query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
listlengths 0
101
| negative_scores
listlengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
|---|---|---|---|---|---|---|
(boolean) scrap_user_logged_in? : Renders "tiddler status msg" or "tiddler msg" if not logged in
|
def scrap_user_logged_in?(error_in_empty_tiddler = false)
if !logged_in?
message = '<h3>'+'Please login first'[:error_login_first] + '</h3>'
respond_to do |format|
format.html { flash[:error] = message and render :action => 'create', :status => :unauthorized and return false }
format.js {
if error_in_empty_tiddler
render :partial => "layouts/message", :status => :unauthorized, :locals => {:message => message}, :layout => false
else
render :partial => "layouts/status_message", :status => :unauthorized, :locals => {:message => message}, :layout => false
end
return false
}
format.xml { return false }
end
else
return true
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def check_logged_in\n service_response = success\n render_api_response(service_response)\n end",
"def check_status\n if @current_user.blank?\n render :text => {\"continue\" => false}.to_json\n return\n end\n \n render :text => @current_user.real_time_notifications.to_json\n end",
"def logged_in?\n # Are we on the login page already?\n if username_field.present?\n # Yes! So, we're not logged in...\n false\n # No, the Kuali header is showing...\n elsif login_info_div.present?\n # So, is the user currently listed as logged in?\n return login_info_div.text.include? @user_name\n else # We're on some page that has no Kuali header, so...\n begin\n # We'll assume that the portal window exists, and go to it.\n on(BasePage).return_to_portal\n # Oops. Apparently there's no portal window, so...\n rescue\n # We'll close any extra tabs/windows\n on(BasePage).close_children if @browser.windows.size > 1\n # And make sure that we're using the \"parent\" window\n @browser.windows[0].use\n end\n # Now that things are hopefully in a clean state, we'll start\n # the process again...\n logged_in?\n end\n end",
"def logged_in_user\n unless logged_in?\n puts \"not logged in\"\n end\n end",
"def is_blogger_logged_in?\n !!current_blogger \n end",
"def logged_in?\n !!logged_user\n end",
"def logged_in?\n !!(cookie && (cookie =~ /reddit_session/) != nil)\n end",
"def check_login_status\n # If user hasn't logged in\n unless logged_in?\n # Show reminder message\n flash[:info] = \"Log in to continue.\"\n\n # Redirect user to login page\n redirect_to login_url\n end\n end",
"def is_logged?\n if current_user.blank?\n respond_to do |format|\n format.html {\n redirect_to login_url\n }\n format.js {\n push_notice_message t(:please_login)\n render :update do |page|\n page.call \"system_message\", system_messages\n end\n }\n end\n end\n end",
"def logged_in?\n !!logged_in_user \n end",
"def require_logged_in\n (render json: [\"You need to be logged in for this.\"], status: 401) unless logged_in?\n end",
"def login_status\n if !in_frame?\n if !logged_in?\n return link_to('Login', authenticated_system_login_path, :target => '_top').html_safe\n else\n return link_to(\"Logout #{current_user.login}\", authenticated_system_logout_path, :target => '_top').html_safe\n end\n else\n return ''\n end\n end",
"def check_login\n head :forbidden unless self.current_user\n end",
"def is_logged_in?\n if logged_in? && current_user\n render json: {\n logged_in: true,\n user: current_user\n }\n else\n render json: {\n logged_in: false,\n message: 'no such user'\n }\n end\n end",
"def get_user_logged_in\n\t\tif current_user != nil\n\t\t\treturn 'Currently signed in as: ' + current_user.forename + ' ' + current_user.surname\n\t\telse\n\t\t\treturn 'You are not logged in!'\n\t\tend\n\tend",
"def user_logged_in\n if session[:just_logged_in] && !current_user.is_admin \n gon.display_login_popup = true\n \n session[:just_logged_in] = false\n end\n end",
"def show_status(msg)\n response = \"DJ announcements: #{@dj_state ? 'enabled' : 'disabled'}\"\n\n if @dj_state\n response << \" DJ tweets: #{@dj_tweeting ? 'enabled' : 'disabled'}\"\n end\n\n msg.reply response\n end",
"def is_logged_in?(user)\n return false if is_logged_out?\n\n unless user_dropdown.present?\n @config.screenshot!(\"is_logged_in_\" + Time.now.to_s)\n #byebug\n raise \"page is not in a dom state able to determine logged in user. Please check your workflow.\"\n end\n\n @profile_page = Pages::Community::Profile.new(@config)\n @profile_page.goto_profile\n\n @profile_page.user_name == user.username\n end",
"def logged_in\n\t \t!current_user.nil?\n\t end",
"def require_logged_in_user\n if !current_user\n head 403\n end\n end",
"def logged_in?\n @logged_in ? true : false\n end",
"def logged_in?\n if request.cookies['userid']\n true\n else\n false\n end\n end",
"def logged_in?\n @logged_in == true\n end",
"def logged_in?\n @logged_in == true\n end",
"def logged_in?\n !!logged_in_user\n end",
"def logged_in?\n !!logged_in_user\n end",
"def logged_in?\n hubssolib_logged_in?\n end",
"def logged_in?\n current_user != :false \n end",
"def logged_in?\n !!session[:logged_in]\n end",
"def logged_in\n logged_in_user != nil\n end",
"def logged_in?\n @logged_in\n end",
"def logged_in?\n @logged_in\n end",
"def logged_in?\n @logged_in\n end",
"def logged_in?\n @logged_in\n end",
"def logged_in?\n current_<%= singular_name %> != :false\n end",
"def logged_in_user\n unless logged_in?\n respond_with_error \"This action requires that you be logged in.\", \n login_path\n end\n end",
"def check_for_human\n session[:previous_protocol] = request.protocol\n \n # If this is a \"checkid_setup\" request, make sure we have a logged in user\n if openid_request.is_a?(OpenID::Server::CheckIDRequest) && openid_request.mode == 'checkid_setup'\n return true if current_user\n \n openid_login_needed\n else\n return true\n end\n end",
"def user_is_logged_in?\n !!session[:user_id]\n end",
"def logged_in\n !!current_user\n end",
"def user_is_logged_in?\n !!session[:user_id]\n end",
"def logged_in?\n current_user != :false\n end",
"def logged_in?\n current_user != :false\n end",
"def logged_in?\n\t\t !!current_user\n end",
"def logged_in?\r\n current_user != :false\r\n end",
"def user_logged?\n !session[:user_id].nil?\n end",
"def logged_in?\n\t\t!!current_user\n end",
"def login_status\n if !logged_in?\n return link_to 'Login', authenticated_system_login_path\n else\n s = \"#{current_user.login}\"\n if self.current_user.shibboleth_id.blank?\n s << \" (#{link_to 'Associate to UVa account', shibboleth_url(:protocol => 'https')}) | \"\n else\n s << ' | '\n end\n s << \"#{link_to('Logout', authenticated_system_logout_path)} | \"\n s << \"#{link_to 'Admin', authenticated_system_root_path} | \" if authorized? hash_for_authenticated_system_root_path\n s\n end\n end",
"def logged_in?\n \trespond_to do |format|\n\t format.html { session[:currentUser].present? } \n\t format.json {\n\n begin\n if (not params[:token].nil?)\n @token = Token.where(:Value => params[:token]).first\n else\n @theparameters = JSON.parse(request.raw_post)\n @token = Token.where(:Value => @theparameters.fetch(\"token\")).first\n end\n @userr = @token.user\n\n if is_admin(@userr)\n return true\n \n elsif not @userr.events.select{ |ev| not ev.Completed and ev.EventDate.to_date + 2 >= Date.today}.empty?\n return true\n else\n raise Exception, \"There are no events currently active for this user.\"\n end\n rescue Exception => e\n raise Exception, \"can't find the user\"\n end\n }\n\t end\n end",
"def check_if_user\n render text: \"Fuck you user\", status: 403 unless current_user.id == @book.user_id || current_user.rank_id == 2\n end",
"def is_logged_in\n #since these are also marked as helper methods, they are availalble in not just all ctronollers (cuz they inherit from appc ontroler) but also avialble to views\n\n (session[:user_id] && session[:user_id].present? ) ? true : false\n end",
"def logged_in?\n !!current_donor\n end",
"def isLoggedIn?\n if session[:loggedIn] \n true \n else\n store_url\n false\n end\t\n end",
"def logged_in?\n not current_client.nil?\n end",
"def user_is_logged_in()\n user = get_user()\n if user != nil\n true\n else\n false\n end\n end",
"def logged_in\n current_user != nil\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def appHelper_ifUserLogged\n if session[:user_name] \n return true\n end\n return false\n end",
"def logged_in?\n !loggedin_user.nil?\n end",
"def logged_in?\n !!link_to_account_detail_page\n end",
"def is_logged_in?\n\t\t!! current_user\n\tend",
"def logged_in?\n \t#devuelve un booleano para saber si hay un usuario loggeado o no. \n \t#para eso sirven los dos signos de exclamacion !!\n \t!!current_user\n end",
"def loggedIn?\n return @logged_in\n end",
"def logged_in? \r\n logger.info(\"Authentication::Logged In::sesssion:---- #{session}\")\r\n if session[:userEmail].blank?\r\n invalid_session = I18n.t(\"message.no_session\") \r\n smv_status = {\r\n :statusCode => -1,\r\n :value => '', \r\n :msg => \"#{invalid_session}\"\r\n }\r\n else\r\n smv_status = {\r\n :statusCode => 0,\r\n :value => '', \r\n :msg => ''\r\n } \r\n end\r\n logger.info(\"Authentication::Logged In::status--- #{smv_status}\")\r\n if smv_status[:statusCode] ==-1\r\n logger.error(\"Authentication::Logged In::status--- #{smv_status}\")\r\n return false\r\n else \r\n return true\r\n end\r\n \r\n end",
"def logged_in?\n\t\t!!current_user\n\tend",
"def logged_in?\n\t\t!!current_user\n\tend",
"def logged_in?\n\t\t!!current_user\n\tend",
"def logged_in?\n\t\t!!current_user\n\tend",
"def logged_in?\n\t\t!!current_user\n\tend",
"def logged_in?\n\t\t!!current_user\n\tend",
"def logged_in?\n\t !!current_user\n\tend",
"def logged_in\n !!session[:user_id]\n end",
"def logged_in?\n @logged_in\n end",
"def logged_in?\n @logged_in\n end",
"def logged_in?\n end",
"def twitter_user?\n return true if is_logged_in? && (session[:request_token] && session[:request_token_secret] && session[:twitter_id])\n end",
"def is_logged_in?\n !session[:user_id].nil?\n end",
"def logged_in?\n !session[:user_id].nil? #&& User.find(session[:user_id]).owns(@current_site)\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\r\n !!current_user\r\n end",
"def logged_in\r\n end",
"def logged_in?\n Watir::Wait.until { logged_in_element.exists? }\n end",
"def is_logged_in\n\t\tif self.controller_name == \"music_rating_services\" || self.controller_name == \"registrations\" || self.controller_name == \"sessions\"\n\t\t\treturn\n\t\telsif current_user == nil\n\t\t\tflash[:notice] = \"You must be logged in to access this feature.\"\n\t\t\tredirect_to root_path\n\t\telse\n\t\t\treturn\n\t\tend\n\tend",
"def logged_in?\n !!current_user #smart way of giving the true if true and not just opposite!\n end",
"def _is_login\n p session[:user]\n session[:user] ? true : false\n end",
"def logged_in?\n current_user != :false\n end",
"def logged_in?\n #Boolean to see if current user is logged in or not\n !!current_user\n end",
"def logged_in?\n !logged_user.nil?\n end",
"def logged_in\n if @current_user\n #this does not return a http status because this is a get request not a post. \n render json:{\n logged_in: true, \n user: @current_user\n }\n else \n render json: {\n logged_in: false\n }\n end\n end",
"def logged_in?\n \t#devuelve un booleano para saber si hay un usuario loggeado o no. \n \t#para eso sirven los dos signos de exclamacion !!\n \t!!usuario_actual\n end",
"def is_logged_in?\n\t\t!session[:user_id].nil?\n\tend",
"def logged_in?\n !!current_user\n end"
] |
[
"0.60554606",
"0.60521966",
"0.6011723",
"0.5927316",
"0.59044623",
"0.5818589",
"0.5803148",
"0.57557356",
"0.5747598",
"0.57026184",
"0.5696085",
"0.56866974",
"0.5606351",
"0.5597603",
"0.5585642",
"0.55816674",
"0.5581013",
"0.5577791",
"0.55694044",
"0.556765",
"0.55545634",
"0.55525255",
"0.55412555",
"0.55412555",
"0.55306345",
"0.55306345",
"0.5527412",
"0.55195606",
"0.5517878",
"0.5516532",
"0.55067945",
"0.55067945",
"0.55067945",
"0.55067945",
"0.5497512",
"0.54954803",
"0.54896873",
"0.5488208",
"0.54864824",
"0.5484956",
"0.5482108",
"0.5482108",
"0.5480884",
"0.54806066",
"0.54700255",
"0.546747",
"0.54602796",
"0.5453372",
"0.5448045",
"0.5439985",
"0.54387224",
"0.54310817",
"0.5430366",
"0.5429751",
"0.5416634",
"0.5411916",
"0.5411916",
"0.5411916",
"0.5411916",
"0.5411916",
"0.5411916",
"0.5411916",
"0.5411916",
"0.5411916",
"0.5411509",
"0.54093677",
"0.5407233",
"0.54051656",
"0.54018",
"0.5399385",
"0.539805",
"0.53973264",
"0.53973264",
"0.53973264",
"0.53973264",
"0.53973264",
"0.53973264",
"0.5380977",
"0.53800744",
"0.5376268",
"0.5376268",
"0.5369222",
"0.5368077",
"0.53664434",
"0.5365493",
"0.53633803",
"0.53633803",
"0.53624237",
"0.5353194",
"0.53497726",
"0.5347824",
"0.53375",
"0.53372514",
"0.5335076",
"0.53331894",
"0.5332484",
"0.53298",
"0.53284913",
"0.5313018",
"0.5310297"
] |
0.7296878
|
0
|
setter and getter methods meow method
|
def meow
puts "meow!"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def getters; end",
"def name\n return @name\nend\ndef age\n return @age\nend\n#setters, allows you to change or set something\ndef name=(name)\n @name = name\nend",
"def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end",
"def set; end",
"def set; end",
"def setter_to_getter(node); end",
"def setter\r\n @setter ||= Field.setter(@name)\r\n end",
"def attribute_to_set; end",
"def method_missing(method, *args, &block)\n \n # The getter\n if @metadata.has_key?(method)\n return attribute_get(method)\n else\n # The setter\n \n if (attribute=method.to_s.match(/(.+)=$/).to_a.last)\n attribute_set(attribute, args.first)\n return\n end\n end\n \n super\n \n end",
"def get()\n \n end",
"def _setter_method\n :\"_#{self[:name]}=\"\n end",
"def setter_method\n :\"#{self[:name]}=\"\n end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def get(object); end",
"def method_missing(method, *args)\n is_set_method = (method.to_s =~ /(.*)=$/)\n key = is_set_method ? $1 : method.to_s\n # No such key\n super unless @data.has_key?(key)\n # Set\n return @data[key] = args[0] if is_set_method\n # Get\n return @data[key]\n end",
"def to_setter\n\t\t\t\t(to_getter.to_s+\"=\").to_sym\n\t\t\tend",
"def attr; end",
"def setter_method\n :\"#{self[:name]}=\"\n end",
"def method_missing(method_name, *args, &block)\n if method_name.to_s.end_with?('=')\n set_attribute(method_name, *args)\n elsif has_attribute?(method_name)\n get_attribute(method_name)\n else\n super\n end\n end",
"def _setter_method\n :\"_#{self[:name]}=\"\n end",
"def method_missing(method_name, *args, &block)\n # Check if the method missing an \"attr=\" method\n raise unless method_name.to_s.end_with?(\"=\")\n\n setter = method_name\n getter = method_name.to_s.slice(0...-1).to_sym\n instance_var = \"@#{getter}\".to_sym\n\n # attr_writer\n define_singleton_method(setter) do |new_val|\n instance_variable_set(instance_var, new_val)\n end\n\n # attr_reader\n define_singleton_method(getter) { instance_variable_get(instance_var) }\n\n # Ignores all arguments but the first one\n value = args[0]\n\n # Actually sets the value on the instance variable\n send(setter, value)\n rescue MethodMissing\n # Raise error as normal, nothing to see here\n super(method_name, *args, &block)\n end",
"def value!\n raise NotImplementedError\n end",
"def method_missing(method_name, *arguments, &block)\n if /^(?<id>[^=]+)(?<assign>=)?$/ =~ method_name.to_s && attribute = self[id]\n assign ? attribute.send(\"value=\", *arguments) : attribute.value\n else\n super\n end\n end",
"def create_accessors(attribute_name)\n class_eval do\n define_method(attribute_name) do\n odata_entity[property_map[attribute_name]]\n end\n\n define_method(\"#{attribute_name}=\") do |value|\n # unless entity[property_map[attribute_name]] == value\n # send(\"#{attribute_name}_will_change!\") if defined?(::ActiveModel)\n # end\n\n odata_entity[property_map[attribute_name]] = value\n end\n end\n\n nil\n end",
"def create_setter\n @model.class_eval <<-EOS, __FILE__, __LINE__\n #{writer_visibility}\n def #{name}=(value)\n self[#{name.inspect}] = value\n end\n EOS\n end",
"def method_missing(method, *args, &block)\n meth, setter = /^(.*?)(=?)$/.match(method).values_at(1,2)\n if valid_temporal_attribute?(meth.to_sym) \n setter.empty? ? get(meth, *args) : set(meth, *args)\n else super\n end\n end",
"def set(object, value); end",
"def define_setter\n name = @name\n klass.send :define_method, \"#{name}=\" do |unit|\n send \"#{name}_value=\", unit.value\n send \"#{name}_unit=\", unit.unit.to_s\n end\n end",
"def method_missing(meth,*args,&block)\n\n method = meth.to_s # convert method name to a string\n setter = method.end_with?('=') # determine if this is a setter method (which would have the last character \"=\" in the method name)\n attribute = setter ? method.chop : method # the attribute name needs to have the \"=\" removed if it is a setter\n multivalued_field = attribute.end_with?(self.class.multivalued_field_marker) # in place editing fields can end with the special character marker, which will join arrays when return; and split them when setting\n attribute.gsub!(self.class.multivalued_field_marker,'') if multivalued_field\n\n solr_field_config=self.class.field_mappings[attribute.downcase.to_sym] # lookup the solr field for this accessor\n if solr_field_config\n solr_field_name=solr_field_config[:field].downcase\n default_value=solr_field_config[:default] || ''\n if setter # if it is a setter, cache the edit if it has changed\n old_values=self[solr_field_name]\n new_values=args.first\n if !self.class.is_equal?(old_values,new_values,multivalued_field) # we should only cache the edit if it actually changed\n value = (multivalued_field ? new_values.split(\"|\") : new_values) # split the values when setting if this is an in place edit field\n cache_edit({solr_field_name.to_sym=>value})\n return value\n else\n return old_values\n end\n else # if it is a getter, return the value\n value = unsaved_edits[solr_field_name.to_sym] || self[solr_field_name] # get the field value, either from unsaved edits or from solr document\n value = default_value if value.blank?\n return (multivalued_field && value.class == Array ? value.join(\" | \") : value) # return a joined value if this is an in place edit field, otherwise just return the value\n end\n else\n super # we couldn't find any solr fields configured, so just send it to super\n end\n\n end",
"def attr_reader(*)\n end",
"def get\n raise NotImplementedError\n end",
"def method_missing(meth, *args)\n return if not method_missing_hook(meth, args)\n\n d = self.class.structure_field_names\n m = meth.to_s\n\n setter = (m[-1].chr == \"=\") ? true : false\n m = m[0..-2] if setter\n\n puts \"WARNING: assignment to @value as struct field\" if setter and m == \"value\"\n\n if (i = d[m.intern])\n if setter\n self[m.intern] = args[0]\n else\n self[m.intern]\n end\n else\n super(meth, *args)\n end\n end",
"def accessor\n @@accessor ||= nil\n @@accessor\n end",
"def method_missing(setter, value)\n case setter.to_s\n when /^set_(.+)/\n variable_name = \"@#{$1}\"\n if instance_variable_defined?(variable_name)\n instance_variable_set(variable_name, value)\n else\n raise NoMethodError.new(\"Undefined setter '#{setter.to_s}' for #{self.class}.\")\n end\n else\n super\n end\n end",
"def delegate_object_reader_method; end",
"def method_missing(method, *args, &block)\n # proxy to metadata\n return @metadata[method] if @metadata.key?(method)\n\n # return nil if metadata value not set\n return nil if METADATA_IDS.include?(method)\n\n # set value if invoking metadata setter\n id = method[0...-1].intern if method[-1] == '='\n metadata_setter = METADATA_IDS.include?(id) && args.length == 1\n return @metadata[id] = args.first if metadata_setter\n\n # dispatch to default behaviour\n super(method, *args, &block)\n end",
"def result_of_setting; end",
"def attr_accessor(*args)\n attr_reader(*args)\n attr_writer(*args)\n end",
"def age=(value)\n @age = value\nend",
"def age=(value)\n @age = value\nend",
"def value() end",
"def inject_acl_object_getter_setter(method_name)\n inject_acl_object_check(method_name, :read)\n inject_acl_object_check(\"#{method_name}=\",:write)\n end",
"def define_getter\n name = @name\n klass.send :define_method, \"#{name}\" do\n return unless send(\"#{name}?\")\n Unitwise(send(\"#{name}_value\"), send(\"#{name}_unit\"))\n end\n end",
"def method_missing(method, *args)\n if self.respond_to?(method)\n super\n else\n method_name = method.to_s\n \n #set a value for a variable\n if method_name =~ /=$/\n var_name = method_name.gsub('=', '')\n value = args.first\n self[var_name] = value\n \n #retrieve a value\n else\n self[method_name]\n end\n end\n end",
"def method_missing(method, *args)\n # Give OpenStruct a chance to create getters and setters for the\n # corresponding field\n super method, *args\n\n if field = setter?(method)\n # override setter logic to apply any existing sanitization rules before\n # assigning the new value to the field\n override_setter_for(field) if sanitize?(field)\n # uses the newly created setter to set the field's value and apply any\n # existing sanitization rules\n send(method, args[0])\n end\n end",
"def method_missing(name, *args, &block)\n return super unless block.nil? # don't do anything if handed a block\n return super if name =~ /^find_$/ # superclass wants to handle these itself\n \n str = name.to_s\n if str.end_with?('=') # setter method?\n return super unless args.size == 1 # don't do anything unless we have a single argument\n \n # create a new instance method\n base_name = str[0..-2].intern\n _singleton_class.instance_exec(name) do |name|\n define_method(name) do |value|\n @written_md_vars[base_name.to_sym] = (value.nil? ? false : true)\n @metadata[base_name.to_s] = value\n end\n end\n \n # manually set the value now\n @written_md_vars[base_name.to_sym] = (args[0].nil? ? false : true)\n @metadata[base_name.to_s] = args[0]\n else # getter method\n return super unless args.size == 0 # don't override if there are args\n return super unless @metadata.has_key? str\n \n # create a new instance method ready for next time\n _singleton_class.instance_exec(name) do |name|\n define_method(name) do\n @metadata[str]\n end\n end \n \n # return the value from metadata now\n @metadata[str]\n end\n end",
"def __setter__\n \"#{self}=\"\n end",
"def create_setter\n @model.class_eval <<-EOS, __FILE__, __LINE__\n #{writer_visibility}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n end",
"def method_missing(method,val=nil)\n if val.nil?\n get(method)\n else\n method = method.to_s[0..-2].to_sym # get rid of = sign\n set(method,val)\n end\n end",
"def set_accessor\n @accessor = Accessor.find(params[:id])\n end",
"def set_accessor\n @accessor = Accessor.find(params[:id])\n end",
"def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end",
"def type=(v)\n case v\n when :get then super('get')\n when :set then super('set')\n when :result then super('result')\n when :error then super('error')\n else super(nil)\n end\n end",
"def to_getter\n\t\t\t\tis_setter? ? self.to_s[0...-1].to_sym : self\n\t\t\tend",
"def method_missing(method, *args)\n return super if args.length > 1 or block_given?\n if args.length == 0\n return super unless data.has_key?(method)\n get method\n else\n set method, args[0]\n end\n end",
"def attr_accessor_sybling(method)\n attr_reader?(method) ? to_attr_writer(method) : to_attr_reader(method)\n end",
"def get!\n throw NotImplementedError\n end",
"def get!\n throw NotImplementedError\n end",
"def define_getter_for(name)\n define_method(\"#{name}\") do\n instance_variable_get(\"@#{name}\") or\n instance_variable_set(\"@#{name}\", deserialize(name)) or\n instance_variable_set(\"@#{name}\", load_associated(name))\n end\n end",
"def method_missing(m, *args, &block)\n # if they accessed a setter, take the param. The API will throw a 'field does not exist'\n # error if they try pushing fields through that don't belong.\n if m.to_s =~ /^(.+)\\=/ and args[0]\n instance_variable_set(\"@#{$1}\", args[0])\n elsif attrs.keys.include?(m.to_s)\n attrs[m.to_s]\n else\n raise NoMethodError.new(\"NoMethodError\")\n end\n end",
"def setter\n @setter ||= :\"#{@name}=\"\n end",
"def value=(_); end",
"def set(value)\n raise NotImplementedError\n end",
"def test_can_create_bean_and_access_accessor_type_methods\n @madb.set_number1 4\n assert_nil(@madb.name1)\n @madb.name1 = \"Name\"\n assert_equal(\"Name\", @madb.name1)\n assert_equal(4, @madb.number1)\n @madb.number2 = 4\n assert_equal(4, @madb.fetch_number2) \n assert_raise(NoMethodError) { @madb.number2 } \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 return super unless @table.accessors?\n\n name =~ /^(\\w+)(=)?$/\n name_mod, assign = $1, $2\n index = @table.index_for_accessor(name_mod)\n arg_count = assign ? 1 : 0\n\n return super unless index\n\n raise ArgumentError, \"Wrong number of arguments (#{args.size} for #{arg_count})\" if args.size > arg_count\n\n if assign then\n raise \"Coercions not yet implemented\" # todo, coerce data when set\n @data[index] = args.first\n else\n @data[index]\n end\n end",
"def method_missing(name, *args, &block)\n if self.is_dynamic_field?(name)\n if name.to_s.ends_with?('=')\n name = name.to_s.gsub(/\\=$/, '').to_sym\n self.dynamic_setter(name, args.first)\n else\n self.dynamic_getter(name)\n end\n else\n super\n end\n end",
"def initialize\n @attribute = 'truite'\n @accessor = 'pouet'\n end",
"def def_set_accessor(key)\n key = key.to_sym\n raise ArgumentError.new('Invalid entry type: %s' % key) if respond_to?(key)\n metaclass.class_eval do\n define_method(key) {|*val| val.size > 0 ? (self[key] ||= Set.new).merge(val) : self[key] }\n define_method(\"#{key}!\") {|*val| val.size > 0 ? (cache[key] ||= Set.new).merge(val) : cache[key] }\n end\n end",
"def return_obj(key, val)\n singleton_class.class_eval { attr_accessor \"#{key.to_s}\" }\n send(\"#{key.to_s}=\", val)\n end",
"def value; end",
"def value; end",
"def value; end",
"def value; end",
"def value; end",
"def value; end",
"def value; end",
"def value; end",
"def value; end",
"def value; end",
"def value; end",
"def value; end",
"def value; end",
"def value; end",
"def value; end",
"def value; end",
"def value; end",
"def value; end",
"def value; end",
"def value; end",
"def value; end",
"def value; end",
"def proxy=(new_value); end",
"def method_missing(method, *args, &block)\n @value = @value.send method, *args, &block\n self\n end",
"def value=(val); end"
] |
[
"0.7285025",
"0.70624655",
"0.6889987",
"0.67542064",
"0.67542064",
"0.6577742",
"0.6561623",
"0.6499023",
"0.6475793",
"0.64498645",
"0.64399177",
"0.6423702",
"0.641594",
"0.641594",
"0.641594",
"0.641594",
"0.641594",
"0.641594",
"0.641594",
"0.63862824",
"0.63265926",
"0.629953",
"0.62985945",
"0.6280853",
"0.62552464",
"0.6254877",
"0.62517536",
"0.6241738",
"0.6193364",
"0.6171781",
"0.6169664",
"0.6155964",
"0.6150781",
"0.6139602",
"0.613499",
"0.61331826",
"0.6127048",
"0.60961217",
"0.60804266",
"0.6077766",
"0.6069335",
"0.6063544",
"0.606338",
"0.6057657",
"0.60480464",
"0.60480464",
"0.603772",
"0.601134",
"0.6006156",
"0.60030526",
"0.60027534",
"0.59998655",
"0.5986654",
"0.5962506",
"0.59555817",
"0.5948348",
"0.5948348",
"0.5946711",
"0.59461355",
"0.5937238",
"0.59228086",
"0.59222597",
"0.5918128",
"0.5918128",
"0.59164435",
"0.59057987",
"0.58998424",
"0.5899497",
"0.5896818",
"0.58959186",
"0.58893764",
"0.5886228",
"0.5880594",
"0.5878815",
"0.58638227",
"0.585655",
"0.58563626",
"0.58563626",
"0.58563626",
"0.58563626",
"0.58563626",
"0.58563626",
"0.58563626",
"0.58563626",
"0.58563626",
"0.58563626",
"0.58563626",
"0.58563626",
"0.58563626",
"0.58563626",
"0.58563626",
"0.58563626",
"0.58563626",
"0.58563626",
"0.58563626",
"0.58563626",
"0.58563626",
"0.58563626",
"0.5853862",
"0.5834062",
"0.58281374"
] |
0.0
|
-1
|
Returns true if user belongs to the specified role.
|
def role?(role)
if self.role == role.to_s
return true
else
return false
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def has_role?(role)\n current_user && current_user.has_role?(role)\n end",
"def has_role?(role)\n current_user && current_user.has_role?(role)\n end",
"def has_role_for_user(name, role)\n roles = get_roles_for_user(name)\n roles.include?(role)\n end",
"def has_role? user_role\n role_subject && role_subject.has_role?(user_role)\n end",
"def current_user_has_role?(role, node = nil)\n if node\n @current_user.has_role_on?(role, node.new_record? ? node.parent : node)\n else\n @current_user.has_role?(role)\n end\n end",
"def has_role?(role)\n current_user.role.name.gsub(/ /, '').underscore.to_sym.eql?(role) if current_user\n end",
"def has_a_role_of( role )\n return self.role.name == role\n end",
"def user_role?\n roles.any? { |role| Roles.user_roles.include?(role) }\n end",
"def has_role?(role)\n case role\n when :admin then admin?\n when :member then true\n else false\n end\n end",
"def user_has_role?(role, user = nil)\n return true if role.blank?\n user = current_user if user.nil? && defined?(current_user)\n case user\n when User then user.has_role?(role)\n when nil then false\n else raise \"#{__method__}: invalid user: #{user.inspect}\"\n end\n end",
"def role?(role)\n @roles.any? { |r| r.name == role.to_s }\n end",
"def user_in_role(role)\n attrs = session['user_attributes']\n attrs && attrs['role'].split(',').include?(role)\n end",
"def has_role?( role )\n\t\treturn self.role.title.to_sym == role if self.role\n\t\tfalse\n\tend",
"def role?(role)\n return !!self.roles.find_by_name(role.to_s.camelize)\n end",
"def role?(role)\n return !!self.roles.find_by_name(role.to_s.camelize)\n end",
"def role?(role)\n return !!self.roles.find_by_name(role.to_s.camelize)\n end",
"def role?(role)\n return !!self.roles.find_by_name(role.to_s.camelize)\n end",
"def has_role?(the_role)\n\t\tthe_role==self.role ? true : false\n\tend",
"def role?(role)\n roles.any? {|r| r.name.underscore.to_sym == role}\n end",
"def role?(role)\n\t self.role == role\n\tend",
"def role?(role)\n \n if self.is_admin\n return true\n end\n \n self.roles.each do |item|\n if item.name.to_s == role.to_s\n return true\n end\n end\n \n return false\n end",
"def role?(role)\n return !!self.roles.find_by_name(role.to_s)\n end",
"def role?(role)\n return !!self.roles.find_by_name(role.to_s)\n end",
"def role?(role)\n return !!self.roles.find_by_name(role.to_s)\n end",
"def role?(role_id)\r\n return @user.role?(role_id)\r\n end",
"def role?(role)\n roles.include? role\n end",
"def is?(role)\n self.roles.pluck(:name).include?(role.to_s)\n end",
"def has_role?(role)\n role = role.name if role.is_a?(Role)\n self.my_roles.include?(role)\n end",
"def has_role?(role)\n if self.roles.exists? then\n self.roles.find_by(:name => role).present?\n end\n end",
"def has_role(r)\n self.role == r\n end",
"def role?(role)\n roles && roles.include?(role)\n end",
"def role?(role)\n self.role == role.to_s ? true : false\n end",
"def has_role?(role_name)\n return false unless User.roles.keys.include?(role_name)\n r = User.roles[role_name]\n self.role & (1 << r) != 0\n end",
"def role?(role)\n\t self.role.name == role\n end",
"def has_role?( user, object )\n false\n end",
"def has_role?(role)\n list ||= self.roles.map(&:name)\n list.include?(role.to_s)\n end",
"def has_role?(role)\n list ||= self.roles.map(&:name)\n list.include?(role.to_s) || list.include?('admin')\n end",
"def has_role?(role)\n list ||= self.roles.map(&:name)\n list.include?(role.to_s) || list.include?('admin')\n end",
"def has_role?(role)\n list ||= self.roles.map(&:name)\n list.include?(role.to_s) || list.include?('admin')\n end",
"def has_role?(role)\n list ||= self.roles.map(&:name)\n list.include?(role.to_s) || list.include?('admin')\n end",
"def has_role?(role)\n list ||= self.roles.map(&:name)\n list.include?(role.to_s) || list.include?('admin')\n end",
"def has_role?(role)\n list ||= self.roles.map(&:name)\n list.include?(role.to_s) || list.include?('admin')\n end",
"def has_role? (role_name)\n self.role ? self.role.name==(role_name.to_s) : false\n end",
"def has_role? (role_name)\n self.role ? self.role.name==(role_name.to_s) : false\n end",
"def accepts_role?( role_name, user )\n user.has_role? role_name, self\n end",
"def is?(role)\n roles.include?(role.to_s)\n end",
"def has_role?(role) \n return self.roles.include?(role)\n end",
"def has_role(the_role)\n answer = false\n roles = self.roles\n\n roles.each do |role|\n if role.roleable_type == the_role\n answer = true \n end \n end \n return answer\n\n end",
"def role?(role)\n self.role.to_s == role.to_s\n end",
"def role? role\n return !!self.roles.find_by_name(role.to_s)\n end",
"def is_user_in_role (security_user_id, role)\n SecurityUser.joins(:security_users_roles)\n .where(security_users_roles:{role:role})\n .exists?([\"security_users.id=#{security_user_id.to_s}\"])\n end",
"def role?(role)\n roles.pluck(:name).include? role.to_s\n end",
"def has_role?\n Role.roles.include? role.try(:name)\n end",
"def has_role?(name)\n role = Role.find_by_name(name)\n # does the role even exist?\n return false unless role != nil\n # role exists, is the user in it?\n return self.roles.first(:conditions => {:name => name}) != nil\n end",
"def role?(role) \n roles.any? { |r| r.name.underscore.to_sym == role } \n end",
"def is_an?(role)\n roles.include?(role.to_s)\n end",
"def user_role_in?(*roles)\n if (roles - ROLES.keys).length > 0\n raise \"role not defined in application_controller#user_role_in?. It's likely you've mistyped a role symbol.\"\n end\n return false if current_user.nil?\n r = roles.map {|i| ROLES[i]}\n matching_roles = current_user.roles.pluck(:id) & r\n return true if matching_roles.length > 0\n return false\n end",
"def has_role?(role)\n # User master always have access to all\n # Given a nil role or a blank list also retun access granted\n return true if role.blank?\n list ||= self.roles.collect(&:name)\n role.is_a?(Array) ? rolelist = role : rolelist = [role]\n rolelist.any? { |r| list.include?(r.to_s) } || list.include?('admin') || self.master?\n end",
"def role?(authorized_role)\n return false if self.employee.nil?\n return false if self.employee.role.nil?\n self.employee.role.downcase.to_sym == authorized_role\n end",
"def accepts_role( role_name, user )\n user.has_role role_name, self\n end",
"def role?(role)\n self.role == role.to_s\n end",
"def role?(role)\n self.role == role.to_s\n end",
"def has_role?(role_name)\n if user_roles\n roles = user_roles.data.map do |role|\n role.name\n end\n\n roles.include?(role_name)\n end\n end",
"def has_role?(role)\n role_list ||= roles.map(&:name)\n role_list.include?(role.to_s) || role_list.include?(User::JEDI_MASTER_ROLE)\n end",
"def has?(role)\n role_id = (role.class <= Rend::Acl::Role) ? role.id : role.to_s\n roles.has_key?(role_id)\n end",
"def has_role?(role)\n roles.map {|r| r.to_s.downcase}.include?(role.to_s.downcase)\n end",
"def role?(r)\n self.role == r.to_s\n end",
"def role?(role)\n self.role&.name == role\n end",
"def has_member?(user)\n roles.exists?(user_id: user)\n end",
"def is?(role)\n role.to_s.eql?ROLES[type]\n end",
"def has_role?(role_name, resource = nil)\n has_role_helper(role_name, resource)\n end",
"def role?(role)\n \troles.include? role.to_s\n end",
"def user?\n has_role? :user\n end",
"def is?( requested_role )\n self.role == requested_role.to_s\n end",
"def has_role? (role_in)\n # Rails.logger.debug(\"* Models::UserRoles.has_role? self.roles:#{self.roles}, role_in:#{role_in}\")\n (to_array_if_not(self.roles)).index(role_in.to_s) != nil\n end",
"def has_role?(role_name) # rubocop:disable Naming/PredicateName\n role&.name == role_name.to_s\n end",
"def role?(authorized_role)\n return false if employee.nil?\n employee.role.downcase.to_sym == authorized_role\n end",
"def authorized?(role)\n current_user[:role] >= User.roles[role]\n end",
"def role?(role)\n !(roles.map(&:name) & Array(role)).empty?\n end",
"def member_of?(role_name)\n !!self.roles.find_by_name(role_name.to_s)\n end",
"def isRole? jid, role\n\t\tuser = @users.read ['role'], ['jid', jid]\n\t\trole ==\tuser[0]['role']\n\tend",
"def role?(role_to_compare)\n self.role.to_s == role_to_compare.to_s\n end",
"def has_role?(name_or_role)\n if name_or_role.is_a?(Role)\n self.roles.include?(name_or_role)\n else\n self.roles.exists?(name: name_or_role)\n end\n end",
"def has_role?(role)\n # I want to be able to use a symbol\n role = role.to_s\n\n case role\n when 'everyone'\n true\n\n when 'readonly'\n User.current_user.is_readonly?\n\n when 'not_readonly'\n !User.current_user.is_readonly?\n\n else\n # The sub! returns nil if no substition was made\n negated = !!role.sub!(/^not_/,'')\n\n # It's an XOR, cool huh? ;)\n negated ^ User.current_user.in_role?(role)\n end\n end",
"def role?(role_name)\n Array(self[:roles]).include?(role_name)\n end",
"def has_role?(role)\n roles.where(name: Role::NAMES[role]).exists?\n #cached_roles.map(&:name).include?(Role::NAMES[role])\n end",
"def is_user_member? usr\n\t\tif usr\n\t \treturn is_member?(Role.find(usr.role.id))\n\t end\n\t return false\n\tend",
"def is_role(r)\n return r == role\n end",
"def has_role(user_id, role_as_sym)\n if user_id.is_a?(Integer) && role_as_sym.is_a?(Symbol)\n vals = Role.access_values_for(role_as_sym)\n self.roles.where(user_id: user_id, access: vals, active: true).first.present?\n else\n false\n end\n end",
"def has_role(rol)\n r = Role.where(:name => rol).first\n roles.include?(r)\n end",
"def has_role?(role_in_question)\n @_list ||= self.roles.collect(&:name)\n return true if @_list.include?(\"admin\")\n (@_list.include?(role_in_question.to_s) )\n end",
"def has_role?(role_in_question)\n @_list ||= self.roles.collect(&:name)\n return true if @_list.include?(\"admin\")\n (@_list.include?(role_in_question.to_s) )\n end",
"def has_role?(role_in_question)\n @_list ||= self.roles.collect(&:name)\n return true if @_list.include?(\"admin\")\n (@_list.include?(role_in_question.to_s) )\n end",
"def has_role?(role_in_question)\n @_list ||= self.roles.collect(&:name)\n return true if @_list.include?(\"admin\")\n (@_list.include?(role_in_question.to_s) )\n end",
"def has_role?(role_in_question)\n @_list ||= self.roles.collect(&:name)\n return true if @_list.include?(\"admin\")\n (@_list.include?(role_in_question.to_s) )\n end",
"def has_role?(role_in_question)\n @_list ||= self.roles.collect(&:name)\n return true if @_list.include?(\"admin\")\n (@_list.include?(role_in_question.to_s) )\n end",
"def has_any_role? user_role\n role_subject && role_subject.has_any_role?(user_role)\n end",
"def role? role_name\n self.roles.exists? name: role_name.to_s\n end",
"def has_role?(role, context=nil, force_context=nil)\n auth_scope do\n force_context ||= config.force_context\n context = Zuul::Context.parse(context)\n target = target_role(role, context, force_context)\n return false if target.nil?\n return role_subject_for?(target, context) if force_context\n\n return true if role_subject_for?(target, context)\n return true if context.instance? && role_subject_for?(target, Zuul::Context.new(context.klass))\n return true if !context.global? && role_subject_for?(target, Zuul::Context.new)\n return false\n end\n end",
"def has_role?(role_in_question)\n @_roles_list ||= self.roles.collect(&:name)\n return true if @_roles_list.include?(\"super_admin\")\n (@_roles_list.include?(role_in_question.to_s) )\n end"
] |
[
"0.82410175",
"0.82410175",
"0.8199655",
"0.81890464",
"0.81474125",
"0.80992967",
"0.80757785",
"0.806661",
"0.8058675",
"0.8016378",
"0.7938648",
"0.791125",
"0.7890983",
"0.78774905",
"0.78774905",
"0.78774905",
"0.78774905",
"0.78743523",
"0.7873208",
"0.7857661",
"0.7856063",
"0.78454286",
"0.78454286",
"0.78454286",
"0.7839318",
"0.78374773",
"0.7836005",
"0.7833895",
"0.782718",
"0.77913195",
"0.77826977",
"0.7771561",
"0.7769611",
"0.7765123",
"0.77604645",
"0.77529466",
"0.77458054",
"0.77458054",
"0.77458054",
"0.77458054",
"0.77458054",
"0.77458054",
"0.77387905",
"0.77387905",
"0.77345365",
"0.77258354",
"0.77242893",
"0.77121216",
"0.770203",
"0.76989317",
"0.76487166",
"0.7612307",
"0.7600394",
"0.75963193",
"0.7590268",
"0.75844556",
"0.7582789",
"0.7569745",
"0.75694984",
"0.7568448",
"0.7566471",
"0.7566471",
"0.756143",
"0.7555155",
"0.7553193",
"0.7507942",
"0.750251",
"0.74732053",
"0.7455764",
"0.74393153",
"0.74322087",
"0.7432141",
"0.7432046",
"0.7431685",
"0.74261993",
"0.74089396",
"0.7402382",
"0.7366104",
"0.7363661",
"0.73492527",
"0.734812",
"0.7347287",
"0.733365",
"0.733317",
"0.73305106",
"0.72992873",
"0.72966003",
"0.7295229",
"0.72949797",
"0.72848696",
"0.72795415",
"0.72795415",
"0.72795415",
"0.72795415",
"0.72795415",
"0.72795415",
"0.72565496",
"0.72441566",
"0.7242999",
"0.7242002"
] |
0.80308217
|
9
|
Run a command using 'artisan' ==== Parameters +command+ :: command to run
|
def artisan(command, options = {})
raise LaravelNotFoundError unless laravel_exists_in_directory?(@path)
php = `which php`.strip
raise RequiredLibraryMissingError, "php" unless php
command = "#{php} #{@path}/artisan #{command}"
output = `#{command}`
puts output unless options[:quiet]
($?.exitstatus == 0)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def run_command(command)\n `#{command}`\nend",
"def execute(command)\n system(command)\n end",
"def execute_command(command)\n system(command)\n end",
"def run(command)\n @commands_to_run << command\n end",
"def rake(command, options = {})\n execute_command :rake, command, options\n end",
"def execute(command)\n invoke_command(command, nil)\n end",
"def execute(command)\n end",
"def execute_command(command)\n end",
"def execute_command(command)\n end",
"def run(command)\n log_and_exit \"Tried to run: #{command}\" if $testing\n %x(#{command})\n end",
"def run\n raise \"`#{ real_command }' failed\" unless Kernel.system( real_command )\n end",
"def execute(command)\n @command = command\n self\n end",
"def execute(command)\n if valid_command?(command)\n apply_command(command)\n else\n return 'Invalid command.'\n end\n end",
"def run_command(command)\n if command and respond_to?(command)\n send(command)\n else\n log_and_exit read_template('help')\n end\n end",
"def run_command(command)\n return unless command\n command.each do |c|\n com = c.split(/[^a-z0-9]/i).map(&:capitalize).join\n get_command(com)\n end\n end",
"def execute(command)\n system \"#{command}\"\nend",
"def execute(command)\n system \"#{command}\"\nend",
"def run(command)\n display command.join(\" \")\n\n IO.popen(command + [err: %i[child out]]) do |io|\n __display(io.read(128), partial: true, verbose: true) until io.eof?\n end\n\n fail StandardError, \"Error running '#{command.join(\" \")}'\" unless $?.success?\n end",
"def run(cmd)\n runner.run(cmd, shell, nil)\n end",
"def rails_command(command, options = {})\n execute_command :rails, command, options\n end",
"def execute(command)\r\n system \"#{command}\"\r\nend",
"def execute(command)\n system \"#{command}\" # rubocop:disable UnneededInterpolation\nend",
"def execute\n parse_command\n run_command(command)\n end",
"def rake command\n install_deps 'rake', :type => Gem\n @shell.call \"cd #{self.checkout_path} && rake #{command}\"\n end",
"def command(command, *args)\n @shell.command(command, *args)\n end",
"def run_command(command, *args)\n `#{command} #{args.join(' ')} 2>/dev/null`\n end",
"def run_command(command)\n args = command [1..-1]\n case command[0]\n when 'q', 'quit' then @running = false\n when 'help', '?' then puts HELP\n when 'create' then create_object(args)\n when 'add-station' then add_station(args)\n when 'remove-station' then remove_station(args)\n when 'add-wagon' then add_wagon(args)\n when 'remove-wagon' then remove_wagon(args)\n when 'stations' then stations\n when 'assign' then assign(args)\n when 'trains' then trains(args)\n when 'move' then move(args)\n when 'require' then occupy(args)\n when 'take-seat' then take_seat(args)\n when 'wagons' then wagons(args)\n when 'producer' then producer(args)\n else\n raise TUIException, \"There is no command '#{command[0]}'\"\n end\n end",
"def out(command)\n assert(system(command))\n end",
"def run_command(command)\n ENV['THOR_SHELL'] = 'HTML'\n FileUtils.cd ENV['TM_PROJECT_DIRECTORY'] do\n begin\n EY::CLI.start([command])\n rescue EY::Error => e\n EY.ui.print_exception(e)\n exit(1)\n rescue Interrupt => e\n puts\n EY.ui.print_exception(e)\n EY.ui.say(\"Quitting...\")\n exit(1)\n end\n end\n end",
"def `(cmd) #`\n\t\tRAILS_DEFAULT_LOGGER.debug(\"Running #{cmd}\")\n\t\tKernel.`(cmd) #`\n\tend",
"def run(command, *args)\n send(command, *args)\n end",
"def cmd(command)\n\t\tbegin\n\t\t\t`#{command}`\n\t\trescue Exception => e\n\t\t\te.to_s\n\t\tend\n\tend",
"def execute(*command)\n UI.say \"=> #{command.join(' ')}\".color(:green)\n success = system(*command)\n unless success\n UI.error(command.join(' '))\n exit 1\n end\n end",
"def run(command, log_action = true)\r\n log 'executing', \"#{command} from #{Dir.pwd}\" if log_action\r\n `#{command}`\r\n end",
"def execute_command(command)\n raw(*command)\n end",
"def execute(command, argument)\n command = canonical_command(command)\n method = \"cmd_#{command}\"\n @commands[command.downcase].send(method, argument)\n end",
"def execute(command) # rubocop:disable Lint/UnusedMethodArgument\n end",
"def run(*command)\n IO.popen(command) { |io| io.read.strip }\n end",
"def execute_command(command)\n @stdin.puts command\n end",
"def execute(cmd)\n @log.info(\"Executing command '#{cmd}'...\")\n Kernel.system(cmd)\n end",
"def exec(command)\n ensure_mode(:privileged)\n run(command)\n end",
"def cmd(command, *arguments) Command.send(command.to_sym, *arguments) end",
"def rake(command, options = {})\r\n log 'rake', command\r\n env = options[:env] || 'development'\r\n sudo = options[:sudo] ? 'sudo ' : ''\r\n in_root { run(\"#{sudo}rake #{command} RAILS_ENV=#{env}\", false) }\r\n end",
"def rake(command, options = {})\n log 'rake', command\n env = options[:env] || 'development'\n sudo = options[:sudo] ? 'sudo ' : ''\n in_root { run(\"#{sudo}rake #{command} RAILS_ENV=#{env}\", false) }\n end",
"def run_karabiner_command(command)\n check_command(\"#{karabiner_executable_path} #{command}\")\n end",
"def run_cmd(cmd)\n\t\tconsole.run_single(cmd)\n\tend",
"def run_cmd(cmd)\n\t\tconsole.run_single(cmd)\n\tend",
"def env_command(command) # rubocop:disable Lint/UnusedMethodArgument\n end",
"def execute command\n if command_exists?\n eval \"Command::#{command}.new.init\"\n else\n raise UnknownCommand, \"Error: unknown command '#{command.downcase.to_s}'.\\nTry --help for help.\"\n end\n end",
"def execute command\n log command\n system(command) unless @options[:test]\n end",
"def runner ( command, opts)\n puts(\"Info: Running: #{command}\") if (opts[:verbrose])\n start_time = Time.now\n system(command)\n puts(\"Info: Done in #{(Time.now - start_time)/60.0}m.\") if (opts[:verbrose])\nend",
"def runner ( command, opts)\n puts(\"Info: Running: #{command}\") if (opts[:verbrose])\n start_time = Time.now\n system(command)\n puts(\"Info: Done in #{(Time.now - start_time)/60.0}m.\") if (opts[:verbrose])\nend",
"def runner ( command, opts)\n puts(\"Info: Running: #{command}\") if (opts[:verbrose])\n start_time = Time.now\n system(command)\n puts(\"Info: Done in #{(Time.now - start_time)/60.0}m.\") if (opts[:verbrose])\nend",
"def runner ( command, opts)\n puts(\"Info: Running: #{command}\") if (opts[:verbrose])\n start_time = Time.now\n system(command)\n puts(\"Info: Done in #{(Time.now - start_time)/60.0}m.\") if (opts[:verbrose])\nend",
"def run(command)\n puts command\n `#{command}`.tap &method(:puts)\nend",
"def run_command cmd\n # http://whynotwiki.com/Ruby_/_Process_management#What_happens_to_standard_error_.28stderr.29.3F\n require 'canis/core/util/viewer'\n begin\n res = `#{cmd} 2>&1`\n rescue => ex\n res = ex.to_s\n res << ex.backtrace.join(\"\\n\") \n end\n res.gsub!(\"\\t\",\" \")\n # Earlier close key was ENTER but we need that to execute or fire\n Canis::Viewer.view(res.split(\"\\n\"), :close_key => 'q', :title => \"<q> to close, M-l M-h to scroll\")\n end",
"def run(cmd)\n log cmd\n system(cmd) or fail \"Command Failed: [#{cmd}]\"\n end",
"def run(cmd)\n log cmd\n system(cmd) or fail \"Command Failed: [#{cmd}]\"\n end",
"def run(cmd)\n puts(cmd)\n system(cmd)\nend",
"def run( *cmd )\n\t\t\tcmd.flatten!\n\n\t\t\tif cmd.length > 1\n\t\t\t\ttrace( \"Running:\", quotelist(*cmd) )\n\t\t\telse\n\t\t\t\ttrace( \"Running:\", cmd )\n\t\t\tend\n\n\t\t\tif Rake.application.options.dryrun\n\t\t\t\tlog \"(dry run mode)\"\n\t\t\telse\n\t\t\t\tsystem( *cmd )\n\t\t\t\tunless $?.success?\n\t\t\t\t\tfail \"Command failed: [%s]\" % [cmd.join(' ')]\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def run_built_in(command)\n _, command, *args = command.strip.split(/\\s+/)\n case command\n when 'user' then user_command(args)\n when 'reset' then reset_command(args)\n when 'version' then version_command(args)\n when 'help' then help_command(args)\n else '-> usage: v user|reset|version|help'\n end\n end",
"def execute_command(command)\n %x{#{command}}\n end",
"def exec(command)\n @commands << %{write text \"#{command}\"}\n end",
"def execute(command)\n sh('-c',command)\n end",
"def run_command(cmd)\n if config[:simulate]\n puts_and_logs \" - Simulate running \\\"#{cmd}\\\"\"\n return\n end\n if config[:debug]\n if config[:verbose]\n puts_and_logs \" - Running \\\"#{cmd}\\\"\"\n else\n logger.debug \" - Running \\\"#{cmd}\\\"\"\n end\n system cmd\n return\n end\n puts_and_logs \" - Running \\\"#{cmd}\\\"\" if config[:verbose]\n system(cmd + ' > /dev/null 2>&1')\n\n end",
"def run_as_system(command)\n Strainer.ui.debug 'Using %x'\n %x{#{command}}\n end",
"def run\n raise Error, \"Unknown command `#{command_name}`\"\n end",
"def run!\n if self.class.commands.include?(@command)\n run_command\n elsif @command.nil?\n puts \"Command required\"\n puts @parser\n exit 1\n else\n abort \"Unknown command: #{@command}. Use one of #{self.class.commands.join(', ')}\"\n end\n end",
"def cmd(cmd)\n puts cmd\n system cmd\n end",
"def run_app(command, arguments)\nend",
"def rake(*args) run_command('rake', args) end",
"def run(command)\n\traise \"non-zero exit status: `#{command}`\" if !system(\"cd #{$root} && #{command}\")\nend",
"def call(*command); end",
"def run_installer_command(cmd)\n `#{cmd}`\n end",
"def command(command)\n IO.pipe do |read_io, write_io|\n pid = Process.spawn(command, :in => \"/dev/tty\", :out => write_io)\n Process.wait(pid)\n raise \"Command failed: #{command.inspect}\" unless $?.success?\n write_io.close\n read_io.read\n end\n end",
"def shell(cmd)\n `#{cmd}`\n end",
"def shell(cmd)\n `#{cmd}`\n end",
"def run( command, *args )\n\t\tcommand ||= 'help'\n\t\tcmd_method = nil\n\n\t\tbegin\n\t\t\tcmd_method = self.method( \"#{command}_command\" )\n\t\trescue NoMethodError => err\n\t\t\terror \"No such command\"\n\t\t\texit :usage\n\t\tend\n\n\t\tcmd_method.call( *args )\n\tend",
"def run(command)\n execute command\n listen_user\n end",
"def run_command_on(cmd, instance=nil) \n Kernel.system \"#{run_command_on_command(cmd, instance)}\" if instance\n end",
"def command(command, *args, &block)\n @output.print(command, args.size > 0 ? ' ' : '', args.join(' '), \"\\r\\n\")\n if block\n if @pipeline\n @pipeline << block\n else\n block.call\n end\n end\n end",
"def run command\n # unless command\n # command = \" \\\"#{@args.join(\"\\\" \\\"\")}\\\"\" if args.any?\n # @switches.each{ |opt| command += \" --#{opt.to_s}\" }\n # @options.each { |opt, val| command += \" --#{opt.to_s} \\\"#{val}\\\"\" }\n # end\n return if command.nil? || command.strip.empty?\n command += \" 2>&1\"\n command += \" >/dev/null\" unless @capture || @output\n\n output = `#{self.path} #{command}`.strip\n puts output.gsub(/^/, \" -- \") if @output\n\n self.reset_for_next_command\n output\n end",
"def run(cmd)\n puts cmd\n system cmd\nend",
"def run(command, *arguments)\n expanded_command = build_cli_call(command, arguments)\n status, out, err = run_command(expanded_command)\n Result.new(expanded_command, status, out, err)\n end",
"def run(command)\n\t\t\t\tcase command[0]\n\t\t\t\t# ** Map functionality\n\t\t\t\twhen 'add_fun'\n\t\t\t\t\t@mapper.add_function command[1]; true\n\t\t\t\twhen 'add_lib'\n\t\t\t\t\t@mapper.add_libraries command[1]\n\t\t\t\t\t@reducer.add_libraries command[1]; true\n\t\t\t\twhen 'map_doc'\n\t\t\t\t\t@mapper.map command[1]\n\t\t\t\twhen 'reset'\n\t\t\t\t\t@config = command[1] || {}\n\t\t\t\t\t@mapper = Mapper.new(self); true\n\t\t\t\t\n\t\t\t\t# ** Reduce functionality\n\t\t\t\twhen 'reduce'\n\t\t\t\t\t@reducer.reduce command[1], command[2]\n\t\t\t\twhen 'rereduce'\n\t\t\t\t\t@reducer.rereduce command[1], command[2]\n\t\t\t\t\n\t\t\t\t# ** Design document functionality\n\t\t\t\twhen 'ddoc'\n\t\t\t\t\tif command[1] == 'new'\n\t\t\t\t\t\t@designer.create(command[2], command[3]); true\n\t\t\t\t\telse\n\t\t\t\t\t\t@designer.run(command[1], command[2], command[3])\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\trescue Exception => exception\n\t\t\t\terror_for_exception(exception)\n\t\t\tend",
"def run_command(cmd, options={})\n FudgeMatchers::Run.new cmd, options\nend",
"def execute_command(command, input)\n command.new(self, input).process\n end",
"def run_silently(command, *arguments)\n run_command_silently build_cli_call(command, arguments)\n end",
"def exec(cmd)\n puts cmd\n `#{cmd}`\nend",
"def invoke(command, params={})\n command_string = compile_command(command, params)\n output_command(command_string)\n execute(command_string, params)\n end",
"def executeCommand(command)\n\t#Building...\n\tcommand = buildCommand(command)\n\t\n\tif $verbose\n\t\t#Logging...\n\t\t#puts \"Executing: \" + command\n\t\tejabberdLog(\"Executing (#{command})\")\n\tend\n\n\t#Executing...\n\toutput = %x[#{command}]\n\treturn output\nend",
"def run_command(*command)\n print_command command\n result = system *command\n if result.nil?\n puts \"Failed to run command.\"\n exit 255\n elsif !result\n exit $?.exitstatus\n end\nend",
"def run(command, *args)\n sh \"#{command} #{args.join(' ')}\"\nend",
"def run_command(command)\n time_start = Time.now\n begin\n result = `#{ command }`\n rescue\n result = 'Get an error when try to run command'\n end\n time_finished = Time.now\n duration = time_finished - time_start\n { start_time: time_start, finished_time: time_finished, duration: duration, result: result }\n end",
"def run(cmd)\n result = `#{cmd}`\n raise Castanaut::Exceptions::ExternalActionError if $?.exitstatus > 0\n result\n end",
"def _runCommand(command)\n pid = Process.spawn command\n #pid = fork {exec command}\n Process.waitpid(pid)\n end",
"def call(argv)\n generate_commands.run(argv)\n end",
"def run(command, &callback)\n if reset?(command)\n callback.call(run_built_in(command))\n else\n @commands.push({command: command.strip, callback: callback})\n end\n end",
"def run\n _cmd = built_in_command( options[:args] )\n _cmd ||= options[:command] ? CommandRunner.new(options[:command]) : 0\n if _cmd.class == CommandRunner\n _cmd.run do |item|\n puts \"%s:\\n %s\\n\\n\" % [ item.class, item.desc ] if item.is_a?(UseCase) && ENV['ENVIRONMENT'] != 'test'\n end\n else\n _cmd\n end\n end",
"def heroku(command)\n s = system(\"GEM_HOME='' BUNDLE_GEMFILE='' GEM_PATH='' RUBYOPT='' /usr/local/heroku/bin/heroku #{command}\")\nend"
] |
[
"0.70448864",
"0.69320637",
"0.68787193",
"0.67727023",
"0.67011297",
"0.6612411",
"0.65893614",
"0.6586468",
"0.6586468",
"0.6576517",
"0.65408194",
"0.6538971",
"0.6479874",
"0.64602405",
"0.645924",
"0.64582384",
"0.64582384",
"0.64547336",
"0.64460385",
"0.64445966",
"0.644124",
"0.64399827",
"0.64313686",
"0.64282054",
"0.64254606",
"0.6356648",
"0.634763",
"0.6347624",
"0.6334425",
"0.63306546",
"0.63297164",
"0.63292587",
"0.63181543",
"0.62909204",
"0.62839895",
"0.62779766",
"0.62610006",
"0.6254871",
"0.6211616",
"0.6198908",
"0.619738",
"0.6183638",
"0.61835355",
"0.6161923",
"0.6153503",
"0.61521757",
"0.61521757",
"0.6127741",
"0.6125512",
"0.6120846",
"0.6118442",
"0.6118442",
"0.6118442",
"0.6118442",
"0.6117984",
"0.6109867",
"0.61005336",
"0.61005336",
"0.6095984",
"0.60957664",
"0.60789496",
"0.60780674",
"0.6070958",
"0.60698575",
"0.6067084",
"0.6043418",
"0.6036677",
"0.6013905",
"0.6005639",
"0.6000347",
"0.59825665",
"0.5981382",
"0.5980056",
"0.5938699",
"0.5934554",
"0.5906125",
"0.5906125",
"0.5899758",
"0.5886573",
"0.5883254",
"0.58757895",
"0.587153",
"0.58676887",
"0.5866241",
"0.58570373",
"0.58514416",
"0.5845282",
"0.583536",
"0.58305436",
"0.5814866",
"0.58070195",
"0.5805395",
"0.5798214",
"0.579182",
"0.579177",
"0.57843333",
"0.5781909",
"0.57803947",
"0.5779235",
"0.5775331"
] |
0.76547575
|
0
|
Return the path to the local cache directory for a given Source ==== Return +string+ :: Filepath to the local cache directory
|
def cache_directory
File.join(CacheFolder, make_md5(@source))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def local_path\n src = if %i(direct repo).include?(new_resource.source)\n package_metadata[:url]\n else\n new_resource.source.to_s\n end\n ::File.join(Chef::Config[:file_cache_path], ::File.basename(src))\n end",
"def cache_repository_path\n File.absolute_path(File.join(Rails.root, 'cache', cached_directory))\n end",
"def get_cache_base_path\n if @settings.cache.use_system_temp_dir\n path = Dir::tmpdir\n else\n path = @settings.cache.custom_cache_dir\n end\n return File.join(path, @settings.cache.name)\n end",
"def download_path\n ::File.join(Chef::Config[:file_cache_path],\n ::File.basename(source_path))\n end",
"def cache_dir\n return pretty_path(File.join(Dir::COMMON_APPDATA, 'RightScale', 'cache'))\n end",
"def cache_path\n Pathname.new(File.expand_path(File.join(ChefCLI::Helpers.package_home, \"cache\")))\n .join(\".cache\", \"git\", Digest::SHA1.hexdigest(uri))\n end",
"def cache_dir; end",
"def cache_dir; end",
"def cache_dir\n '/var/cache'\n end",
"def cache_dir\n '/var/cache'\n end",
"def file_path\n Dir.glob(config.cache).first || File.join(File.dirname(config.cache),\n File.basename(config.cache).gsub(/_.+\\.txt/, '_0.txt'))\n end",
"def cache_dir\n @cache_dir ||= File.join base_dir, \"cache\"\n end",
"def cache_directory\n @options[:cache_directory]\n end",
"def local_cache_path\n File.join(tmp_path, 'bundle_cache')\n end",
"def source_path\n Pathname.new(config[:source_path])\n end",
"def source_path\n src = File.join *[\n sandbox.path,\n ('..' if sandbox.multiruby?),\n 'src'\n ].compact\n\n FileUtils.mkdir_p src\n\n src\n end",
"def cache_dir(arg=nil)\n set_or_return(\n :cache_dir,\n arg,\n :kind_of => [ String ]\n )\n end",
"def cache_file_path\n raise IOError.new 'Write permission is required for cache directory' unless File.writable?(@args[:cache_directory])\n \"#{@args[:cache_directory]}/#{Digest::SHA1.hexdigest((@args[:cache_ref] || @path).to_s + size.to_s + last_modified.to_s)}.cache\"\n end",
"def repo_cache_dir\n File.join(cached_repos_dir, repository_directory)\n end",
"def source_path\n Pathname.new(self.config[:source_path])\n end",
"def file_cache_dir\n @file_cache_dir || FileHelper.tmpdir\n end",
"def local_cache_dir=(dir_path)\n @local_cache_dir = File.expand_path(dir_path)\n @relative_local_path = \"#{@href_path}#{@filename}\"\n @local_path = \"#{@local_cache_dir}/#{@relative_local_path}\"\n end",
"def cache_path\n File.join @path, 'cache.ri'\n end",
"def cache_path\n @cache_path ||= File.join(\"\", \"gko\", \"cache\", \"#{self.host}\")\n end",
"def get_local_dir\n return @resource[:local_dir]\n end",
"def source_path\n source[:path]\n end",
"def cachedir\n if Gem.win_platform?\n File.join(ENV['LOCALAPPDATA'], 'PDK', 'cache')\n else\n File.join(Dir.home, '.pdk', 'cache')\n end\n end",
"def cachedir\n if Gem.win_platform?\n File.join(PDK::Util::Env['LOCALAPPDATA'], 'PDK', 'cache')\n else\n File.join(Dir.home, '.pdk', 'cache')\n end\n end",
"def cache_dir\n find /^Writeable cache dir: (.*)$/\n end",
"def downloaded_file\n filename = source[:cached_name] if source[:cached_name]\n filename ||= File.basename(source[:url], \"?*\")\n File.join(Config.cache_dir, filename)\n end",
"def cache_root\n dataroot.join('cache').tap { |p| p.mkpath unless p.exist? }\n end",
"def cache_path\n home = ENV['HOME']!=nil ? ENV['HOME'] : ''\n return \"#{home}/.jx/repository/#{to_s}/\"\n end",
"def cache_dir\n \"/tmp/cache/#{model.class.to_s.underscore}\"\n end",
"def prepare_cache_path\n cache = Tempfile.new(\"\", Global.file_cache_directory)\n path = cache.path\n cache.close(true)\n return path\n end",
"def cached_location\n dlt = (download_type) ? download_type : 'default'\n Drupid.cache_path + self.class.to_s.split(/::/).last + extended_name + dlt + name\n end",
"def source_dir\n @_source_dir ||= File.join(working_dir, 'src')\n create_if_missing(@_source_dir)\n @_source_dir\n end",
"def source_dir\n @_source_dir ||= File.join(working_dir, 'src')\n create_if_missing(@_source_dir)\n @_source_dir\n end",
"def source_dir\n @_source_dir ||= File.join(working_dir, 'src')\n create_if_missing(@_source_dir)\n @_source_dir\n end",
"def source_path\n File.expand_path source unless source.nil?\n end",
"def cache_directory\n Rails.root.join('tmp', 'export')\n end",
"def cache_file_path\n File.join @homepath, 'cache'\n end",
"def directory_cache(digest)\n location = Global.directory_package_cache_directory + digest\n return location.exist? ? location : nil\n end",
"def cache_dir\n Padrino.root(\"tmp\")\n end",
"def cache_dir\n Padrino.root(\"tmp\")\n end",
"def source_dir\n @config.source_dir\n end",
"def revision_cache_dir\n File.join(shared_cache_dir,revision.to_s)\n end",
"def workdir\n result = base.join('cache')\n result.mkpath\n result\n end",
"def remote_cache_path\n File.join(shared_path, 'bundle', 'cache')\n end",
"def local_source\n @local_source ||= File.join( build_dir, File.basename( upstream_source.path ) )\n end",
"def pathDistSource\n\tpathDist + \"source/\"\nend",
"def folder\n @folder ||= File.dirname(source)\n end",
"def source_path\n sp = []\n\n Tml.session.block_options_queue.each do |opts|\n next unless hash_value(opts, :source)\n sp << hash_value(opts, :source)\n end\n\n sp = sp.reverse\n sp.unshift(Tml.session.current_source)\n\n sp.join(Tml.config.source_separator)\n end",
"def cached_file(source, checksum = nil)\n if source =~ %r{^(file|ftp|http|https):\\/\\/}\n uri = as_uri(source)\n cache_file_path = \"#{Chef::Config[:file_cache_path]}/#{::File.basename(::CGI.unescape(uri.path))}\"\n Chef::Log.debug(\"Caching a copy of file #{source} at #{cache_file_path}\")\n\n remote_file cache_file_path do\n source source\n backup false\n checksum checksum unless checksum.nil?\n end\n else\n cache_file_path = source\n end\n\n Chef::Util::PathHelper.cleanpath(cache_file_path)\n end",
"def shared_cache_dir\n configuration[:shared_cache_dir] || File.join(shared_path,'shared_repository_caches')\n end",
"def cache_file_list_path\n File.join config.config_dir, 'file_cache'\n end",
"def _local_source(path)\n existent = ::Dir[\"#{ENV['DEV_HOME']}/*/{piktur/#{path},gems/#{path},#{path}}\"][0]\n Pathname(existent)\n end",
"def emr_local_path_for_distributed_cache_file(file)\n # NOTE this needs to be *appended* to the property mapred.local.dir\n if file =~ /^s3n?:\\/\\//\n # EMR\n \"/taskTracker/archive/#{file.gsub(/^s3n?:\\/\\//, \"\")}\"\n else\n # Local\n file\n end\n end",
"def cache_root\n \n unless @cache_root \n \n tmp_dir = sensible_os? ? '/tmp' : ENV['TEMP']\n @cache_root = File.join(tmp_dir, 'skmm-cache')\n\n end\n\n return @cache_root\n\n end",
"def file_cache_path\n Chef::Config[:file_cache_path]\n end",
"def class_cache_file_path\n File.join cache_file_path, @class_cache_name\n end",
"def cached_directory\n case branch\n when 'master'\n Digest::MD5.hexdigest(git_url)[0..6]\n else\n Digest::MD5.hexdigest(git_url + branch)[0..6]\n end\n end",
"def cache_dir(uri)\n File.join @dir, \"#{uri.host}%#{uri.port}\", File.dirname(uri.path)\n end",
"def cacheFileName(ni)\n @directory_name + \"/\" + ni.path\nend",
"def compute_source_path(source, ext)\n asset_for(source, ext)\n end",
"def workfile_path(for_file = original_filename)\n # To be safe, keep this directory outside of the the cache directory\n # because calling CarrierWave.clean_cache_files! will remove any files in\n # the cache directory.\n File.join(work_dir, cache_id, version_name.to_s, for_file)\n end",
"def cache_path\n Pathname.new(Berkshelf.berkshelf_path)\n .join('.cache', 'hg', Digest::SHA1.hexdigest(uri))\n end",
"def cache_dir\r\n RUBY_PLATFORM =~ /win32/ ? win32_cache_dir : File.join(File.expand_path(\"~\"), \".slideshow\")\r\n end",
"def acl_cache_path\n @acl_cache_path ||= if Smith.config.agency._has_key?(:acl_cache_path)\n Pathname.new(Smith.config.agency.acl_cache_path).tap { |path| check_path(path) }\n else\n cache_dir = Pathname.new(ENV['HOME']).join('.smith').join('acl')\n if cache_dir.exist?\n cache_dir\n else\n FileUtils.mkdir_p(cache_dir)\n cache_dir\n end\n end\n end",
"def cache_dir(uri)\n # Correct for windows paths\n escaped_path = uri.path.sub(/^\\/([a-z]):\\//i, '/\\\\1-/')\n escaped_path.tap(&Gem::UNTAINT)\n\n File.join Gem.spec_cache_dir, \"#{uri.host}%#{uri.port}\", File.dirname(escaped_path)\n end",
"def cache_path\n return @cache_resources unless @cache_resources.nil?\n\n @cache_resources = Chef::Resource::Directory.new(::File.join(new_resource.cache_path), run_context)\n @cache_resources.recursive(true)\n\n return @cache_resources\n end",
"def cache_path\n @cache_path ||= Pathname.new(Berkshelf.berkshelf_path).join('.cache', 'halite', dependency.name)\n end",
"def include_path\n (source == :local or local_only?) ? local_path : google_cdn_include_path\n end",
"def cache_path_for(resource)\n return false unless @cache_dir\n return false unless Dir.exist?(@cache_dir)\n # sanity check the resource\n return false unless resource && !resource.empty?\n # don't use URL params\n resource = resource.split('?', 2)[0]\n # join and expand the path\n expanded_path = File.expand_path(File.join(@cache_dir, resource))\n # don't allow requests to read outside the given cache directory\n # (eg: resource = '../../../../tmp/foo.txt')\n return false unless expanded_path.start_with?(@cache_dir)\n expanded_path\n end",
"def determine_path\n if source_line.file == SourceLine::DEFAULT_FILE\n return source_line.file\n end\n\n full_path = File.expand_path(source_line.file)\n pwd = Dir.pwd\n\n if full_path.start_with?(pwd)\n from = Pathname.new(full_path)\n to = Pathname.new(pwd)\n\n return from.relative_path_from(to).to_s\n else\n return full_path\n end\n end",
"def cache_dir=(_arg0); end",
"def destination\n @destination ||= shared_path + \"/#{@repository_cache}\"\n end",
"def cache_dir\n File.join( Env.home, '.slideshow' )\n end",
"def source_is_local?\n File.directory?(@source)\n end",
"def source_dir\n @source_dir ||= File.join(staging_dir, \"proto_install\")\n end",
"def source_dir\n Dir.pwd\nend",
"def source_path; end",
"def compute_source_path(source, dir, ext)\n source = rewrite_extension(source, dir, ext) if ext\n\n sources = []\n sources << config.assets_dir\n sources << dir unless source[0] == ?/\n sources << source\n\n File.join(sources)\n end",
"def repo_cache_dir # :nodoc:\n File.join @root_dir, 'cache', 'bundler', 'git', \"#{@name}-#{uri_hash}\"\n end",
"def source_code_dir\n return pretty_path(File.join(Dir::COMMON_APPDATA, 'RightScale', 'src'))\n end",
"def asset_path(kind, source = nil)\n kind, source = source, kind if source.nil?\n source = asset_normalize_extension(kind, escape_link(source.to_s))\n return source if source =~ ABSOLUTE_URL_PATTERN || source =~ /^\\//\n source = File.join(asset_folder_name(kind), source)\n timestamp = asset_timestamp(source)\n result_path = uri_root_path(source)\n \"#{result_path}#{timestamp}\"\n end",
"def source_path\n @source_path ||= source || begin\n u = URI.parse(URL)\n opts = { use_ssl: u.scheme == 'https',\n ca_file: Chef::Config[:ssl_ca_file] }\n body = Net::HTTP.start(u.host, u.port, opts) { |h| h.get(u) }.body\n regex = Regexp.new('https://downloads\\.plex\\.tv/' \\\n 'plex-home-theater/.*/' \\\n 'PlexHomeTheater.*-macosx-x86_64.zip')\n body.match(regex).to_s\n end\n end",
"def get_filename(key)\n\thash = hash(key)\n\n\tif File.exist?(File.join(@cache_dir, hash))\n\t return File.join(@cache_dir, hash)\n\telse\n\t return nil\n\tend\n end",
"def image_path(source)\n compute_public_path(source, 'images')\n end",
"def path\n @@path ||= File.join(RAILS_ROOT, 'tmp', 'cache', 'vm')\n end",
"def dependency_cache_path\n self.dependency_cache_path = tmp_path unless defined?(@dependency_cache_path)\n @dependency_cache_path\n end",
"def repo_cache_dir # :nodoc:\n File.join Gem.dir, 'cache', 'bundler', 'git', \"#{@name}-#{uri_hash}\"\n end",
"def device_caches_dir\n @device_caches_dir ||= File.join(device_data_dir, 'Library', 'Caches')\n end",
"def javascript_path(source)\n return source if source =~ /^http/\n source.gsub!(/\\.js$/, '')\n source_name = source; source_name << \".js\" unless source =~ /\\.js\\w{2,4}$/\n result_path = source_name if source =~ %r{^/} # absolute path\n result_path ||= uri_root_path(\"javascripts\", source_name)\n stamp = File.exist?(result_path) ? File.mtime(result_path) : Time.now.to_i\n \"#{result_path}?#{stamp}\"\n end",
"def derive_cache_dir(url)\n url_dir = url2dir(url)\n host_path = File.join(SYNCED_DOWNLOAD_CACHE_FOLDER[:host], url_dir)\n guest_path = File.join(SYNCED_DOWNLOAD_CACHE_FOLDER[:guest], url_dir)\n {host_path: host_path, guest_path: guest_path}\n end",
"def system_cache_file\n @sysetm_cache ||= File.join(Gem.dir, \"source_cache\")\n end",
"def get_dest_filepath(source)\n # If is a directory ending with a dot, we remove the dot\n source = source[0..-3] + '/' if source[-2..-1] == './'\n # We change the prefix from source to dest\n source.gsub!(@path_source, @path_destination)\n source\n end",
"def sap_media_dir\n ::File.join(cache, 'sap_media')\n end",
"def build_dir\n Puppet::Forge::Cache.base_path + \"tmp-unpacker-#{Digest::SHA1.hexdigest(@filename.basename.to_s)}\"\n end",
"def cache_dir\n \"#{Rails.root}/public/uploads/cache\"\n end",
"def relative_to_source(properties, key)\n path = properties[key]\n base = @source_dir ? @source_dir : ''\n\n return nil if path == nil\n return path if Pathname.new(path).absolute?\n return File.expand_path(File.join(base, path))\n end"
] |
[
"0.7425864",
"0.6830605",
"0.6805839",
"0.6785696",
"0.6771832",
"0.67435277",
"0.6725107",
"0.6725107",
"0.67212343",
"0.67212343",
"0.67077017",
"0.6700639",
"0.6649551",
"0.6648104",
"0.66367656",
"0.6622296",
"0.6547174",
"0.6541506",
"0.6541182",
"0.65391",
"0.6508492",
"0.6495537",
"0.6475357",
"0.64720774",
"0.64697623",
"0.64688706",
"0.64666206",
"0.64632326",
"0.64525926",
"0.6448646",
"0.644148",
"0.6427079",
"0.6408141",
"0.6387683",
"0.63813066",
"0.63770676",
"0.63770676",
"0.63770676",
"0.63763344",
"0.63711655",
"0.6348779",
"0.63283104",
"0.6312885",
"0.6312885",
"0.6309161",
"0.62980586",
"0.62752885",
"0.6264431",
"0.6260607",
"0.62578505",
"0.6244619",
"0.62342",
"0.62229675",
"0.62207896",
"0.6219591",
"0.6198157",
"0.6192832",
"0.6155072",
"0.6142035",
"0.6121487",
"0.60859406",
"0.6071661",
"0.60650724",
"0.60641855",
"0.6063669",
"0.6057122",
"0.6056366",
"0.60504395",
"0.60386777",
"0.60337627",
"0.6007528",
"0.6006957",
"0.59957886",
"0.59954816",
"0.59943384",
"0.5992015",
"0.5988508",
"0.59836096",
"0.5960834",
"0.59189034",
"0.5900152",
"0.5899673",
"0.5899496",
"0.589271",
"0.58872014",
"0.58792907",
"0.58769166",
"0.58656913",
"0.5851491",
"0.5849245",
"0.58472806",
"0.58367777",
"0.58340675",
"0.58288634",
"0.5824194",
"0.58074194",
"0.5805213",
"0.58047366",
"0.5785815",
"0.57793"
] |
0.7448737
|
0
|
Check whether the app directory is the current directory. This is useful to know if we are creating the new application in the current directory. ==== Return +boolean+ :: True, if the app directory is the current directory.
|
def create_in_current_directory?
is_current_directory?(@path)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def current_directory?\n File.exist? current_directory\n end",
"def is_current_directory?(dir = nil)\n dir ||= Dir.pwd\n dir = File.expand_path(dir)\n File.directory?(dir) and (dir == File.expand_path(Dir.pwd))\n end",
"def is_working_dir path\n File.exist? File.expand_path \".git\", path\n end",
"def current?\n # If this is called before the plugins are loaded (i.e. by a plugin's application file), then\n # it is definitely not the top-level app\n if Origen.application_loaded?\n Origen.app == self\n else\n Origen.root == root\n end\n end",
"def has_current_application?\n not self.current_application.nil?\n end",
"def is_git_directory?\n Dir.entries('.').include? '.git'\n end",
"def root?\n !!@root || app_file?\n end",
"def directory?\n !file?\n end",
"def git_directory?\n return if Dir.exist?('.git')\n puts 'You are not in a git project repository.'\n exit!\n end",
"def directory?\n @directory\n end",
"def directory?(dir)\n current_dir = pwd\n begin\n chdir(dir)\n return true\n rescue\n return false\n ensure\n chdir(current_dir) ## Go back former dir\n end\n end",
"def applicable?(dir = Dir.pwd)\n false\n end",
"def root_directory?(path)\n File.directory?(path) &&\n File.expand_path(path) == File.expand_path(File.join(path, \"..\"))\nend",
"def passenger_rack_app?\n workdir.directory? &&\n workdir.join(\"config.ru\").file? &&\n workdir.join(\"tmp\").directory? &&\n workdir.join(\"public\").directory?\n end",
"def current_path?(file); end",
"def falls_in_test_dir?\n %w[spec specs test tests].any? { |dir| File.expand_path(@file_directory).start_with?(\"#{root_dir}/#{dir}\") }\n end",
"def in_dir? dir\n self == dir or\n self.to_s.index(File.join(dir, '')) == 0\n end",
"def directory?() end",
"def root?\n env[\"PATH_INFO\"] == '/'\n end",
"def run?\n @run ||= true\n @run and !@running and app_file? and $0.expand_path == app_file.expand_path\n end",
"def current_directory\n File.expand_path @current_directory\n end",
"def directory?\n kind == NODE_DIR\n end",
"def application?\n gem_dir\n end",
"def application?\n gem_dir\n end",
"def directory?\n FileTest.directory?(to_s)\n end",
"def directory?\n return @directory unless @directory.nil?\n @directory = File.directory? absolute_path\n end",
"def rails_root?\n !@rails_root.blank? && @rails_root.directory?\n end",
"def outside_configured_directory?(dir); end",
"def exists?\n File.exists?(File.join(@root))\n end",
"def root?(path)\n \n root_objects = [\"gemfile\", \"procfile\", \"readme\"]\n current_objects = Dir[path + \"/*\"].map do |file|\n File.basename(file).downcase\n end\n dir = \"\"\n current_objects.each do |co|\n dir = (root_objects.include?(co) == true)? \"ROOT\" : \"NOT ROOT\"\n break if dir == \"ROOT\"\n end\n return true if dir == \"ROOT\"\n return false if dir == \"NOT ROOT\"\n \n end",
"def current_path?(path)\n @ctx.path_with_slashes(@ctx.current_path) == @ctx.path_with_slashes(path)\n end",
"def directory?(path)\n eval(DIRECTORY_CHECK, binding, __FILE__, DIRECTORY_CHECK_LINE)\n nil\nend",
"def path?\n !path.nil? && File.directory?(path)\n end",
"def application?\n (filtered_file =~ /^\\[PROJECT_ROOT\\]/i) && !(filtered_file =~ /^\\[PROJECT_ROOT\\]\\/vendor/i)\n end",
"def is_root?()\n @rootpath == @path\n end",
"def raw_gitdir?\n\t\t\twith_dir do\n\t\t\t\treturn DR::Bool.to_bool(%x/git rev-parse --is-inside-git-dir/)\n\t\t\tend\n\t\tend",
"def git?\n !!git_directory\n end",
"def is_directory?\n files.count > 1\n end",
"def cd_into_test?\n !File.exist?(\"app\") && File.exist?(\"test\") &&\n (File.exist?(\"main.tf\") || File.exist?(\"main.rb\"))\n end",
"def validnn?()\n return dir_exists?(\"/\") ? true : false\n end",
"def project_is_configured_for_git?\n\t\t\tFile.directory? '.git'\n\t\tend",
"def directory?\n case type\n when T_DIRECTORY then true\n when T_UNKNOWN then nil\n else false\n end\n end",
"def valid?\n\t\tFile.directory? dir\n\tend",
"def valid?\n\t\tFile.directory? dir\n\tend",
"def environment?\n dir?('.bundle') || dir?('.virtualenv') || dir?('node_modules')\n end",
"def is_location_in_context?(iLocation)\n # * *iLocation* (_String_): Directory\n return $LOAD_PATH.include?(iLocation)\n end",
"def root?\n Process.uid == 0\n end",
"def eponymous_directory?\n if !path.end_with?(\"/#{@app.config[:index_file]}\") && destination_path.end_with?(\"/#{@app.config[:index_file]}\")\n return true\n end\n\n @app.files.by_type(:source).watchers.any? do |source|\n (source.directory + Pathname(eponymous_directory_path)).directory?\n end\n end",
"def directory?(path)\n ::File.directory?(prefixed(path))\n end",
"def is_root?\n @path == '/' || @path == ''\n end",
"def safeIsDirectory?(f)\n ret = false\n Dir.chdir(f) { ret = true } rescue nil\n return ret\nend",
"def entry_directory?(entry)\n File.directory?(build_directory_location(entry)) \n end",
"def file?\n File.exist?(path) && File.directory?(path)\n end",
"def active_instance_dir_exists?\n return File.directory?( @resource['instances_dir'] + \"/\" + @resource[:name] )\n end",
"def valid_directory?\n File.directory?(output_directory_path)\n end",
"def accessing_parent_of_admin(current_dir_name, path)\n return true if current_dir_name == 'admin' && path == '..'\n\n false\n end",
"def current_dir; end",
"def git_repository?\n @root.join('.git').directory?\n end",
"def directory?\n raise NotLoadedError.new(:metadata) unless metadata_loaded?\n self.is_dir\n end",
"def directory_index?\n path.include?(@app.config[:index_file]) || path =~ /\\/$/ || eponymous_directory?\n end",
"def dir?\n !!@dir ||= false\n end",
"def local_valid_repo?\n @local_dir_path.directory?\n end",
"def accessible?\n workdir.executable? && workdir.readable?\n end",
"def safeIsDirectory?(f)\n ret=false\n Dir.chdir(f) { ret=true } rescue nil\n return ret\nend",
"def safeIsDirectory?(f)\n ret=false\n Dir.chdir(f) { ret=true } rescue nil\n return ret\nend",
"def directory?(path)\n if session.type == 'meterpreter'\n stat = session.fs.file.stat(path) rescue nil\n return false unless stat\n return stat.directory?\n else\n if session.platform == 'windows'\n f = cmd_exec(\"cmd.exe /C IF exist \\\"#{path}\\\\*\\\" ( echo true )\")\n else\n f = session.shell_command_token(\"test -d \\\"#{path}\\\" && echo true\")\n end\n return false if f.nil? || f.empty?\n return false unless f =~ /true/\n true\n end\n end",
"def present_and_running?\n return active_instance_dir_exists? && running?\n end",
"def workspace_dir?(selection)\n selection == \"#{ws.root_dir}/\" || selection == \"#{ws.prefix_dir}/\"\n end",
"def check_cwd_cd_able path\n Dir.exist?(path) && File.readable?(path)\n end",
"def root?\n #%r{\\A/+\\z} =~ @path ? true : false\n @absolute and @path.empty?\n end",
"def current?(user)\n Process.uid == Etc.getpwnam(user).uid\n rescue\n false\n end",
"def check_or_create_working_dir\n unless Dir.exists?(@working_directory)\n if File.writable?(@working_directory.split(\"/\")[0...-1].join(\"/\"))\n Dir.mkdir(@working_directory)\n return true if Dir.exists?(@working_directory)\n end\n end\n Loggers::Main.log.warn \"Creation of #{@working_directory} failed!\"\n end",
"def is_dir?(pristine)\n return pristine['is_dir'] if service.downcase.include? \"dropbox\"\n end",
"def exists?\n factory.system.dir_exists?(@path)\n end",
"def directory?(path)\n # :nocov:\n false\n # :nocov:\n end",
"def app_available?(app)\n `which #{app}`.strip == \"\" ? false : true\n end",
"def available?\n path.directory?\n end",
"def inside_project?\n project_found = false\n cwd = Pathname(Dir.pwd)\n home_directory = File.expand_path('~')\n cwd.ascend do |current_path|\n project_found = File.file?(\"#{current_path.to_s}/.bebox\")\n self.project_root = current_path.to_s if project_found\n break if project_found || (current_path.to_s == home_directory)\n end\n project_found\n end",
"def exist?\n File.directory? @full_path\n end",
"def root?\n self.path == '/'\n end",
"def available_dir?(path)\n evaluation = false\n if File.directory? path\n stat = File::Stat.new path\n evaluation = stat.readable? && stat.writable? && stat.executable?\n end\n return evaluation\n end",
"def directory?(path)\n File.directory?(path_of(path))\n end",
"def gitdir?(dirpath)\n gitpath = \"#{dirpath}/.git\"\n File.exist?(gitpath) && File.directory?(gitpath)\n end",
"def root?\n is_root?(@path)\n end",
"def config_directory_exists?\n File.exist?(config_directory) && File.directory?(config_directory)\n end",
"def current_folder_has_souffle_config?\n File.exists? \"#{Dir.pwd}/souffle.json\"\n end",
"def empty_directory?\n directory? && Dir.entries(to_s).reject { |entry| entry == '.' || entry == '..' }.empty?\n end",
"def directory?(f)\n File.directory? f\n end",
"def root?\n return @active_context.empty?\n end",
"def app_is_installed?\n if installed_app_bundle_dir ||\n simctl.app_container(device, app.bundle_identifier)\n true\n else\n false\n end\n end",
"def exists?(app_name)\n File.exists? File.join(path, app_name)\n end",
"def root?\n Process.uid.zero?\n end",
"def root?\n Process.uid.zero?\n end",
"def gen_app\n unless File.exists?(app_dir)\n original_dir = FileUtils.pwd\n Dir.mkdir(root_dir) unless (!root_dir or File.exists?(root_dir))\n FileUtils.cd(root_dir) if root_dir\n `#{rails_str}`\n FileUtils.cd(original_dir)\n true\n end\n end",
"def current?\n @node.current_path == path\n end",
"def args_valid?\n\tARGV.size == 1 && File.exist?(ARGV[0]) || Dir.exist?(Dir.pwd + \"/\" + ARGV[0])\nend",
"def args_valid?\n\tARGV.size == 1 && File.exist?(ARGV[0]) || Dir.exist?(Dir.pwd + \"/\" + ARGV[0])\nend",
"def is_dir?(path)\n File.directory? path\n end",
"def exists?\n File.exists? dir\n end",
"def dir? ; directory? ? self : nil ; end"
] |
[
"0.8176597",
"0.78471494",
"0.6993995",
"0.66793257",
"0.6520829",
"0.6401081",
"0.63960457",
"0.63663304",
"0.6353409",
"0.6351403",
"0.6331093",
"0.63238937",
"0.6310894",
"0.62939686",
"0.6282812",
"0.62558603",
"0.62252194",
"0.61945635",
"0.61775666",
"0.61280817",
"0.61210185",
"0.611461",
"0.6114117",
"0.6114117",
"0.61092323",
"0.61053616",
"0.6084679",
"0.6078457",
"0.6075462",
"0.607171",
"0.60657215",
"0.6059881",
"0.6054408",
"0.6050087",
"0.6035574",
"0.60259074",
"0.59998286",
"0.59798616",
"0.59673303",
"0.59444857",
"0.5934403",
"0.59170634",
"0.59146523",
"0.59146523",
"0.59121484",
"0.5904253",
"0.5896886",
"0.58952034",
"0.5892657",
"0.589206",
"0.5888696",
"0.5885874",
"0.5884267",
"0.58821034",
"0.58766156",
"0.58676994",
"0.5867346",
"0.5862985",
"0.5858595",
"0.5855163",
"0.58486617",
"0.58486104",
"0.5847096",
"0.58418995",
"0.58418995",
"0.5839621",
"0.5829717",
"0.5827257",
"0.58231205",
"0.58163595",
"0.5810538",
"0.5809276",
"0.5808085",
"0.5806789",
"0.5804226",
"0.580122",
"0.5799762",
"0.5781319",
"0.5779344",
"0.5777965",
"0.577603",
"0.57657766",
"0.5760983",
"0.5753556",
"0.5752583",
"0.57431453",
"0.57429975",
"0.57409644",
"0.57339895",
"0.5731764",
"0.57214206",
"0.5701376",
"0.5701376",
"0.5699237",
"0.56958234",
"0.5694124",
"0.5694124",
"0.568972",
"0.5673976",
"0.56730026"
] |
0.7521997
|
2
|
Check whether the app directory is empty? This is useful to know if we are trying to create the new application in an empty directory or not, so that we may know if we need to create this application forcefully? ==== Return +boolean+ :: True, if the app directory is an empty one.
|
def create_in_empty_directory?
is_empty_directory?(@path)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def empty?\n Dir.empty?(path)\n end",
"def empty_directory?\n directory? && Dir.entries(to_s).reject { |entry| entry == '.' || entry == '..' }.empty?\n end",
"def empty?( dir_path )\n connection.nlst( dir_path ).empty?\n end",
"def is_empty_directory?(dir = nil)\n dir ||= Dir.pwd\n dir = File.expand_path(dir)\n File.directory?(dir) and (Dir.entries(dir).size == 2)\n end",
"def destination_empty?\n Dir['*'].length == 0 \n end",
"def empty?\n Dir['./tmp/specs/*'].empty?\n end",
"def validnn?()\n return dir_exists?(\"/\") ? true : false\n end",
"def empty?(path)\n raise Errno::ENOENT unless File.exist?(path)\n if File.directory?(path)\n files = Dir.entries(path)\n files.size == 2 && files.sort == ['.', '..']\n else\n File.size(path) == 0\n end\n end",
"def exists?\n validate_directory_structure\n end",
"def empty?\n @file.nil? || self.size.nil? || (self.size.zero? && !self.exists?)\n end",
"def exists?\n factory.system.dir_exists?(@path)\n end",
"def is_directory?\n files.count > 1\n end",
"def empty?\n @path.size == 0\n end",
"def exist?(dir)\n return true if !nlst(dir).empty? ## File or not empty directory\n ## Check if a empty directory\n directory?(dir)\n end",
"def current_directory?\n File.exist? current_directory\n end",
"def empty?\n @path.empty?\n end",
"def app_not_exist?(host_path)\n\t\t\thost_path.downcase\n\t\t\tif Dir.exists?(host_path)\n\t\t\t\tDeployLog.stderr_log.fatal {\"The app #{host_path} already exists\"}\n\t\t\t\tSTDERR.puts Rainbow(\"ERROR: The app #{host_path} already exists\").red\n\t\t\t\treturn false\n\t\t\telse\n\t\t\t\ttrue \n\t\t\tend\n\t\tend",
"def exists?\n File.exists?(File.join(@root))\n end",
"def empty_dir?(path)\n Dir.foreach(path) {|f|\n return false if f != '.' and f != '..'\n }\n return true\nend",
"def directory?\n !file?\n end",
"def check_or_create_working_dir\n unless Dir.exists?(@working_directory)\n if File.writable?(@working_directory.split(\"/\")[0...-1].join(\"/\"))\n Dir.mkdir(@working_directory)\n return true if Dir.exists?(@working_directory)\n end\n end\n Loggers::Main.log.warn \"Creation of #{@working_directory} failed!\"\n end",
"def empty?\n path(\"\").empty\n end",
"def exists?(app_name)\n File.exists? File.join(path, app_name)\n end",
"def exists?\n File.exists? dir\n end",
"def exist?\n File.directory? @full_path\n end",
"def config_directory_exists?\n File.exist?(config_directory) && File.directory?(config_directory)\n end",
"def active_instance_dir_exists?\n return File.directory?( @resource['instances_dir'] + \"/\" + @resource[:name] )\n end",
"def exist?\n Dir.exist?(directory)\n end",
"def valid_directory?\n File.directory?(output_directory_path)\n end",
"def create_in_current_directory?\n is_current_directory?(@path)\n end",
"def installed?\n (dir = installed_prefix).directory? && dir.children.length > 0\n end",
"def backup_exist?\n abs_path = File.join(__dir__, @cfg[:backup])\n if File.directory?(abs_path) && Dir.entries(abs_path).size > 200\n true\n end\n false\n end",
"def app_is_installed?\n if installed_app_bundle_dir ||\n simctl.app_container(device, app.bundle_identifier)\n true\n else\n false\n end\n end",
"def empty_path?\n path.empty?\n end",
"def ready?\n File.exist?(desktop_path) && \n File.directory?(libs_path)\n end",
"def path_exists?(path, create_if_not_exist = false)\n return true if path.empty?\n end",
"def valid?\n\t\tFile.directory? dir\n\tend",
"def valid?\n\t\tFile.directory? dir\n\tend",
"def exists?\n Dir[glob].length == 1\n end",
"def verify_empty!\n unless Dir[dest + '/*'].empty?\n abort unless agree \"`#{dest}' is not empty; continue? \"\n end\n end",
"def empty?\n storage.empty?\n end",
"def empty?\n storage.empty?\n end",
"def inactive_instance_dir_exists?\n return File.directory?( @resource['instances_dir'] + \"/\" + \"_\" + @resource[:name] )\n end",
"def exists?\n return true if File.directory?(@path)\n false\n end",
"def root?\n !!@root || app_file?\n end",
"def empty?\n storage.empty?\n end",
"def empty?\n @root.nil?\n end",
"def empty?\n @root.nil?\n end",
"def empty?\n\t\t\t@storage.size == 0\n\t\tend",
"def extract_dir_clean?(dirname )\n items = get_extract_list(dirname )\n return items.empty?\n end",
"def exists?\n folder_location.present?\n end",
"def available?\n path.directory?\n end",
"def empty?\n root.nil?\n end",
"def directory?\n raise NotLoadedError.new(:metadata) unless metadata_loaded?\n self.is_dir\n end",
"def ensure_directory_exists\r\n dir = File.dirname(full_path_from_current_attributes)\r\n FileUtils.mkdir_p(dir) unless File.exists?(dir)\r\n end",
"def root?\n #%r{\\A/+\\z} =~ @path ? true : false\n @absolute and @path.empty?\n end",
"def directory_exists?(path)\n run(\"test -d #{path}\").success?\n end",
"def directory?\n @directory\n end",
"def path?\n !path.nil? && File.directory?(path)\n end",
"def exist?\n File.exist? fullpath\n end",
"def complete_app_install?(app_bundle_dir)\n base_dir = File.dirname(app_bundle_dir)\n plist = File.join(base_dir, METADATA_PLIST)\n File.exist?(plist)\n end",
"def folder_reachable?\n Dir.exists? folder_path\n end",
"def empty?\n File.size(@filename) <= 2\n end",
"def directory?() end",
"def exist?\n # shouldn't force network connections just to check if content exists\n # only check that the path is not empty\n !path.to_s.empty?\n end",
"def exist?\n # shouldn't force network connections just to check if content exists\n # only check that the path is not empty\n !path.to_s.empty?\n end",
"def empty?\n size.zero?\n end",
"def is_root?\n @path == '/' || @path == ''\n end",
"def active_homedir_exists?( username )\n\t\t\thomedir = HOMEDIR_BASE + username\n\t\t\treturn homedir.directory?\n\t\tend",
"def custom_directory?\n # directory exists?\n # print dir path and contents\n # return true\n # else create directory\n end",
"def directory_exists?(path)\n end",
"def directory_has_children? dir\n (Dir.entries(dir) - ['.', '..']).size > 0\n end",
"def dir_exist?(path)\n exist?(path) && !is_file?(path)\n end",
"def exist?(*app_names)\n each_app(*app_names) do |server_app|\n server_app.root_path\n end\n end",
"def is_directory?(path)\n path_exist(path) and (! exist? path)\n end",
"def exists?\n ::File.directory? self.path\n end",
"def empty?\n size.zero?\n end",
"def passenger_rack_app?\n workdir.directory? &&\n workdir.join(\"config.ru\").file? &&\n workdir.join(\"tmp\").directory? &&\n workdir.join(\"public\").directory?\n end",
"def dir_exists?(name)\n # Does it exist?\n end",
"def empty?\n size.zero?\n end",
"def empty?\n size.zero?\n end",
"def empty?\n size.zero?\n end",
"def empty?\n size.zero?\n end",
"def incomplete_install?\n builtin_module_list = %w[aggregate canary puppetdb_fact secure_env_vars puppet_connect]\n (Dir.children(Bolt::Config::Modulepath::MODULES_PATH) - builtin_module_list).empty?\n end",
"def empty?()\n return @root.children.empty? ? true : false\n end",
"def empty?\n\t\t\tsize == 0\n\t\tend",
"def file_exists?\n\tdirectory_name = \"db/seed_files\"\n\tunless File.exist?(directory_name)\n\t\tputs \"Created folder 'db/seed_files'\"\n\t\tDir.mkdir(directory_name)\n\tend\nend",
"def rails_root?\n !@rails_root.blank? && @rails_root.directory?\n end",
"def empty?\n @is_empty\n end",
"def empty?\n return false\n end",
"def empty?(submission)\n Dir.glob(File.join(GitUtils.gen_repo_path(submission), '**', '*')).reject { |fname| File.directory?(fname) }.empty?\n end",
"def empty?\n size == 0\n end",
"def empty?\n size == 0\n end",
"def empty?\n size == 0\n end",
"def is_empty?\n size == 0\n end",
"def zero?(path)\n size(path) == 0\n end",
"def dir_exists?(path)\n begin\n @meta_data = @client.stat(path)\n if (@meta_data[\"type\"] == \"DIRECTORY\")\n return true\n else\n return false\n end\n rescue\n return false\n end \n end",
"def empty?\n size == 0\n end",
"def delete_empty_upstream_dirs\n path = ::File.expand_path(store_dir, root)\n Dir.delete(path) # fails if path not empty dir\n\n path = ::File.expand_path(base_store_dir, root)\n Dir.delete(path) # fails if path not empty dir\n rescue SystemCallError\n true # nothing, the dir is not empty\n end",
"def folder?\n children.any?\n end"
] |
[
"0.7720633",
"0.73840463",
"0.7190939",
"0.7189074",
"0.71495414",
"0.6966294",
"0.67965746",
"0.67876965",
"0.6669369",
"0.6601089",
"0.65078175",
"0.64743793",
"0.64563066",
"0.6444204",
"0.6403268",
"0.6388249",
"0.63646597",
"0.6342541",
"0.63320583",
"0.63096166",
"0.6293525",
"0.62734526",
"0.6261232",
"0.62427646",
"0.6242085",
"0.6213803",
"0.62031794",
"0.6201571",
"0.6198579",
"0.61978316",
"0.6191196",
"0.61372757",
"0.6118321",
"0.6105343",
"0.61034256",
"0.60841566",
"0.6082262",
"0.6082262",
"0.6074383",
"0.6072362",
"0.6070693",
"0.6070693",
"0.6059634",
"0.6057931",
"0.60509205",
"0.6029553",
"0.6026518",
"0.6026167",
"0.6017134",
"0.60098684",
"0.5993572",
"0.5992731",
"0.5988663",
"0.5985463",
"0.59818655",
"0.59694093",
"0.5961613",
"0.5961066",
"0.59596133",
"0.5959412",
"0.59581256",
"0.5955742",
"0.59408736",
"0.59345573",
"0.5932686",
"0.5932686",
"0.59318745",
"0.5923341",
"0.5920623",
"0.5914246",
"0.59117913",
"0.5909675",
"0.59079665",
"0.590526",
"0.59023756",
"0.5893166",
"0.5892421",
"0.58880913",
"0.5883449",
"0.58789325",
"0.58789325",
"0.58789325",
"0.58789325",
"0.5872445",
"0.5867248",
"0.58672225",
"0.5864695",
"0.585937",
"0.58521587",
"0.5846054",
"0.5835787",
"0.5835451",
"0.5835451",
"0.5835451",
"0.58348495",
"0.5834118",
"0.58295304",
"0.58281875",
"0.58233905",
"0.5820853"
] |
0.7992309
|
0
|
Check whether the specified source is a local directory or a URL? ==== Return +boolean+ :: True, if the source is a local directory.
|
def source_is_local?
File.directory?(@source)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def is_file_source_a_remote_url?\n !self.remote_url.blank?\n end",
"def local_valid_repo?\n @local_dir_path.directory?\n end",
"def local_dir_exists?(full_path)\n File.directory?(full_path)\nend",
"def local?\n @uri.scheme == 'file'\n end",
"def is_local_path(path)\n (path =~ /^.:(\\/|\\\\)/)\nend",
"def isLocal (source)\n objectPath = source\n req = Net::HTTP::Get.new(@basePath+objectPath[6..-1]+'?metadata')\n setHeaders req\n response, data = @store.request(req)\n jsonResponse = JSON.parse(data)\n url =\"\"\n jsonResponse['metadatas']['metadatas'].each{ |o|\n url = o[1] if (o[0] == '{file}url')\n }\n store = url[4 ... url.index(\"://\")]\n (store == @localNamespace)\n end",
"def directory?() end",
"def directory?\n case type\n when T_DIRECTORY then true\n when T_UNKNOWN then nil\n else false\n end\n end",
"def local?\n @attributes[:local_path_to_file] && File.exist?(@attributes[:local_path_to_file])\n end",
"def is_directory?(path)\n end",
"def mirror?\n source_type == 'url'\n end",
"def directory?\n !file?\n end",
"def request_is_directory?(path)\n question = absolute_path(path) \n File.directory?(question)\n end",
"def directory?\n kind == NODE_DIR\n end",
"def dir?\n type == :dir\n end",
"def directory?\n FileTest.directory?(to_s)\n end",
"def dir? ; directory? ? self : nil ; end",
"def local_package?(package)\n return false unless package && package[\"Dir\"]\n return false unless File.fnmatch?(\"#{config.root}*\", package[\"Dir\"], File::FNM_CASEFOLD)\n vendored_path_parts(package).nil?\n end",
"def available?\n path.directory?\n end",
"def directory?\n @directory\n end",
"def file?\n File.exist?(path) && File.directory?(path)\n end",
"def is_directory?( path )\n path = File.expand_path( path )\n File.directory?( path )\nend",
"def glob_is_directory?(glob); end",
"def directory?(path)\n ::File.directory?(prefixed(path))\n end",
"def directory?(path)\n eval(DIRECTORY_CHECK, binding, __FILE__, DIRECTORY_CHECK_LINE)\n nil\nend",
"def file_url?(url)\n name = File.basename(url)\n name.include?('.zip') || name.include?('.tar.gz')\n end",
"def directory?\n return @directory unless @directory.nil?\n @directory = File.directory? absolute_path\n end",
"def local_file_exists?(full_path)\n File.exists?(full_path)\nend",
"def local?(link)\n uri = Addressable::URI.parse(link)\n return true if uri.host == @domain\n return false\n end",
"def directory?(f)\n File.directory? f\n end",
"def directory?\n raise NotLoadedError.new(:metadata) unless metadata_loaded?\n self.is_dir\n end",
"def viable_directory?(dir)\n ::File.directory?(dir) && ::File.readable?(dir)\n end",
"def local_clone_dir_exists?(type,module_name,opts={})\n full_module_name = full_module_name(module_name,opts)\n ret = local_repo_dir(type, full_module_name, opts[:version], opts)\n File.directory?(ret) && ret\n end",
"def image?(src)\n !File.directory?(src)\n end",
"def remote_file?\n file? && @remote_file\n end",
"def directory?(path)\n raise NotImplemented\n end",
"def validnn?()\n return dir_exists?(\"/\") ? true : false\n end",
"def dir_link?(link)\n link.content.match?(%r{\\/$}) ||\n link[:href].match?(%r{^(?!((http|https):\\/\\/|\\.{2}|\\/|\\?)).*\\/$})\n end",
"def collection?\n File.directory? @src_path\n end",
"def path?\n !path.nil? && File.directory?(path)\n end",
"def dir?(path)\n begin\n ftype(path) == 'directory'\n rescue\n false\n end\n end",
"def directory?(*args)\n File.directory?(*args)\n end",
"def directory?(name)\n File.directory?(path(name))\n end",
"def directory?(path)\n if session.type == 'meterpreter'\n stat = session.fs.file.stat(path) rescue nil\n return false unless stat\n return stat.directory?\n else\n if session.platform == 'windows'\n f = cmd_exec(\"cmd.exe /C IF exist \\\"#{path}\\\\*\\\" ( echo true )\")\n else\n f = session.shell_command_token(\"test -d \\\"#{path}\\\" && echo true\")\n end\n return false if f.nil? || f.empty?\n return false unless f =~ /true/\n true\n end\n end",
"def in_directory?(directory)\n !!(fullpath =~ %r{^#{Regexp.escape(directory)}/})\n end",
"def entry_directory?(entry)\n File.directory?(build_directory_location(entry)) \n end",
"def directory?\n repos.stat(fs_path, revision).directory?\n end",
"def directory?\n case @typeflag\n when \"5\"\n true\n when \"0\", \"\\0\"\n # If the name ends with a slash, treat it as a directory.\n # This is what other major tar implementations do for\n # interoperability and compatibility with older tar variants\n # and some new ones.\n @name.end_with?(\"/\")\n else\n false\n end\n end",
"def directory?(path)\n without_extension?(path) && exists?(path)\n end",
"def file_uri?(uri)\n uri =~ %r{\\Afile://}\n end",
"def valid?\n\t\tFile.directory? dir\n\tend",
"def valid?\n\t\tFile.directory? dir\n\tend",
"def internal_source?(uri)\n uri = URI.parse(uri.to_s)\n\n internal_host?(uri.host) if uri.host\n end",
"def has_directory? name\n File.directory? path / name\n end",
"def source_exists?\n # FIXME: Just a helper as long as ActiveSource is not completely integrated!\n Source.exists?(@uri) || ActiveSource.exists?(:uri => @uri.to_s)\n end",
"def directory?(path)\n\t\t@connection.directory?(path)\n\tend",
"def user_path?(file); end",
"def isDirectory( path )\n # Using the File class (directory? method), determine if the path\n # is a directory and return this value\n return File.directory? path\nend",
"def is_url?\n path =~ URL_PATHS\n end",
"def source_modified_or_dest_missing?(source_path, dest_path); end",
"def directory_exists?(path)\n end",
"def is_dir?(path)\n File.directory? path\n end",
"def eponymous_directory?\n if !path.end_with?(\"/#{@app.config[:index_file]}\") && destination_path.end_with?(\"/#{@app.config[:index_file]}\")\n return true\n end\n\n @app.files.by_type(:source).watchers.any? do |source|\n (source.directory + Pathname(eponymous_directory_path)).directory?\n end\n end",
"def local\n uri.local?\n end",
"def local\n uri.local?\n end",
"def remote_symlink_exists?(full_path)\n remote_filetest_passes?('-L', full_path)\n end",
"def local_link?\n [1,2].include?(link_type)\n end",
"def is_directory?\n files.count > 1\n end",
"def directory_exists?(relative_destination)\n File.exist?(destination_path(relative_destination))&& File.directory?(destination_path(relative_destination))\n end",
"def local?\n !remote?\n end",
"def exist?\n File.directory? @full_path\n end",
"def valid_directory?\n File.directory?(output_directory_path)\n end",
"def has_local?\n local.exist?\n end",
"def relative? ; all?{ |path| FileTest.relative?(path) } ; end",
"def exist?\n @local_path and @local_path.exist?\n end",
"def source_type\n if source\n if source[:url]\n :url\n elsif source[:git]\n :git\n elsif source[:file]\n :file\n elsif source[:path]\n :path\n end\n else\n :project_local\n end\n end",
"def check_sources\n case self.source\n when \"rubygems\"\n return false if self.gem_name.empty?\n require 'net/http'\n begin\n r = Net::HTTP.get_response(URI.parse(\"http://rubygems.org/gems/#{self.gem_name}\"))\n Net::HTTPSuccess === r ? (return true) : errors.add(:gem_name, \"#{self.gem_name} is not a valid rubygem\")\n rescue\n errors.add(:gem_name, \"#{self.gem_name} failed.\")\n end\n when \"git\"\n if self.source_url.empty?\n errors.add(:source_url, \"can't be blank\")\n return false\n end\n require 'command_check'\n if command?('git')\n git_ls = system(\"git\", \"ls-remote\", self.source_url)\n if git_ls != true\n errors.add(:source_url, \"#{self.source_url} is not a valid git repository\")\n end\n end\n when \"path\"\n if self.source_url.empty?\n errors.add(:source_url, \"can't be blank\")\n return false\n end\n # Use Dir to see if a gemfile exists in that directory, and protect\n # it with File.directory? to keep out wildcards (resource hog).\n # Make the two cases somewhat indistinguishable to avoid revealing\n # irrelevant system properties.\n if (!File.directory? self.source_url or\n Dir.glob(\"#{self.source_url}/*.gemspec\").empty?)\n errors.add(:source_url, \"Gemspec not found in #{self.source_url}\")\n end\n end\n end",
"def is_local?\n !is_remote?\n end",
"def outside_configured_directory?(dir); end",
"def safeIsDirectory?(f)\n ret=false\n Dir.chdir(f) { ret=true } rescue nil\n return ret\nend",
"def safeIsDirectory?(f)\n ret=false\n Dir.chdir(f) { ret=true } rescue nil\n return ret\nend",
"def directory?(path)\n GLib.g_file_test(path, GLib::GFileTest::G_FILE_TEST_IS_DIR)\n end",
"def local_file?(file)\n file.is_a?(Tempfile) ||\n file.is_a?(ActionDispatch::Http::UploadedFile) ||\n file.is_a?(Rack::Test::UploadedFile)\n end",
"def exists?\n File.directory?(directory) && !entry_filter.symlink?(directory)\n end",
"def safeIsDirectory?(f)\n ret = false\n Dir.chdir(f) { ret = true } rescue nil\n return ret\nend",
"def is_directory?(path)\n path_exist(path) and (! exist? path)\n end",
"def directory?(path)\n File.directory?(path_of(path))\n end",
"def is_file?(path)\n !self.is_dir?(path)\n end",
"def directory?(path)\n # :nocov:\n false\n # :nocov:\n end",
"def symlink_outside_site_source?(entry)\n !Pathutil.new(entry).in_path?(\n site.in_source_dir\n )\n end",
"def symlink_outside_site_source?(entry); end",
"def fs_remote?(mount)\n fs_type(mount) == 'nfs'\n end",
"def migrate_linked_file?(uri)\n host = uri.host.to_s\n path = uri.path.to_s\n if(host == 'www.ctcc.uio.no')\n if(path != '/' and path != '')\n return true\n else\n return false\n end\n elsif(host != '')\n return false\n end\n return super(uri)\n end",
"def same_source_host?\n parse(@url).host == parse(@source_url).host\n end",
"def folder_reachable?\n Dir.exists? folder_path\n end",
"def source?\n false\n end",
"def exists?\n ::File.directory? self.path\n end",
"def symlink?\n type == :symlink\n end",
"def exists?\n File.exist? @src_path\n end",
"def kind_clash?(entry, relocated)\n (entry.file? and relocated.directory?) or\n (entry.directory? and relocated.file?)\n end"
] |
[
"0.71893734",
"0.70237935",
"0.6998091",
"0.697964",
"0.6873225",
"0.68724835",
"0.6759035",
"0.6664996",
"0.6627768",
"0.6596963",
"0.653044",
"0.6491668",
"0.64716196",
"0.63899654",
"0.6377403",
"0.6345643",
"0.63219124",
"0.6296141",
"0.6288866",
"0.62444174",
"0.62131816",
"0.6207582",
"0.61796546",
"0.6161711",
"0.61530477",
"0.610643",
"0.6103658",
"0.60970587",
"0.6096735",
"0.6093545",
"0.6092872",
"0.60844934",
"0.6066419",
"0.60658735",
"0.60515237",
"0.6047461",
"0.60381895",
"0.6016313",
"0.60107195",
"0.60039717",
"0.59867513",
"0.5973164",
"0.5969267",
"0.5955442",
"0.5952278",
"0.59489965",
"0.5947115",
"0.5936282",
"0.5934996",
"0.59162414",
"0.5911915",
"0.5911915",
"0.5911061",
"0.590486",
"0.5903714",
"0.58967316",
"0.5889683",
"0.5885652",
"0.58816236",
"0.58812785",
"0.58804685",
"0.58798754",
"0.5870737",
"0.58658695",
"0.58658695",
"0.5859939",
"0.5849907",
"0.5849187",
"0.5846637",
"0.5843224",
"0.5842265",
"0.58404547",
"0.5838988",
"0.5835926",
"0.5828105",
"0.5823333",
"0.5814701",
"0.5813498",
"0.58014137",
"0.57826346",
"0.57826346",
"0.5779363",
"0.5768414",
"0.5765995",
"0.57612133",
"0.57592744",
"0.5753664",
"0.5751267",
"0.5743085",
"0.5737157",
"0.5726623",
"0.57257384",
"0.56989425",
"0.5678254",
"0.5667496",
"0.56584644",
"0.56579864",
"0.5657826",
"0.5649419",
"0.5647514"
] |
0.8530504
|
0
|
Return the path to the configuration file for the current application ==== Return +string+ :: path to the configuration file
|
def config_file
File.join(@path, %w[ application config application.php ])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def app_config_path\n Pathname.new('.').join('config')\n end",
"def config_file\n File.join AppRoot, ConfigFile\n end",
"def configuration_file_path; end",
"def config_path\n @config_path ||= local_config_path\n end",
"def config_file\n CONFIG_FILE\n end",
"def config_path\n Gym.cache[:config_path] ||= \"#{Tempfile.new('gym_config').path}.plist\"\n return Gym.cache[:config_path]\n end",
"def config_path\n Gym.cache[:config_path] ||= \"/tmp/gym_config_#{Time.now.to_i}.plist\"\n return Gym.cache[:config_path]\n end",
"def getConfigPath\n if @conf[:config_name].index('/')\n return @conf[:config_name] if File.file?(@conf[:config_name])\n else \n @conf[:config_dirs].each {|i|\n r = Pathname.new(i) + @conf[:config_name]\n return r if File.file?(r)\n }\n end\n\n CliUtils.warnx \"no config file '#{@conf[:config_name]}' found\" if @conf[:verbose] >= 2\n return nil\n end",
"def configuration_file\n @config_file_name ||= MyRhouse.confpath( \"#{config_file_name}.yml\" )\n end",
"def config_file\n @config_file\n end",
"def config_file\n @config_file ||= File.join( home_dir, TyrantManager.config_file_basename )\n end",
"def config_path\n if result = chef_api_config_path\n Pathname(result).expand_path\n else\n Pathname(\"\")\n end\n end",
"def path\n @configuration.path\n end",
"def active_configuration_path\n configuration_paths.find do |path|\n File.file? path\n end || theme_configuration_path\n end",
"def config_path\n ::Rails.root.to_s + \"/config/#{self.name.split('::').last.underscore.pluralize}.yml\"\n end",
"def config_path\n @config_path ||= 'config/spinach.yml'\n end",
"def path\n @path ||= File.dirname @config_file\n end",
"def base_config_path\n BASE_CONFIG_PATH\n end",
"def config_filename\n return @config_filename if @config_filename\n\n @config_filename = File.join(config_directory, \"config\")\n end",
"def find_config_path\n path = Pathname(Pathname.pwd).ascend{|d| h=d+config_filename; break h if h.file?}\n end",
"def full_configuration_path\n @full_config_path ||= File.join(self.class.config_base_path, self.class.config_path)\n end",
"def path\n @path || File.expand_path(ENV['NEXUS_CONFIG'] || DEFAULT_FILE)\n end",
"def get_config_path()\n return ENV['DOCS_CONFIG_PATH'] || CONFIG_PATH_DEFAULT\n end",
"def cfg_dir\n File.join(@full_path, CONFIG_DIR)\n end",
"def configuration_file\n gitpusshuten_root + '/config.rb'\n end",
"def config_file\n File.join(root, 'config.yml')\n end",
"def config_file\n \"#{confdir}/config.yml\"\n end",
"def config_file_name\n @config_file_name || Pdm.config_file\n end",
"def config_path\n etc+\"php/\"\n end",
"def global_config_path\n linux_cfg = '/etc/openshift/' + conf_name\n File.exists?(linux_cfg) ? linux_cfg : File.join(File.expand_path(File.dirname(__FILE__) + \"/../../conf\"), conf_name)\n end",
"def config_file_path\n rails_root + \"/config/redis.conf\"\n end",
"def config\n @config_file\n end",
"def config_path\n File.join(solr_home, 'conf')\n end",
"def config\n root.join('config', 'environment.rb')\n end",
"def relative_config_file\n File.join(@settings[:config_dir], @settings[:config_file])\n end",
"def get_config_directory()\n\t\t\tconfig_directory= File.join(@base_directory, \"config\")\n\t\t\treturn config_directory\n\t\tend",
"def get_configuration_file\n file = PREFERENCES_LEGACY\n file = PREFERENCES if File.exists? '/usr/libexec/opendirectoryd'\n file\n end",
"def conf_folder\n conf['conf_folder'] || '.'\n end",
"def config_dir\n dir = options[:config] ? File.dirname(options[:config]) : './config'\n File.expand_path(dir)\n end",
"def facebook_app_config_path\n case current_subdomain\n when 'vault'\n FacebookBackup::Vault.config_path\n else\n FacebookBackup.config_path\n end\n end",
"def config_file_path(config_file_path=nil)\n @config_file_path ||= config_file_path || File.join(config_path, config_filename)\n end",
"def app_config_file(filename)\n File.read(File.dirname(__FILE__)+\"/../../app/config/\" + filename).split(\"\\n\")\nend",
"def config_file\n FilePath.new(@directory, 'tc-config.xml')\n end",
"def package_config\n File.join @proj_path_base, 'packages.config'\n end",
"def config_file\n env_config['config_file'] || raise('environment problem:environment information not loaded')\n end",
"def find_config_file\n\n root_directory = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))\n app_config = File.join(root_directory, CONFIG_FILE_NAME)\n global_config = File.join('/etc', CONFIG_FILE_NAME)\n\n [app_config, global_config].each do |config_file|\n return config_file if File.exists?(config_file)\n end\n\n nil\n\n end",
"def plugin_config_file\n File.join(@dir, Config::FILE_NAME)\n end",
"def default_global_config_file\n File.join(File.expand_path(ENV[\"HOME\"]), \".kitchen\", \"config.yml\")\n end",
"def default_path\n Pathname.pwd.join(*base_config_path, self.class.config_folder)\n end",
"def configru_path\n @configru_path ||= if ::File.directory?(new_resource.path)\n ::File.join(new_resource.path, 'config.ru')\n else\n new_resource.path\n end\n end",
"def config_path\n ENV.fetch(\"SIMPLE_SCHEDULER_CONFIG\", \"config/simple_scheduler.yml\")\n end",
"def core_cfg_path\n File.expand_path(ENV[\"DBS_CFGDIR\"].presence || \"~/.db_sucker\")\n end",
"def get_config_file_for(name)\n if File.exists?(\"#{user_dir}/config/#{name}\")\n \"#{user_dir}/config/#{name}\"\n else\n \"#{root_dir}/config/#{name}\"\n end\n end",
"def current_texte_path\n config = File.open('./.config.msh','rb'){|f|Marshal.load(f)}\n config[:last_file_path]\n end",
"def chef_api_config_path\n ENV[\"CHEF_API_CONFIG\"] || if ENV.key?(\"HOME\")\n \"~/.chef-api\"\n else\n nil\n end\n end",
"def config_dev_path\n File.join test_app_path, 'config', 'deploy', 'dev.rb'\n end",
"def config_filename\n @config_filename || 'config/database.yml'\n end",
"def chef_config_path\n Berkshelf.root.join(\"spec/config/knife.rb\").to_s\n end",
"def app_path(path)\n return File.expand_path(File.join(@@config['appPath'], path))\n end",
"def path\n application? ? application_path : local_path\n end",
"def application_path\n if environment.container?\n applications_path.join(application_name_as_snake_case)\n else\n Pathname.new('app')\n end\n end",
"def application_url\n raise Exception.new('You need to load the configuration before using it.') if @config.nil?\n\n return @config[APPLICATION_URL_KEY]\n end",
"def project_config_file\n config_file = {}\n\n if ::File.exists?(@config_file)\n config_file = @global.load_ruby_config(@config_file)\n else\n @task.say_error \"Could not find the config file!\", \"Are you sure you're in a marv project directory?\", false\n abort\n end\n\n return config_file\n end",
"def confdir\n cli_confdir = cli[:confdir]\n global = global_config_dir\n if !cli_confdir.nil?\n return cli_confdir\n elsif File.directory?(global)\n return global\n else\n return user_config_dir\n end\n end",
"def config_path\n test? ? \"config-test.yml\" : \"config.yml\"\n end",
"def conf_file(name)\n user_conf = File.join(PoolParty.user_dir, \"config\", name)\n if File.file?(user_conf)\n File.join(PoolParty.user_dir, \"config\", name)\n else\n File.join(PoolParty.root_dir, \"config\", name)\n end \n end",
"def config_directory\n \"C:\\\\chef\"\n end",
"def config_dir\n Wonkavision::Sample::CONFIG_DIR\n end",
"def root\n application && application.config.root\n end",
"def chef_config_path\n if Chef::Config['config_file']\n ::File.dirname(Chef::Config['config_file'])\n else\n raise(\"No chef config file defined. Are you running \\\nchef-solo? If so you will need to define a path for the ohai_plugin as the \\\npath cannot be determined\")\n end\n end",
"def lockfile_path\n config.pwd.join(LOCKFILE)\n end",
"def config_path(arg = nil)\n set_or_return(:config_path,\n arg,\n kind_of: String,\n default: '/etc/hipache.json')\n end",
"def config_dir\n \"#{gem_dir}/config\"\n end",
"def config_dir\n \"#{gem_dir}/config\"\n end",
"def john_config_file\n ::File.join(::Msf::Config.data_directory, \"jtr\", \"john.conf\")\n end",
"def config\n path = \"./\"\n path = \"config/\" if File.exists?(\"config/\")\n if config_exists?(path) && !Opt[:force]\n puts \"Config file already exists\"\n exit\n else\n FileUtils.copy(File.dirname(__FILE__) + \"/#{CONFIG_FILE}\", path)\n puts \"Copied config file to #{path}\"\n end\n end",
"def root\n self.config[:root] || Dir.pwd rescue Dir.pwd\n end",
"def config_file\n send_command(:getinfo, 'config-file')\n reply = read_reply.split('=').last\n read_reply # skip \"250 OK\"\n Pathname(reply)\n end",
"def config_path\n NginxStage.pun_config_path(user: user)\n end",
"def configuration_file_for(target_dir); end",
"def default_app_variables_path\n Hanami.root.join(\"apps\", Concierge.app.to_s, \"config\", \"environment_variables.yml\").to_s\n end",
"def maintenance_config_file_path\n File.join shared_path, 'config', 'maintenance.json'\n end",
"def get_file_path(filename)\n # dir = File.realdirpath(File.join(File.dirname(__FILE__), '..', 'config'))\n File.join(@dir, filename)\n end",
"def root\n self.config[:root] || Dir.pwd rescue Dir.pwd\n end",
"def conf_root(root = nil)\n Pathname(File.expand_path(root || Environment::CONFROOT || ENV['MIKUTTER_CONFROOT'] || '~/.mikutter'))\n rescue\n Pathname(File.expand_path(ENV['MIKUTTER_CONFROOT'] || '~/.mikutter'))\n end",
"def config_file_path(full_directory_path)\r\n config_path = File.join(full_directory_path, @folder_config)\r\n logger.debug('config_file_path') { \"Config file path: #{config_path}\"}\r\n config_path\r\n end",
"def config_file\n File.join(install_directory,'installer','rails_installer.yml')\n end",
"def log_path\n @options['log_path'] ? File.expand_path(@options['log_path'], @config.root) : default_log_path\n end",
"def config_root\n @config_root ||= root / 'config'\n end",
"def config_path(svc_name)\n # strip st2 prefix\n noprefix_name = svc_name.sub(/^st2/, '')\n config_name = ['logging', noprefix_name, 'conf'].compact.join('.')\n File.join([spec[:conf_dir], config_name])\n end",
"def app_config_key\n return @app_config_key\n end",
"def config_dir\n runtime_config.generated_files_dir\n end",
"def config\n App.instance.load_project_config\n App.instance.config\n end",
"def log_path\n case Merb::Config[:log_file]\n when String then File.dirname(Merb::Config[:log_file])\n else Merb.root_path(\"log\")\n end\n end",
"def log_path\n case Merb::Config[:log_file]\n when String then File.dirname(Merb::Config[:log_file])\n else Merb.root_path(\"log\")\n end\n end",
"def current_configuration\n if @current_configuration.nil?\n raise \"Unable to find configuration file: #{full_configuration_path}\" unless File.exists?(full_configuration_path)\n full_config = YAML.load(File.open(full_configuration_path, \"r\"))\n raise \"No configuration found for environment: #{self.class.environment}\" unless full_config.has_key?(self.class.environment)\n @current_configuration = full_config[self.class.environment]\n end\n @current_configuration\n end",
"def path\n File.join(dir, \"#{APP}.json\")\n end",
"def applications_path\n Pathname.new('apps')\n end",
"def application_mode_file_path locale = locale\n File.join(Translate::Storage.root_dir, \"config\", \"locales\", \"#{locale}.yml\")\n end",
"def config_path(config_type)\n config_type = config_type.to_s\n if (config_path = config_options.fetch(\"#{config_type}_config_path\".to_sym, nil))\n raise ConfigurationError, \"file does not exist #{config_path}\" unless ::File.file? config_path\n return ::File.expand_path(config_path)\n end\n\n # if solr, attempt to use path where fedora.yml is first\n if config_type == \"solr\" && (config_path = check_fedora_path_for_solr)\n return config_path\n end\n\n if defined?(Rails.root)\n config_path = \"#{Rails.root}/config/#{config_type}.yml\"\n return config_path if ::File.file? config_path\n end\n\n return \"#{Dir.getwd}/config/#{config_type}.yml\" if ::File.file? \"#{Dir.getwd}/config/#{config_type}.yml\"\n\n # Last choice, check for the default config file\n config_path = ::File.join(ActiveFedora.root, \"config\", \"#{config_type}.yml\")\n raise ConfigurationError, \"Couldn't load #{config_type} config file!\" unless ::File.file?(config_path)\n\n ActiveFedora::Base.logger.warn \"Using the default #{config_type}.yml that comes with active-fedora. If you want to override this, pass the path to #{config_type}.yml to ActiveFedora - ie. ActiveFedora.init(:#{config_type}_config_path => '/path/to/#{config_type}.yml') - or set Rails.root and put #{config_type}.yml into \\#{Rails.root}/config.\"\n config_path\n end"
] |
[
"0.8710351",
"0.85291845",
"0.8201271",
"0.811794",
"0.80136657",
"0.7929726",
"0.7921384",
"0.7830639",
"0.7786527",
"0.7777559",
"0.77421814",
"0.77030224",
"0.7688194",
"0.76841587",
"0.76562816",
"0.765533",
"0.75824237",
"0.75769",
"0.7561342",
"0.7485603",
"0.7481143",
"0.74467695",
"0.7439354",
"0.7398351",
"0.739134",
"0.7388299",
"0.736677",
"0.7365887",
"0.7330332",
"0.73001826",
"0.7282253",
"0.72359544",
"0.7220502",
"0.71831",
"0.71671915",
"0.71545756",
"0.7143612",
"0.71129715",
"0.7103562",
"0.708682",
"0.70764536",
"0.7076226",
"0.7026809",
"0.7025435",
"0.7009036",
"0.6999816",
"0.69639325",
"0.6956169",
"0.69256943",
"0.69214696",
"0.6920031",
"0.6903795",
"0.6886236",
"0.68838626",
"0.68530667",
"0.68422574",
"0.6811614",
"0.67760545",
"0.6770875",
"0.6760065",
"0.67411613",
"0.6736003",
"0.67257595",
"0.6725594",
"0.6719348",
"0.6718071",
"0.67145586",
"0.6708828",
"0.6706917",
"0.6695372",
"0.66938967",
"0.66862774",
"0.66732967",
"0.66732967",
"0.6668564",
"0.6647642",
"0.66437703",
"0.66217446",
"0.66198814",
"0.66167486",
"0.6603542",
"0.65846276",
"0.6577282",
"0.65722924",
"0.6563138",
"0.655207",
"0.6523713",
"0.64878625",
"0.64756405",
"0.6465849",
"0.64496434",
"0.644773",
"0.6443432",
"0.644271",
"0.644271",
"0.6442611",
"0.6416591",
"0.64136624",
"0.640214",
"0.6394235"
] |
0.82415223
|
2
|
Return the path to a tasks file by its name ==== Parameters +name+ :: string name of the tasks file ==== Return +string+ :: path to the tasks file
|
def tasks_file(name)
File.expand_path(File.join(@path, %w[ application tasks ], name))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def file_name\n \"#{task_name}.rake\"\n end",
"def path_with_task_name(task_name)\n \"#{path}:#{task_name}\"\n end",
"def file_path\n File.join 'lib', 'woro_tasks', file_name\n end",
"def find_task(name)\n name = name.to_sym unless name.nil?\n @tasks[name]\n end",
"def task_name_from_path(path)\n path = File.absolute_path(path)\n parts = path.split(File::Separator)\n if parts.length < 3 || parts[-2] != 'tasks'\n raise ArgumentError, \"Task path was not inside a module.\"\n end\n mod = parts[-3]\n name = File.basename(path).split('.')[0]\n if name == 'init'\n mod\n else\n \"#{mod}::#{name}\"\n end\n end",
"def task(name)\n get \"#{base_url}/tasks/#{name}\"\n end",
"def compute_task_project_file(projectPath, taskName)\n projectFile = nil\n if(!@CurrentTask)\n #Just get the project file with the complete project path\n if(projectPath)\n projectFile = @ProjectFileLoader.LoadedProjectFile(projectPath.RelativePath)\n end\n else\n if(projectPath)\n # Make the project path relative to the top first as it is now relative to the invoking project file\n invokingProjectFile = @ProjectFileLoader.CurrentlyLoadedProjectFile || @CurrentTask.ProjectFile\n projectFile = get_invoked_project_file(invokingProjectFile.Path, projectPath)\n if(!projectFile)\n fail \"Don't know project file '#{projectPath}' for task '#{taskName}'\"\n end\n else\n # Tasks without path are searched first in their declaring project file and then in all sub project files\n projectFile = @CurrentTask.ProjectFile\n end\n \n end\n return projectFile\n end",
"def _get_task_by_name(task_name)\n @tasks.each do |t|\n return t if t.name == task_name\n end\n raise \"Unknown Task!\" # couldn't find it. boo.\n end",
"def task_for_configuration(config_name)\n \"#{@project_name}:#{config_name}\"\n end",
"def get_task(task_name)\n if using_rake? and task_defined?(task_name)\n Rake::Task[task_name]\n end\n end",
"def localPath(taskName)\n self.pipeline.pipe_root + \"/build/prod/\" + taskName\n end",
"def resolve_task(name)\n name = name.to_s\n @tasks.each do |task|\n return task if task.name == name\n end\n @salticid.tasks.each do |task|\n return task if task.name == name\n end\n nil\n end",
"def task_get(task_name)\n tasks.fetch prepare_key(task_name), nil\n end",
"def task_file_names\n return @task_file_names if @task_file_names\n error \"No #{Noop::Config.dir_path_tasks_local} directory!\" unless Noop::Config.dir_path_tasks_local.directory?\n @task_file_names = find_files(Noop::Config.dir_path_tasks_local, Noop::Config.dir_path_tasks_local) do |file|\n file.to_s.end_with? '.pp'\n end\n end",
"def name\n\t\t\t@task\n end",
"def path(name)\n File.join(@output_dir, name)\n end",
"def task_signature(task_name)\n loader = internal_compiler.loaders.private_environment_loader\n task = loader.load(:task, task_name)\n if task\n return TaskSignature.new(task)\n end\n # Could not find task\n nil\n end",
"def get_name(task_name)\n @view.get_name(task_name)\n end",
"def task_name\n @default_options.fetch(:name, nil)\n end",
"def getTaskName\r\n\t\t\t\t\treturn @taskName\r\n\t\t\t\tend",
"def rake_task task_name\n @rake.invoke_task task_name\n end",
"def rake_task_name\n ENV['RAKE_TASK'].to_s.sub(/(?:r?spec|cucumber):?(.*)/, '\\1').upcase\n end",
"def file_name\n file_name = (\"./tmp/database_doings/doing_uniques/uniques_done.txt\")\n end",
"def task_from_filename(filename)\n require filename\n File.basename(filename).gsub(\".rb\", \"\").camelcase # RAILS_ROOT/rooster/lib/tasks/newsfeed_task.rb => NewsfeedTask\n end",
"def template_path(name)\n File.join(__dir__, 'config', \"#{name}.yml.erb\")\n end",
"def project_path(name)\n project_map[name.to_s]\n end",
"def getFileDest(name)\n return nil if name.index(@templateRoot) != 0\n @projectRoot + '/' + name[@templateRoot.length + 1 .. -1]\n end",
"def file_path(file_name)\n file_map[file_name]['path']\n end",
"def file_path(file_name)\n file_map[file_name]['path']\n end",
"def read_task_file\n File.read(file_path)\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 task_name\n raise \"This Stage has not been bound to a name\" if @name.nil?\n name.name\n end",
"def log_file_name\n @task_id == 'test_runner' ? \"#{@test_name}\" : @task_id\n end",
"def find_task(dict, role, name)\n debug 4, \" find_task(#{role[:name]}, #{name})\"\n task_name = name.sub(/\\.yml$/, '')\n if task_name =~ %r!^(?:roles/|\\.\\./\\.\\./(?:\\.\\./roles/)?)([^/]+)/tasks/([^/]+)$!\n role_name, task_name = $1, $2\n debug 4, \" finding role '#{role_name}' elsewhere in '#{task_name}'\"\n role = find_role_by_name(dict, role_name,\n \"while looking for task '#{name}'\")\n end\n\n task = find_on_role(dict, role, :task, task_name)\n [task, task_name, role]\n end",
"def current_task_name\n return nil unless enabled?\n self.class.current_task_name\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 temp_file_from_name(file_name)\n File.join(@temp_dir, file_name).to_s\n end",
"def latest_file_path(name)\n files = Dir[\"#{ ENV[\"HOME\"] }/workspace/*#{ name }*.txt\"]\n throw RuntimeError if files.empty?\n\n files.sort_by! do |file_name|\n file_match_data = FILE_NAME_FORMAT.match file_name\n date_match_data = file_match_data.to_s.match DATE_FORMAT\n DateTime.parse(date_match_data.to_s)\n end\n files.last\n end",
"def project_file(fname)\n \"#{@project_path}/#{fname}\"\nend",
"def files(*name)\n\t\treturn File.join(name)\n\tend",
"def rakefile\n 'Rakefile'\n end",
"def get_path(filename)\n\n Pathname(__FILE__).ascend{ |directory|\n path = directory + \"ansiblealexa.yml\"; break path if path.file?\n }\n\nend",
"def name\n filename\n end",
"def name\n filename\n end",
"def extract_task_name(str)\n matches = str.match(/^(?<name>[^\\[\\]]*)(?:(\\[.*\\])?)$/) # Task name with optional parameters\n if matches.try(:names).blank?\n raise InvalidTasks, \"#{PATH} contains a bad formatted task: #{str}\"\n else\n matches[:name]\n end\n end",
"def random_task_name\n \"test_task_#{SecureRandom.hex}\"\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 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 task\n @keys[:task]\n end",
"def tasks\n ProjectConfiguration.templates[template]::TASKS\n end",
"def tasks\n ProjectConfiguration.templates[template]::TASKS\n end",
"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 find(name)\n Forgery.load_paths.reverse.each do |path|\n file = \"#{path}/#{@folder}/#{name}\"\n return file if File.exists?(file)\n end\n raise ArgumentError.new(\"File '#{name}' wasn't found in '#{@folder}' folder. Searched paths: \\n#{Forgery.load_paths.join('\\n')}\")\n end",
"def get_file(name, env)\n name = name + '.rb' unless name =~ /\\.rb$/\n path = search_directories(env).find { |dir| Puppet::FileSystem.exist?(File.join(dir, name)) }\n path and File.join(path, name)\n end",
"def find_file(name)\n path = File.join(TEST_FILES, name)\n raise \"Can't find #{path}\" unless File.exist?(path)\n\n yield path if block_given?\n path\n end",
"def find_state_by_name(name)\n find_task_by_name(\"#{name}_state\")\n end",
"def path()\n return ::File.join(@root, @name)\n end",
"def file_task? path\r\n task = Rake.application.find_task path\r\n if not task\r\n if File.exists? path\r\n task = Rake.application.define_task(Rake::FastFileTask, path)\r\n end\r\n end\r\n if task\r\n # Generate file so it can be processed for includes\r\n # as well.\r\n task.invoke\r\n true\r\n else\r\n false\r\n end\r\n end",
"def template_paths(name)\r\n \t@templates.inject([]) 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 scraping_task_method(task_name)\n \"scrape_#{task_name}\"\n end",
"def file_path(file_name, description=nil)\n extension = File.extname(file_name)\n basename = File.basename(file_name, extension)\n file_path = File.join(@files_dir, \"#{basename}_#{::Time.now.strftime(\"%H%M%S\")}_#{example_group_number}_#{example_number}#{extension}\")\n @files_saved_during_example.unshift(:desc => description, :path => file_path)\n file_path\n end",
"def lookup_in_scope(name, scope)\n loop do\n tn = scope.path_with_task_name(name)\n task = @tasks[tn]\n return task if task\n break if scope.empty?\n scope = scope.tail\n end\n nil\n end",
"def name\n @name ||= @project.dir.path.match(/.*\\/(.*)$/).nil? ? \"unknown\" : $1\n end",
"def runlog_thread_filename(name)\n @filename + '-' + name.to_s\n end",
"def task_present?(task_name)\n tasks.key? prepare_key(task_name)\n end",
"def dep_path(name)\n config.pwd.join(\"deps\", name)\n end",
"def name\n @name ||= ::File.basename(@path)\n end",
"def file_name(name)\r\n return name.to_s.downcase + '.rb' if name.kind_of?(Symbol)\r\n return ext_name(name).downcase + '.rb'\r\n end",
"def name\n @name ||= File.basename(path)\n end",
"def name\n @name ||= File.basename(path)\n end",
"def add_project(name)\n @tasks[name] = []\n end",
"def pathTo(name)\r\n\t\tif @paths.nil?\r\n\t\t\treturn nil\r\n\t\tend\r\n\t\t@paths.each do |path|\r\n\t\t\tif path.getDestination().getName() == name\r\n\t\t\t\treturn path\r\n\t\t\tend\r\n\t\tend\r\n\t\treturn nil\r\n\tend",
"def name\n @name ||= File.basename(path)\n end",
"def describe_rake_task(task_name, filename, &block)\n require \"rake\"\n\n describe \"Rake task #{task_name}\" do\n attr_reader :task\n\n before(:all) do\n @rake = Rake::Application.new\n Rake.application = @rake\n load filename\n @task = Rake::Task[task_name]\n end\n\n after(:all) do\n Rake.application = nil\n end\n\n def invoke!\n for action in task.instance_eval { @actions }\n instance_eval(&action)\n end\n end\n\n def tmppath(*paths)\n parts = [File.dirname(__FILE__), \"tmp\"]\n parts << (@root_time ||= Time.now.to_i.to_s)\n parts += paths\n # parts << rand().to_s.split(\".\").last\n parts.collect! {|path| path.to_s}\n path = File.join(*parts)\n attempts = 10\n while File.exists?(path)\n path.succ!\n attempts -= 1\n raise \"Unable to find a good temp pathname: #{path.inspect}\" if attempts.zero?\n end\n\n File.expand_path(path)\n end\n\n def cleanup\n path = File.expand_path(File.join(File.dirname(__FILE__), \"tmp\"))\n FileUtils.rm_rf(path)\n end\n\n instance_eval(&block)\n end\nend",
"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 task_remove(task_name)\n return unless task_present? task_name\n tasks.delete prepare_key(task_name)\n reset\n end",
"def filename\n File.join(%w{public finished-jobs},Digest::SHA1.hexdigest(url)+\".txt\")\n end",
"def tasks_directory\n @cached_paths[:tasks_directory] ||= look_up_configured_path(\n :tasks_directory,\n :defaults => ['tasks']\n )\n end",
"def search_task_in_project_file_tree(projectFile, name, scopes)\n #puts \"Looking for task '#{name}' in tree under '#{projectFile.Path().to_s}'\"\n if(!projectFile)\n raise \"No valid project file specified to search for task #{name}\"\n end\n \n task = projectFile[name, scopes]\n if(task != nil)\n #puts \"Found task '#{task.name}'\"\n return task\n end\n \n #puts \"Searching project file includes #{projectFile.ProjectFileIncludes}\"\n projectFile.ProjectFileIncludes.each do |includePath|\n includedProjectFile = get_invoked_project_file(projectFile.Path, includePath)\n if(!includedProjectFile)\n puts \"WARNING: Could not find included project file '#{includePath.to_s}' in '#{projectFile.Path().to_s}'\"\n end\n task = search_task_in_project_file_tree(includedProjectFile, name, scopes)\n if(task != nil)\n #puts \"Found task '#{task.name}'\"\n return task\n end\n end\n \n #puts \"Could not find task in tree under '#{projectFile.Path().to_s}'\"\n return nil\n end",
"def path(name=nil)\n if name\n return @dir + '/' + name\n else\n return @dir\n end\n end",
"def find_filename(name)\n return name if not File.exists?(name)\n\n new_name = name\n count = 0\n until not File.exists?(new_name)\n count += 1\n new_name = \"#{name}_#{count}\"\n end\n\n new_name\n end",
"def path\n File.join(@base, @name)\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 pretty_name(name)\n case name\n when 'task_base'\n 'task'\n when 'force_success'\n 'forcesuccess'\n when 'force_failure'\n 'forcefailure'\n else\n name\n end\n end",
"def template_path(name)\n \"https://#{@templates_bucket}.s3.amazonaws.com/#{@templates_version}/#{name}.yaml\"\n end",
"def [](task_name, scopes=nil)\n task_name = task_name.to_s\n self.lookup(task_name, scopes) or\n enhance_with_matching_rule(task_name) or\n synthesize_file_task(task_name) or\n fail generate_message_for_undefined_task(task_name)\n end",
"def url_for_project_named(name)\n eval project_path\n end",
"def write_rake_step(default: false)\n prefix = @workflow_id + '_'\n prefix = prefix + 'task_' if not default\n if @rake_task == false\n @log.fatal { 'No Rake Task defined' }; exit\n else\n file_out = \"#{prefix}#{@task_name}.rb\"\n dest = File.open(file_out, 'w') # a = append\n dest.puts @rake_task\n dest.close\n @log.info \"Write Rake Step : [#{@task_name}] in [#{file_out}]\"\n return @project_path + '/' + file_out\n end\n end",
"def path\n File.join(@base, @name)\n end",
"def project_root\n this_file_path.ascend do |p|\n rakefile = p.join( 'Rakefile' )\n return p if rakefile.exist?\n end\n end",
"def fetch(task_name, opts = EMPTY_HASH)\n task(task_name, opts)\n end",
"def current_state(name)\n task = get_task(name)\n case\n when task.nil?\n \"Not Created\"\n when task.State >= 0 && task.State <= 4\n [\"Unknown\", \"Disabled\", \"Queued\", \"Ready\", \"Running\"].fetch(task.State)\n when task.State == 3 && task.LastTaskResult == 0\n \"Completed\"\n end\n end",
"def find_file_named name\n @files_hash[name]\n end",
"def get_path_inside_project(file_path)\n file_path.gsub(%r{/#{local_source_path}}, @name)\n end",
"def recipe_name\n File.basename(options[:runner_path]).gsub(/\\..*/, '')\n end",
"def template(name)\n File.join TemplatePath, \"#{name}.rb\"\nend",
"def get_name(path_name)\n resume_file_name = path_name.downcase.split('/').last\n # Replace 'resume' with whatever comes after the name in that folder\n end_index = resume_file_name.index('resume')\n # This is for the nonanalytics folder\n # first_index = resume_file_name.index(\"_\")\n # end_index = resume_file_name.index('_', first_index + 1)\n name = resume_file_name[0, end_index - 1]\n return name\nend",
"def name\n File.basename(__FILE__, '.rb')\n end",
"def task_info(name, details=nil, code=nil)\r\n task_files unless @task_files\r\n\r\n # FIND TASK FILE\r\n\r\n name = name.sub('bg_worker_', '')\r\n rake = \"bg_worker_#{name}.rake\"\r\n @filename = Rails.root.join('lib', 'tasks', rake)\r\n return BgWorker.task if name.blank? || !@task_files.find(name)\r\n\r\n # SET BASIC PROPERTIES\r\n\r\n task = BgWorker.task(:name => name, :filename => @filename)\r\n\r\n # IF LOOKING FOR ADVANCED PROPERTIES, MUST READ FILE\r\n\r\n if details || code\r\n begin\r\n @data = IO.readlines(@filename)\r\n rescue\r\n flash[:warning] = _(\"File invalid\")\r\n return task\r\n end\r\n end\r\n\r\n # DETAILS ARE MERELY EXTRACTED FROM COMMENTS\r\n # ONE MAY EXTRACT INFORMATION DIRECTLY FROM THE SOURCE\r\n # USING CLEVER REGEXEN\r\n\r\n if details\r\n @data.grep(/. (name|args|desc|namespace|dependencies): (.*)/) do |line|\r\n ppt = Regexp.last_match(1)\r\n val = Regexp.last_match(2)\r\n if ppt == 'args' || ppt == 'dependencies'\r\n task[ppt.to_sym] = val.tr(' :', ',').split(',').map{|d| d unless d.blank? }.compact.join(', ')\r\n elsif ppt == 'namespace' && !val.blank?\r\n task[:namespace] = val\r\n task[:fullname] = \"#{task[:namespace]}:bg_worker_#{task[:name]}\"\r\n else\r\n task[ppt.to_sym] = val\r\n end\r\n end\r\n end\r\n\r\n # CODE HAS TO BE EXTRACTED FROM IN-BETWEEN TASK DEFINITION\r\n # AND BLOCK END\r\n\r\n if code\r\n task_begin_code_regexp = /\\A\\s*task :#{task[:name]}.* do \\|.*\\|\\Z/\r\n task_end_code_regexp = /\\A\\s*end\\Z/\r\n ends = []\r\n defs = []\r\n @data.each_with_index {|l, i|\r\n defs << i if l =~ task_begin_code_regexp\r\n ends << i if l =~ task_end_code_regexp\r\n }\r\n if defs.size == 1 && ends.size >= 1\r\n task_end = (task[:namespace] && ends[-2]) ? ends[-2] : ends[-1]\r\n task_def = defs[0] + 1\r\n task_end -= 1\r\n task[:code] = task_def < task_end ? @data[task_def..task_end].join.strip : ''\r\n else\r\n flash[:warning] = _(\"This file is not standardized\")\r\n task[:code] = @data.join.strip\r\n end\r\n end\r\n return BgWorker.task(task)\r\n end"
] |
[
"0.7656034",
"0.7329245",
"0.71107155",
"0.6982276",
"0.6861047",
"0.6798232",
"0.65880334",
"0.64466214",
"0.64102185",
"0.63920736",
"0.6363892",
"0.628988",
"0.62888545",
"0.6229122",
"0.6141346",
"0.6029299",
"0.5956704",
"0.59522754",
"0.5868086",
"0.5866187",
"0.5860112",
"0.5851421",
"0.5849509",
"0.58399636",
"0.5831833",
"0.5810972",
"0.5805699",
"0.57802653",
"0.57802653",
"0.5759389",
"0.57501477",
"0.57501477",
"0.5721727",
"0.570894",
"0.5699618",
"0.56992936",
"0.5663925",
"0.5646766",
"0.5637112",
"0.5627685",
"0.5598727",
"0.5597525",
"0.5584048",
"0.557967",
"0.557967",
"0.5537827",
"0.553555",
"0.55248725",
"0.54781556",
"0.5476982",
"0.5475968",
"0.5475968",
"0.5470674",
"0.54698306",
"0.5466819",
"0.54419625",
"0.5430164",
"0.54266655",
"0.5426373",
"0.5423481",
"0.5410891",
"0.54104596",
"0.5403888",
"0.53924745",
"0.5390939",
"0.5390852",
"0.53895754",
"0.5381648",
"0.53791904",
"0.5374698",
"0.5374698",
"0.5358339",
"0.5357728",
"0.5355206",
"0.5346638",
"0.53427696",
"0.5342769",
"0.5339251",
"0.5338563",
"0.5338398",
"0.5336786",
"0.5332022",
"0.53291535",
"0.53274554",
"0.53177804",
"0.5316351",
"0.53093433",
"0.53041255",
"0.53039145",
"0.53025323",
"0.5301408",
"0.5298485",
"0.529814",
"0.5297329",
"0.5289113",
"0.5287767",
"0.5287091",
"0.5283161",
"0.5280224",
"0.5279324"
] |
0.8417948
|
0
|
check if laravel framework exists in the current application's directory currently, this is performed by looking for the presence of 'artisan' file and the 'laravel' subdirectory. ==== Return +boolean+ :: true, if laravel framework exists
|
def has_laravel?
laravel_exists_in_directory?(@path)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def laravel_exists_in_directory?(directory = nil, relative_to = nil)\n return false unless directory\n directory = File.expand_path(directory, relative_to)\n return false unless File.exists? File.join(directory, \"artisan\")\n return false unless File.directory? File.join(directory, \"laravel\")\n true\n end",
"def rails_app?\n File.exist?(\"bin/rails\")\n end",
"def environment?\n dir?('.bundle') || dir?('.virtualenv') || dir?('node_modules')\n end",
"def has_cache?\n laravel_exists_in_directory?(@cache)\n end",
"def application?\n gem_dir\n end",
"def application?\n gem_dir\n end",
"def ruby?\n exist? 'Gemfile'\n end",
"def bundle_exists?\n File.exists? self.bundle_dir\n end",
"def is_framework_package?(name)\n options.current_execution_environment.packages.include?(name) || options.extra_packages.include?(name)\n end",
"def gemfile_exists? \n File.exists? \"Gemfile\"\nend",
"def gemfile_exists? \n File.exists? \"Gemfile\"\nend",
"def rails?\n File.directory? dest + '/vendor'\n end",
"def as_framework?\n (self.installed? and File.exists? prefix+\"Frameworks/Python.framework\") or build_framework?\n end",
"def exists?\n factory.system.dir_exists?(@path)\n end",
"def includes_framework?(framework_name)\n config.app.frameworks.include?(framework_name.to_sym)\n end",
"def python?\n exist? 'requirements.txt'\n end",
"def as_framework?\n (self.installed? and File.exists? prefix+\"Frameworks/Python.framework\") or build_framework?\nend",
"def installed?\n File.exists?(@path)\n end",
"def app_available?(app)\n `which #{app}`.strip == \"\" ? false : true\n end",
"def application?\n (filtered_file =~ /^\\[PROJECT_ROOT\\]/i) && !(filtered_file =~ /^\\[PROJECT_ROOT\\]\\/vendor/i)\n end",
"def exists?(app_name)\n File.exists? File.join(path, app_name)\n end",
"def node_modules?\n !!name.match(/node_modules\\//)\n end",
"def installed?\n File.exist?(swiftlint_path)\n end",
"def app_yaml_exists?\n if @site.respond_to?(:in_source_dir)\n File.exists? @site.in_source_dir(\"app.yaml\")\n else\n File.exists? Jekyll.sanitized_path(@site.source, \"app.yaml\")\n end\n end",
"def installed?\n ::File.exist?(PATH)\n end",
"def exist?(*app_names)\n each_app(*app_names) do |server_app|\n server_app.root_path\n end\n end",
"def exists?\n File.exists?(File.join(@root))\n end",
"def app_is_installed?\n if installed_app_bundle_dir ||\n simctl.app_container(device, app.bundle_identifier)\n true\n else\n false\n end\n end",
"def rails?\n defined?(::Rails) && ::Rails.application.present? # &.initialized?\n end",
"def env_already_loaded?\n defined? Rails\n end",
"def installed?\n !IO.popen(\"which #{self}\"){|i| i.read}.empty?\n end",
"def bundler?\n @bundler ||= File.exist?(\"#{ Dir.pwd }/Gemfile\")\n end",
"def current_directory?\n File.exist? current_directory\n end",
"def framework_package_name\n if lumen?\n \"laravel/lumen-framework\"\n else\n \"laravel/framework\"\n end\n end",
"def local?\n test_framework?\n end",
"def installed?\n (dir = installed_prefix).directory? && dir.children.length > 0\n end",
"def passenger_rack_app?\n workdir.directory? &&\n workdir.join(\"config.ru\").file? &&\n workdir.join(\"tmp\").directory? &&\n workdir.join(\"public\").directory?\n end",
"def source_partial_exists?\n if @site.respond_to?(:in_source_dir)\n File.exists? @site.in_source_dir(\"_app.yaml\")\n else\n File.exists? Jekyll.sanitized_path(@site.source, \"_app.yaml\")\n end\n end",
"def rails_root?\n !@rails_root.blank? && @rails_root.directory?\n end",
"def build_framework?; build.include? 'framework'; end",
"def php?\n ::FileTest.exist?('/usr/bin/php')\n end",
"def php?\n ::FileTest.exist?('/usr/bin/php')\n end",
"def current_folder_has_souffle_config?\n File.exists? \"#{Dir.pwd}/souffle.json\"\n end",
"def stow_path_bin_exists?\n ::File.exist?(\"#{stow_path}/../bin/stow\")\n end",
"def installed?(command)\n MakeMakefile.find_executable(command)\n end",
"def is_middleman?\n (@config.settings[:framework] == 'middleman' unless @config.blank?) || Gem::Specification::find_all_by_name('middleman').any?\n end",
"def exists?\n return true if File.directory?(@path)\n false\n end",
"def dot_installed?\n assert_usr_bin_env_exists\n system \"#{USR_BIN_ENV} which dot > /dev/null\"\n end",
"def rails?\n @rails = File.exist?(\"config/environment.rb\")\n end",
"def check\n if File.directory?(app_dir)\n engine_in_app = app_migrations.map do |file_name|\n name, engine = file_name.split('.', 2)\n next unless match_engine?(engine)\n\n name\n end.compact\n\n missing_migrations = engine_migrations.sort - engine_in_app.sort\n unless missing_migrations.empty?\n puts \"[#{engine_name.capitalize} WARNING] Missing migrations.\"\n missing_migrations.each do |migration|\n puts \"[#{engine_name.capitalize} WARNING] #{migration} from #{engine_name} is missing.\"\n end\n puts \"[#{engine_name.capitalize} WARNING] Run `bundle exec rake railties:install:migrations` to get them.\\n\\n\"\n true\n end\n end\n end",
"def exists?\n validate_directory_structure\n end",
"def exists?\n File.exists? dir\n end",
"def model_exists?(model)\n File.exists? File.join(RAILS_ROOT,'app/models', model + '.rb')\n end",
"def has_visor?\n File.exists?(\"#{ENV['HOME']}/Library/Application\\ Support/SIMBL/Plugins/Visor.bundle/\")\n end",
"def exists?\n ::File.directory? self.path\n end",
"def has_virtualenv_installed(python)\n `#{python} -m virtualenv --help 2>&1`\n if (0 != $?.to_i)\n false\n else\n true\n end\n end",
"def command_exists?(command)\n ENV['PATH'].split(File::PATH_SEPARATOR).any? {|d| File.exists? File.join(d, command) }\nend",
"def installed?\n MacOS.dev_tools_path == Pathname.new(\"/usr/bin\")\n end",
"def exist?\n ruby_gems_fetcher.started?\n end",
"def gradlew_exists?\n !`ls gradlew`.strip.empty?\n end",
"def rails_development?\n defined?(::Spring)\n end",
"def resource_exists?\n path_exists? install_dir\nend",
"def vendorized?\n File.directory?(normalize(:lib)) && normalize(:lib)\n end",
"def bundler_installed?\n\t`(gem spec bundler -v > /dev/null 2>&1)`\n end",
"def bundler_installed?\n\t`(gem spec bundler -v > /dev/null 2>&1)`\n end",
"def bundler_installed?\n\t`(gem spec bundler -v > /dev/null 2>&1)`\n end",
"def run?\n @run ||= true\n @run and !@running and app_file? and $0.expand_path == app_file.expand_path\n end",
"def rvm_installed?\n cmd_test %{-s \"/usr/local/lib/rvm\"}\nend",
"def directory_exists?(path)\n run(\"test -d #{path}\").success?\n end",
"def gem_path?(file); end",
"def integrated\n File.exist?(gemfile)\n end",
"def model_exists?(model)\n File.exists? File.join(RAILS_ROOT,'app/models', model + '.rb')\nend",
"def lib_root?\n false\n end",
"def ready?\n File.exist?(desktop_path) && \n File.directory?(libs_path)\n end",
"def has_current_application?\n not self.current_application.nil?\n end",
"def dir_exists?(name)\n # Does it exist?\n end",
"def frameworks_invalid?(frameworks)\n frameworks.any? do |framework|\n framework_regex = /[^\\w\\-\\+]/\n framework =~ framework_regex\n end\n end",
"def available?\n path.directory?\n end",
"def installed?(utility)\n return false if execute_as_root(\"which #{utility}\").nil?\n true\n end",
"def installed?\n secrets = @stage.get('secrets').map(&:name)\n secrets.any? { |s| s.match(/\\Ash\\.helm\\.release\\.v\\d+\\.#{Regexp.escape(name)}\\./) }\n end",
"def directory_exists?(path)\n end",
"def env_exists?(ruby_string)\n return true if system_ruby?(ruby_string)\n\n rubie = select_ruby(ruby_string)\n gemset = select_gemset(ruby_string)\n\n if gemset\n gemset_exists?(:ruby => rubie, :gemset => gemset)\n else\n ruby_installed?(rubie)\n end\n end",
"def in_rails?\n !Object.const_get(:Rails).nil?\n end",
"def should_do_python_install?\n return (osx? and (not (File.exists?(python_directory))))\n end",
"def command_exists?(command)\n ENV['PATH'].split(File::PATH_SEPARATOR).any? do |root|\n path = File.join(root, command)\n File.executable?(path) && File.file?(path)\n end\n end",
"def command?(command)\n ENV['PATH'].split(':').any? do |directory|\n File.exists?(File.join(directory, command))\n end\nend",
"def command_exists?(command)\n ENV['PATH'].split(File::PATH_SEPARATOR).any? {|d| File.exists? File.join(d, command) }\n end",
"def installed?\n return prefix.children.length > 0\n rescue\n return false\n end",
"def exists?\n current_user_role_names.each do |role_name|\n return true if Filesystem.test_dir role_name, self, :exists\n end\n false\n end",
"def path_exists?(path)\n File.exists?(path)\n end",
"def executable?\n ::File.executable?(@path)\n end",
"def in_path?(name)\n (`which #{name}`).to_s.strip.size > 0\n end",
"def installed?(cmd)\n !Garcon::FileHelper.which(cmd).nil?\n end",
"def installed?\n File.exist?(\"/etc/munin/plugins/#{name}\")\n end",
"def check_if_bundle_needed\n if `bundle exec #{rspec_command} -v` == `#{rspec_command} -v`\n @bundle = \"\"\n else\n @bundle = \"bundle exec \"\n end\n end",
"def installed? (path_or_repo)\n File.file?(hooks_file(path_or_repo))\n end",
"def rdoc_installed?\n File.exist? @rdoc_dir\n end",
"def rdoc_installed?\n File.exist? @rdoc_dir\n end",
"def local_package?(package)\n return false unless package && package[\"Dir\"]\n return false unless File.fnmatch?(\"#{config.root}*\", package[\"Dir\"], File::FNM_CASEFOLD)\n vendored_path_parts(package).nil?\n end",
"def missing_extensions?\n return false if extensions.empty?\n return false if default_gem?\n return false if File.exist? gem_build_complete_path\n\n true\n end"
] |
[
"0.7489911",
"0.6882119",
"0.66582793",
"0.6546062",
"0.6417397",
"0.6417397",
"0.6262782",
"0.6239475",
"0.6209952",
"0.61106825",
"0.61106825",
"0.60987264",
"0.6097039",
"0.60789406",
"0.60486525",
"0.6011561",
"0.60081226",
"0.59987277",
"0.59533024",
"0.5925606",
"0.5905685",
"0.58866656",
"0.58834916",
"0.5854495",
"0.58115107",
"0.5792801",
"0.57892495",
"0.5765574",
"0.57321817",
"0.57281804",
"0.57005966",
"0.56834966",
"0.56737876",
"0.5632274",
"0.56210655",
"0.561872",
"0.5611566",
"0.55749446",
"0.5558539",
"0.55532646",
"0.55298066",
"0.55298066",
"0.5525455",
"0.5510728",
"0.5489315",
"0.54884225",
"0.5487635",
"0.5478591",
"0.5477547",
"0.54751015",
"0.5472921",
"0.5470941",
"0.5462546",
"0.543388",
"0.54306686",
"0.54073143",
"0.5394754",
"0.5389131",
"0.5384417",
"0.5377303",
"0.5375283",
"0.534944",
"0.53482985",
"0.5344483",
"0.5344483",
"0.5344483",
"0.5339754",
"0.53356725",
"0.53290814",
"0.5316853",
"0.5312794",
"0.5307878",
"0.52930325",
"0.52915907",
"0.5290252",
"0.52902424",
"0.5282274",
"0.5278591",
"0.52647406",
"0.5256906",
"0.5254681",
"0.52539855",
"0.5249292",
"0.523518",
"0.5234759",
"0.5224758",
"0.52235216",
"0.5217442",
"0.52157897",
"0.52129304",
"0.521274",
"0.52106136",
"0.51964664",
"0.5183368",
"0.51650137",
"0.51621044",
"0.5159578",
"0.5159578",
"0.5157393",
"0.5135402"
] |
0.81347567
|
0
|
check if the cache exists for the source specified by the current application's directory this further makes sure that the cache really has laravel framework as we would expect it to ==== Return +boolean+ :: true, if the cache exists
|
def has_cache?
laravel_exists_in_directory?(@cache)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cache_exist?\n File.exist?(@cache_file)\n end",
"def cache_exists?\n File.exist?(cached_file)\n end",
"def cached?\n cache_path.exist?\n end",
"def exists?(path)\n return unless @cache_base\n\n File.exists?(@cache_base + path)\n end",
"def cached?\n cache_path.exist?\n end",
"def cached?\n Dir.exist?(cached_repo_path)\n end",
"def exist?(key)\n File.exist?(cache_path(key))\n end",
"def already_cached?\n File.exist?(cached_installer_path) and File.zero?(cached_installer_path) == false\nend",
"def include?(key)\n File.exist?(cache_path(key))\n end",
"def valid_root_cache?\n return true\n (! options[:purge_cache]) && File.directory?(options[:cache_dir])\n end",
"def page_cache_exists?(url)\n File.exists? page_cache_test_file(url)\n end",
"def exists?\n File.exist? @src_path\n end",
"def cache_valid?\n return false unless File.exist?(cache_path)\n return true if checksum.nil?\n checksum == file_digest(cache_path)\n end",
"def exist?(digest)\n ppg_cache(digest) and directory_cache(digest)\n end",
"def is_in_cache(var)\n Rails.cache.exist?(var)\nend",
"def cache?\n caching && true\n end",
"def cached_file?\n Settings.documents.page_cache && File.exists?(cache_file)\n end",
"def include?(value)\n File.exist?(File.join(cache_path, value))\n end",
"def existe_cache?(recurso)\n if Rails.cache.exist?(\"#{recurso}_#{id}\")\n cache = Rails.cache.read(\"#{recurso}_#{id}\")\n\n begin\n (cache[:created_at] + cache[:expires_in]) > Time.now.to_f\n rescue\n false\n end\n\n else\n false\n end\n end",
"def cached?\n Cache.has? plist\n end",
"def has_laravel?\n laravel_exists_in_directory?(@path)\n end",
"def load_cache\n begin\n file = File.join(\"inline\", File.basename(so_name))\n if require file then\n dir = Inline.directory\n warn \"WAR\\NING: #{dir} exists but is not being used\" if test ?d, dir and $VERBOSE\n return true\n end\n rescue LoadError\n end\n return false\n end",
"def update_cache?\n return @update_cache unless @update_cache.nil?\n @update_cache =\n begin\n File.stat(Gem.user_home).uid == Process.uid\n rescue Errno::ENOENT\n false\n end\n end",
"def folder_reachable?\n Dir.exists? folder_path\n end",
"def asset_exists?(path)\n if Rails.configuration.assets.compile\n Rails.application.precompiled_assets.include? path\n else\n Rails.application.assets_manifest.assets[path].present?\n end\n end",
"def asset_exists?(path)\n if Rails.configuration.assets.compile\n Rails.application.precompiled_assets.include? path\n else\n Rails.application.assets_manifest.assets[path].present?\n end\n end",
"def exists?\n factory.system.dir_exists?(@path)\n end",
"def installed?\n File.exists?(@path)\n end",
"def cached?(key)\n cache_file = @config[:cache_directory] / \"#{key}.cache\"\n _data = _expire = nil\n if File.file?(cache_file)\n _data, _expire = Marshal.load(cache_read(cache_file))\n return true if _expire.nil? || Time.now < _expire\n FileUtils.rm_f(cache_file)\n end\n false\n end",
"def cacheable?(env)\n result = false\n if (url = request_url(env)).blank?\n log(\"NO URI for request #{env.inspect}\")\n elsif cacheable_paths&.none? { |path| url.include?(path) }\n log(\"NON-CACHEABLE URI: #{url}\")\n else\n result = true\n end\n result\n end",
"def cacheable?(env)\n result = false\n if (url = request_url(env)).blank?\n log(\"NO URI for request #{env.inspect}\")\n elsif cacheable_paths&.none? { |path| url.include?(path) }\n log(\"NON-CACHEABLE URI: #{url}\")\n else\n result = true\n end\n result\n end",
"def present?\n File.exists? source_path\n end",
"def found?\n File.exist?(request_path) and (stat.directory? or stat.file?) and stat.readable?\n end",
"def exists?\n ::File.directory? self.path\n end",
"def exist?(key, options = nil)\n Rails.cache.exist?(key, options)\n rescue => exc\n Rails.logger.error { \"MEMCACHE-ERROR: exists?: K: #{key.inspect}. M: #{exc.message}, I: #{exc.inspect}\" }\n nil\n end",
"def exists?\n has_block? or File.exists? @source_path\n end",
"def lut_cache_exists?(name)\n !lut_read_cache_item(name, 0).nil?\n end",
"def webpack_asset_exists?(source, extname)\n manifest[\"#{source}.#{extname}\"].present?\n end",
"def cache?\n false\n end",
"def storage_exists?\n File.exists?(file_path)\n end",
"def source_exists?\n # FIXME: Just a helper as long as ActiveSource is not completely integrated!\n Source.exists?(@uri) || ActiveSource.exists?(:uri => @uri.to_s)\n end",
"def exists?\n return true if File.directory?(@path)\n false\n end",
"def resource_exists?\n path_exists? install_dir\nend",
"def exists?\n File.exists?(File.join(@root))\n end",
"def lockfile_exists?\n File.exist?(lockfile_name)\n end",
"def exists?(cache_key)\n @pg.exec_prepared(@exists_statement_name, [object_to_cache_key(cache_key)]).ntuples.eql?(1)\n end",
"def cached?(key)\n false\n end",
"def run_build?\n ENV['BUILD_ASSETS'].to_s == 'true' ||\n build_files.blank? ||\n src_files.select { |f| File.mtime(f) >= File.mtime(cache_file) }.any?\n end",
"def has_key?(key)\n @cache.has_key?(key)\n end",
"def from_cache?\n @from_cache\n end",
"def exists?\n File.exists?(path)\n end",
"def precompile_assets?\n !File.exist? \"public/assets/manifest.yml\"\n end",
"def remove_repository_cache?\n !copy_cache\n end",
"def exist?\n @metadata_file_path.file? and @metadata_file_path.readable?\n end",
"def exists?\n File.exists?(path)\n end",
"def cache?(key)\n auth_objects_cache.key? key\n end",
"def exists?\n validate_directory_structure\n end",
"def exists?\n File.exist?(@path)\n end",
"def exist?\n ruby_gems_fetcher.started?\n end",
"def exists?\n self.path.present? && File.exist?(self.path)\n end",
"def exist?\n # shouldn't force network connections just to check if content exists\n # only check that the path is not empty\n !path.to_s.empty?\n end",
"def exist?\n # shouldn't force network connections just to check if content exists\n # only check that the path is not empty\n !path.to_s.empty?\n end",
"def exists?\n File.exists?(path)\n end",
"def bundle_exists?\n File.exists? self.bundle_dir\n end",
"def has_assets?\n assets.none?\n end",
"def source_partial_exists?\n if @site.respond_to?(:in_source_dir)\n File.exists? @site.in_source_dir(\"_app.yaml\")\n else\n File.exists? Jekyll.sanitized_path(@site.source, \"_app.yaml\")\n end\n end",
"def exists?\n File.exist?(path)\n end",
"def load_index_cache?(file)\n load_index_cache(file) if File.exist?(file)\n end",
"def data_exist?\n\t\tlocal? || File.exist?(self.data_path)\n\tend",
"def prepare\n unless File.readable?(@config[:cache_directory]) &&\n File.writable?(@config[:cache_directory])\n raise NotAccessible, @config[:cache_directory]\n end\n true\n end",
"def exists?\n File.exists? path\n end",
"def cached?\n options[:cache] == true\n end",
"def have_exact_prebuild_cache?\n\n # check if need build frameworks\n return false if local_manifest == nil\n \n changes = prebuild_pods_changes\n added = changes.added\n changed = changes.changed \n unchanged = changes.unchanged\n deleted = changes.deleted \n \n exsited_framework_pod_names = sandbox.exsited_framework_pod_names\n missing = unchanged.select do |pod_name|\n not exsited_framework_pod_names.include?(pod_name)\n end\n\n needed = (added + changed + deleted + missing)\n \n return needed.empty?\n end",
"def exists?\n File.exists? dir\n end",
"def exist?\n @local_path and @local_path.exist?\n end",
"def exists_file?(key)\n # sanitize the name\n key = safe_file_name(key)\n key = add_namespace(key)\n\n boolify(redis.exists?(key))\n end",
"def version_present_in_cache?(version)\n tag = %x( cd #{@work_dir} && git tag -l \"#{version}\" )\n tag.strip == \"#{version}\"\n end",
"def usable_repository?\n repository_cache.directory? &&\n run_and_output(\"#{git} remote -v | grep origin\").include?(uri)\n end",
"def exist?\n File.exist?(index_file)\n end",
"def rails?\n File.directory? dest + '/vendor'\n end",
"def exist?\n File.exist?(@path)\n end",
"def exist?\n File.directory? @full_path\n end",
"def cache_hit?(client)\n expanded_path = cache_path_for(client.resource)\n return false unless expanded_path\n # this covers permissions and the file actually existing on disk\n return false unless File.readable?(expanded_path)\n # return true if this is a regular file (eg: not a directory)\n return expanded_path if File.file?(expanded_path)\n end",
"def present?(arg)\n return PRESENT_CACHE[arg] if PRESENT_CACHE.key?(arg)\n\n prefixes = ENV['PATH'].split(File::PATH_SEPARATOR)\n\n bool = prefixes.any? do |prefix|\n File.exist?(prefix + File::SEPARATOR + arg)\n end\n\n bool = File.exist?(\"/Applications/#{arg}.app\") if !bool && mac?\n\n PRESENT_CACHE[arg] = bool\n\n bool\n end",
"def cacheable?\n true\n end",
"def data_exist?\n\t\tFile.exist? self.data_path\n\tend",
"def should_cache?\n false\n end",
"def cached?(file_id)\n synchronize do\n return @cached_files.include?(file_id)\n end\n end",
"def exist?\n self.class.exist?(@path)\n end",
"def consider_caching?(path)\n return false if self.disabled\n return true if self.except.blank? && self.only.blank?\n return false if list_match?(self.except, path)\n return true if self.only.blank?\n return true if list_match?(self.only, path)\n false\n end",
"def cache_expired?\n return true unless cache_exist?\n File.new(@cache_file).mtime < Time::now - (@cache_life.to_i * 60)\n # TODO check html rendered date\n end",
"def exists?\n zk.exists?(path)\n end",
"def exists?\n folder_location.present?\n end",
"def cached?(key)\n not @memcache.get(key).nil?\n end",
"def exists?\n File.exist? file_path\n end",
"def feed_exists?\n if @site.respond_to?(:in_source_dir)\n File.exists? @site.in_source_dir(path)\n else\n File.exists? Jekyll.sanitized_path(@site.source, path)\n end\n end",
"def exists? path\n end",
"def exists?\n begin \n CouchSpring.get uri\n true\n rescue\n false\n end \n end",
"def get(key = '')\n if key != '' && ::File.exists?(@cache_dir+key)\n # Is the File older than a day?\n if file_age(@cache_dir+key) > 1\n # Delete and return a cache miss\n File.delete(@cache_dir+key)\n return false\n end\n\n puts \"Reading from cache with key: #{key}\" if ENV['DEBUG']\n data = ::File.read(@cache_dir+key)\n return (data.length > 0) ? data : false\n end\n\n return false\n end",
"def exists?()\n\t\t\treturn @metadata.exists?\n\t\tend"
] |
[
"0.8005785",
"0.7997671",
"0.76418144",
"0.76353294",
"0.7589856",
"0.74197555",
"0.7374245",
"0.71036744",
"0.70137954",
"0.6914038",
"0.6910787",
"0.6860674",
"0.68509674",
"0.6792968",
"0.67497194",
"0.66971934",
"0.6676467",
"0.6583283",
"0.65780044",
"0.6535317",
"0.65153766",
"0.64282644",
"0.64044344",
"0.63708943",
"0.63646746",
"0.63646746",
"0.63221884",
"0.6314134",
"0.63131213",
"0.6310715",
"0.6310715",
"0.62912875",
"0.6277455",
"0.62713474",
"0.626369",
"0.62575674",
"0.62527",
"0.6230401",
"0.62191725",
"0.62047523",
"0.6202026",
"0.61898106",
"0.6183639",
"0.6183321",
"0.61606455",
"0.6160063",
"0.6153234",
"0.6151586",
"0.6148235",
"0.61412215",
"0.61293316",
"0.61245215",
"0.6115368",
"0.6107642",
"0.610111",
"0.6097601",
"0.60941684",
"0.6075876",
"0.6071817",
"0.6070662",
"0.60702944",
"0.60702944",
"0.6065349",
"0.6061667",
"0.60562456",
"0.60502857",
"0.60481364",
"0.60468704",
"0.603938",
"0.6031065",
"0.60304475",
"0.6028959",
"0.60260236",
"0.6023756",
"0.60108143",
"0.6008147",
"0.6003099",
"0.5996405",
"0.59930986",
"0.59926015",
"0.5985772",
"0.5977579",
"0.59732634",
"0.5972449",
"0.5971139",
"0.5967974",
"0.5962152",
"0.59561807",
"0.595223",
"0.5949145",
"0.5940473",
"0.59246856",
"0.59132814",
"0.5902999",
"0.59025747",
"0.58985454",
"0.5896119",
"0.5894758",
"0.5893195",
"0.5887652"
] |
0.8678215
|
0
|
Depending on whether the 'force' parameter is provided, this method removes all the files in the directory specified by the application path, if the directory exists. Further, if the directory doesn't exist, it tries to create the directory specified by the application path.
|
def apply_force
show_info "Creating application forcefully!" if @options[:force]
FileUtils.rm_rf("#{@path}/.", :secure => true) if File.exists?(@path) and @options[:force]
FileUtils.mkdir_p @path
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def clean_app()\n wd = FileUtils.pwd()\n FileUtils.rm_f( [\n '/app/assets/*',\n '/app/components/*',\n '/app/controllers/*',\n '/app/helpers/*',\n '/app/models/*',\n '/app/views/*'\n ].collect!{|e| Dir.glob(wd + e)}.flatten.compact )\n end",
"def destroy\n delete_files_and_empty_parent_directories\n end",
"def clean_up\n FileUtils.rm_rf \"#{@path}\" unless create_in_current_directory?\n FileUtils.rm_rf \"#{@cache}\"\n end",
"def delete\n File.delete fullpath\n dirname = File.dirname(fullpath)\n while dirname != root\n Dir.rmdir(dirname)\n dirname = File.dirname(dirname)\n end\n rescue Errno::ENOTEMPTY\n end",
"def delete!\n execute_as_user(\"rm -rf #{app_dir}\")\n end",
"def empty_non_root_directory path\n check_path_for_danger_to_remove path\n\n logger.debug \"Removing content of '#{File.join path, '*'}'\"\n FileUtils.rm_rf Dir.glob(File.join(path, '*'))\n FileUtils.rm_rf Dir.glob(File.join(path, '.*')).select {|f| f !~ /\\/..?$/}\n end",
"def delete\n if (exists?)\n list.each do |children|\n children.delete\n end\n factory.system.delete_dir(@path)\n end\n end",
"def clean\n needs_cleaning = File.exist?(project_dir)\n if needs_cleaning\n log.info(log_key) { \"Cleaning project directory `#{project_dir}'\" }\n FileUtils.rm_rf(project_dir)\n end\n create_required_directories\n deploy\n needs_cleaning\n end",
"def remove_file_and_clean_directories( path )\n # first, delete the file\n delete_file( path )\n # recursively remove any parent directories, but only if they are empty, stop if they are not\n remove_empty_folders_recursively( path )\n end",
"def clean_installation\n clean_paths.each { |path| FileUtils.rm_rf(path) }\n end",
"def remove_empty_directory(path = nil)\r\n dir = path || File.dirname(full_path)\r\n dir.gsub!(/(\\/+\\.\\.?\\/*)*$/, '')\r\n system_files = %w(Thumbs.db .DS_Store)\r\n if File.directory?(dir) and !File.symlink?(dir) and (Dir.entries(dir) - %w(. ..) - system_files).empty?\r\n system_files.each { |sys| File.delete(\"#{dir}/#{sys}\") if File.exists?(\"#{dir}/#{sys}\") }\r\n Dir.rmdir(dir)\r\n remove_empty_directory(dir.gsub(/\\/+[^\\/]*\\/*$/, ''))\r\n end\r\n end",
"def purge_directory(path)\n remove_directory(path)\n create_directory(path)\n end",
"def purge_directory(path)\n remove_directory(path)\n create_directory(path)\n end",
"def rm\n FileUtils.rm path if File.exist?(path)\n end",
"def clean_paths\n FileUtils.rm_rf(tmp_path)\n FileUtils.mkdir_p(tmp_path)\n end",
"def cleanup\n FileUtils.rm(@out_filename)\n\n # XXX: could be rm-rf, but be safe for now. Might have\n # problems if app creates files in $PWD\n FileUtils.rmdir(@opts[:tmpdir])\n end",
"def rm_rf path\n execute(\"rm -rf #{path}\")\n end",
"def clean_dir\n\n path = self.get_dir\n _clean_dir(path)\n end",
"def delete_dir!(path)\n # do nothing, because there's no such things as 'empty directory'\n end",
"def perform(force=false)\n if Projects::dotenv.exists?\n if !force\n print \"Would you like to remove your default configuration file? ([K]eep/[r]emove): \"\n remove = STDIN.gets.chomp.downcase\n end\n\n if ['r','remove'].include?(remove) || force\n puts \"Removing default config file...\".yellow\n Projects::dotenv.unlink\n end\n end\n\n if Projects::projects_file.exists?\n if !force\n print \"Would you like to remove your .projects file? ([k]eep/[r]emove): \"\n remove = STDIN.gets.chomp.downcase\n end\n\n if ['r','remove'].include?(remove) || force\n puts \"Removing .projects file...\".yellow\n Projects::projects_file.unlink\n end\n end\n \n if Projects::ignore_file.exists?\n if !force\n print \"Would you like to remove your .ignore file? ([k]eep/[r]emove): \"\n remove = STDIN.gets.chomp.downcase\n end\n\n if ['r','remove'].include?(remove) || force\n puts \"Removing .ignore file...\".yellow\n Projects::ignore_file.unlink\n end\n end\n\n if Projects::procfile.exists?\n if !force\n print \"Would you like to remove your Procfile? ([k]eep/[r]emove): \"\n remove = STDIN.gets.chomp.downcase\n end\n\n if ['r','remove'].include?(remove) || force\n puts \"Removing Procfile...\".yellow\n Projects::procfile.unlink\n end\n end\n end",
"def clean_up\n Dir.foreach(Dir.pwd) do |f|\n if !f.start_with?('tmp_') then next\n elsif File.directory?(f) then FileUtils.rm_rf(f)\n else FileUtils.rm(f)\n end\n end\nend",
"def destroy\n FileUtils.rm_r(directory) if exist?\n end",
"def destroy\n remove_files(@path + \"*\")\n end",
"def action_remove\n app_dir = Chef::Resource::Directory.new(\"#{@current_resource.apps_dir}/#{@current_resource.app}\", run_context)\n app_dir.path(\"#{@current_resource.apps_dir}/#{@current_resource.app}\")\n app_dir.recursive(true)\n app_dir.run_action(:delete)\n new_resource.updated_by_last_action(app_dir.updated_by_last_action?)\n end",
"def purge\n\n FileUtils.remove_dir(@basepath)\n end",
"def clean_up\n @files.each {|file| FileUtils.remove(file.path)}\n end",
"def remove_temp_files\n @task.shell.mute do\n @task.remove_dir ::File.join(@project.package_path, @package_name)\n @task.remove_file ::File.join(@project.package_path, \"#{@package_name}.tmp\")\n end\n end",
"def rm_rf(path)\n FileUtils.rm_rf(path)\n end",
"def clean(name)\n return false if exists?(name)\n path = File.join(directory, dir_name(name))\n FileUtils.rm_rf(path)\n end",
"def create_or_delete_directory(path)\n d = ::Chef::Resource::Directory.new(path, run_context)\n d.recursive(true)\n if new_resource.action == :destroy_all\n d.run_action(:delete)\n else\n d.run_action(:create) unless ::File.exists?(path)\n end\n end",
"def cleanUpWorkingFiles()\n system(\"rm -f #{@tripFile} #{routeFile} #{routeAltFile}\") ;\n end",
"def delete_files_and_empty_parent_directories\n style_names = reflection.styles.map{|style| style.name} << :original\n # If the attachment was set to nil, we need the original value\n # to work out what to delete.\n if column_name = reflection.column_name_for_stored_attribute(:file_name)\n interpolation_params = {:basename => record.send(\"#{column_name}_was\")}\n else\n interpolation_params = {}\n end\n style_names.each do |style_name|\n path = interpolate_path(style_name, interpolation_params) or\n next\n FileUtils.rm_f(path)\n begin\n loop do\n path = File.dirname(path)\n FileUtils.rmdir(path)\n end\n rescue Errno::EEXIST, Errno::ENOTEMPTY, Errno::ENOENT, Errno::EINVAL, Errno::ENOTDIR\n # Can't delete any further.\n end\n end\n end",
"def fileCleanPath(pathName) \n pathName.mkpath()\n begin\n pathName.rmtree()\n rescue\n puts \"Cannot delete: \" + pathName.to_s\n end\n pathName.mkpath()\nend",
"def clean!\n FileUtils.rm_rf(dir)\n end",
"def cleanup\n if dir and File.exists?(dir)\n FileUtils.rm_rf(dir)\n end\n\n nil\n end",
"def cleanall\n FileUtils.rm_r(OUTPUT_DIR, force: true, verbose: true)\n end",
"def destroy()\n\n path = self.get_dir\n FileUtils.remove_entry_secure(path, true)\n _clean_dir(File.dirname(path))\n\n super()\n end",
"def unlink_file\n unless is_placeholder_directory?\n FileUtils.rm path if File.file?(path)\n else\n FileUtils.rmdir path if Dir.entries(path) == [\".\", \"..\"]\n end\n end",
"def remove_directory(path)\n FileUtils.rm_rf(path)\n end",
"def remove_directory(path)\n FileUtils.rm_rf(path)\n end",
"def clean\n Dir.foreach(@wd) do |file|\n next if file.start_with?('.') or (file == \"config\")\n filename = File.join(@wd, file)\n FileUtils.remove_file(filename) if File.file?(filename)\n end\n end",
"def rmdir() Dir.rmdir(path) end",
"def clean\n cache = Cache.instance\n # remove all built files\n cache.targets(false).each do |target|\n cache.remove_target(target)\n FileUtils.rm_f(target)\n end\n # remove all created directories if they are empty\n cache.directories(false).sort {|a, b| b.size <=> a.size}.each do |directory|\n cache.remove_directory(directory)\n next unless File.directory?(directory)\n if (Dir.entries(directory) - ['.', '..']).empty?\n Dir.rmdir(directory) rescue nil\n end\n end\n cache.write\n end",
"def remove_empty_directories\n base_paths.each do |path|\n command = <<-CMD\n for directory in $(find #{path} -type d); do\n if [ ! -d $directory ]; then\n echo \"Can't find directory $directory, it was probably already deleted, skipping . . .\"\n continue\n fi\n files=$(find $directory -type f)\n if [ -z \"$files\" ]; then\n echo \"No files in directory $directory, deleting . . .\"\n sudo rm -rf $directory\n fi\n done\n CMD\n Pkg::Util::Net.remote_execute(Pkg::Config.staging_server, command)\n end\n end",
"def clear(options=nil)\n if File.exist?(@root)\n root_dirs = Dir.entries(@root).reject { |f| (EXCLUDED_DIRS + GITKEEP_FILES).include?(f) }\n FileUtils.rm_r(root_dirs.collect{ |f| File.join(@root, f) })\n end\n true\n end",
"def cleanup\n FileUtils.rm_f(@path)\n delete\n end",
"def cleanup_files\n FileUtils.rm_rf(File.join(Rails.root, \"tmp\"))\n end",
"def clean(path)\n path.dirname.ascend do |pathname|\n if Dir.empty?(pathname) && pathname != directory\n pathname.rmdir\n else\n break\n end\n end\n end",
"def rm_rf(path)\n run_via \"rm -rf #{path}\"\n end",
"def cleanup\n File.delete(@path) if @path.is_a?(String) && File.exist?(@path)\n end",
"def clean!\n stop\n FileUtils.remove_entry(download_path) if File.exists? download_path\n FileUtils.remove_entry(tmp_save_dir, true) if File.exists? tmp_save_dir\n FileUtils.remove_entry(instance_dir, true) if File.exists? instance_dir\n FileUtils.remove_entry(md5sum_path) if File.exists? md5sum_path\n FileUtils.remove_entry(version_file) if File.exists? version_file\n end",
"def clean!\n stop\n FileUtils.remove_entry(download_path) if File.exists? download_path\n FileUtils.remove_entry(tmp_save_dir, true) if File.exists? tmp_save_dir\n FileUtils.remove_entry(instance_dir, true) if File.exists? instance_dir\n FileUtils.remove_entry(md5sum_path) if File.exists? md5sum_path\n FileUtils.remove_entry(version_file) if File.exists? version_file\n end",
"def destroy\n FileUtils.rm_rf(@root)\n true\n end",
"def delete\n FileUtils.remove_entry_secure(@directory)\n ObjectSpace.undefine_finalizer(self)\n rescue Errno::ENOENT\n end",
"def cleanup(path)\n Monsove.logger.info(\"Cleaning up local path #{path}\")\n\n FileUtils.rm_rf(path)\n File.delete(\"#{path}.tar.bz2\")\n end",
"def clean_directory\n Dir.foreach(@server_dir) do |file|\n fn = File.join(@server_dir, file)\n File.delete(fn) if fn[-1] != '.'\n end\n end",
"def clean_up\n FileUtils.rm_rf @temp_root\n end",
"def clean\n #rm_r(srcdir)\n rm_r(blddir)\n #rm_r(libdir)\n end",
"def delete!\n return true unless File.exist?(path)\n FileUtils.rm(path)\n end",
"def remove_paths(*args)\n args.each do |item|\n if File.directory?(item)\n puts \"#{item} is a path. removing it now.\"\n # set :noop => true to do a dry run\n FileUtils.rm_rf(item, :verbose => true)\n else\n puts \"#{item} doesn't exist or isn't a directory.\"\n end\n end\n end",
"def clear\n FileUtils.rm_rf(path)\n end",
"def clean_runtime_dirs(options)\n dirs = []\n %w(dependencies build_dependencies repo).each do |dir|\n dirs << dir if options[dir.to_sym] == true\n end\n\n return if dirs.empty?\n\n dirs.map! { |dir| \"app-root/runtime/#{dir.gsub(/_/, '-')}/*\" }\n\n out, err, rc = run_in_container_context(\"shopt -s dotglob; rm -rf #{dirs.join(' ')}\",\n chdir: @container_dir,\n expected_exitstatus: 0)\n end",
"def cleanup\n\t\tfile_count = 0\n\t\tif File.directory?(@file_path)\n\t\t\tDir.foreach(@file_path) do |f|\n\t\t\t\tfile_count += 1\n\t\t\t fn = File.join(@file_path, f)\n\t\t\t File.delete(fn) if f != '.' && f != '..'\n\t\t\tend\n\t\t\tDir.delete(@file_path)\n\t\t\tmsg = \"Cleaned up #{file_count} files\"\n\t\telse\n\t\t\thalt 422, \"No directory\"\n\t\tend\n\t\t{ msg: msg }\n\tend",
"def unlink!\n FileUtils.rm_rf(directory)\n end",
"def delete\n FileUtils.rm(self.path) if exists?\n end",
"def clean_tmp_upload_dir\n FileUtils.rm_r(tmp_upload_dir) if self.tmp_upload_dir && File.directory?(self.tmp_upload_dir)\n end",
"def delete_package_file_if_necessary\n # Unless, other packages reference the package on the filesystem\n unless Package.where(:installer_item_location => self.installer_item_location).length > 1\n begin\n FileUtils.remove(Munki::Application::PACKAGE_DIR + self.installer_item_location)\n rescue\n logger.error \"Unable to remove #{self.installer_item_location} from filesystem\"\n end\n end\n end",
"def destroy\n run_callbacks :destroy do\n if directory?\n logger.info \"Delete directory at #{absolute_path}\"\n FileUtils.rmdir absolute_path\n else\n logger.info \"Delete file at #{absolute_path}\"\n # TODO if the file has added state (not committed), reset it to HEAD\n if status_file.untracked\n FileUtils.rm absolute_path\n else\n remove\n end\n end\n true\n end\n end",
"def remove_old_files\n Dir\n .glob(\"#{@tmp_dir_path}/**/*\")\n .each { |path| FileUtils.rm_rf(path) if old?(path) }\n end",
"def remove!\n [\n PATH,\n ::File.expand_path('~/Library/Application Support/VLC'),\n ::File.expand_path('~/Library/Application Support/org.videolan.vlc')\n ].each do |d|\n directory d do\n recursive true\n action :delete\n end\n end\n end",
"def delete_files\n #TODO delete original file\n unless filename.blank?\n File.delete(splash_file(:full_path => true)) if File.exists?(splash_file(:full_path => true))\n File.delete(flv_file(:full_path => true)) if File.exists?(flv_file(:full_path => true))\n File.delete(original_file) if File.exists?(original_file)\n end\n end",
"def remove_structure\n rm_rf target_dir\n end",
"def destroy\n FileUtils.rm_rf @root\n end",
"def _clean_dir(path)\n\n if File.expand_path(path) == File.expand_path(THETIS_MAIL_LOCATION_DIR)\n return\n end\n\n files_dirs = Dir.glob(File.join(path, '**/*'))\n if files_dirs.nil? or files_dirs.empty?\n FileUtils.remove_entry_secure(path, true)\n _clean_dir(File.dirname(path))\n end\n end",
"def remove(path, force: false, recursive: false, quote_with: '\"')\n command = [ \"rm\" ]\n command << \"-f\" if force\n command << \"-r\" if recursive\n command << path\n quote_command(command, quote_with: quote_with)\n end",
"def remove_solution_files\n remove_folder_files(SOLUTION_PATH)\n end",
"def clean()\n\t\ttmpdir = Dir.open(@tmpout) do |dir|\n\t\t\tdir.each do |file|\n\t\t\t\tif file != \".\" and file != \"..\" then\n\t\t\t\t\tFile.unlink(@tmpout + \"/\" + file)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tDir.rmdir @tmpout\n\tend",
"def purge(full_path)\n\t\traise \"No.\" if full_path == '/'\n\t\tDir.chdir(full_path) do\n\t\t\tall = Dir.glob(\"*\", File::FNM_DOTMATCH).reject { |f| f == '.' or f == '..' }\n\t\t\tFileUtils.rm_rf all\n\t\tend\n\t\ttrue\n\tend",
"def purge(full_path)\n\t\traise \"No.\" if full_path == '/'\n\t\tDir.chdir(full_path) do\n\t\t\tall = Dir.glob(\"*\", File::FNM_DOTMATCH).reject { |f| f == '.' or f == '..' }\n\t\t\tFileUtils.rm_rf all\n\t\tend\n\t\ttrue\n\tend",
"def clean_directory(path, types=nil, run_context=nil)\n raise 'clean_directory path must be a non-empty string!' if path.nil? or path.empty?\n types ||= [\n Chef::Resource::File,\n Chef::Resource::Link,\n Chef::Resource::CookbookFile,\n Chef::Resource::RemoteFile,\n Chef::Resource::Template,\n ]\n run_context ||= node.run_context\n\n # find the chef files generated\n chef_files_generated = run_context.resource_collection.select { |r|\n types.include?(r.class) and r.path.start_with?(path)\n }.map { |r| r.path }\n\n # find the fileststem files present\n filesystem_files_present = Dir[\"#{path}/**/*\"].select { |f|\n ::File.file?(f) or ::File.symlink?(f)\n }\n\n # calculate the difference, and remove the extraneous files\n (filesystem_files_present - chef_files_generated).each do |f|\n if ::File.symlink?(f)\n link \"clean_directory: #{f}\" do\n target_file f\n action :delete\n end\n else\n file \"clean_directory: #{f}\" do\n path f\n action :delete\n end\n end\n end\nend",
"def clean\n FileUtils.remove_dir(@log_dir, true)\n end",
"def clean_up\n pathname.delete if pathname.exist?\n end",
"def rm path\n end",
"def cleanup\n\n # ----------------------------------------------\n account_name = 'your account name' # <-- change this!\n project_name = 'your project name' # <-- change this!\n # ----------------------------------------------\n\n project_dir = \"/home/#{account_name}/www\"\n Dir.chdir(project_dir)\n\n Dir.entries(project_name).select do |entry1|\n\n dir1 = File.join(project_name,entry1) #dir2 = \"#{project_name}/#{entry1}\"\n if is_directory?(dir1)\n Dir.entries(dir1).select do |entry2|\n \n dir2 = File.join(dir1,entry2) #dir2 = \"#{project_name}/#{entry1}/#{entry2}\"\n if is_directory?(dir2)\n Dir.entries(dir2).select do |entry3|\n \n dir3 = File.join(dir2,entry3) #dir3 = \"#{project_name}/#{entry1}/#{entry2}/#{entry3}\"\n if is_directory?(dir3)\n Dir.entries(dir3).select do |entry4|\n delete_file(File.join(dir3,entry4))\n end\n end\n\n delete_file(dir3)\n delete_dir(dir3)\n end\n end\n\n delete_file(dir2)\n delete_dir(dir2)\n end\n end\n\n delete_file(dir1)\n delete_dir(dir1)\n end\n\n delete_dir(project_name)\nend",
"def flush_dir(dirName)\r\n\tif File.directory?(dirName)\r\n\t\tFileUtils.remove_dir(dirName, true)\r\n\tend\r\nend",
"def flush_dir(dirName)\r\n\tif File.directory?(dirName)\r\n\t\tFileUtils.remove_dir(dirName, true)\r\n\tend\r\nend",
"def clean\n FileUtils.rm_rf(\"#{ROOT_DATA_FOLDER}/.\", secure: true)\n unless File.directory?(ROOT_DATA_FOLDER)\n FileUtils.mkdir_p(ROOT_DATA_FOLDER)\n end\n end",
"def rm(path)\n FileUtils.rm_rf(path)\n end",
"def delete\n File::unlink @path+\".lock\" rescue nil\n File::unlink @path+\".new\" rescue nil\n File::unlink @path rescue Errno::ENOENT\n end",
"def delete_directory_contents(options)\n Process::Delete::DirectoryContents.delete(options[:directory_path])\n end",
"def rm_rf(list)\n util.rm_rf(path)\n end",
"def remove_dirs()\n puts \"Removing test directories...\"\n \n if File::exist?(\"tmp\") && File::directory?(\"tmp\")\n FileUtils.rm_rf(\"tmp\") \n end\n exit 0\nend",
"def remove_image_directory\n FileUtils.remove_dir(\"#{Rails.root}/public/uploads/service/image/#{id}\",\n force: true)\n end",
"def delete\n if stat.directory?\n FileUtils.rm_rf(file_path)\n else\n ::File.unlink(file_path)\n end\n ::File.unlink(prop_path) if ::File.exist?(prop_path)\n @_prop_hash = nil\n NoContent\n end",
"def clear\n raise \"unsafe test stage directory -- #{Dir.pwd}\" unless /#{Dir.tmpdir}/ =~ Dir.pwd\n Dir['*'].each do |path|\n FileUtils.rm_r(path)\n end\n end",
"def delete!\n exist!\n File.unlink @path\n @path = nil\n end",
"def cleanup_dirs\n @cleanup_dirs ||= ['.']\n end",
"def delete_file_and_folder!( file_path )\n FileUtils.rm_f file_path\n boundary = adapter_path + '/'\n loop do\n file_path = File.dirname file_path\n break unless file_path.index boundary\n FileUtils.rmdir file_path\n end\n end",
"def cleanup_publish_dir(path)\n FileUtils.rm_rf(path, secure: true)\n end",
"def reset_signup_folder\n FileUtils.rm_rf('./tmp/signup')\nend"
] |
[
"0.66909933",
"0.648186",
"0.64702094",
"0.6443755",
"0.6360182",
"0.6353173",
"0.6324998",
"0.625953",
"0.6253838",
"0.6253676",
"0.62265384",
"0.6222619",
"0.6222619",
"0.62038606",
"0.6202752",
"0.61912227",
"0.61766917",
"0.6137194",
"0.6097808",
"0.6086241",
"0.60836846",
"0.6056921",
"0.60477453",
"0.6041712",
"0.603494",
"0.6024884",
"0.60052055",
"0.6001598",
"0.59839505",
"0.59818494",
"0.5980439",
"0.5971718",
"0.5963495",
"0.59533846",
"0.5952562",
"0.5949958",
"0.5937339",
"0.59298897",
"0.5908614",
"0.5908614",
"0.589351",
"0.5890317",
"0.5888403",
"0.5885438",
"0.5839454",
"0.58313537",
"0.5829088",
"0.5828972",
"0.5828212",
"0.5827477",
"0.582193",
"0.582193",
"0.5819939",
"0.5806307",
"0.58046436",
"0.5804359",
"0.58025056",
"0.57848835",
"0.57789946",
"0.5778438",
"0.57721144",
"0.57714874",
"0.5771152",
"0.57613355",
"0.5761141",
"0.57513607",
"0.5727088",
"0.57184464",
"0.5703835",
"0.56990504",
"0.5698954",
"0.56774753",
"0.56756866",
"0.5675165",
"0.5674341",
"0.5672475",
"0.5671034",
"0.56705266",
"0.56705266",
"0.5667247",
"0.56593776",
"0.5649969",
"0.564247",
"0.56398094",
"0.5635213",
"0.5635213",
"0.563324",
"0.56268114",
"0.5616758",
"0.5614344",
"0.56127375",
"0.5610922",
"0.5607825",
"0.5600961",
"0.5600664",
"0.55905545",
"0.5580629",
"0.5569963",
"0.5568928",
"0.556815"
] |
0.70723313
|
0
|
This method downloads or updates the local cache for the current source. If the source is a directory on this machine, it will simply not do anything since that can interfere with an offline installation, and the user must update the source manually in this case. Otherwise, it uses git to update or download the source as required and caches it locally.
|
def download_or_update_local_cache
# we have nothing to download if the source is a local directory
return if source_is_local?
# we need git for this purpose
raise RequiredLibraryMissingError, "git" if `which git`.empty?
# create the cache, and download or update as required
FileUtils.mkdir_p @cache
Dir.chdir(@cache) do
if has_cache?
show_info "Repository exists in local cache.."
show_info "Updating local cache.."
`git pull -q`
else
show_info "Downloading repository to local cache.."
`git clone -q #{@source} .`
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fetch_local(new_dest, fetch_if_missing = true)\n if !File.exists? @repo.cache_path\n if fetch_if_missing\n fetch\n else\n raise \"Source cache #{@repo.cache_path} not readable.\"\n end\n end\n FileUtils.cp_r @repo.cache_path, new_dest\n end",
"def after_source_download\n Dir.chdir cachedir/name do\n sh \"git checkout #{version}\"\n sh 'git submodule update --init'\n end\n end",
"def prepare_source_for(url, freshen=true)\n self.prepare_dirs\n FileUtils.cd(@cache_dir) do\n uri = URI.parse(url)\n case uri.scheme\n when \"git\"\n name = File.basename(url, \".git\")\n if File.directory?(name)\n if freshen\n FileUtils.cd(name) do\n run \"git checkout -f master\"\n run \"git pull --rebase origin master\"\n run \"git fetch --tags\"\n end\n end\n else\n run \"git clone #{url}\"\n end\n when \"http\", \"ftp\"\n name = File.basename(url)\n unless File.exist?(name)\n File.open(name, \"w+\") do |writer|\n open(url) do |reader|\n writer.write(reader.read)\n end\n end\n end\n else\n raise ArgumentError, \"Unknown revision control scheme: #{uri.scheme}\"\n end\n end\n end",
"def cache # :nodoc:\n return unless @remote\n\n if File.exist? repo_cache_dir\n Dir.chdir repo_cache_dir do\n system @git, 'fetch', '--quiet', '--force', '--tags',\n @repository, 'refs/heads/*:refs/heads/*'\n end\n else\n system @git, 'clone', '--quiet', '--bare', '--no-hardlinks',\n @repository, repo_cache_dir\n end\n end",
"def cache # :nodoc:\n if File.exist? repo_cache_dir then\n Dir.chdir repo_cache_dir do\n system @git, 'fetch', '--quiet', '--force', '--tags',\n @repository, 'refs/heads/*:refs/heads/*'\n end\n else\n system @git, 'clone', '--quiet', '--bare', '--no-hardlinks',\n @repository, repo_cache_dir\n end\n end",
"def fetch\n if cached_location.exist?\n @local_path = cached_location\n debug \"#{extended_name} is cached\"\n else\n raise \"No download URL specified for #{extended_name}\" if download_url.nil?\n blah \"Fetching #{extended_name}\"\n downloader = Drupid.makeDownloader self.download_url.to_s,\n self.cached_location.dirname.to_s,\n self.cached_location.basename.to_s,\n self.download_specs\n downloader.fetch\n downloader.stage\n @local_path = downloader.staged_path\n end\n end",
"def source=(source=nil)\n # source must default to Official Laravel Repository if none is provided\n @source = options[:source] if options\n @source = LaravelRepo if not @source or @source.empty?\n\n # if the specified source is a remote repository, create a cache\n # directory otherwise, use the source as the cache\n @cache = source_is_local? ? @source : cache_directory\n end",
"def update_cache(source=@url, destination=@local_path, options={})\n unless destination\n raise ArgumentError, \"Must specify destination directory when updatng resource\", caller\n end\n file_exists = File.exists?(destination)\n if file_exists && @signature_verified == nil\n verify_signature\n end\n unless file_exists && @signature_verified\n FileUtils.mkdir_p(File.dirname(destination))\n puts \"reading: #{source}\" if options[:verbose]\n tried_to_read = 0\n begin\n jarfile = open(source)\n rescue OpenURI::HTTPError => e\n puts e\n if tried_to_read < 1\n tried_to_read += 1\n retry\n end\n end\n if jarfile.class == Tempfile\n FileUtils.cp(jarfile.path, destination)\n puts \"copying to: #{destination}\" if options[:verbose]\n else\n File.open(destination, 'w') {|f| f.write jarfile.read }\n puts \"writing to: #{destination}\" if options[:verbose]\n end\n puts \"#{jarfile.size} bytes written\" if options[:verbose]\n verify_signature ? jarfile.size : false\n else\n File.size(destination)\n end\n end",
"def fetch\n log.info(log_key) { \"Copying from `#{source_path}'\" }\n\n create_required_directories\n FileSyncer.sync(source_path, project_dir, source_options)\n # Reset target shasum on every fetch\n @target_shasum = nil\n target_shasum\n end",
"def cached_file(source, checksum = nil)\n if source =~ %r{^(file|ftp|http|https):\\/\\/}\n uri = as_uri(source)\n cache_file_path = \"#{Chef::Config[:file_cache_path]}/#{::File.basename(::CGI.unescape(uri.path))}\"\n Chef::Log.debug(\"Caching a copy of file #{source} at #{cache_file_path}\")\n\n remote_file cache_file_path do\n source source\n backup false\n checksum checksum unless checksum.nil?\n end\n else\n cache_file_path = source\n end\n\n Chef::Util::PathHelper.cleanpath(cache_file_path)\n end",
"def install\n if cached?\n Dir.chdir(cache_path) do\n git %{fetch --force --tags #{uri} \"refs/heads/*:refs/heads/*\"}\n end\n else\n git %{clone #{uri} \"#{cache_path}\" --bare --no-hardlinks}\n end\n\n Dir.chdir(cache_path) do\n @revision ||= git %{rev-parse #{rev_parse}}\n end\n end",
"def update!\n log(:info, \"Updating source: #{@host}\")\n Downloader.get(specs_url, work_archive_file)\n Unpacker.gzip(work_archive_file)\n FileUtils.mv(work_index_file, index_file)\n end",
"def download_sources(url)\n filename = \"v#{version}.tar.gz\"\n cached_sources = File.join(SOURCES_CACHE_DIR, filename)\n\n if CfObsBinaryBuilder::CACHE_SOURCES\n FileUtils.mkdir_p(SOURCES_CACHE_DIR)\n if !File.exist?(cached_sources)\n system(\"wget #{url} -O #{cached_sources}\")\n end\n FileUtils.copy(cached_sources, filename)\n else\n system(\"wget #{url} -O #{filename}\")\n end\n end",
"def prepare_cache # {:url=>'git://github.com/ddssda', :branch=>'master', :commit=>'ad452bcd'}\n\t\t\turl = @params['repo_url']\n\t\t\tsite = @params['site']\n\t\t\twd = @core.working_dir_from_site(site)\n\n\t\t\t@repo = DesignShell::Repo.new\n\t\t\tsuitable = if File.exists?(wd)\n\t\t\t\t@repo.open wd\n\t\t\t\t@repo.origin.url==url\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\n\t\t\tif suitable\n\t\t\t\t@repo.fetch\n\t\t\telse\n\t\t\t\tif File.exists? wd\n\t\t\t\t\traise RuntimeError.new('almost did bad delete') if !@core.cache_dir || @core.cache_dir.length<3 || !wd.begins_with?(@core.cache_dir)\n\t\t\t\t\tFileUtils.rm_rf wd\n\t\t\t\tend\n\t\t\t\t@repo.clone(url, wd)\n\t\t\tend\n\t\tend",
"def system_cache_file\n @sysetm_cache ||= File.join(Gem.dir, \"source_cache\")\n end",
"def local_path\n src = if %i(direct repo).include?(new_resource.source)\n package_metadata[:url]\n else\n new_resource.source.to_s\n end\n ::File.join(Chef::Config[:file_cache_path], ::File.basename(src))\n end",
"def updateGit(source)\n dir = File.basename(source.sub(/\\.git$/, ''))\n if File.exists?(dir)\n system 'cd '+dir+' && git pull' or exit 1\n else\n system 'git clone ' + source or exit 1\n end\nend",
"def updateGit(source)\n dir = File.basename(source.sub(/\\.git$/, ''))\n if File.exists?(dir)\n system 'cd '+dir+' && git pull' or exit 1\n else\n system 'git clone ' + source or exit 1\n end\nend",
"def update\n download_page if cache_expired?\n read_cache\n end",
"def cached_wget(url, override_cache=false)\n\tputs \" Fetching #{url}\"\n\tcache_file_name = File.join CACHE_DIR, Digest::MD5.hexdigest(url)\n\tif override_cache or not File.exists? cache_file_name\n\t\tFile.open(cache_file_name, 'w') do |cache_file| \n\t\t\topen(url) do |remote_file|\n\t\t\t\tremote_file.each_line do |remote_line| \n\t\t\t\t\tcache_file.puts remote_line\n\t\t\t\tend\n\t\t\tend\n\t\tend \n\t\tputs \" (downloaded fresh copy to #{cache_file_name})\"\n\telse\n\t\tputs \" (loaded from cache #{cache_file_name})\"\n\tend\n\tcache_file_name\nend",
"def update_sources\n return if @source_urls.nil?\n @source_urls.each do |source_url|\n source = config.sources_manager.source_with_name_or_url(source_url)\n dir = source.specs_dir\n UI.puts \"Updating a source at #{dir} for #{source}\"\n git!(%W(-C #{dir} pull))\n end\n end",
"def update_cache\n # Does nothing...up to subclasses to implement.\n end",
"def setup\n return unless git?\n\n Dir.chdir source_path do\n\n path = clone\n\n Dir.chdir path do\n\n if name = build then\n file = File.expand_path name\n\n # private instance variable. When this is set Entry#install looks\n # for a local file instead of trying to download by name\n @entry.instance_variable_set :@file, file\n end\n\n end if path\n\n end\n end",
"def downloaded_file\n filename = source[:cached_name] if source[:cached_name]\n filename ||= File.basename(source[:url], \"?*\")\n File.join(Config.cache_dir, filename)\n end",
"def source_index\n say \"Updating Gem source index for: #{@uri}\"\n begin\n require 'zlib'\n yaml_spec = fetch_path(\"/yaml.Z\")\n yaml_spec = Zlib::Inflate.inflate(yaml_spec)\n rescue\n yaml_spec = nil\n end\n begin\n\tyaml_spec = fetch_path(\"/yaml\") unless yaml_spec\n\tr = convert_spec(yaml_spec)\n rescue SocketError => e\n\traise RemoteSourceException.new(\"Error fetching remote gem cache: #{e.to_s}\")\n end\n end",
"def cache_dir; end",
"def cache_dir; end",
"def install\n if cached?\n # Update and checkout the correct ref\n Dir.chdir(cache_path) do\n hg %|pull|\n end\n else\n # Ensure the cache directory is present before doing anything\n FileUtils.mkdir_p(cache_path)\n\n Dir.chdir(cache_path) do\n hg %|clone #{uri} .|\n end\n end\n\n Dir.chdir(cache_path) do\n hg %|update --clean --rev #{revision || ref}|\n @revision ||= hg %|id -i|\n end\n\n # Gab the path where we should copy from (since it might be relative to\n # the root).\n copy_path = rel ? cache_path.join(rel) : cache_path\n\n begin \n # Validate the thing we are copying is a Chef cookbook\n validate_cached!(copy_path)\n\n # Remove the current cookbook at this location (this is required or else\n # FileUtils will copy into a subdirectory in the next step)\n FileUtils.rm_rf(install_path)\n\n # Create the containing parent directory\n FileUtils.mkdir_p(install_path.parent)\n\n # Copy whatever is in the current cache over to the store\n FileUtils.cp_r(copy_path, install_path)\n\n ensure\n\n # Remove the .hg directory to save storage space\n # TODO this can have huge performance implications, \n # make it a config option?\n if (hg_path = install_path.join('.hg')).exist?\n FileUtils.rm_r(hg_path)\n end\n\n FileUtils.rm_rf (copy_path)\n end\n end",
"def local_source\n @local_source ||= File.join( build_dir, File.basename( upstream_source.path ) )\n end",
"def copy_over_cache_files\n FileUtils.cp_r \"#{@cache}/.\", @path\n end",
"def fetch_local_packages\n Dir[@local_packages_dir.join(\"*.rpm\").to_s].each do |package|\n # Replace downloaded packages for local ones\n rpm_name = `rpm -qp --qf \\\"%{NAME}\\\" #{package}`\n Dir[cache_dir.join(\"**\", \"*.rpm\").to_s].each do |rpm_to_exchange|\n if `rpm -qp --qf \\\"%{NAME}\\\" #{rpm_to_exchange}` == rpm_name\n log.info \"Removing #{rpm_to_exchange}\"\n FileUtils.remove_file(rpm_to_exchange)\n end\n end\n log.info \"Copying #{package}\"\n FileUtils.cp(package, cache_dir)\n end\n end",
"def update\n `cd #{__dir__} && git pull origin master`\n install\nend",
"def download_src(src_package, src_dir)\n deprec.groupadd(group)\n sudo \"test -d #{src_dir} || sudo mkdir #{src_dir}\" \n sudo \"chgrp -R #{group} #{src_dir}\"\n sudo \"chmod -R g+w #{src_dir}\"\n # XXX check if file exists and if we have and MD5 hash or bytecount to compare against\n # XXX if so, compare and decide if we need to download again\n if defined?(src_package[:md5sum])\n md5_clause = \" && echo '#{src_package[:md5sum]}' | md5sum -c - \"\n end\n sudo <<-SUDO\n sh -c \"cd #{src_dir} && test -f #{src_package[:file]} #{md5_clause} || wget --timestamping #{src_package[:url]}\"\n SUDO\n end",
"def clone\n # We do the clone against the target repo using the `--reference` flag so\n # that doing a normal `git pull` on a directory will work.\n git \"clone --reference #{@cache.path} #{@remote} #{@full_path}\"\n git \"remote add cache #{@cache.path}\", :path => @full_path\n end",
"def compile\n @version, @uri = Ruby.find_ruby(@configuration)\n\n download_start_time = Time.now\n if @uri.include? '://'\n print \"-----> Downloading #{@version} ruby from #{@uri} ... \"\n else\n filename = File.basename(@uri)\n print \"-----> Retrieving #{@version} ruby (#{filename}) ... \"\n end\n LibertyBuildpack::Util::Cache::ApplicationCache.new.get(@uri) do |file| # TODO: Use global cache\n puts \"(#{(Time.now - download_start_time).duration})\"\n expand file\n end\n end",
"def sync\n # TODO stop forcing a sync every time.\n @cache.sync\n\n if cloned?\n fetch\n else\n clone\n end\n reset\n end",
"def source(url)\n Gem.sources.clear if @default_sources\n\n @default_sources = false\n\n Gem.sources << url\n end",
"def get_source(workdir) # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity\n opts = options.merge({ workdir: workdir, dirname: dirname })\n if url || !mirrors.empty?\n if ENV['VANAGON_USE_MIRRORS'] == 'n' or ENV['VANAGON_USE_MIRRORS'] == 'false'\n fetch_url(opts)\n else\n fetch_mirrors(opts) || fetch_url(opts)\n end\n source.verify\n extract_with << source.extract(platform.tar) if source.respond_to? :extract\n\n @cleanup_source = source.cleanup if source.respond_to?(:cleanup)\n @dirname ||= source.dirname\n\n # Git based sources probably won't set the version, so we load it if it hasn't been already set\n if source.respond_to?(:version)\n @version ||= source.version\n end\n else\n VanagonLogger.info \"No source given for component '#{@name}'\"\n\n # If there is no source, we don't want to try to change directories, so we just change to the current directory.\n @dirname = './'\n\n # If there is no source, there is nothing to do to extract\n extract_with << ': no source, so nothing to extract'\n end\n end",
"def cache_path\n Pathname.new(File.expand_path(File.join(ChefCLI::Helpers.package_home, \"cache\")))\n .join(\".cache\", \"git\", Digest::SHA1.hexdigest(uri))\n end",
"def update!\n # Don't do anything if this option is set\n return if self.configurations[:disable_update_from_remote]\n\n if !FeedTools.feed_cache.nil? &&\n !FeedTools.feed_cache.set_up_correctly?\n FeedTools.feed_cache.initialize_cache()\n end\n if !FeedTools.feed_cache.nil? &&\n !FeedTools.feed_cache.set_up_correctly?\n raise \"Your feed cache system is incorrectly set up. \" +\n \"Please see the documentation for more information.\"\n end\n if self.http_headers.blank? && !(self.cache_object.nil?) &&\n !(self.cache_object.http_headers.nil?)\n @http_headers = YAML.load(self.cache_object.http_headers)\n @http_headers = {} unless @http_headers.kind_of? Hash\n elsif self.http_headers.blank?\n @http_headers = {}\n end\n if self.expired? == false\n @live = false\n else\n load_remote_feed!\n \n # Handle autodiscovery\n if self.http_headers['content-type'] =~ /text\\/html/ ||\n self.http_headers['content-type'] =~ /application\\/xhtml\\+xml/\n\n autodiscovered_url = nil\n ['atom', 'rss', 'rdf'].each do |type|\n autodiscovered_url =\n FeedTools::HtmlHelper.extract_link_by_mime_type(self.feed_data,\n \"application/#{type}+xml\")\n break unless autodiscovered_url.nil?\n end\n \n if autodiscovered_url != nil\n begin\n autodiscovered_url = FeedTools::UriHelper.resolve_relative_uri(\n autodiscovered_url, [self.href])\n rescue Exception\n end\n if self.href == autodiscovered_url\n raise FeedAccessError,\n \"Autodiscovery loop detected: #{autodiscovered_url}\"\n end\n self.feed_data = nil\n \n self.href = autodiscovered_url\n if FeedTools.feed_cache.nil?\n self.cache_object = nil\n else\n self.cache_object =\n FeedTools.feed_cache.find_by_href(autodiscovered_url)\n end\n self.update!\n else\n html_body = FeedTools::XmlHelper.try_xpaths(self.xml_document, [\n \"html/body\"\n ])\n if html_body != nil\n raise FeedAccessError,\n \"#{self.href} does not appear to be a feed.\"\n end\n end\n else\n ugly_redirect = FeedTools::XmlHelper.try_xpaths(self.xml_document, [\n \"redirect/newLocation/text()\"\n ], :select_result_value => true)\n if !ugly_redirect.blank?\n if self.href == ugly_redirect\n raise FeedAccessError,\n \"Ugly redirect loop detected: #{ugly_redirect}\"\n end\n self.feed_data = nil\n self.href = ugly_redirect\n if FeedTools.feed_cache.nil?\n self.cache_object = nil\n else\n self.cache_object =\n FeedTools.feed_cache.find_by_href(ugly_redirect)\n end\n self.update!\n end\n end\n \n # Reset everything that needs to be reset.\n @xml_document = nil\n @encoding_from_feed_data = nil\n @root_node = nil\n @channel_node = nil\n @id = nil\n @title = nil\n @subtitle = nil\n @copyright = nil\n @link = nil\n @time_to_live = nil\n @entries = nil\n \n if self.configurations[:lazy_parsing_enabled] == false\n self.full_parse()\n end\n end\n end",
"def cached_directory\n case branch\n when 'master'\n Digest::MD5.hexdigest(git_url)[0..6]\n else\n Digest::MD5.hexdigest(git_url + branch)[0..6]\n end\n end",
"def clone\n @cache.sync\n\n # We do the clone against the target repo using the `--reference` flag so\n # that doing a normal `git pull` on a directory will work.\n git [\"clone\", \"--reference\", @cache.git_dir, @remote, @full_path]\n git [\"remote\", \"add\", \"cache\", @cache.git_dir], :path => @full_path\n git ['fetch', 'cache'], :path => @full_path\n checkout(@ref)\n end",
"def source_path\n @source_path ||= source || begin\n u = URI.parse(URL)\n opts = { use_ssl: u.scheme == 'https',\n ca_file: Chef::Config[:ssl_ca_file] }\n body = Net::HTTP.start(u.host, u.port, opts) { |h| h.get(u) }.body\n regex = Regexp.new('https://downloads\\.plex\\.tv/' \\\n 'plex-home-theater/.*/' \\\n 'PlexHomeTheater.*-macosx-x86_64.zip')\n body.match(regex).to_s\n end\n end",
"def download_path\n ::File.join(Chef::Config[:file_cache_path],\n ::File.basename(source_path))\n end",
"def local_cache_dir=(dir_path)\n @local_cache_dir = File.expand_path(dir_path)\n @relative_local_path = \"#{@href_path}#{@filename}\"\n @local_path = \"#{@local_cache_dir}/#{@relative_local_path}\"\n end",
"def configure_cache\n Jekyll::Cache.cache_dir = in_source_dir(config[\"cache_dir\"], \"Jekyll/Cache\")\n if safe || config[\"disable_disk_cache\"]\n Jekyll::Cache.disable_disk_cache!\n else\n hide_cache_dir_from_git\n end\n end",
"def fetch_latest_code!\n `git clone --quiet #{Shellwords.escape(SOURCE_REPO)} .`\nend",
"def cache_resource(dest_dir=@local_cache_dir, options={})\n unless dest_dir\n raise ArgumentError, \"Must specify destination directory when creating resource\", caller\n end\n self.local_cache_dir=dest_dir\n @size = update_cache(@url, @local_path, options)\n if options[:include_pack_gz]\n @relative_local_path_pack_gz = \"#{@relative_local_path}.pack.gz\"\n @local_path_pack_gz = \"#{dest_dir}/#{@relative_local_path_pack_gz}\"\n @size_pack_gz = update_cache(@url_pack_gz, @local_path_pack_gz, options)\n end\n @signature_verified ? @size : @signature_verified\n end",
"def pkg_update\n pkg_fetch unless File::exists? @srcdir\n\n sysprint \"#{@name} update: #{@fetch_url}\"\n\n protocol = @fetch_url.split(':')\n\n if protocol.length == 0\n syserr \"Invalid package source URL #{@fetch_url}\"\n raise\n end\n\n case protocol\n when /^http$/i, /^https$/i, /^ftp$/i\n sysprint \"#{@name}: can't update from protocol #{protocol}\"\n when /git/i\n git_update(@fetch_url)\n else\n syserr \"Unhandled URL type: #{protocol}\"\n raise\n end\n end",
"def fetch\n dst = Pathname.pwd+File.basename(@url.to_s)\n blah \"Fetching patch...\"\n begin\n curl @url.to_s, '-o', dst\n rescue => ex\n raise \"Patch #{File.basename(@url.to_s)} could not be fetched.\"\n debug ex.message\n end\n @cached_location = dst\n debug \"Patch downloaded into #{@cached_location}\"\n end",
"def sync_to_cache_for_archiving\n result = sync_to_cache(false)\n self.erase_cache_symlinks rescue nil\n result\n end",
"def user_cache_file\n @user_cache ||=\n\tENV['GEMCACHE'] || File.join(Gem.user_home, \".gem/source_cache\")\n end",
"def fetch\n self.version = begin\n ver = cache.fetch(CACHE_VERSION_KEY) do\n {'version' => Tml.config.cache[:version] || 'undefined', 't' => cache_timestamp}\n end\n validate_cache_version(ver)\n end\n end",
"def remote_cache_path\n File.join(shared_path, 'bundle', 'cache')\n end",
"def cache_file\n @cache_file ||= File.join cache_dir, \"#{full_name}.gem\"\n end",
"def update(source)\n copy(source, false)\n end",
"def repo_cache_dir # :nodoc:\n File.join @root_dir, 'cache', 'bundler', 'git', \"#{@name}-#{uri_hash}\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def cache_directory\n File.join(CacheFolder, make_md5(@source))\n end",
"def update\n unless ENV.has_key? 'MWV_NO_UPDATE' or File.exist?($VP + 'no-update')\n system('git fetch origin') if Time.now - File.mtime($VP + '.git/FETCH_HEAD') > 604800 rescue nil\n end\nend",
"def update!\n @repo_dir.mkdir unless @repo_dir.directory?\n repo = Git::Repo.new(@repo_dir, @repo_url)\n\n if repo.exists?\n repo.checkout\n @initial = repo.head\n repo.add_origin\n else\n repo.init\n end\n\n repo.pull\n @current = repo.head\n\n if @initial && @initial != @current\n # hash with status characters for keys:\n # Added (A), Deleted (D), Modified (M)\n @changes_map = Hash.new { |h, k| h[k] = [] }\n\n changes = repo.changes(@initial, @current)\n\n while status = changes.shift\n file = changes.shift\n @changes_map[status] << file\n end\n\n if @changes_map.any?\n @changes = { 'New' => changed_items('A', @filter),\n 'Updated' => changed_items('M', @filter),\n 'Deleted' => changed_items('D', @filter) }\n return true\n end\n end\n\n # assume nothing was updated\n return false\n end",
"def update_cache\n Rails.logger.debug \"Updating cache for... #{@@cache_file}\"\n fp = File.new(@@cache_file, 'w')\n if fp\n # acquire an exclusive lock (writer)\n if fp.flock(File::LOCK_EX)\n content = open(@@file_path).read\n \n if content\n #logger.debug \"Generate cache file: #{@@cache_file}\"\n fp.write(content) # writes to the file\n end\n \n fp.flock(File::LOCK_UN) # release a lock\n end\n fp.close\n end\n end",
"def version_for_cache\n \"path:#{source_path}|shasum:#{destination_shasum}\"\n end",
"def lock_source(source)\n @source_info ||= source\n self\n end",
"def cache_path\n home = ENV['HOME']!=nil ? ENV['HOME'] : ''\n return \"#{home}/.jx/repository/#{to_s}/\"\n end",
"def get_source(workdir)\n if @url\n @source = Vanagon::Component::Source.source(@url, @options, workdir)\n @source.fetch\n @source.verify\n @extract_with = @source.respond_to?(:extract) ? @source.extract(@platform.tar) : ':'\n @cleanup_source = @source.cleanup if @source.respond_to?(:cleanup)\n @dirname = @source.dirname\n\n # Git based sources probably won't set the version, so we load it if it hasn't been already set\n @version ||= @source.version\n else\n warn \"No source given for component '#{@name}'\"\n\n # If there is no source, we don't want to try to change directories, so we just change to the current directory.\n @dirname = './'\n\n # If there is no source, there is nothing to do to extract\n @extract_with = ':'\n end\n end",
"def repo_cache_dir # :nodoc:\n File.join Gem.dir, 'cache', 'bundler', 'git', \"#{@name}-#{uri_hash}\"\n end",
"def source_index\n cache = manager.cache_data[@source_uri]\n if cache && cache['size'] == @fetcher.size\n\tcache['cache']\n else\n\tresult = @fetcher.source_index\n\tmanager.cache_data[@source_uri] = {\n\t 'size' => @fetcher.size,\n\t 'cache' => result,\n\t}\n\tmanager.update\n\tresult\n end\n end",
"def cache_dir=(_arg0); end",
"def repo_cache_dir\n File.join(cached_repos_dir, repository_directory)\n end",
"def cache_dir\n @cache_dir ||= File.join base_dir, \"cache\"\n end",
"def move_to_cache\r\n true\r\n end",
"def fetch_cache(file, url)\n @path = \"tmp/\" + file + \".html\";\n @temp = @path + \".fetch\"\n @doFetch = !(FileTest.exists?(@path) && (Time.new - File.mtime(@path) < (5 * 60)))\n\n if @doFetch and download_page(@temp,url) then\n File.delete(@path) if File.exists?(@path)\n File.rename(@temp, @path)\n end\n\n if File.exists?(@path) then\n return @path\n else\n @useOnce = @path + \".\" + rand(100000).to_s + \".once\"\n download_page(@useOnce, url)\n return @useOnce\n end\n end",
"def upgrade_direct!\n remote_file local_path do\n source package_metadata[:url]\n checksum package_metadata[:sha256]\n end\n dpkg_package local_path\n end",
"def update\n context.execute :rm, '-rf', \"#{deploy_path}/local_file/*\"\n context.upload! fetch(:repo_url), \"#{deploy_path}/local_file/#{fetch(:repo_url)}\"\n end",
"def download_file(url, destination)\n raw_file = server_api.get_rest(url, true)\n\n Chef::Log.info(\"Storing updated #{destination} in the cache.\")\n cache.move_to(raw_file.path, destination)\n end",
"def cached?\n Dir.exist?(cached_repo_path)\n end",
"def version_for_cache\n \"download_url:#{source[:url]}|#{digest_type}:#{checksum}\"\n end",
"def move_to_cache\n true\n end",
"def move_to_cache\n true\n end",
"def move_to_cache\n true\n end",
"def cached_location\n dlt = (download_type) ? download_type : 'default'\n Drupid.cache_path + self.class.to_s.split(/::/).last + extended_name + dlt + name\n end",
"def setup_remote\n if(@cache_file)\n begin\n @cf = File.open(@cache_file, 'w+')\n rescue\n @cf = nil\n end\n end\n @uri = URI.parse(@path)\n @con = Net::HTTP.new(@uri.host, @uri.port)\n @call_path = @uri.path + (@uri.query ? \"?#{@uri.query}\" : '')\n res = @con.request_get(@call_path)\n @heads = res.to_hash\n res.value\n @store = nil\n @redefine_prefix = 'remote'\n end",
"def checkout # :nodoc:\n cache\n\n return false unless File.exist? repo_cache_dir\n\n unless File.exist? install_dir\n system @git, 'clone', '--quiet', '--no-checkout',\n repo_cache_dir, install_dir\n end\n\n Dir.chdir install_dir do\n system @git, 'fetch', '--quiet', '--force', '--tags', install_dir\n\n success = system @git, 'reset', '--quiet', '--hard', rev_parse\n\n if @need_submodules\n _, status = Open3.capture2e(@git, 'submodule', 'update', '--quiet', '--init', '--recursive')\n\n success &&= status.success?\n end\n\n success\n end\n end",
"def checkout # :nodoc:\n cache\n\n unless File.exist? install_dir then\n system @git, 'clone', '--quiet', '--no-checkout',\n repo_cache_dir, install_dir\n end\n\n Dir.chdir install_dir do\n system @git, 'fetch', '--quiet', '--force', '--tags', install_dir\n\n success = system @git, 'reset', '--quiet', '--hard', @reference\n\n success &&=\n system @git, 'submodule', 'update',\n '--quiet', '--init', '--recursive' if @need_submodules\n\n success\n end\n end",
"def cache_skeleton(name)\n repo = config.skeletons[name] or return\n\n path = cache_path(name)\n return path if directory_with_files?(path)\n\n mkdir_p fx(path, '..')\n\n git_clone repo, path\n\n if $?.to_i != 0\n rm_rf path\n return nil\n end\n\n rm_rf File.join(path, '.git')\n\n path\n end",
"def fetch(version, extension)\n # Check if tag exists in current repo, if not fetch & recheck\n if !version_present_in_cache?(version)\n update_repository\n raise \"Version #{version} not found in #{extension} source\" if !version_present_in_cache?(version)\n end\n end",
"def call(path: Dir.pwd)\n git = git_open(path)\n return @error unless git\n\n remote = git.remotes.find { |r| r.name == @config['source_name'] }\n remote ||= git_remote_add(git)\n return @error unless remote\n\n return @error unless git_remote_update(remote)\n\n { success?: true }\n end",
"def fetch dest=@repo.cache_path\n src = @repo.to_s\n if !File.exists? dest\n FileUtils.mkdir_p(dest+'/')\n end \n receiver = Receiver.new S3_STORE\n puts \"fetching from: #{src} at #{S3_STORE}\"\n receiver.receive src, dest, @threads, &REPORTER\n end",
"def cache_repository_path\n File.absolute_path(File.join(Rails.root, 'cache', cached_directory))\n end",
"def sync_cache(staging_path, metadata)\n queue = ThreadedJobQueue.new\n CookbookMetadata.new(metadata).files do |url, path, checksum|\n dest_path = File.join(staging_path, path)\n FileUtils.mkdir_p(File.dirname(dest_path))\n if file_outdated?(dest_path, checksum)\n queue << lambda do |_lock|\n http_client.streaming_request(url) do |tempfile|\n tempfile.close\n FileUtils.mv(tempfile.path, dest_path)\n end\n end\n end\n end\n queue.process(CookbookOmnifetch.chef_server_download_concurrency)\n end",
"def source\n \"#{source_repo}/#{source_branch}\"\n end",
"def save_file(file_id, source)\n synchronize do\n unless cached?(file_id)\n destination = File.join(@cache_root, Utils.fileid2name(file_id))\n FileUtils.cp(source, destination)\n \n if File.exist?(destination)\n cached_file = CachedFile.new\n cached_file.filename = File.basename(source)\n cached_file.last_copy = DateTime::now\n \n @cached_files[file_id] = cached_file\n else\n message = \"Cache: Unable to copy file with id #{file_id}.\"\n @logger.error(message) if @logger\n raise message\n end\n end\n end\n end",
"def update_cache_symlinks #:nodoc:\n self.erase_cache_symlinks\n self.make_cache_symlinks\n end",
"def update_self\n updated_version = open('https://gist.github.com/raw/857843/C.rb').read\n File.open(__FILE__, 'w+') do |f|\n f.puts updated_version\n end\nend",
"def destination\n @destination ||= shared_path + \"/#{@repository_cache}\"\n end",
"def cache_path\n File.join @path, 'cache.ri'\n end"
] |
[
"0.74836445",
"0.689803",
"0.6890024",
"0.6844942",
"0.67704976",
"0.6727353",
"0.66981936",
"0.66831",
"0.6519328",
"0.64912283",
"0.64382005",
"0.6381833",
"0.6327686",
"0.6295119",
"0.62374246",
"0.617224",
"0.61714286",
"0.61714286",
"0.6169956",
"0.61563486",
"0.6114985",
"0.60702705",
"0.6061624",
"0.6012714",
"0.5975014",
"0.597284",
"0.597284",
"0.59488034",
"0.59241915",
"0.58243144",
"0.5808404",
"0.5798405",
"0.57521486",
"0.5746863",
"0.57418907",
"0.57085",
"0.5684057",
"0.56831807",
"0.5679665",
"0.5671513",
"0.56683594",
"0.5658005",
"0.5654972",
"0.56493765",
"0.5646968",
"0.56130785",
"0.5611633",
"0.5607871",
"0.5607205",
"0.5604926",
"0.5595902",
"0.55953985",
"0.5574109",
"0.55702215",
"0.5549273",
"0.5545316",
"0.5539982",
"0.55082726",
"0.55082726",
"0.55082726",
"0.55082726",
"0.5505532",
"0.5504516",
"0.5504405",
"0.5497366",
"0.5491883",
"0.5490345",
"0.5483269",
"0.54831207",
"0.5482037",
"0.5479952",
"0.5479419",
"0.5464151",
"0.54572207",
"0.54523593",
"0.5452145",
"0.54518336",
"0.5448326",
"0.54443586",
"0.543725",
"0.5436986",
"0.542823",
"0.542823",
"0.542823",
"0.54175305",
"0.5413926",
"0.5413374",
"0.5413183",
"0.54124916",
"0.5412076",
"0.5405201",
"0.5399202",
"0.53969544",
"0.5394794",
"0.53819305",
"0.5380792",
"0.5379524",
"0.5377255",
"0.537662",
"0.5366295"
] |
0.8832719
|
0
|
This method copies the files from the local cache to the directory of the application.
|
def copy_over_cache_files
FileUtils.cp_r "#{@cache}/.", @path
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def copy_cache\n @copy_cache ||= configuration[:copy_cache] == true ?\n File.join(Dir.tmpdir, configuration[:application]) :\n configuration[:copy_cache]\n end",
"def copy_cache\n @copy_cache ||= configuration[:copy_cache] == true ?\n File.join(Dir.tmpdir, configuration[:application]) :\n configuration[:copy_cache]\n end",
"def prepare_cache\n FileUtils.mkdir_p(File.join(sandbox_path, \"cache\"))\n end",
"def copy_remote_shared_cache_to_release_path\n logger.debug \"Copying the remote shared cache to release path\"\n run \"mkdir -p #{configuration[:release_path]} && cp -RPp #{revision_cache_dir}/* #{configuration[:release_path]}\"\n end",
"def copy_files_to_current_path()\n require 'fileutils'\n @files.each do |f|\n FileUtils::cp(f,'./')\n end\n end",
"def fetch\n log.info(log_key) { \"Copying from `#{source_path}'\" }\n\n create_required_directories\n FileSyncer.sync(source_path, project_dir, source_options)\n # Reset target shasum on every fetch\n @target_shasum = nil\n target_shasum\n end",
"def update_cache(source=@url, destination=@local_path, options={})\n unless destination\n raise ArgumentError, \"Must specify destination directory when updatng resource\", caller\n end\n file_exists = File.exists?(destination)\n if file_exists && @signature_verified == nil\n verify_signature\n end\n unless file_exists && @signature_verified\n FileUtils.mkdir_p(File.dirname(destination))\n puts \"reading: #{source}\" if options[:verbose]\n tried_to_read = 0\n begin\n jarfile = open(source)\n rescue OpenURI::HTTPError => e\n puts e\n if tried_to_read < 1\n tried_to_read += 1\n retry\n end\n end\n if jarfile.class == Tempfile\n FileUtils.cp(jarfile.path, destination)\n puts \"copying to: #{destination}\" if options[:verbose]\n else\n File.open(destination, 'w') {|f| f.write jarfile.read }\n puts \"writing to: #{destination}\" if options[:verbose]\n end\n puts \"#{jarfile.size} bytes written\" if options[:verbose]\n verify_signature ? jarfile.size : false\n else\n File.size(destination)\n end\n end",
"def copy_files\n message \"Checking for existing #{@@app_name.capitalize} install in #{install_directory}\"\n files_yml = File.join(install_directory,'installer','files.yml')\n old_files = read_yml(files_yml) rescue Hash.new\n \n message \"Reading files from #{source_directory}\"\n new_files = sha1_hash_directory_tree(source_directory)\n new_files.delete('/config/database.yml') # Never copy this.\n \n # Next, we compare the original install hash to the current hash. For each\n # entry:\n #\n # - in new_file but not in old_files: copy\n # - in old files but not in new_files: delete\n # - in both, but hash different: copy\n # - in both, hash same: don't copy\n #\n # We really should add a third hash (existing_files) and compare against that\n # so we don't overwrite changed files.\n\n added, changed, deleted, same = hash_diff(old_files, new_files)\n \n if added.size > 0\n message \"Copying #{added.size} new files into #{install_directory}\"\n added.keys.sort.each do |file|\n message \" copying #{file}\"\n copy_one_file(file)\n end\n end\n \n if changed.size > 0\n message \"Updating #{changed.size} files in #{install_directory}\"\n changed.keys.sort.each do |file|\n message \" updating #{file}\"\n copy_one_file(file)\n end\n end\n \n if deleted.size > 0\n message \"Deleting #{deleted.size} files from #{install_directory}\"\n \n deleted.keys.sort.each do |file|\n message \" deleting #{file}\"\n rm(File.join(install_directory,file)) rescue nil\n end\n end\n \n write_yml(files_yml,new_files)\n end",
"def reserve\n FileUtils.touch(self.cache_dir + self.local_filename)\n end",
"def copy_data_dir_here\n copy_all from: content, to: current_dir\nend",
"def fetch_local_packages\n Dir[@local_packages_dir.join(\"*.rpm\").to_s].each do |package|\n # Replace downloaded packages for local ones\n rpm_name = `rpm -qp --qf \\\"%{NAME}\\\" #{package}`\n Dir[cache_dir.join(\"**\", \"*.rpm\").to_s].each do |rpm_to_exchange|\n if `rpm -qp --qf \\\"%{NAME}\\\" #{rpm_to_exchange}` == rpm_name\n log.info \"Removing #{rpm_to_exchange}\"\n FileUtils.remove_file(rpm_to_exchange)\n end\n end\n log.info \"Copying #{package}\"\n FileUtils.cp(package, cache_dir)\n end\n end",
"def copy_sources!\n FileUtils.cp_r(TEMPLATES + 'sources/.', @sources_path)\n end",
"def copy_assets; end",
"def copy_files\n @files.each do |file|\n basename = File.basename file\n FileUtils.cp file, @backup_folder + basename if File.file? file\n FileUtils.cp_r file, @backup_folder + basename if File.directory? file\n end\n end",
"def cache_dir; end",
"def cache_dir; end",
"def deploy!\n if copy_cache\n if File.exists?(copy_cache)\n logger.debug \"refreshing local cache to revision #{revision} at #{copy_cache}\"\n system(source.sync(revision, copy_cache))\n else\n logger.debug \"preparing local cache at #{copy_cache}\"\n system(source.checkout(revision, copy_cache))\n end\n\n # Check the return code of last system command and rollback if not 0\n unless $? == 0\n raise Capistrano::Error, \"shell command failed with return code #{$?}\"\n end\n\n FileUtils.mkdir_p(destination)\n\n logger.debug \"copying cache to deployment staging area #{destination}\"\n Dir.chdir(copy_cache) do\n queue = Dir.glob(\"*\", File::FNM_DOTMATCH)\n while queue.any?\n item = queue.shift\n name = File.basename(item)\n\n next if name == \".\" || name == \"..\"\n next if copy_exclude.any? { |pattern| File.fnmatch(pattern, item) }\n\n if File.symlink?(item)\n FileUtils.ln_s(File.readlink(item), File.join(destination, item))\n elsif File.directory?(item)\n queue += Dir.glob(\"#{item}/*\", File::FNM_DOTMATCH)\n FileUtils.mkdir(File.join(destination, item))\n else\n FileUtils.ln(item, File.join(destination, item))\n end\n end\n end\n else\n logger.debug \"getting (via #{copy_strategy}) revision #{revision} to #{destination}\"\n system(command)\n\n if copy_exclude.any?\n logger.debug \"processing exclusions...\"\n if copy_exclude.any?\n copy_exclude.each do |pattern|\n delete_list = Dir.glob(File.join(destination, pattern), File::FNM_DOTMATCH)\n # avoid the /.. trap that deletes the parent directories\n delete_list.delete_if { |dir| dir =~ /\\/\\.\\.$/ }\n FileUtils.rm_rf(delete_list.compact)\n end\n end\n end\n end\n\n # merge stuffs under specific dirs\n if configuration[:merge_dirs]\n configuration[:merge_dirs].each do |dir, dest|\n from = Pathname.new(destination) + dir\n to = Pathname.new(destination) + dest\n logger.trace \"#{from} > #{to}\"\n FileUtils.mkdir_p(to)\n FileUtils.cp_r(Dir.glob(from), to)\n end\n end\n\n # for a rails application in sub directory\n # set :deploy_subdir, \"rails\"\n if configuration[:deploy_subdir]\n subdir = configuration[:deploy_subdir]\n logger.trace \"deploy subdir #{destination}/#{subdir}\"\n Dir.mktmpdir do |dir|\n FileUtils.move(\"#{destination}/#{subdir}\", dir)\n FileUtils.rm_rf destination rescue nil\n FileUtils.move(\"#{dir}/#{subdir}\", \"#{destination}\")\n end\n end\n\n File.open(File.join(destination, \"REVISION\"), \"w\") { |f| f.puts(revision) }\n\n logger.trace \"compressing #{destination} to #{filename}\"\n Dir.chdir(copy_dir) { system(compress(File.basename(destination), File.basename(filename)).join(\" \")) }\n\n distribute!\n ensure\n puts $! if $!\n FileUtils.rm filename rescue nil\n FileUtils.rm_rf destination rescue nil\n FileUtils.rm_rf copy_subdir rescue nil\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 cache_directory\n Rails.root.join('tmp', 'export')\n end",
"def copy_assets\r\n FileUtils.cd('view') do\r\n %w[style.css napoli.png ferraro.svg].each do |name|\r\n FileUtils.cp(name, File.join('..', 'output', name))\r\n end\r\n end\r\nend",
"def local_cache_path\n File.join(tmp_path, 'bundle_cache')\n end",
"def copy_files\n require 'ftools'\n @files.inject({}) do |result, file|\n seed = (rand * 1000).to_i\n new_path = \"temp_uploads/#{seed}\" + file[1].path.split('/').last\n File.move(file[1].path, new_path, true)\n result[file[0].to_sym] = new_path\n result\n end\n end",
"def fetch_local(new_dest, fetch_if_missing = true)\n if !File.exists? @repo.cache_path\n if fetch_if_missing\n fetch\n else\n raise \"Source cache #{@repo.cache_path} not readable.\"\n end\n end\n FileUtils.cp_r @repo.cache_path, new_dest\n end",
"def cache_file(file)\n FileUtils.cp(file, path)\n end",
"def build_app_caches(app_name, instance_name)\n Dir.chdir RailsPwnerer::Config[app_name, instance_name][:app_path] do\n if File.exist?('Gemfile')\n Kernel.system 'bundle exec rake assets:precompile RAILS_ENV=production'\n else\n Kernel.system 'rake assets:precompile RAILS_ENV=production'\n end\n end\n end",
"def cache_files(dir, files, cache_file)\n cache_content = files.collect do |f|\n File.read(File.join(dir, f))\n end .join(\"\\n\\n\")\n\n cache_path = File.join(dir, cache_file)\n File.delete(cache_path) if File.exists?(cache_path)\n File.open(cache_path, 'w+') { |f| f.write(cache_content) }\n end",
"def copy_public_folder\n\t\t\t\tFileUtils.mkdir(@dst) unless Dir.exist? @dst\n\t\t\t\tfile_list = get_file_list 'public'\n\t\t\t\tfile_list.each do |filename|\n\t\t\t\t\tdirname = File.join(@dst, File.dirname(filename))\n\t\t\t\t\tFileUtils.mkdir_p(dirname) unless Dir.exist? dirname\n\t\t\t\t\tFileUtils.cp( File.join(@src, 'public', filename), File.join(@dst, filename))\n\t\t\t\t\tlog_action \"Copy #{filename.color(:blue)}\"\n\t\t\t\tend\n\t\t\tend",
"def copy_files\r\n %w{_config.dev.yml about.md feed.xml gulpfile.js index.html}.each do |file|\r\n copy_file file\r\n end\r\n end",
"def create_cache_files\n @cache_path_names = {}\n each_file_set(:create_cache_file)\n write_cache_path_file\n end",
"def cache_dir\n \"#{Rails.root}/public/uploads/cache\"\n end",
"def cache_directory\n File.join(CacheFolder, make_md5(@source))\n end",
"def mirror_engine_files\n \n begin\n initialize_base_public_directory\n \n log.debug \"Attempting to copy public engine files from '#{source_public_dir}'\"\n \n # if there is no public directory, just return after this file\n return if !File.exist?(source_public_dir)\n\n source_files = Dir[source_public_dir + \"/**/*\"]\n source_dirs = source_files.select { |d| File.directory?(d) }\n source_files -= source_dirs \n \n log.debug \"source dirs: #{source_dirs.inspect}\"\n\n # Create the engine_files/<something>_engine dir if it doesn't exist\n if !File.exists?(self.destination_public_dir)\n # Create <something>_engine dir with a message\n log.debug \"Creating #{self.destination_public_dir} public dir\"\n FileUtils.mkdir_p(self.destination_public_dir)\n end\n\n # create all the directories, transforming the old path into the new path\n source_dirs.uniq.each { |dir|\n begin \n # strip out the base path and add the result to the public path, i.e. replace \n # ../script/../vendor/plugins/engine_name/public/javascript\n # with\n # engine_name/javascript\n #\n relative_dir = dir.gsub(File.join(root, \"public\"), name)\n target_dir = File.join(Engines.public_dir, relative_dir)\n unless File.exist?(target_dir)\n log.debug \"Creating directory '#{target_dir}'\"\n FileUtils.mkdir_p(target_dir)\n end\n rescue Exception => e\n raise \"Could not create directory #{target_dir}: \\n\" + e\n end\n }\n\n # copy all the files, transforming the old path into the new path\n source_files.uniq.each { |file|\n begin\n # change the path from the ENGINE ROOT to the public directory root for this engine\n target = file.gsub(File.join(root, \"public\"), destination_public_dir)\n unless File.exist?(target) && FileUtils.identical?(file, target)\n log.debug \"copying file '#{file}' to '#{target}'\"\n FileUtils.cp(file, target)\n end \n rescue Exception => e\n raise \"Could not copy #{file} to #{target}: \\n\" + e \n end\n }\n rescue Exception => e\n log.warn \"WARNING: Couldn't create the engine public file structure for engine '#{name}'; Error follows:\"\n log.warn e\n end\n end",
"def clearCachedContentFiles\n #N Without this, the (local) source cached content file won't be deleted\n @sourceLocation.clearCachedContentFile()\n #N Without this, the (remote) source cached content file won't be deleted\n @destinationLocation.clearCachedContentFile()\n end",
"def download_files\n path = Conf::directories.tmp\n manager = @current_source.file_manager\n manager.start do\n @current_source.folders.each do |folder|\n files = @files[folder]\n puts \"folder => #{folder}, Files => #{files}\" if @opts[:v]\n next if files.empty? \n # download into the TMP directory by folder\n spath = File.join(path, @current_source.name.to_s,folder)\n manager.download_files files,spath,v: true\n move_files folder\n @current_source.schema.insert_files files,folder\n SignalHandler.check { Logger.<<(__FILE__,\"WARNING\",\"SIGINT Catched. Abort.\")}\n end\n end\n end",
"def download_or_update_local_cache\n # we have nothing to download if the source is a local directory\n return if source_is_local?\n # we need git for this purpose\n raise RequiredLibraryMissingError, \"git\" if `which git`.empty?\n\n # create the cache, and download or update as required\n FileUtils.mkdir_p @cache\n Dir.chdir(@cache) do\n if has_cache?\n show_info \"Repository exists in local cache..\"\n show_info \"Updating local cache..\"\n `git pull -q`\n else\n show_info \"Downloading repository to local cache..\"\n `git clone -q #{@source} .`\n end\n end\n end",
"def copy_assets\n FileUtils.cp_r 'assets/.', 'output/', :preserve => true\nend",
"def local_export_and_copy_remote_shared_cache\n logger.debug \"Performing a local :export of revision #{revision} to #{destination}\"\n system(command)\n File.open(File.join(destination,\"REVISION\"), \"w\") { |f| f.puts(revision) }\n logger.debug \"Compressing #{destination} to #{filename}\"\n Dir.chdir(tmpdir) { system(compress(File.basename(destination), File.basename(filename)).join(\" \")) }\n content = File.open(filename, \"rb\") { |f| f.read }\n put content, remote_filename\n run \"umask 02 && mkdir -p #{revision_cache_dir}\"\n uncompress_and_move_command = \"cd #{remote_dir} && #{decompress(remote_filename).join(\" \")} && \" + \n \"cp -RPp #{remote_tmp_release_dir}/* #{revision_cache_dir} && \" +\n \"rm #{remote_filename} && rm -rf #{remote_tmp_release_dir}\"\n run(uncompress_and_move_command)\n ensure\n FileUtils.rm filename rescue nil\n FileUtils.rm_rf destination rescue nil\n end",
"def copy_assets\n FileUtils.cp_r File.join(self.source, '_assets', '.'), self.dest\n end",
"def copy_to_local srcpath, dstpath\n src_bucket = bucket(srcpath)\n src_key_path = key_path(srcpath)\n dstfile = File.new(dstpath, 'w')\n @s3.interface.get(src_bucket, src_key_path) do |chunk|\n dstfile.write(chunk)\n end\n dstfile.close\n end",
"def copy_to_local srcpath, dstpath\n src_bucket,src_key_path = split_path(srcpath)\n dstfile = File.new(dstpath, 'w')\n @s3.interface.get(src_bucket, src_key_path) do |chunk|\n dstfile.write(chunk)\n end\n dstfile.close\n end",
"def save\n Chef::FileCache.store(\"remote_file/#{sanitized_cache_file_basename}\", json_data)\n end",
"def cache_path\n return @cache_resources unless @cache_resources.nil?\n\n @cache_resources = Chef::Resource::Directory.new(::File.join(new_resource.cache_path), run_context)\n @cache_resources.recursive(true)\n\n return @cache_resources\n end",
"def save_file(file_id, source)\n synchronize do\n unless cached?(file_id)\n destination = File.join(@cache_root, Utils.fileid2name(file_id))\n FileUtils.cp(source, destination)\n \n if File.exist?(destination)\n cached_file = CachedFile.new\n cached_file.filename = File.basename(source)\n cached_file.last_copy = DateTime::now\n \n @cached_files[file_id] = cached_file\n else\n message = \"Cache: Unable to copy file with id #{file_id}.\"\n @logger.error(message) if @logger\n raise message\n end\n end\n end\n end",
"def copy_app_files\n copy_file '../../../../app/controllers/application_controller.rb', 'app/controllers/application_controller.rb'\n end",
"def transfer!\n create_local_directories!\n\n files_to_transfer do |local_file, remote_file|\n Logger.message \"#{storage_name} started transferring '#{ local_file }'.\"\n FileUtils.cp(\n File.join(local_path, local_file),\n File.join(remote_path, remote_file)\n )\n end\n end",
"def copy_files(dest_dir)\n @package.documents.each do |file|\n ActiveRecord::Base.logger.debug \"copying file #{file.attach.path} in #{File.join(dest_dir, \"\")}\"\n FileUtils.cp(file.attach.path, File.join(dest_dir, \"\"))\n end\n end",
"def transfer!\n remote_path = remote_path_for(@package)\n FileUtils.mkdir_p(remote_path)\n\n files_to_transfer_for(@package) do |local_file, remote_file|\n Logger.info \"#{storage_name} started transferring '#{ local_file }'.\"\n\n src_path = File.join(local_path, local_file)\n dst_path = File.join(remote_path, remote_file)\n FileUtils.send(transfer_method, src_path, dst_path)\n end\n end",
"def sync_local\n sync_hash = {\n ['~/Library/Application\\\\ Support/Firefox', '~/Library/Application\\\\ Support/Quicksilver',\n '~/Library/Preferences' ] =>'library/',\n ['~/.boson', '~/.sake', '~/.cronrc', '~/.gemrc', '~/.gitconfig', '~/.gem/specs']=>'dotfiles/',\n }\n sync_hash.each do |src, dest|\n src.each do |e| \n cmd = \"rsync -av #{e} #{File.join('~/backup', dest)}\"\n system cmd\n end\n end\n end",
"def cache_dir\n \"#{Rails.root}/tmp/uploads\"\n end",
"def workdir\n result = base.join('cache')\n result.mkpath\n result\n end",
"def local_cache_dir=(dir_path)\n @local_cache_dir = File.expand_path(dir_path)\n @relative_local_path = \"#{@href_path}#{@filename}\"\n @local_path = \"#{@local_cache_dir}/#{@relative_local_path}\"\n end",
"def create_remote_shared_cache\n with_primary_app_server do\n unless Capistrano::Deploy::Dependencies.new(configuration).remote.directory(revision_cache_dir).pass?\n remote_repository_access? ? direct_export_remote_shared_cache : local_export_and_copy_remote_shared_cache\n end\n end\n end",
"def cache_dir\n Padrino.root(\"tmp\")\n end",
"def cache_dir\n Padrino.root(\"tmp\")\n end",
"def remote_cache_path\n File.join(shared_path, 'bundle', 'cache')\n end",
"def copy_content\n @tocopy.each do |pair|\n src = pair[0]\n dst = File.expand_path(File.join(@temp_path, pair[1] || ''))\n dstdir = File.dirname(dst)\n FileUtils.mkpath(dstdir) unless File.exist?(dstdir)\n FileUtils.cp_r(src, dst)\n end\n\n # clear out the list of things to copy so that snippets can\n # re-load it and call copy_content again if needed\n @tocopy = []\n end",
"def copy_from_local srcpath, destpath\n bucket,key = split_path(destpath)\n if File.exists?(srcpath)\n if File.directory?(srcpath)\n raise \"NotYetImplemented\"\n else\n @s3.interface.put(bucket, key, File.open(srcpath))\n end\n else\n raise Errno::ENOENT, \"No such file or directory - #{srcpath}\"\n end\n end",
"def fetch(storage_path, local_path)\n super\n FileUtils.cp absolute_path(storage_path), local_path\n end",
"def cache_file_path\n File.join @homepath, 'cache'\n end",
"def cache_dir\n \"#{Rails.root}/tmp/uploads\"\n end",
"def cache_dir\n \"#{Rails.root}/tmp/uploads\"\n end",
"def cache_dir\n \"#{Rails.root}/tmp/uploads\"\n end",
"def cache_dir\n \"#{Rails.root}/tmp/uploads\"\n end",
"def cache_dir\n \"#{Rails.root}/tmp/uploads\"\n end",
"def call\n INSTALL_DIRS.each do |dir|\n FileUtils.mkdir_p Karafka.root.join(dir)\n end\n\n INSTALL_FILES_MAP.each do |source, target|\n target = Karafka.root.join(target)\n next if File.exist?(target)\n\n source = Karafka.core_root.join(\"templates/#{source}\")\n FileUtils.cp_r(source, target)\n end\n end",
"def make_cache_dir\n ::FileUtils.mkdir_p(@cache_dir) unless ::File.directory?(@cache_dir)\n end",
"def perform_file_copy\n\t\tretrieve_target_dir do |target_dir|\n\t\t\tFileUtils.mkdir_p target_dir\n\t\t\tcopy_depdencies_to target_dir\n\t\tend\t\n\tend",
"def cache_files\n Dir.glob(File.join(@cache_dir, '*'))\n .map{|f| f.gsub(/#{@cache_dir}\\/?/, '')}\n .sort\n end",
"def copy_folders\r\n %w{_includes _layouts _posts _sass assets}.each do |dir|\r\n directory dir\r\n end\r\n end",
"def download_all_files files,dest\n return if files.empty?\n RubyUtil::partition files do |sub|\n cmd = \"mv -t #{dest} \"\n cmd += sub.map { |f| \"\\\"#{f.full_path}\\\"\" }.join(' ')\n exec_cmd(cmd) \n end\n # update files object !\n files.map! { |f| f.path = dest; f }\n end",
"def store!\n @queue_for_storage.each do |source_path, destination_path|\n FileUtils.mkdir_p(File.dirname(destination_path))\n FileUtils.cp(source_path, destination_path)\n FileUtils.chmod(0644, destination_path)\n end\n @stored = @queue_for_storage.dup\n @queue_for_storage.clear\n end",
"def sync\n # source directory already exists? if not then create\n cat_dir = Settings.catalog_dir\n if !File.directory?(cat_dir)\n raise BakerError, \"error in catalog.rb\"\n # File.makedirs(cat_dir)\n end\n local_path = DownloadManager.regional_download(self.catalog_urls, self.local_region, cat_dir, true)\n if !local_path\n raise BakerError, \"Catalog synchronization failed when downloading.\"\n end\n success = DownloadManager.extract(local_path)\n if !success\n puts BakerError, \"Catalog synchronization failed when extracting.\"\n end\n end",
"def cache_dir\n File.join( Env.home, '.slideshow' )\n end",
"def stage\n\n @tempdir = Dir.mktmpdir\n\n begin\n\n # Copy the assets into the temp dir.\n files = Dir.glob(\"#{File.dirname(@file_path)}/#{@file_base}.*\")\n FileUtils.cp(files, @tempdir)\n\n # Change into the temp dir.\n FileUtils.cd(@tempdir) do yield end\n\n ensure\n\n # Delete the copies.\n FileUtils.remove_entry @tempdir\n\n end\n\n end",
"def cache_file_list_path\n File.join config.config_dir, 'file_cache'\n end",
"def local_copy(source, target)\n FileUtils.mkpath(File.dirname(target))\n FileUtils.copy(source, \"#{target}.in_progress\")\n FileUtils.move(\"#{target}.in_progress\", target)\n end",
"def copy_source\n directory('webpack', self.target_path, {\n recursive: true\n })\n end",
"def copy_files (infiles)\n @log.d(\"Backing up files...\");\n htfiles = [];\n backup_dir = @ht_backup_dir + Time.new().strftime(\"%Y%m%d\");\n infiles.each do |infile|\n ht_file = @ht_dir + infile.split('/').last;\n # Check if file exists in ht00x\n if File.exists?(ht_file) then\n # If so, back it up.\n FileUtils.mkdir_p(backup_dir);\n @log.d(\"cp #{ht_file} #{backup_dir}\");\n if @dry_run == false then\n FileUtils.cp(ht_file, backup_dir);\n end\n end\n # Overwrite with one from memberdata (copy)\n @log.d(\"cp #{infile} #{ht_file}\");\n if @dry_run == false then\n FileUtils.cp(infile, ht_file);\n end\n htfiles << ht_file;\n end\n\n return htfiles;\nend",
"def sync_to_cache_for_archiving\n result = sync_to_cache(false)\n self.erase_cache_symlinks rescue nil\n result\n end",
"def preform_copy_file\n @destination_files.each do |destination|\n copy_file(@sources.pop, destination)\n end\n end",
"def sync_cache(staging_path, metadata)\n queue = ThreadedJobQueue.new\n CookbookMetadata.new(metadata).files do |url, path, checksum|\n dest_path = File.join(staging_path, path)\n FileUtils.mkdir_p(File.dirname(dest_path))\n if file_outdated?(dest_path, checksum)\n queue << lambda do |_lock|\n http_client.streaming_request(url) do |tempfile|\n tempfile.close\n FileUtils.mv(tempfile.path, dest_path)\n end\n end\n end\n end\n queue.process(CookbookOmnifetch.chef_server_download_concurrency)\n end",
"def in_cache_dir(*paths); end",
"def copy(options)\n destination = copy_destination options\n to_path = join_paths @root_dir, destination\n to_path_exists = File.exist? to_path\n\n preserve_existing = false? options[:overwrite]\n\n copy_resource_to_path to_path, preserve_existing\n copy_pstore_to_path to_path, preserve_existing\n\n to_path_exists\n end",
"def local_files\n @local_files ||= CloudfileAsset::Local.public_files.collect{|filename| CloudfileAsset::Local.make_relative(filename)}\n end",
"def sync(srcDir, dstDir)\n end",
"def prepare_cache_path\n cache = Tempfile.new(\"\", Global.file_cache_directory)\n path = cache.path\n cache.close(true)\n return path\n end",
"def copy_static\n FileUtils.cp_r 'static/.', 'output/' \nend",
"def destination\n @destination ||= shared_path + \"/#{@repository_cache}\"\n end",
"def cache_file\n File.join(Rscons.application.build_dir, \".rsconscache\")\n end",
"def copy_all_project_files(dir)\n directory FileUtils.pwd, dir,\n exclude_pattern: /(.git|.DS_Store|.irb-history|.gitignore|.gitkeep|screenshot|.apk|.zip)/\n # Replacing launcher files to avoid problems with AWS Device Farm\n copy_file File.join(File.dirname(__FILE__), '..', 'aws',\n 'android', 'app_installation_hooks.rb'),\n File.join(dir, 'features', 'android',\n 'support', 'app_installation_hooks.rb'),\n force: true\n copy_file File.join(File.dirname(__FILE__), '..', 'aws',\n 'android', 'app_life_cycle_hooks.rb'),\n File.join(dir, 'features', 'android',\n 'support', 'app_life_cycle_hooks.rb'),\n force: true\n copy_file File.join(File.dirname(__FILE__), '..', 'aws',\n 'ios', '01_launch.rb'),\n File.join(dir, 'features', 'ios',\n 'support', '01_launch.rb'),\n force: true\nend",
"def local_cache(basebox_name)\n cache_dir = Vagrant::Environment.new.home_path.join('cache', 'apt', basebox_name)\n # Vagrant::Environment.new.home_path\n print cache_dir\n cache_dir.mkpath unless cache_dir.exist?\n partial_dir = cache_dir.join('partial')\n partial_dir.mkdir unless partial_dir.exist?\n cache_dir\nend",
"def cache_dir\r\n RUBY_PLATFORM =~ /win32/ ? win32_cache_dir : File.join(File.expand_path(\"~\"), \".slideshow\")\r\n end",
"def cached_stored_files\n @cached_stored_files ||= storage.files\n end",
"def cache config, name, path\n require 'fileutils'\n require 'pathname'\n name = name.to_s\n local = File.join(File.expand_path('~/.vagrant.d/cache'), config.vm.box, name)\n FileUtils.mkdir_p local\n config.vm.synced_folder local, path\nend",
"def cache config, name, path\n require 'fileutils'\n require 'pathname'\n name = name.to_s\n local = File.join(File.expand_path('~/.vagrant.d/cache'), config.vm.box, name)\n FileUtils.mkdir_p local\n config.vm.synced_folder local, path\nend",
"def cache(input_path, output_path, data=nil)\n path = input_path\n @new_hashes[input_path] = hash(@input_directory, input_path)\n\n if data\n @data[path] = data if data\n @wildcard_dependencies[path] = data[:wildcard_dependencies] if data[:wildcard_dependencies]\n @dependencies[path] = data[:dependencies] if data[:dependencies]\n end\n\n FileUtils.mkdir_p(File.dirname(cached_path_for(path)))\n\n if File.exist? File.join(@output_directory, output_path)\n FileUtils.cp(File.join(@output_directory, output_path), cached_path_for(path))\n else\n FileUtils.cp(File.join(@input_directory, input_path), cached_path_for(input_path))\n end\n end",
"def make_readable\n Dir.glob(\"#{cache_path}/**/*\") do |e|\n FileUtils.chmod(0644, e) if File.file?(e)\n end\n end",
"def make_readable\n Dir.glob(\"#{cache_path}/**/*\") do |e|\n FileUtils.chmod(0644, e) if File.file?(e)\n end\n end",
"def local_cache(box_name, hostname)\n cache_dir = File.join( File.expand_path(\"./vagrant_apt\"),\n 'cache',\n 'apt',\n box_name,\n hostname\n )\n\n partial_dir = File.join(cache_dir, 'partial')\n FileUtils.mkdir_p(partial_dir) unless File.exists? partial_dir\n cache_dir\nend",
"def copy_public_directories\n Bones.public_directories.each do |src|\n FileUtils.copy_entry Bones.root / 'public' / src, destination / src\n end\n end"
] |
[
"0.7012994",
"0.7012419",
"0.64852726",
"0.6473215",
"0.6467962",
"0.6375926",
"0.63359153",
"0.6267059",
"0.62501717",
"0.62361443",
"0.6204939",
"0.6188377",
"0.6160009",
"0.61597955",
"0.613772",
"0.613772",
"0.61052877",
"0.60990757",
"0.60870713",
"0.60385495",
"0.6002424",
"0.60024047",
"0.59795034",
"0.59772253",
"0.59741294",
"0.59626216",
"0.5919066",
"0.5911314",
"0.59020656",
"0.58988726",
"0.5890151",
"0.58879733",
"0.58767813",
"0.58549565",
"0.58360225",
"0.58327585",
"0.58308107",
"0.58281934",
"0.579514",
"0.57842904",
"0.57838744",
"0.5778198",
"0.57761663",
"0.57667255",
"0.5754474",
"0.57538486",
"0.5753701",
"0.5750263",
"0.57402205",
"0.5732873",
"0.57247573",
"0.57104766",
"0.5697175",
"0.5697175",
"0.56968915",
"0.5696792",
"0.5689742",
"0.5686785",
"0.5680401",
"0.56775",
"0.56775",
"0.56775",
"0.56775",
"0.56775",
"0.567632",
"0.56719214",
"0.5642253",
"0.56407106",
"0.5637922",
"0.5637352",
"0.5622189",
"0.5615335",
"0.5611591",
"0.56093305",
"0.56041557",
"0.5601413",
"0.5591022",
"0.5580669",
"0.55755275",
"0.55744135",
"0.5574107",
"0.55718297",
"0.55633587",
"0.555196",
"0.5551595",
"0.55369365",
"0.553665",
"0.5534137",
"0.5533405",
"0.553313",
"0.5532467",
"0.55308867",
"0.5529583",
"0.55231076",
"0.55231076",
"0.5507225",
"0.55052125",
"0.55052125",
"0.5498169",
"0.54901534"
] |
0.7810412
|
0
|
This method updates the permissions on the storage/ directory inside the newly created application. This method does not have a separate exposed call from the CLI. This can be skipped by passing 'noperms' flag for the 'new' command.
|
def update_permissions_on_storage
if @options[:perms]
response = system("chmod -R o+w #{File.join(@path, 'storage')}")
if response
say_success "Updated permissions on storage/ directory."
else
say_failed "Could not update permissions on storage/ directory."
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_new_permissions\n @permissions.each do |key|\n next if Lockdown::System.permission_assigned_automatically?(key)\n str = Lockdown.get_string(key)\n p = ::Permission.find(:first, :conditions => [\"name = ?\", str])\n unless p\n Lockdown.logger.info \">> Lockdown: Permission not found in db: #{str}, creating.\"\n ::Permission.create(:name => str)\n end\n end\n end",
"def create\n create_role_directory\n generate_manifests_file\n end",
"def enforce_new_permissions(opts={})\n enforce_create_permissions(opts)\n end",
"def apply_force\n show_info \"Creating application forcefully!\" if @options[:force]\n FileUtils.rm_rf(\"#{@path}/.\", :secure => true) if File.exists?(@path) and @options[:force]\n FileUtils.mkdir_p @path\n end",
"def create_stored_manifest\n unless stored_manifest\n @stored_manifest = directory.files.new(:body => components.to_json, :key => \"#{manifest.name}-#{version}.json\", :content_type => 'application/json')\n @stored_manifest.acl = 'public-read' if Manifesto.public_manifests?\n @stored_manifest.save\n create_current_manifest\n end\n end",
"def allowed_to_create_apps=(value)\n @allowed_to_create_apps = value\n end",
"def update_permissions(new_permissions)\n new_permissions ||= []\n existing_permissons = permissions.map(&:controller)\n # determine what changed\n added = new_permissions - existing_permissons\n removed = existing_permissons - new_permissions\n # add/remove permissions\n added.each {|perm| permissions.create(:controller => perm) }\n permissions.where(:controller => removed).delete_all\n end",
"def update_permissions\n self.view_permission.update_attribute(:name, name + \" view\")\n self.signup_permission.update_attribute(:name, name + \" signup\")\n self.admin_permission.update_attribute(:name, name + \" admin\")\n end",
"def change_permissions(where)\n logger.info \"Changing permissions in #{where} for:\"\n r = execute_query(\n %Q{\n xquery version \"1.0-ml\";\n\n let $new-permissions := (\n xdmp:permission(\"#{@properties[\"ml.app-name\"]}-role\", \"read\"),\n xdmp:permission(\"#{@properties[\"ml.app-name\"]}-role\", \"update\"),\n xdmp:permission(\"#{@properties[\"ml.app-name\"]}-role\", \"execute\")\n )\n\n let $uris :=\n if (fn:contains(xdmp:database-name(xdmp:database()), \"content\")) then\n\n (: This is to make sure all alert files are accessible :)\n cts:uri-match(\"*alert*\")\n\n else\n\n (: This is to make sure all triggers, schemas, modules and REST extensions are accessible :)\n cts:uris()\n\n let $fixes := \n for $uri in $uris\n let $existing-permissions := xdmp:document-get-permissions($uri)\n \n (: Only apply new permissions if really necessary (gives better logging too):)\n where not(ends-with($uri, \"/\"))\n and count($existing-permissions[fn:string(.) = $new-permissions/fn:string(.)]) ne 3\n \n return (\n \" \" || $uri,\n xdmp:document-set-permissions($uri, $new-permissions)\n )\n return\n if ($fixes) then\n $fixes\n else\n \" no changes needed..\"\n },\n { :db_name => where }\n )\n r.body = parse_body r.body\n logger.info r.body\n logger.info \"\"\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def make_app_directories\n @shell.call \"mkdir -p #{self.directories.join(\" \")}\"\n end",
"def update!(**args)\n @permissions = args[:permissions] unless args[:permissions].nil?\n end",
"def update!(**args)\n @permissions = args[:permissions] unless args[:permissions].nil?\n end",
"def generate\n generate_manifest\n fix_windows_manifest\n end",
"def updated_manifest()\n new_app_manifest = JSON.parse(current.to_json) # a deep clone.\n #now let's update everything.\n new_mem = @application_json['resources']['memory'] unless @application_json['resources'].nil?\n new_app_manifest[:name] = @application_json['name']\n new_app_manifest['resources'] = Hash.new if new_app_manifest['resources'].nil?\n new_app_manifest['resources']['memory'] = new_mem unless new_mem.nil?\n unless @application_json['staging'].nil?\n new_app_manifest['staging'] = Hash.new if new_app_manifest['staging'].nil?\n new_app_manifest['staging']['model'] = @application_json['staging']['model'] unless @application_json['staging']['model'].nil?\n #new_app_manifest['staging']['framework'] = new_app_manifest['staging']['model']\n new_app_manifest['staging']['stack'] = @application_json['staging']['stack'] unless @application_json['staging']['stack'].nil?\n end\n new_app_manifest['uris'] = @application_json['uris'] unless @application_json['uris'].nil?\n new_app_manifest['services'] = @application_json['services'] unless @application_json['services'].nil?\n new_app_manifest['env'] = @application_json['env'] unless @application_json['env'].nil?\n if @application_json['meta']\n new_app_manifest['meta'] = Hash.new if new_app_manifest['meta'].nil?\n new_app_manifest['meta']['debug'] = @application_json['meta']['debug'] if @application_json['meta']['debug']\n new_app_manifest['meta']['restage_on_service_change'] = @application_json['meta']['restage_on_service_change'] if @application_json['meta']['restage_on_service_change']\n end\n new_app_manifest\n end",
"def enforce_new_permissions(opts={})\n #Call the HullAccessControlsEnforcement method for checking create/new permissions\n enforce_create_permissions\n end",
"def enforce_new_permissions(opts={})\n #Call the HullAccessControlsEnforcement method for checking create/new permissions\n enforce_create_permissions\n end",
"def restore_permissions; end",
"def restore_permissions; end",
"def create\n create_directories\n end",
"def set_permissions\n return if @permissions_set\n\n @permissions_set = true\n resource[:configure_permission] ||= configure_permission\n resource[:read_permission] ||= read_permission\n resource[:write_permission] ||= write_permission\n rabbitmqctl(\n 'set_permissions',\n '-p', should_vhost,\n should_user,\n resource[:configure_permission],\n resource[:write_permission],\n resource[:read_permission]\n )\n end",
"def create_app_folder_structure\n puts \"Create #{name} folder structure\"\n end",
"def create_permission(attributes)\n BrickFTP::API::Permission.create(attributes)\n end",
"def create_permission(attributes)\n BrickFTP::API::Permission.create(attributes)\n end",
"def define_im_folder_permission\n case new_resource.im_install_mode\n when 'admin'\n im_folder_permission = '755'\n im_folder_permission\n when 'nonAdmin', 'group'\n im_folder_permission = '775'\n im_folder_permission\n end\nend",
"def define_im_folder_permission\n case new_resource.im_install_mode\n when 'admin'\n im_folder_permission = '755'\n im_folder_permission\n when 'nonAdmin', 'group'\n im_folder_permission = '775'\n im_folder_permission\n end\nend",
"def secondary_storage\n unless ::File.exist?(new_resource.nfs_path)\n shell_out!(\"mkdir -p #{new_resource.nfs_path}\")\n shell_out!(\"chown -R root:root #{new_resource.nfs_path}\")\n end\n end",
"def add(*permissions)\n permissions.flatten!\n control_definitions(permissions)\n permissions.each do |permission|\n new_permission = defined_permissions[permission]\n @permissions_integer += new_permission unless include?(permission)\n end\n sync_with_owner\n end",
"def give_access_to_creator\n user = User.current_user\n unless user.blank?\n user_assignment = user.assigned_apps.where(app_id: self.id) rescue nil\n if user_assignment.blank?\n user.assigned_apps.create!(app_id: self.id)\n PermissionMap.instance.clean(user)\n end\n end\n end",
"def build_permissions(perms, other)\n perms.permits! :read\n perms.permits! :write if self == other\n end",
"def create_user_permissions\n group.users.each do |user|\n create_permission_for(user)\n end\n end",
"def fix_app_permissions(apps)\n apps.map { |path|\n fix_facl(path, app_acl_template(path))\n }.select { |report| report.updated || report.error }\n end",
"def handle_grant_permission\n return if cbac_permission_exists?\n\n permission = Cbac::Permission.new\n permission.privilege_set = privilege_set\n\n if pristine_role.role_type == PristineRole.ROLE_TYPES[:context]\n permission.context_role = pristine_role.name\n else\n generic_role = Cbac::GenericRole.where(name: pristine_role.name).first\n permission.generic_role = generic_role || Cbac::GenericRole.where(name: pristine_role.name, remarks: \"Autogenerated by Cbac loading / upgrade system\").create\n end\n\n register_change if permission.save\n permission\n end",
"def set_permissions_on_app_dir(dir)\n\t# Give the web server read-only access to everything.\n\t# We tighten up permissions in later commands.\n\tsh \"permit #{WWW_USER} #{dir}\"\n\t\n\t# Make the application directory itself executable-only\n\t# by the web server.\n\tif File.directory?(\"#{dir}/releases\") || File.directory?(\"#{dir}/shared\")\n\t\tsh \"setfacl -m user:#{WWW_USER}:--x #{dir}\"\n\t\tsh \"setfacl -d -m user:#{WWW_USER}:--x #{dir}\"\n\tend\n\t\n\t# Make the 'releases' directory executable-only by the web server\n\t# and set correct permissions on each release subdirectory.\n\tif File.directory?(\"#{dir}/releases\")\n\t\tsh \"setfacl -m user:#{WWW_USER}:--x #{dir}/releases\"\n\t\tDir[\"#{dir}/releases/*\"].each do |release_subdir|\n\t\t\tset_permissions_on_release_dir(release_subdir)\n\t\tend\n\tend\n\t\n\t# Deny web server access to everything in the 'shared'\n\t# directory, with some exceptions.\n\tif File.directory?(\"#{dir}/shared\")\n\t\tsh \"deny #{WWW_USER} #{dir}/shared\"\n\t\t\n\t\t# If there's a Capistrano repository cache, then give\n\t\t# it the same permissions as a release directory because\n\t\t# Capistrano actually makes a release directory but copying\n\t\t# cached-copy with 'cp -dpR', thereby copying all ACLs too.\n\t\tif File.directory?(\"#{dir}/shared/cached-copy\")\n\t\t\tset_permissions_on_release_dir(\"#{dir}/shared/cached-copy\")\n\t\tend\n\t\t\n\t\t# If you store attachment files in the 'shared'\n\t\t# directory then you can allow read-only access to that:\n\t\t# sh \"setfacl -m user:#{WWW_USER}:--x #{dir}/shared\"\n\t\t# sh \"permit #{dir}/shared/attachments\"\n\tend\nend",
"def action_create\n if (dir_exists?(@path))\n Chef::Log::info(\"Directory #{ @path } exits; create action not taken\")\n else\n converge_by(\"Create #{ @new_resource }\") do\n @client.mkdir(@path,'permission' => @mode)\n end\n new_resource.updated_by_last_action(true)\n end\n end",
"def copy_permissions_to_new_folder(folder)\r\n # get the 'parent' GroupPermissions\r\n GroupPermission.find_all_by_folder_id(folder_id).each do |parent_group_permissions|\r\n # create the new GroupPermissions\r\n group_permissions = GroupPermission.new\r\n group_permissions.folder = folder\r\n group_permissions.group = parent_group_permissions.group\r\n group_permissions.can_create = parent_group_permissions.can_create\r\n group_permissions.can_read = parent_group_permissions.can_read\r\n group_permissions.can_update = parent_group_permissions.can_update\r\n group_permissions.can_delete = parent_group_permissions.can_delete\r\n group_permissions.save\r\n end\r\n end",
"def update!(**args)\n @added_permissions = args[:added_permissions] if args.key?(:added_permissions)\n @removed_permissions = args[:removed_permissions] if args.key?(:removed_permissions)\n end",
"def update!(**args)\n @added_permissions = args[:added_permissions] if args.key?(:added_permissions)\n @removed_permissions = args[:removed_permissions] if args.key?(:removed_permissions)\n end",
"def update!(**args)\n @added_permissions = args[:added_permissions] if args.key?(:added_permissions)\n @removed_permissions = args[:removed_permissions] if args.key?(:removed_permissions)\n end",
"def adjust_permissions\n # adjust base directory permission\n subsection 'Adjust file and directory permissions', color: :green, prefix: @output_prefix unless @silent\n FileUtils.chown @owner, @group, \"#{ @destination_directory }/#{ @artifact }\"\n FileUtils.chmod \"u+w,g+ws\", \"#{ @destination_directory }/#{ @artifact }\"\n\n # adjust release directory permission\n FileUtils.chown_R @owner, @group, @release_directory\n end",
"def migrate_permissions_for(object)\n # Find any access controls for this work. The must be sufia6F style in order to not show up on the Work.\n legacy_access_controls = access_controls_for object\n puts \"#{legacy_access_controls.count} AccessControls for #{object.class}: #{object.id}\"\n puts \"#{object.permissions}\"\n\n # Create equivalent access controls\n self.class.make_equivalent_permissions( object, legacy_access_controls )\n puts \"Created equivalent permissions.\"\n puts \"#{object.permissions}\"\n\n # Destroy legacy_access_controls\n if object.save\n puts \"Able to save #{object.class} with new permissions. Destroying old access controls.\"\n legacy_access_controls.each{ |ac| ac.destroy }\n else\n puts \"Unable to save #{object.class}.\"\n end\n end",
"def write\n storage_permissions_string = ActiveSupport::JSON.encode(@storage_permissions)\n Base64.strict_encode64(storage_permissions_string)\n end",
"def new_dirs; end",
"def build_permissions(perms, other)\n perms.permits! :read\n\n if self == other\n perms.permits! :write\n elsif other.admin?\n perms.permits! :write\n end\n end",
"def set_perms\n self.perms = Access.for_user(self)\n end"
] |
[
"0.5805985",
"0.5756673",
"0.57172704",
"0.5640863",
"0.54232675",
"0.53868926",
"0.53581667",
"0.5310384",
"0.52916706",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.5261444",
"0.52614343",
"0.5260778",
"0.5211867",
"0.5201585",
"0.5201573",
"0.51188517",
"0.5114627",
"0.50998926",
"0.50998926",
"0.5083688",
"0.5083688",
"0.5067073",
"0.50618064",
"0.49918932",
"0.4989437",
"0.4989437",
"0.4982489",
"0.4982489",
"0.4963671",
"0.495862",
"0.49506027",
"0.49321628",
"0.49144724",
"0.4912027",
"0.49092638",
"0.48966604",
"0.48928744",
"0.48855746",
"0.4878747",
"0.4878747",
"0.4878747",
"0.48724356",
"0.48708972",
"0.48657888",
"0.48184988",
"0.48088697",
"0.4804535"
] |
0.7075284
|
0
|
Once, we are done with the intallation, and an error occurs, this method handles the clean_up routine by removing the application directory we created, as well as the local cache for the source, that may exist. Keeping the local cache does not make sense, since we anyways can not create applications based on these 'corrupt' repositories.
|
def clean_up
FileUtils.rm_rf "#{@path}" unless create_in_current_directory?
FileUtils.rm_rf "#{@cache}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cleanup\n tmpdir = File.join(OBS_BUILD_DIR,OBS_LOCAL_TMP)\n if File.exists?(tmpdir)\n FileUtils.rm_rf(tmpdir)\n end\n end",
"def cleanup\n FileUtils.rm(@out_filename)\n\n # XXX: could be rm-rf, but be safe for now. Might have\n # problems if app creates files in $PWD\n FileUtils.rmdir(@opts[:tmpdir])\n end",
"def clean_up\n FileUtils.rm_rf @temp_root\n end",
"def clean\n needs_cleaning = File.exist?(project_dir)\n if needs_cleaning\n log.info(log_key) { \"Cleaning project directory `#{project_dir}'\" }\n FileUtils.rm_rf(project_dir)\n end\n create_required_directories\n deploy\n needs_cleaning\n end",
"def clean!\n stop\n FileUtils.remove_entry(download_path) if File.exists? download_path\n FileUtils.remove_entry(tmp_save_dir, true) if File.exists? tmp_save_dir\n FileUtils.remove_entry(instance_dir, true) if File.exists? instance_dir\n FileUtils.remove_entry(md5sum_path) if File.exists? md5sum_path\n FileUtils.remove_entry(version_file) if File.exists? version_file\n end",
"def clean!\n stop\n FileUtils.remove_entry(download_path) if File.exists? download_path\n FileUtils.remove_entry(tmp_save_dir, true) if File.exists? tmp_save_dir\n FileUtils.remove_entry(instance_dir, true) if File.exists? instance_dir\n FileUtils.remove_entry(md5sum_path) if File.exists? md5sum_path\n FileUtils.remove_entry(version_file) if File.exists? version_file\n end",
"def clean_app()\n wd = FileUtils.pwd()\n FileUtils.rm_f( [\n '/app/assets/*',\n '/app/components/*',\n '/app/controllers/*',\n '/app/helpers/*',\n '/app/models/*',\n '/app/views/*'\n ].collect!{|e| Dir.glob(wd + e)}.flatten.compact )\n end",
"def cleanup!\n FileUtils.rm_rf(obsolete_files)\n FileUtils.rm_rf(metadata_file) unless @site.incremental?\n end",
"def clean\n #rm_r(srcdir)\n rm_r(blddir)\n #rm_r(libdir)\n end",
"def cleanup_app_caches(app_name, instance_name)\n Dir.chdir RailsPwnerer::Config[app_name, instance_name][:app_path] do\n if File.exist?('Gemfile')\n Kernel.system 'bundle exec rake assets:clean RAILS_ENV=production'\n else\n Kernel.system 'rake assets:clean RAILS_ENV=production'\n end\n end\n end",
"def clean_installation\n clean_paths.each { |path| FileUtils.rm_rf(path) }\n end",
"def clean\n cache = Cache.instance\n # remove all built files\n cache.targets(false).each do |target|\n cache.remove_target(target)\n FileUtils.rm_f(target)\n end\n # remove all created directories if they are empty\n cache.directories(false).sort {|a, b| b.size <=> a.size}.each do |directory|\n cache.remove_directory(directory)\n next unless File.directory?(directory)\n if (Dir.entries(directory) - ['.', '..']).empty?\n Dir.rmdir(directory) rescue nil\n end\n end\n cache.write\n end",
"def clean!\n stop\n remove_instance_dir!\n FileUtils.remove_entry(config.download_path) if File.exists?(config.download_path)\n FileUtils.remove_entry(config.tmp_save_dir, true) if File.exists? config.tmp_save_dir\n md5.clean!\n FileUtils.remove_entry(config.version_file) if File.exists? config.version_file\n end",
"def cleanup_state\n delete_if_exists(state_file_path)\n delete_if_exists(chef_file_path)\n delete_if_exists(past_scripts_path)\n delete_if_exists(log_path)\n end",
"def clean!\n clean_installation if !local?\n end",
"def after_destroy\n super\n\n # Try our best to remove the directory. If it fails there is little\n # else that we could do to resolve the situation -- we already tried to\n # delete it once...\n self.tmpdir and FileUtils.remove_entry_secure(self.tmpdir, true)\n\n # Remove repo directory.\n if self.iso_url\n # Some files in archives are write-only. Change this property so the\n # delete succeeds.\n remove_directory(iso_location)\n end\n end",
"def clean_up\n execute(\"rm -rf #{namespace_dir}\")\n end",
"def cleanup\n FileUtils.rm_rf(sfx_cache_path)\n end",
"def clear_local\n execute(:rm, '-rf', File.join(local_cache_path, '*')) if test!(\"[ -d #{local_cache_path} ]\")\n File.unlink(cached_gemfile_md5_path)\n end",
"def cleanup\n if dir and File.exists?(dir)\n FileUtils.rm_rf(dir)\n end\n\n nil\n end",
"def cleanup\n if Dir.exists?(WORKFOLDER)\n FileUtils.remove_dir(WORKFOLDER)\n print_status(\"Workspace \\\"#{WORKFOLDER}\\\" deleted.\")\n end\nend",
"def clean\n project.run 'rm -rf /var/cache/apk/*'\n end",
"def cleanup\n\n # ----------------------------------------------\n account_name = 'your account name' # <-- change this!\n project_name = 'your project name' # <-- change this!\n # ----------------------------------------------\n\n project_dir = \"/home/#{account_name}/www\"\n Dir.chdir(project_dir)\n\n Dir.entries(project_name).select do |entry1|\n\n dir1 = File.join(project_name,entry1) #dir2 = \"#{project_name}/#{entry1}\"\n if is_directory?(dir1)\n Dir.entries(dir1).select do |entry2|\n \n dir2 = File.join(dir1,entry2) #dir2 = \"#{project_name}/#{entry1}/#{entry2}\"\n if is_directory?(dir2)\n Dir.entries(dir2).select do |entry3|\n \n dir3 = File.join(dir2,entry3) #dir3 = \"#{project_name}/#{entry1}/#{entry2}/#{entry3}\"\n if is_directory?(dir3)\n Dir.entries(dir3).select do |entry4|\n delete_file(File.join(dir3,entry4))\n end\n end\n\n delete_file(dir3)\n delete_dir(dir3)\n end\n end\n\n delete_file(dir2)\n delete_dir(dir2)\n end\n end\n\n delete_file(dir1)\n delete_dir(dir1)\n end\n\n delete_dir(project_name)\nend",
"def clean_up\n Dir.foreach(Dir.pwd) do |f|\n if !f.start_with?('tmp_') then next\n elsif File.directory?(f) then FileUtils.rm_rf(f)\n else FileUtils.rm(f)\n end\n end\nend",
"def cleanup\n cleanup_unpack_path\n cleanup_download_path\n end",
"def application_teardown\n if File.exists?(IMG_DIR)\n FileUtils.rm_rf(IMG_DIR)\n end\n end",
"def ensure_complete_app_installation(app_bundle_dir)\n return nil if app_bundle_dir.nil?\n return app_bundle_dir if complete_app_install?(app_bundle_dir)\n\n # Remove the directory that contains the app bundle\n base_dir = File.dirname(app_bundle_dir)\n FileUtils.rm_rf(base_dir)\n\n # Clean up Containers/Data/Application\n remove_stale_data_containers\n\n nil\n end",
"def purge\n\n FileUtils.remove_dir(@basepath)\n end",
"def clean_dir\n\n path = self.get_dir\n _clean_dir(path)\n end",
"def clean\n FileUtils.rm_rf(\"#{ROOT_DATA_FOLDER}/.\", secure: true)\n unless File.directory?(ROOT_DATA_FOLDER)\n FileUtils.mkdir_p(ROOT_DATA_FOLDER)\n end\n end",
"def clean\n FileUtils.remove_dir(@log_dir, true)\n end",
"def cleanup\n # the state file, if any, is always temporary.\n if @state_file_path && ::File.file?(@state_file_path)\n ::File.unlink(@state_file_path)\n end\n\n # remove any directories listed as temporary by config.\n (config.cleanup_dirs || []).each do |dir|\n ::FileUtils.rm_rf(dir) if ::File.directory?(dir)\n end\n true\n end",
"def prepare_working_dir\n FileUtils.mkdir_p @working_dir unless File.directory?(@working_dir)\n FileUtils.rm_rf Dir[\"#{@working_dir}/*\"] if @force_rebuild\n end",
"def cleanup_cached_images()\n\n # swap_dir = \"../public/swap\" # use when running locally from /lib/b2_bucket.rb\n swap_dir = \"./public/swap\" # use when running via app.rb\n swap_contents = \"#{swap_dir}/*\"\n gitkeep = \"#{swap_dir}/.gitkeep\"\n\n if File.directory?(swap_dir)\n FileUtils.rm_rf(Dir.glob(swap_contents)) # delete contents of /public/swap \n file = File.new(gitkeep, 'w') # recreate .gitkeep file\n file.close if file\n else\n puts \"Directory does not exist!\"\n end\n\nend",
"def clean_up()\n File.delete(ZIP_FILE)\n end",
"def clean!\n FileUtils.rm(self[:build_path]) if File.exist?(self[:build_path])\n FileUtils.rm(self[:staging_path]) if File.exist?(self[:staging_path])\n return self\n end",
"def cleanup\n if ::File.exist?(chef_backup_dir) # rubocop:disable Style/GuardClause\n converge_by(\"removing #{chef_backup_dir}\") do\n FileUtils.rm_rf chef_backup_dir\n end\n end\nend",
"def cleanup_cached_images()\n\n # swap_dir = \"../public/swap\" # use when running locally from /lib/s3_bucket.rb\n swap_dir = \"./public/swap\" # use when running via app.rb\n swap_contents = \"#{swap_dir}/*\"\n gitkeep = \"#{swap_dir}/.gitkeep\"\n\n if File.directory?(swap_dir)\n FileUtils.rm_rf(Dir.glob(swap_contents)) # delete contents of /public/swap \n file = File.new(gitkeep, 'w') # recreate .gitkeep file\n file.close if file\n else\n puts \"sightings directory does not exist!\"\n end\n\nend",
"def cleanUpWorkingFiles()\n system(\"rm -f #{@tripFile} #{routeFile} #{routeAltFile}\") ;\n end",
"def cleanup_files\n FileUtils.rm_rf(File.join(Rails.root, \"tmp\"))\n end",
"def cleanup_dirs\n @cleanup_dirs ||= ['.']\n end",
"def cleanup(config_store, verbose, cache_root = T.unsafe(nil)); end",
"def cleanup(path)\n Monsove.logger.info(\"Cleaning up local path #{path}\")\n\n FileUtils.rm_rf(path)\n File.delete(\"#{path}.tar.bz2\")\n end",
"def cleanup_release\n if ssh.directory_exists?(release_path)\n ssh.run(\"rm -rf #{release_path}\")\n end\n end",
"def pkg_clean\n sysprint \"#{@name} clean\"\n\n FileUtils::rm_rf(@objdir, :secure => true)\n end",
"def cleanup_script_execution\n FileUtils.rm_rf(InstanceConfiguration::CACHE_PATH)\n end",
"def cleanup\n FileUtils.rm_f(@path)\n delete\n end",
"def clean!\n FileUtils.rm_rf(dir)\n end",
"def destroy!\n fail \"Can not destroy a running stone\" if running?\n rm_rf system_config_filename\n rm_rf extent_directory\n rm_rf log_directory\n rm_rf tranlog_directories\n end",
"def clean_up\n @files.each {|file| FileUtils.remove(file.path)}\n end",
"def destroy()\n\n path = self.get_dir\n FileUtils.remove_entry_secure(path, true)\n _clean_dir(File.dirname(path))\n\n super()\n end",
"def cleanup_workspace\n FileUtils.rm_rf(@workspace)\n end",
"def cleanup\n if File.exist?(@scalerui_dir)\n print \"Cleaning up directories...\"\n FileUtils.rm_r(@scalerui_dir)\n puts \"done\"\n else\n puts \"Nothing to clean up!\"\n end\n end",
"def cleanup\n File.delete(@path) if @path.is_a?(String) && File.exist?(@path)\n end",
"def cleanup\n FileUtils.rm_f Dir.glob(File.join(config.folder, '*.items'))\n end",
"def clean_environment\n `rm -rf /tmp/#{@upload_id}` # all sliced pages of the source file\n end",
"def distclean\n cache = Cache.instance\n clean\n cache.clear\n FileUtils.rm_rf(@build_dir)\n end",
"def clean_paths\n FileUtils.rm_rf(tmp_path)\n FileUtils.mkdir_p(tmp_path)\n end",
"def clean_up(cmd = nil)\n FileUtils.rm(\n Dir.glob('build/{src,lib}.{rb,c,js}') +\n Dir.glob('build/ruby2d-opal.{rb,js}') +\n Dir.glob('build/app.c')\n )\n if cmd == :all\n puts \"cleaning up...\"\n FileUtils.rm_f 'build/app'\n FileUtils.rm_f 'build/app.js'\n FileUtils.rm_f 'build/app.html'\n FileUtils.rm_rf 'build/ios'\n FileUtils.rm_rf 'build/tvos'\n end\nend",
"def cleanup\n File.delete(@tmp_state) rescue nil\n end",
"def cleanup\n remove_files(TEST_INPUT_DIR)\n remove_files(TEST_OUTPUT_DIR)\nend",
"def clean_up(cmd = nil)\n FileUtils.rm(\n Dir.glob('build/*.{rb,c,js}')\n )\n if cmd == :all\n puts \"cleaning up...\"\n FileUtils.rm_f 'build/app'\n FileUtils.rm_f 'build/app.js'\n FileUtils.rm_f 'build/app.html'\n FileUtils.rm_rf 'build/App.app'\n FileUtils.rm_rf 'build/ios'\n FileUtils.rm_rf 'build/tvos'\n end\nend",
"def cleanup\n @agent_file_history.each { |af| FileUtils.rm_f(af) }\n @key_file_history.each { |kf| FileUtils.rm_f(kf) }\n end",
"def cleanup_tmpdirs\n FileUtils.rm_r @tmpdir if @tmpdir\n end",
"def cleanall\n FileUtils.rm_r(OUTPUT_DIR, force: true, verbose: true)\n end",
"def cleanup\n File.delete(temp_file_path)\n end",
"def clean_tmp_dir\n system \"rm -rf #{TMP_PATH}\"\n system \"mkdir #{TMP_PATH}\"\n yield\n system \"rm -rf #{TMP_PATH}\"\n system \"mkdir #{TMP_PATH}\"\n end",
"def clear\n raise \"unsafe test stage directory -- #{Dir.pwd}\" unless /#{Dir.tmpdir}/ =~ Dir.pwd\n Dir['*'].each do |path|\n FileUtils.rm_r(path)\n end\n end",
"def clean\n Dir.foreach(@wd) do |file|\n next if file.start_with?('.') or (file == \"config\")\n filename = File.join(@wd, file)\n FileUtils.remove_file(filename) if File.file?(filename)\n end\n end",
"def cleanup_files(resource)\n remove_public_dir(resource) # where the local manifest file is stored\n remove_s3_data_files(resource)\n rescue StandardError => e\n msg = \"An unexpected error occurred when cleaning up files for resource #{resource.id}: \"\n msg << e.full_message\n logger.warn(msg)\n end",
"def destroy\n FileUtils.rm_rf(@working_dir)\n end",
"def cleanup\n\tsh 'del /F /Q .\\_site\\*'\n\t# sh 'rm -rf ./_site'\nend",
"def prepare_workspace\n # create the local backup directory if it doesn't exist\n puts \"Checking workspace...\" if options[:verbose]\n unless File.directory?(backup_directory)\n Dir.mkdir(backup_directory)\n end\n unless File.directory?(temp_directory)\n Dir.mkdir(temp_directory)\n end\n Dir.chdir(backup_directory)\n # check local count against existing backups and delete if needed\n puts \"Checking and clearing archives...\" if options[:verbose]\n backup_files = Dir.glob('*').sort_by{ |f| File.ctime(f) }\n if (backup_files.count > (local_count * total_databases))\n number_to_remove = backup_files.count - (local_count * total_databases)\n backup_files.slice(0, number_to_remove).each { |f| File.delete(f) }\n end\n end",
"def preclean_project\n # Clean-up non-useful files (if any)\n clean_msg = `make clean 2>&1`\n @log_file.puts \"\\nNettoyage du répertoire :\\n\\n#{clean_msg}\"\n \n # I want to be sure...\n FileUtils::rm_f Dir.glob(\"*.o\")\n FileUtils::rm_f Dir.glob(\"*~\")\n end",
"def cleanup\n FileUtils.rm(autoinst_path, force: true)\n FileUtils.rm(definition_path, force: true)\n FileUtils.rm(libvirt_definition_path, force: true)\n if provider == :libvirt\n # Due a bug in vagrant-libvirt the images will not cleanuped correctly\n # in the /var/lib/libvirt directory. This has to be done manually\n # (including DB update)\n system \"sudo virsh vol-delete #{IMAGE_BOX_NAME} default\"\n end\n end",
"def cleanup!\n # This method may be left unimplemented if that is applicable\n end",
"def destroy\n @dirs_created.each { |d| FileUtils.rm_rf(d) }\n self.class.repositories.delete(@name)\n end",
"def clean_build_directory\n FileUtils.rm_rf Dir.glob(File.join(@project.build_path, '*'))\n end",
"def reset_app_sandbox_internal_shared\n [app_documents_dir, app_tmp_dir].each do |dir|\n FileUtils.rm_rf dir\n FileUtils.mkdir dir\n end\n end",
"def cleanup\n begin\n File.unlink(File.join(Restore::Config.socket_dir, 'restore_backend.sock'))\n rescue => e\n BackgrounDRb::ServerLogger.log_exception('server', e)\n end\n end",
"def clean!\n Cleaner.remove_package(package)\n end",
"def destroy(_)\n paths = [\n instance.provisioner[:root_path], instance.verifier[:root_path]\n ]\n paths.each do |p|\n FileUtils.rm_rf(p)\n logger.info(\"[Localhost] Deleted temp dir '#{p}'.\")\n end\n self.class.unlock!\n end",
"def scrub!\n ui.confirm \"Remove all contents from local cache (#{cache_directory})\" unless opts[:yes]\n run_action \"Scrubbing local cache\" do\n FileUtils.rm_rf(cache_directory)\n nil\n end\n end",
"def clean_pod_sources\n return unless installation_options.clean?\n return if installed_specs.empty?\n pod_installers.each(&:clean!)\n end",
"def clean_files\n ck_valid\n File.unlink(pid_file) if File.exists?(pid_file)\n File.unlink(prof_file) if File.exists?(prof_file)\n File.unlink(socket_file) if File.exists?(socket_file)\n end",
"def action_remove\n app_dir = Chef::Resource::Directory.new(\"#{@current_resource.apps_dir}/#{@current_resource.app}\", run_context)\n app_dir.path(\"#{@current_resource.apps_dir}/#{@current_resource.app}\")\n app_dir.recursive(true)\n app_dir.run_action(:delete)\n new_resource.updated_by_last_action(app_dir.updated_by_last_action?)\n end",
"def clean_test_case\n if File.exists?(@local_file_download_destination)\n File.delete(@local_file_download_destination)\n end\n end",
"def cleanup(prefix)\n print_header \"Cleaning up ...\"\n Constants::SOFTWARE.each do |sw|\n cmd \"rm #{prefix}/#{sw}.tar.gz; rm -rf #{prefix}/#{sw}\" if File.exist? \"#{prefix}/#{sw}.tar.gz\"\n end\n end",
"def cleanup\n if !ENV.has_key?('SHAPEFILE_UPLOAD_DIR')\n Rails.logger.error \"No shapefile upload directory. Please set SHAPEFILE_UPLOAD_DIR in application.yml\"\n return nil\n end\n\n upload_dir = ENV['SHAPEFILE_UPLOAD_DIR'].dup\n if upload_dir.empty?\n Rails.logger.error \"Invalid upload directory. Please set SHAPEFILE_UPLOAD_DIR in application.yml\"\n return nil\n end\n\n if shapefile.file && shapefile.file.file\n dir = File.dirname(shapefile.file.file)\n\n if dir.match(/#{upload_dir}/)\n Rails.logger.info \"Cleaning up #{dir}\"\n FileUtils.rm_rf(dir)\n end\n else\n Rails.logger.error \"Couldn't find shapefile file: #{shapefile.inspect}\"\n end\n\n end",
"def clean_test_dir!\n FileUtils.remove_entry_secure test_dir\n end",
"def cleanup_unpack_path\n if unpack_path.exist?\n unpack_path.rmtree\n end\n end",
"def purge\n raise InvalidDbError if @stale\n\n close(false)\n FileUtils.remove_dir(@path) if ::File.exist?(@path)\n end",
"def bootstrap_cleanup\n end",
"def clean_up\n pathname.delete if pathname.exist?\n end",
"def teardown\n return unless File.directory?(RESULTS_ROOT)\n FileUtils.rm_rf(\"#{RESULTS_ROOT}/.\", secure: true)\n end",
"def cleanup\n\t\tfile_count = 0\n\t\tif File.directory?(@file_path)\n\t\t\tDir.foreach(@file_path) do |f|\n\t\t\t\tfile_count += 1\n\t\t\t fn = File.join(@file_path, f)\n\t\t\t File.delete(fn) if f != '.' && f != '..'\n\t\t\tend\n\t\t\tDir.delete(@file_path)\n\t\t\tmsg = \"Cleaned up #{file_count} files\"\n\t\telse\n\t\t\thalt 422, \"No directory\"\n\t\tend\n\t\t{ msg: msg }\n\tend",
"def cleanup\n end",
"def cleanup\n end",
"def remove_local_copy\n Dir.chdir(self.study.data_store_path)\n if File.exists?(self.download_location)\n File.delete(self.download_location)\n subdir = self.remote_location.blank? ? self.id : self.remote_location.split('/').first\n if Dir.exist?(subdir) && Dir.entries(subdir).delete_if {|e| e.start_with?('.')}.empty?\n Dir.rmdir(subdir)\n end\n end\n end",
"def clean()\n rels = releases()\n rels.pop()\n\n unless rels.empty?\n rm = ['rm', '-rf'].concat(rels.map {|r| release_dir(r)})\n rm << release_dir('skip-*')\n cmd.ssh(rm)\n end\n end"
] |
[
"0.6883739",
"0.6783197",
"0.6661202",
"0.6596878",
"0.6569509",
"0.6569509",
"0.65541524",
"0.6499908",
"0.6496716",
"0.64849186",
"0.6408572",
"0.6372577",
"0.6368637",
"0.63353187",
"0.63040847",
"0.62705773",
"0.62540424",
"0.6242853",
"0.62291646",
"0.62134784",
"0.6196061",
"0.6180409",
"0.61656797",
"0.61653787",
"0.6095579",
"0.60951555",
"0.6087178",
"0.606009",
"0.6046829",
"0.60454303",
"0.603674",
"0.6032149",
"0.60058254",
"0.5973694",
"0.5928185",
"0.5920167",
"0.59188884",
"0.5918148",
"0.5899949",
"0.58897406",
"0.58806217",
"0.58378804",
"0.5837801",
"0.5837455",
"0.5833133",
"0.58269966",
"0.58172387",
"0.57985336",
"0.5790041",
"0.57869774",
"0.57856345",
"0.57842666",
"0.5772007",
"0.5753711",
"0.5744445",
"0.57201904",
"0.5717024",
"0.5711164",
"0.5709184",
"0.57071316",
"0.5706005",
"0.56773454",
"0.5665609",
"0.56630737",
"0.56551623",
"0.56469303",
"0.5628171",
"0.5623889",
"0.5613994",
"0.56067723",
"0.5591789",
"0.5591525",
"0.55891496",
"0.5581108",
"0.55810875",
"0.5571416",
"0.55708003",
"0.5565359",
"0.5564513",
"0.5554591",
"0.5550468",
"0.554989",
"0.5547508",
"0.55457455",
"0.5542158",
"0.55304116",
"0.551521",
"0.55136496",
"0.5509236",
"0.55067754",
"0.55059236",
"0.5500848",
"0.5499328",
"0.54920053",
"0.54795593",
"0.5474881",
"0.5466613",
"0.5466613",
"0.5457437",
"0.5456424"
] |
0.7219504
|
0
|
s(:class, NAME, PARENT, BODY)
|
def process_class exp
name = class_name(exp.class_name)
parent = class_name(exp.parent_name)
# If inside an inner class we treat it as a library.
if @current_class
Railroader.debug "[Notice] Treating inner class as library: #{name}"
Railroader::LibraryProcessor.new(@tracker).process_library exp, @file_name
return exp
end
handle_class exp, @tracker.models, Railroader::Model
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def s(type, *children); end",
"def new_anon_class(parent, name=\"\", &proc)\n klass = Class.new(parent) \n mc = klass.instance_eval{ class << self ; self ; end }\n mc.send(:define_method, :to_s) {name}\n klass.class_eval(&proc) if proc\n klass\nend",
"def call\n klass = Class.new(parent)\n\n klass.class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def self.name\n #{name.inspect}\n end\n\n def self.inspect\n name\n end\n\n def self.to_str\n name\n end\n\n def self.to_s\n name\n end\n RUBY\n\n yield(klass) if block_given?\n\n klass\n end",
"def sclass\n class << @obj; self; end\n end",
"def s(type, *children)\n return RubyLint::AST::Node.new(type, children)\nend",
"def class(sexp, level)\n cid, sup, body = sexp\n code, vars = nil, []\n\n base, name = if Symbol === cid or String === cid\n ['self', cid.to_s.inspect]\n elsif cid[0] == :colon2\n [process(cid[1], :expression), cid[2].to_s.inspect]\n elsif cid[0] == :colon3\n ['VM.Object', cid[1].to_s.inspect]\n else\n raise \"Bad receiver in class\"\n end\n\n sup = sup ? process(sup, :expression) : 'null'\n\n in_scope(:class) do\n code = process body, :statement\n\n @scope.locals.each { |t| vars << \"#{t} = nil\" }\n @scope.temps.each { |t| vars << t }\n\n code = \"var #{vars.join ', '};\" + code unless vars.empty?\n end\n\n \"$class(#{base}, #{sup}, #{name}, function(self) {\\n#{code}})\"\n end",
"def class; end",
"def class; end",
"def _parent; end",
"def nested(s)\n raise NotImplementedError, \"Method not implemented\"\nend",
"def nested(s)\n raise NotImplementedError, \"Method not implemented\"\nend",
"def nested(s)\n raise NotImplementedError, \"Method not implemented\"\nend",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def class_name; end",
"def class_name; end",
"def class() end",
"def definition\n \"class #{full_name}\"\n end",
"def class\n <<-CODE\n t1 = stack_pop();\n stack_push(object_class(state, t1));\n CODE\n end",
"def inspect\n class_name = self.class.to_s.split('::').last\n child_lines = children.map { |child| child.inspect(4) }.join(\"\\n\")\n\n if doctype\n dtd = doctype.inspect(2)\n else\n dtd = doctype.inspect\n end\n\n if xml_declaration\n decl = xml_declaration.inspect(2)\n else\n decl = xml_declaration.inspect\n end\n\n return <<-EOF.strip\n#{class_name}(\n doctype: #{dtd}\n xml_declaration: #{decl}\n children: [\n#{child_lines}\n])\n EOF\n end",
"def class_definition()\n \t_IDENTIFIER1 = nil\n\n\n\n\n \t class_def = ClassDefinition.new\n\n\n # 19:7: modifier[class_def] CLASS ( IDENTIFIER ) ( class_name_parameters[class_def] )? ( inheritance[class_def] )? ( interface[class_def] )? class_body[class_def]\n modifier(class_def)\n\n match(:CLASS)\n # 21:8: IDENTIFIER\n _IDENTIFIER1 = @input.look_ahead(1)\n match(:IDENTIFIER)\n class_def.name = _IDENTIFIER1.text \n # 22:7: ( class_name_parameters[class_def] )?\n alt2 = 2\n # 22:7: ( class_name_parameters[class_def] )?\n look_ahead2_0 = look_ahead(1)\n\n if look_ahead2_0 == :LEFT_ANGULAR_BRACKET \n alt2 = 1\n end\n case alt2\n when 1\n # 22:9: class_name_parameters[class_def]\n class_name_parameters(class_def)\n\n end\n # 23:7: ( inheritance[class_def] )?\n alt3 = 2\n # 23:7: ( inheritance[class_def] )?\n look_ahead3_0 = look_ahead(1)\n\n if look_ahead3_0 == :EXTENDS \n alt3 = 1\n end\n case alt3\n when 1\n # 23:8: inheritance[class_def]\n inheritance(class_def)\n\n end\n # 24:7: ( interface[class_def] )?\n alt4 = 2\n # 24:7: ( interface[class_def] )?\n look_ahead4_0 = look_ahead(1)\n\n if look_ahead4_0 == :IMPLEMENTS \n alt4 = 1\n end\n case alt4\n when 1\n # 24:8: interface[class_def]\n interface(class_def)\n\n end\n class_body(class_def)\n\n\n puts class_def.report\n \n\n\n\n end",
"def class_decls; end",
"def superclass() end",
"def parent=(_arg0); end",
"def parent=(_arg0); end",
"def parent=(_arg0); end",
"def parent=(_arg0); end",
"def parent=(_arg0); end",
"def klass; end",
"def klass; end",
"def klass; end",
"def klass; end",
"def klass; end",
"def klass; end",
"def klass; end",
"def klass; end",
"def nested_class( name, parent, &block )\n unless const_defined?( name ) then\n klass = Class.new( parent )\n klass.class_eval( &block ) if block_given?\n const_set( name , klass )\n end\n return const_get( name )\n end",
"def create_class(classname, superclass); end",
"def statement()\n\n\n\n # 12:5: class_definition\n class_definition()\n\n\n\n\n end",
"def top_level_method\n puts \"hello from [class #{self.class.name}]\"\nend",
"def visit_Squeel_Nodes_Sifter(o, parent)\n klass = classify(parent)\n visit(klass.send(o.name, *o.args), parent)\n end",
"def print_class(*) end",
"def dom_class; end",
"def dom_class; end",
"def dom_class; end",
"def dom_class; end",
"def class=(_arg0); end",
"def definition\n \"class << #{full_name}\"\n end",
"def name; self.class.name; end",
"def parents; end",
"def pearified_classname\n self\n end",
"def super_class; end",
"def super_class; end",
"def append_class(name); end",
"def append_class(name); end",
"def set_class\n <<-CODE\n _lit = stack_pop();\n t1 = stack_pop();\n SET_CLASS(_lit, t1);\n stack_push(_lit);\n CODE\n end",
"def namespace_inheritance=(_arg0); end",
"def namespace_inheritance=(_arg0); end",
"def body\n expect :defn, :defs, :class, :module\n\n case self.node_type\n when :defn, :class\n self[3..-1]\n when :defs\n self[4..-1]\n when :module\n self[2..-1]\n end\n end",
"def name; self.class.to_s; end",
"def inspect\n \"\\#<#{self.class} name=#{name.inspect}>\"\n end",
"def translate(sexp)\n t = translate_generic_sexp(sexp)\n var = @translator.next_var_name\n ctor = std_init_name(t.value_type)\n add_border_mark(sexp)\n s(:stmts, class_constructor(t.value_type, var),\n s(:call, ctor,\n s(:args, s(:var, var), t.value_sexp))).with_value(s(:var, var), t.value_type)\n rescue NotInlineableError\n nil\n end",
"def test_class_from_parent\n code = CodeTree.determine_code_from_path([\n \"Wiki.menu('hey')\",\n \".pages\"])\n assert_equal(\"Wiki.pages()\", code)\n end",
"def nesting() end",
"def in_klass name\n if Sexp === name then\n name = case name.sexp_type\n when :colon2 then\n name = name.flatten\n name.delete :const\n name.delete :colon2\n name.join(\"::\")\n when :colon3 then\n name.last.to_s\n else\n raise \"unknown type #{name.inspect}\"\n end\n end\n\n @class_stack.unshift name\n\n with_new_method_stack do\n yield\n end\n ensure\n @class_stack.shift\n end",
"def parent_name\n self.class.parent_name\n end",
"def display_class name\n return if name =~ /#|\\./\n\n found, klasses, includes, extends =\n classes_and_includes_and_extends_for name\n\n return if found.empty?\n\n out = class_document name, found, klasses, includes, extends\n\n display out\n end",
"def inherited(klass); end",
"def inherited(klass); end",
"def eval_string(klass, attrib)\n s = <<EOS\n class #{klass}\n def #{attrib}\n @#{attrib}\n end\n\n def #{attrib}=(value)\n @#{attrib} = value\n end\n end\nEOS\n return s\nend",
"def inspect\n \"#<#{self.class.name} @body=\\\"#{self.body}\\\">\"\n end",
"def test_subclass_name\n bo1 = Pt::Boundary::MyA.new(\"\\n===\\n\")\n assert_equal \"Part::Boundary::MyA\", bo1.subclass_name\n assert_equal \"Boundary::MyA\", bo1.subclass_name(index_ini: 1)\n assert_equal \"MyA\", bo1.subclass_name(index_ini: 2)\n\n ss = PlainText::Part::Section::Subsection.new [\"abc\"]\n assert_equal \"Part::Section::Subsection\", ss.subclass_name\n assert_equal \"Section::Subsection\", ss.subclass_name(index_ini: 1)\n end",
"def visit_Squeel_Nodes_Stub(o, parent)\n contextualize(parent)[o.symbol]\n end",
"def inspect\n \"#<#{self.class.inspect}(#{@name})>\"\n end",
"def add_class(name); end",
"def add_class(name); end",
"def parent=(obj); end",
"def class_name\n %x{\n var first = self[0];\n return (first && first.className) || \"\";\n }\n end",
"def parse_class_regular container, declaration_context, single, # :nodoc:\n name_t, given_name, comment\n superclass = '::Object'\n\n if given_name =~ /^::/ then\n declaration_context = @top_level\n given_name = $'\n end\n\n tk = peek_tk\n if tk[:kind] == :on_op && tk[:text] == '<' then\n get_tk\n skip_tkspace\n superclass = get_class_specification\n superclass = '(unknown)' if superclass.empty?\n end\n\n cls_type = single == SINGLE ? RDoc::SingleClass : RDoc::NormalClass\n cls = declaration_context.add_class cls_type, given_name, superclass\n cls.ignore unless container.document_children\n\n read_documentation_modifiers cls, RDoc::CLASS_MODIFIERS\n record_location cls\n\n cls.add_comment comment, @top_level\n\n @top_level.add_to_classes_or_modules cls\n @stats.add_class cls\n\n suppress_parents container, declaration_context unless cls.document_self\n\n parse_statements cls\n\n cls\n end",
"def parent\n end",
"def parent\n end",
"def parent\n end",
"def parent\n end",
"def parse_superclass(superclass)\n return nil unless superclass\n return nil unless superclass.type == :call || superclass.type == :command_call\n \n cname = superclass.namespace.source\n if cname =~ /^O?Struct$/ && superclass.method_name(true) == :new\n return cname\n end\n nil\n end",
"def classes; end",
"def base_class; end",
"def root_dse\n\t\treturn self.search( '', :base, '(objectClass=*)', :selectattrs => ['+', '*'] ).first\n\tend",
"def parent_name\n @parent_name || super\n end",
"def parent_name\n @parent_name || super\n end",
"def defined_classname filename\r\n script = File.new filename\r\n script.each_line do |line|\r\n if line =~ /class(.*)[<|\\z]/ \r\n script.close\r\n return $1.strip\r\n end\r\n end \r\n script.close \r\n \"\"\r\nend",
"def find_class_named_from name, from\n from = find_class_named from unless RDoc::Context === from\n\n until RDoc::TopLevel === from do\n return nil unless from\n\n klass = from.find_class_named name\n return klass if klass\n\n from = from.parent\n end\n\n find_class_named name\n end"
] |
[
"0.66017395",
"0.6006788",
"0.59766257",
"0.58545053",
"0.5828077",
"0.5729366",
"0.5705696",
"0.5705696",
"0.5650151",
"0.56176203",
"0.5603581",
"0.5603581",
"0.55614185",
"0.55614185",
"0.55614185",
"0.55614185",
"0.55614185",
"0.55614185",
"0.55614185",
"0.55614185",
"0.55614185",
"0.55614185",
"0.55614185",
"0.55614185",
"0.55330396",
"0.55330396",
"0.5491135",
"0.5484204",
"0.5479567",
"0.5472979",
"0.5465034",
"0.544642",
"0.5430461",
"0.5411694",
"0.5411694",
"0.5411694",
"0.5411694",
"0.5411694",
"0.5400924",
"0.5400924",
"0.5400924",
"0.5400924",
"0.5400924",
"0.5400924",
"0.5400489",
"0.5400489",
"0.538735",
"0.53578615",
"0.53371733",
"0.53308606",
"0.5317422",
"0.53057545",
"0.5276985",
"0.5276985",
"0.5276985",
"0.5276985",
"0.52757394",
"0.5251946",
"0.5245682",
"0.522793",
"0.5217818",
"0.52119344",
"0.52119344",
"0.52086926",
"0.52086926",
"0.51940733",
"0.51939046",
"0.51939046",
"0.5186621",
"0.5186143",
"0.5172087",
"0.51605093",
"0.5158225",
"0.5147719",
"0.51458925",
"0.51449627",
"0.5143494",
"0.51400536",
"0.51400536",
"0.51344746",
"0.5129541",
"0.512949",
"0.5122097",
"0.5104239",
"0.5100023",
"0.5100023",
"0.5099301",
"0.50970584",
"0.5096262",
"0.5091334",
"0.5091334",
"0.5091334",
"0.5091334",
"0.50892943",
"0.5081583",
"0.5079701",
"0.50605166",
"0.5060455",
"0.5060455",
"0.5056689",
"0.5042122"
] |
0.0
|
-1
|
Handle calls outside of methods, such as include, attr_accessible, private, etc.
|
def process_call exp
return exp unless @current_class
return exp if process_call_defn? exp
target = exp.target
if sexp? target
target = process target
end
method = exp.method
first_arg = exp.first_arg
# Methods called inside class definition
# like attr_* and other settings
if @current_method.nil? and target.nil?
if first_arg.nil?
case method
when :private, :protected, :public
@visibility = method
when :attr_accessible
@current_class.set_attr_accessible
else
# ??
end
else
case method
when :include
@current_class.add_include class_name(first_arg) if @current_class
when :attr_accessible
@current_class.set_attr_accessible exp
when :attr_protected
@current_class.set_attr_protected exp
else
if @current_class
@current_class.add_option method, exp
end
end
end
exp
else
call = make_call target, method, process_all!(exp.args)
call.line(exp.line)
call
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def method_missing(wh,*therest)\n # xxx internal methods must be protected at some point\n end",
"def internal; end",
"def internal_methods; end",
"def private_method\n end",
"def included; end",
"def protected_method\n end",
"def accessibility; end",
"def ignore_method_conflicts; end",
"def hidden_apis=(_arg0); end",
"def private_method; end",
"def private_method\n\tend",
"def private_method\n\tend",
"def private; end",
"def ignore_me\nend",
"def possibly_include_hidden?; end",
"def a_private_method\n\tend",
"def protected_method\n\tend",
"def access_control\n \n end",
"def dispatch\n raise(NotImplemetedError, \"subclass responsability\")\n end",
"def internal?; end",
"def private_instance_methods(include_super=true) end",
"def protected_instance_methods(include_super=true) end",
"def private_method\n end",
"def include; end",
"def include; end",
"def isolated; end",
"def isolated; end",
"def methods() end",
"def protected_method\n end",
"def http_method\n raise \"Implement in child class\"\n end",
"def protected_methods(all=true) end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def hidden_apis; end",
"def ignore_method_conflicts=(_arg0); end",
"def public_method_here\n\t# stuff\nend",
"def method_missing(method, *)\n raise InsufficientContext.new(method)\n end",
"def extra; end",
"def ignore; end",
"def inherited(klass)\n super\n klass.send :include, ::Henshin::Safety\n klass.instance_variable_set(:@unsafe_methods, @unsafe_methods)\n end",
"def some_business_logic\n # ...\n end",
"def some_business_logic\n # ...\n end",
"def some_business_logic\n # ...\n end",
"def allowGetIn _obj, _args\n \"_obj allowGetIn _args;\" \n end",
"def awaken!\n\t\traise 'Not implemented'\n\tend",
"def other_public_method\n end",
"def included(mod); end",
"def special\n override\n end",
"def import\n raise \"#{self.class.name}::#{__method__} must be overridden\"\n end",
"def api_only=(_); end",
"def api_only=(_arg0); end",
"def inject_acl_object_check(method_name,mode)\n class_eval <<-EOV\n unless respond_to?(:no_acl_#{method_name})\n alias_method :no_acl_#{method_name}, :#{method_name} unless respond_to?(:no_acl_#{method_name})\n private :no_acl_#{method_name}\n end\n EOV\n command = <<-EOV\n def #{method_name}(*args,&block)\n permitted_to!(:#{mode}_#{method_name}) if (!permitted_to?(:#{mode}))\n return send(:no_acl_#{method_name},*args,&block)\n end\n EOV\n instance_eval command\n end",
"def before_dispatch(env); end",
"def process_hook\n fail 'sub class to implement'\n end",
"def check_only_methods\n end",
"def protect()\n res = super(context,self)\n return res\n end",
"def public_instance_methods(include_super=true) end",
"def custom; end",
"def custom; end",
"def public; end",
"def public; end",
"def expose; end",
"def sniff\n return [] if context.singleton_method? || context.module_function?\n return [] if context.references_self?\n return [] if num_helper_methods.zero?\n return [] if ignore_method?\n\n [smell_warning(\n lines: [source_line],\n message: \"doesn't depend on instance state (maybe move it to another class?)\")]\n end",
"def main_method3\n puts greet\n puts pr_method1 #private method worked in sub class like protected\n end",
"def a_private_method\n end",
"def method3 # will be 'private'\r\n\t\t# ...\r\n\tend",
"def method_missing(method_name, *args)\n (args && args.size > 0) ? super(method_name, *args) : before_method(method_name)\n end",
"def included_modules() end",
"def method4 # and this will be 'public'\r\n\t\t#...\r\n\tend",
"def doManipulation(contents); raise \"Abstract Exception: doManipulation must be extended\"; end",
"def api_only; end",
"def api_only; end",
"def api_only; end",
"def safe; end",
"def extract\n raise NoMethodError, \"#{__method__} not defined for#{self.class.name}\"\n end",
"def inclusions; end",
"def included(othermod) end",
"def work\n raise \"implement this in a class that includes this module\"\n end",
"def init_public_members\n super\n @move_route_forcing = false\n end",
"def overrides; end",
"def freeze\n context and inclusions and super\n end",
"def included(m)\n @_modular_saved && @_modular_saved.each do |meth, args, block, where|\n begin\n m.send(meth, *args, &block)\n rescue => ex\n ex.set_backtrace where\n ex.message << \" while applying methods from #{self}\"\n raise ex\n end\n end\n end",
"def before_all\n super if defined?(super)\n end",
"def process_hook\n fail 'child class to implement'\n end",
"def included( hooked_instance )\n \n super if defined?( super )\n \n end",
"def extract\n raise NoMethodError, \"#{__method__} not defined for #{self.class.name}\"\n end",
"def method2 # will be 'protected'\r\n\t\t#...\r\n\tend",
"def called_from; end",
"def called_from; end",
"def decorated_object_behavior\n #code\n end",
"def helpers; end",
"def helpers; end",
"def helpers; end",
"def method3 # will be 'private'\n #...\n end",
"def method2 # will be 'protected'\n #...\n end",
"def public_method; end",
"def method_undefined(*) end",
"def parent_api; end"
] |
[
"0.65077424",
"0.6240586",
"0.60360795",
"0.6001385",
"0.59529465",
"0.5931626",
"0.59065366",
"0.5864792",
"0.58286405",
"0.58241624",
"0.5811471",
"0.5811471",
"0.57930607",
"0.57841784",
"0.57530504",
"0.5734461",
"0.5715461",
"0.57126075",
"0.5692284",
"0.5667195",
"0.56544983",
"0.5639651",
"0.55855435",
"0.55752116",
"0.55752116",
"0.55684584",
"0.55684584",
"0.5557441",
"0.55473894",
"0.55352086",
"0.55167073",
"0.5514799",
"0.5514799",
"0.5514799",
"0.5514799",
"0.5502167",
"0.549742",
"0.5490705",
"0.5483112",
"0.5460369",
"0.54478323",
"0.54452866",
"0.5445216",
"0.5445216",
"0.5445216",
"0.54420763",
"0.5441873",
"0.5415722",
"0.5404474",
"0.5402947",
"0.53953624",
"0.5388018",
"0.53835917",
"0.53794664",
"0.53781384",
"0.5373297",
"0.536138",
"0.53577095",
"0.5353124",
"0.5342678",
"0.5342678",
"0.534267",
"0.534267",
"0.5336038",
"0.53250957",
"0.53200805",
"0.53134215",
"0.5310149",
"0.52990323",
"0.5294946",
"0.5276131",
"0.52742183",
"0.52621526",
"0.52621526",
"0.52621526",
"0.5257438",
"0.525634",
"0.5255261",
"0.5250046",
"0.5249474",
"0.5246385",
"0.5240771",
"0.52395177",
"0.52249134",
"0.5218752",
"0.5216853",
"0.5214444",
"0.518998",
"0.51833177",
"0.51820683",
"0.51820683",
"0.5179392",
"0.51792043",
"0.51792043",
"0.51792043",
"0.51647884",
"0.51605517",
"0.5153373",
"0.514909",
"0.51312965"
] |
0.56006986
|
22
|
takes an array and splits it into left (less than) and right (greater than) by moving in from both sides, swapping values as positions move towards the midpoint
|
def partition_array(array, pivot)
left_i = 0
right_i = (last_i = array.length - 1)
# haven't crossed/met yet...
while left_i < right_i
while array[left_i] <= pivot && left_i < last_i
left_i += 1
end
while array[right_i] >= pivot && right_i > 0
right_i -= 1
end
# four possibilities (extract this part)
if left_i < right_i # stopped but not crossed
# swap left and right values
tmp = array[left_i]
array[left_i] = array[right_i]
array[right_i] = tmp
# repeat loop
else
if left_i > right_i # # crossed, midpoint found
midpoint = left_i #left_i is to right of midpoint after cross
left = array
right = left.slice!(midpoint..-1)
elsif right_i == 0 # right marker came all the way over: ALL GREATER THAN
left, right = [], array
else left_i == last_i # left marker came all the way right: ALL LESS THEN
left, right = array, []
end
break
end
end
return left, right
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def halve array\n middle = (array.size / 2.0).round - 1\n left = array[0..middle]\n right = array[(middle+1)..(array.last)]\n [left,right]\nend",
"def halve array\n middle = (array.length / 2.0).round\n left = [0..middle]\n right = [middle..(array.last)]\n [left,right]\nend",
"def partition_array(array,x,left=0,right=(array.length-1))\n # end condition: when the markers pass each other\n # we're done, so then return the array \n if right < left\n return array\n end\n\n # when the left value is wrong\n wrong_left = array[left] > x\n # when the right value is wrong\n wrong_right = array[right] < x\n \n #if both are wrong, swap the pair\n if wrong_left && wrong_right\n array[left], array[right] = array[right], array[left]\n left = left + 1\n right = right - 1\n partition_array(array,x,left,right)\n #else if only the left is wrong, increment just the right\n elsif wrong_left\n right = right - 1\n partition_array(array,x,left,right)\n #else if the only the right is wrong, increment the left\n elsif wrong_right\n left = left + 1\n partition_array(array,x,left,right)\n end\n\n #return the array\n return array\nend",
"def merge_sort(array)\n return array if array.length == 1\n\n mid_index = array.length / 2\n end_index = array.length - 1\n\n left_half = array[0..mid_index - 1]\n right_half = array[mid_index..end_index]\n\n left_half_sorted = merge_sort(left_half)\n right_half_sorted = merge_sort(right_half)\n\n sorted = []\n until left_half_sorted.empty? || right_half_sorted.empty?\n sorted << (left_half_sorted.first < right_half_sorted.first ? left_half_sorted.shift : right_half_sorted.shift)\n end\n sorted + left_half_sorted + right_half_sorted\nend",
"def bubble_sort_by(array)\n \n i = 0 \n while i < array.length - 1 \n left = array[i]\n right = array[i+1]\n if yield(left,right) > 0\n array[i], array[i+1] = array[i+1], array[i]\n i = -1\n end\n i += 1 \n end\n return array\nend",
"def merge_sort_two(array)\n size = array.size\n return array if size < 2\n\n ##Find the mid_point\n mid_point = size / 2\n\n ##Divide\n left = (array.slice(0, mid_point))\n right = (array.slice(mid_point, array.size)) ##the right part may be odd\n\n merge_two(merge_sort_two(left), merge_sort_two(right))\nend",
"def reverse(arr)\n start_point = 0\n end_point = -1\n mid_point = arr.size / 2\n \n while start_point < mid_point\n arr[start_point], arr[end_point] = arr[end_point], arr[start_point]\n start_point += 1\n end_point -= 1\n end\n arr\nend",
"def b_s(sorted_arr, value)\n left = 0\n right = sorted_arr.length - 1\n\n while left <= right\n #specify the middle of the array, if you get a decimal, it is automatically rounded down\n mid = (left+right)/2\n\n # So now we are saying that we have:\n # beginning of array\n # end of the array,\n # middle of the array\n # value to check between either the right or left side\n\n #compare the value of the position is currently at with the supplied value\n\n #return the position that the value is at if the evaluation of mid in the array is equal\n if sorted_arr[mid] == value\n #return the position of value\n return mid\n end\n # if the evalution turns out to be less than the value...\n if sorted_arr[mid] < value\n # since we know the evaluation on the left side is less than the value,\n # set left to current mid plus one to converge towards the right\n # do this so that you are pinching the value you are looking for.\n # think of it as pinching the array.\n # as a result of this analogy, I came up with this other strange analogy:\n # or think of it as your brain implementing an algorithm in spacetime where you\n # you are pinching in spacetime for an object, where once you have grasp, the message is\n # returned back to your brain telling you the value in space time was found and you calculate further.\n left = mid + 1\n\n # notice how we don't even have to set the conditional of arr[mid] > value...we can just:\n else\n # since the last element (right) is less than the evalution of arr[mid],\n # we readjust the right to be less\n right = mid - 1\n end\n end\n return nil\nend",
"def halve array\n middle = (array.size / 2.0).round\n left = array[0..middle]\n right = array[middle..(array.size)]\n return [left,right] # explicit return for clarity :P\nend",
"def sift_down(array, index, order)\n value = array[index]\n while order > 1\n right_index = index - 1\n left_index = right_index - LEONARDO_NUMS[order - 2]\n break if value >= array[left_index] && value >= array[right_index]\n\n if array[left_index] <= array[right_index]\n array[index] = array[right_index]\n index = right_index\n order -= 2\n else\n array[index] = array[left_index]\n index = left_index\n order -= 1\n end\n end\n array[index] = value\nend",
"def partition(array)\n # write your code here\n\n left = []\n right = []\n pivot = array.shift\n array.each do |int|\n if int <= pivot\n left << int\n else\n right << int\n end\n end\n\n left << pivot\n left + right\nend",
"def merge_sort(array)\n return array if array.length <= 1\n\n mid_idx = (array.length/2)\n left_side = array[0...mid_idx]\n right_side = array[mid_idx..-1]\n\n sort_left = merge_sort(left_side)\n sort_right = merge_sort(right_side)\n\n merge_halves(sort_left, sort_right)\nend",
"def halvsies(arr)\n \n left_array = []\n right_array = []\n middle_index = arr.size / 2\n if arr.size.even?\n left_array = arr[0...middle_index]\n right_array = arr[middle_index..-1]\n elsif\n left_array = arr[0..middle_index]\n right_array = arr[(middle_index + 1)..-1]\n end\n [left_array, right_array]\nend",
"def merge_sort(array)\n return array if array.length < 2\n middle_idx = array.length / 2\n first_half = array.take middle_idx\n last_half = array.drop middle_idx\n\n merge_helper(merge_sort(first_half), merge_sort(last_half))\nend",
"def reverse!(arr)\nreturn arr if arr.size == 0 || arr.size == 1\nfront_counter = 0\nback_counter = -1\n\nloop do\n arr[front_counter], arr[back_counter] = arr[back_counter], arr[front_counter]\n front_counter += 1\n back_counter -= 1\n break if front_counter == (arr.size / 2).floor\nend\n\n# while left_index < array.size / 2\n# array[left_index], array[right_index] = array[right_index], array[left_index]\n# left_index += 1\n# right_index -= 1\n# end\n\narr\nend",
"def partition(array, left, right)\n pivot = right\n right -= 1\n puts \"left: #{left}, right: #{right}\"\n while true do\n while array[left] <= array[pivot] && left < pivot do\n left += 1\n end\n\n while array[right] > array[pivot] do\n right -= 1\n end\n\n\n\n if left >= right\n temp = array[left]\n array[left] = array[pivot]\n array[pivot] = temp\n break\n else\n temp = array[left]\n array[left] = array[right]\n array[right] = temp\n end\n end\n\n\n left\nend",
"def partition(array, testValue)\r\n\r\n\r\n\tleft_index = 0\r\n\tright_index = array.length-1\r\n\r\n\t# While markers have not crossed each other\r\n\twhile(left_index < right_index)\r\n\r\n\t\tl_value = array[left_index]\r\n\t\tr_value = array[right_index]\r\n\t\tif(l_value > testValue and r_value < testValue)\t\r\n\t\t\t# Swap\r\n\t\t\ttemp = array[left_index]\r\n\t\t\tarray[left_index] = array[right_index]\r\n\t\t\tarray[right_index] = temp\r\n\t\tend\r\n\r\n\t\t#Move left_index forward\r\n\t\twhile(array[left_index]<testValue)\r\n\t\t\tleft_index = left_index+1\r\n\t\tend\r\n\r\n\t\t#Move right_index back\r\n\t\twhile(array[right_index]>testValue)\r\n\t\t\tright_index = right_index-1\r\n\t\tend\r\n\tend\r\n\r\n\t#returns the point where the test value divides the array\r\n\tif(array[left_index]>testValue)\r\n\t\tleft_index -= 1\r\n\tend\r\n\treturn left_index, array\r\nend",
"def bubble_sort(array)\n fixed_position = array.length\n while true\n left_elem_index = 0\n while true\n #compare the left and the right\n left = array[left_elem_index]\n right = array[left_elem_index +1]\n if left > right then\n array[left_elem_index] = right\n array[left_elem_index + 1] = left\n left_elem_index +=1\n else\n left_elem_index +=1\n end\n break if left_elem_index +1 == fixed_position\n end\n fixed_position -=1\n break if left_elem_index ==1\n end\n return array\nend",
"def merge_halves(left_array, right_array)\n result_array = []\n array_length = left_array.length + right_array.length\n array_length.times do\n if left_array[0].nil?\n result_array.push(right_array.slice!(0))\n elsif right_array[0].nil?\n result_array.push(left_array.slice!(0))\n elsif left_array[0] < right_array[0]\n result_array.push(left_array.slice!(0))\n else\n result_array.push(right_array.slice!(0))\n end\n end\n result_array\nend",
"def partition(array)\n # write your code here\n first = array[0]\n right = []\n left = []\n \n for i in 1..(array.length - 1)\n if first > array[i] \n left << array[i] \n else \n right << array[i]\n end\n end\n left + [first] + right\n \n end",
"def halvsies(arr)\n midpoint = arr.length.even? ? arr.length / 2 : (arr.length / 2) + 1\n arr1 = arr[0,midpoint]\n arr2 = arr[midpoint..-1]\n [arr1, arr2]\nend",
"def quadruplet_recombine array\n left, right = halve(array)\n\n # ternary\n left_sorted = left.first > left.last ? [left.last, left.first] : left\n right_sorted = right.first > right.last ? [right.last, right.first] : right\n\n sorted = left_sorted[0] < right_sorted [0] ? [left_sorted,right_sorted] : [right_sorted,left_sorted]\n\n sorted.flatten\nend",
"def move_everything_up_between(lower, upper, ary)\n new_ary = Array.new(ary)\n new_ary.each do |a|\n if (upper..lower).cover?(a[1])\n a[1] -= 1\n end\n end\n return new_ary\n end",
"def reverse!(array)\n left_index = 0\n right_index = -1\n\n while left_index < array.size / 2\n array[left_index], array[right_index] = array[right_index], array[left_index]\n left_index += 1\n right_index -= 1\n end\n\n array\nend",
"def reverse!(array)\n left_index = 0\n right_index = -1\n\n while left_index < array.size / 2\n array[left_index], array[right_index] = array[right_index], array[left_index]\n left_index += 1\n right_index -= 1\n end\n\n array\nend",
"def reverse!(array)\n left_index = 0\n right_index = -1\n\n while left_index < array.size / 2\n array[left_index], array[right_index] = array[right_index], array[left_index]\n left_index += 1\n right_index -= 1\n end\n array\nend",
"def forward_pass(array, compare)\n swapped = false\n 0.upto(array.length - 2) do |i|\n if compare.call(array[i], array[i + 1]) > 0\n array[i], array[i + 1] = array[i + 1], array[i]\n swapped = true\n end\n end\n [array, swapped]\nend",
"def reverse!(array)\n left_index = 0\n right_index = -1\n\n while left_index < (array.size / 2)\n array[left_index], array[right_index] = array[right_index], array[left_index]\n left_index += 1\n right_index -= 1\n end\n array\nend",
"def merge_sort(array)\n return array if array.length <= 1\n\n mid_point = array.length / 2\n\n left_hand = merge_sort(array.take(mid_point))\n right_hand = merge_sort(array.drop(mid_point))\n\n merge_sort_compare(left_hand, right_hand)\n #left_hand + right_hand\nend",
"def merge_sort(array)\n\treturn [] if array.length == 0\n\treturn array if array.length == 1\n\n\tmidpoint = array.length / 2\n\tleft_side = array[0..midpoint].take(midpoint)\n\tright_side = array.drop(midpoint)\n\n\tmerge(merge_sort(left_side), merge_sort(right_side))\n\t# merge_sort(merge(left_side, right_side))\n\nend",
"def mergeSort array\n if array.count <= 1\n return array\n end\n\n middle = array.count / 2\n left = mergeSort array.slice(0, middle)\n right = mergeSort array.slice(middle, array.count)\n\n left_offset = 0\n right_offset = 0\n\n while left_offset < left.count && right_offset < right.count\n a = left[left_offset]\n b = right[right_offset]\n\n if a <= b\n array.push a\n left_offset += 1\n else\n array.push b\n right_offset += 1\n end\n end\n return merge(left, right)\nend",
"def merge_sort(arr)\n return arr if arr.length <= 1\n # define middle element where array will be split\n case arr.length % 2 == 0\n when true\n middle_index = (arr.length - 1) / 2\n when false\n middle_index = arr.length / 2\n end\n\n left_half = arr[0..middle_index]\n right_half = arr[middle_index + 1..-1]\n sorted_left = merge_sort(left_half)\n sorted_right = merge_sort(right_half)\n merge(sorted_left, sorted_right)\nend",
"def merge(array, from, mid, to)\n k = from\n i = from\n j = mid + 1\n temp = []\n\n # loop till there are elements in the left and right runs\n while (i <= mid && j <= to)\n if (array[i] < array[j])\n temp[k] = array[i]\n i = i+1\n k = k+1\n else\n temp[k] = array[j]\n j = j+1\n k = k+1\n end\n end\n\n # Copy remaining elements\n while i <= mid\n temp[k] = array[i]\n i = i+1\n k = k+1\n end\n\n while j <= to\n temp[k] = array[j]\n j = j+1\n k = k+1\n end\n\n # copy back to the original array to reflect sorted order\n for i in from..to\n array[i] = temp[i]\n end\n array\nend",
"def reverse_2!(array)\n left_index = 0\n right_index = -1 \n \n while left_index < array.size / 2\n array[left_index], array[right_index] = array[right_index], array[left_index]\n \n left_index += 1 \n right_index -= 1\n end\n \n array\nend",
"def partition(arr, left, right)\n pivot = arr[right]\n pindex = left\n for i in (left...right) do\n if(arr[i] <= pivot)\n arr[pindex], arr[i] = arr[i], arr[pindex]\n pindex += 1\n end\n end\n arr[pindex], arr[right] = arr[right], arr[pindex]\n pindex\nend",
"def rearrange(arr)\n arr_len = arr.length\n\n (1..arr_len-1).each do |index|\n # if index is even\n if (index % 2).zero?\n if arr[index] > arr[index - 1]\n arr[index - 1], arr[index] = arr[index], arr[index - 1]\n end\n else # if index is odd\n if (arr[index] < arr[index - 1])\n arr[index - 1], arr[index] = arr[index] , arr[index - 1]\n end\n end\n end\n\n arr\nend",
"def sort arr\n return arr if arr.length <= 1\n \n middle = arr.pop\n less = arr.select{|x| x < middle}\n more = arr.select{|x| x >= middle}\n\n sort(less) + [middle] + sort(more)\nend",
"def sort arr\n return arr if arr.length <= 1\n \n middle = arr.pop\n less = arr.select{|x| x < middle}\n more = arr.select{|x| x >= middle}\n\n sort(less) + [middle] + sort(more)\nend",
"def move_everything_down_between(upper, lower, ary)\n new_ary = Array.new(ary)\n new_ary.each do |a|\n if (upper..lower).cover?(a[1])\n a[1] += 1\n end\n end\n return new_ary\n end",
"def mergesort(array)\n # Base case\n if array.count <= 1\n return array\n end\n\n # Apply \"Divide & Conquer\" strategy\n # 1. Divide\n mid = array.count / 2\n left_partition = mergesort array.slice(0, mid)\n right_partition = mergesort array.slice(mid, array.count - mid)\n\n # 2. Conquer\n array = []\n left_lead = 0\n right_lead = 0\n while left_lead < left_partition.count && right_lead < right_partition.count\n a = left_partition[left_lead]\n b = right_partition[right_lead]\n\n # Take the smallest of the two, and push it on our array\n if a <= b\n array << a\n left_lead += 1\n else\n array << b\n right_lead += 1\n end\n end\n\n # Either left or right may have elements left; consume them.\n # (Only one of the following loops will actually be entered.)\n while left_lead < left_partition.count\n array << left_partition[left_lead]\n left_lead += 1\n end\n\n while right_lead < right_partition.count\n array << right_partition[right_lead]\n right_lead += 1\n end\n\n return array\nend",
"def compare_and_swap(array, i, j, dir)\n return unless dir == 1 && array[i] > array[j] ||\n dir == -1 && array[i] < array[j]\n\n array[i], array[j] = array[j], array[i]\nend",
"def three_way_partition(array)\n lo = 0\n mid = 0\n hi = array.size - 1\n while mid <= hi\n val = array[mid]\n case val\n when 0\n array[lo], array[mid] = array[mid],array[lo]\n lo += 1\n mid += 1\n when 1\n mid += 1\n when 2\n array[mid], array[hi] = array[hi], array[mid] \n hi -= 1\n end\n end\n array\nend",
"def partition1(arr, left, right)\n pele = arr[left]\n pindex = right\n i = right\n while(i > left)\n if(arr[i] > pele)\n arr[i], arr[pindex] = arr[pindex], arr[i]\n pindex -= 1\n end\n i -= 1\n end\n arr[left], arr[pindex] = arr[pindex], arr[left]\n pindex\nend",
"def sort arr\n return arr if arr.length <= 1\n middle = arr.pop\n less = arr.select{|x| x < middle}\n more = arr.select{|x| x >= middle}\n sort(less) + [middle] + sort(more)\nend",
"def sort arr\n return arr if arr.length <= 1\n middle = arr.pop\n lesss = arr.select{|x| x < middle}\n more = arr.select{|x| x>= middle}\n\n sort(less) + [middle] + sort(more)\nend",
"def mergeSort(arr)\n\n if (arr.length == 1)\n return arr\n end\n\n center = (arr.length / 2).floor\n left = arr[0...center] # takes values from 0 to center excluding the center index\n right = arr[center...arr.length] # takes values from center to end\n\n return merge( mergeSort(left), mergeSort(right) )\nend",
"def halvsies(arr)\n midpoint = (arr.length / 2.0).ceil\n [arr[0...midpoint], arr[midpoint..-1]]\nend",
"def merge_sort(array)\n \n middle = array.length/2-1\n left = [0..middle]\n right = [middle+1..[-1]]\n merge_sort(left) + merge_sort(right)\nend",
"def merge_sort(array) # ***\n return array if array.length <= 1\n mid_idx = (array.length - 1) / 2\n\n first_half = merge_sort(array[0..mid_idx])\n second_half = merge_sort(array[mid_idx + 1..-1])\n\n merge(first_half, second_half)\n # merge(merge_sort(array[0..mid_idx]), merge_sort(array[mid_idx + 1..-1]))\nend",
"def merge_sort(input_array)\n array_length = input_array.length\n if array_length <= 1\n input_array\n else\n left_side = merge_sort(input_array.slice(0, (array_length/2.0).round))\n right_side = merge_sort(input_array.slice((array_length/2.0).round, array_length))\n merge_halves(left_side, right_side)\n end\nend",
"def bubble_sort_by(array)\n switch = true\n while switch\n switch = false\n (0...array.length - 1).each do |i|\n if yield(array[i], array[i + 1]).positive? \n array[i], array[i + 1] = array[i + 1], array[i]\n switch = true\n end\n end\n end\n array\nend",
"def reverse!(array)\n\tleft_index = 0\n\tright_index = -1\n\n\twhile left_index < array.size / 2\n\t\tarray[left_index], array[right_index] = array[right_index], array[left_index]\n\t\tleft_index += 1\n\t\tright_index -= 1\n\tend\t\n\tarray\nend",
"def shell_sort(array)\n # p array\n gap = array.length/2\n while gap > 0\n idx = 0\n while idx < array.length - gap\n # while loop to move multiple steps\n while array[idx + gap] < array[idx]\n array[idx+gap],array[idx] = array[idx],array[idx+gap]\n if idx >= gap\n idx -= gap \n else\n break\n end\n end\n idx += 1\n end\n gap = gap/2\n # puts \"new gap is #{gap}\"\n p \"-\" * 10\n # p array verify properly sorting\n end\nend",
"def merge_sort(array)\n\treturn array if array.length <= 1\n\tmidpoint = (array.length / 2)\n\thalf1 = array[0...midpoint]\n\thalf2 = array[midpoint..-1]\n\tmerge(merge_sort(half1), merge_sort(half2))\nend",
"def halvsies(arr)\n middle = arr.size / 2\n cut = arr.size.even? ? middle : middle + 1\n a = arr.take(cut)\n b = arr.drop(cut)\n [a, b]\nend",
"def shell_sort(arr)\n gap = arr.size / 2\n until gap >= 1\n (0...gap).each do |i|\n j = i\n while j < arr.size\n arr[j], arr[j+gap] = arr[j+gap], arr[j] if arr[j] > arr[j+gap]\n j = j + gap\n end\n end\n gap, mod = gap.divmod(2)\n gap = mod == 0 ? gap + 1 : gap\n end\n arr\nend",
"def halvsies(array)\n half = []\n middle = (array.length / 2.0 ).ceil\n half << array.slice(0,middle) #start, # of elements\n half << array.slice(middle, array.length) #can use middle and not middle+1 because middle equals the index of the element after middle.\n half\nend",
"def bubble_sort_by(array)\n swap_status = nil\n iterations = 0\n\n until swap_status == false\n swap_status = false\n working_array = array[0..((array.count - 1) - iterations)]\n working_array.each_with_index do |item, index|\n if item != working_array.last\n if yield(array[index], array[index + 1]) < 0\n array[index], array[index + 1] = array[index + 1], array[index]\n swap_status = true\n end\n end\n end\n iterations += 1\n end\n array\nend",
"def merge_sort(array)\n return array if array.length <= 1\n\n first_half = array.take(array.length / 2)\n second_half = array.drop(first_half.length)\n\n merge( merge_sort(first_half), merge_sort(second_half) )\nend",
"def smooth_sort(array)\n orders = [0]\n trees = 0\n\n (0...array.length).each do |i|\n if trees > 1 && orders[trees - 2] == orders[trees - 1] + 1\n trees -= 1\n orders[trees - 1] += 1\n elsif trees > 0 && orders[trees - 1] == 1\n orders[trees += 1] = 0\n else\n orders[trees += 1] = 1\n end\n find_and_sift(array, i, trees - 1, orders)\n end\n (array.length - 1).downto(1) do |i|\n if orders[trees - 1] <= 1\n trees -= 1\n else\n right_index = i - 1\n left_index = right_index - LEONARDO_NUMS[orders[trees - 1] - 2]\n trees += 1\n orders[trees - 2] -= 1\n orders[trees - 1] = orders[trees - 2] - 1\n find_and_sift(array, left_index, trees - 2, orders)\n find_and_sift(array, right_index, trees - 1, orders)\n end\n end\n array\nend",
"def merge_sort(array)\n middle_index = (array.length - 1) / 2\n if array.length == 0 || array.length == 1\n return array\n end\n first_half = merge_sort(array[0..middle_index])\n last_half = merge_sort(array[middle_index + 1..array.length - 1])\n return merge(first_half, last_half)\nend",
"def merge_sort(array)\n return array if array.length < 2\n\n midpoint = array.length / 2\n left = array[0...midpoint]\n right = array[midpoint..-1]\n\n return merge(merge_sort(left), merge_sort(right))\nend",
"def insertion_sort(arr)\n\t# step 1 - set variables. Placeholder_index starts at index 1 rather than index 0 because you\n\t# are always comparing the placeholder to what is to the left of the placeholder\n\tplaceholder_index = 1\n\t# until the placeholder_index is at the index value as the length of the array...\n\t\tuntil placeholder_index > (arr.length - 1)\n\t\t\tcurrent_index = placeholder_index\n\t\t\t# the compare_index is the value to the right of the placeholder/compare_index\n\t\t\tcompare_index = current_index - 1\n\t\t\t# until the current_index is greater than or equal to the compare_index\n\t\t\tuntil arr[current_index] >= arr[compare_index]\n\t\t\t\t# swap the two numbers\n\t\t\t\tarr[current_index], arr[compare_index] = arr[compare_index], arr[current_index]\n\t\t\t\t# compare left number and right\n\t\t\t\tcurrent_index -= 1\n\t\t\t\tcompare_index -= 1 unless compare_index == 0\n\t\t\tend\n\t\t\tplaceholder_index += 1\n\t\tend\nreturn arr\nend",
"def merge_sort(array)\n low = 0\n high = array.length - 1\n\n # // divide the array into blocks of size m\n # // m = [1, 2, 4, 8, 16...]\n m = 1\n while m <= (high-low)\n i = low\n while i < high\n from = i\n mid = i + m - 1\n if i + (2 * m) - 1 < high\n to = i + (2 * m) - 1\n else\n to = high\n end\n\n array = merge(array, from, mid, to)\n i = i + (2*m)\n end\n m = 2*m\n end\n array\nend",
"def sort arr\r\n\treturn arr if arr.length <= 1\r\n\r\n\tmiddle = arr.pop\r\n\tless = arr.select{|x| x < middle}\r\n\tmore = arr.select{|x| x >= middle}\r\n\r\n\tsort(less) + [middle] + sort(more)\r\nend",
"def reverse!(arr)\n mid = arr.length / 2\n index1, index2 = 0, -1\n while index1 < mid\n arr[index1], arr[index2] = arr[index2], arr[index1]\n index1 += 1\n index2 -= 1\n end\n arr\nend",
"def shell_sort(array)\n p array\n gap = array.length/2\n while gap > 0\n puts \"gap is currently #{gap}\"\n idx = 0\n while idx < array.length - gap\n # while loop to move multiple steps\n while array[idx + gap] < array[idx]\n array[idx+gap],array[idx] = array[idx],array[idx+gap]\n if idx > 0\n idx -= 1\n else\n break\n end\n end\n idx += 1\n end\n gap = gap/2\n p \"-\" * 10\n p array\n end\nend",
"def merge_sort(arr)\n return arr if arr.length <= 1\n\n if arr.length.odd?\n mid_idx = arr.length / 2\n else\n mid_idx = arr.length / 2 - 1\n end\n\n first_half = arr[0..mid_idx]\n second_half = arr[mid_idx + 1..-1]\n\n fh_split = merge_sort(first_half)\n sh_split = merge_sort(second_half)\n\n merge(fh_split, sh_split)\nend",
"def bubble_sort(array)\n # iterate through the array\n array.each do\n first = 0\n second = 1\n array.map do |value|\n \n # compare two adjacent values\n if array[second] && value > array[second]\n # move the greater value to the right and the lesser left\n save = array[first]\n array[first] = array[second]\n array[second] = save\n end\n first += 1\n second += 1\n end\n end\nprint array\nend",
"def sort(arr)\n return arr unless arr.size > 1\n\n mid = arr.size / 2\n left, right = sort(arr[0...mid]), sort(arr[mid..-1])\n\n merge(left, right)\nend",
"def bubble_sort_by(array)\n arr = array.length - 1\n loop do\n swap = false\n (0...arr).each do |i|\n n_one = array[i]\n n_two = array[i + 1]\n if yield(n_one, n_two).positive?\n array[i], array[i + 1] = array[i + 1], array[i]\n swap = true\n end\n end\n break if swap == false\n end\n array\nend",
"def swap_elements_from_to(array,a,b)\n array[a] = array[a]^array[b]\n array[b] = array[b]^array[a]\n array[a] = array[a]^array[b]\nend",
"def alternate_quicksort(array)\n return array if array.size < 2\n\n left = []\n right = []\n\n pivot_index = array.size - 1\n pivot_value = array[pivot_index]\n\n array.pop\n\n array.each do |item|\n item < pivot_value ? left.push(item) : right.push(item)\n end\n\n quicksort(left) + [pivot_value] + quicksort(right)\nend",
"def partition(arr, left, right, pivot)\n pivot_val = arr[pivot]\n arr[pivot] = arr[right]\n arr[right] = pivot_val\n\n storage = left\n\n (left..right-1).each do |i|\n if arr[i] < pivot_val\n storage_val = arr[storage]\n arr[storage] = arr[i]\n arr[i] = storage_val\n storage += 1\n end\n end\n\n storage_val = arr[storage]\n arr[storage] = arr[right]\n arr[right] = storage_val\n\n storage\nend",
"def halvsies(array)\n first_half = []\n both_halves = []\n\n if array.size == 1 || array.size == 0\n both_halves << array\n both_halves << first_half\n elsif array.size / 2 == 0\n ((array.size) / 2).times do\n first_half << array.shift\n end\n both_halves << first_half\n both_halves << array\n else\n (((array.size - 1) / 2) + 1).times do\n first_half << array.shift\n end\n both_halves << first_half\n both_halves << array\n end\n both_halves\nend",
"def reverse!(array)\n index = 0\n half_point = array.size / 2\n\n while index < half_point\n end_index = array.size - index - 1\n end_element = array[end_index]\n start_element = array[index]\n\n array[index] = end_element\n array[end_index] = start_element\n\n index += 1\n end\n \n array\nend",
"def merge_sort(array)\r\n\tif array.length > 1\r\n\t\tleft_array = []\r\n\t\t\t(array.length/2).times { left_array << array.shift }\r\n\t\tright_array = array\r\n\t\tleft_sorted = merge_sort(left_array)\r\n\t\tright_sorted = merge_sort(right_array)\r\n\t\tresult = []\r\n\t\twhile left_sorted.length>0 && right_sorted.length>0\r\n\t\t\tif left_sorted[0] <= right_sorted[0]\r\n\t\t\t\tresult << left_sorted.shift\r\n\t\t\telse\r\n\t\t\t\tresult << right_sorted.shift\r\n\t\t\tend\r\n\t\tend\r\n\t\tif left_sorted.length>0\r\n\t\t\tleft_sorted.each { |e| result << e }\r\n\t\telsif right_sorted.length>0\r\n\t\t\tright_sorted.each { |e| result << e }\r\n\t\tend\r\n\t\treturn result\r\n\telse\r\n\t\treturn array\r\n\tend\r\nend",
"def halvsies(array)\n second_half, middle_element = array.size.divmod(2)\n first_half_size = second_half + middle_element\n output_array = []\n first_half_array = []\n second_half_array = []\n\n array.each_with_index do |el, idx|\n if idx <= first_half_size - 1\n first_half_array << el\n else\n second_half_array << el\n end\n end\n\n output_array << first_half_array << second_half_array\nend",
"def mid_borrows_from_right\n @mid.type, @mid.value1, @value2, @mid.mid = 2, @value2, @right.value1, @right.left\n @right.shift_left\n @right.type = 2\n end",
"def halvsies(array)\n new_array = [[],[]]\n half_way = array.length / 2.0\n array.each_with_index do | element, index |\n if index < half_way\n new_array[0] << element\n else\n new_array[1] << element\n end\n end\n new_array\nend",
"def merge_sort(arr)\n if arr.length == 1\n return arr\n end\n mid = arr.length / 2\n left = arr[0...mid]\n right = arr[mid..-1]\n\n left_half = merge_sort(left)\n right_half = merge_sort(right)\n merge(left_half,right_half)\nend",
"def merge_sort(array)\r\n return array if array.length <= 1\r\n\r\n mid = array.length / 2\r\n\r\n left = merge_sort(array.take(mid)),\r\n right = merge_sort(array.drop(mid))\r\n merge(left, right)\r\nend",
"def rotation_point(arr)\n left = 0\n mid = arr.length / 2\n right = -1\n\n if arr[left].split('')[0] < arr[mid].split('')[0]\n left = mid\n else\n right = mid\n end\n\nend",
"def halvsies(array)\n new_array = []\n array_size = array.size\n left_array_size = if array_size.odd?\n array_size / 2 + 1\n else\n array_size / 2\n end\n new_array[0] = array.slice!(0, left_array_size)\n new_array[1] = array\n # new_array[0] = array.slice(0, left_array_size)\n # new_array[1] = array.slice(left_array_size, array_size - left_array_size)\n new_array\nend",
"def mid_borrows_from_left\n @mid.type, @mid.mid, @mid.value1, @mid.left = 2, @mid.left, @value1, @left.right\n @left.type, @value1 = 2, @left.value2\n end",
"def partitionx(array, start, fin, pivot_index)\n le_count = 0\n pivot_value = array[pivot_index]\n puts \"Partitioning for value: #{pivot_value}: #{array}\"\n puts \"Start:Fin #{start}:: #{fin}:: #{pivot_index}\"\n array[start..fin].each do |element|\n le_count += 1 if element <= pivot_value\n end\n\n new_array = []\n puts \"LE count: #{le_count}\"\n new_array[le_count - 1] = pivot_value\n left_index = 0 # 5\n right_index = le_count # 1\n index = start\n array[start..fin].each do |element|\n puts \"Element: #{element}: #{index}:: #{pivot_index}\"\n if index == pivot_index\n index += 1\n next\n end\n\n if element <= pivot_value\n puts \"Copying to left #{element} to #{left_index}\"\n new_array[left_index] = element\n left_index += 1\n else\n puts \"Copying #{element} to #{right_index}\"\n new_array[right_index] = element\n right_index += 1\n end\n end\n puts \"before replacing: #{array} : #{array[start..fin]}:: #{new_array}\"\n j = 0\n (start..fin).each do |index|\n puts \"index: #{index}\"\n array[index] = new_array[j]\n j += 1\n end\n\n puts \"New array: #{array}\"\n puts \"new pivot index: #{array.index(pivot_value)}\"\n array.index(pivot_value)\n end",
"def Partition(array, left, right, comparisons)\n\n puts \"partitioning #{array.to_s}... #{comparisons} comparisons done already.\"\n \n pivot = array[left]\n #puts \"choosing pivot of #{pivot} for array starting with #{array[0..1]}\"\n i = left + 1\n \n for j in (left + 1)..right\n #print \" #{j} \"\n comparisons = comparisons + 1\n if array[j] < pivot\n #puts \"#{array[j]} is less than pivot\"\n #swap A[i] and A[j]\n temp = array[i]\n array[i] = array[j]\n array[j] = temp\n i = i + 1\n \n end\n end\n # swap A[l] and A[i - 1]\n temp = array[left]\n array[left] = array[i - 1]\n array[i-1] = temp\n \n puts \"done partitioning #{array.to_s}... #{comparisons} comparisons done now.\"\n return [array, i, j, comparisons]\nend",
"def partition(array, p, r)\n x = array[r]\n i = p - 1\n j = p\n\n while j < r\n if array[j] <= x\n i = i + 1\n array[i], array[j] = array[j], array[i]\n end\n j = j + 1\n end\n\n array[i + 1], array[r] = array[r], array[i + 1]\n\n return (i + 1)\nend",
"def merge_sort(array)\n if array.size <= 1\n return array\n end\n\n # Apply \"Divide & Conquer\" strategy\n\n # 1. Divide\n mid = array.size / 2\n part_a = merge_sort(array.slice(0, mid))\n part_b = merge_sort(array.slice(mid, array.size - mid))\n\n\n# 2. Conquer\n array = []\n offset_a = 0\n offset_b = 0\n while offset_a < part_a.count && offset_b < part_b.count\n a = part_a[offset_a]\n b = part_b[offset_b]\n \n if a <= b\n array << a\n offset_a += 1\n else\n array << b\n offset_b += 1\n end\n end\n \n while offset_a < part_a.count\n array << part_a[offset_a]\n offset_a += 1\n end\n \n while offset_b < part_b.count\n array << part_b[offset_b]\n offset_b += 1\n end\n \n return array\nend",
"def reverse!(arr)\n (1..arr.length / 2).each do |location|\n idx_left, idx_right = location - 1, -location\n arr[idx_left], arr[idx_right] = arr[idx_right], arr[idx_left]\n end\n arr\nend",
"def reversal(array)\n array = array.map{|element| element} #creates a copy of array, remove to have same object_id's\n left_index = 0\n right_index = -1\n \n while left_index < array.size / 2\n array[left_index], array[right_index] = array[right_index], array[left_index]\n left_index += 1\n right_index -=1\n end\n\n array\nend",
"def merge_sort(array)\n if array.length < 2\n return array\n end\n first_half = array[0...array.length / 2]\n second_half = array[array.length / 2..-1]\n\n merge(merge_sort(first_half), merge_sort(second_half))\nend",
"def mergesort(array)\n if array.count <= 1\n # Array of length 1 or less is always sorted\n return array\n end\n\n # Apply \"Divide & Conquer\" strategy\n\n # Divide\n mid = array.count / 2\n part_a = mergesort array.slice(0, mid)\n part_b = mergesort array.slice(mid, array.count - mid)\n\n # Conquer\n array = []\n offset_a = 0\n offset_b = 0\n while offset_a < part_a.count && offset_b < part_b.count\n a = part_a[offset_a]\n b = part_b[offset_b]\n\n # Take the smallest of the two, and push it on our array\n if a <= b\n array << a\n offset_a += 1\n else\n array << b\n offset_b += 1\n end\n end\n\n # There is at least one element left in either part_a or part_b (not both)\n while offset_a < part_a.count\n array << part_a[offset_a]\n offset_a += 1\n end\n\n while offset_b < part_b.count\n array << part_b[offset_b]\n offset_b += 1\n end\n\n return array\nend",
"def merge(first_half, second_half)\n \n# empty array\n merged_array = []\n \n# while both halves have elements\n while first_half.size > 0 && second_half.size > 0 do\n \n# i think it's going to compare 0 elements\n if first_half [0] <= second_half[0]\n \n# if the first half 0 element is larger, push it onto the merged array\n# To retrieve and at the same time remove the first item, use shift\n merged_array.push(first_half.shift)\n \n elsif second_half[0] < first_half[0]\n merged_array.push(second_half.shift)\n end\n end\n\n#once only one (sorted) array remains, just add on the rest of that array\n#only one of these loops will ever run\n while first_half.size > 0 do \n merged_array.push(first_half.shift)\n end\n while second_half.size > 0 do \n merged_array.push(second_half.shift)\n end\n\n merged_array\nend",
"def halvsies(arr)\n index = (arr.length) / 2\n if arr.length.odd?\n [arr[0..index], arr[index+1..-1]]\n else\n [arr[0..index-1], arr[index..-1]]\n end\nend",
"def shell_sort(array)\n len = array.length\n gap = 1\n\n # calculate gap distance for initial sub-array checks\n gap = gap * 3 + 1 while gap < len / 3\n\n while gap > 0\n (gap...len).each do |i|\n j = i\n while j >= gap\n if array[j - gap] > array[j]\n array[j - gap], array[j] = array[j], array[j - gap]\n end\n j -= gap\n end\n end\n gap /= 3\n end\n array\nend",
"def wiggle_sort(nums)\n nums = nums.sort!\n\n greater_num_idx = nums.length / 2\n lesser_num_idx = 1\n\n until lesser_num_idx >= greater_num_idx\n nums[lesser_num_idx], nums[greater_num_idx] = nums[greater_num_idx], nums[lesser_num_idx]\n lesser_num_idx += 2\n greater_num_idx += 1\n end\n nums\nend",
"def halvsies(array)\n arr1 = []\n arr2 = []\n half_length_round_down = array.length/2\n \n index = 0\n index2 = half_length_round_down\n index2 += 1 if array.length.odd?\n \n loop do\n break if index == half_length_round_down\n arr1 << array[index]\n arr2 << array[index2]\n index += 1\n index2 += 1\n end\n \n if array.length.odd?\n arr1 << array[index]\n # because break statement is after index increases we don't have to increase it again\n end\n \n [arr1, arr2]\nend",
"def bubble_sort_by(arr)\n\tloop do\n\t\tswitched = false\n\t\t(arr.count-1).times do |i|\n\t\t\tif yield(arr[i],arr[i+1])<0\n\t\t\t\tarr[i],arr[i+1]=arr[i+1], arr[i]\n\t\t\tend\n\t\tend\n\t\tbreak if not switched\n\tend\n\tarr\nend",
"def merge_sort arr\n\tif arr.length <= 1\n\t\tarr\n\telse\n\t\tmid = arr.length/2\n\t\tfirst_half = arr.slice(0...mid)\n\t\tsecond_half = arr.slice(mid...arr.length)\n\t\tmerge merge_sort(first_half), merge_sort(second_half)\n\tend\nend"
] |
[
"0.67236334",
"0.6612655",
"0.6607327",
"0.65570325",
"0.65525836",
"0.65409666",
"0.6538006",
"0.6522212",
"0.64546245",
"0.6434378",
"0.64074564",
"0.638098",
"0.6380611",
"0.6379941",
"0.63777274",
"0.6377023",
"0.63633555",
"0.6322366",
"0.6304697",
"0.6297341",
"0.6285913",
"0.6269083",
"0.62576413",
"0.6234563",
"0.6234563",
"0.6233479",
"0.6230778",
"0.622673",
"0.62230337",
"0.6192373",
"0.6189321",
"0.6186282",
"0.618257",
"0.61747545",
"0.6167162",
"0.6161702",
"0.61577785",
"0.61577785",
"0.614426",
"0.61346275",
"0.6130984",
"0.612765",
"0.60956264",
"0.60948116",
"0.6090939",
"0.60666454",
"0.6056765",
"0.60506195",
"0.60482097",
"0.6035994",
"0.60265374",
"0.6020499",
"0.6018895",
"0.600543",
"0.6000306",
"0.5986013",
"0.5968474",
"0.596474",
"0.5951083",
"0.595079",
"0.59495914",
"0.59470296",
"0.59448326",
"0.5944638",
"0.5937521",
"0.59323066",
"0.59310764",
"0.59295475",
"0.592685",
"0.59221655",
"0.5912239",
"0.59072536",
"0.59011775",
"0.5898396",
"0.5898384",
"0.589598",
"0.5893414",
"0.5885185",
"0.5881747",
"0.5880979",
"0.5880164",
"0.58740395",
"0.5873388",
"0.5869208",
"0.5865478",
"0.58645695",
"0.58619684",
"0.58563876",
"0.58542573",
"0.5851168",
"0.5848519",
"0.5847743",
"0.5845294",
"0.5842656",
"0.5842277",
"0.58415806",
"0.5840459",
"0.58327395",
"0.58229446",
"0.58223987"
] |
0.66755337
|
1
|
GET /messages GET /messages.json
|
def index
@messages = current_user.received_messages.paginate(:page => params[:page])
@title = "Входящие сообщения"
@path = "index"
respond_to do |format|
format.html # index.html.erb
format.json { render json: @messages }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def messages\n get_json('messages.json')\n end",
"def index\n messages = Message.all\n render json: messages\n end",
"def index\n @messages = Message.all\n render json: @messages\n end",
"def index\n @messages = Message.all\n render json: @messages\n end",
"def index\n @messages = Message.all\n\n render json: @messages\n end",
"def index\n raise ApiAccessEvanta::PermissionDenied unless AppSettings::Value.new(:messages, user: current_user).on?\n @messages = Message.get_message_list(current_user)\n render json: @messages\n end",
"def index\n @messages = message.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def index\n\t\t@messages = Message.all.order('created_at DESC')\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @messages }\n\t\tend\n\tend",
"def get_messages\n \tuser = User.find(params[:user_id]);\n \tif user\n \t\tmessages = Message.where(message_type: user.user_type)\n \t\tconversation = Conversation.where(request_id: params[:request_id])\n texts = []\n conversation.each{ |msg| texts.push(Message.find_by(id: msg.message_id) ? Message.find(msg.message_id) : {})}\n \t\trender json: {messages: messages, conversation: conversation, texts: texts}\n \telse\n\t\trender json: {error: 'User not found.'}\n \tend\n end",
"def show\n\t\t@messages = Message.where(recipient: params[:id]).order('created_at DESC')\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @messages }\n\t\tend\n\tend",
"def index\n @messages = current_user.received_messages\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def index\n @messages = current_user.received_messages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def index\n @messages = Message.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def index\n @messages = Message.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def index\n @messages = Message.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def get_all\n if @messages = Message.all\n render json: @messages\n else\n render json: \"Error!\"\n end\n\n end",
"def get_messages(page = 0)\r\n if page > 0\r\n message_url = \"/message_threads?page=#{page}\"\r\n else\r\n message_url = \"/message_threads\"\r\n end\r\n response = self.class.get(message_url, headers: { \"authorization\" => @user_auth_token })\r\n JSON.parse(response.body)\r\n end",
"def read_all_messages\n post(\"/api/read_all_messages\")\n end",
"def index\n @messages = Message.all\n respond_to do |format|\n format.html { render :index }\n format.json { render :json => @messages}\n end\n end",
"def get_messages(options = nil)\r\n @client.raw('get', '/content/messages', options, nil, @contact_v1_url)\r\n end",
"def show\n @message = Message.find(params[:id])\n render json: @message\n\n end",
"def index\n @messages = Message.order(\"time desc\").page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n authorize! :read, Message\n @messages = Message.find_conversation(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def index\n render json: Message.all\n end",
"def my_messages(opts = {})\n client.get_my_messages(opts)\n end",
"def show\n @message = Message.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def index\n @messaging_messages = Messaging::Message.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messaging_messages }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :_message }\n end\n end",
"def sent_messages\n get('/direct_messages/sent.json')\n end",
"def index\n\t\t@messages = Message.where(:to_user => current_user.id)\n\t\trespond_with(@messages) \n\tend",
"def index\n phone_number = params[:phone_number]\n\n response = Faraday.get \"#{BASE_URL}/api/v1/getMessages/#{phone_number}\", nil, {'Authorization': \"Bearer \"}\n\n @data = {\n phone_number: phone_number\n }\n\n if response.status === 200\n response_body = JSON.parse(response.body)\n @data[:messages] = response_body['messages']['items']\n end\n\n render json: @data\n end",
"def show\n render json: @message\n end",
"def show\n render json: @message\n end",
"def index\n @messages = Message.find_all_by_user_id(session[:user_id], :order => \"timestamp DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @messages }\n end\n end",
"def show\n\n render json: @message\n\n end",
"def show\n render json: get_message()\n end",
"def index\n @messages = Rails.cache.fetch('all_messages', :expires_in => 30.seconds) do\n Message.all\n end\n\n respond_to do |format|\n format.json { render json: @messages }\n end\n end",
"def index\n\n if params[:user_id]\n @messages = Message.where(:user_id => params[:user_id].to_i)\n else\n @messages = Message.all\n end\n if params[:page] and params[:per_page]\n @messages = @messages.paginate(:per_page=>params[:per_page].to_i,:page=>params[:page].to_i).order(\"id desc\")\n @page = params[:page]\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :messages }\n end\n end",
"def show\n render_json :entry => @message\n end",
"def messages_get(opts = {})\n data, _status_code, _headers = messages_get_with_http_info(opts)\n data\n end",
"def read\n @message = Message.find(params[:id])\n @message.read(current_user)\n respond_to do |format|\n format.html # read.html.erb\n format.json { render json: @message }\n end\n end",
"def messages_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MessagesApi.messages_get ...'\n end\n # resource path\n local_var_path = '/messages'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'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'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apiKey']\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 => 'MessagesResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MessagesApi#messages_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n #@messages = Message.all\n \n @messages = Message.page(params[:page]).order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def index\n @messages = current_user.messages\n respond_with(@messages)\n end",
"def index\n @response_messages = @request_message.response_messages\n respond_to do |format|\n format.html { raise ActionController::RoutingError.new('Not Found') }\n format.json {}\n end\n end",
"def show\n @v1_message = V1::Message.find(params[:id])\n\n render json: @v1_message\n end",
"def direct_messages(params = {})\n get \"direct_messages\", params\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message_template }\n end\n end",
"def show\n @text_message = TextMessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text_message }\n end\n end",
"def index\n @mod_messages = ModMessage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mod_messages }\n end\n end",
"def index\n # @messages = Message.message_in_area(params[:latitude], params[:longitude], current_user.message_zone).main_information\n\t @messages = Message.all\n render json: @messages\n end",
"def show\n @chat = Chat.find(params[:id])\n @receiver = interlocutor(@chat)\n @messages = @chat.messages\n @message = Message.new\n render json: $message\n end",
"def new\n @message = Message.new\n @users = User.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = current_user.messages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def get_message\n @msg = Message.find_by_id(get_message_params[:message_id])\n\n if request.xhr?\n render :json => {\n :text => @msg.m_message,\n :offset => @msg.m_offset\n }\n end\n\n end",
"def index\n messages = Message.all\n end",
"def get_messages where = \"inbox\", opts = {}\n query = {\n mark: false\n }\n query.merge! opts\n get(\"/message/#{where}.json\", query: query)\n end",
"def messages\n\t\t@content_title = \"Messages\"\n\t\t@messages = Message.paginate(:order => 'created_at DESC', :page => params[:page])\n\tend",
"def show\n @home_searches_message = Home::Searches::Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home_searches_message }\n end\n end",
"def index\n @messages = Room.find(params['room_id']).messages\n end",
"def show\n @chatroom = Chatroom.find(params[:id])\n @messages = @chatroom.messages.order(\"created_at DESC\")\n @user = User.find(session[:user_id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chatroom }\n end\n end",
"def conversation\n current_user_id = current_user.id\n other_user_id = params[:id]\n @messages = Message.get_conversation(current_user_id, other_user_id)\n render json: @messages\n end",
"def fetch\n messages = paginate ConversationMessage.where(conversation_id: params[:conversation_id])\n .order('created_at DESC')\n render json: messages.to_json(:include => :user)\n end",
"def messages\n\t\t@musician = User.find_by_id(params[:id])\n\t\t@messages = @musician.messages\n\tend",
"def show\n @room_message = RoomMessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @room_message }\n end\n end",
"def show\n @chat_room = ChatRoom.find(params[:chat_room_id])\n #@chat_messages = @chat_room.chat_messages\n @chat_messages = @chat_room.chat_messages.order(created_at: :desc).page(params[:page]).per(5)\n\n render json: @chat_messages, each_serializer: ChatMessageSerializer\n end",
"def index\n @messies = Messy.all\n\n render json: @messies\n end",
"def index\n # Only get the messages for the user currently signed in\n if current_user.group.messages_released\n \t@messages = current_user.messages\n else\n \t@messages = {}\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { send_data @messages }\n end\n end",
"def show\n @topic = Topic.find(params[:id])\n @messages = @topic.messages.order(\"created_at DESC\")\n @message = Message.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @topic }\n end\n end",
"def messages options = {}\n LazyArray.new do |page, size|\n messages, _headers = get 'messages', options.merge(page: page, size: size)\n\n messages.map do |message|\n Types::Message.new message\n end\n end\n end",
"def index\n @mentor_messages = MentorMessage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mentor_messages }\n end\n end",
"def index\n if params[:last_message_id]\n @messages = Message.includes(:user).where(\"id > ?\", params[:last_message_id])\n else\n @messages = Message.includes(:user).limit(5).order(:created_at).reverse_order\n end\n\n @message_data = []\n @messages.each do |message|\n @message_data.push({\n :id => message.id,\n :user => message.user.name,\n :content => message.content\n })\n end\n \n respond_to do |format|\n format.json { render :json => @message_data}\n end\n end",
"def index\n\n if @current_user.admin?\n @v1_messages = V1::Message.all\n else\n @v1_messages = V1::Message.all.where(company_id: @current_user.company.id)\n end\n\n render json: @v1_messages\n end",
"def show\n @user = User.find(params[:user_id])\n @message = @user.messages.find(params[:id])\n @message.update_attribute(:read, true)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: user_messages_path(@user) }\n end\n end",
"def conversation\n @messages = Message.get_conversation(current_user, params[:user_id])\n render json: @messages, each_serializer: MessageConversationSerializer\n end",
"def show\n @store_manager_messages_read = Store::Manager::Messages::Read.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store_manager_messages_read }\n end\n end",
"def message\n @message ||= (request.GET[:msg] || Hash.new)\n end",
"def show_messages\n @messages = get_user.messages.search(params[:page])\n end"
] |
[
"0.8392115",
"0.755332",
"0.7461291",
"0.7461291",
"0.74388546",
"0.74314713",
"0.74295616",
"0.74287003",
"0.7412067",
"0.73680776",
"0.7355837",
"0.7349781",
"0.72963905",
"0.72897035",
"0.72890514",
"0.7267814",
"0.71833634",
"0.7156361",
"0.71530104",
"0.71393275",
"0.7102981",
"0.7047633",
"0.7041137",
"0.7030999",
"0.70169383",
"0.7001942",
"0.69899464",
"0.6982321",
"0.6982321",
"0.6982321",
"0.6982321",
"0.6982321",
"0.6982321",
"0.6982321",
"0.6982321",
"0.6982321",
"0.6982321",
"0.6982321",
"0.6982321",
"0.6982321",
"0.6982321",
"0.6982321",
"0.6982321",
"0.6982321",
"0.6982321",
"0.6982321",
"0.6982321",
"0.6981656",
"0.69737935",
"0.6923553",
"0.69012505",
"0.68950295",
"0.68899083",
"0.6869013",
"0.6869013",
"0.6854208",
"0.68539983",
"0.6851327",
"0.6844157",
"0.68293",
"0.6815127",
"0.6807433",
"0.6798628",
"0.6790059",
"0.67489374",
"0.6737291",
"0.67301667",
"0.6707134",
"0.6692253",
"0.6688602",
"0.6687576",
"0.66733557",
"0.6656614",
"0.6622114",
"0.6607105",
"0.65983576",
"0.658533",
"0.6581427",
"0.6568213",
"0.6553419",
"0.65481013",
"0.6547037",
"0.6545754",
"0.654053",
"0.6526605",
"0.65174496",
"0.6510163",
"0.6508847",
"0.6498704",
"0.64966947",
"0.6489652",
"0.6452607",
"0.6435952",
"0.64349854",
"0.64329004",
"0.64298207",
"0.6405685",
"0.6402004",
"0.6399954",
"0.63972497"
] |
0.70300335
|
24
|
GET /messages/1 GET /messages/1.json
|
def show
@message = Message.read(params[:id], current_user)
@title = @message.subject
if current_user == @message.sender
@this_user = true
else
@this_user = false
end
# @this_user = current_user == @message.sender ? true : false
respond_to do |format|
format.html # show.html.erb
format.json { render json: @message }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @v1_message = V1::Message.find(params[:id])\n\n render json: @v1_message\n end",
"def messages\n get_json('messages.json')\n end",
"def show\n @message = Message.find(params[:id])\n render json: @message\n\n end",
"def show\n\t\t@messages = Message.where(recipient: params[:id]).order('created_at DESC')\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @messages }\n\t\tend\n\tend",
"def index\n messages = Message.all\n render json: messages\n end",
"def index\n @messages = message.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :_message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def index\n @messages = Message.all\n render json: @messages\n end",
"def index\n @messages = Message.all\n render json: @messages\n end",
"def index\n @messages = Message.all\n\n render json: @messages\n end",
"def index\n @messages = Message.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def index\n @messages = Message.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def index\n @messages = Message.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def index\n\t\t@messages = Message.all.order('created_at DESC')\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @messages }\n\t\tend\n\tend",
"def get_messages(page = 0)\r\n if page > 0\r\n message_url = \"/message_threads?page=#{page}\"\r\n else\r\n message_url = \"/message_threads\"\r\n end\r\n response = self.class.get(message_url, headers: { \"authorization\" => @user_auth_token })\r\n JSON.parse(response.body)\r\n end",
"def show\n authorize! :read, Message\n @messages = Message.find_conversation(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def read\n @message = Message.find(params[:id])\n @message.read(current_user)\n respond_to do |format|\n format.html # read.html.erb\n format.json { render json: @message }\n end\n end",
"def index\n @messages = current_user.received_messages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def index\n @messages = current_user.received_messages\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def index\n @messages = Message.all\n respond_to do |format|\n format.html { render :index }\n format.json { render :json => @messages}\n end\n end",
"def index\n @messages = current_user.received_messages.paginate(:page => params[:page])\n @title = \"Входящие сообщения\"\n @path = \"index\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def index\n @messages = Message.order(\"time desc\").page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def get_messages\n \tuser = User.find(params[:user_id]);\n \tif user\n \t\tmessages = Message.where(message_type: user.user_type)\n \t\tconversation = Conversation.where(request_id: params[:request_id])\n texts = []\n conversation.each{ |msg| texts.push(Message.find_by(id: msg.message_id) ? Message.find(msg.message_id) : {})}\n \t\trender json: {messages: messages, conversation: conversation, texts: texts}\n \telse\n\t\trender json: {error: 'User not found.'}\n \tend\n end",
"def index\n render json: Message.all\n end",
"def index\n @messaging_messages = Messaging::Message.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messaging_messages }\n end\n end",
"def message(id)\n Message.new(request(:get, \"messages/#{id}\"))\n end",
"def index\n\n if params[:user_id]\n @messages = Message.where(:user_id => params[:user_id].to_i)\n else\n @messages = Message.all\n end\n if params[:page] and params[:per_page]\n @messages = @messages.paginate(:per_page=>params[:per_page].to_i,:page=>params[:page].to_i).order(\"id desc\")\n @page = params[:page]\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :messages }\n end\n end",
"def read_all_messages\n post(\"/api/read_all_messages\")\n end",
"def message(id)\n Message.new(request(:get, \"messages/#{id.to_s}\"))\n end",
"def get_all\n if @messages = Message.all\n render json: @messages\n else\n render json: \"Error!\"\n end\n\n end",
"def show\n @text_message = TextMessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text_message }\n end\n end",
"def show\n @chat = Chat.find(params[:id])\n @receiver = interlocutor(@chat)\n @messages = @chat.messages\n @message = Message.new\n render json: $message\n end",
"def index\n raise ApiAccessEvanta::PermissionDenied unless AppSettings::Value.new(:messages, user: current_user).on?\n @messages = Message.get_message_list(current_user)\n render json: @messages\n end",
"def show\n render_json :entry => @message\n end",
"def show\n render json: @message\n end",
"def show\n render json: @message\n end",
"def show\n\n render json: @message\n\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message_template }\n end\n end",
"def show\n @topic = Topic.find(params[:id])\n @messages = @topic.messages.order(\"created_at DESC\")\n @message = Message.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @topic }\n end\n end",
"def index\n @messages = Message.find_all_by_user_id(session[:user_id], :order => \"timestamp DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @messages }\n end\n end",
"def index\n #@messages = Message.all\n \n @messages = Message.page(params[:page]).order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def show\n render json: get_message()\n end",
"def show\n @home_searches_message = Home::Searches::Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home_searches_message }\n end\n end",
"def index\n phone_number = params[:phone_number]\n\n response = Faraday.get \"#{BASE_URL}/api/v1/getMessages/#{phone_number}\", nil, {'Authorization': \"Bearer \"}\n\n @data = {\n phone_number: phone_number\n }\n\n if response.status === 200\n response_body = JSON.parse(response.body)\n @data[:messages] = response_body['messages']['items']\n end\n\n render json: @data\n end",
"def show\n @room_message = RoomMessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @room_message }\n end\n end",
"def show\n @user = User.find(params[:user_id])\n @message = @user.messages.find(params[:id])\n @message.update_attribute(:read, true)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: user_messages_path(@user) }\n end\n end",
"def sent_messages\n get('/direct_messages/sent.json')\n end",
"def get_messages(options = nil)\r\n @client.raw('get', '/content/messages', options, nil, @contact_v1_url)\r\n end",
"def get_message\n @msg = Message.find_by_id(get_message_params[:message_id])\n\n if request.xhr?\n render :json => {\n :text => @msg.m_message,\n :offset => @msg.m_offset\n }\n end\n\n end",
"def show\n @project_message = ProjectMessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project_message }\n end\n end",
"def index\n\t\t@messages = Message.where(:to_user => current_user.id)\n\t\trespond_with(@messages) \n\tend",
"def index\n @response_messages = @request_message.response_messages\n respond_to do |format|\n format.html { raise ActionController::RoutingError.new('Not Found') }\n format.json {}\n end\n end",
"def index\n @messages = Rails.cache.fetch('all_messages', :expires_in => 30.seconds) do\n Message.all\n end\n\n respond_to do |format|\n format.json { render json: @messages }\n end\n end",
"def show\n @admin_message = AdminMessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_message }\n end\n end",
"def show\n\n # @conversation_partner = Message.find(params[:receiver])\n\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def index\n @mod_messages = ModMessage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mod_messages }\n end\n end",
"def my_messages(opts = {})\n client.get_my_messages(opts)\n end",
"def conversation\n current_user_id = current_user.id\n other_user_id = params[:id]\n @messages = Message.get_conversation(current_user_id, other_user_id)\n render json: @messages\n end",
"def show\n @conversation = current_user.conversations.find_by_id params.require(:id)\n @messages = @conversation.messages.order('created_at')\n\n uc = @conversation.user_conversations.find_by_user_id(current_user)\n uc.read = true\n uc.save\n\n friend = @conversation.users.collect { |u| u if u != current_user }.compact.first\n @message = Message.new user: friend\n @to = friend.number\n @name = friend.name\n\n respond_to do |format|\n format.html\n format.json { render :json => @messages.to_json(include: :user, :methods => [:file_url]) }\n end\n end",
"def direct_messages(params = {})\n get \"direct_messages\", params\n end",
"def show\n @pmessage = Pmessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pmessage }\n end\n end",
"def show\n @message_log = MessageLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message_log }\n end\n end",
"def show\n @store_manager_messages_read = Store::Manager::Messages::Read.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store_manager_messages_read }\n end\n end",
"def show\n @message = Message.find(params[:id])\n respond_with(@message)\n end",
"def index\n\n if @current_user.admin?\n @v1_messages = V1::Message.all\n else\n @v1_messages = V1::Message.all.where(company_id: @current_user.company.id)\n end\n\n render json: @v1_messages\n end",
"def show\n @mod_message = ModMessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mod_message }\n end\n end",
"def new\n @message = Message.new\n @users = User.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n end",
"def show\n @message = Message.find(params[:id])\n end",
"def get_message(id, options = nil)\r\n @client.raw('get', \"/content/messages/#{id}\", options, nil, @contact_v1_url)\r\n end",
"def show\n @minimessage = Minimessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @minimessage }\n end\n end",
"def show\n @chatroom = Chatroom.find(params[:id])\n @messages = @chatroom.messages.order(\"created_at DESC\")\n @user = User.find(session[:user_id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chatroom }\n end\n end",
"def index\n messages = Message.all\n end",
"def new\n @message = current_user.messages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @chat_room = ChatRoom.find(params[:chat_room_id])\n #@chat_messages = @chat_room.chat_messages\n @chat_messages = @chat_room.chat_messages.order(created_at: :desc).page(params[:page]).per(5)\n\n render json: @chat_messages, each_serializer: ChatMessageSerializer\n end",
"def messages_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MessagesApi.messages_get ...'\n end\n # resource path\n local_var_path = '/messages'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'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'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apiKey']\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 => 'MessagesResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MessagesApi#messages_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def message(message)\n get(\"inbox/messages/#{message}\").pop\n end",
"def index\n @messages = Room.find(params['room_id']).messages\n end"
] |
[
"0.75848913",
"0.75048095",
"0.722935",
"0.7189061",
"0.71235263",
"0.7086403",
"0.7069309",
"0.70688313",
"0.70688313",
"0.70688313",
"0.70688313",
"0.70688313",
"0.70688313",
"0.70688313",
"0.70688313",
"0.70688313",
"0.70688313",
"0.70688313",
"0.70688313",
"0.70688313",
"0.70688313",
"0.70688313",
"0.70688313",
"0.70688313",
"0.70688313",
"0.70688313",
"0.70688313",
"0.70686716",
"0.7058012",
"0.70477957",
"0.70477957",
"0.70233333",
"0.6961783",
"0.6961283",
"0.6959121",
"0.6953646",
"0.6926653",
"0.68890357",
"0.6869605",
"0.6864425",
"0.68611926",
"0.6857419",
"0.6833948",
"0.6821131",
"0.6809511",
"0.67853546",
"0.67475134",
"0.67217106",
"0.670179",
"0.66971004",
"0.6687624",
"0.66782886",
"0.6669124",
"0.6664035",
"0.66585964",
"0.66433144",
"0.66359043",
"0.6617844",
"0.6617844",
"0.6605138",
"0.6594393",
"0.65762705",
"0.65578246",
"0.6547845",
"0.65426296",
"0.65379435",
"0.6531587",
"0.65221304",
"0.6520312",
"0.6519576",
"0.651055",
"0.6489163",
"0.6478214",
"0.6475096",
"0.64616793",
"0.6458609",
"0.64557993",
"0.64470106",
"0.64434236",
"0.6443245",
"0.6440764",
"0.6424771",
"0.64198494",
"0.6416008",
"0.6414998",
"0.6410114",
"0.6406195",
"0.6400211",
"0.6379609",
"0.63745064",
"0.63659716",
"0.63659716",
"0.63654304",
"0.63641304",
"0.6354629",
"0.6348155",
"0.6347639",
"0.63453114",
"0.63427216",
"0.6328349",
"0.63278955"
] |
0.0
|
-1
|
GET /messages/new GET /messages/new.json
|
def new
@message = Message.new
@title = "Новое сообщение"
if params[:reply_to]
@reply_to = current_user.received_messages.find(params[:reply_to])
unless @reply_to.nil?
@message.to = @reply_to.sender.username
@message.subject = "Re: #{@reply_to.subject}"
@message.body = "bq. #{@reply_to.body}\n\n"
end
end
if params[:to]
@message.to = params[:to]
end
respond_to do |format|
format.html # new.html.erb
format.json { render json: @message }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @message = Message.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = current_user.messages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @message }\n end\n end",
"def new\n @message = Message.new\n\n render json: @message\n end",
"def new\n # we don't want to use /messages/new, always use root path /\n flash.keep and redirect_to root_path and return unless request.fullpath == root_path\n\n @message = Message.new\n @show_editable_fields = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n @users = User.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @text_message = TextMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text_message }\n end\n end",
"def new\n @message = Message.new\n @message.signature = 1\n @message.send_date = Date.today\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message_post = MessagePost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message_post }\n end\n end",
"def new\n @message = Message.new\n \n respond_to do |format|\n format.html # new.html.erb \n end\n end",
"def new\n @pmessage = Pmessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pmessage }\n end\n end",
"def new\n @message_pattern = MessagePattern.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message_pattern }\n end\n end",
"def new\n @conversation = Conversation.new\n logger.debug \"In new!\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conversation }\n end\n end",
"def new\n @message_field = MessageField.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message_field }\n end\n end",
"def new\n @messaging_message = Messaging::Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @messaging_message }\n end\n end",
"def new\n @message = Message.new\n @projects = Project.all\n @pems = Pem.all\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @room_message = RoomMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @room_message }\n end\n end",
"def new\n @message_log = MessageLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message_log }\n end\n end",
"def new\n @project_message = ProjectMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_message }\n end\n end",
"def new\n @messagetold = Messagetold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @messagetold }\n end\n end",
"def new\n @mod_message = ModMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mod_message }\n end\n end",
"def new\n @messages_comment = MessagesComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @messages_comment }\n end\n end",
"def new\n @admin_message = AdminMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_message }\n end\n end",
"def new\n puts \"---new message ---\"\n if params[:recv]\n @recv = params[:recv]\n @user_recv = User.find_by_id(@recv)\n else\n @recv = nil\n end\n puts @recv\n @message = current_user.messages.new\n @conversation = @message.conversations.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @message }\n end\n end",
"def new\n @chat = Chat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chat }\n end\n end",
"def new\n @messaging_inbox = Messaging::Inbox.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @messaging_inbox }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @message }\n end\n end",
"def new\n @message_link = MessageLink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message_link }\n end\n end",
"def new\n @mailbox = Mailbox.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mailbox }\n end\n end",
"def new\n @message = Message.new(:relation_id => params[:relation_id], :user_id => params[:user_id], :sent => false)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @conversation = Conversation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conversation }\n end\n end",
"def new\n @conversation = Conversation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conversation }\n end\n end",
"def new\n @contact_message = ContactMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact_message }\n end\n end",
"def new\n\t\t@message = Message.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml\t{ render :xml => @message }\n\t\tend\n\tend",
"def new\n\tif !checklogin? then return end\n\n @message = Message.new(:member_id => session[:login].id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n @recipient = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n format.js { }\n end\n end",
"def new\n @recipient = Recipient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipient }\n end\n end",
"def new\n @recipient = Recipient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipient }\n end\n end",
"def new\n @minimessage = Minimessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @minimessage }\n end\n end",
"def new\n @users = User.all\n @groups = Group.all\n @message = Message.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def get_new_messages\n get_messages_link_and_content\n end",
"def new\n @message = Admin::Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @message }\n end\n end",
"def new\n @reply = Reply.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reply }\n end\n end",
"def new\n @message = Message.new\n respond_with @message\n end",
"def new\n @message = Message.new\n @user = User.find(params[:user_id])\n authorize! :create, Message\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @outgoing_message_log = OutgoingMessageLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @outgoing_message_log }\n end\n end",
"def new\n @home_searches_message = Home::Searches::Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @home_searches_message }\n end\n end",
"def new\n @chatline = Chatline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chatline }\n end\n end",
"def new\n @chat_room = ChatRoom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chat_room }\n end\n end",
"def new\n @message_attachment = MessageAttachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message_attachment }\n end\n end",
"def new\n @inbox = Inbox.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inbox }\n end\n end",
"def new\n @notice = @person.notices.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notice }\n end\n end",
"def new\n @store_manager_message = Store::Manager::Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store_manager_message }\n end\n end",
"def new\n @message = Message.new\n @people = User.where(:group_id => current_user.group_id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message_flow = MessageFlow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message_flow }\n end\n end",
"def create\n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to new_message_url, notice: t(\"messages.created\") }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @notice = Notice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notice }\n end\n end",
"def new\n @chatcontent = Chatcontent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chatcontent }\n end\n end",
"def new\n @store_manager_messages_read = Store::Manager::Messages::Read.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store_manager_messages_read }\n end\n end",
"def new\n @fdn_received_message = Fdn::ReceivedMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fdn_received_message }\n end\n end",
"def new\n @email = Email.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email }\n end\n end",
"def new\n @email = Email.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email }\n end\n end",
"def new\n @email = Email.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email }\n end\n end",
"def new\n @email = Email.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email }\n end\n end",
"def new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @user = User.find(params[:user_id])\n @message = @user.messages.new\n end",
"def new\n @outmessage = Outmessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @outmessage }\n end\n end",
"def new\n @message = Message.new\n if params[:group_id]\n @owner = Group.find(params[:group_id])\n end\n\n message = \"You do not have access needed to start a new discussion at this time. If you are interested in joining this discussion, please let us know.\"\n authorize! :read, Message\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @po }\n end\n end",
"def new\n @notify = Notify.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notify }\n end\n end",
"def new\n @sheduled_message = SheduledMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sheduled_message }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @t = T.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @t }\n end\n end",
"def new\n @frommessage = Frommessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @frommessage }\n end\n end"
] |
[
"0.81525946",
"0.81525946",
"0.8146461",
"0.8146461",
"0.8146461",
"0.8146461",
"0.8146461",
"0.8146461",
"0.8146461",
"0.8146461",
"0.8146461",
"0.8146461",
"0.8146461",
"0.8146461",
"0.8146461",
"0.8146461",
"0.8146461",
"0.8146461",
"0.8146461",
"0.81073797",
"0.8089234",
"0.8006565",
"0.77983874",
"0.7789831",
"0.7594306",
"0.7535214",
"0.7526649",
"0.7513911",
"0.7468994",
"0.7447991",
"0.743061",
"0.7428836",
"0.74261725",
"0.7420901",
"0.74186707",
"0.7409109",
"0.74038494",
"0.7389708",
"0.7385157",
"0.7360829",
"0.73327553",
"0.73268265",
"0.7315095",
"0.7297354",
"0.7297325",
"0.7297325",
"0.7297325",
"0.7297325",
"0.7277455",
"0.72659534",
"0.72479665",
"0.72365826",
"0.72365826",
"0.72361255",
"0.72341895",
"0.72080076",
"0.7207244",
"0.72032976",
"0.72032976",
"0.71917623",
"0.7181413",
"0.71774256",
"0.7171087",
"0.71595883",
"0.71429014",
"0.71311605",
"0.70901656",
"0.7081984",
"0.7047115",
"0.7037729",
"0.7024107",
"0.70132667",
"0.70114136",
"0.6985355",
"0.69814074",
"0.6975128",
"0.69746923",
"0.69499916",
"0.6926426",
"0.6910977",
"0.68947864",
"0.6883031",
"0.6883031",
"0.6883031",
"0.6883031",
"0.68774605",
"0.68615586",
"0.6860701",
"0.68557787",
"0.6854962",
"0.68533087",
"0.68529975",
"0.6851585",
"0.6850251",
"0.6850251",
"0.6850251",
"0.6850251",
"0.6850251",
"0.68480545",
"0.68368995"
] |
0.7037203
|
70
|
POST /messages POST /messages.json
|
def create
@message = Message.new(params[:message])
@message.sender = current_user
@message.recipient = User.find_by_username(params[:message][:to])
respond_to do |format|
if @message.save
format.html { redirect_to @message, notice: 'Сообщение отправлено.' }
format.json { render json: @message, status: :created, location: @message }
else
format.html { render action: "new" }
format.json { render json: @message.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def post(content)\n post_to(\"/api/v1/messages/\", {:body => content})\n end",
"def create\n message = Message.new(message_params)\n message.message = params[:message_text]\n message.display_name = params[:display_name]\n message.save!\n render json: message\n end",
"def create\n @message = Message.new(message_params)\n\n if @message.save\n render json: @message, status: :created, location: [:api, @message]\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end",
"def create\n @message = Message.new(message_params)\n\n if @message.save\n @user = User.find(@message.user_id)\n @user.messages << @message\n render json: @message, status: :created\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end",
"def create\n @message = Message.new(message_params)\n\n if @message.save\n render json: @message, status: :created, location: @message\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end",
"def create\n @message = Message.new(message_params)\n\n if @message.save\n render json: @message, status: :created, location: @message\n else \n render json: @message.errors, status: :unprocessable_entity\n end\n end",
"def create\n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to new_message_url, notice: t(\"messages.created\") }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n message = Message.new(message_params)\n message.messager = current_user\n\n if message.valid?\n message.save!\n render json: MessageSerializer.new(message).serialize\n else\n render json: { errors: message.errors.messages }, status: 422\n end\n end",
"def create\n\n @message = current_user.messages.new(message_params)\n\n if @message\n respond_to do |format|\n if @message.save\n # debugger\n format.html do\n redirect_to @message, notice: 'Message was successfully created.'\n end\n format.json { render :_message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @message = Message.new(params[:message])\n @message.user_id = current_user.id\n \n respond_to do |format|\n if @message.save\n format.json { render json: @message, status: :created}\n else\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def message(user, text)\n post('/direct_messages/new.json', :user => user, :text => text)\n end",
"def message(user, text)\n post('/direct_messages/new.json', :user => user, :text => text)\n end",
"def create\n @message = Message.new(message_params)\n respond_to do |format|\n if @message.save\n format.json {render json: :created}\n else\n format.json {render json: \"not created\"}\n end\n end\n end",
"def create_message(user_id, recipient_id, token , subject, message)\n response = self.class.post('/messages', body: { \"user_id\": user_id, \"recipient_id\": recipient_id,\"token\": token , \"subject\": subject, \"stripped-text\": message }, headers: { \"authorization\" => @auth_token })\n puts response\n\n end",
"def create\n @message = Message.new(params[:message])\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message: params[:message_content], from_id: current_user.id, to_id: params[:to_id])\n respond_to do |format|\n if @message.save\n format.html { redirect_to user_path(@message.to_id), notice: 'Message was successfully sent.' }\n else\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(post_params)\n respond_to do |format|\n if @message.save\n flash[:success] = \"문자가 성공적으로 업로드 되었습니다.\"\n format.html { render :show}\n else\n flash[:error] = \"부족한 곳을 채워주세요\"\n format.html { render :new}\n format.json { render json: @message.errors }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message crée avec succès.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n @message = @conversation.messages.build(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to conversation_messages_path(@conversation), notice: 'メッセージを送信しました。' }\n format.json { render :show, status: :created, location: conversation_messages_path(@conversation) }\n else\n format.html { render :index }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n @message.sent_at = Time.now\n if @message.save\n render text: 'message successfully created.', status: :created\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end",
"def create\n @message = Message.new(message_params)\n \n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully sent.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @room = Room.find_or_create_by(room_params)\n @message = @room.messages.new(message_params)\n\n if @message.save\n render json: @message, status: :created, location: [@room, @message]\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end",
"def send\n inf = params.permit(:to, :from, :time, :priority, :message, :til)\n message = Message.new\n message.user = current_user\n message.entered = DateTime.now.in_time_zone\n message.year = DateTime.now.in_time_zone.year\n\n message.to = inf[:to]\n message.from = inf[:from]\n message.message_time = inf[:time]\n message.priority = inf[:priority]\n message.message = inf[:message]\n message.til = inf[:til]\n\n unless message.save\n render json: {message: @message.errors}.to_json, \\\n status: :unprocessable_entity\n end\n\n render json: {message: 'Success'}.to_json, status: 200\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.find_by(token: params[:token])\n new_message_params = {\n text: message_params[:text],\n conversation_id: message_params[:conversation_id],\n user_id: user.id,\n username: user.username\n }\n @message = Message.new(new_message_params)\n conversation = Conversation.find(message_params[:conversation_id])\n\n if @message.save\n # render json: @message, status: :created, location: @message\n serialized_data = ActiveModelSerializers::Adapter::Json.new(\n MessageSerializer.new(@message)\n ).serializable_hash\n MessagesChannel.broadcast_to conversation, serialized_data\n head :ok\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end",
"def message(message)\n render json: {\n message: message,\n status: :success\n }, status: 200\n end",
"def create\n mesg = Message.new({user_id: @current_user.id, receiver_id: params[:receiver_id], content: params[:content], request_id: params[:request_id]})\n if mesg.save\n render json: {\n status: 'success',\n message: 'Your message was sent',\n data: mesg,\n },\n status: :created\n else\n render json: {\n status: 'error',\n message: 'Message not sent',\n data: mesg.errors\n },\n status: :unprocessable_entity\n end\n end",
"def post_message(token, channel, text, username)\n uri = URI.parse(URL[\"post_msg\"])\n params = { :token => token,\n :channel => channel,\n :text => text,\n :username => username,\n :as_user => true }\n uri.query = URI.encode_www_form( params )\n return JSON.parse( uri.open.read )\n end",
"def post(message)\n puts message\n end",
"def create\n @message = Message.new(message_params)\n\n if @message.save\n render json: { \"status\": \"success\" }, status: 200\n else\n render json: {}, status: 401\n end\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: \"Message sent to #{@message.receiver.full_name}.\" }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = @app_thread.messages.new(message_params)\n @message.user_id = @user.id\n\n respond_to do |format|\n if @message.save\n format.js {}\n format.html { redirect_to user_project_app_thread_url(@user, @project, @app_thread), notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { redirect_to user_project_app_thread_url(@user, @project, @app_thread), notice: @message.errors.full_messages.inspect }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render action: 'show', status: :created, location: @message }\n else\n format.html { render action: 'new' }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to admin_message_path(@message), notice: 'Message was successfully created.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_message(text)\n body ={\n \"title\" => @from_name,\n \"picture\" => @from_picture,\n \"message\" => text\n }\n\n self.class.post(room_path, request_options(body))\n end",
"def api_create\n @message = Message.new\n @message.user_id = params[:message][:user_id]\n @message.room_id = params[:message][:room_id]\n @message.content = params[:message][:content]\n @message.save\n\n #Generate de js to publish\n jsScript = createMessage(@message)\n PrivatePub.publish_to(\"/rooms/#{@message.room_id}\", jsScript)\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.json { render json: @message}\n else\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @conversation = Conversation.find(params[:conversation_id])\n if @conversation.messages.create(sender: current_user,\n content: params[:message][:content])\n redirect_to @conversation\n else\n flash[:error] = \"A problem occured\"\n redirect_to @conversation\n end\n #respond_to do |format|\n # format.js { render json: @message }\n # format.html { redirect_back_or_to :back }\n #end\n end",
"def create\n @message = Message.new(message_params)\n @message.sender_id = current_user.id\n @message.recipient_id = params[:recipient_id]\n\n respond_to do |format|\n if @message.save\n flash[:notice] = \"Mesaj gönderildi.\"\n format.json { render json: {success: true} } \n # Pusher.trigger('private-'+params[:recipient_id],'new_message', {:from => current_user.name, \n # :subject => @message.subject})\n else\n flash[:error] = \"Mesaj gönderilemedi.\"\n redirect_to '/'\n end\n end\n end",
"def create\n @message = @ride_request.messages.new(message_params)\n @message.user = current_user\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to :back, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :back }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_message = UserMessage.new(user_message_params)\n\n if @user_message.save\n render :show, status: :created, location: @user_message\n else\n render json: @user_message.errors, status: :unprocessable_entity\n end\n end",
"def create\n @message = Message.new(params[:message])\n @status = if @message.save then\n @message \n else\n render :json=> @message, :status=> :unprocessable_entity\n end\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to url_for(action: 'index'), notice: f(@message) }\n format.json { render :show, status: :created, location: url_for(action: 'show', id: @message) }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(message)\n puts message\n end",
"def create\n\t\t@message = Message.create!(params[:message])\n\t\trespond_to do |format|\n\t\t\tformat.js\n\t\tend\n\tend",
"def new\n @message = Message.new\n\n render json: @message\n end",
"def post_message(params)\n self.class.post('/chat.postMessage', body: params.merge({token: @token})).tap do |response|\n raise \"error posting message: #{response.fetch('error', 'unknown error')}\" unless response['ok']\n end\n end",
"def create\n @message = Message.new(message_params)\n @message.user = current_user\n respond_to do |format|\n if @message.save\n format.html { redirect_to root_path, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to user_url(@message.user_id), notice: 'Message was successfully created.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n @message.user_sent_id = current_user.id\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :text => '{\"message\": \"Your messages has been sent\"}' }\n #format.json { render action: 'show', status: :created, location: @message }\n else\n format.html { render action: 'new' }\n format.json { render text: 'message'}\n end\n end\n end",
"def create\n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n\n format.html { redirect_to outbox_path, notice: 'Message was successfully created.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_messages!(hash)\n Net::HTTP.post_form(URI.parse(@target), {'data'=>hash.to_json})\n end",
"def message(session, message, options={})\n json_request \"message\", {:session => session,\n :message => message}, options\n end",
"def create\n @message = Message.new(message_params)\n @message.message_type = 'Reqular Message `'\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new params[:message]\n @message.save\n respond_with @message, location: after_send_path, notice: t('hyalin.messages.sent_success')\n end",
"def new\n @message = current_user.messages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def create\n \n @message = current_user.messages.build(params[:message])\n if @message.save\n \n \n @account_sid = 'ACdb43c99b5deb7d4ed12083140f41bab3'\n @auth_token = '11dbb8cbba9b004652469aa77e51183c'\n\n # set up a client to talk to the Twilio REST API\n @client = Twilio::REST::Client.new(@account_sid, @auth_token)\n ha = HashWithIndifferentAccess.new(params[:message])\n mssg = ha['content']\n\n friends = {\n \"+14159006499\" => \"Jered\",\n \"+11111111111\" => \"Chris\",\n \"+11111111111\" => \"Kathryn\"}\n\n @account = @client.account\n @message = @account.sms.messages.create({:to => '+14159006499', :from => '+18319204556', :body => mssg})\n puts @message\n flash[:success] = \"Message created!\"\n redirect_to 'http://www.bugl.co/acknowledge.html'\n\n else\n @feed_items = []\n render 'static_pages/home'\n end\n \n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n \n format.json { render json: @message, status: :created, location: @message }\n else\n \n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def messages\n get_json('messages.json')\n end",
"def create\n @room_message = RoomMessage.new(params[:room_message])\n\n respond_to do |format|\n if @room_message.save\n format.html { redirect_to @room_message, notice: 'Room message was successfully created.' }\n format.json { render json: @room_message, status: :created, location: @room_message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @room_message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @text_message = TextMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text_message }\n end\n end",
"def create\n @message = Message.new sender_id: current_user.id, recipient_id: message_params[:recipient_id], verb: message_params[:verb]\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n puts params['msg']\n receiver = User.find_by(username: params['receiver']).id\n\n @message = Message.new(seen: 0, sender: current_user.id, receiver: receiver, contents: params[:msg], sent_at: Time.now)\n @message.save!\n\n #Load the messages\n m = current_user.chat_with(params['receiver'])\n respond_to do |format|\n format.js { render json: m.to_json }\n format.html\n end\n\n # @message = Message.new(message_params)\n\n # respond_to do |format|\n # if @message.save\n # format.html { redirect_to @message, notice: 'Message was successfully created.' }\n # format.json { render :show, status: :created, location: @message }\n # else\n # format.html { render :new }\n # format.json { render json: @message.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def post_message(params)\n self.class.post('/chat.postMessage', body: params.merge({token: @token})).tap do |response|\n raise \"error posting message: #{response.fetch('error', 'unknown error')}\" unless response['ok']\n end\n end",
"def create\n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.deliver\n format.html { render :thank_you }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def typer(session, message, options={})\n json_request \"message\", {:session => session,\n :message => message}, options\n end",
"def create\n @message = Message.new\n @message.create_one!(params[:message])\n #Juggernaut.publish(1, parse_chat_message(params[:message][:message], current_user))\n respond_to do |format|\n format.html { redirect_to :index }\n format.js\n end\n end",
"def create\n @msg = Msg.new(msg_params)\n\n respond_to do |format|\n if @msg.save\n format.html { redirect_to @msg, notice: 'Msg was successfully created.' }\n format.json { render action: 'show', status: :created, location: @msg }\n else\n format.html { render action: 'new' }\n format.json { render json: @msg.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n create_message(params)\n end",
"def send_messages\n if Message.send_messages()\n render json: {status: :ok}\n else\n render json: \"Error\"\n end\n end",
"def post(request, _params)\n formatter = WeChatMessageFormatter.new\n message = formatter.parse_incoming_message(request.body.read.to_s)\n # Parse the WeChat message XML format\n\n if message['valid']\n # Queue the message for delayed processing\n @db_manager.store_message(message)\n\n # WeChat always requires incoming user messages to be acknowledged at\n # least with an empty string (empty strings are not shown to users),\n # see: https://chatbotsmagazine.com/building-chatbots-for-wechat-part-1-dba8f160349\n # In this sample app, we simulate a \"Customer Service\"-like scenario\n # providing an instant reply to the user, announcing that a complete\n # reply will follow.\n reply = \"Thank you for your message. We will get back to you as soon as possible!\"\n return formatter.format_instant_reply(message, reply)\n end\n\n return 'Message was sent in a wrong format.'\n end",
"def test_create_palindrome_message\n body = {\n \tdata: {\n \t\ttype: 'messages',\n \t\tattributes: {\n \t\t\tcontent: 'racecar'\n \t\t}\n \t}\n }\n\n post '/messages', body.to_json, 'CONTENT_TYPE' => AppConstants::CONTENT_TYPE\n assert last_response.created?\n assert_equal 'application/vnd.api+json', last_response.headers['Content-Type']\n\n response_body = JSON.parse last_response.body\n data = response_body['data']\n\n assert_equal 'messages', data['type']\n assert_equal body[:data][:attributes][:content], data['attributes']['content']\n assert data['attributes']['is_palindrome']\n assert_equal \"localhost:4567/messages/#{data['id']}\", last_response.headers['Location']\n end",
"def send_message\n \tuser = User.find(params[:user_id]);\n \tif user\n \t\tmessage = Conversation.new(user_id: params[:user_id], message_id: params[:message_id], request_id: params[:request_id])\n \t\tif message.save\n \t\t\tconversation = Conversation.find_by(request_id: params[:request_id])\n \t\t\trender json: conversation\n \t\tend\n \telse\n\t\trender json: {error: 'User not found.'}\n \tend\n end",
"def create\n \n @message = Message.new(body: params[:message][:body], sender_id: current_user.id, receiver_id: params[:message][:receiver_id])\n \n #@message = current_user.messages.build(message_params)\n #@message.save\n #respond_with { @message }\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to message_user_path(@message.sender_id, @message.receiver_id), notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_message = Admin::Message.new(admin_message_params)\n\n respond_to do |format|\n if @admin_message.save\n format.html { redirect_to @admin_message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @admin_message }\n else\n format.html { render :new }\n format.json { render json: @admin_message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n @message.room = Room.find(params[:room_id])\n @message.user = @current_user\n respond_to do |format|\n if @message.save\n format.html { redirect_to room_message_path(@message.room, @message), notice: 'Message was successfully created.' }\n format.json { render :show, status: :created }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to messages_url, notice: 'Message was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n if @message.save\n SharpenAPI.send_sms(@message.message, @message.recipient_numbers)\n redirect_to admin_bat_signal_path, notice: 'Message was successfully sent'\n else\n format.html { render :new }\n format.json do\n render json: @message.errors, status: :unprocessable_entity\n end\n end\n end",
"def create\n message_params = params[:message]\n message_params[:text] = params[:text]\n message = Message.new(\n author_id: current_user.id,\n chat: Chat.find(message_params[:chat_id]),\n parse_mode: message_params[:parse_mode],\n text: (message_params[:text].join \"\\r\\n\\r\\n\")\n )\n message.image = message_params[:image] if message_params[:image].present?\n puts JSON.pretty_generate message.as_json\n message.save!\n redirect_to admin_message_path(message), notice: 'A message has been created'\n # Message.create!(\n # author_id: current_user.id,\n # chat: Chat.find(message_params[:chat_id]),\n # image: message_params[:image],\n # parse_mode: message_params[:parse_mode],\n # text: (message_params[:text].join \"\\r\\n\\r\\n\")\n # )\n end",
"def new\n @message = Message.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def create\n inbound_messages.each(&:save)\n render :nothing => true, :status => 200\n end",
"def create\n to = params[:to]\n\n unless to\n raise IOError, \"Incorrect params for sending text message\" \n end\n\n @client = Twilio::REST::Client.new(\n CONFIG[:twilio_account_sid],\n CONFIG[:twilio_auth_token])\n\n @account = @client.account\n @message = @account.sms.messages.create({\n :from => CONFIG[:twilio_phone_number],\n :to => to,\n :body => \"Happy Mining! #{CONFIG[:ios_app_link]}\"}) \n\n rescue => ex\n handle_exception(ex)\n ensure\n respond_to do |format|\n format.json\n end\n end",
"def create\n @message = Message.new(message_params) \n if params.has_key?(:message) and params[:message].has_key?(:users)\n @mu = params[:message][:user].map{ |mu| sg.to_i } - [0]\n end \n if @message.save\n if @mu.kind_of?(Array)\n @message.message_users.delete_all\n @mu.each do |mu_id|\n MessegerUser.create(user_id: mu_id.to_i, message: @message)\n end\n end\n end\n \n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Сообщение было успешно создано.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n # Tell the UserMailer to send a welcome email after save\n MessageMailer.welcome_email(@message).deliver_now\n\n format.html { redirect_to(root_url, :notice => 'Message was successfully sent.') }\n format.json { render json: @message, status: :created, location: @message }\n else\n flash.now.alert = \"Please fill all fields.\"\n # format.html { render action: 'new' }\n # format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end"
] |
[
"0.7465386",
"0.71694404",
"0.7112854",
"0.7095524",
"0.70685273",
"0.70200527",
"0.69382447",
"0.6844289",
"0.683413",
"0.683015",
"0.68281627",
"0.68281627",
"0.6783851",
"0.6763146",
"0.67002374",
"0.6698929",
"0.66701055",
"0.66322166",
"0.66246116",
"0.6623654",
"0.6613094",
"0.66087025",
"0.66064614",
"0.65974814",
"0.65929735",
"0.6586782",
"0.6583194",
"0.6583194",
"0.6583194",
"0.6583194",
"0.6583194",
"0.6583194",
"0.6583194",
"0.6583194",
"0.6583194",
"0.6583194",
"0.6580122",
"0.65786195",
"0.6563439",
"0.6561293",
"0.65548825",
"0.6547267",
"0.65393007",
"0.652263",
"0.6520578",
"0.65172887",
"0.65168685",
"0.65026635",
"0.64886004",
"0.6486658",
"0.64856094",
"0.64639294",
"0.6456334",
"0.64554983",
"0.64546174",
"0.64309764",
"0.6425515",
"0.64214706",
"0.6404915",
"0.64044404",
"0.6388286",
"0.63826376",
"0.6382194",
"0.6380992",
"0.63743335",
"0.636351",
"0.6362325",
"0.6355248",
"0.633311",
"0.63263345",
"0.6326246",
"0.63214594",
"0.6311168",
"0.6308262",
"0.6302277",
"0.6293201",
"0.6289386",
"0.62869877",
"0.6284174",
"0.628026",
"0.6272262",
"0.6271469",
"0.6256184",
"0.6255775",
"0.62544894",
"0.6227389",
"0.6225662",
"0.62165046",
"0.6208265",
"0.62042105",
"0.62042105",
"0.6203562",
"0.6201395",
"0.6198471",
"0.61947614",
"0.619097",
"0.619097",
"0.619097",
"0.619097",
"0.619097",
"0.619097"
] |
0.0
|
-1
|
DELETE /messages/1 DELETE /messages/1.json
|
def destroy
@message = Message.find(params[:id])
@message.mark_deleted(current_user)
respond_to do |format|
format.html { redirect_to messages_url }
format.json { head :ok }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @v1_message = V1::Message.find(params[:id])\n @v1_message.destroy\n\n head :no_content\n end",
"def delete\n @client.post('/api/del_msg', id: get_attribute(:name))\n end",
"def destroy\n # delete a specific message\n end",
"def destroy\n @message.destroy\n \n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # delete a specific message\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n render json: 'Message was successfully deleted', status: :ok\n end",
"def delete_message(id)\n record \"/msg/delete/#{id}\"\n end",
"def destroy\n # delete a specific message\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def message_delete(id)\n request(:delete, \"messages/#{id.to_s}\")\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'message.deleted' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @msg.destroy\n respond_to do |format|\n format.html { redirect_to msgs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n respond_to do |format|\n format.html { redirect_to noticias_messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to [@member, :messages] }\n format.json { head :no_content }\n end\n end",
"def message_destroy(id)\n post(\"/direct_messages/destroy/#{id}.json\")\n end",
"def message_destroy(id)\n post(\"/direct_messages/destroy/#{id}.json\")\n end",
"def destroy\n \t\n @message = Message.find(params[:id])\n @message.delete\n\n respond_to do |format|\n format.html { redirect_to(messages_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def delete_message(message_id)\n RestClient.delete(\"#{@url}/messages/#{message_id}\")\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to success_path, notice: _('Message deleted') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n head :no_content\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url, notice: t(:message_destroyed) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n head :no_content\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to url_for(action: 'index'), notice: f(@message) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n\n @message.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to conversations_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @message = Messages.find(params[:id])\n @message.destroy\n end",
"def destroy\n message = Message.find(params[:id])\n message.destroy\n end",
"def destroy\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to(messages_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Le message a bien été supprimé.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'El Mensaje ha sido eliminado correctamente!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @message.destroy\n head :no_content\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end",
"def destroy\n @message = Admin::Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_messages_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: \"Message was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: \"Message was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hello_message.destroy\n respond_to do |format|\n format.html { redirect_to hello_messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_message = AdminMessage.find(params[:id])\n @admin_message.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to(messages_url) }\n format.xml { head :ok }\n end\n end"
] |
[
"0.79590774",
"0.7747881",
"0.771779",
"0.76623553",
"0.7639338",
"0.76313365",
"0.7628893",
"0.76116306",
"0.76056355",
"0.7605057",
"0.7605057",
"0.7592493",
"0.75893265",
"0.75893265",
"0.75893265",
"0.75893265",
"0.7552685",
"0.7550845",
"0.7550845",
"0.7550845",
"0.7550845",
"0.7550845",
"0.7550845",
"0.7550845",
"0.7550845",
"0.7550845",
"0.7550845",
"0.7550845",
"0.7550845",
"0.7550845",
"0.7550845",
"0.7550845",
"0.7550845",
"0.7550845",
"0.7550845",
"0.7550845",
"0.7550845",
"0.7550845",
"0.7550418",
"0.7538219",
"0.7505909",
"0.74848205",
"0.7474881",
"0.74500626",
"0.74500626",
"0.7442052",
"0.7440293",
"0.74217576",
"0.7417957",
"0.7392894",
"0.73918283",
"0.73915154",
"0.7383026",
"0.73736113",
"0.7368572",
"0.7367718",
"0.736016",
"0.7348663",
"0.7345735",
"0.73398876",
"0.73154765",
"0.73094386",
"0.7297161",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7295871",
"0.7293786",
"0.72931117",
"0.72931117",
"0.7291797",
"0.72867215",
"0.7285215"
] |
0.7340958
|
59
|
TODO: change to guard clause
|
def check_valid_time(hours, minutes)
if hours > 24 || hours < 0
raise ArgumentError.new('ERROR: invalid hours')
elsif minutes > 59 || minutes < 0
raise ArgumentError.new('ERROR: invalid minutes')
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def guard; end",
"def conditionally(*) end",
"def conditionally(*) end",
"def condition; end",
"def cond; end",
"def cond; end",
"def cond; end",
"def check ; true ; end",
"def private; end",
"def missed?; end",
"def sharded?; false; end",
"def checks; end",
"def sharded?; true; end",
"def valid; end",
"def check\n \n end",
"def check\n \n end",
"def semact?; false; end",
"def actual_flow_control\n super\n end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def issn; end",
"def valid_before=(_arg0); end",
"def missing?; end",
"def child_condition; end",
"def placebo?; false end",
"def maybe; end",
"def missing?; false; end",
"def ignores; end",
"def result_of_checking; end",
"def usable?; end",
"def check_record; end",
"def passed?; end",
"def passed?; end",
"def passed?; end",
"def despined?(*)\n end",
"def internal?; end",
"def used?; end",
"def ensure_not_in_dest; end",
"def block_given?() end",
"def verify_iss; end",
"def verify_iss; end",
"def invalid; end",
"def continue?; end",
"def scope_condition() {} end",
"def verify_iss=(_arg0); end",
"def verify_iss=(_arg0); end",
"def allowed?; true end",
"def isolated?; end",
"def isolated?; end",
"def check_ending(_result)\n end",
"def captured_by_block?; end",
"def suivre; end",
"def too_many_hops?; end",
"def probers; end",
"def covered?; end",
"def checked?; end",
"def success?() end",
"def final?; end",
"def continue_on_exists_proc=(_arg0); end",
"def continue_on_exists_proc; end",
"def safe; end",
"def if_condition; end",
"def skipped?; end",
"def skipped?; end",
"def skipped?; end",
"def skipped?; end",
"def absent?; end",
"def verify_not_before=(_arg0); end",
"def verify_not_before=(_arg0); end",
"def run_cond; end",
"def unknown?; false; end",
"def unknown?; false; end",
"def checks=(_arg0); end",
"def conditions; end",
"def conditions; end",
"def precheck\n end",
"def explicit?; end",
"def allowed?() raise NotImplementedError end",
"def verify_not_before; end",
"def verify_not_before; end",
"def else_clause\n expect :if\n self[3]\n end",
"def anchored; end",
"def cond=(_arg0); end",
"def cond=(_arg0); end",
"def cond=(_arg0); end",
"def positive?; end",
"def assert\nraise \"Card not valid!\" unless yield\nend",
"def hit_condition()\n #This is a stub, used for indexing\n end",
"def certain?\n fail NotImplementedError\n end",
"def ordinary?\n raise \"Not implemented yet\"\n end",
"def read?\n !(read_by_user.nil?)\nrescue NameError\n raise 'do_search must first be performed'\nend",
"def if_proc=(_arg0); end",
"def skipped; end",
"def match; end",
"def match; end",
"def ignore; end",
"def guard(guard_result)\r\n @guard_temp=guard_result\r\n end",
"def maybe so, maybe: self\n so\n end"
] |
[
"0.7301945",
"0.63842285",
"0.63842285",
"0.63330686",
"0.6162099",
"0.6162099",
"0.6162099",
"0.61471164",
"0.61059016",
"0.60625136",
"0.598362",
"0.59765637",
"0.596979",
"0.59451175",
"0.59436965",
"0.59436965",
"0.58986694",
"0.57197785",
"0.5694375",
"0.5694375",
"0.5694375",
"0.5694375",
"0.5694375",
"0.5688768",
"0.5688365",
"0.56839174",
"0.56326383",
"0.5629599",
"0.5595661",
"0.5510015",
"0.5509772",
"0.5492702",
"0.5481864",
"0.546419",
"0.5451694",
"0.5451694",
"0.5451694",
"0.5449897",
"0.54431826",
"0.54417056",
"0.5437857",
"0.54372424",
"0.5436393",
"0.5436393",
"0.54125464",
"0.5412481",
"0.5395728",
"0.53953713",
"0.53953713",
"0.5391289",
"0.5378189",
"0.5378189",
"0.5376156",
"0.53645116",
"0.5359012",
"0.5352503",
"0.5347153",
"0.534574",
"0.53437364",
"0.5328424",
"0.5326649",
"0.5316207",
"0.5308914",
"0.53019947",
"0.5298333",
"0.52977294",
"0.52977294",
"0.52977294",
"0.52977294",
"0.52910686",
"0.52889603",
"0.52889603",
"0.52778786",
"0.52689016",
"0.52689016",
"0.52658993",
"0.5263146",
"0.5263146",
"0.52601963",
"0.5245288",
"0.52429825",
"0.5238018",
"0.5238018",
"0.5234455",
"0.52337563",
"0.52323127",
"0.52323127",
"0.52323127",
"0.52311265",
"0.52280486",
"0.5219692",
"0.5214399",
"0.520952",
"0.52045757",
"0.5198555",
"0.5195205",
"0.51946807",
"0.51946807",
"0.5189011",
"0.5188644",
"0.5186794"
] |
0.0
|
-1
|
/Domain/EmailForward/Remove The command is intended to remove an existing Email Forwarding rule. Returned data: STATUS=SUCCESS or FAILURE TRANSACTID=Transaction ID Example return data: transactid=5c6690939950db9fad0a667eef0ebd8e status=SUCCESS
|
def remove_email_forward(source)
validate_list([["Source", source, :email] ])
options = { "Source" => source }
connection = Connection.new
connection.post("Domain/EmailForward/Remove", options)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete_rule!(objectID, forward_to_replicas = false, request_options = {})\n res = delete_rule(objectID, forward_to_replicas, request_options)\n wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options)\n return res\n end",
"def delete_rcpt( email )\n RESPONSE[\"DELRCPT\"] + email + \"\\0\"\n end",
"def destroy\n @inbound_email = InboundEmail.find(params[:id])\n @inbound_email.destroy\n\n respond_to do |format|\n format.html { redirect_to(inbound_emails_url) }\n format.xml { head :ok }\n end\n end",
"def delete_rcpt( email )\n RESPONSE[:delrcpt] + email + \"\\0\"\n end",
"def remove_rule request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, _body, query_string_params = transcode_remove_rule_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end",
"def destroy\n @forward = Forward.find(params[:id])\n @forward.destroy\n\n respond_to do |format|\n format.html { redirect_to(forwards_url) }\n format.xml { head :ok }\n end\n end",
"def remove_firewall_rule server_uuid, position\n response = delete \"server/#{server_uuid}/firewall_rule/#{position}\"\n\n response\n end",
"def destroy\n @route_rule = RouteRule.find(params[:id])\n @route_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(route_rules_url) }\n format.xml { head :ok }\n end\n end",
"def remove(email)\n @mailing_list.remove_contacts(email, force:true)\n end",
"def destroy\n @attend_rule.destroy\n respond_to do |format|\n format.html { redirect_to attend_rules_url, notice: 'Attend rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_forwarding_rule(identifier, opts = {})\n data, _status_code, _headers = delete_forwarding_rule_with_http_info(identifier, opts)\n return data\n end",
"def destroy\n @inbound_email_log = InboundEmailLog.find(params[:id])\n @inbound_email_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(inbound_email_logs_url) }\n format.xml { head :ok }\n end\n end",
"def remove_outbound_rule(rule_number)\n remove_rule(rule_number, true)\n end",
"def destroy\n @rule = Rule.find(params[:id])\n \n\t@account = Account.find(params[:account_id])\n @rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(account_rules_url(@account)) }\n format.xml { head :ok }\n end\n end",
"def remove_rule(rule_number, egress)\n requires :network_acl_id\n\n service.delete_network_acl_entry(network_acl_id, rule_number, egress)\n true\n end",
"def destroy\n @rule.destroy\n\n respond_with(rule, location: rules_url, notice: 'RUle was successfully destroyed.')\n end",
"def remove_inbound_rule(rule_number)\n remove_rule(rule_number, false)\n end",
"def remove_contact(options={})\n list_id = options.delete(:list_id)\n email = options.delete(:email)\n\n request_body = ''\n xml = Builder::XmlMarkup.new(:target => request_body, :indent => 1)\n\n xml.instruct!\n xml.Envelope do\n xml.Body do\n xml.RemoveRecipient do\n xml.LIST_ID list_id\n xml.EMAIL email unless email.nil?\n options.each do |field, value|\n xml.COLUMN do\n xml.NAME field.to_s\n xml.VALUE value.to_s\n end\n end\n end\n end\n end\n\n send_xml_api_request(request_body)\n true\n end",
"def remove_contact(list_id, email)\n endpoint = \"/api/v1/list/#{list_id}/remove-contact/\"\n base_params = base_params(endpoint)\n custom_params = {\n \"email\" => email\n }\n uri = post_api_uri(endpoint)\n http = setup_request(uri)\n result = http.post(uri.path, base_params.merge(custom_params).to_query)\n JSON.parse(result.body)\n end",
"def destroy\n @transaction_rule = @business.transaction_rules.find(params[:id])\n @transaction_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to business_transaction_rules_url(@business), notice: _(\"Regla eliminada\") }\n format.json { head :no_content }\n end\n end",
"def delete_forwarding_rule_with_http_info(identifier, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ForwardingRuleApi.delete_forwarding_rule ...\"\n end\n # verify the required parameter 'identifier' is set\n if @api_client.config.client_side_validation && identifier.nil?\n fail ArgumentError, \"Missing the required parameter 'identifier' when calling ForwardingRuleApi.delete_forwarding_rule\"\n end\n if @api_client.config.client_side_validation && opts[:'identifier_type'] && !['id', 'alias'].include?(opts[:'identifier_type'])\n fail ArgumentError, 'invalid value for \"identifier_type\", must be one of id, alias'\n end\n # resource path\n local_var_path = \"/v2/forwarding-rules/{identifier}\".sub('{' + 'identifier' + '}', identifier.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'identifierType'] = opts[:'identifier_type'] if !opts[:'identifier_type'].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 = ['GenieKey']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SuccessResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ForwardingRuleApi#delete_forwarding_rule\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def destroy\n @payin_rule = PayinRule.find_by(guid: params[:guid])\n\n if @payin_rule.destroy!\n head :ok\n else\n head :bad_request\n end\n end",
"def destroy\n #@rule = Rule.find(params[:id])\n @rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(rules_url) }\n format.xml { head :ok }\n end\n end",
"def remove_contact(list_id, email)\n endpoint = \"/api/#{@version}/list/#{list_id}/remove-contact/\"\n custom_params = {\n \"email\" => email\n }\n make_post_request(endpoint, custom_params)\n end",
"def remove_from_friends_list(email)\n send_contact_command email, 'RML', '1'\n end",
"def destroy\n @forwarding = Forwarding.find(params[:id])\n @forwarding.destroy\n\n respond_to do |format|\n format.html { redirect_to forwardings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n record = TaxRule.find(params[:id])\n record.trash\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @http_domain_rule = collection.find(params[:id])\n @http_domain_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to @core_application }\n format.json { head :ok }\n end\n end",
"def destroy\n @target_rule = TargetRule.find(params[:id])\n @target_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to target_rules_url }\n format.json { head :no_content }\n end\n end",
"def remove\n\t\t\tself.make_request!({uri: self.to_uri, method: :delete})\n\t\tend",
"def destroy\n @email = DirectEmail.find(params[:id])\n @email.destroy\n head :no_content\n end",
"def remove_rule request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/global/securityPolicies/#{request_pb.security_policy}/removeRule\"\n\n query_string_params = {}\n query_string_params[\"priority\"] = request_pb.priority.to_s if request_pb.priority && request_pb.priority != 0\n\n response = @client_stub.make_post_request(\n uri: uri,\n params: query_string_params,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end",
"def destroy\r\n @contact_rule = ContactRule.find(params[:id])\r\n @contact_rule.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to contact_rules_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @code_rule = CodeRule.find(params[:id])\n @code_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(code_rules_url) }\n format.xml { head :ok }\n end\n end",
"def del_from_rules(msg)\n if file_util(rules_file).remove_line(msg[2])\n reply = \"Removed lines from #{rules_file} mathing #{msg[2].inspect}.\"\n else\n reply = \"Lines mathing #{msg[2].inspect} were not found.\"\n end\n\n send_response(reply)\n end",
"def destroy\n @participant_contact_email = Participant::Contact::Email.find(params[:id])\n @participant_contact_email.destroy\n\n respond_to do |format|\n format.html { redirect_to(participant_contact_emails_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @email = Email.find(params[:id])\n @organizer = Organizer.find(params[:organizer_id])\n @email.destroy\n \n respond_to do |format|\n format.html { flash[:message]=\"email contact successfully deleted !\"\n redirect_to(organizer_emails_path(@organizer)) }\n format.xml { head :ok }\n end\n end",
"def delete(fw_rule)\n Dnet.fw_delete @handle, fw_rule\n end",
"def delete_rule(rule_id)\n request({\n 'Action' => 'DeleteRule',\n 'RuleArn' => rule_id,\n :parser => Fog::Parsers::AWS::ELBV2::Empty.new\n })\n end",
"def destroy\n @email_list = EmailList.find(params[:id])\n @email_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(email_lists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @user_mail = UserMail.find(params[:id])\n @user_mail.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_mails_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @reward_rule = RewardRule.find(params[:id])\n @reward_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to reward_rules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @numbering_rule = NumberingRule.find(params[:id])\n @numbering_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(numbering_rules_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @fundamental_retention_mail = Fundamental::RetentionMail.find(params[:id])\n @fundamental_retention_mail.destroy\n\n respond_to do |format|\n format.html { redirect_to fundamental_retention_mails_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @notification_rule.destroy\n respond_to do |format|\n format.html { redirect_to notification_rules_url, notice: 'Notification rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def clear_rules!(forward_to_replicas = false, request_options = {})\n res = clear_rules(forward_to_replicas, request_options)\n wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options)\n return res\n end",
"def remove_rule request_pb, options:, &block\n request_json = JSON.parse ::Google::Cloud::Compute::V1::RemoveRuleSecurityPolicyRequest.encode_json(request_pb)\n\n uri = \"/compute/v1/projects/#{request_pb.project}/global/securityPolicies/#{request_pb.security_policy}/removeRule\"\n\n result_json = @client_stub.make_post_request(\n uri: uri,\n options: options,\n &block\n )\n\n ::Google::Cloud::Compute::V1::Operation.decode_json result_json[:body], { ignore_unknown_fields: true }\n end",
"def destroy\n @mail_item = MailItem.find(params[:id])\n @mail_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(mail_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @delegate = Delegate.find_by_id(params[:id])\n @user = @delegate.user\n @delegate.update_attribute(:active, false)\n @delegate.delegations.each do |d|\n d.destroy\n DelegateMailer.delegation_forced_cancellation(d.user,@delegate).deliver\n end\n\n respond_to do |format|\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n end\n end",
"def rm(msgid)\n req(\"rm\", \"\", \"\", msgid, \"\")\n end",
"def destroy\n reminder = @reminder_rule.reminder\n @reminder_rule.destroy\n CountAllocator.new(reminder).allocate!\n\n respond_to do |format|\n format.html { redirect_to reminder, notice: 'Reminder rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider_fw_rule = ProviderFwRule.find(params[:id])\n @provider_fw_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to provider_fw_rules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n result = access_token.delete(\"/api/v1/emails/#{params[:id]}\")\n display_api_response( result )\n respond_with(\"\",:location => :back)\n end",
"def destroy\n @email = Email.find(params[:id])\n @email.destroy\n\n respond_to do |format|\n format.html { redirect_to(emails_url) }\n format.xml { head :ok }\n end\n end",
"def remove_notification\n \n @ac = AttachContact.find(params[:user_id])\n RecentActivity.create(:transaction_id => @transaction.id, \n :user_id => current_user.id, \n :message => \"Removed Contact: #{@ac.user.fullname} as #{@ac.role.name if @ac.role}\")\n \n render :nothing => true\n end",
"def destroy\n @convert_rule = ConvertRule.find(params[:id])\n @convert_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to convert_rules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @email_domain = Email::Domain.find(params[:id])\n @email_domain.destroy\n\n respond_to do |format|\n format.html { redirect_to(email_domains_url) }\n format.xml { head :ok }\n end\n end",
"def remove\n recipient_list_members.destroy_all\n if message_recipients.count.zero?\n destroy\n else\n self.removed = true\n save!\n end\n end",
"def destroy\n email_address.destroy\n flash[:notice] = 'The email address was successfully removed.'\n respond_with(email_address)\n end",
"def chimp_remove(options, delete_user=true, send_goodbye=false, send_notify=false)\n begin\n raise MailChimpAPI::DeleteError, \"Email and Mailing List Id can't be nil\" if (options[:email].nil? || options[:mailing_list_id].nil?)\n @client.call(\"listUnsubscribe\", @api_key, options[:mailing_list_id], options[:email], delete_user, send_goodbye, send_notify) \n rescue XMLRPC::FaultException => e\n raise MailChimpAPI::DeleteError, e.faultString\n end \n end",
"def remove(mailbox)\n delete(\"#{domain}/mailboxes/#{mailbox}\")\n end",
"def destroy\n @reachmailgroup = Reachmailgroup.find(params[:id])\n @reachmailgroup.destroy\n\n respond_to do |format|\n format.html { redirect_to reachmailgroups_url }\n format.json { head :no_content }\n end\n end",
"def delete!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 45 )\n\n type = DELETE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 166:10: 'delete'\n match( \"delete\" )\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__, 45 )\n\n end",
"def destroy\n operations_check = OperationsCheck.find(params[:operations_check_id])\n @mail_check = MailCheck.find(params[:id])\n @mail_check.destroy\n\n respond_to do |format|\n format.html { redirect_to operations_check_path(operations_check, tab: 'mail') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rule.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @rule.destroy\n respond_to do |format|\n format.html { redirect_to rules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipient = @user.recipients.find(params[:id])\n @recipient.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_recipients_path(@user)) }\n format.xml { head :ok }\n end\n end",
"def delete(recipient_email)\n recipient_email = @client.url_encode(recipient_email)\n @client.call(method: :delete, path: \"suppression-list/#{recipient_email}\")\n end",
"def domains_slaves_axfrout_delete(domain, axfrip)\n result = call('domains.slaves.axfrout.delete', :domain => domain, :axfrip => axfrip)\n result[:domain] ||= domain\n result\n end",
"def remove_from_allowed_list(email)\n send_contact_command email, 'RML', '2'\n end",
"def destroy\n @entry_mail = EntryMail.find(params[:id])\n @entry_mail.destroy\n \n respond_to do |format|\n format.html { redirect_to entry_mails_url }\n format.json { head :no_content }\n end\n end",
"def remove_followingcontest\n current_user.sk.followed_contests.destroy(@contest)\n \n flash[:success] = \"Vous ne recevrez maintenant plus d'e-mail concernant ce concours.\"\n redirect_to @contest\n end",
"def destroy\n @free_shipping_rule = FreeShippingRule.find(params[:id])\n @free_shipping_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_free_shipping_rules_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dataload_email = DataloadEmail.find(params[:id])\n @dataload_email.destroy\n\n respond_to do |format|\n format.html { redirect_to dataload_emails_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mailfetch = Mailfetch.find(params[:id])\n @mailfetch.destroy\n\n respond_to do |format|\n format.html { redirect_to(mailfetches_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @test_rule.destroy\n respond_to do |format|\n format.html { redirect_to test_rules_url, notice: 'Test rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def unfollow\r\n @relationship = Relationship.where(follower_id: current_user.id, followed_id: params[:followed_id]).first\r\n @relationship.create_activity key: 'relationship.unfollow', owner: current_user, recipient: User.find(params[:followed_id]) \r\n @relationship.destroy\r\n render json: { message: \"Relationship destroyed successfully\" }\r\n end",
"def destroy\n @rule.destroy\n respond_to do |format|\n format.html { redirect_to rules_url, notice: 'Rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rule.destroy\n respond_to do |format|\n format.html { redirect_to rules_url, notice: 'Rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def remove list\n list_action list, \"remove\"\n end",
"def remove_from_mailchimp(list_name)\n apikey ||= chimpLogin(monkeybrains[:username], monkeybrains[:password])\n list_id ||= find_mailing_list(apikey, list_name)\n chimpUnsubscribe(apikey, list_id[\"id\"], self[email_column])\n rescue XMLRPC::FaultException\n end",
"def destroy\n @info_parser_rule = InfoParserRule.find(params[:id])\n @info_parser_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to info_parser_rules_url }\n format.json { head :no_content }\n end\n end",
"def delete(email, list_id = nil)\n query = \"email=#{CGI.escape(email)}\"\n query += \"&list_id=#{list_id}\" if list_id\n\n del \"#{@endpoint}?#{query}\", nil\n end",
"def ftp_remove path\n return ftp_action(true, path)\n end",
"def destroy\n @email = Email.find(params[:id])\n @email.destroy\n head :no_content\n end",
"def destroy\n @rule_type = RuleType.find(params[:id])\n @rule_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(rule_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @fdn_received_message = Fdn::ReceivedMessage.find(params[:id])\n #@fdn_received_message.destroy\n @fdn_received_message.be_trashed(current_user)\n\n respond_to do |format|\n format.html { redirect_to fdn_messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gstr_advance_receipts = GstrAdvanceReceipt.find_by_id_and_company_id(params[:id], @company.id)\n @gstr_advance_receipts.delete_gstr_one_entry \n @gstr_advance_receipts.delete\n respond_to do |format|\n @gstr_advance_receipts.register_delete_action(request.remote_ip, @current_user, 'deleted')\n format.html { redirect_to(gstr_advance_receipts_url, :notice =>\"Gstr Advance Receipt has been succesfully deleted\") }\n format.xml {head :ok}\n \n end\n end",
"def delete(actor)\n @links.delete actor.mailbox.address\n end",
"def destroy\n @obligation_rule = ObligationRule.find(params[:id])\n @obligation_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to obligation_rules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prd_attribute = PrdAttribute.find(params[:id])\n @prd_attribute.destroy\n\n #delete_rules()\n\n respond_to do |format|\n format.html { redirect_to(prd_attributes_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def deliver_security_notification_destroy\n deliver_security_notification(\n recipients: [address],\n message: :mail_body_security_notification_remove,\n field: :field_mail,\n value: address\n )\n end",
"def destroy\n @email = @user.emails.find(params[:id])\n @email.destroy\n\n respond_to do |format|\n format.html { redirect_to emails_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mailinglist = Mailinglist.find(params[:id])\n @mailinglist.destroy\n\n respond_to do |format|\n format.html { redirect_to(mailinglists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @emailcontact = Emailcontact.find(params[:id])\n @emailcontact.destroy\n\n respond_to do |format|\n format.html { redirect_to(emailcontacts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @received_issue = ReceivedIssue.find(params[:id])\n contact = @received_issue.contact\n contact.issues_remaining = contact.issues_remaining - 1\n contact.update_attributes(params[:contact])\n @received_issue.destroy\n\n respond_to do |format|\n format.html { redirect_to(received_issues_url) }\n format.xml { head :ok }\n end\n \n end",
"def destroy\n @mail = Mail.find(params[:id])\n @mail.destroy\n\n respond_to do |format|\n format.html { redirect_to(mails_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @mail = Mail.find(params[:id])\n @mail.destroy\n\n respond_to do |format|\n format.html { redirect_to(mails_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @email_user = Email::User.find(params[:id])\n @email_user.destroy\n\n respond_to do |format|\n format.html { redirect_to(email_users_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @contact_us_email = ContactUsEmail.find(params[:id])\n @contact_us_email.destroy\n\n respond_to do |format|\n format.html { redirect_to(contact_us_emails_url) }\n format.xml { head :ok }\n end\n end"
] |
[
"0.62917656",
"0.6098368",
"0.5955882",
"0.5932887",
"0.5835132",
"0.57444125",
"0.57317466",
"0.57110476",
"0.5705981",
"0.5676933",
"0.56649",
"0.5634626",
"0.5616452",
"0.56115717",
"0.56015515",
"0.5593104",
"0.55889994",
"0.5573354",
"0.5528151",
"0.5524846",
"0.5507042",
"0.5506917",
"0.5447852",
"0.544712",
"0.5433319",
"0.54290134",
"0.5407836",
"0.54043317",
"0.5395041",
"0.537106",
"0.5366215",
"0.5361812",
"0.53601736",
"0.5348524",
"0.5338734",
"0.53238326",
"0.5319639",
"0.5313624",
"0.5310209",
"0.53076786",
"0.5286581",
"0.52813685",
"0.5271867",
"0.5269964",
"0.5247874",
"0.52343535",
"0.5227676",
"0.5221261",
"0.5213741",
"0.52128553",
"0.52113426",
"0.52067715",
"0.5196495",
"0.51841736",
"0.5183908",
"0.51794964",
"0.5177355",
"0.5171501",
"0.51569647",
"0.515683",
"0.51463735",
"0.5144136",
"0.51363593",
"0.5135045",
"0.5134754",
"0.5130256",
"0.51236457",
"0.51167977",
"0.51161575",
"0.5103152",
"0.5102509",
"0.5100514",
"0.5097776",
"0.5088903",
"0.5088494",
"0.50828797",
"0.50810033",
"0.50790435",
"0.50790435",
"0.5074368",
"0.5072099",
"0.5067849",
"0.5067842",
"0.5067142",
"0.50664526",
"0.5057258",
"0.505561",
"0.50551283",
"0.5054536",
"0.50544983",
"0.5050889",
"0.5050652",
"0.504564",
"0.50417066",
"0.5040192",
"0.50397325",
"0.5039325",
"0.5039325",
"0.5037259",
"0.50324744"
] |
0.66377723
|
0
|
/Domain/EmailForward/Update The command is intended to add a new Email Forwarding rule. Returned data: STATUS=SUCCESS or FAILURE TRANSACTID=Transaction ID Example return data: transactid=5c6690939950db9fad0a667eef0ebd8e status=SUCCESS
|
def update_email_forward(source, destination)
validate_list([["Source", source, :email],
["Destination", destination, :email]
])
options = {
"Source" => source,
"Destination" => destination
}
connection = Connection.new
connection.post("Domain/EmailForward/Update", options)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def updateAnsweringRuleOnRoutingExt(client, accountId, extensionId, answeringRuleId, forwardingNumberId)\n body = {\n 'enabled' => true,\n 'forwarding' => {\n 'notifyMySoftPhones' => true,\n 'softPhonesRingCount' => 5,\n 'ringingMode' => 'Sequentially',\n 'rules': [{\n 'index': 1,\n 'ringCount': 3,\n 'forwardingNumbers' => [{\n 'id' => forwardingNumberId\n }],\n }]\n }\n }\n client.http.put do |req|\n req.url \"account/#{accountId}/extension/#{extensionId}/answering-rule/#{answeringRuleId}\"\n req.headers['Content-Type'] = 'application/json'\n req.body = body\n end\nend",
"def update_forwarding_rule(identifier, body, opts = {})\n data, _status_code, _headers = update_forwarding_rule_with_http_info(identifier, body, opts)\n return data\n end",
"def update\n @forwarding = Forwarding.find(params[:id])\n\n respond_to do |format|\n if @forwarding.update_attributes(params[:forwarding])\n format.html { redirect_to @forwarding, notice: 'Forwarding was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @forwarding.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @forward = Forward.find(params[:id])\n\n respond_to do |format|\n if @forward.update_attributes(params[:forward])\n format.html { redirect_to(@forward, :notice => 'Forward was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @forward.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @forwarding_url = args[:forwarding_url] if args.key?(:forwarding_url)\n end",
"def update\n @inbound_email = InboundEmail.find(params[:id])\n\n respond_to do |format|\n if @inbound_email.update_attributes(params[:inbound_email])\n format.html { redirect_to(@inbound_email, :notice => 'Inbound email was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inbound_email.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @email = DirectEmail.find(params[:id])\n if @email.update_attributes(params[:direct_email])\n head :no_content\n else\n respond_with @email, status: :unprocessable_entity\n end\n end",
"def update_forwarding_rule_with_http_info(identifier, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ForwardingRuleApi.update_forwarding_rule ...\"\n end\n # verify the required parameter 'identifier' is set\n if @api_client.config.client_side_validation && identifier.nil?\n fail ArgumentError, \"Missing the required parameter 'identifier' when calling ForwardingRuleApi.update_forwarding_rule\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling ForwardingRuleApi.update_forwarding_rule\"\n end\n if @api_client.config.client_side_validation && opts[:'identifier_type'] && !['id', 'alias'].include?(opts[:'identifier_type'])\n fail ArgumentError, 'invalid value for \"identifier_type\", must be one of id, alias'\n end\n # resource path\n local_var_path = \"/v2/forwarding-rules/{identifier}\".sub('{' + 'identifier' + '}', identifier.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'identifierType'] = opts[:'identifier_type'] if !opts[:'identifier_type'].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 = @api_client.object_to_http_body(body)\n auth_names = ['GenieKey']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SuccessResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ForwardingRuleApi#update_forwarding_rule\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update!(**args)\n @rule_actions_pairs = args[:rule_actions_pairs] if args.key?(:rule_actions_pairs)\n end",
"def create\n # Remove old email\n if current_user.forward_address?\n logger.info { \"Removing old email forwarding: #{current_user.forward_address}\" }\n @email_server.delete(current_user.forward_address)\n end\n\n # Add email in Gandi\n begin\n @email_server.create(email_params[:forward_address], { 'destinations' => [email_params[:forward_destination]] })\n rescue LibXML::XML::XMLRPC::RemoteCallError => e\n respond_to do |format|\n error = Gandi::parse_error(e.message)\n logger.info { \"Email forwarding creation error: #{error}\" }\n format.html { redirect_to root_path, alert: \"Couldn't create email forwarding '#{email_params[:forward_destination]}': #{error}.\" }\n format.json { head :no_content, status: :unprocessable_entity }\n end\n return\n end\n\n msg = \"Email forwarding created from #{email_params[:forward_address]}@#{@email_domain} to #{email_params[:forward_destination]}\"\n logger.info { msg }\n\n # Update user with new email\n logger.info { \"Updating user with new email forwarding: #{email_params.inspect}\" }\n current_user.update(email_params)\n\n respond_to do |format|\n format.html { redirect_to root_path, notice: msg }\n format.json { head :no_content }\n end\n end",
"def update\n if @rule.update(rule_params)\n respond_with(@rule, location: rules_url, notice: 'Rule was successfully updated.')\n else\n respond_with(@rule)\n end\n end",
"def update\n @message.require_recipient = true\n respond_to do |format|\n if @message.update(message_params)\n recipient_user_id = @message.recipient_user_id\n forward_note = @message.fwd_note\n forward_note = t('messages.default_forward_note') if ((forward_note.nil?) || (forward_note == '')) # \"Forwarded message\"\n new_message = @message.dup\n if new_message.save\n new_message.update_attributes(owner_user_id: recipient_user_id,\n forwarded_message_id: @message.id,\n read: false,\n forward_note: forward_note,\n copied_message_id: @message.id)\n new_message.recipient_users.create(user_id: recipient_user_id)\n end\n if session[:messaging_context] == :index\n format.html { redirect_to messages_path, notice: t('messages.update') } # \"Message was successfully forwarded.\"\n format.json { head :no_content }\n elsif session[:messaging_context] == :mailbox_out\n format.html { redirect_to mailbox_out_messages_path, notice: t('messages.update') } # \"Message was successfully forwarded.\"\n format.json { head :no_content }\n else\n format.html { redirect_to mailbox_in_messages_path, notice: t('messages.update') } # \"Message was successfully forwarded.\"\n format.json { head :no_content }\n end\n else\n format.html { render action: 'edit' }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if actions = params[:http_domain_rule].try(:[], :actions)\n actions = JSON.load(actions) if String === actions\n params[:http_domain_rule][:actions] = actions\n end\n\n @http_domain_rule = collection.find(params[:id])\n\n respond_to do |format|\n if @http_domain_rule.update_attributes(params[:http_domain_rule])\n format.html do\n flash[:success] = 'Domain rule was successfully updated.'\n redirect_to @core_application\n end\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @http_domain_rule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_inbound_rule(rule_number, protocol, rule_action, cidr_block, options = {})\n update_rule(rule_number, protocol, rule_action, cidr_block, false, options)\n end",
"def update_forwards(old_owner, req)\n new_owner = req.employee\n\n if new_owner == old_owner\n return\n end\n\n old_forwards = old_owner.forwards.find_all { |f| \n f.status == \"FORWARDED\" && f.requirements.include?(req)\n }\n\n # hash the forwards by resumes so we do not need to do a\n # a linear search later\n resume_to_forward_hash = {}\n new_owner.forwards.each do |f|\n resume_to_forward_hash[f.resume] = f\n end\n\n old_forwards.each do |of|\n r = of.resume \n if resume_to_forward_hash[r]\n f = resume_to_forward_hash[r]\n f.requirements << req unless f.requirements.include?(req) \n else\n f = Forward.new(:forwarded_to => new_owner,\n :forwarded_by => of.forwarded_by,\n :resume => r,\n :status => \"FORWARDED\",\n :requirements => [req])\n end\n f.save!\n end\n\n # Remove req from forward, and delete the forward completely\n # if it becomes empty\n old_forwards.each do |f|\n f.requirements.delete(req)\n if f.requirements.size == 0\n f.destroy\n end\n end\n end",
"def update_outbound_rule(rule_number, protocol, rule_action, cidr_block, options = {})\n update_rule(rule_number, protocol, rule_action, cidr_block, true, options)\n end",
"def update_rule(rule_number, protocol, rule_action, cidr_block, egress, options = {})\n requires :network_acl_id\n\n service.replace_network_acl_entry(network_acl_id, rule_number, protocol, rule_action, cidr_block, egress, options)\n true\n end",
"def update\n @inbound_email_log = InboundEmailLog.find(params[:id])\n\n respond_to do |format|\n if @inbound_email_log.update_attributes(params[:inbound_email_log])\n format.html { redirect_to(@inbound_email_log, :notice => 'Inbound email log was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inbound_email_log.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @free_shipping_rule = FreeShippingRule.find(params[:id])\n\n respond_to do |format|\n if @free_shipping_rule.update_attributes(params[:free_shipping_rule])\n format.html { redirect_to([:admin,@free_shipping_rule], :notice => 'Free shipping rule was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @free_shipping_rule.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @error = args[:error] if args.key?(:error)\n @rule = args[:rule] if args.key?(:rule)\n end",
"def update\n #@rule = Rule.find(params[:id])\n\n respond_to do |format|\n if @rule.update_attributes(rule_params)\n format.html { redirect_to(@rule, :notice => 'Rule was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rule.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\r\n @contact_rule = ContactRule.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @contact_rule.update_attributes(params[:contact_rule])\r\n format.html { redirect_to @contact_rule, notice: 'Contact rule was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @contact_rule.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @attend_rule.update(attend_rule_params.tap{|t|Rails.logger.info(\"-------#{t.inspect}\")})\n flash[:notice] = \"操作成功\"\n format.html { redirect_to :back }\n format.json { render :show, status: :ok, location: @attend_rule }\n else\n format.html { render :edit }\n format.json { render json: @attend_rule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @action = args[:action] if args.key?(:action)\n @direction = args[:direction] if args.key?(:direction)\n @display_name = args[:display_name] if args.key?(:display_name)\n @firewall_rule_type = args[:firewall_rule_type] if args.key?(:firewall_rule_type)\n @network_uri = args[:network_uri] if args.key?(:network_uri)\n @policy = args[:policy] if args.key?(:policy)\n @priority = args[:priority] if args.key?(:priority)\n @target_service_accounts = args[:target_service_accounts] if args.key?(:target_service_accounts)\n @target_tags = args[:target_tags] if args.key?(:target_tags)\n @uri = args[:uri] if args.key?(:uri)\n end",
"def update\n @email_domain = Email::Domain.find(params[:id])\n\n respond_to do |format|\n if @email_domain.update_attributes(params[:email_domain])\n format.html { redirect_to(@email_domain, :notice => 'Domain was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @email_domain.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @route_rule = RouteRule.find(params[:id])\n\n respond_to do |format|\n if @route_rule.update_attributes(params[:route_rule])\n flash[:notice] = 'RouteRule was successfully updated.'\n format.html { redirect_to(@route_rule) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @route_rule.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @target_rule = TargetRule.find(params[:id])\n\n respond_to do |format|\n if @target_rule.update_attributes(params[:target_rule])\n format.html { redirect_to @target_rule, notice: 'Target rule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @target_rule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @numbering_rule = NumberingRule.find(params[:id])\n\n respond_to do |format|\n if @numbering_rule.update_attributes(params[:numbering_rule])\n flash[:notice] = 'NumberingRule was successfully updated.'\n format.html { redirect_to(@numbering_rule) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @numbering_rule.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @forward_inbound_credentials = args[:forward_inbound_credentials] if args.key?(:forward_inbound_credentials)\n @triggers = args[:triggers] if args.key?(:triggers)\n end",
"def update\n @reward_rule = RewardRule.find(params[:id])\n\n respond_to do |format|\n if @reward_rule.update_attributes(params[:reward_rule])\n format.html { redirect_to @reward_rule, notice: 'Reward rule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reward_rule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @field_rule.update(field_rule_params)\n format.html { redirect_to object_rule_field_rule_url, notice: ' field rule was successfully updated.' }\n format.json { render :show, status: :ok, location: @field_rule }\n else\n format.html { render :edit }\n format.json { render json: @field_rule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n source = 'web'\n\n # get the parameters from the POST\n if params[:Body].present? && params[:From].present?\n # SMS message from Twilio received to webhook\n if params[:Body][0..2] == '999'\n # SMS request for status - NOT an update\n unique_id = params[:Body][3, (params[:Body].length - 3)]\n @result = 'status of'\n else\n unique_id = params[:Body].chop\n status = params[:Body][unique_id.length]\n end\n source = params[:From]\n elsif params[:destination].present? && params[:destination][:unique_id].present? \n # update from the Web \n unique_id = params[:destination][:unique_id]\n status = params[:destination][:current_status]\n else\n @result = \"unknown\"\n end\n\n # find the destination from the parameters\n destination = Destination.find_by_unique_id(unique_id) unless @result == \"unknown\"\n\n # make the update if there is one\n if destination.nil?\n @result = \"unknown\"\n elsif source != 'web' && !authorized(destination, source)\n @result = \"denied\"\n elsif @result != 'status of'\n # we have an update, NOT a status request\n unless destination.current_status.nil?\n #save current values in history\n update = destination.updates.new\n update.source = destination.source \n update.reported_at = destination.current_report_time \n update.status = destination.current_status\n update.save\n end\n destination.current_status = status \n destination.source = source\n destination.current_report_time = Time.now\n destination.save\n @result = \"updated\"\n end\n\n # send a reply SMS if one is called for\n if source == 'web'\n # Web update (there are no Web status requests)\n if @result == \"unknown\"\n redirect_to :controller => 'destination', :action => 'observation' and return\n else\n redirect_to :controller => 'destination', :action => 'observation', :result => @result, :unique_id => destination.unique_id and return\n end\n else\n # SMS update or status request\n if @result == \"denied\"\n @text = \"update to #{unique_id} #{@result}\"\n elsif @result == \"unknown\"\n @text = \"#{unique_id}: #{@result}\"\n elsif @result == 'status of'\n @text = \"#{@result} for #{unique_id} is #{destination.current_status}\"\n else\n # if this was an update, do NOT send reply\n @text = ''\n end\n response.content_type = 'text/plain'\n render :text => @text and return\n end\n\n end",
"def update!(**args)\n @action_outputs = args[:action_outputs] if args.key?(:action_outputs)\n @rule = args[:rule] if args.key?(:rule)\n end",
"def update\n @convert_rule = ConvertRule.find(params[:id])\n\n respond_to do |format|\n if @convert_rule.update_attributes(params[:convert_rule])\n format.html { redirect_to @convert_rule, notice: 'Convert rule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @convert_rule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_email_updates\n get_email = FollowerFollowing.where('follower_id=? and following_id=?', @login_user.id, params[:id]).first\n get_email.update_attributes(:get_email_updates => !get_email.get_email_updates)\n redirect_to \"/users/profile/#{params[:id]}\"\n end",
"def domain_update(args)\n response = send_request(domain_update_xml(args))\n\n get_result(response)\n end",
"def update!(**args)\n @cast_linking_status = args[:cast_linking_status] if args.key?(:cast_linking_status)\n @truncated_error_msg = args[:truncated_error_msg] if args.key?(:truncated_error_msg)\n end",
"def update_notification_rule(opts = {})\n data, _status_code, _headers = update_notification_rule_with_http_info(opts)\n data\n end",
"def update!(**args)\n @emails = args[:emails] if args.key?(:emails)\n @instruction = args[:instruction] if args.key?(:instruction)\n @uris = args[:uris] if args.key?(:uris)\n end",
"def update\n @rule = Rule.find(params[:id])\n\t@account = Account.find(params[:account_id])\n params[:rule][:pocket_id] = params[:prefix][:pocket_id]\n respond_to do |format|\n if params[:commit].eql?('Cancel') || @rule.update_attributes(params[:rule])\n format.html { redirect_to(account_rules_url(@account)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rule.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @email = @user.emails.find(params[:id])\n\n respond_to do |format|\n if @email.update_attributes(params[:email])\n format.html { redirect_to [@game, @user, @email], notice: 'Email was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @email.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @firewall_policy = args[:firewall_policy] if args.key?(:firewall_policy)\n @rule_priority = args[:rule_priority] if args.key?(:rule_priority)\n end",
"def update\n @participant_contact_email = Participant::Contact::Email.find(params[:id])\n\n respond_to do |format|\n if @participant_contact_email.update_attributes(params[:participant_contact_email])\n format.html { redirect_to(@participant_contact_email, :notice => 'Email was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @participant_contact_email.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @email = Email.find(params[:id])\n\n respond_to do |format|\n if @email.update_attributes(params[:email])\n flash[:notice] = 'Email was successfully updated.'\n format.html { redirect_to(@email) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @email.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @dataload_email = DataloadEmail.find(params[:id])\n\n respond_to do |format|\n if @dataload_email.update_attributes(params[:dataload_email])\n format.html { redirect_to @dataload_email, notice: 'Dataload email was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dataload_email.errors, status: :unprocessable_entity }\n end\n end\n end",
"def hr_forwards\n\t params[:req_status].each do |f|\n\t cur_emp = get_logged_employee\n\t\t @forwards = Forward.new\n\t\t\t@forwards.create_forwards( cur_emp, params[:r_id], \"FORWARDED\", f )\n\t\t @comment = Comment.new\n\t\t\treq_name = Requirement.find(f)\n\t\t\tcomment = \"FORWARDED TO: \" + \"\" + req_name.employee.name + \" For \" + \"\" + req_name.name + \". No coments added while forwarding.\" \n\t\t resume_id = params[:r_id]\n\t\t type = \"INTERNAL\"\n\t\t @comment.create_comment(comment, resume_id, cur_emp.eid, type)\n\t end\n respond_to do |format|\n flash[:success] = \"successfully forwarded the resume.\"\n\t \tresume = Resume.find(params[:r_id])\n\t\t n_forwards = resume.nforwards + 1 #params[:req_status].size\n\t resume.update_columns(:nforwards => n_forwards)\n\t\tend\n\tend",
"def update\n @email_update = EmailUpdate.find(params[:id])\n\n respond_to do |format|\n if @email_update.update_attributes(params[:email_update])\n format.html { redirect_to @email_update, notice: 'Email update was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @email_update.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rule.update(rule_params)\n format.json { render :show, status: :ok, location: @rule }\n else\n format.json { render json: @rule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @recipient_emails = args[:recipient_emails] if args.key?(:recipient_emails)\n @role = args[:role] if args.key?(:role)\n @should_fix = args[:should_fix] if args.key?(:should_fix)\n end",
"def update\n @context_rule = ContextRule.find(params[:id])\n\n respond_to do |format|\n if @context_rule.update_attributes(params[:context_rule])\n format.html { redirect_to(@context_rule, :notice => 'Context rule was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @context_rule.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_ttl(check_id, status, output = nil, options = {})\n definition = JSON.generate(\n 'Status' => status,\n 'Output' => output\n )\n ret = send_put_request(@conn, [\"/v1/agent/check/update/#{check_id}\"], options, definition)\n ret.status == 200\n end",
"def domain_update(args)\n if args.key?(:chg) && args[:chg].key?(:registrant)\n raise ArgumentError, 'You need to do a trade or recover operation to change the registrant'\n end\n has_contacts = args.key?(:add) && args[:add].key?(:contacts) || args.key?(:add) && args[:add].key?(:contacts)\n has_ns = args.key?(:add) && args[:add].key?(:ns) || args.key?(:add) && args[:add].key?(:ns)\n has_other = args.key?(:add) && args[:add].key?(:status) || args.key?(:add) && args[:add].key?(:status) || args.key?(:chg) && args[:chg].key?(:authInfo)\n if [has_contacts, has_ns, has_other].count { |v| v } > 1\n raise ArgumentError, \"You can't update all that at one time\"\n end\n [:add, :rem].each do |ar|\n if args.key?(ar) && args[ar].key?(:ns) && args[ar][:ns].first.is_a?(String)\n args[ar][:ns] = args[ar][:ns].map { |ns| { :hostName => ns } }\n end\n end\n super\n end",
"def update\n flash.keep\n\n respond_to do |format|\n if @rule.update_attributes(params[:rule])\n\n format.html { redirect_to pattern_rules_url(@pattern), :flash => {:success => 'Successfully updated the Rule.' }}\n format.json { render :json => @rule }\n else\n log_message << @rule.errors.full_messages.to_s unless @rule.nil? || @rule.errors.nil? || @rule.errors.full_messages.nil?\n logger.error(log_message)\n logger.debug(e.backtrace)\n\n error_message = \"Failed to update the specified Rule.\"\n format.html { redirect_to pattern_rules_url(@pattern), :flash => {:error => error_message} }\n format.json { render :json => @rule, :status => :unprocessable_entity }\n end\n end\n end",
"def modify_rule(rule_id, actions, conditions)\n params = {}\n\n params.merge!(Fog::AWS.serialize_keys('Actions', actions))\n params.merge!(Fog::AWS.serialize_keys('Conditions', conditions))\n\n request({\n 'Action' => 'ModifyRule',\n 'RuleArn' => rule_id,\n :parser => Fog::Parsers::AWS::ELBV2::ModifyRule.new\n }.merge(params))\n end",
"def update\n respond_to do |format|\n if @rule.update(rule_params)\n format.html { redirect_to @rule, notice: 'Rule was successfully updated.' }\n format.json { render :show, status: :ok, location: @rule }\n else\n format.html { render :edit }\n format.json { render json: @rule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(id, rule)\n rule = fix_conditions(rule)\n @rule = Rule.get(id)\n raise NotFound unless @rule\n if @rule.update(rule)\n redirect resource(@rule)\n else\n display @rule, :edit\n end\n end",
"def update\n respond_to do |format|\n if @notification_rule.update(notification_rule_params)\n format.html { redirect_to notification_rules_path, notice: 'Notification rule was successfully updated.' }\n format.json { render :show, status: :ok, location: @notification_rule }\n else\n format.html { render :edit }\n format.json { render json: @notification_rule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @invalid_rules = args[:invalid_rules] if args.key?(:invalid_rules)\n @matched_rules = args[:matched_rules] if args.key?(:matched_rules)\n @triggered_rules = args[:triggered_rules] if args.key?(:triggered_rules)\n end",
"def update\n respond_to do |format|\n if @rule.update(rule_params)\n format.html { redirect_to @rule, notice: 'Rule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @anchors_dropped = args[:anchors_dropped] if args.key?(:anchors_dropped)\n @domain = args[:domain] if args.key?(:domain)\n end",
"def update\n respond_to do |format|\n if @rule.update(rule_params)\n format.html { redirect_to @rule, notice: 'Rule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n record = TaxRule.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 @route = Route.find(params[:id])\n\n respond_to do |format|\n if @route.update_attributes(params[:route])\n # UserMailer.welcome_email(@user).deliver\n format.html { redirect_to(@route, :notice => 'Route was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @route.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @posting_rule = PostingRule.find(params[:id])\n\n respond_to do |format|\n if @posting_rule.update_attributes(permitted_params(@posting_rule).posting_rule)\n format.html { redirect_to @posting_rule, notice: 'Posting rule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @posting_rule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @rules = args[:rules] if args.key?(:rules)\n end",
"def update!(**args)\n @rules = args[:rules] if args.key?(:rules)\n end",
"def update\n @entity_end_point_rel = EntityEndPointRel.find(params[:id])\n\n respond_to do |format|\n if @entity_end_point_rel.update_attributes(params[:entity_end_point_rel])\n format.html { redirect_to(@entity_end_point_rel, :notice => 'Entity end point rel was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entity_end_point_rel.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @transaction_rule = @business.transaction_rules.find(params[:id])\n\n respond_to do |format|\n if @transaction_rule.update_attributes(transaction_rule_params || {})\n format.html { redirect_to business_transaction_rules_path(@business), notice: _(\"Regla actualizada\") }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @transaction_rule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @code_rule = CodeRule.find(params[:id])\n\n respond_to do |format|\n if @code_rule.update_attributes(params[:code_rule])\n flash[:notice] = 'CodeRule was successfully updated.'\n format.html { redirect_to(@code_rule) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @code_rule.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @talk = Talk.find(params[:id])\n if (params[:email] != @talk.contact.email) then \n \tContact.update(@talk.contact_id,{:email=>params[:email]})\n \t@talk.contact.email = params[:email]\n end\t\n respond_to do |format|\n if @talk.update_attributes(params[:talk])\n flash[:notice] = 'Talk was successfully updated.'\n #format.html { redirect_to(@talk) }\n format.html { redirect_to :back }\n #format.html { render :action => \"show\" }\n format.xml { head :ok }\n else\n format.html { render :action => \"show\" }\n format.xml { render :xml => @talk.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @email_tracker = EmailTracker.find(params[:id])\n\n respond_to do |format|\n if @email_tracker.update_attributes(params[:email_tracker])\n flash[:notice] = 'EmailTracker was successfully updated.'\n format.html { redirect_to(@email_tracker) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @email_tracker.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @email_list = EmailList.find(params[:id])\n\n respond_to do |format|\n if @email_list.update_attributes(params[:email_list])\n format.html { redirect_to(@email_list, :notice => 'Email list was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @email_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @email_user = Email::User.find(params[:id])\n\n respond_to do |format|\n if @email_user.update_attributes(params[:email_user])\n format.html { redirect_to(@email_user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @email_user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @email = EventEmail.find(params[:id])\n if @email.update_attributes(params[:event_email])\n head :no_content\n else\n respond_with @email, status: :unprocessable_entity\n end\n end",
"def update\n @email = Email.find(params[:id])\n if @email.update_attributes(params[:event_email])\n respond_with @email\n else\n respond_with @email, status: :unprocessable_entity\n end\n end",
"def update\n remove_email_dependencies\n migrate_template_to_email\n respond_to do |format|\n if @email.save\n build_emails\n format.html {redirect_to emails_url, notice: 'Email was updated.'}\n format.json {render :index, status: :ok }\n else\n format.html {render :edit}\n format.json {render json: @email.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n @email.update(valid_params)\n json_response(@email)\n end",
"def update\n @referral = Referral.find(params[:id])\n\n respond_to do |format|\n if @referral.update_attributes(params[:referral])\n format.html { redirect_to(@referral, :notice => 'Referral was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @referral.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @certificate_rule.update(certificate_rule_params)\n format.html { redirect_to @certificate_rule, notice: 'Certificate rule was successfully updated.' }\n format.json { render :show, status: :ok, location: @certificate_rule }\n else\n format.html { render :edit }\n format.json { render json: @certificate_rule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @email.update_attributes(params[:email])\n flash[:notice] = 'Email was successfully updated.'\n format.html { redirect_to(@email) }\n format.mobile { redirect_to profile_kontact_kontact_information_plural_fields_path(@profile, @kontact)}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.mobile { render :action => \"edit\" }\n format.xml { render :xml => @email.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @fundamental_retention_mail = Fundamental::RetentionMail.find_by_identifier(params[:id])\n\n respond_to do |format|\n if !@fundamental_retention_mail.nil? && !@fundamental_retention_mail.redeem_credit_reward\n format.html { redirect_to @fundamental_retention_mail, notice: 'Retention mail was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fundamental_retention_mail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @NewsletterSignup = NewsletterSignup.find(params[:id])\n\n respond_to do |format|\n if @NewsletterSignup.update_attributes(params[:newsletter_signup])\n add_message = 'NewsletterSignup was successfully updated.'\n format.html { redirect_to(@NewsletterSignup.object) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @NewsletterSignup.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test_rule.update(test_rule_params)\n format.html { redirect_to @test_rule, notice: 'Test rule was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_rule }\n else\n format.html { render :edit }\n format.json { render json: @test_rule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def plugin_rule_update(rule_id, plugin_id, type, host, opts = {} )\n post_data = {\n :rule_id => rule_id,\n :plugin_id => plugin_id,\n :type => type,\n :host => host\n }\n nessus_rest_post(\"plugin-rules/#{rule_id}\",post_data.merge(validate_options(opts)))\n end",
"def update\n @user_mail = UserMail.find(params[:id])\n\n respond_to do |format|\n if @user_mail.update_attributes(params[:user_mail])\n format.html { redirect_to(@user_mail, :notice => 'User mail was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_mail.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def the_update_redirect\n #return {:controller => :recipients, :action => 'show', :id => @recipient} if @recipient\n return {:action => 'index'}\n end",
"def update\n @referral = Referral.find(params[:id])\n\n respond_to do |format|\n if @referral.update_attributes(params[:referral])\n flash[:notice] = 'Referral was successfully updated.'\n format.html { redirect_to(@referral) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @referral.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @fixability = args[:fixability] if args.key?(:fixability)\n @fixable_email_address = args[:fixable_email_address] if args.key?(:fixable_email_address)\n @out_of_domain_warning_email_address = args[:out_of_domain_warning_email_address] if args.key?(:out_of_domain_warning_email_address)\n end",
"def update!(**args)\n @error = args[:error] if args.key?(:error)\n @firewall_policy = args[:firewall_policy] if args.key?(:firewall_policy)\n end",
"def update_rules\n create_update_rules\n end",
"def update\n respond_to do |format|\n if @email_lead.update(email_lead_params)\n format.html { redirect_to @email_lead, notice: 'Email lead was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @email_lead.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @apply = Apply.find(params[:id])\n\t# 添加了活动\n\t@campaign = Campaign.find(params[:campaign_id])\n respond_to do |format|\n if @apply.update_attributes(params[:apply])\n format.html { redirect_to campaign_applies_path }\n\t\t#format.html { redirect_to(@campaign.applies, :notice => 'Apply was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @apply.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_fax_request(fax_request,response)\n fax_request.update_attributes(\n status: response[\"isSuccess\"],\n message: response[\"message\"],\n SendFaxQueueId: response[\"SendFaxQueueId\"]\n )\n end",
"def update\n respond_to do |format|\n if @template_rule.update(template_rule_params)\n format.html { redirect_to @template_rule, notice: 'Template rule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @template_rule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @price_rule = PriceRule.find(params[:id])\n\n respond_to do |format|\n if @price_rule.update_attributes(params[:price_rule])\n flash[:notice] = 'PriceRule was successfully updated.'\n format.html { redirect_to(@price_rule) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @price_rule.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @action_routine.update(action_routine_params)\n redirect_to [project, exaction, @hp_condition]\n end",
"def update\n @mail_check = MailCheck.find(params[:id])\n\n respond_to do |format|\n if @mail_check.update_attributes(mail_check_params)\n format.html { redirect_to @mail_check, notice: 'Mail check was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mail_check.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post302 = Post302.find(params[:id])\n\n respond_to do |format|\n if @post302.update_attributes(params[:post302])\n format.html { redirect_to(@post302, :notice => 'Post302 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post302.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @obligation_rule = ObligationRule.find(params[:id])\n\n respond_to do |format|\n if @obligation_rule.update_attributes(params[:obligation_rule])\n format.html { redirect_to @obligation_rule, notice: 'Obligation rule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @obligation_rule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @firewall_endpoint_associations = args[:firewall_endpoint_associations] if args.key?(:firewall_endpoint_associations)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @unreachable = args[:unreachable] if args.key?(:unreachable)\n end"
] |
[
"0.6653373",
"0.6351729",
"0.6191149",
"0.6186863",
"0.6149999",
"0.59082484",
"0.5866592",
"0.5849404",
"0.57930136",
"0.57204133",
"0.5687966",
"0.56239426",
"0.5602864",
"0.5567944",
"0.5561976",
"0.5529223",
"0.54956514",
"0.5493252",
"0.5486213",
"0.54797596",
"0.54666626",
"0.5451263",
"0.544401",
"0.5417532",
"0.5386618",
"0.5384899",
"0.53604376",
"0.5360296",
"0.53290516",
"0.5317186",
"0.52653295",
"0.5263379",
"0.52347094",
"0.5228798",
"0.52228326",
"0.522148",
"0.52143776",
"0.5210069",
"0.51870847",
"0.518512",
"0.5176483",
"0.516266",
"0.5151539",
"0.5151412",
"0.51500523",
"0.5148396",
"0.51471776",
"0.51356053",
"0.51244617",
"0.51138836",
"0.51034015",
"0.51010627",
"0.50975674",
"0.50902236",
"0.50832695",
"0.50808954",
"0.507512",
"0.5064446",
"0.50613767",
"0.5061195",
"0.5060933",
"0.5056333",
"0.5054848",
"0.50545245",
"0.504906",
"0.504906",
"0.5047645",
"0.504339",
"0.5041264",
"0.5040129",
"0.50359994",
"0.5030608",
"0.50268567",
"0.5010441",
"0.50032055",
"0.50018126",
"0.5000869",
"0.49950042",
"0.49909234",
"0.49871248",
"0.49787033",
"0.49741742",
"0.4967276",
"0.4964513",
"0.49606237",
"0.495296",
"0.49519005",
"0.4949153",
"0.494579",
"0.49448413",
"0.49355876",
"0.4933293",
"0.49325413",
"0.49296838",
"0.4922048",
"0.4921211",
"0.49208188",
"0.49169573",
"0.49144763",
"0.4913317"
] |
0.71392584
|
0
|
/Domain/EmailForward/List The command is intended to retrieve the list of email forwarding rules for a domain. Returned data: STATUS=SUCCESS or FAILURE RULE_[x]_SOURCE = the source for the rule [x] where [x] is a number starting with 1 and incrementing for each rule RULE_[x]_DESTINATION = the destination for rule [x] Example return data: transactid=b88831878b31225bd9c743b28ac52bf7 total_rules=3
|
def list_email_forwards(domain, range_from_optional, range_to_optional)
validate_list([ ["Domain", domain, :domain_format] ])
options = { "Domain" => domain }
optional_fields = [ ["rangeFrom", range_from_optional], ["rangeTo", range_to_optional] ]
options = set_optional_fields(optional_fields, options)
connection = Connection.new
connection.post("Domain/EmailForward/List", options)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def list_forwarding_rules(opts = {})\n data, _status_code, _headers = list_forwarding_rules_with_http_info(opts)\n return data\n end",
"def list_forwarding_rules_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ForwardingRuleApi.list_forwarding_rules ...\"\n end\n # resource path\n local_var_path = \"/v2/forwarding-rules\"\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 = ['GenieKey']\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 => 'ListForwardingRulesResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ForwardingRuleApi#list_forwarding_rules\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def hr_forwards\n\t params[:req_status].each do |f|\n\t cur_emp = get_logged_employee\n\t\t @forwards = Forward.new\n\t\t\t@forwards.create_forwards( cur_emp, params[:r_id], \"FORWARDED\", f )\n\t\t @comment = Comment.new\n\t\t\treq_name = Requirement.find(f)\n\t\t\tcomment = \"FORWARDED TO: \" + \"\" + req_name.employee.name + \" For \" + \"\" + req_name.name + \". No coments added while forwarding.\" \n\t\t resume_id = params[:r_id]\n\t\t type = \"INTERNAL\"\n\t\t @comment.create_comment(comment, resume_id, cur_emp.eid, type)\n\t end\n respond_to do |format|\n flash[:success] = \"successfully forwarded the resume.\"\n\t \tresume = Resume.find(params[:r_id])\n\t\t n_forwards = resume.nforwards + 1 #params[:req_status].size\n\t resume.update_columns(:nforwards => n_forwards)\n\t\tend\n\tend",
"def mx_port_forwarding_rules\r\n MXPortForwardingRulesController.instance\r\n end",
"def list\n @client.call(method: :get, path: 'recipient-lists')\n end",
"def domains_forward_names\n domains_names = []\n self.domains.forward.each do |domain|\n domains_names.push domain.name\n end\n domains_names\n end",
"def mg_port_forwarding_rules\r\n MGPortForwardingRulesController.instance\r\n end",
"def get_forwarding_rule(identifier, opts = {})\n data, _status_code, _headers = get_forwarding_rule_with_http_info(identifier, opts)\n return data\n end",
"def index\n @mail_lists = MailList.all\n end",
"def list\n @mailing_list.contacts(limit: 10000).map{|contact| contact.email}\n end",
"def frwdlp(session,hostlst,domain,dest)\n\tdest = dest + \"-DNS-forward-lookup.txt\"\n\tprint_status(\"Performing DNS Forward Lookup for hosts in #{hostlst} for domain #{domain}\")\n\tfilewrt(dest,\"DNS Forward Lookup for hosts in #{hostlst} for domain #{domain}\")\n\tresult = []\n\tthreads = []\n\ttmpout = []\n\tbegin\n\tif ::File.exists?(hostlst)\n\t\t::File.open(hostlst).each {|line|\n \t\t\tthreads << ::Thread.new(line) { |h|\n \t\t\t#print_status(\"checking #{h.chomp}\")\n\t\t \tr = session.sys.process.execute(\"nslookup #{h.chomp}.#{domain}\", nil, {'Hidden' => true, 'Channelized' => true})\n \t\t \twhile(d = r.channel.read)\n \t\t\tif d =~ /(Name)/\n \t\t\t\td.scan(/Name:\\s*\\S*\\s*Address\\w*:\\s*.*?.*?.*/) do |n|\n \t\t\t\ttmpout << n.split\n \t\t\tend\n \t\t\tbreak\n \t\tend\n end\n\n r.channel.close\n r.close\n\t\t\t}\n\t\t}\n\tthreads.each { |aThread| aThread.join }\n\ttmpout.uniq.each do |t|\n \tprint_status(\"\\t#{t.join.sub(/Address\\w*:/, \"\\t\")}\")\n \tfilewrt(dest,\"#{t.join.sub(/Address\\w*:/, \"\\t\")}\")\n end\n\n\telse\n\t\tprint_status(\"File #{hostlst}does not exists!\")\n\t\texit\n\tend\n\trescue ::Exception => e\n \t\tprint_status(\"The following Error was encountered: #{e.class} #{e}\")\n\tend\nend",
"def forward\n @list = \"Forward\"\n setFreeagents(\"F\")\n render 'allFA'\n end",
"def update_email_forward(source, destination)\n validate_list([[\"Source\", source, :email],\n [\"Destination\", destination, :email]\n ])\n\n options = {\n \"Source\" => source,\n \"Destination\" => destination\n }\n\n connection = Connection.new\n connection.post(\"Domain/EmailForward/Update\", options)\n end",
"def get_bre_forward_logs(opts = {})\n data, _status_code, _headers = get_bre_forward_logs_with_http_info(opts)\n return data\n end",
"def list(domain=nil)\n if domain\n @mailgun.response = Mailgun::Base.fire(:get, @mailgun.api_url + \"/domains/#{domain}\")\n else\n @mailgun.response = Mailgun::Base.fire(:get, @mailgun.api_url + \"/domains\")[\"items\"] || []\n end\n end",
"def forwarded\n status = \"FORWARDED\"\n @resumes = get_matches(status)\n render \"resumes/_resume_show\"\n end",
"def list(domain, opts = {}, map_mailboxes = true)\n mailboxes = call('domain.mailbox.list', domain.fqdn, opts)\n \n if map_mailboxes\n mailboxes.map! do |mailbox|\n self.new(domain, mailbox['login'])\n end\n end\n return mailboxes\n end",
"def get_vapp_port_forwarding_rules(vAppId)\n params = {\n 'method' => :get,\n 'command' => \"/vApp/vapp-#{vAppId}/networkConfigSection\"\n }\n\n response, headers = send_request(params)\n\n # FIXME: this will return nil if the vApp uses multiple vApp Networks\n # with Edge devices in natRouted/portForwarding mode.\n config = response.css('NetworkConfigSection/NetworkConfig/Configuration')\n fenceMode = config.css('/FenceMode').text\n natType = config.css('/Features/NatService/NatType').text\n\n raise InvalidStateError, \"Invalid request because FenceMode must be set to natRouted.\" unless fenceMode == \"natRouted\"\n raise InvalidStateError, \"Invalid request because NatType must be set to portForwarding.\" unless natType == \"portForwarding\"\n\n nat_rules = {}\n config.css('/Features/NatService/NatRule').each do |rule|\n # portforwarding rules information\n ruleId = rule.css('Id').text\n vmRule = rule.css('VmRule')\n\n nat_rules[rule.css('Id').text] = {\n :ExternalIpAddress => vmRule.css('ExternalIpAddress').text,\n :ExternalPort => vmRule.css('ExternalPort').text,\n :VAppScopedVmId => vmRule.css('VAppScopedVmId').text,\n :VmNicId => vmRule.css('VmNicId').text,\n :InternalPort => vmRule.css('InternalPort').text,\n :Protocol => vmRule.css('Protocol').text\n }\n end\n nat_rules\n end",
"def get_vapp_port_forwarding_rules(vAppId)\n params = {\n 'method' => :get,\n 'command' => \"/vApp/vapp-#{vAppId}/networkConfigSection\"\n }\n\n response, headers = send_request(params)\n\n # FIXME: this will return nil if the vApp uses multiple vApp Networks\n # with Edge devices in natRouted/portForwarding mode.\n config = response.css('NetworkConfigSection/NetworkConfig/Configuration')\n fenceMode = config.css('/FenceMode').text\n natType = config.css('/Features/NatService/NatType').text\n\n raise InvalidStateError, \"Invalid request because FenceMode must be set to natRouted.\" unless fenceMode == \"natRouted\"\n raise InvalidStateError, \"Invalid request because NatType must be set to portForwarding.\" unless natType == \"portForwarding\"\n\n nat_rules = {}\n config.css('/Features/NatService/NatRule').each do |rule|\n # portforwarding rules information\n ruleId = rule.css('Id').text\n vmRule = rule.css('VmRule')\n\n nat_rules[rule.css('Id').text] = {\n :ExternalIpAddress => vmRule.css('ExternalIpAddress').text,\n :ExternalPort => vmRule.css('ExternalPort').text,\n :VAppScopedVmId => vmRule.css('VAppScopedVmId').text,\n :VmNicId => vmRule.css('VmNicId').text,\n :InternalPort => vmRule.css('InternalPort').text,\n :Protocol => vmRule.css('Protocol').text\n }\n end\n nat_rules\n end",
"def get_portforwards(vmnet, opts = {})\n data, _status_code, _headers = get_portforwards_with_http_info(vmnet, opts)\n data\n end",
"def index\n @email_lists = EmailList.all\n end",
"def rules\n @rules=get_endpoint('rule').keys\n end",
"def create_forwarding_rule(body, opts = {})\n data, _status_code, _headers = create_forwarding_rule_with_http_info(body, opts)\n return data\n end",
"def parse_firewall_rules\n script_code = 'netsh advfirewall firewall show rule name=all verbose'\n cmd = powershell_out(script_code) # Not logged because it makes too much noise\n\n retval = parse_firewall_paragraphs(cmd)\n\n raise 'Could not parse firewall rules' if retval.empty?\n return retval\n end",
"def to_list\n rules.map do |rule|\n object = { actions: rule.actions, subject: rule.subjects.map{ |s| s.is_a?(Symbol) ? s : s.name } }\n object[:conditions] = rule.conditions unless rule.conditions.blank?\n object[:inverted] = true unless rule.base_behavior\n object\n end\n end",
"def index\n @direct_messages = DirectMessage.get_direct_messages(current_user)\n \n @recipients = User.reachable_users(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @direct_messages }\n end \n end",
"def list(opts = {})\n data, _status_code, _headers = self_mailers_list_with_http_info(opts)\n data\n end",
"def index\n @http_domain_rules = collection.all\n\n respond_to do |format|\n format.json { render json: @http_domain_rules }\n end\n end",
"def LIST_RULES\n return @legacy.LIST_RULES if @legacy\n raise 'Using legacy auditd_rules LIST_RULES interface with non-legacy audit package. Please use the new syntax.'\n end",
"def get_transac_emails_list(opts = {})\n data, _status_code, _headers = get_transac_emails_list_with_http_info(opts)\n data\n end",
"def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::AccountAttachmentHistoryListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"]\n if page_size_option.is_a? Integer\n req.meta.limit = page_size_option\n end\n if not @parent.snapshot_time.nil?\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.filter = Plumbing::quote_filter_args(filter, *args)\n resp = Enumerator::Generator.new { |g|\n tries = 0\n loop do\n begin\n plumbing_response = @stub.list(req, metadata: @parent.get_metadata(\"AccountAttachmentsHistory.List\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + +@parent.jitterSleep(tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n tries = 0\n plumbing_response.history.each do |plumbing_item|\n g.yield Plumbing::convert_account_attachment_history_to_porcelain(plumbing_item)\n end\n break if plumbing_response.meta.next_cursor == \"\"\n req.meta.cursor = plumbing_response.meta.next_cursor\n end\n }\n resp\n end",
"def rules(options={})\n get('getNotificationRules', options)\n end",
"def get_contact_list(filter, options={ skip: nil, count: nil, auth_token: nil })\n auth_token = options[:auth_token] || @auth_token\n check_auth_token(auth_token, [\"graph/read\"])\n\n response = http_client(MXIT_API_URI + \"/user/socialgraph/contactlist\") do |http, path|\n\n parameters = { :filter => filter }\n # skip and count are optional\n parameters[:skip] = options[:skip] if options[:skip]\n parameters[:count] = options[:count] if options[:count]\n\n request = Net::HTTP::Get.new(path + \"?#{URI.encode_www_form(parameters)}\")\n set_api_headers(request, auth_token.access_token)\n\n http.request(request)\n end\n\n handle_response(response)\n end",
"def index\n @delegations = Delegation.all\n end",
"def index\n @delegations = Delegation.all\n end",
"def list(options={})\n Mailgun.submit(:get, campaign_url, options)[\"items\"] || []\n end",
"def lists\n @links = Link.all\n @short_link = ActionMailer::Base.default_url_options[:host]\n end",
"def mailbox_list(str, opt)\n ret = []\n split_by(Tokenizer.token(str), \",\").each do |m|\n if a1 = m.index(\"<\") and a2 = m.rindex(\">\") and a2 > a1 then\n display_name = m[0..a1-1].join(\" \")\n if opt[:decode_mime_header] then\n display_name = RFC2047.decode(display_name, opt)\n end\n mailaddr = _conv(m[a1+1..a2-1].join, opt)\n local_part, domain = mailaddr.split(/@/, 2)\n ret << RFC2822::Mailbox.new(RFC2822::AddrSpec.new(local_part, domain), _conv(display_name, opt))\n else\n local_part, domain = _conv(m.join, opt).split(/@/, 2)\n ret << RFC2822::Mailbox.new(RFC2822::AddrSpec.new(local_part, domain))\n end\n end\n return ret\n end",
"def index\n @email_domains = Email::Domain.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @email_domains }\n end\n end",
"def history_transfer(domain)\n validate_list([ [\"Domain\", domain, :domain_format] ])\n options = { \"Domain\" => domain }\n\n connection = Connection.new\n connection.post(\"Domain/Transfer/History\", options)\n end",
"def read_forwards\n\t\t_read(EVENTLOG_SEQUENTIAL_READ | EVENTLOG_FORWARDS_READ)\n\tend",
"def index\n\t@account = Account.find(params[:account_id])\n @rules = @account.rules\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rules }\n end\n end",
"def list_hosts(domain, compact_list_optional)\n validate_list([[\"Domain\", domain, :domain_format]])\n options = {\"Domain\" => domain}\n optional_fields = [ [\"compact_list_optional\", compact_list_optional] ]\n options = set_optional_fields(optional_fields, options)\n\n connection = Connection.new\n connection.post(\"Domain/Host/List\", options)\n end",
"def list_apex_redirects(opts = {})\n data, _status_code, _headers = list_apex_redirects_with_http_info(opts)\n data\n end",
"def forward_to\n return @forward_to\n end",
"def get_report_list(options = {})\n options = argument_cleaner(required_params: %i( domainid ), optional_params: %i( ), options: options )\n authenticated_get cmd: \"getreportlist\", **options\n end",
"def rulelist(ruleset, ctx)\r\n\r\n outlist = \"\"\r\n\r\n ruleset.rules.each do |ralias|\r\n rname = ctx.rules[ralias].name\r\n outlist += reference(\"rule\", rname)\r\n\r\n end # rules.each\r\n\r\n return outlist\r\n\r\n end",
"def list_gateway_rules_0(domain_id, gateway_policy_id, opts = {})\n data, _status_code, _headers = list_gateway_rules_0_with_http_info(domain_id, gateway_policy_id, opts)\n data\n end",
"def do_list(args)\n if args[\"zonename\"] == \"example.com\"\n @result = [\n record(\"example.com\", \"SOA\", \"sns.dns.icann.org noc.dns.icann.org 2013012485 7200 3600 1209600 3600\"),\n record(\"example.com\", \"NS\", \"sns.dns.icann.org\"),\n record_prio(\"example.com\", \"MX\", \"test.example.com\",10),\n record(\"test.example.com\", \"A\", \"127.0.0.1\")\n ]\n end\n end",
"def list(options={})\n response = Mailgun.submit(:get, list_url, options)[\"items\"] || []\n end",
"def index\n @recipients = Recipient.order_recipients_by\n end",
"def list(\n filter,\n *args,\n deadline: nil\n )\n return @peering_groups.list(\n filter,\n *args,\n deadline: deadline,\n )\n end",
"def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::AccountHistoryListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"]\n if page_size_option.is_a? Integer\n req.meta.limit = page_size_option\n end\n if not @parent.snapshot_time.nil?\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.filter = Plumbing::quote_filter_args(filter, *args)\n resp = Enumerator::Generator.new { |g|\n tries = 0\n loop do\n begin\n plumbing_response = @stub.list(req, metadata: @parent.get_metadata(\"AccountsHistory.List\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + +@parent.jitterSleep(tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n tries = 0\n plumbing_response.history.each do |plumbing_item|\n g.yield Plumbing::convert_account_history_to_porcelain(plumbing_item)\n end\n break if plumbing_response.meta.next_cursor == \"\"\n req.meta.cursor = plumbing_response.meta.next_cursor\n end\n }\n resp\n end",
"def index\n @email_leads = EmailLead.all\n end",
"def list\n @client.call(method: :get, path: 'tracking-domains')\n end",
"def list\n ContactDatabase.list\n end",
"def forwardings_params\n params.require(:forwarding).permit(:user_id, :domain_id, :destination)\n end",
"def getEmailList()\n emailListFile = File.dirname(File.dirname(__FILE__)) + \"/config/\" +\n \"email_recepients.txt\"\n lines = IO.readlines(emailListFile)\n\n lines.each do |line|\n if line.match(/^EMAIL_RESULTS/)\n temp = line.gsub(/EMAIL_RESULTS=/, \"\")\n temp.strip!\n @resultRecepients = temp.split(\",\")\n elsif line.match(/^EMAIL_ERRORS/)\n temp = line.gsub(/EMAIL_ERRORS=/, \"\")\n temp.strip!\n @errorRecepients = temp.split(\",\") \n elsif line.match(/^EMAIL_CAPTURE/)\n temp = line.gsub(/EMAIL_CAPTURE=/, \"\")\n temp.strip!\n @captureRecepients = temp.split(\",\") \n end\n end\n end",
"def list\n contacts_index(Contact.all)\n end",
"def list(\n filter,\n *args,\n deadline: nil\n )\n return @accounts.list(\n filter,\n *args,\n deadline: deadline,\n )\n end",
"def index\n @routing_lists = RoutingList.all\n end",
"def batch_rules!(rules, forward_to_replicas = false, clear_existing_rules = false, request_options = {})\n res = batch_rules(rules, forward_to_replicas, clear_existing_rules, request_options)\n wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options)\n return res\n end",
"def index\n @rules = Rule.all\n end",
"def index\n @rules = Rule.all\n end",
"def index\n @rules = Rule.all\n end",
"def index\n @rules = Rule.all\n end",
"def domains_list\n call('domains.list')[:domains]\n end",
"def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::WorkflowHistoryListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"]\n if page_size_option.is_a? Integer\n req.meta.limit = page_size_option\n end\n if not @parent.snapshot_time.nil?\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.filter = Plumbing::quote_filter_args(filter, *args)\n resp = Enumerator::Generator.new { |g|\n tries = 0\n loop do\n begin\n plumbing_response = @stub.list(req, metadata: @parent.get_metadata(\"WorkflowsHistory.List\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + +@parent.jitterSleep(tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n tries = 0\n plumbing_response.history.each do |plumbing_item|\n g.yield Plumbing::convert_workflow_history_to_porcelain(plumbing_item)\n end\n break if plumbing_response.meta.next_cursor == \"\"\n req.meta.cursor = plumbing_response.meta.next_cursor\n end\n }\n resp\n end",
"def redirections\n result = db[\"SELECT * FROM `wp_redirection_items`\"]\n result.each { |r| puts r.inspect }\n end",
"def handle_forward\n return unless elmo_response && elmo_response.valid?\n form = elmo_response.try(:form)\n\n if form && form.sms_relay?\n broadcast = ::Broadcast.new(\n recipient_selection: \"specific\",\n recipient_users: form.recipient_users,\n recipient_groups: form.recipient_groups,\n source: \"forward\",\n medium: \"sms_only\",\n body: incoming_msg.body,\n which_phone: \"both\",\n mission: incoming_msg.mission\n )\n\n if broadcast.valid?\n message = strip_auth_code(incoming_msg.body, form)\n return Sms::Forward.new(broadcast: broadcast, body: message, mission: broadcast.mission)\n end\n end\n\n nil\n end",
"def get_ssh_port_forwarding_rule(server, cached_rules=nil)\n rules = cached_rules || client.list_port_forwarding_rules(project_id: server[\"projectid\"]) || []\n rules.find_all { |r|\n r['virtualmachineid'] == server['id'] &&\n r['privateport'] == '22'&&\n r['publicport'] == '22'\n }.first\n end",
"def inspect\r\n @rules.each{|r|\r\n r[1].each{|d|\r\n print r[0].to_s + \" => \" + d[0].inspect + \" TXTO \" + d[1].inspect + \"\\n\"\r\n }\r\n }\r\n end",
"def domains\n\tfetch(\"/Domain.List\")\nend",
"def index\n @recipients = Recipient.all\n end",
"def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::WorkflowApproversHistoryListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"]\n if page_size_option.is_a? Integer\n req.meta.limit = page_size_option\n end\n if not @parent.snapshot_time.nil?\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.filter = Plumbing::quote_filter_args(filter, *args)\n resp = Enumerator::Generator.new { |g|\n tries = 0\n loop do\n begin\n plumbing_response = @stub.list(req, metadata: @parent.get_metadata(\"WorkflowApproversHistory.List\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + +@parent.jitterSleep(tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n tries = 0\n plumbing_response.history.each do |plumbing_item|\n g.yield Plumbing::convert_workflow_approver_history_to_porcelain(plumbing_item)\n end\n break if plumbing_response.meta.next_cursor == \"\"\n req.meta.cursor = plumbing_response.meta.next_cursor\n end\n }\n resp\n end",
"def printRules\n\t\n\t@i = 1\n\t@@rulesArray.each do |rule|\n\t\tputs \"#{@i}-#{rule.fetch('src_ip')}/#{rule.fetch('src_netmask')}:#{rule.fetch('src_port')} #{rule.fetch('dest_ip')}/#{rule.fetch('dest_netmask')}:#{rule.fetch('dest_port')} #{rule.fetch('protocol')} #{rule.fetch('action')}\"\n\t\t@i += 1\n\tend\n\n\tif @i == 1\n\t\tputs \"No rules to print!\"\n\telse\n\t\tputs \"Rules Loaded!\"\n\tend\nend",
"def list\n perform_request(Entities::MarketingEmail, 'newsletter/list.json')\n end",
"def index\n @q = MsgMail.active.ransack(params[:q])\n @mails = @q.result.includes(:mail_type).page(params[:page]).per(15)\n end",
"def index\n redirect_to mailerlists_path\n #@mailernames = Mailername.all\n end",
"def get_email_list(email)\n mail_list_array = []\n response = get_emails(email)\n if !response.blank?\n json_body = JSON.parse(response.body)\n if !json_body[\"items\"].blank?\n Rails.logger.info \"Total Emails: #{json_body[\"items\"].count}\"\n json_body[\"items\"].each do |item|\n Rails.logger.info \"Subject: #{item['message']['headers']['subject']}\"\n Rails.logger.info \"Storage Url: #{item['storage']['url']}\"\n mail_list_array.push(item['storage']['url'])\n end\n end\n end\n mail_list_array\n end",
"def get_list(options={})\n rsp = @flickr.send_request('flickr.contacts.getList', options)\n collect_contacts(rsp)\n end",
"def list_recipients\n post_with_auth 'payment_initiation/recipient/list',\n PaymentRecipientListResponse,\n {}\n end",
"def list(filter)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'filter', filter)\n\t\t\tclient.queue_service_action_call('parentalrule', 'list', 'KalturaParentalRuleListResponse', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def list\n @driver.getRuleNames\n end",
"def list_firewall_rules project:\n client = ::Google::Cloud::Compute::V1::Firewalls::Rest::Client.new\n firewalls = client.list project: project\n\n firewall_list = []\n firewalls.each do |firewall|\n puts \" - #{firewall.name}: #{firewall.description}\"\n firewall_list << firewall\n end\n\n firewall_list\nend",
"def index\n @mailing_lists = MailingList.all\n @email = @mailing_lists.collect(&:email).join(\"; \")\n end",
"def list(\n filter,\n *args,\n deadline: nil\n )\n return @peering_group_resources.list(\n filter,\n *args,\n deadline: deadline,\n )\n end",
"def forward(mappings)\n mappings.each do |from, to|\n from = event_model(from).symbol\n targets = Array[*to].map { |ev| event_model(ev).symbol }\n\n if event_model(from).terminal?\n non_terminal = targets.find_all do |name|\n !event_model(name).terminal?\n end\n unless non_terminal.empty?\n raise ArgumentError,\n \"trying to establish a forwarding relation from \"\\\n \"the terminal event #{from} to the non-terminal \"\\\n \"event(s) #{targets}\"\n end\n end\n\n forwarding_sets[from].merge targets\n end\n update_terminal_flag\n end",
"def index\n @certificate_rules = CertificateRule.all\n end",
"def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::WorkflowAssignmentsHistoryListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"]\n if page_size_option.is_a? Integer\n req.meta.limit = page_size_option\n end\n if not @parent.snapshot_time.nil?\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.filter = Plumbing::quote_filter_args(filter, *args)\n resp = Enumerator::Generator.new { |g|\n tries = 0\n loop do\n begin\n plumbing_response = @stub.list(req, metadata: @parent.get_metadata(\"WorkflowAssignmentsHistory.List\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + +@parent.jitterSleep(tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n tries = 0\n plumbing_response.history.each do |plumbing_item|\n g.yield Plumbing::convert_workflow_assignment_history_to_porcelain(plumbing_item)\n end\n break if plumbing_response.meta.next_cursor == \"\"\n req.meta.cursor = plumbing_response.meta.next_cursor\n end\n }\n resp\n end",
"def list(\n filter,\n *args,\n deadline: nil\n )\n return @account_attachments.list(\n filter,\n *args,\n deadline: deadline,\n )\n end",
"def index\n all_mail_users =\n case @type\n when 'applicable'\n @recipient_list.applicable_mail_users\n when 'included'\n @recipient_list.included_mail_users\n when 'excluded'\n @recipient_list.excluded_mail_users\n end&.order(:name)\n\n @mail_users =\n if params[:page] == 'all'\n all_mail_users&.page(nil)&.per(all_mail_users&.count)\n else\n all_mail_users&.page(params[:page])\n end\n\n flash.alert = '指定のリストはありません。' if @mail_users.nil?\n end",
"def domains\n domains = []\n nextToken = nil\n base_options = {:Action => 'ListDomains'}\n continue = true\n \n while continue\n options = base_options.dup\n options[:NextToken] = nextToken unless nextToken.nil?\n \n sdb_query(options) do |h|\n h.search('//DomainName').each {|e| domains << Domain.new(self, e.innerText)}\n mt = h.at('//NextToken')\n if mt\n nextToken = mt.innerText\n else\n continue = false\n end\n end\n end\n \n domains\n end",
"def remove_email_forward(source)\n validate_list([[\"Source\", source, :email] ])\n\n options = { \"Source\" => source }\n\n connection = Connection.new\n connection.post(\"Domain/EmailForward/Remove\", options)\n end",
"def index\n @rules = Rule.page(params[:page])\n\n respond_with(@rules)\n end",
"def list(domain, options = {})\n res = @client.get(\"domains/#{domain}/webhooks\", options)\n res.to_h['webhooks']\n end",
"def recipient_list(r)\n @recipients = []\n @failed_recipients = []\n r.gsub(\",\", \" \").split(\" \").each do |a|\n a.strip!\n if valid_email(a)\n @recipients << a\n else\n @failed_recipients << a\n end\n end\n end",
"def getDomains()\r\n\r\n _dprint(\"getDomains() called ...\")\r\n\r\n valid_tag = \"DOMAINLIST\"\r\n _dprint(\"Getting Domains\")\r\n\r\n mesg = <<XML\r\n <transaction>\r\n <type>3</type>\r\n <data>\r\n <domain-list>null</domain-list>\r\n </data>\r\n </transaction>\r\nXML\r\n reconnect {\r\n xml = _request(mesg)\r\n domains = XPath.match(xml, '//data/domain-list')\r\n }\r\n _dprint(\"Returning Results...\")\r\n return domains\r\n end",
"def index\n @redirects = Redirect.all\n end",
"def index\n\t\t@conversations = current_user.mailbox.conversations\n\tend"
] |
[
"0.6648423",
"0.59676236",
"0.56102943",
"0.5593586",
"0.54867613",
"0.5458402",
"0.52998596",
"0.5162054",
"0.5085621",
"0.5046843",
"0.49879074",
"0.4986631",
"0.49463314",
"0.49278456",
"0.49263114",
"0.48895684",
"0.48881832",
"0.487571",
"0.48212102",
"0.4819853",
"0.48193905",
"0.47894725",
"0.47828233",
"0.47174805",
"0.46994683",
"0.46980008",
"0.46952122",
"0.46851388",
"0.46754888",
"0.46516642",
"0.46439952",
"0.46370596",
"0.4636575",
"0.46221486",
"0.46221486",
"0.46202403",
"0.4608423",
"0.46011645",
"0.456954",
"0.45353293",
"0.4530505",
"0.4518503",
"0.44952947",
"0.4485875",
"0.44829112",
"0.44791386",
"0.44704375",
"0.44661772",
"0.4448454",
"0.44411233",
"0.44317994",
"0.44314086",
"0.44280934",
"0.44260532",
"0.44201857",
"0.4417809",
"0.44148093",
"0.44143373",
"0.44138747",
"0.44116744",
"0.441015",
"0.43995038",
"0.4390571",
"0.4390571",
"0.4390571",
"0.4390571",
"0.43830428",
"0.4381136",
"0.438113",
"0.43784204",
"0.437091",
"0.43663338",
"0.43521747",
"0.43513295",
"0.4343896",
"0.43428338",
"0.43420815",
"0.43379566",
"0.4335294",
"0.43309718",
"0.43307883",
"0.43288907",
"0.43236932",
"0.43148857",
"0.43141896",
"0.431304",
"0.4309248",
"0.42966664",
"0.42958212",
"0.42950276",
"0.4293078",
"0.42893663",
"0.42864284",
"0.42807114",
"0.42781243",
"0.427725",
"0.4272237",
"0.42607963",
"0.42593384",
"0.42584595"
] |
0.7180608
|
0
|
Returns a collection of usersowners of apps for selection on challenge create or edit each User should be valid, i.e. to have an Org, otherwise skipped
|
def app_owners_for_select
User.real.map { |u| [u.select_text, u.id] if u.org }.compact
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def approvable_users\n @approvable_users ||= (controllable_users + editable_request_applicants + controllable_users.map{|uu|uu.editable_request_applicants}).flatten.uniq\n end",
"def unassigned_approvers_for_contract(contract)\n\n # todo: shouldnt have to use select here... theres a better way\n user_ids = contract.approver_users.map {|user| user.id}\n self.approver_users.select {|user| !user_ids.include?(user.id)}\n\n end",
"def viewable_users\n @viewable_users ||= (controllable_users + request_applicants + controllable_users.map{|uu|uu.request_applicants}).flatten.uniq\n end",
"def user_owners\n User.where(id: owners.keys).to_a.map do |_user|\n _user.anonymous_time_verification = owners[_user.id.to_s]\n _user\n end\n end",
"def users\n # TODO use SQL\n results = self.approvers + self.observers + [self.requester]\n results.compact\n end",
"def find_owner_appointments\n owner_appointments = Appointment.all.select { |appointment| appointment.owners.include?(self) || appointment.owner_id == id } \n if !owner_appointments.empty?\n owner_appointments\n else\n nil\n end\n end",
"def eligible_owners\n User.where('users.id != ?', @cookbook.user_id)\n end",
"def organisers\n org = []\n organiser_ids = self.listings.map {|listing| listing.organiser_id}\n User.all.select do |user|\n if organiser_ids.any?(user.id)\n org << user\n end\n end\n org.uniq\n end",
"def owners\n get_user_with_role(:owner)\n end",
"def available_users\n\t\tfree_users = []\n\t\tfor user in User.all\n\t\t\tunless user.assignments.nil? || user.assignments.empty?\n\t\t\t\tfor assignment in user.assignments\n\t\t\t\t\tif assignment.active\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\tfree_users << user\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tfree_users << user\n\t\t\tend\n\t\tend\n\t\treturn free_users\n\tend",
"def read_owners(config, org_guid)\n user_setup_obj = UsersSetup.new(config)\n\n users_list = []\n users = @client.organization(org_guid).managers\n\n users.each do |user|\n user_guid = user.guid\n username = user_setup_obj.get_username_from_guid(user_guid)\n users_list << Users::User.new(username, 'owner', false, user_guid)\n end\n\n users_list\n end",
"def eligible_collaborators\n ineligible_users = [@cookbook.collaborators, @cookbook.owner].flatten\n User.where('users.id NOT IN (?)', ineligible_users)\n end",
"def users_for_new_issue_watchers(issue)\n users = issue.watcher_users.select{|u| u.status == User::STATUS_ACTIVE}\n project = issue.project\n scope_users = project.users\n scope_groups = project.principals.merge(Group.givable)\n if scope_users.count + scope_groups.count <= 20\n users = (users + scope_users.sort + scope_groups.sort).uniq\n end\n users\n end",
"def ensure_owner_attends\n attendees << user unless attendees.include? user\n end",
"def general_user_organizations_with_protocols\n Protocol.joins(:project_roles).where(project_roles: { identity_id: @id } ).where.not(project_roles: { project_rights: 'none' }).map(&:organizations).flatten.uniq\n end",
"def set_users\n @can_change_owner = policy(@run || Run).current_user_allowed_to_crud?\n @users = policy_scope(User).map{|u| [ u.name, u.id ] } if @can_change_owner\n end",
"def users\n users = []\n if current_user.lead?\n users = object.users.select { |u| u.id != current_user.id }\n users = users.unshift(current_user)\n elsif current_user.dev?\n vms_v = object.vms.select { |vm| vm.is_jenkins }\n users = vms_v.flat_map(&:user).uniq.select { |u| u.id != current_user.id }\n users = users.unshift(current_user)\n else\n users <<= current_user\n end\n users.map { |u| u.id }\n end",
"def owner_and_coowners\n vals = Role.access_values_for(:creator).concat(Role.access_values_for(:administrator))\n User.joins(:roles).where(\"roles.plan_id = ? AND roles.access IN (?)\", self.id, vals)\n end",
"def users\n gateway_check\n unavailable_servers_check\n @users\n end",
"def minimal_owners_to_approve\n owners = owners_contents.map { |o| o & allowed_approvers }\n\n return [] if owners.empty?\n\n # If there's only one OWNERS file that applies, just return it\n # since the magic cartesian product screws it up\n if owners.length == 1\n return owners.first.map { |o| [o] }\n end\n\n owners.inject do |oldSoln, nextSet|\n oldSoln.minimum_length_cartesian_terms(nextSet)\n end\n end",
"def getOwners\r\n\t\t\t\t\treturn @owners\r\n\t\t\t\tend",
"def engaged_users\n self.users.select { |u| u.ideas.count > 0 || u.comments.count > 0 || u.votes.count > 0 || u.support_messages.count > 0 }\n end",
"def valid_apps\n apps.select { |app| app.valid? }\n end",
"def for(home_people)\n split_instant_owner_groups_from_considerations(home_people)\n include_non_accounted_for_considerations\n return_the_unique_owner_groupings\n end",
"def is_user_owner_client_app\n get(\"/api/v1/oauth_is_user_owner_client_app.json\")\n end",
"def filter_owners(path, unknown_owners)\n owners = { clients: [], users: [] }\n unknown_owners.each do |entity|\n if path[0] == \"organizations\" && path.length > 2\n begin\n data.get([\"organizations\", path[1], \"clients\", entity])\n owners[:clients] |= [ entity ]\n rescue\n owners[:users] |= [ entity ]\n end\n else\n owners[:users] |= [ entity ]\n end\n end\n owners\n end",
"def allowed_approvers\n return @allowed_approvers unless @allowed_approvers.nil?\n\n owners = owners_contents.flatten.uniq\n\n if self.author =~ /<(.+?)@amiestreet.com>/\n author_username = $1\n owners.reject! { |u| u == author_username }\n end\n @allowed_approvers = owners\n\n @allowed_approvers\n end",
"def find_users_have_completed_program(users: User.all, curricula: [LearningModules::FOOD_ETALK, LearningModules::BETTER_U], date_range: nil)\n completed_users = []\n users.each do |user|\n completed = user_has_completed_program?(user, curricula, date_range)\n completed_users << user if completed\n end\n return User.where(id: completed_users.map(&:id))\n end",
"def possible_users\n ids = []\n ids = condition.scan(/\\d+/) if condition.present?\n User.where(:id => ids)\n end",
"def verify_users(test_data)\n users = test_data[UseOfCollections::USER_GRP.name] || [UseOfCollections.empty_user]\n users.each_with_index do |user, index|\n verify_values_match(user[UseOfCollections::USER.name], element_value(user_name_input index))\n verify_values_match(user[UseOfCollections::USER_INSTITUTION_ROLE.name], element_value(user_type_input index))\n verify_values_match(user[UseOfCollections::USER_UOC_ROLE.name], element_value(user_role_input index))\n verify_values_match(user[UseOfCollections::USER_INSTITUTION.name], element_value(user_institution_input index))\n end\n end",
"def index\n @app_users = @app.app_users.all\n end",
"def get_owners\n return make_request(\"#{self.endpoint}/list/owners\")\n end",
"def verify_users(test_data)\n users = test_data[CoreUseOfCollectionsData::USER_GRP.name] || [CoreUseOfCollectionsData.empty_user]\n users.each_with_index do |user, index|\n verify_values_match(user[CoreUseOfCollectionsData::USER.name], element_value(user_name_input index))\n verify_values_match(user[CoreUseOfCollectionsData::USER_INSTITUTION_ROLE.name], element_value(user_type_input index))\n verify_values_match(user[CoreUseOfCollectionsData::USER_UOC_ROLE.name], element_value(user_role_input index))\n verify_values_match(user[CoreUseOfCollectionsData::USER_INSTITUTION.name], element_value(user_institution_input index))\n end\n end",
"def org_users\n synchronize { return @org_users if @org_users }\n\n users = {}\n orgs = settings.github_orgs || []\n orgs.each do |org|\n octokit.organization_members(org).each do |user|\n if users.has_key?(user.login)\n users[user.login][:orgs] << org\n else\n users[user.login] = user.to_h\n users[user.login][:mfa_enabled] = true\n users[user.login][:orgs] = [org]\n end\n end\n end\n orgs.each do |org|\n octokit.organization_members(org, filter: '2fa_disabled').each do |user|\n users[user.login][:mfa_enabled] = false\n end\n end\n\n synchronize { @org_users = users }\n end",
"def admins\n app_users.select(&:admin?)\n end",
"def get_assigned_employee_users(assigned_lawfirm_users)\n lawfirm_employees = self.employees.uniq.delete_if{|e| e.blank? || e.user.blank?}\n lawfirm_users = lawfirm_employees.map(&:user) if lawfirm_employees\n lawfirm_users.to_a & assigned_lawfirm_users.to_a\n end",
"def associated_users(permission: nil)\n owner = self.user\n shares = permission.present? ? self.study_shares.where(permission: permission) : self.study_shares\n share_users = shares.map { |share| User.find_by(email: /#{share.email}/i) }.compact\n [owner] + share_users\n end",
"def owner?(user_asking)\n user_asking.in? company.owners\n end",
"def users\n company_ids = [self.id]\n company_ids += advisor_company_ids if advised?\n\n user_ids = UserAffiliation.where(:company_id.in => company_ids).with_access.only(:user_id).map(&:user_id)\n User.where(:id.in => user_ids).order_by(created_at: :asc)\n end",
"def edit_users\n return self[:edit_users] unless persisted?\n (self[:edit_users] + (Wayfinder.for(self).ephemera_project&.edit_users || [])).uniq\n end",
"def users\n runner_users + corporation_users\n end",
"def assignable_users\n users = project.assignable_users.to_a\n users << author if author && author.active?\n if assigned_to_id_was.present? && assignee = Principal.find_by_id(assigned_to_id_was)\n users << assignee\n end\n users.uniq.sort\n end",
"def consumer_ids_for_owners\n consumer_ids = self.owners.map do |doc_owner|\n if doc_owner.owner_type == \"GroupUser\"\n doc_owner.owner.group.owner.id\n elsif %w[User Consumer].include?(doc_owner.owner_type)\n doc_owner.owner.id\n else\n nil\n end\n end\n consumer_ids << self.consumer_id # always include uploader/creator of standard_base_document\n consumer_ids.uniq.reject(&:blank?)\n end",
"def retrieve_user_access_list_for_app(user,app)\n user.groups.where(app_id: app.id)\n end",
"def pickups\n @users.map { |u| u.pickup }.uniq\n end",
"def own_organizations\n api.org_memberships.select { |org| org[:role] == \"admin\"}\n end",
"def owners\n return @owners\n end",
"def retrieve_user_access_list_for_app(user,app)\n user.groups.where(app_id: app.id)\n end",
"def all_users\n self.users +\n User.where(institution: self.institution).\n select{ |u| u.belongs_to_user_group?(self) }\n end",
"def process_owners(api_story)\n owner_ids = api_story['owner_ids']\n\n cached_owners = owner_ids.map do |owner_id|\n User.get_cached(owner_id)\n end\n\n return cached_owners if cached_owners.none?(&:nil?)\n\n project_id = api_story['project_id']\n story_id = api_story['id']\n User.get_by_project_and_story_id(project_id, story_id)\n end",
"def populate_owners\n ENV['PT_PROJECTS'].split(', ').each do |id|\n\n ownersDatum = make_call_parsed(\"#{pivotal_url}/#{id}/memberships\", pivotal_headers)\n\n ownersDatum.each do |ownerData|\n\n unless Owner.find_by_poid(ownerData['person']['id'])\n\n Owner.create( poid: ownerData['person']['id'],\n initials: ownerData['person']['initials'],\n name: ownerData['person']['name'])\n end\n end\n end\n end",
"def apps_permissions_users_list\n return {} unless !skip_info? && is_app_token? && is_not_excluded?\n semaphore.synchronize {\n @apps_permissions_users_list_raw ||= access_token.get('/api/apps.permissions.users.list')\n @apps_permissions_users_list ||= @apps_permissions_users_list_raw.parsed['resources'].inject({}){|h,i| h[i['id']] = i; h}\n }\n end",
"def addable_watcher_users\n users = self.project.users.sort - self.watcher_users\n users.reject! {|user| !user.allowed_to?(:view_issues, self.project)}\n users\n end",
"def enter_users(test_data)\n users = test_data[UseOfCollections::USER_GRP.name] || [UseOfCollections.empty_user]\n prep_fieldsets_for_test_data([fieldset(UseOfCollections::USER_GRP.name)], users)\n\n users.each_with_index do |user, index|\n enter_auto_complete(user_name_input(index), user_name_options(index), user[UseOfCollections::USER.name], 'Local Persons')\n wait_for_options_and_select(user_type_input(index), user_type_options(index), user[UseOfCollections::USER_INSTITUTION_ROLE.name])\n wait_for_options_and_select(user_role_input(index), user_role_options(index), user[UseOfCollections::USER_UOC_ROLE.name])\n enter_auto_complete(user_institution_input(index), user_institution_options(index), user[UseOfCollections::USER_INSTITUTION.name], 'Local Organizations')\n end\n end",
"def list_org\n @users = User.where(organization: true)\n\n render \"list_org\"\n end",
"def available_collaborators\n Set[*self.account.users].difference(self.users).to_a\n end",
"def users\n signups.map do |signup|\n user_id = signup.user_id\n User.all.find {|user| user.id == user_id}\n end\n end",
"def users\n return @canonical_user_pool if @canonical_user_pool\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Retrieving all users\"\n check_retval @user_pool.info!\n\n @canonical_user_pool = []\n @user_pool.each { |user| @canonical_user_pool << canonical_user(user) }\n @canonical_user_pool\n end",
"def potential_task_assignees(task)\n if task.assigned_to.is_a?(Organization)\n task.assigned_to.users.active\n elsif task.parent&.assigned_to.is_a?(Organization)\n task.parent.assigned_to.users.active.reject { |check_user| check_user == task.assigned_to }\n else\n []\n end\n end",
"def research_individual\n @users = Array.new()\n User.all.each do |u|\n if !u.admin?\n @users.push(u)\n end\n end\n end",
"def memberships_users\n group_ids_select = memberships.select(:user_id).where(user_type: 'Group')\n\n User.where('id IN (:user_ids) OR id IN (:group_owner_ids)',\n user_ids: memberships.select(:user_id).where(user_type: 'User'),\n group_owner_ids: Group.where(id: group_ids_select).select(:owner_id))\n end",
"def players\n players_in_signup = []\n player_ids = self.signups.map {|sign| sign.player_id}\n User.all.select do |user|\n if player_ids.any?(user.id)\n players_in_signup << user\n end\n end\n players_in_signup.uniq\n 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 visible_users\n User.where.not(type: :AutotestUser)\n end",
"def refused_users(users)\n emails = email_list(users.map(&:email))\n if users.count == 0\n nil\n else\n \"#{emails} indicated that they were not present for the meeting.\".html_safe\n end\n end",
"def add_owner_ids\n\t\tself.owner_ids << self.payable_from_organization_id \n\t\tself.owner_ids << self.payable_to_organization_id\n\t\tself.owner_ids << self.payable_from_patient_id\n\t\tself.owner_ids.compact!\n\t\tself.owner_ids.uniq!\n\tend",
"def users\n watches_unique_by_user.map(&:user)\n end",
"def signed_up_registrants\n registrants = []\n if event_category.present?\n registrants = event_category.signed_up_registrants\n end\n\n if competition.present?\n registrants = signed_up_competitors.map { |comp| comp.registrants }.flatten\n end\n\n registrants.select { |reg| registrant_passes_filters(reg) }\n end",
"def friend_candidates(for_channels)\n User.all.keep_if { |other|\n (for_channels == other.channel?) && # Select for channels or regular users\n User.public?(other.id) && # Exclude invisible users\n (other.channel? || (other.sign_in_count && (other.sign_in_count > 0))) && # Excluded unconfirmed invites\n (other.id != id) # Don't include this user\n }\n end",
"def assignable_users\n users = project.assignable_users\n users << author if author\n users.uniq.sort\n end",
"def index\n @app_users = AppUser.all\n end",
"def collaborators\n self.users.where(\"project_memberships.active = ?\", true)\n end",
"def projects_users\n all_users_ids = projects.map { |project| project.user_ids }\n all_users_ids.flatten!\n all_users_ids.uniq!\n User.all(conditions: {:_id.in => all_users_ids})\n end",
"def projects_users\n all_users_ids = projects.map { |project| project.user_ids }\n all_users_ids.flatten!\n all_users_ids.uniq!\n User.all(conditions: {:_id.in => all_users_ids})\n end",
"def current_organization_users\n endpoint = '/api/org/users'\n @logger.debug(\"Getting organization users (GET #{endpoint})\") if @debug\n get(endpoint)\n end",
"def owners_contents\n files = applicable_owners_files\n\n return [] if files.nil?\n\n puts \"f: #{files.inspect}\"\n files.map { |f| f[:owners] }\n end",
"def users(users)\n users.to_a.map { |u| Access::Validate.user(u) }\n end",
"def assignable_users\n assignable = Setting.issue_group_assignment? ? Principal.active : User.active\n assignable.sort\n end",
"def users\n if design.only_unblinded\n project.unblinded_members_for_site(subject.site)\n else\n project.members_for_site(subject.site)\n end\n end",
"def owners\n self.authors.collect(&:user)\n end",
"def getAllApprovedUsers()\n users = [] \n docs = @usersColl.find({ \"approval_status.code\" => 1 }, { :username => 1 })\n index = 0\n docs.each do |doc|\n users[index] = doc[:username]\n index += 1\n end # End of docs iteration\n return users\n end",
"def gym_user_instances\n user_names = []\n self.exercise_instances.each do |user|\n user_names << User.all.find {|user_instance| user_instance.id == user.user_id}\n end\n user_names\n \n end",
"def authorized_users\n ProjectAuthorization.select(:user_id).where(project_id: project_ids)\n end",
"def all_principals\n (User.all + UserGroup.where_unit(unit).not(self)).sort { |a, b| a.name.downcase <=> b.name.downcase }\n end",
"def get_relevant_users(include_evaluator = false, include_evaluated = false)\n relevant_users = self.get_team_members\n if not self.adviser_id.blank?\n relevant_users.append(self.adviser.user)\n end\n if not self.mentor_id.blank?\n relevant_users.append(self.mentor.user)\n end\n if include_evaluator\n relevant_users.concat(self.get_evaluator_teams_members)\n end\n if include_evaluated\n relevant_users.concat(self.get_evaluated_teams_members)\n end\n return relevant_users\n end",
"def involved_people\n # [self.user, self.answerers, self.commenters].flatten.uniq\n [self.user].flatten.uniq\n end",
"def assignable_people\n assignable_people_ids.collect{|user_id| User.find(user_id)}\n end",
"def userless_people\n people.select{|p| p.user.nil?}\n end",
"def authorized_apps(user)\n authorized_apps = []\n user.attributes.each do |k, v|\n authorized_apps.push(k) if v == 'Y'\n end\n authorized_apps\n end",
"def grants_individual\n @users = Array.new()\n User.all.each do |u|\n if !u.admin?\n @users.push(u)\n end\n end\n end",
"def signups\n Signup.all.select {|signup| signup.opportunity_id == self.id}\n end",
"def projects_owned\n Project.all.select {|project| project.owner == self}\n end",
"def all_active_directory_users\n filter = Net::LDAP::Filter.construct(\n '(&(objectCategory=organizationalPerson)(givenName=*)(sn=*)(objectClass=User)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))')\n entries = OP_CONN.search(filter: filter)\n users = []\n entries.each do |entry|\n user = User.new(convert_user_attributes(entry))\n user.status = :enabled if (!user.disabled? && user.is_app_user?)\n users << user\n end\n users\n rescue Net::LDAP::LdapError => e\n return []\n end",
"def related_groups_users\n [].tap do |related_users|\n all_groups.each do |group|\n related_users << group.all_users.reject { |group_user| group_user == self }\n end\n end.flatten.uniq\n end",
"def group_owners_only\n where('group_owner_id.null': true)\n end",
"def owners\n entities.map{|e| (e.investment.company.id if e.investment)}.reject{|i| i == nil}\n end",
"def owners=(value)\n @owners = value\n end",
"def get_available_users(event)\n event.teamsheet_entries_available.collect{|tse| tse.user_id.to_s}\n end",
"def household_users\n User.where(id: household_user_ids)\n end",
"def invite_users\n if GroupsController.group_owner? current_user.id, params[:id]\n set_group\n params[:users].each do |email|\n user = User.find_by_email(email) # TODO: only possible because email is unique. Should make magic assist to return user id's\n @group.users << user unless @group.users.include? user or user.nil?\n end unless params[:users].nil?\n respond_to do |format|\n format.html { redirect_to group_path(@group), alert: 'Invited users successfully.' }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to groups_path, alert: \"Not invited. You are not the group owner\" }\n format.json { render json: \"Only owners can add users to the respective group\", status: :unauthorized}\n end\n end\n end"
] |
[
"0.68761355",
"0.6455158",
"0.6327592",
"0.6300272",
"0.6257901",
"0.60782826",
"0.6037363",
"0.6017995",
"0.5982276",
"0.59057945",
"0.5870208",
"0.5833938",
"0.58004457",
"0.57840556",
"0.5711231",
"0.57083935",
"0.570725",
"0.57026416",
"0.5691462",
"0.56893307",
"0.5670895",
"0.5668391",
"0.56668997",
"0.5640673",
"0.5635466",
"0.5616675",
"0.55997795",
"0.5598354",
"0.557043",
"0.55598444",
"0.5537523",
"0.55353916",
"0.55212754",
"0.55201715",
"0.5508708",
"0.55010545",
"0.54898775",
"0.54849154",
"0.546306",
"0.54494125",
"0.5442326",
"0.54396427",
"0.5432123",
"0.54203504",
"0.54127795",
"0.54008704",
"0.54000336",
"0.53967226",
"0.53948426",
"0.5386919",
"0.536517",
"0.5362327",
"0.5361165",
"0.5353467",
"0.5347357",
"0.5323421",
"0.53191817",
"0.5317453",
"0.5310535",
"0.53098494",
"0.53025216",
"0.52966285",
"0.5291366",
"0.5290825",
"0.52864957",
"0.5285508",
"0.5279368",
"0.52787554",
"0.52777064",
"0.5274787",
"0.5270902",
"0.52699167",
"0.52573425",
"0.52573425",
"0.5257162",
"0.5256937",
"0.525135",
"0.52434134",
"0.5229227",
"0.52285016",
"0.522531",
"0.5222367",
"0.5218031",
"0.5217646",
"0.52115333",
"0.5209721",
"0.5209358",
"0.52083117",
"0.5206402",
"0.52019006",
"0.5198965",
"0.5189775",
"0.5189686",
"0.51876867",
"0.5185864",
"0.51843524",
"0.5176338",
"0.51740444",
"0.51669323",
"0.51668465"
] |
0.7603173
|
0
|
Returns a collection of Site admins and challenge admins
|
def host_lead_dxusers
User.site_admins.or(User.challenge_admins).order(:dxuser).distinct.pluck(:dxuser)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @site_admins = SiteAdmin.all\n end",
"def admins\n app_users.select(&:admin?)\n end",
"def get_admins\n\t\t@sm = Member.where(society_id: self.id)\n\t\t@admins = []\n\t\t@sm.each do |m|\n\t\t #if is an admin, add to array\n\t\t if m.admin then @admins << User.find_by_id(m.user_id) end\n\t\tend\n\t\treturn @admins\n end",
"def fetch_admins\n @admins = Admin.get_all_admins_from_memcache(@client_id)\n\n @admins.each do |admin|\n if admin.role == GlobalConstant::Admin.super_admin_role\n @super_admins[admin.id] = admin\n else\n @normal_admins[admin.id] = admin\n end\n end\n\n end",
"def admins\n [self.user.email, self.study_shares.can_edit, User.where(admin: true).pluck(:email)].flatten.uniq\n end",
"def admins\n User.where(id: memberships.admin.pluck(:user_id)).all\n end",
"def fetch_admins\n admin_objs = Admin.not_deleted.where(default_client_id: @client_id).order({id: :desc}).all\n admin_objs.each do |admin|\n @admin_user_count += 1\n @curr_page_data << {\n id: admin.id,\n name: admin.name,\n email: admin.email,\n status: admin.status,\n role: admin.role\n }\n end\n\n @can_invite_new_user = (@admin.role == GlobalConstant::Admin.super_admin_role && @admin_user_count < 20) ? true : false\n end",
"def get_admins\n self._get_reviewers(\"admin\")\n end",
"def administrators\n adminrole = Role.find(:first, :conditions => \"#{self.class.primary_key}=#{self.id} AND name='Administrator'\")\n adminrole ?\n adminrole.users.select{|u| u.company==self} : nil\n end",
"def admins\n [self.user.email, self.user_annotation_shares.can_edit, User.where(admin: true).pluck(:email)].flatten.uniq\n end",
"def index\n @user_admins = UserAdmin.all\n end",
"def index\n administrators = Administrator.all\n admin_list = []\n administrators.each do |admin|\n admin_info = admin.attributes\n admin_info[:user] = User.find(admin[\"user_id\"])\n admin_info[:geofence] = Geofence.find(admin[\"geofence_id\"])\n admin_list << admin_info\n end\n @administrators = admin_list\n end",
"def other_administrators\n Administrator.where.not(['id = ? or is_super = ?',self.id, true]).order(:organisation).map {\n |t| ['%{org}: %{lname} %{name}'%{org: t.organisation, lname: t.info.last_name, name: t.info.name},t.id]\n }\n end",
"def index\n @saas_admins = Admin.all\n end",
"def admins\n # Use the where clause to return users who have admin column set to true (false by default)\n board_members.where(is_admin: true)\n end",
"def admins\n contributors.where(admin: true)\n end",
"def admin_index\n authorize User\n @users = current_user.org.users.includes(:roles)\n end",
"def index\n @administrators = Administrator.all\n end",
"def index\n @administrators = Administrator.all\n end",
"def index\n @administrators = Administrator.all\n end",
"def administrators\n members.where(memberships: { role: 'admin' })\n end",
"def index\n @admins = @admin.role == 1 ? Admin.order(first_name: 'asc') : Admin.joins(:admins_sites).where(\"site_id = ?\", @site.id).order('first_name asc')\n end",
"def get_admins_by_id\n return filter_by_id(get_admins)\n end",
"def index\n @admins = Admin.all\n end",
"def index\n @admins = Admin.all\n end",
"def index\n @admins = Admin.all\n end",
"def index\n @admins = Admin.all\n end",
"def index\n @admins = Admin.all\n end",
"def index\n @admins = Admin.all\n end",
"def admins\n ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::Admin)\n end",
"def index\n @admin_admins = Admin::Admin.page(params[:page]).per(15).load\n end",
"def index\n @admin_users = Admin::User.all\n end",
"def index\n @admins = Admin.all\n\n\n\n\n\n end",
"def index\n @world_admins = WorldAdmin.all\n end",
"def authorized_partner_sites\n if has_role? 'admin'\n sites = PartnerSite.all\n else\n sites =\n PartnerSite.all :conditions => [ 'partner_id = ?', partner_id ]\n end\n sites\n end",
"def active_admins\n admins.select { |admin| circle.has_active_user?(admin) }\n end",
"def admin\n @userList = User.all\n end",
"def index\n @adminusers = Adminuser.all\n end",
"def get_sites\n\t\ts = get_admin_section \"system.applicationHost/sites\"\n\t IisObjectCollection.new s.Collection, :site, Site, lambda { |site| site.id = s.Collection.Count + 1 }\n end",
"def active_admins\n admins.select {|admin| circle.has_active_user?(admin) }\n end",
"def all_sub_admins\n unless @current_admin.is_super_admin\n flash[:error]=\"You are not authorized to navigate to this page \"\n redirect_to admin_index_path\n return\n end\n @all_sub_admins=Admin.where(\"is_super_admin !=?\", true).paginate(:page => params[:page], :per_page => 9)\n end",
"def index\n restrict 'allow only admins' or begin\n @admins = Admin.find(:all)\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @admins.to_xml }\n end\n end\n end",
"def index\n restrict 'allow only admins' or begin\n @admins = Admin.find(:all)\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @admins.to_xml }\n end\n end\n end",
"def admins\n group_users(admins_join_table)\n end",
"def members\n\t\t(self.users.to_a + self.admins.to_a).uniq\n\tend",
"def users\n if design.only_unblinded\n project.unblinded_members_for_site(subject.site)\n else\n project.members_for_site(subject.site)\n end\n end",
"def list_admins\n service_response = ManagerManagement::Team::ListAdmins.new(params).perform\n return render_api_response(service_response)\n end",
"def project_administrators\n people_with_the_role(Seek::Roles::PROJECT_ADMINISTRATOR)\n end",
"def project_administrators\n people_with_the_role(Seek::Roles::PROJECT_ADMINISTRATOR)\n end",
"def index\n @admins = Admin.order(:email)\n authorize @admins\n end",
"def index\n @user_admins = UserAdmin.ignore_fields_user.page params[:page]\n end",
"def setup_admins_users\n begin\n click_on('Logout')\n rescue\n print\n end\n\n Warden.test_reset!\n\n @a1 = admins(:elle_woods)\n @a2 = admins(:vivian_kensington)\n @a3 = admins(:emmett_richmond)\n\n @u1 = users(:connery)\n @u2 = users(:moore)\n @u3 = users(:brosnan)\nend",
"def show_admins\r\n @admins_pages, @admins = paginate(:users, \r\n :conditions => ['level = 2'],\r\n :order => 'username') \r\n end",
"def admin_all_users\n\n # Get the Current App\n @app = MailfunnelsUtil.get_app\n\n # If the User is not an admin redirect to error page\n if !@app.is_admin or @app.is_admin === 0\n redirect_to '/error_page'\n end\n\n\n # Otherwise get list of all Users\n @users = User.all\n\n end",
"def administered_journals\n journal_query = Journal.all\n journal_query = yield(journal_query) if block_given?\n if site_admin?\n journal_query\n else\n roles = [:manage_users, :administer]\n filter_authorized_set(roles, journal_query)\n end\n end",
"def admin\n @happykid = OpeningTime.all\n @promo = Promo.all\n @news = News.all\n @siteInfo = SiteInfo.all\n @staff = Staff.all\n end",
"def index\n authorize Admin\n @admins = initialize_grid(Admin.where(\"id != ?\", current_admin.id).order('id desc'), per_page: 10)\n end",
"def index\n @admin_administrators = Admin::Administrator.page(params[:page])\n end",
"def index\n @admin_n_admins = Admin::NAdmin.all\n end",
"def administrators\n @users = User.admin.search_sort_paginate(params)\n end",
"def admins\r\n AdminsController.instance\r\n end",
"def index\n @admin_surveys = Admin::Survey.all\n end",
"def index\n @administrators = @administrators_active\n @administrators_count = @administrators.size\n end",
"def index\n @admin = Admin.find_by(id: session[:admin_id])\n @admins = Admin.select_admins_to_show(@admin)\n end",
"def index\n @subadmins = Subadmin.all\n end",
"def index\n\t\tis_current_role_site_admin = session[:role] == User.site_admin\n\t\tis_current_role_vendor_admin = session[:role] == User.vendor_admin\n\t\tis_administrator_role = is_current_role_site_admin || is_current_role_vendor_admin\n\t\tif is_administrator_role\n\t\t\t@users = User.all.where(role_id: Role.get_user_id)\n\t\tend\n\tend",
"def index\n return unless authenticated_admin?\n @users = User.all\n end",
"def users\n # TODO use SQL\n results = self.approvers + self.observers + [self.requester]\n results.compact\n end",
"def index\n authorize Admin\n @admins = User.find_by_sql([\"select * from users where role = ?\",2])\n end",
"def index\n @siteusers = Siteuser.all\n end",
"def admins( params={} )\n admins = get_connections(\"admins\", params)\n return map_connections admins, :to => Facebook::Graph::Admin\n end",
"def index\n if current_user.admin == 0\n @eleves_cu = @eleves.where(:user_id => current_user.id).all\n end\n end",
"def send_invitation_emails_to_site_admins(space, site_admins)\n host_lead = space.host_lead # the admin who's created the current administrator space\n\n return if site_admins.empty?\n\n admin_membership = space.space_memberships.find_by(user: host_lead)\n\n site_admins.each do |site_admin|\n membership = space.space_memberships.active.where(user_id: site_admin.id).first\n SpaceEventService.call(space.id, admin_membership.user_id, admin_membership, membership, :membership_added)\n end\n end",
"def guest_lead_dxusers\n User.site_admins.\n or(User.challenge_admins).\n or(User.challenge_evaluators).\n order(:dxuser).distinct.pluck(:dxuser)\n end",
"def create_site_admin_invitations_to_space(space, site_admins)\n host_lead = space.host_lead # the admin who's created the current administrator space\n\n return if site_admins.empty?\n\n admin_membership = space.space_memberships.find_by(user: host_lead)\n\n site_admins.each do |site_admin|\n # rubocop:disable Layout/LineLength\n Rails.logger.info(\"Adding site admin #{user.dxuser} to space #{space.id}\" \\\n \" with admin membership #{admin_membership.id}\")\n SpaceMembershipService::CreateOrUpdate.call(api, space, site_admin, SpaceMembership::ROLE_ADMIN, admin_membership, false)\n NotificationsMailer.space_activated_email(space, admin_membership).deliver_now!\n # rubocop:enable Layout/LineLength\n end\n end",
"def index\n @admins = Admin.page(params[:page]).per(20)\n end",
"def index\n if current_user.admin?\n @users = User.all\n end\n \n end",
"def index\n @adminstrators = Administrator.order(:name)\n end",
"def index\n @shop_admins = ShopAdmin.all\n end",
"def admin_labs\n self.roles.where(name: \"admin\", resource_type: \"Lab\")\n end",
"def index\n if(!admin_signed_in?)\n redirect_back(fallback_location: root_path, notice: 'Acesso negado.')\n end\n @admins = Admin.all\n end",
"def index\n if Administrator.find_by_user_id(current_user.id).admin\n @users = User.all\n else\n redirect_to root_path\n end\n end",
"def index\n @admins = Admin.where(invitation_token: nil)\n end",
"def models\n [::AdminSet, Hyrax::AdministrativeSet]\n end",
"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 index\n # @admins = admin.all\n @admins = Admin.order(:nome)\n end",
"def index\n\t\tif (current_user.has_role? :super_admin)\n\t\t\t@users = User.with_role :admin\n\t\telse\n\t\t\t@users = User.with_role :member\n\t\tend\n\tend",
"def index\n # Replace TaskAdmin with User if we want SuperAdmin to manage all users\n @users = TaskAdmin.all\n end",
"def index\n @admins = Admin.select(:id, :email).order(:email)\n end",
"def info_for_forms\n #Info for page\n #Saving info if we are SA\n @is_super_admin = is_super?\n #Array of admins for SA\n @admins = User.admins_list(with_mentors: false) if @is_super_admin\n end",
"def index\n @admin_cie_users = Registry::CieUser.all\n end",
"def index\n role = Role.find_by_name('SuperAdmin')\n @users = role.users\n end",
"def index\n @@is_current_user_admin = signed_in? && current_user[:admin]\n\n @current_user_collections = if signed_in?\n (\n Collection.where(user_id: current_user).map do |collection|\n [collection.name, collection.id]\n end\n )\n end\n\n end",
"def index\n @collection_center_admins = CollectionCenterAdmin.all\n end",
"def admin\n check_admin_without_render(current_user)\n @users = User.find(:all, :order => \"updated_at\", :conditions => [\"junk is NOT NULL\", ])\n end",
"def index\n if current_admin.role != 'leader'\n redirect_to '/home/top'\n end\n @admins = Admin.all\n end",
"def setup\n @useradmin3 = useradmins(:useradmin3)\n @user3 = users(:three)\n end",
"def index\n\t\t@users = AdminUser.sorted\n\tend",
"def local_admins\n\tlist_of_users_tocheck = []\n\tfor x in Dir.entries(\"/Users\")\n\t\tif !x.start_with?(\".\")\n\t\t\tlist_of_users_tocheck.push(x)\n\t\tend\n\tend\n\n\tlocaladmins = []\n\tfor x in list_of_users_tocheck\n\t\tif `dsmemberutil checkmembership -U #{x} -G admin 2>/dev/null`.chomp == \"user is a member of the group\"\n\t\tlocaladmins.push(x)\n\t\tend\n\tend\n\tputs \"Local Admins:\"\n\treturn localadmins\nend",
"def sites\n if permission.value.positive?\n Site.all_cached\n else\n Rails.cache.fetch(\"user_#{id}_sites\", expires_in: 1.month, race_condition_ttl: 30.seconds) do\n puts 'user sites not cached'\n connections.map { |c| Site.find(c.site_id) }.sort_by(&:title)\n end\n end\n end"
] |
[
"0.7457911",
"0.7408283",
"0.7276864",
"0.71543795",
"0.71151084",
"0.70422775",
"0.6932943",
"0.68824244",
"0.6839848",
"0.6750798",
"0.67470515",
"0.6744809",
"0.6727442",
"0.67062026",
"0.661232",
"0.6602632",
"0.6580056",
"0.6561919",
"0.6561919",
"0.6561919",
"0.6528465",
"0.6522866",
"0.65113807",
"0.64807063",
"0.64807063",
"0.64807063",
"0.64807063",
"0.64807063",
"0.64807063",
"0.6417275",
"0.6380642",
"0.63768476",
"0.63571054",
"0.6334894",
"0.63227266",
"0.6317181",
"0.62987196",
"0.62927866",
"0.62917274",
"0.62912345",
"0.6279198",
"0.6265696",
"0.6265696",
"0.62605643",
"0.6260521",
"0.6247555",
"0.62464035",
"0.624276",
"0.624276",
"0.6241782",
"0.6237046",
"0.62330854",
"0.62263834",
"0.62143177",
"0.6213117",
"0.62121505",
"0.6202561",
"0.61893284",
"0.617668",
"0.6172893",
"0.61390185",
"0.61327785",
"0.61241925",
"0.61222404",
"0.61179596",
"0.61174905",
"0.6104262",
"0.61016554",
"0.6085779",
"0.6082384",
"0.60756093",
"0.60733515",
"0.60687506",
"0.6060355",
"0.6056922",
"0.6055355",
"0.60408247",
"0.60292053",
"0.6025588",
"0.602553",
"0.60190153",
"0.6004717",
"0.60005057",
"0.5999323",
"0.5998459",
"0.5992954",
"0.598995",
"0.5975788",
"0.59724617",
"0.59474933",
"0.59381163",
"0.5935076",
"0.5920903",
"0.59163135",
"0.5914034",
"0.59035075",
"0.5901238",
"0.58944243",
"0.58922523",
"0.5884517"
] |
0.6544892
|
20
|
Returns a collection of Site admins, challenge evaluators and challenge admins
|
def guest_lead_dxusers
User.site_admins.
or(User.challenge_admins).
or(User.challenge_evaluators).
order(:dxuser).distinct.pluck(:dxuser)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @site_admins = SiteAdmin.all\n end",
"def admins\n app_users.select(&:admin?)\n end",
"def get_admins\n\t\t@sm = Member.where(society_id: self.id)\n\t\t@admins = []\n\t\t@sm.each do |m|\n\t\t #if is an admin, add to array\n\t\t if m.admin then @admins << User.find_by_id(m.user_id) end\n\t\tend\n\t\treturn @admins\n end",
"def get_admins\n self._get_reviewers(\"admin\")\n end",
"def fetch_admins\n @admins = Admin.get_all_admins_from_memcache(@client_id)\n\n @admins.each do |admin|\n if admin.role == GlobalConstant::Admin.super_admin_role\n @super_admins[admin.id] = admin\n else\n @normal_admins[admin.id] = admin\n end\n end\n\n end",
"def admins\n [self.user.email, self.study_shares.can_edit, User.where(admin: true).pluck(:email)].flatten.uniq\n end",
"def administrators\n adminrole = Role.find(:first, :conditions => \"#{self.class.primary_key}=#{self.id} AND name='Administrator'\")\n adminrole ?\n adminrole.users.select{|u| u.company==self} : nil\n end",
"def index\n administrators = Administrator.all\n admin_list = []\n administrators.each do |admin|\n admin_info = admin.attributes\n admin_info[:user] = User.find(admin[\"user_id\"])\n admin_info[:geofence] = Geofence.find(admin[\"geofence_id\"])\n admin_list << admin_info\n end\n @administrators = admin_list\n end",
"def admins\n User.where(id: memberships.admin.pluck(:user_id)).all\n end",
"def index\n @user_admins = UserAdmin.all\n end",
"def index\n @administrators = Administrator.all\n end",
"def index\n @administrators = Administrator.all\n end",
"def index\n @administrators = Administrator.all\n end",
"def fetch_admins\n admin_objs = Admin.not_deleted.where(default_client_id: @client_id).order({id: :desc}).all\n admin_objs.each do |admin|\n @admin_user_count += 1\n @curr_page_data << {\n id: admin.id,\n name: admin.name,\n email: admin.email,\n status: admin.status,\n role: admin.role\n }\n end\n\n @can_invite_new_user = (@admin.role == GlobalConstant::Admin.super_admin_role && @admin_user_count < 20) ? true : false\n end",
"def admins\n [self.user.email, self.user_annotation_shares.can_edit, User.where(admin: true).pluck(:email)].flatten.uniq\n end",
"def host_lead_dxusers\n User.site_admins.or(User.challenge_admins).order(:dxuser).distinct.pluck(:dxuser)\n end",
"def index\n @saas_admins = Admin.all\n end",
"def administrators\n members.where(memberships: { role: 'admin' })\n end",
"def admin_index\n authorize User\n @users = current_user.org.users.includes(:roles)\n end",
"def users\n # TODO use SQL\n results = self.approvers + self.observers + [self.requester]\n results.compact\n end",
"def get_sites\n\t\ts = get_admin_section \"system.applicationHost/sites\"\n\t IisObjectCollection.new s.Collection, :site, Site, lambda { |site| site.id = s.Collection.Count + 1 }\n end",
"def index\n @admins = Admin.all\n end",
"def index\n @admins = Admin.all\n end",
"def index\n @admins = Admin.all\n end",
"def index\n @admins = Admin.all\n end",
"def index\n @admins = Admin.all\n end",
"def index\n @admins = Admin.all\n end",
"def admins\n contributors.where(admin: true)\n end",
"def admins\n # Use the where clause to return users who have admin column set to true (false by default)\n board_members.where(is_admin: true)\n end",
"def index\n @admin_users = Admin::User.all\n end",
"def other_administrators\n Administrator.where.not(['id = ? or is_super = ?',self.id, true]).order(:organisation).map {\n |t| ['%{org}: %{lname} %{name}'%{org: t.organisation, lname: t.info.last_name, name: t.info.name},t.id]\n }\n end",
"def index\n @admin_surveys = Admin::Survey.all\n end",
"def project_administrators\n people_with_the_role(Seek::Roles::PROJECT_ADMINISTRATOR)\n end",
"def project_administrators\n people_with_the_role(Seek::Roles::PROJECT_ADMINISTRATOR)\n end",
"def authorized_partner_sites\n if has_role? 'admin'\n sites = PartnerSite.all\n else\n sites =\n PartnerSite.all :conditions => [ 'partner_id = ?', partner_id ]\n end\n sites\n end",
"def index\n @admin_admins = Admin::Admin.page(params[:page]).per(15).load\n end",
"def admin\n @happykid = OpeningTime.all\n @promo = Promo.all\n @news = News.all\n @siteInfo = SiteInfo.all\n @staff = Staff.all\n end",
"def index\n @adminusers = Adminuser.all\n end",
"def members\n\t\t(self.users.to_a + self.admins.to_a).uniq\n\tend",
"def admins\n ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::Admin)\n end",
"def setup_admins_users\n begin\n click_on('Logout')\n rescue\n print\n end\n\n Warden.test_reset!\n\n @a1 = admins(:elle_woods)\n @a2 = admins(:vivian_kensington)\n @a3 = admins(:emmett_richmond)\n\n @u1 = users(:connery)\n @u2 = users(:moore)\n @u3 = users(:brosnan)\nend",
"def models\n [::AdminSet, Hyrax::AdministrativeSet]\n end",
"def index\n @admin_administrators = Admin::Administrator.page(params[:page])\n end",
"def index\n @world_admins = WorldAdmin.all\n end",
"def get_admins_by_id\n return filter_by_id(get_admins)\n end",
"def index\n @admins = Admin.all\n\n\n\n\n\n end",
"def index\n @administrators = @administrators_active\n @administrators_count = @administrators.size\n end",
"def index\n @admins = @admin.role == 1 ? Admin.order(first_name: 'asc') : Admin.joins(:admins_sites).where(\"site_id = ?\", @site.id).order('first_name asc')\n end",
"def index\n @admin_n_admins = Admin::NAdmin.all\n end",
"def users\n if design.only_unblinded\n project.unblinded_members_for_site(subject.site)\n else\n project.members_for_site(subject.site)\n end\n end",
"def active_admins\n admins.select { |admin| circle.has_active_user?(admin) }\n end",
"def admin\n @userList = User.all\n end",
"def administrators\n @users = User.admin.search_sort_paginate(params)\n end",
"def active_admins\n admins.select {|admin| circle.has_active_user?(admin) }\n end",
"def index\n @admin_cie_users = Registry::CieUser.all\n end",
"def admins\r\n AdminsController.instance\r\n end",
"def index\n return unless authenticated_admin?\n @users = User.all\n end",
"def index\n @admins = Admin.order(:email)\n authorize @admins\n end",
"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 index\n @adminstrators = Administrator.order(:name)\n end",
"def index\n @user_admins = UserAdmin.ignore_fields_user.page params[:page]\n end",
"def index\n authorize Admin\n @admins = initialize_grid(Admin.where(\"id != ?\", current_admin.id).order('id desc'), per_page: 10)\n end",
"def index\n\t\tis_current_role_site_admin = session[:role] == User.site_admin\n\t\tis_current_role_vendor_admin = session[:role] == User.vendor_admin\n\t\tis_administrator_role = is_current_role_site_admin || is_current_role_vendor_admin\n\t\tif is_administrator_role\n\t\t\t@users = User.all.where(role_id: Role.get_user_id)\n\t\tend\n\tend",
"def index\n restrict 'allow only admins' or begin\n @admins = Admin.find(:all)\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @admins.to_xml }\n end\n end\n end",
"def index\n restrict 'allow only admins' or begin\n @admins = Admin.find(:all)\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @admins.to_xml }\n end\n end\n end",
"def list_admins\n service_response = ManagerManagement::Team::ListAdmins.new(params).perform\n return render_api_response(service_response)\n end",
"def administered_journals\n journal_query = Journal.all\n journal_query = yield(journal_query) if block_given?\n if site_admin?\n journal_query\n else\n roles = [:manage_users, :administer]\n filter_authorized_set(roles, journal_query)\n end\n end",
"def index\n @admins = Admin.where(invitation_token: nil)\n end",
"def index\n # Replace TaskAdmin with User if we want SuperAdmin to manage all users\n @users = TaskAdmin.all\n end",
"def index\n\t\tif (current_user.has_role? :super_admin)\n\t\t\t@users = User.with_role :admin\n\t\telse\n\t\t\t@users = User.with_role :member\n\t\tend\n\tend",
"def users\n return @canonical_user_pool if @canonical_user_pool\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Retrieving all users\"\n check_retval @user_pool.info!\n\n @canonical_user_pool = []\n @user_pool.each { |user| @canonical_user_pool << canonical_user(user) }\n @canonical_user_pool\n end",
"def index\n if current_user.admin == 0\n @eleves_cu = @eleves.where(:user_id => current_user.id).all\n end\n end",
"def users\n gateway_check\n @users\n end",
"def index\n @siteusers = Siteuser.all\n end",
"def admin_labs\n self.roles.where(name: \"admin\", resource_type: \"Lab\")\n end",
"def sites\n if permission.value.positive?\n Site.all_cached\n else\n Rails.cache.fetch(\"user_#{id}_sites\", expires_in: 1.month, race_condition_ttl: 30.seconds) do\n puts 'user sites not cached'\n connections.map { |c| Site.find(c.site_id) }.sort_by(&:title)\n end\n end\n end",
"def users\n return @users\n end",
"def setup\n @useradmin3 = useradmins(:useradmin3)\n @user3 = users(:three)\n end",
"def index\n @subadmins = Subadmin.all\n end",
"def users\n gateway_check\n unavailable_servers_check\n @users\n end",
"def index\n @admin = Admin.find_by(id: session[:admin_id])\n @admins = Admin.select_admins_to_show(@admin)\n end",
"def index\n if current_user.admin?\n @users = User.all\n end\n \n end",
"def admin_all_users\n\n # Get the Current App\n @app = MailfunnelsUtil.get_app\n\n # If the User is not an admin redirect to error page\n if !@app.is_admin or @app.is_admin === 0\n redirect_to '/error_page'\n end\n\n\n # Otherwise get list of all Users\n @users = User.all\n\n end",
"def index\n @administrator_locals = AdministratorLocal.all\n end",
"def index\n\t\t@users = AdminUser.sorted\n\tend",
"def index\n @admin_governorates = Admin::Governorate.all\n end",
"def index\n @collection_center_admins = CollectionCenterAdmin.all\n end",
"def users\n @users\n end",
"def all_viewable_sites\n Site\n .current\n .with_project_or_as_site_user(all_viewable_projects.select(:id), id)\n end",
"def show_admins\r\n @admins_pages, @admins = paginate(:users, \r\n :conditions => ['level = 2'],\r\n :order => 'username') \r\n end",
"def index\n @admin_managers = Admin::Manager.all\n end",
"def all_sub_admins\n unless @current_admin.is_super_admin\n flash[:error]=\"You are not authorized to navigate to this page \"\n redirect_to admin_index_path\n return\n end\n @all_sub_admins=Admin.where(\"is_super_admin !=?\", true).paginate(:page => params[:page], :per_page => 9)\n end",
"def index\n @admins = Admin.page(params[:page]).per(20)\n end",
"def index\n @shop_admins = ShopAdmin.all\n end",
"def all\n @teachers = @admin.children.unblocked.order(User::DEFAULT_ORDER)\n end",
"def hosts\n @salticid.hosts.select do |host|\n host.roles.include? self\n end\n end",
"def setup\n @admin = users(:admin)\n @user = users(:user)\n end",
"def info_for_forms\n #Info for page\n #Saving info if we are SA\n @is_super_admin = is_super?\n #Array of admins for SA\n @admins = User.admins_list(with_mentors: false) if @is_super_admin\n end",
"def index\n @@is_current_user_admin = signed_in? && current_user[:admin]\n\n @current_user_collections = if signed_in?\n (\n Collection.where(user_id: current_user).map do |collection|\n [collection.name, collection.id]\n end\n )\n end\n\n end",
"def admins\n group_users(admins_join_table)\n end"
] |
[
"0.71780044",
"0.7064868",
"0.7014453",
"0.6884545",
"0.6868511",
"0.6767423",
"0.66854346",
"0.6657168",
"0.66530436",
"0.6567124",
"0.65520495",
"0.65520495",
"0.65520495",
"0.6521446",
"0.6419314",
"0.63916934",
"0.63889843",
"0.6383546",
"0.63315034",
"0.63212305",
"0.6302532",
"0.6298408",
"0.6298408",
"0.6298408",
"0.6298408",
"0.6298408",
"0.6298408",
"0.6292342",
"0.6289846",
"0.62720704",
"0.62642246",
"0.6213432",
"0.61983645",
"0.61983645",
"0.61452466",
"0.6139724",
"0.6126055",
"0.6118322",
"0.6115811",
"0.61096126",
"0.6108909",
"0.6103434",
"0.60971487",
"0.6093636",
"0.6090437",
"0.60893387",
"0.60813767",
"0.6071633",
"0.60698456",
"0.6053082",
"0.6051639",
"0.6040025",
"0.60359615",
"0.60183",
"0.5996995",
"0.5996339",
"0.596959",
"0.5963461",
"0.59531593",
"0.59516954",
"0.5950149",
"0.5937162",
"0.5933967",
"0.59201235",
"0.59201235",
"0.59039456",
"0.58985555",
"0.58978",
"0.5896117",
"0.58856905",
"0.58844817",
"0.5884289",
"0.5880076",
"0.58791304",
"0.5875859",
"0.58706933",
"0.5863071",
"0.5862284",
"0.58600664",
"0.58534175",
"0.5851727",
"0.58352935",
"0.5831254",
"0.5828997",
"0.5828307",
"0.5817378",
"0.58157575",
"0.5814279",
"0.579979",
"0.57970977",
"0.5793601",
"0.57903916",
"0.5785287",
"0.5780828",
"0.57763207",
"0.5745374",
"0.5742243",
"0.57354563",
"0.5732166",
"0.57219946"
] |
0.59945494
|
56
|
Returns a collection of challenges for selection on challenge edit page
|
def challenge_order_for_select
Challenge.not_status(Challenge::STATUS_ARCHIVED).all.map { |ch| [ch.name, ch.id] }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def team_challenge_list\n @team_challenges = TeamChallenge.find_by_user(current_user.id)\n end",
"def index\n @user_challenges = UserChallenge.all\n end",
"def index\n @challenges = Challenge.all\n end",
"def index\n @challenges = Challenge.all\n end",
"def index\n @challenges = Challenge.all\n end",
"def index\n @challenges = Challenge.all\n end",
"def mychallenges\n\t\tputs \"------------------\"\n\t\t# puts session[:users]\n\t\tputs current_user\n\t\t#puts current_user.id\n\t\tputs \"@@@@@@@@@@@@@@@@@@\"\n\n\t\t@challenges = Challenge.all(:limit => 10, :conditions => {:user_id => current_user.id})\n\tend",
"def index\n @challenges = Challenge.all params[:filters], params[:page]\n end",
"def index\n @challenges = Challenge.all.order('difficulty ASC')\n end",
"def index\n @challenge_instances = ChallengeInstance.all\n end",
"def index\n @challenge_instances = ChallengeInstance.all\n end",
"def index\n @challenge_participants = @challenge.challenge_participants.includes(:team, :user)\n end",
"def challenges; end",
"def index\n @question_option_selections = @question_answer.question_option_selections\n end",
"def index\n @challenge_types = ChallengeType.all\n end",
"def show\n @challenge = Challenge.find(params[:id])\n @users = User.all\n @user = User.find(current_user.id)\n @cre_user = @challenge.us_chal_interactions.where(:interaction => \"created\").first.user\n @interaction = UsChalInteraction.where(:user_id => current_user.id, :challenge_id => @challenge.id).first\n @submissions = @challenge.submissions\n end",
"def index\n\t\tif params[:tag]\n\t\t\t@challenges = Challenge.tagged_with(params[:tag])\n\t\telse\n\t\t\t@challenges = Challenge.all\n\t\tend\n\tend",
"def index\n @challenges = Challenge.order(:id)\n .includes(:user)\n .page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end",
"def participants\n expose Challenge.participants(@oauth_token, params[:challenge_id].strip)\n end",
"def index\n @weekly_challenges = WeeklyChallenge.all\n end",
"def index\n @challenges = Challenge.user(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end",
"def show\n @competition = Competition.includes(:challenges).find(params[:id])\n end",
"def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @challenges }\n end\n end",
"def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end",
"def createChallenges\n for tab in Lecode_BattleChallenge::Challenges\n chall = Battle_Challenge.new\n chall.name = tab[0]\n chall.icon = tab[1]\n chall.description = tab[2]\n chall.gain = tab[3]\n chall.freq = tab[4]\n chall.success_onEnd = tab[5]\n chall.id = @challenges.size\n @challenges.push(chall)\n init_evaluation(chall.name)\n end\n \n end",
"def challenges\n @challenges ||= images.map { |path| File.basename(path, image_file_extension) }\n end",
"def challenges\n @limit = get_limit\n @offset = get_offset(params)\n if !params[:keyword].nil?\n @results_count = Challenge.count(:conditions => [ \"name like :kw or description like :kw\", { :kw => \"%\" + params[:keyword].to_s + \"%\" }])\n @challenges = Challenge.find(:all,\n :conditions => [ \"name like :kw or description like :kw\", { :kw => \"%\" + params[:keyword].to_s + \"%\" }],\n :limit => @limit,\n :offset => @offset)\n end\n @results_pages = @results_count.fdiv(@limit)\n respond_to do |format|\n format.html { render \"manage/challenges/index\" }\n format.xml { render :xml => @challenges }\n end\n end",
"def all\n challenges = Challenge.all(@oauth_token, params[:open], \n params[:technology] ||= nil, \n params[:platform] ||= nil, \n params[:category] ||= nil, \n enforce_order_by_params(params[:order_by], 'end_date__c'),\n params[:limit] ||= 50,\n params[:offset] ||= 0)\n # merge in the topcoder challenges\n Topcoder.challenges_open.each {|c| challenges << c } if params[:include_tc]\n expose challenges\n end",
"def index\n @users = User.where(:listed => 1)\n if current_closed_challenge.present?\n @entries = Entry.where(:challenge_id => current_closed_challenge.id).limit(3)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Entry.all }\n end\n else\n respond_to do |format|\n format.html { render \"challenges/about\" }\n format.json { render json: Entry.all }\n end\n end\n end",
"def relatedChallenges\n Challenge.all(:select => \"challenges.*,skill_challenges.parent_id\",\n :joins => :skill_challenges,\n :conditions => { \n :skill_challenges => { :parent_id => self.skill_challenges.first.parent_id }\n },\n :order => \"skill_challenges.lft\")\n end",
"def challenge\n verify_session() or redirect_to action:'dashboard'\n @rival = User.find params[:id]\n retreiveChallenges #UserHelper::ChallengeInterface\n @challenge = Challenge.new\n end",
"def options\n @my_career_id = current_user.career_id\n @match = []\n @peers = []\n @same_career = User.where(:career_id => @my_career_id)\n @same_career.each do |match| #This can be written with match.expertise != current_user.expertise but I'm anticipating adding more expertise options so I wrote it in a way where I can easily encorporate those later.\n if current_user.expertise == \"Beginner\"\n if match.expertise == \"Expert\" # NOTICE!!! Written this way in anticipation of adding more expertise options (Proficient, Masterful, Mid-level etc.)\n @match.push(match.id)\n elsif match.expertise ==\"Beginner\"\n @peers.push(match.id)\n end\n elsif current_user.expertise == \"Expert\"\n if match.expertise == \"Expert\"\n @peers.push(match.id)\n elsif match.expertise == \"Beginner\"\n @match.push(match.id)\n end\n end\n end\n return @match[0..10] #first 11 matches User id's returned by this method\n end",
"def generate_list\n if $game_temp.lbchll_last_index >= @challenges.size\n $game_temp.lbchll_last_index = 0\n else\n $game_temp.lbchll_last_index += 1\n end\n return @challenges[$game_temp.lbchll_last_index]\n end",
"def index\n @reqdifficulties = Reqdifficulty.all\n end",
"def challenge_participants\n search_param = params[params[:fieldname]]\n collection_id = params[:collection_id]\n render_output(Pseud.limit(10).order(:name).joins(:challenge_signups)\n .where([\"pseuds.name LIKE ? AND challenge_signups.collection_id = ?\", \n '%' + search_param + '%', collection_id]).map(&:byline))\n end",
"def index\n @team_challenges = TeamChallenge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @team_challenges }\n end\n end",
"def get_choices\n @choices = CONNECTION.execute(\"SELECT * FROM choices WHERE question_id = #{@id};\")\n end",
"def index\n @teams = Team.order(:created_at)\n @challenges = Challenge.opened.order(:created_at)\n end",
"def index\n @options = @question.options.all\n end",
"def restructure_challenges(challenges)\n challenge_array = []\n\n challenges.each do |challenge|\n challenge_array.push({\n name: challenge.name,\n description: challenge.description,\n content: challenge.content,\n test: challenge.test,\n user_challenges: challenge.user_challenges.count\n })\n end\n\n return challenge_array\n end",
"def set_challenge\n @challenge = Challenge.find(params[:id])\n end",
"def set_challenge\n @challenge = Challenge.find(params[:id])\n end",
"def index\n @attempt_choices = AttemptChoice.all\n end",
"def index\n @course_proposal_questions = CourseProposalQuestion.all\n end",
"def show\n @choices = Choice.where(course_id: @course.id)\n end",
"def options\n SurveyQuestionOption.where(id: eval(selected_options))\n end",
"def get_choices\n @choices = Choice.where(\"user_id\" => self.id)\n end",
"def show\n challenge_id = params[:challenge_id]\n @challenge = Challenge.find(challenge_id)\n end",
"def index\n @question_options = QuestionOption.all\n end",
"def exercises\n ids = self.exercise_records.pluck(:exercise_id)\n Exercise.where(id: ids)\n end",
"def index\n @photo_challenges = PhotoChallenge.all.includes([:photos, :year, winning_photo: :photo]).reverse\n @grouped_challenges = @photo_challenges.group_by(&:year_id)\n end",
"def show\n include_admin = @current_user.is_admin?\n @submissions_table = @contest.all_submissions_table(include_admin)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @problems }\n end\n end",
"def index\n @assignment = Assignment.find(params[:assignment_id])\n @solutions = @assignment.solutions\n @hash_solutions = {}\n @solutions.pluck(:language).uniq.each {|language| @hash_solutions[language] = @solutions.where('language = ?', language)}\n end",
"def set_challenge_solution\n @challenge_solution = ChallengeSolution.find(params[:id])\n end",
"def index\n @computers_quests = ComputersQuest.all\n end",
"def load_challenges(filter=false)\n challenges = []\n YAML.load_file(\"config.yaml\")[:challenges].each do |challenge|\n if filter\n if filter[:name]\n next unless challenge[:name] == filter[:name]\n elsif filter[:title]\n next unless challenge[:title] == filter[:title]\n elsif filter[:points]\n next unless challenge[:points] == filter[:points]\n elsif filter[:type]\n next unless challenge[:type] == filter[:type]\n elsif filter[:text]\n next unless challenge[:text] == filter[:text]\n elsif filter[:flag]\n next unless challenge[:flag] == filter[:flag]\n elsif filter[:strict]\n next unless challenge[:strict] == filter[:strict]\n end\n end\n challenges << challenge\n end\n return false if challenges.empty?\n if filter[:count]\n filtered_challenges = []\n count = filter[:count]\n if challenges.count >= count\n count.times do\n filtered_challenges << challenges.pop\n end\n else\n false\n end\n if count == 1\n return filtered_challenges[0]\n end\n return filtered_challenges\n end\n challenges\n end",
"def set_challenge\n @challenge = Challenge.find(params[:id])\n end",
"def set_challenge\n @challenge = Challenge.find(params[:id])\n end",
"def set_challenge\n @challenge = Challenge.find(params[:id])\n end",
"def set_challenge\n @challenge = Challenge.find(params[:id])\n end",
"def set_challenge\n @challenge = Challenge.find(params[:id])\n end",
"def set_challenge\n @challenge = Challenge.find(params[:id])\n end",
"def set_challenge\n @challenge = Challenge.find(params[:id])\n end",
"def set_challenge\n @challenge = Challenge.find(params[:id])\n end",
"def set_challenge\n @challenge = Challenge.find(params[:id])\n end",
"def show\n @participations = @challenge.participations \n @participation = @challenge.participations.new\n end",
"def chapters_with_problems\n get_chapters.inject Hash.new do |chapters_with_sections,chapter|\n challenges = Dir[\"ch#{chapter}/challenge/*\"]\n chapters_with_sections[chapter] = challenges.map { |challenge| challenge[%r([^/]+?$)].to_i }.sort\n chapters_with_sections\n end\nend",
"def chosen_options\n Option.find_all_by_id session[:chosen_options]\n end",
"def index\n @project_choices = ProjectChoice.all\n end",
"def index\n @problem_attempts = ProblemAttempt.all\n end",
"def show\n @choices = Choice.where(employee_id: @employee.id)\n end",
"def index\n @selected_answers = SelectedAnswer.all\n end",
"def index\n @exercise_modifications = ExerciseModification.all\n end",
"def get_exercises_list\n exercises_list = []\n inst_sections.each do |inst_section|\n exercises_ids = inst_section.inst_book_section_exercises.collect(&:inst_exercise_id).compact\n exercises_objs = InstExercise.where(id: exercises_ids)\n exercises_list.concat exercises_objs.collect(&:short_name)\n end\n return exercises_list\n end",
"def index\n @curator_of_exhibitions = CuratorOfExhibition.all\n end",
"def attempts\n @course_ids = current_user_or_anonymous_user.challenge_responses.select(:course_id).group(:course_id).map(&:course_id).compact\n\n render json: @course_ids\n end",
"def set_challenge\n @challenge = Challenge.find(params[:id])\n end",
"def index\n @programme_exercises = ProgrammeExercise.all\n end",
"def index\n @difficulty_levels = DifficultyLevel.all\n end",
"def selected_problems\n @selected_problems ||= Problem.find(err_ids)\n end",
"def index\n @contests = current_user.contests\n end",
"def set_competition\n @competition = Competition.includes(:challenges).find(params[:id])\n end",
"def options_for_action_select\n source_array = []\n self.questions.each do |q|\n if q.class == MatrixQuestion\n q.choice_questions.each {|cq| source_array << [\"#{q.question_content.statement}: #{cq.question_content.statement} response\", \"#{cq.question_content.id}\"]}\n else\n source_array << [\"#{q.question_content.statement} response\", \"#{q.question_content.id}\"]\n end\n end\n source_array\n end",
"def set_challenge\n @challenge = Challenge.find(params[:challenge_id])\n end",
"def index\n @challenge_scores = ChallengeScore.all\n end",
"def preview\n @form_data = Form.get_form_by_code(current_user[\"id\"], params[:code])\n @questions = Question.get_questions_by_ids(@form_data['id'], JSON.parse(@form_data['question_order']))\n @all_options = Option.collect_options_per_quetions(JSON.parse(@form_data['question_order']))\n end",
"def show\n @user = User.find_by_username(params[:id])\n\n @entries = Entry.where(:user_id => @user.id).sort_by { |entry| -entry.score }\n\n @challenges = Challenge.where(:user_id => @user.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def edit\n @player_challenge = PlayerChallenge.find(params[:id])\n end",
"def show\n @comments = Comment.where(challenge_id: @challenge).order(\"created_at\")\n @owner = User.where(id: @challenge.owner_id).first # find the owner of the challenge\n end",
"def course\n unless user_signed_in? && current_user.instructor\n render :nothing => true, :status => :unauthorized\n end\n \n $selected_course = Course.where({id: params[:id]}).first\n\n @course_projects = $selected_course.projects.collect{ |project|\n {\n project_name: project.name,\n team_names: project.teams.reduce(''){|names, team| names + team.name + ', '}[0..-3],\n due: project.due.in_time_zone('Eastern Time (US & Canada)').strftime('%Y-%m-%d %I:%M:%S %p')\n }\n }\n\n render :template => \"home/index\"\n end",
"def choose_problems(competition)\n\t\tusers=competition.users\n\t\tcase competition.target\n\t\twhen 1\n\t\t\tproblems=Problem.all.where(target: 1)\n\t\twhen 2\n\t\t\tproblems=Problem.all.where(target: 2)\n\t\twhen 3\n\t\t\tproblems=Problem.all.where(target: 3)\n\t\telse\n\t\t\tproblems=Problem.all\n\t\tend\t\n\t\tchecked_problems=problems.where(checked: true) #<-- add checked\n\t\tunseen_problems=checked_problems\n\t\tusers.each do |u|\n\t\t\tunseen_problems=unseen_problems.select{ |p| !p.viewers.include?(u)}\n\t\tend \n\t\tproblems_length=0\n\t\tproblem=nil\n\t\twhile problems_length < competition.length do\n\t\t\tmax_length=competition.length-problems_length\n\t\t\tproblem=nil\n\t\t\tproblem=unseen_problems.select{ |p| p.length <= max_length && !competition.problems.include?(p)}.sample #balta6tina\n\t\t\tif problem.present?\n\t\t\t\tproblems_length += problem.length\n\t\t\t\tcompetition.competition_problems.create!(problem_id: problem.id)\n\t\t\telse\n\t\t\t\tproblem=checked_problems.select{ |p| p.length <= max_length && !competition.problems.include?(p)}.sample\n\t\t\t\tproblems_length += problem.length\n\t\t\t\tcompetition.competition_problems.create!(problem_id: problem.id)\n\t\t\tend\n\t\tend\t\n end",
"def index\n @possible_answers = PossibleAnswer.all\n end",
"def challenge_detail\n @challenge = Challenge.find(params[:foo])\n end",
"def index\n @challenge = Challenge.find(params[:challenge_id])\n @resources = @challenge.resources\n if params[:index]\n render :all\n else\n render :index\n end\n end",
"def correct_options\n Survey::Question.where(section_id: section_ids).map(&:correct_options).flatten\n end",
"def index\n @choice_sets = ChoiceSet.all\n end",
"def get_choices(question)\n puts 'get_choices()'\n choices = Choice.select('id, prompt').find(question.correct_choice_id, question.close_choice_id)\n choices += Choice.select('id, prompt').where.not(id: question.correct_choice_id).where.not(id: question.close_choice_id).where(choice_type:0).shuffle.first(3)\n choices.shuffle!\n end",
"def index\n @user = User.find(params[:user_id])\n @exercises = @user.exercises.all\n end",
"def index\n @icebreaker_answers = IcebreakerAnswer.all\n end",
"def previous_contested_challenges\n user.challenges.where{id!=my{id}}.where{type==my{self.class.name}}.order(\"ends_on DESC\")\n end"
] |
[
"0.7152797",
"0.66272515",
"0.6515581",
"0.6515581",
"0.6515581",
"0.6515581",
"0.6369654",
"0.633059",
"0.62554073",
"0.607645",
"0.607645",
"0.6020836",
"0.5980763",
"0.59603393",
"0.5954202",
"0.5949412",
"0.59379953",
"0.592673",
"0.58657146",
"0.5747622",
"0.5714936",
"0.57143134",
"0.5709631",
"0.5670797",
"0.56682533",
"0.5641545",
"0.5631936",
"0.56254834",
"0.56120855",
"0.55913925",
"0.5561325",
"0.55383086",
"0.5522387",
"0.5490668",
"0.5474861",
"0.5472473",
"0.54687446",
"0.545538",
"0.5409145",
"0.539452",
"0.5388904",
"0.5388904",
"0.5387616",
"0.5367699",
"0.53637946",
"0.5358211",
"0.53553736",
"0.5343463",
"0.53396",
"0.53372157",
"0.53282636",
"0.5314189",
"0.53122735",
"0.5300928",
"0.5291357",
"0.52810705",
"0.52751684",
"0.52751684",
"0.52751684",
"0.52751684",
"0.52751684",
"0.52751684",
"0.52751684",
"0.52751684",
"0.52751684",
"0.5267947",
"0.52671266",
"0.5260523",
"0.52485055",
"0.52481335",
"0.52479035",
"0.5238707",
"0.52335346",
"0.52327543",
"0.52222365",
"0.521766",
"0.52120703",
"0.518219",
"0.51761734",
"0.5164133",
"0.5159974",
"0.5151952",
"0.5148404",
"0.5146844",
"0.5146494",
"0.5143611",
"0.5140673",
"0.51350284",
"0.5110314",
"0.51019335",
"0.5100557",
"0.50973296",
"0.50944513",
"0.50903136",
"0.5082926",
"0.5075423",
"0.50748605",
"0.5071249",
"0.506911",
"0.5067085"
] |
0.55902135
|
30
|
GET /suggestions GET /suggestions.json
|
def index
@suggestions = Suggestion.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @suggestions }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def suggestions\n response.try(:[], \"suggest\").try(:[], @suggest_key).try(:[], request_params[:q]).try(:[], \"suggestions\") || []\n end",
"def suggestions\n with_monitoring do\n Faraday.get(suggestions_url, query_params)\n end\n rescue => e\n e\n end",
"def suggest\n @suggestions = suggestions_service.suggestions\n render 'suggest', layout: false\n end",
"def suggestions\n perform_request_with_collection(:get, '/api/v1/accounts/suggestions', {}, Mastodon::Account)\n end",
"def index\n @suggestions = Suggestion.all\n end",
"def index\n @suggestions = Suggestion.all\n end",
"def suggestions\n suggest(search_suggestions)\n end",
"def restaurant_suggestions\n match_key = Riddle.escape(params[:key]).split(' ').join('* ') + '*'\n begin\n suggestions = Restaurant.search(match_key,{:limit=>20,:match_mode => :extended,\n :ignore_errors=>true,:populate=>true,:retry_stale=>true})\n rescue Exception\n suggestions = []\n end\n response = []\n suggestions.each{|d| response << {:value=>d.id,:label=>d.name}}\n render :json=>response.to_json\n end",
"def suggestions\n # If we haven't registered an autocomplete, just return the empty set\n return [] if @autocomplete_config.nil?\n Dromedary::Suggest::Response.new suggest_results, request_params, autocomplete_config\n end",
"def fast_suggestions query\n return []\n end",
"def return_suggestion\n suggestion = Petit::Shortcode.suggest\n if request.accept?('application/json') || request.accept?('application/vnd.api+json')\n response.headers['Content-Type'] = 'application/vnd.api+json'\n json_body = {\n data: {\n type: 'suggestion',\n id: suggestion,\n attributes: {\n name: suggestion\n }\n }\n }\n json_body.to_json\n else\n suggestion\n end\n end",
"def list\n\t\t# see also as_json overrides in the models\n\t\trender json: load_suggestions(suggestion_params[:avatar_id])\t\t \n end",
"def index\n @talk_suggestions = TalkSuggestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talk_suggestions }\n end\n end",
"def suggest_results\n repository.auto_suggest(suggest_handler_path, request_params)\n end",
"def suggestions\n authenticate_user!\n\n # Check if there are cached suggestions on the user\n if current_user.suggested_map_ids.present?\n maps = Map.where(:_id.in => current_user.suggested_map_ids).to_a.compact\n else\n maps = nil\n end\n\n # Use cached suggestions if present\n if maps.present?\n @maps = current_user.suggested_map_ids.map{|id| maps.find{|m| m.id == id} } # ensure same order as in the suggested_map_ids\n\n # If no cached suggestions, then load new suggestions\n else\n @last_played = Game.last_played_map_ids(current_user, 20) # exclude last 20 played maps\n\n @maps = get_trial_suggestions || get_standard_suggestions || get_unfiltered_suggestions || []\n @maps = @maps.sort_by(&:skill_mean) # Order by difficulty\n\n # Cache new suggestions\n current_user.update_attribute(:suggested_map_ids, @maps.map(&:id))\n end\n\n render :list\n end",
"def event_location_suggestions\n @here = Apis::HereApi.new(params[:address]).get_suggestions\n render json: @here\n end",
"def suggest(url)\n parameters = Specification.new(url: Types::URL).parameters(url: url)\n Suggestion.from_array(client.get(\"/posts/suggest\", parameters))\n end",
"def index\n @suggestions = Suggestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @suggestions }\n end\n end",
"def suggestion_search\n keywords = params[:q]\n keywords = Utils.nomalize_string(keywords)\n\n if keywords.include? '-'\n keywords = keywords.gsub! '-', \" \"\n end\n\n pattern = /#{Regexp.escape(keywords)}/i\n\n users = User.or({:name => pattern}, {:email => pattern}).map { |user|\n UserSerializer.new(user).suggestion_search_hash\n }\n\n render json: users, root: false\n return\n end",
"def suggest\n @result = Artist.search( params[:term] )\n \n respond_to do |format|\n format.html\n format.json { render :json => @result }\n end\n end",
"def suggest_results\n Blacklight.default_index.connection.send_and_receive(suggest_handler_path, params: request_params)['suggest']\n end",
"def spelling_suggestions(query, opts = {})\n invoke 'SpellingSuggestions', query, opts\n end",
"def show\n @suggestion = Suggestion.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @suggestion }\n format.json { render :json => @suggestion.to_json(:only => nil) }\n end\n end",
"def suggested_people\n SuggestedPeople.people(@api_key, @https)\n end",
"def search\n search_param = params[:term]\n matching_keys = UserKey.submitted.search(search_param).collect { |u| { value: \"#{u.name}\", data: u.id } }\n render json: { suggestions: matching_keys }\n end",
"def suggest\n if !params.has_key? :q then\n head :ok\n return\n end\n\n search_stmt = params[:q].upcase\n current_user_id = current_user.id\n\n results = UrContact.where.has{\n (user_id == current_user_id) &\n (upper(name).like \"%#{search_stmt}%\") |\n (upper(email).like \"%#{search_stmt}%\") |\n (upper(telephone).like \"%#{search_stmt}%\")\n }\n\n if params[:format] == \"search\" then\n formattedResults = results\n else\n formattedResults = {query:params[:q], suggestions:results.map{|x| {value:x.name, data:x}} }\n end\n\n #render json: {query:params[:q], suggestions:results}\n render json: formattedResults\n end",
"def show\n @suggestion = Suggestion.find(params[:id])\n end",
"def index\n @blog_suggestions = BlogSuggestion.all\n end",
"def suggest\n tags = Tag.where('tags.name LIKE ?', \"#{params[:q]}%\").limit(10).order(:name)\n\n render json: {\n results: tags.map { |tag|\n {\n id: tag.name,\n text: \"#{tag.name} (#{tag.count})\"\n }\n },\n }\n end",
"def suggestions\n words = params[:query].split(/\\s+/).reject(&:blank?)\n\n suggestions = case words.size\n when 1\n if words.first.starts_with?('@')\n users = find_users(words.first[1..-1]).limit(MAX_SUGGESTIONS)\n users.map do |user|\n {\n user: user.as_json,\n url: user_url(user),\n type: 'user'\n }\n end\n else\n projects = find_projects(words[0]).limit(MAX_SUGGESTIONS).map(&:sluggable).compact\n projects.map do |project|\n {\n project: project.as_json,\n url: project_url(project),\n type: 'project',\n }\n end\n end\n when 2\n project = find_projects(words[0]).only.try!(:sluggable)\n envs = find_environments(project, words[1]).limit(10) if project\n envs.map do |env|\n {\n project: project.as_json,\n environment: env.as_json,\n type: 'environment',\n url: project_environment_bugs_url(project, env)\n\n\n }\n end if project\n when 3\n project = find_projects(words[0]).only.try!(:sluggable)\n env = find_environments(project, words[1]).only if project\n bug = env.bugs.find_by_number(words[2].to_i) if env\n [{\n type: 'bug',\n url: project_environment_bug_url(project, env, bug),\n project: project.as_json,\n environment: env.as_json,\n bug: bug.as_json\n }] if bug\n when 4\n project = find_projects(words[0]).only.try!(:sluggable)\n env = find_environments(project, words[1]).only if project\n bug = env.bugs.find_by_number(words[2].to_i) if env\n occurrence = bug.occurrences.find_by_number(words[3].to_i) if bug\n [{\n type: 'occurrence',\n url: project_environment_bug_occurrence_url(project, env, bug, occurrence),\n project: project.as_json,\n environment: env.as_json,\n bug: bug.as_json,\n occurrence: occurrence.as_json\n }] if occurrence\n end\n\n respond_to do |format|\n format.json { render json: (suggestions || []).to_json }\n end\n end",
"def index\n @suggestion_boxes = SuggestionBox.all\n end",
"def show\n @talk_suggestion = TalkSuggestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @talk_suggestion }\n end\n end",
"def new\n @suggestion = Suggestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @suggestion }\n end\n end",
"def index\n if params[:since]\n all = Suggestion.find(:all, :conditions => [ \"updated_at > ?\", params[:since] ]).reverse\n else\n all = Suggestion.find(:all).reverse\n end\n\n if @current_user\n # Put the user's suggestions at the top\n @suggestions = @current_user.suggestions.reverse + (all - @current_user.suggestions)\n else\n @suggestions = all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @suggestions }\n format.json { render :json => @suggestions.to_json(:only => nil) }\n end\n end",
"def autocomplete\n\t\tquery_params = QueryFormat.autocomplete_format()\n\t\tbegin\n\t\t\tQueryFormat.transform_raw_parameters(params)\n\t\t\tquery = QueryFormat.create_solr_query(query_params, params, request.remote_ip)\n\t\t\tquery['field'] = \"content_auto\" if query['field'].blank?\n\t\t\tis_test = Rails.env == 'test' ? :test : :live\n\t\t\tis_test = :shards if params[:test_index]\n\t\t\tsolr = Solr.factory_create(is_test)\n\t\t\tmax = query['max'].to_i\n\t\t\tquery.delete('max')\n\t\t\twords = solr.auto_complete(query)\n\t\t\twords.sort! { |a,b| b[:count] <=> a[:count] }\n\t\t\twords = words[0..(max-1)]\n\t\t\t@results = words.map { |word|\n\t\t\t\t{ :item => word[:name], :occurrences => word[:count] }\n\t\t\t}\n\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html # index.html.erb\n\t\t\t\tformat.json { render json: { results: @results } }\n\t\t\t\tformat.xml\n\t\t\tend\n\t\trescue ArgumentError => e\n\t\t\trender_error(e.to_s)\n\t\trescue SolrException => e\n\t\t\trender_error(e.to_s, e.status())\n\t\trescue Exception => e\n\t\t\tExceptionNotifier.notify_exception(e, :env => request.env)\n\t\t\trender_error(\"Something unexpected went wrong.\", :internal_server_error)\n\t\tend\n\tend",
"def list_suggestvenues(id)\n get(\"lists/#{id}/suggestvenues\").suggestedVenues\n end",
"def get_v1_tag_suggestions(prefix, opts = {})\n data, _status_code, _headers = get_v1_tag_suggestions_with_http_info(prefix, opts)\n data\n end",
"def findorsuggest()\n \n end",
"def suggestions\n suggest_response['suggest'].values.first[q]['suggestions']\n .uniq { |s| s['term'].downcase }\n .sort_by { |s| (-s['weight']) * 100 + s['term'].length }\n .take(5)\n end",
"def get_suggestion(query) \n oauth = OAuth.new(:consumer_key => self.consumer_key, \n :consumer_secret => self.consumer_secret) \n signed_url = oauth.sign build_query(query)\n\n response = http_client.get(signed_url)\n response_hash = MultiJson.decode(response.body)\n \n suggestion = get_suggestion_from_response(response_hash)\n\n return nil unless suggestion\n return nil if suggestion.downcase == query.downcase\n\n return suggestion\n rescue ::YBossSpell::Error, ::HTTPClient::TimeoutError, ::MultiJson::LoadError => e\n Rails.logger.error(\"YBossSpell: #{e.inspect}\") \n return false\n end",
"def searchSuggestions(query,extras)\n method = 'searchSuggestions'\n type = TODO\n args = {:query=>query}\n args[:extras] = extras if extras\n return_object type,method,args\n end",
"def show\n @brandslip_suggestion = BrandslipSuggestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brandslip_suggestion }\n end\n end",
"def show\n @skill_suggestion = SkillSuggestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @skill_suggestion }\n end\n end",
"def venue_suggestcompletion(ll, query, options = {})\n get('venues/suggestcompletion', { :ll => ll, :query => query }.merge(options)).minivenues\n end",
"def known_suggestions\n @known_suggestions ||= SUGGESTIONS.constants.map do |suggestion_class|\n SUGGESTIONS.const_get(suggestion_class).new\n end\n end",
"def autocomplete\n @design_methods = DesignMethod.where(['name LIKE ?', \"#{params[:term]}%\"])\n @design_hash = []\n @design_methods.each do |d|\n @design_hash << { label: d.name }\n end\n respond_to do |format|\n format.json { render json: @design_hash}\n end\n end",
"def show\n @hospital_suggestion = HospitalSuggestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hospital_suggestion }\n end\n end",
"def autocomplete\n respond_to do |format|\n format.json do\n # Only get non-soft deleted Donations and Donations where the available until datetime is after the current datetime.\n @donations = Donation.kept.available\n\n # Ensure the User has permission to perform this action.\n authorize @donations\n\n # Search the Donations based on the current term typed into the search bar.\n @donations = @donations.search(params[:term])\n\n # Only return the name and description of the Donation, as a single array.\n @donation_names_and_descriptions = []\n @donations.map(&:name).zip(@donations.map(&:description)).each do |name, description|\n @donation_names_and_descriptions << \"#{name}: #{description}\"\n end\n\n render json: @donation_names_and_descriptions.to_json\n end\n end\n end",
"def show\n @change_suggestion = ChangeSuggestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @change_suggestion }\n end\n end",
"def suggestion\n if user_signed_in?\n user = current_user.email\n else\n user = \"< not logged in >\"\n end\n\n if params[:suggestion]\n ContactMailer.suggestion_email(params[:suggestion], params[:pathname], user).deliver!\n end\n respond_to do |format|\n format.json { render json: params[:suggestion] }\n end\n end",
"def suggest\n # For some reason, Rails is not respecting the include_root_in_json for this action. So need to specify manually.\n render(:root => false, :json => OptionSuggester.new.suggest(current_mission, params[:q]).as_json(:for_option_set_form => true))\n end",
"def autocomplete\n @response, = search_service.search_results do |builder|\n builder.with(builder.blacklight_params.merge(search_field: Spotlight::Engine.config.autocomplete_search_field, public: true, rows: 100))\n end\n\n respond_to do |format|\n format.json do\n render json: { docs: autocomplete_json_response(@response.documents) }\n end\n end\n end",
"def suggested_people(lang)\n request('/suggestedPeople', {body: {languages: lang}})\n end",
"def suggest(name, text, completion={})\n request(:post, \"_suggest\", nil, {name => {:text => text, :completion => completion}})\n end",
"def autocomplete\n search_params = params.merge(search_field: Spotlight::Engine.config.autocomplete_search_field)\n (_, @document_list) = search_results(search_params.merge(public: true), search_params_logic)\n\n respond_to do |format|\n format.json do\n render json: { docs: autocomplete_json_response(@document_list) }\n end\n end\n end",
"def autocomplete_name\n @tags = Tag.where([\"name ILIKE ?\", \"*#{params[:term]}*\".to_escaped_for_sql_like]).order('LENGTH(name)', :name).limit(20).pluck(:name)\n respond_to do |format|\n format.json { render :json => @tags }\n end\n end",
"def suggestion_params\n params.require(:suggestion).permit(:name, :votes, :foursquare_id, :user_id, :visited)\n end",
"def show\n @suggestion = Suggestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @suggestion }\n end\n end",
"def show\n @suggestion = Suggestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @suggestion }\n end\n end",
"def suggestions(options = {})\n if user.likes_count < self.class.config.likes_needed_for_custom\n logger.debug(\"Loading trending hot or not suggestions\")\n #XXX-hot-or-not this needs to filter out stuff we've already liked\n ids = Listing.recently_liked(self.class.config.trending.window,\n per: self.class.config.trending.limit,\n exclude_liked_by_users: user.id)\n else\n logger.debug(\"Loading clustered hot or not suggestions\")\n # probably need to tune the number of choices to return\n ids = Pyramid::User.hot_or_not_suggestions(user.id)\n end\n Listing.visible(id: ids, exclude_disliked_by: user)\n end",
"def suggest(name, text, completion = {})\n request(:post, \"_suggest\", nil, { name => { text: text, completion: completion } })\n end",
"def set_suggestion\n @suggestion = Suggestion.find(params[:id])\n end",
"def set_suggestion\n @suggestion = Suggestion.find(params[:id])\n end",
"def set_suggestion\n @suggestion = Suggestion.find(params[:id])\n end",
"def set_suggestion\n @suggestion = Suggestion.find(params[:id])\n end",
"def set_suggestion\n @suggestion = Suggestion.find(params[:id])\n end",
"def set_suggestion\n @suggestion = Suggestion.find(params[:id])\n end",
"def set_suggestion\n @suggestion = Suggestion.find(params[:id])\n end",
"def getAutocomplete(query, type)\n request('getAutocomplete', {'query' => query, 'type' => type})\nend",
"def create\n @suggestion = Suggestion.new(suggestion_params)\n\n if @suggestion.save\n render :show, status: :created, location: @suggestion\n else\n render json: @suggestion.errors, status: :unprocessable_entity\n end\n end",
"def show\n render json: @user.suggest_friends\n end",
"def\tsearch\n\t\tresult = query_google_places\n\t\trender :json => result\n\tend",
"def update\n if @suggestion.update(suggestion_params)\n render :show, status: :ok, location: @suggestion\n else\n render json: @suggestion.errors, status: :unprocessable_entity\n end\n end",
"def bu_autocomplete\n search_term = params[:term]\n\n species_id = Specie.find_by_scientificname(params[:species])\n\n cultivars = Cultivar.where(\"specie_id = ?\", species_id)\n\n logger.debug(\"cultivars for autocompletion: #{cultivars.inspect}\")\n\n filtered_cultivars = cultivars.where(\"LOWER(name) LIKE LOWER(?)\", '%' + search_term + '%')\n\n if filtered_cultivars.size > 0 || search_term.size > 1\n cultivars = filtered_cultivars\n # else if there are no matches and the user has only typed one letter, just return every cultivar associated with the chosen species\n end\n\n cultivars = cultivars.to_a.map do |item|\n item.name.squish\n end\n\n # don't show rows where name is null or empty\n # TO-DO: eliminate these from the database and prevent them with a constraint\n cultivars.delete_if { |item| item.nil? || item.empty? }\n\n if cultivars.empty?\n cultivars = [ { label: \"No matches\", value: \"\" }]\n end\n\n respond_to do |format|\n format.json { render :json => cultivars }\n end\n end",
"def index\n @suggest_boxes = SuggestBox.all\n end",
"def index\n @search = Tutorial.search(params[:q])\n @tutorials = @search.result.where(suggestion: false).page(params[:page]).per(5).order('created_at DESC')\n @suggestions = @search.result.where(suggestion: true).page(params[:page]).per(5).order('created_at DESC')\n end",
"def auto_complete_for_keyword_list\n auto_complete_responder_for_keyword params[:keyword][:list]\n end",
"def show\n @suggestion = Suggestion.new\n @suggestion.game = Game.find_by_slug(params[:id])\n @suggestion.user = current_user\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @suggestion }\n end\n end",
"def prepare_suggested_searches\n @suggested_searches = [\n # { label_key: 'search_suggestion_whale_mass',\n # params: {\n # sort: 'desc',\n # min: 10000,\n # taxon_concept_id: 7649,\n # attribute: 'http://purl.obolibrary.org/obo/VT_0001259',\n # unit: 'http://purl.obolibrary.org/obo/UO_0000009' }},\n # { label_key: 'search_suggestion_cavity_nests',\n # params: {\n # q: 'cavity',\n # attribute: 'http://eol.org/schema/terms/NestType' }},\n { label_key: 'search_suggestion_diatom_shape',\n params: {\n attribute: 'http://purl.obolibrary.org/obo/OBA_0000052',\n taxon_concept_id: 3685 }} #,\n # { label_key: 'search_suggestion_blue_flowers',\n # params: {\n # q: 'http://purl.obolibrary.org/obo/PATO_0000318',\n # attribute: 'http://purl.obolibrary.org/obo/TO_0000537' }}\n ]\n end",
"def suggest\n end",
"def typeahead\n model_name = controller_name.classify\n model_class = class_for_controller_name\n\n results = model_class.authorize_asset_collection(model_class.where('title LIKE ?', \"#{params[:query]}%\"), 'view')\n items = results.first(params[:limit] || 10).map do |item|\n contributor_name = item.contributor.try(:person).try(:name)\n { id: item.id, name: item.title, hint: contributor_name, type: model_name, contributor: contributor_name }\n end\n\n respond_to do |format|\n format.json { render json: items.to_json }\n end\n end",
"def index\n @suggested_categories = SuggestedCategory.all\n end",
"def index\n @suggests = Suggest.paginate(:page => params[:page],:per_page => 10).order('created_at DESC')\n end",
"def suggestion_params\n params.require(:suggestion).permit(:title, :date_created, :user_id)\n end",
"def auto_complete\n q = params[:term].gsub(/\\s/, \"\").gsub(\" \", \"\")\n uri = Addressable::URI.parse(\"https://www.googleapis.com/books/v1/volumes?q=#{q}&country=JP&maxResults=40&orderBy=relevance\")\n begin\n response = Net::HTTP.get_response(uri)\n result = JSON.parse(response.body)\n book_result = result[\"items\"]\n .select{|item| item.has_key?(\"volumeInfo\") && item[\"volumeInfo\"].has_key?(\"title\")}\n .take(40)\n .map{|item|\n {\n title: item[\"volumeInfo\"][\"title\"],\n subtitle: item[\"volumeInfo\"][\"subtitle\"],\n authors: item[\"volumeInfo\"][\"authors\"],\n categories: item[\"volumeInfo\"][\"categories\"],\n google_books_id: item[\"id\"],\n info: item[\"volumeInfo\"][\"industryIdentifiers\"]\n }\n }\n @results = Book.auto_complete_map(book_result)\n\n render json: @results.to_json\n rescue => e\n p e.message\n end\n end",
"def set_suggestion\n @suggesiton = Suggestion.find(params[:id])\n end",
"def suggest()\n\n\t\t\t# It is necessary to clone the json in order to manipulate it\n\t\t\tarticles_clone = articles.clone\n\n\t\t\t# This variable stores the total of articles in logs/content/myad categories inside the json\n\t\t\ttotal_articles = articles_clone[\"logs\"].length + articles_clone[\"content\"].length + articles_clone[\"myad\"].length\n\n\t\t\t# This variable stores the result in array\n\t\t\ttoken_result = Array.new\n\n\t\t\tloop do\n\t\t\t\tarticles_clone.each do |key, array_value|\n\t\t\t\t\tbreak unless token_result.length < MAX_RECOMMENDED_ARTICLES \n\t\t\t\t\tnext if array_value.empty?\n\n\t\t\t\t\tarray = array_value.shift\t\t # Store the first element of the array in this iteration\n\t\t\t\t\ttoken_result.push(array[\"token\"].to_i) # We add a new \"token\" from the element\n\t\t\t\tend\n\n\t\t\t\t# It is mandatory to control the amount of items in the array (token_result), otherwise, we have an infinite loop.\n\t\t\t\tbreak unless token_result.length < MAX_RECOMMENDED_ARTICLES && token_result.length < total_articles\t\n\t\t\tend\n\n\t\t\ttoken_result \n\t\tend",
"def autocomplete\n render :json => end_of_association_chain.ordered.search(params[:term]).limit(params[:limit] || 10).to_autocomplete\n end",
"def query(term, *opts)\n\n opts = {:count => 1, :ratio => 0.0}.merge(opts[0] || {})\n\n return [] if opts[:count] <= 0\n\n resp = JSON.parse(open(search_url term).read, :symbolize_names => true)\n\n resp[:list].map do |res|\n {\n :id => res[:defid],\n :word => res[:word],\n :author => res[:author],\n :permalink => res[:permalink],\n :definition => res[:definition].strip,\n :example => res[:example].strip,\n :upvotes => res[:thumbs_up],\n :downvotes => res[:thumbs_down]\n }\n end.keep_if do |d|\n d[:upvotes]/[d[:downvotes], 0.1].max.to_f >= opts[:ratio]\n end.take opts[:count]\n end",
"def get_search_suggest_with_http_info(q64, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SuggestApi.get_search_suggest ...\"\n end\n \n \n # verify the required parameter 'q64' is set\n fail ArgumentError, \"Missing the required parameter 'q64' when calling SuggestApi.get_search_suggest\" if q64.nil?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/search/suggest\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'q64'] = q64\n query_params[:'expand'] = @api_client.build_collection_param(opts[:'expand'], :multi) if opts[:'expand']\n query_params[:'profile'] = opts[:'profile'] if opts[:'profile']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'JsonNodeSearchResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SuggestApi#get_search_suggest\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def suggestion_params\n params.require(:suggestion).permit(:subject, :content, :observation, :user_id, :revised)\n end",
"def autocomplete\n keyword = params[:keyword]\n gs = Api::Google.new\n results = gs.autocomplete(keyword)\n render json: results # Return to frontend (-> results injected by spot_autocomplete_dropdown.js)\n end",
"def new\n @talk_suggestion = TalkSuggestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @talk_suggestion }\n end\n end",
"def autocomplete\n render json: Post.search(params[:query],operator: \"or\", autocomplete: true,limit: 10,boost_by_distance: {field: :location, origin: [current_user.lat, current_user.lon]}).map {|post| {title: post.title, value: post.id}}\n end",
"def suggest_smart_replies request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_suggest_smart_replies_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Dialogflow::V2::SuggestSmartRepliesResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def keyword_autocomplete\n search_keyword = params[\"search\"]\n similar_keywords =\n Keyword.get_similar_keywords(search_keyword, [])\n similar_keywords.map! { |keyword| keyword.name }\n render json: similar_keywords\n end",
"def auto_complete\n @query = params[:term] || ''\n @auto_complete = hook(:auto_complete, self, query: @query, user: current_user)\n if @auto_complete.empty?\n exclude_ids = auto_complete_ids_to_exclude(params[:related])\n @auto_complete = klass.my(current_user).text_search(@query).ransack(id_not_in: exclude_ids).result.limit(10)\n else\n @auto_complete = @auto_complete.last\n end\n\n session[:auto_complete] = controller_name.to_sym\n respond_to do |format|\n format.any(:js, :html) { render partial: 'auto_complete' }\n format.json do\n results = @auto_complete.map do |a|\n {\n id: a.id,\n text: a.respond_to?(:full_name) ? a.full_name : a.name\n }\n end\n render json: {\n results: results\n }\n end\n end\n end",
"def autocomplete\n @leader = Leaders.find(:all, :conditions => [\"name like ?\",\"%\" + params[:term].upcase + \"%\"])\n render json: @leader \n end",
"def suggest\n Hash[@solr_data[:spellcheck]['suggestions']]['collation']\n end",
"def index\n @suggestions = Suggestion.all\n if params[:status] and params[:status] != \"All\"\n @suggestions = @suggestions.where(\"status like ?\", \"%#{params[:status]}%\")\n end\n end"
] |
[
"0.7921654",
"0.76962346",
"0.7659703",
"0.7499706",
"0.7480025",
"0.7480025",
"0.7419286",
"0.72764426",
"0.7064508",
"0.70626795",
"0.7046857",
"0.7025311",
"0.69745696",
"0.6971177",
"0.6860192",
"0.6709187",
"0.67090434",
"0.66637874",
"0.6660277",
"0.6649667",
"0.6641161",
"0.6624342",
"0.6603844",
"0.6571017",
"0.6558272",
"0.6534057",
"0.6477861",
"0.6465914",
"0.6441984",
"0.6397434",
"0.6387339",
"0.6360161",
"0.63558143",
"0.63462126",
"0.6329021",
"0.6273859",
"0.6253393",
"0.62474513",
"0.6213466",
"0.6199911",
"0.6166466",
"0.61647886",
"0.61551034",
"0.6134454",
"0.61187756",
"0.611387",
"0.6100016",
"0.60757655",
"0.60675144",
"0.60469913",
"0.60379714",
"0.60104203",
"0.6004802",
"0.60012937",
"0.5973292",
"0.5968916",
"0.59607106",
"0.5955772",
"0.5955772",
"0.59191996",
"0.5917688",
"0.5904233",
"0.5904233",
"0.5904233",
"0.5904233",
"0.5904233",
"0.5904233",
"0.5904233",
"0.5889031",
"0.587572",
"0.5871686",
"0.5869532",
"0.5860332",
"0.5851195",
"0.58410263",
"0.5834988",
"0.5832982",
"0.582834",
"0.58263355",
"0.5815892",
"0.5808714",
"0.58071107",
"0.5788211",
"0.5787702",
"0.57866436",
"0.57834756",
"0.57777375",
"0.57745796",
"0.5773426",
"0.5764753",
"0.5745414",
"0.57430154",
"0.5742588",
"0.574131",
"0.5739562",
"0.5737468",
"0.5728644",
"0.57264644",
"0.57176757",
"0.5697884"
] |
0.76882756
|
2
|
GET /suggestions/1 GET /suggestions/1.json
|
def show
@suggestion = Suggestion.new
@suggestion.game = Game.find_by_slug(params[:id])
@suggestion.user = current_user
respond_to do |format|
format.html # show.html.erb
format.json { render json: @suggestion }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def suggestions\n response.try(:[], \"suggest\").try(:[], @suggest_key).try(:[], request_params[:q]).try(:[], \"suggestions\") || []\n end",
"def index\n @suggestions = Suggestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @suggestions }\n end\n end",
"def index\n @suggestions = Suggestion.all\n end",
"def index\n @suggestions = Suggestion.all\n end",
"def suggest\n @suggestions = suggestions_service.suggestions\n render 'suggest', layout: false\n end",
"def suggestions\n with_monitoring do\n Faraday.get(suggestions_url, query_params)\n end\n rescue => e\n e\n end",
"def return_suggestion\n suggestion = Petit::Shortcode.suggest\n if request.accept?('application/json') || request.accept?('application/vnd.api+json')\n response.headers['Content-Type'] = 'application/vnd.api+json'\n json_body = {\n data: {\n type: 'suggestion',\n id: suggestion,\n attributes: {\n name: suggestion\n }\n }\n }\n json_body.to_json\n else\n suggestion\n end\n end",
"def restaurant_suggestions\n match_key = Riddle.escape(params[:key]).split(' ').join('* ') + '*'\n begin\n suggestions = Restaurant.search(match_key,{:limit=>20,:match_mode => :extended,\n :ignore_errors=>true,:populate=>true,:retry_stale=>true})\n rescue Exception\n suggestions = []\n end\n response = []\n suggestions.each{|d| response << {:value=>d.id,:label=>d.name}}\n render :json=>response.to_json\n end",
"def suggestions\n perform_request_with_collection(:get, '/api/v1/accounts/suggestions', {}, Mastodon::Account)\n end",
"def show\n @suggestion = Suggestion.find(params[:id])\n end",
"def fast_suggestions query\n return []\n end",
"def suggestions\n suggest(search_suggestions)\n end",
"def index\n @talk_suggestions = TalkSuggestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talk_suggestions }\n end\n end",
"def suggest_results\n repository.auto_suggest(suggest_handler_path, request_params)\n end",
"def suggest(url)\n parameters = Specification.new(url: Types::URL).parameters(url: url)\n Suggestion.from_array(client.get(\"/posts/suggest\", parameters))\n end",
"def show\n @suggestion = Suggestion.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @suggestion }\n format.json { render :json => @suggestion.to_json(:only => nil) }\n end\n end",
"def list\n\t\t# see also as_json overrides in the models\n\t\trender json: load_suggestions(suggestion_params[:avatar_id])\t\t \n end",
"def index\n @suggestions = Suggestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @suggestions }\n end\n end",
"def suggest_results\n Blacklight.default_index.connection.send_and_receive(suggest_handler_path, params: request_params)['suggest']\n end",
"def show\n @talk_suggestion = TalkSuggestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @talk_suggestion }\n end\n end",
"def suggest\n @result = Artist.search( params[:term] )\n \n respond_to do |format|\n format.html\n format.json { render :json => @result }\n end\n end",
"def suggestions\n # If we haven't registered an autocomplete, just return the empty set\n return [] if @autocomplete_config.nil?\n Dromedary::Suggest::Response.new suggest_results, request_params, autocomplete_config\n end",
"def new\n @suggestion = Suggestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @suggestion }\n end\n end",
"def suggestions\n authenticate_user!\n\n # Check if there are cached suggestions on the user\n if current_user.suggested_map_ids.present?\n maps = Map.where(:_id.in => current_user.suggested_map_ids).to_a.compact\n else\n maps = nil\n end\n\n # Use cached suggestions if present\n if maps.present?\n @maps = current_user.suggested_map_ids.map{|id| maps.find{|m| m.id == id} } # ensure same order as in the suggested_map_ids\n\n # If no cached suggestions, then load new suggestions\n else\n @last_played = Game.last_played_map_ids(current_user, 20) # exclude last 20 played maps\n\n @maps = get_trial_suggestions || get_standard_suggestions || get_unfiltered_suggestions || []\n @maps = @maps.sort_by(&:skill_mean) # Order by difficulty\n\n # Cache new suggestions\n current_user.update_attribute(:suggested_map_ids, @maps.map(&:id))\n end\n\n render :list\n end",
"def spelling_suggestions(query, opts = {})\n invoke 'SpellingSuggestions', query, opts\n end",
"def suggestions\n words = params[:query].split(/\\s+/).reject(&:blank?)\n\n suggestions = case words.size\n when 1\n if words.first.starts_with?('@')\n users = find_users(words.first[1..-1]).limit(MAX_SUGGESTIONS)\n users.map do |user|\n {\n user: user.as_json,\n url: user_url(user),\n type: 'user'\n }\n end\n else\n projects = find_projects(words[0]).limit(MAX_SUGGESTIONS).map(&:sluggable).compact\n projects.map do |project|\n {\n project: project.as_json,\n url: project_url(project),\n type: 'project',\n }\n end\n end\n when 2\n project = find_projects(words[0]).only.try!(:sluggable)\n envs = find_environments(project, words[1]).limit(10) if project\n envs.map do |env|\n {\n project: project.as_json,\n environment: env.as_json,\n type: 'environment',\n url: project_environment_bugs_url(project, env)\n\n\n }\n end if project\n when 3\n project = find_projects(words[0]).only.try!(:sluggable)\n env = find_environments(project, words[1]).only if project\n bug = env.bugs.find_by_number(words[2].to_i) if env\n [{\n type: 'bug',\n url: project_environment_bug_url(project, env, bug),\n project: project.as_json,\n environment: env.as_json,\n bug: bug.as_json\n }] if bug\n when 4\n project = find_projects(words[0]).only.try!(:sluggable)\n env = find_environments(project, words[1]).only if project\n bug = env.bugs.find_by_number(words[2].to_i) if env\n occurrence = bug.occurrences.find_by_number(words[3].to_i) if bug\n [{\n type: 'occurrence',\n url: project_environment_bug_occurrence_url(project, env, bug, occurrence),\n project: project.as_json,\n environment: env.as_json,\n bug: bug.as_json,\n occurrence: occurrence.as_json\n }] if occurrence\n end\n\n respond_to do |format|\n format.json { render json: (suggestions || []).to_json }\n end\n end",
"def set_suggestion\n @suggestion = Suggestion.find(params[:id])\n end",
"def set_suggestion\n @suggestion = Suggestion.find(params[:id])\n end",
"def set_suggestion\n @suggestion = Suggestion.find(params[:id])\n end",
"def set_suggestion\n @suggestion = Suggestion.find(params[:id])\n end",
"def set_suggestion\n @suggestion = Suggestion.find(params[:id])\n end",
"def set_suggestion\n @suggestion = Suggestion.find(params[:id])\n end",
"def set_suggestion\n @suggestion = Suggestion.find(params[:id])\n end",
"def index\n @suggestion_boxes = SuggestionBox.all\n end",
"def get_suggestion(query) \n oauth = OAuth.new(:consumer_key => self.consumer_key, \n :consumer_secret => self.consumer_secret) \n signed_url = oauth.sign build_query(query)\n\n response = http_client.get(signed_url)\n response_hash = MultiJson.decode(response.body)\n \n suggestion = get_suggestion_from_response(response_hash)\n\n return nil unless suggestion\n return nil if suggestion.downcase == query.downcase\n\n return suggestion\n rescue ::YBossSpell::Error, ::HTTPClient::TimeoutError, ::MultiJson::LoadError => e\n Rails.logger.error(\"YBossSpell: #{e.inspect}\") \n return false\n end",
"def index\n @blog_suggestions = BlogSuggestion.all\n end",
"def show\n @skill_suggestion = SkillSuggestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @skill_suggestion }\n end\n end",
"def index\n if params[:since]\n all = Suggestion.find(:all, :conditions => [ \"updated_at > ?\", params[:since] ]).reverse\n else\n all = Suggestion.find(:all).reverse\n end\n\n if @current_user\n # Put the user's suggestions at the top\n @suggestions = @current_user.suggestions.reverse + (all - @current_user.suggestions)\n else\n @suggestions = all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @suggestions }\n format.json { render :json => @suggestions.to_json(:only => nil) }\n end\n end",
"def set_suggestion\n @suggesiton = Suggestion.find(params[:id])\n end",
"def event_location_suggestions\n @here = Apis::HereApi.new(params[:address]).get_suggestions\n render json: @here\n end",
"def show\n @change_suggestion = ChangeSuggestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @change_suggestion }\n end\n end",
"def get_v1_tag_suggestions(prefix, opts = {})\n data, _status_code, _headers = get_v1_tag_suggestions_with_http_info(prefix, opts)\n data\n end",
"def suggest(name, text, completion={})\n request(:post, \"_suggest\", nil, {name => {:text => text, :completion => completion}})\n end",
"def suggest\n tags = Tag.where('tags.name LIKE ?', \"#{params[:q]}%\").limit(10).order(:name)\n\n render json: {\n results: tags.map { |tag|\n {\n id: tag.name,\n text: \"#{tag.name} (#{tag.count})\"\n }\n },\n }\n end",
"def show\n @hospital_suggestion = HospitalSuggestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hospital_suggestion }\n end\n end",
"def findorsuggest()\n \n end",
"def show\n @suggestion = Suggestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @suggestion }\n end\n end",
"def show\n @suggestion = Suggestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @suggestion }\n end\n end",
"def show\n @brandslip_suggestion = BrandslipSuggestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brandslip_suggestion }\n end\n end",
"def search\n search_param = params[:term]\n matching_keys = UserKey.submitted.search(search_param).collect { |u| { value: \"#{u.name}\", data: u.id } }\n render json: { suggestions: matching_keys }\n end",
"def suggest(name, text, completion = {})\n request(:post, \"_suggest\", nil, { name => { text: text, completion: completion } })\n end",
"def list_suggestvenues(id)\n get(\"lists/#{id}/suggestvenues\").suggestedVenues\n end",
"def edit\n @suggestion = Suggestion.find(params[:id])\n end",
"def suggestions\n suggest_response['suggest'].values.first[q]['suggestions']\n .uniq { |s| s['term'].downcase }\n .sort_by { |s| (-s['weight']) * 100 + s['term'].length }\n .take(5)\n end",
"def update\n if @suggestion.update(suggestion_params)\n render :show, status: :ok, location: @suggestion\n else\n render json: @suggestion.errors, status: :unprocessable_entity\n end\n end",
"def autocomplete\n\t\tquery_params = QueryFormat.autocomplete_format()\n\t\tbegin\n\t\t\tQueryFormat.transform_raw_parameters(params)\n\t\t\tquery = QueryFormat.create_solr_query(query_params, params, request.remote_ip)\n\t\t\tquery['field'] = \"content_auto\" if query['field'].blank?\n\t\t\tis_test = Rails.env == 'test' ? :test : :live\n\t\t\tis_test = :shards if params[:test_index]\n\t\t\tsolr = Solr.factory_create(is_test)\n\t\t\tmax = query['max'].to_i\n\t\t\tquery.delete('max')\n\t\t\twords = solr.auto_complete(query)\n\t\t\twords.sort! { |a,b| b[:count] <=> a[:count] }\n\t\t\twords = words[0..(max-1)]\n\t\t\t@results = words.map { |word|\n\t\t\t\t{ :item => word[:name], :occurrences => word[:count] }\n\t\t\t}\n\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html # index.html.erb\n\t\t\t\tformat.json { render json: { results: @results } }\n\t\t\t\tformat.xml\n\t\t\tend\n\t\trescue ArgumentError => e\n\t\t\trender_error(e.to_s)\n\t\trescue SolrException => e\n\t\t\trender_error(e.to_s, e.status())\n\t\trescue Exception => e\n\t\t\tExceptionNotifier.notify_exception(e, :env => request.env)\n\t\t\trender_error(\"Something unexpected went wrong.\", :internal_server_error)\n\t\tend\n\tend",
"def suggested_people\n SuggestedPeople.people(@api_key, @https)\n end",
"def suggest\n if !params.has_key? :q then\n head :ok\n return\n end\n\n search_stmt = params[:q].upcase\n current_user_id = current_user.id\n\n results = UrContact.where.has{\n (user_id == current_user_id) &\n (upper(name).like \"%#{search_stmt}%\") |\n (upper(email).like \"%#{search_stmt}%\") |\n (upper(telephone).like \"%#{search_stmt}%\")\n }\n\n if params[:format] == \"search\" then\n formattedResults = results\n else\n formattedResults = {query:params[:q], suggestions:results.map{|x| {value:x.name, data:x}} }\n end\n\n #render json: {query:params[:q], suggestions:results}\n render json: formattedResults\n end",
"def suggest\n # For some reason, Rails is not respecting the include_root_in_json for this action. So need to specify manually.\n render(:root => false, :json => OptionSuggester.new.suggest(current_mission, params[:q]).as_json(:for_option_set_form => true))\n end",
"def suggestion_search\n keywords = params[:q]\n keywords = Utils.nomalize_string(keywords)\n\n if keywords.include? '-'\n keywords = keywords.gsub! '-', \" \"\n end\n\n pattern = /#{Regexp.escape(keywords)}/i\n\n users = User.or({:name => pattern}, {:email => pattern}).map { |user|\n UserSerializer.new(user).suggestion_search_hash\n }\n\n render json: users, root: false\n return\n end",
"def venue_suggestcompletion(ll, query, options = {})\n get('venues/suggestcompletion', { :ll => ll, :query => query }.merge(options)).minivenues\n end",
"def set_suggest\n @suggest = Suggest.find(params[:id])\n end",
"def searchSuggestions(query,extras)\n method = 'searchSuggestions'\n type = TODO\n args = {:query=>query}\n args[:extras] = extras if extras\n return_object type,method,args\n end",
"def create\n @suggestion = Suggestion.new(suggestion_params)\n\n if @suggestion.save\n render :show, status: :created, location: @suggestion\n else\n render json: @suggestion.errors, status: :unprocessable_entity\n end\n end",
"def suggestion_params\n params.require(:suggestion).permit(:name, :votes, :foursquare_id, :user_id, :visited)\n end",
"def suggest\n end",
"def getAutocomplete(query, type)\n request('getAutocomplete', {'query' => query, 'type' => type})\nend",
"def decline_suggestion(id)\n delete(\"suggestions/#{id}\")\n end",
"def auto_complete_for_keyword_list\n auto_complete_responder_for_keyword params[:keyword][:list]\n end",
"def autocomplete_name\n @tags = Tag.where([\"name ILIKE ?\", \"*#{params[:term]}*\".to_escaped_for_sql_like]).order('LENGTH(name)', :name).limit(20).pluck(:name)\n respond_to do |format|\n format.json { render :json => @tags }\n end\n end",
"def set_suggestion_box\n @suggestion_box = SuggestionBox.find(params[:id])\n end",
"def index\n @suggestions = Suggestion.all\n if params[:status] and params[:status] != \"All\"\n @suggestions = @suggestions.where(\"status like ?\", \"%#{params[:status]}%\")\n end\n end",
"def suggestion\n if user_signed_in?\n user = current_user.email\n else\n user = \"< not logged in >\"\n end\n\n if params[:suggestion]\n ContactMailer.suggestion_email(params[:suggestion], params[:pathname], user).deliver!\n end\n respond_to do |format|\n format.json { render json: params[:suggestion] }\n end\n end",
"def new\n @talk_suggestion = TalkSuggestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @talk_suggestion }\n end\n end",
"def typeahead\n model_name = controller_name.classify\n model_class = class_for_controller_name\n\n results = model_class.authorize_asset_collection(model_class.where('title LIKE ?', \"#{params[:query]}%\"), 'view')\n items = results.first(params[:limit] || 10).map do |item|\n contributor_name = item.contributor.try(:person).try(:name)\n { id: item.id, name: item.title, hint: contributor_name, type: model_name, contributor: contributor_name }\n end\n\n respond_to do |format|\n format.json { render json: items.to_json }\n end\n end",
"def autocomplete\n respond_to do |format|\n format.json do\n # Only get non-soft deleted Donations and Donations where the available until datetime is after the current datetime.\n @donations = Donation.kept.available\n\n # Ensure the User has permission to perform this action.\n authorize @donations\n\n # Search the Donations based on the current term typed into the search bar.\n @donations = @donations.search(params[:term])\n\n # Only return the name and description of the Donation, as a single array.\n @donation_names_and_descriptions = []\n @donations.map(&:name).zip(@donations.map(&:description)).each do |name, description|\n @donation_names_and_descriptions << \"#{name}: #{description}\"\n end\n\n render json: @donation_names_and_descriptions.to_json\n end\n end\n end",
"def autocomplete\n @design_methods = DesignMethod.where(['name LIKE ?', \"#{params[:term]}%\"])\n @design_hash = []\n @design_methods.each do |d|\n @design_hash << { label: d.name }\n end\n respond_to do |format|\n format.json { render json: @design_hash}\n end\n end",
"def update!(**args)\n @suggestions = args[:suggestions] if args.key?(:suggestions)\n end",
"def update!(**args)\n @suggestions = args[:suggestions] if args.key?(:suggestions)\n end",
"def update!(**args)\n @suggestions = args[:suggestions] if args.key?(:suggestions)\n end",
"def suggested_people(lang)\n request('/suggestedPeople', {body: {languages: lang}})\n end",
"def suggestion_params\n params.require(:suggestion).permit(:title, :date_created, :user_id)\n end",
"def index\n @search = Tutorial.search(params[:q])\n @tutorials = @search.result.where(suggestion: false).page(params[:page]).per(5).order('created_at DESC')\n @suggestions = @search.result.where(suggestion: true).page(params[:page]).per(5).order('created_at DESC')\n end",
"def index\n @suggest_boxes = SuggestBox.all\n end",
"def index\n @suggests = Suggest.paginate(:page => params[:page],:per_page => 10).order('created_at DESC')\n end",
"def get_v1_tag_suggestions_with_http_info(prefix, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TagApi.get_v1_tag_suggestions ...'\n end\n # verify the required parameter 'prefix' is set\n if @api_client.config.client_side_validation && prefix.nil?\n fail ArgumentError, \"Missing the required parameter 'prefix' when calling TagApi.get_v1_tag_suggestions\"\n end\n # resource path\n local_var_path = '/v1/tag-suggestions'\n\n # query parameters\n query_params = {}\n query_params[:'prefix'] = prefix\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'explain'] = opts[:'explain'] if !opts[:'explain'].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 = ['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 => 'AutocompleteResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TagApi#get_v1_tag_suggestions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def suggestion_params\n params.require(:suggestion).permit(:document_id, :text, :status, :person_id)\n end",
"def autocomplete\n @leader = Leaders.find(:all, :conditions => [\"name like ?\",\"%\" + params[:term].upcase + \"%\"])\n render json: @leader \n end",
"def known_suggestions\n @known_suggestions ||= SUGGESTIONS.constants.map do |suggestion_class|\n SUGGESTIONS.const_get(suggestion_class).new\n end\n end",
"def query(term, *opts)\n\n opts = {:count => 1, :ratio => 0.0}.merge(opts[0] || {})\n\n return [] if opts[:count] <= 0\n\n resp = JSON.parse(open(search_url term).read, :symbolize_names => true)\n\n resp[:list].map do |res|\n {\n :id => res[:defid],\n :word => res[:word],\n :author => res[:author],\n :permalink => res[:permalink],\n :definition => res[:definition].strip,\n :example => res[:example].strip,\n :upvotes => res[:thumbs_up],\n :downvotes => res[:thumbs_down]\n }\n end.keep_if do |d|\n d[:upvotes]/[d[:downvotes], 0.1].max.to_f >= opts[:ratio]\n end.take opts[:count]\n end",
"def show\n render json: @user.suggest_friends\n end",
"def index\n @suggested_categories = SuggestedCategory.all\n end",
"def new\n @suggestion = Suggestion.new\n end",
"def new\n @skill_suggestion = SkillSuggestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @skill_suggestion }\n end\n end",
"def autocomplete\n @response, = search_service.search_results do |builder|\n builder.with(builder.blacklight_params.merge(search_field: Spotlight::Engine.config.autocomplete_search_field, public: true, rows: 100))\n end\n\n respond_to do |format|\n format.json do\n render json: { docs: autocomplete_json_response(@response.documents) }\n end\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @suggestion_types }\n end\n end",
"def new\n @suggestion = Suggestion.new\n @dictionaries = Dictionary.all\n \n if params[:word_id]\n @word = Word.find_by_id(params[:word_id])\n render 'translation'\n else\n @dictionary = Dictionary.find_by_id(params[:dictionary]) if params[:dictionary]\n @suggested = params[:searched]\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @suggestion }\n end\n end\n end",
"def update\n respond_to do |format|\n if @suggestion.update(suggestion_params)\n format.html { redirect_to @suggestion, notice: 'Suggestion was successfully updated.' }\n format.json { render :show, status: :ok, location: @suggestion }\n else\n format.html { render :edit }\n format.json { render json: @suggestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def autocomplete(term)\n get(\"/catalog/titles/autocomplete?term=#{term}\")\n end",
"def get_search_suggest_with_http_info(q64, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SuggestApi.get_search_suggest ...\"\n end\n \n \n # verify the required parameter 'q64' is set\n fail ArgumentError, \"Missing the required parameter 'q64' when calling SuggestApi.get_search_suggest\" if q64.nil?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/search/suggest\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'q64'] = q64\n query_params[:'expand'] = @api_client.build_collection_param(opts[:'expand'], :multi) if opts[:'expand']\n query_params[:'profile'] = opts[:'profile'] if opts[:'profile']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'JsonNodeSearchResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SuggestApi#get_search_suggest\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end"
] |
[
"0.75693065",
"0.75616205",
"0.744794",
"0.744794",
"0.7447549",
"0.7300006",
"0.7091594",
"0.70371497",
"0.7029383",
"0.6920914",
"0.6914963",
"0.6909951",
"0.6850886",
"0.680707",
"0.67673445",
"0.67305946",
"0.6652034",
"0.65906036",
"0.6565364",
"0.6549162",
"0.6527178",
"0.65256816",
"0.64990216",
"0.64673495",
"0.64623994",
"0.64513224",
"0.6430718",
"0.6430718",
"0.6430718",
"0.6430718",
"0.6430718",
"0.6430718",
"0.6430718",
"0.6405117",
"0.63513494",
"0.634989",
"0.63370454",
"0.62904745",
"0.62841547",
"0.6280888",
"0.6266017",
"0.6265766",
"0.62353945",
"0.6227718",
"0.6221698",
"0.6205094",
"0.62015325",
"0.62015325",
"0.61918926",
"0.6159443",
"0.6147255",
"0.614188",
"0.6129888",
"0.6125917",
"0.6123545",
"0.6101039",
"0.60699564",
"0.6065861",
"0.60218245",
"0.6012469",
"0.60088676",
"0.599526",
"0.5990016",
"0.59451413",
"0.59324944",
"0.5920814",
"0.59202373",
"0.59179974",
"0.5900127",
"0.5862952",
"0.58606076",
"0.58568114",
"0.58565456",
"0.5846165",
"0.58405787",
"0.58400583",
"0.5839991",
"0.5837523",
"0.5836315",
"0.5835423",
"0.58333504",
"0.5815774",
"0.5810478",
"0.58059263",
"0.57986313",
"0.5789146",
"0.5750946",
"0.5741506",
"0.5738631",
"0.5738379",
"0.572522",
"0.57242715",
"0.5722351",
"0.5697894",
"0.5691341",
"0.5686146",
"0.56861395",
"0.5670196",
"0.5669808",
"0.5661451"
] |
0.60488445
|
58
|
POST /suggestions POST /suggestions.json
|
def create
@suggestion = Suggestion.new(params[:suggestion])
@suggestion.user = current_user
respond_to do |format|
if @suggestion.save
format.html { redirect_to :controller => 'profile', :action => 'index', notice: 'Suggestion was successfully created.' }
else
format.html { render action: "new" }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def suggest\n @suggestions = suggestions_service.suggestions\n render 'suggest', layout: false\n end",
"def suggestions\n suggest(search_suggestions)\n end",
"def create\n @suggestion = Suggestion.new(suggestion_params)\n\n if @suggestion.save\n render :show, status: :created, location: @suggestion\n else\n render json: @suggestion.errors, status: :unprocessable_entity\n end\n end",
"def suggestions\n response.try(:[], \"suggest\").try(:[], @suggest_key).try(:[], request_params[:q]).try(:[], \"suggestions\") || []\n end",
"def index\n @suggestions = Suggestion.all\n end",
"def index\n @suggestions = Suggestion.all\n end",
"def suggestion_params\n params.require(:suggestion).permit(:name, :votes, :foursquare_id, :user_id, :visited)\n end",
"def suggestion_params\n params.require(:suggestion).permit(:title, :date_created, :user_id)\n end",
"def index\n @suggestions = Suggestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @suggestions }\n end\n end",
"def create\n @suggestion = Suggestion.new(suggestion_params)\n respond_to do |format|\n if @suggestion.save\n format.html { redirect_to @suggestion, notice: 'Thank you for your suggestion!' }\n format.json { render :show, status: :created, location: @suggestion }\n else\n format.html { render :new }\n format.json { render json: @suggestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def suggestion_params\n params.require(:suggestion).permit(:subject, :content, :observation, :user_id, :revised)\n end",
"def create\n @suggestion = Suggestion.new(params[:suggestion])\n flash[:notice] = 'Thank you for your feedback. ' if @suggestion.save\n respond_with(@suggestion, location: root_url)\n end",
"def restaurant_suggestions\n match_key = Riddle.escape(params[:key]).split(' ').join('* ') + '*'\n begin\n suggestions = Restaurant.search(match_key,{:limit=>20,:match_mode => :extended,\n :ignore_errors=>true,:populate=>true,:retry_stale=>true})\n rescue Exception\n suggestions = []\n end\n response = []\n suggestions.each{|d| response << {:value=>d.id,:label=>d.name}}\n render :json=>response.to_json\n end",
"def suggestion_params\n params.require(:suggestion).permit(:author, :thoughts)\n end",
"def suggest(name, text, completion={})\n request(:post, \"_suggest\", nil, {name => {:text => text, :completion => completion}})\n end",
"def suggestions\n with_monitoring do\n Faraday.get(suggestions_url, query_params)\n end\n rescue => e\n e\n end",
"def suggest(name, text, completion = {})\n request(:post, \"_suggest\", nil, { name => { text: text, completion: completion } })\n end",
"def suggest(url)\n parameters = Specification.new(url: Types::URL).parameters(url: url)\n Suggestion.from_array(client.get(\"/posts/suggest\", parameters))\n end",
"def return_suggestion\n suggestion = Petit::Shortcode.suggest\n if request.accept?('application/json') || request.accept?('application/vnd.api+json')\n response.headers['Content-Type'] = 'application/vnd.api+json'\n json_body = {\n data: {\n type: 'suggestion',\n id: suggestion,\n attributes: {\n name: suggestion\n }\n }\n }\n json_body.to_json\n else\n suggestion\n end\n end",
"def create\n\n ### This one works. \n # @work = Work.friendly.find(params[:work_id])\n # @suggestion = @work.suggesteds.build(suggestion_params)\n # @suggestion.suggester_ip = request.remote_ip\n # @suggestion.user = current_user if current_user\n # respond_to do |format|\n # if @suggestion.save\n # format.html { redirect_to @work\n # flash[:success] = \"Your tag suggestion has been added!\" }\n # format.json { render json: @suggestion, status: :created, location: @suggestion } \n # else\n # format.html { redirect_to @work\n # flash[:warning] = \"Suggesting the suggestion failed. Probably either because you had weird characters in there, or the suggestion exists already.\" }\n # format.json { render json: @suggestion.errors, status: :unprocessable_entity }\n # end\n # end\n\n # This one parses the incoming suggestion(s). AND IT WORKS TOO. \n @work = Work.friendly.find(params[:work_id])\n suggestions = params[:suggested][:suggestion].split(',')\n @i = 0\n if current_user\n @current_user_id = current_user.id \n else \n @current_user_id = nil \n end\n\n suggestions.each do |s, index|\n new_suggestion = @work.suggesteds.build(\n suggester_ip: request.remote_ip,\n user_id: @current_user_id,\n suggestion: s)\n if new_suggestion.save\n @i += 1\n end \n if @i == suggestions.count\n @suggestions_saved = true\n else \n @suggestions_saved = false\n end\n end\n respond_to do |format|\n if @suggestions_saved\n format.html { redirect_to @work \n flash[:info] = \"Success.\"}\n format.json { }\n else\n format.html { redirect_to @work \n flash[:danger] = \"Suggested tags must be unique.\"}\n format.json { }\n end\n end \n end",
"def suggestion_params\n params.require(:suggestion).permit(:document_id, :text)\n end",
"def suggestion_params\n params.require(:suggestion).permit(:document_id, :text, :status, :person_id)\n end",
"def create\n @suggestion = Suggestion.new(params[:suggestion])\n\n respond_to do |format|\n if @suggestion.save\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @suggestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def suggest_params\n params.require(:suggest).permit(:name, :phone, :email, :content)\n end",
"def suggestion_params\n params.require(:suggestion).permit(:name, :author, :ISBN, :Description, :status)\n end",
"def suggest_params\n params.require(:suggest).permit(:title, :content)\n end",
"def new\n @suggestion = Suggestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @suggestion }\n end\n end",
"def suggestion_params\n params.require(:suggestion).permit(:location, :model, :manufacturer, :style)\n end",
"def search_suggestions_params\n params.require(:SearchSuggestion).permit(:popularity, :term )\n end",
"def suggestions\n perform_request_with_collection(:get, '/api/v1/accounts/suggestions', {}, Mastodon::Account)\n end",
"def create\n @talk_suggestion = TalkSuggestion.new(params[:talk_suggestion])\n\n respond_to do |format|\n if @talk_suggestion.save\n format.html { redirect_to talk_suggestions_path, notice: 'Talk suggestion was successfully created.' }\n format.json { render json: @talk_suggestion, status: :created, location: @talk_suggestion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @talk_suggestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def suggest_results\n repository.auto_suggest(suggest_handler_path, request_params)\n end",
"def searchsuggestion_params\n params.require(:searchsuggestion).permit(:term, :popularity)\n end",
"def create\n @suggestion = Suggestion.new(params[:suggestion])\n @suggestion.user_id = current_user.id\n if @suggestion.dictionary_id\n @word = Word.find_by_word_and_dictionary_id(@suggestion.word_name, @suggestion.dictionary_id)\n @suggestion.word_id = @word.id if @word\n else\n @word = Word.find_by_id(@suggestion.word_id)\n @suggestion.dictionary_id = @word.dictionary_id if @word\n end\n \n respond_to do |format|\n if @suggestion.save\n flash[:notice] = 'Suggestion was successfully created.'\n format.html { redirect_to(@suggestion) }\n format.xml { render :xml => @suggestion, :status => :created, :location => @suggestion }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @suggestion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n unless @current_user\n flash[:error] = \"You must be logged in to create a suggestion\"\n redirect_to(suggestions_url)\n return\n end\n\n @suggestion = Suggestion.new(params[:suggestion])\n @suggestion.user = @current_user\n\n respond_to do |format|\n if @suggestion.save\n flash[:notice] = 'Suggestion was successfully created.'\n format.html { redirect_to(@suggestion) }\n format.js { render :json => @suggestion.to_json(:include => [:icon, :user], :method => :to_param)}\n format.xml { render :xml => @suggestion, :status => :created, :location => @suggestion }\n else\n format.html { render :action => \"new\" }\n format.js { render :json => { :errors => @suggestion.errors.full_messages } }\n format.xml { render :xml => @suggestion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def fast_suggestions query\n return []\n end",
"def create\n @ingredient_suggestion = IngredientSuggestion.new(ingredient_suggestion_params)\n\n respond_to do |format|\n if @ingredient_suggestion.save\n format.html { redirect_to @ingredient_suggestion, notice: 'Ingredient suggestion was successfully created.' }\n format.json { render :show, status: :created, location: @ingredient_suggestion }\n else\n format.html { render :new }\n format.json { render json: @ingredient_suggestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def spelling_suggestions(query, opts = {})\n invoke 'SpellingSuggestions', query, opts\n end",
"def blog_suggestion_params\n params.require(:blog_suggestion).permit(:title, :status, :description)\n end",
"def index\n @talk_suggestions = TalkSuggestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talk_suggestions }\n end\n end",
"def create\n @skill_suggestion = SkillSuggestion.new(params[:skill_suggestion])\n\n respond_to do |format|\n if @skill_suggestion.save\n format.html { redirect_to @skill_suggestion, notice: 'Skill suggestion was successfully created.' }\n format.json { render json: @skill_suggestion, status: :created, location: @skill_suggestion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @skill_suggestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_suggestion\n @suggestion = Suggestion.find(params[:id])\n end",
"def set_suggestion\n @suggestion = Suggestion.find(params[:id])\n end",
"def set_suggestion\n @suggestion = Suggestion.find(params[:id])\n end",
"def set_suggestion\n @suggestion = Suggestion.find(params[:id])\n end",
"def set_suggestion\n @suggestion = Suggestion.find(params[:id])\n end",
"def set_suggestion\n @suggestion = Suggestion.find(params[:id])\n end",
"def set_suggestion\n @suggestion = Suggestion.find(params[:id])\n end",
"def create\n @change_suggestion = ChangeSuggestion.new(params[:change_suggestion])\n\n respond_to do |format|\n if @change_suggestion.save\n format.html { redirect_to @change_suggestion, notice: 'Change suggestion was successfully created.' }\n format.json { render json: @change_suggestion, status: :created, location: @change_suggestion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @change_suggestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @suggestion.update(suggestion_params)\n render :show, status: :ok, location: @suggestion\n else\n render json: @suggestion.errors, status: :unprocessable_entity\n end\n end",
"def create\n @blog_suggestion = BlogSuggestion.new(blog_suggestion_params)\n\n respond_to do |format|\n if @blog_suggestion.save\n format.html { redirect_to root_path, notice: \"Blog suggestion was successfully created.\" }\n format.json { render :show, status: :created, location: @blog_suggestion }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @blog_suggestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def suggestions\n words = params[:query].split(/\\s+/).reject(&:blank?)\n\n suggestions = case words.size\n when 1\n if words.first.starts_with?('@')\n users = find_users(words.first[1..-1]).limit(MAX_SUGGESTIONS)\n users.map do |user|\n {\n user: user.as_json,\n url: user_url(user),\n type: 'user'\n }\n end\n else\n projects = find_projects(words[0]).limit(MAX_SUGGESTIONS).map(&:sluggable).compact\n projects.map do |project|\n {\n project: project.as_json,\n url: project_url(project),\n type: 'project',\n }\n end\n end\n when 2\n project = find_projects(words[0]).only.try!(:sluggable)\n envs = find_environments(project, words[1]).limit(10) if project\n envs.map do |env|\n {\n project: project.as_json,\n environment: env.as_json,\n type: 'environment',\n url: project_environment_bugs_url(project, env)\n\n\n }\n end if project\n when 3\n project = find_projects(words[0]).only.try!(:sluggable)\n env = find_environments(project, words[1]).only if project\n bug = env.bugs.find_by_number(words[2].to_i) if env\n [{\n type: 'bug',\n url: project_environment_bug_url(project, env, bug),\n project: project.as_json,\n environment: env.as_json,\n bug: bug.as_json\n }] if bug\n when 4\n project = find_projects(words[0]).only.try!(:sluggable)\n env = find_environments(project, words[1]).only if project\n bug = env.bugs.find_by_number(words[2].to_i) if env\n occurrence = bug.occurrences.find_by_number(words[3].to_i) if bug\n [{\n type: 'occurrence',\n url: project_environment_bug_occurrence_url(project, env, bug, occurrence),\n project: project.as_json,\n environment: env.as_json,\n bug: bug.as_json,\n occurrence: occurrence.as_json\n }] if occurrence\n end\n\n respond_to do |format|\n format.json { render json: (suggestions || []).to_json }\n end\n end",
"def event_location_suggestions\n @here = Apis::HereApi.new(params[:address]).get_suggestions\n render json: @here\n end",
"def set_suggestion\n @suggesiton = Suggestion.find(params[:id])\n end",
"def update!(**args)\n @suggestions = args[:suggestions] if args.key?(:suggestions)\n end",
"def create\n @suggest = Suggest.new(suggest_params)\n @suggest.ip = request.ip\n respond_to do |format|\n if @suggest.save\n format.html { redirect_to :contact, notice: '感谢您对我们的支持,我们会尽快改进。' }\n format.json { render :show, status: :created, location: @suggest }\n else\n format.html { render :index }\n format.json { render json: @suggest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @suggestions = args[:suggestions] if args.key?(:suggestions)\n end",
"def update!(**args)\n @suggestions = args[:suggestions] if args.key?(:suggestions)\n end",
"def create\n @suggest = Suggest.new(suggest_params)\n @suggest.user_id= current_user.id\n @suggest.suggest_user=current_user.nickname\n\n respond_to do |format|\n if @suggest.save\n format.html { redirect_to @suggest, notice: 'Suggest was successfully created.' }\n format.json { render :show, status: :created, location: @suggest }\n else\n format.html { render :new }\n format.json { render json: @suggest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @suggestion = Suggestion.add(params[:suggestion])\n\n redirect_to @suggestion.valid? ? \n admin_suggestions_path :\n new_admin_suggestion_path\n end",
"def create\n @suggestion = Suggestion.new(suggestion_params)\n if @suggestion.save\n flash[:notice]='Suggestion was successfully created.'\n redirect_to '/'\n else\n flash[:notice]=\"Suggestion could not be created\"\n redirect_to '/'\n end\n end",
"def create\n @suggestion = Suggestion.new(params[:suggestion])\n\t\t@suggestion.suggester_id = params[:suggestion][:suggester_id]\n\t\t@suggestion.suggest_to_id = params[:suggestion][:suggest_to_id]\n\n\t\tif params[:book_id]\n\t\t\t@suggestion.book_id = params[:suggestion][:book_id]\n\t\tend\n\n\t\tif params[:job_id]\n \t@suggestion.job_id = params[:suggestion][:job_id]\n\t\tend\n\n\t\t@suggest_to = Person.find(@suggestion.suggest_to_id)\n\n respond_to do |format|\n if @suggestion.save\n flash[:notice] = \"Suggestion was successfully sent to #{@suggest_to.name}.\"\n format.html { redirect_to(@suggestion) }\n format.xml { render :xml => @suggestion, :status => :created, :location => @suggestion }\n\t\t\t\tformat.js\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @suggestion.errors, :status => :unprocessable_entity }\n\t\t\t\tformat.js\n end\n end\n end",
"def suggest\n @result = Artist.search( params[:term] )\n \n respond_to do |format|\n format.html\n format.json { render :json => @result }\n end\n end",
"def suggest\n tags = Tag.where('tags.name LIKE ?', \"#{params[:q]}%\").limit(10).order(:name)\n\n render json: {\n results: tags.map { |tag|\n {\n id: tag.name,\n text: \"#{tag.name} (#{tag.count})\"\n }\n },\n }\n end",
"def suggestions\n # If we haven't registered an autocomplete, just return the empty set\n return [] if @autocomplete_config.nil?\n Dromedary::Suggest::Response.new suggest_results, request_params, autocomplete_config\n end",
"def create\n @brandslip_suggestion = BrandslipSuggestion.new(params[:brandslip_suggestion])\n\n respond_to do |format|\n if @brandslip_suggestion.save\n format.html { redirect_to @brandslip_suggestion, notice: 'Brandslip suggestion was successfully created.' }\n format.json { render json: @brandslip_suggestion, status: :created, location: @brandslip_suggestion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @brandslip_suggestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def suggestion_box_params\n params.require(:suggestion_box).permit(:name, :description, :status)\n end",
"def index\n @suggestions = Suggestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @suggestions }\n end\n end",
"def create\n @suggestion_box = SuggestionBox.new(suggestion_box_params)\n\n respond_to do |format|\n if @suggestion_box.save\n format.html { redirect_to @suggestion_box, notice: 'Suggestion box was successfully created.' }\n format.json { render :show, status: :created, location: @suggestion_box }\n else\n format.html { render :new }\n format.json { render json: @suggestion_box.errors, status: :unprocessable_entity }\n end\n end\n end",
"def prepare_suggested_searches\n @suggested_searches = [\n # { label_key: 'search_suggestion_whale_mass',\n # params: {\n # sort: 'desc',\n # min: 10000,\n # taxon_concept_id: 7649,\n # attribute: 'http://purl.obolibrary.org/obo/VT_0001259',\n # unit: 'http://purl.obolibrary.org/obo/UO_0000009' }},\n # { label_key: 'search_suggestion_cavity_nests',\n # params: {\n # q: 'cavity',\n # attribute: 'http://eol.org/schema/terms/NestType' }},\n { label_key: 'search_suggestion_diatom_shape',\n params: {\n attribute: 'http://purl.obolibrary.org/obo/OBA_0000052',\n taxon_concept_id: 3685 }} #,\n # { label_key: 'search_suggestion_blue_flowers',\n # params: {\n # q: 'http://purl.obolibrary.org/obo/PATO_0000318',\n # attribute: 'http://purl.obolibrary.org/obo/TO_0000537' }}\n ]\n end",
"def index\n @blog_suggestions = BlogSuggestion.all\n end",
"def suggest\n # For some reason, Rails is not respecting the include_root_in_json for this action. So need to specify manually.\n render(:root => false, :json => OptionSuggester.new.suggest(current_mission, params[:q]).as_json(:for_option_set_form => true))\n end",
"def new\n @talk_suggestion = TalkSuggestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @talk_suggestion }\n end\n end",
"def findorsuggest()\n \n end",
"def new\n @suggestion = Suggestion.new\n end",
"def create\n @suggestion = Suggestion.new(suggestion_params)\n @suggestion.user = current_user\n @suggestion.status = 'Pending'\n respond_to do |format|\n if @suggestion.save\n format.html { redirect_to document_path(suggestion_params[:document_id]), notice: 'Suggestion was successfully created.' }\n format.json { render :show, status: :created, location: @suggestion }\n else\n puts('--------------------------------------')\n format.html { redirect_to root_path, notice: @suggestion.errors }\n format.json { render json: @suggestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ingredient_suggestion_params\n params.require(:ingredient_suggestion).permit(:item)\n end",
"def create\n @suggestion = Suggestion.new(suggestion_params)\n @suggestion.person_id = current_person.id\n\n respond_to do |format|\n if @suggestion.save\n format.html { redirect_to [@document, @suggestion], notice: 'Suggestion was successfully created.' }\n format.json { render :show, status: :created, location: @suggestion }\n else\n format.html { render :new }\n format.json { render json: @suggestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_suggestions(name, items)\n # unless alternatives = compute_alternatives(name, items)\n # return\n # end\n # append_message(sprintf(' Did you mean \"%s\"?', implode('\", \"', alternatives)))\n end",
"def suggest_results\n Blacklight.default_index.connection.send_and_receive(suggest_handler_path, params: request_params)['suggest']\n end",
"def search\n search_param = params[:term]\n matching_keys = UserKey.submitted.search(search_param).collect { |u| { value: \"#{u.name}\", data: u.id } }\n render json: { suggestions: matching_keys }\n end",
"def suggestion_search\n keywords = params[:q]\n keywords = Utils.nomalize_string(keywords)\n\n if keywords.include? '-'\n keywords = keywords.gsub! '-', \" \"\n end\n\n pattern = /#{Regexp.escape(keywords)}/i\n\n users = User.or({:name => pattern}, {:email => pattern}).map { |user|\n UserSerializer.new(user).suggestion_search_hash\n }\n\n render json: users, root: false\n return\n end",
"def create\n @suggestion = Suggestion.new(suggestion_params)\n @suggestion.user_id = current_user.id if current_user.present?\n @suggestion.type_s = params[:suggestion][:type_s].to_i\n respond_to do |format|\n if @suggestion.save\n if @suggestion.info? || @suggestion.especial?\n flash[:info] = 'Revisaremos tu mensaje y contactaremos en breve contigo.'\n else\n flash[:info] = 'Hemos registrado tu sugerencia, recuerda que una vez al mes revisamos nuestras sugerencias y realizamos encuestas. <br> Gracias por tu opinión'\n end\n \n format.html { redirect_to root_path }\n format.json { render :show, status: :created, location: @suggestion }\n else\n format.html { render :new }\n \n end\n end\n end",
"def list\n\t\t# see also as_json overrides in the models\n\t\trender json: load_suggestions(suggestion_params[:avatar_id])\t\t \n end",
"def suggest\n end",
"def index\n @suggestion_boxes = SuggestionBox.all\n end",
"def create\n @suggestion = Suggestion.new(params[:suggestion])\n\n respond_to do |format|\n if @suggestion.save\n #flash[:notice] = 'Suggestion was successfully created.'\n format.html { redirect_to(root_url) } \n format.xml { render :xml => @suggestion, :status => :created, :location => @suggestion }\n else\n flash[:notice] = 'Thanks, but that name has already been suggested.'\n format.html { redirect_to(root_url) }\n format.xml { render :xml => @suggestion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def auto_complete_for_keyword_list\n auto_complete_responder_for_keyword params[:keyword][:list]\n end",
"def new\n @skill_suggestion = SkillSuggestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @skill_suggestion }\n end\n end",
"def autocomplete\n @design_methods = DesignMethod.where(['name LIKE ?', \"#{params[:term]}%\"])\n @design_hash = []\n @design_methods.each do |d|\n @design_hash << { label: d.name }\n end\n respond_to do |format|\n format.json { render json: @design_hash}\n end\n end",
"def set_suggest\n @suggest = Suggest.find(params[:id])\n end",
"def new\n @brandslip_suggestion = BrandslipSuggestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @brandslip_suggestion }\n end\n end",
"def submit\n \n # check if user is blacklisted\n\t\tblacklist_entry = IpBlacklist.find_by_ip_address(request.remote_ip)\n\t\tif blacklist_entry\n\t\t\tif blacklist_entry.status == 0\n\t\t\t\trender json: {:status => \"blacklisted\", :name => blacklist_entry.user_name}\n\t\t\t\treturn\n elsif blacklist_entry.status == 2\n @boost = true\n elsif blacklist_entry.status == 3\n @solo = true\n end\n\t\tend\n \n # check if someone is soloing\n solo_entry = IpBlacklist.find_by_status(3)\n if solo_entry\n if solo_entry.ip_address != request.remote_ip\n render json: {:status => \"solo\", :name => solo_entry.user_name}\n return\n end\n end\n\n c = Suggestion.where(\"status = 1 AND avatar_id = :avatar_id AND voting_started_at > :limit\", :avatar_id => suggestion_params[:avatar_id], :limit => 1.minute.ago.to_i).count \n logger.debug c\n if c >= Setting.first.num_display_suggestions - 1\n render json: {:status => \"full\"}\n return\n end\n \n # create a new suggestion\n\t\t@suggestion = Suggestion.new(\n\t\t\t\t:time_string => Time.now.to_i,\n :voting_started_at => Time.now.to_i,\n\t\t\t\t:content => suggestion_params[:content], \n\t\t\t\t:name => suggestion_params[:name],\n\t\t\t\t:avatar_id => suggestion_params[:avatar_id],\n\t\t\t\t:user_hash => cookies['user_hash'],\n\t\t\t\t:score => 0,\n\t\t\t\t:status => 1, # go directly to voting\n\t\t\t\t:ip_address => request.remote_ip\n\t\t) \n\n if suggestion_params[:name] == \"\"\n @suggestion.name = \"Gast\"\n end\n\n if @boost # boost, go directly to transmit\n boost_suggestion(@suggestion)\n\t\tend\n\n if @solo \n @suggestion.name2 = \"solo\"\n end\n\n\t\tif @suggestion.save\n Pusher.trigger('chez_ois_chat', 'update_suggestions_' + suggestion_params[:avatar_id], load_suggestions(suggestion_params[:avatar_id]))\n\n # check in after timeout seconds and retire suggestion\n Thread.new(@suggestion.id, params) do |id, params|\n logger.debug \"starting vote countdown thread\"\n sleep 60\n suggestion = Suggestion.find(id)\n if suggestion.status == 1\n logger.debug \"retiring suggestion that didn't reach the top\"\n retire_suggestion(suggestion, params)\n end\n ActiveRecord::Base.connection.close\n logger.debug \"closing thread\"\n end\n\n #Pusher['chez_ois_chat'].trigger('update_suggestions_' + suggestion_params[:avatar_id], load_suggestions(params[:avatar_id]))\n if @boost\n render json: {:status => \"boost\"}\n else\n\t\t\t render json: @suggestion\n end\n \tend\n end",
"def update\n respond_to do |format|\n if @suggestion.update(suggestion_params)\n format.html { redirect_to @suggestion, notice: 'Suggestion was successfully updated.' }\n format.json { render :show, status: :ok, location: @suggestion }\n else\n format.html { render :edit }\n format.json { render json: @suggestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def suggestions\n suggest_response['suggest'].values.first[q]['suggestions']\n .uniq { |s| s['term'].downcase }\n .sort_by { |s| (-s['weight']) * 100 + s['term'].length }\n .take(5)\n end",
"def suggestion\n if user_signed_in?\n user = current_user.email\n else\n user = \"< not logged in >\"\n end\n\n if params[:suggestion]\n ContactMailer.suggestion_email(params[:suggestion], params[:pathname], user).deliver!\n end\n respond_to do |format|\n format.json { render json: params[:suggestion] }\n end\n end",
"def suggest_smart_replies request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_suggest_smart_replies_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Dialogflow::V2::SuggestSmartRepliesResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def suggest()\n\n\t\t\t# It is necessary to clone the json in order to manipulate it\n\t\t\tarticles_clone = articles.clone\n\n\t\t\t# This variable stores the total of articles in logs/content/myad categories inside the json\n\t\t\ttotal_articles = articles_clone[\"logs\"].length + articles_clone[\"content\"].length + articles_clone[\"myad\"].length\n\n\t\t\t# This variable stores the result in array\n\t\t\ttoken_result = Array.new\n\n\t\t\tloop do\n\t\t\t\tarticles_clone.each do |key, array_value|\n\t\t\t\t\tbreak unless token_result.length < MAX_RECOMMENDED_ARTICLES \n\t\t\t\t\tnext if array_value.empty?\n\n\t\t\t\t\tarray = array_value.shift\t\t # Store the first element of the array in this iteration\n\t\t\t\t\ttoken_result.push(array[\"token\"].to_i) # We add a new \"token\" from the element\n\t\t\t\tend\n\n\t\t\t\t# It is mandatory to control the amount of items in the array (token_result), otherwise, we have an infinite loop.\n\t\t\t\tbreak unless token_result.length < MAX_RECOMMENDED_ARTICLES && token_result.length < total_articles\t\n\t\t\tend\n\n\t\t\ttoken_result \n\t\tend",
"def suggest\n if !params.has_key? :q then\n head :ok\n return\n end\n\n search_stmt = params[:q].upcase\n current_user_id = current_user.id\n\n results = UrContact.where.has{\n (user_id == current_user_id) &\n (upper(name).like \"%#{search_stmt}%\") |\n (upper(email).like \"%#{search_stmt}%\") |\n (upper(telephone).like \"%#{search_stmt}%\")\n }\n\n if params[:format] == \"search\" then\n formattedResults = results\n else\n formattedResults = {query:params[:q], suggestions:results.map{|x| {value:x.name, data:x}} }\n end\n\n #render json: {query:params[:q], suggestions:results}\n render json: formattedResults\n end",
"def suggest\n unless request.post?\n render :nothing=>true\n return\n end\n tags = Tag.all.to_a.map(&:name)\n current = params[:current].split(/,/)\n current.map!{|tag_name| tag_name.strip}\n current = Set.new(current)\n found = Set.new\n tags.each do |tag|\n if params[:name] =~ /(\\s|^)#{Regexp.escape(tag)}(\\s|$)/i \\\n || params[:description] =~ /(\\s|^)#{Regexp.escape(tag)}(\\s|$)/i\n\n found << tag\n end\n end\n current.merge(found)\n @tags_list = current.to_a.sort.join(\", \")\n end"
] |
[
"0.71769315",
"0.69647485",
"0.69324344",
"0.6886024",
"0.6859701",
"0.6859701",
"0.6831595",
"0.6822349",
"0.6787382",
"0.6739569",
"0.66942817",
"0.6672928",
"0.6663233",
"0.66093683",
"0.6562772",
"0.65519756",
"0.653803",
"0.65379304",
"0.65335053",
"0.6528325",
"0.65255976",
"0.6524863",
"0.65118366",
"0.6503619",
"0.6472216",
"0.64399177",
"0.63714844",
"0.633492",
"0.6330261",
"0.6277488",
"0.6206099",
"0.61938494",
"0.61919326",
"0.61823744",
"0.61490905",
"0.61291295",
"0.6123359",
"0.61069065",
"0.6105454",
"0.6086639",
"0.6083741",
"0.6056324",
"0.6056324",
"0.6056324",
"0.6056324",
"0.6056324",
"0.6056324",
"0.6056324",
"0.6043746",
"0.60328954",
"0.6032506",
"0.60219586",
"0.6018669",
"0.600722",
"0.60063875",
"0.60050553",
"0.60048354",
"0.6003871",
"0.600247",
"0.5990779",
"0.5987802",
"0.59544325",
"0.5944923",
"0.59336674",
"0.5930946",
"0.58900976",
"0.5884169",
"0.5879234",
"0.58745164",
"0.58644146",
"0.5859449",
"0.5843488",
"0.5837457",
"0.5829119",
"0.58217794",
"0.5821225",
"0.58145976",
"0.58045536",
"0.57987523",
"0.5784225",
"0.57602715",
"0.5749418",
"0.57276976",
"0.57168573",
"0.5715808",
"0.57103115",
"0.57010204",
"0.56980324",
"0.5696927",
"0.5689873",
"0.5684839",
"0.56742597",
"0.56574774",
"0.56539464",
"0.5635875",
"0.56268007",
"0.5616563",
"0.5602732",
"0.5585882",
"0.55854887"
] |
0.56217647
|
96
|
PUT /suggestions/1 PUT /suggestions/1.json
|
def update
@suggestion = Suggestion.find(params[:id])
respond_to do |format|
if @suggestion.update_attributes(params[:suggestion])
format.html { redirect_to @suggestion, notice: 'Suggestion was successfully updated.' }
format.json { head :ok }
else
format.html { render action: "edit" }
format.json { render json: @suggestion.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update!(**args)\n @suggestions = args[:suggestions] if args.key?(:suggestions)\n end",
"def update!(**args)\n @suggestions = args[:suggestions] if args.key?(:suggestions)\n end",
"def update!(**args)\n @suggestions = args[:suggestions] if args.key?(:suggestions)\n end",
"def update\n if @suggestion.update(suggestion_params)\n render :show, status: :ok, location: @suggestion\n else\n render json: @suggestion.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @suggestion.update(suggestion_params)\n format.html { redirect_to @suggestion, notice: 'Suggestion was successfully updated.' }\n format.json { render :show, status: :ok, location: @suggestion }\n else\n format.html { render :edit }\n format.json { render json: @suggestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @suggest.update(suggest_params)\n format.html { redirect_to @suggest, notice: 'Suggest was successfully updated.' }\n format.json { render :show, status: :ok, location: @suggest }\n else\n format.html { render :edit }\n format.json { render json: @suggest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @suggestion = Suggestion.find(params[:id])\n\n respond_to do |format|\n if @suggestion.update_attributes(params[:suggestion])\n flash[:notice] = 'Suggestion was successfully updated.'\n format.html { redirect_to(@suggestion) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @suggestion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @smart_suggestions = args[:smart_suggestions] if args.key?(:smart_suggestions)\n @suggestion_list_identifier = args[:suggestion_list_identifier] if args.key?(:suggestion_list_identifier)\n end",
"def update!(**args)\n @suggestion = args[:suggestion] if args.key?(:suggestion)\n @unfulfillable = args[:unfulfillable] if args.key?(:unfulfillable)\n end",
"def update\n respond_to do |format|\n if @suggestion.update(suggestion_params)\n format.html { redirect_to [@document, @suggestion], notice: 'Suggestion was successfully updated.' }\n format.json { render :show, status: :ok, location: @suggestion }\n else\n format.html { render :edit }\n format.json { render json: @suggestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @suggestion = Suggestion.find(params[:id])\n\n respond_to do |format|\n if @suggestion.update_attributes(params[:suggestion])\n #flash[:notice] = 'Suggestion was successfully updated.'\n format.html { redirect_to(root_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @suggestion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @suggestion = Suggestion.find(params[:id])\n @suggestion.user_id = current_user.id\n \n respond_to do |format|\n if @suggestion.update_attributes(params[:suggestion])\n flash[:notice] = 'Suggestion was successfully updated.'\n format.html { redirect_to(@suggestion) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @suggestion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_suggestion\n @suggestion = Suggestion.find(params[:id])\n end",
"def set_suggestion\n @suggestion = Suggestion.find(params[:id])\n end",
"def set_suggestion\n @suggestion = Suggestion.find(params[:id])\n end",
"def set_suggestion\n @suggestion = Suggestion.find(params[:id])\n end",
"def set_suggestion\n @suggestion = Suggestion.find(params[:id])\n end",
"def set_suggestion\n @suggestion = Suggestion.find(params[:id])\n end",
"def set_suggestion\n @suggestion = Suggestion.find(params[:id])\n end",
"def set_suggestion\n @suggesiton = Suggestion.find(params[:id])\n end",
"def update\n if @suggestion.update(suggestion_params)\n flash[:notice]='Suggestion was successfully updated.'\n redirect_to '/'\n else\n flash[:notice]=\"Suggestion could not be updated\"\n end\n end",
"def edit\n @suggestion = Suggestion.find(params[:id])\n end",
"def update!(**args)\n @suggest_results = args[:suggest_results] if args.key?(:suggest_results)\n end",
"def update!(**args)\n @suggest_results = args[:suggest_results] if args.key?(:suggest_results)\n end",
"def update\n @change_suggestion = ChangeSuggestion.find(params[:id])\n\n respond_to do |format|\n if @change_suggestion.update_attributes(params[:change_suggestion])\n format.html { redirect_to @change_suggestion, notice: 'Change suggestion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @change_suggestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @skill_suggestion = SkillSuggestion.find(params[:id])\n\n respond_to do |format|\n if @skill_suggestion.update_attributes(params[:skill_suggestion])\n format.html { redirect_to @skill_suggestion, notice: 'Skill suggestion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @skill_suggestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @talk_suggestion = TalkSuggestion.find(params[:id])\n\n respond_to do |format|\n if @talk_suggestion.update_attributes(params[:talk_suggestion])\n format.html { redirect_to @talk_suggestion, notice: 'Talk suggestion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @talk_suggestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ingredient_suggestion.update(ingredient_suggestion_params)\n format.html { redirect_to @ingredient_suggestion, notice: 'Ingredient suggestion was successfully updated.' }\n format.json do\n render :nothing => true, :status => 200\n # render :show, status: :ok, location: @ingredient_suggestion\n end\n else\n format.html { render :edit }\n format.json { render json: @ingredient_suggestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @suggestion_box.update(suggestion_box_params)\n format.html { redirect_to @suggestion_box, notice: 'Suggestion box was successfully updated.' }\n format.json { render :show, status: :ok, location: @suggestion_box }\n else\n format.html { render :edit }\n format.json { render json: @suggestion_box.errors, status: :unprocessable_entity }\n end\n end\n end",
"def suggestion_params\n params.require(:suggestion).permit(:name, :votes, :foursquare_id, :user_id, :visited)\n end",
"def update!(**args)\n @people_suggestion = args[:people_suggestion] if args.key?(:people_suggestion)\n @query_suggestion = args[:query_suggestion] if args.key?(:query_suggestion)\n @source = args[:source] if args.key?(:source)\n @suggested_query = args[:suggested_query] if args.key?(:suggested_query)\n end",
"def update!(**args)\n @people_suggestion = args[:people_suggestion] if args.key?(:people_suggestion)\n @query_suggestion = args[:query_suggestion] if args.key?(:query_suggestion)\n @source = args[:source] if args.key?(:source)\n @suggested_query = args[:suggested_query] if args.key?(:suggested_query)\n end",
"def update\n @suggestion = Suggestion.find(params[:id])\n values = params[:suggestion]\n values.reject! { |k,v| k == :user_id }\n\n respond_to do |format|\n if @current_user and (@current_user.admin? or @suggestion.user == @current_user)\n if @suggestion.update_attributes(params[:suggestion])\n flash[:notice] = 'Suggestion was successfully updated.'\n format.html { redirect_to(@suggestion) }\n format.xml { head :ok }\n else\n #format.html { redirect_to edit_suggestion_path }\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @suggestion.errors, :status => :unprocessable_entity }\n end\n else\n format.html do\n flash[:error] = \"Sorry that suggestion does not belong to you.\"\n redirect_to(@suggestion)\n end\n format.xml { render :xml => \"That suggestion does not belong to you.\" }\n end\n end\n end",
"def suggest\n @suggestions = suggestions_service.suggestions\n render 'suggest', layout: false\n end",
"def suggestion_params\n params.require(:suggestion).permit(:document_id, :text, :status, :person_id)\n end",
"def update_suggested_course_pathway\n suggested_pathway = SuggestedPathway.find_by(id: params[:id])\n suggested_pathway.name = params[:name]\n suggested_pathway.year = params[:year]\n suggested_pathway.course_id = params[:course_id]\n suggested_pathway.data = params[:data]\n suggested_pathway.save\n render json: suggested_pathway\n end",
"def suggestion_params\n params.require(:suggestion).permit(:title, :date_created, :user_id)\n end",
"def index\n @suggestions = Suggestion.all\n end",
"def index\n @suggestions = Suggestion.all\n end",
"def suggestion_params\n params.require(:suggestion).permit(:name, :author, :ISBN, :Description, :status)\n end",
"def set_suggest\n @suggest = Suggest.find(params[:id])\n end",
"def suggestion_params\n params.require(:suggestion).permit(:author, :thoughts)\n end",
"def update\n respond_to do |format|\n if @blog_suggestion.update(blog_suggestion_params)\n format.html { redirect_to root_path, notice: \"Blog suggestion was successfully updated.\" }\n format.json { render :show, status: :ok, location: @blog_suggestion }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @blog_suggestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def suggestion_params\n params.require(:suggestion).permit(:subject, :content, :observation, :user_id, :revised)\n end",
"def suggestion_params\n params.require(:suggestion).permit(:document_id, :text)\n end",
"def update\n @brandslip_suggestion = BrandslipSuggestion.find(params[:id])\n\n respond_to do |format|\n if @brandslip_suggestion.update_attributes(params[:brandslip_suggestion])\n format.html { redirect_to @brandslip_suggestion, notice: 'Brandslip suggestion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @brandslip_suggestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event_suggestion = EventSuggestion.find(params[:id])\n\n respond_to do |format|\n if @event_suggestion.update_attributes(params[:event_suggestion])\n flash[:notice] = 'EventSuggestion was successfully updated.'\n format.html { redirect_to(@event_suggestion) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event_suggestion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @suggestions = args[:suggestions] if args.key?(:suggestions)\n end",
"def update\n respond_to do |format|\n if @suggestion_type.update_attributes(suggestion_type_params)\n format.html { redirect_to(@suggestion_type, :notice => 'Suggestion type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @suggestion_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def suggest(name, text, completion={})\n request(:post, \"_suggest\", nil, {name => {:text => text, :completion => completion}})\n end",
"def set_suggestion_box\n @suggestion_box = SuggestionBox.find(params[:id])\n end",
"def index\n @suggestions = Suggestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @suggestions }\n end\n end",
"def update!(**args)\n @client_id = args[:client_id] if args.key?(:client_id)\n @suggestion_count = args[:suggestion_count] if args.key?(:suggestion_count)\n end",
"def decline_suggestion(id)\n delete(\"suggestions/#{id}\")\n end",
"def set_ingredient_suggestion\n @ingredient_suggestion = IngredientSuggestion.find(params[:id])\n end",
"def suggest(name, text, completion = {})\n request(:post, \"_suggest\", nil, { name => { text: text, completion: completion } })\n end",
"def update!(**args)\n @suggested_query = args[:suggested_query] if args.key?(:suggested_query)\n end",
"def update!(**args)\n @suggested_query = args[:suggested_query] if args.key?(:suggested_query)\n end",
"def create\n @suggestion = Suggestion.new(suggestion_params)\n\n if @suggestion.save\n render :show, status: :created, location: @suggestion\n else\n render json: @suggestion.errors, status: :unprocessable_entity\n end\n end",
"def suggestions\n suggest(search_suggestions)\n end",
"def update\n @hospital_suggestion = HospitalSuggestion.find(params[:id])\n\n respond_to do |format|\n if @hospital_suggestion.update_attributes(params[:hospital_suggestion])\n format.html { redirect_to @hospital_suggestion, notice: 'Hospital suggestion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hospital_suggestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @suggestion = Suggestion.new(suggestion_params)\n respond_to do |format|\n if @suggestion.save\n format.html { redirect_to @suggestion, notice: 'Thank you for your suggestion!' }\n format.json { render :show, status: :created, location: @suggestion }\n else\n format.html { render :new }\n format.json { render json: @suggestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @auto_complete_action = args[:auto_complete_action] if args.key?(:auto_complete_action)\n @hint_text = args[:hint_text] if args.key?(:hint_text)\n @initial_suggestions = args[:initial_suggestions] if args.key?(:initial_suggestions)\n @label = args[:label] if args.key?(:label)\n @name = args[:name] if args.key?(:name)\n @on_change_action = args[:on_change_action] if args.key?(:on_change_action)\n @type = args[:type] if args.key?(:type)\n @value = args[:value] if args.key?(:value)\n end",
"def update!(**args)\n @auto_complete_action = args[:auto_complete_action] if args.key?(:auto_complete_action)\n @hint_text = args[:hint_text] if args.key?(:hint_text)\n @initial_suggestions = args[:initial_suggestions] if args.key?(:initial_suggestions)\n @label = args[:label] if args.key?(:label)\n @name = args[:name] if args.key?(:name)\n @on_change_action = args[:on_change_action] if args.key?(:on_change_action)\n @type = args[:type] if args.key?(:type)\n @value = args[:value] if args.key?(:value)\n end",
"def update!(**args)\n @auto_complete_action = args[:auto_complete_action] if args.key?(:auto_complete_action)\n @hint_text = args[:hint_text] if args.key?(:hint_text)\n @initial_suggestions = args[:initial_suggestions] if args.key?(:initial_suggestions)\n @label = args[:label] if args.key?(:label)\n @name = args[:name] if args.key?(:name)\n @on_change_action = args[:on_change_action] if args.key?(:on_change_action)\n @type = args[:type] if args.key?(:type)\n @value = args[:value] if args.key?(:value)\n end",
"def update\n params[:resource][:term_ids] || []\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def refect\n @suggestion.status = 'Rejected'\n end",
"def create\n @suggestion = Suggestion.new(params[:suggestion])\n flash[:notice] = 'Thank you for your feedback. ' if @suggestion.save\n respond_with(@suggestion, location: root_url)\n end",
"def suggest_params\n params.require(:suggest).permit(:title, :content)\n end",
"def update!(**args)\n @action_id = args[:action_id] if args.key?(:action_id)\n @suggestion_message_id = args[:suggestion_message_id] if args.key?(:suggestion_message_id)\n end",
"def spelling_suggestions(query, opts = {})\n invoke 'SpellingSuggestions', query, opts\n end",
"def suggest_params\n params.require(:suggest).permit(:name, :phone, :email, :content)\n end",
"def suggestion_params\n params.require(:suggestion).permit(:location, :model, :manufacturer, :style)\n end",
"def retire_suggestion(suggestion, params)\n if suggestion.status != 2\n\t\t logger.debug 'RETIRE'\n\t\t\tsuggestion.status = 2\n suggestion.save\t\t \n Pusher['chez_ois_chat'].trigger('update_suggestions_' + suggestion_params[:avatar_id], load_suggestions(suggestion_params[:avatar_id]))\n end\n end",
"def update!(**args)\n @num_results = args[:num_results] if args.key?(:num_results)\n @num_suggestions = args[:num_suggestions] if args.key?(:num_suggestions)\n end",
"def update!(**args)\n @num_results = args[:num_results] if args.key?(:num_results)\n @num_suggestions = args[:num_suggestions] if args.key?(:num_suggestions)\n end",
"def update\n @event_suggestion = EventSuggestion.find(params[:id])\n if @event_suggestion.category == 'dinner'\n @event_suggestion.name = \"Dinner with #{@event_suggestion.host.name || @event_suggestion.host.email}\"\n else @event_suggestion.category == 'drinks'\n @event_suggestion.name = \"Drinks with #{@event_suggestion.host.name || @event_suggestion.host.email}\"\n end\n\n respond_to do |format|\n if @event_suggestion.update_attributes(params[:event_suggestion])\n format.html { redirect_to @event_suggestion, notice: 'Event suggestion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event_suggestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @suggested_lessons = params[:lesson][:suggested_lessons]\n @suggested_lessons.each do |sug_lesson|\n SuggestedLesson.create(lesson_id: @lesson.id, suggested_lesson_id: sug_lesson.to_i)\n end\n respond_to do |format|\n if @lesson.update(lesson_params)\n format.html { redirect_to @lesson, notice: 'Lesson was successfully updated.' }\n format.json { render :show, status: :ok, location: @lesson }\n else\n format.html { render :edit }\n format.json { render json: @lesson.errors, status: :unprocessable_entity }\n end\n end\n end",
"def delete suggestion_id, options={}, headers={}\n @connection.delete \"suggestions/#{suggestion_id}.json\", options, headers\n end",
"def create\n\n ### This one works. \n # @work = Work.friendly.find(params[:work_id])\n # @suggestion = @work.suggesteds.build(suggestion_params)\n # @suggestion.suggester_ip = request.remote_ip\n # @suggestion.user = current_user if current_user\n # respond_to do |format|\n # if @suggestion.save\n # format.html { redirect_to @work\n # flash[:success] = \"Your tag suggestion has been added!\" }\n # format.json { render json: @suggestion, status: :created, location: @suggestion } \n # else\n # format.html { redirect_to @work\n # flash[:warning] = \"Suggesting the suggestion failed. Probably either because you had weird characters in there, or the suggestion exists already.\" }\n # format.json { render json: @suggestion.errors, status: :unprocessable_entity }\n # end\n # end\n\n # This one parses the incoming suggestion(s). AND IT WORKS TOO. \n @work = Work.friendly.find(params[:work_id])\n suggestions = params[:suggested][:suggestion].split(',')\n @i = 0\n if current_user\n @current_user_id = current_user.id \n else \n @current_user_id = nil \n end\n\n suggestions.each do |s, index|\n new_suggestion = @work.suggesteds.build(\n suggester_ip: request.remote_ip,\n user_id: @current_user_id,\n suggestion: s)\n if new_suggestion.save\n @i += 1\n end \n if @i == suggestions.count\n @suggestions_saved = true\n else \n @suggestions_saved = false\n end\n end\n respond_to do |format|\n if @suggestions_saved\n format.html { redirect_to @work \n flash[:info] = \"Success.\"}\n format.json { }\n else\n format.html { redirect_to @work \n flash[:danger] = \"Suggested tags must be unique.\"}\n format.json { }\n end\n end \n end",
"def search_suggestions_params\n params.require(:SearchSuggestion).permit(:popularity, :term )\n end",
"def suggestions\n response.try(:[], \"suggest\").try(:[], @suggest_key).try(:[], request_params[:q]).try(:[], \"suggestions\") || []\n end",
"def update!(**args)\n @query_suggestions = args[:query_suggestions] if args.key?(:query_suggestions)\n @tail_match_triggered = args[:tail_match_triggered] if args.key?(:tail_match_triggered)\n end",
"def destroy\n\n @suggestion = Suggestion.find(params[:id])\n @suggestion.destroy\n\n respond_to do |format|\n format.html { redirect_to(suggestions_url) }\n format.xml { head :ok }\n end\n end",
"def update\n\tquestion_param = question_params.merge(:words => in_words(question_params[\"answer\"].to_i))\n\trespond_to do |format|\n if @question.update(question_param)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\t\n end",
"def update!(**args)\n @completable_field_path = args[:completable_field_path] if args.key?(:completable_field_path)\n @suggestion = args[:suggestion] if args.key?(:suggestion)\n end",
"def create\n @suggestion = Suggestion.new(suggestion_params)\n @suggestion.user = current_user\n @suggestion.status = 'Pending'\n respond_to do |format|\n if @suggestion.save\n format.html { redirect_to document_path(suggestion_params[:document_id]), notice: 'Suggestion was successfully created.' }\n format.json { render :show, status: :created, location: @suggestion }\n else\n puts('--------------------------------------')\n format.html { redirect_to root_path, notice: @suggestion.errors }\n format.json { render json: @suggestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @spelling = Spelling.find(params[:id])\n @spelling.update_attributes(params[:spelling])\n respond_with @spelling\n end",
"def suggest(url)\n parameters = Specification.new(url: Types::URL).parameters(url: url)\n Suggestion.from_array(client.get(\"/posts/suggest\", parameters))\n end",
"def new\n @suggestion = Suggestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @suggestion }\n end\n end",
"def destroy\n @suggestion.destroy\n respond_to do |format|\n format.html { redirect_to suggestions_url, notice: 'Suggestion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def show\n @suggestion = Suggestion.find(params[:id])\n end",
"def update!(**args)\n @document_suggestions = args[:document_suggestions] if args.key?(:document_suggestions)\n @show_action_buttons = args[:show_action_buttons] if args.key?(:show_action_buttons)\n end",
"def suggestion_box_params\n params.require(:suggestion_box).permit(:name, :description, :status)\n end",
"def destroy\n @suggestion.destroy\n end",
"def destroy\n @change_suggestion = ChangeSuggestion.find(params[:id])\n @change_suggestion.destroy\n\n respond_to do |format|\n format.html { redirect_to change_suggestions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @suggest.destroy\n respond_to do |format|\n format.html { redirect_to suggests_url, notice: 'Suggest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @skill_suggestion = SkillSuggestion.find(params[:id])\n @skill_suggestion.destroy\n\n respond_to do |format|\n format.html { redirect_to skill_suggestions_url }\n format.json { head :no_content }\n end\n end",
"def suggestions\n with_monitoring do\n Faraday.get(suggestions_url, query_params)\n end\n rescue => e\n e\n end",
"def create\n @suggestion = Suggestion.new(params[:suggestion])\n @suggestion.user_id = current_user.id\n if @suggestion.dictionary_id\n @word = Word.find_by_word_and_dictionary_id(@suggestion.word_name, @suggestion.dictionary_id)\n @suggestion.word_id = @word.id if @word\n else\n @word = Word.find_by_id(@suggestion.word_id)\n @suggestion.dictionary_id = @word.dictionary_id if @word\n end\n \n respond_to do |format|\n if @suggestion.save\n flash[:notice] = 'Suggestion was successfully created.'\n format.html { redirect_to(@suggestion) }\n format.xml { render :xml => @suggestion, :status => :created, :location => @suggestion }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @suggestion.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
[
"0.73000157",
"0.72999185",
"0.7298716",
"0.7027647",
"0.68784666",
"0.6868386",
"0.67499083",
"0.67188364",
"0.66793126",
"0.6664064",
"0.665388",
"0.6591542",
"0.65357953",
"0.65357953",
"0.65357953",
"0.65357953",
"0.65357953",
"0.65357953",
"0.65357953",
"0.65355194",
"0.6523659",
"0.6436646",
"0.63729316",
"0.63729316",
"0.63472533",
"0.63441455",
"0.6312104",
"0.6306525",
"0.6283511",
"0.6265454",
"0.62644625",
"0.62644625",
"0.6233597",
"0.6169619",
"0.6121744",
"0.61090255",
"0.6105815",
"0.6102942",
"0.6102942",
"0.610115",
"0.60966325",
"0.6096483",
"0.60636824",
"0.60571337",
"0.5995191",
"0.596684",
"0.5955478",
"0.59548134",
"0.5939264",
"0.5926308",
"0.5924574",
"0.59228337",
"0.58887416",
"0.587777",
"0.586823",
"0.5857316",
"0.5851599",
"0.5851599",
"0.5846084",
"0.58230644",
"0.5821792",
"0.58045316",
"0.57888645",
"0.57888645",
"0.57888645",
"0.5784562",
"0.57736164",
"0.5736603",
"0.5725296",
"0.57032293",
"0.56999326",
"0.5692307",
"0.5691732",
"0.5691084",
"0.5670071",
"0.5670071",
"0.566884",
"0.56621706",
"0.5661612",
"0.56404",
"0.5631678",
"0.5623654",
"0.5572056",
"0.55685747",
"0.5563708",
"0.5555879",
"0.55437106",
"0.55333203",
"0.5529911",
"0.5504302",
"0.5500793",
"0.54946357",
"0.5492762",
"0.54816073",
"0.54769975",
"0.54740787",
"0.5469306",
"0.546753",
"0.5461436",
"0.542752"
] |
0.70185274
|
4
|
GET /metric_sources GET /metric_sources.json
|
def index
@metric_sources = MetricSource.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def data_sources\n src.collect{|v| v['source']}\n end",
"def v1_measurement_sources_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MeasurementsApi.v1_measurement_sources_get ...\"\n end\n # resource path\n local_var_path = \"/v1/measurementSources\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'MeasurementSource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MeasurementsApi#v1_measurement_sources_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def v1_measurement_sources_get(opts = {})\n data, _status_code, _headers = v1_measurement_sources_get_with_http_info(opts)\n return data\n end",
"def sources(source: nil)\n params = {\n source: source\n }.compact\n\n _get(\"/account/sources\", params) { |json| json }\n end",
"def sources_data\n sources_url = Api.gnews_path('sources')\n call_gnews_url(sources_url).parse\n end",
"def get_sources\n response = execute_get(\"/reference/source\")\n Source.from_array(decode(response))\n end",
"def account_sources(source)\n get('account/sources', {'source' => source})\n end",
"def get_sources(opts = {})\n data, _status_code, _headers = get_sources_with_http_info(opts)\n data\n end",
"def get_source_data(source_name:, catalog_id:)\n response = HTTParty.get(\"#{@host}/api/sources/#{source_name}\", query: {\n catalog_id: catalog_id,\n api_key: @api_key\n })\n \n return response[\"source\"]\n end",
"def sources_for(r)\n return if r[:source].to_s.empty?\n [{ url: r[:source] }]\n end",
"def set_metric_source\n @metric_source = MetricSource.find(params[:id])\n end",
"def sources_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_get ...\"\n end\n \n # resource path\n path = \"/sources\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n query_params[:'client_id'] = opts[:'client_id'] if opts[:'client_id']\n query_params[:'name'] = opts[:'name'] if opts[:'name']\n query_params[:'created_at'] = opts[:'created_at'] if opts[:'created_at']\n query_params[:'updated_at'] = opts[:'updated_at'] if opts[:'updated_at']\n query_params[:'limit'] = opts[:'limit'] if opts[:'limit']\n query_params[:'offset'] = opts[:'offset'] if opts[:'offset']\n query_params[:'sort'] = opts[:'sort'] if opts[:'sort']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, 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 => 'inline_response_200_15')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_get. Result: #{result.inspect}\"\n end\n return result\n end",
"def url\n resource.url + '/metrics'\n end",
"def get_data_from_source(source)\n url = URI.parse(source.api_url)\n\n if url.respond_to?(:request_uri)\n begin\n Net::HTTP.get_response(url).body\n rescue\n end\n end\n end",
"def urls\n @gapi.source_uris\n end",
"def create\n @metric_source = MetricSource.new(metric_source_params)\n\n respond_to do |format|\n if @metric_source.save\n format.html { redirect_to @metric_source, notice: 'Metric source was successfully created.' }\n format.json { render :show, status: :created, location: @metric_source }\n else\n format.html { render :new }\n format.json { render json: @metric_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SourcesApi.get_sources ...'\n end\n if @api_client.config.client_side_validation && opts[:'query_operator'] && !['AND', 'OR'].include?(opts[:'query_operator'])\n fail ArgumentError, 'invalid value for \"query_operator\", must be one of AND, OR'\n end\n if @api_client.config.client_side_validation && opts[:'filter_operator'] && !['AND', 'OR'].include?(opts[:'filter_operator'])\n fail ArgumentError, 'invalid value for \"filter_operator\", must be one of AND, OR'\n end\n if @api_client.config.client_side_validation && opts[:'facets_interval'] && !['year', 'month', 'week', 'day'].include?(opts[:'facets_interval'])\n fail ArgumentError, 'invalid value for \"facets_interval\", must be one of year, month, week, day'\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling SourcesApi.get_sources, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling SourcesApi.get_sources, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"offset\"]\" when calling SourcesApi.get_sources, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'profile'] && !['full', 'list', 'minimal'].include?(opts[:'profile'])\n fail ArgumentError, 'invalid value for \"profile\", must be one of full, list, minimal'\n end\n if @api_client.config.client_side_validation && opts[:'preset'] && !['analysis', 'latest', 'minimal'].include?(opts[:'preset'])\n fail ArgumentError, 'invalid value for \"preset\", must be one of analysis, latest, minimal'\n end\n # resource path\n local_var_path = '/sources'\n\n # query parameters\n query_params = {}\n query_params[:'query[value]'] = opts[:'query_value'] if !opts[:'query_value'].nil?\n query_params[:'query[operator]'] = opts[:'query_operator'] if !opts[:'query_operator'].nil?\n query_params[:'query[fields][]'] = @api_client.build_collection_param(opts[:'query_fields'], :csv) if !opts[:'query_fields'].nil?\n query_params[:'filter[field]'] = opts[:'filter_field'] if !opts[:'filter_field'].nil?\n query_params[:'filter[value][]'] = @api_client.build_collection_param(opts[:'filter_value'], :csv) if !opts[:'filter_value'].nil?\n query_params[:'filter[operator]'] = opts[:'filter_operator'] if !opts[:'filter_operator'].nil?\n query_params[:'filter[negate]'] = opts[:'filter_negate'] if !opts[:'filter_negate'].nil?\n query_params[:'filter[conditions][]'] = @api_client.build_collection_param(opts[:'filter_conditions'], :csv) if !opts[:'filter_conditions'].nil?\n query_params[:'facets[field]'] = opts[:'facets_field'] if !opts[:'facets_field'].nil?\n query_params[:'facets[name]'] = opts[:'facets_name'] if !opts[:'facets_name'].nil?\n query_params[:'facets[limit]'] = opts[:'facets_limit'] if !opts[:'facets_limit'].nil?\n query_params[:'facets[sort]'] = opts[:'facets_sort'] if !opts[:'facets_sort'].nil?\n query_params[:'facets[filter][]'] = @api_client.build_collection_param(opts[:'facets_filter'], :csv) if !opts[:'facets_filter'].nil?\n query_params[:'facets[interval]'] = opts[:'facets_interval'] if !opts[:'facets_interval'].nil?\n query_params[:'fields[include][]'] = @api_client.build_collection_param(opts[:'fields_include'], :csv) if !opts[:'fields_include'].nil?\n query_params[:'fields[exclude][]'] = @api_client.build_collection_param(opts[:'fields_exclude'], :csv) if !opts[:'fields_exclude'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort[]'] = @api_client.build_collection_param(opts[:'sort'], :csv) if !opts[:'sort'].nil?\n query_params[:'profile'] = opts[:'profile'] if !opts[:'profile'].nil?\n query_params[:'preset'] = opts[:'preset'] if !opts[:'preset'].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(['text/plain; charset=utf-8'])\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 => 'Source')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SourcesApi#get_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_all_sources_info\n source_info = {}\n METADATA_FIELDS.keys.each { |ns|\n source_info[ns] = get_metadata_source_info(ns)\n }\n source_info\n end",
"def metric_source_params\n params.require(:metric_source).permit(:host, :port, :database)\n end",
"def index\n @sources = Source.all\n end",
"def get_metric_stream(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:query]['Action'] = 'GetMetricStream'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :metric_stream_name\n\t\t\targs[:query]['MetricStreamName'] = optional[:metric_stream_name]\n\t\tend\n\t\tif optional.key? :project_name\n\t\t\targs[:query]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def list_metric_stream(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:query]['Action'] = 'ListMetricStream'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :metric_stream_name\n\t\t\targs[:query]['MetricStreamName'] = optional[:metric_stream_name]\n\t\tend\n\t\tif optional.key? :page\n\t\t\targs[:query]['Page'] = optional[:page]\n\t\tend\n\t\tif optional.key? :page_size\n\t\t\targs[:query]['PageSize'] = optional[:page_size]\n\t\tend\n\t\tif optional.key? :project_name\n\t\t\targs[:query]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def feed\n\t\t\"/metric/?metric=#{@origin_id}#{SEP}#{@metric_id}\"\n\tend",
"def aggregate\n data_hash = MediaSourceSerializer.new(\n available_sources, is_collection: true\n ).aggregated_hash\n\n unless params_valid?\n data_hash[:errors] = 'One or more specified MediaSources do not exist'\n end\n\n render json: data_hash.to_json\n end",
"def sources\n @sources ||= AVAILABLE_SOURCES.each_with_object({}) do |source_class, list|\n source = source_class.new\n list[source.id.to_s] = {\n 'name' => source.name,\n 'website' => source.website,\n 'notes' => source.notes,\n 'class' => source.class\n }\n end\n end",
"def get_sources\n @page.all(input_elements[:sources_list])\n end",
"def index\n @event_sources = EventSource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @event_sources }\n end\n end",
"def sources\n %w[\n sample_source\n ]\nend",
"def source\n @source ||= begin\n source = ::Sources::Strategies::Nijie.new(url)\n source.get\n\n source\n end\n end",
"def data_sources\n []\n end",
"def source\n result_hash['src']\n end",
"def index\n @data_sources = DataSource.all\n end",
"def thumbnail_source\n\t\t\t@data[\"thumbnail\"][\"source\"] if @data[\"thumbnail\"]\n\t\tend",
"def index\n respond_with(sources)\n end",
"def get_metrics_list\n\t\turi = \"#{@base_url}/data\"\n\t\tresults = json_metrics_list uri\n\t\tlist = []\n\t\tresults[:hosts][0..@hosts_limit].each {|h|\n\t\t\thost_results = json_metrics_list \"#{uri}/#{h}/\"\n\t\t\tlist << host_results[:metrics].map{|r| \"#{h}/#{r}\"}\n\t\t}\n\t\treturn list.flatten\n\tend",
"def sources\n @sources ||= []\n end",
"def load(rng = nil, attrs = {})\n\n params = {}\n params[:offset] = rng.begin unless rng.nil?\n params[:limit] =\n rng.end - rng.begin + (rng.exclude_end? ? 0 : 1) unless rng.nil?\n\n params.merge! attrs\n uri_params = Helper.to_request_params params\n req = Net::HTTP::Get.new(\"/sources?\"+uri_params)\n res = @lagoonserver.request_with_auth req\n json_sources = JSON.parse(res.body)\n @sources = json_sources.map { |src| Source.new(src, self)}\n return nil\n end",
"def fetch_source(source)\n rsf = @fetcher_class.new(source, @http_proxy)\n rsf.source_index\n end",
"def sources\n @sources.names\n end",
"def sources\n filter.sources\n end",
"def datasource_entries(query = {})\n Request.new(self, '/cdn/datasource_entries', query).get\n end",
"def datasource_entries(query = {})\n Request.new(self, '/cdn/datasource_entries', query).get\n end",
"def show\n @source = Source.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @source }\n end\n end",
"def get_authentication_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserApi.get_authentication_sources ...'\n end\n # resource path\n local_var_path = '/api/3/authentication_sources'\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;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ResourcesAuthenticationSource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserApi#get_authentication_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def sources\n []\n end",
"def get_measurements\n render json: @data_source.measurements\n end",
"def index\n @financial_aid_sources = @financial_aid_package.sources\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @financial_aid_sources }\n end\n end",
"def source\n @data['source']\n end",
"def get_all_datasets_and_resources(base_url)\n return handle_request(URI.encode(base_url + '/current_package_list_with_ressources'))\n end",
"def update\n respond_to do |format|\n if @metric_source.update(metric_source_params)\n format.html { redirect_to @metric_source, notice: 'Metric source was successfully updated.' }\n format.json { render :show, status: :ok, location: @metric_source }\n else\n format.html { render :edit }\n format.json { render json: @metric_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def resources\n @resources ||=\n query_service.custom_queries.find_by_property(property: :source_metadata_identifier, value: [], lazy: true).select do |resource|\n id = resource.source_metadata_identifier.first\n next if /99.*3506421/.match?(id)\n next if transform_id(id).length > 18\n RemoteRecord.catalog?(id)\n end.to_a\n end",
"def index\n @kernel_sources = KernelSource.all\n end",
"def show\n @proxy_source = ProxySource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proxy_source }\n end\n end",
"def custom(cfg)\n metrics = []\n @client.query(cfg['query']).each do |result|\n source = if result['metric']['instance'] =~ /^\\d+/\n result['metric']['app']\n else\n result['metric']['instance']\n end\n\n metrics << {\n 'source' => source,\n 'value' => result['value'][1]\n }\n end\n metrics\n end",
"def providers_id_connector_sources_get_with_http_info(id_connector, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.providers_id_connector_sources_get ...'\n end\n # verify the required parameter 'id_connector' is set\n if @api_client.config.client_side_validation && id_connector.nil?\n fail ArgumentError, \"Missing the required parameter 'id_connector' when calling ConnectionsApi.providers_id_connector_sources_get\"\n end\n # resource path\n local_var_path = '/providers/{id_connector}/sources'.sub('{' + 'id_connector' + '}', id_connector.to_s)\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 => 'InlineResponse20011')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#providers_id_connector_sources_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def datasources(query = {})\n Request.new(self, '/cdn/datasources', query).get\n end",
"def watched_sources\n @watched_sources\n end",
"def index\n @feed_sources = FeedSource.all\n end",
"def sources\n @sources ||= ApiFactory.new 'Repos::Sources'\n end",
"def fetch(options={})\n requires :metric\n options[:from] ||= (Time.now.to_i * 1000) - (3600 * 1000)\n options[:to] ||= Time.now.to_i * 1000\n options[:points] ||= 1 unless options[:resolution]\n if options[:resolution]\n options[:resolution] = options[:resolution].upcase\n end\n data = service.list_data_points(metric.check.entity.id, metric.check.id, metric.name, options).body['values']\n load(data)\n end",
"def search_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SourcesApi.search_sources ...'\n end\n # resource path\n local_var_path = '/sources'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'fields'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Source')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SourcesApi#search_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @founding_sources = FoundingSource.all\n end",
"def show\n @event_source = EventSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @event_source }\n end\n end",
"def get_source_and_collection\n source_uri = N::URI.from_encoded(params[:source])\n collection_uri = N::URI.from_encoded(params[:collection])\n source = TaliaCore::ActiveSource.find(source_uri)\n collection = TaliaCollection.find(collection_uri)\n @source_id = params[:source]\n @source = TaliaSource.find(source.id)\n [ source, collection ]\n end",
"def source_get\n db_select 'source'\n end",
"def datasource\n @datasource ||= endpoint_connection.get(endpoint_url)\n end",
"def datasource\n @datasource ||= endpoint_connection.get(endpoint_url)\n end",
"def datasource\n @datasource ||= endpoint_connection.get(endpoint_url)\n end",
"def raw(metric, source = nil, t_start = nil, t_end = nil)\n raise ArgumentError unless metric.is_a?(String)\n\n options = { metric: metric }\n\n if source\n wf_source_id?(source)\n options[:source] = source\n end\n\n options[:startTime] = parse_time(t_start, true) if t_start\n options[:endTime] = parse_time(t_end, true) if t_end\n\n api.get('raw', options)\n end",
"def index\n @historical_sources = HistoricalSource.all\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 @annotation_source = AnnotationSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @annotation_source }\n end\n end",
"def call\n response = client.mget options\n\n pairs = response[\"docs\"].map { |doc| [doc[\"_id\"], doc[\"_source\"]] }\n\n pairs.to_h\n end",
"def search_sources(opts = {})\n data, _status_code, _headers = search_sources_with_http_info(opts)\n data\n end",
"def sources_id_get(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_id_get ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling sources_id_get\" if id.nil?\n \n # resource path\n path = \"/sources/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, 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 => 'inline_response_200_16')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_id_get. Result: #{result.inspect}\"\n end\n return result\n end",
"def list_sql_metrics(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:query]['Action'] = 'ListSqlMetrics'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :metric_name\n\t\t\targs[:query]['MetricName'] = optional[:metric_name]\n\t\tend\n\t\tif optional.key? :page\n\t\t\targs[:query]['Page'] = optional[:page]\n\t\tend\n\t\tif optional.key? :page_size\n\t\t\targs[:query]['PageSize'] = optional[:page_size]\n\t\tend\n\t\tif optional.key? :project_name\n\t\t\targs[:query]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def connectors_id_connector_sources_get_with_http_info(id_connector, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.connectors_id_connector_sources_get ...'\n end\n # verify the required parameter 'id_connector' is set\n if @api_client.config.client_side_validation && id_connector.nil?\n fail ArgumentError, \"Missing the required parameter 'id_connector' when calling ConnectionsApi.connectors_id_connector_sources_get\"\n end\n # resource path\n local_var_path = '/connectors/{id_connector}/sources'.sub('{' + 'id_connector' + '}', id_connector.to_s)\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 => 'InlineResponse20011')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#connectors_id_connector_sources_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def metrics_for_metric_name\n @metrics = Metric.includes(:metric_name).where(metric_name_id: metric_name_id[:id]);\n render json: @metrics.order({created_at: :asc}),include: [:metric_name], status: :ok\n end",
"def sources\n @_configuration.fetch('sources') { DEFAULT_SOURCES }\n end",
"def get_source_info(ns:DEFAULT_NAMESPACE)\n emsg = \"#{ns} should be one of these values: #{allowed_values_for_ns}\"\n raise ArgumentError.new(emsg) unless allowed_values_for_ns.include?(ns)\n chk_key = ns.to_sym\n if METADATA_FIELDS.has_key?(chk_key)\n get_metadata_source_info(chk_key)\n elsif ns == NAMESPACE_ALL\n get_all_sources_info\n end\n\n end",
"def index\n if (params['feed_id'] == nil) \n @sources = current_user.sources.order(\"name ASC\")\n render \"api/sources/index\"\n return\n end\n\n feed = Feed.find_by(id: params['feed_id'])\n\n if !feed \n render json: [\"Feed does not exist\"], status: 404 \n return\n elsif feed.user_id != current_user.id\n render json: [\"You don't own this feed \"], status: 401\n return\n end\n \n @sources = feed.sources\n render \"api/sources/index\"\n end",
"def sources\n\t\tKassociation.where( :source_id => self.id )\n\tend",
"def raw_stats\n url = URI.parse(stats_url)\n Net::HTTP.start(url.host, url.port) {|http|\n http.request(Net::HTTP::Get.new(url.path))\n }.body\nend",
"def process_lm_sources(customer_id, sources)\n headers = [\n 'Source Name',\n 'Source Type',\n 'IP Address',\n 'Source ID',\n 'Source Status'\n ]\n data = []\n tables = []\n sources_list = sources['sources']\n reply_head = \"/code Log Sources for customer: #{customer_id} \\n\"\n\n sources_list.each do |source|\n source.each do |type, info|\n data << [\n info['name'],\n type,\n info['metadata']['local_ipv4'],\n info['id'],\n info['status']['status']\n ]\n if check_msg_size?(build_table(data, headers))\n tables << [data, headers]\n data = []\n end\n end\n end\n\n summary = \"\\nTotal Sources: #{sources['total_count']}\"\n if tables.length > 0\n reply = [reply_head, tables, summary]\n return reply\n else\n reply = reply_head\n reply << build_table(data, headers)\n reply << summary\n return reply\n end\n end",
"def get_sources(workdir)\n @sources.each do |source|\n cur_source = Vanagon::Component::Source.source(source.url, { :ref => source.ref, :sum => source.sum }, workdir)\n cur_source.fetch\n cur_source.verify\n end\n end",
"def show\n @metric = Metric.find(params[:id])\n\n render json: @metric\n end",
"def index\n @student_sources = StudentSource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @student_sources }\n end\n end",
"def collection_stream\n \"/world/#{world.id}/events.json\"\n end",
"def find_sources\n names = \"\"\n Googlenews.items(100).each do |report|\n name = report['title'].match(/ - ([\\w. ]+)/)[1]\n names << name\n unless Source.find_by_name(name)\n source = Source.new({\n :name => name\n })\n source.save\n end\n end\n render :text => names\n end",
"def fetch(source)\n Feedjira::Feed.fetch_and_parse source\n end",
"def on_update(req)\n res = @data_sources.collect do |name, table|\n {:stream => name, :events => table.rows}\n end\n [res.to_json, \"text/json\"]\n end",
"def destroy\n @metric_source.destroy\n respond_to do |format|\n format.html { redirect_to metric_sources_url, notice: 'Metric source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def get_sql_metrics(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:query]['Action'] = 'GetSqlMetrics'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :metric_name\n\t\t\targs[:query]['MetricName'] = optional[:metric_name]\n\t\tend\n\t\tif optional.key? :project_name\n\t\t\targs[:query]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def new\n get_sources\n @stg_source = StgSource.all\n @report = Report.find(params[:report_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @source }\n end\n end",
"def streams\n ::M2X::Client::Stream.list(@client, self)\n end",
"def index\n @cla_sources = ClaSource.all\n end",
"def get_metrics(path, query={}, headers={})\n url = Client::make_url(URI_TEMPLATE, {:path=>path} )\n response = get( url, query, headers )\n if block_given?\n yield response\n end\n validate_response(url, query, response) \n return JSON.parse( response.content ) \n end",
"def sources\n @sources ||= SourcePool.new\n end",
"def fetch_data(source, opts)\n DataFetcher.new(source, **opts).fetch\n end",
"def get_metric_url start, stop, step\n\t\t@store.get_metric_url self, start, stop, step\n\tend"
] |
[
"0.66277605",
"0.6445829",
"0.6391722",
"0.6261962",
"0.62494874",
"0.62383044",
"0.6093816",
"0.60848826",
"0.60661703",
"0.60651433",
"0.6038971",
"0.6007916",
"0.5851436",
"0.58012366",
"0.57615757",
"0.5693575",
"0.5676205",
"0.5592717",
"0.55799645",
"0.55794305",
"0.5560227",
"0.5555943",
"0.5487853",
"0.54851675",
"0.5469603",
"0.5460956",
"0.542443",
"0.54146963",
"0.540792",
"0.5391243",
"0.5333275",
"0.5321175",
"0.5300092",
"0.5297086",
"0.5278068",
"0.5274007",
"0.52668846",
"0.526631",
"0.5263401",
"0.5260571",
"0.52527475",
"0.52527475",
"0.52502966",
"0.52297103",
"0.5228667",
"0.52262324",
"0.5214864",
"0.521461",
"0.51986784",
"0.51849896",
"0.51832765",
"0.5181343",
"0.51799965",
"0.5168431",
"0.51682955",
"0.51670736",
"0.5164715",
"0.5154575",
"0.51386803",
"0.5133678",
"0.5129461",
"0.5121477",
"0.51124215",
"0.5112317",
"0.5099799",
"0.50879914",
"0.50879914",
"0.50879914",
"0.50836366",
"0.5071538",
"0.50690013",
"0.50688404",
"0.5051477",
"0.5050401",
"0.5047664",
"0.5041397",
"0.50182134",
"0.50143236",
"0.5011785",
"0.5011667",
"0.50111187",
"0.5000584",
"0.49811918",
"0.49762818",
"0.49754998",
"0.49748307",
"0.4966537",
"0.49583408",
"0.4946221",
"0.4942564",
"0.49413198",
"0.4937264",
"0.4934811",
"0.49277675",
"0.49237826",
"0.49193764",
"0.4912011",
"0.4911731",
"0.49020925",
"0.49000478"
] |
0.7550348
|
0
|
GET /metric_sources/1 GET /metric_sources/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @metric_sources = MetricSource.all\n end",
"def v1_measurement_sources_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MeasurementsApi.v1_measurement_sources_get ...\"\n end\n # resource path\n local_var_path = \"/v1/measurementSources\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'MeasurementSource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MeasurementsApi#v1_measurement_sources_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def set_metric_source\n @metric_source = MetricSource.find(params[:id])\n end",
"def get_source_data(source_name:, catalog_id:)\n response = HTTParty.get(\"#{@host}/api/sources/#{source_name}\", query: {\n catalog_id: catalog_id,\n api_key: @api_key\n })\n \n return response[\"source\"]\n end",
"def sources_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_get ...\"\n end\n \n # resource path\n path = \"/sources\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n query_params[:'client_id'] = opts[:'client_id'] if opts[:'client_id']\n query_params[:'name'] = opts[:'name'] if opts[:'name']\n query_params[:'created_at'] = opts[:'created_at'] if opts[:'created_at']\n query_params[:'updated_at'] = opts[:'updated_at'] if opts[:'updated_at']\n query_params[:'limit'] = opts[:'limit'] if opts[:'limit']\n query_params[:'offset'] = opts[:'offset'] if opts[:'offset']\n query_params[:'sort'] = opts[:'sort'] if opts[:'sort']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, 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 => 'inline_response_200_15')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_get. Result: #{result.inspect}\"\n end\n return result\n end",
"def create\n @metric_source = MetricSource.new(metric_source_params)\n\n respond_to do |format|\n if @metric_source.save\n format.html { redirect_to @metric_source, notice: 'Metric source was successfully created.' }\n format.json { render :show, status: :created, location: @metric_source }\n else\n format.html { render :new }\n format.json { render json: @metric_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def v1_measurement_sources_get(opts = {})\n data, _status_code, _headers = v1_measurement_sources_get_with_http_info(opts)\n return data\n end",
"def data_sources\n src.collect{|v| v['source']}\n end",
"def url\n resource.url + '/metrics'\n end",
"def get_data_from_source(source)\n url = URI.parse(source.api_url)\n\n if url.respond_to?(:request_uri)\n begin\n Net::HTTP.get_response(url).body\n rescue\n end\n end\n end",
"def feed\n\t\t\"/metric/?metric=#{@origin_id}#{SEP}#{@metric_id}\"\n\tend",
"def get_metric_stream(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:query]['Action'] = 'GetMetricStream'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :metric_stream_name\n\t\t\targs[:query]['MetricStreamName'] = optional[:metric_stream_name]\n\t\tend\n\t\tif optional.key? :project_name\n\t\t\targs[:query]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def metric_source_params\n params.require(:metric_source).permit(:host, :port, :database)\n end",
"def sources(source: nil)\n params = {\n source: source\n }.compact\n\n _get(\"/account/sources\", params) { |json| json }\n end",
"def update\n respond_to do |format|\n if @metric_source.update(metric_source_params)\n format.html { redirect_to @metric_source, notice: 'Metric source was successfully updated.' }\n format.json { render :show, status: :ok, location: @metric_source }\n else\n format.html { render :edit }\n format.json { render json: @metric_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @source = Source.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @source }\n end\n end",
"def show\n @metric = Metric.find(params[:id])\n\n render json: @metric\n end",
"def sources_for(r)\n return if r[:source].to_s.empty?\n [{ url: r[:source] }]\n end",
"def get_sources\n response = execute_get(\"/reference/source\")\n Source.from_array(decode(response))\n end",
"def show\n @proxy_source = ProxySource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proxy_source }\n end\n end",
"def get_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SourcesApi.get_sources ...'\n end\n if @api_client.config.client_side_validation && opts[:'query_operator'] && !['AND', 'OR'].include?(opts[:'query_operator'])\n fail ArgumentError, 'invalid value for \"query_operator\", must be one of AND, OR'\n end\n if @api_client.config.client_side_validation && opts[:'filter_operator'] && !['AND', 'OR'].include?(opts[:'filter_operator'])\n fail ArgumentError, 'invalid value for \"filter_operator\", must be one of AND, OR'\n end\n if @api_client.config.client_side_validation && opts[:'facets_interval'] && !['year', 'month', 'week', 'day'].include?(opts[:'facets_interval'])\n fail ArgumentError, 'invalid value for \"facets_interval\", must be one of year, month, week, day'\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling SourcesApi.get_sources, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling SourcesApi.get_sources, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"offset\"]\" when calling SourcesApi.get_sources, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'profile'] && !['full', 'list', 'minimal'].include?(opts[:'profile'])\n fail ArgumentError, 'invalid value for \"profile\", must be one of full, list, minimal'\n end\n if @api_client.config.client_side_validation && opts[:'preset'] && !['analysis', 'latest', 'minimal'].include?(opts[:'preset'])\n fail ArgumentError, 'invalid value for \"preset\", must be one of analysis, latest, minimal'\n end\n # resource path\n local_var_path = '/sources'\n\n # query parameters\n query_params = {}\n query_params[:'query[value]'] = opts[:'query_value'] if !opts[:'query_value'].nil?\n query_params[:'query[operator]'] = opts[:'query_operator'] if !opts[:'query_operator'].nil?\n query_params[:'query[fields][]'] = @api_client.build_collection_param(opts[:'query_fields'], :csv) if !opts[:'query_fields'].nil?\n query_params[:'filter[field]'] = opts[:'filter_field'] if !opts[:'filter_field'].nil?\n query_params[:'filter[value][]'] = @api_client.build_collection_param(opts[:'filter_value'], :csv) if !opts[:'filter_value'].nil?\n query_params[:'filter[operator]'] = opts[:'filter_operator'] if !opts[:'filter_operator'].nil?\n query_params[:'filter[negate]'] = opts[:'filter_negate'] if !opts[:'filter_negate'].nil?\n query_params[:'filter[conditions][]'] = @api_client.build_collection_param(opts[:'filter_conditions'], :csv) if !opts[:'filter_conditions'].nil?\n query_params[:'facets[field]'] = opts[:'facets_field'] if !opts[:'facets_field'].nil?\n query_params[:'facets[name]'] = opts[:'facets_name'] if !opts[:'facets_name'].nil?\n query_params[:'facets[limit]'] = opts[:'facets_limit'] if !opts[:'facets_limit'].nil?\n query_params[:'facets[sort]'] = opts[:'facets_sort'] if !opts[:'facets_sort'].nil?\n query_params[:'facets[filter][]'] = @api_client.build_collection_param(opts[:'facets_filter'], :csv) if !opts[:'facets_filter'].nil?\n query_params[:'facets[interval]'] = opts[:'facets_interval'] if !opts[:'facets_interval'].nil?\n query_params[:'fields[include][]'] = @api_client.build_collection_param(opts[:'fields_include'], :csv) if !opts[:'fields_include'].nil?\n query_params[:'fields[exclude][]'] = @api_client.build_collection_param(opts[:'fields_exclude'], :csv) if !opts[:'fields_exclude'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort[]'] = @api_client.build_collection_param(opts[:'sort'], :csv) if !opts[:'sort'].nil?\n query_params[:'profile'] = opts[:'profile'] if !opts[:'profile'].nil?\n query_params[:'preset'] = opts[:'preset'] if !opts[:'preset'].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(['text/plain; charset=utf-8'])\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 => 'Source')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SourcesApi#get_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\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 account_sources(source)\n get('account/sources', {'source' => source})\n end",
"def sources_data\n sources_url = Api.gnews_path('sources')\n call_gnews_url(sources_url).parse\n end",
"def source\n @source ||= begin\n source = ::Sources::Strategies::Nijie.new(url)\n source.get\n\n source\n end\n end",
"def fetch_source(source)\n rsf = @fetcher_class.new(source, @http_proxy)\n rsf.source_index\n end",
"def list_metric_stream(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:query]['Action'] = 'ListMetricStream'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :metric_stream_name\n\t\t\targs[:query]['MetricStreamName'] = optional[:metric_stream_name]\n\t\tend\n\t\tif optional.key? :page\n\t\t\targs[:query]['Page'] = optional[:page]\n\t\tend\n\t\tif optional.key? :page_size\n\t\t\targs[:query]['PageSize'] = optional[:page_size]\n\t\tend\n\t\tif optional.key? :project_name\n\t\t\targs[:query]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def show\n @annotation_source = AnnotationSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @annotation_source }\n end\n end",
"def aggregate\n data_hash = MediaSourceSerializer.new(\n available_sources, is_collection: true\n ).aggregated_hash\n\n unless params_valid?\n data_hash[:errors] = 'One or more specified MediaSources do not exist'\n end\n\n render json: data_hash.to_json\n end",
"def metrics_for_metric_name\n @metrics = Metric.includes(:metric_name).where(metric_name_id: metric_name_id[:id]);\n render json: @metrics.order({created_at: :asc}),include: [:metric_name], status: :ok\n end",
"def show\n @event_source = EventSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @event_source }\n end\n end",
"def index\n @sources = Source.all\n end",
"def thumbnail_source\n\t\t\t@data[\"thumbnail\"][\"source\"] if @data[\"thumbnail\"]\n\t\tend",
"def sources_id_get(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_id_get ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling sources_id_get\" if id.nil?\n \n # resource path\n path = \"/sources/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, 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 => 'inline_response_200_16')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_id_get. Result: #{result.inspect}\"\n end\n return result\n end",
"def source\n result_hash['src']\n end",
"def index\n @event_sources = EventSource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @event_sources }\n end\n end",
"def destroy\n @metric_source.destroy\n respond_to do |format|\n format.html { redirect_to metric_sources_url, notice: 'Metric source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def get_measurements\n render json: @data_source.measurements\n end",
"def show\n @sampled_url = SampledUrl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sampled_url }\n end\n end",
"def get_sources(opts = {})\n data, _status_code, _headers = get_sources_with_http_info(opts)\n data\n end",
"def get_source_by_id_with_http_info(source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SourcesApi.get_source_by_id ...'\n end\n # verify the required parameter 'source_id' is set\n if @api_client.config.client_side_validation && source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'source_id' when calling SourcesApi.get_source_by_id\"\n end\n if @api_client.config.client_side_validation && opts[:'profile'] && !['full', 'list', 'minimal'].include?(opts[:'profile'])\n fail ArgumentError, 'invalid value for \"profile\", must be one of full, list, minimal'\n end\n # resource path\n local_var_path = '/sources/{sourceId}'.sub('{' + 'sourceId' + '}', source_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'profile'] = opts[:'profile'] if !opts[:'profile'].nil?\n query_params[:'fields[include][]'] = @api_client.build_collection_param(opts[:'fields_include'], :csv) if !opts[:'fields_include'].nil?\n query_params[:'fields[exclude][]'] = @api_client.build_collection_param(opts[:'fields_exclude'], :csv) if !opts[:'fields_exclude'].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(['text/plain; charset=utf-8', '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 => 'Source')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SourcesApi#get_source_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\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 providers_id_connector_sources_get_with_http_info(id_connector, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.providers_id_connector_sources_get ...'\n end\n # verify the required parameter 'id_connector' is set\n if @api_client.config.client_side_validation && id_connector.nil?\n fail ArgumentError, \"Missing the required parameter 'id_connector' when calling ConnectionsApi.providers_id_connector_sources_get\"\n end\n # resource path\n local_var_path = '/providers/{id_connector}/sources'.sub('{' + 'id_connector' + '}', id_connector.to_s)\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 => 'InlineResponse20011')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#providers_id_connector_sources_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def new\n get_sources\n @stg_source = StgSource.all\n @report = Report.find(params[:report_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @source }\n end\n end",
"def get_sql_metrics(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:query]['Action'] = 'GetSqlMetrics'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :metric_name\n\t\t\targs[:query]['MetricName'] = optional[:metric_name]\n\t\tend\n\t\tif optional.key? :project_name\n\t\t\targs[:query]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def source_get\n db_select 'source'\n end",
"def get_all_sources_info\n source_info = {}\n METADATA_FIELDS.keys.each { |ns|\n source_info[ns] = get_metadata_source_info(ns)\n }\n source_info\n end",
"def show\n @datasource = Datasource.find(params[:id])\n end",
"def raw(metric, source = nil, t_start = nil, t_end = nil)\n raise ArgumentError unless metric.is_a?(String)\n\n options = { metric: metric }\n\n if source\n wf_source_id?(source)\n options[:source] = source\n end\n\n options[:startTime] = parse_time(t_start, true) if t_start\n options[:endTime] = parse_time(t_end, true) if t_end\n\n api.get('raw', options)\n end",
"def get_json_stats_from(ip, port)\n Net::HTTP.start(ip, port) {|http| http.get('/stats.json') }.body rescue \"{}\"\nend",
"def load(rng = nil, attrs = {})\n\n params = {}\n params[:offset] = rng.begin unless rng.nil?\n params[:limit] =\n rng.end - rng.begin + (rng.exclude_end? ? 0 : 1) unless rng.nil?\n\n params.merge! attrs\n uri_params = Helper.to_request_params params\n req = Net::HTTP::Get.new(\"/sources?\"+uri_params)\n res = @lagoonserver.request_with_auth req\n json_sources = JSON.parse(res.body)\n @sources = json_sources.map { |src| Source.new(src, self)}\n return nil\n end",
"def index\n @financial_aid_sources = @financial_aid_package.sources\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @financial_aid_sources }\n end\n end",
"def index\n @data_sources = DataSource.all\n end",
"def source_index\n cache = manager.cache_data[@source_uri]\n if cache && cache['size'] == @fetcher.size\n\tcache['cache']\n else\n\tresult = @fetcher.source_index\n\tmanager.cache_data[@source_uri] = {\n\t 'size' => @fetcher.size,\n\t 'cache' => result,\n\t}\n\tmanager.update\n\tresult\n end\n end",
"def metricData(ak,aapId,names)\n parseUrl=URI.parse('https://api.newrelic.com/v2/applications/'+appId+'/metrics/data.json')\n uri='https://api.newrelic.com/v2/applications/'+appId+'/metrics/data.json?names'+\n host=parseUrl.host\n path=parseUrl.path\n getRequest(ak,uri,host,path)\nend",
"def custom(cfg)\n metrics = []\n @client.query(cfg['query']).each do |result|\n source = if result['metric']['instance'] =~ /^\\d+/\n result['metric']['app']\n else\n result['metric']['instance']\n end\n\n metrics << {\n 'source' => source,\n 'value' => result['value'][1]\n }\n end\n metrics\n end",
"def index\n respond_with(sources)\n end",
"def datasource\n @datasource ||= endpoint_connection.get(endpoint_url)\n end",
"def datasource\n @datasource ||= endpoint_connection.get(endpoint_url)\n end",
"def datasource\n @datasource ||= endpoint_connection.get(endpoint_url)\n end",
"def get_metrics(path, query={}, headers={})\n url = Client::make_url(URI_TEMPLATE, {:path=>path} )\n response = get( url, query, headers )\n if block_given?\n yield response\n end\n validate_response(url, query, response) \n return JSON.parse( response.content ) \n end",
"def raw_stats\n url = URI.parse(stats_url)\n Net::HTTP.start(url.host, url.port) {|http|\n http.request(Net::HTTP::Get.new(url.path))\n }.body\nend",
"def source\n @data['source']\n end",
"def sources\n %w[\n sample_source\n ]\nend",
"def fetch(options={})\n requires :metric\n options[:from] ||= (Time.now.to_i * 1000) - (3600 * 1000)\n options[:to] ||= Time.now.to_i * 1000\n options[:points] ||= 1 unless options[:resolution]\n if options[:resolution]\n options[:resolution] = options[:resolution].upcase\n end\n data = service.list_data_points(metric.check.entity.id, metric.check.id, metric.name, options).body['values']\n load(data)\n end",
"def connectors_id_connector_sources_get_with_http_info(id_connector, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.connectors_id_connector_sources_get ...'\n end\n # verify the required parameter 'id_connector' is set\n if @api_client.config.client_side_validation && id_connector.nil?\n fail ArgumentError, \"Missing the required parameter 'id_connector' when calling ConnectionsApi.connectors_id_connector_sources_get\"\n end\n # resource path\n local_var_path = '/connectors/{id_connector}/sources'.sub('{' + 'id_connector' + '}', id_connector.to_s)\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 => 'InlineResponse20011')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#connectors_id_connector_sources_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list_sql_metrics(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:query]['Action'] = 'ListSqlMetrics'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :metric_name\n\t\t\targs[:query]['MetricName'] = optional[:metric_name]\n\t\tend\n\t\tif optional.key? :page\n\t\t\targs[:query]['Page'] = optional[:page]\n\t\tend\n\t\tif optional.key? :page_size\n\t\t\targs[:query]['PageSize'] = optional[:page_size]\n\t\tend\n\t\tif optional.key? :project_name\n\t\t\targs[:query]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def search_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SourcesApi.search_sources ...'\n end\n # resource path\n local_var_path = '/sources'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'fields'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Source')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SourcesApi#search_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def fetch\n http_request(url) do |body|\n incidents = JSON.parse body\n\n counts = {}\n total = incidents[\"resourceSets\"].first[\"estimatedTotal\"]\n resources = incidents[\"resourceSets\"].first[\"resources\"]\n resources.each do |resource|\n severity = resource[\"severity\"]\n counts[severity] = (counts.fetch severity, 0) + 1\n end\n\n @data = {}\n counts.each do |severity, count|\n @data[severity_label(severity)] = count\n end\n end\n end",
"def get(incoming={})\n opts = HttpClient::Helper.symbolize_keys(incoming)\n query = {\n :guid => HttpClient::Preconditions.assert_class_or_nil('guid', HttpClient::Helper.to_uuid(opts.delete(:guid)), String),\n :user_guid => HttpClient::Preconditions.assert_class_or_nil('user_guid', HttpClient::Helper.to_uuid(opts.delete(:user_guid)), String),\n :service_key => HttpClient::Preconditions.assert_class_or_nil('service_key', opts.delete(:service_key), String),\n :limit => HttpClient::Preconditions.assert_class_or_nil('limit', opts.delete(:limit), Integer),\n :offset => HttpClient::Preconditions.assert_class_or_nil('offset', opts.delete(:offset), Integer)\n }.delete_if { |k, v| v.nil? }\n @client.request(\"/watches\").with_query(query).get.map { |hash| Apidoc::Models::Watch.new(hash) }\n end",
"def fetch_data(source, opts)\n DataFetcher.new(source, **opts).fetch\n end",
"def get_metrics_list\n\t\turi = \"#{@base_url}/data\"\n\t\tresults = json_metrics_list uri\n\t\tlist = []\n\t\tresults[:hosts][0..@hosts_limit].each {|h|\n\t\t\thost_results = json_metrics_list \"#{uri}/#{h}/\"\n\t\t\tlist << host_results[:metrics].map{|r| \"#{h}/#{r}\"}\n\t\t}\n\t\treturn list.flatten\n\tend",
"def fetch(source)\n Feedjira::Feed.fetch_and_parse source\n end",
"def call\n response = client.mget options\n\n pairs = response[\"docs\"].map { |doc| [doc[\"_id\"], doc[\"_source\"]] }\n\n pairs.to_h\n end",
"def index\n @datasources = Datasource.all\n \n respond_to do |format|\n format.json { render json: { datasources: @datasources, total: @datasources.count }}\n end\n end",
"def show\n @game_source = GameSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_source }\n end\n end",
"def urls\n @gapi.source_uris\n end",
"def datasource_entries(query = {})\n Request.new(self, '/cdn/datasource_entries', query).get\n end",
"def datasource_entries(query = {})\n Request.new(self, '/cdn/datasource_entries', query).get\n end",
"def index_task_sources_with_http_info(task_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TaskSourcesApi.index_task_sources ...'\n end\n # verify the required parameter 'task_id' is set\n if @api_client.config.client_side_validation && task_id.nil?\n fail ArgumentError, \"Missing the required parameter 'task_id' when calling TaskSourcesApi.index_task_sources\"\n end\n # resource path\n local_var_path = '/tasks/{task_id}/task_sources'.sub('{' + 'task_id' + '}', CGI.escape(task_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort_by'] = @api_client.build_collection_param(opts[:'sort_by'], :pipe) if !opts[:'sort_by'].nil?\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n query_params[:'file_id'] = opts[:'file_id'] if !opts[:'file_id'].nil?\n query_params[:'import_file_id'] = opts[:'import_file_id'] if !opts[:'import_file_id'].nil?\n query_params[:'tape_id'] = opts[:'tape_id'] if !opts[:'tape_id'].nil?\n query_params[:'pool_id'] = opts[:'pool_id'] if !opts[:'pool_id'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'TaskSourceCollection' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\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: TaskSourcesApi#index_task_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def resources\n @resources ||=\n query_service.custom_queries.find_by_property(property: :source_metadata_identifier, value: [], lazy: true).select do |resource|\n id = resource.source_metadata_identifier.first\n next if /99.*3506421/.match?(id)\n next if transform_id(id).length > 18\n RemoteRecord.catalog?(id)\n end.to_a\n end",
"def on_update(req)\n res = @data_sources.collect do |name, table|\n {:stream => name, :events => table.rows}\n end\n [res.to_json, \"text/json\"]\n end",
"def get_all_datasets_and_resources(base_url)\n return handle_request(URI.encode(base_url + '/current_package_list_with_ressources'))\n end",
"def fetch_rates(source)\n klass_name = \"#{source}\".downcase.capitalize\n Object.const_get(\"Fxer::Exchange::DataSource::#{klass_name}\").new(@options).rate_set\n end",
"def sources\n @sources ||= AVAILABLE_SOURCES.each_with_object({}) do |source_class, list|\n source = source_class.new\n list[source.id.to_s] = {\n 'name' => source.name,\n 'website' => source.website,\n 'notes' => source.notes,\n 'class' => source.class\n }\n end\n end",
"def index\n @metrics = Metric.all\n end",
"def get_metric_url start, stop, step\n\t\t@store.get_metric_url self, start, stop, step\n\tend",
"def show\n @rss_source = RssSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @rss_source }\n end\n end",
"def banks_id_connector_sources_get_with_http_info(id_connector, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.banks_id_connector_sources_get ...'\n end\n # verify the required parameter 'id_connector' is set\n if @api_client.config.client_side_validation && id_connector.nil?\n fail ArgumentError, \"Missing the required parameter 'id_connector' when calling ConnectionsApi.banks_id_connector_sources_get\"\n end\n # resource path\n local_var_path = '/banks/{id_connector}/sources'.sub('{' + 'id_connector' + '}', id_connector.to_s)\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 => 'InlineResponse20011')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#banks_id_connector_sources_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @src_gst = SrcGst.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @src_gst }\n end\n end",
"def metric(metric_id)\n from_resource :metric,\n connection.get(api_uri(\"metrics/#{metric_id}\"))\n end",
"def prepare_metrics(metric_name, results)\n metrics = []\n results.each do |result|\n source = result['metric']['instance']\n value = result['value'][1].to_i\n log.debug(\"[#{metric_name}] value: '#{value}', source: '#{source}'\")\n metrics << { 'source' => source, 'value' => value }\n end\n metrics\n end",
"def get_source_and_collection\n source_uri = N::URI.from_encoded(params[:source])\n collection_uri = N::URI.from_encoded(params[:collection])\n source = TaliaCore::ActiveSource.find(source_uri)\n collection = TaliaCollection.find(collection_uri)\n @source_id = params[:source]\n @source = TaliaSource.find(source.id)\n [ source, collection ]\n end",
"def source_member(field)\n resource_key = resource_key_for(field)\n return {} unless field == :base || resource.fetchable_fields.include?(resource_key)\n id = key_format(field)\n\n pointer =\n if field == :base then '/data'\n elsif relationship_names.include?(resource_key) then \"/data/relationships/#{id}\"\n else \"/data/attributes/#{id}\"\n end\n\n { source: { pointer: pointer } }\n end",
"def get_d_b_source(project_name, source_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:path]['SourceName'] = source_name\n\t\targs[:pattern] = '/projects/[ProjectName]/sources/[SourceName]'\n\t\targs[:query]['Action'] = 'GetDBSource'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tself.run(args)\n\tend",
"def show\n @recipesource = Recipesource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipesource }\n end\n end",
"def get_authentication_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserApi.get_authentication_sources ...'\n end\n # resource path\n local_var_path = '/api/3/authentication_sources'\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;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ResourcesAuthenticationSource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserApi#get_authentication_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def thumbnail\n\t\t\t@data[\"thumbnail\"][\"source\"]\n\t\tend",
"def get_metric_statistics(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:query]['Action'] = 'GetMetricStatistics'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :dimensions\n\t\t\targs[:query]['Dimensions'] = optional[:dimensions]\n\t\tend\n\t\tif optional.key? :end_time\n\t\t\targs[:query]['EndTime'] = optional[:end_time]\n\t\tend\n\t\tif optional.key? :interval\n\t\t\targs[:query]['Interval'] = optional[:interval]\n\t\tend\n\t\tif optional.key? :length\n\t\t\targs[:query]['Length'] = optional[:length]\n\t\tend\n\t\tif optional.key? :metric_name\n\t\t\targs[:query]['MetricName'] = optional[:metric_name]\n\t\tend\n\t\tif optional.key? :namespace\n\t\t\targs[:query]['Namespace'] = optional[:namespace]\n\t\tend\n\t\tif optional.key? :next_token\n\t\t\targs[:query]['NextToken'] = optional[:next_token]\n\t\tend\n\t\tif optional.key? :start_time\n\t\t\targs[:query]['StartTime'] = optional[:start_time]\n\t\tend\n\t\tself.run(args)\n\tend",
"def show\n @student_source = StudentSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_source }\n end\n end",
"def datasources(query = {})\n Request.new(self, '/cdn/datasources', query).get\n end"
] |
[
"0.7297286",
"0.6602979",
"0.633395",
"0.60801166",
"0.5999042",
"0.5980836",
"0.5931754",
"0.58899045",
"0.58243006",
"0.5783212",
"0.5709409",
"0.56490606",
"0.5644356",
"0.562067",
"0.56043553",
"0.56009334",
"0.5578092",
"0.5577744",
"0.55491894",
"0.55279607",
"0.5522895",
"0.54601985",
"0.5435295",
"0.54213697",
"0.5417794",
"0.53947496",
"0.5371804",
"0.5359084",
"0.5356655",
"0.5337922",
"0.5325855",
"0.5311586",
"0.53115314",
"0.5306375",
"0.5294902",
"0.5289704",
"0.52407175",
"0.5216343",
"0.52144057",
"0.5198356",
"0.5197101",
"0.5191617",
"0.5172539",
"0.5169774",
"0.51513296",
"0.51439524",
"0.5131069",
"0.5126771",
"0.51261187",
"0.51258063",
"0.5122755",
"0.51203364",
"0.5114071",
"0.5113318",
"0.5105876",
"0.51023215",
"0.5100154",
"0.5081277",
"0.5081277",
"0.5081277",
"0.5076633",
"0.5073799",
"0.5073254",
"0.5063918",
"0.5061495",
"0.50584006",
"0.50389355",
"0.50357866",
"0.5007581",
"0.50038505",
"0.5003393",
"0.5002122",
"0.498422",
"0.49806005",
"0.49779677",
"0.49721712",
"0.4970275",
"0.49694213",
"0.49694213",
"0.49647683",
"0.49619916",
"0.49543735",
"0.4950927",
"0.49456486",
"0.49389595",
"0.49384874",
"0.49327415",
"0.4931547",
"0.4922036",
"0.4921622",
"0.49212262",
"0.49205935",
"0.49202803",
"0.49075326",
"0.4900727",
"0.48974073",
"0.48941267",
"0.4879827",
"0.48791787",
"0.48767594",
"0.48723066"
] |
0.0
|
-1
|
POST /metric_sources POST /metric_sources.json
|
def create
@metric_source = MetricSource.new(metric_source_params)
respond_to do |format|
if @metric_source.save
format.html { redirect_to @metric_source, notice: 'Metric source was successfully created.' }
format.json { render :show, status: :created, location: @metric_source }
else
format.html { render :new }
format.json { render json: @metric_source.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @metric_sources = MetricSource.all\n end",
"def metric_source_params\n params.require(:metric_source).permit(:host, :port, :database)\n end",
"def v1_measurement_sources_post(body, opts = {})\n v1_measurement_sources_post_with_http_info(body, opts)\n return nil\n end",
"def set_metric_source\n @metric_source = MetricSource.find(params[:id])\n end",
"def v1_measurement_sources_post_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MeasurementsApi.v1_measurement_sources_post ...\"\n end\n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling MeasurementsApi.v1_measurement_sources_post\" if body.nil?\n # resource path\n local_var_path = \"/v1/measurementSources\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MeasurementsApi#v1_measurement_sources_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def sources_post(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_post ...\"\n end\n \n # resource path\n path = \"/sources\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:POST, 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 => 'inline_response_200_16')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_post. Result: #{result.inspect}\"\n end\n return result\n end",
"def create\n @data_source = DataSource.new(data_source_params)\n\n respond_to do |format|\n if @data_source.save\n format.html { redirect_to @data_source, notice: 'Data source was successfully created.' }\n format.json { render :show, status: :created, location: @data_source }\n else\n format.html { render :new }\n format.json { render json: @data_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @data_source = DataSource.new(data_source_params)\n \n dimension_translations = params[:dimension_translations]\n parsed_dimension_translations = []\n dimension_translations.each do |number, trans|\n parsed_dimension_translations << {original_name: trans[:original_name].to_sym, translated_name: trans[:translated_name], data_type: trans[:data_type]} if trans[:original_name] != \"\"\n end\n\n @data_source.dimension_translations = parsed_dimension_translations\n\n respond_to do |format|\n if @data_source.save\n format.html { redirect_to @data_source, notice: 'Data source was successfully created.' }\n format.json { render :show, status: :created, location: @data_source }\n else\n format.html { render :new }\n format.json { render json: @data_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @source = Source.new(params[:source])\n\n respond_to do |format|\n if @source.save\n track_activity @source\n format.html { redirect_to @source, notice: 'Source was successfully created.' }\n format.json { render json: @source, status: :created, location: @source }\n else\n format.html { render layout: 'form', action: \"new\" }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @source = Source.new(source_params)\n\n respond_to do |format|\n if @source.save\n format.html { redirect_to edit_source_path(@source), notice: 'Source was successfully created.' }\n format.json { render :show, status: :created, location: @source }\n else\n format.html { render :new }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @annotation_source = AnnotationSource.new(params[:annotation_source])\n\n respond_to do |format|\n if @annotation_source.save\n format.html { redirect_to @annotation_source, notice: 'Annotation source was successfully created.' }\n format.json { render json: @annotation_source, status: :created, location: @annotation_source }\n else\n format.html { render action: \"new\" }\n format.json { render json: @annotation_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def aggregate\n data_hash = MediaSourceSerializer.new(\n available_sources, is_collection: true\n ).aggregated_hash\n\n unless params_valid?\n data_hash[:errors] = 'One or more specified MediaSources do not exist'\n end\n\n render json: data_hash.to_json\n end",
"def update\n respond_to do |format|\n if @metric_source.update(metric_source_params)\n format.html { redirect_to @metric_source, notice: 'Metric source was successfully updated.' }\n format.json { render :show, status: :ok, location: @metric_source }\n else\n format.html { render :edit }\n format.json { render json: @metric_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event_source = EventSource.new(params[:event_source])\n\n respond_to do |format|\n if @event_source.save\n format.html { redirect_to @event_source, :notice => 'Event source was successfully created.' }\n format.json { render :json => @event_source, :status => :created, :location => @event_source }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @event_source.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @datasource = Datasource.new(form_params)\n\n respond_to do |format|\n if @datasource.save\n format.json { render json: { datasources: @datasource }, status: :created }\n else\n format.json { render json: @datasource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @historical_source = HistoricalSource.new(historical_source_params)\n\n respond_to do |format|\n if @historical_source.save\n format.html { redirect_to @historical_source, notice: 'Historical source was successfully created.' }\n format.json { render action: 'show', status: :created, location: @historical_source }\n else\n format.html { render action: 'new' }\n format.json { render json: @historical_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n get_sources\n @stg_source = StgSource.all\n @report = Report.find(params[:report_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @source }\n end\n end",
"def v1_measurement_sources_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MeasurementsApi.v1_measurement_sources_get ...\"\n end\n # resource path\n local_var_path = \"/v1/measurementSources\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'MeasurementSource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MeasurementsApi#v1_measurement_sources_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def data_sources\n src.collect{|v| v['source']}\n end",
"def data_source_params\n params.require(:data_source).permit(:stil_active, :source_root_url, :startdate, :name, :desc, :license, :docker_image_location, :schedule_cron, :slug, :enddate, :measurement_ids => [])\n end",
"def create\n @proxy_source = ProxySource.new(params[:proxy_source])\n\n respond_to do |format|\n if @proxy_source.save\n format.html { redirect_to @proxy_source, notice: 'Proxy source was successfully created.' }\n format.json { render json: @proxy_source, status: :created, location: @proxy_source }\n else\n format.html { render action: \"new\" }\n format.json { render json: @proxy_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @metric_source.destroy\n respond_to do |format|\n format.html { redirect_to metric_sources_url, notice: 'Metric source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @heat_source = HeatSource.new(params[:heat_source])\n\n respond_to do |format|\n if @heat_source.save\n format.html { redirect_to @heat_source, notice: 'Heat source was successfully created.' }\n format.json { render json: @heat_source, status: :created, location: @heat_source }\n else\n format.html { render action: \"new\" }\n format.json { render json: @heat_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(source:)\n resp = connection.post do |req|\n req.url workspace_path\n req.params['source'] = source\n end\n raise_exception_based_on_response!(resp, object_identifier) unless resp.success?\n end",
"def create\n\n @report = Report.find(params[:report_id]) \n @source = @report.sources.build(name: params[:tname][:title], description: params[:source][:description], \n object_type: params[:source][:object_type], owner: params[:source][:owner])\n if @source.save\n redirect_to report_source_new_source_field_path(@report, @source)\n else\n render action: \"new\"\n end \n end",
"def create\n unless params[:source][:categories].blank?\n params[:source][:categories] = params[:source][:categories].split(\",\").collect{|u| u.strip}.reject{|u| u.blank?}.uniq.collect{|p| Category.new(:name => p)}\n end\n unless params[:source][:feed_urls].blank?\n params[:source][:feed_urls] = params[:source][:feed_urls].split(\",\").collect{|u| u.strip}.reject{|u| u.blank?}.uniq\n end\n @source = Source.new(params[:source])\n\n respond_to do |format|\n if @source.save\n format.html { redirect_to(@source, :notice => 'Source was successfully created. We\\'ll be doing an initial fetch of articles shortly.') }\n format.xml { render :xml => @source, :status => :created, :location => @source }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @source.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def prepare_metrics(metric_name, results)\n metrics = []\n results.each do |result|\n source = result['metric']['instance']\n value = result['value'][1].to_i\n log.debug(\"[#{metric_name}] value: '#{value}', source: '#{source}'\")\n metrics << { 'source' => source, 'value' => value }\n end\n metrics\n end",
"def create\n @feed_source = FeedSource.new(feed_source_params)\n\n respond_to do |format|\n if @feed_source.save\n format.html { redirect_to @feed_source, notice: 'Feed source was successfully created.' }\n format.json { render :show, status: :created, location: @feed_source }\n else\n format.html { render :new }\n format.json { render json: @feed_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student_source = StudentSource.new(params[:student_source])\n\n respond_to do |format|\n if @student_source.save\n format.html { redirect_to student_sources_path, notice: 'Student source was successfully created.' }\n format.json { render json: @student_source, status: :created, location: @student_source }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sources_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_get ...\"\n end\n \n # resource path\n path = \"/sources\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n query_params[:'client_id'] = opts[:'client_id'] if opts[:'client_id']\n query_params[:'name'] = opts[:'name'] if opts[:'name']\n query_params[:'created_at'] = opts[:'created_at'] if opts[:'created_at']\n query_params[:'updated_at'] = opts[:'updated_at'] if opts[:'updated_at']\n query_params[:'limit'] = opts[:'limit'] if opts[:'limit']\n query_params[:'offset'] = opts[:'offset'] if opts[:'offset']\n query_params[:'sort'] = opts[:'sort'] if opts[:'sort']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, 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 => 'inline_response_200_15')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_get. Result: #{result.inspect}\"\n end\n return result\n end",
"def create\n flash[:notice] = 'The source was successfully created.' if source.save\n respond_with(source)\n end",
"def add_source(*source)\n unless source.blank?\n what.query.add(:sources) << source.flatten \n changed\n end\n end",
"def create\n @metric = Metric.new(params[:metric])\n\n if @metric.save\n render json: @metric, status: :created, location: @metric\n else\n render json: @metric.errors, status: :unprocessable_entity\n end\n end",
"def on_update(req)\n res = @data_sources.collect do |name, table|\n {:stream => name, :events => table.rows}\n end\n [res.to_json, \"text/json\"]\n end",
"def register_predefined_source(source_name)\n return if Rhoconnect.predefined_sources.has_key?(source_name)\n\n Rhoconnect.predefined_sources[source_name] = {:source_loaded => false}\n # create Sinatra server for the predefined source here\n Rhoconnect::Controller::SourceAdapterBase.register_controller(source_name)\n end",
"def new_source(source)\n begin\n @redis.set(source, \"2000-01-01 00:00:00\")\n a = @redis.get(\"SOURCES\")\n a = a +1\n @redis.set(\"SOURCES\", a)\n rescue\n end\n end",
"def create\n @data_source_type = DataSourceType.new(data_source_type_params)\n\n respond_to do |format|\n if @data_source_type.save\n format.html { redirect_to @data_source_type, notice: 'Data source type was successfully created.' }\n format.json { render :show, status: :created, location: @data_source_type }\n else\n format.html { render :new }\n format.json { render json: @data_source_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_sources\n\t @sources.each { |s| @source_counts[s] = { label: s, value: rand(100) } } \n\tend",
"def source_params\n params.require(:source).permit(:source_name, :url, :type)\n end",
"def ingest (file, attrs = {})\n file = File.new(file, \"r\") if file.kind_of? String\n\n source_filename = File.basename file\n attrs[:name] = attrs[:name] || File.basename(file, \".*\")\n\n params = { input: source_filename }\n\n params.merge! attrs\n uri_params = Helper.to_request_params params\n\n # Create request object\n # TODO: This is not going to work with big files\n req = Net::HTTP::Post.new(\"/sources?\"+uri_params)\n req['Content-Length'] = File.size file\n req.body_stream = File.open file\n\n json_source = nil\n\n @lagoonserver.request_with_auth req do |resp|\n # Deal with the response. Response comes (mostly) in pairs:\n # - {\"start\": <some action>} <-- <some action> was started\n # - \"ok\" <-- the last <some action> finished\n #\n # We keep track of the state using a stack. Since we're getting packets\n # from the socket we need to keep track of the leftover, since we're\n # parsing lines.\n leftover = \"\"\n state = []\n resp.read_body do |segment|\n leftover = leftover + segment\n lines = leftover.lines\n\n # 'lines' will keep the '\\n' character. Whatever ends with '\\n' was\n # indeed a full line. The rest (which should be a single element array)\n # is the leftover.\n readys_leftover = lines.partition {|l| l.end_with? \"\\n\"}\n readys = readys_leftover[0].map(&:chomp)\n leftover = readys_leftover[1][0] || \"\"\n\n readys.each do |l|\n if l == \"\\\"ok\\\"\"\n # In case of \"ok\" we pop the last state and log that it's now done.\n log_info \"Done: #{state.pop}\"\n else\n # In case of a \"start\" we log the new action and push it on the\n # stack.\n new_blob = JSON.parse(l)\n if start_token = new_blob[\"start\"]\n # In case of a \"start\" we log the new action and push it on the\n # stack.\n log_info \"Start: \" + start_token\n state.push start_token\n elsif notice_token = new_blob[\"notice\"]\n # Sometimes it's a \"notice\"; very well, just log it.\n log_info \"Notice: \" + notice_token\n else\n # If it's neither \"ok\", a start or a notice, just log its JSON\n # representation and implicitly assume it might be the source\n # metadata.\n json_source = JSON.parse(l)\n log_info (JSON.pretty_generate json_source)\n end\n end\n end\n end\n end\n Source.new(json_source, self)\n end",
"def connections_id_connection_sources_id_source_post_with_http_info(id_connection, id_source, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.connections_id_connection_sources_id_source_post ...'\n end\n # verify the required parameter 'id_connection' is set\n if @api_client.config.client_side_validation && id_connection.nil?\n fail ArgumentError, \"Missing the required parameter 'id_connection' when calling ConnectionsApi.connections_id_connection_sources_id_source_post\"\n end\n # verify the required parameter 'id_source' is set\n if @api_client.config.client_side_validation && id_source.nil?\n fail ArgumentError, \"Missing the required parameter 'id_source' when calling ConnectionsApi.connections_id_connection_sources_id_source_post\"\n end\n # resource path\n local_var_path = '/connections/{id_connection}/sources/{id_source}'.sub('{' + 'id_connection' + '}', id_connection.to_s).sub('{' + 'id_source' + '}', id_source.to_s)\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(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ConnectionSource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#connections_id_connection_sources_id_source_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_metric_stream(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateMetricStream'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :metric_stream\n\t\t\targs[:body]['MetricStream'] = optional[:metric_stream]\n\t\tend\n\t\tif optional.key? :project_name\n\t\t\targs[:query]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def create\n @study_source = StudySource.new(study_source_params)\n\n respond_to do |format|\n if @study_source.save\n format.html { redirect_to @study_source, notice: 'Study source was successfully created.' }\n format.json { render :show, status: :created, location: @study_source }\n else\n format.html { render :new }\n format.json { render json: @study_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sources_for(r)\n return if r[:source].to_s.empty?\n [{ url: r[:source] }]\n end",
"def create\n @datasource = Datasource.find_by_url(params[:datasource][:url])\n if @datasource.nil?\n response = open(params[:datasource][:url])\n @datasource = returning(Datasource.new) do |ds|\n ds.url = params[:datasource][:url]\n ds.type = response.content_type\n end\n @datasource.save!\n end\n\n flash[:notice] = \"Created new datasource\"\n redirect_to datasource_path(:id => @datasource)\n end",
"def search_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SourcesApi.search_sources ...'\n end\n # resource path\n local_var_path = '/sources'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'fields'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Source')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SourcesApi#search_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def add_sources(sources)\n sources_ready = EventMachine::MultiRequest.new\n\n sources.each do |source|\n sources_ready.add(source)\n end\n\n sources_ready.callback do\n sources.each do |source|\n source.proxies.each do |proxy|\n @proxies << proxy unless @proxies.include? proxy\n end\n end\n end\n\n sources_ready\n end",
"def build_body(metric, timestamp, value)\n {\n \"metric\" => metric,\n \"timestamp\" => timestamp,\n \"value\" => value,\n \"tags\" => { \"status\" => \"test\" }\n }.to_json\nend",
"def create\n metric = metrics.create(create_params)\n\n respond_with(metric)\n end",
"def sources_data\n sources_url = Api.gnews_path('sources')\n call_gnews_url(sources_url).parse\n end",
"def create_record\n if @email.to_s.empty? or @server.to_s.empty? or @username.to_s.empty? or @port.to_s.empty?\n raise ArgumentError.new(\"Mandatory arguments are not set\")\n end\n \n params = {}\n params['email'] = @email.to_s\n params['server'] = @server.to_s\n params['username'] = @username.to_s\n params['use_ssl'] = @use_ssl.to_s\n params['port'] = @port.to_s\n params['type'] = @source_type.to_s\n\n # Optional parameters\n params['service_level'] = @service_level if @service_level\n params['sync_period'] = @sync_period if @sync_period\n params['password'] = @password if @password\n params['provider_token'] = @provider_token if @provider_token\n params['provider_token_secret'] = @provider_token_secret if @provider_token_secret\n params['provider_consumer_key'] = @provider_consumer_key if @provider_consumer_key\n\n response = post(\"/2.0/accounts/#{@account_id}/sources\", params)\n response['success']\n end",
"def create\n @source = Source.new(params[:source])\n\n respond_to do |format|\n if @source.save\n format.html { redirect_to(@source, :notice => 'Source was successfully created.') }\n format.xml { render :xml => @source, :status => :created, :location => @source }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @source.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n params = clean_authors\n\n @source = Project.find(params[:project_id]).sources.new(source_params)\n @source.user_id = current_user.id\n\n @source.update_image\n\n respond_to do |format|\n if @source.save\n format.html { redirect_to source_path(@source), notice: 'Source was successfully created.' }\n format.json { render action: 'show', status: :created, location: @source }\n else\n format.html { render action: 'new' }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n get @resource[:source]\n validate_checksum if checksum_specified?\n end",
"def create\n @city_source = CitySource.new(city_source_params)\n\n respond_to do |format|\n if @city_source.save\n format.html { redirect_to @city_source, notice: 'City source was successfully created.' }\n format.json { render :show, status: :created, location: @city_source }\n else\n format.html { render :new }\n format.json { render json: @city_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\n end\n end",
"def upload_sourcemap_to_bugsnag\n args = get_sourcemap_args\n\n cmd = [\n 'npx bugsnag-sourcemaps upload',\n \"--api-key '#{ENV['BUGSNAG_KEY']}'\",\n \"--minified-file '#{args[:bundle_output]}'\",\n \"--source-map '#{args[:sourcemap_output]}'\",\n \"--minified-url '#{args[:bundle_url]}'\",\n '--upload-sources',\n ].join ' '\n\n FastlaneCore::CommandExecutor.execute(command: cmd,\n print_all: true,\n print_command: true)\nend",
"def create\n @data_source = DataSource.find(params[:data_source_id])\n\n @data_store = @data_source.data_stores.create(params[:data_store])\n\n redirect_to data_source_path(@data_source)\n end",
"def new\n @proxy_source = ProxySource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proxy_source }\n end\n end",
"def feed\n\t\t\"/metric/?metric=#{@origin_id}#{SEP}#{@metric_id}\"\n\tend",
"def report_metrics\n metadata = {\n 'sourcetype' => 'json',\n 'source' => 'chef-handler',\n 'host' => node.hostname,\n 'index' => @index,\n 'check-index' => false\n }\n\n # We're creating a new Hash b/c 'node' and 'all_resources' in run_status\n # are just TOO large.\n event = {\n :failed => run_status.failed?,\n :start_time => run_status.start_time,\n :end_time => run_status.end_time,\n :elapsed_time => run_status.elapsed_time,\n :exception => run_status.formatted_exception\n }.to_json\n\n splunk_post(event, metadata)\n end",
"def create\n @lookup_source = LookupSource.new(params[:lookup_source])\n\n respond_to do |format|\n if @lookup_source.save\n format.html { redirect_to(@lookup_source, :notice => 'Lookup source was successfully created.') }\n format.xml { render :xml => @lookup_source, :status => :created, :location => @lookup_source }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lookup_source.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def get_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SourcesApi.get_sources ...'\n end\n if @api_client.config.client_side_validation && opts[:'query_operator'] && !['AND', 'OR'].include?(opts[:'query_operator'])\n fail ArgumentError, 'invalid value for \"query_operator\", must be one of AND, OR'\n end\n if @api_client.config.client_side_validation && opts[:'filter_operator'] && !['AND', 'OR'].include?(opts[:'filter_operator'])\n fail ArgumentError, 'invalid value for \"filter_operator\", must be one of AND, OR'\n end\n if @api_client.config.client_side_validation && opts[:'facets_interval'] && !['year', 'month', 'week', 'day'].include?(opts[:'facets_interval'])\n fail ArgumentError, 'invalid value for \"facets_interval\", must be one of year, month, week, day'\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling SourcesApi.get_sources, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling SourcesApi.get_sources, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"offset\"]\" when calling SourcesApi.get_sources, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'profile'] && !['full', 'list', 'minimal'].include?(opts[:'profile'])\n fail ArgumentError, 'invalid value for \"profile\", must be one of full, list, minimal'\n end\n if @api_client.config.client_side_validation && opts[:'preset'] && !['analysis', 'latest', 'minimal'].include?(opts[:'preset'])\n fail ArgumentError, 'invalid value for \"preset\", must be one of analysis, latest, minimal'\n end\n # resource path\n local_var_path = '/sources'\n\n # query parameters\n query_params = {}\n query_params[:'query[value]'] = opts[:'query_value'] if !opts[:'query_value'].nil?\n query_params[:'query[operator]'] = opts[:'query_operator'] if !opts[:'query_operator'].nil?\n query_params[:'query[fields][]'] = @api_client.build_collection_param(opts[:'query_fields'], :csv) if !opts[:'query_fields'].nil?\n query_params[:'filter[field]'] = opts[:'filter_field'] if !opts[:'filter_field'].nil?\n query_params[:'filter[value][]'] = @api_client.build_collection_param(opts[:'filter_value'], :csv) if !opts[:'filter_value'].nil?\n query_params[:'filter[operator]'] = opts[:'filter_operator'] if !opts[:'filter_operator'].nil?\n query_params[:'filter[negate]'] = opts[:'filter_negate'] if !opts[:'filter_negate'].nil?\n query_params[:'filter[conditions][]'] = @api_client.build_collection_param(opts[:'filter_conditions'], :csv) if !opts[:'filter_conditions'].nil?\n query_params[:'facets[field]'] = opts[:'facets_field'] if !opts[:'facets_field'].nil?\n query_params[:'facets[name]'] = opts[:'facets_name'] if !opts[:'facets_name'].nil?\n query_params[:'facets[limit]'] = opts[:'facets_limit'] if !opts[:'facets_limit'].nil?\n query_params[:'facets[sort]'] = opts[:'facets_sort'] if !opts[:'facets_sort'].nil?\n query_params[:'facets[filter][]'] = @api_client.build_collection_param(opts[:'facets_filter'], :csv) if !opts[:'facets_filter'].nil?\n query_params[:'facets[interval]'] = opts[:'facets_interval'] if !opts[:'facets_interval'].nil?\n query_params[:'fields[include][]'] = @api_client.build_collection_param(opts[:'fields_include'], :csv) if !opts[:'fields_include'].nil?\n query_params[:'fields[exclude][]'] = @api_client.build_collection_param(opts[:'fields_exclude'], :csv) if !opts[:'fields_exclude'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort[]'] = @api_client.build_collection_param(opts[:'sort'], :csv) if !opts[:'sort'].nil?\n query_params[:'profile'] = opts[:'profile'] if !opts[:'profile'].nil?\n query_params[:'preset'] = opts[:'preset'] if !opts[:'preset'].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(['text/plain; charset=utf-8'])\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 => 'Source')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SourcesApi#get_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @source_ref = SourceRef.new(source_ref_params)\n\n respond_to do |format|\n if @source_ref.save\n format.html { redirect_to @source_ref, notice: 'Source ref was successfully created.' }\n format.json { render :show, status: :created, location: @source_ref }\n else\n format.html { render :new }\n format.json { render json: @source_ref.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game_source = GameSource.new(params[:game_source])\n\n respond_to do |format|\n if @game_source.save\n format.html { redirect_to @game_source, notice: 'Game source was successfully created.' }\n format.json { render json: @game_source, status: :created, location: @game_source }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipesource = Recipesource.new(params[:recipesource])\n\n respond_to do |format|\n if @recipesource.save\n format.html { redirect_to @recipesource, notice: 'Recipesource was successfully created.' }\n format.json { render json: @recipesource, status: :created, location: @recipesource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipesource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def source_params\n params.fetch(:source, {}).permit(:disabled, :feed_id, :source_type, :url, :name)\n end",
"def sources\n %w[\n sample_source\n ]\nend",
"def push_metrics!\n metrics = Prometheus::Client.registry\n url = Rails.application.secrets.prometheus_push_gateway_url\n\n Prometheus::Client::Push.new(\"push-gateway\", nil, url).add(metrics)\n end",
"def process_lm_sources(customer_id, sources)\n headers = [\n 'Source Name',\n 'Source Type',\n 'IP Address',\n 'Source ID',\n 'Source Status'\n ]\n data = []\n tables = []\n sources_list = sources['sources']\n reply_head = \"/code Log Sources for customer: #{customer_id} \\n\"\n\n sources_list.each do |source|\n source.each do |type, info|\n data << [\n info['name'],\n type,\n info['metadata']['local_ipv4'],\n info['id'],\n info['status']['status']\n ]\n if check_msg_size?(build_table(data, headers))\n tables << [data, headers]\n data = []\n end\n end\n end\n\n summary = \"\\nTotal Sources: #{sources['total_count']}\"\n if tables.length > 0\n reply = [reply_head, tables, summary]\n return reply\n else\n reply = reply_head\n reply << build_table(data, headers)\n reply << summary\n return reply\n end\n end",
"def report_resources\n metadata = {\n 'sourcetype' => 'json_chef-resources',\n 'source' => 'chef-handler',\n 'host' => node.hostname,\n 'index' => @index,\n 'check-index' => false\n }\n event = run_status.updated_resources.to_json\n\n splunk_post(event, metadata)\n end",
"def stage_json(file_path)\n file_dir, filename = File.split(file_path)\n relative_dir_path = file_dir.gsub(%r{^#{@metrics_dir}/}, \"\")\n destination_dir = \"#{@staging_dir}/#{relative_dir_path}\"\n FileUtils.mkdir_p(destination_dir) unless File.directory?(destination_dir)\n FileUtils.cp(file_path, \"#{destination_dir}/#{filename}\")\n end",
"def create\n @news_source = NewsSource.new(news_source_params)\n\n respond_to do |format|\n if @news_source.save\n format.html { redirect_to @news_source, notice: 'News source was successfully created.' }\n format.json { render :show, status: :created, location: @news_source }\n else\n format.html { render :new }\n format.json { render json: @news_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @creator_source = CreatorSource.new(params[:creator_source])\n\n respond_to do |format|\n if @creator_source.save\n format.html { redirect_to @creator_source, notice: 'Creator source was successfully created.' }\n format.json { render json: @creator_source, status: :created, location: @creator_source }\n else\n format.html { render action: \"new\" }\n format.json { render json: @creator_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @temporary_source = TemporarySource.new(params[:temporary_source])\n\n respond_to do |format|\n if @temporary_source.save\n format.html { redirect_to @temporary_source, notice: 'Temporary source was successfully created.' }\n format.json { render json: @temporary_source, status: :created, location: @temporary_source }\n else\n format.html { render action: \"new\" }\n format.json { render json: @temporary_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sources(source: nil)\n params = {\n source: source\n }.compact\n\n _get(\"/account/sources\", params) { |json| json }\n end",
"def get_source_data(source_name:, catalog_id:)\n response = HTTParty.get(\"#{@host}/api/sources/#{source_name}\", query: {\n catalog_id: catalog_id,\n api_key: @api_key\n })\n \n return response[\"source\"]\n end",
"def source_params\n params.require(:source).permit(:description, :link, :universe)\n end",
"def create\n @dis_datasource = DisDatasource.new(dis_datasource_params)\n\n respond_to do |format|\n if @dis_datasource.save\n format.html { redirect_to @dis_datasource, notice: 'Dis datasource was successfully created.' }\n format.json { render :show, status: :created, location: @dis_datasource }\n else\n format.html { render :new }\n format.json { render json: @dis_datasource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_d_b_source(project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'POST'\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/sources'\n\t\targs[:query]['Action'] = 'CreateDBSource'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :source\n\t\t\targs[:body]['Source'] = optional[:source]\n\t\tend\n\t\tself.run(args)\n\tend",
"def source_params\n params.require(:source).permit(:title, :authors, :hashtags_copy, annotations_attributes: [:id, :body, :body_source, :is_summary, :is_finding], citations_attributes: [:id, :is_read])\n end",
"def create\n @payment_source = PaymentSource.new(params[:payment_source])\n\n respond_to do |format|\n if @payment_source.save\n format.html { redirect_to @payment_source, notice: 'Payment source was successfully created.' }\n format.json { render json: @payment_source, status: :created, location: @payment_source }\n else\n format.html { render action: \"new\" }\n format.json { render json: @payment_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cla_source = ClaSource.new(cla_source_params)\n\n respond_to do |format|\n if @cla_source.save\n format.html { redirect_to @cla_source, notice: 'Cla source was successfully created.' }\n format.json { render :show, status: :created, location: @cla_source }\n else\n format.html { render :new }\n format.json { render json: @cla_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def metricData(ak,aapId,names)\n parseUrl=URI.parse('https://api.newrelic.com/v2/applications/'+appId+'/metrics/data.json')\n uri='https://api.newrelic.com/v2/applications/'+appId+'/metrics/data.json?names'+\n host=parseUrl.host\n path=parseUrl.path\n getRequest(ak,uri,host,path)\nend",
"def url\n resource.url + '/metrics'\n end",
"def data_source_params\n params.fetch(:data_source, {}).permit(:name, dimension_translations: [], calculated_dimensions: [])\n end",
"def create\n @source = new_source\n respond_to do |format|\n # We must check for manually added errors first, as they\n # are lost when .valid? is called during the callback chain.\n if !@source.errors.any? && @source.save\n format.html { redirect_to url_for(@source.metamorphosize),\n notice: \"#{@source.type} successfully created.\" }\n format.json { render action: 'show', status: :created, location: @source.metamorphosize }\n else\n format.html { render action: 'new' }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def source_record(**kwargs)\n FolioRecord.new_from_source_record(\n get_json('/source-storage/source-records', params: kwargs).dig('sourceRecords', 0), self\n )\n end",
"def create\n @source = Source.new\n create_or_update\n end",
"def new\n @annotation_source = AnnotationSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @annotation_source }\n end\n end",
"def add_sources(marshaller)\n source_dir = (source_type == SOURCE_TYPE_INTERNAL) \\\n ? SystemProperties::getCenterInternalDirectory \\\n : SystemProperties::getCenterExternalDirectory\n\n ha_configured = CommonSql.ha_configured?\n\n ConfigurationSource.get_all_sources_by_type(source_type).each do |source|\n source_xml = marshaller.factory.createConfigurationSourceType\n central_server_address = nil\n if ha_configured\n central_server_address = SystemParameter.where(\n :key => SystemParameter::CENTRAL_SERVER_ADDRESS,\n :ha_node_name => source.ha_node_name).first.value\n else\n central_server_address = SystemParameter.where(\n :key => SystemParameter::CENTRAL_SERVER_ADDRESS).first.value\n end\n source_xml.downloadURL =\n \"http://\" + central_server_address + \"/\" + source_dir\n source.configuration_signing_keys.find_each do |key|\n source_xml.getVerificationCert.add(key.cert.to_java_bytes)\n end\n marshaller.root.source.add(source_xml)\n end\n end",
"def create\n @rss_source = RssSource.new(params[:rss_source])\n @rss_source.user_id = current_user.id;\n respond_to do |format|\n if @rss_source.save\n format.html { redirect_to @rss_source, :notice => 'Rss source was successfully created.' }\n format.json { render :json => @rss_source, :status => :created, :location => @rss_source }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @rss_source.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @event_source = EventSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @event_source }\n end\n end",
"def create\n @subject_source = SubjectSource.new(params[:subject_source])\n\n respond_to do |format|\n if @subject_source.save\n format.html { redirect_to @subject_source, notice: 'Subject source was successfully created.' }\n format.json { render json: @subject_source, status: :created, location: @subject_source }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subject_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def convert_time_series metric_prefix, resource_type, resource_labels,\n view_data\n view = view_data.view\n\n view_data.data.map do |tag_values, aggr_data|\n series = Google::Cloud::Monitoring::V3::TimeSeries.new(\n metric: {\n type: make_metric_type(metric_prefix, view.name),\n labels: Hash[view.columns.zip tag_values]\n },\n resource: {\n type: resource_type,\n labels: resource_labels\n },\n metric_kind: convert_metric_kind(view.aggregation),\n value_type: convert_metric_value_type(view)\n )\n\n series.points << convert_point(\n view_data.start_time,\n aggr_data.time,\n view.measure,\n aggr_data\n )\n\n series\n end\n end",
"def put_fundingsources_ach_fundingsourcetoken_with_http_info(funding_source_token, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FundingSourcesApi.put_fundingsources_ach_fundingsourcetoken ...'\n end\n # verify the required parameter 'funding_source_token' is set\n if @api_client.config.client_side_validation && funding_source_token.nil?\n fail ArgumentError, \"Missing the required parameter 'funding_source_token' when calling FundingSourcesApi.put_fundingsources_ach_fundingsourcetoken\"\n end\n # resource path\n local_var_path = '/fundingsources/ach/{funding_source_token}'.sub('{' + 'funding_source_token' + '}', CGI.escape(funding_source_token.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 # 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[:debug_body] || @api_client.object_to_http_body(opts[:'body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'AchResponseModel'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"FundingSourcesApi.put_fundingsources_ach_fundingsourcetoken\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FundingSourcesApi#put_fundingsources_ach_fundingsourcetoken\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def add_source(url, note: nil)\n data = {url: url}\n if note\n data[:note] = note\n end\n if url.present?\n @sources << data\n end\n end",
"def process\n Wavefront::Write.new({ proxy: ENDPOINT, port: 2878 },\n tags: setup_tags).write(metrics_as_points)\n update_run_number\n end",
"def new\n @source = Source.new\n @sources = current_user.sources\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @source }\n end\n end",
"def datasource_params\n params.require(:datasource).permit(:sourcetype, :address, :port, :protocol, :username, :password, :name)\n end"
] |
[
"0.6303889",
"0.6221403",
"0.5960758",
"0.583662",
"0.58281815",
"0.58133495",
"0.572284",
"0.5559883",
"0.554318",
"0.53869396",
"0.5359682",
"0.53440577",
"0.53251487",
"0.52945566",
"0.5258054",
"0.52345407",
"0.52301395",
"0.5214242",
"0.5211699",
"0.51959276",
"0.51824856",
"0.5137637",
"0.5131171",
"0.5100993",
"0.50966537",
"0.5095424",
"0.5075709",
"0.5074827",
"0.5040078",
"0.503553",
"0.5031069",
"0.50228226",
"0.50161177",
"0.4973865",
"0.49728602",
"0.49694997",
"0.49406207",
"0.49393407",
"0.49383962",
"0.49265474",
"0.49173346",
"0.49066395",
"0.4899001",
"0.48967013",
"0.48640382",
"0.48559013",
"0.48401746",
"0.48271692",
"0.4827049",
"0.4818932",
"0.4812149",
"0.48044273",
"0.4804239",
"0.47916815",
"0.47900593",
"0.47890815",
"0.4788169",
"0.4784439",
"0.47480953",
"0.4742448",
"0.4740358",
"0.47272727",
"0.47237587",
"0.47236058",
"0.4711427",
"0.4710517",
"0.47062853",
"0.4705851",
"0.46852794",
"0.46713927",
"0.4667114",
"0.4666509",
"0.46607146",
"0.46494392",
"0.46484366",
"0.46456483",
"0.4643731",
"0.463175",
"0.462494",
"0.4624236",
"0.46154046",
"0.46136245",
"0.46128917",
"0.46032462",
"0.46017247",
"0.45915756",
"0.45860615",
"0.4579264",
"0.4573718",
"0.45728555",
"0.4568826",
"0.4562792",
"0.4562025",
"0.4554898",
"0.45525163",
"0.45508963",
"0.45425227",
"0.4541833",
"0.45375732",
"0.45306316"
] |
0.709647
|
0
|
PATCH/PUT /metric_sources/1 PATCH/PUT /metric_sources/1.json
|
def update
respond_to do |format|
if @metric_source.update(metric_source_params)
format.html { redirect_to @metric_source, notice: 'Metric source was successfully updated.' }
format.json { render :show, status: :ok, location: @metric_source }
else
format.html { render :edit }
format.json { render json: @metric_source.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_metric_source\n @metric_source = MetricSource.find(params[:id])\n end",
"def update\n source = Source.find_by(id: params[:source_id])\n unless source_params[:name] == source.name\n render json: {error: 'You cannot change external api for a source, you must delete that source if you wish to remove it'}, status: :unprocessable_entity\n end\n if source && all_sources.include?(source)\n source.access_token = source_params[:access_token]\n source.account_id = source_params[:account_id]\n if source.save\n render json: { id: source.id, name: source.name, access_token: source.access_token, account_id: source.account_id }, status: :found\n else\n render json: source.errors, status: :unprocessable_entity\n end\n else\n render json: {error: \"could not find source with source id of #{params[:source_id]}\"}, status: :not_found\n end\n end",
"def update!(**args)\n @bigquery_source = args[:bigquery_source] if args.key?(:bigquery_source)\n @gcs_source = args[:gcs_source] if args.key?(:gcs_source)\n @instances_format = args[:instances_format] if args.key?(:instances_format)\n end",
"def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n track_activity(@source, 'update', @source.previous_changes)\n format.html { redirect_to @source, notice: 'Source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @annotation_source = AnnotationSource.find(params[:id])\n\n respond_to do |format|\n if @annotation_source.update_attributes(params[:annotation_source])\n format.html { redirect_to @annotation_source, notice: 'Annotation source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @annotation_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @metric_name = args[:metric_name] if args.key?(:metric_name)\n @target = args[:target] if args.key?(:target)\n end",
"def update\n @metric = Metric.find(params[:id])\n\n if @metric.update(params[:metric])\n head :no_content\n else\n render json: @metric.errors, status: :unprocessable_entity\n end\n end",
"def update!(**args)\n @bigquery_source = args[:bigquery_source] if args.key?(:bigquery_source)\n @gcs_source = args[:gcs_source] if args.key?(:gcs_source)\n end",
"def update!(**args)\n @bigquery_source = args[:bigquery_source] if args.key?(:bigquery_source)\n @gcs_source = args[:gcs_source] if args.key?(:gcs_source)\n end",
"def update!(**args)\n @annotation_source = args[:annotation_source] if args.key?(:annotation_source)\n @create_time = args[:create_time] if args.key?(:create_time)\n @etag = args[:etag] if args.key?(:etag)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @payload = args[:payload] if args.key?(:payload)\n @payload_schema_uri = args[:payload_schema_uri] if args.key?(:payload_schema_uri)\n @update_time = args[:update_time] if args.key?(:update_time)\n end",
"def update!(**args)\n @source_type_metadata = args[:source_type_metadata] if args.key?(:source_type_metadata)\n end",
"def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n format.html { redirect_to edit_source_path, notice: 'Source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @bigquery_source = args[:bigquery_source] if args.key?(:bigquery_source)\n @error_config = args[:error_config] if args.key?(:error_config)\n @gcs_source = args[:gcs_source] if args.key?(:gcs_source)\n @inline_source = args[:inline_source] if args.key?(:inline_source)\n end",
"def update\n sources = Fenix::Store::Converter::Flattener.sources params[:sources]\n respond_to do |format|\n if @host.set_sources sources\n format.html { redirect_to source, notice: 'SourceList was successfully updated.' }\n format.json { render :show, status: :ok, location: source }\n else\n format.html { render :edit }\n format.json { render json: source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_record\n return false if @label.to_s.empty?\n\n atts = {}\n\n atts[\"status\"] = @status if @status\n atts[\"sync_period\"] = @sync_period if @sync_period\n atts[\"service_level\"] = @service_level if @service_level\n atts[\"password\"] = @password if @password\n atts[\"provider_token\"] = @provider_token if @provider_token\n atts[\"provider_token_secret\"] = @provider_token_secret if @provider_token_secret\n atts[\"provider_consumer_key\"] = @provider_consumer_key if @provider_consumer_key\n\n response = post(\"/2.0/accounts/#{@account_id}/sources/#{@label}\", atts)\n response['success']\n end",
"def update_sourced_attributes source_name=nil\n if source_name\n @sources[source_name].apply\n else\n @sources.values.each(&:apply)\n end\n end",
"def metric_source_params\n params.require(:metric_source).permit(:host, :port, :database)\n end",
"def update!(**args)\n @data_format = args[:data_format] if args.key?(:data_format)\n @gcs_source = args[:gcs_source] if args.key?(:gcs_source)\n end",
"def update\n respond_to do |format|\n if @source.update(source_params)\n format.html { redirect_to edit_source_path(@source), notice: 'Source was successfully updated.' }\n format.json { render :show, status: :ok, location: @source }\n else\n format.html { render :edit }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @historical_source.update(historical_source_params)\n format.html { redirect_to @historical_source, notice: 'Historical source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @historical_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @metric_requests = args[:metric_requests] if args.key?(:metric_requests)\n @time_range = args[:time_range] if args.key?(:time_range)\n end",
"def update!(**args)\n @metric_requests = args[:metric_requests] if args.key?(:metric_requests)\n @time_range = args[:time_range] if args.key?(:time_range)\n end",
"def update!(**args)\n @data_source_ids = args[:data_source_ids] if args.key?(:data_source_ids)\n end",
"def update\n respond_to do |format|\n if @data_source.update(data_source_params)\n format.html { redirect_to @data_source, notice: 'Data source was successfully updated.' }\n format.json { render :show, status: :ok, location: @data_source }\n else\n format.html { render :edit }\n format.json { render json: @data_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n format.html { redirect_to @source, notice: 'Source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @avro_source = args[:avro_source] if args.key?(:avro_source)\n @bigquery_source = args[:bigquery_source] if args.key?(:bigquery_source)\n @csv_source = args[:csv_source] if args.key?(:csv_source)\n @disable_ingestion_analysis = args[:disable_ingestion_analysis] if args.key?(:disable_ingestion_analysis)\n @disable_online_serving = args[:disable_online_serving] if args.key?(:disable_online_serving)\n @entity_id_field = args[:entity_id_field] if args.key?(:entity_id_field)\n @feature_specs = args[:feature_specs] if args.key?(:feature_specs)\n @feature_time = args[:feature_time] if args.key?(:feature_time)\n @feature_time_field = args[:feature_time_field] if args.key?(:feature_time_field)\n @worker_count = args[:worker_count] if args.key?(:worker_count)\n end",
"def update!(**args)\n @traffic_source_id = args[:traffic_source_id] if args.key?(:traffic_source_id)\n @traffic_sub_id = args[:traffic_sub_id] if args.key?(:traffic_sub_id)\n end",
"def create\n @metric_source = MetricSource.new(metric_source_params)\n\n respond_to do |format|\n if @metric_source.save\n format.html { redirect_to @metric_source, notice: 'Metric source was successfully created.' }\n format.json { render :show, status: :created, location: @metric_source }\n else\n format.html { render :new }\n format.json { render json: @metric_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @invalid_record_count = args[:invalid_record_count] if args.key?(:invalid_record_count)\n @partial_errors = args[:partial_errors] if args.key?(:partial_errors)\n @source_gcs_uri = args[:source_gcs_uri] if args.key?(:source_gcs_uri)\n @valid_record_count = args[:valid_record_count] if args.key?(:valid_record_count)\n end",
"def update\n metric.update_attributes(update_params)\n\n respond_with(metric)\n end",
"def update!(**args)\n @allow_list_source_data = args[:allow_list_source_data] if args.key?(:allow_list_source_data)\n @confidence = args[:confidence] if args.key?(:confidence)\n @install = args[:install] if args.key?(:install)\n @is_categorical = args[:is_categorical] if args.key?(:is_categorical)\n @media_provider_source_data = args[:media_provider_source_data] if args.key?(:media_provider_source_data)\n @source = args[:source] if args.key?(:source)\n @teleport_source_data = args[:teleport_source_data] if args.key?(:teleport_source_data)\n end",
"def update!(**args)\n @source = args[:source] if args.key?(:source)\n end",
"def update!(**args)\n @source = args[:source] if args.key?(:source)\n end",
"def update!(**args)\n @auto_generate_ids = args[:auto_generate_ids] if args.key?(:auto_generate_ids)\n @bigquery_source = args[:bigquery_source] if args.key?(:bigquery_source)\n @error_config = args[:error_config] if args.key?(:error_config)\n @gcs_source = args[:gcs_source] if args.key?(:gcs_source)\n @id_field = args[:id_field] if args.key?(:id_field)\n @inline_source = args[:inline_source] if args.key?(:inline_source)\n @reconciliation_mode = args[:reconciliation_mode] if args.key?(:reconciliation_mode)\n end",
"def update!(**args)\n @account_id = args[:account_id] if args.key?(:account_id)\n @custom_data_source_id = args[:custom_data_source_id] if args.key?(:custom_data_source_id)\n @errors = args[:errors] if args.key?(:errors)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @status = args[:status] if args.key?(:status)\n @upload_time = args[:upload_time] if args.key?(:upload_time)\n end",
"def update!(**args)\n @source = args[:source] if args.key?(:source)\n @url = args[:url] if args.key?(:url)\n end",
"def update\n respond_to do |format|\n if @datasource.update(form_params)\n format.json { render json: { datasources: @datasource }, status: :ok, location: @datasource }\n else\n format.json { render json: @datasource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @kernel_source.update(kernel_source_params)\n format.html { redirect_to @kernel_source, notice: \"Kernel source was successfully updated.\" }\n format.json { render :show, status: :ok, location: @kernel_source }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @kernel_source.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!(**args)\n @source = args[:source] if args.key?(:source)\n end",
"def update!(**args)\n @source = args[:source] if args.key?(:source)\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @source = args[:source] if args.key?(:source)\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!(**args)\n @gcs_source = args[:gcs_source] if args.key?(:gcs_source)\n end",
"def update!(**args)\n @gcs_source = args[:gcs_source] if args.key?(:gcs_source)\n end",
"def update!(**args)\n @gcs_source = args[:gcs_source] if args.key?(:gcs_source)\n end",
"def update!(**args)\n @gcs_source = args[:gcs_source] if args.key?(:gcs_source)\n end",
"def sources_id_put(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_id_put ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling sources_id_put\" if id.nil?\n \n # resource path\n path = \"/sources/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:PUT, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_id_put. Result: #{result.inspect}\"\n end\n return result\n end",
"def on_update(req)\n res = @data_sources.collect do |name, table|\n {:stream => name, :events => table.rows}\n end\n [res.to_json, \"text/json\"]\n end",
"def update!(**args)\n @metric = args[:metric] if args.key?(:metric)\n @options = args[:options] if args.key?(:options)\n end",
"def update!(**args)\n @metric = args[:metric] if args.key?(:metric)\n @options = args[:options] if args.key?(:options)\n end",
"def connectors_id_connector_sources_id_source_put_with_http_info(id_connector, id_source, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.connectors_id_connector_sources_id_source_put ...'\n end\n # verify the required parameter 'id_connector' is set\n if @api_client.config.client_side_validation && id_connector.nil?\n fail ArgumentError, \"Missing the required parameter 'id_connector' when calling ConnectionsApi.connectors_id_connector_sources_id_source_put\"\n end\n # verify the required parameter 'id_source' is set\n if @api_client.config.client_side_validation && id_source.nil?\n fail ArgumentError, \"Missing the required parameter 'id_source' when calling ConnectionsApi.connectors_id_connector_sources_id_source_put\"\n end\n # resource path\n local_var_path = '/connectors/{id_connector}/sources/{id_source}'.sub('{' + 'id_connector' + '}', id_connector.to_s).sub('{' + 'id_source' + '}', id_source.to_s)\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 form_params['auth_mechanism'] = opts[:'auth_mechanism'] if !opts[:'auth_mechanism'].nil?\n form_params['disabled'] = opts[:'disabled'] if !opts[:'disabled'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ConnectorSource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#connectors_id_connector_sources_id_source_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update!(**args)\n @error = args[:error] if args.key?(:error)\n @gcs_source = args[:gcs_source] if args.key?(:gcs_source)\n end",
"def update\n @event_source = EventSource.find(params[:id])\n\n respond_to do |format|\n if @event_source.update_attributes(params[:event_source])\n format.html { redirect_to @event_source, :notice => 'Event source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event_source.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @gcs_source = args[:gcs_source] if args.key?(:gcs_source)\n @mime_type = args[:mime_type] if args.key?(:mime_type)\n end",
"def update!(**args)\n @dialogflow_source = args[:dialogflow_source] if args.key?(:dialogflow_source)\n @gcs_source = args[:gcs_source] if args.key?(:gcs_source)\n end",
"def update!(**args)\n @dialogflow_source = args[:dialogflow_source] if args.key?(:dialogflow_source)\n @gcs_source = args[:gcs_source] if args.key?(:gcs_source)\n end",
"def update!(**args)\n @resource = args[:resource] if args.key?(:resource)\n @service = args[:service] if args.key?(:service)\n @source_entry = args[:source_entry] if args.key?(:source_entry)\n @storage_properties = args[:storage_properties] if args.key?(:storage_properties)\n end",
"def update!(**args)\n @source_property = args[:source_property] if args.key?(:source_property)\n end",
"def update\n respond_to do |format|\n if @source.update(source_params)\n # We go through this dance to handle changing types from verbatim to other\n @source = @source.becomes!(@source.type.safe_constantize)\n @source.reload # necessary to reload the cached value.\n format.html { redirect_to url_for(@source.metamorphosize), notice: 'Source was successfully updated.' }\n format.json { render :show, status: :ok, location: @source.metamorphosize }\n else\n format.html { render action: 'edit' }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @source_type = args[:source_type] if args.key?(:source_type)\n @source_value = args[:source_value] if args.key?(:source_value)\n end",
"def update!(**args)\n @data_schema = args[:data_schema] if args.key?(:data_schema)\n @input_uris = args[:input_uris] if args.key?(:input_uris)\n end",
"def update!(**args)\n @bigquery_source = args[:bigquery_source] if args.key?(:bigquery_source)\n @data_format = args[:data_format] if args.key?(:data_format)\n @dataset = args[:dataset] if args.key?(:dataset)\n @gcs_source = args[:gcs_source] if args.key?(:gcs_source)\n @logging_sampling_strategy = args[:logging_sampling_strategy] if args.key?(:logging_sampling_strategy)\n @target_field = args[:target_field] if args.key?(:target_field)\n end",
"def update!(**args)\n @payload = args[:payload] if args.key?(:payload)\n @source = args[:source] if args.key?(:source)\n @version = args[:version] if args.key?(:version)\n end",
"def update!(**args)\n @payload = args[:payload] if args.key?(:payload)\n @source = args[:source] if args.key?(:source)\n @version = args[:version] if args.key?(:version)\n end",
"def update!(**args)\n @common_data_source = args[:common_data_source] if args.key?(:common_data_source)\n @host_app_data_source = args[:host_app_data_source] if args.key?(:host_app_data_source)\n end",
"def update!(**args)\n @annotation_labels = args[:annotation_labels] if args.key?(:annotation_labels)\n @data_item_labels = args[:data_item_labels] if args.key?(:data_item_labels)\n @gcs_source = args[:gcs_source] if args.key?(:gcs_source)\n @import_schema_uri = args[:import_schema_uri] if args.key?(:import_schema_uri)\n end",
"def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @data_ref = args[:data_ref] if args.key?(:data_ref)\n @dimensions = args[:dimensions] if args.key?(:dimensions)\n @google_url = args[:google_url] if args.key?(:google_url)\n @insights = args[:insights] if args.key?(:insights)\n @location_association = args[:location_association] if args.key?(:location_association)\n @media_format = args[:media_format] if args.key?(:media_format)\n @name = args[:name] if args.key?(:name)\n @source_url = args[:source_url] if args.key?(:source_url)\n @thumbnail_url = args[:thumbnail_url] if args.key?(:thumbnail_url)\n end",
"def update!(**args)\n @resource_uri = args[:resource_uri] if args.key?(:resource_uri)\n @target = args[:target] if args.key?(:target)\n end",
"def update!(**args)\n @resource_uri = args[:resource_uri] if args.key?(:resource_uri)\n @target = args[:target] if args.key?(:target)\n end",
"def update\n @source = Source.find(params[:id])\n create_or_update\n end",
"def update!(**args)\n @example_gcs_source = args[:example_gcs_source] if args.key?(:example_gcs_source)\n @gcs_source = args[:gcs_source] if args.key?(:gcs_source)\n @nearest_neighbor_search_config = args[:nearest_neighbor_search_config] if args.key?(:nearest_neighbor_search_config)\n @neighbor_count = args[:neighbor_count] if args.key?(:neighbor_count)\n @presets = args[:presets] if args.key?(:presets)\n end",
"def update!\n @source.headers.delete(:update)\n set_updated_time(Time.now)\n save\n end",
"def update!(**args)\n @request_metadata = args[:request_metadata] if args.key?(:request_metadata)\n end",
"def update!(**args)\n @request_metadata = args[:request_metadata] if args.key?(:request_metadata)\n end",
"def update!(**args)\n @request_metadata = args[:request_metadata] if args.key?(:request_metadata)\n end",
"def update!(**args)\n @request_metadata = args[:request_metadata] if args.key?(:request_metadata)\n end",
"def update!(**args)\n @metric_id = args[:metric_id] if args.key?(:metric_id)\n @value = args[:value] if args.key?(:value)\n end",
"def update!(**args)\n @metric_name = args[:metric_name] if args.key?(:metric_name)\n @metric_values = args[:metric_values] if args.key?(:metric_values)\n end",
"def update!(**args)\n @deprecated_old_schema = args[:deprecated_old_schema] if args.key?(:deprecated_old_schema)\n @new_schema = args[:new_schema] if args.key?(:new_schema)\n @original_url = args[:original_url] if args.key?(:original_url)\n @source = args[:source] if args.key?(:source)\n end",
"def update!(**args)\n @custom_source = args[:custom_source] if args.key?(:custom_source)\n @entity_id = args[:entity_id] if args.key?(:entity_id)\n @quantized_score = args[:quantized_score] if args.key?(:quantized_score)\n @source = args[:source] if args.key?(:source)\n end",
"def connections_id_connection_sources_id_source_put_with_http_info(id_connection, id_source, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.connections_id_connection_sources_id_source_put ...'\n end\n # verify the required parameter 'id_connection' is set\n if @api_client.config.client_side_validation && id_connection.nil?\n fail ArgumentError, \"Missing the required parameter 'id_connection' when calling ConnectionsApi.connections_id_connection_sources_id_source_put\"\n end\n # verify the required parameter 'id_source' is set\n if @api_client.config.client_side_validation && id_source.nil?\n fail ArgumentError, \"Missing the required parameter 'id_source' when calling ConnectionsApi.connections_id_connection_sources_id_source_put\"\n end\n # resource path\n local_var_path = '/connections/{id_connection}/sources/{id_source}'.sub('{' + 'id_connection' + '}', id_connection.to_s).sub('{' + 'id_source' + '}', id_source.to_s)\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(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ConnectionSource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#connections_id_connection_sources_id_source_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update!(**args)\n @mysql_source_config = args[:mysql_source_config] if args.key?(:mysql_source_config)\n @oracle_source_config = args[:oracle_source_config] if args.key?(:oracle_source_config)\n @postgresql_source_config = args[:postgresql_source_config] if args.key?(:postgresql_source_config)\n @source_connection_profile = args[:source_connection_profile] if args.key?(:source_connection_profile)\n end",
"def update\n flash[:notice] = 'The source was successfully updated.' if source.update_attributes(params[:source])\n respond_with(source)\n end",
"def update_metric_stream(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'UpdateMetricStream'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :metric_stream\n\t\t\targs[:body]['MetricStream'] = optional[:metric_stream]\n\t\tend\n\t\tif optional.key? :metric_stream_name\n\t\t\targs[:query]['MetricStreamName'] = optional[:metric_stream_name]\n\t\tend\n\t\tif optional.key? :project_name\n\t\t\targs[:query]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def update\n @proxy_source = ProxySource.find(params[:id])\n\n respond_to do |format|\n if @proxy_source.update_attributes(params[:proxy_source])\n format.html { redirect_to @proxy_source, notice: 'Proxy source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proxy_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @metric.update(metric_params)\n format.html { redirect_to @metric, notice: 'Metric was successfully updated.' }\n format.json { render :show, status: :ok, location: @metric }\n else\n format.html { render :edit }\n format.json { render json: @metric.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @metrics = args[:metrics] if args.key?(:metrics)\n @metrics_schema_uri = args[:metrics_schema_uri] if args.key?(:metrics_schema_uri)\n @model_explanation = args[:model_explanation] if args.key?(:model_explanation)\n @name = args[:name] if args.key?(:name)\n @slice = args[:slice] if args.key?(:slice)\n end",
"def update!(**args)\n @source_type = args[:source_type] if args.key?(:source_type)\n end",
"def update!(**args)\n @json_schemas = args[:json_schemas] if args.key?(:json_schemas)\n @schema = args[:schema] if args.key?(:schema)\n end",
"def update!(**args)\n @accesses = args[:accesses] if args.key?(:accesses)\n @resource_edges = args[:resource_edges] if args.key?(:resource_edges)\n @resources = args[:resources] if args.key?(:resources)\n end",
"def update!(**args)\n @metric_type = args[:metric_type] if args.key?(:metric_type)\n @value_type = args[:value_type] if args.key?(:value_type)\n end",
"def update_d_b_source(project_name, source_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'PUT'\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:path]['SourceName'] = source_name\n\t\targs[:pattern] = '/projects/[ProjectName]/sources/[SourceName]'\n\t\targs[:query]['Action'] = 'UpdateDBSource'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :source\n\t\t\targs[:body]['Source'] = optional[:source]\n\t\tend\n\t\tself.run(args)\n\tend",
"def update!(**args)\n @source_object_identifier = args[:source_object_identifier] if args.key?(:source_object_identifier)\n end",
"def update!(**args)\n @consumer_id = args[:consumer_id] if args.key?(:consumer_id)\n @end_time = args[:end_time] if args.key?(:end_time)\n @importance = args[:importance] if args.key?(:importance)\n @labels = args[:labels] if args.key?(:labels)\n @log_entries = args[:log_entries] if args.key?(:log_entries)\n @metric_value_sets = args[:metric_value_sets] if args.key?(:metric_value_sets)\n @operation_id = args[:operation_id] if args.key?(:operation_id)\n @operation_name = args[:operation_name] if args.key?(:operation_name)\n @quota_properties = args[:quota_properties] if args.key?(:quota_properties)\n @resources = args[:resources] if args.key?(:resources)\n @start_time = args[:start_time] if args.key?(:start_time)\n @trace_spans = args[:trace_spans] if args.key?(:trace_spans)\n @user_labels = args[:user_labels] if args.key?(:user_labels)\n end",
"def update_metadata(params)\n @client.put(metadata_path, nil, params, \"Content-Type\" => \"application/json\")\n end",
"def update\n @datasource = Datasource.find(params[:id])\n @datasource.update_attributes!(params[:datasource])\n\n flash[:notice] = \"Updated datasource properties\"\n redirect_to datasource_path(:id => @datasource)\n end",
"def update!(**args)\n @inferred_image_source = args[:inferred_image_source] if args.key?(:inferred_image_source)\n @inferred_image_type = args[:inferred_image_type] if args.key?(:inferred_image_type)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @source_field = args[:source_field] if args.key?(:source_field)\n end",
"def update!(**args)\n @metric_header = args[:metric_header] if args.key?(:metric_header)\n @dimensions = args[:dimensions] if args.key?(:dimensions)\n end"
] |
[
"0.6190008",
"0.61090916",
"0.5785837",
"0.5718648",
"0.5637591",
"0.56240416",
"0.5618999",
"0.5611183",
"0.5611183",
"0.55883193",
"0.55845875",
"0.5579154",
"0.5569169",
"0.5560742",
"0.5555492",
"0.55501014",
"0.55487114",
"0.55292803",
"0.55226487",
"0.5513215",
"0.5482401",
"0.5482401",
"0.547298",
"0.5465565",
"0.5458492",
"0.5435856",
"0.54340625",
"0.5433674",
"0.5430938",
"0.542431",
"0.5423138",
"0.5417615",
"0.5417615",
"0.54140574",
"0.540335",
"0.54012436",
"0.5397091",
"0.5393429",
"0.5393229",
"0.53866756",
"0.53866756",
"0.53833264",
"0.5378557",
"0.536604",
"0.536604",
"0.536604",
"0.536604",
"0.53574723",
"0.5346398",
"0.5343764",
"0.5343764",
"0.53369105",
"0.53352696",
"0.533373",
"0.5324016",
"0.5315472",
"0.5315472",
"0.5308343",
"0.5281287",
"0.5273649",
"0.52706516",
"0.526616",
"0.5260957",
"0.5244243",
"0.5244243",
"0.5241254",
"0.5240431",
"0.5236012",
"0.5235551",
"0.5235551",
"0.5230505",
"0.5229465",
"0.52187645",
"0.52128124",
"0.52128124",
"0.52128124",
"0.52128124",
"0.5206354",
"0.5204038",
"0.52012616",
"0.5190797",
"0.5182312",
"0.51815635",
"0.51668924",
"0.51634854",
"0.51616216",
"0.51551497",
"0.51430005",
"0.5140216",
"0.51384926",
"0.5137335",
"0.5128999",
"0.5126518",
"0.5119636",
"0.51179034",
"0.51144224",
"0.51117235",
"0.5109315",
"0.5106652",
"0.51054823"
] |
0.7165161
|
0
|
DELETE /metric_sources/1 DELETE /metric_sources/1.json
|
def destroy
@metric_source.destroy
respond_to do |format|
format.html { redirect_to metric_sources_url, notice: 'Metric source was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to report_sources_path }\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 @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 @datasource.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @historical_source.destroy\n respond_to do |format|\n format.html { redirect_to historical_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @data_source.destroy\n respond_to do |format|\n format.html { redirect_to data_sources_url, notice: 'Data source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @data_source.destroy\n respond_to do |format|\n format.html { redirect_to data_sources_url, notice: 'Data source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @proxy_source = ProxySource.find(params[:id])\n @proxy_source.destroy\n\n respond_to do |format|\n format.html { redirect_to proxy_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @throughput_metric.destroy\n respond_to do |format|\n format.html { redirect_to throughput_metrics_url }\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 @source.destroy\n respond_to do |format|\n format.html { redirect_to sources_url, notice: 'Source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n metric.destroy\n\n respond_with(metric)\n end",
"def destroy\n if @source.destroy\n respond_to do |format|\n format.html { redirect_to sources_url, notice: \"Destroyed source #{@source.cached}\" }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { render action: :show, notice: 'failed to destroy the source, there is likely data associated with it' }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @annotation_source = AnnotationSource.find(params[:id])\n @annotation_source.destroy\n\n respond_to do |format|\n format.html { redirect_to annotation_sources_url }\n format.json { head :no_content }\n end\n end",
"def delete\n result = Base.redis.hdel(:sources, name)\n if result == 1\n delete_all_inputs\n Log.info \"Deleting Source object from Redis: #{name}\"\n else\n raise UnknownSource, \"Cannot delete non-existent Source object in Redis: #{name}\"\n end\n result\n end",
"def destroy\n @metric.destroy\n respond_to do |format|\n format.html { redirect_to metrics_url, notice: 'Metric was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize_user!\n respond_to do |format|\n format.html { redirect_to sources_path(@source) }\n format.json { head :no_content }\n @source.destroy\n end\n end",
"def destroy\n @event_source = EventSource.find(params[:id])\n @event_source.destroy\n\n respond_to do |format|\n format.html { redirect_to event_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @metric = Metric.find(params[:id])\n @metric.destroy\n\n respond_to do |format|\n format.html { redirect_to metrics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @key_metric = KeyMetric.find(params[:id])\n @key_metric.destroy\n\n respond_to do |format|\n format.html { redirect_to(key_metrics_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n authorize! :manage, @vspec\n metric = @vspec.metric\n @vspec.destroy\n respond_to do |format|\n format.html { redirect_to [metric.service, metric] }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kernel_source.destroy\n respond_to do |format|\n format.html { redirect_to kernel_sources_url, notice: \"Kernel source was successfully destroyed.\" }\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.xml { head :ok }\n end\n end",
"def m_delete\n a = source \"a\"\n sink a.delete(\"b\") # $ hasTaintFlow=a\n sink a.delete_prefix(\"b\") # $ hasTaintFlow=a\n sink a.delete_suffix(\"b\") # $ hasTaintFlow=a\nend",
"def sources_id_delete(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_id_delete ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling sources_id_delete\" if id.nil?\n \n # resource path\n path = \"/sources/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:DELETE, 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 => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_id_delete. Result: #{result.inspect}\"\n end\n return result\n end",
"def destroy\n @admin_sub_metric.destroy\n respond_to do |format|\n format.html { redirect_to admin_sub_metrics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dis_datasource.destroy\n respond_to do |format|\n format.html { redirect_to dis_datasources_url, notice: 'Dis datasource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to(sources_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to(sources_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to(sources_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to(sources_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @sampled_url = SampledUrl.find(params[:id])\n @sampled_url.destroy\n\n respond_to do |format|\n format.html { redirect_to sampled_urls_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 @chef_att_source.destroy\n respond_to do |format|\n format.html { redirect_to chef_att_sources_url, notice: 'Chef att source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @source_ref.destroy\n respond_to do |format|\n format.html { redirect_to source_refs_url, notice: 'Source ref was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n return false if @label.to_s.empty?\n\n response = delete(\"/2.0/accounts/#{@account_id}/sources/#{@label}\")\n @label = '' if response['success']\n \n response['success']\n end",
"def destroy\n @cla_source.destroy\n respond_to do |format|\n format.html { redirect_to cla_sources_url, notice: 'Cla source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @data_store = DataStore.find(params[:id])\n @data_store.destroy\n\n respond_to do |format|\n format.html { redirect_to data_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to user_path(current_user), notice: \"Register was deleted!\" }\n format.json { head :no_content }\n end\n end",
"def delete\n ensure_service!\n service.delete_metric name\n true\n end",
"def destroy\n @lookup_source = LookupSource.find(params[:id])\n @lookup_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(lookup_sources_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @src_gst = SrcGst.find(params[:id])\n @src_gst.destroy\n\n respond_to do |format|\n format.html { redirect_to src_gsts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @metric_speedtest.destroy\n respond_to do |format|\n format.html { redirect_to metric_speedtests_url }\n format.json { head :no_content }\n end\n end",
"def delete_metric_stream(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DeleteMetricStream'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :metric_stream_name\n\t\t\targs[:query]['MetricStreamName'] = optional[:metric_stream_name]\n\t\tend\n\t\tif optional.key? :project_name\n\t\t\targs[:query]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def delete_a_record(zone_id, zone_name, domain_name, namespace, ingress_name)\n sleep 1\n client = Aws::Route53::Client.new\n\n a_record = {\n action: \"DELETE\",\n resource_record_set: {\n name: domain_name,\n alias_target: {\n # ZD4D7Y8KGAS4G this zone is the default AWS zone for ELB records, in eu-west-2\n \"hosted_zone_id\": \"ZD4D7Y8KGAS4G\",\n \"dns_name\": get_ingress_endpoint(namespace, ingress_name) + \".\",\n \"evaluate_target_health\": true,\n },\n type: \"A\",\n },\n }\n\n client.change_resource_record_sets({\n hosted_zone_id: zone_id,\n change_batch: {\n changes: [a_record],\n },\n })\nend",
"def destroy\n @game_source = GameSource.find(params[:id])\n @game_source.destroy\n\n respond_to do |format|\n format.html { redirect_to game_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datasource = Datasource.find(params[:id])\n @datasource.destroy\n\n flash[:notice] = \"Destroyed datasource\"\n redirect_to datasources_path\n end",
"def destroy\n @rep_source = RepSource.find(params[:id])\n @rep_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(rep_sources_url) }\n format.xml { head :ok }\n end\n end",
"def delete_all_metrics\n connection = Librato::Metrics.client.connection\n Librato::Metrics.list.each do |metric|\n #puts \"deleting #{metric['name']}...\"\n # expects 204\n connection.delete(\"metrics/#{metric['name']}\")\n end\n end",
"def delete_metrics(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DeleteMetrics'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :metric_name\n\t\t\targs[:query]['MetricName'] = optional[:metric_name]\n\t\tend\n\t\tif optional.key? :project_name\n\t\t\targs[:query]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def destroy\n @source_file.destroy\n respond_to do |format|\n format.html { redirect_to source_files_url, notice: 'Source file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_d_b_source(project_name, source_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'DELETE'\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:path]['SourceName'] = source_name\n\t\targs[:pattern] = '/projects/[ProjectName]/sources/[SourceName]'\n\t\targs[:query]['Action'] = 'DeleteDBSource'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tself.run(args)\n\tend",
"def destroy\n @data_source_type.destroy\n respond_to do |format|\n format.html { redirect_to data_source_types_url, notice: 'Data source type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feed_source.destroy\n respond_to do |format|\n format.html { redirect_to feed_sources_url, notice: 'Feed source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipesource = Recipesource.find(params[:id])\n @recipesource.destroy\n\n respond_to do |format|\n format.html { redirect_to recipesources_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 delete endpoint\n do_request :delete, endpoint\n end",
"def destroy\n @portal_source.destroy\n respond_to do |format|\n format.html { redirect_to portal_sources_url, notice: 'Portal source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @payment_source = PaymentSource.find(params[:id])\n @payment_source.destroy\n\n respond_to do |format|\n format.html { redirect_to payment_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @spatial_coverages = SpatialCoverages.find(params[:id])\n @spatial_coverages.destroy\n\n respond_to do |format|\n format.html { redirect_to spatial_coverage_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task_metric = TaskMetric.find(params[:id])\n @task_metric.destroy\n\n respond_to do |format|\n format.html { redirect_to task_metrics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student_source = StudentSource.find(params[:id])\n @student_source.destroy\n\n respond_to do |format|\n format.html { redirect_to student_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @study_source.destroy\n respond_to do |format|\n format.html { redirect_to study_sources_url, notice: 'Study source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @founding_source.destroy\n respond_to do |format|\n format.html { redirect_to founding_sources_url, notice: 'Founding source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @source_data_pfr.destroy\n respond_to do |format|\n format.html { redirect_to source_data_pfrs_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n path = relativize_path path\n\n Precog.connect self do |http|\n uri = Addressable::URI.new\n uri.query_values = { :apiKey => api_key }\n\n http.delete \"/ingest/v#{VERSION}/fs/#{path}?#{uri.query}\"\n end\n end",
"def destroy\n onevnet('delete', resource[:name])\n @property_hash.clear\n end",
"def destroy\n @content_source = ContentSource.find(params[:id])\n @content_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(content_sources_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n delete_from_server single_url\n end",
"def destroy\n @backend_stat = Backend::Stat.find(params[:id])\n @backend_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to backend_stats_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @rss_source = RssSource.find(params[:id])\n @rss_source.destroy\n\n respond_to do |format|\n format.html { redirect_to rss_sources_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @city_source.destroy\n respond_to do |format|\n format.html { redirect_to city_sources_url, notice: 'City source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n flash[:notice] = 'The source was successfully removed.' if source.destroy\n respond_with(source)\n end",
"def destroy\n @temporary_source = TemporarySource.find(params[:id])\n @temporary_source.destroy\n\n respond_to do |format|\n format.html { redirect_to temporary_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @source_master.destroy\n respond_to do |format|\n format.html { redirect_to source_masters_url, notice: \"Source master was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @local_cpu_summary = LocalCpuSummary.find(params[:id])\n @local_cpu_summary.destroy\n\n respond_to do |format|\n format.html { redirect_to local_cpu_summaries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n @creator_metric.destroy\n respond_to do |format|\n #@creator_metrics=CreatorMetric.select(\"creator_exts.avatar,creator_exts.category_id,users.sex,users.username,users.description,users.user_comment,creator_exts.tags_set\").joins(\"left join creator_exts on users.id= creator_exts.userid where users.id=#{user_id}\")\n getcreator_metrics\n format.html { render :index, notice: 'Creator metric was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @urlshortner.destroy\n respond_to do |format|\n format.html { redirect_to urlshortners_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @enquiry_source = EnquirySource.find(params[:id])\n @enquiry_source.destroy\n\n respond_to do |format|\n format.html { redirect_to enquiry_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @creator_source = CreatorSource.find(params[:id])\n @creator_source.destroy\n\n respond_to do |format|\n format.html { redirect_to creator_sources_url }\n format.json { head :no_content }\n end\n end",
"def delete_d_b_metric(metric_name, project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'DELETE'\n\t\targs[:path]['MetricName'] = metric_name\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/dbMetrics/[MetricName]'\n\t\targs[:query]['Action'] = 'DeleteDBMetric'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tself.run(args)\n\tend",
"def destroy\n AudioSource.delete( @bundle_source.audio_sources )\n \n corresponding_bundle = @bundle_source.bundle_id\n if( @bundle_source.bundle_id )\n corresponding_bundle = Bundle.find_by_id( @bundle_source.bundle_id )\n if( corresponding_bundle && corresponding_bundle.created_by_user_id == @user.id )\n logger.info(\"****** DESROY invoked ****** \")\n corresponding_bundle.destroy\n end\n end\n\n @bundle_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(bundle_sources_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @analytics_used_analysable.destroy\n respond_to do |format|\n format.html { redirect_to analytics_used_analysables_url, notice: 'Analytics used analysable was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datapoint.destroy\n respond_to do |format|\n format.html { redirect_to datapoints_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @collector.destroy\n respond_to do |format|\n format.html { redirect_to collectors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school_plastic_collection_source.destroy\n respond_to do |format|\n format.html { redirect_to school_plastic_collection_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @coverage.destroy\n respond_to do |format|\n format.html { redirect_to coverages_url, notice: 'Coverage was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @jargon_file = JargonFile.find(params[:id])\n @source = @jargon_file.source\n @jargon_file.destroy\n\n respond_to do |format|\n format.html { redirect_to @source }\n format.json { head :no_content }\n end\n end",
"def delete(_url)\n # do nothing since we can't find the key by url\n end",
"def destroy\n @consensu = Consensu.find(params[:id])\n @consensu.destroy\n\n respond_to do |format|\n format.html { redirect_to consensus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subject_source = SubjectSource.find(params[:id])\n @subject_source.destroy\n\n respond_to do |format|\n format.html { redirect_to subject_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datasource.destroy\n respond_to do |format|\n format.html { redirect_to datasources_url, notice: 'Combination dose was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n Metric.find_by_metric_id(@value_metric.id).destroy\r\n #Metric.find(idx).destroy\r\n @value_metric.destroy\r\n respond_to do |format|\r\n format.html { redirect_to @game, notice: 'Value metric was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @news_source.destroy\n respond_to do |format|\n format.html { redirect_to news_sources_url, notice: 'News source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.66007483",
"0.65632063",
"0.6531628",
"0.6472765",
"0.6459897",
"0.6456585",
"0.6456585",
"0.6414121",
"0.6391749",
"0.6391665",
"0.6391665",
"0.6309538",
"0.62866175",
"0.62614095",
"0.62511986",
"0.6240843",
"0.6223965",
"0.6222224",
"0.6214232",
"0.62033653",
"0.6199345",
"0.6198981",
"0.61502147",
"0.61486465",
"0.61346316",
"0.6134262",
"0.61336195",
"0.6099349",
"0.607288",
"0.606329",
"0.6052089",
"0.6052089",
"0.6052089",
"0.6052089",
"0.6038918",
"0.6032959",
"0.6032741",
"0.5995282",
"0.59921205",
"0.5988163",
"0.5981545",
"0.5953271",
"0.594024",
"0.5936863",
"0.5931666",
"0.5928186",
"0.591908",
"0.58993626",
"0.58908224",
"0.5884797",
"0.5875681",
"0.58689255",
"0.5867002",
"0.58627224",
"0.58586097",
"0.5857715",
"0.5845937",
"0.58414745",
"0.5839709",
"0.5833799",
"0.58299506",
"0.5806",
"0.58022594",
"0.57940537",
"0.5792965",
"0.579093",
"0.5780709",
"0.57760113",
"0.5761639",
"0.57597405",
"0.57580966",
"0.5743498",
"0.5736445",
"0.5732659",
"0.5728026",
"0.57231796",
"0.572113",
"0.5721098",
"0.57148445",
"0.5712532",
"0.56895727",
"0.566064",
"0.5651613",
"0.5644997",
"0.56303555",
"0.5624314",
"0.5622968",
"0.56186974",
"0.56162226",
"0.55986315",
"0.55986315",
"0.5597545",
"0.55881417",
"0.5578653",
"0.55734414",
"0.5572314",
"0.5557624",
"0.55576086",
"0.55564904",
"0.55557305"
] |
0.77900636
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_metric_source
@metric_source = MetricSource.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 metric_source_params
params.require(:metric_source).permit(:host, :port, :database)
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 user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def 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 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 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 maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\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 url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\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 droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\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.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.6291174",
"0.62905735",
"0.6283171",
"0.6242344",
"0.62403613",
"0.6218049",
"0.62143815",
"0.62104696",
"0.61949855",
"0.6178671",
"0.6176147",
"0.6173327",
"0.6163395",
"0.6153005",
"0.6151833",
"0.6147288",
"0.61224324",
"0.6118827",
"0.61075264",
"0.61054534",
"0.6092497",
"0.6080082",
"0.60710967",
"0.60627776",
"0.60219413",
"0.60175914",
"0.60153484",
"0.60107356",
"0.60081726",
"0.60081726",
"0.60013986",
"0.6000165",
"0.59978646",
"0.59936947",
"0.59925723",
"0.5992084",
"0.59796256",
"0.5967569",
"0.5960056",
"0.59589803",
"0.5958441",
"0.5958401",
"0.5952607",
"0.5952406",
"0.5944409",
"0.59391016",
"0.593842",
"0.593842",
"0.5933845",
"0.59312123",
"0.5926475",
"0.59248453",
"0.59179676",
"0.59109294",
"0.59101623",
"0.5908172",
"0.59058356",
"0.5899052",
"0.5897749",
"0.5896101",
"0.58942914",
"0.58939576",
"0.5892063",
"0.5887407",
"0.588292",
"0.58797663",
"0.587367",
"0.58681566",
"0.5868038",
"0.5866578",
"0.58665025",
"0.58655846",
"0.58640826",
"0.5863465",
"0.5862226",
"0.586065",
"0.58581287",
"0.5854443",
"0.5854172",
"0.58507544",
"0.5849934"
] |
0.0
|
-1
|
Thumbnail sizing Gives a thumbnail size automatically on create
|
def test_thumb_size_too_big
assert @photo.valid?
@photo.thumb_l = 169
assert !@photo.valid?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def thumbnail(size); end",
"def sized(width, height)\n\t\t\t@sized_thumb = @template\n\t\t\t@sized_thumb.sub! \"{width}\", width.to_s\n\t\t\t@sized_thumb.sub! \"{height}\", height.to_s\n\t\tend",
"def create_thumbnail\n return create_resized_pic(THUMBNAIL_HEIGHT, THUMBNAIL_WIDTH, SIZE_THUMBNAIL)\n end",
"def thumbnail_definitions\n thumbnail_sizes\n end",
"def create_thumbnail\n image = Image.from_blob(self.photo_image).first\n thumbnail = image.resize_to_fill(320,240, gravity=CenterGravity)\n thumbnail.to_blob\n end",
"def create_thumbnail\n ImageGeneratingService.new(self, 'Thumbnail.png', 'image/png').generate_resized(120)\n end",
"def thumb_width\n width * thumb_height / height\n end",
"def thumbnail(options = {})\n return if !readable? || !thumbnailable?\n\n size = options[:size].to_i\n if size > 0\n # Limit the number of thumbnails per image\n size = (size / 50.0).ceil * 50\n # Maximum thumbnail size\n size = 800 if size > 800\n else\n size = Setting.thumbnails_size.to_i\n end\n size = 100 unless size > 0\n target = thumbnail_path(size)\n\n diskfile_s3 = diskfile\n begin\n Redmine::Thumbnail.generate(diskfile_s3, target, size, is_pdf?)\n rescue => e\n Rails.logger.error \"An error occured while generating thumbnail for #{diskfile_s3} to #{target}\\nException was: #{e.message}\"\n return\n end\n end",
"def thumb(w_x_h, quality: 90, immediate: false)\n fail_for_non_images\n return thumb_in_test_env(w_x_h, quality: quality) if Rails.env.test?\n\n if thumbnail_sizes[w_x_h] && thumbnail_sizes[w_x_h][:uid]\n ret = OpenStruct.new(thumbnail_sizes[w_x_h])\n ret.url = Dragonfly.app.remote_url_for(ret.uid)\n ret\n else\n if svg?\n url = file.remote_url\n width = file_width\n height = file_height\n else\n if immediate || self.class.immediate_thumbnails\n image = Folio::GenerateThumbnailJob.perform_now(self, w_x_h, quality)\n ret = OpenStruct.new(image.thumbnail_sizes[w_x_h])\n ret.url = Dragonfly.app.remote_url_for(ret.uid)\n return ret\n else\n Folio::GenerateThumbnailJob.perform_later(self, w_x_h, quality)\n url = temporary_url(w_x_h)\n end\n width, height = w_x_h.split('x').map(&:to_i)\n end\n OpenStruct.new(\n uid: nil,\n signature: nil,\n url: url,\n width: width,\n height: height,\n quality: quality\n )\n end\n end",
"def image_as_medium_thumbnail\n image.variant(resize_to_fill: [350, 350]).processed\n end",
"def resize_thumb(sizestr)\n ret = nil\n if THUMB_SIZES.has_key?(sizestr)\n sw, sh = size(sizestr)\n img = Magick::Image.from_blob(data)[0]\n tw, th = size(thumb_l)\n img.crop!(thumb_x, thumb_y, tw, th)\n img.resize!(sw, sh)\n ret = img.to_blob\n else\n ret = data\n end\n GC.start\n ret\n end",
"def thumbnail_width\n\t\t\t@data[\"thumbnail\"][\"width\"] if @data[\"thumbnail\"]\n\t\tend",
"def thumbnail_width\n\t\t\t@data[\"thumbnail\"][\"width\"]\n\t\tend",
"def resize\n if size.max > 1024\n res = %x( #{magick_bin_name(\"convert\")} -auto-orient -resize 1024x768 #{Shellwords.shellescape path} #{Shellwords.shellescape path})\n Rails.logger.info res\n end\n unless has_thumbnail?\n unless File.exists? path.gsub(/(.+)\\/.+/, '\\1/thumbs')\n Dir.mkdir path.gsub(/(.+)\\/.+/, '\\1/thumbs')\n end\n ## that's a bit broken on windows - why?\n res = %x( #{magick_bin_name(\"convert\")} -verbose -auto-orient -strip -thumbnail 300x160 #{Shellwords.shellescape path} #{Shellwords.shellescape path.gsub(/(.+)\\/(.+)/, '\\1/thumbs/\\2')})\n Rails.logger.info res\n end\n end",
"def thumbnail_image\n end",
"def cropped_thumbnail(geometry)\n ow,oh = @original_width,@original_height\n \t w,h = geometry.strip.split('x').map{|n|n.to_i}\n\n \t\tif (ow.to_f / oh) < (w.to_f / h)\n \t\t\t# narrow aspect ratio, width is the priority\n \t\t\tresized_w = w\n \t\t\tresized_h = ((w.to_f / ow) * oh).round # scale height to same ratio as width\n \t\telse\n \t\t\t# wide or square aspect ratio, height is the priority\n \t\t\tresized_h = h\n \t\t\tresized_w = ((h.to_f / oh) * ow).round # scale width to the same ratio as height\n \t\tend\n \t\tresize_to = [resized_w,resized_h].max\n\n thumbnail(\"#{resize_to}x#{resize_to}\")\n crop(geometry)\n \t\tself\n \tend",
"def thumbnail input\n return self.images[input].variant(resize: '300x300').processed\n end",
"def generate_thumbnail(image_path, commit_id)\n thumb_size = Glitter::Application.config.thumbnail_geometry\n image = Magick::Image.read(\n \"#{satellitedir}/#{image_path}\"\n ).first\n image.scale(\n thumb_size[0],\n thumb_size[1]\n ).write thumbnail_for(commit_id, true)\n end",
"def thumbnail(input = 0)\n return self.uploads[input].variant(resize: '1000x1000').processed\n end",
"def generate_thumbnail path, img\n img = img.resize_to_fit 200,200\n img.write path\n end",
"def thumb_for(document, size)\n image_tag document.thumb(size, self)\n end",
"def create_homepage_thumbnail\n image = Image.from_blob(self.photo_image).first\n thumbnail = image.resize_to_fill(320,240, gravity=CenterGravity)\n thumbnail.to_blob\n end",
"def dynamic_resize_to_fit(size)\n resize_to_fit *(model.class::IMAGE_CONFIG[size])\n end",
"def thumb_url(size)\n image.file.thumb(size).url\n end",
"def display_image \r\n self.image.variant(resize_to_limit: [1000, 1000]) \r\n end",
"def thumbnail(geometry)\n \t mogrify(:thumbnail, geometry)\n \t self\n end",
"def size(size)\n w = width\n h = height\n if width && height\n d = [w, h].max\n max = case size.to_s\n when \"thumbnail\" then 160\n when \"small\" then 320\n when \"medium\" then 640\n when \"large\" then 960\n when \"huge\" then 1280\n else; 1e10\n end\n if max < d\n w = w * max / d\n h = h * max / d\n end\n end\n [w, h]\n end",
"def resize_image(img, size)\n size = size.first if size.is_a?(Array) && size.length == 1 && !size.first.is_a?(Fixnum)\n if size.is_a?(Fixnum) || (size.is_a?(Array) && size.first.is_a?(Fixnum))\n size = [size, size] if size.is_a?(Fixnum)\n img.thumbnail!(*size)\n elsif size.is_a?(String) && size =~ /^c.*$/ # Image cropping - example geometry string: c75x75\n dimensions = size[1..size.size].split(\"x\")\n img.crop_resized!(dimensions[0].to_i, dimensions[1].to_i)\n elsif size.is_a?(String) && size =~ /^b.*$/ # Resize w/border - example geometry string: b75x75\n dimensions = size[1..size.size].split(\"x\")\n img.change_geometry(dimensions.join(\"x\")) do |cols, rows, image| \n image.resize!(cols<1 ? 1 : cols, rows<1 ? 1 : rows ) \n end\n img.background_color = \"black\"\n x_offset = (img.columns - dimensions[0].to_i) / 2\n y_offset = (img.rows - dimensions[1].to_i) / 2\n img = img.extent(dimensions[0].to_i, dimensions[1].to_i, x_offset, y_offset)\n else\n img.change_geometry(size.to_s) { |cols, rows, image| image.resize!(cols<1 ? 1 : cols, rows<1 ? 1 : rows) }\n end\n img.strip! unless attachment_options[:keep_profile]\n temp_paths.unshift write_to_temp_file(img.to_blob)\n end",
"def large_process\n case [model.attachable_type, model.image_type]\n when ['User', 'avatar'] then\n resize_to_fill 1024, 683 # 3x2\n when ['User', 'inspiration'] then\n resize_to_fit 1024, 9999 # fixed width\n when ['Message', 'avatar'] then\n resize_to_fit 1024, 9999 # fixed width\n when ['Message', 'alternate'] then\n resize_to_fit 1024, 9999 # fixed width\n when ['Alternative', 'avatar'] then\n resize_to_fill 1024, 683 # 3x2\n else\n resize_to_fit 1024, 9999 # fixed width\n end\n # TODO: Test and implement this.\n # fix_exif_rotation\n quality 70\n end",
"def create_medium\n return create_resized_pic(MEDIUM_HEIGHT, MEDIUM_WIDTH, SIZE_MEDIUM)\n end",
"def thumbnail_dimensions(geometry)\n geometry = geometry.to_s\n width = original_width = self.image_width.to_f\n height = original_height = self.image_height.to_f\n geometry_width, geometry_height = geometry.split(%r{\\#{1,2}|\\+|>|!|x}im)[0..1].map(&:to_f)\n if (original_width * original_height > 0) && ::Dragonfly::ImageMagick::Processor::THUMB_GEOMETRY === geometry\n if ::Dragonfly::ImageMagick::Processor::RESIZE_GEOMETRY === geometry\n if geometry !~ %r{\\d+x\\d+>} || (%r{\\d+x\\d+>} === geometry && (width > geometry_width.to_f || height > geometry_height.to_f))\n # Try scaling with width factor first. (wf = width factor)\n wf_width = (original_width * geometry_width / width).round\n wf_height = (original_height * geometry_width / width).round\n\n # Scale with height factor (hf = height factor)\n hf_width = (original_width * geometry_height / height).round\n hf_height = (original_height * geometry_height / height).round\n\n # Take the highest value that doesn't exceed either axis limit.\n use_wf = wf_width <= geometry_width && wf_height <= geometry_height\n if use_wf && hf_width <= geometry_width && hf_height <= geometry_height\n use_wf = wf_width * wf_height > hf_width * hf_height\n end\n\n if use_wf\n width = wf_width\n height = wf_height\n else\n width = hf_width\n height = hf_height\n end\n end\n else\n # cropping\n width = geometry_width\n height = geometry_height\n end\n end\n\n { :width => width.to_i, :height => height.to_i }\n end",
"def thumbnails\n\n @thumbnails ||= ThumbnailSet.new(self, {\n :small => { :dimensions => { :width => '40', \n :height => '40' }, :crop => true },\n :medium => { :dimensions => { :width => '150',\n :height => '150' }},\n :large => { :dimensions => { :width => '800',\n :height => '800'}, :format => :jpg }\n })\n\n end",
"def resize_image(img, size)\n size = size.first if size.is_a?(Array) && size.length == 1 && !size.first.is_a?(Fixnum)\n if size.is_a?(Fixnum) || (size.is_a?(Array) && size.first.is_a?(Fixnum))\n size = [size, size] if size.is_a?(Fixnum)\n img.thumbnail!(*size)\n elsif size.is_a?(String) && size =~ /^c.*$/ # Image cropping - example geometry string: c75x75\n dimensions = size[1..size.size].split(\"x\")\n img.crop_resized!(dimensions[0].to_i, dimensions[1].to_i)\n elsif size.is_a?(String) && size =~ /^b.*$/ # Resize w/border - example geometry string: b75x75\n dimensions = size[1..size.size].split(\"x\")\n img.change_geometry(dimensions.join(\"x\")) do |cols, rows, image|\n image.resize!(cols<1 ? 1 : cols, rows<1 ? 1 : rows )\n end\n img.background_color = \"black\"\n x_offset = (img.columns - dimensions[0].to_i) / 2\n y_offset = (img.rows - dimensions[1].to_i) / 2\n img = img.extent(dimensions[0].to_i, dimensions[1].to_i, x_offset, y_offset)\n else\n img.change_geometry(size.to_s) { |cols, rows, image| image.resize!(cols<1 ? 1 : cols, rows<1 ? 1 : rows) }\n end\n img.strip! unless attachment_options[:keep_profile]\n temp_paths.unshift write_to_temp_file(img.to_blob)\n end",
"def thumbnail!\n image.recreate_versions! if thumbnail_coordinates_changed?\n end",
"def create_thumbnail(image)\n thumb = ( image.gsub /^#{@dirname}/, \"#{@thumbs}\" ) + @thumbext\n system(\"convert #{image} -thumbnail '#{@size}>' -#{@action} '#{@size}' -background white -quality 60 -gravity center -extent #{@size} #{thumb}\")\n end",
"def old_resize_image(img, size)\n size = size.first if size.is_a?(Array) && size.length == 1 && !size.first.is_a?(Fixnum)\n if size.is_a?(Fixnum) || (size.is_a?(Array) && size.first.is_a?(Fixnum))\n size = [size, size] if size.is_a?(Fixnum)\n img.thumbnail!(*size)\n elsif size.is_a?(String) && size =~ /^c.*$/ # Image cropping - example geometry string: c75x75\n dimensions = size[1..size.size].split(\"x\")\n img.crop_resized!(dimensions[0].to_i, dimensions[1].to_i)\n else\n img.change_geometry(size.to_s) { |cols, rows, image| image.resize!(cols<1 ? 1 : cols, rows<1 ? 1 : rows) }\n end\n self.width = img.columns if respond_to?(:width)\n self.height = img.rows if respond_to?(:height)\n img.strip! unless attachment_options[:keep_profile]\n quality = img.format.to_s[/JPEG/] && get_jpeg_quality\n out_file = write_to_temp_file(img.to_blob { self.quality = quality if quality })\n temp_paths.unshift out_file\n self.size = File.size(self.temp_path)\n end",
"def set_thumbnail\n @thumbnail = Thumbnail.find(params[:id])\n end",
"def thumbnail(sid, opts={})\r\n\r\n maxwidth\t= (opts[:maxwidth] || 128).to_f\r\n maxheight\t= (opts[:maxheight] || 128).to_f\r\n aspectratio\t= maxwidth / maxheight\r\n path\t\t= nil\r\n dest_path\t= nil\r\n pic\t\t= nil\r\n case sid.to_sym\r\n when :photo\r\n path\t\t= self.photo__path\r\n dest_path\t= self.photo__thumb_path\r\n end\r\n pic\t = path ? Magick::Image.read(path).first : Magick::Image.from_blob(pic).first\r\n imgwidth = pic.columns\r\n imgheight = pic.rows\r\n imgratio = imgwidth.to_f / imgheight.to_f\r\n scaleratio= imgratio > aspectratio ? maxwidth / imgwidth : maxheight / imgheight\r\n thumb\t = pic.thumbnail(scaleratio)\r\n thumb.write(dest_path) if dest_path\r\n return thumb.to_blob\r\n end",
"def thumbnail_options\n asset_sizes = thumbnail_sizes.collect{|k,v| \n size_id = k\n size_description = \"#{k}: \"\n size_description << (v.is_a?(Array) ? v.join(' as ') : v)\n [size_description, size_id] \n }.sort_by{|pair| pair.last.to_s}\n asset_sizes.unshift ['Original (as uploaded)', 'original']\n asset_sizes\n end",
"def resize_image uri, options = { }\n\n\t# parse id, mime type from image uri\n\tformat = uri.split('/').last.match(/\\.(.+)$/)[1]\n\tid = uri.split('/').last.sub(/\\..+$/, '').slugify\n\n\t# resize image and save to /tmp\n\timage = Image.read(uri)[0]\n\t\n\t# calculate width/height based on percentage of \n\t# difference of width from absolute value of 150\n\tif options[:width]\n\t\twidth = options[:width]\n\t\tscale = (image.page.width - width) / image.page.width.to_f\n\t\theight = image.page.height - (image.page.height * scale)\n\n\t\timage = image.thumbnail(width, height)\n\t\timage.write(\n\t\t\tpath = \"/tmp/#{id}-constrainedw.#{format}\"\n\t\t)\t\t\n\n\telsif options[:height]\n\t\theight = options[:height]\n\t\tscale = (image.page.height - height) / image.page.height.to_f\n\t\twidth = image.page.width - (image.page.width * scale)\n\n\t\timage = image.thumbnail(width, height)\n\t\timage.write(\n\t\t\tpath = \"/tmp/#{id}-thumbh.#{format}\"\n\t\t)\n\n\telse\n\t\twidth = 150\n\t\tscale = (image.page.width - width) / image.page.width.to_f\n\t\theight = image.page.height - (image.page.height * scale)\n\n\t\timage = image.thumbnail(width, height)\n\t\timage.write(\n\t\t\tpath = \"/tmp/#{id}-thumb.#{format}\"\n\t\t)\n\n\tend\n\n path\nend",
"def make_thumbnails\n return true unless defined?(IMAGEMAGICK_CONVERT) && is_local?\n system(\"#{IMAGEMAGICK_CONVERT} -resize #{THUMBNAIL_SIZE} #{filename} #{filename('s')}\")\n true\n end",
"def display_image\n image.variant resize_to_limit: Settings.validation.post.img_resize\n end",
"def thumbnail_height\n\t\t\t@data[\"thumbnail\"][\"height\"] if @data[\"thumbnail\"]\n\t\tend",
"def scale_to(new_size, background:background)\n new_size = SugarCube::CoreGraphics::Size(new_size)\n\n image_size = self.size\n\n if CGSizeEqualToSize(image_size, new_size)\n return self\n end\n\n new_image = nil\n width = image_size.width\n height = image_size.height\n\n target_width = new_size.width\n target_height = new_size.height\n\n scale_factor = 0.0\n scaled_width = target_width\n scaled_height = target_height\n\n thumbnail_point = CGPoint.new(0.0, 0.0)\n width_factor = target_width / width\n height_factor = target_height / height\n\n if width_factor < height_factor\n scale_factor = width_factor\n else\n scale_factor = height_factor\n end\n\n scaled_width = width * scale_factor\n scaled_height = height * scale_factor\n\n # center the image\n\n if width_factor < height_factor\n thumbnail_point.y = (target_height - scaled_height) * 0.5\n elsif width_factor > height_factor\n thumbnail_point.x = (target_width - scaled_width) * 0.5\n end\n\n # this is actually the interesting part:\n\n UIGraphicsBeginImageContextWithOptions(new_size, false, self.scale)\n\n if background\n background = background.uicolor\n context = UIGraphicsGetCurrentContext()\n background.setFill\n CGContextAddRect(context, [[0, 0], new_size])\n CGContextDrawPath(context, KCGPathFill)\n end\n\n thumbnail_rect = CGRectZero\n thumbnail_rect.origin = thumbnail_point\n thumbnail_rect.size.width = scaled_width\n thumbnail_rect.size.height = scaled_height\n\n self.drawInRect(thumbnail_rect)\n\n new_image = UIGraphicsGetImageFromCurrentImageContext()\n UIGraphicsEndImageContext()\n\n raise \"could not scale image\" unless new_image\n\n return new_image\n end",
"def extract_thumb(input, output, width, height)\n Image::Editing::ResizeToFill.new(input, output, width, height).run\n end",
"def display_image\n image.variant(resize_to_limit: [500,500])\n end",
"def do_resize(height = THUMBNAIL_HEIGHT, width = THUMBNAIL_WIDTH)\n #MES- Only do thumbnailing if the Image Magick library can be loaded.\n # This is to make setup easier for other developers- they are not\n # required to have Image Magick.\n # More information on Image Magick is available at \n # http://studio.imagemagick.org/RMagick/doc/usage.html\n if RMAGICK_SUPPORTED\n #MES- Turn the blob into an ImageMagick object\n img = Magick::Image.from_blob(data).first\n if img.nil?\n logger.info \"Failed to resize image #{self.name}- unable to create RMagick wrapper for image\"\n return nil\n end\n \n #MES- Shrink the image\n return img.crop_resized(width, height)\n else\n return nil\n end\n end",
"def large_image_width\n 850\n end",
"def display_image\n image.variant(resize_to_limit: [500, 500])\n end",
"def display_image\n image.variant(resize_to_limit: [500, 500])\n end",
"def display_image\n image.variant(resize_to_limit: [500, 500])\n end",
"def display_image\n image.variant(resize_to_limit: [500, 500])\n end",
"def display_image\n image.variant(resize_to_limit: [500, 500])\n end",
"def display_image\n image.variant(resize_to_limit: [500, 500])\n end",
"def quick_thumbnail(how, what)\n if how == :pos\n if what.is_a? Fixnum\n what = [0, what]\n end\n end\n QuickThumbnail.new(self, how, what, parent_widget, window_id, :thumbnail)\n end",
"def set_offer_image_dimensions\n if offer_image.queued_for_write[:full_size]\n geometry = Paperclip::Geometry.from_file(offer_image.queued_for_write[:full_size])\n self.offer_image_width = geometry.width\n self.offer_image_height = geometry.height\n end\n end",
"def thumb_height\n ( SysConf.value_for('logo_thumb_height') || 65 ).to_i\n end",
"def create_attachment_thumbnails\n attachment_options[:thumbnails].each { |suffix, size| create_thumbnail(suffix, size) } unless attachment_options[:thumbnails].blank? || parent_id\n end",
"def thumbnail_impl(from_path, size='large') # :nodoc:\n from_path = format_path(from_path, false)\n\n raise DropboxError.new(\"size must be small medium or large. (not '#{size})\") unless ['small','medium','large'].include?(size)\n\n params = {\n \"size\" => size\n }\n\n url = build_url(\"/thumbnails/#{@root}#{from_path}\", params, content_server=true)\n\n @session.do_get url\n end",
"def cut_to_fit(options)\n %Q{-thumbnail #{options.width}x#{options.height}^ \\\n -gravity #{options.gravity} \\\n -unsharp 0x.5 \\\n -auto-orient \\\n -extent #{options.width}x#{options.height}}\n end",
"def thumbnail_params\n params.require(:thumbnail).permit(:title, :body, :main_image, :thumb_image)\n end",
"def thumbnail_path\n \"t_\" + image_path\n end",
"def thumbnail_height\n\t\t\t@data[\"thumbnail\"][\"height\"]\n\t\tend",
"def custom_thumbnail_image_for(drive_thumbnail_link, custom_width)\n file_url, current_width = drive_thumbnail_link.split(/=s/)\n \"#{ file_url }=s#{ custom_width }\"\n end",
"def thumbnail_builder\n ::ManifestBuilder::ThumbnailBuilder\n end",
"def resize_image(img, size)\n size = size.first if size.is_a?(Array) && size.length == 1\n if size.is_a?(Fixnum) || (size.is_a?(Array) && size.first.is_a?(Fixnum))\n if size.is_a?(Fixnum)\n # Borrowed from image science's #thumbnail method and adapted \n # for this.\n scale = size.to_f / (img.width > img.height ? img.width.to_f : img.height.to_f)\n img.resize!((img.width * scale).round(1), (img.height * scale).round(1), false)\n else\n img.resize!(size.first, size.last, false) \n end\n else\n w, h = [img.width, img.height] / size.to_s\n img.resize!(w, h, false)\n end\n temp_paths.unshift random_tempfile_filename\n self.size = img.export(self.temp_path)\n end",
"def thumb\n return if collection?\n\n encoded_thumb if %w[book image manuscript map webarchive-seed].include?(dor_content_type)\n end",
"def resize_to(width, height); end",
"def resize!\n end",
"def create_resized_image\n create_image do |xfrm|\n if size\n MiniMagick::Tool::Convert.new do |cmd|\n cmd << xfrm.path # input\n cmd.flatten\n cmd.resize(size)\n cmd << xfrm.path # output\n end\n end\n end\n end",
"def create_thumbnail\n return unless self.content.has_content?\n\n if video?\n create_video_thumbnail\n elsif pdf?\n create_pdf_thumbnail\n else\n create_derivatives\n end\n self.save\n end",
"def thumbnail\r\n\t\tbegin\r\n\t\t\t@image = Image.find(params[:id])\r\n\t\trescue ActiveRecord::RecordNotFound\r\n\t\t\trender :text => \"Image ##{params[:id].to_s} not found\"\r\n\t\telse\r\n\t\t\t# Can probably replace this with a call to to_sym(), but why fix what ain't broke?\r\n\t\t\tscaling_mode = case params[:mode]\r\n\t\t\twhen 'stretch' then :stretch\r\n\t\t\twhen 'fit' then :fit\r\n\t\t\twhen 'crop' then :crop\r\n\t\t\telse :fit\r\n\t\t\tend\r\n\t\t\t@thumbnail = @image.thumbnail(params[:width], params[:height], scaling_mode)\r\n\t\t\tif @thumbnail.kind_of? Thumbnail\r\n\t\t\t\tsend_data(@thumbnail.data,\r\n\t\t\t\t\t:filename => @thumbnail.filename,\r\n\t\t\t\t\t:type => @thumbnail.content_type,\r\n\t\t\t\t\t:disposition => 'inline')\r\n\t\t\telse\r\n\t\t\t\trender :text => @thumbnail.inspect\r\n\t\t\tend\r\n\t\tend\r\n\tend",
"def thumb_url\n image.url(:thumbnail)\n end",
"def thumb_url\n image.url(:thumbnail)\n end",
"def image_dimensions\n {\n thumbnail: 'square/100,100/0/default.jpg',\n default: 'full/80,80/0/default.jpg',\n medium: 'full/125,125/0/default.jpg',\n large: 'full/!400,400/0/default.jpg'\n }\n end",
"def thumbnail_url\n @thumbnail_url ||= Thumbnail.new(self).url\n end",
"def create_thumbnail(source, target)\n command_exec(:create_thumbnail, [quote(source), quote(target)])\n end",
"def resize(path, image, size)\n Rails.logger.warn \"resize method\"\n return false if size.split('x').count!=2\n Rails.logger.warn \"before File.exists? check: #{size.split('x').count}\"\n return false if !File.exists?(File.join(path))\n\n Rails.logger.warn \"before mkdir: #{path}/#{id}\"\n FileUtils.mkdir_p \"#{path}/thumbnails/#{id}\" if !File.exists?(File.join(path, 'thumbnails', id.to_s))\n\n image_original_path = \"#{path}/#{image}\"\n image_resized_path = \"#{path}/thumbnails/#{id}/#{size}_#{image}\"\n\n width = size.split('x')[0]\n height = size.split('x')[1]\n\n Rails.logger.warn \"Magick::Image.read(#{image_original_path})\"\n begin\n i = Magick::Image.read(image_original_path).first\n Rails.logger.warn \"before i.resize_to_fit\"\n i.resize_to_fit(width.to_i,height.to_i).write(image_resized_path)\n rescue Exception => e\n Rails.logger.error e\n end\n\n true\n end",
"def image_sizes\n { :small => 'x110',\n :medium => 'x208',\n :large => 'x413',\n :big => 'x654',\n :storage => 'x867'\n }\n end",
"def generate_thumbnail(image_path, commit_id)\n Gg::ImageProcessing.new(\"#{satellitedir}/#{image_path}\")\n .generate(image_for(commit_id, 'thumbnails'), 'thumbnail')\n end",
"def assign_thumbnail_class_to_attachment_class\n @thumbnail_class = @options[:thumbnail_class] || @klass.const_set(:Thumbnail, Class.new(@klass))\n if @thumbnail_class.is_a?(String) ; @thumbnail_class = @thumbnail_class.constantize; end\n th_task = self\n\n # create thumbnails association\n @klass.class_eval do\n unless reflect_on_association(:thumbnails)\n has_many th_task.options[:thumbnails_association], :class_name => \"::#{base_class.name}\", :foreign_key => th_task.options[:parent_foreign_key], :dependent => :destroy\n end\n end\n\n # modify a thumbnail class to be used as the thumbnail for this attachment\n @thumbnail_class.class_eval do\n # The attachment ID used in the full path of a file\n def attachment_path_id\n parent_id\n end\n\n unless reflect_on_association(:parent)\n belongs_to th_task.options[:parent_association], :class_name => \"::#{th_task.klass.base_class.name}\", :foreign_key => th_task.options[:parent_foreign_key]\n end\n\n validates_presence_of th_task.options[:parent_foreign_key]\n\n # ensure that the thumbnails task is not carried over to the thumbnail class,\n # and also ensure that get_image_size is the first task.\n attachment_tasks do\n load :resize\n unqueue :thumbnails, :get_image_size\n prepend :get_image_size, :with => th_task.options[:with]\n end\n end\n\n @thumbnail_class_processed = true\n end",
"def image_size\n end",
"def cropped_thumbnail(size) # :yields: image\n w, h = width, height\n l, t, r, b, half = 0, 0, w, h, (w - h).abs / 2\n\n l, r = half, half + h if w > h\n t, b = half, half + w if h > w\n\n with_crop(l, t, r, b) do |img|\n img.thumbnail(size) do |thumb|\n yield thumb\n end\n end\n end",
"def image_width\n end",
"def resize_picture picture_owner, path, filename_extension\n\n # if filename_extension == 'jpg'\n resize_factor = \"PICTURE_#{picture_owner.upcase}_PREVIEW_SIZE\".constantize.first # e.g. *PICTURE_COACH_PREVIEW_SIZE*\n system \"convert #{path}/original.#{filename_extension} -resize '#{resize_factor}' #{path}/preview.#{filename_extension}\"\n\n resize_factor = \"PICTURE_#{picture_owner.upcase}_VIEW_SIZE\".constantize.first # e.g. *PICTURE_COACH_VIEW_SIZE*\n system \"convert #{path}/original.#{filename_extension} -resize '#{resize_factor}' #{path}/view.#{filename_extension}\"\n # else\n # # for logo file: just symbol links to original one (nothing to resize)\n # system \"ln -s #{path}/original.#{filename_extension} #{path}/preview.#{filename_extension}\"\n # system \"ln -s #{path}/original.#{filename_extension} #{path}/view.#{filename_extension}\"\n # end\n # Thumb is and in Africa thumb\n resize_factor = \"PICTURE_#{picture_owner.upcase}_THUMB_SIZE\".constantize.first # e.g. *PICTURE_COACH_THUMB_SIZE*\n system \"convert #{path}/original.#{filename_extension} -resize '#{resize_factor}' #{path}/thumb.#{filename_extension}\"\n\n end",
"def thumbnail(geometry = nil)\n if geometry.is_a?(Symbol) and Refinery::Images.user_image_sizes.keys.include?(geometry)\n geometry = Refinery::Images.user_image_sizes[geometry]\n end\n\n if geometry.present? && !geometry.is_a?(Symbol)\n image.thumb(geometry)\n else\n image\n end\n end",
"def create_resized_image\n create_image do |xfrm|\n if size\n xfrm.flatten\n xfrm.resize(size)\n end\n end\n end",
"def thumbnail_for(user, size)\n if user.photos.any?\n if size == \"small\"\n image_tag user.photos.first.image.url(:small), alt: user.name, width: \"50\", height: \"50\"\n else\n image_tag user.photos.first.image.url(:avator), alt: user.name, width: \"200\", height: \"150\"\n end \n else\n default_gender_image(user,size)\n end\n end",
"def thumbnail\n \tobject.file.url(:thumb)\n end",
"def store_image_dimensions_for_cropping\n save_attached_files # make sure Paperclip stores the files before this callback is executed\n if file.exists?\n img = ThumbMagick::Image.new(file.path('tocrop'))\n w,h = img.dimensions\n self.resize = 1\n self.crop_w = w\n self.crop_h = h\n self.crop_x = self.crop_y = 0\n save_without_versioning\n latest_version.update_attributes(:resize => resize, :crop_w => crop_w, :crop_h => crop_h, :crop_x => 0, :crop_y => 0)\n end\n end",
"def set_thumbnail\n dir_name = File.dirname(@path)\n\n if File.exists?(dir_name + '/thumbnails/' + @file_name)\n @thumbnail = dir_name + '/thumbnails/' + @file_name\n @relative_thumbnail_path = @thumbnail.sub(Home::CONTENT_ROOT_DIRECTORY_REGEXP, '')\n else\n @thumbnail = @path\n @relative_thumbnail_path = @relative_path\n end\n end",
"def resize(width, height); end",
"def save_image_dimensions\n if data.content_type == \"image/jpeg\" || \"image/png\" || \"image/jpg\" || \"image/gif\"\n geo = Paperclip::Geometry.from_file(data.queued_for_write[:original])\n self.width = geo.width\n self.height = geo.height\n end\n end",
"def small(input) # Method that returns the image\n self.images[input].variant(resize: \"300x300\").processed # Resizing the image and return it\n end",
"def resize_image(params)\n # The path of the image\n path = \"public/images/#{params[1]}/#{@tempo.id}_#{params[1]}.#{params[0]}\"\n # Read the image\n img = Magick::Image.read(\"public/images/original/#{@original_image_name}\").first\n # Resize and Crop the image\n target = Magick::Image.new(params[2], params[3])\n thumb = img.resize_to_fill!(params[2], params[3])\n target.composite(thumb, Magick::CenterGravity, Magick::CopyCompositeOp).write(path)\n # Insert the width and height into an object\n @tempo.width, @tempo.height = \"#{params[2]}\", \"#{params[3]}\"\n # Add the link and tags to its DB\n add_linkID_tagsID(path,params[1])\n # Delete the image after uploading it to the storage\n File.delete(path)\n end",
"def set_original\n if keep_original\n if size_o.blank?\n image = MiniMagick::Image.open(name)\n self.size_o = \"#{image.width}x#{image.height}\"\n end\n else\n self.size_o = ''\n end\nend",
"def thumb (size = '80x80#')\n if web_image?\n # Although Dragonfly is not thread-safe, since this operation likely has\n # no side-effects, we don't place it within a critical section.\n # TODO Ensure Dragonfly processing works with multiple threads\n Dragonfly.app.fetch_url(access_url).thumb(size).url\n else\n 'http://placehold.it/40?text=No+Image';\n end\n end",
"def resize_pic(filename,resizewidth,out_path)\n nw = resizewidth\n n = File.basename(filename)\n i = QuickMagick::Image.read(filename).first\n w = i.width.to_f # Retrieves width in pixels\n h = i.height.to_f # Retrieves height in pixels\n pr = w/h\n nh = nw/pr \n i.resize \"#{nw}x#{nh}!\"\n i.save \"#{out_path}/#{n}\"\nend",
"def set_image_size(file = local_file_name(:full_size))\n w, h = FastImage.size(file)\n return unless /^\\d+$/.match?(w.to_s)\n\n self.width = w.to_i\n self.height = h.to_i\n save_without_our_callbacks\n end",
"def getthumbnail\n @trek = Trek.find params[:id]\n if @trek.nil?\n redirect_to treks_path, :alert => \"Trek not found.\"\n end\n fname = params[\"name\"]+\".\"+params[\"format\"]\n thumb_path = @trek.get_thumbnail(fname)\n if thumb_path.nil?\n img = Magick::Image.read(@trek.get_img_path(fname)).first\n thumb = img.resize_to_fill(75, 75)\n thumb.write(@trek.get_processed_path + \"/\" + fname)\n send_data thumb.to_blob, :type => \"image/jpeg\", :disposition => \"inline\"\n else\n send_file thumb_path, :type => \"image/jpeg\", :disposition => \"inline\"\n end\n end",
"def resize(width, height)\n end"
] |
[
"0.8350897",
"0.7682651",
"0.75983894",
"0.75393814",
"0.7445365",
"0.73863333",
"0.73693365",
"0.71127594",
"0.7040139",
"0.7033831",
"0.7029926",
"0.69692695",
"0.69013536",
"0.6894124",
"0.68636084",
"0.6832816",
"0.6830081",
"0.6827806",
"0.68221",
"0.68144923",
"0.67927784",
"0.67571324",
"0.6718138",
"0.67091364",
"0.66846704",
"0.6682025",
"0.66730714",
"0.6654811",
"0.6653856",
"0.66324973",
"0.66240966",
"0.6613399",
"0.66098267",
"0.6557442",
"0.6555393",
"0.6553852",
"0.6550691",
"0.651636",
"0.65136135",
"0.65020066",
"0.6454286",
"0.6435766",
"0.6425135",
"0.64149123",
"0.641103",
"0.6401555",
"0.63806367",
"0.6378385",
"0.6348573",
"0.6348573",
"0.6348573",
"0.6348573",
"0.6348573",
"0.6348573",
"0.6346935",
"0.6342771",
"0.63297606",
"0.63295037",
"0.63294476",
"0.6328055",
"0.632282",
"0.6310643",
"0.63081366",
"0.6303654",
"0.6295793",
"0.6283577",
"0.62814265",
"0.6263858",
"0.62634766",
"0.625557",
"0.6253745",
"0.6236195",
"0.62349486",
"0.62349486",
"0.62311786",
"0.62271184",
"0.6214466",
"0.6201817",
"0.6201694",
"0.61901027",
"0.6185332",
"0.61818004",
"0.6146594",
"0.6138506",
"0.6136441",
"0.6135903",
"0.613239",
"0.6126461",
"0.6125195",
"0.6106576",
"0.6105276",
"0.6104168",
"0.61034876",
"0.6101364",
"0.60966223",
"0.609633",
"0.6095482",
"0.60839975",
"0.6082678",
"0.6064346",
"0.6061108"
] |
0.0
|
-1
|
puts "this is a debug message"
|
def solution(a)
# write your code in Ruby 2.2
left, right = 0, a.reduce(:+)
min = 0
(1...a.size).to_a.each do |i|
left = left + a[i-1]
right = right - a[i-1]
diff = (left - right).abs
if i == 1
min = diff
else
min = diff < min ? diff : min
end
end
min
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def debug(msg)\n #puts msg\n end",
"def debug(s)\n\t#puts \"DEBUG: #{s}\"\nend",
"def print_debug(msg)\n puts msg if (@debug) \n STDOUT.flush\n end",
"def debug(message)\n puts message if debug?\n end",
"def debug(s) if $DEBUG then $stderr.print(\"#{s}\\n\") end end",
"def debug_msg( str )\n puts str if @debug == true\n end",
"def debug string\n puts string if $DEBUG\nend",
"def debug(text)\n\t\t\tputs text\n\t\t\tnil\n\t\tend",
"def debug(msg)\n $stderr.puts(\"DEBUG: #{msg}\") if $options['verbose']\nend",
"def debug(msg)\n $stderr.puts(\"DEBUG: #{msg}\") if $options['verbose']\nend",
"def debug(msg)\n $stderr.puts(\"DEBUG: #{msg}\") if $options['verbose']\nend",
"def debug(message)\n $stderr.puts(message) if @options[:debug]\nend",
"def debug(msg = \"\")\n puts \"\\n\\n\\n\"\n puts \" DEBUGGING \".white.on_red\n puts msg\n puts \"\\n\\n\\n\"\n exit\n end",
"def dprint(s)\n print s if $DEBUG\nend",
"def debug_msg msg\n puts msg if @options[:debug]\n end",
"def puts_debug(msg)\r\n if (self.debug) \r\n puts msg\r\n end # end debug\r\n end",
"def puts_debug(msg)\r\n if (self.debug) \r\n puts msg\r\n end # end debug\r\n end",
"def debug(msg)\n STDERR.puts msg if @debug\n end",
"def debug(message)\n puts \"#{Time.now.strftime(\"%H:%M:%S.%L\")} - \\t#{message}\" if DEBUG\nend",
"def debug1(text) debug text, 1 end",
"def say(word)\n require 'debug'\n puts word + ' to begin debugging.'\nend",
"def debug(stuff)\n puts \"DEBUG: #{stuff}\"\nend",
"def print_debug(s)\n config = BeEF::Core::Configuration.instance\n if config.get('beef.debug') || BeEF::Core::Console::CommandLine.parse[:verbose]\n puts Time.now.localtime.strftime(\"[%k:%M:%S]\")+'[>]'.yellow+' '+s.to_s\n end\nend",
"def debug_msg(msg=\"\")\n if(@config.debug)\n puts(\"Debug: #{msg}\")\n @file.puts(\"Debug: #{msg}\")\n end\n end",
"def debug(message)\n $stdout.puts \"D #{message}\" if @debug\n end",
"def debug(message)\n stdout.print(\"#{message}\\n\") if ENV['DEBUG']\n end",
"def debug(str)\n $stderr.puts(str) if @debug\n end",
"def debug_msg(msg)\n if(@options[:debug])\n @log.puts(msg)\n puts msg\n end\nend",
"def say_debug(message)\n puts yellow(message) if self.debug\n end",
"def puts(*strs); $stdout.puts(*strs) if ENV['DEBUG'] end",
"def debug_log( arg )\r\n print('DEBUG: ')\r\n puts (arg)\r\nend",
"def log(s)\n puts \"[Debug]: #{s}\"\nend",
"def log(s)\n puts \"[Debug]: #{s}\"\nend",
"def debug(msg)\n STDERR.puts msg if options.key? :debug\n end",
"def output_debug(string)\n if Command.ui\n Command.ui.debug string\n else\n $stderr.puts \"DEBUG: #{string}\"\n end\n end",
"def dputs str=\"\"\n\t\tputs str if debug?\n\tend",
"def debug(message)\n ostream.puts message if $DEBUG\n end",
"def debug (msg = \"\")\n if Object.const_defined?('Puppet')\n Puppet.debug msg\n else\n if ENV['FACTER_DEBUG'] == 'true'\n $stdout.puts msg\n $stdout.flush\n end\n end\nend",
"def dprint(str)\n if ANSIBLE_DEBUG\n print str\n end\nend",
"def debug(message)\n logger.debug(PROG_NAME) { message }\n end",
"def debug_msg( *msg )\n\t\treturn unless $DEBUG\n\t\t$stderr.puts( *msg )\n\tend",
"def debug_msg( *msg )\n\t\treturn unless $DEBUG\n\t\t$stderr.puts( *msg )\n\tend",
"def debug(*args); puts(*args) if $test; end",
"def debug(message) ; @log.debug(message) ; end",
"def debug(info)\n puts(info) if @debug\n end",
"def debug(message)\n return if quiet?\n say('[DEBUG] ' + message, :yellow) if $DEBUG\n end",
"def debug(msg)\n puts \"[watchr debug] #{msg}\" if options.debug\n end",
"def debugMsg( msg )\n\treturn unless $DEBUG\n\t$stderr.print \"#{msg}\\n\"\nend",
"def dmsg(msg)\n if $DEBUG\n case msg\n when String\n puts msg\n else\n puts msg.inspect\n end\n end\n end",
"def dmsg(msg)\n if $DEBUG\n case msg\n when String\n puts msg\n else\n puts msg.inspect\n end\n end\n end",
"def dmsg(msg)\n if $DEBUG\n case msg\n when String\n puts msg\n else\n puts msg.inspect\n end\n end\n end",
"def debug(msg) log(7, msg); end",
"def dputs(message)\n puts message\nend",
"def debug; end",
"def debug; end",
"def debug; end",
"def debug; end",
"def debug (what)\n ap what\n exit 2\nend",
"def dbg(msg, msgLevel = 1)\n\tif $options['debug'] >= msgLevel then\n\t\tputs \"#{msg}\"\n\tend\nend",
"def dbg(msg, msgLevel = 1)\n\tif $options['debug'] >= msgLevel then\n\t\tputs \"#{msg}\"\n\tend\nend",
"def debug(message)\n if DEBUG\n log message\n end\nend",
"def debug(msg)\n end",
"def puts_debug(*print_string)\n debug_code = true\n puts *print_string if debug_code\n end",
"def debug_out(debmsg)\n if $gDebug \n puts debmsg\n end\n if ($gTest_params[\"logfile\"])\n $fLOG.write(debmsg)\n end\nend",
"def debug(message)\n log(0, message)\n end",
"def debug_out(debmsg)\n if $gDebug\n puts debmsg\n end\n if ($gTest_params[\"logfile\"])\n $fLOG.write(debmsg)\n end\nend",
"def debug (msg = \"\")\n if Object.const_defined?('Puppet')\n Puppet.debug 'facter(extra_modulepath):'+msg\n else\n if ENV['FACTER_DEBUG'] == 'true'\n $stdout.puts msg\n $stdout.flush\n end\n end\nend",
"def debug!\n @client.debug_dev = STDOUT\n end",
"def debug(message)\n warn \"==== VLO DEBUG: \" + message if ENV[\"VLO_DEBUG\"] == 'true'\nend",
"def debug(text)\n puts \"#{text}\".foreground(:yellow)\n end",
"def debug(message = nil, progname = nil, &block)\n add(DEBUG, message, progname, &block)\n end",
"def debug( msg )\n puts Time.now.strftime(\"- %I:%M%p: \") + msg if @debug\nend",
"def debug_puts(puts_text)\n if Debug_Mode == true\n puts \"#{puts_text}\"\n end\n end",
"def debug(d)\n ap d\n puts\n exit 2\nend",
"def debug(msg)\n log.debug msg\n end",
"def debug(*args); end",
"def debug(*args); end",
"def debug(*args); end",
"def INFO(msg)\n if DEBUG\n puts \"INFO: \" + msg\n end\nend",
"def debug(*info)\n puts(info) if debug_mode?\n end",
"def debug(*text)\n if configuration.debug\n channel.write(\"command\" => \"debug\", \"text\" => text.join, \"on\" => on)\n end\n end",
"def debug_print(output, debug)\n\tif debug\n\t\tputs \"[*] #{output}\".red\n\tend\nend",
"def debug(str, ret = false)\r\n puts str if @debug\r\n return ret\r\n end",
"def debug(message = \"\", level = 5)\n if $config[:global][:verboselevel] and $config[:global][:verboselevel] >= level\n puts message \n\t\t#logger.info(message)\n Syslog.info(message)\n end\nend",
"def debug_print(returnedData, debug=\"false\")\n if debug == \"true\" then\n puts \"\\r\\n[DEBUG]\\r\\n\"\n pp(returnedData) \n end\nend",
"def debug(msg=nil)\n log \"DEBUG: #{msg}\" if $debug\n end",
"def debug(msg)\n return unless Fizzy::CFG.debug\n caller_info = caller\n .map { |c| c[/`.*'/][1..-2].split(\" \").first }\n .uniq[0..2]\n .join(\" → \")\n tell \"{m{⚫}}#{✏ caller_info, %w({b{<}} {b{>}})}{w{: #{msg}}}\"\n end",
"def debug_message(message)\n logger.debug \"**** - #{message}\"\n end",
"def debug(msg); @logger.debug(msg); end",
"def debug(msg, &block)\n result = yield\n puts \"-- #{msg} #{'-' * (74 - msg.length)}\" if $debug\n result\n end",
"def debug(msg) #:doc:\r\n if have_hook?(:on_debug)\r\n sync { self.class.debug msg }\r\n end\r\n end",
"def debug( msg )\n puts Time.now.strftime(\"- %I:%M%p: \") + msg\nend",
"def debug(msg, thread = nil)\n return nil unless $opt[:debug]\n function = (thread ? \"#{thread}.\" : '') + \\\n (caller[0][/`.*'/] ? caller[0][/`.*'/][1..-2].split(' ').last : 'core');\n puts \"#{function}#{(function.split(/\\.([^.]*)$/).last == 'core' ? '' : '()')}: #{msg}\".white\nend",
"def debug(msg) log(DEBUG, \"DEBUG \" << format(msg) << \", \" << caller[0][caller[0].rindex(\"/\").nil? ? 0 : caller[0].rindex(\"/\") + 1 .. -1]); end",
"def debug message; write DEBUG, message, caller[0] unless level > @level end",
"def debug(*args)\n $stderr.puts(sprintf(*args)) if @debug\n end",
"def debug(message)\n Edurange.logger.debug message\n end",
"def debug()\n # =========================================\n # DEBUG CODE FOR STEPPING\n # =========================================\n puts \"Curr char is: #{@curr_char}\"\n puts \"PC direction is: #{@curr_direction}\"\n puts \"Stack contents are: #{@stack}\"\n puts \"Skip is: #{@skip}\"\n puts \"Ascii_Mode is: #{@ascii_mode}\"\n prompt()\n STDIN.gets\n\n # =========================================\n # END DEBUG CODE\n # =========================================\n\n end",
"def write_debug( f )\n f.puts( $debug_buf )\n $debug_buf = \"\"\nend",
"def log_debug(message)\n Rails.logger.debug message\n puts message\n end",
"def debug?; end"
] |
[
"0.8406359",
"0.8268479",
"0.8211071",
"0.8138492",
"0.8107914",
"0.80671936",
"0.8004696",
"0.79987866",
"0.7975501",
"0.7975501",
"0.7975501",
"0.79284",
"0.78572273",
"0.78488684",
"0.7837523",
"0.7821288",
"0.7821288",
"0.7792199",
"0.7773948",
"0.7743215",
"0.7739327",
"0.77392334",
"0.77125454",
"0.7705425",
"0.77030075",
"0.7674084",
"0.7641472",
"0.7635617",
"0.76122314",
"0.7607222",
"0.7596653",
"0.7568291",
"0.7568291",
"0.75627065",
"0.7561845",
"0.7530402",
"0.75142545",
"0.7486465",
"0.74476266",
"0.7398443",
"0.7392124",
"0.7392124",
"0.7389751",
"0.7387766",
"0.73778945",
"0.7370045",
"0.73463976",
"0.73165655",
"0.7307878",
"0.7307878",
"0.7307878",
"0.7284727",
"0.7256834",
"0.72515905",
"0.72515905",
"0.72515905",
"0.72515905",
"0.7217113",
"0.7215761",
"0.7215761",
"0.7214241",
"0.7198336",
"0.7160688",
"0.715579",
"0.7149819",
"0.7127787",
"0.7125443",
"0.7106233",
"0.7096052",
"0.70934",
"0.7091538",
"0.7090718",
"0.7090086",
"0.7079579",
"0.70742637",
"0.7066664",
"0.7066664",
"0.7066664",
"0.70518154",
"0.7034283",
"0.70034087",
"0.70024234",
"0.6998635",
"0.6988879",
"0.69563323",
"0.6950195",
"0.69494313",
"0.6936724",
"0.6933031",
"0.69299227",
"0.69211537",
"0.69192326",
"0.6914229",
"0.6912095",
"0.69106394",
"0.6900422",
"0.68945295",
"0.6875811",
"0.68720067",
"0.68642783",
"0.6842386"
] |
0.0
|
-1
|
method to extract minors
|
def minor(m,i)
n = m.length
mb = m[1..-1]
mb.map{|row| row.first(i) + row[i+1..n-1]}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def minions\r\n @minions.list\r\n end",
"def extract_min\n extract_key = peek_min.key\n min_head = new_heap_from_children\n remove_min_from_heap\n\n # Union\n @head = union(self, BinomialHeap.new(min_head))\n h_next = head.sibling\n consolidate(head, h_next)\n # get new @min\n\n extract_key\n end",
"def get_mines(positions)\n positions.select { |pos| mine?(pos) }\n end",
"def min() end",
"def minima\n return Features.minima(@data)\n end",
"def get_all_mines\n\t\tall_mines = []\n\t\t@board.flatten.each do |square|\n\t\t\tall_mines << square.coords if square.mine == true\n\t\tend\n\t\tall_mines\n\tend",
"def minionList\n self['minions'].transform_values {|v| v.pub_key }\n end",
"def get_min()\n end",
"def extract_min\n @nodes.shift.tap do\n # Move the last node to the root position and then heapify down\n @nodes.unshift @nodes.pop unless @nodes.size.zero?\n heapify_down\n end\n end",
"def minimize; end",
"def initial_mineral_spots\n starcraft.units.minerals.select do |u|\n u.distance_to(player.command_centers.first) < 9.build_tiles\n end\n end",
"def get_mineral_list\n # Mineral http://www.wowdb.com/search.aspx?browse=5.-1\n if @@minerals.length == 0\n minerals = search_list(\"5.-1\")\n minerals.each do |m|\n if not m[:skill].nil? and m[:skill] > 0\n @@minerals[m[:name]] = m[:id]\n end\n end\n end\n return @@minerals\n end",
"def extract_min\n prev = min.l\n post = min.r \n \n # concat children to root list\n # min_child_head = min_child_tail = min.child\n mch = mct = min.child\n if mch\n mch.parent = nil\n # link prev to min's first child\n # if prev = nil, then root_head == min so set root_head to next root. \n if prev\n prev.right = mch \n mch.left = prev\n else\n @root_head = mch\n end\n else\n # if prev = nil, then root_head == min so set root_head to next root.\n prev ? prev.right = post : @root_head = root_head.right\n end \n\n # link post to min's rightmost child.\n # if post does not exist, child list have been linked to root list so do nothing.\n if mct\n mct = mct.r while mct.r && mct.r.parent == min\n mct.parent = nil\n if post\n post.left = mct\n mct.right = post\n end\n else\n post.left = prev if post\n end\n\n consolidate\n @min = nil\n @size -= 1\n get_min\n end",
"def extract_tokens(holders,min,max)\n #puts \"Getting from #{holders.collect{|h| h.name}.inspect}\"\n min_free = holders.min_by {|h| h.token}.token\n if min_free < min\n return 0\n else\n dispatch = [min_free,max].min\n holders.each do |holder|\n holder.consume_token(dispatch)\n end\n return dispatch\n end\n end",
"def my_min(list)\r\n smaller_ele = []\r\n list.each do |ele1|\r\n list.each do |ele2|\r\n smaller_ele << [ele1,ele2].min \r\n end\r\n end\r\n return smaller_ele.min\r\nend",
"def calculate_min_slots(matrix)\n output = []\n @sums.each.with_index do |e, i|\n if e == @min\n output << i\n end\n end\n #require 'pry';binding.pry\n output\n end",
"def getMinPopulation(csa)\n population1 = Float::INFINITY\n @@parse.map{ |airport| \n if( airport[\"name\"] == csa) \n airport[\"destinations\"].map do |element,i|\n code = getCode(element[\"ports\"], airport[\"code\"])\n population2 = getPopulation(code, graph) \n if(population2<population1)\n population1 = population2\n end\n end\n \n puts \"The City with Min population is : \" + getPopulationCity(population1, graph)\n end\n \n }\n end",
"def min; end",
"def min; end",
"def findMin(temp_set)\n min_n = nil\n min_d = \"INF\"\n $dist.each do |node, dist|\n if isSmaller(dist, min_d) and !(temp_set.include? node)\n min_d = dist\n min_n = node\n end\n end\n return min_n\nend",
"def min\n end",
"def min\n end",
"def extract_singles(obs)\n obs\nend",
"def player_card_minors(_player)\n []\n end",
"def find_min()\r\n self.min\r\n end",
"def min\n @nodes.first\n end",
"def get_min()\n @min \n end",
"def mergeable_entities\n available_mines = if target_mines.empty?\n @game.mergeable_private_mines(buyer).select { |m| m.owner == owner }\n else\n @game.mergeable_private_mines(buyer) - [target_mines.first[:mine]]\n end\n\n if @game.turn == 1 && target_mines.empty?\n available_mines.select { |m| m == @game.mine_12 }\n elsif @game.corporation_info[buyer][:vor_harzer]\n available_mines.select { |pm| @game.minor_info[pm][:vor_harzer] }\n else\n available_mines\n end\n end",
"def high_yield_mines (a)\n @arr2 = Array.new\n a.each do |this|\n if this[:specimens].length >= 4\n @arr2.push(this[:location])\n end\n end\nend",
"def get_min()\n @min\n end",
"def better_my_min\n min = self.first\n self.each do |el|\n min = el if el < min\n end\n min\n end",
"def get_min_data(thermostat_attr, redis_data)\n thermostat_attr.map do |type|\n redis_data.min_by { |h| h[type].to_i }[type]\n end\n end",
"def test_connect_mines\n @g.connect_mines\n\n assert [@g.ruby_mines['Enumerable Canyon'].neighbors[0]], ['Duck Type Beach']\n assert [@g.ruby_mines['Enumerable Canyon'].neighbors[1]], ['Monkey Patch City']\n end",
"def min\n min = @m[0][0]\n for i in 0...fi\n for k in 0...co\n if @m[i][k] < min then\n min=@m[i][k]\n end\n end\n end \n min\n end",
"def mc_ph cm\n ac = [0,0,0]\n cm.each do |cv|\n ac = cv.each_with_index.map do |c, i|\n c + ac.each_with_index.select{ |_, j| j != i }.map{ |c, _| c }.min\n end\n end\n return ac.min\nend",
"def smallest\n # self.compact.sort.first\n self.compact.min\n end",
"def get_min\n @min\n end",
"def extract\n extract_all\n extract_ccs\n end",
"def my_min2(array)\n min = array.first\n array.each do |el|\n min = [el, min].min\n end\n min\nend",
"def find_min_locator\n return nil if empty?\n use_min\n mode_call(:find_min_loc)\n end",
"def get_min()\n @data.min\n end",
"def min(field)\n grouped(:min, field.to_s, Javascript.min)\n end",
"def lowest_card(card_subset, min = nil)\n\n \n end",
"def min(series, control, ignore=nil)\n each_subseries_in series, control do |name, subseries|\n { :min => subseries.values.sort.first }\n end\n end",
"def min\n MSPhysics::Newton::Hinge.get_min(@address)\n end",
"def min _obj, _args\n \"_obj min _args;\" \n end",
"def bzpopmin(*args); end",
"def extract\n nil\n end",
"def smaller(restaurant_menu)\n mas_barato = restaurant_menu.min_by{|k,v| v}\n puts \"El plato mas barato es el #{mas_barato[0]}\"\nend",
"def getShortFlight(csa)\n number2 = 10000000\n @parse.map{ |airport| \n if( airport[\"name\"] == csa) \n airport[\"destinations\"].map do |element|\n number1 = element[\"distance\"]\n if(number1<number2)\n number2 = number1\n end\n end\n airport[\"destinations\"].map{ |dest| \n if(number2==dest[\"distance\"])\n puts \"The min distance is \" + number2.to_s + \" in the fligth between \"+ dest[\"ports\"].to_s\n end\n }\n end\n }\n end",
"def get_min\n @min ||= calculate_min\n end",
"def min(*x, &block)\n return x.first if x.size == 1\n return min2(x[0], x[1], &block) if x.size == 2\n a = x.first\n (1...x.size).each { |b| \n a = min2(a,x[b], &block) }\n a\n end",
"def calc_p_min_and_sv_min()\n\t\tp_min = []\n\t\tsv_min = []\n\t\t@DataHash[:mp].each_with_index do |e, row, col|\n\t\t\tif e > 0 && \n\t\t\t\tif p_min[row].nil?\n\t\t\t\t\tp_min[row] = e\n\t\t\t\telsif e < p_min[row]\n\t\t\t\t\tp_min[row] = e\n\t\t\t\tend\n\t\t\t\tsv_min[row] = col \n\t\t\tend\n\t\tend\n\t\t@DataHash.merge!({\"p_min\": p_min, \"sv_min\": sv_min})\n\tend",
"def all_whq_ministries\n raise \"block required\" unless block_given?\n page_helper.find_entities_each(\n entity_type: \"ministry\",\n levels: 0,\n fields: \"name\",\n ruleset: \"global_ministries\"\n ) do |entity|\n yield entity\n end\n end",
"def mergeable_private_mines(entity)\n if entity == @hw\n @minors.select { |m| m.owner && @players.include?(m.owner) && @minor_info[m][:vor_harzer] }\n else\n @minors.select { |m| m.owner && @players.include?(m.owner) }\n end\n end",
"def key_for_min_value(hash)\n name = []\n key_for_min_value.collect do |name|\n\n end\nend",
"def min_value_and_index\n [min, min_index]\n end",
"def min\n only_with('min', 'NilClass', 'Numeric', 'String', 'DateTime')\n items.compact.min\n end",
"def calculate_minimum_price\n @restaurant_list.map do |restaurant, value|\n min_price = minimum_price_per_restaurant(restaurant)\n @results << [restaurant, min_price] if min_price > 0\n min_price = minimum_price_combo_meal(restaurant)\n @results << [restaurant, min_price] if !@meal_combo.empty? && min_price > 0\n end\n end",
"def eqp_r_min(item)\n end",
"def min_element\n self.to_a.min\n end",
"def find_min\n loc = find_min_locator and loc.value\n end",
"def min(list)\n list.min\nend",
"def min(&block)\n flag = true # 1st element?\n result = nil\n self.each{|*val|\n val = val.__svalue\n if flag\n # 1st element\n result = val\n flag = false\n else\n if block\n result = val if block.call(val, result) < 0\n else\n result = val if (val <=> result) < 0\n end\n end\n }\n result\n end",
"def minpos\n v, opts = min x: true, y: true\n x = opts[\"x\"]\n y = opts[\"y\"]\n [v, x, y]\n end",
"def least_rooms\n has_info = 0\n has_info = $postings.select{|p| p.to_s.downcase[/\\d+(?=bedroom|br)/]}\n min_post = has_info.min{|a,b| a.to_s.downcase[/\\d+(?=bedroom|br)/].to_i <=> b.to_s.downcase[/\\d+(?=bedroom|br)/].to_i}\n min_room = min_post.to_s.downcase[/\\d+(?=bedroom|br)/].to_i\n min_room_ads = has_info.select{|p| p.to_s.downcase[/\\d+(?=bedroom|br)/].to_i == min_room}\n list_apt(min_room_ads)\nend",
"def min_info key, value, full_attribute\n clear\n puts \"selector: #{key}\"\n value.each_pair do |k,v|\n # v = case v\n # when Set then \"Set[]\"\n # end\n puts\n puts \"#{k} #{v.inspect}\"\n end\n\n if full_attribute\n puts\n max_info key, value, value.keys[full_attribute]\n end\n # puts value\nend",
"def mots_uniques\n @mots_uniques ||= begin\n self.select do |mot_min, arr_indexes|\n arr_indexes.count == 1\n end.keys\n end\n end",
"def cheapest(products)\n products.min_by do |product|\n product[:price]\n end\nend",
"def medians\n @medians ||= {\n self.vertices[0] => Segment.new(self.vertices[0], self.sides[1].midpoint),\n self.vertices[1] => Segment.new(self.vertices[1], self.sides[2].midpoint),\n self.vertices[2] => Segment.new(self.vertices[2], self.sides[0].midpoint)\n }\n end",
"def smallest array\n [array.min]\n end",
"def my_min(list)\n\n # phase 1\n # min = list.first\n # list.each_with_index do |ele_1, i_1|\n # list.each_with_index do |ele_2, i_2|\n # if i_2 != i_1\n # if min > ele_2\n # min = ele_2\n # end\n # end\n # end\n # end\n # min\n\n # phase 2\n min = list.first\n list[1..-1].each do |ele|\n if min > ele\n min = ele\n end\n end\n min\nend",
"def initialize(num_mines)\n @num_mines = num_mines\n end",
"def connect_mines\n ruby_mines['Enumerable Canyon'].add_neighbor(ruby_mines['Duck Type Beach'])\n ruby_mines['Enumerable Canyon'].add_neighbor(ruby_mines['Monkey Patch City'])\n ruby_mines['Duck Type Beach'].add_neighbor(ruby_mines['Enumerable Canyon'])\n ruby_mines['Duck Type Beach'].add_neighbor(ruby_mines['Matzburg'])\n ruby_mines['Monkey Patch City'].add_neighbor(ruby_mines['Nil Town'])\n ruby_mines['Monkey Patch City'].add_neighbor(ruby_mines['Enumerable Canyon'])\n ruby_mines['Monkey Patch City'].add_neighbor(ruby_mines['Matzburg'])\n ruby_mines['Nil Town'].add_neighbor(ruby_mines['Monkey Patch City'])\n ruby_mines['Nil Town'].add_neighbor(ruby_mines['Hash Crossing'])\n ruby_mines['Matzburg'].add_neighbor(ruby_mines['Monkey Patch City'])\n ruby_mines['Matzburg'].add_neighbor(ruby_mines['Duck Type Beach'])\n ruby_mines['Matzburg'].add_neighbor(ruby_mines['Hash Crossing'])\n ruby_mines['Matzburg'].add_neighbor(ruby_mines['Dynamic Palisades'])\n ruby_mines['Hash Crossing'].add_neighbor(ruby_mines['Matzburg'])\n ruby_mines['Hash Crossing'].add_neighbor(ruby_mines['Nil Town'])\n ruby_mines['Hash Crossing'].add_neighbor(ruby_mines['Dynamic Palisades'])\n ruby_mines['Dynamic Palisades'].add_neighbor(ruby_mines['Matzburg'])\n ruby_mines['Dynamic Palisades'].add_neighbor(ruby_mines['Hash Crossing'])\n end",
"def my_min_phase_2(list)\n min = list[0]\n (1...list.length).each do |i|\n min = list[i] if list[i] < min\n end\n min\nend",
"def my_min(list)\n\n min = nil\n\n list.each do |ele|\n min ||= ele\n list.each do |ele2|\n if ele2 < min\n min = ele2\n end\n end\n end\n\n min\nend",
"def successors\n return @successors if @successors\n @successors = (data['successors']||[]).map { |s| function.blocks.by_name(s) }.uniq.freeze\n end",
"def get_primer_set(ops, handle)\n # primers - need to find the collection if the Primer is a sub-item\n primers = ops.map do |op|\n if op.input(handle).object_type.name == SUB_ITEM\n Item.find(op.input(handle).item.get(\"collection\"))\n else\n op.input(handle).item\n end\n end\n\n primers.uniq\n end",
"def index\n @minerals = Mineral.select(:id, :name).order(:name)\n end",
"def find_minmax\n loc1, loc2 = self.find_minmax_locator\n [loc1 && loc1.value, loc2 && loc2.value]\n end",
"def min(field = nil)\n block_given? ? super() : aggregates(field)[\"min\"]\n end",
"def analyze filter = nil\n self.prune\n\n self.hashes.each do |hash,nodes|\n identical[hash] = nodes[1..-1].all? { |n| n == nodes.first }\n end\n\n update_masses\n\n sorted = masses.sort_by { |h,m|\n exp = hashes[h].first\n [-m,\n exp.file,\n exp.line,\n exp.sexp_type.to_s]\n }\n\n sorted.map { |hash, mass|\n nodes = hashes[hash]\n\n next unless nodes.first.first == filter if filter\n\n same = identical[hash]\n node = nodes.first\n n = nodes.size\n bonus = \"*#{n}\" if same\n\n locs = nodes.sort_by { |x| [x.file, x.line] }.each_with_index.map { |x, i|\n extra = :fuzzy if x.modified?\n Location[x.file, x.line, extra]\n }\n\n Item[hash, node.sexp_type, bonus, mass, locs]\n }.compact\n end",
"def min_poss\n [@nrow, @ncol, @nbox].min\n end",
"def pixel\n image_name_list = get_image_name_list ELEMENTS_PATH\n image_name_list.each { |image_name| minimize(image_name) }\n end",
"def my_min(array)\n\t\n\tarray.min\n\t\nend",
"def my_min(list)\n minimum_num = [] \n list.each do |num1| \n minimum_num = num1 if list.all? {|ele| ele >= num1}\n end\n minimum_num\nend",
"def min\n @mini_stack.min\n end",
"def my_min(arry)\n mini = arry.first\n arry.each do |ele|\n if ele < mini\n mini = ele\n end\n end\n mini\nend",
"def actor_movie_list(array)\n actor_in_bond = array.map {|movie| movie[:actor]}\n list = actor_in_bond.uniq\n #movies per actor variable is a new array of objects listing the key value of actor name and movie number count per actor\n movies_per_actor = list.map {|movie| {actor_name: movie, movie_num: actor_in_bond.count(movie)}}\n #movies per variable gives an array of just the number of movie numbers\n movies_per = movies_per_actor.map {|movie| movie[:movie_num]}\n #variable least num gives us the lowest number of movie num\n least_num = movies_per.min\n #lowest acting num variable gives us a array, filtering throught the hashes of movies per actor and looking at\n #the movie num and matching it with the least num of movie an actor has been in and returning that hash\n lowest_acting_num = movies_per_actor.select{|actors| actors[:movie_num] == least_num}\n # this outputs the hash of the actor with the lowest acting number role\n puts lowest_acting_num\nend",
"def negative_minima\n return Features.negative_minima(@data)\n end",
"def my_min_once\n min = first\n each do |num|\n if num < min\n min = num\n end\n end\n min\n end",
"def serviceLane(cases, width)\n res = []\n cases.each do |c1, c2|\n res << (c1..c2).each_with_object([]) do |c, ar|\n ar << width[c]\n end.min\n end\n res\nend",
"def minors_list(show_full_names = false, join_string = \", \")\n minors.collect { |m| m.minor_abbr.strip }.join(join_string)\n end",
"def best_minimal_contracts(dir)\n with_each_strain(dir).inject([-350, []]) do |best_score_contracts_pair, (strain, tricks)|\n score = score_with_bonuses(strain, tricks)\n if score == best_score_contracts_pair[0]\n [score, best_score_contracts_pair[1] << minimal_contract(strain, tricks)]\n elsif score > best_score_contracts_pair[0]\n [score, [minimal_contract(strain, tricks)]]\n else\n best_score_contracts_pair\n end\n end[1].to_set\n end",
"def residents\n u = []\n @buildings.each { |building| u << building.workers }\n (-1..1).each do |xx|\n (-1..1).each do |yy|\n next if xx == 0 and yy == 0\n u << @game[@x+xx,@y+yy].worker\n end\n end\n return u.flatten.compact\n end",
"def compare(index, mines)\n my_mine = mines[index]\n result = []\n for mine in mines\n result << within_blast_radius(my_mine[0],my_mine[1],my_mine[2],\n mine[0],mine[1])\n end\n result\nend",
"def test_0250_min\n @@log.debug \"test_0250_min starts\" if @@log.debug?\n assert_respond_to(@list, :min, \"test_0250_min_respond\")\n # This is subtle, and the result is suprising at first.\n # This coding style assumes that all objects implement <=>.\n # However, the .ndata member of Person is _not_ included in a Person's\n # <=> algorithm. This method returns .ndata for the .min of all\n # Person's in the collection, as determined by <=>.\n # Because of this, it is probably not a great coding technique. :-)\n assert_equal(3, @list.min.ndata, \"test_0250_min_basic\")\n # Basic min for an object\n lastmin = @list.min {|a,b| a.last <=> b.last }\n assert_equal(@bsb, lastmin, \"test_0250_min_block\")\n @@log.debug \"test_0250_min ends\" if @@log.debug?\n end",
"def my_min2(list)\n min = list[0]\n list.each do |el|\n min = el if el < min\n end\n min\nend",
"def extract(list_of_maybes)\n list_of_maybes.flat_map(&:to_a)\n end",
"def smallest(array)\nend",
"def minMax(node)\n hash = { }\n value = []\n for child in node.getChild(@player) ##max è il primo che gioca\n\n\t\n\tutility = min_value(child)\n\t\n \thash[utility] = child\n \tvalue << utility\n\n end\n \n return hash[max_vector(value)]\n \n \n end"
] |
[
"0.6580026",
"0.63092816",
"0.5910332",
"0.57574993",
"0.5753128",
"0.5694006",
"0.55936056",
"0.5586039",
"0.5547664",
"0.5510748",
"0.5480937",
"0.5468981",
"0.5422632",
"0.5415852",
"0.5403625",
"0.53320736",
"0.53131187",
"0.5299023",
"0.5299023",
"0.52903056",
"0.5261932",
"0.5261932",
"0.5255202",
"0.5247315",
"0.52231514",
"0.5220827",
"0.51994383",
"0.5192069",
"0.51621604",
"0.50954765",
"0.507822",
"0.50771177",
"0.50749063",
"0.5066181",
"0.5029416",
"0.50176084",
"0.50174516",
"0.5005229",
"0.5000753",
"0.4994918",
"0.49934798",
"0.49831548",
"0.4979318",
"0.4958175",
"0.4957769",
"0.4953186",
"0.49370775",
"0.49365634",
"0.49207523",
"0.49196154",
"0.49148193",
"0.48914626",
"0.48901913",
"0.48894885",
"0.48780745",
"0.48764905",
"0.4873007",
"0.48676825",
"0.4860586",
"0.48425627",
"0.4827039",
"0.481986",
"0.48176482",
"0.48141554",
"0.48086807",
"0.480208",
"0.47988075",
"0.47863227",
"0.4781284",
"0.47676808",
"0.4762835",
"0.4759816",
"0.4751833",
"0.47514302",
"0.47417262",
"0.47260663",
"0.4725506",
"0.47229734",
"0.47228548",
"0.4717433",
"0.4716954",
"0.47138408",
"0.47106275",
"0.4707815",
"0.47049528",
"0.4695257",
"0.46928322",
"0.4692014",
"0.46890953",
"0.4685978",
"0.46843982",
"0.46769303",
"0.46675423",
"0.466726",
"0.46618712",
"0.46611968",
"0.46569607",
"0.4653038",
"0.46472627",
"0.4643569",
"0.4642017"
] |
0.0
|
-1
|
Marshals the _request_object_ to a JSON string using request_objectto_h
|
def marshal(request_object)
JSON.pretty_generate(request_object.to_h)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_json(*_args)\n @request.to_json\n end",
"def to_json(*_args)\n @request.to_json\n end",
"def encode(object)\n object.to_json\n end",
"def json\n Oj.to_json(@req)\n end",
"def to_json\n request.clone.to_json\n end",
"def toJSON(object)\n\t\treturn JSON.generate(object)\n\tend",
"def to_json(object)\n hash = @hash_helper.to_hash(object)\n JSON.dump(hash)\n end",
"def serialize_json(o)\n API_CLIENT.object_to_http_body(o)\nend",
"def serialize(object) end",
"def as_json(_options = {})\n {:http_client_request => to_hash}\n end",
"def json(obj)\n content_type :json\n obj.to_json\n end",
"def serialize\n JSON.generate(to_h)\n end",
"def object_to_json(obj)\n JSON(obj)\nend",
"def to_json(object)\n context = EasyExtensions::ApiViewContext.get_context(format: :json) # Fake context :)\n builder = EasySwagger::JsonBuilder.new # Fake builder :)\n render_api(object, context, builder, response_schema: response_schema_name)\n builder.output\n end",
"def marshal(object)\n expect! object => [ String, Hash ]\n \n if object.is_a?(String)\n object = { :data => object }\n end\n \n # sort all entries in a way, that make sure that event, id, data\n # are at the end. This makes sure that confirming clients just\n # ignore the extra entries. If we would just send them in random\n # order we might produce \"bogus\" events, when \"data\", \"event\",\n # and \"id\" are separated by invalid entries. \n entries = object.sort_by { |key, value| FIXED_ORDER[key.to_sym] || 0 }\n\n entries.map do |key, value|\n escaped_value = value.gsub(/(\\r\\n|\\r|\\n)/, \"\\n#{key}: \")\n \"#{key}: #{escaped_value}\\n\"\n end.join + \"\\n\"\n end",
"def to_json\n @object.marshal_dump.to_json\n end",
"def format_request(payload); end",
"def format_request(payload); end",
"def serialize(_object, data); end",
"def serialize(_object, data); end",
"def to_json\n @request.perform\n end",
"def to_json\n object.to_json\n end",
"def to_jaxb_json_hash\n _h = super\n _h['request'] = request.to_jaxb_json_hash unless request.nil?\n _h['amount'] = amount.to_jaxb_json_hash unless amount.nil?\n _h['clientAuthorizationId'] = clientAuthorizationId.to_jaxb_json_hash unless clientAuthorizationId.nil?\n _h['merchantProductId'] = merchantProductId.to_jaxb_json_hash unless merchantProductId.nil?\n _h['sessionTransactionToken'] = sessionTransactionToken.to_jaxb_json_hash unless sessionTransactionToken.nil?\n return _h\n end",
"def to_hash\n @request\n end",
"def to_hash\n @request\n end",
"def serialize(object)\n case object\n when String\n {\n type: \"string\",\n value: object,\n description: object\n }\n when Numeric\n {\n type: \"number\",\n value: object,\n description: object.to_s\n }\n when TrueClass, FalseClass\n {\n type: \"boolean\",\n value: object,\n description: object.to_s\n }\n when Symbol\n {\n type: \"symbol\",\n value: object,\n description: object.to_s\n }\n when Array\n result = {\n type: \"object\",\n className: object.class.to_s,\n description: \"Array(#{object.length})\",\n objectId: register(object),\n subtype: \"array\"\n }\n\n result.merge!(\n preview: result.merge(\n overflow: false,\n properties: get_properties(object)\n )\n )\n\n result\n when nil\n {\n type: \"object\",\n subtype: \"null\",\n value: nil\n }\n else\n {\n type: \"object\",\n className: object.class.to_s,\n description: object.to_s,\n objectId: register(object)\n }\n end\n end",
"def request_body\n MAPPING.keys.inject({}) do |mem, e|\n next mem unless value = send(e)\n mem.merge!(e.to_s => value.to_json)\n end\n end",
"def e(object)\n require 'json'\n object.respond_to?(:to_json) ? object.to_json : object.to_s.to_json\n end",
"def object_to_http_body(model)\n return model if model.nil? || model.is_a?(String)\n local_body = nil\n if model.is_a?(Array)\n local_body = model.map { |m| object_to_hash(m) }\n else\n local_body = object_to_hash(model)\n end\n transform_hash(local_body).to_json\n end",
"def as_json(_options = {})\n {:method => method, :path => path, :remote_addr => remote_addr, :request_id => request_id}\n end",
"def serialize(object)\n object.serializable_hash\n end",
"def object_to_http_body(model)\n return model if model.nil? || model.is_a?(String)\n local_body = nil\n if model.is_a?(Array)\n local_body = model.map{|m| object_to_hash(m) }\n else\n local_body = object_to_hash(model)\n end\n local_body.to_json\n end",
"def to_json(_context = nil)\n to_h.to_json\n end",
"def serialize\n marshall.to_json\n end",
"def jsonify(input); end",
"def encode(object)\n ::MultiJson.encode(object)\n end",
"def object_to_http_body(model)\n return model if model.nil? || model.is_a?(String)\n local_body = nil\n if model.is_a?(Array)\n local_body = model.map { |m| object_to_hash(m) }\n else\n local_body = object_to_hash(model)\n end\n local_body.to_json\n end",
"def object_to_http_body(model)\n return model if model.nil? || model.is_a?(String)\n local_body = nil\n if model.is_a?(Array)\n local_body = model.map { |m| object_to_hash(m) }\n else\n local_body = object_to_hash(model)\n end\n local_body.to_json\n end",
"def object_to_http_body(model)\n return model if model.nil? || model.is_a?(String)\n local_body = nil\n if model.is_a?(Array)\n local_body = model.map { |m| object_to_hash(m) }\n else\n local_body = object_to_hash(model)\n end\n local_body.to_json\n end",
"def object_to_http_body(model)\n return model if model.nil? || model.is_a?(String)\n local_body = nil\n if model.is_a?(Array)\n local_body = model.map { |m| object_to_hash(m) }\n else\n local_body = object_to_hash(model)\n end\n local_body.to_json\n end",
"def object_to_http_body(model)\n return model if model.nil? || model.is_a?(String)\n local_body = nil\n if model.is_a?(Array)\n local_body = model.map { |m| object_to_hash(m) }\n else\n local_body = object_to_hash(model)\n end\n local_body.to_json\n end",
"def encode(obj); end",
"def paper_request_json(input)\n Value::PaperRequest.new(input[:paper_id], input[:request_id])\n .yield_self { |request| Representer::PaperRequest.new(request) }\n .yield_self(&:to_json)\n end",
"def to_json_raw_object()\n #This is a stub, used for indexing\n end",
"def to_json(obj = contact)\n return simple_object if @simplify\n\n json = { code: obj.code, name: obj.name, ident: ident, phone: obj.phone,\n created_at: obj.created_at, auth_info: obj.auth_info, email: obj.email,\n statuses: statuses, disclosed_attributes: obj.disclosed_attributes,\n registrar: registrar }\n json[:address] = address if @show_address\n if @domain_params\n json[:domains] = domains\n json[:domains_count] = obj.qualified_domain_ids(@domain_params[:domain_filter]).size\n end\n json\n end",
"def serialized\n start_location = self.request.trip.origin.build_place_details_hash\n end_location = self.request.trip.destination.build_place_details_hash\n json_i = self.as_json \n json_i[\"start_location\"] = start_location\n json_i[\"end_location\"] = end_location\n json_i[\"request\"] = self.request.otp_request\n return json_i\n end",
"def serialize(object, data); end",
"def json(input)\n JSON.dump(input)\n end",
"def serialize(object)\n object.to_s\n end",
"def json(obj)\n JSON.create_id = nil\n JSON.pretty_generate(obj)\nend",
"def to_json(object, use_alias = false)\n hash = to_hash(object, use_alias)\n JSON.dump(hash)\n end",
"def to_s\n @request\n end",
"def json_serialize\n end",
"def to_json\n to_json_object.to_json\n end",
"def to_h\n {\n request_type: @request_type\n }\n end",
"def as_json(*)\n {\n JSON.create_id => self.class.name,\n 'b' => _dump,\n }\n end",
"def to_json(*args)\n {\n JSON.create_id => self.class.name,\n \"sender\" => sender,\n \"receiver\" => receiver,\n \"amount\" => amount,\n \"signature\" => signature,\n \"merkle_hash\" => merkle_hash.to_s\n }.to_json(*args)\n end",
"def as_json(_options = {})\n {:controller_call => to_hash}\n end",
"def as_json(*)\n to_h\n end",
"def request_payload\n {}\n end",
"def serialization_context request\n options[:serialization_context] = OpenStruct.new(\n request_url: request.original_url.split('?')[0], # url without query params\n query_parameters: request.query_parameters\n )\n end",
"def to_str\n body={\n id: @id,\n event: @event,\n data: @data,\n }\n if errors.any?\n body[:errors_count]=@errors.count\n body[:errors]=@errors\n end\n body.to_json\n end",
"def encoderequest(sender, target, msg, requestid, filter={})\n serialized = Marshal.dump(msg)\n digest = makehash(serialized)\n \n @log.debug(\"Encoding a request for '#{target}' with request id #{requestid}\")\n request = {:body => serialized,\n :hash => digest,\n :senderid => @config.identity,\n :requestid => requestid,\n :msgtarget => target,\n :filter => filter,\n :msgtime => Time.now.to_i}\n\n # if we're in use by a client add the callerid to the main client hashes\n request[:callerid] = callerid if @initiated_by == :client\n\n Marshal.dump(request)\n end",
"def stringify\n json_hash = {}\n\n begin\n json_hash = Serializer.serialize(self, class: self.class.name)\n rescue JSON::JSONError => e\n warn \"#{__FILE__}.#{__LINE__}: #{e.message}\"\n end\n\n json_hash.to_json\n end",
"def to_json(*attrs); super self.class.params; end",
"def to_json(*attrs); super self.class.params; end",
"def to_json(*attrs); super self.class.params; end",
"def to_json\n io = StringIO.new << \"{\"\n\n io << JSON.create_id.to_json << \":\" << self.class.name.to_json << \",\"\n\n @data.each {|key, value|\n io << key.to_json.to_s << \":\" << value.to_json << \",\"\n }\n\n io.seek(-1, IO::SEEK_CUR)\n io << \"}\"\n\n io.string\n end",
"def as_json(*)\n {\n FunJSON.create_id => self.class.name,\n 'b' => _dump,\n }\n end",
"def serialize(object)\n return Rubyprot::Serializer.serialize(object)\n end",
"def to_json(what)\n what.to_hash.to_json\n end",
"def structure_request(request)\n method, url, spec = request\n # Flatten everything into the 'spec' hash, also stringify any keys to normalize\n Hash[(spec||{}).merge({\n \"method\" => method.to_s,\n \"url\" => url,\n }).map {|k,v| [k.to_s,v] }]\n end",
"def structure_request(request)\n method, url, spec = request\n # Flatten everything into the 'spec' hash, also stringify any keys to normalize\n Hash[(spec||{}).merge({\n \"method\" => method.to_s,\n \"url\" => url,\n }).map {|k,v| [k.to_s,v] }]\n end",
"def structure_request(request)\n method, url, spec = request\n # Flatten everything into the 'spec' hash, also stringify any keys to normalize\n Hash[(spec||{}).merge({\n \"method\" => method.to_s,\n \"url\" => url,\n }).map {|k,v| [k.to_s,v] }]\n end",
"def structure_request(request)\n method, url, spec = request\n # Flatten everything into the 'spec' hash, also stringify any keys to normalize\n Hash[(spec||{}).merge({\n \"method\" => method.to_s,\n \"url\" => url,\n }).map {|k,v| [k.to_s,v] }]\n end",
"def to_json(object, context = CoderContext.new)\n context = CoderContext.new(context) if context.is_a?(Hash)\n Dumper.to_json(object, context)\n end",
"def to_json\n to_h.to_json\n end",
"def to_json\n to_h.to_json\n end",
"def encoderequest(sender, target, msg, requestid, filter={}, target_agent=nil, target_collective=nil)\n serialized = Marshal.dump(msg)\n digest = makehash(serialized)\n\n req = create_request(requestid, target, filter, serialized, @initiated_by, target_agent, target_collective)\n req[:hash] = digest\n\n Marshal.dump(req)\n end",
"def encode\n h = {\n :batch => @batch_hash,\n :job_id => @job_id\n }\n h.to_json.to_s\n end",
"def to_request_object\n result = {}\n request_obj = {}\n self.class.api_attributes.each do |api_attr|\n request_obj[ api_attr.attribute_name ] = self.send( api_attr.attribute_name )\n end\n result[ self.class.get_request_element ] = request_obj\n return result\n end",
"def serialize(object, user_options)\n object = prepare(object)\n\n return object unless @binding.representable?\n\n @binding.evaluate_option(:serialize, object) do\n marshal(object, user_options)\n end\n end",
"def serialize\n self.to_hash.to_json\n end",
"def prepare_request(request_hash = {}, nested_object = false)\n result = {}\n request_hash.each do |key, value|\n # handle nested objects in the request (like a shopper)\n value = prepare_request(value, true) if value.instance_of?(Hash)\n\n # add the wsdl: prefix to the key\n result[\"wsdl:#{key}\"] = value\n end\n result\n end",
"def serialize(object)\n object = MAPPINGS[object]\n object.nil? ? nil : object\n end",
"def __convert_to_json(o=nil, options={})\n o = o.is_a?(String) ? o : serializer.dump(o, options)\n end",
"def json_obj(method,params={})\n obj =\n {\n 'jsonrpc'=>'2.0',\n 'method'=>method,\n 'params'=>params,\n 'auth'=>@auth,\n 'id'=>@id\n }\n debug(10, :msg=>\"json_obj: #{obj}\")\n return obj.to_json\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(*)\n\t\t\t# to_json needs to not care about arguments with the C extension\n\t\t\t# version of the JSON gem.\n\t\t\t# See json-1.5.1/ext/json/ext/generator/generator.c:902\n\t\t\tto_hash.to_json\n\t\tend",
"def json_\n hash = {\n \"Id\" => id,\n \"AccountId\" => account_id,\n \"SubscriptionId\" => subscription_id,\n \"Name\" => name,\n \"CampaignTypeId\" => campaign_type_id,\n \"ContentId\" => content_id,\n \"Session\" => session,\n \"SessionLength\" => session_length,\n \"UserData\" => user_data,\n \"SingleUse\" => single_use,\n \"SingleUseContentId\" => single_use_content_id\n }\n\n hash.to_json\n end",
"def to_json(*a)\n {'jsonrpc' => '2.0',\n 'method' => @jr_method,\n 'params' => @jr_args}.merge(@headers).to_json(*a)\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 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 structure_request(request)\n method, url, spec = request\n # Flatten everything into the 'spec' hash, also stringify any keys to normalize\n Hash[(spec||{}).merge({\n 'method' => method.to_s,\n 'url' => url,\n }).map { |k, v| [k.to_s, v] }]\n end",
"def to_json(*args)\n to_hash.to_json\n end",
"def send_request(request_obj)\n request(request_obj.method, request_obj.path, body: request_obj.body.to_json)\n end",
"def to_json arg\n as_json.to_json\n end",
"def to_json\n\t\tto_h.to_json\n\tend",
"def to_json\n\t\tto_h.to_json\n\tend"
] |
[
"0.69770724",
"0.69770724",
"0.6881005",
"0.6627694",
"0.6525249",
"0.6495019",
"0.64930177",
"0.64788723",
"0.6333703",
"0.63162804",
"0.6252275",
"0.6227398",
"0.6222578",
"0.61889935",
"0.6159585",
"0.6138563",
"0.6137749",
"0.6137749",
"0.6108434",
"0.6108434",
"0.60977834",
"0.60927343",
"0.6089027",
"0.6076873",
"0.6076873",
"0.60625607",
"0.60525274",
"0.60522974",
"0.604969",
"0.60473764",
"0.6046393",
"0.60444826",
"0.6038861",
"0.6028609",
"0.6005504",
"0.5985092",
"0.5977375",
"0.5977375",
"0.5977375",
"0.5977375",
"0.5977375",
"0.595813",
"0.59550846",
"0.59406924",
"0.59067386",
"0.5897216",
"0.58747286",
"0.5867266",
"0.5857916",
"0.58490175",
"0.5842417",
"0.5824508",
"0.5814636",
"0.5808799",
"0.5790931",
"0.57881224",
"0.57876205",
"0.5779657",
"0.57700086",
"0.5765904",
"0.57432514",
"0.57407147",
"0.57340056",
"0.5733151",
"0.5732191",
"0.5732191",
"0.5732191",
"0.57321304",
"0.57290685",
"0.57282203",
"0.57083875",
"0.5690732",
"0.5690732",
"0.5690732",
"0.5690732",
"0.5687974",
"0.5682847",
"0.5682847",
"0.56808496",
"0.5680847",
"0.5678446",
"0.5677976",
"0.5675434",
"0.5674547",
"0.5666594",
"0.565496",
"0.5645839",
"0.56377304",
"0.56377304",
"0.5636293",
"0.5626914",
"0.56189215",
"0.5612903",
"0.56122863",
"0.5609533",
"0.560696",
"0.5604372",
"0.55898565",
"0.558673",
"0.558673"
] |
0.8793168
|
0
|
Unmarshals a JSON string into an object of type _klass_ using klass.new_from_hash
|
def unmarshal(json_string, klass)
if json_string.nil?
return nil
elsif json_string.length == 0
return ''
end
if klass.respond_to?(:new_from_hash)
klass.new_from_hash(JSON.load(json_string))
else
raise NotImplementedError
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def from_json(json:, klass:)\n hash = JSON.load(json)\n from_hash(hash: hash, klass: klass)\n end",
"def from_json(json:, klass:, use_alias: false)\n hash = JSON.load(json)\n from_hash(hash: hash, klass: klass, use_alias: use_alias)\n end",
"def from_json(json)\n new JSON.parse(json)\n end",
"def load_instance_from(parsed_json, chef_class)\n if Gem::Version.new(Chef::VERSION) < Gem::Version.new('12.0.0')\n chef_class.json_create(parsed_json)\n else\n chef_class.from_hash(parsed_json)\n end\n end",
"def parse_json(json, &block)\n instantiate_classes_in_parsed_json(JSON.parse(json), &block)\n end",
"def json_to_obj json_str\n hash_to_obj(parse_json(json_str))\n end",
"def from_json(json)\n deserialize JSON.parse(json)\n end",
"def from_json\n JSON.parse(self)\n end",
"def deserialize(value)\n self.new(JSON.parse(value))\n end",
"def new_from_json_string(json_string)\n hash = JSON.parse(json_string)\n new_from_response_data(hash.first[1])\n end",
"def initialize(json)\n @info = json if json.is_a? Hash\n @info ||= JSON.parse(json)\n end",
"def from_json string\n _assign_attributes JSON.parse(string)\n end",
"def from_json!(string)\n JSON.parse(string).each do |var, val|\n self.instance_variable_set var, val\n end\n end",
"def from_json(json)\n self.attributes = ActiveSupport::JSON.decode(json)\n self\n end",
"def from_json(resource_class, json)\n # e.g. DELETE\n return nil if json.nil? or json.size == 0\n data = JSON.parse json\n\n if data.is_a? Array\n records = Resources.new\n data.each do |data_element|\n if data_element.is_a? Enumerable\n records << instantiate_record_from_json(resource_class, data_element)\n else\n # Value (e.g. String)\n records << data_element\n end\n end\n records\n else\n instantiate_record_from_json(resource_class, data)\n end\n end",
"def from_hash(hash:, klass:)\n validate_class_kit(klass)\n\n @hash_helper.indifferent!(hash)\n entity = klass.new\n attributes = @attribute_helper.get_attributes(klass)\n attributes.each do |attribute|\n key = attribute[:name]\n type = attribute[:type]\n\n #if the hash value is nil skip it\n next if hash[key].nil?\n\n value = if is_class_kit?(type)\n from_hash(hash: hash[key], klass: type)\n elsif type == Array\n hash[key].map do |array_element|\n if attribute[:collection_type].nil?\n array_element\n else\n if is_class_kit?(attribute[:collection_type])\n from_hash(hash: array_element, klass: attribute[:collection_type])\n else\n @value_helper.parse(type: attribute[:collection_type], value: array_element)\n end\n end\n end\n else\n hash[key]\n end\n\n entity.public_send(:\"#{key}=\", value)\n end\n\n entity\n end",
"def from_hash(hash)\n hash.each_pair do |key, value|\n\n # We need to catch hashes representing child objects\n # If the hash key:value is a of a Hash/BSON:Ordered hash\n if hash[key].class == Hash || hash[key].class == BSON::OrderedHash\n # If we have a classname we know we need to return to an object\n if hash[key][\"@classname\"]\n self.instance_variable_set(key, ::Object::full_const_get(hash[key][\"@classname\"]).new(hash[key])) unless key.to_s.start_with?(\"_\")\n else\n self.instance_variable_set(key, value) unless key.to_s.start_with?(\"_\")\n end\n else\n self.instance_variable_set(key, value) unless key.to_s.start_with?(\"_\")\n end\n end\n end",
"def from_hash(hash)\n hash.each_pair do |key, value|\n\n # We need to catch hashes representing child objects\n # If the hash key:value is a of a Hash/BSON:Ordered hash\n if hash[key].class == Hash || hash[key].class == BSON::OrderedHash\n # If we have a classname we know we need to return to an object\n if hash[key][\"@classname\"]\n self.instance_variable_set(key, ::Object::full_const_get(hash[key][\"@classname\"]).new(hash[key])) unless key.to_s.start_with?(\"_\")\n else\n self.instance_variable_set(key, value) unless key.to_s.start_with?(\"_\")\n end\n else\n self.instance_variable_set(key, value) unless key.to_s.start_with?(\"_\")\n end\n end\n end",
"def construct(json={})\n refresh_from(json)\n end",
"def construct(json={})\n refresh_from(json)\n end",
"def find_instance_from_json(json, instance_class)\n key = instance_class.table_name.singularize\n details = json[key]&.slice(*REQUIRED_ATTRIBUTES[instance_class])\n obj = nil\n if details\n obj = instance_class.new(details)\n obj = instance_class.find(obj.id) if obj.id\n end\n obj\n end",
"def initialize(hash_that_represents_json)\n\t\t@data = hash_that_represents_json\n\tend",
"def initialize(resource_json)\n @json = JSON.parse(resource_json)\n parse_base\n end",
"def parse(json_str)\n e = Pointer.new(:object)\n NSJSONSerialization.JSONObjectWithData(\n json_str.dataUsingEncoding(NSUTF8StringEncoding),\n options: 0,\n error: e)\n end",
"def from_json(serialized_data)\n Yajl::Parser.parse(serialized_data, :symbolize_keys => true)\n end",
"def instance_by_json(json_obj = {})\n obj = self.new \n obj.set_attributes_by_json( json_obj )\n return obj\n end",
"def initialize(json:)\n @raw_json = json\n end",
"def initialize(decoded_json)\n @loaded = false\n if decoded_json.is_a? Hash\n properties_from_hash(decoded_json)\n super(decoded_json)\n parse!(decoded_json)\n @loaded = true\n else\n decoded_json.each do |list|\n self.class.property :\"#{list['key']}\"\n self.merge!({list['key'] => self.class.find(list['key'])})\n end\n end\n end",
"def from_hash(json, client: nil)\n res = self.new\n\n json.each do |k, v|\n # TODO: Better way to do this?\n attr = @attributes.find{|a| a.json_field == k.to_s}\n raise InvalidAttribute.new(\n \"`#{self.name.split('::').last}` did not define a `#{k}`.\"\n ) if attr.nil?\n\n # TODO: Better way to do this?\n case attr.type.to_s\n when Integer.to_s\n maybe_raise_invalid_value(attr, k, v) unless v.is_a?(Fixnum)\n value = v.to_i\n when Float.to_s\n maybe_raise_invalid_value(attr, k, v) unless v.is_a?(Float)\n value = v.to_f\n when String.to_s\n maybe_raise_invalid_value(attr, k, v) unless v.is_a?(String)\n value = v\n when Hash.to_s\n maybe_raise_invalid_value(attr, k, v) unless v.is_a?(Hash)\n value = v\n end\n\n # Lurk, there is probably a better way to do this.\n if !attr.expand_method.nil?\n client ||= Unchained::Client.new\n value = client.send(attr.expand_method, value)\n end\n\n res.send(\"#{attr.name}=\", value)\n end\n\n res\n end",
"def load_from_json_string(json)\n load_from_hash(JSON.parse(json))\n end",
"def from_json\n return nil unless okay?\n\n require \"json\"\n\n JSON.parse(body)\n end",
"def initialize(json)\n @json = json\n end",
"def parse_json(json_)\n from_json_object(::JSON.parse(json_))\n end",
"def dispatch(hash)\n # Convert to an AuditHash, unless it already is one\n hash = Core::AuditHash.from_hash(hash) unless hash.is_a?(Core::AuditHash)\n\n # Ignore if class is unknown\n unless classes[hash['_class']]\n log \"no class #{hash['_class']}\"\n return\n end\n\n # Instantiate and populate keys\n instance = classes[hash['_class']].new\n instance.from_sketch_json_hash(hash, self)\n\n # Warn if any keys were never accessed (could indicate incomplete\n # support for a particular element)\n if !hash.non_accessed_keys.empty?\n log \"#{hash['_class']} may be incomplete; never accessed #{hash.non_accessed_keys.join(', ')}\"\n end\n\n instance\n end",
"def reparsed_from_json\n self.is_a?(String) ? JSON.parse(self) : JSON.parse(self.to_json)\n end",
"def initialize json_hash\n @json = json_hash\n super\n end",
"def from_hash(data_hash)\n activity_kind = data_hash['kind'] || data_hash[:kind]\n raise \"No kind found in activity hash: #{data_hash.inspect}\" unless activity_kind\n\n klass = Activr.registry.class_for_activity(activity_kind)\n klass.new(data_hash)\n end",
"def initialize(json_dict, object_item_class, resource)\n @count = json_dict.fetch('count', 0)\n @_previous = json_dict.fetch('previous', nil)\n @_next = json_dict.fetch('next', nil)\n @results = []\n json_dict.fetch('results', []).each do |result|\n @results.push(object_item_class.new(result, resource))\n @resource = resource\n end\n end",
"def initialize(json, api_client:)\n @api_client = api_client\n json.each { |key, value| _attributes[key] = parse_attribute(value) }\n\n metaclass = (class << self; self; end)\n metaclass.send(:dynamic_accessor, *_attributes.keys)\n end",
"def from data\n obj = new\n obj.decode data\n obj\n end",
"def from_json(data)\n hash = Oj.load(data, symbol_keys: true)\n from_h(hash, :from_json)\n end",
"def json_create(o)\n new(*o[\"data\"])\n end",
"def new_from_json(json)\n params = {}\n\n # set each attribute based on the mapping\n self.attribute_mapping.each do |o,n|\n # if o is a string, parse it\n if n.is_a?(String)\n # check if data type is specified (using @@ symbol)\n if n.include?(\"@@\")\n if n.split(\"@@\").last.downcase == 'time'\n data = Time.new(n.split(\"@@\").first)\n elsif n.split(\"@@\").last.downcase == 'float'\n data = n.split(\"@@\").first.to_f\n else\n data = n.split(\"@@\").first\n end\n params[n.split(\"@@\").first] = data\n else\n # puts \"parsing value: #{n} => #{json[o]}\"\n params[n] = json[o.to_s]\n # puts \"parsed value (#{params[n]})\"\n end\n\n \n # assign boolean value\n elsif [FalseClass, TrueClass].include?(n.class)\n # puts \"Parsing boolean value: #{n} = #{json[o]}\"\n params[n] = json[o]\n # puts \"#{n} => #{o}\"\n # else, o is a class. Call the 'parse_children' method on it\n else\n # puts \"n is a #{n.class.name}\"\n # loop through all the children (for example: 'regels' on 'arrangementen')\n if json[o]\n children = []\n for item in json[o]\n children << n.new_from_json(item)\n end\n params[n.plural_name] = children\n end\n end\n\n end\n params['json'] = json\n self.new(params)\n end",
"def initialize(json, locator = nil)\n @source_json = json\n if @source_json.is_a? String\n @source_hash = JSON.parse(json).with_indifferent_access\n else\n @source_hash = @source_json\n end\n @locator = locator\n end",
"def initialize(json, locator = nil)\n @source_json = json\n if @source_json.is_a? String\n @source_hash = JSON.parse(json).with_indifferent_access\n else\n @source_hash = @source_json\n end\n @locator = locator\n end",
"def deserialize_object(definition, hash)\n return nil if hash.nil?\n result = definition.new\n result.__fields.each do |field|\n name = field.key_json || name_to_json(field.sym)\n\n if field.options[:as] == :list\n value = deserialize_list(hash[name], field)\n elsif field.options[:as] == :dto\n value = deserialize_object(field.options[:of], hash[name])\n else\n value = hash[name]\n end\n\n next if value.nil?\n\n result.send(\"#{field.key_ruby}=\", value)\n end\n result\n end",
"def class_for_json_class(json_class)\n case json_class\n when CHEF_APICLIENT\n Chef::ApiClient\n when CHEF_COOKBOOKVERSION\n Chef::CookbookVersion\n when CHEF_DATABAG\n Chef::DataBag\n when CHEF_DATABAGITEM\n Chef::DataBagItem\n when CHEF_ENVIRONMENT\n Chef::Environment\n when CHEF_NODE\n Chef::Node\n when CHEF_ROLE\n Chef::Role\n when CHEF_SANDBOX\n # a falsey return here will disable object inflation/\"create\n # additions\" in the caller. In Chef 11 this is correct, we just have\n # a dummy Chef::Sandbox class for compat with Chef 10 servers.\n false\n when CHEF_RESOURCE\n Chef::Resource\n when CHEF_RESOURCECOLLECTION\n Chef::ResourceCollection\n when /^Chef::Resource/\n Chef::Resource.find_subclass_by_name(json_class)\n else\n raise JSON::ParserError, \"Unsupported `json_class` type '#{json_class}'\"\n end\n end",
"def objects_from_serialized_hash(hash) # :nodoc:\n klass, attributes = Helpers.to_class_and_attributes(hash)\n klass.from_seedable_attributes(attributes)\n end",
"def from_hash(hash, klass, transforms = [])\n obj = klass.new\n return obj if hash.nil? || hash.empty?\n raise ArgumentError, \"#{hash.inspect} is not a hash\" unless hash.is_a?(Hash)\n\n hash.each do |k, v|\n next unless obj.respond_to?(k)\n\n transform = transforms.detect { |t| t.key.to_sym == k.to_sym }\n if !transform.nil?\n if v.is_a?(Hash)\n child = from_hash(v, transform.klass, transforms)\n obj.instance_variable_set(\"@#{k}\", child)\n elsif v.is_a?(Array)\n items = v.map do |i|\n from_hash(i, transform.klass, transforms)\n end\n obj.instance_variable_set(\"@#{k}\", items)\n end\n else\n obj.instance_variable_set(\"@#{k}\", v)\n end\n end\n\n obj\n end",
"def from_json(data, *args)\n data = ::JSON[data]\n from_hash(data, *args)\n end",
"def hash_to_model(klass_name, hash)\n model_klass =\n if self.class.const_defined?(klass_name, false)\n self.class.const_get(klass_name)\n else\n self.class.const_set(klass_name, Class.new(BaseModel))\n end\n model_klass.new(api, hash)\n end",
"def hash_to_model(klass_name, hash)\n model_klass =\n if self.class.const_defined?(klass_name, false)\n self.class.const_get(klass_name)\n else\n self.class.const_set(klass_name, Class.new(BaseModel))\n end\n model_klass.new(api, hash)\n end",
"def build_object_from_record(cr_json_object, object_class)\n # B. build new class using object keys\n cro_properties = cr_json_object.keys\n cra_keys = nil\n cro_class = nil\n cro_properties.each do |instance_var|\n if cra_keys == nil or !cra_keys.include?(instance_var)\n cro_class = CrApiWrapper::CrObjectFactory.create_class object_class, cro_properties\n cra_keys = cro_properties\n break\n end\n end\n #cro_class = CrApiWrapper::CrObjectFactory.create_class object_class, cro_properties\n new_cro = cro_class.new\n # C. assing object values in content to class instance\n CrApiWrapper::CrObjectFactory.assing_attributes new_cro, cr_json_object\n # now handle nested objects\n cro_properties.each do |field|\n instance_var = field.gsub('/','_').downcase()\n instance_var.gsub!(' ','_')\n instance_var = instance_var.gsub('-','_')\n field_value = new_cro.instance_variable_get(\"@#{instance_var}\")\n field_type = field_value.class\n #puts \"Field: \" + instance_var + \" Type: \" + field_type.to_s + \" Value: \" + field_value.to_s\n if field_type == Hash\n # a hash is the representation of a nested object\n # handle this as a hash\n new_class_name = \"Cr\" + camelise(instance_var)\n #puts \"handle this as a Hash create class \" + new_class_name\n cr_nested_object = build_object_from_record(field_value, new_class_name)\n #puts cr_nested_object\n #puts \"***************************************************************\"\n new_cro.instance_variable_set(\"@#{instance_var}\", cr_nested_object)\n elsif field_type == Array\n values_list = []\n # an array can contain many objects\n # treat each array elemen as a nested object\n field_value.each do |fvs|\n cr_list_object = nil\n if fvs.class == Hash\n new_class_name = \"Cr\" + camelise(instance_var)\n cr_list_object = build_object_from_record(fvs, new_class_name)\n else\n cr_list_object = fvs\n end\n values_list.append(cr_list_object)\n end\n new_cro.instance_variable_set(\"@#{instance_var}\", values_list)\n end\n end\n return new_cro\nend",
"def initialize(response)\n @data = JSON.parse(response)\n end",
"def convert(resp, key=nil)\n json = JSON.parse(resp)\n validate_parser(json, key)\n json = { key => json} if key\n\n objs = build_response_attr(json)\n ClassyJSON::Conversion.new(objs)\n end",
"def map_to_rb_obj(json_obj)\n case json_obj\n when Hash\n mapped_hash = map_hash_to_rb_obj(json_obj)\n if json_obj.has_key?(JSON_CLAZ) && (class_to_inflate = class_for_json_class(json_obj[JSON_CLAZ]))\n class_to_inflate.json_create(mapped_hash)\n else\n mapped_hash\n end\n when Array\n json_obj.map { |e| map_to_rb_obj(e) }\n else\n json_obj\n end\n end",
"def from_hash(hash:, klass:, use_alias: false)\n validate_class_kit(klass)\n\n return hash.map { |i| from_hash(hash: i, klass: klass, use_alias: use_alias) } if hash.is_a?(Array)\n\n @hash_helper.indifferent!(hash)\n entity = klass.new\n attributes = @attribute_helper.get_attributes(klass)\n attributes.each do |attribute|\n key = use_alias ? (attribute[:alias] || attribute[:name]) : attribute[:name]\n type = attribute[:type]\n\n # if the hash value is nil skip it\n next if hash[key].nil?\n\n value = if is_class_kit?(type)\n from_hash(hash: hash[key], klass: type, use_alias: use_alias)\n elsif is_class_kit_custom_type?(type)\n type.parse_from_hash(hash[key])\n elsif type == Array\n hash[key].map do |array_element|\n if attribute[:collection_type].nil?\n array_element\n else\n if is_class_kit?(attribute[:collection_type])\n from_hash(hash: array_element, klass: attribute[:collection_type], use_alias: use_alias)\n elsif is_class_kit_custom_type?(attribute[:collection_type])\n attribute[:collection_type].parse_from_hash(array_element)\n else\n @value_helper.parse(type: attribute[:collection_type], value: array_element)\n end\n end\n end\n else\n hash[key]\n end\n\n entity.public_send(:\"#{attribute[:name]}=\", value)\n end\n\n entity\n end",
"def from_json(data, *args, &block)\n data = ::JSON[data]\n from_hash(data, *args, &block)\n end",
"def from_hash( h)\n\t\th.each { |name,attributes|\n\t\t\tklass = Klass.new\n\t\t\tklass.from_hash( { name => attributes } )\n\t\t\tself.add_class( klass)\n\t\t}\n\n\t\t# this is an experiment in handling \"through\" attributes\n\t\t# i.e. enriching the model with the join classes\n\tend",
"def deserialize(json)\n raise NotImplementedError\n end",
"def initialize( hash )\n\t\t@object_classes = self.parse_objectclasses( hash['objectClasses'] || [] )\n\t\t@attribute_types = self.parse_attribute_types( hash['attributeTypes'] || [] )\n\t\t@ldap_syntaxes = self.parse_ldap_syntaxes( hash['ldapSyntaxes'] || [] )\n\t\t@matching_rules = self.parse_matching_rules( hash['matchingRules'] || [] )\n\t\t@matching_rule_uses = self.parse_matching_rule_uses( hash['matchingRuleUse'] || [] )\n\tend",
"def from_json(data, _ = {} , spec: nil)\n data = JSON.parse(data) if data.is_a?(String)\n if spec\n Data.import(self.class.json_spec_path, spec, self, data)\n elsif defined?(super)\n super\n end\n end",
"def from_json(data)\n hash = Oj.load(data, symbol_keys: true)\n\n hash.each do |k, v|\n hash[k] = convert(v, k, :from_json)\n end\n\n from_h(hash)\n end",
"def initialize(hash = nil)\n return if hash.nil?\n\n names = self.class.name_mapping\n types = self.class.type_mapping\n\n names.each do |key, value|\n type = types[key]\n if type.instance_of? Hash\n # array\n if type['type'].instance_of? String\n if type['type'] == 'array'\n instance_variable_set('@' + key, hash[value].map do |item|\n type['itemType'].new(item)\n end)\n end\n else\n instance_variable_set('@' + key, type.new(hash[value]))\n end\n elsif type.instance_of? Class\n instance_variable_set('@' + key, type.new(hash[value]))\n else\n instance_variable_set('@' + key, hash[value])\n end\n end\n end",
"def from_json(source)\n return if source.blank?\n\n case source\n when ::String\n from_hash Yajl::Parser.parse(source)\n when ::Hash\n from_hash source\n end\n end",
"def initialize json\n @json = json\n @id = @json['id']\n @title = @json['title']\n @description= @json['description']\n @url = @json['url']\n @user = User.new @json['user']\n\n if @json['camera']\n @camera = Camera.new @json['camera']\n end\n\n if @json['film']\n @film = Film.new @json['film']\n end\n\n if @json['longitude'] && @json['latitude']\n @longitude = @json['location']['longitude']\n @latitude = @json['location']['latitude']\n end\n end",
"def map_to_rb_obj(json_obj)\n case json_obj\n when Hash\n mapped_hash = map_hash_to_rb_obj(json_obj)\n if json_obj.has_key?(JSON_CLASS) && (class_to_inflate = class_for_json_class(json_obj[JSON_CLASS]))\n class_to_inflate.json_create(mapped_hash)\n else\n mapped_hash\n end\n when Array\n json_obj.map {|e| map_to_rb_obj(e) }\n else\n json_obj\n end\n end",
"def from(klass)\n new klass.name.to_s,\n nil,\n build_type(klass),\n klass.extras,\n build_initial_attributes(klass)\n end",
"def new_from_hash(hash)\n if hash == nil\n self.class.new.assign(self)\n else\n hash_obj = hash\n if hash.instance_of?(Hash)\n hash_obj = self.class.new\n merge_hash_into_object(hash, hash_obj)\n end\n instance = self.class.new\n object_assign(instance, hash_obj)\n end\n end",
"def load_from_hash(hash)\n return nil unless hash\n result = hash[:type].constantize.new\n \n hash[:attributes].each do |key, value|\n result.send(\"#{key}=\", value)\n end\n \n hash[:reflections].each do |name, values|\n if values\n if values.is_a?Array\n reflection_objects = values.map { |h| load_from_hash(h) } \n result.send(\"#{name}=\", reflection_objects)\n elsif values.is_a?Hash\n reflection_object = load_from_hash(values)\n result.send(\"#{name}=\", reflection_object)\n end\n end\n end\n \n result\n end",
"def parse_attributes(data, klass = nil)\n data.keys.each do |key|\n next if data[key.to_sym].nil?\n value = klass.nil? ? data[key.to_sym] : klass.new(data[key.to_sym])\n instance_variable_set(\"@#{key.to_s.underscore}\", value)\n end\n end",
"def map_to_rb_obj(json_obj)\n case json_obj\n when Hash\n mapped_hash = map_hash_to_rb_obj(json_obj)\n if json_obj.has_key?(JSON_CLAZ) && (class_to_inflate = class_for_json_class(json_obj[JSON_CLAZ]))\n class_to_inflate.json_create(mapped_hash)\n else\n mapped_hash\n end\n when Array\n json_obj.map {|e| map_to_rb_obj(e) }\n else\n json_obj\n end\n end",
"def deserialize_json(s, type)\n headers = { 'Content-Type' => 'application/json' }\n response = double('response', headers: headers, body: s)\n API_CLIENT.deserialize(response, type)\nend",
"def load(json)\n require 'json'\n from_json(JSON.parse(json))\n end",
"def initialize(data = nil)\n ActiveSupport::JSON.decode(data).each do |k, v|\n self.send(\"#{k}=\", v) if self.respond_to?(\"#{k}=\")\n end if data\n end",
"def resource_form_hash(hash)\n return unless hash['type']\n klass_name = hash['type']\n klass = resource_klass(klass_name)\n return unless klass\n klass.new(hash)\n end",
"def initialize(json_text: BLANK_JSON_TEXT) # rubocop:disable Metrics/MethodLength\n json_hash = JSON.parse(json_text, symbolize_names: true)\n @collection_id = json_hash[:collection_id]\n @depositor = json_hash[:depositor]\n @documentation = json_hash[:documentation]\n @steward = json_hash[:steward]\n @locations = json_hash[:locations]\n @locations = [] if @locations.nil?\n @packages = if json_hash[:packages]\n json_hash[:packages].map do |package|\n Manifests::Package.new(package: package)\n end\n else\n []\n end\n end",
"def class_for(fragment, *args)\n item_class = class_from(fragment, *args) or raise DeserializeError.new(\":class did not return class constant.\")\n item_class.new\n end",
"def class_for_json_class(json_class)\n case json_class\n when MEGAM_ERROR\n Megam::Error\n when MEGAM_AUTH\n Megam::Auth\n when MEGAM_ACCOUNT\n Megam::Account\n when MEGAM_NODE\n Megam::Node\n when MEGAM_APPDEFNS\n Megam::Appdefns\n when MEGAM_APPREQUEST\n Megam::AppRequest\n when MEGAM_BOLTREQUEST\n Megam::BoltRequest\n when MEGAM_BOLTDEFNS\n Megam::Boltdefns\n when MEGAM_NODECOLLECTION\n Megam::NodeCollection\n when MEGAM_APPDEFNSCOLLECTION\n Megam::AppdefnsCollection\n when MEGAM_APPREQUESTCOLLECTION\n Megam::AppRequestCollection\n when MEGAM_BOLTREQUESTCOLLECTION\n Megam::BoltRequestCollection\n when MEGAM_BOLTDEFNSCOLLECTION\n Megam::BoltdefnsCollection\n when MEGAM_REQUEST\n Megam::Request\n when MEGAM_REQUESTCOLLECTION\n Megam::RequestCollection\n when MEGAM_PREDEF\n Megam::Predef\n when MEGAM_PREDEFCOLLECTION\n Megam::PredefCollection\n when MEGAM_PREDEFCLOUD\n Megam::PredefCloud\n when MEGAM_PREDEFCLOUDCOLLECTION\n Megam::PredefCloudCollection\n when MEGAM_CLOUDTOOL\n Megam::CloudTool\n when MEGAM_CLOUDTOOLCOLLECTION\n Megam::CloudToolCollection\n when MEGAM_CLOUDTOOLSETTING\n Megam::CloudToolSetting\n when MEGAM_CLOUDTOOLSETTINGCOLLECTION\n Megam::CloudToolSettingCollection\n when MEGAM_CLOUDTEMPLATE\n Megam::CloudTemplate\n when MEGAM_CLOUDTEMPLATECOLLECTION\n Megam::CloudTemplateCollection\n when MEGAM_CLOUDINSTRUCTION\n Megam::CloudInstruction\n when MEGAM_CLOUDINSTRUCTIONGROUP\n Megam::CloudInstructionGroup\n when MEGAM_CLOUDINSTRUCTIONCOLLECTION\n Megam::CloudInstructionCollection\n when MEGAM_SSHKEY\n Megam::SshKey\n when MEGAM_SSHKEYCOLLECTION\n Megam::SshKeyCollection\n when MEGAM_MARKETPLACE\n Megam::MarketPlace\n when MEGAM_MARKETPLACECOLLECTION\n Megam::MarketPlaceCollection\n when MEGAM_MARKETPLACEADDON\n Megam::MarketPlaceAddons\n when MEGAM_MARKETPLACEADDONCOLLECTION\n Megam::MarketPlaceAddonsCollection\n<<<<<<< HEAD\n when MEGAM_ORGANIZATION\n Megam::Organizations\n=======\n when MEGAM_CSAR\n Megam::CSAR\n when MEGAM_CSARCOLLECTION\n Megam::CSARCollection\n>>>>>>> origin/0.5\n else\n raise JSON::ParserError, \"Unsupported `json_class` type '#{json_class}'\"\n end\n end",
"def from_data(data)\n obj = new\n\n @attributes.each do |key|\n value = obj.send \"parse_#{key}\", data\n obj.send \"#{key}=\", value\n end\n\n obj\n end",
"def init_jaxb_json_hash(_o)\n super _o\n if !_o['newState'].nil?\n _oa = _o['newState']\n if(_oa.is_a? Hash)\n @newState = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @newState = String.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @newState = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @newState.push String.from_json(_item)\n else\n @newState.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @newState = _oa\n end\n end\n end",
"def parse(json_str)\n Oj.load(json_str)\n end",
"def load_json(json)\n @raw = JSON.load(json)\n\n load_hash(@raw)\n end",
"def load_model(model_class)\n begin\n file_content = File.read(model_class.db_filename)\n json_data = JSON.parse(file_content)\n rescue Errno::ENOENT\n # The file does not exists\n json_data = []\n end\n json_data.each do |data_hash|\n new_object = model_class.from_hash(data_hash)\n new_object.save\n end\nend",
"def load_model(model_class)\n begin\n file_content = File.read(model_class.db_filename)\n json_data = JSON.parse(file_content)\n rescue Errno::ENOENT\n # The file does not exists\n json_data = []\n end\n json_data.each do |data_hash|\n new_object = model_class.from_hash(data_hash)\n new_object.save\n end\nend",
"def load_from_json!(raw_data)\n begin\n hash = JSON.parse(raw_data, symbolize_names: true)\n rescue JSON::ParserError => e\n raise InvalidRequestError, \"Malformed JSON data.\"\n end\n\n load_from_hash!(hash)\n end",
"def initialize(json)\n @id = json[:id]\n @entity_id = json[:entity_id]\n @role_id = json[:role_id]\n @destroy = false\n end",
"def from_hash(hash)\n struct = SparkleStruct.new\n struct._camel_keys_set(:auto_discovery)\n struct._load(hash)\n struct._camel_keys_set(nil)\n struct\n end",
"def from_hash(hash)\n struct = SparkleStruct.new\n struct._camel_keys_set(:auto_discovery)\n struct._load(hash)\n struct._camel_keys_set(nil)\n struct\n end",
"def from_json json, response_key\n model = nil\n raw = JSON.parse(json)\n response_key ? from_parsed_json(raw[response_key].nil? ? raw : raw[response_key], response_key) : raw\n end",
"def init_jaxb_json_hash(_o)\n if !_o['className'].nil?\n _oa = _o['className']\n if(_oa.is_a? Hash)\n @className = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @className = String.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @className = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @className.push String.from_json(_item)\n else\n @className.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @className = _oa\n end\n end\n if !_o['grade'].nil?\n _oa = _o['grade']\n if(_oa.is_a? Hash)\n @grade = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @grade = Float.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @grade = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @grade.push Float.from_json(_item)\n else\n @grade.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @grade = _oa\n end\n end\n end",
"def build_class_from_schema(cr_json_schema, object_class)\n # A. Build all nested objects\n cr_classes = {}\n if cr_json_schema.keys.include?('definitions')\n cr_definitions = cr_json_schema['definitions'].keys\n #puts \"-----**********----- Definitions -----**********-----\"\n #puts cr_definitions.to_s\n cr_json_schema['definitions'].each do |key, nested_object|\n #puts key + \":\" + nested_object.to_s\n new_class_name = cr_class_name(key)\n #puts new_class_name\n cr_nested_class = build_simple_class(nested_object, new_class_name)\n cr_classes[key] = cr_nested_class\n end\n end\n # B. build main class using object properties\n cr_class = build_simple_class(cr_json_schema, object_class)\n #cr_properties = cr_json_schema['properties'].keys\n #cr_class = CrApiWrapper::CrObjectFactory.create_class object_class, cr_properties\n cr_classes[object_class] = cr_class\n # return the hash of cr classes\n return cr_classes\nend",
"def build_from_hash(hash)\n instance = self.new\n\n # Add the instance attributes dynamically from the hash. If the attribute\n # does not already exist, then don't re-add the attribute class and\n # variable, just set it with the value from the hash\n hash.keys.each do |key|\n class_eval { attr_accessor key } unless instance.methods.include?(key.to_sym)\n instance.instance_variable_set \"@#{key}\", hash[key]\n end\n\n instance\n end",
"def json_to_object(json)\n JSON(json)\nend",
"def make_klass(result)\n keys = result.keys.map(&:to_sym)\n Class.new do\n attr_accessor *keys\n\n def initialize(hash)\n hash.each { |key,val| send(\"#{key}=\", val) }\n end\n\n def method_missing(*args)\n nil\n end\n end\n end",
"def from_json(source, opts = {})\n obj = parse(source, opts)\n\n # JSON gem requires top level object to be a Hash or Array (otherwise\n # you get the \"must contain two octets\" error). Yajl doesn't impose the\n # same limitation. For compatibility, we re-impose this condition.\n unless obj.kind_of?(Hash) || obj.kind_of?(Array)\n raise JSON::ParseError, \"Top level JSON object must be a Hash or Array. (actual: #{obj.class})\"\n end\n\n # The old default in the json gem (which we are mimicing because we\n # sadly rely on this misfeature) is to \"create additions\" i.e., convert\n # JSON objects into ruby objects. Explicit :create_additions => false\n # is required to turn it off.\n if opts[:create_additions].nil? || opts[:create_additions]\n map_to_rb_obj(obj)\n else\n obj\n end\n end",
"def initialize(json_payload)\n @jid = json_payload['jid']\n setup_job_attrs(json_payload['job'])\n end",
"def initialize(json = {}, needs_caching = true) \n\t\t\t# needs_caching is used for internal methods which load the record from cache and therefore don't need to save to cache\n\t\t\tset_attributes(json)\n\t\t\tsave_to_cache if needs_caching\n\n\t\t\treturn nil\n\t\tend",
"def object_class_from_response(response)\n kind = object_kind_from_response(response)\n object_class_from_kind(kind)\n end",
"def initialize(json = nil)\n if json\n @name = json[\"name\"]\n @prefix = json[\"prefix\"]\n @suffix = json[\"suffix\"]\n @target = json[\"target\"]\n @triggers = (json[\"triggers\"] || []).map { |t| \"s3:#{t}\" }\n @type = json[\"type\"]\n end\n end"
] |
[
"0.7809021",
"0.7148607",
"0.70119697",
"0.695165",
"0.6752648",
"0.65935934",
"0.6579648",
"0.638095",
"0.63557273",
"0.6327854",
"0.63100433",
"0.6272995",
"0.6204618",
"0.620255",
"0.6185165",
"0.61575234",
"0.6112106",
"0.6112106",
"0.6105587",
"0.6105587",
"0.60926837",
"0.6085441",
"0.6079277",
"0.60680354",
"0.606229",
"0.6056029",
"0.60551196",
"0.60440946",
"0.6032603",
"0.60178924",
"0.600456",
"0.59909546",
"0.59864086",
"0.5973121",
"0.59687614",
"0.59508026",
"0.5948064",
"0.5909158",
"0.58944184",
"0.58818483",
"0.58699745",
"0.5861501",
"0.5839497",
"0.58385605",
"0.58385605",
"0.5836307",
"0.583391",
"0.5788887",
"0.5773555",
"0.5771345",
"0.57694423",
"0.57694423",
"0.575804",
"0.57395965",
"0.572612",
"0.5706699",
"0.5704349",
"0.57017815",
"0.5695492",
"0.569356",
"0.5680497",
"0.5677891",
"0.5669075",
"0.5657215",
"0.56566405",
"0.5653049",
"0.56495184",
"0.5647294",
"0.5645677",
"0.5626837",
"0.5598074",
"0.5573609",
"0.5566748",
"0.5553665",
"0.55526465",
"0.55485594",
"0.5539573",
"0.55354017",
"0.5529945",
"0.552396",
"0.55138993",
"0.5501977",
"0.5497626",
"0.54952484",
"0.54952484",
"0.54510957",
"0.5441343",
"0.5437214",
"0.5437214",
"0.5418506",
"0.5417698",
"0.54143757",
"0.54088163",
"0.5405061",
"0.53973484",
"0.5395617",
"0.53938806",
"0.53909063",
"0.5390475",
"0.5388429"
] |
0.8070366
|
0
|
titleSlide() This is the first method that runs, and then calls menu()
|
def titleSlide()
=begin
print "\n-------------------------------------------------------------------------\n"
print $titleSlideFont.write("Console Light Show")
print "\nA program for Joshua Bruce\nWritten with love by Robert Leslie\n"
print "---------------------------------------------------------------------------\n"
=end
titleSlideFont = TTY::Font.new(:standard)
titleBox = TTY::Box.frame(
width: TTY::Screen.width-1,
height: 15,
border: :thick,
align: :center,
padding: 1
)do
"#{titleSlideFont.write("Console Light Show")}
\nA program for Joshua Bruce\nWritten with love by Robert Leslie\n2019"
end
print titleBox
menu()
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def run_normal\n welcome_header\n main_menu \n end",
"def goto_title(delay = 30)\r\n fadeout_all\r\n Graphics.wait(delay)\r\n SceneManager.goto(Scene_Title)\r\n end",
"def command_to_title\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Fade out BGM, BGS, and ME\r\n Audio.bgm_fade(800)\r\n Audio.bgs_fade(800)\r\n Audio.me_fade(800)\r\n # Switch to title screen\r\n $scene = Scene_Title.new\r\n end",
"def get_started\n \t@title= \"Antes de empezar...\" #Page title\n end",
"def main()\n main_menu(SHOW_HEADER);\n end",
"def section_title(title)\n end",
"def main_menu\n name_selector\n puts \"Okay #{@name}, what would you like to do?\"\n loop do\n case menu_arrows\n when '1'\n @recommendation.recommendation_menu\n when '2'\n puts 'you have the following number of games in your library: '\n @game_library.game_instances\n puts 'your custom list of games:'\n @game_library.user_games_lister\n when '3'\n puts 'add a game:'\n @game_library.add_title\n when '4'\n @game_library.delete_games\n when '5'\n @time_used.time_wasted\n when '6'\n @game_library.write_games\n puts 'thanks for your time!'\n exit\n end\n end\n end",
"def get_title_from_slide_text(slide_text)\n\n end",
"def menu\n \n \n\nend",
"def command_to_title\n Sound.play_decision\n RPG::BGM.fade(800)\n RPG::BGS.fade(800)\n RPG::ME.fade(800)\n $scene = Scene_Title.new\n close_command_window\n Graphics.fadeout(60)\n end",
"def menu\nend",
"def index\n\t\t@content_title = \"Main menu\"\n\tend",
"def menu\n \nend",
"def update_title?\r\n # If returning to title screen\r\n if $game_temp.to_title\r\n # Switch to title screen\r\n $scene = Scene_Title.new\r\n return true\r\n end\r\n return false\r\n end",
"def title=(_arg0); end",
"def title=(_arg0); end",
"def title=(_arg0); end",
"def start_section(level, title)\n end",
"def run\n welcome\n menu_exit\n end",
"def title\n end",
"def change_title\n @status_window.deactivate\n @title_window.select_last\n @title_window.show.activate\n @title_window.refresh\n @help_window.show\n end",
"def set_title\n unless self.title\n if self.parent\n if last_untitled_page = self.parent.children.where(:title => /Untitled /i).asc(:title).last\n last_untitled_number = last_untitled_page.title.split(\" \").last.to_i\n self.title = \"Untitled #{last_untitled_number+1}\"\n else\n self.title = \"Untitled 1\"\n end\n else\n self.title = \"Untitled 1\"\n end\n end\n end",
"def begin_page_title( title, show_help_button=false )\n if ( show_help_button )\n hb = button_function_tag(\"\", 'Effect.toggle( \"help\", \"slide\", {duration:0.5}); return false', \"help.png\", false);\n else\n hb = \"\"\n end\n return \"<table cellspacing='0' cellpadding='0' border='0' width='100%' class='page_title'><tr><td class='title'>#{title} #{hb}</td><td class='buttons'>\";\n end",
"def main_menu_runner\n\n splash\n\n login_menu_display\n\n end",
"def about_us\r\n\t@title = \"About Us\"\r\n end",
"def main_end\r\n super\r\n # If switching to title screen\r\n if $scene.is_a?(Scene_Title)\r\n # Fade out screen\r\n Graphics.transition\r\n Graphics.freeze\r\n end\r\n end",
"def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @title_window = Window_Outline_Title.new(0, 0, 640, 56)\n @content_window = Window_Outline.new(0, 56, 640, 424)\n \n # Create Window \n @list_window = Window_Outline_List.new(0, 0, 400, 400, Vocab::tutorials_strings)\n width_remain = (640 - @list_window.width)/2\n @list_window.x = width_remain.floor\n height_remain = (480 - @list_window.height)/2\n @list_window.y = height_remain.floor\n end",
"def start\n title = Artii::Base.new\n title = title.asciify ('ToDo.it')\n puts title.colorize(:blue)\n \n welcome_section\nend",
"def command_to_title\n RPG::BGM.fade(800)\n RPG::BGS.fade(800)\n RPG::ME.fade(800)\n $scene = Scene_Title.new\n Graphics.fadeout(60)\n end",
"def book_choir\r\n\t@title = \"Book the Choir\"\r\n end",
"def menu # can do custom methods within a method/class\n end",
"def update_to_title?\r\n # If returning to title screen\r\n if $game_temp.to_title\r\n # Change to title screen\r\n $scene = Scene_Title.new\r\n return true\r\n end\r\n return false\r\n end",
"def set_page_title\n\t\t@page_title = \"#{self.action_name.capitalize}: Abstract /\" <<\n\t\t\t\" #{Abstract.sections.find{|a|a[:controller] == self.class.name.demodulize}[:label]}\"\n\tend",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def main\n create_graphics\n curr_scene = $scene\n check_up\n while @running && curr_scene == $scene\n Graphics.update\n update\n end\n dispose\n # Unload title related pictures\n RPG::Cache.load_title(true)\n RPG::Cache.load_interface(true)\n ::Scheduler.start(:on_scene_switch, ::Scene_Title) if !@running && $scene.is_a?(Scene_Map)\n end",
"def home\n @title = \"Home Base\"\n end",
"def list_menu\n puts \"\\nMain Menu\"\n puts \"1. Daily Prophet - News!\"\n puts \"2. Evanesco - Exit\"\n end",
"def title_block\n #displays a fancy title block for our program\n puts \"WELCOME TO... \"\n puts \"____ ____ _____ \"\n puts \"\\\\ \\\\ / /____ ____ __ __ / \\\\ ____ ____ __ __ \"\n puts \" \\\\ Y // __ \\\\ / \\\\| | \\\\/ \\\\ / \\\\_/ __ \\\\ / \\\\| | \\\\ \"\n puts \" \\\\ /\\\\ ___/| | \\\\ | / Y \\\\ ___/| | \\\\ | / \"\n puts \" \\\\___/ \\\\___ >___| /____/\\\\____|__ /\\\\___ >___| /____/ \"\n puts \" \\\\/ \\\\/ \\\\/ \\\\/ \\\\/ \"\n puts \" BY: MINH AND JUSTIN\"\nend",
"def set_page_title\n case @title\n when 'Winter', 'Spring', 'Summer', 'Fall'\n parent_content = Content.new(@parent_path)\n @page_title = @title + ' ' + parent_content.title\n else\n @page_title = @title\n end\n end",
"def call_menu\n return if $game_system.menu_disabled\n Sound.play_open_menu\n @spriteset.clear_banners\n#~ if @spriteset.banners?\n#~ bs = @spriteset.title_banners ? @spriteset.title_banners : []\n#~ pb = @spriteset.party_banners ? @spriteset.party_banners : []\n#~ rb = @spriteset.red_banners ? @spriteset.red_banners : []\n#~ $game_temp.remember_banners = [[bs],[pb],[rb]]\n#~ $game_temp.remember_banner_phase = [@spriteset.tickdown,@spriteset.banner_phase]\n#~ $game_temp.remember_joiners = @spriteset.joiners\n#~ $game_temp.remember_leavers = @spriteset.leavers\n#~ $game_temp.remember_removed = @spriteset.removed\n#~ $game_temp.remember_header = @spriteset.header_banner\n#~ $game_temp.remember_posx = @spriteset.posx\n#~ end\n SceneManager.call(Scene_Menu)\n Window_MenuCommand::init_command_position\n end",
"def title_help \n\n\t\t#Define general page title\n\t\tbase_title = \"Rex Ruby on Rails Learning | PagesHelper\"\n\t\tif(@title.nil?)\n\t\t\tbase_title\n\t\telse\n\t\t\tbase_title = \"Rex Ruby on Rails Learning | #{@title} | PagesHelper\"\n\t\tend\n\tend",
"def game_start\n opening\n first_menu\n end",
"def page_title\n end",
"def setTitle(title)\r\n\t\t\t\t\t@title = title\r\n\t\t\t\tend",
"def print_menu\n puts \"1. List patients\"\n # ....\n end",
"def menu_options\n system \"clear\"\n puts \"~~~ Welcome #{@user.username} to the Main Menu ~~~\\n\\n\" \n puts \"{1} Continue from previous story \"\n puts \"{2} Create new story\"\n puts \"{3} Delete a story\"\n puts \"{4} Tutorial\"\n puts \"{5} End My Session\"\nend",
"def set_title\n @title = \"#{controller_name}.#{action_name}.title\"\n end",
"def set_page_title(title)\n\t\t@page_title = @current_action.titleize + title\n\tend",
"def page_title\n \n page_title = @renderer.title title()\n \n puts \"[Cutlist.page_title]: #{page_title}\" if $cutlister_debug\n \n page_title\n \n end",
"def title_screen\n TitleScreen.new(ui, options).render\n quit?\n end",
"def run\n greet\n menu\n end",
"def menu\n puts '1) Promedio de notas'\n puts '2) Inasistencia alumnos'\n puts '3) Alumnos aprobados'\n puts '4) Salir'\nend",
"def main_end\r\n # If switching to title screen\r\n if $scene.is_a?(Scene_Title)\r\n # Fade out screen\r\n Graphics.transition\r\n Graphics.freeze\r\n end\r\n end",
"def update_title\n\n # Update the logo sprite\n @logo_sprite.update\n\n # And the prompt label(s)\n drift_x = @args.grid.center_x + 15.randomize(:ratio, :sign)\n drift_y = 400 + 5.randomize(:ratio, :sign)\n\n @prompt.each_with_index do |label, idx|\n\n # If we're stationary, pick a new random location to drift to\n label.movable_location(drift_x, drift_y - (idx * 75), 30) unless label.movable_moving?\n\n # And lastly, update it\n label.update\n\n end\n\n # And see if the user clicks on the button\n @button_sprite.update\n if @args.inputs.mouse.click &&\n @args.inputs.mouse.click.point.x.between?(@args.grid.center_x - 128, @args.grid.center_x + 128) &&\n @args.inputs.mouse.click.point.y.between?(128, 192)\n\n # Set the timer running from this point\n @args.state.vertices.start_tick = @args.tick_count\n\n # Set the shape count to zero\n @args.state.vertices.shape_count = 0\n\n # Start the right music\n @audio_handler.play('vertices/sounds/play.ogg')\n\n # And flag ourselves as running\n @args.state.vertices.running = true\n\n end\n\n end",
"def members_news\r\n\t@title = \"Members News\"\r\n end",
"def main_menu()\n system 'clear'\n loop do\n headline(\"My Petsitter App\")\n puts \"#{@emoji[:smiling_cat_face_with_open_mouth]} Welcome! #{@emoji[:dog_face]}\".colorize(:bold)\n puts @headline\n input = @prompt.select('Menu:') do |menu|\n menu.choice name: 'Pet Sitters', value: \"PET_SITTERS\"\n menu.choice name: 'Clients', value: \"CLIENTS\"\n menu.choice name: 'Jobs', value: \"JOBS\"\n menu.choice name: 'Logout', value: \"EXIT\"\n end\n puts '-' * 20\n go_to(input)\n end\n end",
"def set_page_title\n @page_title = \"Race Results Management\"\n end",
"def titleFadeOut _args\n \"titleFadeOut _args;\" \n end",
"def title=(text); end",
"def title=(text); end",
"def display_menu()\n return 'Welcome to the Chicken Farm Simulator'\nend",
"def title\n # Sets the browser title bar display\n base_title = \"Grademypitch\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def welcome\n puts \"---------------------------------------------\".center(70).blue\n puts \"Welcome to the Makers Academy Student Database!\".center(70).green\n puts \"---------------------------------------------\".center(70).blue\n interactive_menu\nend",
"def setup_slide\n return unless PONY::ERRNO.check_sequence(current_act)\n stop_all_movements\n xpos = (flip && !@ignore_flip_point ? -@acts[1] : @acts[1])\n ypos = @acts[2]\n slide(xpos, ypos, @acts[3], @acts[4], @acts[5] || 0)\n @acts[4].times do\n method_wait\n end\n end",
"def main_menu\n \"Welcome to BATTLESHIP\\nEnter p to play or q to quit\"\n end",
"def title?; end",
"def titleScreen()\n if $enableMusic\n titleMusic = fork{ exec 'afplay', \"./music/title.mp3\" }\n end\n puts `clear`\n puts drawTitle().colorize(:red)\n prompt = TTY::Prompt.new\n menuChoice = prompt.select(\"What would you like to do?\", [\"Play Hangman\", \"Credits\", \"Toggle Music\", \"Quit\"])\n if menuChoice == \"Play Hangman\"\n cancelMusic()\n puts `clear`\n doSpinner()\n puts `clear`\n playGame()\n elsif menuChoice == \"Credits\"\n puts `clear`\n credits()\n elsif menuChoice == \"Toggle Music\"\n if $enableMusic\n stopMusic = fork{exec 'killall', 'afplay'}\n $enableMusic = false\n elsif !$enableMusic\n $enableMusic = true\n end\n titleScreen()\n elsif menuChoice == \"Quit\"\n cancelMusic()\n puts `clear`\n exit!\n end\nend",
"def start_scene; end",
"def on_title_ok\n @actor.equip_title(@title_window.title)\n @status_window.refresh\n title_to_status\n end",
"def display\n\t\ttitle\n\tend",
"def header(in_page=\"\")\n\t # workaround to shoes/shoes4#1212:\n\t $clicky ||= []\n\t $clicky.each{ |i| i.hide }\n\t $clicky = []\n\t \n\t # Header\n\t self.scroll_top = 0\n\t background pattern(img_path \"bg1.png\")\n\t stack do\n\t background enve_blue(0.4)\n\t stack{ background rgb(0,0,0,1.0) } # workaround to shoes/shoes4#1190\n\t flow(width:1.0) do\n\t stack(width:40){}\n\t menu = [\n\t\t [\"Home\",\"/\",\"noun_208357_cc.png\"],\n\t\t [\"All tasks\",\"/index\",\"noun_208394_cc.png\"],\n\t\t [\"Examples\",\"/examples\",\"noun_229087_cc.png\"],\n\t\t [\"Update\",\"/update\",\"noun_229107_cc.png\"],\n\t\t [\"Website\",\"http://enve-omics.ce.gatech.edu/\",\n\t\t \"noun_208472_cc.png\"],\n\t\t [\"About\",\"/about\",\"noun_229118_cc.png\"]\n\t ]\n\t menu.each do |i|\n\t\t flow(width:60, height:65) do\n\t\t if i[1]==in_page\n\t\t\tbackground enve_blue(0.4)\n\t\t\tstack{ background rgb(0,0,0,1.0) } # shoes/shoes4#1190\n\t\t end\n\t\t stack(width:5, height:50){}\n\t\t stack(width:50) do\n\t\t\timage img_path((i[1]==in_page ? \"w-\" : \"\")+i[2]),\n\t\t\t width:50, height:50, margin:2\n\t\t\tinscription i[0], align:\"center\",\n\t\t\t size:(linux? ? 8 : 10),\n\t\t\t stroke: (i[1]==in_page ? white : black)\n\t\t end\n\t\t stack(width:5){}\n\t\t end.click{ (i[1]=~/^https?:/) ? open_url(i[1]) : visit(i[1]) }\n\t\t stack(width:5){}\n\t end\n\t end\n\t stack(height:5, width:1.0){}\n\t stack(height:2, width:1.0) { background black }\n\t end\n\t stack(height:20, width:1.0){}\n end",
"def call\n puts \"Hello! Welcome to Emo Lister\"\n\n list_podcasts\n menu\n goodbye\n end",
"def init()\n # Splash screen\n splash = ConsoleSplash.new(25,88)\n splash.write_header(\"Flood-It\", \"Huzaifa Ahmed\", \"1.0\")\n splash.write_center(-3, \"<Press enter to continue>\")\n splash.write_horizontal_pattern(\"*\")\n splash.write_vertical_pattern(\"*\")\n splash.splash\n\n # Press enter to continue\n gets\n\n # Load the main menu\n display_menu\nend",
"def page_title; end",
"def title!(*titles)\n window_title!(*titles)\n page_title!(titles.last)\n end",
"def show_title\n h2 { h @title.titles }\n text gs_title(@title)\n sources = []\n sources << a('Anime News Network Encyclopdia', :href => \"http://www.animenewsnetwork.com/encyclopedia/anime.php?id=#{@title.ann_id}\") unless @title.ann_id.nil?\n sources << a('AniDB', :href => \"http://anidb.net/perl-bin/animedb.pl?show=anime&aid=#{@title.anidb_id}\") unless @title.anidb_id.nil?\n \n unless sources.empty?\n p { \"View #{h @title.title} in #{sources.join(\", \")}.\" }\n end\n end",
"def header(title)\n \n clear = %x[clear]\n puts clear\n \n puts \" +++++++++++ +++++++++ ++++ \" \n puts \" +++++++++++++ +++++++++ +++ \" \n puts \" +++++++++++++++ +++++++++ ++ \" \n puts \" +++++++++++++++++ +++++++++ + \" \n puts \" +++++++++++++++++++ +++++++++ \" \n puts \" +++++++++++++++++++ +++++++++ +++++\" \n puts \" +++++++++++++++++++ +++++++++ +++++\" \n puts \" +++++++++++++++++ +++++++++ +++++\" \n puts \" +++++++++++++++ +++++++++ \" \n puts \" +++++++++++++ +++++++++ http://ofxAddons.com/\" \n puts \" +++++++++++ +++++++++ http://openframeworks.cc/\"\n \n puts \"\"\n puts \" - #{title}\"\n puts \"\"\n puts \"\"\n \n end",
"def welcome\n system 'clear'\n puts header.call \"Welcome to Ruby QuickNews\"\n puts \"Please login or create a new username\"\n login_menu\n end",
"def intro\n system 'clear'\n intro = PicDisplay.new\n intro.logo\n sleep(4)\n welcome\n end",
"def switch_title _value=0\n send_cmd(\"switch_title #{_value}\")\n end",
"def bar\n puts 'bar'\n main_menu\nend",
"def show # Show method\n menu # Show menu method above\n end",
"def about\n @title = \"about\"\n end"
] |
[
"0.6799781",
"0.6745861",
"0.64579237",
"0.6402513",
"0.63225865",
"0.6228538",
"0.61887145",
"0.61698556",
"0.6157576",
"0.6118033",
"0.6112168",
"0.60834444",
"0.60691595",
"0.6065486",
"0.6064926",
"0.6064926",
"0.6064926",
"0.60427964",
"0.6037542",
"0.6032545",
"0.6031368",
"0.5995492",
"0.59894645",
"0.5988446",
"0.5980184",
"0.5961699",
"0.5940342",
"0.5939857",
"0.5938031",
"0.59209144",
"0.5909613",
"0.5902822",
"0.58934736",
"0.5881895",
"0.5881895",
"0.5881895",
"0.5881895",
"0.5881895",
"0.5881895",
"0.5881895",
"0.5881895",
"0.5881895",
"0.5881895",
"0.5881895",
"0.5881895",
"0.5881895",
"0.5881895",
"0.5881895",
"0.5881895",
"0.5881895",
"0.5881895",
"0.5877129",
"0.5860445",
"0.5854382",
"0.5848578",
"0.58205914",
"0.58119005",
"0.58078116",
"0.5795494",
"0.5781639",
"0.5774977",
"0.57730985",
"0.57511085",
"0.5750942",
"0.5749584",
"0.57404274",
"0.572993",
"0.57267994",
"0.571163",
"0.57099473",
"0.56918997",
"0.56813264",
"0.56649345",
"0.5660746",
"0.56502074",
"0.5649123",
"0.5649123",
"0.56467503",
"0.56288314",
"0.5625738",
"0.5625038",
"0.5624248",
"0.56241673",
"0.5623265",
"0.56218076",
"0.5620786",
"0.5611856",
"0.56113374",
"0.5610884",
"0.5608486",
"0.56061214",
"0.56011194",
"0.5599682",
"0.55958265",
"0.55897164",
"0.5583465",
"0.55792665",
"0.55616486",
"0.55570304",
"0.55446416"
] |
0.6222469
|
6
|
menu() instead of having to run a very long command line, every single method calls this function in some form to return the user to this place, which can then safely end the program (unless the user performs an interrupt using Ctrl + C in the command\/terminal prompt, but that is not very nice, now is it?)
|
def menu()
print "\n-------------------------------------------------------------------------\n"
puts "1) Print Random Letters, Numbers, and Symbols (For a given set of time in seconds)"
puts "2) Enter a string to be printed in random colors (For a given set of time in seconds)"
puts "99) Beta Functions"
puts "100) End Program"
coin = gets.to_i
case(coin)
when 1
printRandom(getDuration())
when 2
puts "Enter your strings to be printed, separated by a comma"
str = gets.chomp
printStringS(str, getDuration())
when 99
puts "Entering Beta Functions..."
betaFuntions()
when 100
puts "Bye Bye"
when -1
infiniteLoopWarning(1)
else
puts "Undefined input"
menu()
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show_menu\n puts \"Type 'q' to quit\"\n puts \"Or press Return to continue\"\nend",
"def menu()\n system('clear')\n puts '==================== M E N U ===================='.colorize(:light_blue)\n puts \" Press enter to start\".colorize(:green)\n gets.chomp\n @@support.help\n numberPlayers\n sleep (0)\n game\n return \"Finishing the game\"\n end",
"def back_to_main()\n prompt = TTY::Prompt.new\n user_input = prompt.keypress(\n \"Press space or enter to return to main menu\", keys: [:space, :return]\n )\n system(\"clear\")\nend",
"def main_menu(user_instance)\n user_greeting(user_instance)\n case help\n when \"1\", \"playlist\", \"playlists\"\n system(\"clear\")\n playlists_menu(user_instance)\n when \"2\", \"songs\", \"song\"\n system(\"clear\")\n songs_menu(user_instance)\n # when \"3\", \"artists\", \"artist\"\n # system(\"clear\")\n # artists_menu(user_instance)\n when \"exit\"\n system(\"clear\")\n goodbye\n exit\n else\n system(\"clear\")\n puts \"Please enter a valid command.\".colorize(:red).bold\n main_menu(user_instance)\n end\nend",
"def command_line_menu\n\tputs \"--- Command Line Menu ---\"\n\tputs \"1: mv\"\n\tputs \"2: cp\"\n\tputs \"3: mkdir\"\n\tputs \"4: ls\"\n\tputs \"5: rm\"\n\tputs \"6: Main Menu\"\n\tuser_input_command_line_menu\nend",
"def atom_menu\n puts \"================\"\n puts \"Make a selection\"\n puts \"================\"\n puts \"1: ctrl + cmd + ^ or v\"\n puts \"2:\"\n puts \"8: Main Menu\"\n puts \"9: exit\"\n case gets.strip\n when \"1\"\n puts \"ctrl + cmd + ^ or v\"\n puts \"grabs the line you are on and moves it up or down as you want.\"\n reset\n #this gap is for adding more functions\n\n when \"8\"\n main_menu\n when \"9\"\n exit 0\n else\n bad_choice\n atom_menu\n end\nend",
"def finish() #method\n puts \"Menu cooked successfully.\"\n exit\n end",
"def main_menu\n choice = true\n while choice\n puts \"What would you like to do?\"\n puts \"(C)reate, (L)ist, (U)pdate, (D)elete, or (E)xit \"\n options = gets.chomp.downcase\n\n case options\n when \"c\"\n # runs method create line 101\n create\n when \"l\"\n #runs method list line 144\n list\n when \"u\"\n #runs method update line 161\n update\n when \"d\"\n #runs method delete line 229\n delete\n when \"e\"\n choice = false #exits world\n else\n puts \"Wrong Input. Please input C, L, U, D or E\"\n end\n end\n end",
"def main_menu\r\n puts \"\\nMain Menu.\"\r\n puts \"A. List Buildings\"\r\n puts \"B. List Machines\"\r\n puts \"C. List Snacks\"\r\n puts \"D. List Users\"\r\n puts \"E. Find a Snack\"\r\n puts \"F. Add a New Snack\"\r\n puts \"G. Create New User\"\r\n puts \"H. List Favorites\"\r\n puts \"I. Find Favorites\"\r\n puts \"J. Add Favorites\"\r\n puts \"Q. Quit\"\r\nend",
"def main_menu\n while(!$quit)\n case welcome_page\n when \"Login\"\n puts \"\\e[H\\e[2J\"\n login_loop\n when \"Register\"\n puts \"\\e[H\\e[2J\"\n register_loop\n when \"Exit\"\n exit\n end\n end\nend",
"def main_menu\n puts \"===============\"\n puts \"Make a selection\"\n puts \"===============\"\n puts \"1: Command line\"\n puts \"2: Atom\"\n puts \"3: Search?\"\n puts \"4: Quit\"\n puts \"===============\"\n\n case gets.strip\n when \"1\"\n command_line_menu\n when \"2\"\n atom_menu\n when \"3\"\n search_function\n reset\n when \"4\"\n exit 0\n else\n bad_choice\n main_menu\n end\nend",
"def main_menu\n prompt = TTY::Prompt.new(\n active_color: :red,\n symbols: {marker: \"⮊\"},\n quiet: true\n )\n\n puts \"\"\n menu_selection = prompt.select(\"Select an option:\") do |menu|\n menu.choice \"➊ Start a new game\", 1\n menu.choice \"➋ How to play\", 2\n menu.choice \"➌ Display win counts\", 3\n menu.choice \"➍ Exit program\", 4\n end\n\n case menu_selection\n when 1\n start_game\n when 2\n instructions\n when 3\n check_win_history\n when 4\n puts \"\\nThanks for playing\\n\\nGoodbye!\"\n exit\n else\n raise InvalidMenu\n end\n\n rescue InvalidMenu\n puts \"Invalid menu input. Please try again!\"\n retry\n rescue\n puts \"An unexpected error has occured. The program will now exit.\"\nend",
"def return_to_menu\n puts Rainbow(\"\\nWould you like to return to the menu? (y/n)\").white.bright\n user_input = gets.chomp\n if user_input == \"y\"\n menu\n menu_choice\n elsif user_input == \"n\"\n puts Rainbow(\"Would you like to quit the app? (y/n)\").white.bright\n user_input = gets.chomp\n if user_input == \"y\"\n exit\n else\n menu\n menu_choice\n end\n end\n end",
"def main_menu\n while true\n print_main_menu\n user_selected = gets.chomp.to_s\n call_option(user_selected)\n end\n end",
"def main_menu\n puts \"(b) - basic calculator\"\n puts \"(a) - advanced calculator\"\n puts \"(bmi) - BMI calculator\"\n puts \"(m) - mortgage calculator\"\n puts \"(t) - trip calculator\"\n puts \"(q) - quit\"\nend",
"def main_menu\n puts\"(b) - basic calculator\"\n puts\"(a) - advanced calculator\"\n puts\"(bmi) - body mass index\"\n puts\"(t) - trip calculator\"\n puts\"(m) - morgage\"\n puts\"(q) - quit\"\nend",
"def main_menu\n puts \"(b) - basic calculator\"\n puts \"(a) - advanced calculator\"\n puts \"(q) - quit\"\nend",
"def main_menu\n puts \"(b) - basic calculator\"\n puts \"(a) - advanced calculator\"\n puts \"(q) - quit\"\nend",
"def back_main_menu\n puts \"\\n\\n Press any key to go back to the main menu\"\n $stdin.getch\n clear\nend",
"def back_main_menu\n puts \"\\n\\n Press any key to go back to the main menu\"\n $stdin.getch\n clear\nend",
"def menu_prompt\n print \"[x - exit | h - help]\\nEnter your command: \"\nend",
"def interactive_menu\n\tloop do\n\tprint_menu\n\tprocess(gets.chomp)\n\tend\nend",
"def main_menu\n\n\tputs \"***Ruby Cheatsheet***\"\n\tputs \"1. Command Line\"\n\tputs \"2. IDE\" \n\tputs \"3. Search\"\n\tputs \"4. Quit\"\n\tputs \"Make a selection 1 - 4:\"\n\nend",
"def show_return_option\n puts \"\\n000 - Return to main Screen\"\n print \":>\"\n end",
"def interactive_menu\n loop do\n print_menu\n process(gets.chomp)\n end\nend",
"def main_menu\n input = 0\n until input.to_i == @@main_ops.length - 1 \n print \"\\e[H\\e[2J\" #clears the screen\n puts @name \n print_menu(@@main_ops)\n print \"Choose an option by entering a number: \"\n input = gets.chomp\n call_option(input)\n end\n end",
"def menu\n puts \"- Type in a #{\"Nintendo Character\".colorize(:red)} | #{\"Game Series\".colorize(:blue)} | #{\"Amiibo Series\".colorize(:green)}\\n\\n\"\n puts \"- Type #{'1'.colorize(:yellow)} for a list of all the Game Series included in the Amiibo collection\"\n puts \"- Type #{'2'.colorize(:yellow)} for a list of all the Amiibo Series included in the Amiibo collection\"\n puts \"- Type #{'3'.colorize(:yellow)} for a list of all the Characters included in Amiibo collection\"\n puts \"- Type #{'4'.colorize(:yellow)} for a list of ALL Amiibos collection\\n\\n\"\n puts \"- Type #{'exit'.colorize(:yellow)} to exit the CLI\\n\\n\"\n puts \"--------------------------------------------------------------------------------\\n\\n\"\n sleep(2)\n end",
"def menu \n prompt = TTY::Prompt.new\n choices = [\"Race🏎️\", \"Go to Garage🧰\", \"Open Shop🔑\", \"Leaderboards📈\", \"Log Out\"]\n choice = prompt.select(\"\", choices) \n if choice == choices[0] && user.user_cars.size > 0 \n system(\"clear\")\n race_meth() #############RACEMETH\n elsif choice == choices[0] && user.user_cars.size == 0 \n system(\"clear\")\n puts \"You have no cars to race. Purchase one from the shop first!\"\n menu()\n elsif choice == choices[1] && user.user_cars.size > 0 \n system(\"clear\")\n garage()\n elsif choice == choices[1] && user.user_cars.size == 0 \n system(\"clear\")\n puts \"You have no cars in your garage. Purchase one from the shop first!\"\n menu()\n elsif choice == choices[2] \n system(\"clear\")\n shop()\n elsif choice == choices[3]\n leaderboards()\n else\n intro() \n end \nend",
"def menu_options\n system \"clear\"\n puts \"~~~ Welcome #{@user.username} to the Main Menu ~~~\\n\\n\" \n puts \"{1} Continue from previous story \"\n puts \"{2} Create new story\"\n puts \"{3} Delete a story\"\n puts \"{4} Tutorial\"\n puts \"{5} End My Session\"\nend",
"def main_menu\n puts \"Main Menu\"\n puts \"(a) - Basic calculator\"\n puts \"(b) - Advanced calculator\"\n puts \"(c) - Special calculators\"\n puts \"(q) - Quit\"\nend",
"def menu(user)\n system \"clear\"\n print \"\\e[8;1000;1000t\"\n aa = Artii::Base.new :font => 'doom'\n puts aa.asciify(\"What would you like to do?\".center(110))\n puts\n puts aa.asciify(\"1. Play a New Game \".center(125))\n puts aa.asciify(\"2. View Leaderboard\".center(125))\n puts aa.asciify(\"3. How to Play \".center(125))\n puts aa.asciify(\"4. Exit \".center(125))\n user_input = gets.chomp\n if user_input == \"1\"\n start_game(user)\n elsif user_input == \"2\"\n display_leaderboard(user)\n elsif user_input == '3'\n how_to_play(user)\n elsif user_input == \"4\"\n system \"clear\"\n puts aa.asciify(\"Thanks for playing!\")\n bye_bear\n sleep(3)\n return nil\n else\n puts \"Selection not recognized\"\n system \"clear\"\n menu(user)\n end\nend",
"def showMainMenu()\n\tputs\n\tputs \"Select an option:\"\n\tputs \"R: Run \" + $fizz + $buzz\n\tputs \"C: Change Words\"\n\tputs \"Q: Quit\"\nend",
"def main_menu\n prompt = TTY::Prompt.new\n first = prompt.select(\"Greetings, #{@player.player_name}. Select Go to Town to start your adventure!\", %w(Go_to_Town Change_my_Name View_my_Quests View_my_Inventory View_my_Renown Slay_the_Dragon Save_the_Kingdom Exit_Game))\n #binding.pry\n if first == \"Go_to_Town\"\n system \"clear\"\n town_menu\n elsif first == \"Change_my_Name\"\n system \"clear\"\n change_name\n elsif first == \"View_my_Quests\"\n system \"clear\"\n view_my_quests #Shows all a players quests\n elsif first == \"View_my_Inventory\"\n system \"clear\"\n view_my_gear #Shows all a players gear\n elsif first == \"View_my_Renown\"\n system \"clear\"\n view_my_renwon #Shows a players total renown\n elsif first == \"Slay_the_Dragon\"\n system \"clear\"\n dragon_message\n elsif first == \"Save_the_Kingdom\"\n system \"clear\"\n kingdom_message\n elsif first == \"Exit_Game\"\n system \"clear\"\n exit_game\n else \n return \n end\nend",
"def run\n welcome\n menu_exit\n end",
"def main_menu\n\n puts \"Doctor's Office Manager\"\n puts \"Enter 'a' to access the appointments menu.\"\n puts \"Enter 's' to access specialities menu.\"\n puts \"Enter 'p' to access patient menu.\"\n puts \"Enter 'i' to access insurance menu.\"\n puts \"Enter 'd' to access doctor menu.\"\n puts \"Enter 'e' to exit\"\n puts \"Enter 'r' to access README\"\n\n user_choice = gets.chomp.downcase\n\n case user_choice\n when 'a'\n appointment_menu\n when 's'\n specialties_menu\n when 'p'\n patient_menu\n when 'i'\n insurance_menu\n when 'd'\n doctor_menu\n when 'e'\n puts \"Goodbye!\"\n sleep 1\n exit\n when 'r'\n display_readme\n else\n puts \"Enter something proper, ya jackass\"\n end\n\nmain_menu\nend",
"def interactive_menu\n # Repeat once a processs has been carried out\n loop do\n # Print the menu and ask the user what to do\n print_menu\n # Do what the user has selected (corresponding to the number entered by the user)\n selected_option(STDIN.gets.chomp)\n end\nend",
"def exit_prg \n puts \"Your brain must hurt from learning all of that information!\"\n exit \n end",
"def interactive_menu\n loop do \n print_menu\n user_selection(STDIN.gets.chomp)\n end\nend",
"def menu\n puts `clear`\n puts '*' * 52\n puts \"* Welcome to London Heathrow! *\".center 50\n puts '*' * 52\n puts '1: Add a flight'\n puts '2: List flights'\n puts '3: Add a passenger to a flight'\n puts '4: List passengers on a flight'\n puts 'q: Quit'\n print '-->'\n gets.chomp\nend",
"def run\n greet\n menu\n end",
"def main_menu\n while true\n print_main_menu\n user_selected =gets.to_i\n call_option(user_selected)\n end\n end",
"def interactive_menu\n\tloop do\n\t\tprint_menu\n\t\tprocess(STDIN.gets.chomp) # can replace with process(gets.gsub(\"\\n\", \"\"))\n\tend\nend",
"def displaymenu # Console only\r\n\t\t @output.puts \"Menu: (1) Play | (2) New | (3) Analysis | (9) Exit\"\r\n\t\t end",
"def main_menu(fridge)\r\n # loop the menu untill break\r\n loop do\r\n # ask if user wanna make Japanese food.\r\n puts \"Hello #{fridge.owner_name.green}. Wellcome to \"+\"Japanese Firdge\".cyan\r\n sleep 3\r\n system \"clear\"\r\n puts \"Would you like to make Japanese food?(y/n)\"\r\n choice = gets.strip.downcase\r\n case choice\r\n # when yes\r\n when \"y\"\r\n get_what_they_have(fridge)\r\n puts \"Let me think what you can make...\"\r\n sleep 3\r\n system \"clear\"\r\n loop do\r\n choose_recipe(find_mached_recipe(fridge))\r\n puts \" \"\r\n puts \"Press [b] to choose other recipes\\nPress [x] to exit\"\r\n exit_back_choice = gets.strip.downcase\r\n if exit_back_choice == \"b\"\r\n system \"clear\"\r\n elsif exit_back_choice == \"x\"\r\n puts \"See you next time! Enjoy your meal :)\"\r\n sleep 1\r\n abort\r\n end # if exit_back_choice end\r\n end # loop end\r\n\r\n # when no\r\n when \"n\"\r\n puts \"See you next time!\"\r\n sleep 1\r\n break\r\n else\r\n puts \"Say that again? #{choice} is not acceptable.\"\r\n sleep 1\r\n main_menu(fridge)\r\n end # case choice end\r\n end # loop end\r\nend",
"def interactive_menu\n puts \"\"\n puts \"-----Student Directory Program-----\".center(50)\n loop do\n print_menu_options\n selection = STDIN.gets.chomp\n menu_options(selection)\n end\nend",
"def main_menu\n puts \"------------------------------------------------------------------------------------------------------\".colorize(:yellow)\n Artii::Base#asciify\n a = Artii::Base.new\n a.asciify(\"Toy Robot Challenge\")\n system(\"clear\")\n puts a.asciify(\"Toy Robot Challenge\").colorize(:red,)\n\n prompt = TTY::Prompt.new\n choices = [\n {name: 'New Game.', value: 1},\n {name: 'Exit.', value: 2},\n ]\n players_input = prompt.select(\"Select An Option:\", choices) \n case players_input\n when 1\n new_game\n when 2\n exit\n end \nend",
"def command_line_menu\n puts \"===============\"\n puts \"Make a selection\"\n puts \"===============\"\n puts \"1: mv --pick file then destination to move it\"\n puts \"2: cd -- pick path from your spot to destination\"\n puts \"3: pwd --displays where you are\"\n puts \"4: touch -- creates a file with the arg you give\"\n puts \"5: ls -- gives a list of directories\"\n puts \"6: mkdir -- creates a directory named the arg you gave\"\n puts \"8: Main Menu\"\n puts \"9: quit\"\n puts \"===============\"\n\n case gets.strip\n when \"1\"\n puts `man mv`\n reset\n when \"2\"\n puts `man cd`\n reset\n when \"3\"\n puts `man pwd`\n reset\n when \"4\"\n puts `man touch`\n reset\n when \"5\"\n puts `man ls`\n reset\n when \"6\"\n puts `man mkdir`\n reset\n when \"8\"\n main_menu\n when \"9\"\n exit 0\n else\n bad_choice\n command_line_menu\n end\n\nend",
"def interactive_menu\n loop do\n print_menu\n user_choice(STDIN.gets.chomp)\n end\nend",
"def main_menu() \n user_input = nil\n while user_input != 4\n system(\"clear\")\n\n puts title_box(\"Main Menu\")\n\n prompt = TTY::Prompt.new\n question = \"Select an action:\"\n choices = [{\"Add book\" => 1}, {\"Check log\" => 2}, {\"Manage log\" => 3}, {\"Exit\" => 4}]\n user_input = prompt.select(question, choices) \n #add new book to log\n if user_input == 1\n add_book()\n #check log\n elsif user_input == 2\n check_log()\n # manage log\n elsif user_input == 3\n manage_log() \n else user_input == 4\n return user_input\n end\n end\nend",
"def interactive_menu\n loop do\n print_menu\n process_menu(STDIN.gets.chomp)\n end\nend",
"def start_menu\n system 'clear'\n puts \"WELCOME TO THE SHELTER\"\n puts \"[da] - Display all animals up for adoption\"\n puts \"[dc] - Display all clients\"\n puts \"[a] - Create a new animal\"\n puts \"[c] - Create a new client\"\n puts \"[ad] - facilitate an adoption\"\n puts \"[sad] - facilitate a return to the shelter\"\n puts \"[q] -- Exit the program\"\n p \"Please enter a command: \"\n input = gets.chomp\n input_selector input\nend",
"def interactive_menu\n loop do\n menu\n process(STDIN.gets.chomp)\n end\nend",
"def display_menu\n font_sml = TTY::Font.new(:straight)\n font_big = TTY::Font.new(:doom)\n font_col = Pastel.new\n system \"clear\"\n # if statement to detect if arguments given in command line\n if ARGV.length == 1\n puts font_sml.write(\"#{ARGV[0]}, Welcome to...\") \n ARGV.clear\n elsif ARGV.length > 1 && ARGV[1] == \"-s\"\n puts font_sml.write(\"#{ARGV[0]}, Welcome to...\") \n ARGV.clear\n random_character\n pre-game\n else\n puts font_sml.write(\"Welcome to...\")\n end\n puts font_col.red(font_big.write(\"RPSG\"))\n puts \"If you haven't played before, it is advisable to read the instructions.\"\n # displays game menu to player\n return $prompt.select(\"What would you like to do?\",\n [\"Start New Game\", \"View Instructions\", \"View Leaderboard\", \"Exit Game\"])\nend",
"def display_main_menu\n puts '################################'\n puts '# {N}- Network Stuff #'\n puts '# {RF}- Read File #'\n # puts '# {GF}- Generate File #'\n # puts '# {D}- Run as Daemon #'\n # puts '# {TD}- Run as Trigger Daemon #'\n puts '# {Q}- Quit #'\n puts '################################'\nend",
"def menu_options\n puts \"Good morning, you have two options; you can either\"\n puts \"1. Add students to the directory\\n 2. View a list of students enrolled at Makers Academy\\n 3. Save the list of students to a file\\n 9. Exit the programme.\"\n puts \"Please type the option you would like?\"\nend",
"def menu\n puts \"\\n************************************************************\".colorize(:magenta).blink\n puts \"Select an option (1-5) from the menu below:\".colorize(:blue).bold\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"1. Don't want to think about what to cook? \\n Spin the RANDOM WHEEL OF RECIPES!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"2. Need some inspiration for cooking? \\n Find recipe by name OR \\n if you have leftover ingredients search your ingredients!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"3. Feeling creative? \\n Write and save your own recipe!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"4. View ALL your favorite recipes in 1 place!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"5. You're done? Time to exit...\".colorize(:blue)\n puts \"************************************************************\\n \".colorize(:magenta).blink\n end",
"def main_menu\n\t\twhile true\n\t\t\tprint_main_menu\n\t\t\tuser_selected = gets.chomp.to_i\n\t\t\t\tif user_selected == 7\n\t\t\t\tputs \"Current session ended, goodbye!\"\n\t\t\t\treturn\n\t\t\tend\n\t\t\tcall_option(user_selected)\n\t\tend\n\tend",
"def user_menu \n system(\"clear\")\n puts \"=================\"\n puts \"Welcome to Lunch\"\n puts \"Would you like to make an order? Y or N?\"\n order_choice = gets.strip \n if order_choice == \"Y\" || order_choice == \"y\"\n main_dishes \n elsif order_choice == \"N\" || order_choice == \"n\"\n puts \"Come back soon!\"\n exit \n else \n puts \"Invalid Choice.\"\n user_menu \n end \nend",
"def return_to_menu\n\tputs \"Return to Menu? [y/n]\"\n\tans = gets.chomp.downcase\n\n\tcase ans[0]\n\t\twhen \"y\"\n\t\t\tclear_screen\n\t\t\tmenu\n\t\twhen \"n\"\n\t\t\tclear_screen\n\t\t\tputs \"Okay. Well...see you around, then. I guess.\"\n\t\telse\n\t\t\tclear_screen\n\t\t\tputs \"Huh? Yes or No, please.\"\n\t\t\treturn_to_menu\n\tend\nend",
"def menu\n gets.chomp\nend",
"def interactive_menu\n loop do\n print_menu\n process(STDIN.gets.chomp)\n end\nend",
"def interactive_menu\n loop do\n print_menu\n process(STDIN.gets.chomp)\n end\nend",
"def interactive_menu\n loop do\n print_menu\n process(STDIN.gets.chomp)\n end\nend",
"def interactive_menu\n loop do\n print_menu\n process(STDIN.gets.chomp)\n end\nend",
"def interactive_menu\n loop do\n print_menu\n process(STDIN.gets.chomp)\n end\nend",
"def interactive_menu\n loop do\n print_menu\n process(STDIN.gets.chomp)\n end\nend",
"def interactive_menu\n loop do\n print_menu\n process(STDIN.gets.chomp)\n end\nend",
"def interactive_menu\n loop do\n print_menu\n process(STDIN.gets.chomp)\n end\nend",
"def menu\n puts \"Menu\"\n puts \"1. List Channels\"\n puts \"2. List Users\"\n puts \"3. Select User\"\n puts \"4. Select Channel\"\n puts \"5. Send Message\"\n puts \"6. Quit\"\nend",
"def interactive_menu \n loop do\n print_menu\n process(STDIN.gets.chomp)\n end\nend",
"def main_menu()\n system 'clear'\n loop do\n headline(\"My Petsitter App\")\n puts \"#{@emoji[:smiling_cat_face_with_open_mouth]} Welcome! #{@emoji[:dog_face]}\".colorize(:bold)\n puts @headline\n input = @prompt.select('Menu:') do |menu|\n menu.choice name: 'Pet Sitters', value: \"PET_SITTERS\"\n menu.choice name: 'Clients', value: \"CLIENTS\"\n menu.choice name: 'Jobs', value: \"JOBS\"\n menu.choice name: 'Logout', value: \"EXIT\"\n end\n puts '-' * 20\n go_to(input)\n end\n end",
"def cli_menu\n system \"clear\"\n menu_header\n puts\n puts \"Welcome, #{@customer.name}!\"\n puts\n $prompt.select(\"SELECT AN OPTION ⬇\") do |menu|\n menu.choice \"Fast Food\", -> { full_menu }\n menu.choice \"Restaurants\", -> { restaurants_menu }\n menu.choice \"Place Order\", -> { place_an_order }\n menu.choice \"Previous Orders\", -> { customer_orders }\n menu.choice \"Cancel Order\", -> { cancel_order }\n menu.choice \"My Account\", -> { account_information }\n menu.choice \"Logout\", -> { exit }\n end\nend",
"def interactive_menu\n loop do\n print_menu\n user_input(STDIN.gets.chomp)\n end\nend",
"def menu \n\tputs \"What would you like to do?\"\n\tputs \"1. Build a quiz?\"\n\tputs \"2. Take a quiz?\"\n\n\tchoice = gets.chomp.to_i\n\n\tcase choice\n\twhen 1\n\t\tsystem \"clear\"\n\t\tbuild_quiz \n\twhen 2\n\t\tsystem \"clear\"\n choose_quiz\n else\n \tsystem \"clear\"\n \tputs \"please try again\"\n \tmenu\n end\nend",
"def character_menu\n puts \" \"\n puts \" ┌─┐┬ ┬┌─┐┬─┐┌─┐┌─┐┌┬┐┌─┐┬─┐ ┬┌┐┌┌─┐┌─┐\"\n puts \" │ ├─┤├─┤├┬┘├─┤│ │ ├┤ ├┬┘ ││││├┤ │ │\"\n puts \" └─┘┴ ┴┴ ┴┴└─┴ ┴└─┘ ┴ └─┘┴└─ ┴┘└┘└ └─┘\"\n puts \" \"\n puts \" Please select an option from below:\"\n puts \" \"\n prompt = TTY::Prompt.new\n menu_choices = [\n \" [1] Find info of character\",\n \" [2] Find allegience of character\",\n \" [3] Search characters by culture\",\n \" [4] Wiki Menu\",\n \" [5] Main Menu\",\n ]\n prompt.select(\" \", menu_choices)\nend",
"def menu\n puts `clear`\n puts \"Bob Pizza Landlord Dashboard\"\n puts\n puts\n puts \"1 - View all the apartments\"\n puts \"2 - View all the tenants\"\n puts \"99 - Exit this App\"\n puts\n print \"Enter Menu Choice[1..2 99 ]:\"\n return gets.chomp.to_i\nend",
"def start_main_menu \n puts \"[1] Start\\n[2] Measurement Converter\\n[3] How to Use\".colorize(:yellow)\n user_input = gets.chomp.downcase\n if @answers[0][1].include?(user_input)\n self.start_recipe\n elsif @answers[0][2].include?(user_input)\n self.start_convert\n elsif @answers[0][3].include?(user_input)\n start_help() #module method\n self.start_main_menu\n elsif user_input == \"end\"\n exit \n else\n puts puts \"Do you not know how to press 1, 2 or 3 :| ... Try again.\".colorize(:red)\n self.start_main_menu\n end\n end",
"def main_menu(player)\n quit = false # boolean used to exit menu loop\n while quit != true # while loop to keep player in menu unless choice is made\n puts\n puts \"Type 'commands' for a list of available commands.\"\n print UI_ARROW.red + \" \"\n input = gets.chomp.strip.downcase\n puts\n case input # switch statement to go to player menu choice\n when 'fight', 'f', 'battle'\n choose_enemy(player)\n when 'armoury', 'a'\n armoury(player)\n when 'stats'\n player.view_stats\n when 'commands'\n list_commands\n when 'clear', 'cls' \n system 'clear'\n when 'quit', 'q', 'exit'\n abort(\"Look, bud. You leave now and you forfeit your body count!\".red)\n when 'godmode'\n player.level = 100\n player.coins = 5000\n else\n puts \"That's not an available command\"\n end\n end\nend",
"def interactive_menu\n loop do\n print_menu\n \n process(STDIN.gets.chomp)\n end\nend",
"def display_menu\n puts \"1. Scrapp townhalls' emails from web\"\n puts \"2. Send massive emails to townhalls\"\n puts \"3. Follow towhalls on Twitter\"\n puts \"4. Print me the JSON\"\n puts \"5. Exit program\"\n end",
"def continue\n if gets == \"\\n\"\n system \"clear\"\n main\n end\n end",
"def main_menu\n puts\n puts \"What would you like to do? Please enter a number:\".colorize(:green)\n puts \"---------------------\"\n puts \"1. Search Developer Jobs\".colorize(:color => :blue, :background => :white)\n puts \"---------------------\"\n puts \"2. See Saved Jobs\".colorize(:color => :blue, :background => :white)\n puts \"---------------------\"\n puts \"3. Apply From Saved Jobs\".colorize(:color => :blue, :background => :white)\n puts \"---------------------\"\n puts \"4. Have You Moved? Update Location Here\".colorize(:color => :blue, :background => :white)\n puts \"---------------------\"\n puts \"5. Sign Out\".colorize(:color => :blue, :background => :white)\n puts \"---------------------\"\n puts \"6. Exit Program\".colorize(:color => :blue, :background => :white)\n puts \"---------------------\"\n main_menu_response = gets.chomp.downcase\n if main_menu_response == \"1\"\n search_jobs\n elsif main_menu_response == \"2\"\n saved_jobs\n elsif main_menu_response == \"3\"\n apply_job\n elsif main_menu_response == \"4\"\n update_location\n elsif main_menu_response == \"5\"\n @@user_id = nil\n puts \"Signing out\".colorize(:color => :blue, :background => :white)\n sleep(1)\n welcome\n elsif main_menu_response == \"6\"\n exit\n else\n invalid_response\n main_menu\n end\n end",
"def menu\n puts \"Welcome to your local shelter\"\n puts \"(A)\\tTo add a new client\\n(B)\\tTo abandon an animal\\n(C)\\tTo adopt an animal\\n(Z)\\tFor admin features\\n(Q)\\tTo quit\"\n gets.chomp\nend",
"def main_menu_options\n a = Artii::Base.new #display main title greeting\n a.asciify('Menu')\n puts a.asciify('Menu').colorize(:blue)\n\n puts \"\"\n puts \"1. Search movies.\"\n puts \"2. View your list.\"\n puts \"\"\n puts \"Please input the number corresponding to your choice.\"\n input = gets.chomp #todo Check to see if you can break this\n system \"clear\"\n if input == '1'\n puts \"Let's look at some movies.\"\n movie_search #send user to the movie search screen\n elsif input == '2'\n display_movie_list_and_movie_list_options #send movie to the movie list screen\n else\n \"Please select a valid option\"\n main_menu_options #call the method again\n end\n end",
"def start_menu\n printf \"\\nPrograma para a disciplina de LPD\\n\"\n printf \"Choose one option\\n\"\n printf \"------------------------------------\\n\"\n printf \"1) Insert user\\n\"\n printf \"2) Login user\\n\"\n printf \"3) Delete user\\n\"\n printf \"0) Exit\\n\"\nend",
"def run_menu(menu)\n display_menu(menu)\n user_choice = get_user_input(menu.user_pick_one_prompt)\n while !menu.user_input_valid?(user_choice)\n user_choice = get_user_input(menu.user_wrong_choice_prompt)\n end\n if menu.user_wants_to_quit?(user_choice)\n exit 0\n else\n menu.find_menu_item_chosen(user_choice).do_if_chosen\n end\n end",
"def do_manual\n display_world\n puts \"Press enter to continue\"\n STDOUT.flush\n input = STDIN.gets.chomp\n if input == \"quit\" or input == \"exit\"\n exit\n end\n end",
"def home_screen\n\tprint \"\\n+---------------------------------------\\n\"\n\tputs \"| What would you like to do?\"\n\tputs \"| 1: List Database Contents\"\n\tputs \"| 2: Enter New Item Into Database\"\n\tputs \"| 3: Remove Item From Database\"\n\tputs \"| 4: Update Item Information\"\n\tputs \"| 5: Exit\"\n\tprint \"| \"\n\tuser_choice = gets.strip\n\tprint \"\\n\"\n\tcase user_choice\n\twhen \"1\"\n\t\tdisplay_contents\n\twhen \"2\"\n\t\tadd_information\n\twhen \"3\"\n\t\tdelete_information\n\twhen \"4\"\n\t\tupdate_information\n\twhen \"5\"\n\t\tabort \"Goodbye!\"\n\telse\n\t\tputs \"You entered an incorrect option.\"\n\t\thome_screen\n\tend\nend",
"def student_main_menu(student_user) \n self.line_break\n puts \"Please select a command:\".colorize(:light_blue), \"1: Return to Main Menu\".colorize(:cyan), \"2: Exit\".colorize(:cyan)\n self.line_break\n input = gets.chomp\n until input == \"1\" || input == \"2\"\n puts \"Invalid response. Please select a command:\".colorize(:yellow), \"1: Return to Main Menu\".colorize(:cyan), \"2: Exit\".colorize(:cyan) \n input = gets.chomp\n end\n if input == \"1\"\n self.student_tasks(student_user)\n elsif input == \"2\"\n puts \"Have a great day!\".colorize(:light_green)\n end\n end",
"def print_menu\n # 1. print the menu and ask the user what to do\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"9. Exit\" # '9' because we'll be adding more items later\nend",
"def house_menu\n puts \"\n ┬ ┬┌─┐┬ ┬┌─┐┌─┐ ┬┌┐┌┌─┐┌─┐\n ├─┤│ ││ │└─┐├┤ ││││├┤ │ │\n ┴ ┴└─┘└─┘└─┘└─┘ ┴┘└┘└ └─┘\n\n Please select an option from below:\n \"\n prompt = TTY::Prompt.new\n menu_choices = [\n \" [1] Find all characters of a house\",\n \" [2] Find largest houses\",\n \" [3] Find all houses of a region\",\n \" [4] Find info of a house\",\n \" [5] Wiki Menu\",\n \" [6] Main Menu\"\n ]\n prompt.select(\" \", menu_choices)\nend",
"def main_menu(player)\n quit = false # boolean used to exit menu loop\n while quit != true # while loop to keep player in menu unless choice is made\n puts\n puts \"Type 'commands' for a list of available commands.\"\n print UI_ARROW.red + \" \"\n input = gets.chomp.strip.downcase\n puts\n case input # switch statement to go to player menu choice\n when 'fight', 'f', 'battle'\n player.choose_enemy\n when 'armoury', 'a'\n player.armoury\n when 'stats'\n player.view_stats\n when 'commands'\n list_commands\n when 'clear', 'cls' \n system 'clear'\n when 'quit', 'q', 'exit'\n abort(\"Look, bud. You leave now and you forfeit your body count!\".red)\n when 'godmode'\n player.level = 100\n player.coins = 5000\n else\n puts \"That's not an available command\"\n end\n end\nend",
"def menuScreen\n @levelNo=1\n clearScreen\n puts \"You are at the menu for Sokoban\"\n puts \"To quick play: Press 'p'\"\n puts \"To choose a level: Press 'c'\"\n puts \"To stop: Press 'q'\"\n charPressedInMenu\nend",
"def menu\n draw_line\n puts \" _______________________________________________________ \"\n puts \" | |\"\n puts \" | ~~THE QUEST~~ |\"\n puts \" | |\"\n puts \" | >>>>>>>>>>> 1. Thebes |\"\n puts \" | >>> | 2. Troy |\"\n puts \" | | = | 3. Hades |\"\n puts \" | | __| 4. GO HOME |\"\n puts \" | | -| |\"\n puts \" | |______| |\"\n puts \" | |\"\n puts \" |_______________________________________________________|\"\nend",
"def interactive_menu\n loop do\n print_menu # Invoking print_menu method\n process(STDIN.gets.chomp) # using input as argument of process method\n end\nend",
"def interactive_menu\n loop do\n# 1. Print the menu and ask the user what they want to do\n print_menu\n process(STDIN.gets.chomp)\n end #<-loop do\nend",
"def menu\n puts `clear`\n print Rainbow(\"\\n\\n\\t***Calculator***\\n\\n\").red\n print Rainbow(\"(b)asic, (a)dvanced, or (q)uit\\n\\n\").green\n choice = gets.chomp.downcase\n case choice[0]\n when \"b\"\n basic_calc\n when \"a\"\n advanced_calc\n when \"q\"\n puts Rainbow(\"\\n\\tGoodbye\\n\").magenta\n gets\n response = \"q\"\n\n else \n puts Rainbow(\"You're doing it wrong!\".upcase).red\n menu\n end\n \nend",
"def menu\n\tputs\n\tputs\n puts \"Welcome to the Real Estate search engine\"\n puts \"To list all available apartments, please press 1\"\n puts \"Press Q to quit\"\nend",
"def any_key\n puts \"\\n\\n Press any key to go back to the main menu\"\n $stdin.getch\n clear\nend",
"def main_menu\n puts \"---------------Animal shelter 4.5A-----------\"\n puts\n puts \"[1] List clients\"\n puts \"[2] List animals for adoption\"\n puts \"[3] Add a new client\"\n puts \"[4] Add a new animal\"\n puts\n puts\n puts \"[5] exit\"\n puts \"---------------------------------------------\"\nend",
"def interactive_menu\n loop do\n print_menu\n selection\n end\nend"
] |
[
"0.79807675",
"0.7569223",
"0.7413971",
"0.7380073",
"0.7360637",
"0.73490816",
"0.73489606",
"0.7323422",
"0.73112",
"0.71781754",
"0.7174452",
"0.71654123",
"0.7164307",
"0.71610934",
"0.7147149",
"0.7144417",
"0.71277463",
"0.71277463",
"0.711951",
"0.711951",
"0.711223",
"0.7109059",
"0.70983565",
"0.7094681",
"0.7090242",
"0.7086257",
"0.708157",
"0.7070817",
"0.7068873",
"0.70514756",
"0.70461106",
"0.70439786",
"0.7040384",
"0.70250785",
"0.7016133",
"0.70054615",
"0.70027936",
"0.7000109",
"0.69988763",
"0.6997604",
"0.69940245",
"0.6983119",
"0.6978833",
"0.69726527",
"0.69725376",
"0.69621384",
"0.6958898",
"0.694542",
"0.6936779",
"0.69365937",
"0.6923953",
"0.6923657",
"0.6918068",
"0.6912486",
"0.6910766",
"0.6905084",
"0.6903297",
"0.68870956",
"0.6886846",
"0.68857116",
"0.68790764",
"0.68790764",
"0.68790764",
"0.68790764",
"0.68790764",
"0.68790764",
"0.68790764",
"0.68777287",
"0.6873673",
"0.686969",
"0.68681604",
"0.6867574",
"0.6863527",
"0.6862928",
"0.6851143",
"0.6845606",
"0.68422294",
"0.68414086",
"0.68382883",
"0.68258226",
"0.68246806",
"0.6824617",
"0.6824283",
"0.68229616",
"0.6816383",
"0.6814627",
"0.6805204",
"0.6804902",
"0.68005747",
"0.67972064",
"0.6792749",
"0.6790772",
"0.6785113",
"0.67839724",
"0.6781174",
"0.67782074",
"0.6777895",
"0.67696106",
"0.67610765",
"0.67584366",
"0.6757741"
] |
0.0
|
-1
|
This method is a menu used to call and test functions which I quite haven't yet ironed out the kinks, I haven't thrown into the menu yet, or don't fit quite right for the menu
|
def betaFuntions()
print "\n-------------------------------------------------------------------------\n"
puts "These are the Beta Functions, these are functions that are not quite thought"
puts "yet, I havne't put into the main menu yet, or isn't quite right for the menu"
puts "Use these at your own discretion, I'm not your dad"
puts "1) getIsMe()"
puts "2) getOnMe() (heheheheh)"
puts "3) printStringRandomFont(string, duration)"
puts "4) printRandomFont(duration)"
puts "5) getFont()"
puts "99) Infinite Loop warning Message"
puts "100) Return to safety"
coin = gets.to_i
case(coin)
when 1
getIsMe()
when 2
getOnMe() #heheheheheh
when 99
infiniteLoopWarning(0)
when 100
menu()
when 3
puts "Enter your strings to be printed, separated by a comma"
str = gets.chomp
printStringRandomFont(str, getDuration())
when 4
printRandomFont(getDuration())
when 5
getFont()
else
puts "Undefined Input\nReturning To Safety"
menu()
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def main_menu\n name_selector\n puts \"Okay #{@name}, what would you like to do?\"\n loop do\n case menu_arrows\n when '1'\n @recommendation.recommendation_menu\n when '2'\n puts 'you have the following number of games in your library: '\n @game_library.game_instances\n puts 'your custom list of games:'\n @game_library.user_games_lister\n when '3'\n puts 'add a game:'\n @game_library.add_title\n when '4'\n @game_library.delete_games\n when '5'\n @time_used.time_wasted\n when '6'\n @game_library.write_games\n puts 'thanks for your time!'\n exit\n end\n end\n end",
"def menu # can do custom methods within a method/class\n end",
"def build_menu(application_name, method_names)\n #take array of method names and turn into menu\n puts \"#{application_name.humanize}\"\n method_names.each_with_index {|method_name, index| puts \"#{index + 1}: #{method_name.to_s.humanize}\"}\n puts \"\\nPlease enter your selection:\"\nend",
"def main_menu\n puts\"(b) - basic calculator\"\n puts\"(a) - advanced calculator\"\n puts\"(bmi) - body mass index\"\n puts\"(t) - trip calculator\"\n puts\"(m) - morgage\"\n puts\"(q) - quit\"\nend",
"def main_menu(user_instance)\n user_greeting(user_instance)\n case help\n when \"1\", \"playlist\", \"playlists\"\n system(\"clear\")\n playlists_menu(user_instance)\n when \"2\", \"songs\", \"song\"\n system(\"clear\")\n songs_menu(user_instance)\n # when \"3\", \"artists\", \"artist\"\n # system(\"clear\")\n # artists_menu(user_instance)\n when \"exit\"\n system(\"clear\")\n goodbye\n exit\n else\n system(\"clear\")\n puts \"Please enter a valid command.\".colorize(:red).bold\n main_menu(user_instance)\n end\nend",
"def print_menu\n puts \"Which action [list|add|delete|mark|idea|quit]?\"\nend",
"def main_menu\n puts \"(b) - basic calculator\"\n puts \"(a) - advanced calculator\"\n puts \"(bmi) - BMI calculator\"\n puts \"(m) - mortgage calculator\"\n puts \"(t) - trip calculator\"\n puts \"(q) - quit\"\nend",
"def main_menu\n choice = true\n while choice\n puts \"What would you like to do?\"\n puts \"(C)reate, (L)ist, (U)pdate, (D)elete, or (E)xit \"\n options = gets.chomp.downcase\n\n case options\n when \"c\"\n # runs method create line 101\n create\n when \"l\"\n #runs method list line 144\n list\n when \"u\"\n #runs method update line 161\n update\n when \"d\"\n #runs method delete line 229\n delete\n when \"e\"\n choice = false #exits world\n else\n puts \"Wrong Input. Please input C, L, U, D or E\"\n end\n end\n end",
"def special_usage\n puts \"Available Options for Specialty Tools Menu: \".underline.white\n puts \"back \".light_yellow + \" => \".white + \"Return to Main Menu\".light_red\n puts \"coldfusion\".light_yellow + \" => \".white + \"Coldfusion Tools\".light_red\n puts \"moinmoin\".light_yellow + \" => \".white + \"MoinMoin RCE\".light_red\n puts \"phpcgi\".light_yellow + \" => \".white + \"PHP CGI RCE Tools\".light_red\n puts \"phpBB\".light_yellow + \" => \".white + \"phpBB Tools\".light_red\n puts \"ipb\".light_yellow + \" => \".white + \"IPB Tools\".light_red\n# puts \"joomla\".light_yellow + \" => \".white + \"Joomla! Tools\".light_red\n# puts \"myBB\".light_yellow + \" => \".white + \"MyBB Tools\".light_red\n# puts \"vBulletin\".light_yellow + \" => \".white + \"vBulletin Tools\".light_red\n puts \"wp\".light_yellow + \" => \".white + \"WordPress Tools\".light_red\n puts \"fckeditor\".light_yellow + \" => \".white + \"FCKEditor Tools\".light_red\n print_line(\"\")\nend",
"def main_menu\n\n\tputs \"***Ruby Cheatsheet***\"\n\tputs \"1. Command Line\"\n\tputs \"2. IDE\" \n\tputs \"3. Search\"\n\tputs \"4. Quit\"\n\tputs \"Make a selection 1 - 4:\"\n\nend",
"def main_menu\n menu_options = [\"Start exploring\", \"Check Inventory\", \"Check Your Score\", \"Go to Pokemon Center\", \"Quit\"]\n menu_prompt = Interactivity.mainMenu \n \n if user.pokemon == nil\n menu_options.shift()\n menu_options.unshift(\"Choose a Pokemon and start exploring\")\n elsif self.user_current_location\n menu_options.shift()\n menu_options.unshift(\"Keep Exploring\")\n end\n \n choice = prompt.select(menu_prompt, menu_options) \n if choice == \"Start exploring\" || choice == \"Choose a Pokemon and start exploring\" || choice == \"Keep Exploring\"\n self.trainer_chooses_pokemon if user.pokemon == nil \n self.trainer_chooses_town\n self.exploring_town\n elsif choice == \"Check Inventory\"\n puts \"MANAGE INVENTORY - CHANGE POKEMONS AROUND\"\n elsif choice == \"Go to Pokemon Center\"\n self.pokemon_center\n elsif choice == \"Check Your Score\"\n puts \"CHECK YOUR SCORE\"\n else\n Interactivity.quit\n end\n end",
"def strass_menu_help\n puts \"Available Options for the String Assistant Menu: \".underline.white\n puts \"back \".light_yellow + \" => \".white + \"Return to Main Menu\".light_red\n puts \"show basic \".light_yellow + \" => \".white + \"Show Basic Functions\".light_red\n puts \"show build \".light_yellow + \" => \".white + \"Show Builder Functions\".light_red\n puts \"show tamper \".light_yellow + \" => \".white + \"Show Tamper Functions\".light_red\n puts \"show append \".light_yellow + \" => \".white + \"Show Append Functions\".light_red\n puts \"show space \".light_yellow + \" => \".white + \"Show Whitespace Functions\".light_red\n puts \"show comma \".light_yellow + \" => \".white + \"Show Comma Functions\".light_red\n puts \"show floor \".light_yellow + \" => \".white + \"Show Floor() Functions\".light_red\n print_line(\"\")\nend",
"def sub_menu(choise)\n case choise\n when '1'\n make_route\n when '2'\n make_station\n when '3'\n make_train\n when '4'\n list_routes\n when '5'\n list_stations\n when '6'\n list_trains\n when '7'\n list_station_trains\n when '8'\n attach_station\n when '9'\n dettach_station\n when '10'\n attach_train\n when '11'\n attach_wagon\n when '12'\n dettach_wagon\n when '13'\n list_train_wagons\n when '14'\n occupy_train_wagon\n when '15'\n move_train\n else\n puts \"Введено некорректное значение меню\\n\\n\"\n end\n end",
"def main_menu\n main_menu_options = {'Interact with Existing Kits' => :list_and_select_kit,\n 'Create a new Kit' => :prompt_kit_params, \n 'Quit' => :quit}\n \n op = @io.select_from_options(\"What would you like to do?\", main_menu_options)\n @operation_stack.unshift op\n \n # return nil, because there's nothing to pass onto the next method\n return\n end",
"def display_menu\n puts \"Choose from the following options: \\n\n to find a candidate, type 'find id' (ex. find 1)\n to view all candidates, type 'all'\n to view all qualified candidates, type 'qualified'\n to exit, type 'quit' \n to view menu, type 'menu' \\n\\n\"\nend",
"def main_menu\n puts \"Main Menu\"\n puts \"(a) - Basic calculator\"\n puts \"(b) - Advanced calculator\"\n puts \"(c) - Special calculators\"\n puts \"(q) - Quit\"\nend",
"def main_menu\r\n puts \"\\nMain Menu.\"\r\n puts \"A. List Buildings\"\r\n puts \"B. List Machines\"\r\n puts \"C. List Snacks\"\r\n puts \"D. List Users\"\r\n puts \"E. Find a Snack\"\r\n puts \"F. Add a New Snack\"\r\n puts \"G. Create New User\"\r\n puts \"H. List Favorites\"\r\n puts \"I. Find Favorites\"\r\n puts \"J. Add Favorites\"\r\n puts \"Q. Quit\"\r\nend",
"def analyze\n analyze = Menu.new(\"What would you like to see?\")\n analyze.add_menu_item({key_user_returns: 1, user_message: \"Get all time/theatres for a particular \n movie.\", do_if_chosen: \"get_time_location/movie\"})\n analyze.add_menu_item({key_user_returns: 2, user_message: \"Get all times for a particular theatre.\", \n do_if_chosen: \"get_time_location/theatre\"})\n analyze.add_menu_item({key_user_returns: 3, user_message: \"Get all movies played at this time.\", \n do_if_chosen: \"get_time_location/time\"})\n analyze.add_menu_item({key_user_returns: 4, user_message: \"Get all time/theatres that are sold out or \n not sold out.\", do_if_chosen: \"get_sold_time_locations\"})\n analyze.add_menu_item({key_user_returns: 5, user_message: \"Get all movies from a particular studio or \n rating.\", do_if_chosen: \"get_movies_like_this\"})\n analyze.add_menu_item({key_user_returns: 6, user_message: \"Get all theatres that are booked or not \n fully booked.\", do_if_chosen: \"get_available_locations\"})\n analyze.add_menu_item({key_user_returns: 7, user_message: \"Get number of staff needed for a time \n slot.\", do_if_chosen: \"get_num_staff_needed\"})\n analyze.add_menu_item({key_user_returns: 8, user_message: \"Return to main menu.\", do_if_chosen: \"home\"})\n analyze\n end",
"def main_menu\n h = {\n a: :ag,\n z: :z_interface,\n # f: :file_actions,\n b: :bookmark_menu,\n c: :create_menu,\n f: :filter_menu,\n o: :order_menu,\n s: :selection_menu,\n t: :toggle_menu,\n v: :view_menu,\n '`' => :goto_parent_dir,\n x: :extras\n }\n menu 'Main Menu', h\nend",
"def main_menu\n puts \"(b) - basic calculator\"\n puts \"(a) - advanced calculator\"\n puts \"(q) - quit\"\nend",
"def main_menu\n puts \"(b) - basic calculator\"\n puts \"(a) - advanced calculator\"\n puts \"(q) - quit\"\nend",
"def main_menu\n h = { \n \"1\" => :view_article,\n \"2\" => :view_comments,\n :f => :display_forum,\n :v => :view_menu,\n :r => :reload,\n :m => :fetch_more,\n :R => :reddit_options,\n :H => :hacker_options,\n :s => :sort_menu, \n :C => :config_menu,\n :a => :view_article,\n :c => :view_comments,\n :x => :extras\n }\n=begin\n :a => :ack,\n \"/\" => :ffind,\n :l => :locate,\n :v => :viminfo,\n :z => :z_interface,\n :d => :child_dirs,\n :r => :recent_files,\n :t => :dirtree,\n \"4\" => :tree,\n :F => :filter_menu,\n :c => :command_menu ,\n :B => :bindkey_ext_command,\n :M => :newdir,\n \"%\" => :newfile,\n=end\n\n menu \"Main Menu\", h\nend",
"def create_menu\n items = Hash.new\n # action shd be a hash\n # menu should have array of hashes (or just a string)\n #db = { :name => \"Databases\", :accelerator => \"M-d\", :enabled = true, :on_right => :get_databases }\n #or = { :name => \"Open Recent\", :accelerator => \"M-o\", :enabled = true, :on_right => :get_recent }\n #find_array = {\"Find ...\" => :find, \"Find Next\" => :find_next, \"Find Previous\" => :find_prev}\n items[\"File >\"] = [\"Open ... C-o\" , \"Open Recent\", \"Databases\" , \"Tables\", \"Exit\"]\n items[\"Window >\"] = { \"Tile\" => nil, \"Find >\" => {\"Find ...\" => :find, \"Find Next\" => :find_next, \"Find Previous\" => :find_prev},\n \"Edit\" => nil, \"Whatever\" => nil}\n items[\"Others >\"] = { \"Shell Output ...\" => :shell_output, \"Suspend ...\" => :suspend , \"View File\" => :choose_file_and_view}\n\n # in the case of generated names how will call back know that it is a db name or a table name\n # We get back an array containing the entire path of selections\n right_actions = {}\n right_actions[\"Databases\"] = Proc.new { Dir.glob(\"**/*.{sqlite,db}\") }\n right_actions[\"Tables\"] = :get_table_names\n\n ret = popupmenu items, :row => 1, :col => 0, :bgcolor => :cyan, :color => :white, :right_actions => right_actions\n # ret can be nil, or have a symbol to execute, or a String for an item with no leaf/symbol\n if ret\n alert \"Got #{ret}\"\n last = ret.last\n if last.is_a? Symbol\n if respond_to?(last, true)\n send(last)\n end\n end\n end\n\n return\n r = 1\n ix = popuplist( top , :title => \" Menu \" , :row => r, :col => 0, :bgcolor => :cyan, :color => :white)\n if ix\n value = top[ix]\n ix = popuplist( items[value] , :row => r + 2 + ix, :col => 10, :bgcolor => :cyan, :color => :white)\n end\nend",
"def analyze_menu\n analyze = Menu.new(\"What would you like to see?\")\n analyze.add_menu_item({key_user_returns: 1, user_message: \"Get all time/theatres for a particular movie.\", do_if_chosen: [\"get_time_location_for_movie\"]})\n analyze.add_menu_item({key_user_returns: 2, user_message: \"Get all times for a particular theatre.\", do_if_chosen: [\"get_time_location_for_location\"]})\n analyze.add_menu_item({key_user_returns: 3, user_message: \"Get all movies played at this time.\", do_if_chosen: [\"get_all_movies_for_this_time\"]})\n analyze.add_menu_item({key_user_returns: 4, user_message: \"Get all time/theatres that are sold out or not sold out.\", do_if_chosen: [\"get_sold_time_locations\"]})\n analyze.add_menu_item({key_user_returns: 5, user_message: \"Get all movies from a particular studio or rating.\", do_if_chosen: [\"get_movies_like_this\"]})\n analyze.add_menu_item({key_user_returns: 6, user_message: \"Get all theatres that are booked or not fully booked.\", do_if_chosen: [\"get_available_locations\"]})\n analyze.add_menu_item({key_user_returns: 7, user_message: \"Get number of staff needed for a time slot.\", do_if_chosen: [\"get_num_staff_needed\"]})\n analyze.add_menu_item({key_user_returns: 8, user_message: \"Return to main menu.\", do_if_chosen: \n [\"main_menu\"]})\n run_menu_and_call_next(analyze)\n end",
"def menu_selection \nend",
"def sub_menu\n puts \"\\n***********************************************\".colorize(:magenta).blink\n puts \"Type the following letters to do...\".colorize(:blue)\n puts \"-----------------------------------------------\".colorize(:cyan).bold\n puts \"s = Save Recipe to My Favorites\".colorize(:blue)\n puts \"r = Rate Recipe\".colorize(:blue)\n puts \"a = See Average Recipe Rating\".colorize(:blue)\n puts \"o = Open Link to See the Steps for This Recipe\".colorize(:blue)\n puts \"m = Back to Main Menu\".colorize(:blue)\n puts \"***********************************************\\n \".colorize(:magenta).blink\n end",
"def main_menu_options\n a = Artii::Base.new #display main title greeting\n a.asciify('Menu')\n puts a.asciify('Menu').colorize(:blue)\n\n puts \"\"\n puts \"1. Search movies.\"\n puts \"2. View your list.\"\n puts \"\"\n puts \"Please input the number corresponding to your choice.\"\n input = gets.chomp #todo Check to see if you can break this\n system \"clear\"\n if input == '1'\n puts \"Let's look at some movies.\"\n movie_search #send user to the movie search screen\n elsif input == '2'\n display_movie_list_and_movie_list_options #send movie to the movie list screen\n else\n \"Please select a valid option\"\n main_menu_options #call the method again\n end\n end",
"def display_and_run\n\n # prints the menu name and waits briefly\n @dp.d_print(@menu_name + \":^^\")\n i = 1\n\n # displays the options\n @options.each do |option|\n print(i.to_s + ' ')\n puts(option.get_name)\n i += 1\n end\n\n # prompt and get valid input from the player\n print(@prompt_string)\n action = get_action\n\n # runs the selected action\n action.call :menu_select\n\n # some test code\n print(\"here\")\n end",
"def init \n greeting \n menu_list\n menu_selection\n goodbye\nend",
"def display_menu()\n return 'Welcome to the Chicken Farm Simulator'\nend",
"def getMenu(menu)\n menu.add_item(\"Done\") {self.done}\n menu.add_item(\"Edit Camera...\") {self.edit}\n menu.add_item(\"Reset Tilt\") {self.reset_tilt}\nend",
"def main_menu\n\t\tputs '################################'\n\t\tputs '######### Tic Tac Toe ##########'\n\t\tputs '################################'\n\t\tputs '================================'\n\t\tputs '== Choose your weapon warrior =='\n\t\tputs '================================'\n\t\tputs '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'\n\t\tputs '^^^^^^ Type Your Choice: ^^^^^^^'\n\t\tputs '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'\n\t\tputs '$$$$$$$$$$$ 1. \"X\" $$$$$$$$$$$$$'\n\t\tputs '$$$$$$$$$$$ 2. \"O\" $$$$$$$$$$$$$'\n\t\tputs '--------------------------------'\n\tend",
"def main_menu\n puts \"---------------Animal shelter 4.5A-----------\"\n puts\n puts \"[1] List clients\"\n puts \"[2] List animals for adoption\"\n puts \"[3] Add a new client\"\n puts \"[4] Add a new animal\"\n puts\n puts\n puts \"[5] exit\"\n puts \"---------------------------------------------\"\nend",
"def search_menu\n puts\n prompt = \"(dork3r)> \"\n while line = Readline.readline(\"#{prompt}\", true)\n cmd = line.chomp\n case cmd\n when /^!(.+)/\n # Execute system commands in terminal\n cmd=$1.strip.chomp\n res = commandz(cmd)\n print_line(\"\\n#{res.join().chomp}\")\n search_menu\n when /^c$|^clear$|^cls$/i\n cls\n banner\n search_menu\n when /^h$|^help$|^ls$/i\n puts\n search_menu_help\n search_menu\n when /^exit$|^quit$|^back$/i\n puts\n print_error(\"Returning to Main Menu....\")\n main_menu\n when /^ip$/i\n ip_info\n search_menu\n when /^ip2host$|^host2ip$/i\n host = Readline.readline(\" Target IP or Domain: \", true)\n dnsenum = DNSEnum.new(host.strip.chomp)\n ip, domain, hostname = dnsenum.host_info\n puts\n print_status(\"IP: #{ip}\")\n print_status(\"Domain: #{domain}\") unless domain == ip\n print_status(\"Hostname: #{hostname}\\n\\n\")\n search_menu\n when /^list$/i\n file = Readline.readline(\" Path to Links File: \", true)\n if File.exists?(file.strip.chomp)\n print_status(\"Performing quick vuln test with user provided links....\")\n links=File.open(file.strip.chomp).readlines\n print_status(\"Loaded #{links.size} links from #{file}....\")\n testing_links = link_prep(links)\n print_status(\"#{testing_links.size} links prepped for testing....\")\n send_and_check(testing_links)\n else\n puts\n print_error(\"Unable to load URL list!\")\n print_error(\"Check path or permissions and try again....\\n\")\n end\n search_menu\n when /^ask$|^bing$|^yahoo$|^google|^all$/i\n print_status(\"Need some info for search....\")\n squery = Readline.readline(\" Enter Search Term: \", true)\n eanswer = Readline.readline(\" Enable TLD Expansion Search (Y/N)? \", true)\n if eanswer.strip.chomp.upcase == 'N' or eanswer.strip.chomp.upcase == 'NO'\n tld_expansion = false\n else\n tld_expansion = true\n line = Readline.readline(\" Enter CSV list of TLD's to Expand Search:\", true)\n if line =~ /.+,.+/\n tld_expansion_array = line.split(',')\n else\n tld_expansion_array = [ 'COM', 'EDU', 'NET', 'ORG' ]\n end\n end\n answer = Readline.readline(\" Enable Vuln Checks w/Search (Y/N)? \", true)\n if answer.strip.chomp.upcase == 'N' or answer.strip.chomp.upcase == 'NO'\n dorking=false\n else\n dorking=true\n end\n puts\n links=[]\n search = SearchEngine.new\n case cmd\n when /ask/i\n if tld_expansion\n tld_expansion_array.each do |t|\n count=links.size\n print_status(\"Searching with Dork against #{t}....\")\n dork = squery.strip.chomp + \"%20site%3A#{t}\"\n links += search.ask_search(dork, false)\n print_status(\"Found #{links.size - count.to_i} Links....\") unless (links.size - count.to_i) == 0\n end\n else\n links += search.ask_search(squery.strip.chomp)\n end\n when /bing/i\n if tld_expansion\n tld_expansion_array.each do |t|\n count=links.size\n print_status(\"Searching with Dork against #{t}....\")\n dork = squery.strip.chomp + \"%20site%3A#{t}\"\n links += search.bing_search(dork, false)\n print_status(\"Found #{links.size - count.to_i} Links....\") unless (links.size - count.to_i) == 0\n end\n else\n links += search.bing_search(squery.strip.chomp)\n end\n when /google/i\n if tld_expansion\n tld_expansion_array.each do |t|\n count=links.size\n print_status(\"Searching with Dork against #{t}....\")\n dork = squery.strip.chomp + \"%20site%3A#{t}\"\n links += search.google_search(dork, false)\n print_status(\"Found #{links.size - count.to_i} Links....\") unless (links.size - count.to_i) == 0\n end\n else\n links += search.google_search(squery.strip.chomp)\n end\n when /excite/i\n if tld_expansion\n tld_expansion_array.each do |t|\n count=links.size\n print_status(\"Searching with Dork against #{t}....\")\n dork = squery.strip.chomp + \"%20site%3A#{t}\"\n links += search.excite_search(dork, false)\n print_status(\"Found #{links.size - count.to_i} Links....\") unless (links.size - count.to_i) == 0\n end\n else\n links += search.excite_search(squery.strip.chomp)\n end\n when /hotbot/i\n if tld_expansion\n tld_expansion_array.each do |t|\n count=links.size\n print_status(\"Searching with Dork against #{t}....\")\n dork = squery.strip.chomp + \"%20site%3A#{t}\"\n links += search.hotbot_search(dork, false)\n print_status(\"Found #{links.size - count.to_i} Links....\") unless (links.size - count.to_i) == 0\n end\n else\n links += search.hotbot_search(squery.strip.chomp)\n end\n when /yahoo/i\n if tld_expansion\n tld_expansion_array.each do |t|\n count=links.size\n print_status(\"Searching with Dork against #{t}....\")\n dork = squery.strip.chomp + \"%20site%3A#{t}\"\n links += search.hotbot_search(dork, false)\n print_status(\"Found #{links.size - count.to_i} Links....\") unless (links.size - count.to_i) == 0\n end\n else\n links += search.yahoo_search(squery.strip.chomp)\n end\n else # All\n if tld_expansion\n tld_expansion_array.each do |t|\n count=links.size\n print_status(\"Searching with Dork against #{t}....\")\n dork = squery.strip.chomp + \"%20site%3A#{t}\"\n links += search.ask_search(dork, false)\n print_status(\"Ask Found #{links.size - count.to_i} Links....\") unless (links.size - count.to_i) == 0\n count=links.size\n links += search.bing_search(dork, false)\n print_status(\"Bing Found #{links.size - count.to_i} Links....\") unless (links.size - count.to_i) == 0\n count=links.size\n links += search.google_search(dork, false)\n print_status(\"Google Found #{links.size - count.to_i} Links....\") unless (links.size - count.to_i) == 0\n count=links.size\n links += search.yahoo_search(dork, false)\n print_status(\"Yahoo Found #{links.size - count.to_i} Links....\") unless (links.size - count.to_i) == 0\n end\n else\n links += search.ask_search(squery.strip.chomp)\n links += search.bing_search(squery.strip.chomp)\n links += search.google_search(squery.strip.chomp)\n links += search.yahoo_search(squery.strip.chomp)\n end\n end\n if not links.nil? and links.size > 0\n links.uniq!\n if dorking\n test_links = link_prep(links)\n print_good(\"#{test_links.size} links prepped for testing....\")\n send_and_check(test_links)\n else\n print_good(\"Search Results: \")\n links.each {|link| puts link.to_s.white }\n end\n puts\n else\n puts\n print_error(\"No links returned from searches!\")\n print_error(\"Can't do anything without links....\\n\\n\")\n end\n search_menu\n when /^local$|^OS$/i\n local_shell\n search_menu\n else\n puts\n print_error(\"Oops, Didn't quite understand that one!\")\n print_error(\"Please try again...\\n\\n\")\n search_menu\n end\n end\nend",
"def present_menu_options\n space(1)\n puts \"Choose an option from the list below.\"\n space(1)\n puts '1. Search for events by city'\n puts '2. Search for events by artist or sports team'\n puts '3. See what I have coming up'\n puts '4. Delete my account'\n puts '5. Exit'\n space(1)\n pick_option\nend",
"def main_menu\n h = { \n :a => :ack,\n \"/\" => :ffind,\n :l => :locate,\n :v => :viminfo,\n :z => :z_interface,\n :d => :child_dirs,\n :r => :recent_files,\n :t => :dirtree,\n \"4\" => :tree,\n :s => :sort_menu, \n :F => :filter_menu,\n :c => :command_menu ,\n :B => :bindkey_ext_command,\n :M => :newdir,\n \"%\" => :newfile,\n :x => :extras\n }\n menu \"Main Menu\", h\nend",
"def main_menu\n @ui.input_1_change\n @ui.user_input1.downcase\n unless %w[trains routes stations cars].include? @ui.user_input1\n puts 'There is no such option in the main menu.'\n end\n main_menu_choose_option(@ui.user_input1)\n end",
"def main_menu\n menu = [\n \"My Stats\",\n \"My Hikes\",\n \"Trails\",\n \"Quit\"]\n choice = nil\n while choice != \"Quit\"\n system 'clear'\n puts \"------MAIN MENU------\"\n choice = @prompt.select(\"What would you like to do #{@current_user.name}?\", menu)\n\n case choice\n when \"My Stats\"\n user_stats\n when \"My Hikes\"\n hike_options\n when \"Trails\"\n trail_options\n end\n end\n end",
"def print_menu\n puts \"\\nMAIN MENU\"\n puts \"add (+)\"\n puts \"subtract (-)\"\n puts \"multiply (*)\"\n puts \"divide (/)\"\n puts \"modulo (%)\"\n puts \"exponify (^)\"\nend",
"def main_menu\n\tputs \"[a] - addition\"\n\tputs \"[s] - subtraction\"\n\tputs \"[m] - multiplication\"\n\tputs \"[d] - divison\"\n\tputs \"[exp] - exponent\"\n\tputs \"[sqrt] - square root\"\n\tputs \"[q] - quit\"\nend",
"def main_menu\n prompt = TTY::Prompt.new\n first = prompt.select(\"Greetings, #{@player.player_name}. Select Go to Town to start your adventure!\", %w(Go_to_Town Change_my_Name View_my_Quests View_my_Inventory View_my_Renown Slay_the_Dragon Save_the_Kingdom Exit_Game))\n #binding.pry\n if first == \"Go_to_Town\"\n system \"clear\"\n town_menu\n elsif first == \"Change_my_Name\"\n system \"clear\"\n change_name\n elsif first == \"View_my_Quests\"\n system \"clear\"\n view_my_quests #Shows all a players quests\n elsif first == \"View_my_Inventory\"\n system \"clear\"\n view_my_gear #Shows all a players gear\n elsif first == \"View_my_Renown\"\n system \"clear\"\n view_my_renwon #Shows a players total renown\n elsif first == \"Slay_the_Dragon\"\n system \"clear\"\n dragon_message\n elsif first == \"Save_the_Kingdom\"\n system \"clear\"\n kingdom_message\n elsif first == \"Exit_Game\"\n system \"clear\"\n exit_game\n else \n return \n end\nend",
"def main_menu\n\n# Step 1, create the entries with (display text, method(:to_be_called), optional_args)\n\n hello = GemMenu::Entry.new('hello', method(:hello_world))\n world = GemMenu::Entry.new('world', method(:counting_world))\n second_menu = GemMenu::Entry.new('2nd level', method(:menu_2))\n food_menu = GemMenu::Entry.new('food menu', method(:menu_favorite_foods))\n long = GemMenu::Entry.new('long menu', method(:long_menu))\n\n# Step 2, once entries are created, create the Menu object and return it with\n# (title text, array_of_Entries, optional_args)\n GemMenu::Menu.new('main menu', [hello, world, second_menu, food_menu, long])\nend",
"def main_menu\n puts \"Here is a list of available commands:\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" show - Show a contact\"\n puts \" search - Search contacts\"\n puts \" delete - Deletes a contact\"\n end",
"def menu\nend",
"def displaymenu # Console only\r\n\t\t @output.puts \"Menu: (1) Play | (2) New | (3) Analysis | (9) Exit\"\r\n\t\t end",
"def start_main_menu \n puts \"[1] Start\\n[2] Measurement Converter\\n[3] How to Use\".colorize(:yellow)\n user_input = gets.chomp.downcase\n if @answers[0][1].include?(user_input)\n self.start_recipe\n elsif @answers[0][2].include?(user_input)\n self.start_convert\n elsif @answers[0][3].include?(user_input)\n start_help() #module method\n self.start_main_menu\n elsif user_input == \"end\"\n exit \n else\n puts puts \"Do you not know how to press 1, 2 or 3 :| ... Try again.\".colorize(:red)\n self.start_main_menu\n end\n end",
"def menu\n puts \"Menu\"\n puts \"1. List Channels\"\n puts \"2. List Users\"\n puts \"3. Select User\"\n puts \"4. Select Channel\"\n puts \"5. Send Message\"\n puts \"6. Quit\"\nend",
"def menu\n puts \"- Type in a #{\"Nintendo Character\".colorize(:red)} | #{\"Game Series\".colorize(:blue)} | #{\"Amiibo Series\".colorize(:green)}\\n\\n\"\n puts \"- Type #{'1'.colorize(:yellow)} for a list of all the Game Series included in the Amiibo collection\"\n puts \"- Type #{'2'.colorize(:yellow)} for a list of all the Amiibo Series included in the Amiibo collection\"\n puts \"- Type #{'3'.colorize(:yellow)} for a list of all the Characters included in Amiibo collection\"\n puts \"- Type #{'4'.colorize(:yellow)} for a list of ALL Amiibos collection\\n\\n\"\n puts \"- Type #{'exit'.colorize(:yellow)} to exit the CLI\\n\\n\"\n puts \"--------------------------------------------------------------------------------\\n\\n\"\n sleep(2)\n end",
"def list_menu\n puts \"\\nMain Menu\"\n puts \"1. Daily Prophet - News!\"\n puts \"2. Evanesco - Exit\"\n end",
"def case_menu(selection)\n case selection\n when 'Playlist'\n @playlist.menu\n when 'Account Details'\n account_details\n when 'Exit'\n p \"Is this exiting?\"\n end\n end",
"def menu\n puts \"\\n************************************************************\".colorize(:magenta).blink\n puts \"Select an option (1-5) from the menu below:\".colorize(:blue).bold\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"1. Don't want to think about what to cook? \\n Spin the RANDOM WHEEL OF RECIPES!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"2. Need some inspiration for cooking? \\n Find recipe by name OR \\n if you have leftover ingredients search your ingredients!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"3. Feeling creative? \\n Write and save your own recipe!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"4. View ALL your favorite recipes in 1 place!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"5. You're done? Time to exit...\".colorize(:blue)\n puts \"************************************************************\\n \".colorize(:magenta).blink\n end",
"def display_main_menu\n puts '################################'\n puts '# {N}- Network Stuff #'\n puts '# {RF}- Read File #'\n # puts '# {GF}- Generate File #'\n # puts '# {D}- Run as Daemon #'\n # puts '# {TD}- Run as Trigger Daemon #'\n puts '# {Q}- Quit #'\n puts '################################'\nend",
"def print_menu\n puts \"1. List patients\"\n # ....\n end",
"def atom_menu\n puts \"================\"\n puts \"Make a selection\"\n puts \"================\"\n puts \"1: ctrl + cmd + ^ or v\"\n puts \"2:\"\n puts \"8: Main Menu\"\n puts \"9: exit\"\n case gets.strip\n when \"1\"\n puts \"ctrl + cmd + ^ or v\"\n puts \"grabs the line you are on and moves it up or down as you want.\"\n reset\n #this gap is for adding more functions\n\n when \"8\"\n main_menu\n when \"9\"\n exit 0\n else\n bad_choice\n atom_menu\n end\nend",
"def return_to_menu(input)\n if input.downcase == \"menu\"\n menu_items\n end\nend",
"def menu(user)\n system \"clear\"\n print \"\\e[8;1000;1000t\"\n aa = Artii::Base.new :font => 'doom'\n puts aa.asciify(\"What would you like to do?\".center(110))\n puts\n puts aa.asciify(\"1. Play a New Game \".center(125))\n puts aa.asciify(\"2. View Leaderboard\".center(125))\n puts aa.asciify(\"3. How to Play \".center(125))\n puts aa.asciify(\"4. Exit \".center(125))\n user_input = gets.chomp\n if user_input == \"1\"\n start_game(user)\n elsif user_input == \"2\"\n display_leaderboard(user)\n elsif user_input == '3'\n how_to_play(user)\n elsif user_input == \"4\"\n system \"clear\"\n puts aa.asciify(\"Thanks for playing!\")\n bye_bear\n sleep(3)\n return nil\n else\n puts \"Selection not recognized\"\n system \"clear\"\n menu(user)\n end\nend",
"def call_menu\n return if $game_system.menu_disabled\n Sound.play_open_menu\n @spriteset.clear_banners\n#~ if @spriteset.banners?\n#~ bs = @spriteset.title_banners ? @spriteset.title_banners : []\n#~ pb = @spriteset.party_banners ? @spriteset.party_banners : []\n#~ rb = @spriteset.red_banners ? @spriteset.red_banners : []\n#~ $game_temp.remember_banners = [[bs],[pb],[rb]]\n#~ $game_temp.remember_banner_phase = [@spriteset.tickdown,@spriteset.banner_phase]\n#~ $game_temp.remember_joiners = @spriteset.joiners\n#~ $game_temp.remember_leavers = @spriteset.leavers\n#~ $game_temp.remember_removed = @spriteset.removed\n#~ $game_temp.remember_header = @spriteset.header_banner\n#~ $game_temp.remember_posx = @spriteset.posx\n#~ end\n SceneManager.call(Scene_Menu)\n Window_MenuCommand::init_command_position\n end",
"def main_menu\n prompt.select(\"What would you like to do today #{user.name}?\") do |menu|\n menu.choice \"Choose Protein\", -> {choose_protein}\n menu.choice \"Exit!\", -> {exit_helper}\n menu.choice \"Delete Account!?!?\", -> {delete_account_helper}\n end\n end",
"def menu\n puts '1) Promedio de notas'\n puts '2) Inasistencia alumnos'\n puts '3) Alumnos aprobados'\n puts '4) Salir'\nend",
"def user_menu\n puts \"1-input data from file\"\n puts \"2-edit data\"\n puts \"3-form groups\"\n puts \"4-list groups\"\n puts \"5-write groups to file\"\n puts \"6-view course information\"\n puts \"0-exit the program\" \n user_selection = gets.chomp\n # case statement calls respective methods based on user's selection.\n # gives error if file is not loaded and returns to menu\n case user_selection\n when \"0\"\n abort\n when \"1\"\n input_data\n when \"2\"\n if @file_loaded\n edit_data\n else\n puts @dash+\"error-file-not-loaded\"+@dash\n user_menu\n end \n when \"3\"\n if @file_loaded\n form_groups\n else\n puts @dash+\"error-file-not-loaded\"+@dash\n user_menu\n end \n when \"4\"\n if @file_loaded\n list_groups\n else\n puts @dash+\"error-file-not-loaded\"+@dash\n user_menu\n end \n when \"5\"\n if @file_loaded\n write_groups\n else\n puts @dash+\"error-file-not-loaded\"+@dash\n user_menu\n end \n when \"6\"\n if @file_loaded\n list_course_info\n else\n puts @dash+\"error-file-not-loaded\"+@dash\n user_menu\n end \n else\n puts @dash+\"error-invalid-selection\"+@dash\n user_menu\n end\n end",
"def menu_options\n system \"clear\"\n puts \"~~~ Welcome #{@user.username} to the Main Menu ~~~\\n\\n\" \n puts \"{1} Continue from previous story \"\n puts \"{2} Create new story\"\n puts \"{3} Delete a story\"\n puts \"{4} Tutorial\"\n puts \"{5} End My Session\"\nend",
"def init # entry method to the CLI \n greeting \n menu_list\n menu_selection\nend",
"def main_menu\n while true\n puts \"Options:\"\n puts \"[1] Add a new field of crops\"\n puts \"[2] Harvest crops\"\n puts \"[3] Status of farm\"\n puts \"[4] Relax and view fields\"\n puts \"[5] Exit\"\n puts \"Enter a Number\"\n main_menu_opt = gets.chomp.to_i\n case main_menu_opt\n when 1 then field #will run field method\n when 2 then harvest #will run harvest method\n when 3 then status #will run status method\n when 4 then relax #will run relax method\n else exit\n end\n end\n end",
"def main_menu\n\tputs \"\\n1 Library\\n2 Staff Members\\n3 Books\\n4 Patrons\\n0 Exit\\n\"\n\tselect = make_selection\n\n\twhile select != \"1\" && select != \"2\" && select != \"3\" && select != \"4\" && select != \"0\"\n\t\tputs \"\\nInvalid choice selected\\n\"\t\t \t\t\n\t\tselect = make_selection\n\tend\n\n\tif select == \"1\"\n\t\tlibrary_choice = \"9\"\n\t\twhile library_choice != \"0\"\n\t\t\tlibrary_choice = select_choice_library\n\t\tend\n\n \telsif select == \"2\"\n\t\tstaff_member_choice = \"9\"\n\t\twhile staff_member_choice != \"0\"\n\t\t\tstaff_member_choice = select_choice_staff_member\n\t\tend\n\n\n\telsif select == \"3\"\n\t\tbook_choice = \"9\"\n\t\twhile book_choice != \"0\"\n\t\t\tbook_choice = select_choice_book\n\t\tend\n\n\n\telsif select == \"4\"\n\t\tpatron_choice = \"9\"\n\t\twhile patron_choice != \"0\"\n\t\t\tpatron_choice = select_choice_patron\n\t\tend\n\n\n\telsif select == \"0\"\n\t\tputs \"\\nGoodbye\"\t\t \t\t\n\tend\n\tselect \nend",
"def showMainMenu()\n\tputs\n\tputs \"Select an option:\"\n\tputs \"R: Run \" + $fizz + $buzz\n\tputs \"C: Change Words\"\n\tputs \"Q: Quit\"\nend",
"def view_menu\n h = {\n f: :select_from_visited_files,\n d: :select_from_used_dirs,\n b: :view_bookmarks,\n s: :list_selected_files,\n c: :child_dirs,\n r: :recent_files,\n t: :tree,\n e: :dirtree\n }\n menu 'View Menu', h\nend",
"def interactive_menu\n loop do\n print_menu\n selection\n end\nend",
"def main_menu\n puts \"===============\"\n puts \"Make a selection\"\n puts \"===============\"\n puts \"1: Command line\"\n puts \"2: Atom\"\n puts \"3: Search?\"\n puts \"4: Quit\"\n puts \"===============\"\n\n case gets.strip\n when \"1\"\n command_line_menu\n when \"2\"\n atom_menu\n when \"3\"\n search_function\n reset\n when \"4\"\n exit 0\n else\n bad_choice\n main_menu\n end\nend",
"def create_menu\n h = { f: :create_a_file,\n d: :create_a_dir,\n s: :create_dir_with_selection,\n b: :create_bookmark }\n _, menu_text = menu 'Create Menu', h\nend",
"def run\n welcome\n main_menu_selection #choose to create a character or login to pre-existing character\n player_options #a list of options the selected player from 'selection_menu' can accomplish\nend",
"def main_menu\n choice = self.prompt.select(\"Hi there, #{self.user.name}! What would you like to do today?\", [\"Create a new post\", \"Find a book\", \"View or edit my posts\", \"Delete my account\", \"Logout\"])\n\n case choice\n when \"Create a new post\"\n self.new_post\n when \"Find a book\"\n self.find_book\n when \"View or edit my posts\"\n self.view_edit_posts\n when \"Delete my account\"\n self.delete_account\n when \"Logout\"\n self.spinner(\" ✌️✌️✌️ \")\n self.greet\n end\n end",
"def bar\n puts 'bar'\n main_menu\nend",
"def printMenu\n\t\tself.report(\"\n\t\tEscolha uma opção\n\t\t1 - Trocar palavra-chave.\n\t\t2 - Ver palavra-chave.\n\t\t3 - Ver arquivo.\n\t\t4 - Sair.\n\t\t? \", 1)\t\t\n\tend",
"def menu\n \nend",
"def forum_actions \n h = { :r => :reload, \n :n => :new_forum, \n :b => :display_forum, \n 'C-b' => :change_subforum, \n :N => :new_articles , \n :k => :delete_current_forum,\n :RIGHT => :next_forum,\n :LEFT => :previous_forum,\n :l => :view_log,\n :C => :config_menu,\n 'C-c' => :quit_app}\n\n ch, menu_text = menu \"Forum Menu \", h\n menu_text = :quit if ch == \"q\"\n return unless menu_text\n case menu_text.to_sym\n when :quit\n when :reload\n fetch_data_from_net $subforum\n when :pages\n $num_pages += 1\n when :new_articles\n new_articles\n when :new_forum\n fetch_data_from_net\n when :change_subforum\n change_file\n when :quit_app\n quit_command\n when :view_log\n view_log\n when :open_command\n print \"Enter open command: \"\n str = Readline::readline('>', true)\n if str && str != \"\"\n $open_command = str\n end\n end\nend",
"def main_menu\n\tputs \"Welcome to Happitails!\"\n\tputs \"Please choose from the options below\"\n\tputs \"1. Add Animal\"\n\tputs \"2. Create Client\"\n\tputs \"3. Adopt an animal\"\n\tputs \"4. Put animal up for adoption\"\n\tputs \"5. View all animals\"\n\tputs \"6. View all clients\"\n\n\n\t# puts \"Z. SECRET DEBUGGING MODE\"\n\n\tputs \"q. Quit\"\nend",
"def main_menu\n puts \"------------------------------------------------------------------------------------------------------\".colorize(:yellow)\n Artii::Base#asciify\n a = Artii::Base.new\n a.asciify(\"Toy Robot Challenge\")\n system(\"clear\")\n puts a.asciify(\"Toy Robot Challenge\").colorize(:red,)\n\n prompt = TTY::Prompt.new\n choices = [\n {name: 'New Game.', value: 1},\n {name: 'Exit.', value: 2},\n ]\n players_input = prompt.select(\"Select An Option:\", choices) \n case players_input\n when 1\n new_game\n when 2\n exit\n end \nend",
"def main_menu(user)\n user = user\n self.clear\n Ascii.image\n menu = [\"See all my plants\",\"Add new plant\",\"Delete my account\",\"Quit\"]\n menu_selection = @@prompt.select(\"What would you like to do?\",menu)\n \n case menu_selection\n when \"See all my plants\"\n my_plant(user)\n when \"Add new plant\"\n add_plant(user)\n when \"Delete my account\"\n answer = @@prompt.yes?(\"Are you sure?\")\n answer == true ? user.destroy : self.main_menu(user)\n when \"Quit\"\n index = 0\n # binding.pry\n color = [\"#7FFF00\",\"#6B8E23\",\"#008000\",\"#2F4F4F\",\"#00008B\"]\n 5.times do\n self.clear\n # binding.pry\n puts Paint[Ascii.goodbye, color[index]] \n index += 1\n sleep(0.7)\n end \n end\n end",
"def menuAOption\n\t\tmenu = @menuStack.pop\n\t\t@menuStack.push(menu)\n\t\toption = menu.getOption\n\t\tcase option\n\t\twhen \"Magic\"\n\t\t\t@hero.nextCommand.push(option)\n\t\t\t@selectMagicBox = OptionBox.new(15, 5, 34, 7, 18, 15, 128, 26, createNextMagicSublist, @screen)\n\t\t\t@menuStack.push(@selectMagicBox)\n\t\twhen \"Attack\"\n\t\t\t@hero.nextCommand.push(option) \n\t\t\tif @enemyUnits.length > 1\n\t\t\t\t@selectEnemyBox = OptionBox.new(242, 5, 15, 7, 18, 15, 128, 26, createEnemyList, @screen)\n\t\t\t\t@menuStack.push(@selectEnemyBox)\n\t\t\telse\n\t\t\t\tsetCombat\n\t\t\t\t@hero.nextCommand.push([@enemyUnits[0]])\n\t\t\tend\n\t\twhen \"Run\"\n\t\t\t@hero.nextCommand.push(option)\n\t\t\tsetCombat\n\t\twhen \"Item\"\n\t\t\t@hero.nextCommand.push(option)\n\t\t\t@subMenuIndex = 0\n\t\t\t@selectItemBox = OptionBox.new(15, 5, 34, 7, 18, 15, 128, 26, createNextItemSublist, @screen)\n\t\t\t@menuStack.push(@selectItemBox)\n\t\telse\n\t\t\tif (option != \"\")\n\t\t\t\tif (option.class < Unit)\n\t\t\t\t\t@hero.nextCommand.push([option])\n\t\t\t\t\tsetCombat\n\t\t\t\telse\n\t\t\t\t\ttargetType = option.getTargetType\n\t\t\t\t\tcase targetType\n\t\t\t\t\twhen \"self\"\n\t\t\t\t\t\t@hero.nextCommand.push(option)\n\t\t\t\t\t\t@hero.nextCommand.push([@hero])\n\t\t\t\t\t\tsetCombat\n\t\t\t\t\twhen \"all\"\n\t\t\t\t\t\t@hero.nextCommand.push(option)\n\t\t\t\t\t\ttargets = []\n\t\t\t\t\t\t@enemyUnits.each { |unit| targets.push(unit) }\n\t\t\t\t\t\t@hero.nextCommand.push(targets)\n\t\t\t\t\t\tsetCombat\n\t\t\t\t\twhen \"enemy\"\n\t\t\t\t\t\t@hero.nextCommand.push(option)\n\t\t\t\t\t\tif @enemyUnits.length > 1\n\t\t\t\t\t\t\t@selectEnemyBox = OptionBox.new(242, 5, 15, 7, 18, 15, 128, 26, createEnemyList, @screen)\n\t\t\t\t\t\t\t@menuStack.push(@selectEnemyBox)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tsetCombat\n\t\t\t\t\t\t\t@hero.nextCommand.push([@enemyUnits[0]])\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def say_fav_food(food)\n puts \"One of your favorite foods is #{food}\"\n menu_favorite_foods\nend",
"def menuScreen\n @levelNo=1\n clearScreen\n puts \"You are at the menu for Sokoban\"\n puts \"To quick play: Press 'p'\"\n puts \"To choose a level: Press 'c'\"\n puts \"To stop: Press 'q'\"\n charPressedInMenu\nend",
"def action_A_menu\n case @intern_mode\n when :choose_move_pokemon\n action_move_current_pokemon\n when :choose_move_item\n return $game_system.se_play($data_system.buzzer_se) if @team_buttons[@index].data.item_holding == 0\n @team_buttons[@move = @index].selected = true\n @intern_mode = :move_item\n @base_ui.show_win_text(text_get(23, 22))\n when :move_pokemon\n process_switch\n when :move_item\n process_item_switch\n else\n $game_system.se_play($data_system.decision_se)\n return show_choice\n end\n $game_system.se_play($data_system.decision_se)\n end",
"def print_menu\n # 1. print the menu and ask the user what to do\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"9. Exit\" # '9' because we'll be adding more items later\nend",
"def display_menu\n puts \"Welcome to Lorrayne and Sherwin's coffee emporium!\\n\\n\"\n puts \"1) Add item - $5.00 - Light Bag\"\n puts \"2) Add item - $7.50 - Medium Bag\"\n puts \"3) Add item - $9.75 - Bold Bag\"\n puts \"4) Complete Sale\"\n end",
"def character_menu\n puts \" \"\n puts \" ┌─┐┬ ┬┌─┐┬─┐┌─┐┌─┐┌┬┐┌─┐┬─┐ ┬┌┐┌┌─┐┌─┐\"\n puts \" │ ├─┤├─┤├┬┘├─┤│ │ ├┤ ├┬┘ ││││├┤ │ │\"\n puts \" └─┘┴ ┴┴ ┴┴└─┴ ┴└─┘ ┴ └─┘┴└─ ┴┘└┘└ └─┘\"\n puts \" \"\n puts \" Please select an option from below:\"\n puts \" \"\n prompt = TTY::Prompt.new\n menu_choices = [\n \" [1] Find info of character\",\n \" [2] Find allegience of character\",\n \" [3] Search characters by culture\",\n \" [4] Wiki Menu\",\n \" [5] Main Menu\",\n ]\n prompt.select(\" \", menu_choices)\nend",
"def selection_menu\n h = {\n a: :select_all,\n u: :unselect_all,\n s: :toggle_select,\n '*' => 'toggle_multiple_selection',\n 'x' => 'toggle_visual_mode',\n 'm' => 'toggle_selection_mode',\n v: :view_selected_files\n }\n menu 'Selection Menu', h\nend",
"def main_menu\n\n puts \"Doctor's Office Manager\"\n puts \"Enter 'a' to access the appointments menu.\"\n puts \"Enter 's' to access specialities menu.\"\n puts \"Enter 'p' to access patient menu.\"\n puts \"Enter 'i' to access insurance menu.\"\n puts \"Enter 'd' to access doctor menu.\"\n puts \"Enter 'e' to exit\"\n puts \"Enter 'r' to access README\"\n\n user_choice = gets.chomp.downcase\n\n case user_choice\n when 'a'\n appointment_menu\n when 's'\n specialties_menu\n when 'p'\n patient_menu\n when 'i'\n insurance_menu\n when 'd'\n doctor_menu\n when 'e'\n puts \"Goodbye!\"\n sleep 1\n exit\n when 'r'\n display_readme\n else\n puts \"Enter something proper, ya jackass\"\n end\n\nmain_menu\nend",
"def main_menu(fridge)\r\n # loop the menu untill break\r\n loop do\r\n # ask if user wanna make Japanese food.\r\n puts \"Hello #{fridge.owner_name.green}. Wellcome to \"+\"Japanese Firdge\".cyan\r\n sleep 3\r\n system \"clear\"\r\n puts \"Would you like to make Japanese food?(y/n)\"\r\n choice = gets.strip.downcase\r\n case choice\r\n # when yes\r\n when \"y\"\r\n get_what_they_have(fridge)\r\n puts \"Let me think what you can make...\"\r\n sleep 3\r\n system \"clear\"\r\n loop do\r\n choose_recipe(find_mached_recipe(fridge))\r\n puts \" \"\r\n puts \"Press [b] to choose other recipes\\nPress [x] to exit\"\r\n exit_back_choice = gets.strip.downcase\r\n if exit_back_choice == \"b\"\r\n system \"clear\"\r\n elsif exit_back_choice == \"x\"\r\n puts \"See you next time! Enjoy your meal :)\"\r\n sleep 1\r\n abort\r\n end # if exit_back_choice end\r\n end # loop end\r\n\r\n # when no\r\n when \"n\"\r\n puts \"See you next time!\"\r\n sleep 1\r\n break\r\n else\r\n puts \"Say that again? #{choice} is not acceptable.\"\r\n sleep 1\r\n main_menu(fridge)\r\n end # case choice end\r\n end # loop end\r\nend",
"def actions\n answer = @prompt.select(\"Where will you go?\", %w(Foward Back Status Items), cycle:true, per_page:4)\n if answer == \"Foward\"\n if @zone_cur == 10\n narrate(\"you leave the #{self.name}\")\n leave(self.exit_name)\n else\n @zone_cur += 1\n narrate(\"you continue foward\")\n encounter_check\n end\n elsif answer == \"Back\"\n if @zone_cur == 0\n narrate(\"you leave the #{self.name}\")\n leave(self.entrance_name)\n else\n @zone_cur -= 1\n narrate(\"you retreat backwards\")\n encounter_check\n end\n elsif answer == 'Status'\n narrate(\"#{@player.name} has #{@player.hp} hp, #{@player.attack} attack, and #{@player.defence} defence\")\n str = \"\"\n a = @player.equipment.map do |el|\n el.name\n end\n b = a.join(\", \")\n narrate(\"#{@player.name} has the following items equipped: #{b}\")\n here\n elsif answer == 'Items'\n answer = @prompt.select(\"Items Menu\", %w(Equip_item Look_item), cycle:true, per_page:4)\n if answer == 'Equip_item'\n #list inventory\n stuff = @player.items.map do |el|\n el.name\n end\n #select an item from inventory\n answer = @prompt.select(\"Items Menu\", stuff, cycle:true, per_page:4)\n #find that item again\n to_eq = @player.items.find do |el|\n el.name == answer\n end\n binding.pry\n #equip that item\n @player.equip(to_eq)\n narrate( \"You have equipped the #{to_eq.name}!\")\n actions\n end\n end\n end",
"def tableau_menu\n player_name_list = @mk.players.collect { |p| p.name }\n @@cli.choose do |menu|\n menu.prompt = \"Whose situation do you want information on? \"\n menu.choices(*player_name_list) do |chosen|\n @@cli.say \"You have chosen <%= color('#{chosen}', BOLD) %>. \"\n @mk.players.find { |p| p.name==chosen }.tableau.console_output\n end\n menu.choice(:none) { @@cli.say \"OK, leaving tableau menu\"}\n end\n end",
"def show_menu\n puts Rainbow(\"Welcome to the Calculator\").yellow\n puts Rainbow(\"//\\\\\" * 50).yellow\n puts Rainbow(\"[a] - Addition\").green\n puts Rainbow(\"[s] - Subtraction\").green\n puts Rainbow(\"[m] - Multiplication\").green\n puts Rainbow(\"[d] - Division\").green\n puts Rainbow(\"[q] - quit\").red\n print Rainbow(\"Enter your selection: \").yellow\nend",
"def menu\n puts \"I am a Calculator, there are many like me but these calculations are mine\"\n puts \"What do you want to do? \"\n puts \"- Add\"\n puts \"- Subtract\"\n puts \"- Multiply\"\n puts \"- Divide\"\n puts \"- More advanced\"\n puts \"- Crazy Stuff\"\n puts \"- Quit\"\n print \"> \"\n $selection = gets.chomp.downcase\n\ncase $selection\nwhen \"more advanced\"\n advanced_calc\nwhen \"crazy stuff\"\n crazy_stuff\nwhen \"quit\"\n \"q\"\nelse\n basic_calc\nend\n\nend",
"def main_menu\n @@prompt.select(\"What would you like to do today?\".colorize(:yellow)) do |menu|\n menu.choice \"Read Reviews\", -> {self.read_reviews}\n menu.choice \"Write a review\", -> { self.writing }\n menu.choice \"Update a review\", -> { self.update_reviews }\n menu.choice \"Delete a review\", -> { self.deleting }\n menu.choice \"Log Out\", -> { self.log_out }\n end\n end",
"def main_menu(owner_name, owner)\n puts \"#{page_break}\\n\n Select from the following menu options to get started:\\n\n 1 - Make New Appointent\n 2 - Reschedule Appointment\n 3 - Cancel Appointment\n 4 - Search for a Groomer\n 5 - Exit\n \"\n end",
"def assigned_menu\n\n end",
"def main_menu\n input = 0\n until input.to_i == @@main_ops.length - 1 \n print \"\\e[H\\e[2J\" #clears the screen\n puts @name \n print_menu(@@main_ops)\n print \"Choose an option by entering a number: \"\n input = gets.chomp\n call_option(input)\n end\n end",
"def on_help(menu)\n end",
"def command_line_menu\n\tputs \"--- Command Line Menu ---\"\n\tputs \"1: mv\"\n\tputs \"2: cp\"\n\tputs \"3: mkdir\"\n\tputs \"4: ls\"\n\tputs \"5: rm\"\n\tputs \"6: Main Menu\"\n\tuser_input_command_line_menu\nend",
"def main_menu\n\tputs \"Welcome, what would you like to do today?\"\n\tputs \"1) Add Items to Cart\"\n\tputs \"2) View Items in Cart\"\n\tputs \"3) Remove Items from Cart\"\n\tputs \"4) View Total\"\n\tputs \"5) Exit\"\n\tuser_input = gets.strip.to_i\n\n\n\tcase user_input\n\twhen 1\n\t\tadd_items\n\twhen 2\n\t\tview_items\n\twhen 3\n\t\tremove_item\n\twhen 4\n\t\tshow_total\n\twhen 5\n\t\tputs \"Thank you for shopping with DPL Grocery!\"\n\t\texit!\n\telse\n\t\tputs \"Wrong option bruuuh, try again!\"\n\t\t# puts \"Please choose from the options above, try again.\"\n\tmain_menu\n\tend\nend",
"def print_menu\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list to a csv file\"\n puts \"4. Load the list from a csv file\"\n puts \"5. Print the source code for this programme\"\n puts \"9. Exit\" # 9 because we'll be adding more items\nend",
"def main_menu\n @active = 0\n @prompt.select(\"\\nWhat would you like to do?\\n\".blue) do |menu|\n menu.choice \"Check out what's on today\", -> {today_menu} \n menu.choice \"Check out things to do on the weekend\", -> {weekend_menu}\n menu.choice \"Look at my favourites\", -> {display_favorites}\n menu.choice \"Exit\".red, -> {leave_app} \n end \n end"
] |
[
"0.7416875",
"0.73825264",
"0.719878",
"0.7191419",
"0.71611387",
"0.7099529",
"0.70819247",
"0.7017779",
"0.70097107",
"0.6987493",
"0.6982442",
"0.6972278",
"0.69594455",
"0.6957965",
"0.6950839",
"0.6934846",
"0.6919071",
"0.68772995",
"0.68765634",
"0.6871877",
"0.6871877",
"0.68703693",
"0.6831023",
"0.6830796",
"0.67997247",
"0.6785725",
"0.67854565",
"0.6771433",
"0.6743958",
"0.6725469",
"0.6712121",
"0.6711084",
"0.67001796",
"0.6698307",
"0.6689975",
"0.6683563",
"0.6680487",
"0.6658347",
"0.6641311",
"0.6638858",
"0.66298103",
"0.6623604",
"0.66214865",
"0.6615018",
"0.66146344",
"0.66076976",
"0.6601559",
"0.659546",
"0.658642",
"0.65813446",
"0.65784353",
"0.65779996",
"0.6574954",
"0.6565611",
"0.65540946",
"0.6545558",
"0.65402776",
"0.65382755",
"0.6536203",
"0.65343595",
"0.6530908",
"0.6523403",
"0.6497999",
"0.6494955",
"0.64769244",
"0.6470452",
"0.6469298",
"0.6468454",
"0.6462273",
"0.6454402",
"0.6454016",
"0.64537716",
"0.6449299",
"0.644756",
"0.6446669",
"0.644039",
"0.64362735",
"0.6435715",
"0.64287204",
"0.6427747",
"0.6419348",
"0.6416106",
"0.6409406",
"0.6393696",
"0.63885987",
"0.6388014",
"0.63643825",
"0.63633096",
"0.63628083",
"0.63591844",
"0.6358222",
"0.63555235",
"0.6355177",
"0.6355175",
"0.63541156",
"0.6353729",
"0.63513005",
"0.6339205",
"0.6336473",
"0.63314927",
"0.63294196"
] |
0.0
|
-1
|
isMe(str) Passed a string, and returns the string as a pastel with the background depending on a randomly generated number
|
def isMe(str)
case $prng1.rand(1..6)
when 1
return $pastel.red(str)
when 2
return $pastel.green(str)
when 3
return $pastel.yellow(str)
when 4
return $pastel.blue(str)
when 5
return $pastel.magenta(str)
when 6
return $pastel.cyan(str)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def onMe(str)\n case $prng1.rand(1..6)\n when 1\n return $pastel.on_red(str)\n when 2\n return $pastel.on_green(str)\n when 3\n return $pastel.on_yellow(str)\n when 4\n return $pastel.on_blue(str)\n when 5\n return $pastel.on_magenta(str)\n when 6\n return $pastel.on_cyan(str)\n end\nend",
"def see_color(str)\n return 'red' if str.start_with?('red')\n return 'blue' if str.start_with?('blue')\n\n ''\n end",
"def random_pattern\n randomish_string = ('a'..'z').to_a.shuffle.join\n randomish_color = \"%06x\" % (rand * 0xffffff)\n return GeoPattern.generate(randomish_string, color: randomish_color )\n end",
"def green_style(string)\n pastel = Pastel.new\n green_string = pastel.green(\"#{string}\")\n return green_string\nend",
"def contains(string, style)\n if !/\\A\\d+\\z/.match(string)\n # Not a positive number, url?\n else\n # Number\n test = pull_id(string)\n end\n case style\n when 'human'\n print_human(test)\n when 'json'\n print_json(test)\n when 'hash'\n print_hash(test)\n else\n puts \"You're not supposed to be here. Didn't Runner catch the unregcongized style?\"\n end\n end",
"def check_inside_Colors (string)\n Colors.include?(string)\n end",
"def generateHashtag(string)\r\n return false if string.empty?\r\n words = string.split(\" \")\r\n capitals = words.map do |element|\r\n element.capitalize\r\n end\r\n joined = capitals.join\r\n hashed = joined.prepend(\"#\")\r\n \r\n if hashed.length > 140\r\n return false\r\n end\r\n return false if hashed == \"#\"\r\n hashed\r\nend",
"def colorThenWord ()\n\t\n\tcolor = $rng.rand(0..5)\n\tword = $rng.rand(6..11)\n\n\tprintJumble(color, word)\n\n\tlineArr = gets.chomp.split\n\n\tif (lineArr[0] == $arr[color+6] && lineArr[1] == $arr[word])\n\t\t\treturn 1\n\telse\n\t\t\treturn 0\n\tend\n\n\nend",
"def random_pattern_with_color( hex_color )\n randomish_string = ('a'..'z').to_a.shuffle.join\n return GeoPattern.generate(randomish_string, color: hex_color )\n end",
"def wordThenColor()\n\n\tcolor = $rng.rand(0..5)\n\tword = $rng.rand(6..11)\n\n\tprintJumble(color,word)\n\n\tlineArr = gets.chomp.split\n\n\tif (lineArr[0] == $arr[word] && lineArr[1] == $arr[color+6])\n\t\t\treturn 1\n\telse\n\t\t\treturn 0\n\tend\n\nend",
"def blue_style(string)\n pastel = Pastel.new\n blue_string = pastel.blue(\"#{string}\")\n return blue_string\nend",
"def background(pos, string)\n $background = \"\"\n if pos[0]\n background = pos[1].even? ? \"\\e[1;100m\" : \"\\e[47m\"\n else\n background = pos[1].odd? ? \"\\e[1;100m\" : \"\\e[47m\"\n end\n background + string\n end",
"def code(str)\n fg, bg = str.split(/\\s*\\bon_?\\s*/)\n (fg ? foreground(fg) : \"\") + (bg ? background(bg) : \"\")\n end",
"def g_happy(str)\n (str.size).times do |x|\n slice = str[x + 1..(str.size + 1)]\n if slice == \"gg\"\n return true\n end\n end\nend",
"def firstWordSecondColor()\n\n\tcolor1 = $rng.rand(0..5)\n\tword1 = $rng.rand(6..11)\n\n\tcolor2 = $rng.rand(0..5)\n\tword2 = $rng.rand(6..11)\n\n\tprintJumble(color1,word1)\n\tprintJumble(color2,word2)\n\n\tlineArr = gets.chomp.split\n\n\tif (lineArr[0] == $arr[word1] && lineArr[1] == $arr[color2+6])\n\t\t\treturn 1\n\telse\n\t\t\treturn 0\n\tend\n\nend",
"def generateHashtag(string)\n hashtag = string.split.map(&:capitalize).join\n return false if hashtag.size > 139 || hashtag.size == 0\n hashtag.insert(0, \"#\")\nend",
"def generateHastag(str)\n\tarray = str.split\n\treturned_str = \"#\"\n\tarray.each do |word|\n\t\treturned_str << word.capitalize\n\tend\n\treturn false if returned_str.length > 140 || returned_str.eql?('#') \n\treturned_str\nend",
"def red_style(string)\n pastel = Pastel.new\n red_string = pastel.red(\"#{string}\")\n return red_string\nend",
"def isColor(c)\n if c == \"r\" or c == \"b\" or c == \"g\" or c == \"y\" or c == \"c\" or c == \"m\" then\n return true\n else\n return false\n end\nend",
"def some_age(string)\n string = \"Teddy\" if string == \"\"\n \"#{string} is #{rand(20..200)} years old!\"\nend",
"def generateHashtag(str)\n return false if str.empty?\n return false if str.length > 140\n \"#\" + str.split.join(\" \").split.map(&:capitalize).join\nend",
"def fuzz_str()\n\t\treturn Rex::Text.rand_text_alphanumeric(rand(1024))\n\tend",
"def firstColorSecondWord()\n\n\tcolor1 = $rng.rand(0..5)\n\tword1 = $rng.rand(6..11)\n\n\tcolor2 = $rng.rand(0..5)\n\tword2 = $rng.rand(6..11)\n\n\tprintJumble(color1,word1)\n\tprintJumble(color2,word2)\n\n\tlineArr = gets.chomp.split\n\n\tif(lineArr[0] == $arr[color1+6] && lineArr[1] == $arr[word2])\n\t\t\treturn 1\n\telse\n\t\t\treturn 0\n\tend\n\nend",
"def printStringRandomFont(printMe, duration)\n x = printMe.split(\", \")\n currentTime = Time.now.to_i\n futureTime = currentTime + duration\n while (currentTime <= futureTime) do\n print \"#{isMe(onMe(\"\\n#{returnFont(x[$prng.rand(0...x.length())])}\\n\\n\"))}\"\n currentTime = Time.now.to_i\n end\n menu()\nend",
"def singleColor()\n\n\tcolor = $rng.rand(0..5)\n\tword = $rng.rand(6..11)\n\n\tprintJumble(color, word)\n\n\tentry = gets.chomp\n\n\tif (entry == $arr[color+6])\n\t\t\treturn 1\n\telse\n\t\t\treturn 0\n\tend\n\nend",
"def rainbowSpeak1(sentence)\n\trandNum = 0\n\tpreviousRandNum = 0\n\tletterArr = []\n\n\tsentence = sentence.split('')\n\n\tsentence.each do |letter|\n\t\twhile (randNum == previousRandNum)\n\t\t\trandNum = rand(1...7) \n\t\tend\n\n\t\tcase randNum\n\t\twhen 1\n\t\t\tletterArr.push(letter.colorize(:red))\n\t\twhen 2\n\t\t\tletterArr.push(letter.colorize(:green))\n\t\twhen 3\n\t\t\tletterArr.push(letter.colorize(:yellow))\n\t\twhen 4\n\t\t\tletterArr.push(letter.colorize(:blue))\n\t\twhen 5\n\t\t\tletterArr.push(letter.colorize(:magenta))\n\t\twhen 6\n\t\t\tletterArr.push(letter.colorize(:cyan))\n\t\twhen 7\n\t\t\tletterArr.push(letter.colorize(:white))\n\t\tend\n\t\n\t\tpreviousRandNum = randNum\n\tend\n\treturn letterArr.join(\"\")\nend",
"def hashtag(str)\n return false if str.strip.empty?\n str = str.split(\" \").map(&:capitalize).join.prepend(\"#\")\n str.length > 30 ? false : str\nend",
"def mask(value)\n result = ''\n value.each_char do |ch|\n case ch\n when '#' then result += randomize(0..9).to_s\n when 'A' then result += ('A'..'Z').to_a[rand(26)]\n when 'a' then result += ('a'..'z').to_a[rand(26)]\n else result += ch\n end\n end\n result\n end",
"def mask(value)\n result = ''\n value.each_char do |ch|\n case ch\n when '#' then result += randomize(0..9).to_s\n when 'A' then result += ('A'..'Z').to_a[rand(26)]\n when 'a' then result += ('a'..'z').to_a[rand(26)]\n else result += ch\n end\n end\n result\n end",
"def put_background_color_to(str, color)\n str.colorize(background: :\"#{color}\")\n end",
"def draw_str(str, x, y, line_height = LINE_HEIGHT, colour, show_bg)\n # TODO: let's make a colour lookup class... See LineContent\n rgb =\n case colour\n when 'red'\n [255, 0, 0]\n when 'magenta'\n [255, 0, 255]\n when 'ltblue'\n [135, 206, 250]\n when 'yellow'\n [255, 255, 0]\n when 'ltgreen'\n [144, 238, 144]\n when 'cyan'\n [0, 255, 255]\n else # unknown colours default to white\n [255, 255, 255]\n end\n\n bg_on =\n if ['true', 'yes'].include? show_bg\n 1\n else\n 0\n end\n\n str.split(\"\\n\").each_with_index { |line, idx|\n @dc_kos.draw_str(line, x, y + (line_height * idx+1), *rgb, bg_on)\n }\n end",
"def meow()\n punctuations = '.!?'\n \"#{CAT_FACES[rand(CAT_FACES.length)]} Meow#{punctuations[rand(punctuations.length)]}\"\n end",
"def random(string)\n random_key = @colours.keys.sample\n\n self.send(random_key, string)\n end",
"def web_color(string)\n hashable = \"#{string}\"\n \"#\" + Digest::SHA1.hexdigest(hashable)[0..5]\n end",
"def survive_attack?\n random = rand(1..@@max_str)\n if random > @str\n return true\n else\n return false\n end\n end",
"def seeded_pattern( search_term )\n randomish_color = \"%06x\" % (rand * 0xffffff)\n return GeoPattern.generate(search_term, color: randomish_color )\n end",
"def generateHashtag(string)\n return false if string.gsub(/ /, \"\").empty?\n \n capitalized_string = string.split(\" \").map do |word|\n word.capitalize\n end\n \n hash_tag_str = capitalized_string.join(\"\").prepend(\"#\")\n \n if hash_tag_str.size <= 140\n return hash_tag_str\n else\n return false\n end\nend",
"def hashtag(str)\n return_string = \"#\"\n words = str.split()\n\n words.each do |word|\n word_index = 0\n word.chars.each do |char|\n if word_index == 0\n return_string = return_string + char.upcase\n else\n return_string = return_string + char\n end\n\n word_index += 1\n end\n end\n\n if return_string == \"#\"\n return false\n elsif str.length > 30\n return false\n end\n\n return return_string\nend",
"def green(text)\n colorize(text, 32)\nend",
"def pirates_say_arrrrrrrrr(string)\n text = \"\"\n r_exist = false\n string.split('').each do |chr|\n if r_exist == true\n text << chr\n r_exist = false\n elsif chr.downcase == \"r\"\n r_exist = true\n end\n end\n text\nend",
"def rand_brancket\n (rand(2) == 0) ? \"【#{FFaker::Food.meat}】\" : ''\nend",
"def text_urgent(text); text_green(text);end",
"def fast_green_typer(string)\n string.chars.each do |x|\n print x.colorize(@@colours[0])\n sleep(0.003)\n end\n br\n end",
"def randomize(str)\n return str if str.nil?\n\n random = str\n\n @substitutions.each do |orig, subs|\n random = str.gsub(orig, subs)\n end\n\n random\n end",
"def randHashtag()\n (0...10).map{ ('a'..'z').to_a[rand(26)] }.join\nend",
"def rgb_style(string)\n pastel = Pastel.new\n styled_rgb = pastel.red(\"#{string[0]}\") + pastel.green(\"#{string[1]}\") + pastel.blue(\"#{string[2]}\")\n return styled_rgb\nend",
"def make_invalid(str)\n\terr = rand()\n\tindex = rand(str.length - 2)\n\n\tif err < 0.25\n\t\t# \"Delete\"\n\t\treturn str[0..index] + str[(index + 2)..(str.length - 1)]\n\telsif err < 0.50\n\t\t# \"Add\"\n\t\tnewchar = (@delims.flatten - [str[index]]).shuffle[0]\n\t\treturn str[0..index] + newchar + str[(index + 1)..(str.length - 1)]\n\telsif err < 0.75\n\t\t# \"Unclosed\"\n\t\treturn str[0..(str.length - 2)]\n\telse\n\t\t# \"Change\"\n\t\tnewchar = (@delims.flatten - [str[index]]).shuffle[0]\n\t\treturn str[0..index] + newchar + str[(index + 2)..(str.length - 1)]\n\tend\nend",
"def yours?(str)\n str[0..1] == 'BA'\n end",
"def g_happy(str)\n happy = true\n str.size.times do |n|\n if str[n] == \"g\" && str[n + 1] != \"g\" && str[n - 1] != \"g\"\n happy = false\n end\n end\n return happy\nend",
"def is_solid_masonery?()\n\n # p \"randomize is_solid_masonery?\"\n srand();rand(2)\n end",
"def flag3(str,left_color='brown',middle_color='pink',right_color='red')\n m = str.length / 3\n remainder = str.length % 3\n central_length = remainder == 1 ? m+1 : m \n lateral_length = remainder == 2 ? m+1 : m \n colora( left_color, str[ 0 .. lateral_length-1] ) + \n colora( middle_color, str[ lateral_length .. lateral_length+central_length-1] ) + \n colora( right_color, str[ lateral_length+central_length .. str.length ] ) \nend",
"def colour(name, text)\n if Pry.color\n str = Pry::Helpers::Text.send(name, text)\n unless str.start_with?(\"\\001\")\n str = \"\\001#{Pry::Helpers::Text.send name, '{text}'}\\002\".sub '{text}', \"\\002#{text}\\001\"\n end\n str\n else\n text\n end\nend",
"def generate_entry\n all_the_feels = $feelings.values.flatten\n entry = \"%02d/%02d \" % [rand(12)+1,rand(28)+1]\n 10.times do\n if rand(4) < 1\n entry += all_the_feels[rand(all_the_feels.length)]\n else\n entry += \"---\"\n end\n entry += \" \"\n end\n return entry\nend",
"def random_color\n String\n .colors\n .reject { |color| color == :default }\n .sample\n end",
"def pirates_say_arrrrrrrrr(string)\n final_result = \"\"\n looking_for_r = false\n string.length.times do |x|\n if looking_for_r == true\n final_result << string[x]\n end\n looking_for_r = string[x].include?(\"r\") || string[x].include?(\"R\")\n end\n final_result\nend",
"def decorate(string, style)\n # (fg, bg, bright, underline)\n # fg = style.fg\n # bg = style.bg\n # bright = style.bright\n # underline = style.underline\n return string if !STDOUT.isatty || @output_type == :raw || @disabled\n\n fg = get_colour_instance style.fg\n bg = get_colour_instance style.bg\n\n output = []\n lines = string.lines.map(&:chomp)\n lines = [''] if lines.length.zero?\n lines.each do |line|\n unless line.length < 0\n line = case @palette.type\n when 'ansi' then colour_ansi line, fg, bg\n when 'extended' then colour_extended line, fg, bg\n else raise \"Unknown palette '#{@palette.type}'.\"\n end\n\n line = e(1) + line if style.bright\n line = e(4) + line if style.underline\n line = e(5) + line if style.blink\n line = e(7) + line if style.inverse\n line = e(20) + line if style.fraktur\n line = e(51) + line if style.framed\n\n if (style.bright || style.underline || style.blink || style.inverse || style.fraktur || style.framed) && (fg == nil) && (bg == nil)\n line << e(0)\n end\n end\n\n output.push line\n end\n\n output << '' if string =~ /\\n$/\n output.join \"\\n\"\n end",
"def tired?(digits=nil) \n # ignore the arg, go with your guts\n (rand * 10 < 3)\n end",
"def returnFont(str)\n case $prng1.rand(1..5)\n# when 1\n# $fontFont = TTY::Font.new(\"3d\")\n# return $fontFont.write(str)\n when 2\n $fontFont = TTY::Font.new(:doom)\n return $fontFont.write(str)\n when 3\n $fontFont = TTY::Font.new(:standard)\n return $fontFont.write(str)\n when 4\n $fontFont = TTY::Font.new(:starwars)\n return $fontFont.write(str)\n when 5\n $fontFont = TTY::Font.new(:straight)\n return $fontFont.write(str)\n else\n $fontFont = TTY::Font.new(:standard)\n return $fontFont.write(str)\n end\nend",
"def pirates_say_arrrrrrrrr(string)\n r = false\n output_string = \"\"\n string.each_char do |x|\n if r == true\n output_string << x\n r = false\n end\n if x == \"r\" || x == \"R\"\n r = true\n end\n end\n puts output_string\nend",
"def from_custom_string(custom_string, positions: [0, 29, 14, 30, 28, 31])\n digest = Digest::MD5.hexdigest(custom_string.to_s)\n Inker.color(\"##{positions.map { |p| digest[p] }.join}\")\n end",
"def see_color_with_nested_ternary(str)\n # rubocop:disable Style/NestedTernaryOperator\n str.start_with?('red') ? 'red' : str.start_with?('blue') ? 'blue' : ''\n # rubocop:enable Style/NestedTernaryOperator\n end",
"def pirates_say_arrrrrrrrr(string)\n new_string = \"\"\n add_next = false\n string.size.times do |index|\n char = string[index]\n new_string << char if add_next\n add_next = (char == \"r\" || char == \"R\")\n end\n new_string\n\n\nend",
"def check_color?(piece, player)\n piece == player.downcase ? true : false\n end",
"def red(text)\n colorize(text, 31)\nend",
"def require_sequence\n puts \"Repeat Sequence (Only repeat the first letter of each color):\"\n seq.length.times do |i|\n print \"> \"\n input = gets.chomp\n \n if input != seq[i]\n self.game_over = true\n break\n end \n end\n end",
"def repeat_guess(guess, str)\n if @guess != @str[-1]\n print \"Repeat. Please guess different letter.\"\n return\n end\nend",
"def Starts_whit(string1,character)\n return string1[0] == character\nend",
"def color_valid1(color)\n if color == \"blue\" || color == \"green\"\n true\n else\n false\n end\nend",
"def rand_text_highascii(length, bad=payload_badchars)\n if debugging?\n rand_text_debug(length)\n else\n Rex::Text.rand_text_highascii(length, bad)\n end\n end",
"def select_random_code\n code = \"\"\n 4.times { code += @colors.sample }\n return code\n end",
"def random_face_emoji\n %w[cool goofy monocle sly smile think].sample\n end",
"def printStringS(printMe, duration)\n x = printMe.split(\", \")\n currentTime = Time.now.to_i\n futureTime = currentTime + duration\n while (currentTime <= futureTime) do\n print \"#{isMe(onMe(x[$prng.rand(0...x.length())]))}\"\n currentTime = Time.now.to_i\n end\n menu()\nend",
"def awesome_string(string)\n lexers = ::Rouge::Guessers::Source.new(string).filter(R_LEXERS)\n if !lexers.empty?\n format_syntax_string(string, lexers.first)\n elsif string =~ /(?:\\r?\\n)(?!\\z)/\n format_multiline_string(string)\n else\n format_plain_string(string)\n end\n end",
"def green(string)\n colorize(string, 32)\n end",
"def look_and_say(str)\n counter = 1\n numbers = str.split(//)\n cluster = []\n\n numbers.each_with_index do |num, i|\n if num != numbers[i + i]\n cluster << [counter, num]\n counter == 1\n else\n counter += 1\n end\n end\n\n cluster.flatten.join(\"\")\nend",
"def create_name\n colors = @colors\n first = colors.sort_by{rand}.first.split('')[0..2].sort_by{rand}.to_s\n last = colors.sort_by{rand}.last.split('')[0..2].sort_by{rand}.to_s\n return \"--- #{first}.#{@remainder}.#{last} ---\"\n end",
"def is_isogram(string)\n string.length == string.downcase.chars.uniq.length ? true : false\nend",
"def char_to_block c\n c = bg_white \" \" if c == \"W\" \n c = bg_red \" \" if c == \"R\" \n c = bg_green \" \" if c == \"G\" \n c = bg_yellow \" \" if c == \"Y\" \n c = bg_purple \" \" if c == \"P\" \n c = bg_fuscia \" \" if c == \"F\" \n c = bg_blue \" \" if c == \"B\" \n c = bg_grey \" \" if c == \"E\" \n c = \" \" if c == \"x\"\n c\n end",
"def generate_identifier(sample)\n # Here, I will include every 'location adjective' and 'discovery' beginning with a vowel. These must all be preceeded by 'an'.\n if [\"alternative-timeline\", \"alternate-history\", \"ancient\", \"anachronistic\", \"arcane prophecy\", \"alien artifact\", \"enchanted sword\", \"otherworldly portal\", \"encrypted data feed\", \"exiled angel\"].include?(sample)\n \"an\"\n else\n \"a\"\n end\nend",
"def eat_milk_and_cookies\n if Random.rand(5) == 0\n p \"MMMMM #{@name} just ate an Chocolatechip Cookie\"\n elsif Random.rand(5)== 1\n p \"MMMMM #{@name} just ate an Snickerdoodle Cookie\"\n elsif Random.rand(5) == 2\n p \"MMMMM #{@name} just ate an Oreo Cookie\"\n elsif Random.rand(5) == 3\n p \"MMMMM #{@name} just ate an Sugar Cookie\"\n else\n p \"MMMMM #{@name} just ate an Almond Cookie\"\n end\n end",
"def blue(text)\n colorize(text, 34)\nend",
"def white?\n color == \"white\"\n end",
"def color_valid_test(color)\n color == \"blue\" || color == \"green\"\nend",
"def has_sch_sound (str)\n return str + str.slice!(0,3) + 'ay'\nend",
"def scramble(str)\n\treturn str.split(//).shuffle().to_s\nend",
"def mexican_blanket_magic(colours)\n ptr = -1\n pattern = []\n colours.size.times do\n # Next 10 lines build the gradient\n 5.times { pattern[ptr += 1] = colours[0] }\n pattern[ptr+=1] = colours[1]\n\n 4.times { pattern[ptr+=1] = colours[0] }\n 2.times { pattern[ptr+=1] = colours[1] }\n\n 3.times { pattern[ptr+=1] = colours[0] }\n 3.times { pattern[ptr+=1] = colours[1] }\n\n 2.times { pattern[ptr+=1] = colours[0] }\n 4.times { pattern[ptr+=1] = colours[1] }\n\n pattern[ptr+=1] = colours[0]\n 5.times { pattern[ptr+=1] = colours[1] }\n\n # This is our black stripe which divides the gradients\n n = rand(100)\n if n <= 20 # Aprox. 20% chance of 3px wide line\n 3.times { pattern[ptr+=1] = \"black\" }\n elsif n >= 80 # Aprox. 20% chance of 7px wide line\n 7.times { pattern[ptr+=1] = \"black\" }\n end # Aprox. 60% chance of no line\n\n # Aprox. 20% chance we will get a diagonal bar\n # of random colour and size (<= 21px)\n if rand(100) < 20\n clr = colours[rand(colours.size)]\n (rand(20)+1).times { pattern[ptr+=1] = clr }\n end\n\n # Rotate through the colours in order\n cs = colours.shift\n colours.push(cs)\n end\n\n # Pad out the pattern to match image width\n ptr = -1\n while pattern.size < COLUMNS\n pattern << pattern[ptr+=1]\n end\n return pattern\nend",
"def any_string(options = {})\n if options[:min] && options[:max]\n raise \":min must be less than :max\" if options[:min] > options[:max]\n end\n if options[:min]\n raise \":min must be positive\" if options[:min] < 1\n end\n\n min_size = options[:min]\n max_size = options[:max]\n\n if min_size.nil? && max_size.nil?\n min_size = rand(80) + 1\n max_size = min_size + rand(80)\n elsif min_size.nil?\n min_size = max_size - rand(max_size)\n min_size = 1 if min_size < 1\n else\n max_size = min_size + rand(min_size) + 1\n end\n\n string = Faker::Lorem.words(1).join(' ')\n while string.length < min_size\n string += Faker::Lorem.words(1).join(' ') \n end\n\n string[0..(max_size-1)]\n end",
"def good(str = '')\n show(\"Good for #{str}\")\n true\n end",
"def rainbow \n \"rainbow\" \n end",
"def are_you_playing_banjo(name)\n name[0] =~ /[Rr]/ ? \"#{name} plays banjo\" : \"#{name} does not play banjo\"\nend",
"def g_happy(str)\n i = 0\n g = 0\n while i < str.size\n if str[i] == \"g\"\n g = 1\n if str[i - 1] != \"g\" && str[i + 1] != \"g\"\n return false\n end\n end\n i += 1\n end\n if g == 1\n return true\n end\nend",
"def color_for_string(string)\n @color_hash[string] ||= (Digest::MD5.hexdigest(string)[0..8].to_i(16) % 6) + 31\n end",
"def pick_hair_color\n # colors = ['Blonde', 'Silver', 'Periwinkle',\n # 'Pink', 'Teal', 'Green', 'Light Green',\n # 'Blue', 'Light Blue',\n # 'Red', 'Dark Red']\n\n ## only use \"darker\" colors - why? why not?\n colors = [ 'Purple',\n 'Orange', 'Red', 'Dark Red']\n\n colors[ rand( colors.size ) ]\nend",
"def printRandomFont(duration)\n st = \"A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,0,1,2,3,4,5,6,7,8,9\"\n x = st.split(\",\")\n currentTime = Time.now.to_i\n futureTime = currentTime + duration\n while (currentTime <= futureTime)do\n print \"#{isMe(onMe(\"\\n#{returnFont(x[$prng.rand(0...x.length())])}\\n\\n\"))}\"\n currentTime = Time.now.to_i\n end\n menu()\nend",
"def complementColor()\n\t\n\tcolor = $rng.rand(0..5)\n\tword = $rng.rand(6..11)\n\n\tprintJumble(color,word)\n\n\tentry = gets.chomp\n\n\tif (entry == getComplement($arr[color+6]))\n\t\t\treturn 1\n\telse\n\t\t\treturn 0\n\tend\n\nend",
"def get_random_color\n\t\tletters = '0123456789ABCDEF'.split('');\n\t\tcolor = '#';\n\t\tprng = Random.new\n\t\tfor i in 0...6\n\t\t\tprng.seed\n\t\t\tcolor += letters[(prng.rand * 15).round];\n\t\tend\n\t\tcolor\n\tend",
"def anim(string)\n \n string.each_char do |n|\n \n \n print n \n \n \n slt =rand(0.02..0.08)\n sleep(slt) \n end\n print \"\\n\"\nend",
"def get_sandwich(str)\n count = 0 \n x = 0\n y = 0\n\n (str.size - 4).times do |i|\n if str[i..(i + 4)] == \"bread\" || str[i..(i-4)] == \"bread\"\n if count == 0\n x = i + 5\n count += 1\n elsif count > 0\n y = i + 1\n end\n end\n end\n if count < 2\n # return \"You need to have two pieces of bread to make a sandwich\"\n end\n \n return str[x..y-2]\nend",
"def colorize string, data\n case data\n when String\n \"\\033[0;36m#{string}\\033[0m\"\n when Numeric\n \"\\033[0;33m#{string}\\033[0m\"\n when TrueClass, FalseClass\n \"\\033[1;35m#{string}\\033[0m\"\n when NilClass\n \"\\033[1;31m#{string}\\033[0m\"\n else\n string\n end\n end",
"def uuid_format?(str)\n return false unless 36 == str.length\n UUID_REGEX === str\n end"
] |
[
"0.6822564",
"0.62595063",
"0.5952448",
"0.58726877",
"0.57527214",
"0.5648092",
"0.5625498",
"0.56076586",
"0.5595542",
"0.55714715",
"0.5563615",
"0.556184",
"0.5527345",
"0.5523645",
"0.5500495",
"0.54868793",
"0.5482332",
"0.5478909",
"0.5471816",
"0.5457307",
"0.54439515",
"0.5438241",
"0.5399648",
"0.53690886",
"0.53410435",
"0.53361243",
"0.53027046",
"0.52926135",
"0.52926135",
"0.5283196",
"0.52802455",
"0.52683794",
"0.5259744",
"0.5254376",
"0.5247907",
"0.5245929",
"0.52242005",
"0.5214244",
"0.52141964",
"0.52112687",
"0.5208759",
"0.5200723",
"0.51987547",
"0.5185767",
"0.51729506",
"0.51568604",
"0.51416516",
"0.5134675",
"0.51289785",
"0.512691",
"0.5120186",
"0.5119782",
"0.5100295",
"0.50991017",
"0.5098585",
"0.5088602",
"0.5088591",
"0.5086736",
"0.5081397",
"0.5071633",
"0.5059505",
"0.50433946",
"0.50430757",
"0.50363046",
"0.50359684",
"0.5035188",
"0.50345546",
"0.5032419",
"0.50275177",
"0.5014345",
"0.50136137",
"0.5012881",
"0.50124454",
"0.500855",
"0.50020707",
"0.5001449",
"0.4997815",
"0.49908262",
"0.4990704",
"0.49883237",
"0.49854845",
"0.49845725",
"0.49826136",
"0.49817878",
"0.49805963",
"0.49751517",
"0.4973268",
"0.4971922",
"0.49715504",
"0.49656814",
"0.4963557",
"0.49613103",
"0.4959095",
"0.49573827",
"0.4956075",
"0.49547842",
"0.49429515",
"0.494125",
"0.4935808",
"0.4925421"
] |
0.8011491
|
0
|
onMe(str) Passed a string, and returns it as a pastel string with the background changed Depending on a random number
|
def onMe(str)
case $prng1.rand(1..6)
when 1
return $pastel.on_red(str)
when 2
return $pastel.on_green(str)
when 3
return $pastel.on_yellow(str)
when 4
return $pastel.on_blue(str)
when 5
return $pastel.on_magenta(str)
when 6
return $pastel.on_cyan(str)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def isMe(str)\n case $prng1.rand(1..6)\n when 1\n return $pastel.red(str)\n when 2\n return $pastel.green(str)\n when 3\n return $pastel.yellow(str)\n when 4\n return $pastel.blue(str)\n when 5\n return $pastel.magenta(str)\n when 6\n return $pastel.cyan(str)\n end\nend",
"def green_style(string)\n pastel = Pastel.new\n green_string = pastel.green(\"#{string}\")\n return green_string\nend",
"def text_urgent(text); text_green(text);end",
"def red_style(string)\n pastel = Pastel.new\n red_string = pastel.red(\"#{string}\")\n return red_string\nend",
"def code(str)\n fg, bg = str.split(/\\s*\\bon_?\\s*/)\n (fg ? foreground(fg) : \"\") + (bg ? background(bg) : \"\")\n end",
"def blue_style(string)\n pastel = Pastel.new\n blue_string = pastel.blue(\"#{string}\")\n return blue_string\nend",
"def random(string)\n random_key = @colours.keys.sample\n\n self.send(random_key, string)\n end",
"def rainbowSpeak1(sentence)\n\trandNum = 0\n\tpreviousRandNum = 0\n\tletterArr = []\n\n\tsentence = sentence.split('')\n\n\tsentence.each do |letter|\n\t\twhile (randNum == previousRandNum)\n\t\t\trandNum = rand(1...7) \n\t\tend\n\n\t\tcase randNum\n\t\twhen 1\n\t\t\tletterArr.push(letter.colorize(:red))\n\t\twhen 2\n\t\t\tletterArr.push(letter.colorize(:green))\n\t\twhen 3\n\t\t\tletterArr.push(letter.colorize(:yellow))\n\t\twhen 4\n\t\t\tletterArr.push(letter.colorize(:blue))\n\t\twhen 5\n\t\t\tletterArr.push(letter.colorize(:magenta))\n\t\twhen 6\n\t\t\tletterArr.push(letter.colorize(:cyan))\n\t\twhen 7\n\t\t\tletterArr.push(letter.colorize(:white))\n\t\tend\n\t\n\t\tpreviousRandNum = randNum\n\tend\n\treturn letterArr.join(\"\")\nend",
"def see_color(str)\n return 'red' if str.start_with?('red')\n return 'blue' if str.start_with?('blue')\n\n ''\n end",
"def put_background_color_to(str, color)\n str.colorize(background: :\"#{color}\")\n end",
"def background(pos, string)\n $background = \"\"\n if pos[0]\n background = pos[1].even? ? \"\\e[1;100m\" : \"\\e[47m\"\n else\n background = pos[1].odd? ? \"\\e[1;100m\" : \"\\e[47m\"\n end\n background + string\n end",
"def process_text text, color = \"#000000\"\n end",
"def rainbow \n \"rainbow\" \n end",
"def green(text)\n colorize(text, 32)\nend",
"def web_color(string)\n hashable = \"#{string}\"\n \"#\" + Digest::SHA1.hexdigest(hashable)[0..5]\n end",
"def rgb_style(string)\n pastel = Pastel.new\n styled_rgb = pastel.red(\"#{string[0]}\") + pastel.green(\"#{string[1]}\") + pastel.blue(\"#{string[2]}\")\n return styled_rgb\nend",
"def getOnMe()\n puts \"Enter the colors you want the background of the printed strings to be ON (the background)\"\n puts \"1) Red\\n2) Green\\n3) Yellow\\n4) Blue\\n5) Magenta\\n6) Cyan\"\n onMeString = gets.chomp.split(\", \")\n (0...onMeString.length()).each do |i|\n onMeString[i] = onMeString[i].to_i\n end\n puts \"Chosen Numbers: #{onMeString}\"\n return onMeString\nend",
"def anim(string)\n \n string.each_char do |n|\n \n \n print n \n \n \n slt =rand(0.02..0.08)\n sleep(slt) \n end\n print \"\\n\"\nend",
"def decorate(string, style)\n # (fg, bg, bright, underline)\n # fg = style.fg\n # bg = style.bg\n # bright = style.bright\n # underline = style.underline\n return string if !STDOUT.isatty || @output_type == :raw || @disabled\n\n fg = get_colour_instance style.fg\n bg = get_colour_instance style.bg\n\n output = []\n lines = string.lines.map(&:chomp)\n lines = [''] if lines.length.zero?\n lines.each do |line|\n unless line.length < 0\n line = case @palette.type\n when 'ansi' then colour_ansi line, fg, bg\n when 'extended' then colour_extended line, fg, bg\n else raise \"Unknown palette '#{@palette.type}'.\"\n end\n\n line = e(1) + line if style.bright\n line = e(4) + line if style.underline\n line = e(5) + line if style.blink\n line = e(7) + line if style.inverse\n line = e(20) + line if style.fraktur\n line = e(51) + line if style.framed\n\n if (style.bright || style.underline || style.blink || style.inverse || style.fraktur || style.framed) && (fg == nil) && (bg == nil)\n line << e(0)\n end\n end\n\n output.push line\n end\n\n output << '' if string =~ /\\n$/\n output.join \"\\n\"\n end",
"def random_pattern\n randomish_string = ('a'..'z').to_a.shuffle.join\n randomish_color = \"%06x\" % (rand * 0xffffff)\n return GeoPattern.generate(randomish_string, color: randomish_color )\n end",
"def fetch_current_word\n $current_word = $current_lvl.fetch(rand($current_lvl.length-1))\n $current_word.colorize(:color => :black, :background => :green)\nend",
"def red(text)\n colorize(text, 31)\nend",
"def color_to_use\n return :no_bg_color if value == :none\n value =~ /^on_/ ? value : \"on_#{value}\".to_sym\n end",
"def colour(name, text)\n if Pry.color\n str = Pry::Helpers::Text.send(name, text)\n unless str.start_with?(\"\\001\")\n str = \"\\001#{Pry::Helpers::Text.send name, '{text}'}\\002\".sub '{text}', \"\\002#{text}\\001\"\n end\n str\n else\n text\n end\nend",
"def from_custom_string(custom_string, positions: [0, 29, 14, 30, 28, 31])\n digest = Digest::MD5.hexdigest(custom_string.to_s)\n Inker.color(\"##{positions.map { |p| digest[p] }.join}\")\n end",
"def printStringRandomFont(printMe, duration)\n x = printMe.split(\", \")\n currentTime = Time.now.to_i\n futureTime = currentTime + duration\n while (currentTime <= futureTime) do\n print \"#{isMe(onMe(\"\\n#{returnFont(x[$prng.rand(0...x.length())])}\\n\\n\"))}\"\n currentTime = Time.now.to_i\n end\n menu()\nend",
"def on_49(_) { fg: fg_color(9) } end",
"def medium_rainbow_typer(string)\n string.chars.each do |x|\n print x.colorize(selector(@@colours))\n sleep(0.02)\n end\n br\n end",
"def fast_green_typer(string)\n string.chars.each do |x|\n print x.colorize(@@colours[0])\n sleep(0.003)\n end\n br\n end",
"def recolor(str, bg: '#000', fg: '#fff', bg_opacity: \"1.0\", fg_opacity: \"1.0\")\n doc = Nokogiri::XML(str)\n doc.css('path')[0]['fill'] = bg # dark backdrop\n doc.css('path')[1]['fill'] = fg # light drawing\n doc.css('path')[0]['fill-opacity'] = bg_opacity.to_s # dark backdrop\n doc.css('path')[1]['fill-opacity'] = fg_opacity.to_s # light drawing\n doc.to_xml\nend",
"def select_random_code\n code = \"\"\n 4.times { code += @colors.sample }\n return code\n end",
"def color(str, color)\n interactive? ? interaction_highline.color(str, color) : str\n end",
"def blue(text)\n colorize(text, 34)\nend",
"def green(string)\n \"\\033[0;32m#{string}\\033[0m\"\nend",
"def green(string)\n \"\\033[0;32m#{string}\\033[0m\"\nend",
"def add_bg_color(str, color)\n color = color.to_s.sub(\"bg_\", \"\").to_sym\n str = reset_prev_formatting str, :bg_color\n \"\\e[#{TC_CONFIG[:bg_colors][color].to_s}m#{str}\"\n end",
"def pride string\n c = @colors[@index % @size]\n @index += 1\n \"#{ESC}38;5;#{c}m#{string}#{NND}\"\n end",
"def green(string)\n colorize(string, 32)\n end",
"def decorate(options = {})\n return string if !self.class.enabled? || string.length == 0\n escape_sequence = [\n Colored2::TextColor.new(options[:foreground]),\n Colored2::BackgroundColor.new(options[:background]),\n Colored2::Effect.new(options[:effect])\n ].compact.join\n\n colored = ''\n colored << escape_sequence if options[:beginning] == :on\n colored << string\n if options[:end]\n colored << no_color if options[:end] == :off && !colored.end_with?(no_color)\n colored << escape_sequence if options[:end] == :on\n end\n colored\n end",
"def bg_red; use_code(41) end",
"def color_for_string(string)\n @color_hash[string] ||= (Digest::MD5.hexdigest(string)[0..8].to_i(16) % 6) + 31\n end",
"def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend",
"def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend",
"def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend",
"def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend",
"def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend",
"def green(string)\n \"\\033[0;32m#{string}\\e[0m\"\nend",
"def green(string)\n \"\\033[0;32m#{string}\\e[0m\"\nend",
"def getRandomColor()\n num = Random.rand(1..6)\n if num == 1 then return :red\n elsif num == 2 then return :blue\n elsif num == 3 then return :green\n elsif num == 4 then return :yellow\n elsif num == 5 then return :cyan\n elsif num == 6 then return :magenta\n end\nend",
"def colour(name, text)\n if Pry.color\n \"\\001#{Pry::Helpers::Text.send name, '{text}'}\\002\".sub '{text}', \"\\002#{text}\\001\"\n else\n text\n end\nend",
"def random_pattern_with_color( hex_color )\n randomish_string = ('a'..'z').to_a.shuffle.join\n return GeoPattern.generate(randomish_string, color: hex_color )\n end",
"def bg_dark_grey; use_code(100) end",
"def get_random_color\n\t\tletters = '0123456789ABCDEF'.split('');\n\t\tcolor = '#';\n\t\tprng = Random.new\n\t\tfor i in 0...6\n\t\t\tprng.seed\n\t\t\tcolor += letters[(prng.rand * 15).round];\n\t\tend\n\t\tcolor\n\tend",
"def welcome_explainer\n name = \" Legislature Information on Bills and Sponsors \"\n print ColorizedString[\"_/\\\\_\"].white.on_blue \n puts ColorizedString[name.center(name.length)].black.on_white\n print ColorizedString[\"\\\\/\\\\/\"].white.on_blue \n puts ColorizedString[\"(from Open States API v1)\".center(name.length)].white.on_red\nend",
"def red_(string)\n print $color.wrap(\"#{string}\").red\nend",
"def red(string)\n colorize(string, 31)\n end",
"def pick_hair_color\n # colors = ['Blonde', 'Silver', 'Periwinkle',\n # 'Pink', 'Teal', 'Green', 'Light Green',\n # 'Blue', 'Light Blue',\n # 'Red', 'Dark Red']\n\n ## only use \"darker\" colors - why? why not?\n colors = [ 'Purple',\n 'Orange', 'Red', 'Dark Red']\n\n colors[ rand( colors.size ) ]\nend",
"def fuzz_str()\n\t\treturn Rex::Text.rand_text_alphanumeric(rand(1024))\n\tend",
"def red(string)\n puts $color.wrap(\"#{string}\").red\nend",
"def colorize(str, foreground)\n if @color\n fore = FOREGROUND[foreground] or raise ArgumentError, \"Unknown foreground color #{foreground.inspect}\"\n \"#{fore}#{str}#{RESET}\"\n else\n str.to_s\n end\n end",
"def color(color); end",
"def some_age(string)\n string = \"Teddy\" if string == \"\"\n \"#{string} is #{rand(20..200)} years old!\"\nend",
"def yellow(string)\n colorize(string, 33)\n end",
"def colored_string\n color(to_bold_s)\n end",
"def rainbow; end",
"def style(s, style); color(s, *Styles[style]) end",
"def meow()\n punctuations = '.!?'\n \"#{CAT_FACES[rand(CAT_FACES.length)]} Meow#{punctuations[rand(punctuations.length)]}\"\n end",
"def highlight_line(string)\n\t$targets.each do |t|\n\t\n\t\t# match case insensitive if asked nicely\n\t\tif $options.match(/i/)\n\t\t\tre = Regexp.compile(t, true)\n\t\telse\n\t\t\tre = Regexp.compile(t, false)\n\t\tend\n\n\t\t# surround each match with terminal color control chars\n\t\tstring.gsub!(re) do |s|\n\t\t\t\"%s%s%s\" % [get_color(t), $&, $Normal]\n\t\tend\n\tend\n\n\tstring\nend",
"def flag3(str,left_color='brown',middle_color='pink',right_color='red')\n m = str.length / 3\n remainder = str.length % 3\n central_length = remainder == 1 ? m+1 : m \n lateral_length = remainder == 2 ? m+1 : m \n colora( left_color, str[ 0 .. lateral_length-1] ) + \n colora( middle_color, str[ lateral_length .. lateral_length+central_length-1] ) + \n colora( right_color, str[ lateral_length+central_length .. str.length ] ) \nend",
"def purple\n colorize(35)\n end",
"def instruction_message\n puts \"\\nMASTERMIND is a color guessing game where the computer generates a \\\nrandom string of four characters representing the base colors #{\"(r)ed\".red}, \\\n#{\"(g)reen\".green}, #{\"(b)lue\".blue}, and/or #{\"(y)ellow\".yellow}. \\\nThe intermediate difficulty level is six characters and adds \\\n#{\"(m)agenta\".magenta} and the advanced difficulty level is eight characters \\\nand adds #{\"(c)yan\".cyan}. \\\nThe string is only guaranteed to contain one color. The player must submit \\\nguesses to try to find the generated combination. Guesses are not case sensitive.\"\n\n puts \"\\nEnter #{\"(p)lay\".green}, #{\"(i)nstructions\".yellow} or #{\"(q)uit\".red}\"\n end",
"def message(string)\n puts\n puts \"[#{colorize(\"--\", \"blue\")}] #{ string }\"\nend",
"def colorize(str, color_code = 36)\n \"\\e[#{color_code}m#{str}\\e[0m\"\n end",
"def randomize_icon_color\n self.icon = \"a\".concat(rand(0..9).to_s)\n end",
"def drawMistakes(m)\n attron(color_pair(6))\n setpos(13,0)\n addstr(\"Mistakes: #{m}\")\n setpos(0,0)\nend",
"def qt_monkey_random_text \n return '\"generated: \" << (\"random\" * rand(5)) << ( \"text\" * rand(5))' \n end",
"def create_code\n speak\n code = []\n 4.times do\n code << Mastermind.show_colors[rand(0..7)]\n end\n code\n end",
"def c(text, colors)\n text = \"%{B#{colors[:bg]}}#{text}%{B-}\" if colors[:bg]\n text = \"%{F#{colors[:fg]}}#{text}%{F-}\" if colors[:fg]\n text\nend",
"def output_color(text, color=text.to_i)\r\n # Color matches: 1 - Black; 2 - White; 3 - Red; 4 - Yellow; 5 - Green; 6 - Blue; 7 - Gold\r\n colors = { 1 => 30, 2 => 36, 3 => 31, 4 => 33, 5 => 35, 6 => 34, 7 => 220 }\r\n # \\e[47m Is for the grey foreground \\e[{color} is for picking the color and \\e[0m is for resetting the terminal.\r\n \"\\e[1m\\e[47m\\e[#{colors[color]}m#{text}\\e[0m\\e[22m\"\r\n end",
"def random_face_emoji\n %w[cool goofy monocle sly smile think].sample\n end",
"def random_color\n String\n .colors\n .reject { |color| color == :default }\n .sample\n end",
"def to_s\n \"#{foreground}#{background}\"\n end",
"def draw_str(str, x, y, line_height = LINE_HEIGHT, colour, show_bg)\n # TODO: let's make a colour lookup class... See LineContent\n rgb =\n case colour\n when 'red'\n [255, 0, 0]\n when 'magenta'\n [255, 0, 255]\n when 'ltblue'\n [135, 206, 250]\n when 'yellow'\n [255, 255, 0]\n when 'ltgreen'\n [144, 238, 144]\n when 'cyan'\n [0, 255, 255]\n else # unknown colours default to white\n [255, 255, 255]\n end\n\n bg_on =\n if ['true', 'yes'].include? show_bg\n 1\n else\n 0\n end\n\n str.split(\"\\n\").each_with_index { |line, idx|\n @dc_kos.draw_str(line, x, y + (line_height * idx+1), *rgb, bg_on)\n }\n end",
"def shout(message)\n output.puts Paint[message, :bold, :red ]\n end",
"def color(code, str, partial = T.unsafe(nil)); end",
"def colorize txt, fg, bg, flags\n txt\n end",
"def string_flasher(string, difficulty, height, width, score)\n difficulty[5].times do\n clear\n puts score_display(score, difficulty)\n random_cursor(height, width)\n puts string.colorize(selector(@@colours))\n sleep(difficulty[6])\n end\n end",
"def red(string)\n \"\\033[0;33m#{string}\\033[0m\"\nend",
"def red(string)\n \"\\033[0;33m#{string}\\033[0m\"\nend",
"def cyan(str)\n color(36, str)\n end",
"def printRandomFont(duration)\n st = \"A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,0,1,2,3,4,5,6,7,8,9\"\n x = st.split(\",\")\n currentTime = Time.now.to_i\n futureTime = currentTime + duration\n while (currentTime <= futureTime)do\n print \"#{isMe(onMe(\"\\n#{returnFont(x[$prng.rand(0...x.length())])}\\n\\n\"))}\"\n currentTime = Time.now.to_i\n end\n menu()\nend",
"def highlight(str = '')\n return '' if str.blank?\n\n str = str.split('=')\n str.count > 1 ? \"\\e[32m#{str[0]}=\\e[33m#{str[1]}\\e[0m\" : \"\\e[32m#{str[0]}\\e[0m\"\nend",
"def background_color(color); end",
"def gen_color()\n random = Random.new\n\n colorname = Array.new(9)\n colorname = [ 'red', 'blue', 'lightblue', 'pink', 'gold', 'white', 'yellow', 'green', 'lightgreen', 'orange', 'grey', 'black' ]\n\n return colorname[random.rand(9)]\nend",
"def add_bright_color(str, color)\n color = color.to_s.sub(\"bright_\", \"\").to_sym\n str = reset_prev_formatting str, :color\n \"\\e[1m\\e[#{TC_CONFIG[:colors][color].to_s}m#{str}\"\n end",
"def colorize(string, code)\n \"\\e[#{code}m#{string}\\e[0m\"\n end",
"def randHashtag()\n (0...10).map{ ('a'..'z').to_a[rand(26)] }.join\nend",
"def coloured(string, colour)\n \"<%= color(\\\"#{string}\\\", #{colour}) %>\"\nend",
"def printStringS(printMe, duration)\n x = printMe.split(\", \")\n currentTime = Time.now.to_i\n futureTime = currentTime + duration\n while (currentTime <= futureTime) do\n print \"#{isMe(onMe(x[$prng.rand(0...x.length())]))}\"\n currentTime = Time.now.to_i\n end\n menu()\nend",
"def cover\n 'http://lorempixel.com/400/300/' + %W(abstract nightlife transport).sample + '?a=' + SecureRandom.uuid\n end"
] |
[
"0.7293182",
"0.6238231",
"0.61357147",
"0.60416496",
"0.60021955",
"0.5953776",
"0.5866313",
"0.5863987",
"0.5830028",
"0.57968444",
"0.5793305",
"0.57177734",
"0.56975555",
"0.5678245",
"0.5678075",
"0.5672203",
"0.5615061",
"0.5598038",
"0.5596516",
"0.553829",
"0.5522357",
"0.5495485",
"0.5493688",
"0.54860234",
"0.5482075",
"0.54646766",
"0.5460548",
"0.5427471",
"0.54136336",
"0.54105026",
"0.5406029",
"0.5397796",
"0.5397153",
"0.5397085",
"0.5397085",
"0.5374633",
"0.5342337",
"0.5334247",
"0.5332779",
"0.5317391",
"0.5308653",
"0.5298977",
"0.5298977",
"0.5298977",
"0.5298977",
"0.5298977",
"0.5296619",
"0.5296619",
"0.5294742",
"0.52926344",
"0.5282888",
"0.526683",
"0.5243335",
"0.5241076",
"0.5236999",
"0.52184546",
"0.5218034",
"0.52061176",
"0.5202939",
"0.52023923",
"0.5200272",
"0.51977354",
"0.51877683",
"0.5177717",
"0.51668626",
"0.51617813",
"0.5154531",
"0.51385623",
"0.51352954",
"0.5132728",
"0.5126955",
"0.5122005",
"0.5113414",
"0.5107758",
"0.51076514",
"0.5103996",
"0.50938594",
"0.5092577",
"0.50916225",
"0.5090838",
"0.5083264",
"0.5082549",
"0.5077831",
"0.50746655",
"0.50730306",
"0.5072108",
"0.50652546",
"0.5062585",
"0.5062585",
"0.5059153",
"0.5052822",
"0.5049181",
"0.50439715",
"0.50417423",
"0.5031814",
"0.50262004",
"0.50158346",
"0.5007335",
"0.50055015",
"0.5003805"
] |
0.7763928
|
0
|
returnFont(str) Passed a string, and returns it as a TTYfont which always has a new line at the end, which the font is dependent on a random number
|
def returnFont(str)
case $prng1.rand(1..5)
# when 1
# $fontFont = TTY::Font.new("3d")
# return $fontFont.write(str)
when 2
$fontFont = TTY::Font.new(:doom)
return $fontFont.write(str)
when 3
$fontFont = TTY::Font.new(:standard)
return $fontFont.write(str)
when 4
$fontFont = TTY::Font.new(:starwars)
return $fontFont.write(str)
when 5
$fontFont = TTY::Font.new(:straight)
return $fontFont.write(str)
else
$fontFont = TTY::Font.new(:standard)
return $fontFont.write(str)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def printStringRandomFont(printMe, duration)\n x = printMe.split(\", \")\n currentTime = Time.now.to_i\n futureTime = currentTime + duration\n while (currentTime <= futureTime) do\n print \"#{isMe(onMe(\"\\n#{returnFont(x[$prng.rand(0...x.length())])}\\n\\n\"))}\"\n currentTime = Time.now.to_i\n end\n menu()\nend",
"def printRandomFont(duration)\n st = \"A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,0,1,2,3,4,5,6,7,8,9\"\n x = st.split(\",\")\n currentTime = Time.now.to_i\n futureTime = currentTime + duration\n while (currentTime <= futureTime)do\n print \"#{isMe(onMe(\"\\n#{returnFont(x[$prng.rand(0...x.length())])}\\n\\n\"))}\"\n currentTime = Time.now.to_i\n end\n menu()\nend",
"def loadfont(str)\n inquiry_int do |font|\n super(str, font)\n end\n end",
"def draw_str(str, x, y, line_height = LINE_HEIGHT, colour, show_bg)\n # TODO: let's make a colour lookup class... See LineContent\n rgb =\n case colour\n when 'red'\n [255, 0, 0]\n when 'magenta'\n [255, 0, 255]\n when 'ltblue'\n [135, 206, 250]\n when 'yellow'\n [255, 255, 0]\n when 'ltgreen'\n [144, 238, 144]\n when 'cyan'\n [0, 255, 255]\n else # unknown colours default to white\n [255, 255, 255]\n end\n\n bg_on =\n if ['true', 'yes'].include? show_bg\n 1\n else\n 0\n end\n\n str.split(\"\\n\").each_with_index { |line, idx|\n @dc_kos.draw_str(line, x, y + (line_height * idx+1), *rgb, bg_on)\n }\n end",
"def font(name)\n primitive \"font \\'#{name}\\'\"\n end",
"def show_text(string) # Tj\n raise PDF::Reader::MalformedPDFError, \"current font is invalid\" if current_font.nil?\n at = transform(Point.new(0,0))\n @content[at.y] ||= \"\"\n @content[at.y] << current_font.to_utf8(string)\n end",
"def generate_font_id\n @mutex.synchronize { @current_font_id += 1 }\n end",
"def draw_text(line, string, even_text = false, width = nil)\n return if line <= 0\n y = 32 * line - 32\n if even_text\n if width != nil\n draw_even_text(0, y, width, 32, string)\n else\n draw_even_text(0, y, @width, 32, string)\n end\n else\n self.contents.draw_text(0, y, @width, 32, string)\n end\n end",
"def text(s, x, y, color=0xffffffff)\n color = sym_color(color) if color.is_a? Symbol\n @font.draw(s, x, y, 0, 1, 1, color)\n end",
"def draw\n @font.draw(@text, @x, @y, 0, 1, 1, @color)\n end",
"def new_font(*args)\n font = Font.new\n return font_config_abs(font, *args)\n end",
"def decorate(string, style)\n # (fg, bg, bright, underline)\n # fg = style.fg\n # bg = style.bg\n # bright = style.bright\n # underline = style.underline\n return string if !STDOUT.isatty || @output_type == :raw || @disabled\n\n fg = get_colour_instance style.fg\n bg = get_colour_instance style.bg\n\n output = []\n lines = string.lines.map(&:chomp)\n lines = [''] if lines.length.zero?\n lines.each do |line|\n unless line.length < 0\n line = case @palette.type\n when 'ansi' then colour_ansi line, fg, bg\n when 'extended' then colour_extended line, fg, bg\n else raise \"Unknown palette '#{@palette.type}'.\"\n end\n\n line = e(1) + line if style.bright\n line = e(4) + line if style.underline\n line = e(5) + line if style.blink\n line = e(7) + line if style.inverse\n line = e(20) + line if style.fraktur\n line = e(51) + line if style.framed\n\n if (style.bright || style.underline || style.blink || style.inverse || style.fraktur || style.framed) && (fg == nil) && (bg == nil)\n line << e(0)\n end\n end\n\n output.push line\n end\n\n output << '' if string =~ /\\n$/\n output.join \"\\n\"\n end",
"def generate(char, size, color)\n color = \"#\" + color.rgb.map{|f| f.to_s(16).rjust(2, \"0\") }.join()\n path = @fontimage.write(char.value, color, size.to_i)\n font_image_url(path)\n end",
"def load_font(family, height)\n end",
"def render_text s, c, f = font\n f.render_solid_utf8 s, *rgb[c]\n end",
"def render_text s, c, f = font\n f.render_solid_utf8 s, *rgb[c]\n end",
"def draw_text(text, x, y, z, scale_x = 1.0, scale_y = 1.0, \r\n color = Gosu::Color.new(255,255,255), mode = :default)\r\n\r\n # Draw the font at the requested location\r\n @font.draw(text,\r\n x,\r\n y,\r\n z,\r\n scale_x = 1.0,\r\n scale_y = 1.0,\r\n color = Gosu::Color.new(0,255,255),\r\n mode = :default)\r\n end",
"def text s, x, y, c, f = font\n f.draw_solid_utf8 screen, s, x, y, *rgb[c]\n end",
"def add_font_info(string)\n softcover_sty = File.join('latex_styles', 'softcover.sty')\n custom_pdf_sty = File.join('latex_styles', 'custom_pdf.sty')\n regex = '{code}{Verbatim}{(.*)}'\n styles = nil\n [softcover_sty, custom_pdf_sty].reverse.each do |filename|\n if File.exist?(filename)\n styles ||= File.read(filename).scan(/#{regex}/).flatten.first\n end\n end\n unless styles.nil?\n string.to_s.gsub!(\"\\\\begin{Verbatim}[\",\n \"\\\\begin{Verbatim}[#{styles},\")\n end\n string\n end",
"def text s, x, y, c, f = font\n f.draw_solid_utf8 screen, s, x, self.h-y-f.height, *rgb[c]\n end",
"def convert_1_number_to_1_font(number,font)\n if number == \"0\"\n return font[0]\n end\n if number == \"1\"\n return font[1]\n end\n if number == \"2\"\n return font[2]\n end\n if number == \"3\"\n return font[3]\n end\n if number == \"4\"\n return font[4]\n end\n if number == \"5\"\n return font[5]\n end\n if number == \"6\"\n return font[6]\n end\n if number == \"7\"\n return font[7]\n end\n if number == \"8\"\n return font[8]\n end\n if number == \"9\"\n return font[9]\n end\n if number == \":\"\n return font[-1]\n end\nend",
"def default_font; \"example.font\"; end",
"def cyan(string)\n \"\\n\\033[0;36m#{string}\\033[0m\"\nend",
"def cyan(string)\n \"\\n\\033[0;36m#{string}\\033[0m\"\nend",
"def cyan(string)\n \"\\n\\033[0;36m#{string}\\033[0m\"\nend",
"def pango_render_text(width,font,text)\n pango = self.create_pango_layout\n pango.width = width*1000\n pango.wrap=Pango::WRAP_WORD\n pango.font_description = Pango::FontDescription.new(font)\n pango.markup=text\n self.show_pango_layout(pango)\n end",
"def draw_text(x, y, text, options = {})\n options[:font_color] ||= RFPDF::COLOR_PALETTE[:black]\n options[:font] ||= default_font\n options[:font_size] ||= 10\n options[:font_style] ||= ''\n set_text_color_a(options[:font_color], options[:colorspace])\n SetFont(options[:font], options[:font_style], options[:font_size])\n SetXY(x, y)\n Write(options[:font_size] + 4, text)\n end",
"def drawText(x,y,text,fontSize = 14, fontFamily = :times, color = \"black\") \n @device.drawText(x,y,text,fontSize, fontFamily, color) ;\n end",
"def draw_text(xp, yp, step, strs, draw, canvas) # xp,yp is X,Y position. draw is the drawing method, canvas is where to draw on\n for str in strs\n yp = yp + step\n draw.annotate(canvas,647,600,xp,yp,str){\n draw.fill = '#ddd'\n draw.stroke = 'transparent'\n draw.pointsize = 20\n # self.font = \"BS.ttf\" \n draw.font = $config[\"fonts\"][3] \n }\n end\n return yp\nend",
"def bold(str)\n console_bold=\"\\e[1m\"\n console_reset=\"\\e[0m\"\n \"#{console_bold}#{str}#{console_reset}\"\nend",
"def font_style(style=nil)\n cur_page.font_style(style)\n end",
"def draw(text, x, y, z, factor_x = 1, factor_y = 1, c = Color::WHITE,\n mode = :default)\n\n offset = 0\n text.each_char do |char|\n (@fonts_manager.getSymbol char ).draw(x + offset, y, z, factor_x, factor_y, c, mode)\n offset += 10*factor_x\n end\n\n end",
"def draw_text_ex(x, y, text, reset = true)\n reset_font_settings if reset\n text = convert_escape_characters(text)\n pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}\n process_character(text.slice!(0, 1), text, pos) until text.empty?\n end",
"def SetFont(family, style='', size=0)\n\t\t# save previous values\n\t\t@prevfont_family = @font_family;\n\t\t@prevfont_style = @font_style;\n\n\t\tfamily=family.downcase;\n\t\tif (family=='')\n\t\t\tfamily=@font_family;\n\t\tend\n\t\tif ((!@is_unicode) and (family == 'arial'))\n\t\t\tfamily = 'helvetica';\n\t\telsif ((family==\"symbol\") or (family==\"zapfdingbats\"))\n\t\t\tstyle='';\n\t\tend\n\t\t\n\t\tstyle=style.upcase;\n\n\t\tif (style.include?('U'))\n\t\t\t@underline=true;\n\t\t\tstyle= style.gsub('U','');\n\t\telse\n\t\t\t@underline=false;\n\t\tend\n\t\tif (style.include?('D'))\n\t\t\t@deleted=true;\n\t\t\tstyle= style.gsub('D','');\n\t\telse\n\t\t\t@deleted=false;\n\t\tend\n\t\tif (style=='IB')\n\t\t\tstyle='BI';\n\t\tend\n\t\tif (size==0)\n\t\t\tsize=@font_size_pt;\n\t\tend\n\n\t\t# try to add font (if not already added)\n\t\tAddFont(family, style);\n\t\t\n\t\t#Test if font is already selected\n\t\tif ((@font_family == family) and (@font_style == style) and (@font_size_pt == size))\n\t\t\treturn;\n\t\tend\n\t\t\n\t\tfontkey = family + style;\n\t\tstyle = '' if (@fonts[fontkey].nil? and !@fonts[family].nil?)\n \n\t\t#Test if used for the first time\n\t\tif (@fonts[fontkey].nil?)\n\t\t\t#Check if one of the standard fonts\n\t\t\tif (!@core_fonts[fontkey].nil?)\n\t\t\t\tif @@fpdf_charwidths[fontkey].nil?\n\t\t\t\t\t#Load metric file\n\t\t\t\t\tfile = family;\n\t\t\t\t\tif ((family!='symbol') and (family!='zapfdingbats'))\n\t\t\t\t\t\tfile += style.downcase;\n\t\t\t\t\tend\n\t\t\t\t\tif (getfontpath(file + '.rb').nil?)\n\t\t\t\t\t\t# try to load the basic file without styles\n\t\t\t\t\t\tfile = family;\n\t\t\t\t\t\tfontkey = family;\n\t\t\t\t\tend\n\t\t\t\t\trequire(getfontpath(file + '.rb'));\n \t\tfont_desc = TCPDFFontDescriptor.font(file)\n\t\t\t\t\tif ((@is_unicode and ctg.nil?) or ((!@is_unicode) and (@@fpdf_charwidths[fontkey].nil?)) )\n\t\t\t\t\t\tError(\"Could not include font metric file [\" + fontkey + \"]: \" + getfontpath(file + \".rb\"));\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\ti = @fonts.length + 1;\n\n\t\t\t\tif (@is_unicode)\n\t\t\t\t\t@fonts[fontkey] = {'i' => i, 'type' => font_desc[:type], 'name' => font_desc[:name], 'desc' => font_desc[:desc], 'up' => font_desc[:up], 'ut' => font_desc[:ut], 'cw' => font_desc[:cw], 'enc' => font_desc[:enc], 'file' => font_desc[:file], 'ctg' => font_desc[:ctg]}\n\t\t\t\t\t@@fpdf_charwidths[fontkey] = font_desc[:cw];\n\t\t\t\telse\n\t\t\t\t\t@fonts[fontkey] = {'i' => i, 'type'=>'core', 'name'=>@core_fonts[fontkey], 'up'=>-100, 'ut'=>50, 'cw' => font_desc[:cw]}\n\t\t\t\t\t@@fpdf_charwidths[fontkey] = font_desc[:cw];\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tError('Undefined font: ' + family + ' ' + style);\n\t\t\tend\n\t\tend\n\t\t#Select it\n\t\t@font_family = family;\n\t\t@font_style = style;\n\t\t@font_size_pt = size;\n\t\t@font_size = size / @k;\n\t\t@current_font = @fonts[fontkey]; # was & may need deep copy?\n\t\tif (@page>0)\n\t\t\tout(sprintf('BT /F%d %.2f Tf ET', @current_font['i'], @font_size_pt));\n\t\tend\n\tend",
"def cyan(string)\n \"\\033[0;36m#{string}\\033[0m\"\nend",
"def qt_monkey_random_text \n return '\"generated: \" << (\"random\" * rand(5)) << ( \"text\" * rand(5))' \n end",
"def display_text\n\t\t\t#specifying font to be used\n\t\t\t#text_font @font, 16\n\t\t\t#text \"Mmmmm ... Strings .... \", 10, 100\n\t\tend",
"def get_single text, config={}\n w = one_line_window\n x = y = 0\n color = config[:color_pair] || $datacolor\n color=Ncurses.COLOR_PAIR(color);\n w.attron(color);\n w.mvprintw(x, y, \"%s\" % text);\n w.attroff(color);\n w.wrefresh\n Ncurses::Panel.update_panels\n chr = get_char\n w.destroy\n w = nil \n return chr\nend",
"def font=(font)\n set_font(font)\n generate_buffers\n end",
"def make_prompt_string( string )\n\t\t\treturn CLEAR_CURRENT_LINE + colorize( 'bold', 'green' ) { string + ' ' }\n\t\tend",
"def AddFont(family, style='', file='')\n\t\tif (family.empty?)\n\t\t\treturn;\n\t\tend\n\n\t\t#Add a TrueType or Type1 font\n\t\tfamily = family.downcase\n\t\tif ((!@is_unicode) and (family == 'arial'))\n\t\t\tfamily = 'helvetica';\n\t\tend\n\n\t\tstyle=style.upcase\n\t\tstyle=style.gsub('U','');\n\t\tstyle=style.gsub('D','');\n\t\tif (style == 'IB')\n\t\t\tstyle = 'BI';\n\t\tend\n\n\t\tfontkey = family + style;\n\t\t# check if the font has been already added\n\t\tif !@fonts[fontkey].nil?\n\t\t\treturn;\n\t\tend\n\n\t\tif (file=='')\n\t\t\tfile = family.gsub(' ', '') + style.downcase + '.rb';\n\t\tend\n\t\tfont_file_name = getfontpath(file)\n\t\tif (font_file_name.nil?)\n\t\t\t# try to load the basic file without styles\n\t\t\tfile = family.gsub(' ', '') + '.rb';\n \t\tfont_file_name = getfontpath(file)\n\t\tend\n if font_file_name.nil?\n\t\t\tError(\"Could not find font #{file}.\")\n end\n\t\trequire(getfontpath(file))\n\t\tfont_desc = TCPDFFontDescriptor.font(file)\n\n\t\tif (font_desc[:name].nil? and @@fpdf_charwidths.nil?)\n\t\t\tError('Could not include font definition file');\n\t\tend\n\n\t\ti = @fonts.length+1;\n\t\tif (@is_unicode)\n\t\t\t@fonts[fontkey] = {'i' => i, 'type' => font_desc[:type], 'name' => font_desc[:name], 'desc' => font_desc[:desc], 'up' => font_desc[:up], 'ut' => font_desc[:ut], 'cw' => font_desc[:cw], 'enc' => font_desc[:enc], 'file' => font_desc[:file], 'ctg' => font_desc[:ctg], 'cMap' => font_desc[:cMap], 'registry' => font_desc[:registry]}\n\t\t\t@@fpdf_charwidths[fontkey] = font_desc[:cw];\n\t\telse\n\t\t\t@fonts[fontkey]={'i' => i, 'type'=>'core', 'name'=>@core_fonts[fontkey], 'up'=>-100, 'ut'=>50, 'cw' => font_desc[:cw]}\n\t\t\t@@fpdf_charwidths[fontkey] = font_desc[:cw];\n\t\tend\n\n\t\tif (!font_desc[:diff].nil? and (!font_desc[:diff].empty?))\n\t\t\t#Search existing encodings\n\t\t\td=0;\n\t\t\tnb=@diffs.length;\n\t\t\t1.upto(nb) do |i|\n\t\t\t\tif (@diffs[i]== font_desc[:diff])\n\t\t\t\t\td = i;\n\t\t\t\t\tbreak;\n\t\t\t\tend\n\t\t\tend\n\t\t\tif (d==0)\n\t\t\t\td = nb+1;\n\t\t\t\t@diffs[d] = font_desc[:diff];\n\t\t\tend\n\t\t\t@fonts[fontkey]['diff'] = d;\n\t\tend\n\t\tif (font_desc[:file] and font_desc[:file].length > 0)\n\t\t\tif (font_desc[:type] == \"TrueType\") or (font_desc[:type] == \"TrueTypeUnicode\")\n\t\t\t\t@font_files[font_desc[:file]] = {'length1' => font_desc[:originalsize]}\n\t\t\telse\n\t\t\t\t@font_files[font_desc[:file]] = {'length1' => font_desc[:size1], 'length2' => font_desc[:size2]}\n\t\t\tend\n\t\tend\n\tend",
"def qt_monkey_random_text\n return '\"generated: \" << (\"random\" * rand(5)) << ( \"text\" * rand(5))'\n end",
"def init_font(font)\n @font=font\n dc = Wx::WindowDC.new(self)\n dc.set_font(font)\n @asc_width, asc_h = dc.get_text_extent(\"@\")[0,2]\n @asc_width+2 # compact, but not too much so\n @hex_width, hex_h = dc.get_text_extent(\"@@\")[0,2]\n @txt_height = (hex_h > asc_h)? hex_h : asc_h\n @addr_width = dc.get_text_extent(@data.size.to_s(16).rjust(4,'@'))[0]\n @row_height = @txt_height\n\n update_dimensions() if @started\n end",
"def draw_text_cs(x, y, w, h, t, a = 0)\r\n original_color = self.font.color.clone\r\n self.font.color = Color.new(0,0,0,100)\r\n draw_text(x + 2, y + 2, w, h, t, a)\r\n self.font.color = original_color\r\n draw_text(x, y, w, h, t, a) \r\n end",
"def draw\r\n @font.draw_text(\"No Longer Human!\", 50,50,0)\r\n end",
"def render_with_style(style, output)\n style_values = send(\"#{style}_style\")\n pdf.text output, style_values\n end",
"def font\n return @font\n end",
"def draw_text(loc, txt, font)\n pt = pixel_top_left(loc[:x], loc[:y])\n horiz_adjust = (@box_side_length - font.text_width(\"#{txt}\")) / 2\n vert_adjust = (@box_side_length - font.height) / 2\n font.draw(\"#{txt}\", pt.right(horiz_adjust)[:x], pt.down(vert_adjust)[:y], 0, 1, 1, BLACK)\n end",
"def style_for(char)\n return '' if char.style == @style\n\n @style = char.style\n @style.to_s\n end",
"def draw_formatted_text(x, y, width, text, max = nil, test = false, starting_position = nil)\n @emojis = 0\n return {:x => 0, :y => 0, :lines => 0} if text.nil? || text.empty?\n @paragraph_lines = 0\n mh = nil\n mh = max * line_height if max\n end_y = y\n pos = {}\n text.split(/[\\n\\r]+/).each do |paragraph|\n if starting_position != nil\n x_paragraph = x + starting_position[:x]\n y_paragraph = end_y + starting_position[:y]\n else\n x_paragraph = x\n y_paragraph = end_y\n end\n pos = draw_text_paragraph(x_paragraph, y_paragraph, width, check_emoji(paragraph), mh, test)\n end_y += pos[:y]\n starting_position = nil\n end\n pos[:y] = end_y\n pos\n end",
"def scr_bold\n print \"\\33[1m\"\nend",
"def font=(value)\n @font = value\n end",
"def style(string, type)\n raise \"Type '#{type}' unknown: must be one of \" + TYPES.map{|e| \":#{e}\"}.join(', ') if\n not TYPES.include?(type)\n style = eval(\"@#{type}_style\")\n foreground = eval(\"@#{type}_foreground\")\n background = eval(\"@#{type}_background\")\n # if no style nor colors, return raw string\n return string if not foreground and not background and not style\n # insert style and colors in string\n colorized = \"\\e[\"\n colorized << \"#{STYLE_CODES[style]};\" if style\n colorized << \"#{FOREGROUND_COLOR_CODES[foreground]};\" if foreground\n colorized << \"#{BACKGROUND_COLOR_CODES[background]};\" if background\n colorized = colorized[0..-2]\n colorized << \"m#{string}\\e[#{STYLE_CODES[:reset]}m\"\n return colorized\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 create_text_content(text, text_height, font_name)\n\t\tGosu::Image::from_text(text, text_height, {:font => font_name})\n\tend",
"def generate(options = {})\n options.reverse_merge!(\n :fontsize => 25,\n :padding => 20,\n :color => '#000',\n :background => '#fff',\n :fontweight => 'bold',\n :rotate => true,\n :font => config['font']\n ).symbolize_keys!\n\n options[:fontweight] = case options[:fontweight]\n when 'bold' then 700\n else 400\n end\n \n text = Magick::Draw.new\n text.pointsize = options[:fontsize]\n text.font_weight = options[:fontweight]\n text.fill = options[:color]\n text.gravity = Magick::CenterGravity\n text.font = options[:font] if options[:font]\n \n #rotate text 5 degrees left or right\n text.rotation = (rand(2)==1 ? 5 : -5) if options[:rotate]\n \n metric = text.get_type_metrics(self.string)\n\n #add bg\n canvas = Magick::ImageList.new\n canvas << Magick::Image.new(metric.width+options[:padding], metric.height+options[:padding]){\n self.background_color = options[:background]\n }\n\n #add text\n canvas << Magick::Image.new(metric.width+options[:padding], metric.height+options[:padding]){\n self.background_color = 'transparent'\n }.annotate(text, 0, 0, 0, 0, self.string).wave(1, 50)\n\n #add noise\n canvas << Magick::Image.new(metric.width+options[:padding], metric.height+options[:padding]){\n p = Magick::Pixel.from_color(options[:background])\n p.opacity = Magick::MaxRGB/2\n self.background_color = p\n }.add_noise(Magick::LaplacianNoise)\n\n self.image = canvas.flatten_images.blur_image(1)\n end",
"def fontName\n return @font_name\n end",
"def font_for(filename,size=16)\n tuple = [filename, size]\n if @fonts.has_key?(tuple)\n return @fonts[tuple]\n else\n fullpath = path_for(filename)\n return nil unless fullpath\n ext = File.extname(filename)\n result = nil\n case(ext.downcase)\n when \".ttf\"\n result = Rubygame::TTF.new(fullpath,size)\n when \".png\"\n result = Rubygame::SFont.new(fullpath)\n end\n @fonts[tuple] = result\n end\n return result\n end",
"def format(string)\n zwnj = \"\\u{0200c}\"\n ansi_to_irc_table = {\n \"\\033[30m\" => \"\\x031#{zwnj}\", # black\n \"\\033[31m\" => \"\\x034#{zwnj}\", # red\n \"\\033[32m\" => \"\\x033#{zwnj}\", # green\n \"\\033[33m\" => \"\\x037#{zwnj}\", # brown\n \"\\033[34m\" => \"\\x032#{zwnj}\", # blue\n \"\\033[35m\" => \"\\x0313#{zwnj}\", # magenta\n \"\\033[36m\" => \"\\x0311#{zwnj}\", # cyan\n \"\\033[37m\" => \"\\x031#{zwnj}\", # gray\n \"\\033[0m\" => \"\\x03#{zwnj}\", # color end\n \"\\033[1m\" => \"\\x02#{zwnj}\", # bold start\n \"\\033[22m\" => \"\\x02#{zwnj}\" # bold end\n }\n\n s = string.to_s\n ansi_to_irc_table.each { |ansi, irc| s.gsub!(ansi, irc) }\n s\n end",
"def line(*font)\n @io.puts(tag(:hr))\n end",
"def font\n\t\treturn @font\n\tend",
"def rand_text(length, bad=payload_badchars)\n if debugging?\n rand_text_debug(length)\n else\n Rex::Text.rand_text(length, bad)\n end\n end",
"def font_id(style_index)\n xf_id(style_index)[:fontId]\n end",
"def text_width(font_handle, text)\n end",
"def render pad, lineno, text\n if @hash\n dim = match_line text\n fg = dim.first\n bg = dim[1] || @default_colors[1]\n if dim.size == 3\n att = dim.last\n else\n att = @default_colors.last\n end\n cp = get_color($datacolor, fg, bg)\n else\n cp = @pair\n att = @default_colors[2]\n end\n\n FFI::NCurses.wattron(pad,FFI::NCurses.COLOR_PAIR(cp) | att)\n FFI::NCurses.mvwaddstr(pad, lineno, 0, text)\n FFI::NCurses.wattroff(pad,FFI::NCurses.COLOR_PAIR(cp) | att)\n end",
"def style_for(char)\n return ''.freeze if char.style == @style\n\n @style = char.style\n @style.to_s\n end",
"def add_text_wrap(x, y, width, text, size = nil, justification = :left, angle = 0, test = false)\n if text.kind_of?(Numeric) and size.kind_of?(String)\n text, size = size, text\n warn PDF::Writer::Lang[:add_textw_parameters_reversed] % caller[0]\n end\n\n if size.nil? or size <= 0\n size = @font_size\n end\n\n # Need to store the initial text state, as this will change during the\n # width calculation, but will need to be re-set before printing, so\n # that the chars work out right\n t_CTS = @current_text_state.dup\n\n select_font(\"Helvetica\") if @fonts.empty?\n return \"\" if width <= 0\n\n w = brk = brkw = 0\n font = @current_font\n tw = width / size.to_f * 1000\n\n pos = -1\n loop do\n pos += 1\n break if pos == text.size\n font_change = true\n tag_size, text, font_change = quick_text_tags(text, pos, font_change)\n if tag_size != 0\n if font_change\n current_font!\n font = @current_font\n end\n pos += (tag_size - 1)\n else\n w += char_width(font, text[pos, 1])\n\n if w > tw # We need to truncate this line\n if brk > 0 # There is somewhere to break the line.\n if text[brk] == \" \"\n tmp = text[0, brk]\n else\n tmp = text[0, brk + 1]\n end\n x, adjust = adjust_wrapped_text(tmp, brkw, width, x, justification)\n\n # Reset the text state\n @current_text_state = t_CTS.dup\n current_font!\n add_text(x, y, tmp, size, angle, adjust) unless test\n return text[brk + 1..-1]\n else # just break before the current character\n tmp = text[0, pos]\n# tmpw = (w - char_width(font, text[pos, 1])) * size / 1000.0\n x, adjust = adjust_wrapped_text(tmp, brkw, width, x, justification)\n\n # Reset the text state\n @current_text_state = t_CTS.dup\n current_font!\n add_text(x, y, tmp, size, angle, adjust) unless test\n return text[pos..-1]\n end\n end\n\n if text[pos] == ?-\n brk = pos\n brkw = w * size / 1000.0\n end\n\n if text[pos, 1] == \" \"\n brk = pos\n ctmp = text[pos]\n ctmp = @fonts[font].differences[ctmp] unless @fonts[font].differences.nil?\n z = @fonts[font].c[tmp].nil? ? 0 : @fonts[font].c[tmp]['WX']\n brkw = (w - z) * size / 1000.0\n end\n end\n end\n\n # There was no need to break this line.\n justification = :left if justification == :full\n tmpw = (w * size) / 1000.0\n x, adjust = adjust_wrapped_text(text, tmpw, width, x, justification)\n # reset the text state\n @current_text_state = t_CTS.dup\n current_font!\n add_text(x, y, text, size, angle, adjust) unless test\n return \"\"\n end",
"def width(string, font_size)\n string_base_width = string.bytes.inject(0){|result, byte|\n byte_width = WIDTHS[byte] || 1000\n result + byte_width\n }\n string_base_width * font_size / 1000\n end",
"def time_to_font(time,font)\n output = []\n for i in 0...time.length()\n converted_font = convert_1_number_to_1_font(time[i],font)\n output.append(converted_font)\n end\n return output\nend",
"def font idx\n @fonts[idx]\n end",
"def printstr(pad, r,c,string, color, att = Ncurses::A_NORMAL)\n\n #att = bold ? Ncurses::A_BLINK|Ncurses::A_BOLD : Ncurses::A_NORMAL\n # att = bold ? Ncurses::A_BOLD : Ncurses::A_NORMAL\n pad.attrset(Ncurses.COLOR_PAIR(color) | att)\n #pad.mvprintw(r, c, \"%s\", string);\n pad.mvaddstr(r, c, \"%s\" % string);\n pad.attroff(Ncurses.COLOR_PAIR(color) | att)\nend",
"def make_line(text_array, len)\n start = rand(text_array.length)\n val = start\n line = \"\"\n while true\n val = val + 1\n line = \"#{line} #{text_array[val]}\"\n if line.to_phrase.syllables == len\n line.gsub!('\"','')\n return line\n end\n if line.to_phrase.syllables > len\n line = \"\"\n start = start + 1\n val = start\n end\n end\n end",
"def bold(output)\n color('1', output)\n end",
"def print_out(style, input)\n move_down style[:upper_space]\n font style[:font_variable], :style => $headline_chapter_font_style\n font_size style[:font_size_variable]\n text input\nend",
"def colorize(str, color_code = 36)\n \"\\e[#{color_code}m#{str}\\e[0m\"\n end",
"def write_char(c)\n if c == \"\\000\"\n # Return to original text\n c = \"\\\\\"\n end\n # If \\C[n]\n if c == \"\\001\"\n # Change text color\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n color = $1.to_i\n if color >= 0 and color <= 7\n self.contents.font.color = text_color(color)\n end\n # go to next text\n return\n end\n # If \\G\n if c == \"\\002\"\n # Make gold window\n if @gold_window == nil\n @gold_window = Window_Gold.new\n @gold_window.x = 560 - @gold_window.width\n if $game_temp.in_battle\n @gold_window.y = 192\n else\n @gold_window.y = self.y >= 128 ? 32 : 384\n end\n @gold_window.opacity = self.opacity\n @gold_window.back_opacity = self.back_opacity\n end\n # go to next text\n return\n end\n # If \\skip\n if c == \"\\003\"\n # toggle text skipping\n #$game_system.text_skip = !$game_system.text_skip\n # go to next text\n return\n end\n # If \\b\n if c == \"\\004\"\n # toggle bold\n self.contents.font.bold = !self.contents.font.bold\n # go to next text\n return\n end\n # If \\i\n if c == \"\\005\"\n # toggle italics\n self.contents.font.italic = !self.contents.font.italic\n # go to next text\n return\n end\n # If \\s\n if c == \"\\006\"\n # toggle shadow\n #$game_system.shadowed_text = !$game_system.shadowed_text\n # go to next text\n return\n end\n # If \\font\n if c == \"\\007\"\n # change font\n @text.sub!(/\\[(.*?)\\]/, \"\")\n font = $1.to_s\n @font = font\n if font == \"\"\n self.contents.font.name = Font.default_name\n else\n self.contents.font.name = font\n end\n # go to next text\n return\n end\n # If \\p[n]\n if c == \"\\010\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n @pause_time = $1.to_i\n\n # go to next text\n return\n end\n \n # If \\w[n]\n if c == \"\\011\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n @wait = $1.to_i\n\n # go to next text\n return\n end\n \n # If \\ws[n]\n if c == \"\\013\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n $game_system.write_speed = $1.to_i\n\n # go to next text\n return\n end \n # If \\oa[n]\n if c == \"\\014\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n index = $1.to_i\n @text.sub!(\" \", \"\")\n item = $data_armors[index]\n # draw the icon\n icon = RPG::Cache.icon(item.icon_name)\n self.contents.blt(@x + 2, (@y * 32) + 4, icon, Rect.new(0, 0, 24, 24))\n @x += 24\n\n # go to next text\n return\n end\n \n # If \\oi[n]\n if c == \"\\015\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n index = $1.to_i\n @text.sub!(\" \", \"\")\n item = $data_items[index]\n # draw the icon\n icon = RPG::Cache.icon(item.icon_name)\n self.contents.blt(@x + 2, (@y * 32) + 4, icon, Rect.new(0, 0, 24, 24))\n @x += 24\n\n # go to next text\n return\n end\n \n # If \\os[n]\n if c == \"\\016\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n index = $1.to_i\n @text.sub!(\" \", \"\")\n item = $data_skills[index]\n # draw the icon\n icon = RPG::Cache.icon(item.icon_name)\n self.contents.blt(@x + 2, (@y * 32) + 4, icon, Rect.new(0, 0, 24, 24))\n @x += 24\n\n # go to next text\n return\n end\n \n # If \\ow[n]\n if c == \"\\017\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n index = $1.to_i\n @text.sub!(\" \", \"\")\n item = $data_weapons[index]\n # draw the icon\n icon = RPG::Cache.icon(item.icon_name)\n self.contents.blt(@x + 2, (@y * 32) + 4, icon, Rect.new(0, 0, 24, 24))\n @x += 24\n \n # go to next text\n return\n end\n \n # If \\tc\n if c == \"\\020\"\n # center justify\n @text_justification = CENTER\n get_x_value\n # go to next text\n return\n end\n \n # If \\tl\n if c == \"\\021\"\n # left justify\n @text_justification = LEFT\n get_x_value\n # go to next text\n return\n end\n \n # If \\tr\n if c == \"\\022\"\n # right justify\n @text_justification = RIGHT\n get_x_value\n # go to next text\n return\n end\n \n # If \\ignr\n if c == \"\\023\"\n # set ignore flage\n @ignore = true\n # go to next text\n return\n end\n \n # if \\c (hex color)\n if c == \"\\026\"\n # convert hex color to RGB\n @text.sub!(/\\[([0123456789abcdef]+)\\]/, \"\")\n hex_code = $1.to_s\n \n red = (\"0x\" + hex_code.slice(0..1)).hex\n blue = (\"0x\" + hex_code.slice(2..3)).hex\n green = (\"0x\" + hex_code.slice(4..5)).hex\n \n self.contents.font.color = Color.new(red, blue, green)\n return\n end\n \n # If new line text\n if c == \"\\n\"\n # Add 1 to y\n if !@ignore\n @y += 1\n end\n if @text != \"\"\n get_x_value\n end\n @ignore = false\n\n # go to next text\n return\n end\n if @ignore\n return\n end\n # Draw text\n line = self.contents.text_size(\"dj\").height\n if $game_system.shadowed_text\n old_color = self.contents.font.color.clone\n self.contents.font.color = $game_system.shadow_color\n self.contents.draw_text(6 + @x, line * @y + 2, 40, 32, c)\n self.contents.font.color = old_color\n end\n self.contents.draw_text(4 + @x, line * @y, 40, 32, c)\n # Add x to drawn text width\n @x += self.contents.text_size(c).width\n end",
"def draw_text_indent(line, string, additional=0)\n return if line <= 0\n y = 32 * line - 32\n self.contents.draw_text(35+additional, y, @width, 32, string)\n end",
"def font_descender(size = nil)\n size = @font_size if size.nil? or size <= 0\n\n select_font(\"Helvetica\") if @fonts.empty?\n hi = @fonts[@current_font].fontbbox[1].to_f\n (size * hi / 1000.0)\n end",
"def widont(text)\n return Typogruby.widont(text.to_s)\n end",
"def draw_text_icon(line, string, graphic_name)\n return if line <= 0\n draw_icon(line, graphic_name)\n y = 32 * line - 32\n self.contents.draw_text(35, y, @width, 32, string)\n end",
"def font\n @font_path\n end",
"def draw_text_box(x, y, w, h, text, options = {})\n options[:align] ||= 'C'\n options[:border] ||= 0\n options[:border_color] ||= RFPDF::COLOR_PALETTE[:black]\n options[:border_width] ||= 0.5\n options[:fill] ||= 1\n options[:fill_color] ||= RFPDF::COLOR_PALETTE[:white]\n options[:font] ||= default_font\n options[:font_color] ||= RFPDF::COLOR_PALETTE[:black]\n options[:font_size] ||= 8\n options[:font_line_spacing] ||= options[:font_size] * 0.3\n options[:font_style] ||= ''\n options[:padding] ||= 2\n options[:x_padding] ||= 0\n options[:valign] ||= \"M\"\n\t\tif options[:fill] == 1 or options[:border] == 1\n draw_box(x, y, w, h, options)\n \tend \n SetMargins(0,0,0)\n set_text_color_a(options[:font_color], options[:colorspace])\n \tfont_size = options[:font_size]\n SetFont(options[:font], options[:font_style], font_size)\n \tfont_size += options[:font_line_spacing]\n \tcase options[:valign]\n \t when \"B\", \"bottom\"\n \t y -= options[:padding]\n \t when \"T\", \"top\"\n \t y += options[:padding]\n \tend\n \tcase options[:align]\n \t when \"L\", \"left\"\n \t x += options[:x_padding]\n \t w -= options[:x_padding]\n \t w -= options[:x_padding]\n \t when \"R\", \"right\"\n \t x += options[:x_padding]\n \t w -= options[:x_padding]\n \t w -= options[:x_padding]\n \tend\n SetXY(x, y)\n if GetStringWidth(text) < w or not text[\"\\n\"].nil? and (options[:valign] == \"T\" || options[:valign] == \"top\")\n text = text + \"\\n\"\n end\n if GetStringWidth(text) > w or not text[\"\\n\"].nil? or (options[:valign] == \"B\" || options[:valign] == \"bottom\")\n font_size += options[:font_size] * 0.1\n # TODO 2006-07-21 Level=1 - this is assuming a 2 line text\n SetXY(x, y + ((h - (font_size * 2)) / 2)) if (options[:valign] == \"M\" || options[:valign] == \"middle\")\n MultiCell(w, font_size, text, 0, options[:align])\n else\n Cell(w, h, text, 0, 0, options[:align])\n end\n end",
"def add_font font\n @fonts.push(font).uniq! if font\n font\n end",
"def font(name=nil, size=nil, options={})\n cur_page.font(name, size, options)\n end",
"def write_char(c)\n if c == \"\\000\"\n # Return to original text\n c = \"\\\\\"\n end\n # If \\C[n]\n if c == \"\\001\"\n # Change text color\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n color = $1.to_i\n if color >= 0 and color <= 7\n self.contents.font.color = text_color(color)\n end\n # go to next text\n return\n end\n # If \\G\n if c == \"\\002\"\n # Make gold window\n if @gold_window == nil\n @gold_window = Window_Gold.new\n @gold_window.x = 560 - @gold_window.width\n if $game_temp.in_battle\n @gold_window.y = 192\n else\n @gold_window.y = self.y >= 128 ? 32 : 384\n end\n @gold_window.opacity = self.opacity\n @gold_window.back_opacity = self.back_opacity\n end\n # go to next text\n return\n end\n # If \\skip\n if c == \"\\003\"\n # toggle text skipping\n $game_system.text_skip = !$game_system.text_skip\n # go to next text\n return\n end\n # If \\b\n if c == \"\\004\"\n # toggle bold\n self.contents.font.bold = !self.contents.font.bold\n # go to next text\n return\n end\n # If \\i\n if c == \"\\005\"\n # toggle italics\n self.contents.font.italic = !self.contents.font.italic\n # go to next text\n return\n end\n # If \\s\n if c == \"\\006\"\n # toggle shadow\n $game_system.shadowed_text = !$game_system.shadowed_text\n # go to next text\n return\n end\n # If \\font\n if c == \"\\007\"\n # change font\n @text.sub!(/\\[(.*?)\\]/, \"\")\n font = $1.to_s\n $game_system.font = font\n if font == \"\"\n self.contents.font.name = Font.default_name\n else\n self.contents.font.name = font\n end\n # go to next text\n return\n end\n # If \\p[n]\n if c == \"\\010\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n @pause_time = $1.to_i\n\n # go to next text\n return\n end\n \n # If \\w[n]\n if c == \"\\011\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n @wait = $1.to_i\n\n # go to next text\n return\n end\n \n # If \\ws[n]\n if c == \"\\013\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n $game_system.write_speed = $1.to_i\n\n # go to next text\n return\n end \n # If \\oa[n]\n if c == \"\\014\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n index = $1.to_i\n @text.sub!(\" \", \"\")\n item = $data_armors[index]\n # draw the icon\n icon = RPG::Cache.icon(item.icon_name)\n line = self.contents.text_size(\"dj\").height\n self.contents.blt(@x + 4, (@y * line) + 4, icon, Rect.new(0, 0, 24, 24))\n @x += 24\n\n # go to next text\n return\n end\n \n # If \\oi[n]\n if c == \"\\015\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n index = $1.to_i\n @text.sub!(\" \", \"\")\n item = $data_items[index]\n # draw the icon\n\t if item != nil\n\t\ticon = RPG::Cache.icon(item.icon_name) \n\t\tline = self.contents.text_size(\"dj\").height\n\t\tself.contents.blt(@x + 4, (@y * line) + 4, icon, Rect.new(0, 0, 24, 24))\n\t\t@x += 24\n\t end\n\n # go to next text\n return\n end\n \n # If \\os[n]\n if c == \"\\016\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n index = $1.to_i\n @text.sub!(\" \", \"\")\n item = $data_skills[index]\n # draw the icon\n icon = RPG::Cache.icon(item.icon_name)\n line = self.contents.text_size(\"dj\").height\n self.contents.blt(@x + 2, (@y * line) + 4, icon, Rect.new(0, 0, 24, 24))\n @x += 24\n\n # go to next text\n return\n end\n \n # If \\ow[n]\n if c == \"\\017\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n index = $1.to_i\n @text.sub!(\" \", \"\")\n item = $data_weapons[index]\n # draw the icon\n icon = RPG::Cache.icon(item.icon_name)\n line = self.contents.text_size(\"dj\").height\n self.contents.blt(@x + 2, (@y * line) + 4, icon, Rect.new(0, 0, 24, 24))\n @x += 24\n \n # go to next text\n return\n end\n \n # If \\tc\n if c == \"\\020\"\n # center justify\n $game_system.text_justification = CENTER\n get_x_value\n # go to next text\n return\n end\n \n # If \\tl\n if c == \"\\021\"\n # left justify\n $game_system.text_justification = LEFT\n get_x_value\n # go to next text\n return\n end\n \n # If \\tr\n if c == \"\\022\"\n # right justify\n $game_system.text_justification = RIGHT\n get_x_value\n # go to next text\n return\n end\n \n # If \\ignr\n if c == \"\\023\"\n # set ignore flage\n @ignore = true\n # go to next text\n return\n end\n \n # if \\slv\n if c == \"\\024\"\n # we need to show a slave window\n @text.sub!(/\\[(.*?)\\]/, \"\")\n name = $1.to_s\n $game_system.slave_windows[name].show = true\n return\n end\n \n # if \\ind\n if c == \"\\025\"\n # we need to show a independent window\n @text.sub!(/\\[(.*?)\\]/, \"\")\n name = $1.to_s\n if $game_system.indy_windows[name].show\n $game_system.indy_windows[name].dispose\n $game_system.indy_windows.delete(name)\n else\n $game_system.indy_windows[name].show = true\n end\n return\n end\n \n # if \\c (hex color)\n if c == \"\\026\"\n # convert hex color to RGB\n @text.sub!(/\\[([0123456789abcdef]+)\\]/, \"\")\n hex_code = $1.to_s\n \n red = (\"0x\" + hex_code.slice(0..1)).hex\n blue = (\"0x\" + hex_code.slice(2..3)).hex\n green = (\"0x\" + hex_code.slice(4..5)).hex\n \n self.contents.font.color = Color.new(red, blue, green)\n return\n end\n \n # If new line text\n if c == \"\\n\"\n # Add 1 to y\n if !@ignore\n @y += 1\n end\n if @text != \"\"\n get_x_value\n end\n @ignore = false\n\n # go to next text\n return\n end\n if @ignore\n return\n end\n # Draw text\n line = self.contents.text_size(\"dj\").height\n if $game_system.shadowed_text\n old_color = self.contents.font.color.clone\n self.contents.font.color = $game_system.shadow_color \n self.contents.draw_text(6 + @x, line * @y + 2, 40, 32, c)\n self.contents.font.color = old_color\n end\n self.contents.draw_text(4 + @x, line * @y, 40, 32, c)\n # Add x to drawn text width\n @x += self.contents.text_size(c).width\n end",
"def reset_prev_formatting(str, type)\n case type\n when :color\n str = str.gsub(\"\\e[1m\", '').gsub(/\\e\\[[3][0-7]m/, '')\n when :bg_color\n str = str.gsub(/\\e\\[[4][0-7]m/, '')\n when :underline\n str = str.gsub(\"\\e[4m\", '')\n when :strikethrough\n str = str.gsub(\"\\e[9m\", '')\n end\n\n # Remove ANSI termination characters from `str`.\n str = str.gsub(\"\\e[0m\", '')\n\n # Hack! Add ANSI termination character at the end of `str` if `str`\n # contains any fancy stuff added by term colorizer methods before.\n if str.scan(/\\e\\[[1-9]/).any?\n str = str + \"\\e[0m\" unless str.end_with? \"\\e[0m\"\n end\n\n return str\n end",
"def font_style(style)\n f = font\n if block_given?\n font(f.name, size: font_size, style: style) do\n yield\n end\n else\n font(f.name, size: font_size, style: style)\n end\n end",
"def draw_text(locator, text, options = {})\n color = options.fetch(:color, '#f00')\n font_size = options.fetch(:font_size, 13)\n top = options.fetch(:top, 2)\n right = options.fetch(:right, 20)\n\n rect = rect(locator)\n id = random_id\n\n execute_script(%(\n var textbox = window.document.createElement('div');\n textbox.id = '#{id}';\n textbox.innerText = '#{text}';\n textbox.style.border = 'none';\n textbox.style.color = '#{color}';\n textbox.style.display = 'block';\n textbox.style.font = '#{font_size}px Verdana, sans-serif';\n textbox.style.left = #{rect.x} + 'px';\n textbox.style.margin = '0';\n textbox.style.padding = '0';\n textbox.style.position = 'absolute';\n textbox.style.right = #{right} + 'px';\n textbox.style.top = (#{rect.y} + #{rect.height} + #{top}) + 'px';\n textbox.style.zIndex = '99999';\n window.document.body.appendChild(textbox);\n return;\n ))\n\n find_element(\"id=#{id}\")\n end",
"def render pad, lineno, text\n FFI::NCurses.mvwaddstr(pad, lineno, 0, @clearstring) if @clearstring\n FFI::NCurses.mvwaddstr(pad, lineno, 0, text)\n end",
"def path_to_font(source, options = T.unsafe(nil)); end",
"def ansi_to_html(string); end",
"def stylize(string)\n CLI::UI.fmt string\n end",
"def default_signature_font(person)\n\n # Build hash.\n people = {\n chris_terry: \"Arty Signature\",\n toby_varland: \"Gallatone\",\n tim_hudson: \"Hello Santtiny\",\n greg_turner: \"Hello Santtiny\",\n john_mcguire: \"Xtreem\",\n kevin_marsh: \"Autograf\",\n art_mink: \"Notera\",\n rob_caudill: \"Hello Santtiny\",\n mike_mitchell: \"Hello Santtiny\",\n terry_marshall: \"Hello Santtiny\",\n ross_varland: \"Wanted Signature\"\n }\n\n # Return font.\n return people.fetch(person, \"Hello Santtiny\")\n\n end",
"def monospace(str)\n _raw str.gsub(/`([^`]*)`/, '<code>\\1</code>')\n end",
"def met_font_config(shade, state)\n return font_config(shade, font_size, state)\n end",
"def mapf_format_paragraph(text, max_width = contents_width)\n text = text.clone\n # Create a Dummy Contents - I wanted to boost compatibility by using the\n # default process method for escape codes. It may have the opposite effect,\n # for some :(\n real_contents = contents # Preserve Real Contents\n self.contents = Bitmap.new(24, 24)\n reset_font_settings\n paragraph = \"\"\n while !text.empty?\n text.lstrip!\n oline, nline, tw = mapf_format_by_line(text.clone, max_width)\n # Replace old line with the new one\n text.sub!(/#{Regexp.escape(oline)}/m, nline)\n paragraph += text.slice!(/.*?(\\n|$)/)\n end\n contents.dispose # Dispose dummy contents\n self.contents = real_contents # Restore real contents\n return paragraph\n end",
"def default_font_name()\n end",
"def draw_text(destination_bitmap, x, y, text)\n start_x = x\n start_y = y\n cursor_x = start_x\n cursor_y = start_y\n \n for i in 0...text.length\n # New line character\n if text[i].chr == \"\\n\"\n cursor_x = 0\n cursor_y += @common.lineHeight\n end\n \n char = @chars[text[i]]\n \n # If there was no info about this character in the font file, skip it\n next if char == nil\n \n # Render the character\n x = cursor_x + char.xoffset\n y = cursor_y + char.yoffset\n \n src_bitmap = @page_bitmaps[char.page]\n \n src_rect = Rect.new(\n char.x,\n char.y,\n char.width,\n char.height\n )\n \n destination_bitmap.blt(x, y, src_bitmap, src_rect)\n \n cursor_x += char.xadvance\n end\n end",
"def pride string\n c = @colors[@index % @size]\n @index += 1\n \"#{ESC}38;5;#{c}m#{string}#{NND}\"\n end",
"def font_setup\n %Q(font \"#{@font},#{@fontsize}\")\n end"
] |
[
"0.6373198",
"0.62699497",
"0.5854242",
"0.5825746",
"0.5771107",
"0.5691184",
"0.5671456",
"0.56694084",
"0.56310356",
"0.56266737",
"0.56012356",
"0.5599312",
"0.55815506",
"0.55778265",
"0.5555534",
"0.5555534",
"0.55336475",
"0.5479716",
"0.5475523",
"0.5461922",
"0.545489",
"0.5408537",
"0.5400635",
"0.5400635",
"0.5400635",
"0.5396146",
"0.5387598",
"0.538511",
"0.5366139",
"0.53616184",
"0.5352456",
"0.53335184",
"0.531617",
"0.5295386",
"0.52842975",
"0.5233563",
"0.5218787",
"0.52134603",
"0.52121717",
"0.5210191",
"0.520615",
"0.51993454",
"0.5188775",
"0.51841116",
"0.51834255",
"0.5159797",
"0.514899",
"0.5145237",
"0.51272327",
"0.5126799",
"0.51211876",
"0.5119797",
"0.5119108",
"0.51174223",
"0.5106507",
"0.51021194",
"0.5090295",
"0.5089913",
"0.50827867",
"0.5081262",
"0.50760996",
"0.5071342",
"0.50666106",
"0.50224566",
"0.5019318",
"0.5009427",
"0.49990714",
"0.4995664",
"0.49898732",
"0.49894795",
"0.4987573",
"0.4983336",
"0.49818978",
"0.49775848",
"0.49744445",
"0.49733722",
"0.49710393",
"0.4964621",
"0.49628574",
"0.49577373",
"0.49477208",
"0.4929851",
"0.49240392",
"0.49199486",
"0.4919418",
"0.49100733",
"0.4909042",
"0.49061123",
"0.48976204",
"0.4894034",
"0.48939514",
"0.48918155",
"0.48766991",
"0.48685443",
"0.48660848",
"0.4865337",
"0.4858785",
"0.48555958",
"0.48403442",
"0.48387092"
] |
0.7918338
|
0
|
getIsMe() Returns an integer array (max 6) of user picked numbers, which corresponds to the colors that work well with the command prompt (this program has not yet been tested to work in any Linux Kernel, for reasons of lazyness) Note to self: GET THIS SHIT TO WORK, THEN MAKE EACH SELECTION REPRESENT THAT COLOR, DO THIS FOR getOnMe() TOO
|
def getIsMe()
puts "Enter the colors you want the printed string to be"
puts "1) Red\n2) Green\n3) Yellow\n4) Blue\n5) Magenta\n6) Cyan"
isMeString = gets.chomp.split(", ")
(0...isMeString.length()).each do |i|
isMeString[i] = isMeString[i].to_i
end
puts "Chosen Numbers: #{isMeString}"
return isMeString
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def getOnMe()\n puts \"Enter the colors you want the background of the printed strings to be ON (the background)\"\n puts \"1) Red\\n2) Green\\n3) Yellow\\n4) Blue\\n5) Magenta\\n6) Cyan\"\n onMeString = gets.chomp.split(\", \")\n (0...onMeString.length()).each do |i|\n onMeString[i] = onMeString[i].to_i\n end\n puts \"Chosen Numbers: #{onMeString}\"\n return onMeString\nend",
"def enter_colors\n speak\n guess\n end",
"def scan_for_colors; end",
"def get_colors_from_player(prompt)\n\t\twhile true\n\t\t\tcolors = encode_input Mastermind.get_user_input(prompt)\n\t\t\treturn colors unless colors.nil?\n\t\t\tputs Mastermind.color(INVALID_INPUT_MESSAGE, \"error\")\n\t\tend\n\tend",
"def player_choice_acquisition\n puts \"Choose between the following colors: #{@colors}\"\n (1..@code_length).map do |choice|\n user_input = nil\n until @colors.include?(user_input)\n puts \"indicate choice N°#{choice}:\"\n user_input = gets.chomp\n end\n user_input\n end\n end",
"def enter_colors\n colors = []\n until colors.length == 4\n pick = gets.chomp.downcase\n if input_validation(pick)\n colors << pick\n else\n puts \"Don't know that color, sorry.\"\n end\n end\n puts \"You picked #{colors.join(\", \")}\"\n colors\n end",
"def get_color_pegs\n code_peg_colors = CodePeg::COLORS\n print \"Enter your 4 colors from #{code_peg_colors} : \"\n user_input = gets.chomp.split(\" \")\n\n until user_input.length == 4 &&\\\n user_input.all? { |item| code_peg_colors.include?(item) }\n print \"Enter your 4 colors from #{code_peg_colors} : \"\n user_input = gets.chomp.split(\" \")\n end\n user_input\n\n end",
"def make_guess\n\t\tget_colors_from_player MAKE_GUESS_PROMPT\n\tend",
"def singleColor()\n\n\tcolor = $rng.rand(0..5)\n\tword = $rng.rand(6..11)\n\n\tprintJumble(color, word)\n\n\tentry = gets.chomp\n\n\tif (entry == $arr[color+6])\n\t\t\treturn 1\n\telse\n\t\t\treturn 0\n\tend\n\nend",
"def creator_ai_input\n return Colors.sample(4)\n end",
"def ask_for_guess\n @guess_count += 1\n @guess = get_code(\"Please enter your guess in the format 'color color color color'(to list available color options enter 'options'):\")\n end",
"def pick_solution\n \tputs \"Enter your secret code. Choose four colors\"\n \tenter_row\n end",
"def in_check?(color)\n end",
"def choose_color\n all = self.class.shell(\"docker ps --format={{.Names}}\").compact\n\n if @project\n @prefix = \"#{@project}_\"\n all.reject! { |n| !n.start_with?(@prefix) }\n all = all.map { |cn| cn[@prefix.length..-1] }\n end\n\n # Find colors that are in use\n in_use = Set.new(all.map { |cn| cn.split('_')[0] }) & @palette\n\n # Find a color that isn't in use; default to the first color if\n # everything is already used\n @palette.detect { |c| !in_use.include?(c) } || @palette.first\n end",
"def player_guess\n print 'Red = 1, '.colorize(:red), 'Green = 2, '.colorize(:green), 'Blue = 3, '.colorize(:blue),\n 'Magenta = 4, '.colorize(:magenta), 'Cyan = 5, '.colorize(:cyan), \"Yellow = 6\\n\".colorize(:light_yellow)\n puts\n puts \"Select four colours or enter 's' to show previous guesses.\"\n colour_selection = gets.chomp\n if colour_selection == 's'\n show_previous_guesses\n player_guess\n elsif colour_selection.length == 4 && !colour_selection.match?(/[^123456]/)\n store_colour_selection(colour_selection)\n else\n puts 'Input four numbers (1-6)'\n player_guess\n end\n end",
"def colors\n Color.all.each_with_index do |color, i|\n puts \"#{i + 1}. #{color.name}\"\n end\n\n puts \"\\nType the number of the color to see a list of the associated crystals.\"\n puts \"To go back, type 'menu'.\\n\\n\"\n\n input = gets.strip.downcase\n if input == 'menu'\n elsif input.to_i > 0 && (input.to_i - 1) < Color.all.length\n index = input.to_i - 1\n # Show list of crystals for a given color\n c = Color.all[index]\n Color.crystals(c).each_with_index do |crystal, i|\n puts \"#{i + 1}. #{crystal.name}\"\n end\n\n puts \"\\nTo learn more about a crystal, type the number.\"\n input = gets.strip.downcase\n if input.to_i > 0 && (input.to_i - 1) < Color.crystals(c).length\n index = input.to_i - 1\n crystal = Color.crystals(c)[index]\n # Show info for given crystal\n crystal_info(crystal)\n end\n else\n puts 'Try one of these options:'\n colors\n end\n end",
"def choose_colour(board,width,height,count,finished_game_counter,current_score)\n \n #prints the array\n board.each do |row|\n row.each do |column| \n \n #the field is coloured according to the element in the array \n if column == :red\n \n #prints the element as two space characters with a coloured background\n print column = \" \".colorize(:background => :red)\n elsif column == :green\n print column = \" \".colorize(:background => :green)\n elsif column == :blue\n print column = \" \".colorize(:background => :blue)\n elsif column == :yellow\n print column = \" \".colorize(:background => :yellow)\n elsif column == :magenta\n print column = \" \".colorize(:background => :magenta)\n elsif column == :cyan\n print column = \" \".colorize(:background => :cyan)\n end \n end\n puts\n end\n \n #display number of turns\n print \"Number of turns: \"\n turns(count)\n \n #display percentage completed\n print \"Current completion: \"\n completion(board,width,height,count,finished_game_counter,current_score)\n \n #gets user input r,g,y,b,c,m and increases count by one\n print \"Choose a colour: \"\n user_colour = gets.chomp.downcase\n count = count + 1\n \n #the user_colour variable will be set , depending on the user input\n if user_colour == \"r\"\n user_colour = :red\n change_colour(board,user_colour,width,height,count,finished_game_counter,current_score)\n elsif user_colour == \"g\"\n user_colour = :green\n change_colour(board,user_colour,width,height,count,finished_game_counter,current_score)\n elsif user_colour == \"b\"\n user_colour = :blue\n change_colour(board,user_colour,width,height,count,finished_game_counter,current_score)\n elsif user_colour == \"y\"\n user_colour = :yellow\n change_colour(board,user_colour,width,height,count,finished_game_counter,current_score)\n elsif user_colour == \"m\"\n user_colour = :magenta\n change_colour(board,user_colour,width,height,count,finished_game_counter,current_score)\n elsif user_colour == \"c\"\n user_colour = :cyan\n change_colour(board,user_colour,width,height,count,finished_game_counter,current_score)\n \n #if user types q, he will return to the main menu\n elsif user_colour == \"q\"\n main_menu(width,height,current_score,finished_game_counter)\n end\nend",
"def color_pick\n if mark_ratio < (day_parameter + least_mark_ratio)\n color = \"#C7E6F2\" #light color below average performance\n elsif mark_ratio >= ((2*day_parameter) + least_mark_ratio)\n color = \"#44bbdf\" #dark color excellent perfomance\n else\n color = \"#70c9e5\" #meduim color average performance\n end \n return color \n end",
"def colored_prompt\n return (Readline::VERSION !~ /EditLine/) && Pry.color if @colored_prompt.nil?\n\n @colored_prompt\n end",
"def computer_color\n\t valid_colors = [\"r\", \"y\", \"b\", \"w\", \"c\", \"g\"] \n\t return [valid_colors[rand(0..5)],valid_colors[rand(0..5)], valid_colors[rand(0..5)], valid_colors[rand(0..5)]]\n\tend",
"def possible_colors\n %w(R G B Y)\n end",
"def isMe(str)\n case $prng1.rand(1..6)\n when 1\n return $pastel.red(str)\n when 2\n return $pastel.green(str)\n when 3\n return $pastel.yellow(str)\n when 4\n return $pastel.blue(str)\n when 5\n return $pastel.magenta(str)\n when 6\n return $pastel.cyan(str)\n end\nend",
"def complementColor()\n\t\n\tcolor = $rng.rand(0..5)\n\tword = $rng.rand(6..11)\n\n\tprintJumble(color,word)\n\n\tentry = gets.chomp\n\n\tif (entry == getComplement($arr[color+6]))\n\t\t\treturn 1\n\telse\n\t\t\treturn 0\n\tend\n\nend",
"def colorQuest(color)\n color = color.downcase if color\n return \"7DC076EF\" if color == \"blue\"\n return \"089D5EBF\" if color == \"red\"\n return \"26CC4B56\" if color == \"green\"\n return \"6F697395\" if color == \"cyan\"\n return \"5CFA729D\" if color == \"magenta\"\n return \"135D47BF\" if color == \"yellow\"\n return \"56946F5A\" if color == \"gray\"\n return \"7FDE6B39\" if color == \"white\"\n return \"751272B7\" if color == \"purple\"\n return \"0E7F4F3F\" if color == \"orange\"\n return \"2D4A5694\" # Returns the default dark gray color if all other options are exhausted\nend",
"def get_theme_choice_from_user(icon_theme_names)\n display_theme_names(icon_theme_names)\n puts \"Choose an icon theme by typing its number\"\n chosen = STDIN.gets.chomp.to_i\n\n while chosen < 1 || chosen > icon_theme_names.count\n puts \"Invalid choice. Please type a number between 1-#{icon_theme_names.count}\"\n chosen = STDIN.gets.chomp.to_i\n end\n icon_theme_names[chosen-1]\nend",
"def usecolor\n return @usecolor if defined? @usecolor\n if @cmdobj.settings.has_key? 'nocolor' then @usecolor = false\n elsif @cmdobj.settings.has_key? 'mailto' then @usecolor = false\n elsif not @colorok then @usecolor = false\n else @usecolor = $stdout.tty?\n end\n #debug \"Use color? #{@usecolor}\"\n return @usecolor\n end",
"def choose_code\r\n @code = []\r\n 4.times do\r\n @code.push($possible_color[(rand(0..5))])\r\n end\r\n @code\r\n end",
"def store_colour_selection(colour_selection)\n @guess = colour_selection.to_s.chars.map(&:to_i).join(' ')\n code_to_index\n end",
"def ask_for_code\n get_code(\"Please enter the code your four color code in the format 'color color color color'(to list available color options enter 'options'):\")\n end",
"def askGuess\n valid = false\n while (!valid)\n puts \"The choices are: #{'red'.bright_red} #{'yellow'.bright_yellow} #{'green'.green} #{'blue'.cyan} #{'orange'.red} #{'purple'.magenta};\\n\n Please enter your guess for the first color:\"\n c1 = gets.chomp \n puts \"Please enter your guess for the second color:\"\n c2 = gets.chomp\n puts \"Please enter your guess for the third color:\"\n c3 = gets.chomp\n puts \"Please enter your guess for the fourth color:\"\n c4 = gets.chomp\n if (valid?(c1) && valid?(c2) && valid?(c3) && valid?(c4))\n valid = true\n else \n puts \"\\nThere was a problem with your input. Please try again with correct input\\n\"\n end\n end\n @guess = [c1, c2, c3, c4]\n puts \"your guess was #{@guess.to_s}\"\n end",
"def colors() = @colors ||= %i[blue green purple magenta cyan yellow red]",
"def colorize(*args)\n shell.set_color(*args)\n end",
"def scan_for_colors\n scan(/\\033\\[([0-9;]+)m(.+?)\\033\\[0m|([^\\033]+)/m).map do |match|\n split_colors(match)\n end\n end",
"def scan_for_colors\n scan(/\\033\\[([0-9;]+)m(.+?)\\033\\[0m|([^\\033]+)/m).map do |match|\n split_colors(match)\n end\n end",
"def get_color\n\tputs \"Client's favorite color:\"\n\tcolor = gets.chomp\nend",
"def pick_hair_color\n # colors = ['Blonde', 'Silver', 'Periwinkle',\n # 'Pink', 'Teal', 'Green', 'Light Green',\n # 'Blue', 'Light Blue',\n # 'Red', 'Dark Red']\n\n ## only use \"darker\" colors - why? why not?\n colors = [ 'Purple',\n 'Orange', 'Red', 'Dark Red']\n\n colors[ rand( colors.size ) ]\nend",
"def random_guess\n return Colors.sample(4)\n end",
"def display_color_index\n require_color_echo_get\n\n CE.rainbow\n cnt = 134\n @padding = \" \" * 2\n\n header = \"OK, Let me check color index list... :)\"\n mes = CE.rainbow.get(@padding + \"-\" * cnt) + $/\n mes += @padding + \" \" * ((cnt - header.size)/2) + CE.rainbow.get(header) + $/\n mes += CE.rainbow.get(@padding + \"-\" * cnt) + $/\n\n mes += @padding\n 256.times do |i|\n num = i + 1\n mes += CE.fg(\"index#{num}\".intern).get(\"index#{num}\" + \" \" * (4 - num.to_s.size))\n mes += CE.bg(\"index#{num}\".intern).get(\" \" * 5)\n mes += \" \" * 3\n\n if num % 8 == 0\n mes += $/ * 2\n mes += @padding if num != 256\n end\n end\n print mes \n\n exit 0\nend",
"def request_color(string = nil)\n string = '#999' unless string.to_s.match(/#?[0-9A-F]{3,6}/i)\n color = string\n prefix, string = string.match(/(#?)([0-9A-F]{3,6})/i)[1,2]\n string = $1 * 2 + $2 * 2 + $3 * 2 if string =~ /^(.)(.)(.)$/\n \n _options = default_options_for_cocoa_dialog()\n _options[\"color\"] = string\n \n col = cocoa_dialog(\"colorselect\", _options)\n return nil unless col && col != \"\" # user cancelled\n col.delete! '#'\n\n color = prefix\n if /(.)\\1(.)\\2(.)\\3/.match(col) then\n color << $1 + $2 + $3\n else\n color << col\n end\n return color\n end",
"def colorThenWord ()\n\t\n\tcolor = $rng.rand(0..5)\n\tword = $rng.rand(6..11)\n\n\tprintJumble(color, word)\n\n\tlineArr = gets.chomp.split\n\n\tif (lineArr[0] == $arr[color+6] && lineArr[1] == $arr[word])\n\t\t\treturn 1\n\telse\n\t\t\treturn 0\n\tend\n\n\nend",
"def color_selection\n\t\tputs \"Player 1, do you choose \\\"red\\\" or \\\"black\\\"?\"\n\t\tcolor = gets.chomp.strip.downcase\n\t\tcase color\n\t\twhen \"red\"\n\t\t\t@player1 = Player.new(:red)\n\t\t\t@player2 = Player.new(:black)\n\t\twhen \"black\"\n\t\t\t@player1 = Player.new(:black)\n\t\t\t@player2 = Player.new(:red)\n\t\telse\n\t\t\tputs \"Error: Invalid entry. Try again...\"\n\t\t\tcolor_selection\n\t\tend\n\t\tfirst_turn\n\tend",
"def wordThenColor()\n\n\tcolor = $rng.rand(0..5)\n\tword = $rng.rand(6..11)\n\n\tprintJumble(color,word)\n\n\tlineArr = gets.chomp.split\n\n\tif (lineArr[0] == $arr[word] && lineArr[1] == $arr[color+6])\n\t\t\treturn 1\n\telse\n\t\t\treturn 0\n\tend\n\nend",
"def get_colour\n colour = gets.chomp.downcase\n \n if colour ==\"q\" then\n colour = \"q\" \n elsif colour == \"r\" \n colour = :red\n elsif colour == \"b\"\n colour = :blue\n elsif colour == \"g\"\n colour = :green\n elsif colour == \"y\"\n colour = :yellow\n elsif colour == \"c\"\n colour = :cyan\n elsif colour == \"m\"\n colour = :magenta\n else\n # if the input is none of the above colours or 'q'\n # then the input must be invalid \n colour = \"invalid\" \n end\n # return colour\n return colour\nend",
"def enter_row\n guess = gets.chomp.split(\",\")\n guess.each{ |color| color.strip! }\n if guess.length != 4\n return false\n end\n guess.each do |color|\n if !Peg::COLORS.include?(color)\n return false\n end\n end\n return guess\n end",
"def colors_for(i, j)\n mode = :default\n if [i, j] == @cursor\n bg = @board.piece_in_hand.is_a?(NullPiece) ? :yellow : :light_blue\n # mode = :blink\n # elsif @board.piece_in_hand.filter_moves.include?([i,j])\n # bg = :white\n elsif (i + j).odd?\n bg = :white\n bg = :green if highlight && @board.piece_in_hand.filter_moves.include?([i,j])\n elsif (i + j).even?\n bg = :light_white\n bg = :light_green if highlight && @board.piece_in_hand.filter_moves.include?([i,j])\n end\n\n { background: bg, color: :black, mode: mode } #@board[[i, j]].color\n end",
"def determine_color_scheme\n @default_options.color_scheme = @highline.choose do |menu|\n menu.layout = :one_line\n menu.select_by = :name\n menu.header = nil\n menu.prompt = \"What color scheme would you like? \"\n menu.choice(\"none\") { :none }\n menu.choice(\"dark terminal background\") { :dark_bg }\n menu.choice(\"light terminal background\") { :light_bg }\n end\n end",
"def input_correct?(guess)\n guess.all? {|i| @color_array.any?{|x| x==i}}\nend",
"def printColorHelp()\n\tputs \"Red looks like this\".red()\n\tputs \"Green looks like this\".green()\n\tputs \"Yellow looks like this\".yellow()\n\tputs \"Blue looks like this\".blue()\n\tputs \"Magenta looks like this\".magenta()\n\tputs \"Cyan looks like this\".cyan()\n\tputs \"Complements are:\"\n\tputs \"Red and Cyan\"\n\tputs \"Green and Magenta\"\n\tputs \"Blue and Yellow\"\n\tputs \"When prompted for 'color', enter the color in which the word appears\"\n\tputs \"When prompted for 'word', enter the word that is written\"\n\tputs \"Please enter all data in lowercase and in a single line when \"\\\n\t\"prompted for two words\"\n\tputs \"Once you have attained the required points for a given level, \"\\\n\t \"you will be asked if you want to skip to the next level\"\n\tputs \"I apologize to all the colorblind folks out there!\"\nend",
"def get_color\n if @thread\n return CYCLING\n end\n\n pins = COLORS.select do |pin|\n get_pin pin\n end\n\n if pins.length == 0\n return nil\n elsif pins.length == 1\n return pins.first\n else\n return INVALID_STATE\n end\n end",
"def playerguess\n @guess = []\n puts \"What do you think the first colour is?\"\n @guess[0] = gets.chomp.downcase\n #input_validator(@guess[0])\n puts \"What do you think the second colour is?\"\n @guess[1] = gets.chomp.downcase\n #input_validator(@guess[1])\n puts \"What do you think the third colour is?\"\n @guess[2] = gets.chomp.downcase\n #input_validator(@guess[2])\n puts \"What do you think the fourth colour is?\"\n @guess[3] = gets.chomp.downcase\n #input_validator(@guess[3])\n end",
"def get_color\n @colors.each {\n |key, val| \n (val[:set] = true; return val[:syn]) unless val[:set]\n }\n DEFAULT_COLOR\n end",
"def firstWordSecondColor()\n\n\tcolor1 = $rng.rand(0..5)\n\tword1 = $rng.rand(6..11)\n\n\tcolor2 = $rng.rand(0..5)\n\tword2 = $rng.rand(6..11)\n\n\tprintJumble(color1,word1)\n\tprintJumble(color2,word2)\n\n\tlineArr = gets.chomp.split\n\n\tif (lineArr[0] == $arr[word1] && lineArr[1] == $arr[color2+6])\n\t\t\treturn 1\n\telse\n\t\t\treturn 0\n\tend\n\nend",
"def onMe(str)\n case $prng1.rand(1..6)\n when 1\n return $pastel.on_red(str)\n when 2\n return $pastel.on_green(str)\n when 3\n return $pastel.on_yellow(str)\n when 4\n return $pastel.on_blue(str)\n when 5\n return $pastel.on_magenta(str)\n when 6\n return $pastel.on_cyan(str)\n end\nend",
"def get_guess(hints = nil, turn = nil)\n computer_guess = []\n\n if correct_colors.uniq.length != 4\n case turn\n when 1\n 4.times { computer_guess << color_spectrum[guess_set] }\n # self.guess_set += 1\n when (2..8)\n 4.times { computer_guess << color_spectrum[guess_set] }\n correct_colors << color_spectrum[guess_set - 1] if color_is_correct(hints, turn)\n # self.guess_set += 1 if guess_set < 8\n when 9\n correct_colors << color_spectrum[guess_set - 1] if color_is_correct(hints, turn)\n self.correct_colors = correct_colors.shuffle\n return correct_colors\n else\n self.correct_colors = correct_colors.shuffle\n return correct_colors\n end\n else\n self.correct_colors = correct_colors.shuffle\n return correct_colors\n end\n self.guess_set += 1 if guess_set < 8\n computer_guess\n end",
"def give_hint (guess, code)\n #red_orb => right color, position\n #white_orb => right color, wrong position\n red_orb = 0\n white_orb = 0\n\n code.each_with_index do |color, index|\n if (guess[index] == color)\n red_orb += 1\n elsif (guess.include?(color))\n white_orb += 1\n end\n end\n\n return [red_orb,white_orb]\n end",
"def hash_to_array() #define function\n counter = 1 #set local variables for this function to access\n hash = {} #empty hash to store user input\n numbers = [] #returning array variables\n colors = []\n puts \"Let's pick 5 different numbers and colors.\" \n\n while counter <= 5 do #loop to collect 5 of each input type needed\n print \"#{counter} Pick a number. \"\n number = gets.chomp.to_i\n print \"#{counter} Pick a color. \"\n color = gets.chomp.to_s\n counter += 1\n hash.store(number, color) #store input into a hash, easiest way is via key value pair, could also do hash[colors]=color\n end\n \n \n print \"Do you want all of your colors or all of your numbers? \"\n answer = gets.chomp\n \n if answer == \"numbers\" \n hash.each_key {|key| numbers.push(key)}\n puts numbers\n else \n hash.each_value {|value| colors.push(value)}\n puts colors\n end\nend",
"def display_colors\n\t\tprint \"\\nColors: \"\n\t\tMastermind::COLORS.each do |color, _color_code|\n\t\t\tunless color == :blank || color == :black || color == :white\n\t\t\t\tcolor_string = color.to_s.capitalize\n\t\t\t\tprint Mastermind::color(\" #{color_string} \", color)\n\t\t\tend\n\t\tend\n\t\tputs \"\\nChoose a color with it's full name or it's first character\"\n\tend",
"def process_options\n puts ScrumyChangeColor::ALLOWED_COLORS.join(', ') if @options.list_colors\n end",
"def computer_choice_acquisition\n if @proposed_code == []\n @choice_list = @colors.repeated_permutation(@code_length).to_a\n else\n @choice_list.select! do |item|\n result_pair = check_proposed_code(item)\n result_pair[0] == @iteration_correct_value_and_position && result_pair[1] == @iteration_correct_value_wrong_position\n end\n end\n @choice_list[0]\n end",
"def color(*options)\n mix = []\n color_seen = false\n\n if options.empty?\n mix << random(false) # random foreground color\n else\n options.each{ |option|\n case option\n when Symbol\n if ANSI_EFFECTS.keys.include?(option)\n mix << effect(option)\n elsif ANSI_COLORS.keys.include?(option)\n mix << simple(option, color_seen)\n color_seen = true\n else\n raise ArgumentError, \"Unknown color or effect: #{ option }\"\n end\n\n when Array\n if option.size == 3 && option.all?{ |n| n.is_a? Numeric }\n mix << rgb(*(option + [color_seen])) # 1.8 workaround\n color_seen = true\n else\n raise ArgumentError, \"Array argument must contain 3 numerals\"\n end\n\n when ::String\n if option =~ /^#?(?:[0-9a-f]{3}){1,2}$/\n mix << hex(option, color_seen)\n color_seen = true\n else\n mix << name(option, color_seen)\n color_seen = true\n end\n\n when Numeric\n integer = option.to_i\n color_seen = true if (30..49).include?(integer)\n mix << integer\n\n when nil\n color_seen = true\n \n else\n raise ArgumentError, \"Invalid argument: #{ option.inspect }\"\n\n end\n }\n end\n\n wrap(*mix)\n end",
"def main_menu\n options = [\"View recipe book\", \"Search by ingredient\", \"Quit app\"]\n answer = @prompt.select(\"Choose an option:\".colorize(:color => :blue), (options))\n if answer == options[0]\n select_recipe_from_book(@user.view_recipe_book)\n elsif answer == options[1]\n find_recipe\n elsif answer == options[2]\n puts ''\n puts \"Thanks for using Feed. See you next time!\".colorize(:color => :blue)\n system exit\n end\nend",
"def color?\n tty?\n end",
"def get_guess\n @user_guess = \"\"\n if @count >= 5\n abort(\"You guessed 5 times incorrectly. You Lose\")\n else\n while guess_letters_check\n print \"You must guess exactly 4 colors (R,Y,B,P,O,G).\\nGuess here:\"\n @user_guess = gets.chomp.upcase\n end\n end\n @count += 1\n check_guess(@user_guess)\n end",
"def prompt_user\n \"[#{`whoami`.chomp}]\".green\nend",
"def select_color\n selected ? :red : color\n end",
"def add_colors\n\tNcurses.start_color\n\tcolors = %w[RED BLUE GREEN MAGENTA CYAN YELLOW]\n\tcolors.each { |color|\n\t\teval \"Ncurses.init_color( Ncurses::COLOR_#{color}, #{rand(0..1000)}, #{rand(0..1000)}, #{rand(0..1000)} )\"\n\t}\n\t#Ncurses.init_pair( PAIR_NUMBER, BORDER_LINE_COLOR, BORDER_COLOR)\n\trandom_color = eval \"Ncurses::COLOR_#{colors.sample}\"\n\tNcurses.init_pair(2, random_color, Ncurses::COLOR_RED)\n\tNcurses.init_pair(3, random_color, Ncurses::COLOR_BLUE)\n\tNcurses.init_pair(4, random_color, Ncurses::COLOR_GREEN)\n\tNcurses.init_pair(5, random_color, Ncurses::COLOR_MAGENTA)\n\tNcurses.init_pair(6, random_color, Ncurses::COLOR_CYAN)\n\tNcurses.init_pair(7, random_color, Ncurses::COLOR_YELLOW)\nend",
"def colors; end",
"def on_49(_) { fg: fg_color(9) } end",
"def menu\n puts `clear`\n puts Rainbow(\"*** Welcome to the calculator ***\").magenta.bright.underline\n puts Rainbow(\"Choose your type of calculator\").green.bright.blink\n print Rainbow(\"(b)\").green + \"asic or \" + Rainbow(\"(a)\").yellow + \"dvance or \" + Rainbow(\"(g)\").cyan + \"ometry or \" + Rainbow(\"(l)\").blue + \"ength conversion or \" + Rainbow(\"(p)\").magenta + \"eriod or \" + Rainbow(\"(t)\").green + \"mperature or \" + Rainbow(\"(w)\").cyan + \"eight or \" + Rainbow(\"(q)\").red + \"uit: \"\n gets.chomp.downcase\n\nend",
"def list_colors\n color_string = \"\\nThe available colors are \"\n COLORS.each_with_index do |color, index|\n if index%2 == 0\n color_string += \"\\n\"\n end\n color_string += color + \" \"\n end\n puts color_string\n end",
"def prompt_in\n \" > \".cyan\nend",
"def find_color_codes\n color_codes.uniq(&:numeric_code)\n end",
"def menu\n puts Rainbow(\"*** Welcome to the calculator ***\").magenta.bright.underline\n puts Rainbow(\"Choose your type of calculator\").green.bright.blink\n print Rainbow(\"(b)\").green + \"asic or \" + Rainbow(\"(a)\").yellow + \"dvance or \" + Rainbow(\"(q)\").red + \"uit: \"\n gets.chomp.downcase\nend",
"def isColor(c)\n if c == \"r\" or c == \"b\" or c == \"g\" or c == \"y\" or c == \"c\" or c == \"m\" then\n return true\n else\n return false\n end\nend",
"def getcolors(gridrow)\n AnsiColor.block(usecolor) do\n return normal, normal\n end\n end",
"def take_turn\n puts @master.show_board\n puts \"\\nPick your colors (one by one):\"\n puts Mastermind.show_colors.join(\", \")\n\n @master.guess(@codebreaker.enter_colors)\n @robot.get_the_score(@master.score) if @codebreaker == @robot\n end",
"def picked_wrong_color(picked_color)\n color != picked_color\n end",
"def correct_color?(array)\n @correct_colors = array & $code_strings\n end",
"def much_green?(colors) ; colors[1] > 200 ; end",
"def colorize!; @colors = true; end",
"def display_rainbow(colors)\n if (colors.size > 0) \n puts \"R: #{colors[0]}, O: #{colors[1]}, Y: #{colors[2]}, G: #{colors[3]}, B: #{colors[4]}, I: #{colors[5]}, V: #{colors[6]}\"\n end\nend",
"def convert_player_code\n colors = gets.chomp.downcase.strip.gsub(/,/, '').split\n colors.each do |color|\n until @@colors.include?(color)\n puts \"#{color} is not a valid color. Choose from white, black, blue, red, green, or yellow.\"\n color = gets.chomp.downcase.strip\n end\n @@player_key.push(color)\n end\n end",
"def std_colors\n FFI::NCurses.use_default_colors\n # 2018-03-17 - changing it to ncurses defaults\n FFI::NCurses.init_pair(0, FFI::NCurses::BLACK, -1)\n FFI::NCurses.init_pair(1, FFI::NCurses::RED, -1)\n FFI::NCurses.init_pair(2, FFI::NCurses::GREEN, -1)\n FFI::NCurses.init_pair(3, FFI::NCurses::YELLOW, -1)\n FFI::NCurses.init_pair(4, FFI::NCurses::BLUE, -1)\n FFI::NCurses.init_pair(5, FFI::NCurses::MAGENTA, -1)\n FFI::NCurses.init_pair(6, FFI::NCurses::CYAN, -1)\n FFI::NCurses.init_pair(7, FFI::NCurses::WHITE, -1)\n # ideally the rest should be done by application\n #FFI::NCurses.init_pair(8, FFI::NCurses::WHITE, -1)\n #FFI::NCurses.init_pair(9, FFI::NCurses::BLUE, -1)\n FFI::NCurses.init_pair(10, FFI::NCurses::BLACK, FFI::NCurses::CYAN)\n FFI::NCurses.init_pair(12, FFI::NCurses::BLACK, FFI::NCurses::BLUE)\n FFI::NCurses.init_pair(13, FFI::NCurses::BLACK, FFI::NCurses::MAGENTA)\n\n FFI::NCurses.init_pair(14, FFI::NCurses::WHITE, FFI::NCurses::CYAN)\n=begin\n FFI::NCurses.init_pair(8, FFI::NCurses::WHITE, FFI::NCurses::BLUE)\n FFI::NCurses.init_pair(9, FFI::NCurses::BLUE, FFI::NCurses::BLUE)\n FFI::NCurses.init_pair(10, FFI::NCurses::BLACK, FFI::NCurses::GREEN)\n FFI::NCurses.init_pair(11, FFI::NCurses::BLACK, FFI::NCurses::YELLOW)\n FFI::NCurses.init_pair(12, FFI::NCurses::BLACK, FFI::NCurses::BLUE)\n FFI::NCurses.init_pair(13, FFI::NCurses::BLACK, FFI::NCurses::MAGENTA)\n FFI::NCurses.init_pair(14, FFI::NCurses::BLACK, FFI::NCurses::CYAN)\n FFI::NCurses.init_pair(15, FFI::NCurses::BLACK, FFI::NCurses::WHITE)\n=end\n end",
"def check_color(guess)\n count = 0\n guess.upcase.chars.uniq.each do |char| \n if @secret_code.include? char\n count += 1 \n end\n end\n return count \n end",
"def color_identity\n unless @color_identity\n @color_identity = []\n @color_identity << \"W\" if mana_cost =~ /W/i or text =~ /\\{W\\}/ or subtypes.include?(\"Plains\") or color_indicator =~ /\\bWhite\\b/\n @color_identity << \"U\" if mana_cost =~ /U/i or text =~ /\\{U\\}/ or subtypes.include?(\"Island\") or color_indicator =~ /\\bBlue\\b/\n @color_identity << \"B\" if mana_cost =~ /B/i or text =~ /\\{B\\}/ or subtypes.include?(\"Swamp\") or color_indicator =~ /\\bBlack\\b/\n @color_identity << \"R\" if mana_cost =~ /R/i or text =~ /\\{R\\}/ or subtypes.include?(\"Mountain\") or color_indicator =~ /\\bRed\\b/\n @color_identity << \"G\" if mana_cost =~ /G/i or text =~ /\\{G\\}/ or subtypes.include?(\"Forest\") or color_indicator =~ /\\bGreen\\b/\n end\n @color_identity\n end",
"def new_color(data)\n data.strip!\n case data\n when /^y/i\n @use_color = true\n when /^n/i\n @use_color = false\n else\n ask_color\n return\n end\n\n create_new_player\n end",
"def view_log(question)\n prompt = TTY::Prompt.new\n choices = [{\"#{@user_log[0]}\" => 1}, {\"#{@user_log[1]}\" => 2}, {\"#{@user_log[2]}\"=> 3}, {\"Cancel\"=> 4}]\n # choices = [{\"All reads\" => 1}, {\"Current reads\" => 2}, {\"Future reads\" => 3}, {\"Past reads\" => 4}, {\"Cancel\" => 5}]\n list_choice = prompt.select(question, choices)\n if list_choice == 1\n return list_choice\n elsif list_choice == 2\n return list_choice\n elsif list_choice == 3\n return list_choice\n elsif list_choice == 4\n return list_choice\n end\n \nend",
"def code_check(guess)\n @not_guessed = []\n @code_scan = []\n\n 4.times do |i|\n if guess[i] == @code[i]\n @feedback << '|'.white\n @code_scan[i] = nil\n else\n @not_guessed << guess[i]\n @code_scan[i] = @code[i]\n end\n end\n @not_guessed.each do |color|\n @code_scan.each do |code_element|\n next unless code_element == color\n\n @feedback << '|'.red\n color = 'is_somewhere_else'\n @code_element = 'checked'\n end\n end\n end",
"def correct_colors(temp_array)\n temp_player_input = temp_array[1]\n temp_secret_code = temp_array[0]\n temp_player_input.each do |item|\n next unless temp_secret_code.include?(item)\n\n @matches.shift\n @matches << 'white'\n temp_secret_code[temp_secret_code.index(item)] = 'O'\n end\n end",
"def detect_colour_mode\n case ENV['TERM']\n when /-truecolor$/ then 16_777_216\n when /-256color$/, 'xterm' then 256\n when /-color$/, 'rxvt' then 16\n else 256\n end\n end",
"def detect_colour_mode\n case ENV['TERM']\n when /-truecolor$/ then 16_777_216\n when /-256color$/, 'xterm' then 256\n when /-color$/, 'rxvt' then 16\n else 256\n end\n end",
"def color?\n cartas_por_pinta\n @pintas[0][1] == 5\n end",
"def get_user_text_color(user)\n user_color = get_user_color(user).gsub(\"#\", \"\")\n\n # Get the hex color as red, green, blue\n r = user_color[0..1].hex\n g = user_color[2..3].hex\n b = user_color[4..5].hex\n\n if ((r * 0.299) + (g * 0.587) + (b * 0.114)) > 186\n \"#4a4a4a\"\n else\n \"#ffffff\"\n end\n end",
"def firstColorSecondWord()\n\n\tcolor1 = $rng.rand(0..5)\n\tword1 = $rng.rand(6..11)\n\n\tcolor2 = $rng.rand(0..5)\n\tword2 = $rng.rand(6..11)\n\n\tprintJumble(color1,word1)\n\tprintJumble(color2,word2)\n\n\tlineArr = gets.chomp.split\n\n\tif(lineArr[0] == $arr[color1+6] && lineArr[1] == $arr[word2])\n\t\t\treturn 1\n\telse\n\t\t\treturn 0\n\tend\n\nend",
"def determine_color\n colors = {'Red' => 0, 'Green' => 0, 'Yellow' => 0, 'Blue' => 0}\n @hand.each do |card|\n colors[card.suit] += 1\n end\n return colors.key(colors.values.max)\n end",
"def color(*options)\n return '' if mode.zero? || options.empty?\n mix = []\n color_seen = false\n colors = ANSI_COLORS_FOREGROUND\n\n options.each{ |option|\n case option\n when Symbol\n if color = colors[option]\n mix << color\n color_seen = :set\n elsif ANSI_EFFECTS.key?(option)\n mix << effect(option)\n elsif option == :random\n mix << random(color_seen)\n color_seen = :set\n else\n raise ArgumentError, \"Unknown color or effect: #{ option }\"\n end\n\n when Array\n if option.size == 3 && option.all?{ |n| n.is_a? Numeric }\n mix << rgb(*(option + [color_seen])) # 1.8 workaround\n color_seen = :set\n else\n raise ArgumentError, \"Array argument must contain 3 numerals\"\n end\n\n when ::String\n if option =~ /^#?(?:[0-9a-f]{3}){1,2}$/i\n mix << hex(option, color_seen)\n color_seen = :set\n else\n mix << rgb_name(option, color_seen)\n color_seen = :set\n end\n\n when Numeric\n integer = option.to_i\n color_seen = :set if (30..49).include?(integer)\n mix << integer\n\n when nil\n color_seen = :set\n\n else\n raise ArgumentError, \"Invalid argument: #{ option.inspect }\"\n\n end\n\n if color_seen == :set\n colors = ANSI_COLORS_BACKGROUND\n color_seen = true\n end\n }\n\n wrap(*mix)\n end",
"def getFont()\n puts \"Enter font(s) you want\"\n puts \"1) Doom\\n2) Standard\\n3) Star Wars\\n4) Straight\\n\"\n fontMe = gets.chomp.split(\", \")\n (0...fontMe.length()).each do |i|\n fontMe[i] = fontMe[i].to_i\n end\n puts \"Chosen Numbers: #{fontMe}\"\n return fontMe\nend",
"def show_previous_guesses\n puts 'previous guesses: '\n @guess_switch = 1\n @guesses.each do |array|\n guess_as_circle(array.split)\n end\n @colors_as_circles = @colors_as_circles.each_slice(4).to_a\n @colors_as_circles.each do |a, b, c, d|\n print \"#{a} #{b} #{c} #{d}\\n\"\n end\n @guess_switch = 0\n end",
"def computer_code_acquisition\n @code_length.times.map { @colors.sample }\n end",
"def give_hint()\n \n sleep(2)\n puts \"hint...\"\n sleep(1)\n\n correct_colors = []\n correct_place = 0\n\n #count matching colors\n $computer[\"code\"].map { |value| if $player[\"code\"].include?(value)\n if !correct_colors.include?(value)\n correct_colors.push(value) \n end\n end }\n\n #update object\n $computer[\"correct_colors\"] = correct_colors\n\n #report matching colors \n if correct_colors.length() > 0\n puts \"#{correct_colors.length()} of the colors that the computer chose are accurate...\"\n end \n \n #count matching placement of matching colors\n correct_colors.map { |value| $computer[\"code\"].index(value) == $player[\"code\"].index(value) }.map { |value| if value == true\n correct_place += 1\n end}\n\n #update object\n $computer[\"correct_place\"] = correct_place\n\n puts \"... and #{correct_place} in the correct place\" \n \n sleep(3)\n\n end"
] |
[
"0.6934101",
"0.6502392",
"0.6462207",
"0.6407704",
"0.63438225",
"0.6285216",
"0.6257975",
"0.61168754",
"0.6062321",
"0.60447246",
"0.59515584",
"0.59136915",
"0.5904335",
"0.58938307",
"0.58680624",
"0.58318514",
"0.5769378",
"0.5742568",
"0.5686361",
"0.56224257",
"0.56115526",
"0.5609215",
"0.5599651",
"0.5585733",
"0.55669904",
"0.55614483",
"0.5546888",
"0.5544817",
"0.55366665",
"0.5526816",
"0.5521963",
"0.552034",
"0.55186015",
"0.55186015",
"0.5503164",
"0.5495525",
"0.5484472",
"0.54801387",
"0.54671043",
"0.5453749",
"0.5446421",
"0.54433876",
"0.5441639",
"0.543093",
"0.54078954",
"0.5401426",
"0.53902143",
"0.53881884",
"0.5386294",
"0.53824407",
"0.53815097",
"0.53759354",
"0.5374026",
"0.5365735",
"0.5363855",
"0.5363825",
"0.53633446",
"0.5338119",
"0.5335597",
"0.5321954",
"0.5311548",
"0.5303304",
"0.5302513",
"0.52974945",
"0.52949923",
"0.5289606",
"0.52876943",
"0.5287306",
"0.52863485",
"0.52814716",
"0.5277901",
"0.52615637",
"0.5246602",
"0.52429414",
"0.5238486",
"0.52383786",
"0.52310365",
"0.5230104",
"0.52257156",
"0.52227205",
"0.52226526",
"0.52118707",
"0.5200311",
"0.5199835",
"0.51948667",
"0.51928014",
"0.5184084",
"0.5181211",
"0.51809883",
"0.5178844",
"0.5178844",
"0.51745623",
"0.51742816",
"0.5172194",
"0.51700234",
"0.51636386",
"0.51610225",
"0.51609915",
"0.51538396",
"0.5153721"
] |
0.67435735
|
1
|
getOnMe() See: getIsMe(). Its exactly the same as that but it is for the background color of the stirng printed. I'm realising now that I can just call the getisMe() method twice for a statement, but I like the name of this method too much, so I'm keeping it.
|
def getOnMe()
puts "Enter the colors you want the background of the printed strings to be ON (the background)"
puts "1) Red\n2) Green\n3) Yellow\n4) Blue\n5) Magenta\n6) Cyan"
onMeString = gets.chomp.split(", ")
(0...onMeString.length()).each do |i|
onMeString[i] = onMeString[i].to_i
end
puts "Chosen Numbers: #{onMeString}"
return onMeString
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def blue = \"\\e[36m#{self}\\e[0m\"",
"def colorized?; end",
"def isMe(str)\n case $prng1.rand(1..6)\n when 1\n return $pastel.red(str)\n when 2\n return $pastel.green(str)\n when 3\n return $pastel.yellow(str)\n when 4\n return $pastel.blue(str)\n when 5\n return $pastel.magenta(str)\n when 6\n return $pastel.cyan(str)\n end\nend",
"def green; end",
"def green; end",
"def can_be_colored?\n self.user_id.nil?\n end",
"def red; end",
"def red; end",
"def color; end",
"def color; end",
"def color; end",
"def color?\n false\n end",
"def blue; end",
"def blue; end",
"def red\n end",
"def red?\n not black?\n end",
"def color?\n @color\n end",
"def green\n end",
"def color\n @red ? \"R\" : \"B\"\n end",
"def onMe(str)\n case $prng1.rand(1..6)\n when 1\n return $pastel.on_red(str)\n when 2\n return $pastel.on_green(str)\n when 3\n return $pastel.on_yellow(str)\n when 4\n return $pastel.on_blue(str)\n when 5\n return $pastel.on_magenta(str)\n when 6\n return $pastel.on_cyan(str)\n end\nend",
"def color\n @color\nend",
"def color\n @color;\n end",
"def blue\n end",
"def color\n return @color\n end",
"def color\n @color\n end",
"def color\n @color\n end",
"def start?\n @color == @@colors[:green]\n end",
"def context_get_bgcolor()\n return $gimp_iface.gimp_context_get_background()[0]\nend",
"def get_color\n completed? ? 'info' : 'warning'\n end",
"def colorize?\n @colorize\n end",
"def green?\n\t\t@color == 'green'\n\tend",
"def bg_red; use_code(41) end",
"def colors; end",
"def colors\n return\n end",
"def green=(_); end",
"def getDrawColor()\n return @drawColor\n end",
"def color\n\t\treturn @color\n\t\t\n\tend",
"def color?\n tty?\n end",
"def use_color?\n use_color\n end",
"def render_colour\n \"#{colour}#{yield}\"\n end",
"def inspect\n pretty.uncolor\n end",
"def on_49(_) { fg: fg_color(9) } end",
"def in_check?(color)\n end",
"def background(marked_tag, highlight_related_tags: true)\n return '#f00' if self == marked_tag\n return '#ff8c00' if highlight_related_tags && in?(marked_tag.related_tags)\n '#666'\n end",
"def background_color(color); end",
"def print_game_state\n puts \"Players hand is #{@player_hand} Value: #{get_hand_value(@player_hand)}\".colorize(:light_blue)\n puts \"Dealer hand is #{@dealer_hand} Value: #{get_hand_value(@dealer_hand)}\".colorize(:light_blue)\nend",
"def color?\n !@color.nil?\n end",
"def log_versus_and\n \"blue\"\n end",
"def red?\n @color == :red\n end",
"def bgcolor\n @bgcolor || $def_bg_color\n end",
"def color?\n cartas_por_pinta\n @pintas[0][1] == 5\n end",
"def usecolor\n return @usecolor if defined? @usecolor\n if @cmdobj.settings.has_key? 'nocolor' then @usecolor = false\n elsif @cmdobj.settings.has_key? 'mailto' then @usecolor = false\n elsif not @colorok then @usecolor = false\n else @usecolor = $stdout.tty?\n end\n #debug \"Use color? #{@usecolor}\"\n return @usecolor\n end",
"def bgColor\n return @bg_color\n end",
"def bg_dark_grey; use_code(100) end",
"def red\n colorize(:red)\nend",
"def open?\n @color == @@colors[:cyan]\n end",
"def color?\n if color == :auto\n return $stdout.tty?\n end\n\n # ensure true on misconfigured value\n return color != :never\n end",
"def blue=(_); end",
"def is_highlight?\n contexts.flag6 == 1\n end",
"def color\n @color || $def_fg_color\n end",
"def no_ap # Switch awesome_print off\n #IRB::Irb.class_eval do\n # def output_value\n # printf @context.return_format, @context.inspect_last_value\n # end\n #end\n\n #set_wirble_color\n #puts 'awesome_print: OFF'.red\n #puts 'wirble colors: ON'.green\nend",
"def white?\n color == \"white\"\n end",
"def color\n return @color\n end",
"def color\n return @color\n end",
"def white; return self.trays[Hive::Color[:white]]; end",
"def style; end",
"def style; end",
"def style; end",
"def background(bgcolor)\n names_to_code(\"on_\" + bgcolor)\n end",
"def highlight!\r\n highlights_on proc { true }\r\n end",
"def color_to_use\n return :no_bg_color if value == :none\n value =~ /^on_/ ? value : \"on_#{value}\".to_sym\n end",
"def has_eye_color?(person, color)\n # Your code here\nend",
"def in_danger?; @in_danger; end",
"def dark; end",
"def dark; end",
"def open_background_color_span\n \"<span style=\\\"background-color:##{self.html_color};\\\">\"\n end",
"def highlighter; end",
"def highlighter; end",
"def say(something, color = nil)\n if interactive?\n h = interaction_highline\n color.nil? ? h.say(something) : h.say(h.color(something, color))\n end\n end",
"def bleu_gras\n \"\\033[1;96m#{self}\\033[0m\"\n end",
"def name_color\n # HACK(pwnall): come up with better colors\n user.key == @room.user1.key ? 'red' : 'blue'\n end",
"def textColor\n return @text_color\n end",
"def background; end",
"def yellow\n puts \" yellow\".yellow\n puts\n print \"red\"\n puts \" blue\"\n puts\n puts \" green\"\n puts\n end",
"def background_color\n return @peer.background_color\n end",
"def crisis_color\n return text_color(17)\n end",
"def show\n @bg_gray = true\n\n end",
"def eye_color\n @eye_color\n end",
"def eye_color\n @eye_color\n end",
"def awesome_self(object, type)\n if @options[:raw] && object.instance_variables.any?\n awesome_object(object)\n else\n colorize(object.inspect.to_s, type)\n end\n end",
"def white\n find color: :white\n end",
"def bold; \"\\e[1m#{self}\\e[22m\" end",
"def see_color(str)\n return 'red' if str.start_with?('red')\n return 'blue' if str.start_with?('blue')\n\n ''\n end",
"def green\n\t\tlight COLOR_KEY_GREEN\n\tend",
"def bright; end",
"def bright; end",
"def inqtextcolorind\n inquiry_int { |pt| super(pt) }\n end",
"def inqtextcolorind\n inquiry_int { |pt| super(pt) }\n end",
"def get_color\n @color\n end",
"def start_style(name)\n case name\n when \"negative\"\n \"<span style=\\\"color: white; background-color: black\\\">\"\n when /on_(\\w+)/\n colval = color_value($1)\n \"<span style=\\\"background-color: #{colval}\\\">\"\n else\n colval = color_value(name)\n \"<span style=\\\"color: #{colval}\\\">\"\n end\n end",
"def color(color); end"
] |
[
"0.610704",
"0.6044335",
"0.60258615",
"0.6012948",
"0.6012948",
"0.5934339",
"0.5932155",
"0.5932155",
"0.5895948",
"0.5895948",
"0.5895948",
"0.5815126",
"0.576262",
"0.576262",
"0.5751427",
"0.5732536",
"0.5730394",
"0.57264024",
"0.56779146",
"0.5668724",
"0.56199825",
"0.55932176",
"0.5590188",
"0.55858517",
"0.5582904",
"0.5582904",
"0.5578892",
"0.5577041",
"0.55400985",
"0.5538141",
"0.5537064",
"0.55279255",
"0.55071443",
"0.5471275",
"0.54579973",
"0.5456255",
"0.5427506",
"0.5425184",
"0.54166645",
"0.540488",
"0.53874075",
"0.5385948",
"0.537158",
"0.5365274",
"0.5356729",
"0.53537977",
"0.53536624",
"0.53388417",
"0.5330853",
"0.53148854",
"0.52936316",
"0.52838975",
"0.5276505",
"0.52598876",
"0.52355856",
"0.52274805",
"0.52153045",
"0.52121747",
"0.52119106",
"0.5205673",
"0.52047986",
"0.5203103",
"0.5198989",
"0.5198989",
"0.51977414",
"0.51919305",
"0.51919305",
"0.51919305",
"0.5181957",
"0.5180465",
"0.5170565",
"0.5169999",
"0.51671004",
"0.51651275",
"0.51651275",
"0.5159514",
"0.51449794",
"0.51449794",
"0.5119486",
"0.51171434",
"0.5117006",
"0.5115052",
"0.5111055",
"0.5109269",
"0.5107637",
"0.5103957",
"0.5102937",
"0.510117",
"0.510117",
"0.5098766",
"0.50946057",
"0.5093592",
"0.5088149",
"0.50814444",
"0.50794125",
"0.50794125",
"0.50717074",
"0.50717074",
"0.50685924",
"0.50642693",
"0.5053132"
] |
0.0
|
-1
|
getFont() See: getIsMe(). Its exactly the same as that except this is for the FONT of the printed strings. This will eventually be passed into a method that calls those font(s) the user picked.
|
def getFont()
puts "Enter font(s) you want"
puts "1) Doom\n2) Standard\n3) Star Wars\n4) Straight\n"
fontMe = gets.chomp.split(", ")
(0...fontMe.length()).each do |i|
fontMe[i] = fontMe[i].to_i
end
puts "Chosen Numbers: #{fontMe}"
return fontMe
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def font\n return @font\n end",
"def font\n\t\treturn @font\n\tend",
"def fontName\n return @font_name\n end",
"def font\n @font_path\n end",
"def font(name=nil, size=nil, options={})\n cur_page.font(name, size, options)\n end",
"def font=(value)\n @font = value\n end",
"def font(name)\n primitive \"font \\'#{name}\\'\"\n end",
"def info_font(*args)\n @p.info_font(self, *args)\n end",
"def setfont(*args)\n @p.setfont(self, *args)\n end",
"def default_font; \"example.font\"; end",
"def font_style(style=nil)\n cur_page.font_style(style)\n end",
"def font_setup\n %Q(font \"#{@font},#{@fontsize}\")\n end",
"def default_font_name()\n end",
"def SetFont(family, style='', size=0)\n\t\t# save previous values\n\t\t@prevfont_family = @font_family;\n\t\t@prevfont_style = @font_style;\n\n\t\tfamily=family.downcase;\n\t\tif (family=='')\n\t\t\tfamily=@font_family;\n\t\tend\n\t\tif ((!@is_unicode) and (family == 'arial'))\n\t\t\tfamily = 'helvetica';\n\t\telsif ((family==\"symbol\") or (family==\"zapfdingbats\"))\n\t\t\tstyle='';\n\t\tend\n\t\t\n\t\tstyle=style.upcase;\n\n\t\tif (style.include?('U'))\n\t\t\t@underline=true;\n\t\t\tstyle= style.gsub('U','');\n\t\telse\n\t\t\t@underline=false;\n\t\tend\n\t\tif (style.include?('D'))\n\t\t\t@deleted=true;\n\t\t\tstyle= style.gsub('D','');\n\t\telse\n\t\t\t@deleted=false;\n\t\tend\n\t\tif (style=='IB')\n\t\t\tstyle='BI';\n\t\tend\n\t\tif (size==0)\n\t\t\tsize=@font_size_pt;\n\t\tend\n\n\t\t# try to add font (if not already added)\n\t\tAddFont(family, style);\n\t\t\n\t\t#Test if font is already selected\n\t\tif ((@font_family == family) and (@font_style == style) and (@font_size_pt == size))\n\t\t\treturn;\n\t\tend\n\t\t\n\t\tfontkey = family + style;\n\t\tstyle = '' if (@fonts[fontkey].nil? and !@fonts[family].nil?)\n \n\t\t#Test if used for the first time\n\t\tif (@fonts[fontkey].nil?)\n\t\t\t#Check if one of the standard fonts\n\t\t\tif (!@core_fonts[fontkey].nil?)\n\t\t\t\tif @@fpdf_charwidths[fontkey].nil?\n\t\t\t\t\t#Load metric file\n\t\t\t\t\tfile = family;\n\t\t\t\t\tif ((family!='symbol') and (family!='zapfdingbats'))\n\t\t\t\t\t\tfile += style.downcase;\n\t\t\t\t\tend\n\t\t\t\t\tif (getfontpath(file + '.rb').nil?)\n\t\t\t\t\t\t# try to load the basic file without styles\n\t\t\t\t\t\tfile = family;\n\t\t\t\t\t\tfontkey = family;\n\t\t\t\t\tend\n\t\t\t\t\trequire(getfontpath(file + '.rb'));\n \t\tfont_desc = TCPDFFontDescriptor.font(file)\n\t\t\t\t\tif ((@is_unicode and ctg.nil?) or ((!@is_unicode) and (@@fpdf_charwidths[fontkey].nil?)) )\n\t\t\t\t\t\tError(\"Could not include font metric file [\" + fontkey + \"]: \" + getfontpath(file + \".rb\"));\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\ti = @fonts.length + 1;\n\n\t\t\t\tif (@is_unicode)\n\t\t\t\t\t@fonts[fontkey] = {'i' => i, 'type' => font_desc[:type], 'name' => font_desc[:name], 'desc' => font_desc[:desc], 'up' => font_desc[:up], 'ut' => font_desc[:ut], 'cw' => font_desc[:cw], 'enc' => font_desc[:enc], 'file' => font_desc[:file], 'ctg' => font_desc[:ctg]}\n\t\t\t\t\t@@fpdf_charwidths[fontkey] = font_desc[:cw];\n\t\t\t\telse\n\t\t\t\t\t@fonts[fontkey] = {'i' => i, 'type'=>'core', 'name'=>@core_fonts[fontkey], 'up'=>-100, 'ut'=>50, 'cw' => font_desc[:cw]}\n\t\t\t\t\t@@fpdf_charwidths[fontkey] = font_desc[:cw];\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tError('Undefined font: ' + family + ' ' + style);\n\t\t\tend\n\t\tend\n\t\t#Select it\n\t\t@font_family = family;\n\t\t@font_style = style;\n\t\t@font_size_pt = size;\n\t\t@font_size = size / @k;\n\t\t@current_font = @fonts[fontkey]; # was & may need deep copy?\n\t\tif (@page>0)\n\t\t\tout(sprintf('BT /F%d %.2f Tf ET', @current_font['i'], @font_size_pt));\n\t\tend\n\tend",
"def load_font(family, height)\n end",
"def font_name()\n validate_worksheet\n @workbook.fonts[font_id()][:font][:name][:attributes][:val]\n end",
"def returnFont(str)\n case $prng1.rand(1..5)\n# when 1\n# $fontFont = TTY::Font.new(\"3d\")\n# return $fontFont.write(str)\n when 2\n $fontFont = TTY::Font.new(:doom)\n return $fontFont.write(str)\n when 3\n $fontFont = TTY::Font.new(:standard)\n return $fontFont.write(str)\n when 4\n $fontFont = TTY::Font.new(:starwars)\n return $fontFont.write(str)\n when 5\n $fontFont = TTY::Font.new(:straight)\n return $fontFont.write(str)\n else\n $fontFont = TTY::Font.new(:standard)\n return $fontFont.write(str)\n end\nend",
"def loadfont(str)\n inquiry_int do |font|\n super(str, font)\n end\n end",
"def current_font!\n select_font(\"Helvetica\") unless @current_base_font\n\n font = File.basename(@current_base_font)\n if @font_families[font] and @font_families[font][@current_text_state]\n # Then we are in some state or another and this font has a family,\n # and the current setting exists within it select the font, then\n # return it.\n if File.dirname(@current_base_font) != '.'\n nf = File.join(File.dirname(@current_base_font), @font_families[font][@current_text_state])\n else\n nf = @font_families[font][@current_text_state]\n end\n\n unless @fonts[nf]\n enc = {\n :encoding => @fonts[font].encoding,\n :differences => @fonts[font].differences\n }\n load_font(nf, enc)\n end\n @current_font = nf\n else\n @current_font = @current_base_font\n end\n end",
"def type1_font_names\n if @options[:built_in_fonts]\n PdfK::FONT_NAMES\n else\n AFM::font_names\n end\n end",
"def get_font(name = :Helvetica)\n initiate_library\n font = FONTS_LIBRARY[name]\n return nil unless font\n font = font.dup\n font[:referenced_object] = font[:referenced_object].dup if font[:referenced_object]\n font\n end",
"def select_typography\n\t\tputs \"To Helvetica, or not to Helvetica?\"\n\tend",
"def font(height, font_name=Gosu::default_font_name)\n @used_fonts ||= {}\n key = [font_name, height]\n if @used_fonts.include? key\n @font = @used_fonts[key]\n else\n @font = @used_fonts[key] = Gosu::Font.new(self, font_name, height)\n end\n end",
"def _font_family(id)\n {\n 0x00 => :'Not applicable',\n 0x01 => :Roman,\n 0x02 => :Swiss,\n 0x03 => :Modern,\n 0x04 => :Script,\n 0x05 => :Decorative\n }[id]\n end",
"def font(name=\"Helvetica\", size=nil)\n fontsize(size) if size\n @fname = name\n fontsize unless @fsize\n CGContextSelectFont(@ctx, @fname, @fsize, KCGEncodingMacRoman)\n end",
"def pbSmallFontName\n return MessageConfig.pbTryFonts(\"Power Green Small With BLD\",\"Pokemon Emerald Small With BLD\",\n \"Arial Narrow\",\"Arial\")\nend",
"def default_font_name\n (options[:default] and options[:default][:name]) ? options[:default][:name] : Gosu::default_font_name\n end",
"def process_text_options(options)\n if options[:style]\n raise 'Bad font family' unless font.family\n font(font.family, style: options[:style])\n end\n\n # must compare against false to keep kerning on as default\n unless options[:kerning] == false\n options[:kerning] = font.has_kerning_data?\n end\n\n options[:size] ||= font_size\n end",
"def font_encoding(encoding=nil)\n cur_page.font_encoding(encoding)\n end",
"def name\n read_attribute(:font_name)\n end",
"def font_for(filename,size=16)\n tuple = [filename, size]\n if @fonts.has_key?(tuple)\n return @fonts[tuple]\n else\n fullpath = path_for(filename)\n return nil unless fullpath\n ext = File.extname(filename)\n result = nil\n case(ext.downcase)\n when \".ttf\"\n result = Rubygame::TTF.new(fullpath,size)\n when \".png\"\n result = Rubygame::SFont.new(fullpath)\n end\n @fonts[tuple] = result\n end\n return result\n end",
"def font(row, col, sheet = nil)\n sheet ||= @default_sheet\n read_cells(sheet)\n\n @fonts[sheet][normalize(row,col).to_a]\n end",
"def find_font_for_this_glyph char, current_font, current_font_opts = {}, fallback_fonts_to_check = [], original_font = current_font\n (doc = @document).font current_font, current_font_opts\n if doc.font.glyph_present? char\n current_font\n elsif fallback_fonts_to_check.empty?\n if logger.info? && !doc.scratch?\n fonts_checked = [original_font].concat @fallback_fonts\n missing_chars = (doc.instance_variable_defined? :@missing_chars) ?\n (doc.instance_variable_get :@missing_chars) : (doc.instance_variable_set :@missing_chars, {})\n previous_fonts_checked = (missing_chars[char] ||= [])\n if previous_fonts_checked.empty? && !(previous_fonts_checked.include? fonts_checked)\n logger.warn %(Could not locate the character `#{char}' (#{char.unpack('U*').map {|it| \"\\\\u#{(it.to_s 16).rjust 4, '0'}\" }.join}) in the following fonts: #{fonts_checked.join ', '})\n previous_fonts_checked << fonts_checked\n end\n end\n original_font\n else\n find_font_for_this_glyph char, fallback_fonts_to_check.shift, current_font_opts, fallback_fonts_to_check, original_font\n end\n end",
"def is_fonts?(); @type == GRT_FONTS; end",
"def interpret(ps)\n raise Error unless ps.fonts.has_key?(@index)\n ps.font = ps.fonts[@index]\n end",
"def font(row, col, sheet = nil)\n sheet ||= default_sheet\n read_cells(sheet)\n row, col = normalize(row, col)\n style_name = @style[sheet][[row, col]] || @style_defaults[sheet][col - 1] || 'Default'\n @font_style_definitions[style_name]\n end",
"def convert_font_args(params)\n return unless params\n font = {\n :_name => params[:name],\n :_color => params[:color],\n :_size => params[:size],\n :_bold => params[:bold],\n :_italic => params[:italic],\n :_underline => params[:underline],\n :_pitch_family => params[:pitch_family],\n :_charset => params[:charset],\n :_baseline => params[:baseline] || 0\n }\n\n # Convert font size units.\n font[:_size] *= 100 if font[:_size] && font[:_size] != 0\n\n font\n end",
"def get_original_font(name = :Helvetica)\n initiate_library\n FONTS_LIBRARY[name]\n end",
"def load_fonts\n\n # Load fonts.\n self.load_single_font('Across The Road')\n self.load_single_font('Alabama')\n self.load_single_font('Arial')\n self.load_single_font('Arial Narrow')\n self.load_single_font('Arty Signature')\n self.load_single_font('Asem Kandis')\n self.load_single_font('Autograf')\n self.load_single_font('Born Ready')\n self.load_single_font('Brittany Signature')\n self.load_single_font('Bulgatti')\n self.load_single_font('Courier New')\n self.load_single_font('Estelly')\n self.load_single_font('Friday Vibes')\n self.load_single_font('From Skyler')\n self.load_single_font('Gallatone')\n self.load_single_font('Halimun')\n self.load_single_font('Hello Santtiny')\n self.load_single_font('Just Realize')\n self.load_single_font('Just Signature')\n self.load_single_font('Mayestica')\n self.load_single_font('Menlo')\n self.load_single_font('Notera')\n self.load_single_font('Prestige Signature')\n self.load_single_font('Reinata')\n self.load_single_font('Santos Dumont')\n self.load_single_font('SF Mono')\n self.load_single_font('Shopping List')\n self.load_single_font('Signatures')\n self.load_single_font('Signerica')\n self.load_single_font('Silver Pen')\n self.load_single_font('Sophistica')\n self.load_single_font('Source Code Pro')\n self.load_single_font('Southampton')\n self.load_single_font('Thankfully')\n self.load_single_font('The Jacklyn')\n self.load_single_font('Tomatoes')\n self.load_single_font('Wanted Signature')\n self.load_single_font('White Angelica')\n self.load_single_font('Whitney')\n self.load_single_font('Whitney Bold')\n self.load_single_font('Whitney Index Rounded')\n self.load_single_font('Whitney Index Squared')\n self.load_single_font('Xtreem')\n self.load_single_font('Gotham Condensed')\n\n end",
"def init_font(font)\n @font=font\n dc = Wx::WindowDC.new(self)\n dc.set_font(font)\n @asc_width, asc_h = dc.get_text_extent(\"@\")[0,2]\n @asc_width+2 # compact, but not too much so\n @hex_width, hex_h = dc.get_text_extent(\"@@\")[0,2]\n @txt_height = (hex_h > asc_h)? hex_h : asc_h\n @addr_width = dc.get_text_extent(@data.size.to_s(16).rjust(4,'@'))[0]\n @row_height = @txt_height\n\n update_dimensions() if @started\n end",
"def coordinate_labels_font_family\n if self.options[:font_family].blank?\n 'Helvetica Neue'\n else\n self.options[:font_family]\n end\n end",
"def AddFont(family, style='', file='')\n\t\tif (family.empty?)\n\t\t\treturn;\n\t\tend\n\n\t\t#Add a TrueType or Type1 font\n\t\tfamily = family.downcase\n\t\tif ((!@is_unicode) and (family == 'arial'))\n\t\t\tfamily = 'helvetica';\n\t\tend\n\n\t\tstyle=style.upcase\n\t\tstyle=style.gsub('U','');\n\t\tstyle=style.gsub('D','');\n\t\tif (style == 'IB')\n\t\t\tstyle = 'BI';\n\t\tend\n\n\t\tfontkey = family + style;\n\t\t# check if the font has been already added\n\t\tif !@fonts[fontkey].nil?\n\t\t\treturn;\n\t\tend\n\n\t\tif (file=='')\n\t\t\tfile = family.gsub(' ', '') + style.downcase + '.rb';\n\t\tend\n\t\tfont_file_name = getfontpath(file)\n\t\tif (font_file_name.nil?)\n\t\t\t# try to load the basic file without styles\n\t\t\tfile = family.gsub(' ', '') + '.rb';\n \t\tfont_file_name = getfontpath(file)\n\t\tend\n if font_file_name.nil?\n\t\t\tError(\"Could not find font #{file}.\")\n end\n\t\trequire(getfontpath(file))\n\t\tfont_desc = TCPDFFontDescriptor.font(file)\n\n\t\tif (font_desc[:name].nil? and @@fpdf_charwidths.nil?)\n\t\t\tError('Could not include font definition file');\n\t\tend\n\n\t\ti = @fonts.length+1;\n\t\tif (@is_unicode)\n\t\t\t@fonts[fontkey] = {'i' => i, 'type' => font_desc[:type], 'name' => font_desc[:name], 'desc' => font_desc[:desc], 'up' => font_desc[:up], 'ut' => font_desc[:ut], 'cw' => font_desc[:cw], 'enc' => font_desc[:enc], 'file' => font_desc[:file], 'ctg' => font_desc[:ctg], 'cMap' => font_desc[:cMap], 'registry' => font_desc[:registry]}\n\t\t\t@@fpdf_charwidths[fontkey] = font_desc[:cw];\n\t\telse\n\t\t\t@fonts[fontkey]={'i' => i, 'type'=>'core', 'name'=>@core_fonts[fontkey], 'up'=>-100, 'ut'=>50, 'cw' => font_desc[:cw]}\n\t\t\t@@fpdf_charwidths[fontkey] = font_desc[:cw];\n\t\tend\n\n\t\tif (!font_desc[:diff].nil? and (!font_desc[:diff].empty?))\n\t\t\t#Search existing encodings\n\t\t\td=0;\n\t\t\tnb=@diffs.length;\n\t\t\t1.upto(nb) do |i|\n\t\t\t\tif (@diffs[i]== font_desc[:diff])\n\t\t\t\t\td = i;\n\t\t\t\t\tbreak;\n\t\t\t\tend\n\t\t\tend\n\t\t\tif (d==0)\n\t\t\t\td = nb+1;\n\t\t\t\t@diffs[d] = font_desc[:diff];\n\t\t\tend\n\t\t\t@fonts[fontkey]['diff'] = d;\n\t\tend\n\t\tif (font_desc[:file] and font_desc[:file].length > 0)\n\t\t\tif (font_desc[:type] == \"TrueType\") or (font_desc[:type] == \"TrueTypeUnicode\")\n\t\t\t\t@font_files[font_desc[:file]] = {'length1' => font_desc[:originalsize]}\n\t\t\telse\n\t\t\t\t@font_files[font_desc[:file]] = {'length1' => font_desc[:size1], 'length2' => font_desc[:size2]}\n\t\t\tend\n\t\tend\n\tend",
"def set_font\n font_families.update(\n 'HealthQuestPDF' => {\n normal: HealthQuest::Engine.root.join('lib', 'fonts', 'sourcesanspro-regular-webfont.ttf'),\n medium: HealthQuest::Engine.root.join('lib', 'fonts', 'sourcesanspro-bold-webfont.ttf'),\n bold: HealthQuest::Engine.root.join('lib', 'fonts', 'bitter-bold.ttf')\n }\n )\n font 'HealthQuestPDF'\n end",
"def initialize_fonts(application)\r\n\t[12, 14, 16, 18, 24].each() do |size|\r\n\t\tFONT[\"Courier #{size}\"] = FXFont.new(application, 'Courier New', size)\r\n\t\tFONT[\"Helvetica #{size}\"] = FXFont.new(application, 'Helvetica', size)\r\n\tend\r\n\t\r\n\tFONT['Courier 24 bold'] = FXFont.new(application, 'Courier New', 24, FXFont::Bold)\r\nend",
"def font_style(style)\n f = font\n if block_given?\n font(f.name, size: font_size, style: style) do\n yield\n end\n else\n font(f.name, size: font_size, style: style)\n end\n end",
"def set_font(font_name)\n itr = @form.getFields.keySet.iterator\n while itr.hasNext\n field = itr.next\n @form.setFieldProperty(field, 'textfont', create_font(font_name), nil)\n end\n end",
"def set_font(font_name)\n itr = @form.getFields.keySet.iterator\n while itr.hasNext\n field = itr.next\n @form.setFieldProperty(field, 'textfont', create_font(font_name), nil)\n end\n end",
"def settextfontprec(*)\n super\n end",
"def default_signature_font(person)\n\n # Build hash.\n people = {\n chris_terry: \"Arty Signature\",\n toby_varland: \"Gallatone\",\n tim_hudson: \"Hello Santtiny\",\n greg_turner: \"Hello Santtiny\",\n john_mcguire: \"Xtreem\",\n kevin_marsh: \"Autograf\",\n art_mink: \"Notera\",\n rob_caudill: \"Hello Santtiny\",\n mike_mitchell: \"Hello Santtiny\",\n terry_marshall: \"Hello Santtiny\",\n ross_varland: \"Wanted Signature\"\n }\n\n # Return font.\n return people.fetch(person, \"Hello Santtiny\")\n\n end",
"def font_descender(size = nil)\n size = @font_size if size.nil? or size <= 0\n\n select_font(\"Helvetica\") if @fonts.empty?\n hi = @fonts[@current_font].fontbbox[1].to_f\n (size * hi / 1000.0)\n end",
"def pbNarrowFontName\n return MessageConfig.pbTryFonts(\"Power Green Narrow With BLD\",\"Pokemon Emerald Narrow With BLD\",\n \"Arial Narrow\",\"Arial\")\nend",
"def set_font(face, size)\n @curr_font = Gauges::FontRef.get(face, size)\n end",
"def set_user_font model\n model.unread?(@user) ? 'font-bold' : '' rescue ''\n end",
"def family\n @family ||= family_options.map do |font_name, font_options|\n name = parse_font_name(font_name)\n\n options = font_options.sort.uniq\n\n options.any? ? \"#{name}:#{options.join(',')}\" : name\n end.join('|')\n end",
"def ctrlSetFont _obj, _args\n \"_obj ctrlSetFont _args;\" \n end",
"def quoted_fonts\n quoted_fonts = @font_family.map do |font|\n if font.include?(' ') && font[0] != \"'\"\n \"'#{font}'\"\n else\n font\n end\n end\n\n quoted_fonts.join(', ')\n end",
"def font_size\r\n @style.font_size || @default_font_size\r\n end",
"def pbSetSystemFont(bitmap)\n fontname=MessageConfig.pbGetSystemFontName\n bitmap.font.name=fontname\n if fontname==\"Pokemon FireLeaf With BLD\" || fontname==\"Power Red and Green With BLD\"\n bitmap.font.size=29\n elsif fontname==\"Pokemon Emerald Small With BLD\" || fontname==\"Power Green Small With BLD\"\n bitmap.font.size=25\n else\n bitmap.font.size=31\n end\nend",
"def font=(font)\n @label.font = font\n end",
"def parse_font_options(options = {})\n return if (options.keys & [:fg_color, :sz, :b, :i, :u, :strike, :outline, :shadow, :charset, :family, :font_name]).empty?\n\n Axlsx.instance_values_for(fonts.first).each do |key, value|\n # Thanks for that 1.8.7 - cant do a simple merge...\n options[key.to_sym] = value unless options.key?(key.to_sym)\n end\n font = Font.new(options)\n font.color = Color.new(rgb: options[:fg_color]) if options[:fg_color]\n font.name = options[:font_name] if options[:font_name]\n options[:type] == :dxf ? font : fonts << font\n end",
"def font_size()\n validate_worksheet\n return @workbook.fonts[font_id()][:font][:sz][:attributes][:val]\n end",
"def monospace_fonts\n @monospace_fonts ||= FONTS.select do |name|\n re = Regexp.new(name.gsub(' ', ' ?'), 'i')\n available_fonts.grep(re).any?\n end\n end",
"def path_to_font(source, options = T.unsafe(nil)); end",
"def new_font(*args)\n font = Font.new\n return font_config_abs(font, *args)\n end",
"def font_path(source, options = T.unsafe(nil)); end",
"def font=(f)\n\t\traise 'Font must respond to char_bitmap' if !f.nil? && !f.respond_to?(:char_bitmap)\n\t\t@font = f\n\tend",
"def font(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 s_attribute = @s_attribute[sheet][[row,col]]\n s_attribute ||= 0\n s_attribute = s_attribute.to_i\n @style_definitions[s_attribute]\n end",
"def ask_which_font(font_links)\n font_links.each_with_index { |x,i|\n puts \"#{i + 1}: #{x.href}\"\n }\n font_index = ask \"Which one do you want? [1-#{font_links.length}] :\"\n font_links[font_index.to_i - 1] \n end",
"def font=(font_path)\n @title_font.path = font_path unless @title_font.path\n @marker_font.path = font_path\n @legend_font.path = font_path\n end",
"def find_or_initialize_font(name, opts = {})\n # Find already initialized font.\n font_key = ::Dopp::Font::STORE.font_key(name, opts)\n return @fonts[font_key] if @fonts.key?(font_key)\n\n # Initialize font.\n builder = ::Dopp::Font::STORE.font_builder(name)\n font = builder.new(self, opts).build\n @sections += font.sections\n # Register font.\n @fonts[font_key] = font\n font.names.each do |font_name|\n key = ::Dopp::Font::STORE.font_key(font_name, opts)\n @fonts[key] = font\n end\n font\n end",
"def change_font_decor\n #If toggled to on, font is bold, otherwise not bold.\n # Best case here is to use NSAttributedString\n if @switch_font.on? == true\n @font_label.font = UIFont.fontWithName(\"#{@font_label.text}-Bold\",size:@font_size)\n else\n @font_label.font = UIFont.fontWithName(\"#{@font_label.text}\",size:@font_size)\n end\n end",
"def load_font(name, size)\n config = Gamebox.configuration\n fonts_path = config.fonts_path\n gb_fonts_path = config.gb_fonts_path\n @loaded_fonts[name] ||= {}\n return @loaded_fonts[name][size] if @loaded_fonts[name][size]\n begin\n if name =~ /^\\// and File.exists?(name)\n font = Font.new(@window, name, size)\n @loaded_fonts[name][size] = font\n else\n full_name = fonts_path + name\n if File.exist? full_name\n font = Font.new(@window, full_name, size)\n @loaded_fonts[name][size] = font\n else\n full_name = gb_fonts_path + name\n font = Font.new(@window, full_name, size)\n @loaded_fonts[name][size] = font\n end\n end\n return font\n rescue Exception => ex\n log \"Cannot load font #{full_name}:#{ex}\"\n end\n return nil\n end",
"def load_font(name, size)\n @loaded_fonts[name] ||= {}\n return @loaded_fonts[name][size] if @loaded_fonts[name][size]\n begin\n #full_name = File.expand_path(FONTS_PATH + name)\n full_name = FONTS_PATH + name\n if File.exist? full_name\n font = Font.new(@window, full_name, size)\n @loaded_fonts[name][size] = font\n else\n #full_name = File.expand_path(GAMEBOX_FONTS_PATH + name)\n full_name = GAMEBOX_FONTS_PATH + name\n font = Font.new(@window, full_name, size)\n @loaded_fonts[name][size] = font\n end\n return font\n rescue Exception => ex\n puts \"Cannot load font #{full_name}:#{ex}\"\n end\n return nil\n end",
"def font idx\n @fonts[idx]\n end",
"def font=(font)\n set_font(font)\n generate_buffers\n end",
"def display_text\n\t\t\t#specifying font to be used\n\t\t\t#text_font @font, 16\n\t\t\t#text \"Mmmmm ... Strings .... \", 10, 100\n\t\tend",
"def prepare_fonts # :nodoc:\n fonts = {}\n\n @xf_formats.each { |format| format.set_font_info(fonts) }\n\n @font_count = fonts.size\n\n # For the DXF formats we only need to check if the properties have changed.\n @dxf_formats.each do |format|\n # The only font properties that can change for a DXF format are: color,\n # bold, italic, underline and strikethrough.\n format.has_dxf_font(true) if format.color? || format.bold? || format.italic? || format.underline? || format.strikeout?\n end\n end",
"def userinterfacefont=(userInterfaceFont)\n @elementHash[:userinterfacefont] = userInterfaceFont\n @elementHash.delete(:postscriptfontname)\n end",
"def font_size\n return sz if sz\n\n font = styles.fonts[styles.cellXfs[style].fontId] || styles.fonts[0]\n font.b || (defined?(@b) && @b) ? (font.sz * 1.5) : font.sz\n end",
"def font_size\n return sz if sz\n\n font = styles.fonts[styles.cellXfs[style].fontId] || styles.fonts[0]\n font.b || (defined?(@b) && @b) ? (font.sz * row.worksheet.workbook.bold_font_multiplier) : font.sz\n end",
"def font(id, size, global = true, ext = '.ttf')\n a = global ? @global_fonts : @fonts\n id_size = \"#{id}_#{size}\"\n return a[id_size] if a[id_size]\n s = @prefix + @font_dir + id.to_s.split(@separator).join('/') + ext\n font = Gosu::Font.new size, name: s\n a[id_size] = font\n end",
"def ctrlSetFontP _obj, _args\n \"_obj ctrlSetFontP _args;\" \n end",
"def load_fonts\n @@fonts[\"game\"] = Gosu::Font.new(80)\n @@fonts[\"menu\"] = Gosu::Font.new(40)\n @@fonts[\"notification\"] = Gosu::Font.new(25)\n @@fonts[\"big\"] = Gosu::Font.new(20)\n @@fonts[\"small\"] = Gosu::Font.new(14)\n @@fonts[\"button\"] = Gosu::Font.new(15)\n end",
"def ctrlSetFontPB _obj, _args\n \"_obj ctrlSetFontPB _args;\" \n end",
"def ctrlSetFontH6 _obj, _args\n \"_obj ctrlSetFontH6 _args;\" \n end",
"def font_size(size=nil)\n cur_page.font_size(size)\n end",
"def load_single_font(name)\n\n # Determine path to font file.\n font_file_name = name.gsub(/\\s+/, \"\")\n path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}.ttf\")\n return unless File.file?(path)\n\n # Determine variants.\n italics_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-Italic.ttf\")\n bold_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-Bold.ttf\")\n bold_italics_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-BoldItalic.ttf\")\n\n # Build hash of variants.\n font_hash = { normal: path }\n font_hash[:italic] = italics_path if File.file?(italics_path)\n font_hash[:bold] = bold_path if File.file?(bold_path)\n font_hash[:bold_italic] = bold_italics_path if File.file?(bold_italics_path)\n\n # Add font.\n self.font_families.update(name => font_hash)\n\n end",
"def set_text(font, size)\n\t \t@pdf.setfont(font, size)\n\t end",
"def ctrlSetFontH2 _obj, _args\n \"_obj ctrlSetFontH2 _args;\" \n end",
"def another_print_fonts\n for index in 0..@fonts.size do\n puts \"#{index} -> #{@fonts[index]}\" # use of templating\n end\nend",
"def ctrlSetFontH6B _obj, _args\n \"_obj ctrlSetFontH6B _args;\" \n end",
"def font_size\n @font_size ||= [cell_height, cell_width].sort.shift * 0.8\n end",
"def load_single_font(name)\n \n # Determine path to font file.\n font_file_name = name.gsub(/\\s+/, \"\")\n path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}.ttf\")\n return unless File.file?(path)\n\n # Determine variants.\n italics_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-Italic.ttf\")\n bold_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-Bold.ttf\")\n bold_italics_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-BoldItalic.ttf\")\n\n # Build hash of variants.\n font_hash = { normal: path }\n font_hash[:italic] = italics_path if File.file?(italics_path)\n font_hash[:bold] = bold_path if File.file?(bold_path)\n font_hash[:bold_italic] = bold_italics_path if File.file?(bold_italics_path)\n\n # Add font.\n self.font_families.update(name => font_hash)\n\n end",
"def ctrlSetFontH4 _obj, _args\n \"_obj ctrlSetFontH4 _args;\" \n end",
"def update_font\n self.contents.font.name = @window.fontName\n #self.recalculate_maxlength\n self.refresh\n end",
"def fonts_list\n initiate_library\n FONTS_LIBRARY.keys\n end",
"def ctrlSetFontH3 _obj, _args\n \"_obj ctrlSetFontH3 _args;\" \n end",
"def platform_font_paths\n fonts = find_os_font_files.reject do |f|\n f.downcase.include?('bold') ||\n f.downcase.include?('italic') ||\n f.downcase.include?('oblique') ||\n f.downcase.include?('narrow') ||\n f.downcase.include?('black')\n end\n fonts.sort_by { |f| f.downcase.chomp '.ttf' }\n end",
"def init_font_families\n # Set the known family groups. These font families will be used to\n # enable bold and italic markers to be included within text\n # streams. HTML forms will be used... <b></b> <i></i>\n @font_families[\"Helvetica\"] =\n {\n \"b\" => 'Helvetica-Bold',\n \"i\" => 'Helvetica-Oblique',\n \"bi\" => 'Helvetica-BoldOblique',\n \"ib\" => 'Helvetica-BoldOblique'\n }\n @font_families['Courier'] =\n {\n \"b\" => 'Courier-Bold',\n \"i\" => 'Courier-Oblique',\n \"bi\" => 'Courier-BoldOblique',\n \"ib\" => 'Courier-BoldOblique'\n }\n @font_families['Times-Roman'] =\n {\n \"b\" => 'Times-Bold',\n \"i\" => 'Times-Italic',\n \"bi\" => 'Times-BoldItalic',\n \"ib\" => 'Times-BoldItalic'\n }\n end",
"def render_text s, c, f = font\n f.render_solid_utf8 s, *rgb[c]\n end",
"def render_text s, c, f = font\n f.render_solid_utf8 s, *rgb[c]\n end"
] |
[
"0.7163284",
"0.70176446",
"0.6831852",
"0.6807011",
"0.67599624",
"0.6721139",
"0.6718104",
"0.66663325",
"0.6623491",
"0.65921557",
"0.6590611",
"0.65260506",
"0.65060997",
"0.64129794",
"0.63956726",
"0.63722026",
"0.63655585",
"0.636294",
"0.6294848",
"0.6267017",
"0.62030834",
"0.61714804",
"0.61515564",
"0.6116978",
"0.6086249",
"0.6046191",
"0.6025734",
"0.5981217",
"0.59760684",
"0.5973911",
"0.59308046",
"0.5891985",
"0.58864796",
"0.58509713",
"0.58279645",
"0.58235395",
"0.58227426",
"0.5821504",
"0.5818746",
"0.5806701",
"0.5780955",
"0.5777979",
"0.5756699",
"0.5754776",
"0.57508856",
"0.574992",
"0.574992",
"0.5744081",
"0.5740044",
"0.5739839",
"0.5735963",
"0.5730282",
"0.5723559",
"0.5720889",
"0.57159466",
"0.57122856",
"0.57122445",
"0.5699516",
"0.5632114",
"0.5626499",
"0.5621162",
"0.56066114",
"0.5593609",
"0.5584423",
"0.5574897",
"0.5565938",
"0.5553263",
"0.55421555",
"0.55407715",
"0.5534286",
"0.5532488",
"0.55297446",
"0.55250436",
"0.5524992",
"0.55229616",
"0.5521857",
"0.55010164",
"0.54547316",
"0.5447895",
"0.5436289",
"0.5416348",
"0.54139906",
"0.54095876",
"0.54095805",
"0.5398631",
"0.5393273",
"0.539002",
"0.53676575",
"0.5326849",
"0.5326056",
"0.53145725",
"0.5294906",
"0.5294113",
"0.52903086",
"0.5289104",
"0.5286468",
"0.5274696",
"0.52687275",
"0.5258951",
"0.5257257",
"0.5257257"
] |
0.0
|
-1
|
Hahahha its not like I even need this method now, do I?
|
def getDuration()
puts "Enter duration (in seconds)"
return gets.to_i
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def private; end",
"def schubert; end",
"def suivre; end",
"def probers; end",
"def who_we_are\r\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def weber; end",
"def refutal()\n end",
"def zuruecksetzen()\n end",
"def anchored; end",
"def jack_handey; end",
"def terpene; end",
"def villian; end",
"def custom; end",
"def custom; end",
"def gounod; end",
"def implementation; end",
"def implementation; end",
"def verdi; end",
"def berlioz; end",
"def formation; end",
"def celebration; end",
"def operations; end",
"def operations; end",
"def invention; end",
"def hiss; end",
"def herald; end",
"def r; end",
"def r; end",
"def eplore\n end",
"def private_method\n end",
"def stderrs; end",
"def isolated; end",
"def isolated; end",
"def extra; end",
"def strategy; end",
"def ibu; end",
"def guct\n end",
"def mitch_hedberg; end",
"def returns; end",
"def king_richard_iii; end",
"def silly_adjective; end",
"def placebo?; false end",
"def dh; end",
"def schumann; end",
"def bellini; end",
"def rossini; end",
"def internal; end",
"def feruchemist; end",
"def spouse; end",
"def strain; end",
"def used?; end",
"def scientist; end",
"def leeway; end",
"def leeway; end",
"def trd; end",
"def hd\n \n end",
"def original; end",
"def how_it_works\r\n end",
"def wrapper; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def bs; end",
"def buzzword; end",
"def buzzword; end",
"def spice; 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 malts; end",
"def witcher; end",
"def offences_by; end",
"def surge; end",
"def identify; end",
"def sn\n end",
"def romeo_and_juliet; end",
"def ignores; end",
"def flag; end",
"def ravel; end",
"def handle; end",
"def heroine; end",
"def starship; end",
"def operation; end"
] |
[
"0.7655734",
"0.72888225",
"0.7284377",
"0.71844465",
"0.69513756",
"0.6845551",
"0.6845551",
"0.6845551",
"0.6845551",
"0.6751847",
"0.6706008",
"0.6664528",
"0.6652801",
"0.6595214",
"0.6591525",
"0.6519477",
"0.64988214",
"0.64988214",
"0.6467656",
"0.6463441",
"0.6463441",
"0.6462786",
"0.6413275",
"0.6398931",
"0.63837",
"0.6299881",
"0.6299881",
"0.6292188",
"0.6277773",
"0.6275795",
"0.6272436",
"0.6272436",
"0.6254219",
"0.62506557",
"0.62375695",
"0.62339234",
"0.62339234",
"0.62336767",
"0.6230942",
"0.6227144",
"0.6219315",
"0.6216478",
"0.6212419",
"0.6210617",
"0.6201048",
"0.62001455",
"0.6195294",
"0.6191443",
"0.619037",
"0.61666244",
"0.6166102",
"0.6165341",
"0.61644757",
"0.6163234",
"0.6153476",
"0.6152045",
"0.61310065",
"0.61310065",
"0.6128309",
"0.6123211",
"0.6122894",
"0.61224663",
"0.61106277",
"0.6110101",
"0.6110101",
"0.6110101",
"0.6110101",
"0.6110101",
"0.6110101",
"0.6110101",
"0.6110101",
"0.6110101",
"0.6110101",
"0.6110101",
"0.6110101",
"0.61034137",
"0.60851806",
"0.60851806",
"0.60771614",
"0.607189",
"0.607189",
"0.607189",
"0.607189",
"0.607189",
"0.607189",
"0.607189",
"0.607189",
"0.60595345",
"0.6048918",
"0.60436535",
"0.6043236",
"0.604171",
"0.60408896",
"0.602833",
"0.6025978",
"0.6020559",
"0.6019216",
"0.6015945",
"0.6012458",
"0.60106266",
"0.6006381"
] |
0.0
|
-1
|
printRandom(int duration) Passed an integer, interpreted as a duration in seconds for a while loop to run, prints out random symbols in a string array in randomly picked colors for a given duration, and then calls the menu function
|
def printRandom(duration)
st = "q,w,e,r,t,y,u,i,o,p,a,s,d,f,g,h,j,k,l,z,x,c,v,b,n,m,Q,W,E,R,T,Y,U,I,O,P,A,S,D,F,G,H,J,K,L,Z,X,C,V,B,N,M,1,2,3,4,5,6,7,8,9,0,!,@,#,$,%,^,&,*,(,),_,+,[,],|,{,}"
x = st.split(",")
currentTime = Time.now.to_i
futureTime = currentTime + duration
while (currentTime <= futureTime) do
print "#{isMe(onMe( x[$prng.rand(0...x.length())] ))}"
currentTime = Time.now.to_i
end
menu()
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def printStringRandomFont(printMe, duration)\n x = printMe.split(\", \")\n currentTime = Time.now.to_i\n futureTime = currentTime + duration\n while (currentTime <= futureTime) do\n print \"#{isMe(onMe(\"\\n#{returnFont(x[$prng.rand(0...x.length())])}\\n\\n\"))}\"\n currentTime = Time.now.to_i\n end\n menu()\nend",
"def printRandomFont(duration)\n st = \"A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,0,1,2,3,4,5,6,7,8,9\"\n x = st.split(\",\")\n currentTime = Time.now.to_i\n futureTime = currentTime + duration\n while (currentTime <= futureTime)do\n print \"#{isMe(onMe(\"\\n#{returnFont(x[$prng.rand(0...x.length())])}\\n\\n\"))}\"\n currentTime = Time.now.to_i\n end\n menu()\nend",
"def printStringS(printMe, duration)\n x = printMe.split(\", \")\n currentTime = Time.now.to_i\n futureTime = currentTime + duration\n while (currentTime <= futureTime) do\n print \"#{isMe(onMe(x[$prng.rand(0...x.length())]))}\"\n currentTime = Time.now.to_i\n end\n menu()\nend",
"def print_menu(options_types)\n min_length = options_types.collect { |item| item.length }.min\n num_of_items = get_number(\"menu items\", min_length)\n puts \"\\nHere's your menu:\"\n (1..num_of_items).each do |item_num|\n print \" #{item_num}.\"\n options_types.each { |type| print \" #{type.delete_at(rand(type.length - 1))}\" }\n puts\n end\nend",
"def display_menu\n font_sml = TTY::Font.new(:straight)\n font_big = TTY::Font.new(:doom)\n font_col = Pastel.new\n system \"clear\"\n # if statement to detect if arguments given in command line\n if ARGV.length == 1\n puts font_sml.write(\"#{ARGV[0]}, Welcome to...\") \n ARGV.clear\n elsif ARGV.length > 1 && ARGV[1] == \"-s\"\n puts font_sml.write(\"#{ARGV[0]}, Welcome to...\") \n ARGV.clear\n random_character\n pre-game\n else\n puts font_sml.write(\"Welcome to...\")\n end\n puts font_col.red(font_big.write(\"RPSG\"))\n puts \"If you haven't played before, it is advisable to read the instructions.\"\n # displays game menu to player\n return $prompt.select(\"What would you like to do?\",\n [\"Start New Game\", \"View Instructions\", \"View Leaderboard\", \"Exit Game\"])\nend",
"def menu()\n print \"\\n-------------------------------------------------------------------------\\n\"\n puts \"1) Print Random Letters, Numbers, and Symbols (For a given set of time in seconds)\"\n puts \"2) Enter a string to be printed in random colors (For a given set of time in seconds)\"\n puts \"99) Beta Functions\"\n puts \"100) End Program\"\n coin = gets.to_i\n \n case(coin)\n when 1\n printRandom(getDuration())\n when 2\n puts \"Enter your strings to be printed, separated by a comma\"\n str = gets.chomp\n printStringS(str, getDuration())\n when 99\n puts \"Entering Beta Functions...\"\n betaFuntions()\n when 100\n puts \"Bye Bye\"\n when -1\n infiniteLoopWarning(1)\n else\n puts \"Undefined input\"\n menu()\n end\nend",
"def printing_menu(number_of_items)\n rand_val = rand(0..@fav_food.length)\n number_of_items.times do |i|\n\n # Traps code in a loop if index selected is outside of array. Rand() range is dynamic based on array size.\n while @style[rand_val] == nil && @texture[rand_val] == nil && @fav_food[rand_val] == nil\n rand_val = rand(0..@fav_food.length)\n @style[rand_val] = @style[rand_val]\n @texture[rand_val] = @texture[rand_val]\n @fav_food[rand_val] = @fav_food[rand_val]\n end\n\n print \"Item #{i+1}: #{@texture[rand_val]} \"\n print \"#{@style[rand_val]}\"\n print \" #{@fav_food[rand_val]} \\n\"\n\n # Deletes elements from menu arrays after they have been displayed to the user.\n @style.delete_at(rand_val)\n @texture.delete_at(rand_val)\n @fav_food.delete_at(rand_val)\n end\nend",
"def menu\n puts \"- Type in a #{\"Nintendo Character\".colorize(:red)} | #{\"Game Series\".colorize(:blue)} | #{\"Amiibo Series\".colorize(:green)}\\n\\n\"\n puts \"- Type #{'1'.colorize(:yellow)} for a list of all the Game Series included in the Amiibo collection\"\n puts \"- Type #{'2'.colorize(:yellow)} for a list of all the Amiibo Series included in the Amiibo collection\"\n puts \"- Type #{'3'.colorize(:yellow)} for a list of all the Characters included in Amiibo collection\"\n puts \"- Type #{'4'.colorize(:yellow)} for a list of ALL Amiibos collection\\n\\n\"\n puts \"- Type #{'exit'.colorize(:yellow)} to exit the CLI\\n\\n\"\n puts \"--------------------------------------------------------------------------------\\n\\n\"\n sleep(2)\n end",
"def repeat_menu\n puts \"\\n-----------------------\".colorize(:blue)\n puts \"You currently have $#{@player.wallet} left.\".colorize(:red)\n puts \"What do you want to do?\".colorize(:red)\n puts \"1)Add more money to my wallet\".colorize(:blue)\n puts \"2)Play another game\".colorize(:blue)\n puts \"3)Exit\".colorize(:blue)\n puts \"-----------------------\".colorize(:blue)\n print \"> \"\n choice = gets.to_i\n case choice\n when 1\n add_money_to_wallet\n display_main_menu\n when 2\n display_main_menu\n when 3\n puts \"\\nGOOD BYE!!!\".colorize(:red)\n sleep(1)\n print `clear`\n exit\n else\n puts \"Invalid Entry\".colorize(:red)\n repeat_menu\n end\n end",
"def anim(string)\n \n string.each_char do |n|\n \n \n print n \n \n \n slt =rand(0.02..0.08)\n sleep(slt) \n end\n print \"\\n\"\nend",
"def menu\n puts \"\\n************************************************************\".colorize(:magenta).blink\n puts \"Select an option (1-5) from the menu below:\".colorize(:blue).bold\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"1. Don't want to think about what to cook? \\n Spin the RANDOM WHEEL OF RECIPES!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"2. Need some inspiration for cooking? \\n Find recipe by name OR \\n if you have leftover ingredients search your ingredients!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"3. Feeling creative? \\n Write and save your own recipe!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"4. View ALL your favorite recipes in 1 place!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"5. You're done? Time to exit...\".colorize(:blue)\n puts \"************************************************************\\n \".colorize(:magenta).blink\n end",
"def show_menu\n puts \"calculator\"\n puts \"-=\" * 40\n puts Rainbow(\"[a] - addition\").red.bright\n puts Rainbow(\"[s] - substraction\").green\n puts Rainbow(\"[m] - multiplication\").aqua\n puts Rainbow(\"[d] - division\").purple.bright\n puts Rainbow(\"[q] - quit\").yellow.bright\n puts Rainbow(\"[r] - squareroot\").gold.bright\n puts Rainbow(\"[e] - To the power of\").brown\n print \"Enter your choice: \"\nend",
"def menu\n draw_line\n puts \" _______________________________________________________ \"\n puts \" | |\"\n puts \" | ~~THE QUEST~~ |\"\n puts \" | |\"\n puts \" | >>>>>>>>>>> 1. Thebes |\"\n puts \" | >>> | 2. Troy |\"\n puts \" | | = | 3. Hades |\"\n puts \" | | __| 4. GO HOME |\"\n puts \" | | -| |\"\n puts \" | |______| |\"\n puts \" | |\"\n puts \" |_______________________________________________________|\"\nend",
"def menuScreen\n @levelNo=1\n clearScreen\n puts \"You are at the menu for Sokoban\"\n puts \"To quick play: Press 'p'\"\n puts \"To choose a level: Press 'c'\"\n puts \"To stop: Press 'q'\"\n charPressedInMenu\nend",
"def create_menu(descriptors, cooking_styles, foods) \n number_of_items = get_number_of_items\n puts \"Here is your menu:\"\n puts \"-\" * 60\n number_of_items.times do |i|\n descriptor = descriptors.sample\n descriptors.delete(descriptor)\n cooking_style = cooking_styles.sample\n cooking_styles.delete(cooking_style)\n food = foods.sample\n foods.delete(food)\n puts \"#{i + 1}: #{descriptor} #{cooking_style} #{food}\"\n end\nend",
"def loading_screen(string) \n string.length.times do |i| # Iterates over each index in a given string\n # Clear the screen to provide an animated effect.\n clear\n \n # Please wait header \n puts HEADER_LINE\n puts \"Please Wait...\".upcase.center(HEADER_LENGTH)\n puts HEADER_LINE\n puts\n \n # Displays all characters in the string up to the index being iterated over.\n puts string[0, i].center(HEADER_LENGTH)\n sleep(0.2)\n end\nend",
"def display_menu\n title_print\n puts \"Hi #{@todays_hero.name}!\"\n puts \"***************************\"\n selection = TTY::Prompt.new.select(\"What would you like to do?\", per_page: 10, cycle: true) do |menu|\n menu.enum '>'\n\n menu.choice 'Start a fight', 1\n menu.choice 'Train for battle', 2\n menu.choice 'Go on a Quest', 3\n menu.choice 'Show Stats', 4\n menu.choice 'Display Instructions', 5\n menu.choice 'Display Leaderboard', 6\n menu.choice 'Exit', 7\n end\n self.start_game_loop(selection)\n end",
"def print_intro\n puts \"Welcome to the Menu Generator!\"\n puts \"A menu of random food items, each with a description (such as\"\n puts \"'hot' or 'sweet'), a cooking method (such as 'baked' or 'fried')\"\n puts \"and a food (such as 'chicken' or 'tofu') will be generated.\\n\\n\"\nend",
"def drum_roll(dramatic_text, beep)\n print \"\\a\" unless beep == false\n c = 0\n dramatic_text.length.times do\n print dramatic_text[c]\n c += 1\n sleep 0.05\nend\nend",
"def display_main_menu\n puts \"\\nMain Menu\".colorize(:red)\n puts \"-----------------------\".colorize(:blue)\n puts \"You currently have $#{@player.wallet}\".colorize(:red)\n puts \"Please select one of the following:\".colorize(:red)\n puts \"1)Roulette\".colorize(:blue)\n puts \"2)Black Jack\".colorize(:blue)\n puts \"3)Slots\".colorize(:blue)\n puts \"4)Dice\".colorize(:blue)\n puts \"5)Horse Races\".colorize(:blue)\n puts \"6)Additional Options\".colorize(:blue)\n puts \"-----------------------\".colorize(:blue)\n print \"> \"\n choice = gets.to_i\n case choice\n when 1 # Roulette\n Roulette.new(@player)\n when 2 # Black Jack\n BlackJack.new(@player)\n when 3 # Slots\n Slots.new(@player)\n when 4 # Dice\n Dice.new(@player)\n when 5 # Horse Races\n HorseRaces.new(@player)\n when 6\n repeat_menu\n else\n puts \"Invalid input, try again.\".colorize(:red)\n sleep(1)\n display_main_menu\n end\n print `clear`\n repeat_menu\n end",
"def strass_menu_help\n puts \"Available Options for the String Assistant Menu: \".underline.white\n puts \"back \".light_yellow + \" => \".white + \"Return to Main Menu\".light_red\n puts \"show basic \".light_yellow + \" => \".white + \"Show Basic Functions\".light_red\n puts \"show build \".light_yellow + \" => \".white + \"Show Builder Functions\".light_red\n puts \"show tamper \".light_yellow + \" => \".white + \"Show Tamper Functions\".light_red\n puts \"show append \".light_yellow + \" => \".white + \"Show Append Functions\".light_red\n puts \"show space \".light_yellow + \" => \".white + \"Show Whitespace Functions\".light_red\n puts \"show comma \".light_yellow + \" => \".white + \"Show Comma Functions\".light_red\n puts \"show floor \".light_yellow + \" => \".white + \"Show Floor() Functions\".light_red\n print_line(\"\")\nend",
"def show_menu\n puts Rainbow(\"Welcome to the Calculator\").yellow\n puts Rainbow(\"//\\\\\" * 50).yellow\n puts Rainbow(\"[a] - Addition\").green\n puts Rainbow(\"[s] - Subtraction\").green\n puts Rainbow(\"[m] - Multiplication\").green\n puts Rainbow(\"[d] - Division\").green\n puts Rainbow(\"[q] - quit\").red\n print Rainbow(\"Enter your selection: \").yellow\nend",
"def displaymenu # Console only\r\n\t\t @output.puts \"Menu: (1) Play | (2) New | (3) Analysis | (9) Exit\"\r\n\t\t end",
"def showMainMenu()\n\tputs\n\tputs \"Select an option:\"\n\tputs \"R: Run \" + $fizz + $buzz\n\tputs \"C: Change Words\"\n\tputs \"Q: Quit\"\nend",
"def menu()\n system('clear')\n puts '==================== M E N U ===================='.colorize(:light_blue)\n puts \" Press enter to start\".colorize(:green)\n gets.chomp\n @@support.help\n numberPlayers\n sleep (0)\n game\n return \"Finishing the game\"\n end",
"def character_menu\n puts \" \"\n puts \" ┌─┐┬ ┬┌─┐┬─┐┌─┐┌─┐┌┬┐┌─┐┬─┐ ┬┌┐┌┌─┐┌─┐\"\n puts \" │ ├─┤├─┤├┬┘├─┤│ │ ├┤ ├┬┘ ││││├┤ │ │\"\n puts \" └─┘┴ ┴┴ ┴┴└─┴ ┴└─┘ ┴ └─┘┴└─ ┴┘└┘└ └─┘\"\n puts \" \"\n puts \" Please select an option from below:\"\n puts \" \"\n prompt = TTY::Prompt.new\n menu_choices = [\n \" [1] Find info of character\",\n \" [2] Find allegience of character\",\n \" [3] Search characters by culture\",\n \" [4] Wiki Menu\",\n \" [5] Main Menu\",\n ]\n prompt.select(\" \", menu_choices)\nend",
"def displayArray\n checkIfComplete\n clearScreen\n @levelArr.each do |y|\n y.each do |x|\n case(x)\n when '@'\n print x.colorize(:color => :orange)\n when '#'\n print x.colorize(:background => :gray)\n else\n print x\n end\n end\n end\n manPosition = locateMan\n puts \"Press 'h' for help:\"\n charPressedInGame\nend",
"def interactive_menu\n loop do\n print_menu\n selection\n end\nend",
"def display_and_run\n\n # prints the menu name and waits briefly\n @dp.d_print(@menu_name + \":^^\")\n i = 1\n\n # displays the options\n @options.each do |option|\n print(i.to_s + ' ')\n puts(option.get_name)\n i += 1\n end\n\n # prompt and get valid input from the player\n print(@prompt_string)\n action = get_action\n\n # runs the selected action\n action.call :menu_select\n\n # some test code\n print(\"here\")\n end",
"def wave_display\n font_big = TTY::Font.new(:doom)\n font_col = Pastel.new\n case $current_lvl\n when $lvl_1\n puts font_col.red(font_big.write(\"WAVE 1\"))\n when $lvl_2\n puts font_col.red(font_big.write(\"WAVE 2\"))\n when $lvl_3\n puts font_col.red(font_big.write(\"WAVE 3\"))\n end\nend",
"def main_menu\n input = 0\n until input.to_i == @@main_ops.length - 1 \n print \"\\e[H\\e[2J\" #clears the screen\n puts @name \n print_menu(@@main_ops)\n print \"Choose an option by entering a number: \"\n input = gets.chomp\n call_option(input)\n end\n end",
"def menu\n puts `clear`\n puts Rainbow(\"*** Welcome to the calculator ***\").magenta.bright.underline\n puts Rainbow(\"Choose your type of calculator\").green.bright.blink\n print Rainbow(\"(b)\").green + \"asic or \" + Rainbow(\"(a)\").yellow + \"dvance or \" + Rainbow(\"(g)\").cyan + \"ometry or \" + Rainbow(\"(l)\").blue + \"ength conversion or \" + Rainbow(\"(p)\").magenta + \"eriod or \" + Rainbow(\"(t)\").green + \"mperature or \" + Rainbow(\"(w)\").cyan + \"eight or \" + Rainbow(\"(q)\").red + \"uit: \"\n gets.chomp.downcase\n\nend",
"def intro\n clr\n puts\"\n████████╗██╗ ██████╗████████╗ █████╗ ██████╗████████╗ ██████╗ ███████╗\n╚══██╔══╝██║██╔════╝╚══██╔══╝██╔══██╗██╔════╝╚══██╔══╝██╔═══██╗██╔════╝\n ██║ ██║██║ ██║ ███████║██║ ██║ ██║ ██║█████╗ \n ██║ ██║██║ ██║ ██╔══██║██║ ██║ ██║ ██║██╔══╝ \n ██║ ██║╚██████╗ ██║ ██║ ██║╚██████╗ ██║ ╚██████╔╝███████╗\n ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═════╝ ╚══════╝\n \"\n sleep 2\n end",
"def play_name_animation(name)\n 3.times do |i|\n puts \"\\e[H\\e[2J\" \n letterify_name(name)\n sleep(0.3)\n puts \"\\e[H\\e[2J\" \n blankify_name(name)\n sleep(0.3)\n end\nend",
"def menu\n # This uses a HEREDOC for multiline listing\n puts \"-------------------------\".colorize(:green) \n puts <<-MENU\n\nChoose a how you would like to see a card. You can view by name, creature, enchantment or sorcery:\n1. See cards by Name \n2. See cards by Creature \n3. See cards by Enchantment \n4. See cards by Sorcery\n\nOr type 'exit' at any time to leave the program. Type 'menu' to return to the main menu.\n MENU\n end",
"def main_menu(user)\n user = user\n self.clear\n Ascii.image\n menu = [\"See all my plants\",\"Add new plant\",\"Delete my account\",\"Quit\"]\n menu_selection = @@prompt.select(\"What would you like to do?\",menu)\n \n case menu_selection\n when \"See all my plants\"\n my_plant(user)\n when \"Add new plant\"\n add_plant(user)\n when \"Delete my account\"\n answer = @@prompt.yes?(\"Are you sure?\")\n answer == true ? user.destroy : self.main_menu(user)\n when \"Quit\"\n index = 0\n # binding.pry\n color = [\"#7FFF00\",\"#6B8E23\",\"#008000\",\"#2F4F4F\",\"#00008B\"]\n 5.times do\n self.clear\n # binding.pry\n puts Paint[Ascii.goodbye, color[index]] \n index += 1\n sleep(0.7)\n end \n end\n end",
"def menu_options\n system \"clear\"\n puts \"~~~ Welcome #{@user.username} to the Main Menu ~~~\\n\\n\" \n puts \"{1} Continue from previous story \"\n puts \"{2} Create new story\"\n puts \"{3} Delete a story\"\n puts \"{4} Tutorial\"\n puts \"{5} End My Session\"\nend",
"def print_menu\n isFinished = true\n while (isFinished)\n puts @menu_description\n @menu_items.each_pair { |key, value|\n puts \"(#{key}) #{value}\"\n }\n\n isFinished = determine_action(get_entry(\"Select option: \"))\n end\n end",
"def welcome_message(positions)\n system 'clear'\n puts \"Let's play some poker!\".light_red\n sleep(1)\n puts 'There are ' + positions.length.to_s.yellow + ' players at the table.'\n sleep(1)\n puts 'Starting stacks are ' + '5000 chips.'.light_green\n sleep(1)\n puts 'The ' + 'small blind is 25 chips'.light_yellow + ' and the ' + 'big blind is 50 chips.'.light_red\n puts ''\n sleep(2)\nend",
"def menu\n puts \"Quelle action veux-tu effectuer ?\" #Presentation menu\n puts \"\"\n puts \"a - chercher une meilleure arme\"\n puts \"s - chercher à se soigner\"\n puts \"\"\n puts \"Attaquer un joueur en vue\"\n print \"0 - \"\n puts @human_player.show_state\n counter_of_ennemies = 0\n @enemies.each do |mechant|\n print \"#{counter_of_ennemies} - \" \n puts mechant.show_state\n counter_of_ennemies += 1\n end\n end",
"def main_menu\n prompt = TTY::Prompt.new(\n active_color: :red,\n symbols: {marker: \"⮊\"},\n quiet: true\n )\n\n puts \"\"\n menu_selection = prompt.select(\"Select an option:\") do |menu|\n menu.choice \"➊ Start a new game\", 1\n menu.choice \"➋ How to play\", 2\n menu.choice \"➌ Display win counts\", 3\n menu.choice \"➍ Exit program\", 4\n end\n\n case menu_selection\n when 1\n start_game\n when 2\n instructions\n when 3\n check_win_history\n when 4\n puts \"\\nThanks for playing\\n\\nGoodbye!\"\n exit\n else\n raise InvalidMenu\n end\n\n rescue InvalidMenu\n puts \"Invalid menu input. Please try again!\"\n retry\n rescue\n puts \"An unexpected error has occured. The program will now exit.\"\nend",
"def main_menu()\n system 'clear'\n loop do\n headline(\"My Petsitter App\")\n puts \"#{@emoji[:smiling_cat_face_with_open_mouth]} Welcome! #{@emoji[:dog_face]}\".colorize(:bold)\n puts @headline\n input = @prompt.select('Menu:') do |menu|\n menu.choice name: 'Pet Sitters', value: \"PET_SITTERS\"\n menu.choice name: 'Clients', value: \"CLIENTS\"\n menu.choice name: 'Jobs', value: \"JOBS\"\n menu.choice name: 'Logout', value: \"EXIT\"\n end\n puts '-' * 20\n go_to(input)\n end\n end",
"def onMe(str)\n case $prng1.rand(1..6)\n when 1\n return $pastel.on_red(str)\n when 2\n return $pastel.on_green(str)\n when 3\n return $pastel.on_yellow(str)\n when 4\n return $pastel.on_blue(str)\n when 5\n return $pastel.on_magenta(str)\n when 6\n return $pastel.on_cyan(str)\n end\nend",
"def main_menu\n name_selector\n puts \"Okay #{@name}, what would you like to do?\"\n loop do\n case menu_arrows\n when '1'\n @recommendation.recommendation_menu\n when '2'\n puts 'you have the following number of games in your library: '\n @game_library.game_instances\n puts 'your custom list of games:'\n @game_library.user_games_lister\n when '3'\n puts 'add a game:'\n @game_library.add_title\n when '4'\n @game_library.delete_games\n when '5'\n @time_used.time_wasted\n when '6'\n @game_library.write_games\n puts 'thanks for your time!'\n exit\n end\n end\n end",
"def display_main_menu\n puts '################################'\n puts '# {N}- Network Stuff #'\n puts '# {RF}- Read File #'\n # puts '# {GF}- Generate File #'\n # puts '# {D}- Run as Daemon #'\n # puts '# {TD}- Run as Trigger Daemon #'\n puts '# {Q}- Quit #'\n puts '################################'\nend",
"def print_banner(winner)\n colors = ['bg-magenta', 'bg-cyan', 'bg-red', 'bg-blue', 'bg-red', 'bg-gray']\n headline = \"********* GRAND WINNER! #{winner} won 5 matches! *********\"\n\n puts \"********************************************************\"\n puts \"********************************************************\"\n 5.times do\n puts colorize(headline, 'default', colors.sample)\n end\n puts \"********************************************************\"\n puts \"********************************************************\"\n puts\nend",
"def print_menu()\n puts (\"1. Add numbers\")\n puts (\"2. Subtract numbers\")\n puts (\"3. Multiply numbers\")\n puts (\"4. Devide numbers\")\n puts (\"5. Quit\")\nend",
"def display_banner()\n\n\tr = Random.rand(1..4)\n\n\tcase r\n\twhen 1\n\t\tputs \"\n\t.------..------..------..------..------.\n\t|D.--. ||V.--. ||A.--. ||S.--. ||H.--. |\n\t| :/\\\\: || :(): || (\\\\/) || :/\\\\: || :/\\\\: |\n\t| (__) || ()() || :\\\\/: || :\\\\/: || (__) |\n\t| '--'D|| '--'V|| '--'A|| '--'S|| '--'H|\n\t`------'`------'`------'`------'`------'\n\n\n\t\t\"\n\twhen 2\n\t\tputs \"\n\t@@@@@@@ @@@ @@@ @@@@@@ @@@@@@ @@@ @@@ \n\t@@@@@@@@ @@@ @@@ @@@@@@@@ @@@@@@@ @@@ @@@ \n\t@@! @@@ @@! @@@ @@! @@@ !@@ @@! @@@ \n\t!@! @!@ !@! @!@ !@! @!@ !@! !@! @!@ \n\t@!@ !@! @!@ !@! @!@!@!@! !!@@!! @!@!@!@! \n\t!@! !!! !@! !!! !!!@!!!! !!@!!! !!!@!!!! \n\t!!: !!! :!: !!: !!: !!! !:! !!: !!! \n\t:!: !:! ::!!:! :!: !:! !:! :!: !:! \n\t :::: :: :::: :: ::: :::: :: :: ::: \n\t:: : : : : : : :: : : : : :\n\t\n\n\t\t\"\n\twhen 3\n\t\tputs \"\n\n\t\t ^^ .-=-=-=-. ^^\n\t ^^ (`-=-=-=-=-`) ^^\n\t (`-=-=-=-=-=-=-`) ^^ ^^\n\t ^^ (`-=-=-=-=-=-=-=-`) ^^ ^^\n\t ( `-=-=-=-(@)-=-=-` ) ^^\n\t (`-=-=-=-=-=-=-=-=-`) ^^\n\t (`-=-=-=-=-=-=-=-=-`) ^^\n\t (`-=-=-=-=-=-=-=-=-`) ^^\n\t (`-=-=-=-=-=-=-=-=-`) ^^\n\t (`-=-=-=-=-=-=-=-`) ^^\n\t (`-=-=-=-=-=-=-`) ^^ ^^\n\t dvash (`-=-=-=-=-`)\n\t `-=-=-=-=-`\n\n\n\t\t\"\n\twhen 4\n\t\tputs \"\n\n\t _______________\n\t //~~~~~~~~~~~~~~~\\\\\\\\ |\n\t 0 / /_________________\\\\ \\\\| 0\n\t ---------------------------\n\t / /======|=D=V=A=S=H=|======\\\\ \\\\\n\t \\\\_____________________________/\n\t \\\\ _______ _______ /\n\t |\\\\ _/|__|__|\\\\_____/|__|__|\\\\_ /|\n\t | |`V' `---' `V'| |\n\t |______| |______|\n\t\t\n\n\t\t\"\n\tend\nend",
"def select_random_code\n code = \"\"\n 4.times { code += @colors.sample }\n return code\n end",
"def require_sequence\n puts \"Repeat Sequence (Only repeat the first letter of each color):\"\n seq.length.times do |i|\n print \"> \"\n input = gets.chomp\n \n if input != seq[i]\n self.game_over = true\n break\n end \n end\n end",
"def menu\n\tuser_input = 0\n\twhile user_input < 1 || user_input > 4\n\t\tsystem \"clear\"\n\t\tputs \" - - . :\"\n\t\tputs \" - - - | -\"\n\t\tputs \" - - - . . | - - -\"\n\t\tputs \" - - - | . | - - -\"\n\t\tputs \" - - - - | : | - - -\"\n\t\tputs \" - - - - .| _|_ |. - -\"\n\t\tputs \" - - - ._-| |-_. - -\"\n\t\tputs \" - - - ._- | | -_. - -\"\n\t\tputs \" -.--.--.--.--.--. _ _-_ _ | M E N U | _ _-_ _ .--.--.--.--.--.-\"\n\t\tputs \" | | | | | |`.| | | || _______ || | | |.'| | | | | |\"\n\t\tputs \" 8888888888888888L_|`.88888| | | | |88888.'|_J8888888888888888\"\n\t\tputs \" |: `888L_|`.| | | | | | :|.'|_J888' :|\"\n\t\tputs \" |: `888L_|`. | | | |: | .'|_J888' :|\"\n\t\tputs \" |: |`888L_|`. | | | .'|_J888' :|\"\n\t\tputs \" ______<:________|:_`888L_|) | | | (|_J888':|________:|________\"\n\t\tputs \" |: |: `888L. |___|___| .J888' :| :|\"\n\t\tputs \" |: |: `88|/_________\\\\|88' :| :|\"\n\t\tputs \" __..-- _.-' ,|L_________J|. `-._ ``--..__\"\n\t\tputs \" ' _.-' |/___________\\\\| `-._ ``\"\n\t\tputs \" .c|L___________J|c. `-.\"\n\t\tputs \" .' |/_____________\\\\| `.\"\n\t\tputs \" 1. PLAY .'| |L_____________J| |`. 2. STATS\"\n\t\tputs \" 3. RULES .' | _/ \\\\_ | `. 4. QUIT\" \n\t\tputs \" .'| _// \\\\\\\\_ |`.\"\n\t\tputs \" .' | _/// \\\\\\\\\\\\_ | `.\"\n\t\tputs \" _____ Welcome to the Stairway Game !! ___\" \n\t\tputs \"Select Menu choice > \"\n\t\tuser_input = gets.to_i\n\tend\n\tuser_input\nend",
"def create_code\n speak\n code = []\n 4.times do\n code << Mastermind.show_colors[rand(0..7)]\n end\n code\n end",
"def menu\n puts Rainbow(\"calc\").red\n puts Rainbow(\"(b)asic, (a)dvanced, (t)rig, t(e)mperature (q)uit\").green\n function_type = gets.chomp.downcase \nend",
"def rainbowSpeak1(sentence)\n\trandNum = 0\n\tpreviousRandNum = 0\n\tletterArr = []\n\n\tsentence = sentence.split('')\n\n\tsentence.each do |letter|\n\t\twhile (randNum == previousRandNum)\n\t\t\trandNum = rand(1...7) \n\t\tend\n\n\t\tcase randNum\n\t\twhen 1\n\t\t\tletterArr.push(letter.colorize(:red))\n\t\twhen 2\n\t\t\tletterArr.push(letter.colorize(:green))\n\t\twhen 3\n\t\t\tletterArr.push(letter.colorize(:yellow))\n\t\twhen 4\n\t\t\tletterArr.push(letter.colorize(:blue))\n\t\twhen 5\n\t\t\tletterArr.push(letter.colorize(:magenta))\n\t\twhen 6\n\t\t\tletterArr.push(letter.colorize(:cyan))\n\t\twhen 7\n\t\t\tletterArr.push(letter.colorize(:white))\n\t\tend\n\t\n\t\tpreviousRandNum = randNum\n\tend\n\treturn letterArr.join(\"\")\nend",
"def house_menu\n puts \"\n ┬ ┬┌─┐┬ ┬┌─┐┌─┐ ┬┌┐┌┌─┐┌─┐\n ├─┤│ ││ │└─┐├┤ ││││├┤ │ │\n ┴ ┴└─┘└─┘└─┘└─┘ ┴┘└┘└ └─┘\n\n Please select an option from below:\n \"\n prompt = TTY::Prompt.new\n menu_choices = [\n \" [1] Find all characters of a house\",\n \" [2] Find largest houses\",\n \" [3] Find all houses of a region\",\n \" [4] Find info of a house\",\n \" [5] Wiki Menu\",\n \" [6] Main Menu\"\n ]\n prompt.select(\" \", menu_choices)\nend",
"def sub_menu\n puts \"\\n***********************************************\".colorize(:magenta).blink\n puts \"Type the following letters to do...\".colorize(:blue)\n puts \"-----------------------------------------------\".colorize(:cyan).bold\n puts \"s = Save Recipe to My Favorites\".colorize(:blue)\n puts \"r = Rate Recipe\".colorize(:blue)\n puts \"a = See Average Recipe Rating\".colorize(:blue)\n puts \"o = Open Link to See the Steps for This Recipe\".colorize(:blue)\n puts \"m = Back to Main Menu\".colorize(:blue)\n puts \"***********************************************\\n \".colorize(:magenta).blink\n end",
"def game_over\n puts \" ██████╗ █████╗ ███╗ ███╗███████╗\"\n sleep(1)\n puts \"██╔════╝ ██╔══██╗████╗ ████║██╔════╝\"\n sleep(1)\n puts \"██║ ███╗███████║██╔████╔██║█████╗ \"\n sleep(1)\n puts \"██║ ██║██╔══██║██║╚██╔╝██║██╔══╝ \"\n sleep(1)\n puts \"╚██████╔╝██║ ██║██║ ╚═╝ ██║███████╗\"\n sleep(1)\n puts \"╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝\"\n sleep(1)\n puts \" \"\n sleep(1)\n puts \"██████╗ ██╗ ██╗███████╗██████╗ \"\n sleep(1)\n puts \"██╔═══██╗██║ ██║██╔════╝██╔══██╗ \"\n sleep(1)\n puts \"██║ ██║██║ ██║█████╗ ██████╔╝ \"\n sleep(1)\n puts \"██║ ██║╚██╗ ██╔╝██╔══╝ ██╔══██╗ \"\n sleep(1)\n puts \"╚██████╔╝ ╚████╔╝ ███████╗██║ ██║ \"\n sleep(1)\n puts \"╚═════╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝ \"\n sleep(1)\n\n\n exit(0)\nend",
"def display_instructions\r\n\r\n Console_Screen.cls #Clear the display area\r\n puts \"INSTRUCTIONS:\\n\\n\" #Display a heading\r\n\r\n #Display the game's instructions\r\n puts \"This game randomly generates a word that is between five and ten \"\r\n puts \"characters long. It is up to you to guess the secret word! At the \"\r\n puts \"beginning of the game, you will be given the opportunity to choose \"\r\n puts \"five consonants and one vowel. If any of your letters match the \"\r\n puts \"letters in the secret word they will be revealed. All other characters\"\r\n puts \"will be displayed as an underscore. Choose wisely, because you’ll \"\r\n puts \"only get one guess at the secret word!\\n\\n\"\r\n puts \"Good luck!\\n\\n\\n\\n\\n\\n\\n\\n\\n\"\r\n print \"Press Enter to continue.\"\r\n\r\n Console_Screen.pause #Pause the game\r\n\r\n end",
"def random_colors\n colors = [\"blue\",\"red\",\"green\",\"black\",\"yellow\",\"pink\",\"white\",\"grey\"]\n color = colors[rand(colors.length)]\nend",
"def main_menu\n puts \"[1] - Display animals\"\n puts \"[2] - Display clients\"\n puts \"[3] - Enter animal to database\"\n puts \"[4] - Enter client to database\"\n puts \"[5] - Client is adopting animal\"\n puts \"[6] - Client is putting animal up for adoption\"\n puts \"[7] - Clear\"\n puts \"[8] - Quit\"\n\n print \"Please enter in your choice: \"\n response = gets.to_i\n\n case response\n when 1\n display_animals\n when 2\n display_clients\n when 3\n create_animal\n when 4\n create_client\n when 5\n adopt_animal\n when 6\n deposit_animal\n when 7\n puts `clear`\n when 8\n return Rainbow(\"badger badger badger badger badger badger badger badger badger badger badger badger badger mushroom mushroom \" * 10).yellow\n end\n\n main_menu\nend",
"def print_menu menu_level= '0'\n print_menu_header menu_level\n\n 20.times do |counter|\n lvl = \"#{menu_level}.#{counter}\"\n puts \" #{counter} : \" + @menu_map[lvl][0] if @menu_map.has_key?(lvl)\n end\n puts \"Make a choice between those items. (X to exit)\"\n puts \"Use left arrow to go back\"\n end",
"def play_again\n puts \"-----------------------------------------------------------------------\"\n font = font_instance\n prompt = prompt_instance\n puts font.write(\"Play again?\")\n prompt.select(\"Would you like to play again?\".colorize(:magenta)) do |menu|\n menu.choice \"YES\", -> {play}\n menu.choice \"NO\", -> {main_menu}\n end\nend",
"def loading_screen(string) \n string.length.times do |i|\n clear\n \n # Please wait header \n puts HEADER_LINE\n puts \"Please Wait...\".upcase.center(HEADER_LENGTH)\n puts HEADER_LINE\n puts\n puts string[0, i].center(HEADER_LENGTH)\n sleep(0.2)\n end\nend",
"def menu(user)\n system \"clear\"\n print \"\\e[8;1000;1000t\"\n aa = Artii::Base.new :font => 'doom'\n puts aa.asciify(\"What would you like to do?\".center(110))\n puts\n puts aa.asciify(\"1. Play a New Game \".center(125))\n puts aa.asciify(\"2. View Leaderboard\".center(125))\n puts aa.asciify(\"3. How to Play \".center(125))\n puts aa.asciify(\"4. Exit \".center(125))\n user_input = gets.chomp\n if user_input == \"1\"\n start_game(user)\n elsif user_input == \"2\"\n display_leaderboard(user)\n elsif user_input == '3'\n how_to_play(user)\n elsif user_input == \"4\"\n system \"clear\"\n puts aa.asciify(\"Thanks for playing!\")\n bye_bear\n sleep(3)\n return nil\n else\n puts \"Selection not recognized\"\n system \"clear\"\n menu(user)\n end\nend",
"def try_again\n wave_display\n puts \"Here's the word again...\"\n\tputs $current_word.colorize(:color => :black, :background => :green) + \"\\r\"\n sleep($hide_speed)\n player_input_word\nend",
"def print_menu()\n menu = [\"Add Item charge\",\"Add Labor\",\"Apply Discount\",\"total\",\"New Transaction\", \"Exit Application\"];\n\n for i in 1..6 do\n puts(\"#{i}\\t\\t#{menu[i-1]}\");\n end \nend",
"def interactive_menu\n # Repeat once a processs has been carried out\n loop do\n # Print the menu and ask the user what to do\n print_menu\n # Do what the user has selected (corresponding to the number entered by the user)\n selected_option(STDIN.gets.chomp)\n end\nend",
"def loop(timer: 0.1)\n loop do\n puts \"\\e[H\\e[2J\"\n puts step()\n sleep(timer)\n end\n end",
"def welcome \n\n system \"clear\"\n puts \"\n ██████╗░██████╗░░█████╗░██╗░░░██╗░██████╗░██╗░░██╗████████╗░██████╗\n ██╔══██╗██╔══██╗██╔══██╗██║░░░██║██╔════╝░██║░░██║╚══██╔══╝██╔════╝\n ██║░░██║██████╔╝███████║██║░░░██║██║░░██╗░███████║░░░██║░░░╚█████╗░\n ██║░░██║██╔══██╗██╔══██║██║░░░██║██║░░╚██╗██╔══██║░░░██║░░░░╚═══██╗\n ██████╔╝██║░░██║██║░░██║╚██████╔╝╚██████╔╝██║░░██║░░░██║░░░██████╔╝\n ╚═════╝░╚═╝░░╚═╝╚═╝░░╚═╝░╚═════╝░░╚═════╝░╚═╝░░╚═╝░░░╚═╝░░░╚═════╝░\\n\\n\\n\"\n\n # Progress bar\n bar = TTY::ProgressBar.new(\"[:bar]\", total: 74)\n 100.times do\n sleep(0.01)\n bar.advance(1)\n end\n\n main_menu\nend",
"def main_menu\n puts \"------------------------------------------------------------------------------------------------------\".colorize(:yellow)\n Artii::Base#asciify\n a = Artii::Base.new\n a.asciify(\"Toy Robot Challenge\")\n system(\"clear\")\n puts a.asciify(\"Toy Robot Challenge\").colorize(:red,)\n\n prompt = TTY::Prompt.new\n choices = [\n {name: 'New Game.', value: 1},\n {name: 'Exit.', value: 2},\n ]\n players_input = prompt.select(\"Select An Option:\", choices) \n case players_input\n when 1\n new_game\n when 2\n exit\n end \nend",
"def main_menu\r\n puts \"\\nMain Menu.\"\r\n puts \"A. List Buildings\"\r\n puts \"B. List Machines\"\r\n puts \"C. List Snacks\"\r\n puts \"D. List Users\"\r\n puts \"E. Find a Snack\"\r\n puts \"F. Add a New Snack\"\r\n puts \"G. Create New User\"\r\n puts \"H. List Favorites\"\r\n puts \"I. Find Favorites\"\r\n puts \"J. Add Favorites\"\r\n puts \"Q. Quit\"\r\nend",
"def main_menu\n \"Welcome to BATTLESHIP\\nEnter p to play or q to quit\"\n end",
"def display_menu\n system('clear')\n arr = ['My List', 'Recommendations', 'Playlist', 'Account Details', 'Exit']\n @prompt.select(\"》 MAIN MENU 《\\n\".colorize(:light_green), arr)\n end",
"def main_menu(player)\n quit = false # boolean used to exit menu loop\n while quit != true # while loop to keep player in menu unless choice is made\n puts\n puts \"Type 'commands' for a list of available commands.\"\n print UI_ARROW.red + \" \"\n input = gets.chomp.strip.downcase\n puts\n case input # switch statement to go to player menu choice\n when 'fight', 'f', 'battle'\n choose_enemy(player)\n when 'armoury', 'a'\n armoury(player)\n when 'stats'\n player.view_stats\n when 'commands'\n list_commands\n when 'clear', 'cls' \n system 'clear'\n when 'quit', 'q', 'exit'\n abort(\"Look, bud. You leave now and you forfeit your body count!\".red)\n when 'godmode'\n player.level = 100\n player.coins = 5000\n else\n puts \"That's not an available command\"\n end\n end\nend",
"def main_menu\n prompt = TTY::Prompt.new\n first = prompt.select(\"Greetings, #{@player.player_name}. Select Go to Town to start your adventure!\", %w(Go_to_Town Change_my_Name View_my_Quests View_my_Inventory View_my_Renown Slay_the_Dragon Save_the_Kingdom Exit_Game))\n #binding.pry\n if first == \"Go_to_Town\"\n system \"clear\"\n town_menu\n elsif first == \"Change_my_Name\"\n system \"clear\"\n change_name\n elsif first == \"View_my_Quests\"\n system \"clear\"\n view_my_quests #Shows all a players quests\n elsif first == \"View_my_Inventory\"\n system \"clear\"\n view_my_gear #Shows all a players gear\n elsif first == \"View_my_Renown\"\n system \"clear\"\n view_my_renwon #Shows a players total renown\n elsif first == \"Slay_the_Dragon\"\n system \"clear\"\n dragon_message\n elsif first == \"Save_the_Kingdom\"\n system \"clear\"\n kingdom_message\n elsif first == \"Exit_Game\"\n system \"clear\"\n exit_game\n else \n return \n end\nend",
"def cadenas(arr)\n 10.times do\n puts \"Cadena aleatoria: #{(65+rand(26)).chr*5}\"\n end\n \nend",
"def main_menu\n while true\n print_main_menu\n user_selected =gets.to_i\n call_option(user_selected)\n end\n end",
"def display_instructions\n\n\tConsole_Screen.cls #clear th display area\n\tputs \"Instructions:\\n\\n\" #display a heading\n\n\t#display games instructions\n\tputs \"At the start of each round of play, the game randomly selects\"\n\tputs \"a word that is between minimum four and max ten characters long and\"\n\tputs \"challenges you to guess it. Before submitting your guess, you\"\n\tputs \"must specify five consontants and one vowel. If any of these\"\n\tputs \"are used in the word, they will be revealed on the screen,\"\n\tputs \"thereby making it easier for you to guess the secret word\"\n\tputs \"If a letter you chose is not in the word, then its space will \" +\n\t\" will be replaced by an underscore (_)\\n\\n\\n\"\n\tputs \"Goodluck!\\n\\n\\n\\n\\n\\n\\n\"\n\tprint \"Press Enter to continue.\"\n\n\tConsole_Screen.pause #pause the game\nend",
"def main_menu(player)\n quit = false # boolean used to exit menu loop\n while quit != true # while loop to keep player in menu unless choice is made\n puts\n puts \"Type 'commands' for a list of available commands.\"\n print UI_ARROW.red + \" \"\n input = gets.chomp.strip.downcase\n puts\n case input # switch statement to go to player menu choice\n when 'fight', 'f', 'battle'\n player.choose_enemy\n when 'armoury', 'a'\n player.armoury\n when 'stats'\n player.view_stats\n when 'commands'\n list_commands\n when 'clear', 'cls' \n system 'clear'\n when 'quit', 'q', 'exit'\n abort(\"Look, bud. You leave now and you forfeit your body count!\".red)\n when 'godmode'\n player.level = 100\n player.coins = 5000\n else\n puts \"That's not an available command\"\n end\n end\nend",
"def run\n greet\n menu\n end",
"def play\r\n @secret_word = get_random_word\r\n @secret_word_letters = @secret_word.chars.to_a\r\n print_instructions\r\n play_loop\r\n end",
"def random_event\n clear\n center \"Random Event\"\n new_line\n display_event(Event.all.sample)\n wait_and_clear\n end",
"def menu game\n puts `clear`\n puts \"dBBBBb dB dBBBBBP dBBBBBP dBP dBBBBP dBBBBP dBP dBP dBP dBBBBBb\"\n puts \"dB dP BBB dBP dBP dBP dP dBP dBP dBP dBP dB BP\"\n puts \"dBBBK dBBBBB dBP dBP dBP dBBP `BBBBb dBBBBBP dBP dBBBP'\"\n puts \"dB db dBP BB dBP dBP dBP dP dBP dBP dBP dBP dBP\"\n puts \"dBBBBP' dBB BBB dBP dBP dBBBBP dBBBBP dBBBBP' dBP dBP dBP dBP\"\n puts\n game.show_board\n puts\n puts \" . Unknown * Hit [#{game.misses}] - Misses [#{game.hits}]\"\n puts\n puts \" MAIN MENU\"\n puts\n puts \"1 - New Game\"\n puts !game.showship ? \"2 - Show Ships (CHEATER!)\" : \"2 - Hide Ships\"\n puts \"3 - build ship\"\n puts \"99 - Exit this App\"\n puts \"A..Z## ( A-J is Column 1-10 Row) Shoot at Ship\"\n puts\n print \"Enter Menu Choice[1..2 99 ]:\"\n\n return gets.chomp\n end",
"def print_menu\n puts \"1. List patients\"\n # ....\n end",
"def menu(array)\r\n start_line\r\n for line in array\r\n puts line.capitalize.colorize(:light_blue)\r\n end\r\n empty_line\r\n return gets.chomp \r\n end",
"def menu\n\tputs \"Quelle action veux-tu effectuer?\"\n\tputs \"\\n\"\n\tputs \"a - chercher une meilleure arme\"\n\tputs \"s - chercher à se soigner\"\n\tputs \"\\n\"\n\tputs \"attaquer un joueur en vue :\"\n\ti = 0\n\tenemies_in_sight.each do |enemy|\n\t\ti +=1\n\t\tputs \"#{i} - #{enemy.name} a #{enemy.life_points} points de vie.\"\n\tend\n\tputs \"Fais ton choix\"\n\tprint \">\"\n\tend",
"def present_menu_options\n space(1)\n puts \"Choose an option from the list below.\"\n space(1)\n puts '1. Search for events by city'\n puts '2. Search for events by artist or sports team'\n puts '3. See what I have coming up'\n puts '4. Delete my account'\n puts '5. Exit'\n space(1)\n pick_option\nend",
"def notify_the_user_that_the_program_has_finished_by_calling_this_long_method_name\n done = rand(13)\n puts \"\\nBoo-yah!\" if done == 0\n puts \"\\nOh-yeah!\" if done == 1\n puts \"\\nYah-hoo!\" if done == 2\n puts \"\\nYeah-yuh!\" if done == 3\n puts \"\\nRock on!\" if done == 4\n puts \"\\n^_^\" if done == 5\n puts \"\\nRadical!\" if done == 6\n puts \"\\nAwesome!\" if done == 7\n puts \"\\nTubular!\" if done == 8\n puts \"\\nYay!\" if done == 9\n puts \"\\nGnarly!\" if done == 10\n puts \"\\nSweet!\" if done == 11\n puts \"\\nGroovy!\" if done == 12\n puts \"--------------------------------\\n\"\n end",
"def display\n again = false\n message = ''\n puts \"\\n\" * 100\n # Ruby is magic in this respect. The ljust() (left justify), rjust (right justify), and center() methods\n # are fantastical. It's so easy to build a nice looking menu that there really isn't any reason not to.\n begin\n # This section deals with the top line, title, and separator line\n puts \"\\t\\t╔\".ljust(@max_width, '═') + '╗'\n puts \"\\t\\t║#{@title.center(@max_width-3)}║\"\n puts \"#{\"\\t\\t╠\".ljust(@max_width, '═')}╣\"\n puts \"#{\"\\t\\t║\".ljust(@max_width)}║\"\n\n # This section prints out the strings in the array and enumerates them and then puts an exit option\n # as the last item.\n (0..@num_items).each { |i|\n if i < @num_items\n puts \"\\t\\t║ #{(i+1).to_s} #{'.' * 10} #{@choices[i]}\".ljust(@max_width) + '║'\n else\n puts \"#{\"\\t\\t║ #{(i+1).to_s} #{'.' * 10} Exit\".ljust(@max_width)}║\"\n end\n }\n\n # This section pads the bottom and puts in the bottom line and corners.\n puts \"#{\"\\t\\t║\".ljust(@max_width)}║\"\n puts \"#{\"\\t\\t╚\".ljust(@max_width, '═')}╝\"\n print \"#{\"\\n\" * 20}\"\n\n # If the user entered an invalid response (previously), print out a message\n if again\n puts message\n again = false\n end\n\n # Get the user response and convert it to an integer.\n print 'Your choice: '\n choice = gets.to_i\n\n # Validate the response. If invalid, set a message, clear the screen, and make it so the menu\n # displays again by setting the again bool flag to true.\n if choice < 1 or choice > @num_items + 1\n message = \"Invalid choice. Please enter a value between 1 and #{@num_items+1}\"\n puts \"\\n\" * 100\n again = true\n end\n\n # If the again flag is set to true, display the menu again.\n end while again\n\n # Return choice to the caller\n choice\n end",
"def welcome\n puts \"---------------------------------------------\".center(70).blue\n puts \"Welcome to the Makers Academy Student Database!\".center(70).green\n puts \"---------------------------------------------\".center(70).blue\n interactive_menu\nend",
"def show_menu\n puts \"Calculator\"\n puts \"-=\" * 40\n puts \"[mor] - Mortgage Calculator\"\n print \"Enter your selection: \"\nend",
"def menu\n puts \"Menu\"\n puts \"1. List Channels\"\n puts \"2. List Users\"\n puts \"3. Select User\"\n puts \"4. Select Channel\"\n puts \"5. Send Message\"\n puts \"6. Quit\"\nend",
"def titleSlide()\n=begin \n print \"\\n-------------------------------------------------------------------------\\n\"\n print $titleSlideFont.write(\"Console Light Show\")\n print \"\\nA program for Joshua Bruce\\nWritten with love by Robert Leslie\\n\"\n print \"---------------------------------------------------------------------------\\n\"\n=end\n titleSlideFont = TTY::Font.new(:standard)\n titleBox = TTY::Box.frame(\n width: TTY::Screen.width-1,\n height: 15,\n border: :thick,\n align: :center,\n padding: 1\n )do\n \"#{titleSlideFont.write(\"Console Light Show\")}\n \\nA program for Joshua Bruce\\nWritten with love by Robert Leslie\\n2019\"\n end\n print titleBox\n menu()\nend",
"def main_menu\n system 'clear'\n user.reload\n\nputs\" \n███████╗██╗ ██╗██████╗ ███████╗██████╗ ██╗ ██╗███████╗██████╗ ██████╗ ███████╗██╗██╗██╗██╗\n██╔════╝██║ ██║██╔══██╗██╔════╝██╔══██╗██║ ██║██╔════╝██╔══██╗██╔═══██╗██╔════╝██║██║██║██║\n███████╗██║ ██║██████╔╝█████╗ ██████╔╝███████║█████╗ ██████╔╝██║ ██║███████╗██║██║██║██║\n╚════██║██║ ██║██╔═══╝ ██╔══╝ ██╔══██╗██╔══██║██╔══╝ ██╔══██╗██║ ██║╚════██║╚═╝╚═╝╚═╝╚═╝\n███████║╚██████╔╝██║ ███████╗██║ ██║██║ ██║███████╗██║ ██║╚██████╔╝███████║██╗██╗██╗██╗\n╚══════╝ ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝╚═╝╚═╝╚═╝ \n \n\".colorize(:blue)\n\n puts \"\\n\\n\\n---Welcome, #{self.user.name}!\\n********************************************************************************************\"\n prompt.select(\"\\n\\n\\n\\n---What would you like to do?\") do |menu|\n menu.choice \"\\n\\n---1) View Your Superheros\", -> {display_user_superheros}\n menu.choice \"\\n---2) Create A Superhero\", -> {display_and_add_a_superhero}\n menu.choice \"\\n---3) Give Your Superhero A Superpower/Edit\", ->{display_and_add_superpower}\n menu.choice \"\\n---4) Add Your Superhero To An Organization/Edit\", ->{display_and_add_orgs}\n menu.choice \"\\n---5) Delete A Superheros From Your List\", -> {remove_superhero}\n menu.choice \"\\n---6) Exit And Log Out\", -> {user_log_out}\n end\n \n \n end",
"def main_menu\n\t\tputs '################################'\n\t\tputs '######### Tic Tac Toe ##########'\n\t\tputs '################################'\n\t\tputs '================================'\n\t\tputs '== Choose your weapon warrior =='\n\t\tputs '================================'\n\t\tputs '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'\n\t\tputs '^^^^^^ Type Your Choice: ^^^^^^^'\n\t\tputs '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'\n\t\tputs '$$$$$$$$$$$ 1. \"X\" $$$$$$$$$$$$$'\n\t\tputs '$$$$$$$$$$$ 2. \"O\" $$$$$$$$$$$$$'\n\t\tputs '--------------------------------'\n\tend",
"def draw\n letters.delete_at(rand(letters.size))\n end",
"def setup\n\n y = 288\n @texts = Array.new\n\n @menu_list.each { |t|\n @texts << Text.create(t, :y => y, :size => 90, :color => Color::WHITE)\n @texts[@texts.size - 1].center_x\n y += 128\n }\n\n @choice, @last = 0, 0\n @texts[@choice].color = Color::YELLOW\n\n end",
"def display_options_menu(options, message)\n optnums = (1..options.count).map{ |i| i.to_s 36}\n options.each_with_index do |opt, i|\n if opt[0].length > $sp[:w]\n right_end = \"|\"\n else\n right_end = \" \" * ($sp[:w] - 7 - opt[0].size) + \"|\"\n end\n puts \" \" * $sp[:l] + \"| #{optnums[i]}) #{opt[0]}\" + right_end\n end\n puts \" \" * $sp[:l] + \"-\" * $sp[:w]\n puts \"\\n\" * (4 - message.count)\n message.each {|line| puts \" \" * $sp[:l] + line}\n print \"\\n\" + \" \" * $sp[:l] + \"Your selection (1-#{optnums[-1]})? \"\n input = STDIN.getch\n exit_game_reviews if input.ord == 27\n optnums.include?(input) ? options[optnums.index(input)][1] : nil\nend",
"def display_menu\n puts \"Welcome to Lorrayne and Sherwin's coffee emporium!\\n\\n\"\n puts \"1) Add item - $5.00 - Light Bag\"\n puts \"2) Add item - $7.50 - Medium Bag\"\n puts \"3) Add item - $9.75 - Bold Bag\"\n puts \"4) Complete Sale\"\n end",
"def intro\n loading_2\n puts `clear`\n puts \"\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\"\n puts \"\".center(236).blue_on_green\n print \"Welcome to Restaurant Sleuth!\".center(118).blue_on_green\n puts \"\".center(236).blue_on_green\n sleep 1\n print \" Please enter your city:\".center(118).blue_on_green\n puts \"\".center(236).blue_on_green\n puts \"\\n\\n\"\nend"
] |
[
"0.7819071",
"0.7719222",
"0.7337845",
"0.6795813",
"0.6752646",
"0.6651901",
"0.65144366",
"0.6267164",
"0.6201734",
"0.618687",
"0.6175224",
"0.6157515",
"0.6077647",
"0.6062917",
"0.6056033",
"0.6046337",
"0.60086596",
"0.59682584",
"0.5912481",
"0.5898218",
"0.58981365",
"0.5869016",
"0.5857693",
"0.5853043",
"0.58437884",
"0.5812155",
"0.5805116",
"0.58024037",
"0.57864076",
"0.5781026",
"0.5762364",
"0.5761939",
"0.5761861",
"0.57567424",
"0.5752071",
"0.57439196",
"0.5713292",
"0.5712913",
"0.57028747",
"0.56520855",
"0.5648287",
"0.56381387",
"0.56377393",
"0.56276184",
"0.5626849",
"0.5614135",
"0.5608914",
"0.5603187",
"0.5600971",
"0.55954295",
"0.55868924",
"0.5584617",
"0.5583111",
"0.55825657",
"0.5567821",
"0.55548704",
"0.555453",
"0.5552176",
"0.554625",
"0.5546074",
"0.5543143",
"0.5542772",
"0.55295515",
"0.5518824",
"0.5516984",
"0.55155164",
"0.55154896",
"0.55140257",
"0.55139995",
"0.5511973",
"0.5503031",
"0.5500044",
"0.54987276",
"0.5496194",
"0.5495555",
"0.54948425",
"0.5474233",
"0.5471981",
"0.54706055",
"0.5467257",
"0.5457328",
"0.5452195",
"0.5448437",
"0.5447332",
"0.5446999",
"0.543835",
"0.54342985",
"0.5433912",
"0.54306394",
"0.5423698",
"0.5418183",
"0.5413328",
"0.5412663",
"0.54087627",
"0.5407021",
"0.54020494",
"0.5401423",
"0.53979397",
"0.5397747",
"0.5392585"
] |
0.78929853
|
0
|
printStringS(string printMe, int duration) Passed a string and a duration, the code creates a string array split at a comma followed by a space. I know there can be some problems with this but this was the first thing that came to mind. I could use a regex but what ever. This does the same exact thing as the other printing functions so I expect the person reading this code to assume what this method does.
|
def printStringS(printMe, duration)
x = printMe.split(", ")
currentTime = Time.now.to_i
futureTime = currentTime + duration
while (currentTime <= futureTime) do
print "#{isMe(onMe(x[$prng.rand(0...x.length())]))}"
currentTime = Time.now.to_i
end
menu()
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def string_splitter( string )\n\n array = []\n array = string.split(\"\")\n p array\n return array\n\nend",
"def space_separated(str: raise)\n\tfirst_index = 0\n\tlast_index = 0\n\tresults = []\n\n\tstr.size.times do\n\t\tcheck_string = str[first_index..last_index]\n\t\tif DICTIONARY[check_string]\n\t\t\tresults << check_string\n\t\t\tfirst_index = last_index += 1\n\t\t\tlast_index = first_index\n\t\telse\n\t\t\tlast_index += 1\n\t\tend\n\tend\n\n\tputs results.join(\" \")\nend",
"def do_comma s; a = mega_pop(s); String == a.class ? s[:output] << \"#{a}\" : s[:output] << \"#{a.chr}\" end",
"def parse_comma_seperated_string(s)\n list = s.split(',')\n end",
"def separate_comma(my_integer)\n\n\tmy_string = my_integer.to_s\n\n\tif my_string.length % 3 == 0\n\t\tcommas_needed = my_string.length / 3 - 1\n\telse\n\t\tcommas_needed = my_string.length / 3\n\tend\n\n\tmy_array = Array.new(my_string.length + commas_needed)\n\n\tstring_position = my_string.length - 1\n\n\tarray_position = my_array.length - 1\n\n\tcomma_counter = 0\n\n\tresult_string = \"\"\n\n\tuntil array_position < 0\n\n\t\tif comma_counter == 3 \n\t\t\tmy_array[array_position] = \",\"\n\t\t\tcomma_counter = 0\n\t\t\tarray_position -= 1\n\t\telse\n\t\t\tmy_array[array_position] = my_string[string_position]\n\t\t\tarray_position -= 1\n\t\t\tstring_position -= 1\n\t\t\tcomma_counter += 1\n\t\tend\n\n\t\t#print my_array\n\n\tend\n\n\tmy_array.each do |character|\n\t\tresult_string += character\n\t\t\n\tend\n\n\treturn result_string\n\n\t#puts \"commas needed \" + commas_needed.to_s\n\t\nend",
"def separate_comma(int)\n\n result = []\n\n int.to_s.split(\"\").reverse.each_slice(3) do |slice|\n slice << \",\"\n result << slice\n end\n\n p result.flatten.join.chop.reverse\n\nend",
"def parse_comma_seperated_string(s)\n s.nil? ? [] : s.split(',')\n end",
"def separate_comma(i)\n\ts = i.to_s\n\tc = -s.length\n\tp = -1\n\n\tuntil p < c\n\t\tif p % 4 == 0\n\t\t\ts.insert(p, ',')\n\t\t\tc -= 1\n\t\tend\n\t\tp -= 1\n\tend\n\treturn s\nend",
"def separate_comma(digits_array)\n\n formatted_digits = digits_array.to_s.split(//)\n #p formatted_digits\n\n reverse_digits = formatted_digits.reverse\n #p reverse_digits\n\n slice_three = []\n reverse_digits.each_slice(3) {|slice| slice_three.push(slice)}\n #p slice_three\n\n join_subarrays = slice_three.map(&:join)\n #p join_subarrays\n\n insert_commas = []\n insert_commas = join_subarrays.join(',')\n #p insert_commas\n\n final = insert_commas.reverse\n p final\n\nend",
"def separate_comma(integer) #running this program gets me an array of each integer.to_s. See below for reconsidered approach\n new_array = []\n integer.to_s.split(//).each{|n| new_array << n} \nend",
"def segmented_output\n if @words.join(\"\").length == @str.length\n return @words.join(\", \")\n else\n get_error_message()\n end\n end",
"def separate_comma(pos_integer)\n\t#final solution via Stack Overflow\n\tpos_integer.to_s.chars.to_a.reverse.each_slice(3).map(&:join).join(\",\").reverse\n\t\n\n\t# my original solution, didn't quite add commas correctly and couldn't figure out how to join it back together\n\t# list = new_array.reverse.each_slice(3) { |a| p \"#{a.join},\" }\n\n\nend",
"def separate_comma(integer)\n\n string = integer.to_s\n if string.length > 3\n array = string.split(\"\")\n i = (string.length - 3)\n while i > 0\n array.insert(i, \",\")\n i -= 3\n end\n array.join\n else\n string\n end\n\nend",
"def separate_comma(number)\n\tnumber = number.to_s.split('')\n\tsliced_array = []\n\tnumber.reverse.each_slice(3) { |group| sliced_array.push(group) }\n\t# For every slice in the array we need reverse the array then we need to piece it back together adding the comma after every slice (This was a royal pain to figure out) (The constant reversing)\n\tsliced_array.reverse.map{|i| i.reverse.join}.join(\",\")\nend",
"def format(sentence:)\n words = sentence.split(\" \")\nend",
"def print_multiple_words\n text = @array_to_split.join(\", \")\n text += \", and #{@lastword}\"\n return text\n end",
"def separate_comma(integer)\n if integer.to_s.length <= 3\n comma_string = integer.to_s\n else\n integer_array = integer.to_s.split('')\n integer_array.each_with_index do |n, i|\n if i % 4 == 0\n integer_array.insert(-i, \",\")\n end\n comma_string = integer_array.join(\"\")\n comma_string[0] = \"\"\n end\n end\n p comma_string\nend",
"def separate_comma(integer)\n strinteger = integer.to_s.split('')\n figures = strinteger.size / 3\n if strinteger.size <= 3\n \tp integer.to_s\n elsif strinteger.size%3 == 0\n \tt = -4\n \t(figures.to_i - 1).times do |x|\n \t strinteger.insert(t, ',')\n \t t -= 4\n \tend\n p strinteger.join\n else\n \tt = -4\n \t(figures.to_i).times do |x|\n \t strinteger.insert(t, ',')\n \t t -= 4\n \tend\n p strinteger.join\n end\nend",
"def spputs(*args)\n # split, prefix and puts\n args.each do |arg|\n case arg\n when Array\n arg.each do |argh| puts(\"#{full_name}: #{argh}\"); end\n when String\n spputs(arg.split($RS))\n else\n ssputs(arg.to_s)\n end\n end\n end",
"def my_split(string, divider)\n array = []\n current_element = ''\n\n formatted_string = string.clone\n formatted_string.strip!\n\n formatted_string.each_char do |char|\n if char == divider\n array << current_element\n current_element = ''\n else\n current_element << char\n end\n end\n\n array << current_element\n\n array\nend",
"def separate_comma(num)\r\n\tnum_s = num.to_s\r\n\tx = num_s.length - 1\r\n\tfinal = \"\"\r\n\r\n\twhile x >= 0\r\n\t\tfinal.prepend((num_s.length - x) % 3 == 0 && x != 0 ? \",#{num_s[x]}\" : \"#{num_s[x]}\")\r\n\t\tx-= 1\r\n\tend\r\n\r\n\treturn final\r\nend",
"def liststrs(strs)\n return \"\" if strs.empty?\n if (strs.count == 1)\n strs[0]\n else\n last = strs.pop\n [strs.join(', '), last].join(' and ')\n end\nend",
"def parse_times(str)\n \tstr.delete(' ')\n \ttimes = []\n \tsuccess = true\n \tstr.split(',').each do |t|\n \t pt = parse_time(t)\n \t if pt\n \t \ttimes << pt\n \t else\n \t \traise \"unable to parse time #{t}\"\n \t \tsuccess = false\n \t \tbreak\n \t end\n \tend\n end",
"def filter_through_white_list(string)\n res = []\n string.split(' ').each do |word|\n if word =~ float_matcher\n res << word.strip\n next\n end\n stripped_word = word.strip.gsub(/^,/, '').gsub(/,$/, '')\n if mappings.has_key?(stripped_word)\n res << mappings[stripped_word]\n elsif !join_words.include?(stripped_word) and ChronicDuration.raise_exceptions\n raise DurationParseError, \"An invalid word #{word.inspect} was used in the string to be parsed.\"\n end\n end\n # add '1' at front if string starts with something recognizable but not with a number, like 'day' or 'minute 30sec' \n res.unshift(1) if res.length > 0 && mappings[res[0]] \n res.join(' ')\n end",
"def filter_through_white_list(string)\n res = []\n string.split(' ').each do |word|\n if word =~ float_matcher\n res << word.strip\n next\n end\n stripped_word = word.strip.gsub(/^,/, '').gsub(/,$/, '')\n if mappings.has_key?(stripped_word)\n res << mappings[stripped_word]\n elsif !join_words.include?(stripped_word) and ChronicDuration.raise_exceptions\n raise DurationParseError, \"An invalid word #{word.inspect} was used in the string to be parsed.\"\n end\n end\n # add '1' at front if string starts with something recognizable but not with a number, like 'day' or 'minute 30sec' \n res.unshift(1) if res.length > 0 && mappings[res[0]] \n res.join(' ')\n end",
"def filter_through_white_list(string)\n res = []\n string.split(' ').each do |word|\n if word =~ float_matcher\n res << word.strip\n next\n end\n stripped_word = word.strip.gsub(/^,/, '').gsub(/,$/, '')\n if mappings.has_key?(stripped_word)\n res << mappings[stripped_word]\n elsif !join_words.include?(stripped_word) and ChronicDuration.raise_exceptions\n raise DurationParseError, \"An invalid word #{word.inspect} was used in the string to be parsed.\"\n end\n end\n # add '1' at front if string starts with something recognizable but not with a number, like 'day' or 'minute 30sec' \n res.unshift(1) if res.length > 0 && mappings[res[0]] \n res.join(' ')\n end",
"def filter_through_white_list(string)\n res = []\n string.split(' ').each do |word|\n if word =~ float_matcher\n res << word.strip\n next\n end\n stripped_word = word.strip.gsub(/^,/, '').gsub(/,$/, '')\n if mappings.has_key?(stripped_word)\n res << mappings[stripped_word]\n elsif !join_words.include?(stripped_word) and ChronicDuration.raise_exceptions\n raise DurationParseError, \"An invalid word #{word.inspect} was used in the string to be parsed.\"\n end\n end\n # add '1' at front if string starts with something recognizable but not with a number, like 'day' or 'minute 30sec' \n res.unshift(1) if res.length > 0 && mappings[res[0]] \n res.join(' ')\n end",
"def separated_time_string(seconds, separator)\n secs = seconds % 60\n mins = seconds / 60 % 60\n hours = seconds / 60 / 60 \n time_string = sprintf(\"%02d#{separator}%02d#{separator}%02d\", hours, mins, secs)\n end",
"def time_string(secs)\n dhms = ([secs / 86400] + Time.at(secs).utc.strftime('%H|%M|%S').split(\"|\").map(&:to_i)).zip(['day', 'hour', 'minute', 'second'])\n dhms.shift while dhms[0][0] == 0\n dhms.pop while dhms[-1][0] == 0\n dhms.map! { |(v, s)| \"#{v} #{s}#{v == 1 ? nil : 's'}\" }\n return dhms[0] if dhms.size == 1\n \"#{dhms[0..-2].join(', ')} and #{dhms[-1]}\"\n end",
"def separate_comma__Use_refactored_method_below (num)\n strs = String.new\n num.to_s.reverse.each_char.each_slice(3){|chars| strs << \"#{chars.join},\"}\n strs.chomp(',').reverse\nend",
"def helper_for_parsing_sprint_info obj, arr\n arr.map do |field_num|\n \"#{obj[0].split(',')[field_num].split(\"=\")[1]}\" if obj\n end\n end",
"def separate_comma(integer)\n num_array = integer.to_s.reverse.chars.each_slice(3).to_a\n string_array = num_array.map { |a| a.join.to_s }\n string_array.join(\",\").reverse\nend",
"def format_name(str)\n parts = str.split(\" \")\n print parts\nend",
"def separate_comma(number)\n array = number.to_s.reverse.split(//)\n length = array.length\n\n if length <= 6\n n = 0\n elsif length % 2 == 0\n n = 1\n else\n n = 2\n end\n\n if length < 4\n return array.join.reverse\n elsif length <= 9 \n i = 3 \n while i < length + n do \n array.insert(i, \",\")\n i = i + 4 \n end\n end\n\n return array.join.reverse.to_s\nend",
"def separate_comma(num)\n numarray = num.to_s.chars\n finarray = Array.new\n for i in 0..numarray.length-1\n if i % 3 == 0 && i > 0\n finarray.unshift(numarray.pop + \",\")\n else\n finarray.unshift(numarray.pop)\n end\n end\n return finarray.join\nend",
"def format_duration(secs)\n if !secs\n return ''\n end\n\n [[60, :sec], [60, :min], [24, :hr], [1000, :days]].map{ |count, name|\n if secs > 0\n secs, n = secs.divmod(count)\n \"#{n.to_i} #{name}\"\n end\n }.compact.reverse.join(' ')\n end",
"def separate_comma(num)\n\treturn str if str.length < 4\n\treturn str[0] + \",\" + str[1..3] if str.length < 5\n\treturn str[0..1] + \",\" + str[2..4] if str.length < 6 \n\treturn str[0..2] + \",\" + str[3..5] if str.length < 7\n\treturn str[0] + \",\" + str[1..3] + \",\" + str[4..6] if str.length < 8\n\treturn str[0..1] + \",\" + str[2..4] + \",\" + str[5..7] if str.length < 9\n\tend",
"def separate_comma(num)\n num.to_s.reverse.chars.each_slice(3).to_a.map{|sub_array| sub_array.join }.join(\",\").reverse \nend",
"def separate_comma(num)\n num_array = num.to_s.chars\n\n num_array.each_index do |index|\n if index % 4 == 0\n num_array.insert(-index, \",\")\n end\n end\n num_array[0] = \"\"\n num_array.join(\"\")\nend",
"def separate_comma(num_to_comma)\n str = num_to_comma.to_s\n count = str.length\n if count < 4\n p str\n elsif (count - 1) % 3 == 0\n while count > 1 do\n count = count - 3\n str.insert(count, \",\")\n end\n elsif (count - 2) % 3 == 0\n while count > 2 do\n count = count - 3\n str.insert(count, \",\")\n end\n elsif (count - 3) % 3 == 0\n while count > 3 do\n count = count - 3\n str.insert(count, \",\")\n end\n end\n p str\nend",
"def separate_comma(i)\n num = i.to_s\n if num.length % 3 == 0 && num.length > 3\n (num.length - 3).step(3, -3) {|v| num.insert(v, \",\")}\n elsif num.length > 3\n (num.length - 3).step(0, -3) {|v| num.insert(v, \",\")}\n end\n num\nend",
"def separate_comma(number)\n num = number.to_s\n i = -4\n while i >= (-1 * num.length)\n num.insert(i, ',')\n i -= 4\n end\n p num.to_s\nend",
"def strings(array)\n string = \"\"\n array.each do |word|\n if word == array[-1]\n string << word\n else\n string << word + \", \"\n end\n end\n p string\nend",
"def fields(text) \n p text.split(/[,\\s]+/)\nend",
"def separate_comma (number)\n\nnumber\n.to_s\n.reverse\n.split(\"\")\n.map.with_index {|x, i| ((i+1)%3 == 0 && number.to_s.length - (i+1) > 0 ? x << \",\" : x)}\n.join\n.reverse\n\nend",
"def get_sprints(sprint_strings)\n return [] if sprint_strings.nil?\n sprint_strings.map { |sprint_string| Sprint.new(sprint_string) }\n end",
"def separate_comma(number)\n\tnumber_string = number.to_s\n\tsize = number_string.length\n\n\tif size < 4\n\t\tnumber_string\n\telse\n\t\tarray = number_string.split(//).reverse!\n\t\tcounter = 0\n\t\tnew_array = []\n\n\t\tarray.each do |element|\n\t\t\tnew_array << element\n\t\t\tcounter += 1\n\t\t\tnew_array << \",\" if counter % 3 == 0 && counter < size\n\t\tend\n\t\tnew_array.reverse!.join\n\tend\nend",
"def separate_comma(num)\n\tnum_s = num.to_s\n\tdigits = num_s.length\n\tif digits <= 3\n\t\tnum_s\n\telsif digits % 3 == 0\n\t\tnum_s.scan(/.../).join(\",\")\n\telse\n\t\ti = digits % 3\n\t\tnum_s[0..i-1] + \",\" + num_s[i..-1].scan(/.../).join(\",\")\n\tend\nend",
"def sub_strings(string)\r\n blank = []\r\n idx = 0\r\n while idx < string.length\r\n length = 1\r\n while (idx + length) <= string.length\r\n blank << string.slice(idx, length)\r\n length += 1\r\n end\r\n idx += 1\r\n end\r\n return blank\r\nend",
"def make_sentence parts\n # Join the strings to create a sentence\n # Add spaces after commas and end with a period\n parts.join(' ').gsub(/\\s[,.]/,\" ,\" => \",\", \" .\" => \"\") << \".\"\nend",
"def separate_comma(integer)\n integer = integer.to_s\n length = integer.length\n i = 0\n integer = integer.split(\"\")\n puts integer\n while i < (length - 1)\n if (length - 1) % 3 == 0 && (i % 3 ==0 || i == 0)\n x = integer[i]\n integer[i] = \"#{x}\" + \",\"\n elsif (length - 2) % 3 == 0 && ((i-1) % 3 ==0)\n x = integer[i]\n integer[i] = \"#{x}\" + \",\"\n elsif (length - 3) % 3 == 0 && ((i-2) % 3 ==0)\n x = integer[i]\n integer[i] = \"#{x}\" + \",\"\n end\n i += 1\n end\n puts integer\n integer=integer.join\n p integer\nend",
"def separate_comma(number)\n if number.to_s.length < 3\n puts number\n else number.to_s.length >= 4\n puts number.to_s.chars.to_a.reverse.each_slice(3).map(&:join).join(\",\").reverse\n end\nend",
"def array_from_string string\n # takes the string found when params tries to return an array, and reconstruct the array.\n array = string.split(/[^Q1234567890]+/)\n array.delete(\"\")\n array\n end",
"def separate_comma(num)\n\tnum_string = num.to_s\n\ti = num_string.length\n\t# puts i\n\t# puts num_string\n\treturn num_string if i <= 3\n\twhile i > 0 do #i=5\n\t\t\tnum_string.insert((0-(i+1)),\",\") if i % 3 == 0\n\t\t\tnum_string.delete num_string[0] if num.to_s.length == 6\n\t\t\ti-=1\n\tend\n\tnum_string.slice!(0) if num_string[0].include? \",\"\n\t# puts num_string\n\tnum_string\nend",
"def add_titles_to_video\n\n\t@durations_array = @sentences_to_extract.map{|s| convert_to_duration(s.start_at + (CARD_LENGTH*1000))}\n\n\tp @durations_array\n\t# @durations_array.each |duration|\n\n\t# end\nend",
"def separate_comma(integer)\n\tstring = integer.to_s\n\tif string.length > 3 \n\t\ti = -4\n\t\twhile i >= -string.length\n\t\t\tstring.insert(i, \",\")\n\t\t\ti += -4\n\t\tend\n\tend\n\tstring\nend",
"def make_sentence parts\n index = 1\n parts.delete('.')\n string = parts.join(' ') + '.'\n if string.include?(\" ,\")\n string.gsub!(\" ,\", \",\")\n end\n string\nend",
"def separate_comma ( int )\n int.to_s.split('').to_a().reverse().each_slice(3).to_a.map(&:join).join(\",\").reverse()\nend",
"def separate_comma(num)\n\tnumber = num.to_s\n\tif number.length < 4\n\t\tp number\n\telse\n\t\tnum_of_loops = ((number.length - 1) / 3)\n\t\tposition = -4\n\t\tuntil num_of_loops == 0\n\t\t\tnumber.insert(position, \",\")\n\t\t\tposition -= 4\n\t\t\tnum_of_loops -= 1\n\t\tend\n\tend\n\tp number\nend",
"def separate_comma(number)\n comma_array = number.to_s.chars.reverse.each_slice(3)\n comma_array.map(&:join).join(\",\").reverse\nend",
"def fields(input_fields)\n output = input_fields.gsub(/[\\s,]/ , \" \")\n output_array = output.split\n return output_array\nend",
"def split_on_sentences(speaker, string)\n aa = []\n end_index = 0\n start_index = nil\n text_length = string.length\n while true\n if end_index < text_length\n start_index = end_index\n end_index = string.index(%r{\\.|\\?|!}, end_index)\n end_index ||= text_length\n aa << string[start_index...end_index.next].strip\n end_index += 1\n end\n break unless end_index < text_length\n end\n batch_subs(speaker, aa)\n end",
"def separate_comma(number)\n a = number.to_s.split('')\n b = a.size/3.0\n if a.size < 4\n p number.to_s\n elsif a.size%3 == 0\n n = -4\n (b.to_i-1).times do |i|\n a.insert(n, ',')\n n -= 4\n end\n p a.join(\"\")\n else\n n = -4\n b.to_i.times do |i|\n a.insert(n, ',')\n n -= 4\n end\n p a.join(\"\")\n end\nend",
"def display_movie (movie)\n movie.chomp!\n movie_details = movie.split \",\"\n\n movie_name = movie_details[0]\n movie_duration = movie_details[1]\n movie_rating = movie_details[2]\n\n puts \"\"\n puts \"Name: #{movie_name}\"\n puts \"Duration: #{movie_duration}\"\n puts \"Rating: #{movie_rating}\"\nend",
"def separate_comma(num)\n numbers = num.to_s.split('')\n size = numbers.size/3.0\n if numbers.size < 4\n return num.to_s\n elsif numbers.size%3 == 0\n comma = -4\n (size.to_i-1).times do |x|\n numbers.insert(comma, ',')\n comma -= 4\n end\n strings = ''\n return numbers.join(\"\")\n else\n comma = -4\n size.to_i.times do |x|\n numbers.insert(comma, ',')\n comma -= 4\n end\n return numbers.join(\"\")\n end\nend",
"def separate_comma(number)\n\n array = number.to_s.reverse.split(//)\n length = array.length\n\n if length<=6\n x = 0\n elsif length%2 == 0\n x = 1\n else \n x = 2\n end\n\n\n\n if length < 4\n return array.join.reverse.to_s \n else\n i = 3\n while i < length+n do\n array.insert(i, ',')\n i += 4\n end\n end\n return array.join.reverse.to_s\nend",
"def separate_comma(integer)\n comma_array = []\n array_of_strings = integer.to_s.reverse.split(//)\n array_of_strings.each_slice(3){|triple_digits| comma_array << triple_digits}\n comma_array = comma_array.map{|numbers| numbers.join}\n comma_array.join(\",\").reverse\nend",
"def format_duration(seconds)\n return \"now\" if seconds.zero?\n\n seconds_in = {\n :second => 1,\n :minute => 60,\n :hour => 3_600,\n :day => 86_400,\n :year => 31_536_000\n }\n size_order = [ :year, :day, :hour, :minute, :second ]\n\n out = Array.new\n size_order.each do |t|\n value = seconds / seconds_in[t]\n if value != 0\n out << \"#{value} #{t.to_s}#{\"s\" if value != 1}\"\n seconds -= value * seconds_in[t]\n end\n end\n\n return out[0] if out.length == 1\n out[0...-1].join(\", \") + \" and #{out[-1]}\"\nend",
"def separate_comma(num)\n\tif num < 1000\n\t\tp num.to_s\n\telse\n\tnew_num = []\n num = num.to_s.reverse\n num = num.chars.to_a\n until num.empty?\n new_num << num.shift(3) \n new_num.push(',')\n end\n new_num.pop\n p new_num.join.reverse\n \n end\nend",
"def fields(string)\n string.split(/[,\\t ]+/)\nend",
"def separate_comma(number)\n case number.to_s.length\n when 0..3\n puts number.to_s\n when 4..6\n puts number.to_s.insert(-4,\",\")\n when 7..9\n puts number.to_s.insert(-4,\",\").insert(-8,\",\")\n when 10..12\n puts number.to_s.insert(-4,\",\").insert(-8,\",\").insert(-12,\",\")\n end\nend",
"def separate_comma(num)\n\tstr = num.to_s.split('')\n\tstr.reverse!\n\tcommas = []\n\tcount = 0\n\tstr.each do |i|\n\t\tif count < 3\n\t\t\tcommas.unshift(i)\n\t\t\tcount += 1\n\t\telsif count == 3 \n\t\t\tcommas.unshift(\",\")\n\t\t\tcommas.unshift(i)\n\t\t\tcount = 1\n\t\tend \n\tend\n\tcommas.join(\"\")\nend",
"def spin_words(string)\n string.split()\nend",
"def format_time_h_mm(time_string)\n\t\tresult = ''\n\t\ttime_duration = Time.at(time_string).utc\n\n\t\t#format hours\n\t\tif time_duration.hour > 0\n \t\t\tresult << time_duration.strftime('%k hour')\n \t\t\tif time_duration.hour > 1\n\t\t\t\tresult << 's'\n\t\t\tend\n\t\t\tresult << ', '\n \t\tend\n\n \t\t#format minutes\n \t\tif time_duration.min > 0\n \t\t\tresult << time_duration.strftime('%M minute')\n\t \t\tif time_duration.min > 1\n\t\t\t\tresult << 's'\n\t \t\tend\n \t\tend\n\tend",
"def separate_comma(pos_int)\n string = pos_int.to_s\n case pos_int\n when 0..999\n p string\n\n when 1000..999999\n p string.insert(-4,\",\")\n\n when 1000000..99999999\n p string.insert(-4,\",\").insert(-8,\",\")\n end\n\nend",
"def array_method(string)\n string.join(\" \")\nend",
"def separate_comma(num)\n arr = num.to_s.split(\"\")\n arr = arr.each_index {|x|\n x = -x - 1\n arr = arr.insert(x, \",\") if x % 4 == 0\n }\n return arr.join\nend",
"def separate_comma(number)\n\tstring_number = number.to_s\n\t\n\tif string_number.length <= 3\n\t\treturn string_number\n\telse \n\t\tif string_number.length%3 == 0\n\t\t\tcomma_place = 3\n\t\t\t# if the length of the string is evenly divisible by 3, the first\n\t\t\t# comma goes after the third character in the string\n\t\telse\n\t\t\tcomma_place = string_number.length%3\n\t\t\t# if the length is not evenly divisible by 3, figure out the remainder\n\t\t\t# when you divde by 3 and put the first comma after that character in \n\t\t\t# the string\n\t\tend\n\t\t\t\n\t\tcomma_counter = 0\n\t\t\t\n\t\twhile comma_place < string_number.length\n\t\t\t\tstring_number.insert(comma_place, \",\")\n\t\t\t\tcomma_counter += 1\n\t\t\t\tcomma_place += 3 + comma_counter\n\t\tend\n\t\t\t\t\n\tend\n\n\treturn string_number\n\nend",
"def printArray(array)\n array.flatten!\n string = \"\"\n array.each {|letter| string << \"#{letter},\"}\n string.chomp(\",\")\nend",
"def separate_comma(number)\n a = number.to_s.split('')\n b = a.size/3.0\n if a.size < 4\n number.to_s\n elsif a.size%3 == 0\n n = -4\n (b.to_i-1).times do |i|\n a.insert(n, ',')\n n -= 4\n end\n a.join(\"\")\n else\n n = -4\n b.to_i.times do |i|\n a.insert(n, ',')\n n -= 4\n end\n a.join(\"\")\n end\nend",
"def separate_comma(number)\n\tnumber = number.to_s.split('')\n\tindex = number.length\n\twhile index > 3 do\n\t\t\tnumber.insert(index-3,\",\")\n\t\tindex-=3\n\tend\n\tnumber.join\nend",
"def format_sins(string)\n\n match = string.scan(/(\\s|^)(\\d{3}[-.]{0,1}\\d{3}[-.]{0,1}*\\d{3})(\\D|$)/).transpose[1]\n reformatted = []\n unless match == nil\n match.each do |i|\n i.gsub! /[.-]/,\"\"\n threes = /(...)(...)(...)/.match(i).captures\n reformatted << \"#{threes[0]}-#{threes[1]}-#{threes[2]}\"\n end\n p reformatted\n return\n end\n return string\n end",
"def human_string(array)\n length = array.length\n \n new_string = array[0...-1].join(\", \")\n new_string << \" and #{array[-1]}\"\n \n return new_string\nend",
"def separate_comma(number)\n \n if number == nil\n return nil\n end\n \n arr = number.to_s.reverse.split(//)\n \n \n if arr.length < 7\n j = 0\n \n elsif arr.length % 2 == 0\n j = 1\n else\n j = 2\n end\n \n \n \n if arr.length < 4\n return array.join.reverse.to_s\n \n else\n i = 3\n \n while i < arr.length + j do\n array.insert(i, ',')\n i += 4\n end\n end\n \n return array.join.reverse.to_s\n \nend",
"def split(the_string, position)\n results = [the_string[0, position], the_string[position, the_string.length()]]\nend",
"def separate_comma(i)\n\tif i <=3\n\t\treturn i\n\telse new_i = i.to_s.reverse\n\tarr = []\n\t\tuntil new_i.empty?\n\t \tarr << new_i.slice!(0..2)\n\t end\n\treturn arr.join(\",\").reverse\n\tend\nend",
"def separate_comma(integer)\n number_string = integer.to_s\n char_count = integer.to_s.length\n\n if char_count > 3\n\n -4.step((-char_count - 1), -4) do |x|\n number_string.insert(x, \",\")\n end\n\n return number_string\n else\n return number_string\n end\nend",
"def pirates_say_arrrrrrrrr(string)\n\tarray_1 = string.downcase.split\"\"\n\tarray_2 = []\n\nloop do \n\tarrr = array_1.index(\"r\")\n\tbreak if arrr == nil\n\tarray_1.delete_at(arrr)\n\tarray_2 << array_1[arrr]\n\t\nend\n\narray_2.join\n\nend",
"def separate_comma(positive_int)\n\n string = positive_int.to_s\n i = -4\n\n until i <= 0 - (string.length + 1)\n string = string.insert(i,\",\")\n i -= 4\n end\n\n return string\nend",
"def pirates_say_arrrrrrrrr(string)\n array = string.split(\"\")\n collection = []\n \n for i in 0...(array.length) do\n #puts \"#{i} 1\"\n if array[i] == \"r\" || array[i] == \"R\" then\n #puts \"#{i} 2\"\n collection << array[i + 1]\n end\n end\n\n collection.join\nend",
"def format_ssns(string)\n ssn_array = grab_all_ssns(string)\n ssn_array.map do |ssns|\n new_array = ssns.split('')\n new_array.delete_if { |str| str =~ /\\D/ }\n new_array.insert(3, \"-\")\n new_array.insert(6, \"-\")\n new_array = new_array.join\n ssn_array = new_array\n end\n ssn_array\n # binding.pry\nend",
"def separate_comma(num)\n num_s = num.to_s\n\n if num_s.length <= 3\n return num_s\n else\n i = -4\n until i < -num_s.length\n num_s.insert(i,\",\")\n i -= 4\n end\n return num_s\n end\nend",
"def separate_comma(value)\n\t\treturn value.to_s unless value.to_s.length > 4 #return value as string unless length > 4\n\t\t\n\t\ttempChars = value.to_s.chars #converts value to a string, then to array of chars\n\t\tindexFromEnd = -4 #using a negative index to insert() a comma from the end of the array of chars, insert() puts a comma in AFTER the specified index\n\t\t\n\t\twhile indexFromEnd.abs <= tempChars.length #while the absolute value of index is less than the length of the chars array\n\t\t\ttempChars.insert(indexFromEnd,',') #inserts a comma at the specified negative index\n\t\t\tindexFromEnd -= 4 #decrements index to insert the next comma into the string\n\t\tend\n\t\ttempChars.join #returns array of chars with commas join()ed into one string\nend",
"def separate_comma(num)\n\tnum.to_s.reverse.chars.to_a.each_slice(3).to_a.map {|value|\n\t\tvalue.join(\"\")\n\t}.join(\",\").reverse\nend",
"def separate_comma(num)\n\tnum.to_s.reverse.chars.to_a.each_slice(3).to_a.map {|value|\n\t\tvalue.join(\"\")\n\t}.join(\",\").reverse\nend",
"def separate_comma(number)\n comma_separated_number = number.to_s.reverse.split('').each_slice(3).map {|obj| obj.push(\",\") }.join.chop.reverse\nend",
"def substrings_at_start(string)\n string_array = string.chars\n array_final = []\n\n 1.upto(string.size) do |count|\n array_final << string_array.slice(0, count).join\n end\n array_final\nend",
"def separate_comma(number)\n\treturn number.to_s if number < 1000\n\tarr_string = number.to_s.split(\"\")\n\tnew_string = \"\"\n\tif number >= 1000 && number <= 9999\n\t\tarr_string.map! do |n|\n\t\t\tif arr_string.index(n) == 0\n\t\t\t\tnew_string << n + \",\"\n\t\t\telse\n\t\t\t\tnew_string << n\n\t\t\tend\n\t\tend\n\telsif number >= 10000 && number <= 99999\n\t\tarr_string.map! do |n|\n\t\t\tif arr_string.index(n) == 1\n\t\t\t\tnew_string << n + \",\"\n\t\t\telse\n\t\t\t\tnew_string << n\n\t\t\tend\n\t\tend\n\telsif number >= 100000 && number <= 999999\n\t\tarr_string.map! do |n|\n\t\t\tif arr_string.index(n) == 2\n\t\t\t\tnew_string << n + \",\"\n\t\t\telse\n\t\t\t\tnew_string << n\n\t\t\tend\n\t\tend\n\telsif number >= 1000000 && number <= 9999999\n\t\tarr_string.map! do |n|\n\t\t\tif arr_string.index(n) == 0 || arr_string.index(n) == 3\n\t\t\t\tnew_string << n + \",\"\n\t\t\telse\n\t\t\t\tnew_string << n\n\t\t\tend\n\t\tend\t\n\telsif number >= 10000000 && number <= 99999999\n\t\tarr_string.map! do |n|\n\t\t\tif arr_string.index(n) == 1 || arr_string.index(n) == 4\n\t\t\t\tnew_string << n + \",\"\n\t\t\telse\n\t\t\t\tnew_string << n\n\t\t\tend\n\t\tend\n\tend\n\tnew_string\t\nend",
"def separate_comma(integer)\n\tinteger = integer.to_s\n\ti = -4\n\tif integer.length <= 3\n\t\tp integer\n\telse\n\t\twhile i.abs <= integer.length\n\t\t\tinteger.insert(i,\",\")\n\t\t\ti -= 4\n\t\tend\n\tend\n\tp integer\nend",
"def timeConversion(s)\n #\n # Write your code here.\n #\n split = s.split(\":\")\n pm = split[2][-2,2]\n split[2] = split[2][0,2]\n if pm == \"AM\" && split[0] == \"12\"\n split[0] = 00\n end\n if pm == \"PM\"\n split[0] = split[0].to_i + 12\n if split[0] == 24\n split[0] = 12\n end\n end\n\n split[0] = split[0].to_s.rjust(2,\"0\")\n split[1] = split[1].to_s.rjust(2,\"0\")\n split[2] = split[2].to_s.rjust(2,\"0\")\n\n p split.join(\":\")\nend"
] |
[
"0.5394821",
"0.5392412",
"0.53802735",
"0.53696316",
"0.5271568",
"0.525917",
"0.5206748",
"0.5192149",
"0.5184887",
"0.5177218",
"0.5157017",
"0.51315856",
"0.51269263",
"0.5062674",
"0.5057844",
"0.5055729",
"0.5043236",
"0.50301117",
"0.5020443",
"0.49807832",
"0.497843",
"0.4975634",
"0.49734747",
"0.49575028",
"0.49575028",
"0.49575028",
"0.49575028",
"0.49447227",
"0.4935398",
"0.49255276",
"0.49244964",
"0.48972276",
"0.48952267",
"0.4895059",
"0.48857632",
"0.4885307",
"0.48769394",
"0.48661703",
"0.4862613",
"0.48564574",
"0.4844713",
"0.48317206",
"0.48203534",
"0.48179883",
"0.48177752",
"0.48144397",
"0.4805944",
"0.48057944",
"0.48003525",
"0.47991538",
"0.47988307",
"0.47934183",
"0.47926834",
"0.47919202",
"0.4790108",
"0.47881496",
"0.47876316",
"0.47846198",
"0.4782108",
"0.47791442",
"0.47787237",
"0.4777754",
"0.47744137",
"0.47726303",
"0.47659096",
"0.4761023",
"0.47491822",
"0.47473854",
"0.47454816",
"0.47351852",
"0.47298154",
"0.47290212",
"0.47200876",
"0.47182378",
"0.4716133",
"0.47137764",
"0.47106606",
"0.4707025",
"0.47044885",
"0.47002545",
"0.46946824",
"0.46921226",
"0.46918812",
"0.46862108",
"0.46842188",
"0.46820632",
"0.46803325",
"0.46800852",
"0.46792287",
"0.46768767",
"0.46737343",
"0.46734336",
"0.46729022",
"0.46712336",
"0.46712336",
"0.46672693",
"0.4667103",
"0.46650913",
"0.46645054",
"0.46625265"
] |
0.6095845
|
0
|
printStringFont(printMe, duration) Passed a string and a duration, the code creates an array
|
def printStringRandomFont(printMe, duration)
x = printMe.split(", ")
currentTime = Time.now.to_i
futureTime = currentTime + duration
while (currentTime <= futureTime) do
print "#{isMe(onMe("\n#{returnFont(x[$prng.rand(0...x.length())])}\n\n"))}"
currentTime = Time.now.to_i
end
menu()
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def printRandomFont(duration)\n st = \"A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,0,1,2,3,4,5,6,7,8,9\"\n x = st.split(\",\")\n currentTime = Time.now.to_i\n futureTime = currentTime + duration\n while (currentTime <= futureTime)do\n print \"#{isMe(onMe(\"\\n#{returnFont(x[$prng.rand(0...x.length())])}\\n\\n\"))}\"\n currentTime = Time.now.to_i\n end\n menu()\nend",
"def time_to_font(time,font)\n output = []\n for i in 0...time.length()\n converted_font = convert_1_number_to_1_font(time[i],font)\n output.append(converted_font)\n end\n return output\nend",
"def printStringS(printMe, duration)\n x = printMe.split(\", \")\n currentTime = Time.now.to_i\n futureTime = currentTime + duration\n while (currentTime <= futureTime) do\n print \"#{isMe(onMe(x[$prng.rand(0...x.length())]))}\"\n currentTime = Time.now.to_i\n end\n menu()\nend",
"def draw_string_array(instructions, start_x, start_y, max_width)\n draw_string_y = start_y\n string_height = 20\n instructions_font = Gosu::Font.new(string_height)\n instructions.each do |instruction|\n wrapped_instruction = wrap_string(instruction, instructions_font, max_width)\n instructions_font.draw_text(wrapped_instruction[0],\n start_x,\n draw_string_y,\n 1)\n draw_string_y += string_height * (wrapped_instruction[1] + 1)\n end\nend",
"def loading_screen(string) \n string.length.times do |i| # Iterates over each index in a given string\n # Clear the screen to provide an animated effect.\n clear\n \n # Please wait header \n puts HEADER_LINE\n puts \"Please Wait...\".upcase.center(HEADER_LENGTH)\n puts HEADER_LINE\n puts\n \n # Displays all characters in the string up to the index being iterated over.\n puts string[0, i].center(HEADER_LENGTH)\n sleep(0.2)\n end\nend",
"def play_name_animation(name)\n 3.times do |i|\n puts \"\\e[H\\e[2J\" \n letterify_name(name)\n sleep(0.3)\n puts \"\\e[H\\e[2J\" \n blankify_name(name)\n sleep(0.3)\n end\nend",
"def another_print_fonts\n for index in 0..@fonts.size do\n puts \"#{index} -> #{@fonts[index]}\" # use of templating\n end\nend",
"def subtitle_print(words)\n title = Artii::Base.new :font => 'slant'\n puts title.asciify(words).colorize(:blue)\n end",
"def draw_text(xp, yp, step, strs, draw, canvas) # xp,yp is X,Y position. draw is the drawing method, canvas is where to draw on\n for str in strs\n yp = yp + step\n draw.annotate(canvas,647,600,xp,yp,str){\n draw.fill = '#ddd'\n draw.stroke = 'transparent'\n draw.pointsize = 20\n # self.font = \"BS.ttf\" \n draw.font = $config[\"fonts\"][3] \n }\n end\n return yp\nend",
"def process_name(c, pos)\n c = WiggleText::NAMES[c]\n text_width = text_size(c).width\n if defined? Graphics.fullscreen #MKXP fix\n text_width += text_width * 0.6\n text_width = text_width.round\n end\n letter = Sprite_TextAnim.new(self.viewport)\n bitmap = Bitmap.new(text_width, 12)\n letter.bitmap = bitmap\n letter.x = 23\n letter.y = self.y - 10\n letter.z = self.z + 10\n letter.anim_offset = @animchars.size\n letter.anim_type = 7 #@anim_type\n tuckie_extra(letter)\n letter.update\n bitmap.draw_text(0, 0, 10, 12, c)\n @animchars.push(letter)\n end",
"def returnFont(str)\n case $prng1.rand(1..5)\n# when 1\n# $fontFont = TTY::Font.new(\"3d\")\n# return $fontFont.write(str)\n when 2\n $fontFont = TTY::Font.new(:doom)\n return $fontFont.write(str)\n when 3\n $fontFont = TTY::Font.new(:standard)\n return $fontFont.write(str)\n when 4\n $fontFont = TTY::Font.new(:starwars)\n return $fontFont.write(str)\n when 5\n $fontFont = TTY::Font.new(:straight)\n return $fontFont.write(str)\n else\n $fontFont = TTY::Font.new(:standard)\n return $fontFont.write(str)\n end\nend",
"def string_flasher(string, difficulty, height, width, score)\n difficulty[5].times do\n clear\n puts score_display(score, difficulty)\n random_cursor(height, width)\n puts string.colorize(selector(@@colours))\n sleep(difficulty[6])\n end\n end",
"def draw_playtime(x, y, width, align)\n hour = @total_sec / 60 / 60\n min = @total_sec / 60 % 60\n sec = @total_sec % 60\n time_string = sprintf(\"%02d:%02d:%02d\", hour, min, sec)\n self.contents.font.color = normal_color\n self.contents.draw_text(x, y, width, WLH, time_string, 2)\n end",
"def loading_screen(string) \n string.length.times do |i|\n clear\n \n # Please wait header \n puts HEADER_LINE\n puts \"Please Wait...\".upcase.center(HEADER_LENGTH)\n puts HEADER_LINE\n puts\n puts string[0, i].center(HEADER_LENGTH)\n sleep(0.2)\n end\nend",
"def frame(text, char)\n\n longest_word_length = (text.map { |w| w.length }.max)\n frame_width = longest_word_length + 4\n\n frame_top_bottom = char*(frame_width)\n frame_arr = []\n\n #top of frame\n frame_arr.push(\"#{frame_top_bottom}\\n\")\n\n #middle of frame (content and the sides of the frame)\n text.each do |word|\n diff = longest_word_length - word.length\n spaces = ' '*diff\n frame_arr.push(\"#{char} #{word} #{spaces}#{char}\\n\")\n end\n\n #bottom of frame\n frame_arr.push(\"#{frame_top_bottom}\")\n frame_arr.join\nend",
"def printRandom(duration)\n st = \"q,w,e,r,t,y,u,i,o,p,a,s,d,f,g,h,j,k,l,z,x,c,v,b,n,m,Q,W,E,R,T,Y,U,I,O,P,A,S,D,F,G,H,J,K,L,Z,X,C,V,B,N,M,1,2,3,4,5,6,7,8,9,0,!,@,#,$,%,^,&,*,(,),_,+,[,],|,{,}\"\n x = st.split(\",\")\n currentTime = Time.now.to_i\n futureTime = currentTime + duration\n while (currentTime <= futureTime) do\n print \"#{isMe(onMe( x[$prng.rand(0...x.length())] ))}\"\n currentTime = Time.now.to_i\n end\n menu()\nend",
"def print *textarray\n create_window unless @win\n show unless @visible\n c = 1\n textarray.each_with_index { |s, i| \n @win.printstring i+@row_offset, c+@col_offset, \"%-*s\" % [@w-(@col_offset*2)-c, s], @color_pair\n }\n @win.wrefresh\n end",
"def printStrings strArr, maxLength\n strArr.each_with_index do |str, i|\n # center strings, add spaces on left to add shifting effect\n puts ' ' * i * 2 + str.center(maxLength)\n end\nend",
"def draw_ascii(pattern, width)\n for i in 0...(pattern.size-width+1)\n puts pattern.slice(i, width).join\n end\nend",
"def draw\n unless DEBUG_PRINT_WAIT.nil?\n @string = get_debug_string\n end\n @hud_font.draw_text(@string, 16, 16, 100, 1, 1, 0xff_000000, :default)\n end",
"def display_text\n\t\t\t#specifying font to be used\n\t\t\t#text_font @font, 16\n\t\t\t#text \"Mmmmm ... Strings .... \", 10, 100\n\t\tend",
"def frame(text, char)\n width = text.max { |a,b| a.length <=> b.length }.size + 4\n output = \"\" << \"#{char}\" * width << \"\\n\"\n text.each { |line| output << \"#{char} #{line}\" << \"%0#{width - line.size - 2}s\" % char << \"\\n\" }\n output << \"#{char}\" * width\nend",
"def anim(string)\n \n string.each_char do |n|\n \n \n print n \n \n \n slt =rand(0.02..0.08)\n sleep(slt) \n end\n print \"\\n\"\nend",
"def show_time(string)\n return unless string && timing?\n\n if @@message_callback\n @@message_callback.call(:info, string)\n else\n $stderr.puts \"#{GREEN}#{string}#{RESET}\"\n end\n end",
"def wave_display\n font_big = TTY::Font.new(:doom)\n font_col = Pastel.new\n case $current_lvl\n when $lvl_1\n puts font_col.red(font_big.write(\"WAVE 1\"))\n when $lvl_2\n puts font_col.red(font_big.write(\"WAVE 2\"))\n when $lvl_3\n puts font_col.red(font_big.write(\"WAVE 3\"))\n end\nend",
"def frame(text, char)\n length = text.max{|x| x.length}.length + 4\n ret=[]\n ret.push(char*length)\n\n text.each{|x| ret.push(\"#{char} #{x}#{\" \"*(x.length+4-(length))} #{char}\")}\n ret.push(char*length)\n ret.each{|x| puts x}\nend",
"def loading\n chars = %w[| / ― \\\\]\n fps = 10\n delay = 1.0/fps\n\n fps.round.times do |i|\n print chars[ i % chars.length]\n sleep delay\n print \"\\b\"\n end\nend",
"def draw\n return if @destoryed\n return unless @verbose\n unless DEBUG_PRINT_WAIT.nil?\n @string = get_debug_string\n end\n @hud_font.draw_text(@string, $program.width - 200, $program.height - 300, 100, 1, 1, 0xff_000000, :default)\n end",
"def animate(text: 'Downloading')\n\tt = Thread.new {\n\t\ti = 0\n\t\tlen = text.length\n\t\tchars = %W(\\u2802 \\u2812 \\u2832 \\u2834 \\u2826)\n\n\t\twhile true\n\t\t\ti += 1\n\t\t\ti_m_l = i % len\n\n\t\t\tprint \"\\e[2K #{chars.rotate![0]} #{text[0...i_m_l]}#{text[i_m_l].swapcase}#{text[i_m_l + 1..-1]}\\r\"\n\t\t\tsleep 0.1\n\t\tend\n\t}\n\n\tv = yield\n\tt &.kill\n\tputs\n\treturn v\nend",
"def show_text(string) # Tj\n raise PDF::Reader::MalformedPDFError, \"current font is invalid\" if current_font.nil?\n at = transform(Point.new(0,0))\n @content[at.y] ||= \"\"\n @content[at.y] << current_font.to_utf8(string)\n end",
"def add_titles_to_video\n\n\t@durations_array = @sentences_to_extract.map{|s| convert_to_duration(s.start_at + (CARD_LENGTH*1000))}\n\n\tp @durations_array\n\t# @durations_array.each |duration|\n\n\t# end\nend",
"def strftime(p0) end",
"def call\n if words.size < 3\n color_size = 3\n elsif words.size > 9\n color_size = 9\n else\n color_size = words.size\n end\n\n # This will raise an exception if you pass a color ramp that doesn't\n # exist in ColorBrewer.\n colors = ColorBrewer::SEQUENTIAL_COLOR_SCHEMES[color_size].fetch(color)\n\n # Write out to PDF and return the PDF\n pdf_with_header(header: header) do |pdf|\n # Get the path to the font file itself. Again, it'll raise if you\n # pass a bad font.\n font_path = pdf.font_families.fetch(font)[:normal]\n\n # Get our point sizes for each word\n range = (words.values.min..words.values.max)\n words_to_points = words.each_with_object({}) do |(word, freq), ret|\n ret[word] = point_size_for(frequency_range: range,\n frequency: freq)\n end\n\n # Build the canvas and place the words\n canvas = Canvas.new(words: words_to_points, font_path: font_path)\n positions = words_to_points.each_with_object({}) do |(word, size), ret|\n ret[word] = [canvas.place_word(word: word, size: size), size]\n end\n\n pdf.font(font)\n\n # Compute how much space we have and how we should scale from our\n # canvas to the PDF\n space_x = pdf.bounds.width\n space_y = pdf.bounds.height - 18 - 20\n\n scale_x = space_x / canvas.width\n scale_y = space_y / canvas.height\n scale = [scale_x, scale_y].min\n\n # Center the block of text. Which of these dimensions is larger is\n # stochastic, so don't care about test coverage\n x_offset = y_offset = 0\n # :nocov:\n if scale == scale_x\n y_offset = (space_y - scale * canvas.height) / 2\n else\n x_offset = (space_x - scale * canvas.width) / 2\n end\n # :nocov:\n\n # Draw all the words, stroked in the darkest color from the color\n # scheme\n pdf.stroke_color(colors.last[1, 6])\n pdf.line_width(0.25)\n\n positions.each_with_index do |(word, (pos, size)), i|\n pdf.fill_color(colors[i % colors.size][1, 6])\n pdf.text_rendering_mode(:fill_stroke) do\n pdf.draw_text(word, size: size * scale,\n at: [pos[0] * scale + x_offset,\n pos[1] * scale + y_offset])\n end\n end\n end\n end",
"def print_info(s)\n puts Time.now.localtime.strftime(\"[%k:%M:%S]\")+'[*]'.blue+' '+s\nend",
"def print_over(s)\n time = Time.now.localtime.strftime(\"[%k:%M:%S]\")\n print \"\\r#{time}\"+\"[*]\".blue+\" #{s}\"\nend",
"def hamstrings_stretch\n \"Remaining seated, extend one leg outward. Reach toward your toes. Hold for 10 to 30 seconds. Repeat on the other side. Be sure to do this one leg at a time, as doing this exercise with both legs out can cause back issues.\"\nend",
"def draw s, delay = nil\n puts s # note if s is array, it is joined with \"\\n\"\n if delay\n puts \"wait #{delay}\"\n end\n puts \"update\"\n $stdout.flush\nend",
"def format(human_timestamp, line_array, offset)\n human_timestamp.getlocal.strftime('%Y-%m-%d %H:%M:%S%z') + ' ' + line_array[offset..-1].join(' ')\nend",
"def kgb \n \n anim_two(\" \n ▄█ ▄█▄ ▄██████▄ ▀█████████▄ \n ███ ▄███▀ ███ ███ ███ ███ \n ███▐██▀ ███ █▀ ███ ███ \n ▄█████▀ ▄███ ▄███▄▄▄██▀ \n ▀▀█████▄ ▀▀███ ████▄ ▀▀███▀▀▀██▄ \n ███▐██▄ ███ ███ ███ ██▄ \n ███ ▀███▄ ███ ███ ███ ███ \n ███ ▀█▀ ████████▀ ▄█████████▀ \n ▀ \".colorize(:blue) +\n \n \" \n \n ┬ ┬┌─┐┌─┐┌┬┐┌─┐ ┬ ┬┌─┐┬─┐┌┬┐┌─┐┬─┐┌─┐\n ├─┤├┤ ├─┤ │││─┼┐│ │├─┤├┬┘ │ ├┤ ├┬┘└─┐\n ┴ ┴└─┘┴ ┴─┴┘└─┘└└─┘┴ ┴┴└─ ┴ └─┘┴└─└─┘\n\n \")\n puts' Донжт интерфере ин оур интернал аффаирс. Лет ус странгле оур цитиизенс ин пеацер.\n (\"Don\\'t interfere in our internal affairs. We are playing Counter Strike this week.\")'.colorize(:red) \n puts \"\\n\"\n anim_two( \" The KGB has declined any involvement in the assistance of dealing with this virus \")\n puts\" \n \n \"\n puts \"\\n\"\n egg1 = [@easter_egg[0]]\n result_egg1 = @prompt.collect do\n key(:answer).select(\"Press Enter:\", egg1)\n end\n\n puts `clear`\n\n egg_result = result_egg1.values.join\n\n \n \n if egg_result = @easter_egg[0]\n plane_moving_anim()\n else puts \"goodbye\"\n end\n \n end",
"def title str, color=0, att=BOLD\n ## save so we can repaint if required\n @title_data = [str, color, att]\n strl = str.length\n col = (@width - strl)/2\n printstring(0,col, str, color, att)\n end",
"def credits(text, speed, name, size, color, bold, italic, outline, shadow)\r\n #reset original position\r\n self.ox = self.oy = 0\r\n #flag bitmap for disposal\r\n @text_flag = true\r\n #get the text array\r\n text = text.split(\"\\n\")\r\n #setup the bitmap\r\n bitmap_size = 0\r\n font_size = size\r\n #check each line\r\n text.each do |line|\r\n #if it is a font changing line\r\n if line =~ /font_(\\w*)\\((.*)\\)/\r\n #change font size if needed\r\n font_size = $2.to_i if $1 == 'size'\r\n #skip bitmap size increment\r\n next\r\n end\r\n #increase the bitmap size by the font size\r\n bitmap_size += (font_size + 10)\r\n end\r\n self.bitmap = Bitmap.new(640, bitmap_size)\r\n #setup font\r\n self.bitmap.font.name = name\r\n self.bitmap.font.size = size\r\n self.bitmap.font.color = color\r\n self.bitmap.font.bold = bold\r\n self.bitmap.font.italic = italic\r\n @outline = outline\r\n @shadow = shadow\r\n #location to draw the text\r\n y = 0\r\n #loop through each line of text\r\n text.each do |line|\r\n #adjust the font if needed\r\n if line =~ /font_(\\w*)\\(['\"]?(\\w*)['\"]?,?(\\d*),?(\\d*),?(\\d*)\\)/\r\n case $1\r\n when 'name'\r\n self.bitmap.font.name = $2\r\n when 'size'\r\n self.bitmap.font.size = $2.to_i\r\n when 'color'\r\n self.bitmap.font.color = Color.new($2.to_i,$3.to_i,$4.to_i,$5.to_i)\r\n when 'bold'\r\n eval(\"self.bitmap.font.bold = #{$2}\")\r\n when'italic'\r\n eval(\"self.bitmap.font.italic = #{$2}\")\r\n when 'outline'\r\n eval(\"@outline = #{$2}\")\r\n when 'shadow'\r\n eval(\"@shadow = #{$2}\")\r\n end\r\n next\r\n end\r\n #draw the text\r\n draw_text(0, y, 640, self.bitmap.font.size, line, 1)\r\n #increment the next drawing location\r\n y += (self.bitmap.font.size + 10)\r\n end\r\n #move to the bottom of the screen and set the scrolling speed\r\n self.y = 480\r\n @scroll_speed = speed\r\n #return the time taken to scroll to the end\r\n return (bitmap_size + 480) / speed\r\n end",
"def convert_font_args(params)\n return unless params\n font = {\n :_name => params[:name],\n :_color => params[:color],\n :_size => params[:size],\n :_bold => params[:bold],\n :_italic => params[:italic],\n :_underline => params[:underline],\n :_pitch_family => params[:pitch_family],\n :_charset => params[:charset],\n :_baseline => params[:baseline] || 0\n }\n\n # Convert font size units.\n font[:_size] *= 100 if font[:_size] && font[:_size] != 0\n\n font\n end",
"def textReport(psdFiles)\n textData = Array.new\n\n psdFiles.each do |psdFile|\n name = File.basename(psdFile)\n PSD.open(psdFile) do |psd|\n puts \"\\n[ #{name} ] Text Report =================================== \\n\\n\"\n psd.layers.each do |layer|\n textRaw = layer.adjustments[:type]\n textString = textRaw.to_s()\n\n fontRaw = layer.text\n fontString = fontRaw.to_s()\n fontstring = fontString.gsub!(':font=>{:name=>\"', \"spliter\")\n fontstring = fontString.gsub!('\", :sizes=>[', \"spliter\")\n fontstring = fontString.gsub!('], :colors=>[', \"spliter\")\n fontstring = fontString.gsub!(';\\ncolor: ', \"spliter\")\n fontstring = fontString.gsub!(';\"}, :left=>', \"spliter\")\n fontArray = fontString.split(\"spliter\")\n\n fontName = fontArray[1].to_s()\n fontSize = fontArray[2].to_s()\n fontColor = fontArray[4].to_s()\n\n if textString == \"\"\n else\n textData.push(\"\\n#{textString}\\n=> #{fontName} | #{fontSize}px | #{fontColor}\")\n end\n end\n end\n textDataClean = textData.uniq\n textDataClean.each do |d|\n puts d\n end\n end\nend",
"def sounds_for_time(time, args={})\n format = args.delete(:format) || 'dMYaHm'\n result = []\n format.each_char do |c|\n result += send(\"parse_#{FORMAT_TABLE[c]}\".to_sym, time)\n end\n result\n end",
"def formatrun(io)\n ich, ifnt = io.read(4).unpack('vv')\n\n {\n ich: ich, # ich (2 bytes): An unsigned integer that specifies the zero-based index of the first character of the text that contains the text run.\n ifnt: ifnt # ifnt (2 bytes): A FontIndex structure that specifies the font. If ich is equal to the length of the text, this record is undefined and MUST be ignored.\n }\n end",
"def draw_text(line, string, even_text = false, width = nil)\n return if line <= 0\n y = 32 * line - 32\n if even_text\n if width != nil\n draw_even_text(0, y, width, 32, string)\n else\n draw_even_text(0, y, @width, 32, string)\n end\n else\n self.contents.draw_text(0, y, @width, 32, string)\n end\n end",
"def print\n \"#{id}-#{start}-#{duration}-#{body}\"\n end",
"def draw\r\n @font.draw_text(\"No Longer Human!\", 50,50,0)\r\n end",
"def draw_sample\n \t\" #{@sample[:space_1]} | #{@sample[:space_2]} | #{@sample[:space_3]}\\n\" +\n \t\t\t\t\t \" _____|_____|____\\n\" +\n \t\" #{@sample[:space_4]} | #{@sample[:space_5]} | #{@sample[:space_6]}\\n\" +\n \t\t\t\t\t \" _____|_____|____\\n\" +\n \t\" #{@sample[:space_7]} | #{@sample[:space_8]} | #{@sample[:space_9]}\\n\" +\n \t\t\t\t\t\t \" | | \\n\\n\"\n\n end",
"def draw_text(text, x, y, z, scale_x = 1.0, scale_y = 1.0, \r\n color = Gosu::Color.new(255,255,255), mode = :default)\r\n\r\n # Draw the font at the requested location\r\n @font.draw(text,\r\n x,\r\n y,\r\n z,\r\n scale_x = 1.0,\r\n scale_y = 1.0,\r\n color = Gosu::Color.new(0,255,255),\r\n mode = :default)\r\n end",
"def process_anim_character(c, pos)\n text_width = text_size(c).width\n if defined? Graphics.fullscreen #MKXP fix\n text_width += text_width * 0.6\n text_width = text_width.round\n end\n letter = Sprite_TextAnim.new(self.viewport)\n bitmap = Bitmap.new(text_width, pos[:height])\n letter.bitmap = bitmap\n letter.x = pos[:x] + self.standard_padding\n letter.y += WiggleText::DROP_HEIGHT if WiggleText::DROP_IN\n letter.y = self.y + standard_padding + pos[:y] + 2\n letter.z = self.z + 10\n letter.anim_offset = @animchars.size\n letter.anim_type = @anim_type\n tuckie_extra(letter)\n letter.update\n bitmap.draw_text(0, 0, 10, pos[:height], c)\n @animchars.push(letter)\n pos[:x] += text_width\n end",
"def text s, x, y, c, f = font\n f.draw_solid_utf8 screen, s, x, y, *rgb[c]\n end",
"def format_text(title, url, url_title_time_ary)\n s = \"Title: #{title}¥nURL: #{url}¥n¥n\"\n url_title_time_ary.each do |aurl, atitle, atime|\n s << \"* (#{atime})#{atitle}¥n\"\n s << \" #{aurl}¥n\"\n end\n s\nend",
"def run\n file = \"english.srt\"\n times = parse_times file\n build_ffmpeg times, file\nend",
"def print_example\n for font in $pretty_fonts do\n puts font\n converter = PrettyConverter.new font\n for ch in (('a'..'z').to_a + ('A'..'Z').to_a) do\n print(converter.convert_char ch)\n end\n print \"\\n\"\n end\nend",
"def print(string, _width = @content_cols)\n #return unless visible?\n w = _width == 0? Ncurses.COLS : _width\n FFI::NCurses.waddnstr(@pad,string.to_s, w) # changed 2011 dts \n end",
"def print_out(style, input)\n move_down style[:upper_space]\n font style[:font_variable], :style => $headline_chapter_font_style\n font_size style[:font_size_variable]\n text input\nend",
"def print(string, width = self.width)\n w = width == 0? Ncurses.COLS : width\n waddnstr(string.to_s, w) # changed 2011 dts \n end",
"def text s, x, y, c, f = font\n f.draw_solid_utf8 screen, s, x, self.h-y-f.height, *rgb[c]\n end",
"def text(s, x, y, color=0xffffffff)\n color = sym_color(color) if color.is_a? Symbol\n @font.draw(s, x, y, 0, 1, 1, color)\n end",
"def draw_text(x, y, text, options = {})\n options[:font_color] ||= RFPDF::COLOR_PALETTE[:black]\n options[:font] ||= default_font\n options[:font_size] ||= 10\n options[:font_style] ||= ''\n set_text_color_a(options[:font_color], options[:colorspace])\n SetFont(options[:font], options[:font_style], options[:font_size])\n SetXY(x, y)\n Write(options[:font_size] + 4, text)\n end",
"def line(text, length=20)\n puts \"-\" * length\n puts text \nend",
"def debug fmt, *args\n s = fmt % args\n text s, 10, h-40-font.height, :white\n end",
"def update_text_animation()\n unless @animchars.empty?\n @animchars.each do |letter|\n letter.update\n end\n end\n end",
"def each_phrase(length, text_array=nil)\n text_array ||= @text_array\n length = length.to_i\n max_index = text_array.length - length\n (0..max_index).each do |index|\n yield text_array.slice(index, length).join(' ')\n end\n end",
"def text(data, ts, te, soff = 0)\n [copy(data, ts-soff..te-1), ts-soff, te]\n end",
"def text(data, ts, te, soff = 0)\n [copy(data, ts-soff..te-1), ts-soff, te]\n end",
"def draw\n @font.draw(@text, @x, @y, 0, 1, 1, @color)\n end",
"def pirates_say_arrrrrrrrr(string)\n last_letter_r = false\n array = []\n string.size.times { |x|\n string_letter = string[x]\n array << string_letter if last_letter_r\n last_letter_r = (string_letter == \"r\" || string_letter == \"R\") }\n array.join(\"\")\nend",
"def convert_1_number_to_1_font(number,font)\n if number == \"0\"\n return font[0]\n end\n if number == \"1\"\n return font[1]\n end\n if number == \"2\"\n return font[2]\n end\n if number == \"3\"\n return font[3]\n end\n if number == \"4\"\n return font[4]\n end\n if number == \"5\"\n return font[5]\n end\n if number == \"6\"\n return font[6]\n end\n if number == \"7\"\n return font[7]\n end\n if number == \"8\"\n return font[8]\n end\n if number == \"9\"\n return font[9]\n end\n if number == \":\"\n return font[-1]\n end\nend",
"def wait_animation(message, time_seconds)\n print message\n print \" [ ]\"\n STDOUT.flush\n time_seconds.downto(1) do\n 1.upto(4) do |i|\n next_output = \"\\b\\b\\b\\b\\b\\b\\b\"\n case\n when i % 4 == 0\n next_output += \"[ = ]\"\n when i % 3 == 0\n next_output += \"[ = ]\"\n when i % 2 == 0\n next_output += \"[ = ]\"\n else\n next_output += \"[ = ]\"\n end\n\n print next_output\n STDOUT.flush\n sleep(0.25)\n end\n end\n # remove loading animation\n print \"\\b\\b\\b\\b\\b\\b\\bRefreshing...\"\n STDOUT.flush\n puts\n end",
"def print_logo()\n sleep(0.2)\n line = \"===================================================\\n\"\n text = [\" _____ _ _ _ ____ _ _ \", \"| __ \\\\ | | (_)| || _ \\\\ (_)| |\", \"| |__) || |__ _ | || |_) | _ __ __ _ ___ _ | |\", \"| ___/ | '_ \\\\ | || || _ < | '__|/ _` |/ __|| || |\", \"| | | | | || || || |_) || | | (_| |\\\\__ \\\\| || |\", \"|_| |_| |_||_||_||____/ |_| \\\\__,_||___/|_||_|\"]\n print line\n text.each do |t|\n sleep(0.2)\n puts t\n end\n sleep(0.2)\n print \"\\n\"\n sleep(0.2)\n print line\n sleep(0.2)\nend",
"def print_stats(title_array)\n # some iteration magic and puts out the movies in a nice list\n title_array.each do |title|\n puts \"#{title}\\n\"\n puts\"*****************\\n\"\n end\nend",
"def animate_from_charset(lines, duration, reverse: false, repeat: false)\n # Calculate and store the frames to display\n frames = []\n lines.each do |dir|\n\t\t\t[0,1,2,3].each do |pattern|\n\t\t\t\tframes.push ((((dir+1)*2)<<2) | pattern)\t# A frame is 0bdddpp with ddd the direction, pp the pattern\n\t\t\tend\n end\n frames.reverse! if reverse # Invert the animation if asked\n duration *= 2 # Double the frame to match the game framerate (30 / s)\n # Contain the charset animation data\n @charset_animation = {\n running: true, # Indicate if the animation need to be updated or not\n frames: frames, # List of frames\n delay: (duration.to_f / frames.size.to_f).round, # Delay between two frame in frames\n repeat: repeat, # Indicate if the animation is looped or not\n counter: -1, # Frame counter (initialized at -1 so the first update will set the appearance)\n index: 0 # Index of the current frame to display\n }\n return update_charset_animation # First update, display the first frame\n end",
"def draw_text(*args)\n raise \"not implemented\"\n end",
"def add_text(x, y, text, size = nil, angle = 0, word_space_adjust = 0)\n if text.kind_of?(Numeric) and size.kind_of?(String)\n text, size = size, text\n warn PDF::Writer::Lang[:add_text_parameters_reversed] % caller[0]\n end\n\n if size.nil? or size <= 0\n size = @font_size\n end\n\n select_font(\"Helvetica\") if @fonts.empty?\n\n text = text.to_s\n\n # If there are any open callbacks, then they should be called, to show\n # the start of the line\n @callbacks.reverse_each do |ii|\n info = ii.dup\n info[:x] = x\n info[:y] = y\n info[:angle] = angle\n info[:status] = :start_line\n\n info[:tag][self, info]\n end\n if angle == 0\n add_content(\"\\nBT %.3f %.3f Td\" % [x, y])\n else\n rad = PDF::Math.deg2rad(angle)\n tt = \"\\nBT %.3f %.3f %.3f %.3f %.3f %.3f Tm\"\n tt = tt % [ Math.cos(rad), Math.sin(rad), -Math.sin(rad), Math.cos(rad), x, y ]\n add_content(tt)\n end\n\n if (word_space_adjust != 0) or not ((@word_space_adjust.nil?) and (@word_space_adjust != word_space_adjust))\n @word_space_adjust = word_space_adjust\n add_content(\" %.3f Tw\" % word_space_adjust)\n end\n\n pos = -1\n start = 0\n loop do\n pos += 1\n break if pos == text.size\n font_change = true\n tag_size, text, font_change = quick_text_tags(text, pos, font_change)\n\n if tag_size != 0\n if pos > start\n part = text[start, pos - start]\n tt = \" /F#{find_font(@current_font).font_id}\"\n tt << \" %.1f Tf %d Tr\" % [ size, @current_text_render_style ]\n tt << \" (#{PDF::Writer.escape(part)}) Tj\"\n add_content(tt)\n end\n\n if font_change\n current_font!\n else\n add_content(\" ET\")\n xp = x\n yp = y\n tag_size, text, font_change, xp, yp = text_tags(text, pos, font_change, true, xp, yp, size, angle, word_space_adjust)\n\n # Restart the text object\n if angle.zero?\n add_content(\"\\nBT %.3f %.3f Td\" % [xp, yp])\n else\n rad = PDF::Math.deg2rad(angle)\n tt = \"\\nBT %.3f %.3f %.3f %.3f %.3f %.3f Tm\"\n tt = tt % [ Math.cos(rad), Math.sin(rad), -Math.sin(rad), Math.cos(rad), xp, yp ]\n add_content(tt)\n end\n\n if (word_space_adjust != 0) or (word_space_adjust != @word_space_adjust)\n @word_space_adjust = word_space_adjust\n add_content(\" %.3f Tw\" % [word_space_adjust])\n end\n end\n\n pos += tag_size - 1\n start = pos + 1\n end\n end\n\n if start < text.size\n part = text[start..-1]\n\n tt = \" /F#{find_font(@current_font).font_id}\"\n tt << \" %.1f Tf %d Tr\" % [ size, @current_text_render_style ]\n tt << \" (#{PDF::Writer.escape(part)}) Tj\"\n add_content(tt)\n end\n add_content(\" ET\")\n\n # XXX: Experimental fix.\n @callbacks.reverse_each do |ii|\n info = ii.dup\n info[:x] = x\n info[:y] = y\n info[:angle] = angle\n info[:status] = :end_line\n info[:tag][self, info]\n end\n end",
"def string *classes, size: 1..10\n classes = [:printable] if classes.empty?\n repertoire = DSL::CharacterClass.expand(*classes)\n size = pick_from(size) if Range === size\n send_to( send_to(repertoire, :sample, size), :join )\n end",
"def tt(time, format=:short); '13:37'; end",
"def print tickObj, printvar\n if printvar.length <= 1265 # printable larger than screen size\n tickObj.labels << [0, 725, printvar]\n else\n tickObj.labels << [0, 725, printvar]\n if $dragon.root.tick_count >= $start_tick + 10 # only update every 10 ticks\n ## Move the first char to the end of the string ##\n temp = printvar[0]\n printvar[0] = ''\n $start_tick = $dragon.root.tick_count\n return\n end\n end\nend",
"def _fmt(color, text, size = 0)\n\t\ttext.center(size)\n\tend",
"def greet_characters(array)\n array.each do |title|\n puts \"Hello #{title}!\"\n end\nend",
"def styleReport(psdFiles)\n textData = Array.new\n\n psdFiles.each do |psdFile|\n name = File.basename(psdFile)\n PSD.open(psdFile) do |psd|\n puts \"\\n[ #{name} ] Text Report =================================== \\n\\n\"\n psd.layers.each do |layer|\n textRaw = layer.adjustments[:type]\n textString = textRaw.to_s()\n\n fontRaw = layer.text\n fontString = fontRaw.to_s()\n fontstring = fontString.gsub!(':font=>{:name=>\"', \"spliter\")\n fontstring = fontString.gsub!('\", :sizes=>[', \"spliter\")\n fontstring = fontString.gsub!('], :colors=>[', \"spliter\")\n fontstring = fontString.gsub!(';\\ncolor: ', \"spliter\")\n fontstring = fontString.gsub!(';\"}, :left=>', \"spliter\")\n fontArray = fontString.split(\"spliter\")\n\n fontName = fontArray[1].to_s()\n fontSize = fontArray[2].to_s()\n fontColor = fontArray[4].to_s()\n\n if textString == \"\"\n else\n textData.push(\"#{fontName} | #{fontSize}px | #{fontColor}\")\n end\n end\n end\n textDataClean = textData.uniq\n textDataClean.each do |d|\n puts d\n end\n end\nend",
"def osd_show_text _string, _duration=0, _level=0\n send_cmd(\"osd_show_text #{_string} #{_duration} #{_level}\")\n end",
"def generate\n # sort steps by either ascending or descending times\n order = @order == :asc ? 1 : -1\n sorted = @names_and_time_ms.sort_by { |(_, time_ms)| time_ms * order }\n\n # convert times from milliseconds into seconds and add to collection\n sorted.map! { |(name, time_ms)| [name, time_ms, time_ms / 1000.0] }\n\n # for calculating widths of name and time columns\n longest_name = sorted.map { |(name, _, _)| name.length }.max\n longest_time = sorted.map { |(_, _, time_s)| time_s.to_s.length }.max\n\n # output line for each name\n sorted.reduce(\"\") do |result, (name, time_ms, time_s)|\n name_column = \"#{name}:\".rjust(longest_name + 1)\n time_column = \"(#{time_s}s)\".ljust(longest_time + 3)\n bar_column = \"#\" * (time_ms / @scale.to_f).ceil\n result + [name_column, time_column, bar_column].join(\" \") + \"\\n\"\n end\n end",
"def speakIntoFiles(spanishText, germanText, englishText)\n @spanishText = spanishText\n @germanText = germanText\n @englishText = englishText\n\n\n readingSpeedES = 140\n readingSpeedDE = 180\n readingSpeedEN = 140\n\n spanishVoice = \"Jorge\"\n germanVoice = \"Markus\"\n englishVoice =\"Susan\"\n\n # we set the character length of the file name\n # languageFileDE = \"#{germanText[0,55]}\"\n languageFileES = \"#{spanishText[0,20].chomp}\"\n languageFileEN = \"#{englishText[0,20].chomp}\"\n languageFileDE = \"#{germanText[0,20].chomp}\"\nputs `say -v #{spanishVoice} -r #{readingSpeedES} \"#{spanishText}\" -o \"#{languageFileES}\".aif`\nputs `say -v #{germanVoice} -r #{readingSpeedDE} \"#{germanText}\" -o \"#{languageFileDE}\".aif`\nputs `say -v #{englishVoice} -r #{readingSpeedEN} \"#{englishText}\" -o \"#{languageFileEN}\".aif`\nend",
"def titleSlide()\n=begin \n print \"\\n-------------------------------------------------------------------------\\n\"\n print $titleSlideFont.write(\"Console Light Show\")\n print \"\\nA program for Joshua Bruce\\nWritten with love by Robert Leslie\\n\"\n print \"---------------------------------------------------------------------------\\n\"\n=end\n titleSlideFont = TTY::Font.new(:standard)\n titleBox = TTY::Box.frame(\n width: TTY::Screen.width-1,\n height: 15,\n border: :thick,\n align: :center,\n padding: 1\n )do\n \"#{titleSlideFont.write(\"Console Light Show\")}\n \\nA program for Joshua Bruce\\nWritten with love by Robert Leslie\\n2019\"\n end\n print titleBox\n menu()\nend",
"def set_text(font, size)\n\t \t@pdf.setfont(font, size)\n\t end",
"def width(string, font_size)\n string_base_width = string.bytes.inject(0){|result, byte|\n byte_width = WIDTHS[byte] || 1000\n result + byte_width\n }\n string_base_width * font_size / 1000\n end",
"def initialize(text, duration)\n @text = text\n @duration = duration\n end",
"def initialize(text, duration)\n @text = text\n @duration = duration\n end",
"def drawText(x,y,text,fontSize = 14, fontFamily = :times, color = \"black\") \n @device.drawText(x,y,text,fontSize, fontFamily, color) ;\n end",
"def say(*fmt)\n print Time.now.localtime.strftime('[%Y%m%d-%H%M%S] ')\n printf *fmt\n puts ''\nend",
"def adjust_transition_text\n if @temporary_objects[:title].width > Window.width - (@margin * 2)\n length_per_char = @temporary_objects[:title].width / @temporary_objects[:title].text.length\n split_title = @temporary_objects[:title].text.split(' ')\n\n remove_from_temporary(:title)\n title_parts = []\n grouped_text = []\n grouped_text_length = 0\n split_title.each_index do |i|\n grouped_text_length += (split_title[i].length + 1) * length_per_char\n if grouped_text_length > Window.width - (@margin * 2)\n if i < split_title.length - 1\n text = grouped_text.join(' ').rstrip\n sym = \"divided_text_#{i}\".to_sym\n # make a new text object\n @temporary_objects[sym] = Text.new(text, {x: 0, y: 0, size: 20, z: 6, font: 'assets/fonts/PressStart2P.ttf'})\n \n title_parts << @temporary_objects[sym]\n\n grouped_text = []\n grouped_text << split_title[i]\n grouped_text_length = (split_title[i].length + 1) * length_per_char\n else\n text = grouped_text.join(' ').rstrip\n sym = \"divided_text_#{i}\".to_sym\n sym2 = \"divided_text_#{i + 1}\".to_sym\n\n # make a new text object with grouped_text\n @temporary_objects[sym] = Text.new(text, {x: 0, y: 0, size: 20, z: 6, font: 'assets/fonts/PressStart2P.ttf'})\n # make a new text object with split_title[i]\n @temporary_objects[sym2] = Text.new(split_title[i], {x: 0, y: 0, size: 20, z: 6, font: 'assets/fonts/PressStart2P.ttf'})\n\n title_parts << @temporary_objects[sym]\n title_parts << @temporary_objects[sym2]\n end\n else\n if i < split_title.length - 1\n grouped_text << split_title[i]\n else\n grouped_text << split_title[i]\n text = grouped_text.join(' ').rstrip\n sym = \"divided_text_#{i}\".to_sym\n # make a new text object with grouped_text\n @temporary_objects[sym] = Text.new(text, {x: 0, y: 0, size: 20, z: 6, font: 'assets/fonts/PressStart2P.ttf'})\n title_parts << @temporary_objects[sym]\n end\n end\n end\n\n positions = get_centered_positions(title_parts, 5)\n title_parts.each_index do |i|\n title_parts[i].x = positions[i][:x]\n title_parts[i].y = positions[i][:y]\n end\n end\n end",
"def print msg, color\n @text[2] = @text[1]\n @text[1] = @text[0]\n @text[0] = Message.new(msg, color, 18)\n end",
"def banner(s, color = GREEN)\n s = \"#{s} \".ljust(72, \" \") \n $stderr.write \"#{color}[#{Time.new.strftime('%H:%M:%S')}] #{s}#{RESET}\\n\"\n $stderr.flush\n end",
"def print_dt3vstot(io, run, pat=[[2,1,3]])\n\n io.puts \"<h3>dT(3) vs ToT</h3>\"\n io.puts \"<div style=\\\"text-align: center;\\\">\"\n\n io.puts \"<table>\"\n pat.each { |a, b, c|\n io.puts \" <tr>\"\n (1..6).each { |col|\n ch1 = 48 + 6*a + (col-1)\n ch2 = 48 + 6*b + (col-1)\n ch3 = 48 + 6*c + (col-1)\n io.puts \" <td><a href=\\\"fig/#{run}/dt3_#{ch1}_#{ch2}_#{ch3}_tot.gif\\\"><img src=\\\"fig/#{run}/thumb/dt3_#{ch1}_#{ch2}_#{ch3}_tot.gif\\\" alt='' /></a></td>\"\n }\n io.puts \" </tr>\" \n }\n io.puts \"</table>\" \n io.puts \"</div>\"\n\nend",
"def fontReport(psdFiles)\n fontData = Array.new\n\n psdFiles.each do |psdFile|\n name = File.basename(psdFile)\n PSD.open(psdFile) do |psd|\n puts \"\\n[ #{name} ] Font used =================================== \\n\\n\"\n psd.layers.each do |layer|\n fontRaw = layer.text\n fontString = fontRaw.to_s()\n fontstring = fontString.gsub!(':font=>{:name=>\"', \"spliter\")\n fontstring = fontString.gsub!('\", :sizes=>[', \"spliter\")\n fontArray = fontString.split(\"spliter\")\n fontName = fontArray[1].to_s()\n if fontName == \"\"\n else\n fontData.push(\"* \" + fontName)\n end\n end\n end\n fontDataClean = fontData.uniq\n fontDataClean.each do |d|\n puts d\n end\n end\nend",
"def create_texts\n add_text(TEXT_OX, 0, DELTA_X - TEXT_OX, DELTA_Y, text_get(32, 0)) # Attack !\n add_text(TEXT_OX + DELTA_X, 0, DELTA_X - TEXT_OX, DELTA_Y, text_get(32, 1)) # Bag\n add_text(TEXT_OX, DELTA_Y, DELTA_X - TEXT_OX, DELTA_Y, text_get(32, 2)) # Pokemon\n add_text(TEXT_OX + DELTA_X, DELTA_Y, DELTA_X - TEXT_OX, DELTA_Y, text_get(32, 3)) # Flee\n end",
"def drum_roll(dramatic_text, beep)\n print \"\\a\" unless beep == false\n c = 0\n dramatic_text.length.times do\n print dramatic_text[c]\n c += 1\n sleep 0.05\nend\nend",
"def time(*args)\n @contents << \"\\\\time #{args[0..1].join(\"/\")}\"\n end"
] |
[
"0.7082753",
"0.70182985",
"0.6287385",
"0.59701514",
"0.5935123",
"0.57840484",
"0.5696641",
"0.5671314",
"0.5583725",
"0.55798",
"0.55558866",
"0.55276823",
"0.5523067",
"0.5484647",
"0.5476543",
"0.54740113",
"0.5458908",
"0.54549724",
"0.5443103",
"0.54390556",
"0.5432878",
"0.5399636",
"0.5383359",
"0.53830725",
"0.5372498",
"0.53697765",
"0.5365629",
"0.53344905",
"0.53130215",
"0.52784073",
"0.5232188",
"0.51734096",
"0.5169567",
"0.51644266",
"0.5149888",
"0.5145295",
"0.514467",
"0.51384115",
"0.5134306",
"0.5132783",
"0.51284343",
"0.5122011",
"0.51195765",
"0.511806",
"0.51065135",
"0.50709146",
"0.506545",
"0.50638366",
"0.5057218",
"0.5054191",
"0.5049512",
"0.5044761",
"0.50434905",
"0.50407296",
"0.5024632",
"0.50238615",
"0.50229186",
"0.502199",
"0.50168014",
"0.50126314",
"0.49967545",
"0.49953645",
"0.49948987",
"0.499424",
"0.4990671",
"0.49785012",
"0.49785012",
"0.4977632",
"0.49767837",
"0.49684265",
"0.49682295",
"0.49676532",
"0.49667364",
"0.49659237",
"0.49561423",
"0.4952122",
"0.49514517",
"0.4935707",
"0.49323308",
"0.49278572",
"0.4921503",
"0.4920917",
"0.49063173",
"0.48872456",
"0.48845652",
"0.48822984",
"0.48801708",
"0.4875997",
"0.48755464",
"0.48755464",
"0.48754835",
"0.48737913",
"0.48722783",
"0.48626688",
"0.48622656",
"0.4860095",
"0.48564643",
"0.4855594",
"0.48550826",
"0.4831541"
] |
0.7331457
|
0
|
printRandomFont(duration) Prints random fonts in random colors. THere's a weird issue about a space at the end of the print statement and I don't like it :(
|
def printRandomFont(duration)
st = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,0,1,2,3,4,5,6,7,8,9"
x = st.split(",")
currentTime = Time.now.to_i
futureTime = currentTime + duration
while (currentTime <= futureTime)do
print "#{isMe(onMe("\n#{returnFont(x[$prng.rand(0...x.length())])}\n\n"))}"
currentTime = Time.now.to_i
end
menu()
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def printStringRandomFont(printMe, duration)\n x = printMe.split(\", \")\n currentTime = Time.now.to_i\n futureTime = currentTime + duration\n while (currentTime <= futureTime) do\n print \"#{isMe(onMe(\"\\n#{returnFont(x[$prng.rand(0...x.length())])}\\n\\n\"))}\"\n currentTime = Time.now.to_i\n end\n menu()\nend",
"def printRandom(duration)\n st = \"q,w,e,r,t,y,u,i,o,p,a,s,d,f,g,h,j,k,l,z,x,c,v,b,n,m,Q,W,E,R,T,Y,U,I,O,P,A,S,D,F,G,H,J,K,L,Z,X,C,V,B,N,M,1,2,3,4,5,6,7,8,9,0,!,@,#,$,%,^,&,*,(,),_,+,[,],|,{,}\"\n x = st.split(\",\")\n currentTime = Time.now.to_i\n futureTime = currentTime + duration\n while (currentTime <= futureTime) do\n print \"#{isMe(onMe( x[$prng.rand(0...x.length())] ))}\"\n currentTime = Time.now.to_i\n end\n menu()\nend",
"def returnFont(str)\n case $prng1.rand(1..5)\n# when 1\n# $fontFont = TTY::Font.new(\"3d\")\n# return $fontFont.write(str)\n when 2\n $fontFont = TTY::Font.new(:doom)\n return $fontFont.write(str)\n when 3\n $fontFont = TTY::Font.new(:standard)\n return $fontFont.write(str)\n when 4\n $fontFont = TTY::Font.new(:starwars)\n return $fontFont.write(str)\n when 5\n $fontFont = TTY::Font.new(:straight)\n return $fontFont.write(str)\n else\n $fontFont = TTY::Font.new(:standard)\n return $fontFont.write(str)\n end\nend",
"def wave_display\n font_big = TTY::Font.new(:doom)\n font_col = Pastel.new\n case $current_lvl\n when $lvl_1\n puts font_col.red(font_big.write(\"WAVE 1\"))\n when $lvl_2\n puts font_col.red(font_big.write(\"WAVE 2\"))\n when $lvl_3\n puts font_col.red(font_big.write(\"WAVE 3\"))\n end\nend",
"def play_name_animation(name)\n 3.times do |i|\n puts \"\\e[H\\e[2J\" \n letterify_name(name)\n sleep(0.3)\n puts \"\\e[H\\e[2J\" \n blankify_name(name)\n sleep(0.3)\n end\nend",
"def printStringS(printMe, duration)\n x = printMe.split(\", \")\n currentTime = Time.now.to_i\n futureTime = currentTime + duration\n while (currentTime <= futureTime) do\n print \"#{isMe(onMe(x[$prng.rand(0...x.length())]))}\"\n currentTime = Time.now.to_i\n end\n menu()\nend",
"def loading\n chars = %w[| / ― \\\\]\n fps = 10\n delay = 1.0/fps\n\n fps.round.times do |i|\n print chars[ i % chars.length]\n sleep delay\n print \"\\b\"\n end\nend",
"def draw\r\n @font.draw_text(\"No Longer Human!\", 50,50,0)\r\n end",
"def print_random_text(next_words)\nend",
"def rainbowSpeak1(sentence)\n\trandNum = 0\n\tpreviousRandNum = 0\n\tletterArr = []\n\n\tsentence = sentence.split('')\n\n\tsentence.each do |letter|\n\t\twhile (randNum == previousRandNum)\n\t\t\trandNum = rand(1...7) \n\t\tend\n\n\t\tcase randNum\n\t\twhen 1\n\t\t\tletterArr.push(letter.colorize(:red))\n\t\twhen 2\n\t\t\tletterArr.push(letter.colorize(:green))\n\t\twhen 3\n\t\t\tletterArr.push(letter.colorize(:yellow))\n\t\twhen 4\n\t\t\tletterArr.push(letter.colorize(:blue))\n\t\twhen 5\n\t\t\tletterArr.push(letter.colorize(:magenta))\n\t\twhen 6\n\t\t\tletterArr.push(letter.colorize(:cyan))\n\t\twhen 7\n\t\t\tletterArr.push(letter.colorize(:white))\n\t\tend\n\t\n\t\tpreviousRandNum = randNum\n\tend\n\treturn letterArr.join(\"\")\nend",
"def qt_monkey_random_text\n return '\"generated: \" << (\"random\" * rand(5)) << ( \"text\" * rand(5))'\n end",
"def qt_monkey_random_text \n return '\"generated: \" << (\"random\" * rand(5)) << ( \"text\" * rand(5))' \n end",
"def anim(string)\n \n string.each_char do |n|\n \n \n print n \n \n \n slt =rand(0.02..0.08)\n sleep(slt) \n end\n print \"\\n\"\nend",
"def draw_sample\n \t\" #{@sample[:space_1]} | #{@sample[:space_2]} | #{@sample[:space_3]}\\n\" +\n \t\t\t\t\t \" _____|_____|____\\n\" +\n \t\" #{@sample[:space_4]} | #{@sample[:space_5]} | #{@sample[:space_6]}\\n\" +\n \t\t\t\t\t \" _____|_____|____\\n\" +\n \t\" #{@sample[:space_7]} | #{@sample[:space_8]} | #{@sample[:space_9]}\\n\" +\n \t\t\t\t\t\t \" | | \\n\\n\"\n\n end",
"def another_print_fonts\n for index in 0..@fonts.size do\n puts \"#{index} -> #{@fonts[index]}\" # use of templating\n end\nend",
"def rand_text_debug(length, char = 'A')\n char * (length.kind_of?(Range) ? length.first : length)\n end",
"def print_banner(winner)\n colors = ['bg-magenta', 'bg-cyan', 'bg-red', 'bg-blue', 'bg-red', 'bg-gray']\n headline = \"********* GRAND WINNER! #{winner} won 5 matches! *********\"\n\n puts \"********************************************************\"\n puts \"********************************************************\"\n 5.times do\n puts colorize(headline, 'default', colors.sample)\n end\n puts \"********************************************************\"\n puts \"********************************************************\"\n puts\nend",
"def drum_roll(dramatic_text, beep)\n print \"\\a\" unless beep == false\n c = 0\n dramatic_text.length.times do\n print dramatic_text[c]\n c += 1\n sleep 0.05\nend\nend",
"def loading_screen(string) \n string.length.times do |i| # Iterates over each index in a given string\n # Clear the screen to provide an animated effect.\n clear\n \n # Please wait header \n puts HEADER_LINE\n puts \"Please Wait...\".upcase.center(HEADER_LENGTH)\n puts HEADER_LINE\n puts\n \n # Displays all characters in the string up to the index being iterated over.\n puts string[0, i].center(HEADER_LENGTH)\n sleep(0.2)\n end\nend",
"def rand_text(length, bad=payload_badchars)\n if debugging?\n rand_text_debug(length)\n else\n Rex::Text.rand_text(length, bad)\n end\n end",
"def insert_sky\n puts \" \" * 41 + \"\\u{2728} \" + \"\\u{1f31b}\" + \" \\u{2728}\"\n puts\n end",
"def time_to_font(time,font)\n output = []\n for i in 0...time.length()\n converted_font = convert_1_number_to_1_font(time[i],font)\n output.append(converted_font)\n end\n return output\nend",
"def print_example\n for font in $pretty_fonts do\n puts font\n converter = PrettyConverter.new font\n for ch in (('a'..'z').to_a + ('A'..'Z').to_a) do\n print(converter.convert_char ch)\n end\n print \"\\n\"\n end\nend",
"def firecracker\n 100.times do |i|\n print '💥'.center(8)\n end\nend",
"def gprint (text)\n\tprint colorize(colorize(text, \"black\"), \"white_bg\")\nend",
"def subtitle_print(words)\n title = Artii::Base.new :font => 'slant'\n puts title.asciify(words).colorize(:blue)\n end",
"def print_colors\n 1.upto(6) { |i| print \"#{i} = \" + \"\\u2b24\".color(COLORS[i]) + \" \" }\n print \": \"\nend",
"def rand_text_alpha(length, bad=payload_badchars)\n if debugging?\n rand_text_debug(length)\n else\n Rex::Text.rand_text_alpha(length, bad)\n end\n end",
"def font_descender(size = nil)\n size = @font_size if size.nil? or size <= 0\n\n select_font(\"Helvetica\") if @fonts.empty?\n hi = @fonts[@current_font].fontbbox[1].to_f\n (size * hi / 1000.0)\n end",
"def print_logo()\n sleep(0.2)\n line = \"===================================================\\n\"\n text = [\" _____ _ _ _ ____ _ _ \", \"| __ \\\\ | | (_)| || _ \\\\ (_)| |\", \"| |__) || |__ _ | || |_) | _ __ __ _ ___ _ | |\", \"| ___/ | '_ \\\\ | || || _ < | '__|/ _` |/ __|| || |\", \"| | | | | || || || |_) || | | (_| |\\\\__ \\\\| || |\", \"|_| |_| |_||_||_||____/ |_| \\\\__,_||___/|_||_|\"]\n print line\n text.each do |t|\n sleep(0.2)\n puts t\n end\n sleep(0.2)\n print \"\\n\"\n sleep(0.2)\n print line\n sleep(0.2)\nend",
"def random_statement(r)\n\tcase r.rand(6).to_i\n\twhen 0\n\t\treturn \" :D\"\n\twhen 1\n\t\treturn \" Yawn. I'm tired...\"\n\twhen 2\n\t\t#Dice because it was randomly generated\n\t\treturn \" 🎲🎲🎲\"\n\twhen 3\n\t\treturn \" D:\"\n\twhen 4\n\t\treturn \" Hm.\"\n\telse\n\t\treturn \" ~_~\"\n\tend\nend",
"def print_over(s)\n time = Time.now.localtime.strftime(\"[%k:%M:%S]\")\n print \"\\r#{time}\"+\"[*]\".blue+\" #{s}\"\nend",
"def draw_text_cs(x, y, w, h, t, a = 0)\r\n original_color = self.font.color.clone\r\n self.font.color = Color.new(0,0,0,100)\r\n draw_text(x + 2, y + 2, w, h, t, a)\r\n self.font.color = original_color\r\n draw_text(x, y, w, h, t, a) \r\n end",
"def try_again\n wave_display\n puts \"Here's the word again...\"\n\tputs $current_word.colorize(:color => :black, :background => :green) + \"\\r\"\n sleep($hide_speed)\n player_input_word\nend",
"def game_complete_text\n slow_type(\"\\nCongratulations, #{@new_player_name}! You have found your way out!\")\n pause(0.3)\n slow_type(\"Written, developed and coded by Adam Vaughan and Danny Smith.\")\n pause(0.3)\n slow_type(\"Stayed tuned for more levels!\")\n end",
"def random_mons_print(num)\n mons = Monster.all.sample(num)\n string_array = []\n mons.each{|monster|\n string_array << 'Name: '.green + \"#{monster.name.capitalize} \" + \"Type: \".green + \"#{monster.monster_type.capitalize} \" + \"Challenge Rating: \".green + \"#{monster.challenge_rating} \" + \"Alignment: \".green + \"#{monster.alignment.capitalize}\"\n }\n puts_with_delay(string_array, 0.3)\n end",
"def draw\n letters.delete_at(rand(letters.size))\n end",
"def test_fontDiff\n f = Font.new()\n f.color = Color.power_up_color()\n f.size = 12\n f.bold = true\n [@window, @sprite, @bitmap].each{|container|\n uc = UCGraph.new(container, 300, 180, 50, @elements, nil, 100, -100, f,\n Color.hp_gauge_color1, Color.hp_gauge_color2,\n Color.mp_gauge_color1, Color.mp_gauge_color2)\n uc.draw()\n }\n return true\n end",
"def loading_screen(string) \n string.length.times do |i|\n clear\n \n # Please wait header \n puts HEADER_LINE\n puts \"Please Wait...\".upcase.center(HEADER_LENGTH)\n puts HEADER_LINE\n puts\n puts string[0, i].center(HEADER_LENGTH)\n sleep(0.2)\n end\nend",
"def display_banner()\n\n\tr = Random.rand(1..4)\n\n\tcase r\n\twhen 1\n\t\tputs \"\n\t.------..------..------..------..------.\n\t|D.--. ||V.--. ||A.--. ||S.--. ||H.--. |\n\t| :/\\\\: || :(): || (\\\\/) || :/\\\\: || :/\\\\: |\n\t| (__) || ()() || :\\\\/: || :\\\\/: || (__) |\n\t| '--'D|| '--'V|| '--'A|| '--'S|| '--'H|\n\t`------'`------'`------'`------'`------'\n\n\n\t\t\"\n\twhen 2\n\t\tputs \"\n\t@@@@@@@ @@@ @@@ @@@@@@ @@@@@@ @@@ @@@ \n\t@@@@@@@@ @@@ @@@ @@@@@@@@ @@@@@@@ @@@ @@@ \n\t@@! @@@ @@! @@@ @@! @@@ !@@ @@! @@@ \n\t!@! @!@ !@! @!@ !@! @!@ !@! !@! @!@ \n\t@!@ !@! @!@ !@! @!@!@!@! !!@@!! @!@!@!@! \n\t!@! !!! !@! !!! !!!@!!!! !!@!!! !!!@!!!! \n\t!!: !!! :!: !!: !!: !!! !:! !!: !!! \n\t:!: !:! ::!!:! :!: !:! !:! :!: !:! \n\t :::: :: :::: :: ::: :::: :: :: ::: \n\t:: : : : : : : :: : : : : :\n\t\n\n\t\t\"\n\twhen 3\n\t\tputs \"\n\n\t\t ^^ .-=-=-=-. ^^\n\t ^^ (`-=-=-=-=-`) ^^\n\t (`-=-=-=-=-=-=-`) ^^ ^^\n\t ^^ (`-=-=-=-=-=-=-=-`) ^^ ^^\n\t ( `-=-=-=-(@)-=-=-` ) ^^\n\t (`-=-=-=-=-=-=-=-=-`) ^^\n\t (`-=-=-=-=-=-=-=-=-`) ^^\n\t (`-=-=-=-=-=-=-=-=-`) ^^\n\t (`-=-=-=-=-=-=-=-=-`) ^^\n\t (`-=-=-=-=-=-=-=-`) ^^\n\t (`-=-=-=-=-=-=-`) ^^ ^^\n\t dvash (`-=-=-=-=-`)\n\t `-=-=-=-=-`\n\n\n\t\t\"\n\twhen 4\n\t\tputs \"\n\n\t _______________\n\t //~~~~~~~~~~~~~~~\\\\\\\\ |\n\t 0 / /_________________\\\\ \\\\| 0\n\t ---------------------------\n\t / /======|=D=V=A=S=H=|======\\\\ \\\\\n\t \\\\_____________________________/\n\t \\\\ _______ _______ /\n\t |\\\\ _/|__|__|\\\\_____/|__|__|\\\\_ /|\n\t | |`V' `---' `V'| |\n\t |______| |______|\n\t\t\n\n\t\t\"\n\tend\nend",
"def sentence(word_count: rand(DEFAULT_WORD_COUNT_RANGE), fillers: dictionnary.fillers)\n word_count = 0 if word_count.negative?\n dictionnary_words = dictionnary.words\n words = (0...word_count).map do\n next dictionnary_words.sample if fillers.nil? || fillers == false || fillers.empty?\n\n rand(3).zero? ? dictionnary_words.sample : fillers.sample\n end\n return '' if words.empty?\n\n words[0] = words[0].capitalize\n words = words.join(' ')\n \"#{words}.\"\n end",
"def rand_brancket\n (rand(2) == 0) ? \"【#{FFaker::Food.meat}】\" : ''\nend",
"def draw_playtime(x, y, width, align)\n hour = @total_sec / 60 / 60\n min = @total_sec / 60 % 60\n sec = @total_sec % 60\n time_string = sprintf(\"%02d:%02d:%02d\", hour, min, sec)\n self.contents.font.color = normal_color\n self.contents.draw_text(x, y, width, WLH, time_string, 2)\n end",
"def rand_title_two\n 5.times.map do\n rand_word(8).capitalize + ' '\n end.join(' ').rstrip!\nend",
"def character\n system(\"clear\")\n a = Artii::Base.new :font => 'slant'\n puts a.asciify('Fantasy Final')\n sleep(5)\n end",
"def display_text\n\t\t\t#specifying font to be used\n\t\t\t#text_font @font, 16\n\t\t\t#text \"Mmmmm ... Strings .... \", 10, 100\n\t\tend",
"def time_emoji\n %w[clockface hourglass alarmclock stopwatch watch].sample\n end",
"def font_draw\n\t\t@font.draw( \"Debug mode\" , 49, 30 , 1, 1.0, 1.0, 0xfffff000 )\n\t\t@font.draw( (\"x.pos: #{ @ball.xpos } y.pos %.0f\" % [@ball.ypos]), 49, 50 , 1, 1.0, 1.0, 0xfffff000 )\n\n\tend",
"def space\n 20.times do\n puts \"\"\n end\n end",
"def display\n if count_dracula > 0\n fill(255)\n elsif count_franken > 0\n fill(0)\n end\n # Its size is also tied to number of occurences\n fs = map1d(total_count, (5..25), (2..24.0))\n fs = (2..48).clip fs\n text_size(fs)\n text_align(CENTER)\n text(word, position[X], position[Y])\n end",
"def create_name\n colors = @colors\n first = colors.sort_by{rand}.first.split('')[0..2].sort_by{rand}.to_s\n last = colors.sort_by{rand}.last.split('')[0..2].sort_by{rand}.to_s\n return \"--- #{first}.#{@remainder}.#{last} ---\"\n end",
"def titleSlide()\n=begin \n print \"\\n-------------------------------------------------------------------------\\n\"\n print $titleSlideFont.write(\"Console Light Show\")\n print \"\\nA program for Joshua Bruce\\nWritten with love by Robert Leslie\\n\"\n print \"---------------------------------------------------------------------------\\n\"\n=end\n titleSlideFont = TTY::Font.new(:standard)\n titleBox = TTY::Box.frame(\n width: TTY::Screen.width-1,\n height: 15,\n border: :thick,\n align: :center,\n padding: 1\n )do\n \"#{titleSlideFont.write(\"Console Light Show\")}\n \\nA program for Joshua Bruce\\nWritten with love by Robert Leslie\\n2019\"\n end\n print titleBox\n menu()\nend",
"def display_menu\n font_sml = TTY::Font.new(:straight)\n font_big = TTY::Font.new(:doom)\n font_col = Pastel.new\n system \"clear\"\n # if statement to detect if arguments given in command line\n if ARGV.length == 1\n puts font_sml.write(\"#{ARGV[0]}, Welcome to...\") \n ARGV.clear\n elsif ARGV.length > 1 && ARGV[1] == \"-s\"\n puts font_sml.write(\"#{ARGV[0]}, Welcome to...\") \n ARGV.clear\n random_character\n pre-game\n else\n puts font_sml.write(\"Welcome to...\")\n end\n puts font_col.red(font_big.write(\"RPSG\"))\n puts \"If you haven't played before, it is advisable to read the instructions.\"\n # displays game menu to player\n return $prompt.select(\"What would you like to do?\",\n [\"Start New Game\", \"View Instructions\", \"View Leaderboard\", \"Exit Game\"])\nend",
"def banner(s, color = GREEN)\n s = \"#{s} \".ljust(72, \" \") \n $stderr.write \"#{color}[#{Time.new.strftime('%H:%M:%S')}] #{s}#{RESET}\\n\"\n $stderr.flush\n end",
"def display_name\n pastel = Pastel.new\n font = TTY::Font.new(:doom)\n puts pastel.green(\"You have encountered\")\n puts pastel.red(font.write(\"DRACO THE TERRIBLE\"))\n end",
"def small_font\n [-2, 0, 0, 0, 0, 255]\n end",
"def generate(num_chars, &block)\n output = rand_char\n\n until output.size > num_chars\n seq = @markov.get_sequence(output[-1], next_depth)\n output += seq.join(\"\")\n\n yield seq if block_given?\n end\n\n format_text(output[0..(num_chars - 1)])\n end",
"def random_tweet\n number_of_words = 6 + rand(10)\n ((number_of_words.times.map{word_list.sample}.join(\" \"))[0,139])+\".\"\n end",
"def generate_font_id\n @mutex.synchronize { @current_font_id += 1 }\n end",
"def string_flasher(string, difficulty, height, width, score)\n difficulty[5].times do\n clear\n puts score_display(score, difficulty)\n random_cursor(height, width)\n puts string.colorize(selector(@@colours))\n sleep(difficulty[6])\n end\n end",
"def random(text, first, last)\n value = rand(first..last)\n selected = text + value.to_s\n puts \"Selected: \" + selected\n selected.to_sym\nend",
"def select_random_code\n code = \"\"\n 4.times { code += @colors.sample }\n return code\n end",
"def draw\n unless DEBUG_PRINT_WAIT.nil?\n @string = get_debug_string\n end\n @hud_font.draw_text(@string, 16, 16, 100, 1, 1, 0xff_000000, :default)\n end",
"def generate_entry\n all_the_feels = $feelings.values.flatten\n entry = \"%02d/%02d \" % [rand(12)+1,rand(28)+1]\n 10.times do\n if rand(4) < 1\n entry += all_the_feels[rand(all_the_feels.length)]\n else\n entry += \"---\"\n end\n entry += \" \"\n end\n return entry\nend",
"def chooseRandomWord() \n @randomWord = @wordsList[rand(0..@wordsList.size)]\n @randomWord.downcase\n \n #adding \"_\" to the letters array to display during the game\n randomWordSize = @randomWord.size - 1\n (1..randomWordSize).each do |i| \n @lettersDisplayArr.push(\" _ \")\n \n end\n beginGame()\n end",
"def draw_remaining_characters\n contents.clear_rect(remaining_characters_rect)\n old_size = contents.font.size\n contents.font.size = 12\n draw_text(remaining_characters_rect, remaining_characters, 2)\n contents.font.size = old_size\n end",
"def create_sample_text\n Text.new(0, viewport, 0, 0, 0, 0, ' ')\n end",
"def setup\r\n background 0\r\n font = load_font \"data/DroidSansMono-24.vlw\"\r\n text_font(font)\r\n\r\n @c = []\r\n generate\r\n end",
"def draw_word\n @words.sample(random: Ibsenphrase::Random.prng)\n end",
"def random_ascii\n print send(all_giraffes[rand(all_giraffes.length)])\n end",
"def loading_animation\n type(\"#{@teams[:white].symbols[:King]}\\n#{@teams[:black].symbols[:King]}\\n#{@teams[:white].symbols[:King]}\\n#{@teams[:black].symbols[:King]}\\n\\n\")\n end",
"def print_title\n type(\"ZJCRUMPTON PRESENTS:\".green.to_s, 'mid')\n print \"\n #{\"______ _ _ ______ __ _\n | | | \\\\ | | | | | | | \\\\ \\\\ \\\\ | |\n | |__| | | | | | | |--| < \\\\_\\\\_| |\n |_| \\\\_\\\\ \\\\_|__|_| |_|__|_/ ____|_|\".red}\n\n #{\"______ _ _ ______ ______ ______\n | | | | | | | | / | / |\n | | | |--| | | |---- '------. '------.\n |_|____ |_| |_| |_|____ ____|_/ ____|_/\".blue}\n\n \\n\\n\"\n end",
"def display_msg_footer\n str = \"\\033[#{@color}m⬆ \" * ((@length / 4) - (@msg.length / 2) - 1)\n str += \"\\033[#{@secondary_color}m #{@msg} \"\n str += \"\\033[#{@color}m⬆ \\033[0m\" * ((@length / 4))\n puts str\nend",
"def print_out(style, input)\n move_down style[:upper_space]\n font style[:font_variable], :style => $headline_chapter_font_style\n font_size style[:font_size_variable]\n text input\nend",
"def prn\n puts \" #{(0..8).to_a.join(\" \")}\"\n puts \" #{'-' * (2 * 9)}\"\n g.each_with_index do |v, i|\n # ERROR: print function doesn't display values and doesn't use colors\n # puts \"#{i} #{v.join(\" \")}\"\n puts \"#{i} | #{v.map{|t| t.n.to_s.colorize(t.c) }.join(' ')}\"\n end\n end",
"def display_rainbow(colors)\n puts \"R: #{colors[0]}, O: #{colors[1]}, Y: #{colors[2]}, G: #{colors[3]}, B: #{colors[4]}, I: #{colors[5]}, V: #{colors[6]}\"\nend",
"def fetch_current_word\n $current_word = $current_lvl.fetch(rand($current_lvl.length-1))\n $current_word.colorize(:color => :black, :background => :green)\nend",
"def greet2\n puts \"\\n\n We've looked up some interesting\\n\n facts about characters from the films,\\n\n and we invite you to learn some \\n\n more about them.\\n\"\n sleep 4\n end",
"def welcome(salon)\n puts\n puts HEADER_LINE\n puts \"WELCOME TO \".center(HEADER_LENGTH)\n puts \"#{salon.name} Dog Grooming !\".center(HEADER_LENGTH).colorize(:light_blue)\n puts HEADER_LINE\n puts\nend",
"def kgb \n \n anim_two(\" \n ▄█ ▄█▄ ▄██████▄ ▀█████████▄ \n ███ ▄███▀ ███ ███ ███ ███ \n ███▐██▀ ███ █▀ ███ ███ \n ▄█████▀ ▄███ ▄███▄▄▄██▀ \n ▀▀█████▄ ▀▀███ ████▄ ▀▀███▀▀▀██▄ \n ███▐██▄ ███ ███ ███ ██▄ \n ███ ▀███▄ ███ ███ ███ ███ \n ███ ▀█▀ ████████▀ ▄█████████▀ \n ▀ \".colorize(:blue) +\n \n \" \n \n ┬ ┬┌─┐┌─┐┌┬┐┌─┐ ┬ ┬┌─┐┬─┐┌┬┐┌─┐┬─┐┌─┐\n ├─┤├┤ ├─┤ │││─┼┐│ │├─┤├┬┘ │ ├┤ ├┬┘└─┐\n ┴ ┴└─┘┴ ┴─┴┘└─┘└└─┘┴ ┴┴└─ ┴ └─┘┴└─└─┘\n\n \")\n puts' Донжт интерфере ин оур интернал аффаирс. Лет ус странгле оур цитиизенс ин пеацер.\n (\"Don\\'t interfere in our internal affairs. We are playing Counter Strike this week.\")'.colorize(:red) \n puts \"\\n\"\n anim_two( \" The KGB has declined any involvement in the assistance of dealing with this virus \")\n puts\" \n \n \"\n puts \"\\n\"\n egg1 = [@easter_egg[0]]\n result_egg1 = @prompt.collect do\n key(:answer).select(\"Press Enter:\", egg1)\n end\n\n puts `clear`\n\n egg_result = result_egg1.values.join\n\n \n \n if egg_result = @easter_egg[0]\n plane_moving_anim()\n else puts \"goodbye\"\n end\n \n end",
"def display_emoji_break\n emoji = $EMOJIS.sample\n print \"#{emoji} \" * 15\n print \" #{path_clip} \"\n puts \"#{emoji} \" * 15\nend",
"def print_menu(options_types)\n min_length = options_types.collect { |item| item.length }.min\n num_of_items = get_number(\"menu items\", min_length)\n puts \"\\nHere's your menu:\"\n (1..num_of_items).each do |item_num|\n print \" #{item_num}.\"\n options_types.each { |type| print \" #{type.delete_at(rand(type.length - 1))}\" }\n puts\n end\nend",
"def draw\n return if @destoryed\n return unless @verbose\n unless DEBUG_PRINT_WAIT.nil?\n @string = get_debug_string\n end\n @hud_font.draw_text(@string, $program.width - 200, $program.height - 300, 100, 1, 1, 0xff_000000, :default)\n end",
"def print_times_blank(amount)\n amount.times { print \" \"}\n nil\n end",
"def random_p\n \"<p>#{texter.random_paragraph}</p>\"\n end",
"def random_lines(latin)\n number_of_lines = rand(10..15)\n song_lines = @lines.sample(number_of_lines)\n\n if latin\n rand(6..12).times do\n latin_line = LATIN.sample\n song_lines.insert(rand(number_of_lines), latin_line)\n number_of_lines += 1\n end\n end\n\n song_lines.join(\". \")\n end",
"def create_line(max_words)\n letters = [('a'..'z'), ('A'..'Z')].map(&:to_a).flatten # From a to z and from A to Z - All characters considered in ASCII\n words = []\n (0..rand(max_words)).each do\n word = (0..rand(25)).map { letters[rand(letters.length)] }.join # Gererate random strings with lenth between 1 and 26\n words.push(word)\n end\n words.join(' ')\n end",
"def sentence_length\n Random.rand(9)+3\nend",
"def scr_bold\n print \"\\33[1m\"\nend",
"def fmtstr_advance_count(prec)\n\t\t\n\t\t# no need to advance :)\n\t\treturn \"\" if prec == 0\n\t\t\n\t\t# asumming %x max normal length is 8...\n\t\tif prec >= 8\n\t\t\treturn \"%0\" + prec.to_s + \"x\"\n\t\tend\n\t\t\n\t\t# anything else, we just put some chars in...\n\t\treturn rand_text(prec)\n\tend",
"def rand_text_alpha_upper(length, bad=payload_badchars)\n if debugging?\n rand_text_debug(length)\n else\n Rex::Text.rand_text_alpha_upper(length, bad)\n end\n end",
"def rand_text_hex(length, bad=payload_badchars)\n if debugging?\n rand_text_debug(length, '0')\n else\n Rex::Text.rand_text_hex(length, bad)\n end\n end",
"def display()\r\n #final presenter as a string spaced out\r\n presentWord = \"\"\r\n #iterate the shadow word\r\n @shadowWord.each { |x| \r\n #add a space in the letters\r\n presentWord += x + \" \"\r\n }\r\n #remove the trailing spaces as spec\r\n presentWord.rstrip\r\n end",
"def notify_the_user_that_the_program_has_finished_by_calling_this_long_method_name\n done = rand(13)\n puts \"\\nBoo-yah!\" if done == 0\n puts \"\\nOh-yeah!\" if done == 1\n puts \"\\nYah-hoo!\" if done == 2\n puts \"\\nYeah-yuh!\" if done == 3\n puts \"\\nRock on!\" if done == 4\n puts \"\\n^_^\" if done == 5\n puts \"\\nRadical!\" if done == 6\n puts \"\\nAwesome!\" if done == 7\n puts \"\\nTubular!\" if done == 8\n puts \"\\nYay!\" if done == 9\n puts \"\\nGnarly!\" if done == 10\n puts \"\\nSweet!\" if done == 11\n puts \"\\nGroovy!\" if done == 12\n puts \"--------------------------------\\n\"\n end",
"def text s, x, y, c, f = font\n f.draw_solid_utf8 screen, s, x, y, *rgb[c]\n end",
"def color_puts(id, text)\n if id < 10\n print \"\\033[0;3#{id+1}m#{text}\\033[0m\\n\"\n else\n print \"#{text}\\n\"\n end\nend",
"def rand_title_three\n Array.new(4) do\n rand_word(5).capitalize + ' '\n end.join(' ').rstrip!\nend",
"def random_chars(num)\n\t\tchars = [\"\\u270a\",\"\\u231b\",\"\\u23f3\",\"\\u26a1\",\"\\u2b50\",\"\\u1f4aa\"]\n\t\treturn chars[rand(chars.count)]\n\tend",
"def draw_letters\n letter_freq = {\n A: 9, N: 6, B: 2, O: 8, C: 2, P: 2, D: 4, Q: 1, E: 12, R: 6, F: 2, S: 4,\n G: 3, T: 6, H: 2, U: 4, I: 9, V: 2, J: 1, W: 2, K: 1, X: 1, L: 4, Y: 2, M: 2, Z: 1,\n }\n\n avail_letters = array_gen(letter_freq)\n used_letters = avail_letters.sample(10)\n\n return used_letters\nend",
"def generate_greeting\n languages = %w[French Spanish English Italian Hindi Japanese Korean Chinese Tamil Polish Dutch German Swedish]\n greetings = %w[Bonjour Hola Greetings Ciao שלום こんにちは 여보세요 你好 வணக்கம் Cześć Hallo Guten\\ Tag Hej]\n selection = rand(languages.length)\n @greeting_language = languages[selection]\n @greeting = greetings[selection]\n end"
] |
[
"0.8265744",
"0.67774516",
"0.66434515",
"0.6322893",
"0.62821245",
"0.60768193",
"0.60268307",
"0.59610516",
"0.59377813",
"0.59319305",
"0.5915328",
"0.587851",
"0.5870912",
"0.58537483",
"0.58437955",
"0.5835893",
"0.58138955",
"0.58035374",
"0.57865846",
"0.5748406",
"0.5748272",
"0.57447565",
"0.57217085",
"0.57132083",
"0.56908506",
"0.568616",
"0.5676341",
"0.5660257",
"0.5644951",
"0.563876",
"0.5632541",
"0.56203103",
"0.5614592",
"0.55871713",
"0.55759376",
"0.55739033",
"0.5559969",
"0.5558541",
"0.55582494",
"0.5551333",
"0.5547458",
"0.5545976",
"0.55418146",
"0.55231535",
"0.55180395",
"0.55101055",
"0.54998136",
"0.54997677",
"0.5499114",
"0.54866815",
"0.54786164",
"0.5475332",
"0.5472075",
"0.5441821",
"0.54352087",
"0.5427052",
"0.5421531",
"0.5415107",
"0.5411804",
"0.5410335",
"0.54020786",
"0.53896916",
"0.53886116",
"0.5386948",
"0.53706616",
"0.5368722",
"0.5368349",
"0.53644013",
"0.53619456",
"0.534469",
"0.53395486",
"0.5332691",
"0.5331338",
"0.5322304",
"0.53184026",
"0.53056353",
"0.5305289",
"0.52934",
"0.5291371",
"0.528801",
"0.52780455",
"0.52715206",
"0.52693933",
"0.52693397",
"0.52691346",
"0.52676946",
"0.5267497",
"0.5264541",
"0.5263424",
"0.52509046",
"0.52499646",
"0.52453506",
"0.52411556",
"0.5240411",
"0.5239264",
"0.52376515",
"0.52370805",
"0.5236768",
"0.52346426",
"0.52338684"
] |
0.84779274
|
0
|
infiniteLoopWarning() This was written early in development incase I knew some logic at some point would cause an infinite loop. I'm keeping this method in here just in case logic is written that could accidentally cause an infinite loop Note to self: make this into a box using TTY
|
def infiniteLoopWarning(whereAmIFrom)
puts "______________________________________________________________________"
puts "|********************************************************************|"
puts "|********************************************************************|"
puts "|***************************WARNING!*********************************|"
puts "|*************This Method Causes an Infinite Loop!*******************|"
puts "|*******To stop this infinite loop, press CTRL+C in the terminal*****|"
puts "|**********If you wish to continue, enter 'Y' and hit return*********|"
puts "|*********Otherwise, enter anything else and return to safety********|"
puts "|********************************************************************|"
puts "|********************************************************************|"
puts "|____________________________________________________________________|"
case(whereAmIFrom)
when 0
betaFuntions()
when 1
menu()
else
puts "I forgot where I came from, I'm going back to the main menu"
menu()
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def infinite_loop?; end",
"def endless_loop?; end",
"def check_for_infinite_loop(processed_source, offenses_by_iteration); end",
"def loop; end",
"def infinite?; end",
"def keep_looping?\n true\n end",
"def loop_forever; end",
"def pre_loop; end",
"def say_hello\n p \"hello\"\n # say_hello # an infinite loop\nend",
"def loop\n end",
"def loop\n end",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end # fix\nend",
"def is_loop\n\n false\n end",
"def endless_loop\n loop { yield }\n end",
"def loop\n end",
"def run_loop\n end",
"def is_loop\n\n true\n end",
"def post_loop; end",
"def sleepy_run; end",
"def infinite?() end",
"def run_warned; end",
"def interrupt?; end",
"def while(&blk)\n loop{ !blk[] }\n end",
"def running?; end",
"def preloop\n end",
"def myloop\n while true\n yield\n end\nend",
"def my_loop\n while true\n yield\n end\nend",
"def foreverize\n loop do\n run\n end\n end",
"def run_interrupted; end",
"def kloop\n end",
"def unboxed\n $stderr.puts \"I should never happen\"\n end",
"def warn_no_continuations; end",
"def handle_fell_off_screen\n end",
"def halt; end",
"def halt; end",
"def code_like_crazy\r\n puts \"I'm crushing some code!\"\r\n end",
"def main\n loop do\n unless @context\n begin\n self.process(self.await_input)\n rescue ConsoleInterrupt\n self.replace '^C'\n self.println ':(', 2\n rescue ConsoleError => e\n self.print _INTL(\"{1}: {2}\",self.name,e.message), 0, true\n self.println ':(', 2\n rescue ConsoleExit\n self.exit_session\n break\n end\n end\n end\n end",
"def test_loop(options)\n Snooper.watch options\nrescue Interrupt\n puts # This is where the ^C is on unix\n puts \"Testing over, time for a coffee...\".yellow\nend",
"def bye; end",
"def running; end",
"def running; end",
"def slow_scroll()\r\n 10.times do\r\n sleep 0.05\r\n puts \"\"\r\n end\r\nend",
"def cartman_hates(thing)\n # while true\n puts \"What's there to hate about #{thing}?\"\nend",
"def halt!\n @running = false\n return nil\n end",
"def main()\n puts \"Starting:\"+Time.new.inspect\n n=5\n loop {\n t=Time.new\n puts \"Tick #{n}:\"+Time.new.inspect\n n=n-1\n if (n==0) \n puts \"Boom!\" \n raise \n end \n sleep 2\n \n }\nend",
"def parentloop; end",
"def check_for_implication_loops\n # actually this is tricky\n end",
"def cartman_hates(thing)\nwhile true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def idle?; end",
"def keep_going; end",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def idle\n sleep(5) while running?\n end",
"def run\n raise NotImplementedError, 'Generic loop has nothing to do'\n end",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\nend; end",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def put_hold_notice\n @io.puts\n @io.puts 'Pausing here -- run Ruby again to ' \\\n 'measure the next benchmark...'\n end",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\nend\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\nend\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\nend\nend",
"def stopsig(*) end",
"def safe_loop &block\n begin\n loop &block\n rescue => ex\n $log.debug( \"APP.rb rescue reached \")\n $log.debug( ex) if ex\n $log.debug(ex.backtrace.join(\"\\n\")) if ex\n ensure\n close\n # putting it here allows it to be printed on screen, otherwise it was not showing at all.\n if ex\n puts \"========== EXCEPTION ==========\"\n p ex \n puts \"===============================\"\n puts(ex.backtrace.join(\"\\n\")) \n end\n end\n end",
"def while(&block)\n\t\t\t\t\trepeat &block\n\t\t\t\tend",
"def infinite?\n end",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def print_1_forever\n while true do\n puts 1\n end\nend",
"def throw_away_meaningless_line\n\t\tputs \"I have no idea what you are talking about\"\n\tend",
"def non_interactive_mode(_pry_)\n _pry_.print = proc {}\n _pry_.exception_handler = proc do |o, e, _pry_|\n _pry_.run_command \"cat --ex\"\n o.puts \"...exception encountered, going interactive!\"\n interactive_mode(_pry_)\n end\n end",
"def let_mes_catch_up\n sleep 1\n end",
"def run\n while 1\n if step == 1 then break end\n end\n end",
"def protect_runtime_errors # &block\n\t\tbegin\n\t\t\tyield\n\t\trescue StandardError => e\n\t\t\t# keep execption from halting program,\n\t\t\t# but still output the exception's information.\n\t\t\tprocess_snippet_error(e)\n\t\t\t\n\t\t\tunload(kill:true)\n\t\t\t# ^ stop further execution of the bound @wrapped_object\n\t\tend\n\tend",
"def warn_no_continuations\n end",
"def main_loop\n\t\t\tbegin\n\t\t\t\tloop {\n\t\t\t\t\titerate\n\t\t\t\t\tlog.debug \"Finished iteration; sleeping for #{sleep_time}s.\"\n\t\t\t\t\tsleep sleep_time\n\t\t\t\t}\n\t\t\trescue Exception => e\n\t\t\t\t# We want to avoid crashing if at all possible, so we catch\n\t\t\t\t# everything, log it, sleep (to avoid thrashing or flooding the\n\t\t\t\t# logs completely if the error persists), and go back to the\n\t\t\t\t# main loop.\n\t\t\t\tlog.error(\"#{self.class.inspect}'s main loop crashed \" \\\n\t\t\t\t\t\t \"with #{e.inspect} at #{e.backtrace[0]}!\")\n\t\t\t\tsleep(sleep_time * 10)\n\t\t\t\tretry\n\t\t\tend\n\t\tend",
"def busy?; end",
"def postloop\n end",
"def do_not_thread; true; end"
] |
[
"0.77953",
"0.76390487",
"0.6622432",
"0.65400165",
"0.65247416",
"0.6403027",
"0.6373231",
"0.6268196",
"0.62585306",
"0.61858463",
"0.61858463",
"0.6183321",
"0.61659527",
"0.6134492",
"0.61285883",
"0.608467",
"0.60680455",
"0.60055166",
"0.5943251",
"0.59350204",
"0.59182143",
"0.5836319",
"0.581125",
"0.5792122",
"0.5770962",
"0.57691205",
"0.5767383",
"0.5760035",
"0.57105505",
"0.56868607",
"0.56771135",
"0.5657441",
"0.5655358",
"0.5611631",
"0.5611631",
"0.56066537",
"0.5605507",
"0.56029695",
"0.5594498",
"0.55860734",
"0.55860734",
"0.55576235",
"0.55494684",
"0.554913",
"0.554469",
"0.55295414",
"0.5525626",
"0.5520716",
"0.55193436",
"0.5492499",
"0.5492261",
"0.5484834",
"0.547699",
"0.5474176",
"0.5472925",
"0.54709804",
"0.54670644",
"0.54670644",
"0.54670644",
"0.5461724",
"0.5461354",
"0.5458253",
"0.54561645",
"0.54327416",
"0.54192114",
"0.54192114",
"0.54192114",
"0.54192114",
"0.54192114",
"0.54192114",
"0.54192114",
"0.54192114",
"0.54192114",
"0.54192114",
"0.54192114",
"0.54192114",
"0.54192114",
"0.54192114",
"0.54192114",
"0.54192114",
"0.54192114",
"0.54192114",
"0.54192114",
"0.54192114",
"0.54192114",
"0.54192114",
"0.54192114",
"0.54192114",
"0.54192114",
"0.5410335",
"0.5409104",
"0.5403841",
"0.54023117",
"0.5397614",
"0.53975004",
"0.53904754",
"0.53877527",
"0.5386665",
"0.53842556",
"0.5370458"
] |
0.62529755
|
9
|
Takes an enumerator to work with as argument.
|
def initialize(enum = nil, &blk)
if enum
#The enumerator being used.
@enum = enum
elsif blk
@enum = Enumerator.new do |yielder|
blk.call(yielder)
end
else
raise "No enum or block was given."
end
@eles = []
@end_eles = []
# Used to calculate length without depending corruption.
@length_cache = 0
# If the virtual array has become corrupted because of forgotten elements (by calling each and enumerating through elements).
@array_corrupted = false
# To allow the object to be thread-safe.
@mutex = Mutex.new
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def enumerator ; end",
"def enumerator ; end",
"def enumerator; end",
"def initialize(enumerator)\n @enumerator = enumerator\n end",
"def each &block\n if block_given?\n iterate_each &block\n self\n else\n self.to_enum\n end\n end",
"def each\n if block_given?\n @enum.each { |t| yield t }\n self\n else\n to_enum(:each)\n end\n end",
"def each\n enum = @head\n while (enum != nil) \n yield enum.value\n enum = enum.next\n end\n end",
"def infinite_select_2(enum)\n Enumerator.new do |yielder|\n enum.each do |value|\n yielder.yield(value) if yield(value)\n end\n end\nend",
"def my_each\n return to_enum unless block_given?\n\n i = 0\n arr = to_a\n while i <= arr.length - 1\n yield (arr[i])\n i += 1\n end\n self\nend",
"def my_each_with_index\n return to_enum unless block_given?\n\n index = 0\n my_each do |value|\n yield(value, index)\n index += 1\n end\n end",
"def taskforce_select(enum, &block)\n Enumerator.new do |current_value| # this default serves as the new generator for the enum generator to processed\n enum.each do|value| # this iterates careful through enum passed \n current_value.yield value if block.call(value) #only provide a value if its within check by code blocks\n end\n end\n end",
"def infinite_select(enum, &block)\n Enumerator.new do |yielder|\n enum.each do |value|\n if block.call(value) then yielder.yield value else break end\n end\n end\nend",
"def enumerator_class\n if defined?(Enumerator)\n Enumerator\n else\n Enumerable::Enumerator\n end\nend",
"def infinite_selectz(enum, &block)\n Enumerator.new do |yielder|\n enum.each do |value|\n yielder.yield(value) if block.call(value)\n end\n end\nend",
"def my_each_with_index\n if block_given?\n for i in 0.upto(self.length-1)\n yield self[i], i\n end\n else\n self.to_enum\n end\n end",
"def each\n if block_given?\n while row = shift\n yield row\n end\n else\n to_enum\n end\n end",
"def each\n\t\t\t@enumvalues ||= {}\n\t\t\t@enumvalues.each_value { |enumvalue| yield enumvalue }\n\t\tend",
"def to_enum(methname=:each!)\n # Why has Ruby 2 deprecated this form?\n #::Enumerator.new(self, methname) \n ::Enumerator.new do |y|\n __send__(methname) do |*a|\n y.yield *a\n end\n end\n end",
"def test_generator\n g = Enumerator::Generator.new(Proc.new { 1 })\n g.to_a\n assert(true)\n end",
"def each(&block)\n return to_enum unless block_given?\n\n @selected.each(&block)\n end",
"def robust_enumerator(collection)\n case collection\n when Hash, Struct\n collection.each_pair.to_a\n when Array\n Enumerator.new do |y|\n cur = collection.size\n until cur.zero?\n pos = collection.size - cur\n y << [pos, collection[pos]]\n cur -= 1\n end\n end\n when ->(c) { c.respond_to?(:each_pair) }\n collection.each_pair.to_a\n else\n fail TypeError, \"Can't dig/* in #{collection.class}\"\n end\n end",
"def initialize(object = nil, enum_sel = :each, *extra)\n # per specs, requires 1.8.8 or above\n unless object\n if block_given?\n raise(ArgumentError, 'Enumerator from block not supported in 1.8.7')\n else\n raise(ArgumentError, 'wrong number of arguments (0 for 1)')\n end\n end\n\n @ofs = 0\n @obj = object\n unless enum_sel._isSymbol\n raise TypeError, 'second arg must be a Symbol'\n end\n @enum_selector = enum_sel\n @extra_args = extra\n end",
"def my_each_with_index\n return to_enum unless block_given?\n\n i = 0\n while i < size\n yield(self[i], i)\n i += 1\n end\n self\n end",
"def test_0655_each_with_index\n @@log.debug \"test_0655_each_with_index starts\" if @@log.debug?\n assert_respond_to(@list, :each_with_index, \"test_0655_each_with_index_respond\")\n # Type check\n enum = @list.each_with_index\n result = enum.is_a? Enumerator\n assert(result,\"test_0655_each_with_index_class\") \n # Check each index number\n @list.each_with_index {|item, index|\n case\n when item == @aen\n assert(index == 0, \"test_0655_each_with_index_i0\")\n when item == @bsb\n assert(index == 1, \"test_0655_each_with_index_i1\")\n when item == @cab\n assert(index == 2, \"test_0655_each_with_index_i2\")\n when item == @dad\n assert(index == 3, \"test_0655_each_with_index_i3\")\n else\n flunk(\"test_0655_each_with_index_invalid\")\n end\n }\n#\n# The author's paper copy of the 1.9 Pickaxe implies that each_with_index\n# can be invoked with one or more arguments as shown below.\n#\n# This appears to be incorrect, which can be confirmed by either:\n#\n# * Attempting to run the code shown\n# * Documentation at http://ruby-doc.org/core-1.9/classes/Enumerable.html\n#\n=begin\n # Invoke with argument(s)\n myarg = \"-tag\"\n accum = \"\"\n @list.each_with_index(myarg) {|item, index|\n case\n when item == @aen\n assert(index == 0, \"test_0655_each_with_index_i0a\")\n assert(myarg == \"-tag\", \"test_0655_each_with_index_tag0\")\n when item == @bsb\n assert(index == 1, \"test_0655_each_with_index_i1a\")\n assert(myarg == \"-tag\", \"test_0655_each_with_index_tag1\")\n when item == @cab\n assert(index == 2, \"test_0655_each_with_index_i2a\")\n assert(myarg == \"-tag\", \"test_0655_each_with_index_tag2\")\n when item == @dad\n assert(index == 3, \"test_0655_each_with_index_i3a\")\n assert(myarg == \"-tag\", \"test_0655_each_with_index_tag3\")\n else\n flunk(\"test_0655_each_with_index_invalid\")\n end\n }\n=end\n @@log.debug \"test_0655_each_with_index ends\" if @@log.debug?\n end",
"def my_each_with_index\n return to_enum unless block_given?\n\n i = 0\n while i < length\n yield(self[i], i)\n i += 1\n end\n end",
"def each(&block)\n return to_enum unless block_given?\n @index.each(&block)\n self\n end",
"def each(&block)\n if block\n to_enum.each(&block)\n return nil\n else\n return to_enum\n end\n end",
"def each_entry\n return to_enum unless block_given?\n\n @tar.each do |entry|\n yield entry\n end\n ensure\n @tar.rewind\n end",
"def each(&block)\n return to_enum unless block_given?\n index.each(&block)\n self\n end",
"def initialize(enum = nil, &block)\n warning \"Using inefficient threaded enumerator for #{enum.inspect}, consider writing a iterator\" if $DEBUG\n @queue_finalizer = QueueFinalizer.new\n ObjectSpace.define_finalizer self, &@queue_finalizer\n _setup(enum, block)\n end",
"def enumerator_from(starting_value, &block)\n return Enumerator.produce((yield starting_value), &block) if Enumerator.respond_to?(:produce)\n\n Enumerator.new do |y|\n last = starting_value\n loop { y << (last = yield last) }\n end\nend",
"def filter(enum, &block)\n Enumerator.new do |yielder| \n enum.each do |value|\n yielder.yield(value) if block.call(value) \n end\n end \nend",
"def eternal_sequence\n Enumerator.new do |enum|\n i = 0\n while true\n enum.yield i # <- Notice that this is the yield method of the enumerator, not the yield keyword\n i +=1\n end\n end\nend",
"def each\n enum_options.each {|e| yield e.new }\n end",
"def each\n return to_enum unless block_given?\n entries.each { |entry| yield(entry) }\n self\n end",
"def enumerator\n SolutionEnumerator.new(self.method(:interpret), dimacs)\n end",
"def iterate(iterator)\n\tloop do\n\t\tyield iterator.next\n\tend\nend",
"def enumerator\n @enumerator ||= Enumerator.new(spiral_output.length) { |y| spiral_output.reverse_each { |e| y << e }}\n end",
"def each_index\n return to_enum(__callee__) unless block_given?\n \n each_with_index{ |_, idx| yield(idx) }\n end",
"def ensure_enum()\n if self.kind_of? Enumerator\n self\n else\n self.to_enum\n end\n end",
"def my_select(parameter = nil)\n arr = []\n if block_given?\n my_each { |value| arr.push(value) if yield(value) }\n elsif parameter.nil?\n return Enumerator.new(arr)\n else\n my_each { |value| arr.push(value) if parameter.call(value) }\n end\n arr\n end",
"def each\n return to_enum(:each) unless block_given?\n\n seek(:head)\n yield current_entry while move_next\n end",
"def each(&block)\n if block\n _target.each(&block)\n else\n to_enum\n end\n end",
"def each\n return to_enum :each unless block_given?\n\n loop do\n items = instance_exec(&@proc)\n\n items.each do |item|\n yield item\n end\n\n break if items.empty?\n end\n end",
"def enumerate(enumerable, options = {}, &block)\n options[:method_args] ||= []\n options[:yield_args] ||= []\n yield_args = options[:yield_args] * ', '\n method_args = arguments_for_call options[:method_args] # foo, bar, function\n method_args << ', ' unless method_args.blank?\n add_variable_assignment!(options[:variable]) if options[:variable]\n append_enumerable_function!(\"#{enumerable.to_s.camelize(:lower)}(#{method_args}function(#{yield_args}) {\")\n # only yield as many params as were passed in the block\n yield(*options[:yield_args].collect { |p| JavaScriptVariableProxy.new(@generator, p) }[0..block.arity-1])\n add_return_statement! if options[:return]\n @generator << '});'\n end",
"def test_0920_each_entry\n @@log.debug \"test_0920_each_entry starts\" if @@log.debug?\n assert_respond_to(@list, :each_entry, \"test_0920_each_entry_respond\")\n # Type check\n enum = @list.each_entry\n type_check = enum.is_a? Enumerator\n assert(type_check,\"test_0920_each_entry_class\")\n # :TODO: Realistic example(s).\n @@log.debug \"test_0920_each_entry ends\" if @@log.debug?\n end",
"def block_call\n expect :iter\n self[1]\n end",
"def &(enum)\n enum.is_a?(Enumerable) or raise ArgumentError, \"value must be enumerable\"\n n = self.class.new\n enum.each { |o| n.add(o) if include?(o) }\n n\n end",
"def next\n raise StopIteration if @enumerators.empty?\n minimum_enumrator.next\n end",
"def iterator()\n raise NotImplementedError\n end",
"def each(&block)\n if block_given?\n names.each(&block)\n self\n else\n to_enum\n end\n end",
"def each_with_index(&block)\n return to_enum :each_with_index unless block\n\n i = 0\n self.each{|*val|\n block.call(val.__svalue, i)\n i += 1\n }\n self\n end",
"def test_0160_each_with_index\n @@log.debug \"test_0160_each_with_index starts\" if @@log.debug?\n assert_respond_to(@list, :each_with_index, \"test_0160_each_with_index_respond\")\n # Basic operation\n ta = []\n @list.each_with_index do |obj, ndx|\n ta << \"#{obj.first}-#{ndx}\"\n end\n assert_equal([\"Alfred-0\", \"Bob-1\", \"Charlie-2\", \"Dilbert-3\"], ta, \"test_0160_each_with_index_basic\")\n # Check Enumerator or Enumerable::Enumerator return, no block given\n new_list = @list.each_with_index\nif RUBY_VERSION >= \"1.9\"\n result = new_list.is_a? Enumerator\n assert(result, \"test_0160_each_with_index_enumcheck\")\nelse\n result = new_list.is_a? Enumerable::Enumerator\n assert(result, \"test_0160_each_with_index_enumenumcheck\")\nend\n @@log.debug \"test_0160_each_with_index ends\" if @@log.debug?\n end",
"def use\n if !@open_func\n raise ArgumentError, \"FileEnumerator reused.\"\n end\n use_count_up\n begin\n yield\n ensure\n use_count_down\n end\n end",
"def each\n return to_enum(:each) unless block_given?\n @size.times { |position| yield self[position] }\n end",
"def each(&block)\n \n if (!block_given?)\n to_enum\n else\n parse_with_block(&block)\n end\n \n end",
"def my_select\n if block_given?\n arr = Array.new\n self.my_each do |x|\n if yield x\n arr << x\n end\n end\n arr\n else\n self.to_enum\n end\n end",
"def enumerate(type, opts)\n raise Error::SubclassResponsibility\n end",
"def each(&block)\n if block\n loop do\n poll if @events.empty?\n event = @events.shift\n yield event if event\n end\n else\n to_enum\n end\n end",
"def iterate seed, &block\n Enumerator.new do |e|\n current = seed\n loop do\n e << current\n current = yield current\n end\n end\nend",
"def each(&block)\n return enum_for(:each) unless block_given?\n \n # if using the block form only, don't \"next\" for internal iteration\n if @block && !@enum\n @block.call Enumerator::Yielder.new(&block)\n else\n rewind\n\n until end?\n yield self.next\n end\n end\n \n self\n end",
"def each(&block)\n block or return enum_for(__method__)\n to_a.each(&block)\n self\n end",
"def progress_counter(enum)\n Enumerator.new do |y|\n count = 0\n enum.each do |x|\n if (count += 1) == 100\n count = 0\n STDERR.print '.' # STDOUT could be redirected, so we print to STDERR\n end\n y.yield(x)\n end\n end\n end",
"def each\n return to_enum unless block_given?\n list = self\n until list.empty?\n yield(list.head)\n list = list.tail\n end\n end",
"def each(&block)\n block_given? ? all.each(&block) : all.to_enum\n end",
"def each(&block)\n return to_enum unless block_given?\n @map.each(&block)\n self\n end",
"def my_each_with_index\n return to_enum unless block_given?\n i = 0\n array = []\n while i < size\n yield to_a[i], i\n array << to_a[i]\n i += 1\n end\n array\n end",
"def iterator(&proc)\n\tputs \"Entering iterator\"\n\tproc.call\n\tputs \"Exiting iterator\" # This code is never executed\nend",
"def each(node, &block)\n return to_enum(__method__, node) unless block_given?\n visit(node, &block)\n end",
"def each(&blk)\n enum = Enumerator.new do |y|\n @converted.each {|k, v| y.yield(k,v) }\n @hash.each {|k,v| y.yield(k, self.move_value(k)) }\n end\n if blk.nil?\n enum\n else\n enum.each do |k,v|\n blk.call(k,v)\n end\n end\n end",
"def my_collect(array, &block)\nnew_array = []\ncounter =0\nif block_given?\nwhile counter < array.length\n new_array[counter] = yield(array[counter])\n counter +=1\nend\nreturn new_array\nelse \n return self.to_enum\nend\nend",
"def start_after(&blk)\n Enumerator.new do |out|\n s = self.ensure_enum\n loop do\n break if blk.call(s.next)\n end\n \n loop do\n out.yield s.next\n end\n end\n end",
"def +(enum)\n Enumerator.new do |y|\n self.each { |x| y.yield(x) }\n enum.each { |x| y.yield(x) }\n end\n end",
"def each\n return [].to_enum if predicate.nil?\n\n if block_given?\n objects do |object|\n converted_object = convert_object(object)\n yield converted_object unless converted_object.nil?\n end\n end\n\n to_enum\n end",
"def each\n return enum_for unless block_given?\n\n while (chunk = read)\n yield chunk\n end\n end",
"def my_select\n return to_enum unless block_given?\n\n selected = []\n my_each { |i| selected << i if yield(i) }\n selected\n end",
"def each\n return to_enum unless block_given?\n records.each { |record| yield record }\n end",
"def each(&block)\n return to_enum unless block_given?\n @aliases.each(&block)\n self\n end",
"def -(enum)\n Enumerator.new do |y|\n set = enum.to_set\n self.each do |x|\n y.yield(x) if not set.include? x\n end\n end\n end",
"def each\n enum = cursor.to_enum\n enum.each do |doc|\n yield doc\n end if block_given?\n enum\n end",
"def each\n return to_enum(:each) unless block_given?\n loop do\n pair = next_pair\n break if pair.nil?\n yield(pair[0], pair[1])\n end\n end",
"def initialize(enumerable)\n @enumerable = enumerable\n end",
"def iterate_proc!(&cod)\n self.each_with_index { |n, i|\n self[i] = cod.call(n)\n }\n end",
"def each\n @timevec.each_with_index { |time,i | v = values_at(i, *enum_attrs); yield v }\n end",
"def test_thread_enumerator\n in_q = Queue.new\n out_q = Queue.new\n\n te = Gapic::Rest::ThreadedEnumerator.new do |in_q, out_q|\n (0..2).each do |i|\n in_q.deq\n out_q.enq i\n end\n\n raise StandardError.new \"Error\"\n end\n\n (0..2).each do |i|\n assert_equal i, te.next\n end\n\n err = assert_raises(StandardError) do\n te.next\n end\n\n assert_equal \"Error\", err.message\n end",
"def each_value\n return to_enum :each_value unless block_given?\n each_field_with_value do |_, _, value|\n yield value\n end\n end",
"def enums(&block)\n values = get_enums\n if block\n values.each do |v|\n yield v\n end\n else\n values\n end\n end",
"def each\n return enum_for(:each) unless block_given?\n\n item = @head\n\n while item do\n yield item.value\n item = item.next\n end\n end",
"def apply\n ->(f, enum) { f.(enum) }.curry\n end",
"def each\n for each element\n yield(element)\n end\nend",
"def each\n return enum_for(:each) unless block_given?\n @list.each do |item|\n yield item\n end\n end",
"def each_with_iterator\n\n iterator = get_iterator_fast\n while (iterator.has_next?)\n yield iterator.get_next, iterator if block_given?\n end\n \n end",
"def my_each(&prc)\n end",
"def each\n return to_enum :each unless block_given?\n 0.upto(size-1) { |i| yield self[i] }\n self\n end",
"def each\n return to_enum :each unless block_given?\n 0.upto(size-1) { |i| yield self[i] }\n self\n end",
"def initialize(enum = nil, &block) # :yields: o\n @val = 0\n\n enum.nil? and return\n\n if block\n do_with_enum(enum) { |o| add(block[o]) }\n else\n merge(enum)\n end\n end",
"def each(&block)\n\t\t\t\treturn to_enum unless block_given?\n\t\t\t\t\n\t\t\t\twhile chunk = gets\n\t\t\t\t\tyield chunk\n\t\t\t\tend\n\t\t\tend",
"def each\n return to_enum( :each ) unless block_given?\n @data.each { |ar| yield ar }\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 around_invoke(options={})\n proxies = options.delete(:proxies)\n with_context_mock(options) do\n enum = enumerable.dup\n with_proxies(enum, type: proxies) do\n # Create a new enumerator for the specific context and enum.\n enumerator = Xe::Enumerator.new(context, enum)\n yield(enumerator)\n end\n end\n end"
] |
[
"0.76930577",
"0.76930577",
"0.74891657",
"0.69930017",
"0.6499236",
"0.63552153",
"0.63498425",
"0.6319797",
"0.6299976",
"0.6237401",
"0.6231643",
"0.6198141",
"0.6145268",
"0.6138899",
"0.61232275",
"0.6090671",
"0.607028",
"0.6049706",
"0.6042774",
"0.60382044",
"0.60297173",
"0.59864056",
"0.59435016",
"0.58981997",
"0.5891645",
"0.58828795",
"0.58793986",
"0.5874487",
"0.5870132",
"0.5866803",
"0.5857616",
"0.5847283",
"0.58189857",
"0.58117706",
"0.5789625",
"0.577998",
"0.5779926",
"0.57425064",
"0.5740886",
"0.5735947",
"0.5717597",
"0.5712837",
"0.570928",
"0.56993",
"0.569858",
"0.5669366",
"0.5655611",
"0.5648525",
"0.5646562",
"0.5612258",
"0.55919045",
"0.5581295",
"0.5555695",
"0.5542965",
"0.5538148",
"0.55344117",
"0.55306154",
"0.5530581",
"0.5529767",
"0.55095154",
"0.54939514",
"0.54917645",
"0.5481937",
"0.54723674",
"0.54683864",
"0.54682744",
"0.54636216",
"0.54609466",
"0.54553694",
"0.540678",
"0.54045147",
"0.5401607",
"0.540115",
"0.53990525",
"0.5393552",
"0.5393312",
"0.5375867",
"0.53734636",
"0.53619957",
"0.5358744",
"0.5355111",
"0.5337132",
"0.53361464",
"0.5329899",
"0.5326606",
"0.5324827",
"0.5317039",
"0.53166586",
"0.5309322",
"0.529968",
"0.5296663",
"0.5282712",
"0.5280105",
"0.527926",
"0.527926",
"0.5277307",
"0.52765155",
"0.5270626",
"0.52643764",
"0.52636963"
] |
0.5290933
|
91
|
Cache the first elements (if not cached already) and returns it.
|
def first
check_corrupted
cache_ele if @eles.empty?
return @eles.first
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def first\n items.compact.first\n end",
"def get_first\n return @head.data if @head\n return @head\n end",
"def first\n self.take(1)[0]\n end",
"def first\n @head.lru_next\n end",
"def first\n @ordered_elements.first\n end",
"def get_first\n return @head ? @head.data : nil\n end",
"def first\n return @front.head unless @front.empty?\n @rear.last # memoize?\n end",
"def get_first\r\n return @head ? @head.data : nil\r\n end",
"def first\n\n wi(fetch_all({}).first)\n end",
"def get_first\n return @head if @head.nil?\n\n return @head.data\n end",
"def first\n @current = self.head if self.head\n @current.value rescue nil\n end",
"def first\n return sync { @first }\n end",
"def get_first\n return head ? head.data : nil\n end",
"def first\n @elements.empty? ? nil : @elements[0]\n end",
"def get_first\n current = @head\n return nil if current.nil?\n \n return @head.data\n end",
"def get_first\n return nil if @head.nil?\n return @head.data\n end",
"def first\n @enumerable.first\n end",
"def get_first\n return nil if @head.nil?\n\n return @head.data\n end",
"def get_first\n return nil if @head.nil?\n\n return @head.data\n end",
"def get_first\r\n # if the list is empty, head is nil\r\n if @head.nil?\r\n return nil\r\n else \r\n value = @head.data\r\n return value\r\n end\r\n end",
"def get_first\n return @head.nil? ? nil : @head.data\n end",
"def get_first\n return @head.nil? ? nil : @head.data\n end",
"def get_first\n \n return nil if @head.nil?\n return @head.data\n \n end",
"def get_first\n if @head == nil\n return nil\n else\n return @head.data\n end\n end",
"def first\n\n @items.values.first\n end",
"def get_first\n return nil if !@head\n return @head.data\n end",
"def get_first\n @head.nil? ? nil : @head.data\n end",
"def peek_first\n raise 'No such element' if @size == 0\n @head.value\n end",
"def first\n all[0]\n end",
"def get_first\r\n if @head \r\n return @head.data\r\n else \r\n return nil\r\n end\r\n end",
"def get_first\n return nil if head.nil?\n return head.data\n end",
"def get_first\n @head == nil ? nil : @head.data\n end",
"def caar; first.first end",
"def first\n @items.first\n end",
"def first\n limit(1).to_a.first\n end",
"def first() end",
"def first\n result ? all.first : limit(1).all.first\n end",
"def first\n _id, entry = @redis.xrange(key, '-', '+', count: 1).first\n entry\n end",
"def first\n all.first\n end",
"def first\n all.first\n end",
"def first\n all.first\n end",
"def first\n all.first\n end",
"def cache(count)\n @cached_elements = active_elements.pop(count)\n return\n end",
"def first\r\n self[0]\r\n end",
"def first(count = nil)\n if count.nil?\n @collection.first\n else\n out = []\n @collection.first(count).each do |item|\n out << item\n end\n out\n end\n end",
"def first ; list.first ; end",
"def first(n = 1)\n return self.clone if n >= self.size\n return self[0] if n == 1\n return self[0...n]\n end",
"def first\n to_a.first\n end",
"def first\n self[0]\n end",
"def first\n self[0]\n end",
"def first\n results.first\n end",
"def first\n all.first\n end",
"def first\n all.first\n end",
"def first\n all.first\n end",
"def first\n self.slice(0)\n end",
"def first\n all.first\n end",
"def fetch_first(&block)\n Volt.logger.warn('.fetch_first is deprecated in favor of .first')\n first\n end",
"def get_first_element(arr)\n return arr.first()\nend",
"def first(opts={})\n ::Kernel.Veneer(find_first(::Hashie::Mash.new(opts)))\n end",
"def first\n lock {\n first_id = resolve_steps(:first)\n first_id.nil? ? nil : _load(first_id)\n }\n end",
"def first\n @adapter.first(collection)\n end",
"def list_first(list)\n list.head.data unless list.head.nil?\nend",
"def get_first\r\n @head&.data\r\n end",
"def first_item\n items.first\n end",
"def first\n @head.val\n end",
"def first\n self[0]\n end",
"def initial_entry()\n return sets[0].first\n end",
"def initial_entry()\n return sets[0].first\n end",
"def first\r\n\t\t@set.first\r\n\tend",
"def first\n response = query(:per_page => 1, :page => 1).get!\n response[:results].first\n end",
"def first_or_initialize(attrs = {})\n fetch.first || build(attrs)\n end",
"def first\n @values.first\n end",
"def first(*args)\n find_first_or_last(:first, *args)\n end",
"def first!\n fail_not_found_if_nil(first)\n end",
"def first\n\t\traise \"ContainerEmpty\" if @head.nil?\n\t\t@head\n\tend",
"def first\n if @prv\n @prv.first\n else\n self\n end\n end",
"def first(*args)\n all.send(:first, *args)\n end",
"def cache_fetch(key, default = nil)\n nkey = namespaced(key)\n\n # Delete expired rows\n @dataset.select.filter(:key => nkey) do\n expires < Time.now\n end.delete\n\n # Get remaining row (if any)\n result = @dataset.select(:value).filter(:key => nkey).limit(1)\n\n if result.empty?\n return default\n else\n return deserialize(result.first[:value])\n end\n end",
"def cache_fetch(key, default = nil)\n nkey = namespaced(key)\n\n # Delete expired rows\n @dataset.select.filter(:key => nkey) do\n expires < Time.now\n end.delete\n\n # Get remaining row (if any)\n result = @dataset.select(:value).filter(:key => nkey).limit(1)\n\n if result.empty?\n return default\n else\n return deserialize(result.first[:value])\n end\n end",
"def first; self.objects.first end",
"def first(key)\n values(key).first\n end",
"def afirst(selector={}, opts={}, &blk)\n opts[:limit] = 1\n afind(selector, opts) do |res|\n yield res.first\n end\n end",
"def get_first_element(arr)\n arr.first\nend",
"def first\n enumerator(:limit => 1).first \n end",
"def first\n # return value if head node is set\n if !@head.nil?\n @head.value\n else\n # otherwise raise an exception\n raise \"List is empty\"\n end\n end",
"def try_with_cache(obj, source, consume_all)\n beg = source.bytepos\n \n # Not in cache yet? Return early.\n unless entry = lookup(obj, beg)\n result = obj.try(source, self, consume_all)\n \n if obj.cached?\n set obj, beg, [result, source.bytepos-beg]\n end\n \n return result\n end\n\n # the condition in unless has returned true, so entry is not nil.\n result, advance = entry\n\n # The data we're skipping here has been read before. (since it is in \n # the cache) PLUS the actual contents are not interesting anymore since\n # we know obj matches at beg. So skip reading.\n source.bytepos = beg + advance\n return result\n end",
"def using_first(array)\n array.first\nend",
"def using_first(array)\n array.first\nend",
"def using_first(array)\n array.first\nend",
"def using_first(array)\n array.first\nend",
"def [](row_number)\n if fully_cached?\n cache[row_number]\n else\n to_a[row_number]\n end\n end",
"def first\n each do |cb|\n return cb\n end\n end",
"def first\n each do |cb|\n return cb\n end\n end",
"def getMin()\n element=@store[1]\n\n #copy last element to the first...\n @store[1]=@store[@store.length-1]\n @store.delete_at(@store.length-1) #delete the last element \n\n #We need to restore the Heap Structure if altered\n heapify(1)\n return element\n end",
"def first(*args)\n find(:first, *args)\n end",
"def using_first(array)\n first_element=array.first\nend",
"def first(*args)\n find(:first, *args)\n end",
"def first(*args)\n find(:first, *args)\n end",
"def first\n @head\n end",
"def get_cached(args)\n cache_key = gen_cache_key(args)\n\n begin\n cached_val = MongoMapper::Document.redis.get(cache_key)\n rescue Exception\n cached_val = nil\n end\n\n unless cached_val\n res = where(args)\n result_count = res.count\n if result_count == 0\n return nil\n elsif result_count == 1\n cached_val = Octo::Utils.serialize(res.first)\n MongoMapper::Document.redis.setex(cache_key, get_ttl, cached_val)\n elsif result_count > 1\n cached_val = Octo::Utils.serialize(res)\n MongoMapper::Document.redis.setex(cache_key, get_ttl, cached_val)\n end\n end\n begin\n Octo::Utils.deserialize(cached_val)\n rescue Exception => e\n Octo.logger.error e\n nil\n end\n end"
] |
[
"0.6740814",
"0.67160505",
"0.6685045",
"0.6624165",
"0.6600085",
"0.6591254",
"0.6564186",
"0.65391654",
"0.6535495",
"0.65317184",
"0.6508876",
"0.65011096",
"0.6491118",
"0.64525986",
"0.64417773",
"0.6436038",
"0.64311564",
"0.6399928",
"0.6399928",
"0.6398635",
"0.63743484",
"0.63743484",
"0.6368751",
"0.6365461",
"0.63643265",
"0.63307387",
"0.6294347",
"0.6266233",
"0.62658274",
"0.62645495",
"0.6249282",
"0.6241589",
"0.62209034",
"0.6220774",
"0.61854637",
"0.61810946",
"0.6175035",
"0.61651415",
"0.61481535",
"0.61481535",
"0.61481535",
"0.61481535",
"0.61444175",
"0.61411035",
"0.61048806",
"0.609456",
"0.60898507",
"0.6087011",
"0.6071064",
"0.6071064",
"0.6048446",
"0.6043531",
"0.6043531",
"0.6043531",
"0.60203713",
"0.59949493",
"0.5992202",
"0.5950969",
"0.59165734",
"0.59147346",
"0.58991796",
"0.589903",
"0.58914185",
"0.58837616",
"0.58752567",
"0.58668965",
"0.58529377",
"0.58529377",
"0.5842891",
"0.58155876",
"0.58145136",
"0.57906294",
"0.57867044",
"0.57836896",
"0.57824814",
"0.57824486",
"0.57637805",
"0.5760475",
"0.5760475",
"0.575265",
"0.5745279",
"0.57365423",
"0.5731208",
"0.5719451",
"0.5709167",
"0.5708666",
"0.5699539",
"0.5699539",
"0.5699539",
"0.5699539",
"0.56865406",
"0.5681879",
"0.5681879",
"0.5681752",
"0.5678082",
"0.5665467",
"0.5661277",
"0.5661277",
"0.5651648",
"0.5650914"
] |
0.73728454
|
0
|
Returns true if the arrayenumerator is empty.
|
def empty?
if @empty == nil
cache_ele if @length_cache == 0
if @length_cache > 0
@empty = false
else
@empty = true
end
end
return @empty
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def empty?\n @iterator.nil?\n end",
"def empty?\n iterator.nil?\n end",
"def empty?\r\n @arr.empty?\r\n end",
"def empty?\n to_ary.empty?\n end",
"def empty?\n to_ary.empty?\n end",
"def empty?\n to_ary.empty?\n end",
"def empty?\n @ary.empty?\n end",
"def is_empty?\n @array.length == 0\n # if @array.length = 0\n # true\n # else\n # false\n # end\n end",
"def empty?\n size == 0\n end",
"def empty?\n size == 0\n end",
"def empty?\n size == 0\n end",
"def empty?\n size.zero?\n end",
"def empty?\n @size == 0\n end",
"def empty?\n @size == 0\n end",
"def empty?()\n return @length == 0\n end",
"def is_empty?\n size == 0\n end",
"def empty?\n # raise NotImplementedError, \"Not yet implemented\"\n if size > 0\n return false\n end\n return true\n end",
"def empty?\n size.zero?\n end",
"def empty?\n return @size == 0\n end",
"def empty?\n size.zero?\n end",
"def empty?\n size.zero?\n end",
"def empty?\n size.zero?\n end",
"def empty?\n size.zero?\n end",
"def empty?\n size == 0\n end",
"def empty?\n @size == 0\n end",
"def empty?\n @size == 0\n end",
"def __empty?\n all?(&:__empty?)\n end",
"def empty?\n\t\t\tsize == 0\n\t\tend",
"def empty?\n return self.length == 0\n end",
"def empty?\n @size == 0\n end",
"def empty?\n @size == 0\n end",
"def empty?\n peek\n false\n rescue StopIteration\n true\n end",
"def empty?\n\t\treturn size.zero?\n\tend",
"def empty?\n size == 0\n end",
"def empty?\n size == 0\n end",
"def has_empty?(a)\n if a.instance_of? Array\n ret = false\n a.each { |x| ret = true if has_empty?(x) }\n ret\n else\n not a or a.empty?\n end\n end",
"def empty?\n @pointer >= @enum.size\n end",
"def empty?\n self.count == 0\n end",
"def empty?\n self.count == 0\n end",
"def is_empty?\n self.size == 0\n end",
"def empty?\n @length == 0\n end",
"def empty?\n self.length == 0\n end",
"def empty?\n length == 0\n end",
"def empty?\n length == 0\n end",
"def empty?\n length == 0\n end",
"def empty?\n count == 0\n end",
"def empty?\n count == 0\n end",
"def is_empty()\n if @length == 0\n true\n else\n false\n end\n end",
"def empty?\n length.zero?\n end",
"def empty?\n @size.zero?\n end",
"def empty?\n count == 0\n end",
"def empty?\r\n @length == 0\r\n end",
"def empty?\n !@first_pointer\n end",
"def empty?\n _values.all?(&:empty?)\n end",
"def empty?\n @items.count == 0\n end",
"def empty?\r\n @length == 0\r\n end",
"def empty?\r\n @length == 0\r\n end",
"def empty?\r\n @length == 0\r\n end",
"def empty?\r\n @length == 0\r\n end",
"def empty?\n return true if self.curr == 0\n false\n end",
"def empty?\n @buffers.values.all?(&:empty?)\n end",
"def empty?\n @_values.empty?\n end",
"def empty?\n _values.empty?\n end",
"def empty?\n return false\n end",
"def is_empty()\n return @items.empty?\n end",
"def empty?\n each do |cell|\n return false if cell.value.to_i != 0\n end\n true\n end",
"def empty?\n count <= 0\n end",
"def empty?\n @elements.empty?\n end",
"def empty?\n @is_empty\n end",
"def empty?\n @length == 0\n end",
"def empty?\n @next.nil?\n end",
"def empty?\n cardinality == 0\n end",
"def array_fast_empty?(arr)\n return true if arr.size.zero?\n\n arr.each do |a|\n if a.is_a?(Array)\n return false if !array_fast_empty?(a)\n\n next\n end\n return false\n end\n\n true\n end",
"def empty?\n @index == 0\n end",
"def isEmpty?()\r\n return @items == 0\r\n end",
"def empty?\n @data.empty?\n end",
"def empty?\n @data.empty?\n end",
"def empty?\n count.zero?\n end",
"def empty?\n count.zero?\n end",
"def empty?\n count.zero?\n end",
"def empty?\n true\n end",
"def empty?\n true\n end",
"def empty()\n @size == 0\n end",
"def empty()\n @size == 0\n end",
"def empty?\n @count == 0\n end",
"def empty?\n @count == 0\n end",
"def empty?\n @count == 0\n end",
"def empty?\n @count == 0\n end",
"def empty?\n @i_keys.empty?\n end",
"def empty?\n entries.all? { |entry| entry.empty? }\n end",
"def empty?\n each_cell do |cell|\n return false if cell\n end\n true\n end",
"def empty?\n\t\t@length == 0\n\tend",
"def empty?\n entries.empty?\n end",
"def empty?\n return self.length == 0\n end",
"def empty?()\n return @first.nil?\n end",
"def empty?\n size == 0 # Equivalent to (down == self)\n end",
"def empty?\n length == 0\n end",
"def empty?\n empties? INTERNAL_COLLECTIONS\n end",
"def __empty?\n return false unless super\n __elements.values.all?(&:__empty?)\n end",
"def empty?\n @items.empty?\n end",
"def empty?\n @items.empty?\n end"
] |
[
"0.8013646",
"0.8012338",
"0.7983263",
"0.789861",
"0.789861",
"0.78563607",
"0.7804117",
"0.7783732",
"0.77368253",
"0.77368253",
"0.77368253",
"0.7724417",
"0.77150285",
"0.77150285",
"0.77045745",
"0.7695986",
"0.7680893",
"0.7679936",
"0.7670419",
"0.7660207",
"0.7660207",
"0.7660207",
"0.7660207",
"0.7619561",
"0.76006633",
"0.76006633",
"0.7577657",
"0.7519421",
"0.75020957",
"0.7496086",
"0.7496086",
"0.7474122",
"0.7472542",
"0.7471759",
"0.7471759",
"0.7441342",
"0.74358815",
"0.7432639",
"0.7432639",
"0.74300915",
"0.7429529",
"0.74189836",
"0.7414221",
"0.7414221",
"0.7414221",
"0.7410249",
"0.7410249",
"0.7409055",
"0.7391886",
"0.73868513",
"0.73541945",
"0.7354146",
"0.734123",
"0.73325956",
"0.73244756",
"0.7323872",
"0.7323872",
"0.7323872",
"0.7323872",
"0.73231274",
"0.731969",
"0.73079073",
"0.729716",
"0.7286575",
"0.7280476",
"0.7274641",
"0.726927",
"0.72627723",
"0.7258998",
"0.72566295",
"0.72548634",
"0.72522324",
"0.72463495",
"0.72290707",
"0.72231287",
"0.7214099",
"0.7214099",
"0.7194905",
"0.7194905",
"0.7194905",
"0.7188201",
"0.7188201",
"0.7182736",
"0.7182736",
"0.7180809",
"0.7180809",
"0.7180809",
"0.7180809",
"0.7175771",
"0.7163156",
"0.7158044",
"0.7142212",
"0.71394974",
"0.71384305",
"0.71342885",
"0.712886",
"0.71205735",
"0.7112166",
"0.71078956",
"0.71033216",
"0.71033216"
] |
0.0
|
-1
|
Returns each element and releases them from cache.
|
def each(&block)
if block
to_enum.each(&block)
return nil
else
return to_enum
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cache(count)\n @cached_elements = active_elements.pop(count)\n return\n end",
"def free\n cache.clear\n nil\n end",
"def invalidate_cache!\n elements.each do |element|\n element.invalidate_cache!\n end\n\n self\n end",
"def cache_all\n begin\n @mutex.synchronize do\n while ele = @enum.next\n @length_cache += 1\n @eles << ele\n end\n end\n rescue StopIteration\n @end = true\n end\n end",
"def uncached\n yield\n end",
"def get(keys)\n log(\"get :Cache, #{keys.inspect}\")\n connection.multi_get(:Cache, Array(keys)).values.map { |v| v['blob'] }\n end",
"def cache\n rows.each(&:cache)\n end",
"def getMany(*ks)\n\t \tself.ready\n self.evict(*ks) if @evictWhen[:get]\n self.instance_exec(ks, &@getMany)\n end",
"def cache\n yield\n end",
"def cache_instances\n [*Pages.all_instances, *([BlogArticle, Industry, Team].map{|p| p.all })]\n end",
"def refill\n now = Time.now.to_i\n cache_set.each {|rec|\n ttl = rec[:end_ts].to_i - now\n cache_write( rec[:key], rec[:value], ttl ) if ttl > 0 \\\n if rec[:value] and rec[:value].length > MAX_OBJ_SIZE and ttl > 0\n }\n end",
"def caching(&block)\n if defined? @collection\n @collection.each(&block)\n else\n @collection = []\n execute.each do |doc|\n @collection << doc\n yield doc if block_given?\n end\n end\n end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def _smart_cache(expires_in, *keys, &block)\n key = _cache_key(keys)\n unless cached = Rails.cache.read( key )\n cached = yield(block) \n Rails.cache.write(key, cached, expires_in: expires_in) \n end\n cached\n end",
"def flush_cache; end",
"def flush!\n @_cache = {}\n end",
"def refresh (num=@max_parallel,use_cache=true)\n\t\t puts \"Add entries to the local cache table from site tracker: \" if @verbose\n\t\t\tresults = Hash.new\n\t\t\ttags = @tag_store.keys\n\t\t\tif tags.size > 0\n\t\t\t\tParallel.map(tags, :in_processes => num) { |target|\n\t\t\t\t\tcheck_adware(target,use_cache)\n\t\t\t\t}.each do |process|\n\t\t\t\t\tif !process\n\t\t\t\t\t\tnext\n\t\t\t\t\telse\n\t\t\t\t\t\tresults.merge!(process)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t@tag_store.merge!(results)\n\t\t\t\tputs \"Done loading adware entries.\"\n tags = nil\n\t\t\t\treturn results\n\t\t\telse\n\t\t\t\tputs \"Error: no entry is loaded. Please check your list and try again.\"\n\t\t\tend\n tags = nil\n\t\t\treturn results\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n \tend",
"def each_queue\n @cache.each do |queue|\n yield queue\n end\n end",
"def build_cache\n []\n end",
"def refresh_cache\n @cache = build_cache\n end",
"def fetch(*key)\n @cache[key] ||= yield\n end",
"def flush_memos\n CACHE.clear\n end",
"def clear_cache() @cache = {}; end",
"def cache_ele(amount = 1)\n begin\n @mutex.synchronize do\n while @eles.length <= amount\n @eles << @enum.next\n @length_cache += 1\n end\n end\n rescue StopIteration\n @end = true\n end\n end",
"def expand_all\n expand\n @cache\n end",
"def cache_clear\n @store.flush_all\n rescue ::MemCache::MemCacheError => e\n Log.error(e)\n nil\n end",
"def clear_cache\n @all = nil\n end",
"def clear_all!\n @cache = Cache.new\n end",
"def evict\n return if @cache.empty?\n @semaphor.synchronize(){|| \n keys = @cache.keys\n least_recently_used = keys.first\n @cache.each_pair do |url, response|\n least_recently_used = url if @cache[least_recently_used].timestamp > @cache[url].timestamp\n end\n @current_load = @current_load - @cache[least_recently_used].response.bytesize()\n @cache.delete(least_recently_used)\n }\n end",
"def shutdown\n @cache.each_value do |c|\n c.stop\n c.teardown\n end\n end",
"def clear_cache; end",
"def all_fetched_entries\n @entry_cache.all_entries\n end",
"def clear\r\n @cache.flush\r\n end",
"def queues\n @cache\n end",
"def each(&block)\n @monitor.synchronize do\n expire!\n @stash.map { |key, entry| [key, entry.value] }.each(&block)\n end\n end",
"def expensive\n @items = @items.expensive\n end",
"def cache!\n @@cache\n end",
"def fetch_and_store!\n # Get links from page\n # Download files from links concurrently\n download self.extract!\n end",
"def clear\n @cache.clear\n end",
"def fetch(key, options = nil) \n if caching_enabled\n result = Rails.cache.fetch(key, options) do\n yield\n end\n Rails.cache.delete(key) unless result\n else\n result = yield\n end\n result\n end",
"def each(&block)\n Fetcher.new(self).each(&block)\n end",
"def clear\n @cache.clear\n entries.clear\n self\n end",
"def all\n @cache ||= Request.get('/data')\n\n end",
"def cache_get(k)\n synchronize{@cache[k]}\n end",
"def remove_articles_cache\n Article.find(:all).each do |article|\n expire_article(article)\n end\n end",
"def fetch(&block)\n Rails.cache.fetch(cache_key, &block)\n end",
"def fetch(key)\n now = Time.now.public_send(_kind)\n value = get(key, now)\n\n if value.nil?\n clear_all(key)\n value = set(key, now, set_nil(yield))\n end\n\n unset_nil(value)\n end",
"def add(element)\n if cache.include?(element)\n cache.delete(element)\n elsif cache.size >= max_cache_size\n cache.shift\n end\n\n cache << element\n nil\n end",
"def clear\n\n set_id_to_cache_key_map\n\n cache_response = fetch\n @id_to_cache_key_map.each do |id, key|\n Memcache.delete(key)\n Memcache.delete(\"ca_sa_shared_de_sa_cs_#{cache_response[id][:api_key]}\")\n end\n\n nil\n\n end",
"def pop\n\t\t\t@storage.pop\n\t\tend",
"def cached_fetch(key)\n fetch(key) do\n return yield unless h = self[:cache]\n Sequel.synchronize{return h[key] if h.has_key?(key)}\n value = yield\n Sequel.synchronize{h[key] = value}\n end\n end",
"def cache\n @cache ||= {}\n end",
"def cache\n @cache ||= {}\n end",
"def cache_collect\n\t\tRepository.repo.get_from_cache(@template)\n\tend",
"def clear\n cache.clear\n end",
"def update_cache\r\n Rails.cache.delete(\"All#{self.class.name.to_s}\")\r\n end",
"def dispose()\n self.entries.each do |entry|\n entry.instance_variable_set(\"@root_node\", nil)\n entry.instance_variable_set(\"@feed\", nil)\n entry.instance_variable_set(\"@parent_feed\", nil)\n entry.dispose if entry.respond_to?(:dispose)\n end\n self.entries = []\n \n @cache_object = nil\n @http_headers = nil\n @xml_document = nil\n @feed_data = nil\n @feed_data_type = nil\n @root_node = nil\n @channel_node = nil\n @href = nil\n @id = nil\n @title = nil\n @subtitle = nil\n @link = nil\n @last_retrieved = nil\n @time_to_live = nil\n @entries = nil\n @live = false\n @encoding = nil\n @options = nil\n\n GC.start()\n self\n end",
"def dispose\n begin\n @lock.synchronize do\n while instance = @available.pop\n instance.close\n end\n\n @condition.wait(@lock) if @used.size > 0\n end\n end until empty?\n end",
"def pop\n\t\t@mutex.synchronize do\n\t\t\t@store.pop\n\t\tend\n\tend",
"def index\n @product_caches = ProductCache.all\n end",
"def store\n @by_cache.each{|cache, tags| cache[:tags] = tags }\n end",
"def clear_cache\n @results = nil\n @result_ids = nil\n @num_results = nil\n @letters = nil\n end",
"def clear!\n @cache = {}\n end",
"def reset\r\n free\r\n @requested = []\r\n end",
"def cache(data); end",
"def results\n @mutex.synchronize do\n resolvables = @resolvables\n @resolvables = []\n return resolvables\n end\n end",
"def poll()\n return nil if self.heap_container.length == 0\n return self.heap_container.pop() if self.heap_container.length == 1\n \n item = self.heap_container.pop()\n self.heap_container[0] = self.heap_container.pop()\n self.heapify_down()\n return item\n end",
"def cache\n @cache ||= {}\n end",
"def clear\n @cache = {}\n end",
"def cache\n @cache ||= {}\n end",
"def cache\n @cache ||= {}\n end",
"def each(&block)\n get unless loaded\n self.objects.first[1].each(&block) rescue nil\n end",
"def cache\n DataCache\n end",
"def unload!\n cache.save if @__cache\n __send__ :unloaded if respond_to? :unloaded\n\n @__cache = nil\n end",
"def clear\n @lock.synchronize do\n if block_given?\n @items.each do |id, ref|\n begin\n yield id, ref.__getobj__\n rescue WeakRef::RefError\n end\n end\n end\n @items.clear\n end\n end",
"def get_everything!\n self.update!\n\n prev = @prev\n while prev\n prev.update!\n\n self.merge_entries! prev\n prev = prev.prev\n end\n\n nxt = @next\n while nxt\n nxt.update!\n\n self.merge_entries! nxt\n nxt = nxt.next\n end\n\n self\n end",
"def cache\n @cache ||= build_cache\n end",
"def cache\n @cache ||= MemoryCache.new\n end",
"def cache\n # Do a deep copy\n Marshal.load(Marshal.dump(@@cache))\n end",
"def clear\n @cache.clear\n self\n end",
"def fetch(*key)\n if block_given?\n @cache[key] ||= yield\n else\n @cache[key]\n end\n end",
"def release\n if pointer.kind_of?(::FFI::MemoryPointer) && !pointer.null?\n pointer.free\n end\n while uri = @raptor_uri_list.pop\n V1_4.raptor_free_uri(uri) unless uri.nil? || uri.null?\n end\n end",
"def latest_entries\n unless @latest_entries\n @latest_entries = Rails.cache.fetch([@account.cache_key, '/latest_entries'], :expires_in => 10.minutes) do\n Entry.paginate(:all, :from => \"/accounts/#{@account.account_resource_id.to_s}/entries.xml\", :params => { :page => 1, :per_page => 5}) \n end\n end\n @latest_entries\n end",
"def without_cache(&block); end",
"def without_cache(&block); end",
"def instance_cache; end",
"def each &block\n @storage.reverse_each &block\n end",
"def pop\n val = []\n @queue_mutex.synchronize do\n val = @memory_queue.pop\n end\n val\n end",
"def get_elements(path)\n elements = self./(path)\n return nil unless elements\n elements = elements.map{|element| Element.new(element)}\n end",
"def clear_cache\n @lit_cache = {}\n @lit_nextpos = {}\n end",
"def fetch_objects!(lookup = :parallel)\n # this gets all valid parse objects from the array\n items = valid_parse_objects\n lookup == :parallel ? items.threaded_each(2, &:fetch!) : items.each(&:fetch!)\n #self.replace items\n self #return for chaining.\n end",
"def list\n Enumerator.new do |y|\n @cache.each_value do |re|\n y << [re['address'], re['name']]\n end\n end\n end",
"def users\n result = Rails.cache.read([:ibiza, id, :users])\n get_users_only_once if result.nil?\n result\n end",
"def all\n end_time = (Time.now - (30 * 60 * 60 * 24)).to_i\n all_items = Array.new\n cur_items = self\n begin\n all_items += cur_items.items\n cur_items = cur_items.next(:count => 200, :start_time => end_time)\n end until cur_items.nil?\n all_items\n end",
"def fetch_objects(lookup = :parallel)\n items = valid_parse_objects\n lookup == :parallel ? items.threaded_each(2, &:fetch) : items.each(&:fetch)\n #self.replace items\n self\n end"
] |
[
"0.6973532",
"0.6196989",
"0.6178804",
"0.60938716",
"0.5883575",
"0.58788705",
"0.5837647",
"0.5801962",
"0.5778058",
"0.5765341",
"0.57640266",
"0.57034814",
"0.56749713",
"0.56749713",
"0.56749713",
"0.56749713",
"0.56749713",
"0.56749713",
"0.56749713",
"0.56175804",
"0.561364",
"0.55919576",
"0.5552919",
"0.5549333",
"0.5542352",
"0.55394495",
"0.5534403",
"0.55343777",
"0.55297863",
"0.5511776",
"0.5509782",
"0.5490857",
"0.5478266",
"0.5476072",
"0.54709125",
"0.546322",
"0.5448093",
"0.54238117",
"0.5415978",
"0.5415761",
"0.54041296",
"0.5402581",
"0.5399348",
"0.53800553",
"0.53721505",
"0.5372081",
"0.53645134",
"0.53627086",
"0.5358605",
"0.5355432",
"0.5341249",
"0.5336335",
"0.5329874",
"0.5326946",
"0.53262645",
"0.5314501",
"0.5310694",
"0.530686",
"0.530686",
"0.5292871",
"0.52866966",
"0.5276178",
"0.5269092",
"0.5263694",
"0.52599615",
"0.5253501",
"0.52516884",
"0.5249616",
"0.5244795",
"0.5241194",
"0.5238375",
"0.5236684",
"0.5231085",
"0.5227428",
"0.52262133",
"0.52256405",
"0.52256405",
"0.5224172",
"0.5222916",
"0.52215815",
"0.5209325",
"0.52070963",
"0.5206063",
"0.52038985",
"0.5202594",
"0.52023935",
"0.52016115",
"0.518804",
"0.5177981",
"0.5174604",
"0.5174604",
"0.5168968",
"0.5165016",
"0.5164748",
"0.5161074",
"0.51572716",
"0.5157183",
"0.5156698",
"0.51547825",
"0.51496994",
"0.51493716"
] |
0.0
|
-1
|
This method should only be used with 'each_index'.
|
def [](key)
if @each_index && @each_index.key?(key)
ret = @each_index[key]
@each_index.delete(key)
return ret
end
raise "This only works when also using 'each_index'. Invalid key: '#{key}'."
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def each_child_with_index\n end",
"def each_child_index\n end",
"def my_each_with_index\n\t\tself.length.times do |index|\n\t\t\tyield(self[index], index)\n\t\tend\n\tend",
"def raise_index!\n @index += 1\n end",
"def each_with_index(&block)\n to_a.each_with_index(&block)\n end",
"def each_with_index(&block)\n to_a.each_with_index(&block)\n end",
"def each_with_index(&block)\n @delegate.each_with_index(&block)\n end",
"def reset_index\n @index = 0\n end",
"def shift_out_with_index(&block)\n each_with_index(&block)\n end",
"def at(index); end",
"def each(&block)\n @index.each(&block)\n end",
"def row(index)\n end",
"def each_with_index(&blk)\n (0..@size-1).each { |i| blk.call(self.[](i),i) }\n end",
"def my_each_with_index\n for i in 0..self.length-1\n yield(self[i], i) if block_given?\n end\n self\n end",
"def each_index(*_arg0); end",
"def my_each_with_index\n i = 0\n while i < self.size\n yield(self[i], i)\n i += 1\n end\n self\n end",
"def each_with_index # :yields: e, i, j\n (0...hsize).each { |j|\n (0...vsize).each { |i|\n yield self[i,j], i, j\n }\n }\n self\n end",
"def my_each_with_index\n \ti = 0\n \twhile i < self.length\n \t\tif block_given?\n \t\t\tyield(self[i], i)\n \t\telse\n \t\t\treturn self\n \t\tend\n \t\ti +=1\n \tend\n \tself\n end",
"def my_each_with_index\n i = 0\n while i < self.length\n yield self[i], i\n i += 1\n end\n self\n end",
"def my_each_with_index\n i = 0\n while i < self.length\n yield(self[i], i)\n i += 1\n end\n self\n end",
"def each_index(&block)\n return enum_for(:each_index) unless block_given?\n 0.upto(size-1, &block)\n self\n end",
"def index()\n INDEXES.find { |i| (self + i).exist? }&.yield_self { |i| self + i }\n end",
"def my_each_with_index\n i = 0\n while i < self.size\n yield self[i], i\n i += 1\n end\n end",
"def each(&b)\n # force loading of the full listing by using self[]\n self[0..(@index.size - 1)].each(&b)\n end",
"def my_each_with_index\n for i in 0...self.length do\n yield(self[i], i)\n end\n return self\n end",
"def each(&b)\n @index.each(&b)\n end",
"def update_index\n all.each do |n|\n n.update_index\n end\n end",
"def each_index\n\t\t\t@joints.each_index { |x| yield x }\n\t\tend",
"def my_each_with_index\n i = 0\n while i < size\n yield(self[i], i)\n i += 1\n end\n self\n end",
"def index(element); end",
"def my_each_with_index\n i = 0\n while i < self.to_a.length\n yield self.to_a[i], i\n i += 1\n end\n end",
"def each_entry_with_index\n @index.each_with_index do |hash, idx|\n next if hash.nil?\n entry = '' \n hash.each {|x| entry << pack(x.sha1, @block_ary[x.block].start, @block_ary[x.block].size, x.buflocation, x.size) }\n yield entry, idx \n end\n end",
"def [](index)\n demand super(index)\n end",
"def get(index)\n \n end",
"def swim(index)\n end",
"def each_index\n (0...hsize).each { |j|\n (0...vsize).each { |i|\n yield i, j\n }\n }\n self\n end",
"def swim(index)\n raise \"Not implemented.\"\n end",
"def each_with_index(&block)\n @tree.each_with_index(&block)\n end",
"def each_with_index\n\t\t@data.each_index do |y|\n\t\t\t@data[y].each_with_index do |val, x|\n\t\t\t\tyield x,y,val\n\t\t\tend\n\t\tend\n\n\tend",
"def increase_index\n @i +=1\n end",
"def define_index_method_for_contents\n i, e = 0, 0\n @contents.each do |content|\n def content.index\n @index\n end\n\n def content.index=(index)\n @index = index\n end\n\n if content.instance_of? Introduction\n i += 1\n content.index= i\n else\n e += 1\n content.index= e\n end\n end\n end",
"def eachio_index(&block) # :yield: index\n 0.upto(length-1, &block)\n self\n end",
"def [](index); end",
"def each_index\n return to_enum(__callee__) unless block_given?\n \n each_with_index{ |_, idx| yield(idx) }\n end",
"def my_each_with_index\n a = (is_a? Hash) ? to_a : self\n i = 0\n while i < a.count\n yield a[i], i\n i += 1\n end\n end",
"def _skip_next\n @index += 1\n\n self\n end",
"def each(&block_)\n @indexes.each(&block_)\n end",
"def each\n raise 'Not implemented'\n end",
"def each_value_with_index\n @nz.each do |i, j, v|\n yield v, i, j\n end\n end",
"def normalize_index(index)\n norm_index = 0\n index.times do\n while true do\n norm_index += 1 \n break unless columns[norm_index][:included] == false\n end\n end\n norm_index\n end",
"def each_with_index\n if block_given?\n @fm.each_with_index do |el, index|\n yield el, get_row_from_index(index), get_col_from_index(index)\n end\n end\n end",
"def each_with_index(&block)\n return to_enum :each_with_index unless block\n\n i = 0\n self.each{|*val|\n block.call(val.__svalue, i)\n i += 1\n }\n self\n end",
"def render\n index\n grid.each_with_index do |row, i|\n join(row, i)\n end\n index\n end",
"def item; @data[self.index]; end",
"def normalize_index(index)\n norm_index = 0\n index.times do\n while true do\n norm_index += 1\n break unless final_columns[norm_index][:included] == false\n end\n end\n norm_index\n end",
"def [](index)\n i = 0\n each { |x| return x if i == index; i += 1 }\n nil # out of index\n end",
"def my_each_with_index\n return to_enum unless block_given?\n\n i = 0\n while i < size\n yield(self[i], i)\n i += 1\n end\n self\n end",
"def each(&block)\n return to_enum unless block_given?\n @index.each(&block)\n self\n end",
"def item; @data[@index]; end",
"def each_index\n\t\t@data.each_index do |y|\n\t\t\t@data[y].each_index do |x|\n\t\t\t\tyield x, y\n\t\t\tend\n\t\tend \n\tend",
"def [](index)\n all[index]\n end",
"def remove(index)\n end",
"def my_each_with_index\n if block_given?\n for i in 0.upto(self.length-1)\n yield self[i], i\n end\n else\n self.to_enum\n end\n end",
"def delete_at_index(index)\n \n end",
"def each_with_index(&block)\n examples.each_with_index(&block)\n end",
"def test_0160_each_with_index\n @@log.debug \"test_0160_each_with_index starts\" if @@log.debug?\n assert_respond_to(@list, :each_with_index, \"test_0160_each_with_index_respond\")\n # Basic operation\n ta = []\n @list.each_with_index do |obj, ndx|\n ta << \"#{obj.first}-#{ndx}\"\n end\n assert_equal([\"Alfred-0\", \"Bob-1\", \"Charlie-2\", \"Dilbert-3\"], ta, \"test_0160_each_with_index_basic\")\n # Check Enumerator or Enumerable::Enumerator return, no block given\n new_list = @list.each_with_index\nif RUBY_VERSION >= \"1.9\"\n result = new_list.is_a? Enumerator\n assert(result, \"test_0160_each_with_index_enumcheck\")\nelse\n result = new_list.is_a? Enumerable::Enumerator\n assert(result, \"test_0160_each_with_index_enumenumcheck\")\nend\n @@log.debug \"test_0160_each_with_index ends\" if @@log.debug?\n end",
"def clear_index\n @index = nil\n end",
"def customize_row_index(row_index)\n row_index += 1\n end",
"def my_each_with_index\n return to_enum unless block_given?\n\n i = 0\n while i < length\n yield(self[i], i)\n i += 1\n end\n end",
"def each_child_with_index(&block) # :yields: child_node, index\n children.each_with_index(&block)\n nil\n end",
"def each_child_with_index(&block) # :yields: child_node, index\n children.each_with_index(&block)\n nil\n end",
"def each_with_index &block\n latch = CountDownLatch.new(size)\n __getobj__.each_with_index {|x, index|\n @@pool << -> {\n begin\n block.call(x, index)\n rescue\n $!.print_stack_trace\n ensure\n latch.count_down\n end\n }\n }\n latch.wait\n self\n end",
"def construct_index\n end",
"def with_index(new_index) # :yields: new_index\n old_index = @index\n set_index(new_index, false)\n return_value = yield @index\n set_index(old_index)\n return_value\n end",
"def row_tell\n @index\n end",
"def cursor_to_decision\n @index = 89\n end",
"def each(&block)\n @index.each do |key, start_length|\n block.call([key, self[key]])\n end\n end",
"def index=(new_index)\n @index = new_index\n @index = @pages.size-1 if @index < 0\n @index = 0 if @index > @pages.size-1\n refresh\n end",
"def each_with_index(arr)\n arr.size.times do |i|\n yield(arr[i], i)\n end\n arr\nend",
"def index=(index)\n old_index = self.index\n super(index)\n draw_item(old_index)\n draw_item(self.index)\n end",
"def index=(_arg0); end",
"def index_corruption?; end",
"def lttfindex\n end",
"def map_with_index # :yields: e, i, j\n m = self.class.reserve(self.vsize, self.hsize)\n each_with_index { |e, i, j|\n m[i,j] = yield e, i, j\n }\n m\n end",
"def each(&block)\n return to_enum unless block_given?\n index.each(&block)\n self\n end",
"def reindex!\n self.index = {}\n data.each do |inventory_object|\n store_index_for(inventory_object)\n end\n end",
"def [](indx)\n elements[indx]\n end",
"def advance(index)\n each_data_block(index, false) do\n return data_header\n end\n nil\n\tend",
"def index(p0) end",
"def index(p0) end",
"def on_add_with_index(&block)\n @index.each do |index, values|\n values.each do |v|\n block.call(index, v)\n end\n end\n @onAddBlockWithIndex = block\n end",
"def each\n @indexes.each { |_name, index| yield index }\n end",
"def loop_with_index_again(puppies)\n puppies.each_with_index { |val, idx| \n puts \"#{idx}: #{val}\"\n }\nend",
"def [](index)\n @index[index]\n end",
"def my_each_with_index\n return self unless block_given?\n hash = Hash.new(0)\n for h in self\n yield h, self.index(h)\n hash.merge! self.index(h) => h\n end\n return hash\n end",
"def get_index(index)\n return self.at(index)\n end",
"def next\n\t\t\t\t@index += 1\n\t\t\t\tself._update\n\t\t\t\tself\n\t\t\tend",
"def index\r\n build_index unless @index\r\n @index\r\n end",
"def index ; @index ; end",
"def each_index(&block)\n if block_given?\n @indexes.each(&block)\n self\n else\n @indexes.freeze\n end\n end",
"def my_each_with_index(arr)\n \n\n for element in arr\n index = arr.index(element)\n yield(element, index)\n end\n \n \nend"
] |
[
"0.6800131",
"0.66231084",
"0.6539461",
"0.6506758",
"0.63712955",
"0.63712955",
"0.6327163",
"0.62712497",
"0.6257605",
"0.625735",
"0.62397224",
"0.62275606",
"0.6197853",
"0.6178756",
"0.6135701",
"0.6129638",
"0.61199296",
"0.61155254",
"0.6112531",
"0.6110354",
"0.61067355",
"0.60804415",
"0.6063629",
"0.6061906",
"0.6031355",
"0.59740967",
"0.5966674",
"0.5958168",
"0.59534377",
"0.59497476",
"0.59318274",
"0.5927844",
"0.5914538",
"0.5911989",
"0.59079415",
"0.5904114",
"0.588984",
"0.58823824",
"0.58651173",
"0.58586043",
"0.58499384",
"0.5833636",
"0.57902324",
"0.57784694",
"0.57768285",
"0.57710826",
"0.57662904",
"0.5764515",
"0.5764393",
"0.5752061",
"0.5723574",
"0.57206863",
"0.5719053",
"0.5718851",
"0.5714261",
"0.56973004",
"0.5696878",
"0.56940174",
"0.56815547",
"0.56815135",
"0.5679506",
"0.5673007",
"0.56691206",
"0.5664521",
"0.56451774",
"0.56279725",
"0.56265944",
"0.56102496",
"0.56040144",
"0.5602972",
"0.5602972",
"0.55971223",
"0.55899405",
"0.5589087",
"0.5586294",
"0.5573498",
"0.55558896",
"0.55512494",
"0.5534942",
"0.5528932",
"0.5514634",
"0.5510813",
"0.549672",
"0.5493385",
"0.5491011",
"0.5490069",
"0.5485463",
"0.54854316",
"0.54849714",
"0.54849714",
"0.54742813",
"0.5472139",
"0.54670584",
"0.54653597",
"0.5461123",
"0.546054",
"0.5452563",
"0.5449585",
"0.54402435",
"0.54368216",
"0.5435497"
] |
0.0
|
-1
|
Yields each countkey and caches element for returning it by using the []method.
|
def each_index(&block)
enum = Enumerator.new do |yielder|
begin
@each_index = {}
count = 0
self.each do |ele|
# Remove previous element to not take up memory.
count_before = count - 1
@each_index.delete(count_before) if @each_index.key?(count_before)
# Add current element to cache.
@each_index[count] = ele
yield(count)
# Increase count for next run.
count += 1
end
ensure
@each_index = nil
end
end
if block
enum.each(&block)
return nil
else
return enum
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def [](key)\n i = 1\n desired_index = index(key, size)\n while @items[desired_index].key != key\n desired_index += i**2\n i += 1\n end\n\n return @items[desired_index].value\n end",
"def each_key(&block); end",
"def finalize\n yield [key, @count]\n end",
"def each\n @buckets.each_with_index do |count, index|\n yield(to_bucket(index), count)\n end\n end",
"def each(&block)\n block or return enum_for(__method__) { size }\n @hash.each_key(&block)\n self\n end",
"def fetch(*key)\n @cache[key] ||= yield\n end",
"def get(key)\n if @cache.key?(key)\n i = @frequency[key]\n @rentused[i].delete(key)\n @rentused[i + 1] = { key => nil } if @rentused[i + 1].nil?\n @rentused[i + 1][key] = nil\n @frequency[key] += 1\n # p @cache, @frequency, @rentused\n @cache[key]\n else\n -1\n end\n end",
"def cache(count)\n @cached_elements = active_elements.pop(count)\n return\n end",
"def counter_cache=(_arg0); end",
"def counter_cache; end",
"def each(&block)\n @index.each do |key, start_length|\n block.call([key, self[key]])\n end\n end",
"def count(key)\n @counter[key]\n end",
"def each\n @hash.each_key { |o| yield(o) }\n self\n end",
"def each\n pos = hash_size\n hoff0 = @hashes[0]\n while pos < hoff0\n key, value = *read_entry(pos)\n yield(key,value)\n pos += key.length + value.length + hashref_size\n end\n end",
"def next!\r\n @cur = @cache[@idx+=1]\r\n end",
"def incr(key); end",
"def incr(key); end",
"def each(&block)\n @size.times { |position| yield self.get(position) }\n end",
"def [](num) #<== maybe requires hash\n # num_hash = num.hash\n # @store[num_hash % num_buckets]\n @store[num % num_buckets]\n end",
"def [](key)\n puts \"STUB: [] in CacheMethods::Cache\"\n end",
"def [](key)\n @items[index(key, size)].value\n end",
"def next_in(key, count, duration)\n @key = key\n @duration = duration\n return 0 if current_count(key) < count\n [@duration - elapsed, 0].max\n end",
"def each\n index = 1\n while index <= self.keys.get_length\n key = self.keys.get(index)\n value = self.values.get(index)\n yield key , value\n index = index + 1\n end\n self\n end",
"def zscan_each(key, **options, &block); end",
"def memoize_results(key)\n (@inst_var_refreshable || @inst_var_refreshable = Set.new) << key\n return instance_variable_get(key) if instance_variable_defined?(key)\n instance_variable_set(key, yield)\n end",
"def fetch(*key)\n if block_given?\n @cache[key] ||= yield\n else\n @cache[key]\n end\n end",
"def fetch(key)\n send(:[], key){return(yield if defined?(yield))}\n end",
"def cache\n yield\n end",
"def cache_all\n begin\n @mutex.synchronize do\n while ele = @enum.next\n @length_cache += 1\n @eles << ele\n end\n end\n rescue StopIteration\n @end = true\n end\n end",
"def fetch_all(key); end",
"def each_key\n return enum_for(__method__) unless block_given?\n @raw.each_key do |key|\n yield key\n end\n self\n end",
"def index(key, size)\n i = IndexNext.new\n sum = 0\n i.next = 0\n # generate index with ascii code\n key.each_byte do |c|\n sum += c\n end\n i.index = sum % size\n if self.list[i.index] != nil\n #loop through the next available slot\n i.index = i.index + 1\n #index and number_searched is returned to i\n i = next_open_index(i.index)\n else\n #when empty just return sum % size\n i\n end\n end",
"def my_each_with_index\n a = (is_a? Hash) ? to_a : self\n i = 0\n while i < a.count\n yield a[i], i\n i += 1\n end\n end",
"def index(key, size) #take the asscii value % size to come up with index\n total = 0\n key.each_byte do |c|\n total = c + total\n end\n total % size\n\n end",
"def [](idx)\n return @cache[idx] if @cache.has_key? idx\n while @pointer != idx\n previous_entry = @cache[@pointer]\n\n @pointer += 1\n\n if first_mention? previous_entry\n @cache[@pointer] = 0\n @index[0] << @pointer\n else\n a, b = *@index[previous_entry][-2..-1]\n @cache[@pointer] = b - a\n @index[b - a] ||= []\n @index[b - a] << @pointer\n end\n\n end\n\n @cache[idx]\n end",
"def [](entry)\n @cache[key_for(entry)]\n end",
"def incrby(key, increment); end",
"def incrby(key, increment); end",
"def index(key, size)\n return key.sum%size\n end",
"def each\n @internal_hash.each { |k,_| yield k }\n end",
"def each\n index = 0\n while index < @i_keys.get_length\n key = @i_keys.get(index)\n value = @i_values.get(index)\n yield key , value\n index = index + 1\n end\n self\n end",
"def index(key, size)\n code = key.sum\n return code % size\n end",
"def each\n store.each { |(key, value)| yield key, value }\n end",
"def each_key\n\t record = @head\r\n\t while record.next && record.next != @tail\r\n\t\t record = record.next\n\t\t yield record.key\r\n\t end\r\n end",
"def index(key, size)\n i = key.sum % size \n end",
"def each(&block) # :yields: result\n 0.upto(@size - 1) {|x| yield self[x]}\n end",
"def each_oid( &block )\n\t\treturn @storage.each_key( &block )\n\tend",
"def index(key, size)\n (key.sum % size)\n end",
"def call\n if hash?\n return iterate_hash { |*args, **opts| yield(*args, **opts) }\n end\n\n iterate { |*args, **opts| yield(*args, **opts) }\n end",
"def index_by\n\t\t\t\tmap { |n| [yield(n), n] }.to_hash\n\t\t end",
"def each\n response = run\n\n entities = @collection.deserialize(response.entities)\n entities.each { |x| yield(x) }\n\n while continue?(response)\n response.entities = []\n\n @options[:exclusive_start_key] = response.last_evaluated_key\n response = run(response)\n\n entities = @collection.deserialize(response.entities)\n entities.each { |x| yield(x) }\n end\n\n response.count\n end",
"def my_each_with_index(&block)\n return to_enum(:my_each_with_index) unless block_given?\n n = 0\n while n < length\n block.call(self[n], n) if is_a?(Array)\n block.call(keys[n], self[keys[n]]) if is_a?(Hash)\n block.call(self[n]) if is_a?(Range)\n n += 1\n end\n self\n end",
"def index(key, size)\n return key.sum % size\n end",
"def index(key, size)\n return key.sum % size\n end",
"def index(key, size)\n return key.sum % size\n end",
"def index(key, size)\n return key.sum % size\n end",
"def each(&block)\n @items.each_key(&block)\n self\n end",
"def cache(key)\n return @cache[key] if cached?(key)\n\n @cache[key] = yield\n end",
"def inc(key)\n \n end",
"def finalize\n yield [key, size]\n end",
"def index(key, size)\n return key.sum % size \n end",
"def memoize(key)\n return instance_variable_get(\"@#{key}\") if instance_variable_defined?(\"@#{key}\")\n\n instance_variable_set(\"@#{key}\", yield)\n end",
"def key\n # The counter is always 1 ahead.\n @counter - 1\n end",
"def index(key, size)\n value = ascii_value(key) % size\n return value\n end",
"def index(key, size)\n return key.sum % size\n end",
"def each()\n i = 0\n while i < @total\n yield at(i)\n i += 1\n end\n self\n end",
"def each\n self.to_hash.each\n end",
"def index(key, size)\n total_sum = 0\n key.each_byte do |x|\n total_sum += x\n end\n return total_sum % size\n end",
"def each\n if block_given?\n (0...Count()).each { |i| yield self[i] }\n else\n (0...Count()).map { |i| self[i] }\n end\n end",
"def [](key)\n @items[index(key,@items.length)].value\n end",
"def each\n 0.upto(item_count - 1) { | i | yield i }\n end",
"def cache(key)\n @lock.synchronize do\n @contents[key] ||= yield\n end\n end",
"def [](key)\n fetch(key)\n end",
"def cache_fetch(*args)\n super { |key| @store[key] }\n end",
"def my_each_with_index\n return self unless block_given?\n\n if is_a? Array\n length.times { |idx| yield(self[idx], idx) }\n elsif is_a? Hash\n keys = self.keys\n vals = values\n length.times { |idx| yield([keys[idx], vals[idx]], idx) }\n else\n warn 'Incompatible type!'\n end\n self\n end",
"def index(key, size)\n hash_code = 0\n key.each_byte do |c|\n hash_code += c\n end\n hash_code % @size\n end",
"def index()\n INDEXES.find { |i| (self + i).exist? }&.yield_self { |i| self + i }\n end",
"def index(key, size)\n key.sum % size\n end",
"def index(key, size)\n key.sum % size\n end",
"def index(key, size)\n key.sum % size\n end",
"def index(key, size)\n key.sum % size\n end",
"def index(key, size)\n key.sum % size\n end",
"def index(key, size)\n key.sum % size\n end",
"def index(key, size)\n key.sum % size\n end",
"def index(key, size)\n key.sum % size\n end",
"def index(key, size)\n key.sum % size\n end",
"def index(key, size)\n key.sum % size\n end",
"def index(key, size)\n key.sum % size\n end",
"def index(key, size)\n key.sum % size\n end",
"def index(key, size)\n key.sum % size\n end",
"def index(key, size)\n key.sum % size\n end",
"def index(key, size)\n key.sum % size\n end",
"def index(key, size)\n key.sum % size\n end",
"def index(key, size)\n key.sum % size\n end",
"def index(key, size)\n key.sum % size\n end",
"def index(key, size)\n key.sum % size\n end",
"def index(key, size)\n key.sum % size\n end",
"def index(key, size)\n key.sum % size\n end",
"def index(key, size)\n key.sum % size\n end",
"def index(key, size)\n key.sum % size\n end"
] |
[
"0.65200365",
"0.641567",
"0.64118683",
"0.6328605",
"0.63226575",
"0.6300463",
"0.6259036",
"0.62395865",
"0.61929506",
"0.6191512",
"0.61428714",
"0.6076651",
"0.5988484",
"0.5986315",
"0.5951433",
"0.59340775",
"0.59340775",
"0.59335816",
"0.5923167",
"0.5921202",
"0.5902832",
"0.58983415",
"0.589748",
"0.58960223",
"0.58910275",
"0.5886123",
"0.5880863",
"0.587797",
"0.5871918",
"0.58531934",
"0.58510584",
"0.5842457",
"0.58053553",
"0.57920116",
"0.57817173",
"0.5774223",
"0.5760784",
"0.5760784",
"0.5750793",
"0.5744809",
"0.5736646",
"0.5731749",
"0.57258517",
"0.5724009",
"0.5713628",
"0.5712774",
"0.5710809",
"0.5689784",
"0.5684696",
"0.5676555",
"0.56745136",
"0.566685",
"0.5651387",
"0.5651387",
"0.5651387",
"0.5651387",
"0.5643876",
"0.5625903",
"0.5624336",
"0.5619946",
"0.5616912",
"0.5616779",
"0.5616767",
"0.5610025",
"0.56078",
"0.5603521",
"0.5599159",
"0.5598794",
"0.55961114",
"0.55909497",
"0.5589992",
"0.55865735",
"0.5582974",
"0.55772704",
"0.5565182",
"0.5555285",
"0.55498385",
"0.5549768",
"0.5549768",
"0.5549768",
"0.5549768",
"0.5549768",
"0.5549768",
"0.5549768",
"0.5549768",
"0.5549768",
"0.5549768",
"0.5549768",
"0.5549768",
"0.5549768",
"0.5549768",
"0.5549768",
"0.5549768",
"0.5549768",
"0.5549768",
"0.5549768",
"0.5549768",
"0.5549768",
"0.5549768",
"0.5549768"
] |
0.6580912
|
0
|
Returns a enumerator that can yield all the elements (both cached and future uncached ones).
|
def to_enum
check_corrupted
@array_corrupted = true
return Enumerator.new do |yielder|
while ele = @eles.shift
yielder << ele
end
yield_rest do |ele|
yielder << ele
end
while ele = @end_eles.shift
yielder << ele
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cache_all\n begin\n @mutex.synchronize do\n while ele = @enum.next\n @length_cache += 1\n @eles << ele\n end\n end\n rescue StopIteration\n @end = true\n end\n end",
"def cycle()\n Enumerator.new do |out|\n values = self.touch{|x| out.yield x}.to_a\n unless values.empty?\n loop do\n values.each{|x| out.yield x}\n end\n end\n end\n end",
"def each(&block)\n return enum_for(:each) unless block\n while rec = fetch\n block.call rec\n end\n self\n end",
"def each(&block)\n return enum_for(:each) unless block\n while rec = fetch\n block.call rec\n end\n self\n end",
"def each\n return to_enum unless block_given?\n entries.each { |entry| yield(entry) }\n self\n end",
"def infinite_iterator(array)\n Enumerator.new do |result|\n loop do\n array.cycle { |item| result << item }\n end\n end\nend",
"def each(&block)\n return enum_for(:each) unless block_given?\n \n # if using the block form only, don't \"next\" for internal iteration\n if @block && !@enum\n @block.call Enumerator::Yielder.new(&block)\n else\n rewind\n\n until end?\n yield self.next\n end\n end\n \n self\n end",
"def each\n return enum_for(:each) unless block_given?\n results.each(&Proc.new)\n self\n end",
"def each(&block)\n return to_enum(:each) unless block_given?\n size.times.each { |i| yield @elements[i] }\n self\n end",
"def cons()\n Enumerator.new do |out|\n s = self.ensure_enum\n loop do\n items = s.next.ensure_enum\n loop do\n out.yield items.next\n end\n end\n end\n end",
"def each\n return to_enum :each unless block_given?\n\n loop do\n items = instance_exec(&@proc)\n\n items.each do |item|\n yield item\n end\n\n break if items.empty?\n end\n end",
"def enumerator; end",
"def enumerator ; end",
"def enumerator ; end",
"def each\n enum = @head\n while (enum != nil) \n yield enum.value\n enum = enum.next\n end\n end",
"def each\n return enum_for(:each) unless block_given?\n\n item = @head\n\n while item do\n yield item.value\n item = item.next\n end\n end",
"def each\n return to_enum(:each) unless block_given?\n\n seek(:head)\n yield current_entry while move_next\n end",
"def each\n return to_enum unless block_given?\n list = self\n until list.empty?\n yield(list.head)\n list = list.tail\n end\n end",
"def each\n return enum_for(:each) unless block_given?\n while event = next_event\n yield event\n end\n end",
"def each\n return enum_for(:each) unless block_given?\n n = @head\n while n\n yield n.value\n n = n.next\n end\n end",
"def each_index(&block)\n enum = Enumerator.new do |yielder|\n begin\n @each_index = {}\n\n count = 0\n self.each do |ele|\n # Remove previous element to not take up memory.\n count_before = count - 1\n @each_index.delete(count_before) if @each_index.key?(count_before)\n\n # Add current element to cache.\n @each_index[count] = ele\n yield(count)\n\n # Increase count for next run.\n count += 1\n end\n ensure\n @each_index = nil\n end\n end\n\n if block\n enum.each(&block)\n return nil\n else\n return enum\n end\n end",
"def each_with_iterator\n\n iterator = get_iterator_fast\n while (iterator.has_next?)\n yield iterator.get_next, iterator if block_given?\n end\n \n end",
"def eternal_sequence\n Enumerator.new do |enum|\n i = 0\n while true\n enum.yield i # <- Notice that this is the yield method of the enumerator, not the yield keyword\n i +=1\n end\n end\nend",
"def cache_ele(amount = 1)\n begin\n @mutex.synchronize do\n while @eles.length <= amount\n @eles << @enum.next\n @length_cache += 1\n end\n end\n rescue StopIteration\n @end = true\n end\n end",
"def weave()\n Enumerator.new do |out|\n enums = self.ensure_enum.lmap(&:ensure_enum)\n \n while enums.has_next? do\n # We to_a each iteration to avoid creating a huge\n # Enumerator stack.\n enums = enums.lselect{|e| e.has_next?}.touch{|e| out.yield e.next}.to_a.ensure_enum\n end\n end\n end",
"def collect!(&block)\n unless block_given?\n return ArrayEnumerator.new(self, :collect! ) # for 1.8.7\n end\n i = 0\n sz = self.__size\n enum_res = self.each { | elem | # use self.each to handle break in block\n self.__at_put(i, block.call( elem ) )\n i += 1\n }\n if i < sz\n return enum_res\n end\n self\n end",
"def each\n return enum_for(:each) unless block_given?\n\n pointer = self\n loop do\n break if pointer.null?\n yield pointer\n pointer = pointer.next\n end\n end",
"def each_queue\n @cache.each do |queue|\n yield queue\n end\n end",
"def each\n return to_enum(:each) unless block_given?\n @size.times { |position| yield self[position] }\n end",
"def each(&block)\n block_given? ? all.each(&block) : all.to_enum\n end",
"def to_iter\n Iterator.new @entries, @capacity\n end",
"def each\n return enum_for(:each) unless block_given?\n\n @data.collection.each { |item| yield item }\n end",
"def each(&block)\n if block\n to_enum.each(&block)\n return nil\n else\n return to_enum\n end\n end",
"def next\n raise StopIteration if @enumerators.empty?\n minimum_enumrator.next\n end",
"def each()\n self.to_a.each { |elt| yield elt }\n end",
"def each()\n cur = @first\n while cur\n yield cur.value\n cur = cur.next\n end\n end",
"def each\n for each element\n yield(element)\n end\nend",
"def each\n self.to_a.each do |el|\n yield(el)\n end\n end",
"def each\n return enum_for(:each) unless block_given?\n @list.each do |item|\n yield item\n end\n end",
"def each\n\t\titerator = @head\n\t\twhile iterator != nil do\n\t\t\tyield iterator.value\n\t\t\titerator = iterator.next\n\t\tend\n\tend",
"def each\n return enum_for(__method__) unless block_given?\n return if @head.nil?\n\n traverser = @head\n\n until traverser.nil?\n yield traverser\n traverser = traverser.next_node\n end\n end",
"def each\n return enum_for(__method__) unless block_given?\n return if @head.nil?\n\n traverser = @head\n\n until traverser.nil?\n yield traverser\n traverser = traverser.next_node\n end\n end",
"def enumerator_from(starting_value, &block)\n return Enumerator.produce((yield starting_value), &block) if Enumerator.respond_to?(:produce)\n\n Enumerator.new do |y|\n last = starting_value\n loop { y << (last = yield last) }\n end\nend",
"def each\n return enum_for unless block_given?\n\n while (chunk = read)\n yield chunk\n end\n end",
"def each\n all.each do |el|\n yield el\n end\n end",
"def each\n loop do\n val = self.next\n return if self.ended?\n yield val\n end\n end",
"def each\n if block_given?\n @cards.each {|c| yield(c) }\n else\n Enumerator.new(self, :each)\n end\n end",
"def each\n raise ResultsAlreadyConsumedException unless @unread\n\n if block_given?\n @unread = false\n @source.each { |row| yield symbolize_row_keys(row) }\n else\n Enumerator.new(self)\n end\n end",
"def each(&block)\n unless block_given?\n return ArrayEnumerator.new(self, :each ) # for 1.8.7\n end\n i = 0\n lim = self.__size\n while i < lim\n block.call(self.__at(i))\n i += 1\n end\n self\n end",
"def each\n return to_enum(:each) unless block_given?\n @entry.each { |key, value| yield [key, value] }\n end",
"def enumerator\n Enumerator.new do |yielder|\n response = get_initial_response\n\n loop do\n items = response.records\n\n # If there are no records, we're done\n break if items.empty?\n\n # Otherwise, iterate through the records...\n items.each { |item| yielder << item }\n\n # ...and fetch the next page\n @params ||= {}\n @params[:page] ||= 1\n @params[:page] += 1\n\n response = @service.list(**@params)\n end\n end.lazy\n end",
"def each(&block)\n return to_enum unless block_given?\n @index.each(&block)\n self\n end",
"def each(&block)\n if block\n loop do\n poll if @events.empty?\n event = @events.shift\n yield event if event\n end\n else\n to_enum\n end\n end",
"def each(&block)\n return to_enum unless block_given?\n index.each(&block)\n self\n end",
"def each\n return to_enum( :each ) unless block_given?\n @data.each { |ar| yield ar }\n end",
"def each\n all.each do |el|\n yield el\n end\n end",
"def all\n end_time = (Time.now - (30 * 60 * 60 * 24)).to_i\n all_items = Array.new\n cur_items = self\n begin\n all_items += cur_items.items\n cur_items = cur_items.next(:count => 200, :start_time => end_time)\n end until cur_items.nil?\n all_items\n end",
"def each\n return to_enum unless block_given?\n records.each { |record| yield record }\n end",
"def each\n return to_enum :each unless block_given?\n inst, last = first, last\n\n while inst\n yield inst\n break if inst == last\n inst = inst.next\n end\n\n self\n end",
"def iterate seed, &block\n Enumerator.new do |e|\n current = seed\n loop do\n e << current\n current = yield current\n end\n end\nend",
"def each\n return enum_for(:each) unless block_given?\n changesets.each do |c|\n yield c\n end\n end",
"def to_enum\n return Enumerator.new do |yielder|\n climber.connection_pool.connections.each do |connection|\n connection.send(self.class.enumerator_method) do |element|\n yielder << element\n end\n end\n end\n end",
"def each\n\t\t\t@enumvalues ||= {}\n\t\t\t@enumvalues.each_value { |enumvalue| yield enumvalue }\n\t\tend",
"def each\r\n actual = @head\r\n while actual != nil do\r\n yield actual.value\r\n actual = actual.next\r\n end\r\n end",
"def my_each\n return to_enum unless block_given?\n\n i = 0\n arr = to_a\n while i <= arr.length - 1\n yield (arr[i])\n i += 1\n end\n self\nend",
"def each\n return to_enum :each unless block_given?\n 0.upto(size-1) { |i| yield self[i] }\n self\n end",
"def each\n return to_enum :each unless block_given?\n 0.upto(size-1) { |i| yield self[i] }\n self\n end",
"def each_entry\n return to_enum unless block_given?\n\n @tar.each do |entry|\n yield entry\n end\n ensure\n @tar.rewind\n end",
"def each &block\n if block_given?\n iterate_each &block\n self\n else\n self.to_enum\n end\n end",
"def each\n if block_given?\n @enum.each { |t| yield t }\n self\n else\n to_enum(:each)\n end\n end",
"def each &block\n return enum_for(:each) unless block_given?\n ptr = @head\n while ptr\n yield ptr.value\n ptr = ptr.nxt\n end\n nil\n end",
"def iter\n @iter ||= Iterator.new(self)\n end",
"def each()\n i = 0\n while i < @total\n yield at(i)\n i += 1\n end\n self\n end",
"def each\n @entries.each {|e| yield e}\n end",
"def each( &block )\n if block_given?\n entries.each{ |id,entry| yield Entry.new(self,id,entry) }\n else\n Enumerator.new(self, :each)\n end\n end",
"def all\n results = query '*::*::*::*'\n (results.each {|r| yield r}) if block_given?\n results\n end",
"def each\n @collection.each { |c| yield c }\n end",
"def my_each_with_index\n return to_enum unless block_given?\n\n i = 0\n while i < size\n yield(self[i], i)\n i += 1\n end\n self\n end",
"def test_generator\n g = Enumerator::Generator.new(Proc.new { 1 })\n g.to_a\n assert(true)\n end",
"def each # And define each on top of next\n loop { yield self.next }\n end",
"def each(&block)\n block or return enum_for(__method__)\n to_a.each(&block)\n self\n end",
"def each &block\n return enum_for(:each) unless block_given?\n if multiple?\n @value.each(&block)\n else\n yield @value\n end\n end",
"def each(&block)\n i = @elements.length - 1\n while i >= 0\n yield @elements[i]\n i -= 1\n end\n end",
"def consumer\n @consumer ||= ::Enumerator.new(@enumerable)\n end",
"def each\n if block_given?\n while row = shift\n yield row\n end\n else\n to_enum\n end\n end",
"def each(&block)\n return enum_for(:each) unless block_given?\n visit { |node| yield node }\n self\n end",
"def each\n response = run\n\n entities = @collection.deserialize(response.entities)\n entities.each { |x| yield(x) }\n\n while continue?(response)\n response.entities = []\n\n @options[:exclusive_start_key] = response.last_evaluated_key\n response = run(response)\n\n entities = @collection.deserialize(response.entities)\n entities.each { |x| yield(x) }\n end\n\n response.count\n end",
"def tube_enumerator\n tubes_in_pool = beanstalks.inject([]) do |memo, beanstalk|\n memo.concat(beanstalk.tubes.keys)\n end\n tubes_in_pool.uniq!\n return Enumerator.new do |yielder|\n tubes_in_pool.each do |tube_name|\n yielder << strategy_tube(tube_name)\n end\n end\n end",
"def each\n items.each { |itm| yield itm }\n end",
"def each\n @items.each { |i| yield i }\n end",
"def each # :nodoc:\n return enum_for __method__ unless block_given?\n\n @exact.each do |requirement|\n yield requirement\n end\n\n @list.each do |requirement|\n yield requirement\n end\n end",
"def all\n _register_class_observer\n if _class_fetch_states.has_key?(:all) && 'fi'.include?(_class_fetch_states[:all]) # if f_etched or i_n progress of fetching\n collection = HyperRecord::Collection.new\n _record_cache.each_value { |record| collection.push(record) }\n return collection\n end\n promise_all\n HyperRecord::Collection.new\n end",
"def each_element()\n yield( @element )\n end",
"def each &block\n #els = elements.map{|e| Builder.new(singular_r_name, e).build}\n return elements.to_enum if !block_given?\n for element in elements\n block.call(element)\n end\n end",
"def infinite_select_2(enum)\n Enumerator.new do |yielder|\n enum.each do |value|\n yielder.yield(value) if yield(value)\n end\n end\nend",
"def each(&block)\n return all.each(&block)\n end",
"def each\n\n rewind\n\n n,f,q,c=next_seq\n\n while (!n.nil?)\n yield(n,f,q,c)\n n,f,q,c=next_seq\n end\n\n rewind\n\n end",
"def each\n if block_given?\n (0...Count()).each { |i| yield self[i] }\n else\n (0...Count()).map { |i| self[i] }\n end\n end",
"def expand_all\n expand\n @cache\n end",
"def peek\n raise StopIteration if @enumerators.empty?\n minimum_enumrator.peek\n end",
"def map\n reset_iteration\n return enum_for(:collect) unless block_given?\n [].tap { |ret| loop { ret << yield(self.next) } }\n end"
] |
[
"0.7156392",
"0.6508514",
"0.63153464",
"0.63153464",
"0.62896097",
"0.62733287",
"0.6248347",
"0.62035775",
"0.617342",
"0.6169629",
"0.6157273",
"0.6156464",
"0.6151761",
"0.6151761",
"0.6143435",
"0.61367726",
"0.61337703",
"0.6119522",
"0.6086988",
"0.6078656",
"0.60718876",
"0.6022889",
"0.60186476",
"0.6007392",
"0.60044193",
"0.59799516",
"0.59764767",
"0.59188074",
"0.5909205",
"0.5887324",
"0.58738726",
"0.58729565",
"0.5867483",
"0.5838156",
"0.5828536",
"0.58263755",
"0.5806268",
"0.58041793",
"0.5801604",
"0.5798299",
"0.5792319",
"0.5792319",
"0.5789668",
"0.57831824",
"0.57785654",
"0.5771455",
"0.5763093",
"0.575291",
"0.5745474",
"0.57433313",
"0.57283115",
"0.5720669",
"0.5719103",
"0.5716561",
"0.5709306",
"0.57049733",
"0.5702294",
"0.5699454",
"0.5685433",
"0.56753826",
"0.567211",
"0.5671136",
"0.56656736",
"0.5660805",
"0.56551903",
"0.5644474",
"0.5644474",
"0.5627869",
"0.56132483",
"0.5602946",
"0.5578586",
"0.55729425",
"0.55612385",
"0.5555166",
"0.5554049",
"0.5549071",
"0.55488676",
"0.55475837",
"0.55472153",
"0.5538854",
"0.55328655",
"0.5525573",
"0.55244637",
"0.55239767",
"0.5521553",
"0.5515398",
"0.55145484",
"0.55115813",
"0.5500245",
"0.5497571",
"0.549088",
"0.5489461",
"0.5488688",
"0.5486755",
"0.5485282",
"0.5484098",
"0.5476686",
"0.5471828",
"0.54626006",
"0.5459303",
"0.5459207"
] |
0.0
|
-1
|
Returns the counted length. Can only be called after the end of the enumerator has been reached.
|
def length
raise CannotCallBeforeEnd, "Cant call length before the end has been reached." unless @end
return @length_cache
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def length\n each.count\n end",
"def length\n count\n end",
"def length\n @count\n end",
"def length\r\n self.count\r\n end",
"def length; count end",
"def length\n count = 0\n each { count += 1 }\n count\n end",
"def size\n it = iterator\n it.size\n end",
"def size\n counter = 0\n @items.each do |item|\n if item.nil?\n counter += 1\n else\n counter += item.length - 1\n end\n end\n counter\n end",
"def length\n @enumerable.length\n end",
"def length\n @length ||= (count.to_f / @per_chunk).ceil\n end",
"def count\n each.size\n end",
"def count\n values.inject(0){|m, v| m + v.length}\n end",
"def length\n @driver_instance.count_list_value(@key)\n end",
"def length\n @items.count do |item|\n !item.nil?\n end\n end",
"def my_count\n if block_given?\n num = 0\n self.my_each{|item| num += 1 if yield(item)}\n num\n else\n # if no block given return size of array\n self.length\n end\n end",
"def length\n length = 0; each {length += 1}; length\n end",
"def length\n @blocks.inject(@entry.length) {| sum , item | sum + item.length}\n end",
"def total_count()\n @raw_data.size\n end",
"def size\n @count\n end",
"def size\n @count\n end",
"def count\n to_a.size\n end",
"def count\n to_a.size\n end",
"def item_count\n @items.length\n end",
"def total_count\n @_total_count || @_original_array.length\n end",
"def length()\n obj_len = internal_object_length - 1\n return obj_len\n end",
"def length\n count = 0\n current = @head\n until current.nil?\n count += 1\n current = current.next\n end\n return count\n end",
"def item_count\n @collection.length\n end",
"def length\n @items.length\n end",
"def length\r\n length = 0\r\n if !@head\r\n return length\r\n else\r\n cursor = @head\r\n while cursor\r\n length += 1\r\n cursor = cursor.next\r\n end\r\n end\r\n return length\r\n end",
"def size\n @value.inject(0) {|acc, it| acc + it.size}\n end",
"def length\n collection.size\n end",
"def size\n return @items.length\n end",
"def count\n underlying_array.length\n end",
"def length\r\n return self.stop - self.start + 1\r\n end",
"def count(data)\n return data.length\n end",
"def item_count\n collection.length\n end",
"def count\n @data.size\n end",
"def length\n count = 0 \n return count if @head.nil?\n return length_helper(count, @head)\n end",
"def size\n Integer.new.tap do |count|\n each { |element| count += 1 }\n end\n end",
"def length\n reduce(0) {|sum,_| sum + 1 }\n end",
"def length\n @blocks.inject(0) {| sum , item | sum + item.length}\n end",
"def length\n @length\n end",
"def length\n @length\n end",
"def length\n @length\n end",
"def length\n return @list.length\n end",
"def size\n result, list = 0, self\n until list.empty?\n if list.cached_size?\n return result + list.size\n else\n result += 1\n end\n list = list.tail\n end\n result\n end",
"def length\n return self.stop - self.start + 1\n end",
"def length\n return self.stop - self.start + 1\n end",
"def length\n if !block_given?\n return @j_del.java_method(:length, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling length()\"\n end",
"def count\r\n items.size\r\n end",
"def length()\n return self.keys.get_length()\n end",
"def size\n return 0 if @head.nil?\n\n n = 0\n self.each { n += 1}\n return n\n end",
"def length\n count = 0\n current = head\n until current.nil?\n count += 1\n current = current.next\n end\n return count\n end",
"def length()\n return @i_keys.get_length()\n end",
"def size\n return @items.length\n end",
"def size\n return @items.length\n end",
"def size\n return @items.length\n end",
"def size\n return @items.length\n end",
"def size\n return @items.length\n end",
"def size\n return @items.length\n end",
"def size\n return @items.length\n end",
"def item_count\n @items.length \n end",
"def length\n count(:up)\n end",
"def size\n\t\tlengths.reduce(&:*)\n\tend",
"def length\n\n count_objects()\n end",
"def item_count\n @collection.size\n end",
"def length\n return 0 if @head.nil?\n\n count = 0 \n current = @head\n until current.nil?\n count += 1\n # Move the pointer to the next, otherwise will be infinite loop.\n current = current.next\n end\n\n return count\n end",
"def count_items\n @items.size\n end",
"def length\n @results_list.count\n end",
"def size\n raise_if_closed!\n\n @lock.synchronize do\n unsynchronized_size\n end\n end",
"def length\n Integer(connection.write(\"get_length\", false))\n rescue ArgumentError\n 0\n end",
"def length\n Integer(connection.write(\"get_length\", false))\n rescue ArgumentError\n 0\n end",
"def length\n Integer(connection.write(\"get_length\", false))\n rescue ArgumentError\n 0\n end",
"def length()\n #This is a stub, used for indexing\n end",
"def length\n count = 0\n current = @head\n while current != nil\n count += 1\n current = current.next\n end\n\n return count\n end",
"def count; @value.size; end",
"def my_count\n return self.to_enum unless block_given?\n counter = 0\n for i in self\n counter +=1 if yield i\n end\n return counter\n end",
"def size\n @items.length\n end",
"def length\n size\n end",
"def count\n @valueset.length\n end",
"def nitems\n count = 0\n i = 0\n lim = self.__size\n while i < lim\n count += 1 unless self.__at(i)._equal?(nil)\n i += 1\n end\n count\n end",
"def length\n @end - @start + 1\n end",
"def size\n return @items.size\n end",
"def len()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.Run_len(@handle.ptr)\n result\n end",
"def count\n each.count\n end",
"def length\n @data.length\n end",
"def size\n @items.count\n end",
"def size\n @items.count\n end",
"def count\n to_a.size\n end",
"def length\n return 0 if @head.nil?\n\n count = 0\n current = @head\n\n until current.nil?\n count += 1\n current = current.next\n end\n\n return count\n end",
"def length()\n # If there are no items, return 0 for the length.\n return 0 unless @tag.exists\n\n return @tag.length\n end",
"def size\n return @items.size\n end",
"def length\n @_length ||= begin\n raw = _redis.llen(_batch_key)\n return 0 if raw.nil? || raw.zero?\n raise Inconsistency, @uid if raw < PREFIX_COUNT\n raw - PREFIX_COUNT\n end\n end",
"def size\n\n @items.size\n end",
"def size\n data.values.inject(0){|m,v| m+=v.size}\n end",
"def length\n size\n end",
"def length\n count = 0\n current = head\n while !current.nil?\n count += 1\n current = current.next\n end\n return count\n end",
"def length(include_deleted = false)\n values(include_deleted).length\n end",
"def length\r\n @list.length\r\n end",
"def length\r\n count = 0\r\n curr = @head \r\n\r\n while curr\r\n count += 1\r\n curr = curr.next\r\n end\r\n\r\n return count\r\n end"
] |
[
"0.77859384",
"0.75392175",
"0.7527459",
"0.74279743",
"0.74182385",
"0.7343085",
"0.7341371",
"0.7329341",
"0.7302966",
"0.7255458",
"0.72254574",
"0.7207516",
"0.71943486",
"0.71807534",
"0.7151463",
"0.70933056",
"0.70712405",
"0.7069975",
"0.703647",
"0.703647",
"0.70092654",
"0.70092654",
"0.7004882",
"0.699909",
"0.69635946",
"0.6962501",
"0.69593626",
"0.69592535",
"0.6945027",
"0.69439715",
"0.69420695",
"0.6925305",
"0.69227356",
"0.69013417",
"0.68739057",
"0.686263",
"0.68566984",
"0.68477124",
"0.6839919",
"0.6839401",
"0.6838944",
"0.6828059",
"0.6828059",
"0.6828059",
"0.68186456",
"0.6816488",
"0.6807833",
"0.6807833",
"0.6802342",
"0.67997444",
"0.67910284",
"0.67896557",
"0.6778796",
"0.6767961",
"0.6767064",
"0.6767064",
"0.6767064",
"0.6767064",
"0.6767064",
"0.6767064",
"0.6767064",
"0.67607886",
"0.6757966",
"0.67575306",
"0.675625",
"0.67484593",
"0.6746896",
"0.6742134",
"0.67408866",
"0.6731856",
"0.67309326",
"0.67309326",
"0.67309326",
"0.67116475",
"0.67100465",
"0.6708431",
"0.6705465",
"0.6697299",
"0.6687474",
"0.66860247",
"0.6684156",
"0.6683133",
"0.6682522",
"0.66752195",
"0.6664667",
"0.66627604",
"0.6656357",
"0.6656357",
"0.6648089",
"0.66478604",
"0.6647499",
"0.66467816",
"0.66432995",
"0.6636527",
"0.663522",
"0.662654",
"0.66232115",
"0.6616697",
"0.6616271",
"0.6615839"
] |
0.7076803
|
16
|
Giving slice negaive arguments will force it to cache all elements and crush the memory for big results.
|
def slice(*args)
check_corrupted
if args[0].is_a?(Range) && !args[1]
need_eles = args[0].begin + args[0].end
elsif args[0] && !args[1]
need_eles = args[0]
elsif args[0] && args[1] && args[0] > 0 && args[1] > 0
need_eles = args[0] + args[1]
elsif args[0] < 0 || args[1] < 0
raise ArgumentError, "Slice cant take negative arguments."
else
raise ArgumentError, "Dont now what to do with args: '#{args}'."
end
@eles ||= []
cache_eles = need_eles - @eles.length if need_eles
cache_ele(cache_eles) if need_eles && cache_eles > 0
return @eles.slice(*args)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def slice!(*args)\n # lazy load the collection, and remove the matching entries\n orphaned = orphan_resources(super)\n\n # Workaround for Ruby <= 1.8.6\n compact! if RUBY_VERSION <= '1.8.6'\n\n unless orphaned.kind_of?(Enumerable)\n return orphaned\n end\n\n offset, limit = extract_slice_arguments(*args)\n\n query = if offset >= 0\n scoped_query(:offset => offset, :limit => limit)\n else\n query = scoped_query(:offset => (limit + offset).abs, :limit => limit).reverse\n\n # tell the Query to prepend each result from the adapter\n query.update(:add_reversed => !query.add_reversed?)\n end\n\n new_collection(query, orphaned)\n end",
"def slice(*args)\n dup.slice!(*args)\n end",
"def slice!(*args)\n offset, limit = extract_slice_arguments(*args)\n\n if self.limit || self.offset > 0\n offset, limit = get_relative_position(offset, limit)\n end\n\n update(:offset => offset, :limit => limit)\n end",
"def slice!(*keys)\n replace(slice(*keys))\n end",
"def slice! *args\n b, l = get_beginning_and_length *args\n head, sliced, tail = ()\n sliced = l.nil? ? self.slice(b) : self.slice(b, l)\n head = self.slice(0, b)\n l = 1 if l.nil?\n tail = self.slice((b + l)..-1)\n self.clear\n self.concat head + tail\n sliced\n end",
"def slice!(*keys)\r\n replace(slice(*keys))\r\n end",
"def slice!(*keys)\r\n replace(slice(*keys))\r\n end",
"def slice!(*keys)\n replace(slice(*keys))\n end",
"def slice!(*keys)\n replace(slice(*keys))\n end",
"def slice!(*keys)\n replace(slice(*keys))\n end",
"def slice(*rest) end",
"def slice(*keep)\n inject(Characterizable::BetterHash.new) do |memo, ary|\n if keep.include?(ary[0])\n memo[ary[0]] = ary[1]\n end\n memo\n end\n end",
"def slice!(*keys); end",
"def slice *keys\n dup.slice!(*keys)\n end",
"def [](slice)\n slice.respond_to?(:each) ? slice.map{|i| recover_at(i) } : recover_at(slice)\n end",
"def slice!(p0, *rest) end",
"def slice!(p0, *rest) end",
"def unlimited\n cached_dataset(:_unlimited_ds){clone(:limit=>nil, :offset=>nil)}\n end",
"def caching rows\n raise ArgumentError, \"Invalid caching size. Must be a non-negative integer.\" unless rows.is_a?(Fixnum) && rows >= 0\n spawn :@caching, rows\n end",
"def slice start, length\n if length == 1\n synchronize do\n decode @redis.lindex @redis_name, start\n end\n else\n synchronize do\n Array(@redis.lrange(@redis_name, start, start + length - 1)).map do |item|\n decode item\n end\n end\n end\n end",
"def slice(p0, *rest) end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def rebuild_cache(cache_key, klass)\n page = cache_key.slice(cache_key.index(/\\d/)..cache_key.length).to_i\n klass.all.order(:id)[(page * items_per_page)..(page * items_per_page + items_per_page)].to_a\n end",
"def slice!(start, length = nil)\n result = case start\n when Range, Array\n trim *range_pair(start)\n else\n trim(start, start + length - 1)\n end\n Redis::Future === result ? result : to_a\n end",
"def slice=(args)\n case args[1]\n when Range\n slice_set(args[0], args[1].begin, args[1].last)\n else\n slice_set(args[0], args[1], args[2])\n end\n end",
"def cache(count)\n @cached_elements = active_elements.pop(count)\n return\n end",
"def slice(*args)\n self.class.new super\n end",
"def slice(start, length)\n end",
"def slice(arg, length = (missing_length = true))\n if missing_length\n if arg.is_a?(Range)\n from, to = arg.begin, arg.end\n from += size if from < 0\n return nil if from < 0\n to += size if to < 0\n to += 1 if !arg.exclude_end?\n length = to - from\n length = 0 if length < 0\n list = self\n while from > 0\n return nil if list.empty?\n list = list.tail\n from -= 1\n end\n list.take(length)\n else\n at(arg)\n end\n else\n return nil if length < 0\n arg += size if arg < 0\n return nil if arg < 0\n list = self\n while arg > 0\n return nil if list.empty?\n list = list.tail\n arg -= 1\n end\n list.take(length)\n end\n end",
"def slice!(slice = nil)\n raise(Exception, \"Slicing unavailable!\") unless sliced?\n if slice.present?\n if slice.to_i.in?(1..slice_number)\n @current_slice = slice.to_i\n else\n raise(ArgumentError, \"Slice number must be Integer in (1..#{slice_number}). #{slice.inspect} passed.\")\n end\n end\n self\n end",
"def update_cache(subset, cache)\n instance_variable_set(\"@#{subset}\", cache)\n end",
"def recache_source_dataset!\n if source_dataset_cache?\n if source_dataset.opts[:limit] == 1\n source_dataset.cache_set([self])\n else\n source_dataset.cache_del\n end\n end\n end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def slice! *keys\n keys.inject({}) {|acc,key|\n acc[key] = self.delete(key) if self.has_key?(key)\n acc\n }\n end",
"def build_cache\n []\n end",
"def take(n)\n #This is a stub, used for indexing\nend",
"def slice_without_hooks!( index_start_or_range, length = nil )\n\n @without_hooks = true\n\n slice = slice!( index_start_or_range, length )\n \n @without_hooks = false\n \n return slice\n \n end",
"def cache(data); end",
"def slice(input, start, size, name: nil)\n _op(:slice, input, start, size: size, name: name)\n end",
"def slice(input, start, size, name: nil)\n _op(:slice, input, start, size: size, name: name)\n end",
"def slice(hash_)\n shared_slice(hash_).dup\n end",
"def slice(*args)\n Vector[*to_a.slice(*args)]\n end",
"def cache\n rows.each(&:cache)\n end",
"def together_slice(*args)\n if_not_contain_array_rails_type_error\n reduce([]) { |ret, list|ret << list.slice(*args) }\n end",
"def slice(*args, &block)\n sort_if_needed\n @rules.slice(*args, &block)\n end",
"def process_slice\n @block.call(@slice) if @slice.any?\n @seen |= @slice.map(&:filename).map(&:to_s)\n @slice = []\n end",
"def new_slice\n pause(slice_delay) if slice_delay\n self[:index] = nil\n self[:value] = nil\n end",
"def filter_cache; end",
"def slice(*args)\n case argc = args.size\n when 2 then slice_with_start_and_length(*args)\n when 1 then (arg = args.first).is_a?(Range) ? slice_with_range(arg) : at(arg)\n when 0 then raise ArgumentError, \"wrong number of arguments (0 for 1)\"\n else raise ArgumentError, \"wrong number of arguments (#{argc} for 2)\"\n end\n end",
"def chunk(array, slice)\n sliced_array = []\n array.each_slice(slice) do |num|\n sliced_array.push(num)\n end\n p sliced_array\nend",
"def each_row_slice(slice_size = 100, batch = ETL::Batch.new)\n slice = []\n each_row(batch) do |row_in|\n slice << row_in\n if slice.length >= slice_size\n yield slice\n slice = []\n end\n end\n yield slice if slice.length > 0\n end",
"def reappend_el(index)\n element = @cache.slice!(index)\n @cache << element\n end",
"def slice(range, options = {})\n start, finish = range_pair(range)\n fetch_range :zrange, start, finish, options\n end",
"def cache_results(results)\n return if search_param.length > 2\n results.each_with_index do |result, index|\n redis.zadd(cache_set, index, result)\n end\n redis.expire(cache_set, 24 * 60 * 60)\n end",
"def slice!(*keys)\n @parameters.slice!(*keys)\n self\n end",
"def cache_store=(_arg0); end",
"def cache_store=(_arg0); end",
"def rslice(range, options = {})\n start, finish = range_pair(range)\n fetch_range :zrevrange, start, finish, options\n end",
"def shift_elements(index)\n while index < @length - 1\n @cache[index] = @cache[index+1]\n index += 1\n end\n end",
"def slice(start=nil,_end=nil)\n if !block_given? && start == nil && _end == nil\n return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:slice, []).call(),::Vertx::Buffer)\n elsif start.class == Fixnum && _end.class == Fixnum && !block_given?\n return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:slice, [Java::int.java_class,Java::int.java_class]).call(start,_end),::Vertx::Buffer)\n end\n raise ArgumentError, \"Invalid arguments when calling slice(start,_end)\"\n end",
"def slice_records!\n @number_of_records ||= @records.length\n\n @records = @records.slice(0, per_page) if @number_of_records > per_page\n end",
"def fetch_from_cache\n if paginate?\n\n # Return a paginated collection\n if cached.ids.empty?\n\n # No ids, return an empty WillPaginate result\n [].paginate(opts_for_paginate)\n\n elsif combined_options.include?(:order)\n\n # An order has been specified. We have to go to the database\n # and paginate there because the contents of the requested\n # page will be different.\n klass.paginate(cached.ids, { :total_entries => cached.ids.size }.merge(opts_for_find.merge(opts_for_paginate)))\n\n else\n\n # Order is unchanged. We can paginate in memory and only select\n # those ids that we actually need. This is the most efficient.\n paged_ids = cached.ids.paginate(opts_for_paginate)\n paged_ids.replace(klass.find_all_by_id(paged_ids, opts_for_find(paged_ids)))\n\n end\n\n elsif cached.ids.empty?\n\n # We are returning a regular (non-paginated) result.\n # If we don't have any ids, that's an empty result\n # in any language.\n []\n\n elsif combined_options.include?(:order)\n\n # An order has been specified, so use it.\n klass.find_all_by_id(cached.ids, opts_for_find)\n\n else\n\n # No order has been specified, so we have to maintain\n # the current order. We do this by passing some extra\n # SQL which orders by the current array ordering.\n offset, limit = combined_options.delete(:offset) || 0, combined_options.delete(:limit) || cached.count\n ids = cached.ids[offset, limit]\n\n klass.find_all_by_id(ids, opts_for_find(ids))\n end\n end",
"def slice *keys\r\n keys.map! { |key| convert_key(key) } if respond_to?(:convert_key, true)\r\n keys.each_with_object(self.class.new) { |k, hash| hash[k] = self[k] if has_key?(k) }\r\n end",
"def prefetch(reqs)\n end",
"def slice(start, length = nil)\n case start\n when Integer\n if length\n range(start, start + length - 1)\n else\n conn.lindex(key, start) rescue nil\n end\n when Range, Array\n range *range_pair(start)\n else\n []\n end\n end",
"def cache_fetch(*args)\n super { |key| @store[key] }\n end",
"def load_cache\n a = dataset.all\n h = {}\n a.each{|o| h[o.pk.freeze] = o.freeze}\n @all = a.freeze\n @cache = h.freeze\n end",
"def new_slice(*args)\n # It also lazy-initializes the `Slice` subclass with the modules that are\n # whitelisted by `INHERITED_SLICE_MODULES`.\n unless defined? @_slice_class_initialized\n included_modules.each do |mod|\n if mod.name && INHERITED_SLICE_MODULES.include?(mod.name.sub(/^ArrayLike::/, \"\").to_sym)\n self::Slice.send(:include, mod)\n end\n end\n\n @_slice_class_initialized = true\n end\n\n self::Slice.new(*args)\n end",
"def prefetch_multiple_keys(cache_keys)\n if controller.should_refresh_cache or !Rails.configuration.action_controller.perform_caching\n {}\n else\n Rails.cache.read_multi(cache_keys.collect { |key| timestamp_key(key[0],key[1]) })\n end\n end",
"def [](index, length = undefined)\n index += @length if index < 0\n\n return if index >= @length || index < 0\n\n `\n if (length !== undefined) {\n if (length <= 0) {\n return [];\n }\n\n return self.slice(index, index + length);\n }\n else {\n return self[index];\n }\n `\n end",
"def [](start, length=1)\n length == 1 ? @storage[start] : @storage[start, length]\n end",
"def warm_cache_shuffled(pages: nil)\n pages ||= total_pages\n logger.info(\"Concurrently fetching #{pages} total pages of photos from Flickr\")\n\n photos = fetch_and_randomize_photos(pages)\n\n # 3. Cache the individual photos\n # example cache key: flickr_photo/49822914933\n cache_photos(photos)\n\n # 4. Cache photos in batches of `per_page` size\n # example cache key: flickr_photos/33668819@N03_20_1\n logger.info(\"Writing #{pages} pages of photos to cache\")\n cache_photos_in_batches(photos, pages)\n\n logger.info(\"Wrote #{photos.count} photos to cache\")\n logger.info(\"Example photo cache key: #{self.generate_photo_cache_key(photo_id: photos[0][:key])}\")\n logger.info(\"Example batch cache key: #{self.generate_page_cache_key(user_id: FLICKR_USER_ID, page: 1,\n per_page: 20,)}\")\n logger.info('Done')\n end",
"def [](*args)\n args = args.first if (args.size == 1)\n return super(args) if args.is_a?(Hash)\n ck = cache_key(args)\n if obj = @cache_store.get(ck)\n return obj\n end\n if obj = super(args)\n @cache_store.set(ck, obj, @cache_ttl)\n end \n obj\n end",
"def slice!(index, length = undefined)\n index += @length if index < 0\n\n return if index >= @length || index < 0\n\n if length\n `self.splice(index, index + length)`\n else\n `self.splice(index, 1)[0]`\n end\n end",
"def cache\n clone.tap { |crit| crit.options.merge!(:cache => true) }\n end",
"def cache!\n @@cache\n end",
"def take(count)\n Fetcher.new(self).take(count)\n end",
"def __slices(n)\n\t\tbytes = Array.new\n\t\ti = 0\n\t\twhile i < size do\n\t\t\tbytes.push(__slice(i, n))\n\t\t\ti += n\n\t\tend\n\t\treturn bytes\n\tend",
"def find_every_with_cache(options)\n return find_every_without_cache(options) unless is_caching?\n prefix_options, query_options = split_options(options[:params])\n path = collection_path(prefix_options, query_options)\n fetch(path) { find_every_without_cache(options)}\n end",
"def expand_all\n expand\n @cache\n end",
"def slice(*keys)\n keys.map! { |key| @hash.convert_key(key) } if @hash.respond_to?(:convert_key, true)\n keys.each_with_object(@hash.class.new) { |k, hash| hash[k] = @hash[k] if @hash.has_key?(k) && if_string_not_empty(@hash[k]) }\n end",
"def get_cache(subset)\n instance_variable_get(\"@#{subset}\") || Rambling::Trie.create\n end",
"def slice_images(opts) \n slices = @slices\n output = \"\"\n\n slices.each do |name, slice|\n # If we modify the canvas, we'll place the modified canvas here.\n # Otherwise, consumers will use slice[:file] [:canvas] or [:contents]\n # to get the original data as needed.\n slice[:canvas] = nil\n \n # In any case, if there is one, we need to get the original file and canvas;\n # this process also tells us if the slice is 2x, etc.\n canvas = canvas_for slice, opts\n\n # Check if a canvas is required\n must_slice = (slice[:left] != 0 or slice[:right] != 0 or slice[:top] != 0 or slice[:bottom] != 0)\n if must_slice or slice[:x2]\n if canvas.nil?\n throw \"Chance could not load file '#{slice[:path]}'.\" +\n \"If it is not a PNG, RMagick is required to slice or use @2x mode.\"\n end\n\n f = slice[:proportion]\n\n # RMagick or ChunkyPNG? 'columns' is RMagick\n if canvas.respond_to?('columns')\n canvas_width = canvas.columns\n canvas_height = canvas.rows\n else\n canvas_width = canvas.width\n canvas_height = canvas.height\n end\n\n if must_slice\n rect = nil\n\n # The math that uses canvas_width and canvas_height needs to return numbers that,\n # when multiplied by f, are valid. So, divide by f first.\n rect = slice_rect(slice, canvas_width / f, canvas_height / f)\n\n if not rect.nil?\n \n ## CHECK CACHE ##\n file = file_for(slice, opts)\n cached_canvas = Chance::Instance::Slicing.get_canvas_from_cache(file, rect)\n if cached_canvas\n slice[:canvas] = cached_canvas\n else\n slice[:canvas] = canvas.crop(rect[:left] * f, rect[:top] * f, rect[:width] * f, rect[:height] * f)\n Chance::Instance::Slicing.add_canvas_to_cache(slice[:canvas], file, rect)\n end\n \n canvas_width = rect[:height] * f\n canvas_height = rect[:width] * f\n end\n end\n\n slice[:target_width] = canvas_width / f\n slice[:target_height] = canvas_height / f\n end\n \n \n\n end\n \n end",
"def slice(*keys)\n FlexHash[keys.map { |key| [key, fetch(key)] }]\n end",
"def slice *args\n b, l = get_beginning_and_length *args\n if l.nil?\n self.at b\n else\n e = b + l - 1\n r = self.to_avi\n r.frames.each_with_index do |f, i|\n unless i >= b && i <= e\n f.data = nil\n end\n end\n r.frames\n end\n end",
"def mpileup_cached (opts={}) \n @pileup_cache = Hash.new unless @pileup_cache\n @cached_regions = Hash.new unless @cached_regions\n region = opts[:r] ? opts[:r] : opts[:region]\n unless @cached_regions[region]\n @cached_regions[region.to_s] = Bio::DB::Fasta::Region.parse_region(region)\n tmp = Array.new\n @cached_regions[region]pileup = tmp\n mpileup(opts) do | pile | \n tmp << pile \n yield pile\n end\n else \n @cached_regions.pileup[region] .each do | pile |\n yield pile\n end\n end\nend",
"def [] aName, *args\n if aName.is_a? Integer or aName.is_a? Range\n super(aName, *args)\n else\n @cache[aName.to_s]\n end\n end",
"def chunk(arr, size)\n extras = arr.length % size\n results = []\n\n # Drop the remainder, and subtract one because we're iterating from zero\n iters = (arr.length / size).floor(0) - 1 # 'iterations'\n (0..iters).each do |i|\n slice_start = size * i\n slice_length = size\n results.append( arr.slice(slice_start, slice_length) )\n end\n\n # Determine the position (+ length) in the array in order to extract the remaining elements\n slice_start = arr.length - extras\n slice_length = arr.length - slice_start\n\n results.append( arr.slice(slice_start, slice_length) ) if extras > 0\n results\nend",
"def take(n=@size)\n a = []\n n.times{a.push(pop)}\n a\n end",
"def slice(result_array, max_length=10)\n return result_array[0...max_length]\n end",
"def cache_copy(from,to)\n return unless @cache_base\n\n copy(@cache_base + from, @cache_base + to)\n end"
] |
[
"0.6689691",
"0.6555951",
"0.6256087",
"0.61413586",
"0.6070657",
"0.6068402",
"0.6068402",
"0.60481393",
"0.60481393",
"0.60481393",
"0.6035638",
"0.5954487",
"0.59522265",
"0.594318",
"0.5934288",
"0.59161437",
"0.59161437",
"0.5891549",
"0.5881322",
"0.58536875",
"0.5831622",
"0.5809159",
"0.5809159",
"0.5809159",
"0.5809159",
"0.58068013",
"0.5756949",
"0.5755849",
"0.57427794",
"0.56986",
"0.568813",
"0.56485176",
"0.5645017",
"0.5612981",
"0.56059206",
"0.55953074",
"0.55953074",
"0.55953074",
"0.55953074",
"0.55953074",
"0.55953074",
"0.55953074",
"0.55833757",
"0.5571293",
"0.5543381",
"0.5538663",
"0.5532015",
"0.5531458",
"0.5531458",
"0.55012643",
"0.5497839",
"0.5490256",
"0.54872143",
"0.5443579",
"0.54129463",
"0.5402765",
"0.5397402",
"0.5396171",
"0.5381866",
"0.53666073",
"0.5347081",
"0.53251565",
"0.5317921",
"0.5316985",
"0.53068537",
"0.53068537",
"0.5303677",
"0.5295093",
"0.52386546",
"0.52299166",
"0.52147245",
"0.52065164",
"0.52030796",
"0.5183561",
"0.51657367",
"0.51583916",
"0.51516986",
"0.514396",
"0.51234406",
"0.51203626",
"0.5115953",
"0.51111",
"0.50945747",
"0.5090553",
"0.50867015",
"0.5078534",
"0.5067931",
"0.5067299",
"0.50647247",
"0.5061125",
"0.5060672",
"0.5060265",
"0.50526303",
"0.5040424",
"0.5038509",
"0.50366104",
"0.5035175",
"0.50264925",
"0.50247073",
"0.50175357"
] |
0.6435965
|
2
|
Caches necessary needed elements and then returns the result as on a normal array.
|
def shift(*args)
check_corrupted
if args[0]
amount = args[0]
else
amount = 1
end
@eles ||= []
cache_ele(amount - @eles.length) if @eles.length < amount
res = @eles.shift(*args)
# Since we are removing an element, the length should go down with the amount of elements captured.
if args[0]
@length_cache -= res.length
else
@length_cache -= 1
end
return res
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def build_cache\n []\n end",
"def cache\n @transpose\n end",
"def cache\n rows.each(&:cache)\n end",
"def data_caches\n (@data_caches || [])\n end",
"def getCache\n keys = Rails.cache.instance_variable_get(:@data).keys\n data = [keys.length]\n\n #If a city parameter is detected and it matches data in the city field in the cache then \n #that city and its corresponding ip address and country are pushed onto the array\n if params[\"city\"]\n city = params[\"city\"]\n keys.each do |key|\n curr = Rails.cache.read(key)\n if curr[\"city\"] == city\n data.push(Rails.cache.read(key))\n end\n end\n #If a country parameter is detected and it matches data in the country field in the cache then \n #that country and its corresponding ip address and city are pushed onto the array\n elsif params[\"country\"]\n city = params[\"country\"]\n keys.each do |key|\n curr = Rails.cache.read(key)\n if curr[\"country\"] == city\n data.push(Rails.cache.read(key))\n end\n end\n #If no parameters are detected then push cache onto array\n else\n keys.each do |key|\n data.push(Rails.cache.read(key))\n end\n end\n\n @cache = data\n \n end",
"def data\n @cache ||= {}\n end",
"def get_data\n (mem, w_cache) = get_mem\n [100*mem.to_f/@total, 100*w_cache.to_f/@total]\n end",
"def cache(count)\n @cached_elements = active_elements.pop(count)\n return\n end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache(data); end",
"def cache_nodes_to_array\n arr = []\n node = @rear_node\n begin\n arr << node.value\n node = node.parent\n end while !node.nil?\n return arr\n end",
"def in_memory\n []\n end",
"def to_a\n check_corrupted\n cache_all\n return @eles\n end",
"def cached\n raise NotImplementedError\n end",
"def in_memory\n []\n end",
"def in_memory\n []\n end",
"def cache\n @cache ||= build_cache\n end",
"def get_array\n\t\tsynchronize do\n\t\t\t@condition.wait_until{@array.size > 0}\n\t\t\ta = @array\n\t\t\t@array = []\n\t\t\treturn a\n\t\tend\n\tend",
"def cache\n # Do a deep copy\n Marshal.load(Marshal.dump(@@cache))\n end",
"def cache\n DataCache\n end",
"def db_cache_array( options )\n collection = options[:collection]\n # nitro_cache_key - same across all collection\n nitro_cache_key = options.to_nitro_cache_key\n\n # this is place where NitroPartial creates new partials info in DB\n @current_cache_aggregator = { nitro_partial_id: NitroPartial.get_partial( options[:partial], options ).id,\n nitro_cache_key: nitro_cache_key,\n reverse: false,\n caches: [] }\n\n result = render( partial: options[:partial],\n collection: collection,\n as: options[:as],\n locals: {\n locals: options[:locals]\n }\n )\n (collection.try(:first) ? collection.try(:first).class : collection.klass).nitro_cache_bulk_insert( @current_cache_aggregator )\n\n NitroCache.where( nitro_cacheable: collection, nitro_cache_key: nitro_cache_key ).update_all(viewed_at: Time.now)\n result\n end",
"def cache\n @cache ||= {}\n end",
"def cache\n @cache ||= {}\n end",
"def raw\n @cache ||= Hash[ rows.map { |row| [row, cells(row)] } ]\n end",
"def cache\n @cache ||= {}\n end",
"def cache\n @cache ||= {}\n end",
"def __array__; self; end",
"def cache\n @cache ||= {}\n end",
"def cache_instances\n [*Pages.all_instances, *([BlogArticle, Industry, Team].map{|p| p.all })]\n end",
"def load_static_cache_rows\n if rows = Sequel.synchronize{@static_cache_cache[name]}\n rows.map{|row| call(row)}.freeze\n else\n rows = dataset.all.freeze\n raw_rows = rows.map(&:values)\n Sequel.synchronize{@static_cache_cache[name] = raw_rows}\n rows\n end\n end",
"def value_cache\n C.value_cache\n end",
"def to_array(array=nil)\n if array\n array.start = 0\n array.total = @size\n else\n array = Array.new @size\n end\n\n i = 0\n while i < @capacity\n array[@table[i+2]] = @table[i+1] if @table[i]\n i += 4\n end\n\n unless @spill.empty?\n i = @spill.to_iter 3\n while i.next\n array[i.at(2)] = i.at(1) if i.item\n end\n end\n\n array\n end",
"def [](row_number)\n if fully_cached?\n cache[row_number]\n else\n to_a[row_number]\n end\n end",
"def arr\n @custom_cells.each do |c|\n set_custom_cell_val(c)\n end\n @arr.map! { |x| (x == nil) ? 0 : x }\n @arr\n end",
"def build_array\n arr = []\n yield(arr)\n arr \n end",
"def cache!\n @@cache\n end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def array\n @@array\n end",
"def calc_karps_algo_values\n 🛑 ::RuntimeError.new(\"| c{CurrencyMatrix}-> m{calc_karps_algo_values} already has warm cache |\") unless @cached_stats[:karp_vals].empty?\n (0...@len).∀ do |i|\n @cached_stats[:karp_vals] << self.karps_algorithm(i)\n end\n @cached_stats[:karp_vals]\n end",
"def cache_version_data\n {}\n end",
"def cache\n @cached = { y: @y, x: @x }\n end",
"def all_fetched_entries\n @entry_cache.all_entries\n end",
"def to_a\n a = Array.new(size).fill(0)\n @elements.each_pair { |k,v| a[k] = v }\n a\n end",
"def atomic_array_pulls\n @atomic_array_pulls ||= {}\n end",
"def compute_cache\n\n\t\t# cache of equality will be stored on @equals\n\t\t# we store if a number if equal to the successor\n\t\t@equals = Array.new( @sequence.size )\n\n\t\t# for every number on the list\n\t\ti = 0\n\t\t@sequence.reduce do |left,right|\n\n\t\t\t# We compute and store the equality\n\t\t\t@equals[i] = ( left === right )\n\n\t\t\t# next number!!!\n\t\t\ti += 1\n\n\t\t\t# we return right to continue the reduce\n\t\t\tright\n\t\tend\n\n\t\t# The last number is NOT equal to the successor\n\t\t@equals[ i ] = false\n\tend",
"def cache_all\n begin\n @mutex.synchronize do\n while ele = @enum.next\n @length_cache += 1\n @eles << ele\n end\n end\n rescue StopIteration\n @end = true\n end\n end",
"def rebuild_cache(cache_key, klass)\n page = cache_key.slice(cache_key.index(/\\d/)..cache_key.length).to_i\n klass.all.order(:id)[(page * items_per_page)..(page * items_per_page + items_per_page)].to_a\n end",
"def atomic_array_add_to_sets\n @atomic_array_add_to_sets ||= {}\n end",
"def cache_store; end",
"def cache_store; end",
"def generate_data_values\n data_array = Array.new()\n @data.repository.each { |dataset|\n data_array << create_data_hash(dataset)\n }\n return data_array\n end",
"def to_a; Array(force) end",
"def array\n raise \"Not implemented\"\n end",
"def get_items\r\n @arr.to_a\r\n end",
"def to_a\n @size_dep.depend\n array = []\n Volt.run_in_mode(:no_model_promises) do\n attributes.size.times do |index|\n array << deep_unwrap(self[index])\n end\n end\n array\n end",
"def cache\n @cache ||= MemoryCache.new\n end",
"def expand_all\n expand\n @cache\n end",
"def rebuild_weight_array\n end",
"def cacheable_data\n @cacheable_data ||= {}\n .merge(@page.liquid_data)\n .merge(LiquidHelper.globals(page: @page))\n .merge(images: images)\n .merge(named_images: named_images)\n .merge(primary_image: image_urls(@page.image_to_display))\n .merge(shares: Shares.get_all(@page))\n .merge(follow_up_url: follow_up_url)\n end",
"def Array(p0) end",
"def populate\n (0...@quantity).each do |i|\n @result[i] = sequence(i)\n end\n end",
"def fetch\n fetch0(Array, false)\n end",
"def collect_cache_module_data\n return unless collect_module_exists?\n collect_keys.each do |key|\n mod_array = collect_module[key]\n next if mod_array.blank?\n mod_cache_array = Array.new\n mod_array.delete_if do |hash|\n hash[:cache] != false ? (mod_cache_array.push(hash) and true) : false\n end\n collect_module.delete(key) if mod_array.blank?\n next if mod_cache_array.blank?\n collect_module_data_for(key, mod_cache_array)\n end\n end",
"def as_array\n @fm.dup\n end",
"def resize!\n new_array = StaticArray.new(@store.length * 2)\n self.each_with_index do |el, i|\n new_array[i] = el\n end\n @store = new_array\n end",
"def add(ele)\n # Just need to add the element to the cache if the cache is not full\n if count < max_storage\n underlying_array << ele\n return ele\n end\n\n # 1. Check if the element already exists inside of the cache\n # 2. Remove the first element if it exists, otherwise delete it from the cache\n # 3. Append the element to the back of the cache\n search_idx = underlying_array.index(ele)\n search_idx.nil? ? underlying_array.shift : underlying_array.delete_at(search_idx)\n underlying_array.push(ele)\n end",
"def load_cache\n a = dataset.all\n h = {}\n a.each{|o| h[o.pk.freeze] = o.freeze}\n @all = a.freeze\n @cache = h.freeze\n end",
"def fetch_curr_table\n Array.new\n end",
"def initialize_cache\n @elephant_cache = {}\n end",
"def entries\n Rails.cache.instance_variable_get(:@data).size\n end",
"def to_ary\n\t\t\treturn @elements.to_ary\n\t\tend",
"def simple_cache\n @@cache_store\n end",
"def data\n # This is a common memoization technique used in Ruby\n @data ||= normalize_data\nend",
"def expiration_to_a\n @entries.to_a\n end",
"def _rewrap_array(result)\n if @wrap_results\n newcoll = @collection.class.new(result)\n self.class.new(newcoll, @wrapfunc_in, @wrapfunc_out)\n else\n @collection.class.new(result.map(&@wrapfunc_out))\n end\n end",
"def products_with_cache\n if new_record?\n @products_cache || []\n else\n self.products_without_cache\n end\n end",
"def build_metric_data_array(stats_hash)\n metric_data_array = []\n stats_hash.each do |metric_spec, stats|\n # Omit empty stats as an optimization\n unless stats.is_reset?\n metric_id = metric_id_cache[metric_spec]\n metric_data = if metric_id\n NewRelic::MetricData.new(nil, stats, metric_id)\n else\n NewRelic::MetricData.new(metric_spec, stats, nil)\n end\n metric_data_array << metric_data\n end\n end\n metric_data_array\n end",
"def to_a\n if @values.first.nil?\n # Price curve hasn't been calculated.\n Array.new(@length) { |index| get(index) }\n else\n super\n end\n end",
"def get_items\n\t\t@arr\n\tend",
"def get_array_final(name,value)\n\thash_final = Hash[name.zip(value.map)]\n\treturn hash_final\nend",
"def ensure_cardinality(result)\n Array.wrap(result)\n end",
"def instance_cache; end",
"def cache_content\n csv = CSV.parse(@cache.get, :headers => true)\n csv = csv.first # Only one line.\n\n # Clean-up\n csv = csv.map{|key, value| [key.strip, value.strip]}\n .delete_if{|key, _| key.empty?}\n\n date_entry, *quotations = *csv\n _, date = date_entry\n\n time = Time.parse(date + ' ' + self.class.new_rates_time_of_day_s(date))\n quotations.map!{|cur,rate| [cur, BigDecimal.new(rate)]}\n\n [time, quotations]\n rescue\n raise InvalidCacheError\n end",
"def to_a()\n [@count, @tempCore0, @tempCore2, @temp1] ;\n end",
"def to_ary\n self.map{|result| result}\n end",
"def array_hash\n array_name = array_crypto_name()\n array_value = array_crypto_value()\n new_array=[]\n array_name.size.times {|i| new_array<<Hash[array_name[i],array_value[i]]}\n puts new_array.inspect\n return new_array\nend\n\narray_hash()",
"def airports_normal\n return Array.new\n end",
"def update_cache\n # Does nothing...up to subclasses to implement.\n end",
"def to_ary; []; end",
"def compute_query_api_pattern_array_data(query_api_method_name, source, params_with_defaults, used_query_params)\n result = source.dup\n source.dup.each_with_index do |item, idx|\n value = compute_query_api_pattern_param(query_api_method_name, item, params_with_defaults, used_query_params)\n value == Utils::NONE ? result.delete_at(idx) : result[idx] = value\n end\n result\n end",
"def array\n @array\n end",
"def compute_down_cache\n collection = Array.new(@row_ct) { Array.new(@col_ct) { 0 }}\n c_idx = 0\n while (c_idx < @col_ct) do\n r_idx = 0 # LESSON: whenever doing these nested loops, make sure to double check that values get properly reset...\n counter = 0\n while (r_idx < @row_ct) do\n val = @grid[r_idx][c_idx]\n if val == 1\n counter += 1\n else\n counter = 0\n end\n collection[r_idx][c_idx] = counter\n r_idx += 1\n end\n c_idx += 1\n end\n return collection\n end"
] |
[
"0.6984168",
"0.6394703",
"0.6152861",
"0.6102456",
"0.60799986",
"0.6042356",
"0.5970591",
"0.5967334",
"0.59621054",
"0.59621054",
"0.59621054",
"0.59621054",
"0.59621054",
"0.59621054",
"0.59621054",
"0.5935178",
"0.58838564",
"0.58155787",
"0.58038986",
"0.5792339",
"0.5758892",
"0.5758892",
"0.5737914",
"0.57306576",
"0.57134646",
"0.5713072",
"0.5696828",
"0.56683546",
"0.56683546",
"0.56675005",
"0.56564283",
"0.56564283",
"0.5639153",
"0.56263417",
"0.56040263",
"0.5601596",
"0.558992",
"0.5583728",
"0.55738246",
"0.55698097",
"0.5554811",
"0.5549354",
"0.5543158",
"0.5543158",
"0.5543158",
"0.5543158",
"0.5526629",
"0.54972595",
"0.54831064",
"0.5481193",
"0.5472675",
"0.5458977",
"0.54302734",
"0.54120225",
"0.54089975",
"0.5362842",
"0.53514504",
"0.5348754",
"0.5348754",
"0.53484005",
"0.5341311",
"0.5340267",
"0.53396827",
"0.53266865",
"0.5325262",
"0.5317964",
"0.53171784",
"0.5313162",
"0.5299857",
"0.52959746",
"0.5293392",
"0.5290243",
"0.5288888",
"0.5283653",
"0.5269659",
"0.52687085",
"0.5267549",
"0.52662694",
"0.5254594",
"0.52438074",
"0.52404326",
"0.5238985",
"0.52307665",
"0.5229644",
"0.522526",
"0.5221342",
"0.52187806",
"0.5215861",
"0.52108705",
"0.5210313",
"0.520511",
"0.51949275",
"0.5188345",
"0.51825196",
"0.51762456",
"0.517557",
"0.5170335",
"0.516255",
"0.516158",
"0.5161482",
"0.51572216"
] |
0.0
|
-1
|
Returns a normal array with all elements. Can also raise corrupted error if elements have been thrown out.
|
def to_a
check_corrupted
cache_all
return @eles
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_a; Array(force) end",
"def coerce_array(array, non_empty)\n unless array.kind_of?(Array)\n coercion_error!\n end\n if non_empty and array.empty?\n coercion_error!\n end\n array\n end",
"def to_a; []; end",
"def array\n ErrorArray.new(self)\n end",
"def array\n raise \"Not implemented\"\n end",
"def check_corrupted\n raise ArrayCorruptedError, \"Too late to call. Corrupted.\" if @array_corrupted\n end",
"def to_a\n out = []\n\n each { |e| out << e }\n\n out\n end",
"def to_array\n array = []\n self.each { |x| array.push x }\n return array\n end",
"def to_a\n @arr\n end",
"def to_a; [Array]; end",
"def to_a\n each.force\n end",
"def to_a\n Array(each)\n end",
"def to_a\n array\n end",
"def to_a()\n a = []\n for i in 0..size()-1\n a << self[i]\n end\n a\n end",
"def to_flat_array\n ary = Array.new(self.size)\n self.each.with_index { |v,i| ary[i] = v }\n ary\n end",
"def to_a\n a = []\n for i in 0..size()-1\n a << self[i]\n end\n a\n end",
"def to_a\n @elements.dup\n end",
"def as_array\n @fm.dup\n end",
"def get_array\n\t\tsynchronize do\n\t\t\t@condition.wait_until{@array.size > 0}\n\t\t\ta = @array\n\t\t\t@array = []\n\t\t\treturn a\n\t\tend\n\tend",
"def to_a\n result = []\n size.times { |i| result << self[i] }\n result\n end",
"def to_a\n Array.wrap(self)\n end",
"def to_a\n a = Array.new(size).fill(0)\n @elements.each_pair { |k,v| a[k] = v }\n a\n end",
"def to_a\n Array.new @row || nilified_row\n end",
"def to_a\n array = all\n array.each_with_index do |value, i|\n array[i] = value.to_a if value.is_a?(RedisArray)\n end\n end",
"def to_a\n map { |e| e.data}\n end",
"def to_a\n @elements.clone\n end",
"def to_a(length=self.length)\n length == 0 ? [] : self[0, length]\n end",
"def to_ary; []; end",
"def void_array(*args)\n return nil.to_a\n end",
"def to_a\n # @rows.collect{|row| row.collect{|e| e}} \n my_rows = @rows\n r_size = my_rows.size\n res = Array.new(r_size)\n for i in 0..r_size-1 do\n res[i] = my_rows[i].dup\n end\n res\n end",
"def to_a\n a = Array.new(stop)\n self.each { |i,v| a[i] = v }\n return a\n end",
"def to_a\n return [] unless head\n head.to_a\n end",
"def to_a\n return [] unless head\n head.to_a\n end",
"def ensure_cardinality(result)\n Array.wrap(result)\n end",
"def to_a\n\t\t\tflat = []\n\t\t\t\n\t\t\tflatten_to_array(flat)\n\t\t\t\n\t\t\treturn flat\n\t\tend",
"def to_a\n errors.dup\n end",
"def to_array(array=nil)\n if array\n array.start = 0\n array.total = @size\n else\n array = Array.new @size\n end\n\n i = 0\n while i < @capacity\n array[@table[i+2]] = @table[i+1] if @table[i]\n i += 4\n end\n\n unless @spill.empty?\n i = @spill.to_iter 3\n while i.next\n array[i.at(2)] = i.at(1) if i.item\n end\n end\n\n array\n end",
"def get_elements(array)\n\n elements = []\n if array != nil\n elements = array.to_a\n end\n return elements\n\nend",
"def __array__; self; end",
"def safe_to_array(o)\n case o\n when NilClass\n []\n when Array\n o\n else\n [o]\n end\n end",
"def to_ary\n\t []\n\tend",
"def to_a\n x = []\n self.each do |it|\n x << it\n end\n x\n end",
"def to_a\n each.to_a\n end",
"def to_a\n each.to_a\n end",
"def to_array\n @array ||= begin\n array = to_hash.kind_of?(Array) ? to_hash : [to_hash]\n array.compact\n end\n end",
"def flatten!\n\t\t@array = make_flat(@array)\n\tend",
"def to_a\n result = []\n self.each do |item|\n result << item\n end\n return result\n end",
"def to_a\n @size_dep.depend\n array = []\n Volt.run_in_mode(:no_model_promises) do\n attributes.size.times do |index|\n array << deep_unwrap(self[index])\n end\n end\n array\n end",
"def to_ary()\n return nil;\n end",
"def get_items\r\n @arr.to_a\r\n end",
"def to_ary\n nil\n end",
"def to_ary\n nil\n end",
"def to_ary\n nil\n end",
"def to_ary\n nil\n end",
"def to_a\n a = []\n each { |item|\n a.push(item)\n }\n a\n end",
"def alternate\n return [] if size.zero?\n return [[self[0]]] if size == 1 \n populate_alternate_arrays\n end",
"def to_a\n\n @pointer.address.zero? ? nil : self.collect { |e| e }\n end",
"def to_a\n super.map{|v| Array === v ? v.to_a : v}\n end",
"def to_ary\n nil\n end",
"def to_ary\n nil\n end",
"def to_ary\n nil\n end",
"def to_ary\n nil\n end",
"def eContents\r\n if @_contained_elements\r\n @_contained_elements.dup\r\n else\r\n []\r\n end\r\n end",
"def to_a\n\t\tarr = []\n\t\teach {|valor| arr << valor}\n\t\tarr\n\tend",
"def to_a\n to_ary.dup\n end",
"def to_a\n unchecked = @val\n shift = 0\n arr = []\n while unchecked > 0\n bit = unchecked & -unchecked\n pos = bit.bit_length - 1\n arr << (pos + shift)\n unchecked >>= (pos + 1)\n shift += pos + 1\n end\n arr\n end",
"def to_ary\n nil\n end",
"def converted_arrays; end",
"def raw_elements\n _elms.tap do |e|\n raise(OperaWatir::Exceptions::UnknownObjectException) if e.empty?\n end\n end",
"def to_a\n to_ary.dup\n end",
"def missing_data\n only_missing.to_a\n end",
"def to_a ; data.dup ;end",
"def to_ary; nil; end",
"def array()\n\t\t@array\n\tend",
"def to_ary\n\t\t\treturn @elements.to_ary\n\t\tend",
"def array\n @@array\n end",
"def to_box(safe: true)\n Array(self).to_box(safe: safe) unless self.empty?\n end",
"def Array(p0) end",
"def to_ary\n each.to_a\n end",
"def arr\n @custom_cells.each do |c|\n set_custom_cell_val(c)\n end\n @arr.map! { |x| (x == nil) ? 0 : x }\n @arr\n end",
"def array(before: Pass.instance, each: Pass.instance, after: Pass.instance)\n ArrayV.new before: before, each: each, after: after\n end",
"def to_ary! #:nodoc:\n @enumerator = @enumerator.to_a unless @enumerator.is_a?(Array)\n @enumerator\n end",
"def make_sure_array(objects)\n return if objects.nil?\n\n objects = objects.values if objects.respond_to?(:values)\n objects = [objects] unless objects.respond_to?(:each)\n objects\n end",
"def array\n @array\n end",
"def to_a\n result = []\n self.each { |e| result << e } # each will use succ\n result\n end",
"def nilified_row\n (@nilified_row ||= Array.new(size)).dup\n end",
"def to_ary\n\t\t@data.flatten\n\tend",
"def my_flatten\n arr = []\n i = 0\n while i < self.length\n if self[i].is_a? Array\n arr += self[i].my_flatten\n else\n arr << self[i]\n end\n i += 1\n end\n return arr\n end",
"def to_ary\n self.map{|result| result}\n end",
"def array_of_nils(length:)\n Array.new(length, nil)\nend",
"def to_a\n results = []\n traverse { |value| results << value }\n results\n end",
"def to_a\n if @values.first.nil?\n # Price curve hasn't been calculated.\n Array.new(@length) { |index| get(index) }\n else\n super\n end\n end",
"def arrayify(a)\n ( a && a.respond_to?(:to_a) ) ? a.to_a : nil\n end",
"def all\n @rarray\n end",
"def flatten\n raise\n end",
"def to_a \n return @data\n end",
"def to_flex_array\n self\n end",
"def flatten\n\t\tmake_flat(@array)\n\tend",
"def _ensure_array_is_valid(ary)\n toins = []\n ary.each do |e|\n begin\n toins << self.class.validate(e)\n rescue DontInsertException; end\n end\n \n toins\n end",
"def test_NilClass_InstanceMethod_to_a\n\t\tassert_equal([], nil.to_a)\n\tend"
] |
[
"0.6327811",
"0.6207902",
"0.60584545",
"0.6018229",
"0.5999955",
"0.5979181",
"0.5963324",
"0.5918077",
"0.5899368",
"0.58793414",
"0.5876633",
"0.58589774",
"0.5846337",
"0.58371603",
"0.58151656",
"0.57924086",
"0.5755562",
"0.5750376",
"0.57429296",
"0.57337123",
"0.56966597",
"0.56950754",
"0.56838673",
"0.56679314",
"0.5650052",
"0.5640267",
"0.562518",
"0.56222767",
"0.5616961",
"0.56043696",
"0.5585769",
"0.5532693",
"0.5532693",
"0.55316997",
"0.5529534",
"0.5507191",
"0.549549",
"0.54943776",
"0.548595",
"0.5478353",
"0.5469193",
"0.54649746",
"0.5452674",
"0.5452674",
"0.540143",
"0.5382271",
"0.53636885",
"0.53571206",
"0.53555715",
"0.53461915",
"0.5340505",
"0.5340505",
"0.5340505",
"0.5340505",
"0.5338324",
"0.5338253",
"0.53234166",
"0.5311501",
"0.53036517",
"0.53036517",
"0.53036517",
"0.53036517",
"0.5287479",
"0.5280549",
"0.5279992",
"0.52778137",
"0.52765256",
"0.5275104",
"0.5273218",
"0.52654445",
"0.5263699",
"0.5261317",
"0.5260889",
"0.5255547",
"0.52538145",
"0.52411616",
"0.5236833",
"0.52345586",
"0.52343893",
"0.52303874",
"0.5223179",
"0.52221143",
"0.52097946",
"0.5204881",
"0.51994175",
"0.5194067",
"0.5172789",
"0.5170539",
"0.51686436",
"0.51625705",
"0.5158638",
"0.51568127",
"0.51484096",
"0.5117923",
"0.5104554",
"0.5097571",
"0.5094904",
"0.50917274",
"0.50807333",
"0.5079335"
] |
0.61041963
|
2
|
Raises error because elements have been forgotten to spare memory.
|
def check_corrupted
raise ArrayCorruptedError, "Too late to call. Corrupted." if @array_corrupted
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def try_allocate_next\n while not @waiting_list.empty? and @waiting_list.first[1] <= @free do\n first = @waiting_list.shift\n first[0].req(self, first[1])\n first[0].ready\n end\n end",
"def book_execution(fill)\n# allocate(fill)\n end",
"def allocate_memory( amount )\n return false\n end",
"def memos; end",
"def memos; end",
"def memory_allocation_exceeded(host_name)\n `curl -s -i -L \\\n -u #{Conn[:creds]} \\\n -H 'content-type:application/json' \\\n #{[Conn[:host_api], 'nodes', host_name].join('/')} | jq '.mem_used<.mem_limit*.8'`\n end",
"def free_space\n @ole.FreeSpace\n end",
"def free_space_ok?\n #todo: need real heuristic\n free_space['main']['inodes'] > 100000\n end",
"def reserve!\n memory_map.transform_values! { |_| RESERVED }\n end",
"def allocate(parts); end",
"def spaceAvailable\n\t\treturn @maxElements > @weapons.length + @shieldBoosters.length\n\tend",
"def sub_allocate array,attribute,compared_to,container,&block\r\nsub_array = pick_items(array,attribute,compared_to)\r\n\t\t\t\t# select the first empty element from Booking Items matching condition\r\n\t\t\t\tif !sub_array.empty? \r\n\t\t\t\tsub_array.each do |it|\r\n\t\t\t\t\t\tif it.first_empty_unit \r\n\t\t\t\t\t\tit.first_empty_unit.box = container\r\n\t\t\t\t\t\treturn \r\n\t\t\t\t\t\tend\r\n\t\t\t\t\tend\r\n\t\t\t\telsif block_given?\r\n\t\t\t\tnew_array = yield array\r\n\t\t\t\t\tif !new_array.empty?\r\n\t\t\t\t\t\tnew_array.each do |bi|\r\n\t\t\t\t\t\t\t\tif bi.first_empty_unit \r\n\t\t\t\t\t\t\t\tbi.first_empty_unit.box = container\r\n\t\t\t\t\t\t\t\treturn \r\n\t\t\t\t\t\t\t\tend\r\n\t\t\t\t\t\tend\r\n\t\t\t\t\tend\r\n\t\t\t\t\t# select the first empty element from any Booking Item\r\n\t\t\t\t\t\tarray.each do |bi|\r\n\t\t\t\t\t\t\tif bi.first_empty_unit \r\n\t\t\t\t\t\t\tbi.first_empty_unit.box = container\r\n\t\t\t\t\t\t\treturn \r\n\t\t\t\t\t\t\tend\r\n\t\t\t\t\t\tend\r\n\t\t\t\t#SURPLUS CONTAINER\t\r\n\t\t\t\terrors << \"Surplus Container #{container.instance_variable_get(:@container)}\" \r\n\t\t\t\telse\r\n\t\t\t\t# select the first empty element from any Booking Item\r\n\t\t\t\t\t\tarray.each do |bi|\r\n\t\t\t\t\t\t\tif bi.first_empty_unit \r\n\t\t\t\t\t\t\tbi.first_empty_unit.box = container\r\n\t\t\t\t\t\t\treturn \r\n\t\t\t\t\t\t\tend\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tend\r\n\t\t\t\t#SURPLUS CONTAINER\t\r\n\t\t\t\terrors << \"Surplus Container #{container.instance_variable_get(:@container)}\" \r\n\t\t\t\tend\r\nend",
"def disk_space_allocation_exceeded(host_name)\n `curl -s -i -L \\\n -u #{Conn[:creds]} \\\n -H 'content-type:application/json' \\\n #{[Conn[:host_api], 'nodes', host_name].join('/')} | jq '.disk_free_limit<.disk_free*.8'`\n end",
"def get_free_space\n get(Codenjoy::Client::Games::Tetris::Board::ELEMENTS[:NONE])\n end",
"def spaceAvailable\n return @maxElements > @weapons.length + @shieldBoosters.length\n end",
"def preallocated_make_new\n make_new(:default)\n rescue Exception\n sync{@size[0] -= 1}\n raise\n end",
"def element_size\n end",
"def resize!\n self.capacity *=2 \n new_store = StaticArray.new(capacity)\n self.length.times { |i| new_store[i] = self[i] } \n self.store = new_store\n end",
"def resize!\n #dobule capacity\n #new store\n #place existing elements into new store\n capacity2 = @capacity * 2\n store2 = StaticArray.new(capacity2)\n @length.times { |i| store2[i] = @store[i] }\n @capacity = capacity2\n @store = store2\n end",
"def check_for_registry_leaks\n expected = @players.size + @npcs.size\n actual = @registry.size\n if expected != actual\n raise \"We have #{expected} game entities, #{actual} in registry (delta: #{actual - expected})\"\n end\n end",
"def _element_size(memory)\n RuntimeValidator::can_get_size @left_operand.type, memory.current_frame_name, @line_number\n Memory::Value.int @left_operand.value.length\n end",
"def free_bytes\n free * pagesize\n end",
"def ensure_order_and_write\n fill_queues\n unless @heap.empty?\n #extract the minimum element from the heap \n extracted_el = @heap.extract\n write_to_disk(extracted_el)\n #add the next element from the same thread to the heap\n from_queue = extracted_el[:thread]\n fill_queues\n next_el = @thread_queues[from_queue].shift\n if next_el\n @heap.push(next_el) \n end\n end\n end",
"def memsize\n end",
"def next_free\n #need to increment before returning value, because returning exits function\n sizeup if @next_free >= @max\n @next_free+=1\n # puts \"item #{arr[@next_free-1].pool_id} allocated\" \n return @arr[@next_free-1]\n end",
"def avail_out= size\n\t\tsize.times do \n\t\t\tif size > avail_out\n\t\t\t\t@output_buffer.push nil\n\t\t\telse\n\t\t\t\t@output_buffer.pop\n\t\t\tend\n\t\tend\n\tend",
"def space_available\n used = 0\n if recordings.any?\n used = recordings.map(&:full_size).reduce(:+) \n end\n\n total_space - used\n end",
"def nilitems\n size - nitems\n end",
"def location_capacity_overflow\n logger.debug(\"XXXXXXXXXXXXXXXXX Imran Latif - Index Location\")\n if (self.capacity.to_i != 0 && !self.capacity.nil? && self.capacity.to_i < self.locations.count)\n errors.add(:location, \"cannot be created / updated. Have more sub-locations than capacity you are specifying right now. Please! delete and try again.\")\n end\n \n end",
"def pre_verify(packer)\n total = packer.machines.map(&:memory).inject { |a, e| a + e }\n physical = ::Chef.node['memory']['total'].to_i / 1024\n fail \"The fragments chosen require (#{total}MB) more than three \" \\\n \" of the physical memory (#{physical}MB) on this machine.\" \\\n if total > (physical * 0.75)\n end",
"def current_memory\n nil\n end",
"def delete\n raise \"Bad things happen\" if @size == 0\n @size -= 1\n end",
"def resize!\n dcap = @capacity * 2\n dstore = StaticArray.new(dcap)\n\n for i in 0...@length\n dstore[i] = self[i]\n end\n\n self.capacity = dcap\n self.store = dstore\n end",
"def test_that_full_tile_rack_doesnt_need_any_tiles\n 7.times{|num| @newTileRack.append(:A)}\n assert_equal(0,@newTileRack.number_of_tiles_needed)\n end",
"def reset\r\n free\r\n @requested = []\r\n end",
"def deallocate_memory\n return false\n end",
"def test_elementsNumber\n temp = []\n for e in @elements\n temp.push(e)\n end\n while temp.size > 3\n [@window, @sprite, @bitmap].each{|container|\n uc = UCGraph.new(container, 100 + 200*(temp.size%3.to_i), 180 + 120*(temp.size%2.to_i), 50, temp, nil, 100, -100, Font.normal_font,\n Color.hp_gauge_color1, Color.hp_gauge_color2,\n Color.mp_gauge_color1, Color.mp_gauge_color2, nil,\n 1, Color.normal_color)\n uc.draw()\n }\n temp.delete_at(temp.size-1)\n end\n return true\n end",
"def size\n @elements.size\n end",
"def not_available\n (0...@size).reject { |index| bit_on?(index) }\n end",
"def cache(count)\n @cached_elements = active_elements.pop(count)\n return\n end",
"def +@\n if dummy?\n +Alloc.new(self)\n else\n @size\n end\n end",
"def in_memory\n []\n end",
"def in_memory\n []\n end",
"def _get_allocated_size; GC.stat(:malloc_increase_bytes); end",
"def size_exhausted?\n @size >= (MAX_BYTES - Defaults::Metric::MAX_BYTES)\n end",
"def resize!\n @capacity *= 2\n new_store = StaticArray.new(@capacity)\n (0...@length).each do |idx|\n if idx < @start_idx\n new_store[idx] = @store[idx]\n else\n new_store[idx + @length] = @store[idx]\n end\n end\n @store = new_store\n @start_idx += @length\n end",
"def check_for_resize; end",
"def on_size_exceeded\n tracer.trace('operation.parent') do\n # Fill the trace over the capacity of the context\n max_size.times do |i|\n tracer.trace('operation.sibling') do |span|\n yield(span) if i + 1 == max_size\n end\n end\n end\n end",
"def used_memory\n @rss_reader.rss\n end",
"def used_space\n size - free_space\n end",
"def in_memory\n []\n end",
"def erlang_process_allocation_exceeded(host_name)\n `curl -s -i -L \\\n -u #{Conn[:creds]} \\\n -H 'content-type:application/json' \\\n #{[Conn[:host_api], 'nodes', host_name].join('/')} | jq '.proc_used<.proc_total*.8'`\n end",
"def avail_out= size\n\t\t\tsize.times do\n\t\t\t\tif size > avail_out\n\t\t\t\t\t@output_buffer.push nil\n\t\t\t\telse\n\t\t\t\t\t@output_buffer.pop\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def check_rehash!\n return if @size.to_f/@cardinality < LOAD_FACTOR_THRESHOLD\n\n @cardinality *= 2\n old_arr = @arr.dup\n @arr = []\n old_arr.each do |r|\n next unless r\n\n self.add(r.number, r.name)\n el = r\n while (el = el.next_rec)\n self.add(el.number, el.name)\n end\n end\n end",
"def prepareForReuse; end",
"def decrease_in_ignorable_element!\n @in_ignorable_element -= 1\n end",
"def size\n @elements.size\n end",
"def test_reference_before_reserve\n var = Variable.new(:bool, \"test\")\n assert_raise ArgumentError do\n var.value\n end\n var.reserve_memory\n assert_nothing_raised ArgumentError do\n var.value\n end\n end",
"def try_make_new\n return preallocated_make_new if sync{can_make_new?(@size[0])}\n\n to_disconnect = nil\n do_make_new = false\n\n sync do\n current_size = @size[0]\n @allocated.keys.each do |t|\n unless t.alive?\n (to_disconnect ||= []) << @allocated.delete(t)\n current_size -= 1\n end\n end\n \n do_make_new = true if can_make_new?(current_size)\n end\n\n begin\n preallocated_make_new if do_make_new\n ensure\n if to_disconnect\n to_disconnect.each{|conn| disconnect_connection(conn)}\n fill_queue\n end\n end\n end",
"def collect\n @this_mem[:rss_size] = ::GetProcessMem.new(Process.pid).kb\n @this_mem\n rescue => e\n ::Instana.logger.info \"#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}\"\n ::Instana.logger.debug e.backtrace.join(\"\\r\\n\")\n end",
"def available_slots()\n return @size - @used_spaces\n end",
"def initialize\n @size = 0\n clear\n end",
"def written_blocks\n (@real_time_memory + @user_memory).reject(&:nil?).count\n end",
"def test_arrayget_nil_on_nonexistent_index\n collection = Sketchup.active_model.pages\n expected = nil\n result = collection[collection.size]\n assert_equal(expected, result,\n 'Expected does not match result.')\n end",
"def size\n @elements.length\n end",
"def ensure_free_space(src,dst)\n state = true\n #lines = %x[df #{dst}]\n #n = lines.last.split[1].to_i * 1024\n #debug lines\n return state\nend",
"def memory_usage_information\n super\n end",
"def invalid_percent_array_context?(node); end",
"def store_excess(frame, amount)\n return 0.0 if amount.zero?\n\n remaining = amount\n\n @storage.each do |prod|\n remaining -= prod.store_excess(frame, remaining)\n end\n\n amount - remaining\n end",
"def delete\n raise \"Bad Things\" if @size == 0\n # @storage[@size-1] = 0 <-- don't need this since it doesn't matter whether the value is 0 or something else\n @size -= 1\n end",
"def allocate_handles()\n #This is a stub, used for indexing\n end",
"def resize\n # TODO\n # if aray is 75% full, double the array and copy all items over\n end",
"def test_s38_Lots_of_empty_subviews\n W('s38a');\n\n p1 = Metakit::BytesProp.new(\"p1\");\n\n Metakit::Storage.open(\"s38a\", 1) {|s1|\n v = s1.get_as(\"v[v1[p1:S]]\");\n\n v.set_size(100000);\n s1.commit();\n }\n \n Metakit::Storage.open(\"s38a\", 1) {|s2|\n v2 = s2.view(\"v\");\n # // this should not materialize all the empty subviews\n v2.set_size(v2.get_size() + 1);\n # // nor should this\n s2.commit();\n }\n \n Metakit::Storage.open(\"s38a\", 1) {|s3|\n v3 = s3.view(\"v\");\n v3.remove_at(1, v3.get_size() - 2);\n assert_equal 2, v3.get_size\n s3.commit();\n }\n\n # D(s38a);\n R('s38a');\n end",
"def resize!\n new_array = StaticArray.new(@store.length * 2)\n self.each_with_index do |el, i|\n new_array[i] = el\n end\n @store = new_array\n end",
"def mem(*) end",
"def update_memory(running_tasks, avg_task_mem)\n @memory_used += (running_tasks * avg_task_mem)\n # Avg used but should never exit maximum capacity or get lower than zero\n @memory_used = [0,[@memory_used, @memory_capacity].min].max\n end",
"def increase_used\n self[:numUsed] += 1\n end",
"def free_spaces\n @list.map { |bin| [@operations_lower_bound - bin.size, 0].max }\n end",
"def enqueue(element)\n #if the array is already at the max length @size, or if the elemennt we are trying to add is nil, do nothing\n if full? or element.nil?\n nil\n else\n #subtracts 1 from @tail\n @tail = @tail.pred\n #sets the value of the element at the tail of the array to the value of element.\n @store[@tail] = element\n #returns it self\n self\n end\n end",
"def initialize(capacity, broken: false)\n @capacity = capacity\n @elts = []\n @broken = broken\n end",
"def excess\n if @total_memory\n @size_specified ? @size_specified - default_size : MemorySize::ZERO\n else\n MemorySize::ZERO\n end\n end",
"def allocated_storage\n data[:allocated_storage]\n end",
"def allocated_storage\n data[:allocated_storage]\n end",
"def required_space\n # Start with our cached default generated size\n space = 300\n\n # Reliability adds 10 bytes for recv error checks\n space += 10\n\n # The final estimated size\n space\n end",
"def required_space\n # Start with our cached default generated size\n space = 300\n\n # Reliability adds 10 bytes for recv error checks\n space += 10\n\n # The final estimated size\n space\n end",
"def memsize; RAtlas::memsize(@storage);end",
"def resize\n old_items = @items\n @items = Array.new(@items.size*2)\n old_items.each do |i|\n if i != nil\n puts i\n @items[index(i.key,@items.length)] = HashItem.new(i.key, i.value)\n end\n end\n end",
"def ensure_not_referenced_by_any_item\n\t\tunless items.empty?\n\t\t\terrors.add(:base, 'Na stanie są sztuki tego produktu')\n\t\t\tthrow :abort\n\t\tend\n\tend",
"def memused\n @memtotal - @memfree\n end",
"def delete(elem)\n deleted = @elements.delete(elem)\n build_heap unless deleted.nil?\n deleted\n end",
"def expensive\n @items = @items.expensive\n end",
"def size\n\t\t\t@elements.size\n\t\tend",
"def resize!\n new_capacity = capacity * 2\n # make new StaticArray with capacity that's double the length of the original store\n new_store = StaticArray.new(new_capacity)\n # iterate and copy over all the elements to the new store \n length.times{ |i| new_store[i] = self[i]}\n # set self.capacity to new capacity\n # set selt.store to new store \n self.store = new_store\n self.capacity = new_capacity\n end",
"def storage_failure; end",
"def free_blocks\n free_space / BLOCK_SIZE\n end",
"def invalidated_on_change_of\r\n [:size]\r\n end",
"def flush_check\n flush if @item_array.size >= BATCH_SIZE\n end",
"def required_space\n # Start with our cached default generated size\n space = cached_size\n\n # EXITFUNK 'thread' is the biggest by far, adds 29 bytes.\n space += 29\n\n # Reliability adds some bytes!\n space += 44\n\n space += uuid_required_size if include_send_uuid\n\n # The final estimated size\n space\n end",
"def ensure_capacity(vertex_capacity, index_capacity)\n @vertices = self.class.ensure_capacity_of_array(\n @vertices, vertex_capacity, VertexSpec::Array\n )\n\n @faces = self.class.ensure_capacity_of_array(\n @faces, index_capacity, FaceSpec::Array\n )\n end",
"def size!\n @elements.values.map(&:size!).inject(0) {|total,size| total + size}\n end",
"def length\n @elements.length\n #@elements.size \n end"
] |
[
"0.56459045",
"0.5611767",
"0.55496514",
"0.55346745",
"0.55346745",
"0.5508365",
"0.5498803",
"0.54919183",
"0.54238194",
"0.53638256",
"0.53223276",
"0.53086746",
"0.529422",
"0.52939916",
"0.52900803",
"0.5275704",
"0.5266398",
"0.522226",
"0.5221263",
"0.51804155",
"0.5174136",
"0.51687694",
"0.51224107",
"0.51094145",
"0.5105613",
"0.5100785",
"0.5100638",
"0.50771827",
"0.5075598",
"0.5070623",
"0.506978",
"0.5061532",
"0.50540376",
"0.5049197",
"0.5046762",
"0.5044859",
"0.50434273",
"0.5041483",
"0.5037516",
"0.50272506",
"0.5022181",
"0.5018727",
"0.5018727",
"0.5006317",
"0.50057596",
"0.5002043",
"0.49970046",
"0.49947092",
"0.49927077",
"0.49925974",
"0.4992359",
"0.4989542",
"0.49794117",
"0.49752954",
"0.49691033",
"0.49660194",
"0.49625638",
"0.49616703",
"0.49426135",
"0.4940452",
"0.49312958",
"0.49284932",
"0.49250248",
"0.49083972",
"0.4905522",
"0.49053717",
"0.49053058",
"0.48977134",
"0.48829645",
"0.48827663",
"0.48712683",
"0.48703426",
"0.4869131",
"0.48688838",
"0.48596197",
"0.4847122",
"0.48384932",
"0.48379874",
"0.48283637",
"0.48213083",
"0.4806628",
"0.48027563",
"0.48027563",
"0.4799037",
"0.4799037",
"0.47939706",
"0.4793437",
"0.47838694",
"0.47818682",
"0.4779703",
"0.47774035",
"0.47740382",
"0.4773671",
"0.47703537",
"0.47700238",
"0.47622535",
"0.47585058",
"0.475523",
"0.47545764",
"0.47485164",
"0.4744438"
] |
0.0
|
-1
|
Yields the rest of the elements to the given block.
|
def yield_rest
@array_corrupted = true
begin
@mutex.synchronize do
loop do
ele = @enum.next
@length_cache += 1
yield(ele)
end
@end = true # How it actually breaks is beyond me...
end
rescue StopIteration
@end = true
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def each(&block)\n i = @elements.length - 1\n while i >= 0\n yield @elements[i]\n i -= 1\n end\n end",
"def each(&block)\n return @parts.each(&block)\n end",
"def each_mid(&block)\n \n end",
"def each(&block)\n each_element(block) if @xml\n end",
"def each_element(&block)\n each_node do |node|\n yield(node) if node.kind_of?(Element)\n end\n end",
"def each(&block)\n return enum_for(:each) unless block_given?\n visit { |node| yield node }\n self\n end",
"def each(&block)\n @ordered_elements.each(&block)\n end",
"def each(node, &block); end",
"def yields\n parsed {\n @yields\n }\n end",
"def each(&block)\n each_page { |page| page.each(&block) }\n end",
"def block\n (@blocks ||= Array.new) << Block.new\n @in_block = @blocks.last\n yield\n @in_block = nil\n end",
"def each(&block)\n # get the first\n node=getnext([])\n $DEBUG.puts \"each: first node is #{node}\"\n while node\n block.call node\n oldnode=node\n node=getnext(node.oid)\n $DEBUG.puts \"each: next of #{oldnode} is #{node}\"\n end\n end",
"def each(&block)\n end",
"def each(&block)\n node = first\n\n while node\n if block\n block.yield(node)\n end\n\n if node.next\n node = node.next\n else\n break\n end\n end\n\n return node\n end",
"def each &block\n @parts.each(&block)\n end",
"def each(node, &block)\n visit(node, &block)\n end",
"def each &block\n end",
"def each(&block)\n\t\t@stack.drop(1).each(&block)\n\t\treturn self\n\tend",
"def _each(&block)\n _next.each(&block) if _next\n end",
"def each(&block)\n each_node([], @root, block)\n end",
"def ret_block\n x = 1\n y = 2\n z = 3\n yield(x,y,z)\n yield(x)\n yield(x,x,x,x)\n yield([x,y,z])\nend",
"def each_content_element(&block)\n # Do nothing\n end",
"def each(&block)\n (@first .. @last).each(&block)\n end",
"def each_element()\n yield( @element )\n end",
"def each(&block)\n\n all.each { |wi| block.call(wi) }\n end",
"def shift_out(&block)\n each(&block)\n end",
"def process_blocks(blocks); end",
"def each(&_block)\n iterator = BlockIterator.new(self)\n\n until iterator.current_hash == Block::GENESIS_PREV_HASH\n block = iterator.next\n yield(block)\n end\n end",
"def each(&block)\n @items.each(&block)\n end",
"def each(&block)\n raise NotImplementedError\n end",
"def each_content_element(&block)\n @entries.each { |e| e.each_content_element(&block) }\n end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block)\n all.each(&block)\n end",
"def each(&block)\n raise NotImplementedError\n end",
"def each(&block)\n\t\t\t@ordered.each(&block)\n\t\tend",
"def block_method\n yield(\"Brandon\",\"CS\")\n yield(\"Katie\",\"Econ\")\nend",
"def each(&block)\n yield self\n children.each {|c| c.each(&block)}\n end",
"def each(&block)\n @items.each(&block)\n self\n end",
"def yield_with_each(array, &block)\n array.each do |x|\n yield x\n end\n\nend",
"def each\n for each element\n yield(element)\n end\nend",
"def each(&block)\n return all.each(&block)\n end",
"def item_block(_item, &block)\n block.yield\n end",
"def each_element (xpath=\"*\", &block)\n self.find_match(xpath).each{ |n| yield n }\n end",
"def each (&block)\n\n @items.each { |i| block.call(i) }\n end",
"def each &block\n return enum_for :each unless block_given?\n\n each_page do |page|\n page.each(&block)\n end\n end",
"def each(&block)\n each_element { |item|\n # XPath won't work here as it's missing a prefix...\n yield(item) if item.kind_of?(RosterItem)\n }\n end",
"def yield_with_while_loop(array, &block)\n i = 0\n while i < array.length\n block.call(array[i])\n#yield array[i]\ni+=1\nend\nend",
"def each(&block) \n current = @head\n \n while current\n block.call(current.value)\n current = current.successor\n end\n end",
"def each(&block)\n @items.each do |item|\n yield item unless item.nil?\n end\n self\n end",
"def each(&block)\n items.each &block\n end",
"def each(&block)\n items.each &block\n end",
"def iterate_children(ts, block, new_model)\n ts.children.each do |cs|\n # assumes there is only one element - could iterate instead but what case would that be?\n element = block.css(cs.selector).first\n\n handle_element(cs, element, new_model)\n end # end top selector children iteration\n end",
"def each\n @source.each do |elem|\n yield DropDelegation.wrap_element(elem)\n end\n end",
"def each(&block)\n return enum_for(:each) unless block\n while rec = fetch\n block.call rec\n end\n self\n end",
"def each(&block)\n return enum_for(:each) unless block\n while rec = fetch\n block.call rec\n end\n self\n end",
"def traverse(&block); end",
"def traverse(&block); end",
"def each(&block)\n internal_collection.each(&block)\n end",
"def each( &block )\n return self.fields.each( &block ) if block\n self.fields.each\n end",
"def each(&block)\n if block\n @block = block\n parser_dispatch\n else\n enum_for(:each)\n end\n end",
"def each(&block)\n if use_eager_all?\n all(&block)\n else\n super\n end\n end",
"def each\n yield self[0]\n yield self[1]\n end",
"def next_blocks(*blocks)\n @next_blocks = blocks.dup\n end",
"def each\n @block_args.each do |arg|\n yield arg\n end\n end",
"def each\n self[0..-1].each { |o| yield o }\n end",
"def each_node(&block)\n\t\t\tnodes.each(&block)\n\t\tend",
"def i_take_a_block\n yield\nend",
"def each(&block)\n node = top\n\n while node\n if block\n block.yield(node)\n end\n\n if node.previous\n node = node.previous\n else\n break\n end\n end\n\n return node\n end",
"def each(&block)\n\n end",
"def each_block(rewind = true, with_prologue = true)\n\t self.rewind if rewind\n\t while !eof?\n\t\tio = self.rio\n\t\tif @next_block_pos == 0 && with_prologue\n\t\t read_prologue\n\t\telse\n\t\t io.seek(@next_block_pos)\n\t\tend\n\n\t\t@data = nil\n\t\t@data_header.updated = false\n\n if !read_block_header\n next_io\n next\n end\n\n\t\tyield(@block_info)\n\t end\n\trescue EOFError\n\tend",
"def each\n self.traverse_down { |node| yield(node) }\n end",
"def process_block exp\n exp = exp.dup\n exp.shift\n\n exp.map! do |e|\n process e\n end\n\n exp.unshift :rlist\n end",
"def each(&block)\n @all.each(&block)\n end",
"def each\n while (part = readpartial)\n yield part\n end\n end",
"def each(&block)\n @items.each do |item|\n block.call(item)\n end\n end",
"def each_registered_block(type, &block); end",
"def each(&block)\n Placeholder.each(node_data, &block)\n end",
"def each(&block)\n @current = self.head\n position = @current\n if block_given?\n while position do\n block.call( position.value.dup )\n position = position.next\n break if position.equal?(@current)\n end\n else\n Enumerator.new do |yielder|\n while position do\n yielder << position.value.dup\n position = position.next\n break if position.equal?(@current)\n end\n end\n end\n end",
"def each(&block)\n @all.each_batch { |batch| batch.each { |s| yield s } }\n end",
"def each(&block)\n node = @Node.new(nil,nil,nil)\n node = @head\n\n while !(node.nil?)\n yield node.value\n\n node = node.next\n end\n end",
"def each(&block)\n axis_iterator(:child).each(&block)\n end",
"def each(&block)\n return enum_for(:each) unless block_given?\n \n # if using the block form only, don't \"next\" for internal iteration\n if @block && !@enum\n @block.call Enumerator::Yielder.new(&block)\n else\n rewind\n\n until end?\n yield self.next\n end\n end\n \n self\n end",
"def each(&block)\n to_a.each(&block)\n end",
"def MyBlockMethod()\n puts \"At the top of the method\"\n\tyield\n\tputs \"At the bottom of the method\"\nend",
"def yieldall(opts = T.unsafe(nil), &block); end",
"def each\n all.each do |el|\n yield el\n end\n end",
"def each\n while true do\n yield\n break if ! advance\n end\n end",
"def process_block exp\n exp = exp.dup\n exp.shift\n if @inside_concat\n @inside_concat = false\n exp[0..-2].each do |e|\n process e\n end\n @inside_concat = true\n process exp.last\n else\n exp.map! do |e|\n res = process e\n if res.empty? or res == ignore\n nil\n elsif node_type?(res, :lvar) and res.value == :_erbout\n nil\n\n else\n res\n end\n end\n block = Sexp.new(:rlist).concat(exp).compact\n block.line(exp.line)\n block\n end\n end",
"def each(&block)\n @collection.each do |collectable|\n if block_given?\n block.call collectable\n else \n yield collectable\n end\n end \n end",
"def each(&block)\n to_a.each(&block)\n end",
"def each(&block)\n to_a.each(&block)\n end",
"def traverse(parent, &block)\n @source_elements.traverse(self, &block)\n yield parent, self\n end",
"def each_row_streaming(&block)\n Roo::Utils.each_element(@path, 'row', &block)\n end",
"def each\n all.each do |el|\n yield el\n end\n end",
"def each\n aux = @head\n while aux!=nil\n yield aux.value\n aux=aux.nest\n end\n end",
"def br(block)\n return if @finished\n @builder.br(block.is_a?(Generator) ? block.start_block : block.to_ptr)\n self.finish\n end"
] |
[
"0.72132117",
"0.67873955",
"0.67869896",
"0.6676489",
"0.65819436",
"0.65683365",
"0.6558794",
"0.6537509",
"0.6506344",
"0.6471794",
"0.6457197",
"0.6453752",
"0.6442493",
"0.6432216",
"0.6426067",
"0.64234626",
"0.6405001",
"0.63957584",
"0.6386053",
"0.63793635",
"0.6378982",
"0.63657415",
"0.63247484",
"0.63221055",
"0.63113284",
"0.6291481",
"0.62912107",
"0.6290488",
"0.6279237",
"0.6272163",
"0.6264031",
"0.6257227",
"0.6257227",
"0.6257227",
"0.6257227",
"0.6257227",
"0.6257227",
"0.6251714",
"0.6232559",
"0.6232049",
"0.62289435",
"0.6228311",
"0.6223323",
"0.621095",
"0.62057614",
"0.6201555",
"0.61985207",
"0.6193507",
"0.6179832",
"0.6179739",
"0.617647",
"0.6154473",
"0.6149949",
"0.61493146",
"0.6148795",
"0.6148795",
"0.61395746",
"0.6135709",
"0.61327124",
"0.61327124",
"0.61320263",
"0.61320263",
"0.61246645",
"0.6122726",
"0.61226463",
"0.6122399",
"0.61177325",
"0.61168987",
"0.61149883",
"0.6109407",
"0.61037874",
"0.6092671",
"0.60831314",
"0.6076964",
"0.6075454",
"0.60731816",
"0.60722464",
"0.60693836",
"0.6068805",
"0.60592353",
"0.6053216",
"0.60531867",
"0.60487604",
"0.6043241",
"0.6041028",
"0.60350657",
"0.60328007",
"0.6029761",
"0.60270846",
"0.6021188",
"0.6019767",
"0.6018091",
"0.6011228",
"0.6008418",
"0.60061824",
"0.60061824",
"0.600111",
"0.6000531",
"0.59989953",
"0.59983516",
"0.5991928"
] |
0.0
|
-1
|
Caches a given amount of elements.
|
def cache_ele(amount = 1)
begin
@mutex.synchronize do
while @eles.length <= amount
@eles << @enum.next
@length_cache += 1
end
end
rescue StopIteration
@end = true
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cache(count)\n @cached_elements = active_elements.pop(count)\n return\n end",
"def caching rows\n raise ArgumentError, \"Invalid caching size. Must be a non-negative integer.\" unless rows.is_a?(Fixnum) && rows >= 0\n spawn :@caching, rows\n end",
"def reappend_el(index)\n element = @cache.slice!(index)\n @cache << element\n end",
"def cache\n rows.each(&:cache)\n end",
"def cache(data); end",
"def cache_all\n begin\n @mutex.synchronize do\n while ele = @enum.next\n @length_cache += 1\n @eles << ele\n end\n end\n rescue StopIteration\n @end = true\n end\n end",
"def _store(*key_elements, value)\n cache.put(_key(*key_elements), value)\n end",
"def cache_size\n super\n end",
"def add(element)\n if cache.include?(element)\n cache.delete(element)\n elsif cache.size >= max_cache_size\n cache.shift\n end\n\n cache << element\n nil\n end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def rebuild_cache(cache_key, klass)\n page = cache_key.slice(cache_key.index(/\\d/)..cache_key.length).to_i\n klass.all.order(:id)[(page * items_per_page)..(page * items_per_page + items_per_page)].to_a\n end",
"def initialize(hits,miss,entries,size)\n @cache_hits=hits\n @cache_miss=miss\n @cache_entries=entries\n @cache_size=size\n end",
"def add(ele)\n # Just need to add the element to the cache if the cache is not full\n if count < max_storage\n underlying_array << ele\n return ele\n end\n\n # 1. Check if the element already exists inside of the cache\n # 2. Remove the first element if it exists, otherwise delete it from the cache\n # 3. Append the element to the back of the cache\n search_idx = underlying_array.index(ele)\n search_idx.nil? ? underlying_array.shift : underlying_array.delete_at(search_idx)\n underlying_array.push(ele)\n end",
"def initialize(size)\n\t\t@cache=Cache.new(size)\n\tend",
"def shift_elements(index)\n while index < @length - 1\n @cache[index] = @cache[index+1]\n index += 1\n end\n end",
"def build_cache\n []\n end",
"def cache_store; end",
"def cache_store; end",
"def set_cache(value); end",
"def set_cache(value); end",
"def put(key, value)\n \treturn if @capacity.zero?\n if @cache.key?(key) || !@cache.key?(key) && @cache.size < @capacity\n @cache[key] = value\n @frequency[key] += 1\n i = @frequency[key]\n if i == 1 # a new item\n @rentused[1] = { key => nil } if @rentused[1].nil?\n @rentused[1][key] = nil\n else\n @rentused[i - 1].delete(key)\n @rentused[i] = { key => nil } if @rentused[i].nil?\n @rentused[i][key] = nil\n end\n else\n 1.upto(100).each do |i|\n next unless !@rentused[i].nil? && !@rentused[i].empty?\n k = @rentused[i].keys.first\n @cache.delete(k)\n @frequency.delete(k)\n @rentused[i].delete(k)\n break\n end\n @cache[key] = value\n @frequency[key] = 1\n @rentused[1] = { key => nil } if @rentused[1].nil?\n @rentused[1][key] = nil\n # p @cache, @frequency, @rentused\n end\n end",
"def entries\n Rails.cache.instance_variable_get(:@data).size\n end",
"def cache_results(results)\n return if search_param.length > 2\n results.each_with_index do |result, index|\n redis.zadd(cache_set, index, result)\n end\n redis.expire(cache_set, 24 * 60 * 60)\n end",
"def put(key, value)\n return if @capacity.zero?\n @cache.delete(key)\n @cache.shift while @cache.size >= @capacity\n @cache[key] = value\n end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def expand_all\n expand\n @cache\n end",
"def <<(entry)\n if index = @cache[entry]\n entries[index] = entry\n else\n @cache[entry] = size\n entries << entry\n end\n self\n end",
"def cache_instances\n [*Pages.all_instances, *([BlogArticle, Industry, Team].map{|p| p.all })]\n end",
"def index(entry)\n @cache[entry]\n end",
"def cache_store=(_arg0); end",
"def cache_store=(_arg0); end",
"def cache!\n @@cache\n end",
"def update_cache\n # Does nothing...up to subclasses to implement.\n end",
"def counter_cache; end",
"def cached\n raise NotImplementedError\n end",
"def cache( name, value, created_on )\n meter = Meter.new( :name => name, :value => value, :created_on => created_on, :created_at => Time.now )\n store( name, meter )\n end",
"def cache(name, value)\n @cache = {} if @cache.nil?\n @cache[name] = value\n end",
"def index\n @orders = Order.all\n @cache_key_orders = cache_key('all', @orders)\n fresh_when @cache_key_orders, public: true\n end",
"def invalidate_cache!\n elements.each do |element|\n element.invalidate_cache!\n end\n\n self\n end",
"def cache\n yield\n end",
"def counter_cache=(_arg0); end",
"def [](row_number)\n if fully_cached?\n cache[row_number]\n else\n to_a[row_number]\n end\n end",
"def []=(entry, index)\n if valid?(entry)\n @cache[key_for(entry)] = index\n end\n end",
"def cache\n @cache ||= build_cache\n end",
"def _smart_cache(expires_in, *keys, &block)\n key = _cache_key(keys)\n unless cached = Rails.cache.read( key )\n cached = yield(block) \n Rails.cache.write(key, cached, expires_in: expires_in) \n end\n cached\n end",
"def expensive\n @items = @items.expensive\n end",
"def cache(new_cache = nil)\n @cache = new_cache if new_cache\n @cache\n end",
"def refill\n now = Time.now.to_i\n cache_set.each {|rec|\n ttl = rec[:end_ts].to_i - now\n cache_write( rec[:key], rec[:value], ttl ) if ttl > 0 \\\n if rec[:value] and rec[:value].length > MAX_OBJ_SIZE and ttl > 0\n }\n end",
"def cache(*uris)\n uris.each { |uri| @filter.insert(uri) }\n end",
"def index\n @product_caches = ProductCache.all\n end",
"def cache(key, value)\n @cache[key] = value\n end",
"def save(key, value)\n return if @capacity <= 0\n\n @cache_mutex.synchronize do\n @map.delete(key) if @map.key?(key)\n\n @map[key] = CacheElement.new(value)\n\n @map.delete(@map.first[0]) if @map.size > @capacity\n nil\n end\n end",
"def db_cache_array( options )\n collection = options[:collection]\n # nitro_cache_key - same across all collection\n nitro_cache_key = options.to_nitro_cache_key\n\n # this is place where NitroPartial creates new partials info in DB\n @current_cache_aggregator = { nitro_partial_id: NitroPartial.get_partial( options[:partial], options ).id,\n nitro_cache_key: nitro_cache_key,\n reverse: false,\n caches: [] }\n\n result = render( partial: options[:partial],\n collection: collection,\n as: options[:as],\n locals: {\n locals: options[:locals]\n }\n )\n (collection.try(:first) ? collection.try(:first).class : collection.klass).nitro_cache_bulk_insert( @current_cache_aggregator )\n\n NitroCache.where( nitro_cacheable: collection, nitro_cache_key: nitro_cache_key ).update_all(viewed_at: Time.now)\n result\n end",
"def elements=(elements)\n set_if_changed(:elements, [*elements]) do\n invalidate_cache!(:only_section => true)\n end\n end",
"def fetch(size = :small)\n unless @cache.has_key?(size)\n response = do_request(build_fetch_xml(size))\n @cache[size] = response\n end\n @cache[size]\n end",
"def cached_render_memory\n cache = Cache.actions\n options = cache_options\n store_options = {}\n key = full_path\n\n if options.respond_to?(:values_at)\n block, ttl = options.values_at(:key, :ttl)\n\n key = [full_path, block.call] if block\n store_options[:ttl] = ttl if ttl\n end\n\n cached_memory_process(cache, key, store_options)\n end",
"def store(value, *key)\n @cache[key] = value\n end",
"def cache\n @cache ||= {}\n end",
"def cache\n @cache ||= {}\n end",
"def cache\n DataCache\n end",
"def index(key, size)\n if @items[key.sum % size] && @items[key.sum % size].key != key\n resize\n key.sum % size\n else\n key.sum % size\n end\n end",
"def cache_store(key, message)\n @messages[key] = [] if @messages[key].nil?\n @messages[key].shift if @messages[key].length == 10\n @messages[key] << message\n end",
"def cache\n @cache ||= {}\n end",
"def cache\n @cache ||= {}\n end",
"def save_from_cache(start=nil, stop=nil)\n if start.nil? || stop.nil?\n start = Rails.cache.read(index_min, :raw => true).to_i\n stop = Rails.cache.read(index_max, :raw => true).to_i\n end\n \n t = start\n total = 0\n while t <= stop\n ck = cache_key_for_index(t)\n obj = load(ck)\n unless obj.nil?\n if obj.save!\n Rails.cache.delete(ck)\n total += 1\n end\n end\n \n t += 1\n Rails.cache.write(index_min, t, :raw => true)\n end\n \n total\n end",
"def cache_id\n index + 1\n end",
"def cache\n @cache ||= {}\n end",
"def resize!\n self.capacity *=2 \n new_store = StaticArray.new(capacity)\n self.length.times { |i| new_store[i] = self[i] } \n self.store = new_store\n end",
"def resize!\n #dobule capacity\n #new store\n #place existing elements into new store\n capacity2 = @capacity * 2\n store2 = StaticArray.new(capacity2)\n @length.times { |i| store2[i] = @store[i] }\n @capacity = capacity2\n @store = store2\n end",
"def update (url, response, timestamp)\n \n @semaphor.synchronize(){||\n if @cache.has_key?(url)\n # then this url is already in the cache and we simply update the timestamp\n new_entry = CacheEntry.new(url, response, timestamp)\n @cache[url] = new_entry\n else\n new_entry = CacheEntry.new(url, response, timestamp)\n # ensure that this object is not too large\n return if new_entry.response.bytesize() > max_object_size \n # remove items from the cache until this new entry fits.\n while @current_load + new_entry.response.bytesize() > max_load do\n evict()\n end\n @current_load = @current_load + new_entry.response.bytesize()\n @cache[url] = new_entry\n end\n }\n end",
"def length \n\t\t@cache.length\n\tend",
"def []=(key, value)\n i = index(key, size)\n @items[i] = LinkedList.new if @items[i].nil?\n @items[i].add_to_front(Node.new(key, value))\n @item_count += 1\n resize if load_factor >= @max_load_factor\n end",
"def load_factor\n @items / self.get_size\n end",
"def create_memo(rows)\n memo = []\n (rows + 1).times { |_| memo << []}\n memo\nend",
"def cache\n @cache ||= MemoryCache.new\n end",
"def _cache(*keys, &block)\n key = _cache_key(keys)\n unless cached = Rails.cache.read( key )\n if block_given?\n cached = yield(block)\n Rails.cache.write(key, cached)\n end\n end\n cached\n end",
"def resize!\n dcap = @capacity * 2\n dstore = StaticArray.new(dcap)\n\n for i in 0...@length\n dstore[i] = self[i]\n end\n\n self.capacity = dcap\n self.store = dstore\n end",
"def add_to_cache(obj)\n @cache << obj\n if @t + @interval < Time.now\n @t = Time.now\n flush if @cache.size > 0\n @cache = Array.new\n end\n end",
"def initialize_cache\n @elephant_cache = {}\n end",
"def cache_all_boxes_sized(size)\n raise \"cache_all_boxes_sized called with (#{size})\" if size < 1\n smaller_boxes = boxes_of_size(size - 1)\n\n # for each flavor\n @utils.all_flavors.each do |flavor|\n # build a new box from each smaller box:\n smaller_boxes.each_value do |box|\n new_box = Cookies::CookieBox.copy_from(box) # clone and build from here\n new_box.add(flavor, 1)\n\n next unless new_box.valid? # if it makes an invalid, don't make it\n next unless boxes_of_size(size)[new_box.key].nil? # ignore if already cached\n\n boxes_of_size(size)[new_box.key] = new_box\n end\n end\n end",
"def update_cache(type, id, data)\n end",
"def update_cache(type, id, data)\n end",
"def cache_attributes(*attribute_names)\n attribute_names.each {|attr| cached_attributes << attr.to_s}\n end",
"def organize_calculation(count)\n active_count = active_elements.count\n\n return if active_count == count\n return cache(active_count - count) if active_count > count\n\n retrieve_from_cache(count - active_count)\n\n calculate(count - active_elements.count)\n end",
"def cache=(input)\n case\n when input && !cached?\n cache = io_index.to_a\n io_index.close\n @io_index = cache\n \n when !input && cached?\n io_index << {:format => 'II'}\n @io_index = ExternalIndex[*io_index]\n \n end\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def update_cache\r\n Rails.cache.delete(\"All#{self.class.name.to_s}\")\r\n end",
"def update_cache\n self.update_attribute :resources_cache, self.resources\n end"
] |
[
"0.7288147",
"0.65581906",
"0.6442266",
"0.6291514",
"0.6197986",
"0.61684155",
"0.61306196",
"0.6063331",
"0.6041663",
"0.60035473",
"0.60035473",
"0.60035473",
"0.60035473",
"0.60035473",
"0.60035473",
"0.60035473",
"0.5966043",
"0.5913687",
"0.58923423",
"0.58374834",
"0.57914025",
"0.57557184",
"0.57102895",
"0.57102895",
"0.56811446",
"0.56811446",
"0.5649555",
"0.5642241",
"0.56230104",
"0.5602732",
"0.55972886",
"0.55972886",
"0.55972886",
"0.55972886",
"0.55786866",
"0.55609626",
"0.5554981",
"0.55199414",
"0.55185056",
"0.55185056",
"0.55112606",
"0.5510632",
"0.54632485",
"0.5432573",
"0.5408622",
"0.53869957",
"0.5377866",
"0.5359887",
"0.5356496",
"0.53563875",
"0.5354944",
"0.535236",
"0.53500664",
"0.5342468",
"0.53422534",
"0.5301803",
"0.5301649",
"0.530109",
"0.52764344",
"0.5259418",
"0.52542573",
"0.52524894",
"0.524911",
"0.5240019",
"0.52336496",
"0.5229436",
"0.52224666",
"0.52224666",
"0.5205571",
"0.52033067",
"0.5200311",
"0.519173",
"0.519173",
"0.5184038",
"0.5183726",
"0.51787263",
"0.5178007",
"0.51739156",
"0.51592",
"0.515708",
"0.51533794",
"0.5140124",
"0.5131212",
"0.510979",
"0.5095535",
"0.5095129",
"0.5094518",
"0.5094003",
"0.50934756",
"0.5092381",
"0.5092381",
"0.50920683",
"0.50919557",
"0.50748646",
"0.5067002",
"0.5067002",
"0.5067002",
"0.5067002",
"0.50624615",
"0.50611216"
] |
0.6586287
|
1
|
Forces the rest of the elements to be cached.
|
def cache_all
begin
@mutex.synchronize do
while ele = @enum.next
@length_cache += 1
@eles << ele
end
end
rescue StopIteration
@end = true
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cache(count)\n @cached_elements = active_elements.pop(count)\n return\n end",
"def update_cache\n # Does nothing...up to subclasses to implement.\n end",
"def invalidate_cache!\n elements.each do |element|\n element.invalidate_cache!\n end\n\n self\n end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache!\n @@cache\n end",
"def clear_cache() @cache = {}; end",
"def clear_cache; end",
"def refresh_cache\n @cache = build_cache\n end",
"def update_cache\r\n Rails.cache.delete(\"All#{self.class.name.to_s}\")\r\n end",
"def flush_cache; end",
"def cached?; end",
"def set_cache(value); end",
"def set_cache(value); end",
"def reset\r\n @cache.reset\r\n end",
"def cached\n raise NotImplementedError\n end",
"def move_to_cache\n true\n end",
"def cache\n yield\n end",
"def disable_caching; end",
"def disable_caching=(_arg0); end",
"def move_to_cache\r\n true\r\n end",
"def set_manual_caching\n self.vdo_caching = 0\n self.auto_caching = 0\n end",
"def flush_cache!\n @cached_dependencies = {}\n end",
"def move_to_cache\n true\n end",
"def move_to_cache\n true\n end",
"def move_to_cache\n true\n end",
"def update_cache_chain\n logger.debug \"DB ********** Touching Element #{id} ********** \"\n self.touch\n self.dynamic_page.try(:update_cache_chain)\n end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def reset\n @entry_cache.clear\n end",
"def set_no_caching\n self.vdo_caching = 1\n self.auto_caching = 1\n end",
"def cache\n rows.each(&:cache)\n end",
"def update_cache\n self.update_attribute :resources_cache, self.resources\n end",
"def cache(data); end",
"def clear_cache!\n # this should be overridden by concrete adapters\n end",
"def cache\n @cache ||= build_cache\n end",
"def update_cache_chain\n logger.debug \"DB ********** Touching BlogElem #{id} ********** \"\n self.touch\n self.element.try(:update_cache_chain)\n end",
"def update_cache_chain\n logger.debug \"DB ********** Touching BlogElem #{id} ********** \"\n self.touch\n self.element.try(:update_cache_chain)\n end",
"def reset_cache\n self.class.reset_cache\n end",
"def move_to_cache\n false\n end",
"def set_auto_caching\n self.vdo_caching = 0\n self.auto_caching = 1\n end",
"def clear_cache\n @cache = {}\n end",
"def cache\n old = @cache_enabled\n @cache_enabled = true\n yield\n ensure\n @cache_enabled = old\n clear_cache unless @cache_enabled\n end",
"def cache\n @cache ||= {}\n end",
"def cache\n @cache ||= {}\n end",
"def clear_cache!\n @cache = {}\n end",
"def clear_cache!\n @cache = {}\n end",
"def cache_store; end",
"def cache_store; end",
"def configure_cache; end",
"def clear_cache!\n @sorted = false\n end",
"def cached\n self\n end",
"def disable_cache; end",
"def reset_cache!\n @@cache = { :default => {} }.with_indifferent_access\n true\n end",
"def cache_on?; end",
"def cache_on?; end",
"def clear\n @cache.clear\n end",
"def flush!\n @_cache = {}\n end",
"def clear\n cache.clear\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def flush_cache!\n flush!(:manually_requested)\n end",
"def cache_clear\n @moneta.clear\n end",
"def invalidate_cache!(options = {})\n @cache = {:header => nil, :footer => nil}\n\n unless options[:only_section]\n elements.each do |element|\n element.invalidate_cache!\n end\n end\n end",
"def clear\r\n @cache.flush\r\n end",
"def cache\n @cache ||= {}\n end",
"def cache(new_cache = nil)\n @cache = new_cache if new_cache\n @cache\n end",
"def reset_cache!\n return unless Praxis::Blueprint.caching_enabled?\n\n Praxis::Blueprint.cache = Hash.new do |hash, key|\n hash[key] = {}\n end\n end",
"def cache\n @cache ||= {}\n end",
"def cache\n @cache ||= {}\n end",
"def clear_cache\n @lit_cache = {}\n @lit_nextpos = {}\n end",
"def filter_cache; end",
"def clear_cache\n @all = nil\n end",
"def cache\n the_current_time = current_time\n cache_loaded_at = @cache.loaded_at if @cache\n\n if @cache && cache_expiration_policy_object.stale?(cache_loaded_at, the_current_time)\n flush!(:stale, :loaded => cache_loaded_at, :now => the_current_time)\n end\n\n unless @cache\n instrument('cache_load') do\n @cache = LowCardTables::LowCardTable::Cache.new(@low_card_model, @low_card_model.low_card_options)\n end\n end\n\n @cache\n end",
"def _cache_control; end",
"def without_cache(&block); end",
"def without_cache(&block); end",
"def clear\n @cache.clear\n self\n end",
"def no_cache!\n @cacheable = false\n end",
"def clear!\n @cache = {}\n end",
"def clear\n @cache = {}\n end",
"def reset!\n @cache = nil\n end",
"def test_cached\n cached = TestCache.new\n \n # force = false\n assert !cached.cached?(:m1)\n cached.m1\n assert cached.cached?(:m1)\n sleep 4\n assert cached.cached?(:m1)\n \n # force = true\n assert !cached.cached?(:m2)\n cached.m2\n sleep 1\n assert cached.cached?(:m2)\n sleep 3\n assert !cached.cached?(:m2)\n end",
"def update_cached_tag_lists\n cache_tag_list if tag_list != cached_tag_list\n cache_topic_list if topic_list != cached_topic_list\n cache_user_tag_list if user_tag_list != cached_user_tag_list\n cache_owned_tag_list if owned_tag_list != cached_owned_tag_list\n end",
"def invalidate_sorted_cache\n\t\tmod_sorted = nil\n\t\tmod_ranked = nil\n\tend",
"def invalidate_tag_cache!\n @tags_for_node_cache = nil\n @tags_cache = nil\n @tags_type_cache = nil\n end",
"def invalidate\n @cache_version ||= 0\n @cache_version += 1\n end",
"def clear_cached_vars\n @_rendered , @_versions = false , false\n end",
"def delete_all_caching_without_touching_additives\n\t\t\tself.delete_category_menu_fragments\n \t\tself.delete_cache\n \t\tself.delete_shared_item_items\n\t\t\tself.delete_category_browser_fragments\nend",
"def cache\n @cached = { y: @y, x: @x }\n end",
"def uncached\n yield\n end",
"def refill\n now = Time.now.to_i\n cache_set.each {|rec|\n ttl = rec[:end_ts].to_i - now\n cache_write( rec[:key], rec[:value], ttl ) if ttl > 0 \\\n if rec[:value] and rec[:value].length > MAX_OBJ_SIZE and ttl > 0\n }\n end"
] |
[
"0.7424256",
"0.7407792",
"0.727837",
"0.7251613",
"0.7251613",
"0.7251613",
"0.7251613",
"0.7251613",
"0.7251613",
"0.7251613",
"0.70731896",
"0.7022682",
"0.70201015",
"0.7003864",
"0.6951931",
"0.690355",
"0.68360835",
"0.6832704",
"0.6832704",
"0.6794257",
"0.6747019",
"0.67390454",
"0.6735316",
"0.6725528",
"0.6717481",
"0.6712417",
"0.6710156",
"0.6708782",
"0.6707361",
"0.6707361",
"0.6707361",
"0.6693532",
"0.6659552",
"0.6659552",
"0.6659552",
"0.6659552",
"0.6652019",
"0.65988356",
"0.6590029",
"0.65818477",
"0.65696186",
"0.65525925",
"0.6536407",
"0.6534556",
"0.6534556",
"0.6524387",
"0.6522976",
"0.6520358",
"0.65179425",
"0.6496224",
"0.6491777",
"0.6491777",
"0.6484353",
"0.6484353",
"0.6479558",
"0.6479558",
"0.64783525",
"0.64757264",
"0.6473133",
"0.6446674",
"0.6446427",
"0.64321065",
"0.64321065",
"0.64307785",
"0.6419656",
"0.6418435",
"0.64155775",
"0.64155775",
"0.64155775",
"0.64155775",
"0.6415019",
"0.641023",
"0.6403631",
"0.6403623",
"0.6398717",
"0.63928944",
"0.6378015",
"0.6375201",
"0.6375201",
"0.63584566",
"0.63513017",
"0.63077366",
"0.63060117",
"0.6295211",
"0.6292416",
"0.6292416",
"0.6286265",
"0.628357",
"0.62741435",
"0.62471807",
"0.6246463",
"0.62440205",
"0.62419623",
"0.62103724",
"0.62012637",
"0.62011516",
"0.61954373",
"0.6189481",
"0.61842525",
"0.6179598",
"0.61700904"
] |
0.0
|
-1
|
Obtiene los elementos HTML
|
def get_html path
array = []
archivo = File.open(path, 'r:UTF-8')
archivo.each do |l|
array.push(l.strip)
end
archivo.close
return array
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def element\n c = content()\n c = [ c + HTML.div.form_button_bar { @buttons } ] if @buttons\n HTML.form(@attrib) { c }\n end",
"def inner_html\n # This sets up the inner html for the to_html call\n end",
"def html\n `#{@el}.innerHTML`\n end",
"def inner_html\n self.inner_xml\n end",
"def html\n node.inner_html\n end",
"def html *o\n if o.empty?\n a = []\n each do |e| a << e.get_inner_html end\n return(a)\n end\n \n each do |e| e.set_inner_html o[0] end\n end",
"def inner_html(options = T.unsafe(nil)); end",
"def html\r\n @rootNode.html_node()\r\n end",
"def inner_html(*args); end",
"def inner_html(*args); end",
"def to_html\n build\n end",
"def elements\n find_by_tag('*')\n end",
"def index\n @scraping_html_elements = ScrapingHtmlElement.all\n end",
"def html\r\n # use body.html instead?\r\n @driver.at_css('html').to_html\r\n end",
"def html\n @browser.html()\n end",
"def to_html; end",
"def to_html\n end",
"def to_html(*)\n self\n end",
"def read_html\n array = nodes.to_a\n array.each_with_index do |node, index|\n header = (index.modulo(10) == 0) ? \"<h2>!!!!!SLOW DOWN AND ENUNCIATE!!!!!</h2>\" : \"\"\n anchor = \"<a id=section_#{index} href=/pages/#{self.id}/edit?section=#{index}>#{index}</a>\"\n type = nodes.at(index).name\n array[index]=nodes.at(index).replace \"#{header}<#{type}>#{anchor} #{nodes.at(index).inner_html}</#{type}>\"\n end\n array.map(&:to_html).join\n end",
"def html()\n return @driver.get_sc_core_query_element_html(@handle, @index)\n end",
"def element\n factory.body\n end",
"def elemento\n \n @elemento\n end",
"def tags(selector)\n\t\te = elements(selector)\n\t\te.map {|x| x.inner_html}\n\tend",
"def presentable_html(html)\n # sanitize edited, tags: %w(body p span a h1 h2 h3 h4 h5 h6 ul ol li) if work.file_content_html %> -->\n # doc = Nokogiri::HTML(html_junk)\n # body = doc.at_xpath(\"//body\")\n # body.css('*').remove_attr('class')\n # edited = body.to_html\n return raw html\n end",
"def initialize_html_tags; end",
"def html\n self[\"html\"][0].get_outer_html\n end",
"def html\n `$q(this.__native__.innerHTML)`\n end",
"def tags(selector)\n e = elements(selector)\n e.map {|x| x.inner_html}\n end",
"def html_elements(*elements)\n elements.any? ? @html_elements = elements : get_inherited_attribute(\"@html_elements\")\n end",
"def html\n if FUNCTION != 'none'\n if self.md.value != nil\n hm = self.md.value\n else\n hm = INDEX\n end\n @me = YAML.load(self.yaml.value)\n [\n ERB.new(HEAD).result(binding),\n Kramdown::Document.new(ERB.new(hm).result(binding)).to_html,\n \"</body></html>\"\n ].flatten.join('')\n end\n end",
"def html\n @driver.page_source\n end",
"def html_string\n @html.join(\"\")\n end",
"def html\n children.to_s\n end",
"def inner_html=(node_or_tags); end",
"def print_html_definition()\n @noko.css(\"li.g:first-of-type\").each {|e| puts e}\n end",
"def html\n @doc.to_s\n end",
"def html\n @doc.to_s\n end",
"def set_elements\n super\n element(:message) {b.li(:class => 'uif-infoMessageItem')}\n element(:messages) {b.lis(:class => 'uif-infoMessageItem')}\n element(:message_header) {b.h3(:class => 'uif-pageValidationHeader')}\n element(:submit_button) {b.button(:id => \"submitEditor\")}\n element(:cancel_button) {b.button(:id => \"cancelEditor\")}\n element(:close_button) {b.button(:id => \"closeEditor\")}\n element(:return_to_search_button) {b.button(:id => \"returnToSearch_button\")}\n # Navigation Area Elements\n element(:delete_bib_button) {b.button(:title => 'Delete Bib')}\n element(:add_instance_button) {b.button(:title => 'Add Instance')}\n element(:add_einstance_button) {b.button(:title => 'Add EInstance')}\n # @note Vakata Context Menu items are only present on the screen after the containing menu header has been right-clicked.\n element(:delete_instance_button) {b.div(:id => 'vakata-contextmenu').ul.li(:index => 0).a(:rel => \"Delete\")}\n element(:add_item_button) {b.button(:title => 'Add Item')}\n element(:delete_item_button) {b.div(:id => 'vakata-contextmenu').ul.li(:index => 0).a(:rel => 'Delete')}\n end",
"def inner_dom= element\n clear\n append element\n end",
"def decided_html(dmds)\r\n html = ''\r\n dmds.each { |om_id,list|\r\n html += \"<b>#{@omlist[om_id]}</b><br/>\\n<ul>\"\r\n list.each { |dmd|\r\n html += \"<li><span class=\\\"dmd_id\\\">#{dmd.id}</span> <span class=\\\"dmd_source\\\">#{dmd.source}</span>: <span class=\\\"dmd_title\\\">#{dmd.title}</span></li>\\n\"\r\n }\r\n html += \"<br/></ul>\\n\"\r\n }\r\n #puts html\r\n html\r\n end",
"def to_html\n fail NoMethodError, \"Engines need to implement this method\"\n end",
"def tag(selector)\n e = element(selector)\n e && e.inner_html\n end",
"def inner_html\n `#@native.innerHTML`\n end",
"def to_html\n bootstrap_wrapping do\n hidden_field_for_all << # Might need to remove this guy.\n collection.map { |choice|\n choice_html(choice)\n }.join(\"\\n\").html_safe\n end\n end",
"def to_html\n child_type = element_type\n type_string = ''\n type_string = \"type=\\\"#{@type}\\\"\" if @type\n\n element_string = \"<#{child_type} id=\\\"#{@id}\\\" #{type_string}></#{child_type}>\"\n end",
"def tag(selector)\n\t\te = element(selector)\n\t\te && e.inner_html\n\tend",
"def html_contents\n layout_contents\n end",
"def to_html\n map { |x| x.output(\"\") }.join\n end",
"def trans_html\n @doc.to_html\n end",
"def to_dom\n end",
"def content\n \n # TODO: Find out if @content can be cached here. \n # return @content if @content\n\n @content = []\n if @title then\n @content << HTML.h1(:class => :form_title) { @title }\n end\n included_fields = []\n fields().each { |field|\n\n if field.is_a?(Hash) then\n # This is a fieldset\n field.each_pair { |fieldset_name, fieldset_fields|\n # Get Fieldset instance by name from @fieldsets: \n @content << HTML.li { @fieldsets[fieldset_name.to_s] }\n if fieldset_fields.is_a?(Hash) then\n included_fields += fieldset_fields[:fields]\n else\n included_fields += fieldset_fields\n end\n }\n else \n element = @element_map[field.to_s]\n if element then\n included_fields << element.name.to_s\n element = element.to_hidden_field() if element.hidden?\n if element.kind_of? Aurita::GUI::Hidden_Field then\n @content << element\n else\n @content << @field_decorator.new(element)\n end\n end\n end\n }\n included_fields = included_fields.map { |f| f.to_s }\n # Render required field as hidden field if not \n # included in form field config: \n @elements.each { |element| \n if !included_fields.include?(element.name.to_s) && element.required? then\n @content << element.to_hidden_field()\n end\n }\n fields_id = dom_id().to_s+'_fields' if dom_id()\n\n @content = @content_decorator.new(:id => fields_id) { @content } \n return @content\n end",
"def dom_class; end",
"def dom_class; end",
"def dom_class; end",
"def dom_class; end",
"def to_html\n @page.to_html\n end",
"def content\n @row.html\n end",
"def html_classes; end",
"def html\n @html ||= process_html!\n end",
"def html\n driver.getPageSource\n end",
"def dom\n div = DOM::Element.new 'div'\n div.html = @body\n fragment = DOM::Fragment.new\n fragment << div\n fragment\n end",
"def news_list_to_html(news)\n H.section(:id => \"newslist\") {\n aux = \"\"\n news.each{|n|\n aux << news_to_html(n)\n }\n aux\n }\nend",
"def to_html\n @html ||= format_html\n end",
"def html\n html = %{<div class=\"obj-form-frame\"><table class=\"obj-form\">}\n html = append_fields(html, @name, template, false)\n html << '</table>'\n html << %{<div class=\"btn\" id=\"#{@name}.save_button\"><span>Save</span></div>}\n html << %{<div class=\"btn\" style=\"float:right;\" id=\"#{@name}.cancel_button\"><span>Cancel</span></div>}\n html << '</div>'\n end",
"def to_html\n render_file(main)\n end",
"def description_html\n convert_html description\n end",
"def generate_html(individual_files=false)\n return self.to_s\n end",
"def generate_html(individual_files=false)\n return self.to_s\n end",
"def to_html\n @doc.at(\"body\").children.to_html(encoding: ENCODING).lstrip\n end",
"def to_html(*args); end",
"def to_html(*args); end",
"def to_html(*args); end",
"def to_html(*args); end",
"def element_init\n extend TagMaker\n methods = \"\"\n # - -\n for element in %w[ A TT I B U STRIKE BIG SMALL SUB SUP EM STRONG\n DFN CODE SAMP KBD VAR CITE FONT ADDRESS DIV center MAP\n APPLET PRE XMP LISTING DL OL UL DIR MENU SELECT table TITLE\n STYLE SCRIPT H1 H2 H3 H4 H5 H6 TEXTAREA FORM BLOCKQUOTE\n CAPTION ]\n methods += <<-BEGIN + nn_element_def(element) + <<-END\n def #{element.downcase}(attributes = {})\n BEGIN\n end\n END\n end\n\n # - O EMPTY\n for element in %w[ IMG BASE BASEFONT BR AREA LINK PARAM HR INPUT\n ISINDEX META ]\n methods += <<-BEGIN + nOE_element_def(element) + <<-END\n def #{element.downcase}(attributes = {})\n BEGIN\n end\n END\n end\n\n # O O or - O\n for element in %w[ HTML HEAD BODY P PLAINTEXT DT DD LI OPTION tr\n th td ]\n methods += <<-BEGIN + nO_element_def(element) + <<-END\n def #{element.downcase}(attributes = {})\n BEGIN\n end\n END\n end\n eval(methods)\n end",
"def element; end",
"def element; end",
"def element; end",
"def element; end",
"def to_html\n @to_html ||= traite_to_html\n end",
"def html\n return if self.text.blank?\n\n html = self.text\n \n # s = StringScanner.new(self.text)\n # html = ''\n # while markup = s.scan_until(/\\[code/) do\n # html += RedCloth.new(markup[0..-6]).to_html\n # s.pos= s.pos-5\n # code = s.scan_until(/\\[\\/code\\]/)\n # if code\n # code.gsub!(/\\[code\\]/, '[code lang=\"ruby\"]')\n # html += '<div class=\"syntax\">' + Syntaxi.new(code).process + '</div>' \n # else\n # break\n # end\n # end\n # html += RedCloth.new(s.rest).to_html\n \n html\n end",
"def html\n _search_parts_keys(/html/i)\n end",
"def markup_manipulation(html_fragment)\n html_doc = Nokogiri::HTML html_fragment\n html_doc = link_manipulations html_doc\n html_doc = image_manipulations html_doc\n return html_doc.css('body').children.to_s\n end",
"def to_html \n generator.generate\n end",
"def content\n function = <<~JAVASCRIPT\n () => {\n let retVal = '';\n if (document.doctype)\n retVal = new XMLSerializer().serializeToString(document.doctype);\n if (document.documentElement)\n retVal += document.documentElement.outerHTML;\n return retVal;\n }\n JAVASCRIPT\n evaluate_function(function).value\n end",
"def to_html\n @root_component.to_html\n end",
"def generate_html\n to_return = \"\"\n\n @child_objects.each do |child_object|\n to_return += child_object.generate_html\n end\n\n return to_return\n end",
"def web_html\n return @web_html\n end",
"def html(options = {})\n @html_options = options.symbolize_keys.reverse_merge(:div => {:id => \"filters\"})\n @html_options[:div] ||= {}\n @html_options[:dom_prefix] ||= @html_options[:div][:id] || \"filters\"\n @html_options[:name_prefix] ||= \"filters\"\n div_options = (@html_options[:div] || {}).reverse_merge(:class => \"winnower\")\n content_tag :div, [html_toggler, html_fieldset, html_errors].join, div_options\n end",
"def html_markup_html(text); end",
"def tags_with_html_content\n [:details, :description, :detailed_information, :impact]\n end",
"def tags_with_html_content\n [:details, :description, :detailed_information, :impact]\n end",
"def set_elements\n super\n # Search Control Elements\n element(:search_button) {b.button(:id => \"search_button\")}\n element(:clear_button) {b.button(:id => \"clear_button\")}\n element(:doc_type_bib) {b.radio(:id => 'SearchPanel-docType-Section_control_0')}\n element(:doc_type_holdings) {b.radio(:id => 'SearchPanel-docType-Section_control_1')}\n element(:doc_type_item) {b.radio(:id => 'SearchPanel-docType-Section_control_2')}\n element(:doc_type_e_holdings) {b.radio(:id => 'SearchPanel-docType-Section_control_3')}\n element(:link_to_order_button) {b.button(:id => 'submit_button')}\n element(:export_to_xml_button) {b.button(:id => 'export_button1')}\n element(:close_button) {b.button(:id => 'cancel_button')}\n # Search Fields\n element(:search_field_1) {b.text_field(:id => \"searchText_id_line0_control\")}\n element(:search_which_selector_1) {b.select_list(:id => \"operator_id_line0_control\")}\n element(:search_field_selector_1) {b.select_list(:id => \"docField_id_line0_control\")}\n element(:search_scope_1_and) {b.radio(:id => 'searchScope_id_line0_control_0')}\n element(:search_scope_1_or) {b.radio(:id => 'searchScope_id_line0_control_1')}\n element(:search_scope_1_not) {b.radio(:id => 'searchScope_id_line0_control_2')}\n element(:search_field_2) {b.text_field(:id => 'searchText_id_line1_control')}\n element(:search_which_selector_2) {b.select_list(:id => 'operator_id_line1_control')}\n element(:search_field_selector_2) {b.select_list(:id => 'docField_id_line1_control')}\n element(:search_scope_2_and) {b.radio(:id => 'searchScope_id_line1_control_0')}\n element(:search_scope_2_or) {b.radio(:id => 'searchScope_id_line1_control_1')}\n element(:search_scope_2_not) {b.radio(:id => 'searchScope_id_line1_control_2')}\n # Search Results Elements\n element(:next_link) {b.a(:text => 'Next')}\n element(:previous_link) {b.a(:text => 'Previous')}\n end",
"def inner_html(*args)\n children.map { |x| x.to_html(*args) }.join\n end",
"def set_scraping_html_element\n @scraping_html_element = ScrapingHtmlElement.find(params[:id])\n end",
"def get_field_edit_html\n '<HTML NOT IMPLEMENT YET>'\n end",
"def inner_html= html\n `#@native.innerHTML = html`\n end",
"def to_s\n to_html\n end",
"def html(raw_html)\n `#{@element}.innerHTML = #{raw_html}`\n end",
"def html_content\n\t\t\treturn \"\" if content.blank? \n\t\t\tstr = content.gsub(/<(\\s*)(\\w+)(\\s*)>/){ |s| \"<\\#{$1}>\" }\n\t\t\tstr = str.gsub(/<\\/(\\s*)(\\w+)(\\s*)>/){ |s| \"<\\/>\" }\n\t\t\tstr = str.gsub(/\\r\\n/, \"<br/>\") \n\t\t\tstr = str.gsub(/(\\s)/, \" \")\n\t\t\tstr = str.gsub(/\\[bold\\]/, \"<b>\")\n\t\t\tstr = str.gsub(/\\[-bold\\]/, \"</b>\")\n\t\t\tstr = str.gsub(/\\[italic\\]/, \"<i>\")\n\t\t\tstr = str.gsub(/\\[-italic\\]/, \"</i>\")\n\t\t\tstr = str.gsub(/\\[color:(#.{6})\\]/){ |s| \"<span style=\\\"color:#{$1}\\\">\" }\n\t\t\tstr = str.gsub(/\\[-color\\]/, \"</span>\")\n\t\t\tstr = str.gsub(/\\[(\\w+)\\]/) do |s|\n\t\t\t\temotion = EMOTIONS.index($1)\n\t\t\t\temotion.nil? ? \"[#{$1}]\": \"<img src=\\\"/assets/emotions/#{emotion}.gif\\\" />\" \n\t\t\tend\n\t\t\treturn str\n\t\tend",
"def input_html_options; end",
"def to_html(entypo: false)\n html_type(entypo:entypo) + \" \" + html_body(inline:true)\n end"
] |
[
"0.6872056",
"0.67273533",
"0.6704301",
"0.6558897",
"0.6413072",
"0.64096683",
"0.63698095",
"0.6368281",
"0.6347792",
"0.6347792",
"0.63243484",
"0.63209945",
"0.6314407",
"0.6307073",
"0.6231574",
"0.62306076",
"0.62286973",
"0.61824906",
"0.6156695",
"0.6146184",
"0.6017386",
"0.60039574",
"0.59978276",
"0.59867734",
"0.59748936",
"0.59540695",
"0.59360236",
"0.59195423",
"0.5895837",
"0.5894962",
"0.5894396",
"0.58855224",
"0.5866286",
"0.5858674",
"0.5850559",
"0.5845301",
"0.5845301",
"0.58343196",
"0.5823619",
"0.5821361",
"0.58209217",
"0.5775476",
"0.5761453",
"0.575776",
"0.57469815",
"0.5731962",
"0.5717896",
"0.5717577",
"0.5702344",
"0.5699831",
"0.5676432",
"0.56689364",
"0.56689364",
"0.56689364",
"0.56689364",
"0.5668318",
"0.56649035",
"0.5663589",
"0.5658512",
"0.56541896",
"0.5640136",
"0.5621858",
"0.560856",
"0.5597505",
"0.5594137",
"0.5592298",
"0.55879945",
"0.55879945",
"0.55860597",
"0.5585253",
"0.5585253",
"0.5585253",
"0.5585253",
"0.55829525",
"0.5563958",
"0.5563958",
"0.5563958",
"0.5563958",
"0.5556433",
"0.5554157",
"0.5548646",
"0.5543471",
"0.5543229",
"0.5540582",
"0.5534583",
"0.5532635",
"0.5517167",
"0.55154026",
"0.55096066",
"0.5508234",
"0.5508234",
"0.55059236",
"0.5503657",
"0.55022377",
"0.55002713",
"0.5499213",
"0.5492858",
"0.54906523",
"0.54660225",
"0.54652756",
"0.5464655"
] |
0.0
|
-1
|
Crea los MD a partir de las ayudas de las herramientas
|
def create_md tool
original = tool[1].split("\n")
new = []
note = false
# Cambia las rutas y < y > por código HTML
def diple l
return l.gsub('de +++YAML+++ en <http://pecas.cliteratu.re>', 'de [+++YAML+++](yaml.html)')
.gsub('de JavaScript en <http://pecas.cliteratu.re>', 'de [JavaScript](js.html)')
.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)')
.gsub('<','<').gsub('>','>')
end
# Agrega versalitas
def smallcaps l
return l.gsub(/([A-Z]{3,})/, '+++\1+++')
end
# Cambia comillas por sintaxis para línea de código
def to_code l
return l.gsub(/«(.+?)»/, '`\1`')
end
# Añade líneas de código en las opciones
def to_code_option l
return l.gsub(/^(\S+)/, '`\1`')
end
new.push('# ' + $l_g_pc_docs_creation + '`' + tool[0] + '`')
original.each_with_index do |l, i|
l = to_code(diple(smallcaps(l)))
if l =~ /^\S/
# Encabezados 2
if l !~ /^Nota/ && i != 1
new.push('## ' + l + "\n\n")
# Párrafos
else
# Notas
if l =~ /^Nota/
if !note
new.push("--- {.espacio-arriba3}\n\n")
note = true
new.push(l + ' {.espacio-arriba3}')
else
new.push(l + ' {.espacio-arriba1 .sin-sangria}')
end
# Descripción
else
# Esto servirá para crear «herramientas.md»
$tools_md["#{tool[0]}"] = [tool[0], l.gsub(/^\S+\s+/, '')]
new.push(l)
end
end
else
if l.strip != ''
l = l.strip
# Opciones de Pecas
if l =~ /^-/
new.push('* ' + to_code_option(l))
# Comandos de Pecas
elsif l =~ /^pc-/
new.push('```')
new.push(l)
new.push('```')
# Explicaciones
elsif l =~ /^[A-Z]/
new.push("\n" + l)
# Dependencias / Tipos
else
# Evita que se quede como línea de código el tipo y su descripción
l_final = []
l.split(/\s+/).each_with_index do |ll, i|
# Solo la primera palabra se va como código
if i == 0
l_final.push('* `' + ll + '`')
# El resto de las palabras se quedan como texto
else
l_final.push(ll)
end
end
new.push(l_final.join(' '))
end
# Líneas en blanco
else
new.push(l)
end
end
end
archivo = File.new(Dir.pwd + '/md/' + tool[0] + '.md', 'w:UTF-8')
archivo.puts new
archivo.close
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_md\n @md ||= [\n \"[🔙 🏡](#{project_readme_path})\",\n '',\n \"# #{title} (#{year})\",\n '',\n \"By the #{adjective} [#{author}](#{homepage})\",\n '',\n '## Links:',\n '',\n \"- [Purchase #{title}](#{purchase})\",\n '',\n '## Chapter Notes:',\n ''\n ].concat(section_md).concat(image_md).join \"\\n\"\n end",
"def build_mdlinks\n return unless options.Build_Markdown_Links\n\n puts_cyan \"Middlemac is creating `#{options.File_Markdown_Links}`.\"\n\n files_array = []\n out_array = []\n longest_shortcut = 0\n longest_path = 0\n\n Dir.glob(\"#{app.source}/Resources/**/*.erb\").each do |fileName|\n\n # Remove all file extensions and make a shortcut\n base_name = fileName\n while File.extname(base_name) != '' do\n base_name = File.basename( base_name, '.*' )\n end\n next if base_name.start_with?('_') # || base_name == 'index'\n\n if base_name == 'index'\n shortcut = \"[#{File.split(File.split(fileName)[0])[1]}_index]:\"\n\n else\n shortcut = \"[#{base_name}]:\"\n end\n\n # Make a fake absolute path\n path = Pathname.new(fileName).relative_path_from(Pathname.new(app.source))\n path = File::SEPARATOR + File.join(File.dirname(path), base_name) + '.html'\n\n # Get the title, if any\n metadata = YAML.load_file(fileName)\n title = (metadata.is_a?(Hash) && metadata.key?('title')) ? metadata['title'] : ''\n\n files_array << { :shortcut => shortcut, :path => path, :title => title }\n\n longest_shortcut = shortcut.length if shortcut.length > longest_shortcut\n longest_path = path.length if path.length > longest_path\n\n end\n\n files_array = files_array.sort_by { |key| [File.split(key[:path])[0], key[:path]] }\n files_array.uniq.each do |item|\n item[:shortcut] = \"%-#{longest_shortcut}.#{longest_shortcut}s\" % item[:shortcut]\n\n if item[:title].length == 0\n out_array << \"#{item[:shortcut]} #{item[:path]}\"\n else\n item[:path] = \"%-#{longest_path}.#{longest_path}s\" % item[:path]\n out_array << \"#{item[:shortcut]} #{item[:path]} \\\"#{item[:title]}\\\"\"\n end\n end\n\n File.open(options.File_Markdown_Links, 'w') { |f| out_array.each { |line| f.puts(line) } }\n\n end",
"def build_mdimages\n\n return unless options.Build_Markdown_Images\n\n puts_cyan \"Middlemac is creating `#{options.File_Markdown_Images}`.\"\n\n files_array = []\n out_array = []\n longest_shortcut = 0\n\n Dir.glob(\"#{app.source}/Resources/**/*.{jpg,png,gif}\").each do |fileName|\n\n # Remove all file extensions and make a shortcut\n base_name = fileName\n while File.extname(base_name) != '' do\n base_name = File.basename( base_name, '.*' )\n end\n next if base_name.start_with?('_')\n shortcut = \"#{base_name}\"\n\n # Make a fake absolute path `/Resources/...`. Middleman will convert\n # these to appropriate relative paths later, and this will just\n # magically work in the helpbooks. \n path = File::SEPARATOR + Pathname.new(fileName).relative_path_from(Pathname.new(app.source)).to_s\n\n files_array << { :shortcut => shortcut, :path => path }\n\n # We will format the destination file nicely with spaces.\n # +3 to account for bracketing []:\n longest_shortcut = shortcut.length + 3 if shortcut.length + 3 > longest_shortcut\n\n end\n\n files_array = files_array.uniq.sort_by { |key| [File.split(key[:path])[0], key[:path]] }\n \n # Now add virtual `all-` items for target-specific items for which no `all-` exists.\n # Middlemac will intelligently support target-specific image files, but it will\n # never have the chance unless a markdown reference is present in this file. Of\n # course this only applies if you're using reference notation.\n options.Targets.keys.each do |target|\n \n # Build an array of all files starting with `target-`\n current_set = files_array.select { |item| item[:shortcut].start_with?(\"#{target.to_s}-\") }\n \n # For each of these items, check to see if `all-` exists.\n current_set.each do |item|\n \n seek_for = item[:shortcut].sub(\"#{target.to_s}-\", \"all-\")\n unless files_array.any? { |hash| hash[:shortcut] == seek_for }\n \t\t\t path = item[:path].sub(\"#{target.to_s}-\", \"all-\")\n \t\t\t files_array << { :shortcut => seek_for, :path => path }\n \t\t\tend\n end\n end\n\n # Create the actual output from the files_array.\n files_array.each do |item|\n # Just a reminder to myself that this is a format string. \n shortcut_out = \"%-#{longest_shortcut}.#{longest_shortcut}s\" % \"[#{item[:shortcut]}]:\"\n out_array << \"#{shortcut_out} #{item[:path]}\"\n end\n\n File.open(options.File_Markdown_Images, 'w') { |f| out_array.each { |line| f.puts(line) } }\n\n end",
"def create!\n new_file = \"#{next_number}-#{strip_title}.md\"\n @path = File.join(@dir, new_file)\n File.open(@path, 'w') do |file|\n file.write initial_content\n end\n\n new_file\n end",
"def create_moab_dirs\n target_path = manifest_path(object.alternate_id, version)\n if File.directory?(target_path)\n err_string = \"The Moab directory #{target_path} for \"\\\n \"#{object.alternate_id} version #{version} already exists\"\n Rails.logger.error(err_string)\n raise DRI::Exceptions::InternalError, err_string\n end\n\n make_dir(\n [\n version_path(object.alternate_id, version),\n metadata_path(object.alternate_id, version),\n content_path(object.alternate_id, version)\n ]\n )\n end",
"def create_moab_dirs()\n target_path = manifest_path(self.object.id, self.version)\n if File.directory?(target_path)\n err_string = \"The Moab directory #{target_path} for \"\\\n \"#{self.object.id} version #{self.version} already exists\"\n Rails.logger.error(err_string)\n raise DRI::Exceptions::InternalError, err_string\n end\n\n make_dir(\n [\n version_path(self.object.id, self.version),\n metadata_path(self.object.id, self.version),\n content_path(self.object.id, self.version)\n ]\n )\n end",
"def crear_modificaciones\n if @current_journal\n @current_journal.id_objeto ||= self.id\n @current_journal.is_created = (Modificacion.exists?(['clase = ? AND id_objeto = ? AND is_created = ?', @current_journal.clase, @current_journal.id_objeto, true ])) ? false : true\n # attributes changes\n (Parte.column_names - %w(id tramite_id updated_at created_at)).each {|c|\n before = @issue_before_change.send(c)\n after = send(c)\n next if before == after || (before.blank? && after.blank?)\n @current_journal.modificacion_detalles << ModificacionDetalle.new(\n :tipo => c.class.to_s,\n :campo => c,\n :old_value => @issue_before_change.send(c),\n :value => send(c))\n }\n\n begin\n if @current_journal.save\n # reset current journal\n init_journal @current_journal.user\n end\n rescue => err\n puts err\n end\n end\n end",
"def create_chksum_manifest\n chksum_manifest = {}\n files = Dir['*'].select{ |f| File.file? f }\n files.each do |file|\n chksum_manifest[file] = Digest::MD5.file(file).hexdigest\n end\n chksum_manifest\n end",
"def create_checksums\n # puts \"Ins: #{@basename}\"\n md5 = Digest::MD5.file(@fullname).to_s\n sha1 = Digest::SHA1.file(@fullname).to_s\n sha256 = Digest::SHA2.new(256).file(@fullname).to_s\n @pkgdb.query(\"insert into checksums values ( datetime('now'), '#{@basename}', '#{@suitename}', '#{@mtime.iso8601}', '#{md5}', '#{sha1}', '#{sha256}' )\")\n end",
"def generate\n generate_header\n generate_content\n #not_dirty\n end",
"def mkdirs()\n if !File.exists?(\"data\")\n Dir.mkdir(\"data\")\n end \n if !File.exists?(CACHE_DIR)\n Dir.mkdir(CACHE_DIR)\n end\n if !File.exists?(RDF_DIR)\n Dir.mkdir(RDF_DIR)\n end\nend",
"def create\n @diagnoz = Diagnoz.new(params[:diagnoz])\n @woman = Woman.find(params[:woman_id])\n @woman.diagnozs << @diagnoz\n respond_to do |format|\n if @diagnoz.save\n params[:diamkhs].each do |p|\n @diamkh = Diamkh.new\n @diamkh.mkh_id = p\n @diamkh.diagnoz_id = @diagnoz.id\n @diamkh.save\n end\n format.html { redirect_to [@woman,@diagnoz], notice: 'Diagnoz was successfully created.' }\n format.json { render json: @diagnoz, status: :created, location: @diagnoz }\n else\n format.html { render action: \"new\" }\n format.json { render json: @diagnoz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generateLinks()\n links = {}\n \n $doc.pages.each do |page|\n page.markdown.each do |line|\n headerMatch = line.match(/^(#+)\\s+(.*?)\\s+@@(.*?)$/)\n if headerMatch\n headerLevel = headerMatch[1].length\n headerTitle = headerMatch[2]\n headerID = headerMatch[3]\n if links[headerID]\n puts \"ERROR: #{headerID} already exists.\"\n exit 1\n end\n if headerLevel == 1\n links[headerID] = \"#{page.id}.htm\"\n else\n links[headerID] = \"#{page.id}.htm##{headerID}\"\n end\n end\n end\n end\n \n links[\"toc\"] = \"index.htm\"\n \n return links\nend",
"def create_entries entries\n out = []\n\n entries.each do |entry, items|\n out << RDoc::Markup::Heading.new(3, entry)\n out << RDoc::Markup::BlankLine.new\n\n out << create_items(items)\n end\n\n out\n end",
"def create_entries entries\n out = []\n\n entries.each do |entry, items|\n out << RDoc::Markup::Heading.new(3, entry)\n out << RDoc::Markup::BlankLine.new\n\n out << create_items(items)\n end\n\n out\n end",
"def create_html path\n html_name = \"#{File.basename(path, '.md')}.html\"\n\n if html_name !~ /^index/\n html_name = 'md/' + html_name\n end\n\n puts \"Ejecutando «pc-pandog -i #{path} -o #{html_name}»…\"\n system(\"pc-pandog -i #{path} -o #{html_name}\")\n\n html = get_html(html_name)\n new_html = []\n\n write = true\n html.each do |l|\n if l =~ /<head>/\n write = false\n if html_name !~ /^index/\n new_html.push($head.join(\"\\n\"))\n else\n new_html.push($head.join(\"\\n\").gsub('<link type=\"text/css\" rel=\"stylesheet\" href=\"../css/styles.css\">', '<link type=\"text/css\" rel=\"stylesheet\" href=\"css/styles.css\">').gsub('<script type=\"text/javascript\" src=\"../js/piwik.js\"></script>', '<script type=\"text/javascript\" src=\"js/piwik.js\"></script>'))\n end\n elsif l =~ /<\\/head>/\n write = true\n elsif l =~ /<style>/\n if html_name !~ /^index/\n new_html.push($header.join(\"\\n\"))\n else\n new_html.push($header.join(\"\\n\").gsub('../index.html', '').gsub(/\"(\\S+?\\.html)\"/, 'html/' + '\\1')) \n end\n elsif l =~ /<\\/body>/\n new_html.push($footer.join(\"\\n\"))\n new_html.push(l)\n else\n if write == true\n new_html.push(l)\n end\n end\n end\n\n new_html = beautifier_html(new_html)\n\n\t# Se actualiza la información\n\tarchivo = File.new(html_name, 'w:UTF-8')\n\tarchivo.puts new_html\n\tarchivo.close\n\n # Si no es el index, lo mueve a la carpeta «html»\n if html_name !~ /^index/\n FileUtils.mv(html_name, 'html')\n end\nend",
"def create\n authorize!(:edit, Heb412Gen::Plantillahcm)\n @plantillahcm = Heb412Gen::Plantillahcm.new(plantillahcm_params)\n if !@plantillahcm.nombremenu && @plantillahcm.ruta\n @plantillahcm.nombremenu = File.basename(@plantillahcm.ruta)\n end\n create_gen(@plantillahcm)\n end",
"def generate(options = {})\n embed_outline(options[:selflink]) if options[:outline]\n\n #if options[:dirmap]\n # md_dir = Pathname.new(@md_file).dirname.expand_path\n # embed_sidebar( Madowu::DirectoryMapper.dirmap(md_dir) )\n #end\n\n if options[:sidebar]\n #lines = File.open( options[:sidebar], \"r\").readlines\n lines = `#{@markdown} #{options[:sidebar]}`.split(\"\\n\")\n embed_sidebar(lines)\n end\n\n result = [\n make_header(options[:css], options[:charset]),\n @markup_lines,\n \"</div></div></body></html>\",\n ''\n ].join(\"\\n\")\n end",
"def generate_tables\n create_characters\n create_kiosks\n create_traps\n create_buttons\n end",
"def construct_all_the_notes\n # All the release note text\n release_notes = process_repos\n\n build_frontmatter\n\n [\n @frontmatter, '---', \"\\n\",\n headfoot(@header), \"\\n\\n\",\n release_notes.join(\"\\n\\n\"),\n headfoot(@footer), \"\\n\",\n @footer_locations.join(\"\\n\"), \"\\n\\n\",\n find_terms(release_notes).join(\"\\n\")\n ].join('').gsub(\"\\r\\n\", \"\\n\").gsub(/\\n{4,}/m, \"\\n\\n\\n\")\nend",
"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 buildReadMeIndex\n x = 0\n fileOutArr = Array.new\n\n # Build each Fn Command Card\n fileOutArr.push \"# Fn Command Reference\\n\\n\"\n @cmdListArr.each do |command|\n # Start markdown file\n fileOutArr.push \"[\" + command + \"](\" + @fileNameArr[x] + \".md\" + \") \\n\"\n x = x + 1 # Counter for syncing arrays\n end\n\n # Add Fn Version\n fileOutArr.push(\"\\n<sub>\" + @fnVersion + \"</sub>\")\n\n # Write README.md file to disk\n puts \"Writing: \" + \"README\" + \".md\"\n File.open(\"README.md\", \"w\") do |f|\n f.puts(fileOutArr)\n end\n\n end",
"def create_students_timetable\n @students.each do |student|\n name = student[:name].split(' ').map(&:downcase).join('_')\n student_path = \"#{__dir__}/../#{ENV['STUDENTS_PATH']}/#{name}\"\n system(\"mkdir -p #{student_path}\")\n system \"cp #{__dir__}/../docs/#{student[:tt_path]} #{student_path}/emploi_du_temps.txt\"\n end\n end",
"def create\n file = File.open(\"db/emails.json\", \"w\")\n system \"clear\"\n puts \"Création du tableau de hash pour le departement du Rhone...\".green\n hash_lyon = get_all_the_urls_townhalls_rhone\n puts \"Création du tableau de hash pour le departement du Cote d'or...\".green\n hash_cote_d_or = get_all_the_urls_townhalls_cot_d_or\n puts \"Création du tableau de hash pour le departement du Bouche du Rhone...\".green\n hash_bouch_du_rhone = get_all_the_urls_townhalls\n puts \"Fusion des tableaux de hash...\".red\n hash = hash_lyon.merge(hash_cote_d_or)\n super_hash = hash.merge(get_all_the_urls_townhalls)\n puts \"Création du fichier .json\".green\n puts \"FIN...\".green\n return File.open(\"db/emails.json\",\"w\") do |f|\n f.write(super_hash.to_json)\n end\n end",
"def create_new_data_dimensions\n # map the meta information to the resolution\n delta_x = ((@meta_data.domain_x.upper - @meta_data.domain_x.lower) /\n @columns).round(3) * 2\n delta_y = ((@meta_data.domain_y.upper - @meta_data.domain_y.lower) /\n @lines).round(3)\n meta_string = add_domain_information(@meta_data.domain_x, delta_x)\n meta_string.concat(add_domain_information(@meta_data.domain_y, delta_y))\n end",
"def initialize(md, debug: false, root: 'Thoughts')\n \n @debug = debug\n \n s, @filename = if md.lines.length == 1 then\n\n File.write(md, \"# #{root}\\n\\n\") unless File.exists? md \n File.exists?(md) ? [File.read(md), md] : md\n\n else\n\n md\n\n end\n \n load_sections(s)\n \n end",
"def create_dirs\n if :dynamic == @build.link_type\n return if '.' == @dir_root\n dir = File.join @build.obj_root, @dir_root\n else # static\n dir = if '.' == @dir_root\n File.join @build.obj_root, 'static'\n else\n File.join @build.obj_root, @dir_root, 'static'\n end\n end\n Util.run_cmd \"mkdir -p #{dir}\"\n end",
"def content_path\n path = \"esm/#{self.esm.name}/#{self.name}/content\"\n file_path = \"public/#{path}\"\n p = file_path.split('/')\n i=0\n unless FileTest.exist?(file_path)\n while(s = \"public/esm/#{p[2...2+i].join('/')}\" and s!=file_path)\n Dir.mkdir(s) unless FileTest.exist?(s)\n i+=1\n end\n Dir.mkdir(s) unless FileTest.exist?(s)\n end\n return path\n end",
"def md_extensions\n # empty for now\n {}\n end",
"def send_dmmc(event)\n assert_permissions(event, ['dmmc'])\n msg = event.content.remove('dmmcize').strip\n limit = 30\n levels = Userlevel.where_like('title', msg).to_a[0..limit - 1]\n count = levels.count\n palettes = Userlevel::THEMES.dup\n response = nil\n zip_buffer = Zip::OutputStream.write_buffer{ |zip|\n levels.each_with_index{ |u, i|\n if i == 0\n response = event.channel.send_message(\"Creating screenshot 1 of #{count}...\")\n else\n response.edit(\"Creating screenshot #{i + 1} of #{count}...\")\n end\n palette = palettes.sample\n zip.put_next_entry(sanitize_filename(u.author.name) + ' - ' + sanitize_filename(u.title) + '.png')\n zip.write(u.screenshot(palette))\n palettes.delete(palette)\n }\n }\n zip = zip_buffer.string\n response.delete\n send_file(event, zip, 'dmmc.zip', true)\nrescue => e\n lex(e, \"Error fetching dMMc maps.\", event: event)\nend",
"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 create\n @manifestation = Manifestation.new(params[:manifestation])\n if @manifestation.original_title.blank?\n @manifestation.original_title = @manifestation.attachment_file_name\n end\n\n respond_to do |format|\n if @manifestation.save\n Manifestation.transaction do\n @original_manifestation = Manifestation.where(:id => params[:manifestation_id]).first\n if @original_manifestation\n @manifestation.derived_manifestations << @original_manifestation\n end\n # 雑誌の場合、出版者を自動的に追加\n if @manifestation.series_statement\n @manifestation.create_next_issue_work_and_expression\n end\n if @expression\n @manifestation.expressions << @expression\n end\n if @patron\n @manifestation.patrons << @patron\n end\n end\n\n flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.manifestation'))\n format.html { redirect_to(@manifestation) }\n format.json { render :json => @manifestation, :status => :created, :location => @manifestation }\n else\n prepare_options\n format.html { render :action => \"new\" }\n format.json { render :json => @manifestation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_structure\n if File.exists?(\"features\") && File.directory?(\"features\")\n return\n else\n FileUtils.mkpath \"features/step_definitions\"\n FileUtils.mkdir \"features/support\"\n FileUtils.mkdir \"features/screenshots\"\n FileUtils.touch\"features/support/env.rb\"\n end\n \n\n end",
"def create_tables\n unless MinWords::DB.table_exists?(:words)\n MinWords::DB.create_table :words do\n primary_key :id\n varchar :word_text, unique: true\n end\n end\n unless MinWords::DB.table_exists?(:defines)\n MinWords::DB.create_table :defines do\n primary_key :id\n foreign_key :word_id, :words\n varchar :definition_text\n end\n end\n end",
"def build_skeleton(dirs,path=@path)\n \n dirs.each{\n |node|\n \n if node.kind_of?(Hash) && !node.empty?()\n node.each_pair{\n |dir,content| \n \n dir = replace_tags(dir)\n \n puts 'Creating directory ' + File.join(path,dir)\n Dir.mkdir(File.join(path,dir))\n \n if content.kind_of?(Array) && !content.empty?()\n build_skeleton(content,File.join(path,dir))\n end\n \n }\n elsif node.kind_of?(Array) && !node.empty?()\n node.each{\n |file|\n \n write_file(file,path)\n \n }\n end\n \n }\n \n end",
"def outputMnemonicDefinitions()\n ccdd.writeToFileLn($tlmFile, \"\")\n ccdd.writeToFileLn($tlmFile, \"/* Mnemonic Definitions */\")\n\n # Step through each row in the table\n for row in 0..$numStructRows - 1\n # Check if the variable is not telemetered\n if !isTelemetry(row)\n # Output the mnemonic definition for this row in the data table\n outputMnemonicDefinition(row)\n end\n end\nend",
"def cria_classes()\n c = Hash.new()\n c['Retrodatou'] = [\"Retrodatou\",\"FF6060\",\"Possível retrodatação desta palavra\", 1, 1]\n c['RetrodatouHomonimia'] = [\"Retrodatou\",\"FF6060\",\"Possível retrodatação desta palavra (homonímia)\", 1, 2]\n c['RetrodatouNomeProprio'] = [\"Retrodatou\",\"FF6060\",\"Possível nome próprio\", 1, 3]\n c['RetrodatouNomeProprioFlexao'] = [\"Retrodatou\",\"FF6060\",\"Flexão ou possível nome próprio\", 1, 4]\n c['RetrodatouFlex'] = [\"Retrodatou\",\"FF6060\",\"Flexão ou possível retrodatação desta palavra\", 1, 5]\n c['RetrodatouNomeProprioHomonimia'] = [\"Retrodatou\",\"FF6060\",\"Possível nome próprio (homonímia)\", 1, 6]\n c['Homo'] = [\"Retrodatou\",\"FF6060\",\"Retrodatação improvável desta palavra\", 1, 7]\n c['HomoNomeProprio'] = [\"Retrodatou\",\"FF6060\",\"Retrodatação improvável deste nome próprio\", 1, 8]\n c['SemData'] = [\"SemData\",\"80EEFF\",\"Possível primeira datação desta palavra\", 3, 9]\n c['SemDataNomeProprio'] = [\"SemData\",\"80EEFF\",\"Possível nome próprio sem data\", 3, 10]\n c['SemDataFlex'] = [\"SemData\",\"80EEFF\",\"Flexão ou possível primeira datação desta palavra\", 3, 11]\n c['SemDataNomeProprioFlexao'] = [\"SemData\",\"80EEFF\", \"Flexão ou possível nome próprio\", 3, 12]\n c['Inexistente'] = [\"Inexistente\",\"80EEFF\",\"Palavra não reconhecida\", 3, 13]\n c['InexistenteNomeProprio'] = [\"Inexistente\",\"80EEFF\",\"Possível nome próprio\", 3, 14]\n c['InexistenteComposto'] = [\"Inexistente\",\"80EEFF\",\"Possível composição\", 3, 15]\n c['InexistenteAdverbioModo'] = [\"Inexistente\",\"80EEFF\",\"Possível advérbio de modo\", 3, 16]\n c['InexistenteDiminutivo'] = [\"Inexistente\",\"80EEFF\",\"Possível diminutivo\", 3, 17]\n c['InexistenteAumentativo'] = [\"Inexistente\",\"80EEFF\",\"Possível aumentativo\", 3, 18]\n c['InexistenteSuperlativo'] = [\"Inexistente\",\"80EEFF\",\"Possível superlativo\", 3, 19]\n c['InexistenteAbreviatura'] = [\"Inexistente\",\"80EEFF\",\"Possível abreviatura\", 3, 20]\n c['PossivelHomonimia'] = [\"Inexistente\",\"80EEFF\",\"Possível homonímia\", 3, 21]\n return c\n end",
"def puts_massage_and_delete_md()\n puts \"created #{@id}.org\".green\n puts \"URL: #{@items[\"url\"]}\"\n system \"rm -f #{@id}.md\"\n end",
"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 generate_all_the_docs!\n oks = []\n fails = []\n\n ATOMIC_RED_TEAM.atomic_tests.each do |atomic_yaml|\n begin\n print \"Generating docs for #{atomic_yaml['atomic_yaml_path']}\"\n generate_technique_docs! atomic_yaml, atomic_yaml['atomic_yaml_path'].gsub(/.yaml/, '.md')\n # generate_technique_execution_docs! atomic_yaml, \"#{File.dirname(File.dirname(__FILE__))}/atomic-red-team-execution/#{atomic_yaml['attack_technique'].downcase}.html\"\n\n oks << atomic_yaml['atomic_yaml_path']\n puts \"OK\"\n rescue => ex\n fails << atomic_yaml['atomic_yaml_path']\n puts \"FAIL\\n#{ex}\\n#{ex.backtrace.join(\"\\n\")}\"\n end\n end\n puts\n puts \"Generated docs for #{oks.count} techniques, #{fails.count} failures\"\n generate_attack_matrix! 'All', \"#{File.dirname(File.dirname(__FILE__))}/atomics/matrix.md\"\n generate_attack_matrix! 'Windows', \"#{File.dirname(File.dirname(__FILE__))}/atomics/windows-matrix.md\", only_platform: /windows/\n generate_attack_matrix! 'macOS', \"#{File.dirname(File.dirname(__FILE__))}/atomics/macos-matrix.md\", only_platform: /macos/\n generate_attack_matrix! 'Linux', \"#{File.dirname(File.dirname(__FILE__))}/atomics/linux-matrix.md\", only_platform: /^(?!windows|macos).*$/\n\n generate_index! 'All', \"#{File.dirname(File.dirname(__FILE__))}/atomics/index.md\"\n generate_index! 'Windows', \"#{File.dirname(File.dirname(__FILE__))}/atomics/windows-index.md\", only_platform: /windows/\n generate_index! 'macOS', \"#{File.dirname(File.dirname(__FILE__))}/atomics/macos-index.md\", only_platform: /macos/\n generate_index! 'Linux', \"#{File.dirname(File.dirname(__FILE__))}/atomics/linux-index.md\", only_platform: /^(?!windows|macos).*$/\n \n return oks, fails\n end",
"def generate_news\n \twebsite_project = Project.where(:title=>\"Build in Progress Website\").where(:remix_ancestry => nil).first()\n \tif website_project\n \t\twebsite_project.steps.order(\"created_at ASC\").each do |step|\n \t\t\tnews_step_id = step.id\n \t\t\tnews_title = step.name\n \t\t\tnews_type = \"website\"\n \t\t\tNews.create(:title => news_title, :step_id => news_step_id, :news_type => news_type, :created_at => step.created_at)\n \t\tend\n end\n\n mobile_project = Project.where(:title=>\"Build in Progress Mobile\").where(:remix_ancestry => nil).first()\n if mobile_project\n \tmobile_project.steps.order(\"created_at ASC\").each do |step|\n \t\tnews_step_id = step.id\n \t\t\tnews_title = step.name\n \t\t\tnews_type = \"mobile\"\n\t\t\tNews.create(:title => news_title, :step_id => news_step_id, :news_type => news_type, :created_at => step.created_at)\n \tend\n end\n\n end",
"def create_material\n # upload a files\n materials = Material\n .upload(params[:meeting][:materials_attributes], @meeting.id)\n\n materials.each do |material|\n @meeting.materials.new(material)\n end\n end",
"def create_user_directories\n #Directories\n avatar = \"#{Rails.root}/data/avatars/#{resource.id}\"\n push = \"#{Rails.root}/data/push/#{resource.id}\"\n passes = \"#{Rails.root}/data/passes/#{resource.id}\"\n coredata = \"#{Rails.root}/data/coredata/#{resource.id}\"\n #Avatar Upload Pictures\n Dir.mkdir(avatar) unless File.exists?(avatar)\n #Push Notification Certificates\n Dir.mkdir(push) unless File.exists?(push)\n #Avatar Passbook\n Dir.mkdir(passes) unless File.exists?(passes)\n #Core Data\n Dir.mkdir(coredata) unless File.exists?(coredata)\n end",
"def create_openstudio_objects(log_report=true)\n # assign a standards building type so that David's measures can run\n building = @openstudio_model.getBuilding\n building.setStandardsBuildingType('MediumOffice')\n\n # create all of the non-geometric model elements\n if log_report\n puts 'Translating Materials'\n end\n create_materials\n\n if log_report\n puts 'Translating Constructions'\n end\n create_constructions\n \n if log_report\n puts 'Translating ConstructionSets'\n end\n create_construction_set\n create_global_construction_set\n\n if log_report\n puts 'Translating Schedules'\n end\n create_schedule_type_limits\n create_schedules\n\n if log_report\n puts 'Translating ProgramTypes'\n end\n create_program_types\n\n # create all of the model geometry\n if log_report\n puts 'Translating Room Geometry'\n end\n create_rooms\n\n if log_report\n puts 'Translating Context Shade Geometry'\n end\n create_orphaned_shades\n create_orphaned_faces\n create_orphaned_apertures\n create_orphaned_doors\n\n # create the hvac systems\n if log_report\n puts 'Translating HVAC Systems'\n end\n create_hvacs\n end",
"def make_info_mano_onlogs\r\n @log.debug \"make_info_mano_onlogs\"\r\n @mano_coll = []\r\n curr_ix = 0\r\n curr_mano_info = {:ix => curr_ix, :data => []}\r\n @data_logs.each do |line|\r\n #p line\r\n if line =~ /new_mano/\r\n @mano_coll << curr_mano_info if curr_mano_info.size > 0\r\n curr_ix += 1\r\n curr_mano_info = {:ix => curr_ix, :data => []}\r\n else\r\n curr_mano_info[:data] << line \r\n end\r\n end\r\n end",
"def build\n\t\t@hills = []\n\t\tif @anthills.length == 10 && @field\n\t\t\tx = (0...@rows).to_a.shuffle.take(10)\n\t\t\ty = (0...@columns).to_a.shuffle.take(10)\n\t\t\t@anthills.each_with_index do |hill, i|\n\t\t\t\thill_type = rand(0..1)\n\t\t\t\tif hill_type == 0\n\t\t\t\t\t@hills << WarriorAnthill.new(hill,x[i],y[i])\n\t\t\t\telse\n\t\t\t\t\t@hills << ForagerAnthill.new(hill,x[i],y[i])\n\t\t\t\tend\n\t\t\t\t@field[x[i]][y[i]] = Cell.new(@hills[i])\n\t\t\tend\n\t\t\t@meadow = Meadow.instance.create(@field, @hills, @rows, @columns)\n\t\telse \n\t\t\tputs \"Not enough hills or field not created\"\n\t\tend\n\t\t@meadow\n\tend",
"def make_new_file\n\t\tmetadata_file_data = \"\"\n\t\tmetadata_file_data << \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?><cp:coreProperties\"\n\t\tmetadata_file_data << \" xmlns:cp=\\\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\\\" \"\n\t\tmetadata_file_data << \"xmlns:dc=\\\"http://purl.org/dc/elements/1.1/\\\" xmlns:dcterms=\\\"http://purl.org/dc/terms/\\\" \"\n\t\tmetadata_file_data << \"xmlns:dcmitype=\\\"http://purl.org/dc/dcmitype/\\\" xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\"\n\t\tmetadata_file_data << \"<dc:creator>#{datastore['DOCAUTHOR']}</dc:creator><cp:lastModifiedBy>#{datastore['DOCAUTHOR']}\"\n\t\tmetadata_file_data << \"</cp:lastModifiedBy><cp:revision>1</cp:revision><dcterms:created xsi:type=\\\"dcterms:W3CDTF\\\">\"\n\t\tmetadata_file_data << \"2013-01-08T14:14:00Z</dcterms:created><dcterms:modified xsi:type=\\\"dcterms:W3CDTF\\\">\"\n\t\tmetadata_file_data << \"2013-01-08T14:14:00Z</dcterms:modified></cp:coreProperties>\"\n\n\t\t#where to find the skeleton files required for creating an empty document\n\t\tdata_dir = File.join(Msf::Config.install_root, \"data\", \"exploits\", \"docx\")\n\n\t\t#making the actual docx\n\t\tdocx = Rex::Zip::Archive.new\n\t\t#add skeleton files\n\t\tvprint_status(\"Adding skeleton files from #{data_dir}\")\n\t\tDir[\"#{data_dir}/**/**\"].each do |file|\n\t\t\tif not File.directory?(file)\n\t\t\t\tdocx.add_file(file.sub(data_dir,''), File.read(file))\n\t\t\tend\n\t\tend\n\t\t#add on-the-fly created documents\n\t\tvprint_status(\"Adding injected files\")\n\t\tdocx.add_file(\"docProps/core.xml\", metadata_file_data)\n\t\tdocx.add_file(\"word/_rels/settings.xml.rels\", @rels_file_data)\n\t\t#add the otherwise skipped \"hidden\" file\n\t\tfile = \"#{data_dir}/_rels/.rels\"\n\t\tdocx.add_file(file.sub(data_dir,''), File.read(file))\n\t\t#and lets create the file\n\t\tfile_create(docx.pack)\n\tend",
"def mhld\n holdings.present? ? Folio::MhldBuilder.build(holdings, holding_summaries, pieces) : []\n end",
"def crear_indice_respuestas_dudas respuestas_dudas\n texto = ''\n respuestas_dudas.each_with_index do |respuesta_duda, indice|\n texto += \" (*#{indice}*) (#{respuesta_duda.usuario.nombre_usuario}): \\t #{respuesta_duda.contenido}\\n\"\n end\n texto\n end",
"def update_readme(data_hash)\n \n puts \"Updating README measure order...\"\n \n table_flag_start = \"MEASURE_WORKFLOW_START\"\n table_flag_end = \"MEASURE_WORKFLOW_END\"\n \n readme_path = \"README.md\"\n \n # Create table\n table_lines = []\n table_lines << \"|Group|Measure|Dependencies*|\\n\"\n table_lines << \"|:---|:---|:---|\\n\"\n data_hash.each do |group|\n new_group = true\n group[\"group_steps\"].each do |group_step|\n grp = \"\"\n if new_group\n grp = group[\"group_name\"]\n end\n name = group_step['name']\n deps = group_step['dependencies']\n table_lines << \"|#{grp}|#{name}|#{deps}|\\n\"\n new_group = false\n end\n end\n \n # Embed table in README text\n in_lines = IO.readlines(readme_path)\n out_lines = []\n inside_table = false\n in_lines.each do |in_line|\n if in_line.include? table_flag_start\n inside_table = true\n out_lines << in_line\n out_lines << table_lines\n elsif in_line.include? table_flag_end\n inside_table = false\n out_lines << in_line\n elsif not inside_table\n out_lines << in_line\n end\n end\n \n File.write(readme_path, out_lines.join(\"\"))\n \nend",
"def create_dirs\n run_dir = query_property('run_dir')\n raise 'Run directory not found' unless Dir.exist?(run_dir)\n\n create_dir(\"#{run_dir}/messaging/in_pending\", 'in_pending')\n create_dir(\"#{run_dir}/messaging/in_processed\", 'in_processed')\n create_dir(\"#{run_dir}/messaging/out_pending\", 'out_pending')\n create_dir(\"#{run_dir}/messaging/out_processed\", 'out_processed')\n FileUtils.chmod_R('u=wrx,go=r', run_dir)\n end",
"def make_default_h3m\r\n buf = ''\r\n\r\n # Set map specifications to 36x36 (0x24000000) map with 2 players, with\r\n # default/no settings for name, description, victory condition etc\r\n buf << \"\\x0e\\x00\\x00\\x00\\x01\\x24\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\r\n buf << \"\\x00\\x00\\x01\\x01\\x01\\x00\\x01\\x00\\x00\\x00\\xff\\x01\\x01\\x00\\x01\\x00\"\r\n buf << \"\\x00\\x00\\xff\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\xff\\x00\\x00\\x00\\x00\\x8c\"\r\n buf << \"\\x00\\x00\\xff\\x00\\x00\\x00\\x00\\xb1\\x00\\x00\\xff\\x00\\x00\\x00\\x00\\x00\"\r\n buf << \"\\x00\\x00\\xff\\x00\\x00\\x00\\x00\\x7f\\x00\\x00\\xff\\x00\\x00\\x00\\x00\\x48\"\r\n buf << \"\\x00\\x00\\xff\\xff\\xff\\x00\"\r\n buf << \"\\xFF\" * 16\r\n buf << \"\\x00\" * 35\r\n\r\n # Each tile is 7 bytes, fill map with empty dirt tiles (0x00)\r\n buf << \"\\x00\" * (36 * 36 * 7)\r\n\r\n # Set object attribute array count to 1\r\n buf << \"\\x01\\x00\\x00\\x00\"\r\n\r\n # Size of first sprite name, this will be overwritten\r\n buf << \"\\x12\\x34\\x56\\x78\"\r\n\r\n # Standard name for first object, which will be searched for\r\n buf << 'AVWmrnd0.def'\r\n\r\n buf\r\n end",
"def create_dependencies\n create_course_bin()\n\n #create 8 default semesters\n Semester.create_semesters(start_sem, start_year.to_i, 8) {|semester| semesters.concat semester} \n end",
"def generate_invalid_qrda_text\n validation_ids.each do |validation_id|\n Random.new.rand(1..2).times do\n measure_id = determine_useful_measures(validation_id).sample\n measure = HealthDataStandards::CQM::Measure.find_by(_id: measure_id)\n doc = Document.create(\n name: HOSPITALS.sample,\n validation_id: validation_id,\n test_execution: self,\n measure_id: measure.hqmf_id,\n qrda: generate_qrda_text(measure)\n )\n Cedar::Invalidator.invalidate_qrda(doc)\n end\n update_qrda_progress\n end\n end",
"def decided_html(dmds)\r\n html = ''\r\n dmds.each { |om_id,list|\r\n html += \"<b>#{@omlist[om_id]}</b><br/>\\n<ul>\"\r\n list.each { |dmd|\r\n html += \"<li><span class=\\\"dmd_id\\\">#{dmd.id}</span> <span class=\\\"dmd_source\\\">#{dmd.source}</span>: <span class=\\\"dmd_title\\\">#{dmd.title}</span></li>\\n\"\r\n }\r\n html += \"<br/></ul>\\n\"\r\n }\r\n #puts html\r\n html\r\n end",
"def create_page_filename_list\n\n missing, expected = [], []\n\n unless @has_mets\n\n # Without METS, there's no way to find out which files should be present, so we won't be able to figure out if something is missing.\n # We also lack knowing what order they should be in. Ah well...\n\n @datafiles.sort!\n @datafiles = @datafiles.sort_by { |x| x[/\\d+/].to_i } # sort by number\n expected += @datafiles.select { |name| name =~ /\\.tiff$|\\.tif$|\\.jp2$|\\.jp2k$|\\.jpg$|\\.jpeg$/i }\n\n else\n\n # This checks the filenames in the list @datafiles (what's in the\n # package directory, less the metadata files) against the\n # filenames declared in the METS file table of contents (a\n # structmap). While datafiles is a simple list of filenames, the\n # table of contents provies a Struct::Page with slots :title,\n # :level, :image_filename, :image_mimetype, and :valid_repeat.\n # A :valid_repeat file is ignored.\n\n @table_of_contents.pages.each do |entry|\n next if entry.valid_repeat\n expected.push entry.image_filename\n missing.push entry.image_filename if @datafiles.grep(entry.image_filename).empty?\n end\n end\n\n unexpected = @datafiles - expected\n unexpected.delete_if { |x| x =~ /^Thumbs.db$/i } # common cruft\n\n unless unexpected.empty?\n warning \"The #{pretty_class_name} #{@directory_name} has the following #{unexpected.count} unexpected #{ unexpected.length == 1 ? 'file' : 'files'} that will not be processed:\"\n warning unexpected.map { |name| \" - #{name}\" }.sort\n end\n\n ## TODO: bug here reporting an error, 'name' somehow gets nil, see FSU's package FSU_Flambeau_04301979 started 2017-08-09 14:41:39\n\n unless missing.empty?\n error \"The #{pretty_class_name} #{@directory_name} is missing the following #{missing.count} required #{ missing.length == 1 ? 'file' : 'files'} declared in the mets.xml file:\"\n error missing.map { |name| \" - #{name}\" }.sort\n return false\n end\n\n @page_filenames = expected - missing\n end",
"def generate_messages(mfhd_status)\n\n messages = []\n mfhd_status.each do |item_id, item|\n messages << generate_message(item)\n end\n messages\n\n end",
"def generate\n add_intro\n add_blood_pressure_intro\n add_blood_pressure_list\n add_blood_pressure_outro\n add_medications_intro\n add_medications_list\n add_about\n\n @pdf\n end",
"def create_layout(content, attributes, identifier)\n # Get filenames\n base_path = 'layouts' + identifier[0..-2]\n meta_filename = base_path + '.yaml'\n content_filename = base_path + '.html'\n\n # Notify\n Nanoc3::NotificationCenter.post(:file_created, meta_filename)\n Nanoc3::NotificationCenter.post(:file_created, content_filename)\n\n # Create files\n FileUtils.mkdir_p(File.dirname(meta_filename))\n File.open(meta_filename, 'w') { |io| io.write(YAML.dump(attributes.stringify_keys)) }\n File.open(content_filename, 'w') { |io| io.write(content) }\n end",
"def create_tables_mysql()\n\n\t\tdbrows = @database.query <<-SQL\n\t\tCREATE TABLE IF NOT EXISTS invoices (\n\t\t\torganization VARCHAR(255),\n\t\t\tupdated DATE,\n\t\t\tamount FLOAT,\n\t\t\tamount_outstanding FLOAT,\n\t\t\tdiscount FLOAT,\n\t\t\tinvoice_id VARCHAR(255),\n\t\t\tnumber VARCHAR(255) UNIQUE PRIMARY KEY,\n\t\t\tmatter VARCHAR(255),\n\t\t\tstatus VARCHAR(255),\n\t\t\tdate DATE\n\t\t\t);\n\t\t\tSQL\n\n\t\t\tdbrows = @database.query <<-SQL\n\t\t\tCREATE TABLE IF NOT EXISTS invoice_lines (\n\t\t\t\tline_id INTEGER,\n\t\t\t\t_order INTEGER,\n\t\t\t\tnumber VARCHAR(255),\n\t\t\t\tinvoice_id VARCHAR(255),\n\t\t\t\tdescription TEXT,\n\t\t\t\tamount FLOAT,\n\t\t\t\tfirst_expense_id INTEGER,\n\t\t\t first_time_entry_id TEXT,\n\t\t\t\tline_item_date VARCHAR(255),\n\t\t\t\tperson VARCHAR(512),\n\t\t\t\tname VARCHAR(255),\n\t\t\t\tunit_cost FLOAT,\n\t\t\t\tquantity FLOAT,\n\t\t\t\ttype VARCHAR(255),\n\t\t\t\tmatter VARCHAR(255),\n\t\t\t\tupdated DATE\n\t\t\t\t);\n\t\t\t\tSQL\n\t\t## Add code here if you end up making additional tables\n\n\t\tdbrows = @database.query <<-SQL\n\t\tCREATE TABLE IF NOT EXISTS projects (\n\t\t\tmatter VARCHAR(255) UNIQUE,\n\t\t\tname VARCHAR(255),\n\t\t\tproject_id VARCHAR(255),\n\t\t\thour_budget FLOAT\n\t\t\t);\n\t\t\tSQL\n\t\tdbrows = @database.query('DELETE FROM projects;')\n\n\t\tdbrows = @database.query <<-SQL\n\t\tCREATE TABLE IF NOT EXISTS time_entries (\n\t\t\ttime_entry_id INTEGER UNIQUE,\n\t\t\tstaff_id INTEGER,\n\t\t\tproject_id VARCHAR(255),\n\t\t\ttask_id INTEGER,\n\t\t\thours FLOAT,\n\t\t\tdate DATE,\n\t\t\tnotes TEXT,\n\t\t\tbilled INTEGER\n\t\t);\n\t\tSQL\n\t\tdbrows = @database.query('DELETE FROM time_entries;')\n\n\t\tdbrows = @database.query <<-SQL\n\t\tCREATE TABLE IF NOT EXISTS staff (\n\t\t\tperson VARCHAR(512),\n\t\t\tfirst_name VARCHAR(255),\n\t\t\tlast_name VARCHAR(255),\n\t\t\tstaff_id INTEGER,\n\t\t\trate FLOAT\n\t\t);\n\t\tSQL\n\t\tdbrows = @database.query('DELETE FROM staff;')\n\n\t\tdbrows = @database.query <<-SQL\n\t\tCREATE TABLE IF NOT EXISTS contractor (\n\t\t\tname VARCHAR(255),\n\t\t\tcontractor_id INTEGER,\n\t\t\trate FLOAT\n\t\t);\n\t\tSQL\n\t\tdbrows = @database.query('DELETE FROM contractor;')\n\n\t\tdbrows = @database.query <<-SQL\n\t\t\t-- estimates from Contractors\n\t\t\tCREATE OR REPLACE VIEW unbilled_contractor_time AS\n\t\t\t\tSELECT projects.matter, contractor.name as person, SUM(time_entries.hours * contractor.rate) as estimated\n\t\t\t\tFROM time_entries\n\t\t\t\tINNER JOIN projects ON projects.project_id = time_entries.project_id\n\t\t\t\tINNER JOIN contractor ON contractor.contractor_id = time_entries.staff_id\n\t\t\t\tWHERE projects.matter <> '' AND time_entries.billed = 0\n\t\t\t\tGROUP BY projects.matter, person\n\t\t\t;\n\t\t\tSQL\n\n\t\t\t#UNBILLED STAFF TIME view\n\t\tdbrows = @database.query <<-SQL\n\t\t-- Estimates from Staff\n\t\t\tCREATE OR REPLACE VIEW unbilled_staff_time AS\n\t\t\t\t\tSELECT projects.matter, staff.person, SUM(time_entries.hours * staff.rate) as estimated\n\t\t\t\t\tFROM time_entries\n\t\t\t\t\tINNER JOIN projects ON projects.project_id = time_entries.project_id\n\t\t\t\t\tINNER JOIN staff ON staff.staff_id = time_entries.staff_id\n\t\t\t\t\tWHERE projects.matter <> '' AND time_entries.billed = 0\n\t\t\t\t\tGROUP BY projects.matter, staff.person\n\t\t\t\t\tORDER BY projects.matter, staff.person\n\t\t\t\t\t;\n\n\t\t\tSQL\n\n\t\t#UNBILLED ALL TIME TEMP view\n\t\tdbrows = @database.query <<-SQL\n\t\t\tCREATE OR REPLACE VIEW unbilled_all_time_temp AS\n\t\t\t\t\tSELECT * FROM unbilled_staff_time\n\t\t\t\t\tUNION\n\t\t\t\t\tSELECT * FROM unbilled_contractor_time;\n\t\t\tSQL\n\n\t\t#UNBILLED ALL TIME view\n\t\tdbrows = @database.query <<-SQL\n\t\t\t-- All unbilled time\n\t\t\t\tCREATE OR REPLACE VIEW unbilled_all_time AS\n\t\t\t\t\tSELECT *\n\t\t\t\t\tFROM unbilled_all_time_temp\n\t\t\t\t\tGROUP BY unbilled_all_time_temp.matter, unbilled_all_time_temp.person\n\t\t\t\t;\n\t\t\t\tSQL\n\n\t\t#mysql version\n\t\t#INVOICES GROUP view\n\t\tdbrows = @database.query <<-SQL\n\t\t\tCREATE OR REPLACE VIEW invoices_grouped AS\n\t\t\t\t\tSELECT\n\t\t\t\t\t\t\tinvoices.organization\n\t\t\t\t\t\t, invoices.matter\n\t\t\t\t\t\t, SUM((CASE WHEN status <> 'draft' THEN invoices.amount ELSE 0 END)) AS lifetime_billed\n\t\t\t\t\t\t, SUM((CASE WHEN YEAR(invoices.date) = YEAR(NOW()) THEN\n\t\t\t\t\t\t\t(CASE WHEN status <> 'draft' THEN invoices.amount ELSE 0 END)\n\t\t\t\t\t\t\tELSE 0 END)) as ytd_billed\n\t\t\t\t\t\t, SUM((CASE WHEN status = 'draft' THEN invoices.amount ELSE 0 END)) as draft_invoices\n\t\t\t\t\t\t, SUM((CASE WHEN status <> 'draft' THEN invoices.amount_outstanding ELSE 0 END)) as outstanding\n\t\t\t\t\tFROM invoices\n\t\t\t\t\tGROUP BY invoices.organization, invoices.matter;\n\t\t\tSQL\n\n\t\t#ORGNAMES view\n\t\tdbrows = @database.query <<-SQL\n\t\t\tCREATE OR REPLACE VIEW orgnames AS\n\t\t\t\tSELECT DISTINCT invoices_grouped.organization, unbilled_all_time.matter\n\t\t\t\tFROM unbilled_all_time\n\t\t\t\tLEFT OUTER JOIN invoices_grouped ON SUBSTR(invoices_grouped.matter,1,4) = SUBSTR(unbilled_all_time.matter,1,4);\n\t\t\tSQL\n\n\t\tdbrows = @database.query <<-SQL\n\t\t\t-- Build a deconstructed invoice from the line items\n\t\t\tCREATE OR REPLACE VIEW apportioned_invoices AS\n\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\t\tinvoices.organization\n\t\t\t\t\t\t\t, invoices.updated\n\t\t\t\t\t\t\t, (invoice_lines.amount - (invoice_lines.amount * invoices.discount/100)) as amount\n\t\t\t\t\t\t\t, (invoices.amount_outstanding/invoices.amount) * (invoice_lines.amount - (invoice_lines.amount * invoices.discount/100)) as amount_outstanding\n\t\t\t\t\t\t\t, invoices.discount\n\t\t\t\t\t\t\t, invoices.invoice_id\n\t\t\t\t\t\t\t, invoices.number\n\t\t\t\t\t\t\t, invoices.matter\n\t\t\t\t\t\t\t, invoices.status\n\t\t\t\t\t\t\t, invoices.date\n\t\t\t\t\t\t\t, (CASE WHEN invoice_lines.person = '' OR invoice_lines.person IS NULL THEN 'no name found' ELSE invoice_lines.person END) as person\n\t\t\t\t\t\t\t, invoice_lines.type\n\t\t\t\t\t\tFROM invoice_lines\n\t\t\t\t\t\tLEFT OUTER JOIN invoices ON invoices.invoice_id = invoice_lines.invoice_id\n\t\t\t\t\t\t;\n\t\t\tSQL\n\n\t\tdbrows = @database.query <<-SQL\n\t\t\tCREATE OR REPLACE VIEW apportioned_invoices_grouped AS\n\t\t\t\t\tSELECT\n\t\t\t\t\t\t\tapportioned_invoices.organization\n\t\t\t\t\t\t, apportioned_invoices.matter\n\t\t\t\t\t\t, apportioned_invoices.person\n\t\t\t\t\t\t, SUM((CASE WHEN apportioned_invoices.status <> 'draft' THEN apportioned_invoices.amount ELSE 0 END)) AS lifetime_billed\n\t\t\t\t\t\t, SUM((CASE WHEN YEAR(apportioned_invoices.date) = YEAR(NOW()) THEN\n\t\t\t\t\t\t\t(CASE WHEN apportioned_invoices.status <> 'draft' THEN apportioned_invoices.amount ELSE 0 END)\n\t\t\t\t\t\t\tELSE 0 END)) as ytd_billed\n\t\t\t\t\t\t, SUM((CASE WHEN apportioned_invoices.status = 'draft' THEN apportioned_invoices.amount ELSE 0 END)) as draft_invoices\n\t\t\t\t\t\t, SUM(unbilled_all_time.estimated) AS estimated\n\t\t\t\t\t\t, SUM((CASE WHEN apportioned_invoices.status <> 'draft' THEN apportioned_invoices.amount_outstanding ELSE 0 END)) as outstanding\n\t\t\t\t\tFROM apportioned_invoices\n\t\t\t\t\tLEFT OUTER JOIN unbilled_all_time ON apportioned_invoices.matter = unbilled_all_time.matter AND apportioned_invoices.person = unbilled_all_time.person\n\t\t\t\t\tGROUP BY apportioned_invoices.organization, apportioned_invoices.matter, apportioned_invoices.person;\n\t\t\t\t\t;\n\t\t\t\tSQL\n\n\t\t#UNBILLED ALL TIME WITH ORGS view\n\t\tdbrows = @database.query <<-SQL\n\t\t\t-- need to fix up matters\n\t\t\tCREATE OR REPLACE VIEW unbilled_all_time_with_orgs AS\n\t\t\t\t\tSELECT (CASE WHEN orgnames.organization <> '' THEN orgnames.organization ELSE 'unknown organization' END) as organization, unbilled_all_time.person, unbilled_all_time.matter, unbilled_all_time.estimated\n\t\t\t\t\tFROM unbilled_all_time\n\t\t\t\t\tLEFT OUTER JOIN orgnames ON orgnames.matter = unbilled_all_time.matter\n\t\t\t\t;\n\t\t\tSQL\n\n\t\tdbrows = @database.query <<-SQL\n\t\t\tCREATE OR REPLACE VIEW dashboard_detailed AS\n\t\t\t\t\tSELECT\n\t\t\t\t\t\t\tapportioned_invoices_grouped.organization\n\t\t\t\t\t\t, apportioned_invoices_grouped.matter\n\t\t\t\t\t\t, apportioned_invoices_grouped.person\n\t\t\t\t\t\t, apportioned_invoices_grouped.lifetime_billed\n\t\t\t\t\t\t, apportioned_invoices_grouped.ytd_billed\n\t\t\t\t\t\t, apportioned_invoices_grouped.outstanding\n\t\t\t\t\t\t, apportioned_invoices_grouped.draft_invoices\n\t\t\t\t\t\t, (CASE WHEN unbilled_all_time_with_orgs.estimated IS NULL THEN 0 ELSE unbilled_all_time_with_orgs.estimated END) as estimated\n\t\t\t\t\t\t, (apportioned_invoices_grouped.lifetime_billed + apportioned_invoices_grouped.draft_invoices + (CASE WHEN unbilled_all_time_with_orgs.estimated IS NULL THEN 0 ELSE unbilled_all_time_with_orgs.estimated END)) as all_spend\n\t\t\t\t\tFROM apportioned_invoices_grouped\n\t\t\t\t\tLEFT OUTER JOIN unbilled_all_time_with_orgs ON unbilled_all_time_with_orgs.matter = apportioned_invoices_grouped.matter AND unbilled_all_time_with_orgs.person = apportioned_invoices_grouped.person\n\t\t\t\t\tUNION\n\t\t\t\t\t-- Find the other half of the FULL OUTER JOIN\n\t\t\t\t\tSELECT\n\t\t\t\t\t\t\tunbilled_all_time_with_orgs.organization\n\t\t\t\t\t\t, unbilled_all_time_with_orgs.matter\n\t\t\t\t\t\t, unbilled_all_time_with_orgs.person\n\t\t\t\t\t\t, 0 as lifetime_billed\n\t\t\t\t\t\t, 0 as ytd_billed\n\t\t\t\t\t\t, 0 as outstanding\n\t\t\t\t\t\t, 0 as draft_invoices\n\t\t\t\t\t\t, unbilled_all_time_with_orgs.estimated\n\t\t\t\t\t\t, unbilled_all_time_with_orgs.estimated as all_spend\n\t\t\t\t\tFROM unbilled_all_time_with_orgs\n\t\t\t\t\tLEFT OUTER JOIN apportioned_invoices_grouped ON apportioned_invoices_grouped.matter = unbilled_all_time_with_orgs.matter AND apportioned_invoices_grouped.person = unbilled_all_time_with_orgs.person\n\t\t\t\t\tWHERE apportioned_invoices_grouped.matter IS NULL;\n\t\t\t\t;\n\t\t\tSQL\n\n\n\n\t\t\t#DASHBOARD view\n\t\t\tdbrows = @database.query <<-SQL\n\t\t\t\tCREATE OR REPLACE VIEW dashboard AS\n\t\t\t\t\tSELECT\n\t\t\t\t\t \torganization\n\t\t\t\t\t , matter\n\t\t\t\t\t , SUM(lifetime_billed) as lifetime_billed\n\t\t\t\t\t , SUM(ytd_billed) as ytd_billed\n\t\t\t\t\t , SUM(outstanding) as outstanding\n\t\t\t\t\t , SUM(draft_invoices) as draft_invoices\n\t\t\t\t\t , SUM(estimated) as estimated\n\t\t\t\t\t , SUM(all_spend) as all_spend\n\t\t\t\t\tFROM dashboard_detailed\n\t\t\t\t\tGROUP BY matter\n\t\t\t\t;\n\t\t\tSQL\n\tend",
"def makeFolder(path, logkey='')\n unless File.exist?(path)\n Dir.mkdir(path)\n else\n\t logstring = 'n-a'\n\tend\nrescue => logstring\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend",
"def create \n @ficha_medica = FichaMedica.find(params[:ficha_medica_id])\n @diagnostico = @ficha_medica.diagnosticos.create(diagnostico_params)\n if @diagnostico.save\n msg = \"Se ha agregado correctamente \"\n flash[:notice] = msg\n else\n redirect_to @ficha_medica\n end\n redirect_to ficha_medicas_url\n end",
"def create_detentions\n @students.each do |student|\n next if student[:detention].to_i.zero?\n\n name = student[:name].split(' ').map(&:downcase).join('_')\n file_path = \"#{__dir__}/../#{ENV['DETENTIONS_PATH']}/#{name}\"\n File.open(file_path, 'w') { |f| f.puts(student[:detention]) }\n end\n end",
"def cria_partida_demo\n \n partida = self.partidas.new(descricao:\"Partida Demo\", tipo: 0, dia_semana: 0)\n partida.save\n\n 14.times do |i|\n partida.jogadors.create(\n nome: \"Jogador #{i}\",\n habilidade: rand(1..5),\n )\n end\n\n end",
"def create\n # 登録したコンテンツにユーザー情報を付与\n for user in params[:memorytext]\n user[1].update(:user_id => current_user.id)\n end\n\n # まだ未登録のMemoryだった場合、登録する\n @memory_1 = Memory.is_my_memory?(params[:memorytext]['0'], current_user.id)\n @memory_2 = Memory.is_my_memory?(params[:memorytext]['1'], current_user.id)\n @memory_3 = Memory.is_my_memory?(params[:memorytext]['2'], current_user.id)\n\n # Memoryが3つ入力されていれば,リンク構造を6つ保存(双方向)\n if (!params[:memorytext]['0']['content'].blank? && !params[:memorytext]['1']['content'].blank? && !params[:memorytext]['2']['content'].blank?)\n @edge_1to2 = Memory.is_my_edge?(@memory_1, @memory_2, current_user.id)\n @edge_1to3 = Memory.is_my_edge?(@memory_1, @memory_3, current_user.id)\n @edge_2to1 = Memory.is_my_edge?(@memory_2, @memory_1, current_user.id)\n @edge_2to3 = Memory.is_my_edge?(@memory_2, @memory_3, current_user.id)\n @edge_3to1 = Memory.is_my_edge?(@memory_3, @memory_1, current_user.id)\n @edge_3to2 = Memory.is_my_edge?(@memory_3, @memory_2, current_user.id)\n redirect_to root_path\n\n # Memoryが2つ入力されていれば,リンク構造を2つ保存\n elsif (!params[:memorytext]['0']['content'].blank? && !params[:memorytext]['1']['content'].blank?)\n @edge_1to2 = Memory.is_my_edge?(@memory_1, @memory_2, current_user.id)\n @edge_2to1 = Memory.is_my_edge?(@memory_2, @memory_1, current_user.id)\n redirect_to :back\n\n #TODO:各リンクに重み付けを行う\n\n #TODO:どういう状態の時に、相手側へのフィードバックを発生させるか?\n # 【連想記憶の強化条件】\n # ページを開いたとき:\n # 利用回数(検索回数):\n #リンクノードが増えたとき:\n # データを削除したとき:\n # データを変更したとき:\n # 頻度が高いとき:\n #パスを通ったら、(キーワードをクリックしたら)リンクを強化:\n # 【連想記憶の弱化条件】\n #ほとんど利用されてない時:\n #リンクノードが減ったとき:\n # データを削除したとき:\n # データを変更したとき:\n # 頻度が低いとき:\n\n # Memoryが1つの場合は,該当レコードを表示\n else\n redirect_to @memory_1\n end\n\n\n=begin\n memory = current_user.memories.build(params[:memory])\n memory.save!\n redirect_to root_path\n=end\n=begin\n @memory = Memory.new(params[:memory])\n @memory.user_id = current_user.id\n\n respond_to do |format|\n if @memory.save\n flash[:notice] = 'Memory was successfully created.'\n format.html { redirect_to(:back) }\n format.xml { render :xml => @memory, :status => :created, :location => @memory }\n else\n format.html { redirect_to(:action => \"index\") }\n #format.html { render :action => \"new\" }\n format.xml { render :xml => @memory.errors, :status => :unprocessable_entity }\n end\n end\n=end\n end",
"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 create_build_directories\n root_dir = generate_build_location(\"\")\n Dir.mkdir root_dir unless Dir.exists?(root_dir)\n img_dir = generate_image_location(\"\",\"\").split(\"/\")[0...-1].join(\"/\")\n Dir.mkdir img_dir unless Dir.exists?(img_dir)\n end",
"def create\n @medicine = Medicine.create(medicine_params)\n\n diseases_lists = medicine_params[:diseases_list].split(\",\")\n diseases_lists.each do |disease_name|\n disease = Disease.find_or_create_by(name:disease_name)\n MedicineDisease.find_or_create_by(medicine_id: @medicine.id, disease_id: disease.id)\n end\n\n efficacie_lists = medicine_params[:efficacie_list].split(\",\")\n efficacie_lists.each do |efficacy_name|\n efficacy = Efficacy.find_or_create_by(name:efficacy_name)\n MedicineEfficacy.find_or_create_by(medicine_id: @medicine.id, efficacy_id: efficacy.id)\n end\n\n end",
"def make_hl7_from_text(text)\n hl7 = HL7::Message.new\n msh = hl7.standard_msh\n msh.sending_facility = {:namespace_id=>Pref.namespace_id,:universal_id=>Pref.hostname,:universal_id_type=>\"DNS\"}\n if ENV['RAILS_ENV'] == 'development'\n pro_id = 'D'\n else\n pro_id = 'P'\n end\n msh.processing_id = {:processing_id=>pro_id}\n hl7 << msh\n p = User.find_by_wedgetail(wedgetail,:order=>\"created_at DESC\")\n hl7 << p.make_pid\n obr = HL7::Obr.new\n obr[0] = \"OBR\"\n obr.set_id = 1\n obr.filler_order_number= {:entity_identifier=>\"%X\" % self.id,:namespace_id=>Pref.namespace_id,:universal_id=>Pref.hostname,:universal_id_type=>\"DNS\"}\n author = User.find_by_wedgetail(created_by,:order=>\"created_at DESC\")\n obr.principal_result_interpreter = {:name=>{:family_name=>author.family_name.upcase,:given_name=>author.given_names.upcase,:id_number=>author.id}}\n obr.observation_time = created_at\n usi = {:name_of_coding_system=>\"LN\"} # LOINC\n message_type = {:message_code=>'REF',:trigger_event=>'I12'}\n case narrative_type_id\n when 1 # Health Summary\n usi[:identifier] = \"34133-9\"\n usi[:text] = \"Summarization of episode note\"\n when 2 # Medication Chart\n usi[:identifier] = \"19009-0\"\n usi[:text] = \"Medication.current\"\n when 3 # Discharge Summary\n usi[:identifier] = \"28574-2\"\n usi[:text] = \"Discharge note\"\n when 4 # Progress Note\n usi[:identifier] = \"11488-4\"\n usi[:text] = \"Consultation Note\"\n when 5 # Allergies\n usi[:identifier] = \"11488-4\" # no good loinc code\n usi[:text] = \"Consultation Note\"\n when 6 # Scrapbook\n usi[:identifier] = \"11488-4\"\n usi[:text] = \"Consultation Note\"\n when 7 # Result\n usi[:identifier] = \"11526-1\"\n usi[:text] = \"Study report\"\n message_type = {:message_code=>'ORU',:trigger_event=>'R01'}\n when 8 # Letter\n usi[:identifier] = \"34140-4\"\n usi[:text] = \"Transfer of care referral note\"\n when 9 # Immunisations\n usi[:identifier] = \"11369-6\"\n usi[:text] = \"History of immunization\"\n else\n usi[:identifier] = \"11488-4\"\n usi[:text] = \"Consultation Note\"\n end\n obr.universal_service_identifier = usi\n msh.message_type = message_type\n hl7 << obr\n obx = HL7::Obx.new\n obx[0] = \"OBX\"\n obx.set_id = 1\n obx.value_type = \"FT\"\n obx.identifier = usi\n obx.value = text\n obx.result_status = \"F\"\n hl7 << obx\n hl7\n end",
"def make_dirs\r\n FileUtils.rm_rf @dirs[:tmp]\r\n @dirs.each do |k, dir|\r\n FileUtils.mkdir_p dir\r\n end\r\n end",
"def generate_all\n copy_template_dir('layouts', 'layouts')\n copy_template_dir('content/bootstrap', 'content/bootstrap')\n copy_template_dir('content/content', 'content/content')\n delete_target_file('lib/default.rb')\n copy_template_dir('lib', 'lib')\n delete_target_file('Rules')\n copy_template_file('Rules', 'Rules')\n copy_template_file('.gitignore', '.gitignore')\n copy_template_file('cg_config.rb', 'cg_config.rb')\n copy_template_file('cg_config.rb_sample', 'cg_config.rb_sample')\n delete_target_file('content/stylesheet.css')\n delete_target_file('content/index.html')\n delete_target_file('layouts/default.html')\n create_empty_dir('content/images')\n end",
"def make_data\r\n @holidays = ['2014/09/02','2015/01/01']\r\n @wday_name = l(:ts_week_day_names).split(',')\r\n @month_names = l(:ts_month_names).split(',')\r\n @break_time_names = l(:ts_break_time_names).split(',')\r\n @break_time_values = l(:ts_break_time_values).split(',')\r\n #month data\r\n @month_sheet = []\r\n @total_hours = 0;\r\n @total_result = 0;\r\n (@first_date..@last_date).each do |date|\r\n date_str = date.strftime(\"%Y/%m/%d\")\r\n date_id = date.strftime(\"%Y%m%d\")\r\n date_sheet = Timecards.where([\"work_date = ? AND users_id = ?\", date_str, @this_uid]).first\r\n if (date_sheet == nil) \r\n date_sheet = Timecards.new\r\n date_sheet.work_date = date\r\n end\r\n date_sheet.is_holiday = false\r\n if @holidays.include?(date_str)\r\n date_sheet.is_holiday = true\r\n end\r\n format_time_card(date_sheet)\r\n @month_sheet << date_sheet\r\n if (date_sheet.work_hours != nil)\r\n @total_hours = @total_hours + date_sheet.work_hours\r\n end\r\n if (date_sheet.work_result != nil)\r\n @total_result = @total_result + date_sheet.work_result\r\n end\r\n end\r\n end",
"def create_table\n sql = \"create table if not exists checksums (\n date varchar(25),\n basename varchar(70),\n suitename varchar(20),\n mtime varchar(25),\n md5 varchar(32),\n sha1 varchar(40),\n sha256 varchar(64)\n )\"\n @pkgdb.query(sql)\n end",
"def build_manifest(opts={})\n main_class = (opts[:main_class] ? randomize(opts[:main_class]) : nil)\n app_name = (opts[:app_name] ? randomize(opts[:app_name]) : nil)\n existing_manifest = nil\n meta_inf_exists = @entries.find_all{|item| item.name == 'META-INF/' }.length > 0\n\n @manifest = \"Manifest-Version: 1.0\\r\\n\"\n @manifest << \"Main-Class: #{main_class}\\r\\n\" if main_class\n @manifest << \"Application-Name: #{app_name}\\r\\n\" if app_name\n @manifest << \"Permissions: all-permissions\\r\\n\"\n @manifest << \"\\r\\n\"\n @entries.each { |e|\n next if e.name =~ %r|/$|\n if e.name == \"META-INF/MANIFEST.MF\"\n existing_manifest = e\n next\n end\n #next unless e.name =~ /\\.class$/\n @manifest << \"Name: #{e.name}\\r\\n\"\n #@manifest << \"SHA1-Digest: #{Digest::SHA1.base64digest(e.data)}\\r\\n\"\n @manifest << \"\\r\\n\"\n }\n if existing_manifest\n existing_manifest.data = @manifest\n else\n add_file(\"META-INF/\", '') unless meta_inf_exists\n add_file(\"META-INF/MANIFEST.MF\", @manifest)\n end\n end",
"def create_html_summary\r\n puts \"Creating HTML...\"\r\n @dmds = @lists.last\r\n @html = '<html>'\r\n @html += '<head><link rel=\"stylesheet\" href=\"styles.css\"></head>'\r\n @html += '<body>'\r\n @html += \"<h3>Actions</h3>\\n<ul>\"\r\n @html += actions_html\r\n @html += \"</ul>\\n\"\r\n #@html += \"<h3>Prios diff</h3>\\n<ul>\"\r\n #@html += prio_diff_html\r\n #@html += \"</ul>\\n\"\r\n #@html += \"<h3>Closed DMD</h3>\\n<ul>\"\r\n #@html += closed_dmd_html\r\n #@html += \"</ul>\\n\"\r\n @html += \"<h3>Open DM</h3>\"\r\n ano, evo = sas_report\r\n @html += \"<table><tr><td>Nature of changes</td><td>P0</td><td>P1</td><td>P2/P3</td><td>Total</td></tr>\r\n <tr><td>Anomalies</td><td>#{ano['0']}</td><td>#{ano['1']}</td><td>#{ano['2']+ano['3']}</td><td>#{ano['0']+ano['1']+ano['2']+ano['3']}</td></tr>\r\n <tr><td>Evolutions</td><td>#{evo['0']}</td><td>#{evo['1']}</td><td>#{evo['2']+evo['3']}</td><td>#{evo['0']+evo['1']+evo['2']+evo['3']}</td></tr>\r\n <tr><td>Total</td><td>#{ano['0']+evo['0']}</td><td>#{ano['1']+evo['1']}</td><td>#{ano['2']+ano['3']+evo['2']+evo['3']}</td><td>#{ano['0']+evo['0']+ano['1']+evo['1']+ano['2']+ano['3']+evo['2']+evo['3']}</td></tr>\r\n <table>\"\r\n count = prios_hash\r\n @html += \"<h3>Non analysed DMD, by priority</h3><ul>\\n\"\r\n @html += \"<b>Stats</b><ul>TBD: #{count['TBD']}<br/>P0: #{count['0']}<br/>P1: #{count['1']}<br/>P2: #{count['2']}<br/>P3: #{count['3']}<br/></ul>\\n\"\r\n @html += \"#{priority_html(priority_dmd)}</ul>\\n\"\r\n @html += \"<h3>Evo</h3>\\n<ul>#{priority_html(priority_evo)}</ul>\\n\"\r\n @html += \"<h3>Analysed but not batched DMD</h3>\\n<ul>#{analysed_html(analysed_dmd)}</ul>\\n\"\r\n @html += \"<h3>Has workload but not 'analysed' DMD</h3>\\n<ul>#{analysed_html(workload_dmd)}</ul>\\n\"\r\n @html += \"<h3>Decided DMD</h3>\\n<ul>#{decided_html(decided_dmd)}</ul>\\n\"\r\n @html += \"<h3>Last updated</h3>\\n<ul>#{last_updated_html(last_updated_dmd)}</ul>\\n\"\r\n @html += '</body>'\r\n @html += '</html>'\r\n end",
"def create_daily_data\n data = {\n sign: @sign_name.to_s,\n duration: 'daily',\n horoscope_text: get_daily_horoscope,\n }\n @horoscope = Horoscope.new(data)\n if @horoscope.save\n intensity = @theastrologer_content.css(\"div.row.daily-meta div[1] p[1]\").text.split(':').last.gsub(' ', '').to_s\n keywords = @theastrologer_content.css(\"div.row.daily-meta div[2] p[1]\").text.split(':').last.gsub(' ', '')\n mood = @theastrologer_content.css(\"div.row.daily-meta div[1] p[2]\").text.split(':').last.gsub(' ', '')\n @horoscope.other_details.create(\n [\n {\n detail_type: \"intensity\",\n detail: intensity\n },\n {\n detail_type: \"keywords\",\n detail: keywords\n },\n {\n detail_type: \"mood\",\n detail: mood\n }\n ]\n )\n end\n end",
"def build_tables\n @db.exec(%q[\n CREATE TABLE IF NOT EXISTS breeds(\n id serial NOT NULL PRIMARY KEY,\n breed varchar(30),\n price integer\n )])\n\n @db.exec(%q[\n CREATE TABLE IF NOT EXISTS puppies(\n id serial NOT NULL PRIMARY KEY,\n breed varchar(30),\n name varchar(30),\n age integer,\n created_at timestamp NOT NULL DEFAULT current_timestamp\n )])\n\n @db.exec(%q[\n CREATE TABLE IF NOT EXISTS requests(\n id serial NOT NULL PRIMARY KEY,\n breed text,\n status text,\n created_at timestamp NOT NULL DEFAULT current_timestamp\n )])\n end",
"def generate_constructions\n # TODO? delete and re-create or check that it exists and update?\n # self.construct_assemblies.destroy_all\n # self.materials.destroy_all\n # self.fenestration_constructions.destroy_all\n # self.door_construction.destroy_all\n\n # model names\n constructions = %w(UndergroundWall UndergroundFloor InteriorWall InteriorFloor ExteriorWall ExteriorFloor Roof)\n fenestrations = %w(Window Skylight)\n doors = ['Door']\n space_ids = []\n\n # get all building -> stories -> spaces (that's what constructions are attached to)\n stories = building.building_stories\n spaces = []\n stories.each do |story|\n story.spaces.each do |space|\n spaces << space\n end\n end\n space_ids = spaces.collect(&:id)\n logger.debug(\"*****SPACES: #{space_ids.inspect} *****\")\n\n project_cas = []\n project_mats = []\n project_fens = []\n project_doors = []\n\n # to find doors, windows, skylights\n int_wall_ids = []\n ext_wall_ids = []\n roof_ids = []\n\n # assign regular constructions\n constructions.each do |con|\n con_model = con.constantize\n instances = con_model.any_in(space_id: space_ids)\n\n if con === 'InteriorWall'\n int_wall_ids = instances.collect(&:id)\n elsif con === 'ExteriorWall'\n ext_wall_ids = instances.collect(&:id)\n elsif con === 'Roof'\n roof_ids = instances.collect(&:id)\n end\n\n # puts \"#{instances.size} instances of #{con}\"\n # logger.info \"#{instances.size} instances of #{con}\"\n\n instances.each do |instance|\n # get lib record\n unless instance.construction_library_id.nil?\n lib = Construction.find(instance.construction_library_id)\n\n # TODO: check that it doesn't exist yet or skip?\n ca = construct_assemblies.find_or_create_by(name: lib.name)\n ca.compatible_surface_type = lib.compatible_surface_type\n # save other attributes here (for floors)\n ca.slab_type = lib.slab_type\n ca.slab_insulation_orientation = lib.slab_insulation_orientation\n ca.slab_insulation_thermal_resistance = lib.slab_insulation_thermal_resistance\n\n material_refs = []\n # material references\n logger.debug(\"!!!!! LAYERS: #{lib['layers']}\")\n unless lib['layers'].nil?\n lib.layers.each do |layer|\n mat = materials.find_or_create_by(name: layer['name'])\n mat.code_category = layer['code_category']\n mat.code_item = layer['code_item']\n # save framing_configuration and material (required)\n mat.framing_depth = layer['framing_depth']\n mat.framing_configuration = layer['framing_configuration']\n mat.framing_material = layer['framing_material']\n mat.framing_material = layer['framing_material']\n mat.cavity_insulation = layer['cavity_insulation_r_value']\n\n mat.save\n material_refs << mat.name\n # only save unique records to project\n match = project_mats.find { |m| m['name'] === mat.name }\n logger.info(\"MATCH: #{match}, for material #{mat.name}\")\n project_mats << mat if match.nil?\n end\n end\n\n # save material references to construction assembly\n ca.material_reference = material_refs\n ca.save\n # only save unique records to project\n match = project_cas.find { |m| m['name'] === ca.name }\n # puts \"MATCH: #{match} for ca #{ca.name}\"\n logger.info \"MATCH: #{match} for ca #{ca.name}\"\n project_cas << ca if match.nil?\n\n # save construction assembly reference on original instance (in construct_assembly_reference field, use name)\n instance.construct_assembly_reference = ca.name\n instance.save\n end\n end\n end\n\n\n logger.info \"Exterior Wall ids are #{ext_wall_ids}\"\n\n # assign doors\n door_instances = Door.or({:interior_wall_id.in => int_wall_ids}, {:exterior_wall_id.in => ext_wall_ids})\n\n logger.info(\"Door instances: #{door_instances.size}\")\n door_instances.each do |instance|\n # get lib record\n unless instance.construction_library_id.nil?\n lib = DoorLookup.find(instance.construction_library_id)\n dc = door_constructions.find_or_create_by(name: lib.name)\n # add other lib fields\n lib.attributes.each_pair do |key, value|\n unless %(created_at updated_at id _id).include? key\n dc[key] = value\n end\n end\n dc.save\n\n # only save unique records to project\n match = project_doors.find { |m| m['name'] === dc.name }\n logger.info(\"MATCH: #{match} for door construction #{dc.name}\")\n project_doors << dc if match.nil?\n\n # save construction assembly reference on original instance (in construct_assembly_reference field, use name)\n instance.door_construction_reference = dc.name\n instance.save\n end\n end\n\n # assign fenestrations\n fenestrations.each do |fen|\n fen_model = fen.constantize\n if fen === 'Window'\n instances = fen_model.any_in(exterior_wall_id: ext_wall_ids)\n else\n # skylight\n instances = fen_model.any_in(roof_id: roof_ids)\n end\n # puts \"#{instances.size} instances of #{fen}\"\n # logger.info(\"#{instances.size} instances of #{fen}\")\n\n instances.each do |instance|\n # get lib record\n unless instance.construction_library_id.nil?\n lib = Fenestration.find(instance.construction_library_id)\n # TODO: check that it doesn't exist yet or skip?\n fc = fenestration_constructions.find_or_create_by(name: lib.name)\n # save all lib attributes to construction instance\n lib.attributes.each_pair do |key, value|\n unless %(created_at updated_at id _id).include? key\n fc[key] = value\n end\n end\n fc.save\n\n # only save unique records to project\n match = project_fens.find { |m| m['name'] === fc.name }\n logger.info(\"MATCH: #{match} for fen construction #{fc.name}\")\n project_fens << fc if match.nil?\n\n # save construction assembly reference on original instance (in construct_assembly_reference field, use name)\n instance.fenestration_construction_reference = fc.name\n instance.save\n end\n end\n end\n\n # save all to project\n self.door_constructions = project_doors\n self.fenestration_constructions = project_fens\n self.construct_assemblies = project_cas\n self.materials = project_mats\n self.save!\n end",
"def make_ivory_tower\n 5.times do |n| \n user = make_user\n journal = make_journal\n journal.save!\n publication = make_publication\n article = make_article\n section_array = []\n 3.times { |n| section_array << make_section }\n author = make_author\n journal.publications << publication\n publication.articles << article\n article.authors << author\n section_array.each { |section| article.sections << section }\n end\nend",
"def makeFolder(path, logkey='')\n unless Dir.exist?(path)\n Mcmlln::Tools.makeDir(path)\n else\n logstring = 'n-a'\n end\nrescue => logstring\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend",
"def create_contents\n contents = []\n if description[\"contents\"].blank?\n logger.warn \"\\n++++++\\nWARNING! Could not find any content descriptions for element: #{self.name}\\n++++++++\\n\"\n else\n description[\"contents\"].each do |content_hash|\n contents << Alchemy::Content.create_from_scratch(self, content_hash.symbolize_keys)\n end\n end\n end",
"def html_to_markdown\n html_decoded = ConverterMachine.html_markdown(self)\n\n # Update the work.\n unless self.update_attributes!(file_content_md: html_decoded)\n errors.add(\"There was an error updating MD for work id: #{self.id}\")\n end\n end",
"def create_report\n\tcreate_rep_heading\n \tcreate_product_data\n \tcreate_brand_data\nend",
"def create_dirs\n FileUtils.mkdir_p(@work_dir) unless File.exist?(@work_dir)\n end",
"def fill_form_guids_get_ht_needles(s_form, s_prefix)\n ht_needles=Hash.new\n s_needle=nil\n i=0\n while true\n s_needle=s_prefix+i.to_s+@@lc_rsqbrace\n break if !s_form.include? s_needle\n ht_needles[s_needle]=Kibuvits_GUID_generator.generate_GUID\n i=i+1\n end # loop\n return ht_needles\n end",
"def create_base_dirs\n BASE_DIR.each do |dir|\n FileUtils.mkdir \"#{@project_name}/#{dir}\"\n $stdout.puts \"\\e[1;32m \\tcreate\\e[0m\\t#{dir}\"\n end\n FileUtils.mkdir \"#{@project_name}/app/apis/#{@project_name}\"\n $stdout.puts \"\\e[1;32m \\tcreate\\e[0m\\tapp/apis/#{@project_name}\"\n end",
"def create\n \t@dpm = Dpm.new(dpm_params)\n \t#todo @user = User.find_by(current_user[:id])\n \t#@user.dpms << @dpm\n \t\n respond_to do |format|\n if @dpm.save\n format.html { render '/dpms/step1', notice: 'Dpm was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dpm }\n else\n format.html { render action: 'new' }\n format.json { render json: @dpm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @diagnoz = Diagnoz.new\n @admin_mkh_groups = Admin::MkhGroup.all\n @diagnoz.diamkhs.build\n @woman = Woman.find(params[:woman_id])\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def mkdir_p_folders\n [systems_folder, images_systems_folder, data_systems_folder, pages_score_folder].each do |dossier|\n FileUtils.mkdir_p(dossier)\n end\nend",
"def create_parts_and_annotations_mcd(part)\n \n puts\n puts \"== Creating/finding SD part for #{part.biofab_id} ==\"\n\n sd_sequence = part.sequence[$msd1]\n sd_part = Part.find_by_sequence(sd_sequence)\n if !sd_part\n sd_part = Part.new\n sd_part.sequence = sd_sequence\n sd_part.description = \"The Shine-Dalgarno / RBS sequence in a mono-cistronic design.\"\n sd_part.part_type = $sd_type\n sd_part.save!\n puts \"--created sd part\"\n else\n puts \"--found sd part\"\n end\n puts \"---- #{sd_part.sequence}\"\n\n puts\n puts \"== Creating start part for #{part.biofab_id} ==\"\n\n start_sequence = part.sequence[$mstart]\n start_part = Part.find_by_sequence(start_sequence)\n if !start_part\n start_part = Part.new\n start_part.sequence = start_sequence\n start_part.description = \"Start codon.\"\n start_part.part_type = $start_type\n start_part.save!\n puts \"--created start part\"\n else\n puts \"--found start part\"\n end\n \n puts\n puts \"== Annotating #{part.biofab_id} ==\"\n\n annot_type_name = \"Mono-cistronic 5' UTRs\"\n annot_type = AnnotationType.find_by_name(annot_type_name)\n if !annot_type\n annot_type = AnnotationType.new\n annot_type.name = annot_type_name\n annot_type.save!\n puts \"-- created annotation type for mono-cistronic 5' UTRs\"\n else\n puts \"-- found annotation type for mono-cistronic 5' UTRs\"\n end\n \n sd_label = \"Mutated SD\"\n start_label = \"Start\"\n\n create_annotation(part, sd_part, annot_type, $msd1.begin, $msd1.end, sd_label)\n create_annotation(part, start_part, annot_type, $mstart.begin, $mstart.end, start_label)\n\nend",
"def create_all\n for i in 0..Pdf.get_pdf_file_count do\n pdf = Pdf.create_pdf(i.to_s, @client, @settings)\n pdf_file_name = Pdf.get_pdf_file_name(Pdf::PDFS.keys[i], @client)\n pdf.render_file(\"#{Rails.root}/app/assets/generated-pdfs/#{pdf_file_name}\")\n end\n generate_zip(@client)\n end",
"def create_storages\n @storages = []\n @encryption_info = @ms_off_crypto.encryption_info\n @encrypted_package = @ms_off_crypto.encrypted_package\n\n @storages << Storage.new('EncryptionInfo', :data=>encryption_info, :left=>3, :right=>11) # example shows right child. do we need the summary info????\n @storages << Storage.new('EncryptedPackage', :data=>encrypted_package, :color=>Storage::COLORS[:red])\n @storages << Storage.new([6].pack(\"c\")+\"DataSpaces\", :child=>5, :modified =>129685612740945580, :created=>129685612740819979)\n @storages << version\n @storages << data_space_map\n @storages << Storage.new('DataSpaceInfo', :right=>8, :child=>7, :created=>129685612740828880,:modified=>129685612740831800)\n @storages << strong_encryption_data_space\n @storages << Storage.new('TransformInfo', :color => Storage::COLORS[:red], :child=>9, :created=>129685612740834130, :modified=>129685612740943959)\n @storages << Storage.new('StrongEncryptionTransform', :child=>10, :created=>129685612740834169, :modified=>129685612740942280)\n @storages << primary \n # @storages << summary_information\n # @storages << document_summary_information\n\n # we do this at the end as we need to build the minifat stream to determine the size. #HOWEVER - it looks like the size should not include the padding?\n @storages.unshift Storage.new('Root Entry', :type=>Storage::TYPES[:root], :color=>Storage::COLORS[:red], :child=>1, :data => mini_fat_stream)\n\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 create\n @database = Database.new(params[:database])\n path = @database.path\n @database.active=false\n Dir.mkdir \"telemetries\" unless Dir.exists? \"telemetries\"\n Dir.mkdir \"telemetries/#{@database.mission}\" unless Dir.exists? \"telemetries/#{@database.mission}\"\n if !Dir.exists? path then\n Dir.mkdir path\n Dir.mkdir path+\"/input\"\n Dir.mkdir path+\"/processed\"\n end\n respond_to do |format|\n if @database.save\n format.html { redirect_to @database, notice: 'Database was successfully created.' }\n format.json { render json: @database, status: :created, location: @database }\n else\n format.html { render action: \"new\" }\n format.json { render json: @database.errors, status: :unprocessable_entity }\n end\n end\n end",
"def run_mdc_content_tests\n assert_not_nil Strain.find(:all)\n # Check strains loaded, start with the first strain in the test file\n strain = Strain.find_by_mdc_id('MDC-03-08')\n assert_not_nil strain\n assert_equal 228, Strain.count\n \n # the last strain in the file\n strain2 = Strain.find_by_mdc_id('MDC-05-90')\n assert_not_nil strain2\n # make sure it loaded the data\n strain2_genotypes = Genotype.find_all_by_strain_id(strain2.id)\n assert_equal 9, strain2_genotypes.size\n \n snp = Snp.find_by_symbol('J500418')\n assert_not_nil snp\n assert_equal 'C/T', snp.target_allele\n \n assert_not_nil Genotype.count\n \n assert_equal (228*9), Genotype.count\n genotypes = Genotype.find_all_by_genotypable_id(snp.id)\n assert_not_nil genotypes\n assert_equal 228, genotypes.size\n \n # Get genotype data for J500418 in strain MDC-03-08\n last_genotype = Genotype.find_by_genotypable_id_and_strain_id(snp.id, strain.id)\n assert_not_nil last_genotype\n assert_equal 'TT',last_genotype.genotype_allele\n end",
"def create\n\n if File.exists?(dbfilename)\n puts \"Moved '#{dbfilename}' to '#{dbfilename}.bak'.\"\n FileUtils.mv(dbfilename, dbfilename + '.bak')\n end\n db = Sequel.sqlite(dbfilename)\n db.create_table :pdfmd_documents do\n String :md5sum, :primary_key => true\n String :filename\n String :author\n String :title\n String :subject\n Date :createdate\n String :keywords\n String :filepath\n end\n db.add_index :pdfmd_documents, :md5sum\n db.add_index :pdfmd_documents, :keywords\n end",
"def generate_story_themes(themes, story)\n if themes\n themes.each do |theme|\n theme_obj = generate_theme(theme)\n story_theme = Storytheme.new()\n story_theme.story = story\n story_theme.theme = theme_obj\n story_theme.save\n end\n end\nend",
"def build_contents\n # Merge the array of hashes into one.\n flatten_hash = Hash[*step_contents.collect(&:contents).collect{|h| h.to_a}.flatten]\n # Create a flat hash structure\n Hash.to_dotted_hash flatten_hash\n end",
"def create_practices()\n\t\t@@practices[:mail] = create_mail_practice()\n\t\t@@practices[:none] = create_none_practice()\n\t\t@@practices[:fax] = create_fax_practice()\n\t\t#@practices[:athena] = create_athena_practice()\n\tend",
"def entries_to_dir entries, path\n if File.exists? path\n raise \"directory #{path} already exists\"\n else\n Dir.mkdir path\n end\n\n entries.each do |entry|\n e = entry.to_s\n\n new_filename = path + '/0x' + MD5.new(e).hexdigest[0,8] + '.atom'\n\n File.open(new_filename, 'w') { |f| f.write e }\n end\n end"
] |
[
"0.5654948",
"0.5615741",
"0.5470057",
"0.541697",
"0.5363079",
"0.53075135",
"0.53068924",
"0.52131814",
"0.52057517",
"0.51363",
"0.51253265",
"0.51243556",
"0.50982094",
"0.50778276",
"0.50778276",
"0.5072326",
"0.50687176",
"0.5067654",
"0.5010212",
"0.49945396",
"0.4933511",
"0.49123257",
"0.49029097",
"0.490175",
"0.48964757",
"0.48830286",
"0.48754537",
"0.48746195",
"0.4872266",
"0.4862383",
"0.4856716",
"0.4854157",
"0.48519316",
"0.48485988",
"0.48471117",
"0.48470205",
"0.48441568",
"0.4841706",
"0.48353568",
"0.4808621",
"0.48029345",
"0.48010236",
"0.47838485",
"0.4780616",
"0.4777376",
"0.477586",
"0.47660473",
"0.47614834",
"0.47552866",
"0.47489968",
"0.47443604",
"0.47394937",
"0.47394016",
"0.47279832",
"0.47276413",
"0.47271606",
"0.47256473",
"0.472102",
"0.4718662",
"0.47158307",
"0.4711974",
"0.47093445",
"0.46939445",
"0.46866277",
"0.46792716",
"0.4661417",
"0.46603775",
"0.4658267",
"0.46578452",
"0.46532664",
"0.4650373",
"0.46503112",
"0.4648595",
"0.46443245",
"0.4638931",
"0.46371114",
"0.46352157",
"0.4631031",
"0.46308276",
"0.46269298",
"0.46268332",
"0.46266583",
"0.46201676",
"0.46178013",
"0.4614401",
"0.46093372",
"0.46040574",
"0.4603946",
"0.460207",
"0.45976934",
"0.45915043",
"0.45879865",
"0.4587278",
"0.45868462",
"0.45813838",
"0.4580449",
"0.45783865",
"0.457759",
"0.45772335",
"0.45711774"
] |
0.61998576
|
0
|
Crea los HTML a partir de los MD
|
def create_html path
html_name = "#{File.basename(path, '.md')}.html"
if html_name !~ /^index/
html_name = 'md/' + html_name
end
puts "Ejecutando «pc-pandog -i #{path} -o #{html_name}»…"
system("pc-pandog -i #{path} -o #{html_name}")
html = get_html(html_name)
new_html = []
write = true
html.each do |l|
if l =~ /<head>/
write = false
if html_name !~ /^index/
new_html.push($head.join("\n"))
else
new_html.push($head.join("\n").gsub('<link type="text/css" rel="stylesheet" href="../css/styles.css">', '<link type="text/css" rel="stylesheet" href="css/styles.css">').gsub('<script type="text/javascript" src="../js/piwik.js"></script>', '<script type="text/javascript" src="js/piwik.js"></script>'))
end
elsif l =~ /<\/head>/
write = true
elsif l =~ /<style>/
if html_name !~ /^index/
new_html.push($header.join("\n"))
else
new_html.push($header.join("\n").gsub('../index.html', '').gsub(/"(\S+?\.html)"/, 'html/' + '\1'))
end
elsif l =~ /<\/body>/
new_html.push($footer.join("\n"))
new_html.push(l)
else
if write == true
new_html.push(l)
end
end
end
new_html = beautifier_html(new_html)
# Se actualiza la información
archivo = File.new(html_name, 'w:UTF-8')
archivo.puts new_html
archivo.close
# Si no es el index, lo mueve a la carpeta «html»
if html_name !~ /^index/
FileUtils.mv(html_name, 'html')
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def generate(options = {})\n embed_outline(options[:selflink]) if options[:outline]\n\n #if options[:dirmap]\n # md_dir = Pathname.new(@md_file).dirname.expand_path\n # embed_sidebar( Madowu::DirectoryMapper.dirmap(md_dir) )\n #end\n\n if options[:sidebar]\n #lines = File.open( options[:sidebar], \"r\").readlines\n lines = `#{@markdown} #{options[:sidebar]}`.split(\"\\n\")\n embed_sidebar(lines)\n end\n\n result = [\n make_header(options[:css], options[:charset]),\n @markup_lines,\n \"</div></div></body></html>\",\n ''\n ].join(\"\\n\")\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 write_the_html_file(mdpath, name)\n DbgMgr.put \"out_html\", \"writing #{name}html\"\n file = File.join @doc, (name + \"html\")\n VersionedFile.new_version file, true, bak: @doc_bak, keep: @keep\n cmd = \"pandoc -p -s -S -f markdown -t html5 --toc --toc-depth=4 \" +\n \"--self-contained --css #{@css} -o #{file} #{mdpath}\"\n DbgMgr.put \"out_html\", cmd\n output = %x[#{cmd}]\n [$?.exitstatus, output]\n\n end",
"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 generate_html\n # the individual descriptions for files and classes\n gen_into(@files)\n gen_into(@classes)\n # and the index files\n gen_file_index\n gen_class_index\n gen_method_index\n gen_main_index\n\n # this method is defined in the template file\n write_extra_pages if defined? write_extra_pages\n end",
"def create!\n new_file = \"#{next_number}-#{strip_title}.md\"\n @path = File.join(@dir, new_file)\n File.open(@path, 'w') do |file|\n file.write initial_content\n end\n\n new_file\n end",
"def html\n if FUNCTION != 'none'\n if self.md.value != nil\n hm = self.md.value\n else\n hm = INDEX\n end\n @me = YAML.load(self.yaml.value)\n [\n ERB.new(HEAD).result(binding),\n Kramdown::Document.new(ERB.new(hm).result(binding)).to_html,\n \"</body></html>\"\n ].flatten.join('')\n end\n end",
"def body\n HTML.render render_md, options\n end",
"def generate_html\n html_renderer = Carta::CLI::HTMLRenderer.new(@PROJECT_DIR)\n # puts @MANUSCRIPT_DIR\n book['html'] = html_renderer.manuscript_html\n book['outline'] = html_renderer.outline\n book['epub_toc_html'] = html_renderer.epub_toc_html\n book['html_toc_html'] = html_renderer.html_toc_html\n\n generate_epub_manifest\n end",
"def to_html source=nil\n require 'md2man/html/engine'\n Md2Man::HTML::ENGINE.render(read(source))\n rescue LoadError\n raise 'Run `gem install md2man` to use BinMan::html().'\n end",
"def decided_html(dmds)\r\n html = ''\r\n dmds.each { |om_id,list|\r\n html += \"<b>#{@omlist[om_id]}</b><br/>\\n<ul>\"\r\n list.each { |dmd|\r\n html += \"<li><span class=\\\"dmd_id\\\">#{dmd.id}</span> <span class=\\\"dmd_source\\\">#{dmd.source}</span>: <span class=\\\"dmd_title\\\">#{dmd.title}</span></li>\\n\"\r\n }\r\n html += \"<br/></ul>\\n\"\r\n }\r\n #puts html\r\n html\r\n end",
"def to_html\n render_file(main)\n end",
"def html_contents\n layout_contents\n end",
"def build\r\n self.ehtml, self.ecss, self.ejs = self.theme.page_layout.build_content() \r\n return self.ehtml, self.ecss, self.ejs\r\n end",
"def build_html(files)\n builder = Nokogiri::HTML::Builder.new do |doc|\n doc.html {\n doc.body {\n doc.table {\n build_table_header(doc)\n build_table_body(doc, files)\n }\n }\n }\n end\n\n builder.to_html\n end",
"def build_mdlinks\n return unless options.Build_Markdown_Links\n\n puts_cyan \"Middlemac is creating `#{options.File_Markdown_Links}`.\"\n\n files_array = []\n out_array = []\n longest_shortcut = 0\n longest_path = 0\n\n Dir.glob(\"#{app.source}/Resources/**/*.erb\").each do |fileName|\n\n # Remove all file extensions and make a shortcut\n base_name = fileName\n while File.extname(base_name) != '' do\n base_name = File.basename( base_name, '.*' )\n end\n next if base_name.start_with?('_') # || base_name == 'index'\n\n if base_name == 'index'\n shortcut = \"[#{File.split(File.split(fileName)[0])[1]}_index]:\"\n\n else\n shortcut = \"[#{base_name}]:\"\n end\n\n # Make a fake absolute path\n path = Pathname.new(fileName).relative_path_from(Pathname.new(app.source))\n path = File::SEPARATOR + File.join(File.dirname(path), base_name) + '.html'\n\n # Get the title, if any\n metadata = YAML.load_file(fileName)\n title = (metadata.is_a?(Hash) && metadata.key?('title')) ? metadata['title'] : ''\n\n files_array << { :shortcut => shortcut, :path => path, :title => title }\n\n longest_shortcut = shortcut.length if shortcut.length > longest_shortcut\n longest_path = path.length if path.length > longest_path\n\n end\n\n files_array = files_array.sort_by { |key| [File.split(key[:path])[0], key[:path]] }\n files_array.uniq.each do |item|\n item[:shortcut] = \"%-#{longest_shortcut}.#{longest_shortcut}s\" % item[:shortcut]\n\n if item[:title].length == 0\n out_array << \"#{item[:shortcut]} #{item[:path]}\"\n else\n item[:path] = \"%-#{longest_path}.#{longest_path}s\" % item[:path]\n out_array << \"#{item[:shortcut]} #{item[:path]} \\\"#{item[:title]}\\\"\"\n end\n end\n\n File.open(options.File_Markdown_Links, 'w') { |f| out_array.each { |line| f.puts(line) } }\n\n end",
"def to_html_fragment\n to_markdown_slices.map do |tagged_markdown|\n tagged_markdown.to_html\n end.join(\"\\n\\n\")\n end",
"def generate\n generate_header\n generate_content\n #not_dirty\n end",
"def generate_html\n body = generate_body\n init = Nyaplot.generate_init_code\n path = File.expand_path(\"../templates/static_html.erb\", __FILE__)\n template = File.read(path)\n ERB.new(template).result(binding)\n end",
"def html_to_markdown(content,user)\n filenumber = user.id\n filename = filenumber.to_s+\".html\"\n %x[\"touch #{filename}\"]\n File.atomic_write(\"tmp/#{filename}\") do |file|\n file.write(content)\n end\n html_content = `pandoc -f html -t markdown \"tmp/#{filename}\"`\n File.delete(\"tmp/#{filename}\")\n return html_content\n end",
"def md_to_html\n options = {\n filter_html: true,\n link_attributes: {\n rel: \"nofollow\",\n target: \"_blank\"\n }\n }\n\n extensions = {\n space_after_headers: true,\n autolink: true\n }\n\n renderer = Redcarpet::Render::HTML.new(options)\n markdown = Redcarpet::Markdown.new(renderer, extensions)\n\n self.description = markdown.render(self.description_md)\n end",
"def md_include_html(html)\n res = \"{::options parse_block_html=\\\"true\\\" /}\\n\"\n res << html\n res << \"\\n{::options parse_block_html=\\\"false\\\" /}\\n\"\n return res\nend",
"def to_markdown\n files = Dir.glob('**/*.html')\n files.each do |f|\n new_f = f.gsub 'html', 'markdown'\n system \"mv #{f} #{new_f}\" if File.file? f\n end\n end",
"def create_HTML_file(loc_name, content, out_dir)\n File.open(\"#{out_dir}/#{loc_name}.html\", 'w') do |f|\n f.write(HEADER_TEXT)\n f.write(\"<h1>Lonely Planet: #{loc_name}</h1>\")\n f.write(NAV_TITLE)\n f.write($navigation_html)\n f.write(BLOCK_TITLE)\n f.write(\"<h1><li class='first'><a href='#'>#{loc_name}</a></li></h1>\")\n f.write(MAIN_BLOCK)\n f.write(content)\n f.write(CLOSE_HTML)\n end\nend",
"def build( special_contexts=[] )\r\n\r\n self.ehtmls, self.ecss, self.ejs = self.theme.original_page_layout_root.build_content(special_contexts)\r\n self.ehtml = self.ehtmls.first\r\n\r\n end",
"def generate_html\n @main_url = main_url\n @sorted_files = @files.sort\n @sorted_classes = @classes.sort\n @sorted_methods = RDoc::Generator::Method.all_methods.sort\n\n # the individual descriptions for files and classes\n gen_into(@files)\n gen_into(@classes)\n\n # and the index files\n gen_file_index\n gen_class_index\n gen_method_index\n gen_main_index\n\n # this method is defined in the template file\n values = {\n :title_suffix => CGI.escapeHTML(\"[#{@options.title}]\"),\n :charset => @options.charset,\n :style_url => style_url('', @options.css),\n }\n\n @template.write_extra_pages(values) if\n @template.respond_to?(:write_extra_pages)\n end",
"def generate_html(game)\n file = File.open(\"/home/matt/Documents/programming/ruby/dmsw/template.1\", 'rb')\n html = file.read.chomp\n file.close\n \n file = File.open('/home/matt/Documents/programming/ruby/dmsw/template.2', 'rb')\n game.win_lose == \"W\" ? html.concat(\"<p class=\\\"yes\\\">Yes.\") : html.concat(\"<p class=\\\"no\\\">No.\")\n html.concat(file.read.chomp)\n file.close\n\n html.concat(game.url_num + \"\\\" target=\\\"_blank\\\">\" + game.score)\n\n file = File.open('/home/matt/Documents/programming/ruby/dmsw/template.3', 'rb')\n html.concat(file.read.chomp)\n file.close\n return html\nend",
"def create_html(options)\n if(options[:html_template] && options[:html_template] == :scientific) then\n\n if(options[:language] && options[:language] == :english) then\n html = '<h2>Academic Interests<\\/h2>\\r\\n' +\n '<p>Add information about academic fields of interest.<\\/p>\\r\\n' +\n '<h2>Teaching<\\/h2>\\r\\n' +\n '<ul>\\r\\n' +\n ' <li><Link to programme of study/course><\\/li>\\r\\n' +\n ' <li><Link to programme of study/course><\\/li>\\r\\n' +\n ' <li>...<\\/li>\\r\\n' +\n '<\\/ul>\\r\\n' +\n '<h2>Higher education and employment history<\\/h2>\\r\\n' +\n '<p>Brief introduction to previous education and employment.<\\/p>\\r\\n' +\n '<h2>Honoraria<\\/h2>\\r\\n' +\n '<ul>\\r\\n' +\n ' <li><Name of prize and (if applicable) link 1><\\/li>\\r\\n' +\n ' <li><Name of prize and (if applicable) link 2><\\/li>\\r\\n' +\n ' <li>...<\\/li>\\r\\n' +\n '<\\/ul>\\r\\n' +\n '<h2>Appointments<\\/h2>\\r\\n' +\n '<ul>\\r\\n' +\n ' <li><Title and (if applicable) link 1><\\/li>\\r\\n' +\n ' <li><Title and (if applicable) link 2><\\/li>\\r\\n' +\n ' <li>...<\\/li>\\r\\n' +\n '<\\/ul>\\r\\n' +\n '<h2>Cooperation<\\/h2>\\r\\n' +\n '<p> <\\/p>'\n else\n html = '<h2>Faglige interesser<\\/h2>\\r\\n' +\n '<p>Her kan du skrive om faglige interesser.<\\/p>\\r\\n' +\n '<h2>Undervisning<\\/h2>\\r\\n<p>' +\n '<Lenke til studieprogram/emne> <br />\\r\\n' +\n '<Lenke til studieprogram/emne> <br />\\r\\n...<\\/p>\\r\\n' +\n '<h2>Bakgrunn<\\/h2>\\r\\n' +\n '<p>Kort om tidligere arbeidserfaring og utdanning<\\/p>\\r\\n' +\n '<h2>Priser<\\/h2>\\r\\n' +\n '<p><Navn og eventuelt lenke til pris 1> <br />\\r\\n' +\n '<Navn og eventuelt lenke til pris 2> <br />\\r\\n' +\n '...<\\/p>\\r\\n' +\n '<h2>Verv<\\/h2>\\r\\n<p>' +\n '<Navn og eventuelt lenke til verv 1> <br />\\r\\n' +\n '<Navn og eventuelt lenke til verv 2> <br />\\r\\n...' +\n '<\\/p>\\r\\n' +\n '<h2>Samarbeid<\\/h2>\\r\\n' +\n '<p> <\\/p>'\n end\n else\n\n if(options[:language] && options[:language] == :english) then\n html = '<h2>Tasks performed<\\/h2>\\r\\n' +\n '<p>Add information about job duties, as a short text or a bulleted list:<\\/p>' +\n '\\r\\n<ul>\\r\\n' +\n ' <li><Task 1><\\/li>\\r\\n' +\n ' <li><Task 1><\\/li>\\r\\n' +\n ' <li>...<\\/li>\\r\\n' +\n '<\\/ul>\\r\\n' +\n '<h2>Background<\\/h2>\\r\\n' +\n '<p>Add information about previous education and employment.<\\/p>'\n else\n html = '<h2>Arbeidsområder<\\/h2>\\r\\n' +\n '<p>Her kan du skrive om arbeidsområder, ' +\n 'enten som kort tekst eller som listepunkter:</p>' +\n '\\r\\n' +\n '<ul>\\r\\n' +\n ' <li><Arbeidsområde 1></li>\\r\\n' +\n ' <li><Arbeidsområde 1></li>\\r\\n' +\n ' <li>...</li>\\r\\n' +\n '</ul>' +\n '\\r\\n' +\n '<h2>Bakgrunn</h2>\\r\\n' +\n '<p>Eventuelt kort om tidligere arbeidserfaring og utdanning.</p>'\n end\n end\n return html\n end",
"def generate_html_and_make_pdf(folder, html_content, html_name, pdf_name, pdf_options)\n generate_html(folder, html_content, html_name)\n convert_html_to_pdf(folder, html_name, pdf_name, pdf_options)\n end",
"def build_html\r\n fetch_produce_items\r\n set_prices\r\n set_categories\r\n\r\n @monday = date_of_next('Monday')\r\n @grouped_items = @items.group_by(&:category)\r\n\r\n File.open(HTML_OUT, 'wb') do |f|\r\n f << template.render(self)\r\n end\r\nend",
"def cut_html\n if not @layed\n raise 'cannot build. miter not loaded. use Miter#lay first.'\n end\n return html_build_table(@main)\n end",
"def to_md\n @md ||= [\n \"[🔙 🏡](#{project_readme_path})\",\n '',\n \"# #{title} (#{year})\",\n '',\n \"By the #{adjective} [#{author}](#{homepage})\",\n '',\n '## Links:',\n '',\n \"- [Purchase #{title}](#{purchase})\",\n '',\n '## Chapter Notes:',\n ''\n ].concat(section_md).concat(image_md).join \"\\n\"\n end",
"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 html_file\n new_or_existing_file 'hello.html', 'text/html', 1.megabyte\n end",
"def to_html\n return \"\" unless file_name\n return e if e?\n page = render.to_html\n path = File.dirname(file_path)\n # Get child content.\n # A reflexive.\n files(path).each do |file|\n doc = Document.new :base_path => self.base_path, :lang => self.lang, :indent => self.indent, :settings => self.settings, :web_path => self.web_path, :commit => self.commit, :repository => self.repository, :filename => file\n self.browsers << doc\n page += doc.to_html\n end\n dirs(path).each do |dir|\n # Plus one indent from parent. Change h[1-6] tag to h[2-7] if indent is 1.\n doc = Document.new :base_path => dir, :lang => self.lang, :indent => self.indent + 1, :settings => self.settings, :web_path => self.web_path[0..-2] + dir.gsub(self.base_path, \"\"), :commit => self.commit, :repository => self.repository\n self.childs << doc\n page += doc.to_html\n end\n page\n end",
"def make_html\n @document.encoding = 'UTF-8'\n @best_candidate = nil\n end",
"def generate_html(individual_files=false)\n return self.to_s\n end",
"def generate_html(individual_files=false)\n return self.to_s\n end",
"def mdrender\n \t@markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :autolink => true, :space_after_headers => true)\n end",
"def buildMenu\n template = File.read('_plugins/figma-menu.html.erb')\n result = ERB.new(template).result(binding)\n\n open(\"_includes/figma-menu.html\", \"wb\") { |file|\n file.write(result)\n file.close\n }\n\n end",
"def html_page\n <<-END.gsub(/^\\s+/, '')\n <html><head>\n <title>Why Fixturing Is Annoying</title>\n <script src='/app-ui.js'></script>\n </head>\n <body class=\"webapp\">\n <div class=\"app-content-holder\"></div>\n </body></html>\n END\n end",
"def to_html\n @markdown_class.new(@markdown).to_html\n end",
"def genHTMLMessage(title: \"\", headline: \"\", msg: \"\", template: $MU_CFG['html_template'], extra_vars: {})\n logo_url = \"/cloudamatic.png\"\n page = \"<img src='#{logo_url}'><h1>#{title}</h1>#{msg}\"\n vars = {\n \"title\" => title,\n \"msg\" => msg,\n \"headline\" => headline,\n \"logo\" => logo_url\n }.merge(extra_vars)\n if !template.nil? and File.exist?(template) and File.readable?(template)\n page = Erubis::Eruby.new(File.read(template)).result(vars)\n elsif $MU_CFG.has_key?('html_template') and\n File.exist?($MU_CFG['html_template']) and\n File.readable?($MU_CFG['html_template'])\n page = Erubis::Eruby.new(File.read($MU_CFG['html_template'])).result(vars)\n elsif File.exist?(\"#{$MU_CFG['libdir']}/modules/html.erb\") and\n File.readable?(\"#{$MU_CFG['libdir']}/modules/html.erb\")\n page = Erubis::Eruby.new(File.read(\"#{$MU_CFG['libdir']}/modules/html.erb\")).result(vars)\n end\n page\nend",
"def generate_html(filesystems, packages, users)\n service_status = are_services_running([\"ssh\", \"nfs\", \"http\"])\n\n html_content =\n \"\"\"\n <html><head><title>Linux box info</title></head>\n <body><table>\n <tr>\n <th>Logical Volume</th>\n <th>Mount Point</th>\n <th>Size</th>\n <th>Free</th>\n <th>FS Type</th>\n </tr>#{concatenate_html(filesystems)}\n\n <tr>\n <th>Name</th>\n <th>Version</th>\n <th>Release</th>\n <th>Architecture</th>\n <th>Description</th>\n </tr>#{concatenate_html(packages)}\n\n <tr>\n <th>Username</th>\n <th>Sudo</th>\n <th>Password expiration</th>\n </tr>#{concatenate_html(users)}\n\n <tr>\n <th>Service status</th>\n </tr>#{service_status}\n </table></body>\n </html>\n \"\"\"\n\n File.open(RESULT_FILE, 'w') { |file| file.write(html_content)}\nend",
"def generate_html\n return false if @css_file.nil? or @html.nil?\n \n css_link = @link_to_css.nil? ? @css_file : @link_to_css\n \n html = WebifyRuby::Html.new(css_link, @html)\n @html_file = html.html_file\n end",
"def to_html(md)\n Kramdown::Document\n .new(md, {input: \"GFM\"})\n .to_html\n end",
"def html\n File.read(@folder + \"/data/#{@what}.html\")\n end",
"def create_display_template_file(directory)\n html = %{<!-- Template File -->\\n\n<div class=\"myWidget\">Hello World</div>}\n\n File.open(directory, \"w\") do |f|\n f.write(html)\n end\n end",
"def build_web_page(info_hash, id_hash, id_date, id_status)\n image_counter = info_hash.length\n \n File.open('rovers_index.html', 'w') do |file|\n file.puts \"<html>\\n<head>\\n<title>Rovers Nasa!</title>\\n</head>\"\n file.puts \"<body>\\n<section class='container'>\"\n file.puts \"<h1> FOTOGRAFIAS DE LOS ROVERS DE LA NASA CON SUS CARACTERISTICAS</h1>\"\n file.puts\"<ul>\"\n image_counter.times do |i| \n file.puts \"\\t<img src='#{info_hash[i]}'width='250'>\"\n file.puts \"\\n<li><p> ID is: #{id_hash[i]}</p></li>\"\n file.puts \"<li><p>Date in Earth: #{id_date[i]}</p></li>\"\n file.puts \"<li><p> Satelite Status: #{id_status[i]}</p></li>\"\n\n end\n file.puts \"</ul>\\n</section>\\n</body>\\n<html>\"\n end\n end",
"def html_open; \"<html>\"; end",
"def defineLayoutMenu\n #puts \"Removing Old Menu and Home Layout\"\n rm_rf File.join(\"#{g('wiki_source')}\",URL_LAYOUT_DEFAULT)\n #puts \"Generating New Menu\"\n open(File.join(\"#{g('wiki_source')}\",URL_LAYOUT_DEFAULT), 'w') do |newLayout|\n newLayout.puts '\n <!doctype html><html lang=\"en\"><head><meta charset=\"utf-8\"><title>{{ page.title }}</title></head>\n <body>\n {% include style.html %}\n {% include menu.html %}\n '\n oldUnder=-1\n File.foreach(File.join(\"#{g('wiki_source')}\",URL_MENU_FILE)) do |line|\n currentUnder = count_em(line,\"-\")\n #Fils du courant\n if(currentUnder>oldUnder)\n if(oldUnder==-1)\n newLayout.puts '\n <div class=\"w3-row-padding w3-padding-64 w3-container\">\n <div>\n <div class=\"w3-quarter\" style=\"width:260px\">\n\t\t<nav class=\"w3-bar-block w3-collapse w3-large w3-theme-l5 w3-animate-left w3-small w3-round w3-blue\" style=\"z-index:3;margin-left:10px\" id=\"mySidebar\">\n <div class=\"w3-medium w3-text-white w3-margin-left\" style=\"font-weight:bold\"><div>'\n else\n newLayout.puts \" <div id='sub' class=' w3-padding-small w3-bar-block w3-small'>\"\n end\n oldUnder=currentUnder\n else\n #Père du courant\n if(currentUnder<oldUnder)\n loop do \n newLayout.puts \" </div>\"\n oldUnder = oldUnder -1\n break if oldUnder==currentUnder\n end\n end\n end\n fileWithName = File.join(\"#{g('wiki_dest')}\",\"/\"+line.gsub(\"-\",\"\")).gsub(\"\\n\",\"\")\n title=line\n if(File.exists?(fileWithName+\".md\"))\n File.foreach(fileWithName+\".md\") do |row|\n if(row.include? \"title:\")\n title = row\n break\n end\n end \n newLayout.puts \"<a href='/\"+fileWithName+\"'>\"+title.gsub(\"title: \",\"\")+\"</a><br/>\"\n else\n newLayout.puts \"\"+title.gsub(\"-\",\"\")+\"\"\n end\n end\n newLayout.puts '</div></div></nav></div>\n <div class=\"w3-threequarter\">\n {{ content }}\n </div>\n </div>\n </div>\n </body></html>'\n end\n \n \nend",
"def create_summary\r\n puts \"Creating a summary...\"\r\n #@lists.disp_summary\r\n create_html_summary\r\n file = File.open('test.html','w')\r\n file << @html\r\n file.close\r\n end",
"def html\n Markdown.render(self.content)\n end",
"def html\n Markdown.render(self.content)\n end",
"def generate_content(section, topic)\n \tbegin\n \t\t@content = Kramdown::Document.new(File.read('data/docs/i2x_' + section + '_' + topic + '.md'), :toc_levels => '1').to_html\n \trescue\n \tend\n \t@content\n end",
"def contents()\n html = Nokogiri::HTML(@markdown_document.to_html())\n\n # Fixup refs to other markdown documents\n html.css(\"a\").each do |anchor|\n anchor[\"href\"] = anchor[\"href\"].sub(%r{\\.md$}, \".html\")\n end\n\n # Since we transform device-specific $device/README.md pages into\n # discrete $device.html, we need to fixup cross-linking into its namespace\n # This could be generalized some more, to be fixed once we have other internal links to mismatched README.md/index.html locations.\n if File.dirname(relative_output) == \"devices\"\n html.css(\"a\").each do |anchor|\n if anchor[\"href\"].match(%r{\\.\\./[^\\.]+$})\n anchor[\"href\"] = anchor[\"href\"].sub(%r{\\.\\./}, \"devices/\") + \".html\"\n end\n end\n end\n\n # Since Nokogiri produces a complete document from our fragment, we\n # have to pick only what's in the body; so strip the body added tags and higher-up tags.\n html\n .at_css(\"body\").to_s()\n .sub(%r{^<body>}, \"\").sub(%r{</body>$}, \"\")\n end",
"def writeMarkdown(doc, page)\n\n layers = page[\"children\"].reverse\n pagetitle = page[\"name\"]\n blocks = []\n\n # Let's get the text layers\n text = layers.select do |layer|\n layer[\"type\"] === \"TEXT\"\n end\n\n # Let's get only the frames\n frames = layers.select do |layer|\n layer[\"type\"] === \"FRAME\"\n end\n \n # let's build this\n frames.each do |frame|\n ftitle = self.showTitle?(frame[\"name\"]) ? frame[\"name\"] : nil\n fimage = self.getFrameImage(doc, page[\"name\"], frame)\n ftext = self.getFrameText(text, frame[\"name\"])\n\n blocks.push([ftitle, \"/#{@assetpath}/#{fimage}\", ftext])\n end\n\n\n # Do we have a summary?\n summary = text.select do |layer|\n layer[\"name\"] == \"_summary.md\"\n end\n\n summary = summary.size > 0 ? summary.first[\"characters\"] : nil\n\n # Do we have a tags?\n tags = text.select do |layer|\n layer[\"name\"] == \"_tags\"\n end\n\n tags = tags.size > 0 ? tags.first[\"characters\"] : nil\n menutag = !tags.nil? ? tags.split(\",\").first : nil\n\n \n # Export markdown from erb template\n filename = \"#{doc[\"document\"].parameterize}-#{pagetitle.parameterize}\"\n template = File.read('_plugins/figma-template.md.erb')\n result = ERB.new(template).result(binding)\n\n open(\"#{@pagespath}/#{filename}.md\", \"wb\") { |file|\n file.write(result)\n file.close\n }\n\n [pagetitle, filename, menutag]\n end",
"def markdownToHTML(markdown)\n output = \"\"\n IO.popen($mmdPath, \"w+\") do |f|\n f.print markdown\n f.close_write\n output = f.gets(nil)\n end\n return output\nend",
"def head()\n head = '<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <link rel=\"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css\" integrity=\"sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z\" crossorigin=\"anonymous\">\n <title>Informacion Rover en Marte</title>\n </head>\n <body class=\"container\">'\n \n return head\n \n end",
"def create_page\n @outfile.puts <<'EOF'\n<!DOCTYPE html>\n<html>\n <head>\n <title>Fun Fun Fun</title>\n <meta charset=\"utf-8\">\nEOF\n\n include_stylesheets\n include_javascript\n add_data(@batch)\n @outfile.puts <<'EOF'\n </head>\n <body>\n <svg class=\"chart\">\n </svg>\n </body>\n</html>\nEOF\n end",
"def html_to_markdown\n html_decoded = ConverterMachine.html_markdown(self)\n\n # Update the work.\n unless self.update_attributes!(file_content_md: html_decoded)\n errors.add(\"There was an error updating MD for work id: #{self.id}\")\n end\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 create_empty_page(p)\n cli.say 'Creating project page'\n FileUtils.mkdir_p(browse_file(p, '.'))\n %w[favicon-32.png style.css].each do |i|\n FileUtils.cp(template_file(i), browse_file(p, i))\n end\n write_file(p, 'about.html') do\n build_from_template('about.html', citation: MiGA::MiGA.CITATION)\n end\n end",
"def write( destination=nil )\n\t\tstart = Time.now\n\t\t\n\t\tsource = @bundle.source\n\t\t@html_path = destination || File.dirname(source)/\"#{File.basename source}_html\"\n\t\tFileUtils.rm_rf(@html_path) if File.exists?(@html_path)\n\t\tFileUtils.mkdir(@html_path)\n\t\t\n\t\tmaster_templates = DocuBot::TEMPLATE_DIR\n\t\tsource_templates = source/'_templates'\n\t\tmaster_root = master_templates/'_root'\n\t\tsource_root = source_templates/'_root'\n\t\t\n\t\t# Copy any files found in the source directory that weren't made into pages\n\t\t@bundle.extras.each do |file|\n\t\t\tFileUtils.mkdir_p( @html_path / File.dirname( file ) )\n\t\t\tFileUtils.cp( source / file, @html_path / file )\n\t\tend\n\t\t\n\t\t# Copy files from template to root of destination\n\t\t# Record these as extras so that the CHMWriter can access them\n\t\tDir.chdir @html_path do\n\t\t\texisting_files = Dir[ '*' ]\n\t\t\tFileUtils.copy( Dir[ master_templates/'_root'/'*' ], '.' )\n\t\t\tFileUtils.copy( Dir[ source_templates/'_root'/'*' ], '.' )\n\t\t\tnew_files = Dir[ '*' ] - existing_files\n\t\t\t@bundle.extras.concat( new_files )\n\t\tend\n\t\t\n\t\tDir.chdir @html_path do\n\t\t\to = Object.new\n\t\t\t\n\t\t\t# Write out every page\n\t\t\ttop = File.exists?( source_templates/'top.haml' ) ? source_templates/'top.haml' : master_templates/'top.haml'\n\t\t\ttop = Haml::Engine.new( IO.read( top, encoding:'utf-8' ), HAML_OPTIONS )\n\t\t\t@bundle.toc.descendants.each do |node|\n\t\t\t\tnext if node.anchor\n\t\t\t\t\n\t\t\t\tcontents = node.page.to_html\n\t\t\t\ttemplate = node.page.template # Call page.to_html first to ensure page.template is set\n\n\t\t\t\tcustom_js = \"#{template}.js\"\n\t\t\t\tcustom_js = nil unless File.exists?( source_root/custom_js ) || File.exists?( master_root/custom_js )\n\t\t\t\t\n\t\t\t\tcustom_css = \"#{template}.css\"\n\t\t\t\tcustom_css = nil unless File.exists?( source_root/custom_css ) || File.exists?( master_root/custom_css )\n\t\t\t\t\n\t\t\t\tvariables = {\n\t\t\t\t\t:page => node.page,\n\t\t\t\t\t:contents => contents,\n\t\t\t\t\t:global => @bundle.global,\n\t\t\t\t\t:root => node.page.root,\n\t\t\t\t\t:breadcrumb => node.ancestors,\n\t\t\t\t\t:custom_js => custom_js,\n\t\t\t\t\t:custom_css => custom_css\n\t\t\t\t}\t\t\t\t\n\t\t\t\thtml = top.render( o, variables )\n\t\t\t\tFileUtils.mkdir_p( File.dirname( node.file ) )\n\t\t\t\tFile.open( node.file, 'w' ){ |f| f << html }\n\t\t\tend\n\n\t\t\tFile.open( 'glossary-terms.js', 'w' ){ |f| f << @bundle.glossary.to_js }\n\t\tend\n\t\t\n\t\tputs \"...%.2fs to write the HTML\" % (Time.now - start)\n\tend",
"def write_file\n\n File.open(\"rebuild.html\", \"w\") do |file|\n @write_array.each do |tags_and_text|\n file.write tags_and_text\n end\n end\n\n end",
"def read_html\n array = nodes.to_a\n array.each_with_index do |node, index|\n header = (index.modulo(10) == 0) ? \"<h2>!!!!!SLOW DOWN AND ENUNCIATE!!!!!</h2>\" : \"\"\n anchor = \"<a id=section_#{index} href=/pages/#{self.id}/edit?section=#{index}>#{index}</a>\"\n type = nodes.at(index).name\n array[index]=nodes.at(index).replace \"#{header}<#{type}>#{anchor} #{nodes.at(index).inner_html}</#{type}>\"\n end\n array.map(&:to_html).join\n end",
"def create_html_header(diff_file)\n diff_file.puts %{<!DOCTYPE html>}\n diff_file.puts %{<html>}\n diff_file.puts %{<head>}\n diff_file.puts %{<meta charset=\"utf-8\" />}\n diff_file.puts %{<title></title>}\n diff_file.puts %{</head>}\n diff_file.puts %{<body>}\n end",
"def to_html \n generator.generate\n end",
"def generate\n # Ensure site is a directory\n FileUtils.mkdir_p site_path\n\n # If there is more than one language, then we need to create\n # multiple files, one for each language.\n if languages.size >= 1\n\n # Enter the most dastardly loop. \n # Create a View::Document with sections only containing the \n # specified language. \n languages.map do |language|\n document_views = documents.map do |document|\n document.sections = document.sections.map do |section|\n section.examples = section.examples.select {|ex| ex.language.blank? || ex.language == language }\n section\n end\n\n Views::Document.new document\n end\n\n # Use Mustache to create the file\n page = Page.new\n page.title = title\n page.logo = File.basename logo if logo\n page.documents = document_views\n\n File.open(\"#{site_path}/#{language.underscore}.html\", \"w\") do |file|\n file.puts page.render\n end\n end\n\n # copy the default language to the index and were done!\n FileUtils.cp \"#{site_path}/#{default.underscore}.html\", \"#{site_path}/index.html\"\n\n # There are no languages specified, so we can just create one page\n # using a collection of Document::View.\n else \n document_views = documents.map do |document|\n Views::Document.new document\n end\n\n page = Page.new\n page.title = title\n page.logo = File.basename logo if logo\n page.documents = document_views\n\n File.open(\"#{site_path}/index.html\", \"w\") do |file|\n file.puts page.render\n end\n end\n\n # Copy the logo if specified\n FileUtils.cp \"#{logo}\", \"#{site_path}/#{File.basename(logo)}\" if logo\n\n # Copy all the stylesheets into the static directory and that's it!\n resources_path = File.expand_path \"../resources\", __FILE__\n\n FileUtils.cp \"#{resources_path}/style.css\", \"#{site_path}/style.css\"\n FileUtils.cp \"#{resources_path}/syntax.css\", \"#{site_path}/syntax.css\"\n end",
"def to_html\n determine_markdown_renderer\n @markdown.to_html\n end",
"def html\n #this is a way to create longer strings in place easily.\n x = <<DELIM\n<html>\n<body>\n#{yield}\n</body>\n</html>\nDELIM\nend",
"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 write_page\n contents = [people,projects,events].inject({}) { |x,y| x.merge(y) }\n File.open('index.html','w') do |f|\n f.write(@template.render(contents))\n end\n end",
"def trees_to_html(trees)\n # the first part of the html skeleton\n result = '\n <!doctype html>\n <html>\n <head><title>Green Thumb Nursery </title></head>\n <body>\n <h1>Catalog</h1>\n <table>\n <tr>\n <td>Type of tree</td>\n <td>Size of the tree</td>\n <td>Price of the tree</td>\n </tr>\n '\n\n # for each record, add it to the html\n tree_parser(trees).each do |type, size, price|\n result << \"\n <tr>\n <td>#{type}</td>\n <td>#{size}</td>\n <td>#{price}</td>\n </tr>\n \"\n end\n\n # close off the html\n result << '\n </table>\n </body>\n </html>\n '\n\n result\nend",
"def files_to_page\n insert_to_page('div', html)\n insert_to_page('script', js, false)\n insert_to_page('style', style, false)\n end",
"def prepare_html(content , page_type = 'N')\n #header\n 1.upto 5 do |no| content.gsub! /^(={#{no}}) (.*) (={#{no}})/ ,\"\\nh#{no+1}. \\\\2\\n\" end\n 1.upto 5 do |no| content.gsub! /^(={#{no}}) (.*)/ ,\"\\nh#{no+1}. \\\\2\\n\" end\n\n #list\n 1.upto 5 do |no| content.gsub! /^([ ]{#{no}})(\\*) ?(.*)/ ,\"#{'*'*no} \\\\3\" end\n 1.upto 5 do |no| content.gsub! /^([ ]{#{no}})(#) ?(.*)/ ,\"#{'#'*no} \\\\3\" end\n #content.gsub! /(\\*) v (.*)/ , \"\\\\1 -\\\\2-\"\n \n #block\n content.gsub! /^\\{\\{\\{/ , \"<pre>\" ; content.gsub! /^\\}\\}\\}/ , \"</pre>\"\n content.gsub! /^\\{\\{\\\"/ , \"<blockquote>\" ; content.gsub! /^\\\"\\}\\}/ , \"</blockquote>\"\n content.gsub! /^\\{\\{\\[/ , \"<math>\" ; content.gsub! /^\\]\\}\\}/ , \"</math>\"\n \n #concept & property\n content.gsub! /\\[\\[(.*?):=(.*?)\\]\\]/ , '\\1(\\2)'\n #content.gsub! /\\[\\[(.*?)[<>=].*?\\]\\]/ , \\\"\\\\1\\\":#{APP_ROOT}/page/\\\\1\" \n content.gsub! /\\[\\[(.*?)\\]\\]/ , \"\\\"\\\\1\\\":#{APP_ROOT}/entry/\\\\1\" if defined?(APP_ROOT)\n\n #comment\n content.gsub! PTN_COMMENT , \"\\\\1\"\n content.gsub! PTN_COMMENT_MULTILINE , \"\"\n if defined? SystemConfig\n SystemConfig.site_info.each do |e|\n content.gsub! /(\\s)#{e[1]}:/ , \"\\\\1#{e[2]}\"\n end\n content.gsub! SystemConfig.ptn_url_unnamed , \"\\\\1\\\"\\\\2\\\":\\\\2\"\n content.gsub! \"%ROOT%\" , APP_ROOT\n end\n \n #Process by page_type\n case page_type\n when 'N'\n math_list = content.scan( PTN_MATH ) ; math_list.each do |m|\n #content.gsub! \"$#{m[0]}$\" , latex_render(m[0])\n content.gsub! \"$#{m[0]}$\" , get_math_img(m[0])\n end\n math_block_list = content.scan( PTN_MATH_BLOCK ) ; math_block_list.each do |m|\n #content.gsub! \"#{m[0]}\" , latex_render(m[0])\n content.gsub! \"#{m[0]}\" , get_math_img(m[0])\n end\n when 'S'\n menu_list = content.scan( PTN_MENU ) ; menu_list.each do |m|\n menu_title = m[0] ; menu_target = m[1] ; menu_str = \"M{{#{menu_title}|#{menu_target}}}\"\n #$lgr.info \"#{menu_title} / #{menu_target}\"\n result = link_to_remote(menu_title , :url => { :action => 'menu' , :query => CGI.escape(menu_target) })\n content.gsub! menu_str , result\n end\n end\n #$lgr.info \"[prepare_html] \"+content\n query_list = content.scan( PTN_QUERY ) ; query_list.each do |q|\n query_type = q[0] ; query_content = q[1] ; query_str = \"#{query_type}{{#{query_content}}}\"\n case query_type\n when 'P'\n result = eval(\"find_page :display=>'|@title|@tags|@created_at|' ,\" + query_content )\n result = result.join(\"\\n\") if result.class == Array\n result = \"|_.Title|_.Tag|_.CreatedAt|\\n\"+result if query_content.scan(/:display/).size == 0\n #$lgr.info \"[prepare_html] Query : #{query_str} , #{result}\"\n content.gsub! query_str , result\n end\n end\n #content.gsub! SystemConfig.ptn_url , \"\\\"\\\\0\\\":\\\\0\"\n #???content.gsub!(SystemConfig.ptn_site) \"\\\"#{ApplicationController.SystemConfig(\\\\0)}\\\":\\\\0\"\n content\n end",
"def generate_html()\n html = \"\"\n \n puts \"Generating HTML ...\"\n \n s3 = RightAws::S3.new(S3_ID, S3_KEY)\n bucket = s3.bucket(S3_BUCKET)\n \n thumb = ''\n original = ''\n large = ''\n bucket.keys.each do |key|\n if key.full_name.include?(IMG_DIR)\n if key.full_name.include?(IMG_THUMB)\n thumb = S3_PUBLIC + key.full_name \n elsif key.full_name.include?(IMG_FINAL)\n large = S3_PUBLIC + key.full_name\n else\n original = S3_PUBLIC + key.full_name\n end \n \n if thumb != '' && large != '' && original != ''\n html += HTML_ITEM_PREFIX \n html += '<img class=\"thumbnail\" src=\"' + thumb + '\" rev=\"' + original + '\" rel=\"' + large + '\" />' \n html += HTML_TOGGLE + HTML_ITEM_SUFFIX \n thumb = ''\n original = ''\n large = '' \n end\n end\n end\n \n File.open(HTML_FILE, 'a') { |f| f.write(html) } \nend",
"def get_html_template(passed, failed, env, view_build_link, view_allure_link)\n file = File.read('features/data/email_template.html')\n email_template = Nokogiri::HTML.fragment(file)\n email_template.at_css('#passed').content += passed.to_s\n email_template.at_css('#failed').content += failed.to_s\n email_template.at_css('#env').content += env\n email_template.at_css(\"#circleci\")['href'] = view_build_link\n email_template.at_css(\"#allure\")['href'] = view_allure_link\n email_template.to_html\nend",
"def create_html_file(filename, template, data)\n File.open(filename, \"w+:utf-8\") do |file|\n file << ERB.new(File.read(template)).result(data.to_binding)\n end\n end",
"def create\r\n html=params[:page][:html]\r\n @page = Page.new(params[:page])\r\n respond_to do |format|\r\n if @page.save\r\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\r\n format.json { render json: @page, status: :created, location: @page }\r\n target = \"#{Rails.public_path}/#{@page.project_id}/#{@page.page_name}.html\"\r\n if !File.directory?(\"#{Rails.public_path}/#{@page.project_id}\")\r\n Dir.mkdir(\"#{Rails.public_path}/#{@page.project_id}\")\r\n Dir.mkdir(\"#{Rails.public_path}/#{@page.project_id}/images\")\r\n end\r\n File.open(target, \"w+\") do |f|\r\n f.write(html)\r\n end\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @page.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def generate_contents\n template_file = @template_dir + 'contents.hhc.rhtml'\n\n out_file = @outputdir + \"contents.hhc\"\n debug_msg \" rendering #{out_file}\"\n render_template template_file, out_file do |io| binding end\n end",
"def create_html_summary\r\n puts \"Creating HTML...\"\r\n @dmds = @lists.last\r\n @html = '<html>'\r\n @html += '<head><link rel=\"stylesheet\" href=\"styles.css\"></head>'\r\n @html += '<body>'\r\n @html += \"<h3>Actions</h3>\\n<ul>\"\r\n @html += actions_html\r\n @html += \"</ul>\\n\"\r\n #@html += \"<h3>Prios diff</h3>\\n<ul>\"\r\n #@html += prio_diff_html\r\n #@html += \"</ul>\\n\"\r\n #@html += \"<h3>Closed DMD</h3>\\n<ul>\"\r\n #@html += closed_dmd_html\r\n #@html += \"</ul>\\n\"\r\n @html += \"<h3>Open DM</h3>\"\r\n ano, evo = sas_report\r\n @html += \"<table><tr><td>Nature of changes</td><td>P0</td><td>P1</td><td>P2/P3</td><td>Total</td></tr>\r\n <tr><td>Anomalies</td><td>#{ano['0']}</td><td>#{ano['1']}</td><td>#{ano['2']+ano['3']}</td><td>#{ano['0']+ano['1']+ano['2']+ano['3']}</td></tr>\r\n <tr><td>Evolutions</td><td>#{evo['0']}</td><td>#{evo['1']}</td><td>#{evo['2']+evo['3']}</td><td>#{evo['0']+evo['1']+evo['2']+evo['3']}</td></tr>\r\n <tr><td>Total</td><td>#{ano['0']+evo['0']}</td><td>#{ano['1']+evo['1']}</td><td>#{ano['2']+ano['3']+evo['2']+evo['3']}</td><td>#{ano['0']+evo['0']+ano['1']+evo['1']+ano['2']+ano['3']+evo['2']+evo['3']}</td></tr>\r\n <table>\"\r\n count = prios_hash\r\n @html += \"<h3>Non analysed DMD, by priority</h3><ul>\\n\"\r\n @html += \"<b>Stats</b><ul>TBD: #{count['TBD']}<br/>P0: #{count['0']}<br/>P1: #{count['1']}<br/>P2: #{count['2']}<br/>P3: #{count['3']}<br/></ul>\\n\"\r\n @html += \"#{priority_html(priority_dmd)}</ul>\\n\"\r\n @html += \"<h3>Evo</h3>\\n<ul>#{priority_html(priority_evo)}</ul>\\n\"\r\n @html += \"<h3>Analysed but not batched DMD</h3>\\n<ul>#{analysed_html(analysed_dmd)}</ul>\\n\"\r\n @html += \"<h3>Has workload but not 'analysed' DMD</h3>\\n<ul>#{analysed_html(workload_dmd)}</ul>\\n\"\r\n @html += \"<h3>Decided DMD</h3>\\n<ul>#{decided_html(decided_dmd)}</ul>\\n\"\r\n @html += \"<h3>Last updated</h3>\\n<ul>#{last_updated_html(last_updated_dmd)}</ul>\\n\"\r\n @html += '</body>'\r\n @html += '</html>'\r\n end",
"def create(p)\n puts \"Creating page #{p}\"\n Dir.mkdir p unless File.exists? p\n Content.new(\"#{@dir}\", @extension).page p\n end",
"def generate_html(record)\n \"<!DOCTYPE html>\n <html>\n <head>\n <meta charset=\\\"utf-8\\\">\n <link rel=\\\"stylesheet\\\" href=\\\"./style.css\\\" />\n <script type=\\\"application/javascript\\\" src=\\\"./click_handlers.js\\\"></script>\n <title></title>\n </head>\n <body>\n #{main_text(record)}\n </body>\n </html>\"\nend",
"def convert_markdown\n self.html_content = Raptor::Markdown.render(self.content)\n end",
"def build\n html = []\n scripts.each do |script|\n code = File.read(script)\n html << %[<div class=\"file\" id=\"#{script}\"><pre>]\n html << highlight(code)\n html << %[</pre></div>]\n end\n text = html.join(\"\\n\")\n text = interlink(text)\n text = garnish(text)\n text\n end",
"def generate_HTML(loc_hier, out_dir)\n loc_hier.each do |loc|\n id = loc[:id]\n loc_name = loc[:location]\n\n generate_HTML(loc[:sub_loc], out_dir) unless loc[:sub_loc].empty?\n\n loc_content = $destinations.elements[\"destination[@atlas_id='#{id}']\"]\n content = ''\n\n loc_content.elements.each do |el|\n content += '<p>'\n section_title = el.elements[1].name.split('_').each(&:capitalize!).join(' ')\n content += \"<h2>#{section_title}</h2>\"\n content += '<p>'\n content_string = el.elements[1].elements[1].cdatas[0].to_s\n content += content_string.gsub(\"\\n\\n\\n\", '<br><p>').gsub(\"\\n\\n\", '<p>').gsub(\"\\n\", '<br>')\n content += '<p>'\n end\n create_HTML_file(loc_name, content, out_dir)\n end\nend",
"def to_html!\n locales[\"locales\"].each do |locale_code|\n # contrary to what is said on https://developer.zendesk.com/rest_api/docs/core/locales\n # we do not get an ID, so I'm inventing one that is unique per locale\n locale = {\"name\" => locale_code, \"id\" => locale_code.chars.map {|ch| ch.ord - 'A'.ord + 10}.join}\n @raw_data[:locales] << locale\n\n categories(locale_code)['categories'].each do |category|\n log(category['name'].upcase)\n @raw_data[:categories] << category\n\n sections(locale_code, category['id'])['sections'].each do |section|\n @raw_data[:sections] << section\n log(\" #{section['name']}\")\n\n articles(locale_code, section['id'])['articles'].each do |article|\n log(\" #{article['name']}\", :standard)\n\n article_dir = dir_path(locale, category, section, article)\n file_path = \"#{article_dir}index.html\"\n article['backup_path'] = file_path\n @raw_data[:articles] << article\n\n File.open(file_path, \"w+\") { |f| f.puts article_html_content(article) }\n\n article_attachments(article['id'])['article_attachments'].each do |article_attachment|\n @raw_data[:article_attachments] << article_attachment\n # optimization, do not download attachment when already present (we could check based on the id)\n download_attachment!(article_attachment, article_dir)\n end\n end\n end\n end\n end\n end",
"def create_layout(content, attributes, identifier)\n # Get filenames\n base_path = 'layouts' + identifier[0..-2]\n meta_filename = base_path + '.yaml'\n content_filename = base_path + '.html'\n\n # Notify\n Nanoc3::NotificationCenter.post(:file_created, meta_filename)\n Nanoc3::NotificationCenter.post(:file_created, content_filename)\n\n # Create files\n FileUtils.mkdir_p(File.dirname(meta_filename))\n File.open(meta_filename, 'w') { |io| io.write(YAML.dump(attributes.stringify_keys)) }\n File.open(content_filename, 'w') { |io| io.write(content) }\n end",
"def content\n div :id => 'doc3' do\n div :id => 'hd' do\n render_top_line\n h1 @page_title || 'Missing :page_title' \n end\n div :id => 'bd' do\n render_body\n end\n div :id => 'ft' do\n render_footer\n end\n end\n end",
"def generate_html\n to_return = \"\"\n\n @child_objects.each do |child_object|\n to_return += child_object.generate_html\n end\n\n return to_return\n end",
"def content\n content = '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" ' +\n '\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">' +\n '<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>' + title + '</title>' +\n ' <link href=\"http://www.uio.no/profil/kupu/kupucontentstyles.css\" type=\"text/css\" rel=\"stylesheet\"/>' +\n '</head><body>'\n if(body)\n content += body\n end\n content += '</body></html>'\n end",
"def designer\r\n @page = Page.find(params[:id])\r\n data = File.read(\"#{Rails.public_path}/#{@page.project_id}/#{@page.page_name}.html\")\r\n @page.update_attribute(:html , data)\r\n render 'designer'\r\n end",
"def to_html\n build\n end",
"def html_from_template(filename, title, html)\n\t\tlevels = filename.count(\"/\") - 1\n\t\tcss_link = \"./\" + (\"../\" * levels) + \"css/style.css\"\n @template.result(:title => title, :css_link => css_link, :content => html)\n\tend",
"def generate\n verify_path\n \n self.layouts.each {|layout| layout.write_file}\n self.pages.each {|page| page.write_file}\n \n Webby.site.content_dir = self.content_dir\n Webby.site.layout_dir = self.layout_dir\n Webby.site.template_dir = self.template_dir\n Webby.site.output_dir = self.output_dir\n \n Merb.logger.debug \"content_dir: #{Webby.site.content_dir}\"\n Merb.logger.debug \"layout_dir: #{Webby.site.layout_dir}\"\n Merb.logger.debug \"template_dir: #{Webby.site.template_dir}\"\n Merb.logger.debug \"output_dir: #{Webby.site.output_dir}\"\n \n # Use directory => '.' option to generate the site in output_dir\n Webby.site.page_defaults = {'layout' => self.default_layout.relative_path,\n 'directory' => '.',\n 'collision' => :force}\n \n Merb.logger.debug \"page_defaults: #{Webby.site.page_defaults}\" \n # returns nil if success \n # Webby::Builder.run\n Webby::Builder.run :rebuild => true\n end",
"def content\n require theme_path\n this = self # needed because Markaby is based on `instance_eval`\n @builder = Trinity::Builder.new(:indent => 2)\n @builder.instruct!\n @builder.declare! :DOCTYPE, :html, :PUBLIC, \"-//W3C//DTD XHTML+RDFa 1.0//EN\", \"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd\"\n @builder.html(:xmlns => 'http://www.w3.org/1999/xhtml') do\n head { this.render_html_head }\n body { this.render_html_body }\n end\n @builder.to_s\n end",
"def produce_moments_files(seconds,src_path,out_path,htmlfilename,resizewidth)\n c = 0\n moments = create_pics_moments(seconds,src_path)\n make_output_dir(out_path)\n File.open(\"#{out_path}/#{htmlfilename}\", 'a') do |htmlfile| # creates and writes html file\n #htmlfile << %&header\\n& # insert here html code before pictures\n while c < moments.size\n dir = \"#{out_path}/#{c}\" # path to output subdirectory\n rdir = dir + '/resized' # path to subdirectory with resized pictures\n make_output_dir(dir) # making output subdir\n make_output_dir(rdir) # making resized subdir\n htmlfile << %&<div class=\"images\" id=\"set#{c}\">\\n& # opening pictures set div\n moments[c].each do |pic| \n #copy_pic(pic,dir)\n resize_pic(pic,900,dir) # instead of copy_pic\n puts 'copied: ' + pic\n resize_pic(pic,resizewidth,rdir)\n htmlfile << %& <a target=\"_blank\" href=\"../_images/#{c}/#{File.basename(pic)}\"><img src=\"../_images/#{c}/resized/#{File.basename(pic)}\" alt=\"#{File.basename(pic)}\"></a>\\n& # main html\n end\n c +=1\n htmlfile << %&</div>\\n& # closing pictures set div\n end\n #htmlfile << %&footer\\n& #insert here html code after pictures\n end\nend",
"def to_html\n m = Markaby::Builder.new({}, self)\n\n m.div do\n {\n :module => 'Module:', :description => 'Description:',\n :line_number => 'Line Number:', :submitted_by => 'Submitted By:',\n :owner => 'Owner:', :ticket => 'Ticket:',\n :resolved => 'Resolved:'\n }.each do |key, value|\n h5 value\n span self.send(key).to_s\n end\n end\n end",
"def generate_dataset_page(p, d)\n data = {\n unmiga_name: d.name.unmiga_name,\n information: format_metadata(d),\n results: format_results(d)\n }\n write_file(p, \"d_#{d.name}.html\") do\n build_from_template('dataset.html', data)\n end\n end"
] |
[
"0.7052148",
"0.6775882",
"0.64302987",
"0.63986224",
"0.6344221",
"0.6278271",
"0.62523043",
"0.6219281",
"0.6187609",
"0.6187192",
"0.6144861",
"0.61413157",
"0.61411023",
"0.6118311",
"0.60868794",
"0.6044552",
"0.6028312",
"0.60194486",
"0.6008795",
"0.599306",
"0.59920955",
"0.59698516",
"0.59667134",
"0.5944709",
"0.5930931",
"0.5929369",
"0.59188026",
"0.5892165",
"0.5892072",
"0.5891487",
"0.58872753",
"0.5883624",
"0.5875383",
"0.58662564",
"0.5864748",
"0.5833865",
"0.58311826",
"0.58311826",
"0.57964414",
"0.57916796",
"0.57872784",
"0.5785481",
"0.57845044",
"0.5779598",
"0.57714844",
"0.5761021",
"0.5757676",
"0.57523465",
"0.57462496",
"0.5746023",
"0.5743773",
"0.5739295",
"0.5732915",
"0.5732915",
"0.5723243",
"0.571725",
"0.56920373",
"0.5691969",
"0.5663953",
"0.56456363",
"0.5639387",
"0.56383526",
"0.56360924",
"0.5618268",
"0.56150925",
"0.56109077",
"0.5607496",
"0.55977213",
"0.5595951",
"0.55948263",
"0.55941564",
"0.5589006",
"0.55876476",
"0.55841637",
"0.55797577",
"0.55644673",
"0.5541061",
"0.5537227",
"0.5536071",
"0.5531981",
"0.55255973",
"0.5523978",
"0.55197966",
"0.5515426",
"0.5513486",
"0.55133414",
"0.5509571",
"0.5504533",
"0.55028933",
"0.5490845",
"0.5485865",
"0.5475325",
"0.54753095",
"0.5471479",
"0.5468277",
"0.5462649",
"0.54611516",
"0.544302",
"0.5441246",
"0.5436939"
] |
0.67557853
|
2
|
Need variable in view to know if caching is enabled. Used to save javascript into cached page so that certain dynamic things are handled by clientside javascript since Rails is skipped when page caching is on TODO: better way?
|
def set_page_caching_status
if perform_caching && caching_allowed
@page_caching_active = true
else
@page_caching_active = false
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cacheable?\n true\n end",
"def cache?\n false\n end",
"def cache?\n caching && true\n end",
"def cache_on?; end",
"def cache_on?; end",
"def cacheable?\n @cacheable\n end",
"def allow_page_to_be_cached?\n return !(agent_logged_in? or current_user.is_admin?)\n end",
"def should_cache?\n false\n end",
"def write_cache?\n if site.front_page_cached and c = cache_url\n #Rails.logger.info(\"request.path:::: #{request.path}\")\n cache_page(response.body, File.join(site.cache_path, c).to_s)\n end\n end",
"def cached?; end",
"def cacheable_request?\n (request.get? || request.head?) && (request.params[:cache] != 'false')\n end",
"def is_in_cache(var)\n Rails.cache.exist?(var)\nend",
"def caching?\n @params.key?(:cache) ? @params[:cache] : @@caching\n end",
"def template_cache_configured?\n if defined?(Rails)\n defined?(ActionController::Base) && ActionController::Base.perform_caching\n else\n Rabl.configuration.perform_caching\n end\n end",
"def cached?\n options[:cache] == true\n end",
"def use_page_caching?\n (not heroku?) && page_cache_enabled_in_environment_configuration?\n\t\tend",
"def may_cache?\n may_cache_field?(headers['cache-control'])\n end",
"def cacheable?\n return false if method != :get && method != :head\n return false if cache_control.no_store?\n true\n end",
"def page_cache_enabled_in_environment_configuration?\n Rails.configuration.action_controller.perform_caching\n end",
"def cached?\n cache_path.exist?\n end",
"def cache_value?; end",
"def cached?(key)\n false\n end",
"def response_publicly_cached?\n !!(response.cache_control[:public])\n end",
"def cache_page?\n return false unless @page && Alchemy::Config.get(:cache_pages)\n pagelayout = PageLayout.get(@page.page_layout)\n pagelayout['cache'] != false && pagelayout['searchresults'] != true\n end",
"def _cache_control; end",
"def cached?\n cache_path.exist?\n end",
"def cacheable?(response)\n return false unless response.success?\n return false unless method.in? CACHEABLE_METHODS\n return false if header.cache_control && header.cache_control.include?('no-store')\n true\n end",
"def cached_file?\n Settings.documents.page_cache && File.exists?(cache_file)\n end",
"def cache_action_index?\n Rails.env.production? && site.public && !(request.format.json? || request.format.js?)\n end",
"def cached?\n !(!@cached)\n end",
"def cache_enabled?(opts)\n # only gets ever get cached\n return false unless opts[:method] == :get\n return false if opts[:cache_key].nil?\n return false unless Tml.cache.enabled?\n true\n end",
"def enabled?\n @cache_enabled\n end",
"def enabled?\n @cache_enabled\n end",
"def set_page_caching_status\n @page_caching_active = page_caching_active\n end",
"def cached?\n @rules = cached_rules if cached_rules? && caching_on?\n end",
"def no_cache\n conditionally_visible? || self[:no_cache]\n end",
"def has_js\n session[:surveyor_javascript] = \"enabled\"\n render :text => 'ok'\n end",
"def use_cache?\n super && !against_head?\n end",
"def use_cache?\n super && !against_head?\n end",
"def add_cache_control; end",
"def only_browser_can_cache(no_store = true, max_age_in_seconds = 0)\n #TODO assert input\n response.headers[\"Date\"] = timestamp\n response.headers[\"Expires\"] = \"Fri, 01 Jan 1990 00:00:00 GMT\"\n response.headers[\"Cache-Control\"] = \"private, max-age=#{max_age_in_seconds}\" + (\", no-store\" if no_store).to_s\n end",
"def cachable?\n return false if header['Vary'] and header['Vary'].include?('*')\n return false if header['Cache-Control'] and header['Cache-Control'].include?('no-store')\n\n true\n end",
"def render_page_from_cache\n if cached_page.live_exists?\n render :file => cached_page.live_path\n return true\n else\n render :text => 'Currently not in cache', :status => 503\n return false\n end\n end",
"def skip_cache?\n return true unless method.in? CACHEABLE_METHODS\n header.cache_control && header.cache_control.include?('no-cache')\n end",
"def move_to_cache\n true\n end",
"def enabled?\n @config[:caching][:enabled]\n end",
"def move_to_cache\r\n true\r\n end",
"def digest\n serve_assets == \"local_dynamic\" ? false : true \n end",
"def skip_cache?\n # Only cache production and staging environments\n # Leaving QA environments so that writers can quickly see their updates\n # And admins can approve them and bust the cache in production\n # This conditional also allows non-prod environments to test caching\n # NOTE: turn on/off development mode caching with `rake dev:cache`\n if !Rails.env.production? || ['recognizeapp.com', 'demo.recognizeapp.com'].any?{|host| Recognize::Application.config.host == host}\n # so if production or staging, check the query parameter\n ['off', false, 'false', 'no'].any?{ |off| params[:cache].to_s == off.to_s }\n else\n # Here, we're a QA server and therefore should skip cache\n return true\n end\n end",
"def using_cache\n\t\t(@modcache_invalidated != true)\n\tend",
"def disable_caching; end",
"def use_cache?(opts = {})\n return true if opts[:cache].nil?\n opts[:cache]\n end",
"def cache_query?\n false\nend",
"def cache_query?\n false\nend",
"def page_cached?(page = 1)\n cached_pages.include? page.to_s\n end",
"def should_cache?\n ctrait = controller.trait\n\n [ Global.cache_all,\n ctrait[:cache_all],\n actions_cached.map{|k,v| k.to_s}.include?(method),\n ].any?\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def cache?\n persisted?\n end",
"def no_cache? shallow_check=false\n check = @request.env['HTTP_CACHE_CONTROL'].to_s.downcase == 'no-cache'\n\n if check\n if shallow_check || Lux.env.dev?\n true\n else\n can_clear_cache ? true : false\n end\n else\n false\n end\n end",
"def cacheable?(env)\n result = false\n if (url = request_url(env)).blank?\n log(\"NO URI for request #{env.inspect}\")\n elsif cacheable_paths&.none? { |path| url.include?(path) }\n log(\"NON-CACHEABLE URI: #{url}\")\n else\n result = true\n end\n result\n end",
"def cacheable?(env)\n result = false\n if (url = request_url(env)).blank?\n log(\"NO URI for request #{env.inspect}\")\n elsif cacheable_paths&.none? { |path| url.include?(path) }\n log(\"NON-CACHEABLE URI: #{url}\")\n else\n result = true\n end\n result\n end",
"def render_fresh_page?\n must_not_cache? || stale?(\n etag: page_etag,\n last_modified: @page.published_at,\n public: !@page.restricted,\n template: \"pages/show\"\n )\n end",
"def move_to_cache\n true\n end",
"def move_to_cache\n true\n end",
"def move_to_cache\n true\n end",
"def must_not_cache?\n flash.present? || !@page.cache_page?\n end",
"def consider_caching?(path)\n return false if self.disabled\n return true if self.except.blank? && self.only.blank?\n return false if list_match?(self.except, path)\n return true if self.only.blank?\n return true if list_match?(self.only, path)\n false\n end",
"def cacheable?\n return false unless CACHEABLE_RESPONSE_CODES.include?(status)\n return false if cache_control.no_store? || cache_control.private?\n validateable? || fresh?\n end",
"def must_revalidate?\n cache_control.must_revalidate || cache_control.proxy_revalidate\n end",
"def using_local_cache?\n @use_local_cache == true\n end",
"def set_cache_control\r\n @view.headers['Cache-Control'] ||= ie_request? ? 'no-cache, must-revalidate' : ''\r\n end",
"def cached?(name, *args)\n return false if Rails.env == 'development'\n cache = Cacheable.cache[self][name.to_sym]\n return false unless cache.key?(args)\n params = cache[args]\n !(params[:force] && (params[:time] < (Time.new - params[:ttl])))\n end",
"def cache_hit?\n @gapi.cache_hit\n end",
"def cache?(key)\n auth_objects_cache.key? key\n end",
"def performing_caching?\n @config ? @config.perform_caching : Rails.application.config.action_controller.perform_caching\n end",
"def cache_control(options)\n return if !Config['production']\n\n if options[:no_cache]\n response.headers.delete('ETag')\n response.headers.delete('Last-Modified')\n response.headers.delete('Cache-Control')\n return\n end\n\n last_modified = options.delete(:last_modified)\n modified_since = env['HTTP_IF_MODIFIED_SINCE']\n last_modified = last_modified.try(:to_time) || last_modified\n last_modified = last_modified.try(:httpdate) || last_modified\n\n if options[:version]\n options[:etag] = options[:version].cache_id\n options[:last_modified] = options[:version].date\n end\n\n if User.logged_in?\n # Always private mode if user is logged in\n options[:private] = true\n\n # Special etag for authenticated user\n options[:etag] = \"#{User.current.name}-#{options[:etag]}\" if options[:etag]\n end\n\n if options[:etag]\n value = '\"%s\"' % options.delete(:etag)\n response['ETag'] = value.to_s\n response['Last-Modified'] = last_modified if last_modified\n if etags = env['HTTP_IF_NONE_MATCH']\n etags = etags.split(/\\s*,\\s*/)\n # Etag is matching and modification date matches (HTTP Spec §14.26)\n halt :not_modified if (etags.include?(value) || etags.include?('*')) && (!last_modified || last_modified == modified_since)\n end\n elsif last_modified\n # If-Modified-Since is only processed if no etag supplied.\n # If the etag match failed the If-Modified-Since has to be ignored (HTTP Spec §14.26)\n response['Last-Modified'] = last_modified\n halt :not_modified if last_modified == modified_since\n end\n\n options[:public] = !options[:private]\n options[:max_age] ||= 0\n options[:must_revalidate] ||= true if !options.include?(:must_revalidate)\n\n response['Cache-Control'] = options.map do |k, v|\n if v == true\n k.to_s.tr('_', '-')\n elsif v\n v = 31536000 if v.to_s == 'static'\n \"#{k.to_s.tr('_', '-')}=#{v}\"\n end\n end.compact.join(', ')\n end",
"def from_cache?\n @from_cache\n end",
"def cached?(key)\n not @memcache.get(key).nil?\n end",
"def has_cached_banner?\n @server.make_json_request('show.cache', tvdbid: @tvdbid)['data']['banner'] == 1\n end",
"def disk_cache_enabled; end",
"def cache_buster\n response.headers[\"Cache-Control\"] = \"no-cache, no-store, max-age=0, must-revalidate\"\n response.headers[\"Pragma\"] = \"no-cache\"\n response.headers[\"Expires\"] = \"Fri, 01 Jan 1990 00:00:00 GMT\"\n end",
"def should_attempt_cache_invalidate\n attempt_invalidate_cache = ENV['drupal.export.attempt_invalidate_cache']\n invalidate = false\n\n unless attempt_invalidate_cache.nil? || attempt_invalidate_cache.empty?\n invalidate = true if attempt_invalidate_cache =~ /true/\n end\n invalidate\n end",
"def cacheable?\n last.nil? || last.cacheable\n end",
"def cached_size?\n false\n end",
"def cache_control(options)\n return if !Config['production']\n\n if options[:no_cache]\n response.headers.delete('ETag')\n response.headers.delete('Last-Modified')\n response.headers.delete('Cache-Control')\n return\n end\n\n last_modified = options.delete(:last_modified)\n modified_since = env['HTTP_IF_MODIFIED_SINCE']\n last_modified = last_modified.try(:to_time) || last_modified\n last_modified = last_modified.try(:httpdate) || last_modified\n\n if User.logged_in?\n # Always private mode if user is logged in\n options[:private] = true\n\n # Special etag for authenticated user\n options[:etag] = \"#{User.current.name}-#{options[:etag]}\" if options[:etag]\n end\n\n if options[:etag]\n value = '\"%s\"' % options.delete(:etag)\n response['ETag'] = value.to_s\n response['Last-Modified'] = last_modified if last_modified\n if etags = env['HTTP_IF_NONE_MATCH']\n etags = etags.split(/\\s*,\\s*/)\n # Etag is matching and modification date matches (HTTP Spec §14.26)\n halt :not_modified if (etags.include?(value) || etags.include?('*')) && (!last_modified || last_modified == modified_since)\n end\n elsif last_modified\n # If-Modified-Since is only processed if no etag supplied.\n # If the etag match failed the If-Modified-Since has to be ignored (HTTP Spec §14.26)\n response['Last-Modified'] = last_modified\n halt :not_modified if last_modified == modified_since\n end\n\n options[:public] = !options[:private]\n options[:max_age] ||= 0\n options[:must_revalidate] ||= true if !options.include?(:must_revalidate)\n\n response['Cache-Control'] = options.map do |k, v|\n if v == true\n k.to_s.tr('_', '-')\n elsif v\n v = 31536000 if v.to_s == 'static'\n \"#{k.to_s.tr('_', '-')}=#{v}\"\n end\n end.compact.join(', ')\n end",
"def do_http_cache?\n resources.flatten.select do |resource|\n resource.respond_to?(:updated_at)\n end &&\n controller.response.last_modified.nil? && !new_record?\n end",
"def set_cache_buster\n \n response.headers[\"Cache-Control\"] = \"no-cache, no-store, max-age=0, must-revalidate\"\n response.headers[\"Pragma\"] = \"no-cache\"\n response.headers[\"Expires\"] = \"Fri, 01 Jan 1990 00:00:00 GMT\"\n\n end",
"def check_site_read_only\r\n if OperatingParamCache.instance.read_only_site_enabled?\r\n if request.xhr?\r\n render :update do |page|\r\n page.redirect_to '/site_slow.html#hide_find_reviews'\r\n end\r\n else\r\n render :template => 'common/site_slow', :layout => 'application'\r\n end\r\n false\r\n else\r\n true\r\n end\r\n end",
"def blockly_cache_bust\n if ::CACHE_BUST.blank?\n false\n else\n ::CACHE_BUST\n end\n end",
"def cache_control(opts)\n return if !App.production?\n etag(opts[:etag]) if opts[:etag]\n last_modified(opts[:last_modified]) if opts[:last_modified]\n if opts[:validate_only]\n response.headers.delete 'ETag'\n response.headers.delete 'Last-Modified'\n return\n end\n mode = opts[:private] ? 'private' : 'public'\n max_age = opts[:max_age] || (opts[:static] ? 86400 : 0)\n response['Cache-Control'] = \"#{mode}, max-age=#{max_age}, must-revalidate\"\n end",
"def no_cache!\n @cacheable = false\n end",
"def enabled?\n @parent.gemset_globalcache :enabled\n end",
"def add_cache_control\n return if request.query_string.to_i == 0\n headers['Cache-Control'] ||= 'public, max-age=300'\n end",
"def disable_caching=(_arg0); end",
"def cache_column?\n false\n end",
"def cache\n @options[:cache]\n end",
"def vary_page_caching_on_user\n response.headers['Vary'] = 'Cookie'\n end"
] |
[
"0.7261158",
"0.72413623",
"0.7237386",
"0.7150613",
"0.7150613",
"0.7056725",
"0.704111",
"0.70056087",
"0.6990013",
"0.6985611",
"0.6858229",
"0.6832103",
"0.67350006",
"0.6732197",
"0.6723559",
"0.66722894",
"0.66353464",
"0.6632723",
"0.66268206",
"0.66029155",
"0.66010356",
"0.6600866",
"0.6580763",
"0.65454227",
"0.65193224",
"0.6479277",
"0.6464592",
"0.64536595",
"0.64340234",
"0.6417786",
"0.6416854",
"0.64143604",
"0.64143604",
"0.64006037",
"0.63840425",
"0.63776636",
"0.6340944",
"0.63367355",
"0.63367355",
"0.63229644",
"0.628257",
"0.6261981",
"0.6247824",
"0.623817",
"0.61864674",
"0.6186038",
"0.6161187",
"0.6151701",
"0.61458725",
"0.6137375",
"0.61270773",
"0.61194724",
"0.6106423",
"0.6106423",
"0.6101257",
"0.60934645",
"0.6085635",
"0.6085635",
"0.6085635",
"0.6085635",
"0.6083576",
"0.6061322",
"0.60360277",
"0.60360277",
"0.60251343",
"0.6016124",
"0.6016124",
"0.6016124",
"0.600727",
"0.60013384",
"0.5994914",
"0.59948933",
"0.5994383",
"0.59867066",
"0.596548",
"0.59590214",
"0.5955491",
"0.59401906",
"0.5938927",
"0.5936706",
"0.5935141",
"0.59269696",
"0.5923268",
"0.59194416",
"0.58986044",
"0.58822316",
"0.5873086",
"0.5864355",
"0.5854103",
"0.58504605",
"0.5837315",
"0.5830413",
"0.582278",
"0.58226097",
"0.58149594",
"0.5814756",
"0.58131546",
"0.5812573",
"0.5812374",
"0.58106685"
] |
0.6897646
|
10
|
Get locale code from request subdomain (like
|
def extract_locale_from_subdomain
unless request.subdomains.empty?
parsed_locale = request.subdomains.first
else # Assume no tld if no subdomains (assume something like "es.localhost")
parsed_locale = request.domain.split('.')[0]
end
if parsed_locale
if I18n.available_locales.include?(parsed_locale.intern)
parsed_locale.intern
else
nil
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def extract_locale_from_subdomain\n parsed_locale = request.subdomains.first\n \n end",
"def get_locale_from_subdomain\n locale = @rh.match( /(.+)\\.demowatch\\.[a-z]{2,3}$/i)[1]\n return locale if ( I18N_ALL_LANGUAGES.include?( locale))\n return nil\n end",
"def extract_locale_from_subdomain\n @parsed_locale = request.subdomains.first\n if @parsed_locale.blank?\n @parsed_locale = 'en'\n end\n I18n.available_locales.include?(@parsed_locale.to_sym) ? @parsed_locale : 'en'\n end",
"def extract_locale_from_subdomain\n parsed_locale = request.subdomains.first\n I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale : nil\nend",
"def extract_locale_from_subdomain\n parsed_locale = request.subdomains.first\n I18n.available_locales.include?(parsed_locale.try(:to_sym)) ? parsed_locale : nil\n end",
"def extract_locale_from_subdomain\n parsed_locale = request.subdomains.first\n if parsed_locale != nil\n I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale : nil\n else\n return nil\n end\n end",
"def extract_locale_from_tld\n parsed_locale = request.host.split('.').last\n \n end",
"def extract_locale_from_subdomain\n\t\t parsed_locale = request.subdomains.first || I18n.default_locale\n\t\t I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale : nil\n\t\tend",
"def extract_locale_from_tld\n parsed_locale = request.host.split('.').last\n (I18n.available_locales.include? parsed_locale) ? parsed_locale : nil\n end",
"def extract_locale_from_tld\n parsed_locale = request.host.split('.').last\n (I18n.available_locales.include? parsed_locale) ? parsed_locale : nil\n end",
"def extract_locale_from_tld\n parsed_locale = request.host.split('.').last\n I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale : nil\n end",
"def extract_locale_from_tld\n parsed_locale = request.host.split('.').last\n I18n.available_locales.map(&:to_s).include?(parsed_locale) ? parsed_locale : nil\n end",
"def extract_locale_from_tld\n parsed_locale = request.host.split('.').last\n I18n.available_locales.map(&:to_s).include?(parsed_locale) ? parsed_locale : nil\n end",
"def extract_locale_from_tld\n parsed_locale = request.host.split('.').last\n I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale : nil\nend",
"def extract_locale_from_tld\n \n parsed_locale = request.host.split('.').last\n I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale : nil\n end",
"def extract_locale_from_tld\n parsed_locale = request.domain.split('.').first\n I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale : nil\n end",
"def extract_locale_from_tld\n parsed_locale = request.host.split('.').last\n I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale : nil\n end",
"def extract_locale_from_tld\n # parsed_locale = request.host.split('.').last\n # I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale : nil\n parsed_locale = request.url.split('/')\n if !parsed_locale[3].blank?\n I18n.available_locales.include?(parsed_locale[3].to_sym) ? parsed_locale[3] : nil\n end\n end",
"def extract_locale_from_request\r\n # locale defined in parameters\r\n return params[:locale] if params[:locale]\r\n # get locale from subdomains\r\n parsed_locale = request.subdomains.first\r\n return parsed_locale if I18n.available_locales.map(&:to_s).include?(parsed_locale)\r\n # get locale from http header\r\n return request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first if request.env['HTTP_ACCEPT_LANGUAGE']\r\n # get default locale\r\n return I18n.default_locale\r\n end",
"def extract_locale_from_request\r\n # locale defined in parameters\r\n return params[:locale] if params[:locale]\r\n # get locale from subdomains\r\n parsed_locale = request.subdomains.first\r\n return parsed_locale if I18n.available_locales.map(&:to_s).include?(parsed_locale)\r\n # get locale from http header\r\n return request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first if request.env['HTTP_ACCEPT_LANGUAGE']\r\n # get default locale\r\n return I18n.default_locale\r\n end",
"def domain_to_locale code\n\t\t\tdomain_locale_map[code.to_sym] || flag_locale_map[code.to_sym] || code\n\t\tend",
"def locale_from_http_header\n language = request.env['HTTP_ACCEPT_LANGUAGE']\n unless language.blank?\n http_locale = language.scan(/^[a-z]{2}-[A-Z]{2}/)\n unless http_locale.blank?\n http_locale = http_locale.first\n else\n http_locale = language.scan(/^[a-z]{2}/).first\n end\n end\n end",
"def extract_locale_from_tld\n I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale : nil\n end",
"def extract_locale_from_accept_language_header\n lang = request.env['HTTP_ACCEPT_LANGUAGE']\n lang.split(\",\")[0].to_sym if lang\n end",
"def get_locale(host)\r\n host.gsub(I18n.config.host_locale_regex, '\\1') || I18n.default_locale\r\n end",
"def extract_locale_from_accept_language_header\n request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first\n end",
"def extract_locale_from_accept_language_header\n request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first\n end",
"def extract_locale_from_accept_language_header\n request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first\n end",
"def extract_locale_from_accept_language_header\n request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z] {2} /).first\n end",
"def extract_locale_from_accept_language_header\n begin\n locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first\n\n locales = {\n 'de' => 'de_DE',\n 'da' => 'da_DK',\n 'dk' => 'da_DK',\n 'fi' => 'fi_FI',\n 'fr' => 'fr_FR',\n 'de' => 'de_DE',\n 'en' => 'en_GB',\n 'uk' => 'en_GB',\n 'us' => 'en_GB',\n 'gr' => 'el_GR',\n 'is' => 'is_IS',\n 'it' => 'it_IT',\n 'ja' => 'ja_JP',\n 'nl' => 'nl_NL',\n 'no' => 'no_NO',\n 'pl' => 'pl_PL',\n 'pt' => 'pt_PT',\n 'ro' => 'ro_RO',\n 'ru' => 'ru_RU',\n 'es' => 'es_ES',\n 'sv' => 'sv_SE',\n 'se' => 'sv_SE'\n }\n\n if not locales.has_key?(locale)\n return \"en\"\n end\n\n return locales[locale]\n rescue\n return \"en\"\n end\n end",
"def locale_country(locale = nil)\n (locale || I18n.locale).to_s.match(/[_-](\\w{2})$/) ? $1.to_sym : nil\n end",
"def extract_locale_from_accept_language_header\n if request.env['HTTP_ACCEPT_LANGUAGE']\n request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first.to_sym\n end\n end",
"def get_locale_from_http_header\n return DEFAULT_LANGUAGE if request.env['HTTP_ACCEPT_LANGUAGE'].nil?\n locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first\n return locale if I18N_ALL_LANGUAGES.include?( locale)\n return DEFAULT_LANGUAGE\n end",
"def getLocaleCode\n locp = params['locale'].to_s\n locc = cookies['locale'].to_s\n if (\n locp.present? &&\n BaseRec::VALID_LOCALES.include?(locp)\n )\n # first set locale to the locale passed as the locale param\n @locale_code = locp\n elsif (\n locc.present? &&\n BaseRec::VALID_LOCALES.include?(locc)\n )\n # next default locale to cookie:\n @locale_code = locc\n else\n # next set it to default locale\n @locale_code = Rails.application.config.i18n.default_locale\n # # next set locale to the locale in user record\n # @locale_code = current_user.try(:locale) || @locale_code\n end\n # set the locale in I18n\n Rails.logger.debug \"@locale_code: #{@locale_code.inspect}\"\n I18n.locale = @locale_code\n cookies[:locale] = @locale_code\n end",
"def extract_locale_from_accept_language_header\n locale = \"en_US\"\n locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first \\\n if not request.env['HTTP_ACCEPT_LANGUAGE'].nil?\n return locale\n end",
"def extract_locale_from_accept_language_header\n lang = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first\n logger.info \"INFO: Language #{lang} determined from header\"\n lang\n end",
"def extract_locale_from_accept_language_header\n browser_locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first.to_sym\n return nil unless I18n.available_locales.include? browser_locale\n browser_locale\n end",
"def locale\n (self.country.blank? or self.country.indonesia?) ? :id : :en\n end",
"def locale_country(locale=nil)\n \"#{locale || I18n.locale}\".match(/-([a-zA-Z]{2})/) ? $1.to_sym : nil\n end",
"def get_locale\n if !self.language.nil?\n return self.language.abbreviation\n elsif !self.org.nil?\n return self.org.get_locale\n else\n return nil\n end\n end",
"def get_locale\n if !self.language.nil?\n return self.language.abbreviation\n else\n return nil\n end\n end",
"def getLocaleCode\n # first default locale to default locale\n @locale_code = Rails.application.config.i18n.default_locale\n # next set locale to the locale in user record\n @locale_code = current_user.try(:locale) || @locale_code\n # next set locale to the locale passed as the locale param\n if (params.present? &&\n params['locale'].present? &&\n BaseRec::VALID_LOCALES.include?(params['locale'].to_s)\n )\n @locale_code = params['locale']\n end\n # set the locale in I18n\n I18n.locale = @locale_code\n Rails.logger.debug \"@locale_code: #{@locale_code.inspect}\"\n end",
"def extract_locale_from_accept_language_header\n browser_locale = request.env['HTTP_ACCEPT_LANGUAGE'].try(:scan, /^[a-z]{2}/).try(:first).try(:to_sym)\n if I18n.available_locales.include? browser_locale\n browser_locale\n else\n I18n.default_locale\n end\n end",
"def payment_compatible_locale(locale)\n locale = locale.to_s.split(\"-\").first\n if [\"fr\", \"en\", \"es\", \"it\", \"pt\", \"de\", \"nl\", \"fi\"].include?(locale)\n return locale\n else\n return \"en\"\n end\n end",
"def detect_locale_from(source)\n case source\n when :params\n params[:locale]\n when :session\n logger.debug \"Session: #{session.inspect}\"\n session[:locale]\n when :cookie\n cookies[:locale]\n when :domain\n parse_host_and_port_for_locale[0]\n when :header\n request.env['HTTP_ACCEPT_LANGUAGE']\n when :default\n default_locale\n else\n raise \"unknown source\"\n end\n end",
"def extract_locale_from_accept_language_header\n accept_language = request.env['HTTP_ACCEPT_LANGUAGE']\n logger.debug \"* Accept-Language from header: #{accept_language}\"\n return accept_language.scan(/^[a-z]{2}/).first if accept_language\n end",
"def extract_locale_from_accept_language_header\n accept_language = request.env['HTTP_ACCEPT_LANGUAGE']\n logger.debug \"* Accept-Language from header: #{accept_language}\"\n return accept_language.scan(/^[a-z]{2}/).first if accept_language\n end",
"def to_deepl_compatible_locale(locale)\n locale.to_s.split('-', 2).first.upcase\n end",
"def extract_locale_from_accept_language_header\n # One source of client supplied information would be an Accept-Language HTTP header.\n # People may set this in their browser\n if (request.env['HTTP_ACCEPT_LANGUAGE'] != nil)\n request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first\n #request.env['HTTP_ACCEPT_LANGUAGE']\n end\n end",
"def lang locale\n if translations.find_by(locale: locale).try(:automated?)\n \"#{locale}-x-mtfrom-de\"\n else\n locale.to_s\n end\n end",
"def locale\r\n read_attribute(:locale).to_sym\r\n end",
"def set_locale\n if request.subdomain == 'en'\n I18n.locale = request.subdomain\n else\n I18n.locale = params[:locale] || I18n.default_locale\n end\n end",
"def locale\n if self.language\n LANGUAGE_CODE[self.language]\n end\n end",
"def extract_locale_from_session\n session[:locale] || nil\n end",
"def locale\n if !language.nil?\n language.abbreviation\n elsif !org.nil?\n org.locale\n end\n end",
"def locale_switch_subdomain_url(locale)\n route_localize_switch(locale, subdomain: locale)\n end",
"def cctld_from_locale( locale )\n # return \"il\" if locale.to_s == \"he\"\n return if locale.to_s.split( \"-\" ).size < 2\n\n region = locale.to_s.split( \"-\" ).last\n case region\n # There are a few exceptions to ISO 3166-1 / ccTLD mapping\n when \"gb\" then \"uk\"\n else region\n end\n end",
"def language_name(code)\n if configatron.locales.include?(code)\n t(:locale_name, :locale => code)\n else\n (entry = ISO_639.find(code.to_s)) ? entry.english_name : code.to_s\n end\n end",
"def current_locale\n Thread.current[:\"localite:locale\"] || base\n end",
"def get_lang_from_headers\n\t\t\t@env['HTTP_ACCEPT_LANGUAGE'].to_s[0, 2]\n\t\tend",
"def extract_locale_from_subdomain(only_available_locales = false)\n parsed_locale = filter_locale(self.subdomain, only_available_locales)\n LocalE.log_result 'subdomains', request.subdomains, parsed_locale, 'no valid sub domain', 'locale'\n parsed_locale\n end",
"def locale_backend; end",
"def locale_path(locale)\n locale_regexp = %r{/(en|de)/?}\n if request.env['PATH_INFO'] =~ locale_regexp\n \"#{request.env['PATH_INFO']}\".gsub(locale_regexp, \"/#{locale}/\")\n else\n \"/#{locale}#{request.env['PATH_INFO']}\"\n end\n end",
"def locale_language(locale = nil)\n (locale || I18n.locale).to_s.match(/^(\\w{2})/) ? $1.to_sym : nil\n end",
"def locale\n I18n.locale.to_s\n end",
"def locale\n I18n.locale.to_s\n end",
"def to_deepl_source_locale(locale)\n locale.to_s.split('-', 2).first.upcase\n end",
"def exctract_locale_from_url(url)\n url[/^([^\\/]*\\/\\/)?[^\\/]+\\/(\\w{2})(\\/.*)?/,2]\n end",
"def locale\n return nil if errors\n\n locale = YAML.safe_load(@text).keys.first\n locale.to_sym\n end",
"def locale_of(filename)\n locale = (filename =~ extension_regex ? $1 : nil)\n locale ? locale.gsub(/^\\./, '').to_sym : nil\n end",
"def request_subdomain\n request.host.split(/\\./).first\n end",
"def locale_country_codes(l)\n if l.nil? || ! @ll.has_key?(l.downcase.to_sym)\n Rails.logger.warn \"Unknown locale key: #{l}\"\n l = DEFAULT_LOCALE_CODE\n end\n\n @ll[l.downcase.to_sym][:ccodes]\n end",
"def _calc_locale(_l)\n _l = (_l || @_deco_locale || (h.cama_get_i18n_frontend rescue nil) || I18n.locale).to_s\n \"_#{_l}\"\n end",
"def locale_name\n YAML.load(translation || \"{}\").with_indifferent_access[locale] || survey.default_locale_name\n end",
"def language_code\n if self.class.globalized?\n unless @original_language.nil?\n code = @original_language.code\n else\n code = Globalize::Locale.base_language.code\n end\n elsif Globalize::Locale.language.nil?\n code = Globalize::Locale.base_language.code\n else\n code = Globalize::Locale.language.code\n end\n code\n end",
"def locale; end",
"def locale; end",
"def locale; end",
"def locale; end",
"def locale; end",
"def locale; end",
"def locale; end",
"def locale\n @grpc.locale\n end",
"def locale\n @grpc.locale\n end",
"def extract_locale_from_tld(only_available_locales = false)\n parsed_locale = filter_locale(self.top_level_domain, only_available_locales)\n LocalE.log_result 'host', request.host, parsed_locale, 'no valid top level domain', 'locale'\n parsed_locale\n end",
"def language_code_lookup( language_code )\n\n case language_code\n when 'eng'\n return 'English'\n when 'fre'\n return 'French'\n when 'ger'\n return 'German'\n when 'spa'\n return 'Spanish'\n end\n return language_code\n end",
"def header_locale\n options = request.env.fetch('HTTP_ACCEPT_LANGUAGE', '').split(',')\n # clear out preference values; assume they'll be in order\n options.map! { |v| v.split(';')[0] }\n options.each do |v|\n return locale_matches[v] if locale_matches.keys.include?(v)\n end\n I18n.default_locale\n end",
"def locale\n return @locale\n end",
"def locale\n return @locale\n end",
"def get_locale_from_params \n return nil unless params[:locale]\n I18n.available_locales.include?(params[:locale].to_sym) ? params[:locale] : nil\n end",
"def get_locale_from_params \n return nil unless params[:locale]\n I18n.available_locales.include?(params[:locale].to_sym) ? params[:locale] : nil\n end",
"def set_locale\n new_locale = find_matching_locale(extract_locale_from_subdomain || extract_locale_from_url)\n unless new_locale.nil?\n I18n.locale = new_locale\n else\n I18n.locale = I18n.default_locale\n end\n end",
"def locale_to_translate_into\n multilanguage_site = settings.multilanguage_site\n default_language = settings.default_language\n if multilanguage_site and session[:locale] != default_language\n session[:locale]\n else\n nil\n end\n end",
"def country_code\n cc = carmen_country\n\n cc ? \"#{cc.code.upcase}\" : nil\n end",
"def locale_to_name\n \t\t{'fr' => 'Français',\n 'en' => 'English',\n 'po' => 'portugues',\n 'sp' => 'Spanish',\n 'de' => 'Deutsch',\n 'it' => 'Italiano'}\n\tend",
"def valid_language\n locale = extract_locale_from_accept_language_header\n logger.debug \"* Extracted Locale ID: #{locale}\"\n if !locale.blank? &&\n (locale == 'de' ||\n locale == 'en')\n locale\n else\n DEFAULT_LANGUAGE\n end\n end",
"def valid_language\n locale = extract_locale_from_accept_language_header\n logger.debug \"* Extracted Locale ID: #{locale}\"\n if !locale.blank? &&\n (locale == 'de' ||\n locale == 'en')\n locale\n else\n DEFAULT_LANGUAGE\n end\n end",
"def locale\n current_site.locale || I18n.default_locale.to_s\n end",
"def norwegian_organisation_number; end",
"def find_locale\n locale = locales.all.detect(&:default)\n return locale.code if locale\n\n default_locale\n end"
] |
[
"0.8537563",
"0.8402093",
"0.8291987",
"0.8176371",
"0.8157528",
"0.8143707",
"0.81155235",
"0.7962062",
"0.7789393",
"0.7786918",
"0.77175075",
"0.77090496",
"0.77090496",
"0.7708932",
"0.77087075",
"0.76737785",
"0.76634765",
"0.76173943",
"0.75250655",
"0.74508166",
"0.7191692",
"0.703815",
"0.69635344",
"0.6900294",
"0.68706375",
"0.68313366",
"0.68313366",
"0.68313366",
"0.6816444",
"0.6785596",
"0.6764007",
"0.6760551",
"0.67416024",
"0.6737196",
"0.6715669",
"0.6676565",
"0.6658952",
"0.6651867",
"0.6629833",
"0.6620206",
"0.65868074",
"0.65807915",
"0.6523037",
"0.6518158",
"0.6498985",
"0.64910734",
"0.64910734",
"0.64556736",
"0.6438692",
"0.6435281",
"0.6433417",
"0.64085066",
"0.6397128",
"0.6382367",
"0.63527125",
"0.63461155",
"0.6329845",
"0.63177305",
"0.62681574",
"0.62458295",
"0.6234673",
"0.6228621",
"0.6214029",
"0.62120175",
"0.61931276",
"0.61931276",
"0.6176277",
"0.6173736",
"0.6172208",
"0.6155073",
"0.61442345",
"0.6132232",
"0.6099868",
"0.60969836",
"0.60830146",
"0.6061803",
"0.6061803",
"0.6061803",
"0.6061803",
"0.6061803",
"0.6061803",
"0.6061803",
"0.6058934",
"0.6058934",
"0.6058833",
"0.60253733",
"0.60081685",
"0.60056096",
"0.60056096",
"0.5993695",
"0.59913206",
"0.5983769",
"0.5976429",
"0.5973521",
"0.5970793",
"0.59664005",
"0.59651774",
"0.59645694",
"0.5945921",
"0.59430397"
] |
0.8096817
|
7
|
"cache_page" alias method which effectivly forces the domain name to be prepended to the page cache path. Note that the "caches_page" method called on actions within a controller is affected by this as well
|
def cache_page_with_domain(content = nil, options = nil)
return unless perform_caching && caching_allowed
path = "/#{request.host}"
path << case options
when Hash
url_for(options.merge(:only_path => true,
:skip_relative_url_root => true, :format => params[:format]))
when String
options
else
if request.path.empty? || request.path == '/'
'/index'
else
request.path
end
end
cache_page_without_domain(content, path)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def page_cache(page)\n if page\n \"/page-#{page}\"\n else\n \"\"\n end\n end",
"def cache_page(content = nil, options = nil)\n return unless perform_caching && caching_allowed\n\n path = case options\n when Hash\n url_for(options.merge(:only_path => true, :skip_relative_url_root => true, :format => params[:format]))\n when String\n options\n else\n request.path\n end\n\n self.class.cache_page(content || response.body, path)\n end",
"def bagel_cache_page(content = nil, options = nil)\n return unless perform_caching && caching_allowed && AppConfig[:cache_to_filesytem]\n\n path = case options\n when Hash\n url_for(options.merge(:only_path => true, :skip_relative_url_root => true, :format => params[:format]))\n when String\n options\n else\n request.path\n end\n\n self.class.cache_page(content || response.body, path)\n end",
"def cache_cms_page\n unless Comatose.config.disable_caching or response.headers['Status'] == '404 Not Found'\n return unless params[:use_cache].to_s == 'true' and allow_page_cache?\n path = params[:cache_path] || request.request_uri\n begin\n # TODO: Don't cache pages rendering '404' content...\n self.class.cache_page( response.body, path )\n rescue\n logger.error \"Comatose CMS Page Cache Exception: #{$!}\"\n end\n end\n end",
"def page_cache_file(url)\n ActionController::Base.send :page_cache_file, url.gsub(/^https?:\\/\\//, '')\n end",
"def cache_page(content = nil, options = nil, gzip = Zlib::BEST_COMPRESSION)\n if perform_caching? && caching_allowed?\n path = \\\n case options\n when Hash\n url_for(options.merge(only_path: true, format: params[:format]))\n when String\n options\n else\n request.path\n end\n\n type = if self.respond_to?(:media_type)\n Mime::LOOKUP[self.media_type]\n else\n Mime::LOOKUP[self.content_type]\n end\n\n if type && (type_symbol = type.symbol).present?\n extension = \".#{type_symbol}\"\n end\n\n page_cache.cache(content || response.body, path, extension, gzip)\n end\n end",
"def cache_page_with_references\n return unless perform_caching && caching_allowed\n CachedPage.create_by_url(site, url_for(:only_path => true, :skip_relative_url_root => true), cached_references)\n end",
"def cache_page(content, path, extension = nil, gzip = Zlib::BEST_COMPRESSION)\n if perform_caching\n page_cache.cache(content, path, extension, gzip)\n end\n end",
"def caches_page(*actions)\n return unless perform_caching\n actions = actions.map(&:to_s)\n after_filter { |c| c.cache_page if actions.include?(c.action_name) }\n end",
"def cache_page(content, path)\n return unless perform_caching\n\n benchmark \"Cached page: #{page_cache_file(path)}\" do\n FileUtils.makedirs(File.dirname(page_cache_path(path)))\n File.open(page_cache_path(path), \"wb+\") { |f| f.write(content) }\n end\n end",
"def write_cache?\n if site.front_page_cached and c = cache_url\n #Rails.logger.info(\"request.path:::: #{request.path}\")\n cache_page(response.body, File.join(site.cache_path, c).to_s)\n end\n end",
"def site_cache(cache_type, &blk)\n site_content_cache_key = [cache_key, cache_type]\n Rails.cache.fetch(site_content_cache_key, expires_in: 4.weeks.from_now, &blk)\n end",
"def cache_location\n $redis.lpush(\"user-pages-#{@current_user.id}\", request.url)\n $redis.ltrim(\"user-pages-#{@current_user.id}\", 0, 9)\n end",
"def cache time: 3600, &block\n return yield if 'development' == ENV['RACK_ENV']\n\n key = \"url:#{I18n.locale}:#{request.path}\"\n cached = $redis.get(key)\n page = cached || yield\n etag Digest::SHA1.hexdigest(page)\n\n if cached\n ttl = $redis.ttl(key)\n response.header['redis-ttl'] = ttl.to_s\n response.header['redis'] = 'HIT'\n else\n response.header['redis'] = 'MISS'\n $redis.setex(key, time, page)\n end\n page\n end",
"def cache_request_uri\n session[:protected_page] = request.request_uri\n end",
"def cache(content, options={})\n return content unless Sinatra.options.cache_enabled\n \n unless content.nil?\n path = cache_page_path(request.path_info)\n FileUtils.makedirs(File.dirname(path))\n open(path, 'wb+') { |f| f << content } \n content\n end\n end",
"def cacheable_url\n ret = self[:url]\n ret = [ret, self.timestamp].join('?') if target.config[:timestamp_urls]\n ret = SC.attach_prefix(ret)\n if target.config[:hyper_domaining]\n ret = [self.hyperdomain_prefix(ret), ret].join('')\n end\n return ret\n end",
"def set_cache_key(klass)\n @cache_key = params[:page] ? \"#{klass.to_s.pluralize.downcase}_page#{params[:page]}\" : \"jobs_page1\"\n end",
"def cache_response!(response)\n cache.write(escape_path_for_cache_key(request_options[:path]), response)\n end",
"def set_page_caching_status\n @page_caching_active = page_caching_active\n end",
"def page_cache_test_file(url)\n File.join ActionController::Base.page_cache_directory, page_cache_file(url).reverse.chomp('/').reverse\n end",
"def cache_request\n cache\n end",
"def vary_page_caching_on_user\n response.headers['Vary'] = 'Cookie'\n end",
"def cache_clear\n DrgCms.cache_clear(:dc_page)\nend",
"def cache_fleximage( content, path )\n return unless perform_caching && APP_CONFIG['perform_fleximage_caching']\n benchmark \"Cached page: #{page_cache_file(path)}\" do\n FileUtils.makedirs(File.dirname(page_cache_path(path)))\n File.open(page_cache_path(path), \"wb+\") { |f| f.write(content) }\n end\n end",
"def expire_page(options = {})\n return unless perform_caching\n\n if options.is_a?(Hash)\n if options[:action].is_a?(Array)\n options[:action].dup.each do |action|\n self.class.expire_page(url_for(options.merge(:only_path => true, :skip_relative_url_root => true, :action => action)))\n end\n else\n self.class.expire_page(url_for(options.merge(:only_path => true, :skip_relative_url_root => true)))\n end\n else\n self.class.expire_page(options)\n end\n end",
"def expire_page(options = {})\n if perform_caching?\n case options\n when Hash\n case options[:action]\n when Array\n options[:action].each { |action| expire_page(options.merge(action: action)) }\n else\n page_cache.expire(url_for(options.merge(only_path: true)))\n end\n else\n page_cache.expire(options)\n end\n end\n end",
"def generate_page_cache\n if runtime_mode == :plugin\n @errors = [\"Page cache cannot be generated in plugin mode\"]\n else\n @errors = generate_all_pages_html(params)\n end\n if @errors.length == 0 \n flash[:notice] = \"Pages Cached Successfully\"\n else\n flash[:notice] = \"Pages Cache Error(s): #{@errors.join(', ')}\"\n flash[:cache_errors] = @errors \n end\n redirect_to :controller=>self.controller_name, :action=>'index'\n end",
"def page_cached?(page = 1)\n cached_pages.include? page.to_s\n end",
"def set_cache(value); end",
"def set_cache(value); end",
"def add_cache_control; end",
"def cache_for(expires, *args, &blk)\n @cache_data ||= CacheData.new\n @cache_data.value caller_locations(1,1)[0].label.to_sym, expires, args, &blk\n end",
"def expire_page_cache\n expire_cms_pages_from_bottom( Comatose::Page.root)\n expire_cms_fragments_from_bottom( Comatose::Page.root )\n flash[:notice] = \"Page cache has been flushed\"\n redirect_to :controller=>self.controller_name, :action=>'index'\n end",
"def page\r\n return @cache[:page] unless @cache[:page].nil?\r\n\r\n @cache[:page] = @agent.try(:page)\r\n end",
"def expire_cache(path = nil)\n return unless Sinatra.options.cache_enabled\n \n path = (path.nil?) ? cache_page_path(request.path_info) : cache_page_path(path)\n if File.exist?(path)\n File.delete(path)\n #log.info( \"Expired Page deleted at: [#{path}]\")\n else\n #log.info( \"No Expired Page was found at the path: [#{path}]\")\n end\n end",
"def set_page_caching_status\n if perform_caching && caching_allowed\n @page_caching_active = true\n else\n @page_caching_active = false\n end\n end",
"def serve_from_cache!\n puts \"\\nServed from cache '#{request.uri}'\\n\\n\" if ::SETTINGS['debug']\n TinyProxy::Cache.get(request.uri)\n end",
"def cached_based_on(*whatever)\n segmented_path = lazy_cache_key_for(*whatever)\n (@controller || self).read_fragment(segmented_path) || (@controller || self).write_fragment(segmented_path, yield)\n end",
"def cache_shared_page(*args)\n around_action :capture_and_apply_surrogate_keys, *args\n end",
"def expire_page_cache\n expire_cms_pages_from_bottom( fetch_root_page )\n expire_cms_fragments_from_bottom( fetch_root_page )\n flash[:notice] = \"Page cache has been flushed\"\n redirect_to :controller=>self.controller_name, :action=>'index'\n end",
"def render_page_from_cache\n if cached_page.live_exists?\n render :file => cached_page.live_path\n return true\n else\n render :text => 'Currently not in cache', :status => 503\n return false\n end\n end",
"def http_cache\n response.headers['Cache-Control'] = 'public, max-age=300'\n end",
"def rebuild_top_page_cache\n controller = ActionController::Base.new\n controller.expire_fragment( 'top_page')\n controller.expire_fragment( 'more_photos')\n controller.expire_fragment( 'left_block' )\n #load page to regenerate cache\n Net::HTTP.get 'pantherfotos.com' #TODO extract from routes\n end",
"def update\n download_page if cache_expired?\n read_cache\n end",
"def expire_cache(page_name)\n expire_pages(ContentPage.find_all_by_page_name(page_name))\n end",
"def after_create(page)\n expire_cache_for(page)\n end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def do_get(request, response)\n request_path = request.unparsed_uri\n page_response = cache.get(request_path)\n\n if page_response.nil?\n destination = destination_resolver.get_destination_for_path(request_path)\n LOG.info \"cache miss, forwarding the request on to: #{destination}\"\n\n page_response = forward_request(destination)\n cache.put(request_path, page_response)\n end\n\n response.status, response.body = page_response\n end",
"def _cache_control; end",
"def render_page(page, format = :html, local_params = {})\n now = Time.now.to_formatted_s(:rfc822)\n response.headers[HTTP_EXPIRES] = now\n response.headers[HTTP_LAST_MODIFIED] = now\n response.headers[HTTP_CACHE_CONTROL] = HTTP_NO_CACHE\n super\n end",
"def test_cache_link\n get '/' + TEST_PAGE\n assert_redirected_to :link => TEST_PAGE_LINK\n \n follow_redirect!\n assert_no_errors\n assert_page_cached(TEST_PAGE_LINK)\n end",
"def cache_page?\n return false unless @page && Alchemy::Config.get(:cache_pages)\n pagelayout = PageLayout.get(@page.page_layout)\n pagelayout['cache'] != false && pagelayout['searchresults'] != true\n end",
"def configure_cache; end",
"def cache_store; end",
"def cache_store; end",
"def cache_response_for(duration)\n # response.headers[\"Expires\"] = CGI.rfc1123_date(Time.now + expiry)\n response.headers[\"Expires\"] = duration_in_words(duration)\n expires_in duration, :public => true\n end",
"def cache(key = nil, &code)\n key ||= Stash.caller_name\n @store[key.to_sym] ||= code.call\n end",
"def disable_caching=(_arg0); end",
"def expire_single\n if allowed_request\n expire_cache(params[:id])\n render :text => \"Non-species page '#{params[:id]}' cache expired.\", :layout => false\n else\n redirect_to root_url\n end\n end",
"def fetch_cache(file, url)\n @path = \"tmp/\" + file + \".html\";\n @temp = @path + \".fetch\"\n @doFetch = !(FileTest.exists?(@path) && (Time.new - File.mtime(@path) < (5 * 60)))\n\n if @doFetch and download_page(@temp,url) then\n File.delete(@path) if File.exists?(@path)\n File.rename(@temp, @path)\n end\n\n if File.exists?(@path) then\n return @path\n else\n @useOnce = @path + \".\" + rand(100000).to_s + \".once\"\n download_page(@useOnce, url)\n return @useOnce\n end\n end",
"def sprinkle_html_caching_magic(column)\n define_method \"cache_#{column}_html\" do\n html = self.send(\"#{column}_html\")\n self.send(\"cached_#{column}_html=\", html)\n end\n before_save \"cache_#{column}_html\".to_sym\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def cache_path\n @cache_path ||= File.join(\"\", \"gko\", \"cache\", \"#{self.host}\")\n end",
"def prevent_page_caching\n response.headers['Cache-Control'] = 'private, max-age=0, must-revalidate'\n end",
"def expire_cache_for(record)\n case record\n when Page\n expire_page_caches(record.id)\n when Comment\n expire_page(:controller => 'pages', :action => 'index', :page_id => record.page_id, :on => \"comments_count\")\n expire_page(:controller => 'pages', :action => 'index', :page_id => record.page_id, :on => \"comments_list\")\n end\n end",
"def cache_for(time)\n expires_in time, :public => true\n end",
"def expire_single\n if allowed_request\n expire_cache(params[:id])\n render text: \"Non-species page '#{params[:id]}' cache expired.\", layout: false\n else\n redirect_to root_url, status: :moved_permanently\n end\n end",
"def vary_cache_key_for(request)\n method = request.method.to_s\n Digest::SHA1.hexdigest(\"by_vary_index#{@cache_salt}#{method}#{request.url}\")\n end",
"def disable_caching; end",
"def process_response_before_caching(response, opts)\n response\n end",
"def after_update(page)\n expire_cache_for(page)\n end",
"def cache_key\n [super, user.try(:cache_key)].compact.join('/')\n end",
"def set_cache_control\n if ssl_request? && ie_request?\n @controller.headers['Cache-Control'] = 'maxage=1' # added to make ie ssl pdfs work (per naisayer)\n else\n @controller.headers['Cache-Control'] ||= ie_request? ? 'no-cache, must-revalidate' : ''\n end\n end",
"def move_to_cache\n true\n end",
"def move_to_cache\n true\n end",
"def move_to_cache\n true\n end",
"def move_to_cache\r\n true\r\n end",
"def cache_dir; end",
"def cache_dir; end",
"def cache_name\n self.name.methodize\n end",
"def cache_dir=(_arg0); end",
"def cacheFileName(ni)\n @directory_name + \"/\" + ni.path\nend",
"def cached?; end",
"def action_path_for(options)\n ActionController::Caching::Actions::ActionCachePath.path_for(controller, options)\n end",
"def action_path_for(options)\n ActionController::Caching::Actions::ActionCachePath.path_for(controller, options)\n end",
"def set_cache_buster\n \n response.headers[\"Cache-Control\"] = \"no-cache, no-store, max-age=0, must-revalidate\"\n response.headers[\"Pragma\"] = \"no-cache\"\n response.headers[\"Expires\"] = \"Fri, 01 Jan 1990 00:00:00 GMT\"\n\n end",
"def move_to_cache\n true\n end",
"def key_for_cached\n [ @options[:namespace], MD5.hexdigest(@url) ].join('_')\n end",
"def add_compilation_cache(url:, data:)\n {\n method: \"Page.addCompilationCache\",\n params: { url: url, data: data }.compact\n }\n end",
"def cache\n yield\n end"
] |
[
"0.7399514",
"0.6926317",
"0.68699867",
"0.67377055",
"0.6641414",
"0.66082925",
"0.65276724",
"0.6514265",
"0.6491977",
"0.6366616",
"0.61459774",
"0.6093058",
"0.6084344",
"0.5999851",
"0.59539056",
"0.5940506",
"0.5912845",
"0.5832463",
"0.58030003",
"0.5802468",
"0.5792046",
"0.578193",
"0.57042885",
"0.56914747",
"0.5685803",
"0.56682193",
"0.5663912",
"0.5641992",
"0.56283283",
"0.5624683",
"0.5624683",
"0.5619906",
"0.56088835",
"0.5542194",
"0.55395305",
"0.55381376",
"0.55239266",
"0.5520413",
"0.5478775",
"0.5466544",
"0.54662603",
"0.5456545",
"0.5425638",
"0.5420868",
"0.5406123",
"0.5382446",
"0.537563",
"0.5366744",
"0.5366744",
"0.5366744",
"0.5366744",
"0.5366744",
"0.5366744",
"0.5366744",
"0.53558975",
"0.5341699",
"0.53279984",
"0.5325186",
"0.5299319",
"0.52886087",
"0.5286533",
"0.5286533",
"0.5276718",
"0.5259364",
"0.5256817",
"0.5244215",
"0.52324843",
"0.52313685",
"0.5227025",
"0.5227025",
"0.5227025",
"0.5227025",
"0.52097476",
"0.5204686",
"0.52039444",
"0.5185448",
"0.5183708",
"0.51829183",
"0.5176589",
"0.5167059",
"0.5152606",
"0.51498145",
"0.5145223",
"0.51385385",
"0.51385385",
"0.51385385",
"0.51382226",
"0.51350695",
"0.51350695",
"0.5126923",
"0.5126389",
"0.5116992",
"0.51141113",
"0.5110772",
"0.5110772",
"0.51104003",
"0.51043326",
"0.5095168",
"0.5091836",
"0.5082362"
] |
0.7539716
|
0
|
Appending = at the end of a method name, allows to implement a "setter". A setter is a method that is assignable. Example: p.tag_names = "stuff,yo" The code in the example above would call the method we wrote below where the value on the righthand side of the = would become the argument to the method. This is similar to implementing an `attr_writer`.
|
def tag_names=(rhs)
self.tags = rhs.strip.split(/\s*,\s*/).map do |tag_name|
Tag.find_or_initialize_by(name: tag_name)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def setter_method\n :\"#{self[:name]}=\"\n end",
"def setter_method\n :\"#{self[:name]}=\"\n end",
"def attribute_setter(attribute_name)\n \"set#{attribute_name.to_s.camelcase(:upper)}\"\n end",
"def setter( name ) (name.to_s + '=').to_sym end",
"def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end",
"def _setter_method\n :\"_#{self[:name]}=\"\n end",
"def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end",
"def setter\n @setter ||= \"#{name}=\"\n end",
"def attr_writer(sym, *more) end",
"def _setter_method\n :\"_#{self[:name]}=\"\n end",
"def setter\n @setter ||= :\"#{@name}=\"\n end",
"def add_writer_tags(klass, new_method, member)\n member_tag = member_tag_for_member(klass, member, :write)\n return_type = return_type_from_tag(member_tag)\n setter_doc_text = member_tag ? member_tag.text : \"Sets the attribute #{member}\"\n new_method.docstring.replace(setter_doc_text)\n new_method.add_tag YARD::Tags::Tag.new(:param, \"the value to set the attribute #{member} to.\", return_type, \"value\")\n new_method.add_tag YARD::Tags::Tag.new(:return, \"the newly set value\", return_type)\n end",
"def define_writer(name, selector)\n define_method(\"#{name}=\") { |value| @browser.find(selector).set(value) }\n end",
"def attr_writer(name)\n meth = Rubinius::AccessVariable.set_ivar name\n @method_table.store \"#{name}=\".to_sym, meth, :public\n Rubinius::VM.reset_method_cache name\n nil\n end",
"def attr_setter(*attrs)\n code, made = '', []\n attrs.each do |a|\n code << \"def #{a}(*a); a.size > 0 ? (@#{a}=a[0]; self) : @#{a} end\\n\"\n made << a.to_sym\n end\n module_eval(code)\n made\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end",
"def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end",
"def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end",
"def []=(name, value)\n if ATTRIBUTES.include?(name)\n setter = [name, \"=\"].join\n public_send(setter, value)\n end\n end",
"def create_field_setter(name, meth, field)\n generated_methods.module_eval do\n define_method(\"#{ meth }=\") do |value|\n instance_variable_set \"@#{ name }\", value\n end\n end\n end",
"def define_writer_method(attribute, method_name, visibility)\n define_method(method_name) { |value| attribute.set(self, value) }\n send(visibility, method_name)\n self\n end",
"def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end",
"def create_setter\n @model.class_eval <<-EOS, __FILE__, __LINE__\n #{writer_visibility}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n end",
"def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end",
"def key_writer *keys\n keys.each do |method|\n key = method.to_s\n define_method \"#{method}=\" do |value|\n self[key] = value\n end\n end\n end",
"def setter\r\n @setter ||= Field.setter(@name)\r\n end",
"def to_setter\n\t\t\t\t(to_getter.to_s+\"=\").to_sym\n\t\t\tend",
"def define_setter_for(name, property_name: name)\n setter = :\"#{name}=\"\n if !should_define_setter_for?(name, setter)\n define_method(setter) { |value| self.[]=(property_name, value) }\n end\n end",
"def create_setter\n @model.class_eval <<-EOS, __FILE__, __LINE__\n #{writer_visibility}\n def #{name}=(value)\n self[#{name.inspect}] = value\n end\n EOS\n end",
"def add_writer_tags(klass, new_method, member); end",
"def method=(_); end",
"def create_setter_for(attribute, options)\n setter_method = \"#{attribute}=\"\n\n define_method setter_method do |value|\n if options[:allow_blank] || value != \"\"\n write_attribute(attribute, value)\n end\n end\n end",
"def struct_writer(method)\n class_eval <<-RUBY\n attr_writer :#{method}\n RUBY\n end",
"def set(field,value)\n set_method = (field.to_s + \"=\").to_sym\n m = self.method((field.to_s + \"=\").to_sym)\n m.call value\n end",
"def method_missing(method, *args)\n if method.to_s[-1,1] == '='\n self.put(method.to_s.tr('=',''), *args)\n else\n self.get(method)\n end\n end",
"def alias_writer(name)\n writer = \"#{name}=\"\n alias_method(writer, name)\n private(writer)\n end",
"def method_missing(method_name, *args, &block)\n setter = method_name.to_s.end_with?('=')\n key = method_name.to_s.chomp('=').to_sym\n\n if config.key?(key)\n setter ? config[key] = args.shift : config[key]\n else\n super\n end\n end",
"def to_setter(field)\n field.to_s.concat(\"=\").to_sym\n end",
"def method=(tup)\n @method = tup\n end",
"def method=(tup)\n @method = tup\n end",
"def define_setter_for(name)\n define_method(\"#{name}=\") do |associated|\n instance_variable_set(\"@#{name}\".to_sym, associated)\n\n assign_id_for(name, associated)\n assign_type_for(name, associated)\n assign_serialized_attributes(name, associated)\n end\n end",
"def define_setter\n name = @name\n klass.send :define_method, \"#{name}=\" do |unit|\n send \"#{name}_value=\", unit.value\n send \"#{name}_unit=\", unit.unit.to_s\n end\n end",
"def gen_setter(method_spec)\n method_id = \"0x\" + calc_id(gen_method_id(method_spec[\"name\"], get_types(method_spec)))\n self.class.send(:define_method, method_spec[\"name\"].underscore << \"!\") do |*args|\n options = args[-1]\n encoded_inputs = W3::Encoder::encode_inputs(args[0..-2], method_spec[\"inputs\"])\n @eth.send_transaction!({\n \"from\" => options[\"from\"],\n \"to\" => @address,\n \"data\" => encoded_inputs.unshift(method_id).join\n })\n end\n end",
"def set_attribute(name, value); end",
"def __setter__\n \"#{self}=\"\n end",
"def []=(name, value)\n self.send((name.to_s+\"=\").to_sym, value) rescue nil\n end",
"def method_missing(method, *args)\n if method.to_s[-1,1] == '='\n self[method.to_s.tr('=','').to_sym] = args.first\n else\n self[method]\n end\n end",
"def name= val # Setter - set a value\n @name = val \n end",
"def define_magic_attr(name)\n define_method name do |*attrs|\n raise ArgumentError.new(\"wrong number of arguments\") if attrs.size > 1\n send(\"#{name}=\", attrs.first) if attrs.size == 1\n instance_variable_get(\"@#{name}\")\n end\n\n attr_writer name\n end",
"def method_missing(method_name, *args, &block)\n # Check if the method missing an \"attr=\" method\n raise unless method_name.to_s.end_with?(\"=\")\n\n setter = method_name\n getter = method_name.to_s.slice(0...-1).to_sym\n instance_var = \"@#{getter}\".to_sym\n\n # attr_writer\n define_singleton_method(setter) do |new_val|\n instance_variable_set(instance_var, new_val)\n end\n\n # attr_reader\n define_singleton_method(getter) { instance_variable_get(instance_var) }\n\n # Ignores all arguments but the first one\n value = args[0]\n\n # Actually sets the value on the instance variable\n send(setter, value)\n rescue MethodMissing\n # Raise error as normal, nothing to see here\n super(method_name, *args, &block)\n end",
"def subject=(value)\n unless value =~ METHOD_DEF\n raise ArgumentError, \"not a method definition: #{value}\"\n end\n \n @method_name = $1\n @arguments = scan_args($2)\n \n super\n end",
"def set_attrs (key, val)\n self.instance_variable_set(\"@#{key}\", val)\n self.class.send(:define_method, key, proc {self.instance_variable_get(\"@#{key}\")})\n end",
"def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end",
"def define_tag_setter_methods\n @tags.keys.each do |tag_name|\n next if respond_to? :\"#{tag_name}=\"\n if tag_name =~ /karma:(.*)/\n class_eval %{\n def karma\n def #{$1}=(new_value)\n update_tag_value('#{tag_name}', new_value)\n end\n end\n }\n else\n class_eval %{\n def #{tag_name}=(new_value)\n update_tag_value('#{tag_name}', new_value)\n end\n }\n end \n end\n end",
"def make_setter( key )\n\t\treturn Proc.new {|new_value| self.namespaced_hash[ key.to_sym ] = new_value }\n\tend",
"def name_setter(new_name)\n @name = new_name\n end",
"def op_set(attrname = nil)\n attrname ||= pop\n attrvalue = pop\n receiver = peek\n if receiver.respond_to?(:[]=)\n receiver[attrname] = attrvalue\n elsif receiver.respond_to?(:\"#{attrname}=\")\n receiver.send(:\"#{attrname}=\", attrvalue)\n else\n raise Error, \"Unable to set #{attrname} on #{receiver.inspect}\"\n end\n end",
"def method_missing(method_name, *args, &block)\n if method_name.to_s.end_with?('=')\n set_attribute(method_name, *args)\n elsif has_attribute?(method_name)\n get_attribute(method_name)\n else\n super\n end\n end",
"def define_writer_method(mod)\n mod.define_writer_method(self, \"#{name}=\".to_sym, @writer_visibility)\n self\n end",
"def method_missing(method, *args)\n if method.to_s.slice(-1, 1) == '='\n if args.size != 1\n raise ArgumentError.new(\"wrong number of arguments (#{args.size} for 1)\")\n end\n tags[method.to_s.chop] = args[0]\n else\n if args.size > 0\n raise ArgumentError.new(\"wrong number of arguments (#{args.size} for 0)\")\n end\n tags[method.to_s]\n end\n end",
"def method_missing(meth, *args, &block)\n meth_name = meth.to_s\n if meth_name[-1,1] == '='\n self[meth_name[0..-2].to_sym] = args[0]\n else\n self[meth] || self[meth_name]\n end\n end",
"def set_handler(method, val)\n send(\"#{method}=\", val)\n end",
"def method_missing(m, *args)\n m = m.to_s\n setter = /(.*)=$/.match(m)\n if setter\n raise ArgumentError, \"setters need 1 arg\" if args.length != 1\n @profile[setter[1]] = args.first\n\n else\n raise ArgumentError, \"getters can't have args\" if args.length > 0\n @profile[m]\n end\n end",
"def tag_set(p_tag_sym, p_val) tag.send(\"#{p_tag_sym.to_s}=\", p_val) end",
"def method=(value)\n @method = value\n end",
"def config_attr_writer(method_symbol, &block)\n configurable(method_symbol).writes_value(&block)\n end",
"def mattr_writer(*syms, &proc)\n receiver = self\n options = syms.extract_options!\n syms.each do |sym|\n raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\\w*$/\n class_exec do\n define_singleton_method \"#{sym}=\" do |obj|\n class_variable_set(\"@@#{sym}\", obj)\n end\n end\n\n unless options[:instance_writer] == false || options[:instance_accessor] == false\n class_exec do\n define_method \"#{sym}=\" do |obj|\n receiver.class_variable_set(\"@@#{sym}\", obj)\n end\n end\n end\n send(\"#{sym}=\", proc.call) if proc\n end\n end",
"def method_missing(meth, *args)\n meth = meth.to_s\n if meth =~ /=/\n self[meth.sub('=','')] = args.first\n else\n self[meth]\n end\n end",
"def method_missing(method, *args, &block)\n if method[-1] == '='\n # setter\n key = method.slice(0...-1).to_sym\n\n unless has_key?(key)\n super\n end\n self[key] = args[0]\n else\n unless has_key?(method)\n super\n end\n\n prop = self[method]\n if prop.is_a? JSFunction\n prop.call_with_instance(self, *args, &block)\n else\n prop\n end\n end\n end",
"def method_name=(_arg0); end",
"def method_name=(_arg0); end",
"def define_set_accessor(identifier, *locator, element, &block)\n define_method(\"#{identifier}=\".to_sym) do |*values|\n accessor =\n if block_given?\n instance_exec(&block)\n else\n reference_element(element, locator)\n end\n\n if accessor.respond_to?(:set)\n accessor.set(*values)\n else\n accessor.send_keys(*values)\n end\n end\n end",
"def method_missing(meth, *args, &blk)\n name = meth.to_s\n return evaluate(self[meth]) if name.size == 1\n # Ruby 1.8.7 doesn't let you do string[-1]\n key, suffix = name[0..-2].to_sym, name[-1..-1]\n case suffix\n when '='\n self[key] = args.first\n when '?'\n include? key\n when '!'\n raise Error, \"Setting :#{key} is not set\" unless include?(key)\n evaluate self[key]\n else\n evaluate self[meth]\n end\n end",
"def method_missing(method,val=nil)\n if val.nil?\n get(method)\n else\n method = method.to_s[0..-2].to_sym # get rid of = sign\n set(method,val)\n end\n end",
"def write_method=(val)\n @write_method = val if %w(:flock :normal).include(val)\n end",
"def method_missing(attr, *vals)\n\t\t\tattr_str = attr.to_s\n\t\t\tcase attr_str\n\t\t\twhen /^[a-zA-Z_]+$/\n\t\t\t\t#getter\n\t\t\t\tif @attributes.has_key? attr\n\t\t\t\t\treturn @attributes[attr]\n\t\t\t\telse\n\t\t\t\t\tsuper(attr, *vals) #method missing\n\t\t\t\tend\n\t\t\t\t\n\t\t\twhen /^[a-zA-Z_]+=$/\n\t\t\t\t#setter\n\t\t\t\tif vals.empty?\n\t\t\t\t\traise ArgumentError, \"No arguments provided to attribute setter #{attr_str}\"\n\t\t\t\tend\n\t\t\t\t@attributes[attr_str.slice(0..-2).to_sym] = vals.first\n\t\t\t\t\n\t\t\telse\n\t\t\t\tsuper(attr, *vals) #method missing\n\t\t\tend\n\t\tend",
"def method(method_name)\n \n @_method = method_name.to_s\n \n end",
"def method_missing(method, *args, &block)\n \n # The getter\n if @metadata.has_key?(method)\n return attribute_get(method)\n else\n # The setter\n \n if (attribute=method.to_s.match(/(.+)=$/).to_a.last)\n attribute_set(attribute, args.first)\n return\n end\n end\n \n super\n \n end",
"def setName _obj, _args\n \"_obj setName _args;\" \n end",
"def name=(value); end",
"def set attrib, value\n if attrib.is_a? String and attrib.include? \".\"\n syms = attrib.split(\".\")\n first = syms[0]\n rest = syms[1..-1].join(\".\")\n self.send(first).set(rest, value)\n else\n self.send(\"#{attrib}=\".to_sym, value)\n end\n end",
"def override_setters(*setters)\n setters.each do |setter|\n case setter\n\n #######################################################################\n ## facility_code\n #######################################################################\n when :facility_code\n define_method(:facility_code=) do |v|\n write_attribute(:facility_code, v.strip.upcase) if v.present?\n end\n\n #######################################################################\n ## institution\n #######################################################################\n when :institution\n define_method(:institution=) do |v|\n if v.present?\n v = v.to_s.gsub(\"'\", \"''\").strip.try(:upcase)\n write_attribute(:institution, v)\n end\n end\n\n #######################################################################\n ## ope6\n #######################################################################\n when :ope6\n define_method(:ope6=) do |v|\n if v.present? && !self.class.forbidden_word?(v.downcase)\n write_attribute(:ope6, self.class.pad(v.strip, 8)[1, 5])\n end\n end\n\n #######################################################################\n ## ope\n #######################################################################\n when :ope\n define_method(:ope=) do |v|\n v = v.try(:strip).try(:upcase) if v.is_a?(String)\n v = nil if self.class.forbidden_word?(v)\n\n write_attribute(:ope, self.class.pad(v, 8))\n self.ope6 = ope\n end\n\n #######################################################################\n ## state\n #######################################################################\n when :state\n define_method(:state=) do |v|\n write_attribute(:state, DS::State.get_abbr(v.strip)) if v.present?\n end\n\n #######################################################################\n ## miscellaneous\n #######################################################################\n else\n define_method(\"#{setter.to_s}=\".to_sym) do |v|\n col = self.class.columns.find { |col| col.name == setter.to_s }\n\n if v.is_a?(String)\n v = v.try(:strip)\n v = nil if self.class.forbidden_word?(v) || v.blank?\n v = v.to_s.gsub(\"'\", \"''\") if !v.nil?\n end\n\n if col.try(:sql_type) == \"boolean\"\n if !v.nil?\n v = self.class.truthy?(v) if v.is_a?(String)\n write_attribute(setter, v)\n end\n else\n write_attribute(setter, v)\n end\n end\n end\n end\n end",
"def set(name, value)\n update(name, value)\n end",
"def set(option, value)\n define_method(option) { value }\n end",
"def writer(brand, accessor, default)\n # classic setter scheme, it does nothing if value\n # parameter is not a `brand` instance though\n define_method \"#{accessor}=\".to_sym do |value|\n instance_variable_set \"@#{accessor}\", value if value.is_a? brand\n end\n\n # pedlar setter `accessor_with`\n # it sets instance variable with :\n # - fitting user-defined method\n # - or instance creation with passed params\n # - or value that must a be an instance of `brand`\n define_method \"#{accessor}_with\".to_sym do |*values|\n instance_variable_set \"@#{accessor}\", peddles(accessor, brand, *values)\n end\n end",
"def setter(name, metadata)\n re_define_method(\"#{name}=\") do |object|\n without_autobuild do\n if value = get_relation(name, metadata, object)\n if value.respond_to?(:substitute)\n set_relation(name, value.substitute(object.substitutable))\n end\n else\n __build__(name, object.substitutable, metadata)\n end\n end\n end\n self\n end",
"def method_missing method, *params, &block\n method = method.to_s\n if method[-1..-1] == '='\n self[method[0..-2]] = params[0]\n else\n self[method]\n end\nend",
"def method_missing(method, *args)\n\t\tvariable = method.to_s\n\n\t\tif variable[-1].chr == '='\n\t\t\tvariable.chop! # Remove the '='\n\t\t\tsetter = true\n\t\tend\n\n\t\tif Variables.include?(variable)\n\t\t\tvalue = eval('@' + variable)\n\t\t\tif setter\n\t\t\t\teval(\"@#{variable} = #{args[0].inspect}\")\n\t\t\t\tnotifyObservers\n\t\t\telse\n\t\t\t\treturn value\n\t\t\tend\n\t\telse\n\t\t\tsuper # Raise undefined method exception.\n\t\tend\n\tend",
"def insert_param_method_generic(param_name,method_name)\n setter_method = param_name + \"=\"\n if send(param_name)\n @new_item.send(setter_method,send(param_name).send(method_name))\n end\n end",
"def create_attr_methods(name, val)\n self.instance_variable_set \"@#{name}\", val\n self.class.class_eval do\n define_method(\"#{name}\") { val }\n end\n end",
"def []=(name, value)\n send(\"#{name}=\", value)\n end",
"def write_value_using_method_strategy(writer, key)\n writer.push_value(@object.send(key), key)\n end",
"def define_attr_method(name, value=nil, &block)\n sing = class << self; self; end\n sing.send :alias_method, \"original_#{name}\", name\n if block_given?\n sing.send :define_method, name, &block\n else\n # use eval instead of a block to work around a memory leak in dev\n # mode in fcgi\n sing.class_eval \"def #{name}; #{value.to_s.inspect}; end\"\n end\n end",
"def []=(name, value)\n set name.to_s, value.to_s\n end",
"def method_missing(method, *arg)\n # Raise an error if a method gets accessed which was not defined before\n raise RuntimeError, \"'rk.#{method.to_s}' is undefined\" unless method.to_s.include?(\"=\")\n\n # Define a method to return a value as set, for example rk.settings = 'set' defines\n # a method called \"settings\" which returns the string \"set\"\n key = method.to_s.sub(/=/, \"\")\n val = (arg || []).first.to_s\n\n instance_eval(%Q[\n def #{key}\n \"#{val}\"\n end\n ])\n\n # Store user-defined key\n @keys[key] = val\n end",
"def method_missing(method, *parameters)\n string = method.to_s\n if string[-1] == ?=\n assignment = true\n string = string[0..-2]\n end\n if attributes.keys.include? string\n if assignment\n update(string => parameters.first)\n else\n attribute(string)\n end\n elsif self.class.attribute_prefixes.include? string\n if assignment\n raise NotImplementedError.new(\"Mass assignment not yet supported to prefix\")\n else\n @attribute_prefix ||= {}\n @attribute_prefix[method] ||= AttributePrefix.new(self, string)\n end\n else\n super\n end\n end",
"def create_writer(klass, member)\n # We want to convert these members into attributes just like\n # as if they were declared using attr_accessor.\n new_meth = register MethodObject.new(klass, \"#{member}=\", :instance) do |o|\n o.parameters = [['value', nil]]\n o.signature ||= \"def #{member}=(value)\"\n o.source ||= \"#{o.signature}\\n @#{member} = value\\nend\"\n end\n add_writer_tags(klass, new_meth, member)\n klass.attributes[:instance][member][:write] = new_meth\n end",
"def cattr_setter_thread *names\n opts = Hash === names[-1] ? names.pop : EMPTY_HASH\n\n transform = opts[:setter_transform]\n transform = \"__val = (#{transform})\" if transform\n\n names.each do | name |\n instance_eval(expr = <<\"END\", __FILE__, __LINE__)\ndef self.#{name}= __val\n #{transform}\n Thread.current[:'#{self.name}.#{name}'] = [ __val ]\nend\nEND\n # $stderr.puts \"#{expr}\"\n end\n end",
"def method_missing(method, *args)\n if method.to_s =~ /=$/\n @attributes[ method.to_s.gsub(/=$/, '').to_sym ] = args\n else\n @attributes[method]\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end"
] |
[
"0.75186193",
"0.739029",
"0.7325416",
"0.73035663",
"0.7255241",
"0.71206915",
"0.70761937",
"0.7072722",
"0.70363855",
"0.69919664",
"0.69786155",
"0.6961414",
"0.6865732",
"0.68431723",
"0.6816614",
"0.68067795",
"0.67480546",
"0.67087877",
"0.66799504",
"0.6654127",
"0.6651107",
"0.6626688",
"0.6502044",
"0.6500363",
"0.6492692",
"0.6482521",
"0.64632463",
"0.64580566",
"0.64085484",
"0.6393488",
"0.639164",
"0.63799006",
"0.6363687",
"0.63587433",
"0.63208336",
"0.63036007",
"0.6288731",
"0.62793934",
"0.6275735",
"0.6275735",
"0.6274852",
"0.6257499",
"0.62524307",
"0.62504005",
"0.62451357",
"0.6242083",
"0.6241815",
"0.6231082",
"0.6214702",
"0.6186312",
"0.6153546",
"0.61388814",
"0.6138826",
"0.61153466",
"0.6115016",
"0.6104884",
"0.6095751",
"0.6093067",
"0.60579956",
"0.603537",
"0.60323304",
"0.60134304",
"0.60080224",
"0.60023546",
"0.60017866",
"0.5992552",
"0.5983431",
"0.59795606",
"0.5968198",
"0.5956104",
"0.5956104",
"0.59548664",
"0.5946883",
"0.5938022",
"0.5933047",
"0.59200877",
"0.5917633",
"0.5914011",
"0.5910523",
"0.5901509",
"0.5900072",
"0.5896089",
"0.5892157",
"0.5888895",
"0.5885891",
"0.5884007",
"0.5873658",
"0.58713156",
"0.5867116",
"0.5863475",
"0.5846944",
"0.5842292",
"0.5839418",
"0.581074",
"0.5807814",
"0.57925564",
"0.5789935",
"0.57686675",
"0.576792",
"0.5766991",
"0.5766991"
] |
0.0
|
-1
|
If doesn't have a current appointment, was already given a dose, allow them to all changes they'd like to Otherwise check if patient can schedule (checking the conditions)
|
def can_update_profile?
!@patient.appointments.current || # if there's no appointment, allow
@patient.doses.count.positive? || # if there's already a dose, allow
@patient.can_schedule? # if it's the user 1st dose and there's an appointment, check if they can still schedule
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def doctor_double_booked #We check this against all of the doctors appointments \n this_start = self.start_time #Instance methods that are called on a particular doctor's appointment \n this_end = self.end_time \n conflict = doctor.appointments.any? do |appointment| \n #Look through all of the doctors appointments and checks if there are any overlapping appointments (start_time, end_time). \n #any? returns true or false. \n \n other_start = appointment.start_time \n other_end = appointment.end_time\n other_start < this_end && this_end < other_end || other_start < this_start && this_start < other_end\n # other_start < this_end && this_end < other_end \n #This means that this appointment ends in the middle of an existing appointment.\n \n # other_start < this_start && this_start < other_end \n #This means that this appointment starts in the middle of an existing appointment. \n end\n if conflict #true or false \n errors.add(:doctor, 'has a conflicting appointment') \n # Adds an error message to the appointment with an error message about the doctor. The doctor is the key, the message is the value. \n end\n end",
"def doctor_double_booked\n this_start = self.start_time\n this_end = self.end_time\n conflict = doctor.appointments.any? do |appointment|\n other_start = appointment.start_time \n other_end = appointment.end_time\n other_start < this_end && this_end < other_end || other_start < this_start && this_start < other_end\n end\n if conflict\n errors.add(:doctor, 'has a conflicting appointment')\n end\n end",
"def can_cancel_and_reschedule?\n return true unless follow_up_for_dose\n\n Time.zone.now > can_change_after\n end",
"def appointment?\n !open && !close\n end",
"def appointment?\n !open && !close\n end",
"def time_collision_validation\n\t\tappointments = Appointment.all\n\n\t\t#if duration is equals to 0, it means it is fixed pay. \n\t\t#Here, duration is set to 0 so it will not be validated \n\t\t#This will execute if is_pay_per hour is set to 0\n\t\tif @start_date.present? && @start_time.present? && duration == 0.to_s\n\t\t\tstart_at = Time.parse(\"#{@start_date} #{@start_time}\") + (1.hours)\n\t\t\t\n\t\t\tappointments.each do |a|\n\t\t\t\t# will ensure that the appointment to compare will not be compared to itself in the database if it exists\n\t\t\t\tif a.id.to_s != @appointment_id.to_s\n\t\t\t\t\t# compare fixed-pay input to pay per hour appointment\n\t\t\t\t\tif a.task.is_pay_per_hour && start_at < a.end_at && start_at >= a.start_at \n\t\t\t\t\t\terrors.add(:start_time, \"Please select a different date or time.\")\n\t\t\t\t\t\terrors.add(:start_date, \"An appointment is already \n\t\t\t\t\t\t\tset at #{a.start_at.strftime(\"%I:%M%p\")}, #{a.start_at.strftime(\"%d/%m/%Y\")} \n\t\t\t\t\t\t\tto #{a.end_at.strftime(\"%I:%M%p\")} on #{a.end_at.strftime(\"%d/%m/%Y\")}. \n\t\t\t\t\t\t\tPlease select a different date or time.\")\n\t\t\t\t\t\tbreak\n\n\n\t\t\t\t\t\t#compare fixed-pay input to fixed pay appointment\n\t\t\t\t\telsif !a.task.is_pay_per_hour && start_at == a.start_at \n\t\t\t\t\t\terrors.add(:start_time, \"Please select a different date or time.\")\n\t\t\t\t\t\terrors.add(:start_date, \"A fixed pay appointment is aleady set at #{a.start_at.strftime(\"%I:%M%p\")}\n\t\t\t\t\t\t\t, #{a.start_at.strftime(\"%d/%m/%Y\")}. \n\t\t\t\t\t\t\tPlease select a different date or time.\")\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend \t\n\t\t\t\tend \t\n\t\t\tend\n\n\n\t\t\t\t#Here, duration should be present and will be always validated\n\t\t\t\t#This will execute if is_pay_per hour is set to 1\n\t\t\telsif @start_date.present? && @start_time.present? && duration.present?\n\t\t\t\tstart_at = Time.parse(\"#{@start_date} #{@start_time}\") + (1.hours)\n\t\t\t\tend_at = Time.parse(\"#{@start_date} #{@start_time}\") + (@duration.to_f.hours+ (1.hours))\n\n\t\t\t\tappointments.each do |a|\n\t\t\t\t\t# will ensure that the appointment to compare will not be compared to itself in the database if it exists\n\t\t\t\t\tif a.id.to_s != @appointment_id.to_s\n\t\t\t\t\t\t# compare pay per hour input to pay per hour appointment\n\t\t\t\t\t\tif a.task.is_pay_per_hour && start_at < a.end_at && a.start_at < end_at \n\n\t\t\t\t\t\t\terrors.add(:start_time, \"Please select a different date or time.\")\n\t\t\t\t\t\t\terrors.add(:start_date, \"An appointment already \n\t\t\t\t\t\t\t\texists at #{a.start_at.strftime(\"%I:%M%p\")}, #{a.start_at.strftime(\"%d/%m/%Y\")} \n\t\t\t\t\t\t\t\tto #{a.end_at.strftime(\"%I:%M%p\")} on #{a.end_at.strftime(\"%d/%m/%Y\")}. \n\t\t\t\t\t\t\t\tPlease select a different date or time.\")\n\t\t\t\t\t\t\tbreak\n\n\t\t\t\t\t\t\t#compare pay per hour input to fixed pay appointment\n\t\t\t\t\t\telsif !a.task.is_pay_per_hour && a.start_at <= end_at && a.start_at >= start_at\n\n\t\t\t\t\t\t\terrors.add(:start_time, \"Please select a different date or time.\")\n\t\t\t\t\t\t\terrors.add(:start_date, \"A fixed pay appointment is aleady set at #{a.start_at.strftime(\"%I:%M%p\")}\n\t\t\t\t\t\t\t\t, #{a.start_at.strftime(\"%d/%m/%Y\")}. \n\t\t\t\t\t\t\t\tPlease select a different date or time.\")\n\t\t\t\t\t\t\tbreak\t\t\t\t\n\t\t\t\t\t\tend\t\t\t\n\t\t\t\t\tend \n\t\t\t\tend\n\t\t\tend \n\t\tend",
"def appointment_unique_with_doctor_in_clinic\n times_taken = []\n begin\n self.doctor.appointments.confirmed.each do |appt|\n unless appt.id == self.id\n times_taken << appt.appointment_time\n end\n end\n rescue NoMethodError\n errors.add(:doctor_id, 'No doctor specified')\n end\n errors.add(:appointment_time, \"Time not available\") if times_taken.include?(appointment_time)\n end",
"def tutor_double_booked\n lesson_start = self.start_time\n lesson_end = self.end_time\n overlap = tutor.appointments.any? do |appointment|\n check_start = appointment.start_time\n check_end = appointment.end_time\n check_start < lesson_end && lesson_end < check_end || check_start < lesson_start && lesson_start < check_end\n end\n if overlap\n errors.add(:tutor, 'there is a conflictiong appointment')\n end\n end",
"def multi_appointment_receipt_allowed?() # We must validate record existance (for AS security layer):\n return false unless existing_record_check? # (current record instance could be empty or new)\n # Existing records must be checked for this also:\n ( Appointment.find_all_unpayed_for_patient( self.id ).size > 0 )\n end",
"def has_appointment?(date, time)\n datetime = Temporal.generate_datetime(date, time)\n\n !is_available?(datetime, 20) #the time is broken up into 20 minute blocks\n end",
"def correct_meeting_only\n redirect_to current_user if current_user.service_user?\n if current_user.volunteer?\n current_user.initiatives.each do |init|\n return if init.meetings.include?(Meeting.find(params[:id]))\n end\n flash[:danger] = 'You are not allowed to access that page.'\n redirect_to current_user\n end\n end",
"def check_overlap\n appointments = Appointment.all\n current_start = DateTime.strptime(self.start_time,\"%m/%d/%y %H:%M\").to_time\n current_end = DateTime.strptime(self.end_time,\"%m/%d/%y %H:%M\").to_time\n\n appointments.each do |appt|\n appt_start = DateTime.strptime(appt.start_time,\"%m/%d/%y %H:%M\").to_time\n appt_end = DateTime.strptime(appt.end_time,\"%m/%d/%y %H:%M\").to_time\n\n ## if the appointment being checked is a new appointment ##\n if @new_appt\n if current_start >= appt_start && current_start <= appt_end\n @valid = false\n elsif current_end >= appt_start && current_end <= appt_end\n @valid = false\n end\n\n ## if the appointment being checked is an old appointment being updated ##\n else\n if current_start > appt_start && current_start < appt_end\n @valid = false\n elsif current_end > appt_start && current_end < appt_end\n @valid = false\n end\n end\n\n end\n @valid\n p @valid\n end",
"def valid_appointments(base_time)\n transform_blocks_to_appointments(valid_blocks(base_time))\n end",
"def cannot_delete_with_appointments\n has_appointment = Appointment.find_by(patient_id: id)\n errors.add(:base, 'It is not possible to delete a patient with appointment(s).') unless has_appointment.nil?\n end",
"def update_associated_appointments()\n if self.is_payed? # When the receipt is flagged as 'payed', make sure all appointments are too:\n # [Steve, 20100501] The added check on the structure of Appointments is\n # needed to be compliant with the previous version of the structure of the\n # table, otherwise the migration from older DB version fails.\n Appointment.update_all( \"is_payed=1\", ['receipt_id = ?', self.id] ) if Appointment.new.attributes.include?('receipt_id')\n end\n end",
"def must_pay_to_avoid_cancellation\n\t\tif @event.start_date < (Time.now + 1.week) && @event.paid == false \n\t\t\t#cannot book event\n\t\tend\n\tend",
"def appt_started?\n appointment.start_date.present?\n end",
"def has_appointment?(current_employee)\n appointments = current_employee.brand.appointments.where(customer_id: self.id)\n unless appointments.empty?\n if appointments.last.date >= Date.today\n true\n end\n else\n false\n end\n end",
"def create\n @appointment = Appointment.new(params[:appointment])\n @appointment.patient_id = current_user.id if current_user.is_patient? \n @appointment.approve_status = 1\n if @appointment.save\n DoctorPatient.create({:patient_id => @appointment.patient_id, :doctor_id => @appointment.doctor_id })\n UserMailer.appointment_pending(@appointment).deliver\n redirect_to \"/appointments\"\n else\n render :new\n end\n end",
"def cancel_appointment appointment\n time_range = TimeRange.new appointment.started_at, appointment.finished_at\n if appointment.daily_schedule_id == self.id\n self.free time_range\n true\n end\n false\n end",
"def can_schedule?\n conditions.any?\n end",
"def is_available?(datetime, duration, id = 0)\n\n #Do any appointments start during this time? Does this start during any of the appointments' times?\n appointments.each do |appointment|\n #it doesn't matter if the conflict is with the appointment about to be changed.\n if appointment.id != id\n #check if they're on the same day first\n if datetime.to_date == appointment.start_time.to_date\n #query 1: does the old appointment start during the new one? \n q1 = Temporal.is_during_appointment?(appointment.start_time, datetime, appointment.duration)\n\n #query 2: does the new appointment start during the old one?\n q2 = Temporal.is_during_appointment?(datetime, appointment.start_time, duration)\n\n if q1 || q2\n return false\n end\n end\n end\n end\n end",
"def appointment_on_is_valid\n return if appointment_on.nil? || !appointment_on_changed?\n\n unless (appointment_on.to_date - Date.today) >= MINIMUM_DAYS\n errors[:appointment_on] << \"should be at least #{MINIMUM_DAYS} days from today\"\n end\n end",
"def create\n\n # physician = Physician.find(physician_id)\n # unless physician.patients.where(email: email).exists?\n # patient = Patient.find_or_create_by(email: email)\n # physician.appointments.create(patient: patient)\n\n unless Appointment.where(doctor_id: appointment_params[:doctor_id], appointment_date_id: appointment_params[:appointment_date_id], time_table_id: appointment_params[:time_table_id]).exists?\n # unless Appointment.where(doctor_id: requested_doctor, appointment_date_id: requested_date, time_table_id: requested_timing).exists?\n @appointment = Appointment.new(appointment_params)\n @patient_id = @current_patient.id\n end\n\n # if @appointment.try(:save)\n # if !@appointment.nil? && @appointment.save\n if @appointment && @appointment.save\n puts \"Im saving!\"\n redirect_to @appointment, notice: 'Appointment was successfully created.'\n else\n puts \"Failed saving!\"\n redirect_to new_appointment_url, notice: 'Appointment was NOT successfully created.'\n end\n end",
"def reschedule_appointment\n if @patient.appointments.length < 1\n puts \"You currently have no appointments\"\n sleep(2)\n else\n @prompt.select \"Which appointment would you like to Reschedule?\" do |menu|\n @patient.appointments.each do |appt|\n menu.choice appt.time, -> { change_appt(appt) }\n end\n menu.choice \"<Go Back>\", -> { appointment_system } #back \n end\n end\n @patient.reload\n appointment_system\n end",
"def no_appts_avail?\n appointments.empty?\n end",
"def approval\n @appointments = Appointment.in_clinic(@admin).requests.\n order_by_time.includes(:doctor, :patient).not_past\n end",
"def expire_appointment\n #if the appointment has not been booked on the day of, the appointment expires. \n if self.expired?\n self.status = Status::EXPIRED\n self.save\n end\n end",
"def update\n if !Appointment.registred_this_day.where(user_id: current_user.id, appointment_type: appointment_params[:appointment_type]).blank?\n flash[:alert] = t('flash.actions.alert.appointment_exists')\n redirect_to '/appointments'\n return \n end\n respond_to do |format|\n if @appointment.update(appointment_params)\n format.html { redirect_to @appointment, notice: t('flash.actions.notice.appointment_updated') }\n format.json { render :show, status: :ok, location: @appointment }\n else\n format.html { render :edit }\n format.json { render json: @appointment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @appointment = Appointment.new(appointment_params)\n if @appointment.check_future && @appointment.check_overlap\n if @appointment.save\n render json: @appointment, status: 201\n else\n render json: @appointment.errors, status: 422\n end\n end\n end",
"def update\n appointment = current_user.appointments.find(params[:appointment_id])\n case params[:command]\n when 'schedule'\n appointment.schedule!\n when 'start'\n appointment.start!\n when 'complete'\n appointment.complete!(params[:time_spent_in_min])\n # else\n # TO DO: handle error\n end\n redirect_to root_path\n end",
"def populate_with_appointments(\n appointments_start_dates\n )\n appointments_start_dates.each do |start_date|\n expert = Expert.find(expert_id)\n if expert.available_for_datetime(start_date)\n appointment = appointments.new(\n user_id: user_id,\n service_id: service_id,\n expert_id: expert_id,\n description: description,\n start_date: start_date,\n duration_in_min: service.duration_in_min,\n type: 'OpenAppointment'\n )\n\n if appointment.save\n appointments << appointment\n true\n else\n puts \"---- 🔸 FAILURE | while saving appointment \\\n error:#{appointment.errors.messages}🔸\\\n in populate_with_appointments\"\n false\n end\n else\n puts \"---- 🔸 FAILURE | Expert(#{expert.id}) not available for \\\n start_date #{start_date}🔸in populate_with_appointments\"\n return false\n end\n end\n end",
"def is_reservation_and_has_conflicts?\n self.is_reservation? && self.has_conflicts?\n end",
"def overdue?\n if is_appointment?\n start_date.to_date < Time.zone.now.to_date\n else\n open? && end_date.to_date < Time.zone.now.to_date\n end\n end",
"def can_create_overdue_or_under_repair_schedule?\n kit_schedule = KitSchedule.new\n kit_schedule.current_user = User.current_user\n return kit_schedule.can_create_overdue_or_under_repair?(self.center_ids)\n end",
"def set_alarm(employed, vacation)\n employed && !vacation\nend",
"def has_appt?\n !appt_date.blank?\n end",
"def validate_for_another_reservation\n if start_at && end_at && BUSY_STATUSES.include?(self.status)\n errors.add(:start_at, 'Another reservation already exists for these dates.') if exists_other_reservations_in_same_period?\n end\n end",
"def set_alarm(employed, vacation)\n if employed == true && vacation == false\n true\n else\n false\n end\nend",
"def has_valid_date?\n self.time_event < Time.now.advance(days: 1)\n end",
"def check_appointment_date\n if date < Date.today\n errors.add(:appointment_date, \"can't be in the past\")\n end\n end",
"def do_scheduling?\n\t\t!self.scheduled_at.blank?\n\tend",
"def perform(appointment_id)\n @appt = Appointment.find(appointment_id)\n @date = @appt.appt_reminder_email_time.to_date\n if @date == Date.today && @appt.status != 'Cancelled'\n AppointmentMailer.appointment_reminder_for_tutor(appointment_id)\n AppointmentMailer.appointment_reminder_for_student(appointment_id)\n end\n end",
"def appointment_complete\n end",
"def authorized_for?(*args)\n return false if current_user.nil? # If current_user is not defined or the model is accessed outside of the request/response cycle, bail out\n is_allowed = current_user.can_do( :appointments, args[0][:action] )\n\n return is_allowed && multi_appointment_receipt_allowed? if args[0][:column].blank? && (args[0][:action] == :issue_receipt)\n return is_allowed\n end",
"def puede_coger_vacaciones\n if start_time.past?\n errors.add(:pasado, \": aun no inventamos vacaciones al pasado\")\n end\n\n if empleado.periodo_vacacionals.count > 0\n if empleado.periodo_vacacionals.count > 1\n errors.add(:periodos, \": tienes demasiados\")\n else\n primer_periodo = empleado.periodo_vacacionals.first\n dias_restantes = (primer_periodo.end_time - primer_periodo.start_time).to_int\n if dias_restantes < 8\n errors.add(:dias, \": has pedido demasiados\")\n end\n end\n\n acts_en_periodo = empleado.actividads\n .where(\"start_time <= ?\", end_time)\n .where(\"end_time >= ?\", start_time)\n .where(finalizado: false)\n .count\n\n vacs_en_periodo = empleado.periodo_vacacionals\n .where(\"start_time <= ?\", end_time)\n .where(\"end_time >= ?\", start_time)\n .count\n\n if acts_en_periodo > 0 && vacs_en_periodo > 0\n errors.add(:tareas, \": tienes tareas pendientes esas fechas\")\n end\n end\n end",
"def exclusive_schedule\n if Schedule.where('init >= ? AND init <= ?', init, finish).any?\n errors.add(:base, \"Já existe uma reserva para esse horário\")\n end\n end",
"def can_enroll?\n self.self_enrollment_allowed && effective_cutoff_date >= Time.now\n end",
"def booked?\n if self.appointments.count == 0\n return false # It is not booked.\n elsif self.appointments.count == 2\n return true # It is booked.\n elsif self.appointments.count == 1 and !self.appointments.last.closed?\n return false # It is not booked.\n else\n return true # It is booked.\n end\n end",
"def can_reserve\n if !@contestproblem.in_correction? && !@contestproblem.in_recorrection? && !@contestsolution.official?\n redirect_to @contestproblem\n end\n end",
"def volunteering_allowed?\n # As of today, cannot volunteer if project is in 'parking lot'\n if self.event.nil? then\n return false\n else\n return self.event.volunteering_enabled?\n end\n end",
"def check_lesson_plan\n current_schedule = \n submitted_lesson_plan = LessonPlan.find(:all, :conditions => ['is_submitted=?', true]).map(&:schedule)\n if submitted_lesson_plan.include?(self.id)\n #lesson plan created, schedule editable? #issue arise during training : lesson plan first created by lecturer, schedule used to be last minute produce by Coordinator\n #errors.add_to_base \"tak bole la\"\n # raise I18n.t(\"weeklytimetable_detail.removal_not_allowed\")\n return false\n end\n end",
"def is_slot_already_passed?\n\t\tunless self.date_of_booking != Time.zone.now.beginning_of_day \n\t\t\tunless self.resource.next_time_slots.include?(self.resource.timeslots[self.slot])\n\t\t\t\tself.errors[:slot_avaibility] << \"=> This slot is already passed\"\n\t\t\tend\n\t\tend\n\tend",
"def can_procreate_during?(period)\n fertility_range.overlaps? period if (period and fertility_range)\n end",
"def pet_overlap\n this_start = self.start_time\n this_end = self.end_time\n overlap = veterinarian.appointments.any? do |appointment|\n other_start = appointment.start_time\n other_end = appointment.end_time\n other_start < this_end && this_end < other_end || other_start < this_start && this_start < other_end\n end\n if overlap\n errors.add(:pet, 'has a conflicting appointment')\n end\n end",
"def test_onetimeappointment\n \n appt = OneTimeAppointment.new(\"Room 202\", \"ISM210\", 1, 30, 26, 2, 2018)\n \n assert_equal \"Room 202\", appt.location()\n assert_equal 1,appt.hour\n assert_equal \"ISM210\", appt.purpose()\n assert_equal 30,appt.min\n assert_equal 26,appt.day\n assert_equal 2018,appt.year\n assert_equal \"Room 202 ISM210 1 30 26 2 2018\", appt.to_s\n assert_equal true, appt.occurs_on?(2018, 2, 26)\n assert_equal false, appt.occurs_on?(2015, 6, 17)\n \n end",
"def book_once_aday\n errors.add(:user, 'Guest can book only once a day') if booked_in_same_day?\n end",
"def approve_deny\n appointment = Appointment.find(params[:appointment_id])\n if params[:confirmed]\n appointment.update_attribute(:request, false)\n appointment.email_confirmation_to_patient(:approve)\n render status: 200, json: {\n status: :confirmed,\n message: 'Appointment confirmed'\n }\n else\n appointment.email_confirmation_to_patient(:deny)\n appointment.destroy\n render status: 200, json: {\n status: :deleted,\n message: 'Appointment denied'\n }\n end\n # if params.has_key?(:approve)\n # appointment.request = false\n # appointment.save!\n # appointment.email_confirmation_to_patient(:approve)\n # elsif params.has_key?(:deny)\n # appointment.email_confirmation_to_patient(:deny)\n # appointment.destroy\n # end\n # redirect_to appointment_approval_path(@admin.id)\n end",
"def can_create_program_schedule?\n program_teacher_schedule = ProgramTeacherSchedule.new\n program_teacher_schedule.current_user = User.current_user\n program_teacher_schedule.teacher = self\n return program_teacher_schedule.can_create?(self.center_ids)\n end",
"def can_change_after\n follow_up_for_dose.created_at + follow_up_for_dose.follow_up_in_days.days -\n Rails.configuration.x.schedule_up_to_days.days\n end",
"def my_appointments \n #look through all the appointments \n my_appointments == Appointment.all.select do |apt|\n apt.doctor == self \n end \n end",
"def is_required?\n return self.schedule_status == 'reschedule' ? true : false\n end",
"def can_schedule?(slot, employee, position, location)\n !existing_shifts.user_scheduled_at(employee.id, slot.x, slot.y) &&\n !existing_shifts.user_scheduled_during_day(employee.id, slot.x, location.id) &&\n !existing_shifts.user_scheduled_at(employee.id, slot.x, slot.y) &&\n slot.not_full? &&\n slot.position_room_available?(position.name) &&\n !minmax_not_eligible(slot, employee) &&\n not_during_time_off(slot, employee)\n end",
"def admited?\n return true unless admited_on.nil?\n end",
"def reschedule_appointment\n if @client.appointments.length < 1\n puts \"You currently have no appointments\"\n sleep(2)\n else\n @prompt.select \"Which appointment would you like to Reschedule?\" do |menu|\n @client.appointments.each do |appt|\n menu.choice appt.time, -> { change_appt(appt) }\n end\n menu.choice \"<Go Back>\", -> { appointment_system } #back \n end\n end\n @client.reload\n\n appointment_system\n end",
"def set_appointment\n @appointment = Appointment.find(params[:id])\n authorize @appointment\n end",
"def meeting_conflict?(other)\n return false if self.start_time.nil? or other.start_time.nil?\n section_days = other.days.split(\"\")\n section_days.each do |day|\n if( self.days.include?(day) )\n if (self.start_time.to_i >= other.start_time.to_i and self.start_time.to_i <= other.end_time.to_i) or \n (other.start_time.to_i >= self.start_time.to_i and other.start_time.to_i <= self.end_time.to_i)\n return true\n end \n end\n end\n return false\n end",
"def appointment_pending(appoint_obj)\n @doctor = Doctor.find_by_id(appoint_obj.doctor_id)\n @patient = Patient.find_by_id(appoint_obj.patient_id)\n mail(:to => @doctor.email, :subject => \"New Appointment\")\n end",
"def check_overlaps_cargo_department\n\t\t# if some day of availabilityes overlaps whith new period availability.\t\n\t\tav=Availability.where(:department_id => department_id).where('upper(cargo) like ?',\"#{cargo.upcase}\")\n\t\t\t.where(\"((desde - ?) * (? - hasta)) >= 0\", hasta, desde).where(:status => true)\n\n\t\tif av.count>0 # availabilit\n\t\t\t\t\terrors.add(:cargo,\" Ya existe un periodo de disponibilidad mínima para el cargo: '#{cargo}' cuyas fechas coinciden.\")\t\n\t\tend\n\tend",
"def in_force?\n if self.effective_date.nil?\n false\n elsif self.termination_date.nil?\n Date.today >= effective_date\n else\n Date.today >= effective_date and Date.today < termination_date\n end\n end",
"def require_same_organizer\n if current_organizer != @event.organizer and !current_organizer.admin?\n flash[:danger] = \"You can only edit or delete your own events\"\n redirect_to root_path\n end \n end",
"def check_conflict\n\n params[:id] = params[:id] ? params[:id] : 0\n flag = false\n arr_wd_sche_now = params[:a_day_check].each.map{|c| c.to_i}\n if params[:repeat_sche] == \"false\"\n start_date = format_date(params[:start_date])\n end_date = format_date(params[:end_date])\n @schedules = current_user.working_schedules.where(\"(:start_date BETWEEN start_date AND end_date) AND (:end_date BETWEEN start_date AND end_date) AND active = TRUE\",start_date: start_date, end_date: end_date).where.not(id: params[:id])\n @schedules.each do |sc|\n arr_wd_sches = sc.working_days.select(\"day_of_week\").where(open: true).map{ |w| w.day_of_week}\n arr_wd_sches.each do |c|\n if arr_wd_sche_now.include? c\n flag = true\n end\n end\n end\n render json: flag\n else\n start_date = format_date(params[:start_date])\n @schedules = current_user.working_schedules.where(\"(end_date >= :today) AND active = TRUE\",today: Date.today).where.not(id: params[:id])\n @schedules.each do |sc|\n arr_wd_sches = sc.working_days.select(\"day_of_week\").where(open: true).map{ |w| w.day_of_week}\n arr_wd_sches.each do |c|\n if arr_wd_sche_now.include? c\n flag = true\n end\n end\n end\n render json: flag\n end\n end",
"def flag_for_pickup \n if start_dt_tm && (TzTime.zone.utc_to_local(start_dt_tm).to_date <= TzTime.now.to_date ) && #Is this portion of the check necessary\n end_dt_tm && (TzTime.zone.utc_to_local(end_dt_tm).to_date >= TzTime.now.to_date) && #Is this portion of the check necessary\n Schedulehelper.IsEntryDueOn(self,TzTime.now.to_date) \n #On update, if the entry is already marked for due today, then skip this step\n EntryStatus.flag_entry(self) if entry_status == nil || !is_due_today\n #Update account_detail if not already\n user = self.user\n if !user.are_tasks_flagged_today \n user.account_detail.update_attribute(:tasks_last_flagged_on, TzTime.now.utc)\n end \n \n elsif entry_status && is_due_today #Here 'is_due_today' is returning the status as it was before the update since it is merely a flag \n #This case is to catch while the entry is being updated and if the entry's frequency schedule changed\n #in such a way where it is not due to day anymore\n EntryStatus.remove_flag(self)\n elsif entry_status == nil\n #Entry either starts in the future or not due today \n #Create a dummy record so that if the entry is ended right away, it can be recorded\n self.entry_status = EntryStatus.new( :user_id => self.user_id) \n end\n end",
"def check_existing_attendee\n @attendee = @event.event_attendees.find_by(user: current_api_user)\n\n update_attendee if @attendee.present?\n end",
"def notify_ready\n appointment = Appointment.find(params[:appointment_id])\n flash[:danger] = 'Patient has not checked in' unless appointment.checked_in?\n appointment.push_notify_ready\n redirect_to admin_appointments_path(@admin)\n end",
"def vet_overlap\n this_start = self.start_time\n this_end = self.end_time\n return if this_end < this_start\n overlap = veterinarian.appointments.any? do |appointment|\n other_start = appointment.start_time\n other_end = appointment.end_time\n other_start < this_end && this_end < other_end || other_start < this_start && this_start < other_end\n end\n if overlap\n errors.add(:veterinarian, 'has a conflicting appointment')\n end\n end",
"def update\n #@reservation = Reservation.new(reservation_params)\n #Same date constraints\n if @reservation.date!=@reservation.start_time.to_date\n redirect_to rooms_path, notice:'Dates should match' and return\n end\n #duration constraint=>automatically assigned\n if params[:duration].to_i==0\n @reservation.end_time=@reservation.start_time+60.minutes\n else \n @reservation.end_time=@reservation.start_time+params[:duration].to_i.minutes\n end\n #Date Constraints\n if (@reservation.date < Date.current() || @reservation.date - Date.current() >7)\n redirect_to rooms_path, notice:'Failed due to date constraints' and return\n end\n #Time Constraints\n if (@reservation.start_time<Time.now)\n redirect_to rooms_path, notice: 'Failed due to time constraints' and return\n end\n #Member Overlap\n @reservations = Reservation.where(\"member_id=? AND date=? AND (start_time, end_time) overlaps (?,?) AND id <> ?\", @reservation.member_id, @reservation.date, @reservation.start_time, @reservation.end_time,@reservation.id)\n if !(is_admin?)\n if !(@reservations.empty?)\n redirect_to rooms_path, notice: 'Failed due to member constraint' and return\n end\n end\n #Room Overlap\n @reservations = Reservation.where(\"room_id=? AND date=? AND (start_time, end_time) overlaps (?,?) AND id<> ?\", @reservation.room_id, @reservation.date, @reservation.start_time, @reservation.end_time,@reservation.id)\n if !(@reservations.empty?)\n redirect_to rooms_path, notice: 'Failed due to room overlap' and return\n end\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: \"Success\"}\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def correct_calendar\n @calcheck=Department.find(Calendar.find(params[:id]).department_id)\n redirect_to(calendars_url) unless current_emp.id==@calcheck.enterprise_id || current_user.role>3 \n end",
"def valid_for_grading?(answer)\n return true if @assessment.autograded?\n return true unless answer.specific.is_a?(Course::Assessment::Answer::Programming)\n\n answer.specific.attempting_times_left > 0 || can?(:manage, @assessment)\n end",
"def must_not_be_a_project_observation\n\n if ProjectObservation.first(:conditions => {:observation_id => self.observation_id, :project_id => self.project_id})\n errors.add(:observation_id, \"can't be used to make invitation when project_observation exists for same observation_id and project_id\")\n end\n true\nend",
"def flagged_case_responded_to_in_time_for_stats_purposes?\n responding_team_assignment_date = transitions.where(\n event: \"assign_responder\",\n ).last.created_at.to_date\n\n disclosure_approval_date = transitions.where(\n event: \"approve\",\n acting_team_id: default_clearance_team.id,\n ).last.created_at.to_date\n\n internal_deadline = @deadline_calculator.internal_deadline_for_date(\n correspondence_type, responding_team_assignment_date\n )\n\n internal_deadline >= disclosure_approval_date\n end",
"def check_if_needs_approval\r\n self.suspended_at = Time.now if Setting.user_signup == :needs_approval && !self.admin\r\n end",
"def create\n #@doctor = Doctor.find(params[:doctor_id])\n # @appointment = @doctor.appointments.build(params.require(:appointment).permit(:startTime, :comment, :patient_id, :doctor_id))\n # @appointment = Appointment.new(appointment_params)\n #@appointment.startTime = params[:appointment][:startTime]\n #@appointment.comment = params[:appointment][:comment]\n # @appointment.patient_id = params[:appointment][:patient_id]\n #@doctor_id1 = params[:appointment][:doctor_id]\n #@appointment.appointmentdate = params[:appointment][:appointmentdate]\n @doctor = Doctor.find(params[:doctor_id])\n @appointment = @doctor.appointments.build(params.require(:appointment).permit(:appointmentdate, :startTime, :comment, :patient_id, :doctor_id))\n #respond_to do |format|\n # @appointments_list = Appointment.all\n \n @appointment.patientname=current_user.email\n \n \n if @appointment.save\n # format.html { redirect_to @appointment, notice: 'Appointment was successfully created.' }\n #format.json { render :show, status: :created, location: @appointment }\n redirect_to doctor_appointment_path(@doctor, @appointment)\n else\n \n # format.html { render :isAvailable }\n render 'new'\n end\n \n \n end",
"def on_same_day?(reservation)\n (reservation.blank? || reservation.start_dt.blank?) ? false : reservation_on_day?(\"start_day\", reservation.start_dt.strftime('%Y-%m-%d'))\n end",
"def check_authorization\n @can_edit = can_blank_timetable?('edit')\n @can_show = can_blank_timetable?('show')\n end",
"def can_activate?\n self.person && self.person_match? && self.has_not_expired?\n end",
"def validate_time(start_time, end_time)\n\t\t\t\ttime_now = Time.now.strftime(\"%m/%d/%Y %H:%M\")\n\t\t\t\tappointments = Appointment.all\n\t\t\t\ttoday = start_time.split[0]\n\t\t\t\ttoday_appts = appointments.where(start_time: today)\n\t\t\t\tresult = false\n\n\t\t\t\tif start_time > time_now\n\t\t\t\t\tif today_appts.length == 0\n\t\t\t\t\t\treturn true\n\t\t\t\t\tend\n\t\t\t\t\ttoday_appts.each do |appt|\n\t\t\t\t\t\tif start_time <= appt.end_time && appt.start_time <= end_time\n\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tresult = true\n\t\t\t\t\t\tend\n\t\t\t\t\tend#end of each loop\n\t\t\t\tend#end of if start_time\n\t\t\t\tresult\n\t\t\tend",
"def can_make_reserves?\n !undergraduate? && !virginia_borrower?\n end",
"def allow_id_info_changes_only_in_eligible_state\n if (ssn_changed? || dob_changed?) && !ELIGIBLE_STATES.include?(aasm_state)\n message = \"An employee's identifying information may change only when in 'eligible' status. \"\n errors.add(:base, message)\n end\n end",
"def check_schedule(range_of_days)\n\tif 1 > range_of_days.to_i\n\t\traise \"The schedule of the diary must last for at least one day.\"\n\telsif 40 < range_of_days.to_i\n\t\traise \"Save paper! Don't generate schedule for >40 days.\"\n\tend\n\t\n\t# Set the duration of the food diary\n\t$duration = range_of_days.to_i\nend",
"def allow_custom_assignment_schedule\n return @allow_custom_assignment_schedule\n end",
"def is_date_valid?\n\t\tunless self.date_of_booking >= Time.zone.now.beginning_of_day \n\t\t\tself.errors[:date_validation] << \"=> You can't book resource for previous day\"\n\t\tend\n\tend",
"def free_time_frame?\n started_booking_time = Booking.where(start_time: start_time)\n\n if started_booking_time.present? && (started_booking_time.ids.first != id)\n errors.add(:start_time, 'Sorry, this hour is already booked')\n end\n end",
"def got_second_dose?\n appointments.active.checked_out.count >= 2\n end",
"def got_first_dose?\n appointments.active.checked_out.count.positive?\n end",
"def got_first_dose?\n appointments.active.checked_out.count.positive?\n end",
"def create\n @appointment = Appointment.new\n if @appointment.verify_datetime(params) == false\n @error = \"Please enter a valid date and time.\"\n render('new') and return\n else\n @appointment.topic = params[:appointment][:topic]\n @appointment.start_time = @appointment.generate_start_time(params)\n @appointment.end_time = @appointment.generate_end_time(params)\n @appointment.interval = params[:appointment][:interval].to_i\n @appointment.available = true\n @appointment.mentor = current_user\n if @appointment.save\n redirect_to \"/appointments/index\"\n else\n render \"new\"\n end\n end\n end",
"def appt_date_after_bus_start\r\n if appt_date.present? && appt_date.strftime(\"%Y\") < \"2017\"\r\n errors.add(:appt_date, \"can't occur before the business started\")\r\n end\r\n end",
"def check_overlapping_dates\n #compare this new reservation against existing reservations\n listing.reservations.each do |old_booking|\n if overlap?(self, old_booking)\n return errors.add(:overlapping_dates, \"The booking dates are not available\")\n end\n end\n\n end",
"def create_schedule_conflict(rname,day,stime,etime)\r\n #flag=false\r\n @statuss=Status.find(:all,:conditions => [\"room_name = ? AND schedule_day = ?\",rname,day])\r\n if @statuss\r\n @statuss.each do |s|\r\n if time_conflict(stime,etime,s[\"start_time\"],s[\"end_time\"])\r\n return true\r\n end\r\n end\r\n end\r\n return false\r\n end"
] |
[
"0.7215266",
"0.68634623",
"0.65881354",
"0.6581343",
"0.6581343",
"0.6477333",
"0.64772683",
"0.6449904",
"0.64198446",
"0.639106",
"0.6371733",
"0.6347831",
"0.63122517",
"0.62951106",
"0.6294801",
"0.6292406",
"0.62743455",
"0.6224108",
"0.6198988",
"0.61689717",
"0.6165554",
"0.6164159",
"0.6164024",
"0.6149829",
"0.61186486",
"0.61174005",
"0.6112548",
"0.60945743",
"0.608979",
"0.60812825",
"0.6072088",
"0.6070783",
"0.60480034",
"0.60402185",
"0.6017075",
"0.5998234",
"0.59715337",
"0.59643495",
"0.5959759",
"0.5936816",
"0.5932483",
"0.59290904",
"0.5929051",
"0.5923421",
"0.59188783",
"0.5886688",
"0.58632696",
"0.5826253",
"0.5818213",
"0.5805669",
"0.58007854",
"0.57918835",
"0.579072",
"0.57882166",
"0.57833964",
"0.57787645",
"0.5776608",
"0.57754856",
"0.5758459",
"0.5754744",
"0.5753638",
"0.57523066",
"0.5741889",
"0.57378834",
"0.5724324",
"0.5711532",
"0.57058626",
"0.5699549",
"0.5698848",
"0.56948847",
"0.5682567",
"0.5671379",
"0.5667857",
"0.56674093",
"0.5658721",
"0.5657808",
"0.5642608",
"0.5633292",
"0.5627275",
"0.56256276",
"0.56233746",
"0.56211835",
"0.5619249",
"0.5617084",
"0.56164026",
"0.5614468",
"0.55963755",
"0.5595445",
"0.559473",
"0.55913115",
"0.55889237",
"0.55880576",
"0.5588008",
"0.5587933",
"0.55851644",
"0.55851644",
"0.55841005",
"0.5582414",
"0.5581593",
"0.55742407"
] |
0.7544121
|
0
|
returns the list of media types available for this resource to be deserialized from
|
def media_types
Restfulie::MediaType.default_types + MediaType.medias_for(self)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def media_types\n return @media_types\n end",
"def media_type_representations\n custom_representations + Restfulie::MediaType.default_representations.dup\n end",
"def media_types=(value)\n @media_types = value\n end",
"def available_content_types\n if self.api_file.download_url\n return [self.api_file.mime_type]\n else\n return []\n end\n end",
"def mime_types\n [].tap do |result|\n @parts.each do |part|\n result << part.content_type\n end\n end\n end",
"def mime_types\n safe_const_get(:MIME_TYPES) || []\n end",
"def mediatype\n media_type\n end",
"def content_types\n self.values.collect do |hash|\n (hash || {})['type']\n end.compact\n end",
"def media_type_sym media\n case\n when (media =~ %r{^application/xml}) then :xml\n when (media =~ %r{^application/json}) then :json\n when (media =~ %r{^application/json-p}) then :json\n when (media =~ %r{^(application|text)/(x-)?javascript}) then :json\n when (media =~ %r{^(application|text)/(x-)?ecmascript}) then :json\n when (media =~ %r{^text/yaml}) then :yaml\n # when (media =~ %r{^text/tab-separated-values}) then :tsv\n # when (media =~ %r{^text/(comma-separated-values|csv)}) then :csv\n # when (media =~ %r{^text/html}) then :html\n else :json\n end\n end",
"def available_formats\n formats = self.items.collect {|i| i.item_type }\n return formats.compact\n end",
"def index\n @admin_media_types = Admin::MediaType.all\n end",
"def mime\n mimes = []\n self.class.ancestors.each do |parent|\n if parent.const_defined? 'MIMES'\n parent.const_get('MIMES').each do |mime|\n unless mimes.include? mime\n mimes << mime\n end\n end\n end\n end\n mimes\n end",
"def content_types\n return @content_types\n end",
"def mime_types\n @mime_types ||=\n request_files.transform_values do |file|\n file.hasMimeType || 'application/octet-stream'\n end\n end",
"def medias_for(type)\n found = {}\n type.media_type_representations.each do |key|\n found[key] = media_types[key]\n end\n found.values\n end",
"def media_type; end",
"def media_type; end",
"def mime_types\n config[:mime_types]\n end",
"def get_resource_types\n get_types(Occi::Core::Resource.kind)\n end",
"def media_type(name)\n name = normalize(name)\n raise Restfulie::UnsupportedContentType.new(\"unsupported content type '#{name}'\") if media_types[name].nil?\n media_types[name].type\n end",
"def content_types\n self.mounting_point.content_types\n end",
"def scoped_medium_types\n [primary_media.prepend('primary'), secondary_media.prepend('secondary'), component_media.prepend('component')]\n end",
"def load_mediasets\n []\n end",
"def get_supported_file_types\n path = '/v3/miscellaneous/supported-file-types'\n\n headers = {\n 'Content-Type' => 'application/json',\n 'User-Agent' => Config.user_agent\n }\n\n request = Net::HTTP::Get.new(path, headers)\n handle_response(@api_client.request(request), 'get_supported_file_types')\n end",
"def content_types\n type.children.select { |child| child.class == ContentType }\n end",
"def content_types\n self.class.custom_content_types\n end",
"def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n collection = @model.get Occi::Core::Resource.kind\n collection.kinds.collect { |kind| kind.term }\n end",
"def set_media_type\n media_types = self.class.head(@endpoint).headers['accept']\n Occi::Log.debug(\"Available media types: #{media_types}\")\n @media_type = case media_types\n when /application\\/occi\\+json/\n 'application/occi+json'\n else\n 'text/plain'\n end\n end",
"def valid_types(record)\n Array(record.supported_mime_types)\n rescue NoMethodError\n Array.new\n end",
"def accepted_mimes\n case self.type\n when'Recording'\n '.wav,.mp3'\n when 'Document'\n '.pdf'\n when 'Image'\n '.jpeg,.jpg,.gif,.bmp,.png'\n else\n ''\n end\n end",
"def content_type_whitelist\n MIME_TYPE_WHITELIST\n end",
"def collect_default_mediatypes(endpoints)\n # We'll start by processing the rendered mediatypes\n Set.new(endpoints.select do |endpoint|\n endpoint.media_type && !endpoint.media_type.is_a?(Praxis::SimpleMediaType)\n end.collect(&:media_type))\n end",
"def content_types\n ContentTypes.new(self)\n end",
"def mime_types(type)\n mime_types = {\n yaml: \"application/x-yaml\",\n json: \"application/json\"\n }\n mime_types[type.to_sym]\n end",
"def type\n return unless media_type\n\n media_type.split('/').first\n end",
"def accepted_content_types\n return @content_types if @content_types\n @content_types = []\n if val = @ext_params[\"content_return_types\"]\n @content_types = val.split(',').map {|i| i.to_sym}\n end\n\n @content_types\n end",
"def mime_types\n {image: ['image/png', 'image/jpeg', 'image/jpg', 'image/jp2', 'image/bmp', 'image/gif', 'image/tiff'],\n pdf: ['application/pdf', 'application/x-pdf'],\n audio: ['audio/mpeg', 'audio/mp4', 'audio/x-aiff', 'audio/ogg', 'audio/vorbis', 'audio/vnd.wav'],\n video: ['video/mp4', 'video/quicktime', 'video/x-msvideo', 'video/x-ms-wmv']}\n end",
"def content_types(meta=false)\n content_type_classes(meta).map { |cls| cls.key }\n end",
"def types\n get_metadata unless @types\n return @types\n end",
"def media_type\n @media_type || parse_and_return(:@media_type)\n end",
"def media_type\r\ncontent_mime_type.to_s\r\nend",
"def media\n parse(delete('media'))\n end",
"def content_types\n result = call(\"Webs\", \"get_content_types\", \"listName\" => @id)\n result.xpath(\"//sp:ContentType\", NS).map do |content_type|\n supersite && supersite.content_type(content_type[\"ID\"]) || ContentType.new(self, nil, content_type[\"ID\"], content_type[\"Name\"], content_type[\"Description\"], content_type[\"Version\"], content_type[\"Group\"])\n end\n end",
"def selected_mime_types\n return [] if mime_types.blank?\n\n mime_types.split(',')\n end",
"def stringy_media_type\n request.content_mime_type.to_s\n end",
"def get_material_types\n METADATA_RELATIONS_CONFIG['material_types']\n end",
"def available_related_content_types\n available_related_content.map{|hash| hash['Type'] }\n end",
"def to_media_type(options)\n as_media_type(options).to_json\n end",
"def to_media_type(options)\n as_media_type(options).to_json\n end",
"def available_types\n gather do |c|\n c.respond_to?(:model_types) ? c.model_types : []\n end\n end",
"def tags\n if properties.key?(:media_content) and\n properties[:media_content][:url].present? and\n properties.key?(:media_thumbnail) and\n properties[:media_thumbnail][:url].present?\n %w[image]\n else\n []\n end\n end",
"def wp_get_mime_types\n # Filters the list of mime types and file extensions.\n apply_filters(\n 'mime_types',\n {\n # Image formats.\n 'jpg|jpeg|jpe': 'image/jpeg',\n 'gif': 'image/gif',\n 'png': 'image/png',\n 'bmp': 'image/bmp',\n 'tiff|tif': 'image/tiff',\n 'ico': 'image/x-icon',\n # Video formats.\n 'asf|asx': 'video/x-ms-asf',\n 'wmv': 'video/x-ms-wmv',\n 'wmx': 'video/x-ms-wmx',\n 'wm': 'video/x-ms-wm',\n 'avi': 'video/avi',\n 'divx': 'video/divx',\n 'flv': 'video/x-flv',\n 'mov|qt': 'video/quicktime',\n 'mpeg|mpg|mpe': 'video/mpeg',\n 'mp4|m4v': 'video/mp4',\n 'ogv': 'video/ogg',\n 'webm': 'video/webm',\n 'mkv': 'video/x-matroska',\n '3gp|3gpp': 'video/3gpp', # Can also be audio\n '3g2|3gp2': 'video/3gpp2', # Can also be audio\n # Text formats.\n 'txt|asc|c|cc|h|srt': 'text/plain',\n 'csv': 'text/csv',\n 'tsv': 'text/tab-separated-values',\n 'ics': 'text/calendar',\n 'rtx': 'text/richtext',\n 'css': 'text/css',\n 'htm|html': 'text/html',\n 'vtt': 'text/vtt',\n 'dfxp': 'application/ttaf+xml',\n # Audio formats.\n 'mp3|m4a|m4b': 'audio/mpeg',\n 'aac': 'audio/aac',\n 'ra|ram': 'audio/x-realaudio',\n 'wav': 'audio/wav',\n 'ogg|oga': 'audio/ogg',\n 'flac': 'audio/flac',\n 'mid|midi': 'audio/midi',\n 'wma': 'audio/x-ms-wma',\n 'wax': 'audio/x-ms-wax',\n 'mka': 'audio/x-matroska',\n # Misc application formats.\n 'rtf': 'application/rtf',\n 'js': 'application/javascript',\n 'pdf': 'application/pdf',\n 'swf': 'application/x-shockwave-flash',\n 'class': 'application/java',\n 'tar': 'application/x-tar',\n 'zip': 'application/zip',\n 'gz|gzip': 'application/x-gzip',\n 'rar': 'application/rar',\n '7z': 'application/x-7z-compressed',\n 'exe': 'application/x-msdownload',\n 'psd': 'application/octet-stream',\n 'xcf': 'application/octet-stream',\n # MS Office formats.\n 'doc': 'application/msword',\n 'pot|pps|ppt': 'application/vnd.ms-powerpoint',\n 'wri': 'application/vnd.ms-write',\n 'xla|xls|xlt|xlw': 'application/vnd.ms-excel',\n 'mdb': 'application/vnd.ms-access',\n 'mpp': 'application/vnd.ms-project',\n 'docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n 'docm': 'application/vnd.ms-word.document.macroEnabled.12',\n 'dotx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',\n 'dotm': 'application/vnd.ms-word.template.macroEnabled.12',\n 'xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n 'xlsm': 'application/vnd.ms-excel.sheet.macroEnabled.12',\n 'xlsb': 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',\n 'xltx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',\n 'xltm': 'application/vnd.ms-excel.template.macroEnabled.12',\n 'xlam': 'application/vnd.ms-excel.addin.macroEnabled.12',\n 'pptx': 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n 'pptm': 'application/vnd.ms-powerpoint.presentation.macroEnabled.12',\n 'ppsx': 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',\n 'ppsm': 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12',\n 'potx': 'application/vnd.openxmlformats-officedocument.presentationml.template',\n 'potm': 'application/vnd.ms-powerpoint.template.macroEnabled.12',\n 'ppam': 'application/vnd.ms-powerpoint.addin.macroEnabled.12',\n 'sldx': 'application/vnd.openxmlformats-officedocument.presentationml.slide',\n 'sldm': 'application/vnd.ms-powerpoint.slide.macroEnabled.12',\n 'onetoc|onetoc2|onetmp|onepkg': 'application/onenote',\n 'oxps': 'application/oxps',\n 'xps': 'application/vnd.ms-xpsdocument',\n # OpenOffice formats.\n 'odt': 'application/vnd.oasis.opendocument.text',\n 'odp': 'application/vnd.oasis.opendocument.presentation',\n 'ods': 'application/vnd.oasis.opendocument.spreadsheet',\n 'odg': 'application/vnd.oasis.opendocument.graphics',\n 'odc': 'application/vnd.oasis.opendocument.chart',\n 'odb': 'application/vnd.oasis.opendocument.database',\n 'odf': 'application/vnd.oasis.opendocument.formula',\n # WordPerfect formats.\n 'wp|wpd': 'application/wordperfect',\n # iWork formats.\n 'key': 'application/vnd.apple.keynote',\n 'numbers': 'application/vnd.apple.numbers',\n 'pages': 'application/vnd.apple.pages',\n }\n )\n end",
"def mediatype\n\t\treturn \"%s/%s\" % [ self.type || '*', self.subtype || '*' ]\n\tend",
"def subtype\n return unless media_type\n\n media_type.split('/').last\n end",
"def microform_types\n return [] unless record['008']\n types = ['WM']\n f8_23 = record['008'].value[23]\n return types if %w[BK MU SE MX].include?(bib_format) && %w[a b c].include?(f8_23)\n\n f8_29 = record['008'].value[29]\n return types if %w[MP VM].include?(bib_format) && %w[a b c].include?(f8_29)\n\n return types if record['245'] && (record['245']['h'] =~ /micro/i)\n\n # Nope. Not microform\n return []\n end",
"def attachment_types\n @attachment_types ||= []\n end",
"def media_sizes\n return @media_sizes\n end",
"def dor_resource_content_type\n public_xml_doc.xpath('//contentMetadata/resource/@type').map(&:text)\n end",
"def video_mime_types\n ['video/mpg', 'video/mpeg', 'video/mp4', 'video/x-m4v', 'video/webm', 'video/x-msvideo', 'video/avi', 'video/quicktime', 'application/mxf']\n end",
"def formats\n formats = online_resource?(record) ? online_format : physical_format\n any_found?(formats) ? Array(formats[0]) : nil\n end",
"def get_available_types()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('uiconf', 'getAvailableTypes', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend",
"def registered_formats\n @@registered_formats\n end",
"def content_type_allowlist\n Rails.configuration.x.file_upload_content_type_allowlist.split(/\\s*,\\s*/)\n end",
"def media_type\n hyper_schema_link.media_type\n end",
"def mime_type(media_type = nil)\n types = MIME::Types.type_for(path)\n return if types.empty?\n if media_type\n media_type = media_type.to_s\n media_types = types.select { |m| m.media_type == media_type }\n if media_types.length > 1\n sub_types = media_types.select { |m| m.sub_type == format }\n media_types = sub_types if sub_types.any?\n end\n types = media_types if media_types.any?\n end\n types.first.content_type if types.any?\n end",
"def accepts(*types)\n mime_types = types.map{ |type| mime_type(CONTENT_TYPE_ALIASES[type] || type) }\n condition do\n halt 406 unless mime_types.include?(request.media_type)\n content_type(mime_symbol(request.media_type))\n end\n end",
"def get_mediaitem_fields()\n @restv9.get_mediaItems_fields()\n end",
"def media_type(meta, file)\n tags = meta.inject(&:merge)\n tags.fetch 'MIMEType', Rack::Mime.mime_type(File.extname(file))\n end",
"def recognized_item_types\n\t\t# , 'DocFile', 'DocImage', 'DocPrivate', 'Path'\n\t\t['Article', 'Document', 'Event', 'Group', 'Page', 'Petition', 'Signature', 'User', 'Weblink']\n\tend",
"def conf_media_type\n @conf_kit_media_types = Kitting::KitMediaType.where(:kit_type => \"configurable\",:customer_number => \"SYSTEM\")\n end",
"def dor_file_mimetype\n public_xml_doc.xpath('//contentMetadata/resource/*/@mimetype').map(&:text)\n end",
"def media_type\n return unless headers['Content-Type']\n\n headers['Content-Type'].split(';').first\n end",
"def accepted_media_element_sti_type\n case kind\n when COVER, IMAGE1, IMAGE2, IMAGE3, IMAGE4\n MediaElement::IMAGE_TYPE\n when VIDEO1, VIDEO2\n MediaElement::VIDEO_TYPE\n when AUDIO\n MediaElement::AUDIO_TYPE\n else\n ''\n end\n end",
"def media_presets\n site.data.dig('picture', 'media_presets') || {}\n end",
"def media_quality_list\n return @media_quality_list\n end",
"def list_resource_types(feed_id = nil)\n if feed_id.nil?\n ret = http_get('/resourceTypes')\n else\n the_feed = hawk_escape_id feed_id\n ret = http_get(\"/feeds/#{the_feed}/resourceTypes\")\n end\n ret.map { |rt| ResourceType.new(rt) }\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 mime_types(*types)\n types.flatten.each do |t|\n @mime_types << t\n end\n @mime_types\n end",
"def mixed_types\n types = []\n types << 'MV' if (bib_format == 'MX') || (record.leader[8] == 'a')\n types << 'MW' if %w[d f p t].include?(record.leader[6])\n return types\n end",
"def mime_exts\n config[:mime_exts]\n end",
"def content_type\n @mime_type\n end",
"def mime_type\n \"application/json\".freeze\n end",
"def mediatype; end",
"def mime_type\n self.class.mime_type\n end",
"def allowed_types\n config.allowed_response_types\n end",
"def get_allowed_mime_types(user = nil)\n t = wp_get_mime_types\n t.delete(:swf)\n t.delete(:exe)\n # TODO implement:\n # if ( function_exists( 'current_user_can' ) )\n # unfiltered = user ? user_can( user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' )\n # end\n # if unfiltered.blank?\n # t.delete(:'htm|html')\n # t.delete(:js)\n # end\n\n # Filters list of allowed mime types and file extensions.\n apply_filters('upload_mimes', t, user)\n end",
"def media_format\n media_format = \"\"\n if media_type =~ /[\\/]/\n media_format = media_type.split(\"/\")[1]\n if \"x-www-form-urlencoded\" == media_format\n media_format = format # use regular format instead, we never want form data\n end\n end\n \n media_format\n end",
"def type\n Medium.find(self.source.medium_id).media\n end",
"def media_type(default = nil)\n if value = content_type\n value.split('/')[0]\n else\n if block_given?\n yield\n else\n default\n end\n end\n end",
"def content_type\n if format == :auto\n MIME_TYPES.values.join(',')\n elsif MIME_TYPES.has_key? format\n MIME_TYPES[format]\n else\n raise ArgumentError, \"Unknown format '#{format}'\"\n end\n end",
"def content_type\n if format == :auto\n MIME_TYPES.values.join(',')\n elsif MIME_TYPES.has_key? format\n MIME_TYPES[format]\n else\n raise ArgumentError, \"Unknown format '#{format}'\"\n end\n end",
"def acceptable?(media_type)\n !matches(media_type).empty?\n end",
"def content_type\n @resource.content_type\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @media_scopes }\n end\n end",
"def mediafiles\n source_node.xpath('.//MediaFile').to_a.collect do |node|\n Mediafile.new(node)\n end\n end",
"def allowed_file_types\n Rails.configuration.allowed_file_types\n end",
"def as_media_type(options = {})\n options ||= {}\n halelets = []\n halelets << get_semantic_data(options)\n halelets << get_data(@object.each_transition(options), relations)\n halelets << get_data(@object.metadata_links(options), relations)\n base_object = halelets.reduce(&:deep_merge)\n add_embedded(base_object, options)\n end",
"def as_media_type(options = {})\n options ||= {}\n halelets = []\n halelets << get_semantic_data(options)\n halelets << get_data(@object.each_transition(options), relations)\n halelets << get_data(@object.metadata_links(options), relations)\n base_object = halelets.reduce(&:deep_merge)\n add_embedded(base_object, options)\n end",
"def find_image_items\n manifest_items.select { |item| item['media_type'] =~ /^image\\// }\n end",
"def response_media_type(options={})\n options = {:halt_if_unacceptable => false}.merge(options)\n accept = env['HTTP_ACCEPT']\n if accept =~ /\\S/\n begin\n best_media_type = env['rack-accept.request'].best_media_type(supported_media_types)\n rescue RuntimeError => e\n # TODO: this is a crappy way to recognize this exception \n raise unless e.message =~ /Invalid header value/\n end\n if best_media_type\n best_media_type\n else\n if options[:halt_if_unacceptable]\n logger.error \"received Accept header of #{accept.inspect}; halting with 406\"\n message = I18n.t('app.errors.request.accept',\n :default => \"The request indicated that no supported media type is acceptable. Supported media types are: %{supported_media_types}. The request specified Accept: %{accept}\",\n :accept => accept,\n :supported_media_types => supported_media_types.join(', ')\n )\n halt_error(406, {'Accept' => [message]})\n else\n supported_media_types.first\n end\n end\n else\n supported_media_types.first\n end\n end"
] |
[
"0.81824464",
"0.7180635",
"0.69721913",
"0.6924355",
"0.6907955",
"0.6860248",
"0.68008566",
"0.6589313",
"0.6581141",
"0.654005",
"0.65085536",
"0.6504488",
"0.6468978",
"0.64427537",
"0.6439476",
"0.6425805",
"0.6425805",
"0.64250743",
"0.6379401",
"0.63503253",
"0.6342117",
"0.63398933",
"0.6329418",
"0.6259466",
"0.62582874",
"0.62330073",
"0.62106574",
"0.6207299",
"0.6194762",
"0.61784637",
"0.61647546",
"0.6163565",
"0.6127558",
"0.6127548",
"0.61057055",
"0.6100374",
"0.60890585",
"0.60179865",
"0.5978519",
"0.59680104",
"0.59604394",
"0.59587795",
"0.5954866",
"0.59488887",
"0.59403455",
"0.5898765",
"0.58790666",
"0.58636063",
"0.58636063",
"0.58139926",
"0.5806953",
"0.58007365",
"0.5786475",
"0.5785137",
"0.5783049",
"0.57679886",
"0.5761923",
"0.5753791",
"0.5739574",
"0.5737322",
"0.5735254",
"0.5705815",
"0.569773",
"0.569642",
"0.56916946",
"0.56892407",
"0.56891924",
"0.5684825",
"0.5681449",
"0.5676721",
"0.56757563",
"0.5671178",
"0.5638617",
"0.562576",
"0.5619866",
"0.5608378",
"0.56031716",
"0.55937576",
"0.55930144",
"0.5561934",
"0.55499107",
"0.55374783",
"0.55374765",
"0.5534132",
"0.55315524",
"0.5529398",
"0.5528005",
"0.5517714",
"0.5507728",
"0.55045867",
"0.55045867",
"0.5504285",
"0.5499399",
"0.54985005",
"0.5492286",
"0.5477051",
"0.54650867",
"0.54650867",
"0.545941",
"0.5458346"
] |
0.83236927
|
0
|
returns a list of media types that this resource can be serialized to
|
def media_type_representations
custom_representations + Restfulie::MediaType.default_representations.dup
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def media_types\n Restfulie::MediaType.default_types + MediaType.medias_for(self)\n end",
"def media_types\n return @media_types\n end",
"def media_types=(value)\n @media_types = value\n end",
"def mime_types\n safe_const_get(:MIME_TYPES) || []\n end",
"def mediatype\n media_type\n end",
"def mime_types\n [].tap do |result|\n @parts.each do |part|\n result << part.content_type\n end\n end\n end",
"def index\n @admin_media_types = Admin::MediaType.all\n end",
"def available_content_types\n if self.api_file.download_url\n return [self.api_file.mime_type]\n else\n return []\n end\n end",
"def content_types\n return @content_types\n end",
"def mime\n mimes = []\n self.class.ancestors.each do |parent|\n if parent.const_defined? 'MIMES'\n parent.const_get('MIMES').each do |mime|\n unless mimes.include? mime\n mimes << mime\n end\n end\n end\n end\n mimes\n end",
"def scoped_medium_types\n [primary_media.prepend('primary'), secondary_media.prepend('secondary'), component_media.prepend('component')]\n end",
"def content_types\n self.values.collect do |hash|\n (hash || {})['type']\n end.compact\n end",
"def medias_for(type)\n found = {}\n type.media_type_representations.each do |key|\n found[key] = media_types[key]\n end\n found.values\n end",
"def media_type; end",
"def media_type; end",
"def media_type_sym media\n case\n when (media =~ %r{^application/xml}) then :xml\n when (media =~ %r{^application/json}) then :json\n when (media =~ %r{^application/json-p}) then :json\n when (media =~ %r{^(application|text)/(x-)?javascript}) then :json\n when (media =~ %r{^(application|text)/(x-)?ecmascript}) then :json\n when (media =~ %r{^text/yaml}) then :yaml\n # when (media =~ %r{^text/tab-separated-values}) then :tsv\n # when (media =~ %r{^text/(comma-separated-values|csv)}) then :csv\n # when (media =~ %r{^text/html}) then :html\n else :json\n end\n end",
"def content_types\n type.children.select { |child| child.class == ContentType }\n end",
"def content_type_whitelist\n MIME_TYPE_WHITELIST\n end",
"def accepted_mimes\n case self.type\n when'Recording'\n '.wav,.mp3'\n when 'Document'\n '.pdf'\n when 'Image'\n '.jpeg,.jpg,.gif,.bmp,.png'\n else\n ''\n end\n end",
"def content_types\n self.mounting_point.content_types\n end",
"def load_mediasets\n []\n end",
"def content_types\n ContentTypes.new(self)\n end",
"def content_types\n self.class.custom_content_types\n end",
"def get_resource_types\n get_types(Occi::Core::Resource.kind)\n end",
"def available_formats\n formats = self.items.collect {|i| i.item_type }\n return formats.compact\n end",
"def mime_types\n config[:mime_types]\n end",
"def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n collection = @model.get Occi::Core::Resource.kind\n collection.kinds.collect { |kind| kind.term }\n end",
"def collect_default_mediatypes(endpoints)\n # We'll start by processing the rendered mediatypes\n Set.new(endpoints.select do |endpoint|\n endpoint.media_type && !endpoint.media_type.is_a?(Praxis::SimpleMediaType)\n end.collect(&:media_type))\n end",
"def mime_types\n @mime_types ||=\n request_files.transform_values do |file|\n file.hasMimeType || 'application/octet-stream'\n end\n end",
"def content_types(meta=false)\n content_type_classes(meta).map { |cls| cls.key }\n end",
"def accepted_content_types\n return @content_types if @content_types\n @content_types = []\n if val = @ext_params[\"content_return_types\"]\n @content_types = val.split(',').map {|i| i.to_sym}\n end\n\n @content_types\n end",
"def valid_types(record)\n Array(record.supported_mime_types)\n rescue NoMethodError\n Array.new\n end",
"def to_media_type(options)\n as_media_type(options).to_json\n end",
"def to_media_type(options)\n as_media_type(options).to_json\n end",
"def mime_types\n {image: ['image/png', 'image/jpeg', 'image/jpg', 'image/jp2', 'image/bmp', 'image/gif', 'image/tiff'],\n pdf: ['application/pdf', 'application/x-pdf'],\n audio: ['audio/mpeg', 'audio/mp4', 'audio/x-aiff', 'audio/ogg', 'audio/vorbis', 'audio/vnd.wav'],\n video: ['video/mp4', 'video/quicktime', 'video/x-msvideo', 'video/x-ms-wmv']}\n end",
"def mime_types(type)\n mime_types = {\n yaml: \"application/x-yaml\",\n json: \"application/json\"\n }\n mime_types[type.to_sym]\n end",
"def mediatype\n\t\treturn \"%s/%s\" % [ self.type || '*', self.subtype || '*' ]\n\tend",
"def available_related_content_types\n available_related_content.map{|hash| hash['Type'] }\n end",
"def media_type\r\ncontent_mime_type.to_s\r\nend",
"def media_type(name)\n name = normalize(name)\n raise Restfulie::UnsupportedContentType.new(\"unsupported content type '#{name}'\") if media_types[name].nil?\n media_types[name].type\n end",
"def get_supported_file_types\n path = '/v3/miscellaneous/supported-file-types'\n\n headers = {\n 'Content-Type' => 'application/json',\n 'User-Agent' => Config.user_agent\n }\n\n request = Net::HTTP::Get.new(path, headers)\n handle_response(@api_client.request(request), 'get_supported_file_types')\n end",
"def accepted_media_element_sti_type\n case kind\n when COVER, IMAGE1, IMAGE2, IMAGE3, IMAGE4\n MediaElement::IMAGE_TYPE\n when VIDEO1, VIDEO2\n MediaElement::VIDEO_TYPE\n when AUDIO\n MediaElement::AUDIO_TYPE\n else\n ''\n end\n end",
"def content_types\n result = call(\"Webs\", \"get_content_types\", \"listName\" => @id)\n result.xpath(\"//sp:ContentType\", NS).map do |content_type|\n supersite && supersite.content_type(content_type[\"ID\"]) || ContentType.new(self, nil, content_type[\"ID\"], content_type[\"Name\"], content_type[\"Description\"], content_type[\"Version\"], content_type[\"Group\"])\n end\n end",
"def types\n get_metadata unless @types\n return @types\n end",
"def tags\n if properties.key?(:media_content) and\n properties[:media_content][:url].present? and\n properties.key?(:media_thumbnail) and\n properties[:media_thumbnail][:url].present?\n %w[image]\n else\n []\n end\n end",
"def stringy_media_type\n request.content_mime_type.to_s\n end",
"def get_material_types\n METADATA_RELATIONS_CONFIG['material_types']\n end",
"def set_media_type\n media_types = self.class.head(@endpoint).headers['accept']\n Occi::Log.debug(\"Available media types: #{media_types}\")\n @media_type = case media_types\n when /application\\/occi\\+json/\n 'application/occi+json'\n else\n 'text/plain'\n end\n end",
"def type\n return unless media_type\n\n media_type.split('/').first\n end",
"def attachment_types\n @attachment_types ||= []\n end",
"def media_quality_list\n return @media_quality_list\n end",
"def selected_mime_types\n return [] if mime_types.blank?\n\n mime_types.split(',')\n end",
"def content_type_allowlist\n Rails.configuration.x.file_upload_content_type_allowlist.split(/\\s*,\\s*/)\n end",
"def mediatype; end",
"def video_mime_types\n ['video/mpg', 'video/mpeg', 'video/mp4', 'video/x-m4v', 'video/webm', 'video/x-msvideo', 'video/avi', 'video/quicktime', 'application/mxf']\n end",
"def as_media_type(options = {})\n options ||= {}\n halelets = []\n halelets << get_semantic_data(options)\n halelets << get_data(@object.each_transition(options), relations)\n halelets << get_data(@object.metadata_links(options), relations)\n base_object = halelets.reduce(&:deep_merge)\n add_embedded(base_object, options)\n end",
"def as_media_type(options = {})\n options ||= {}\n halelets = []\n halelets << get_semantic_data(options)\n halelets << get_data(@object.each_transition(options), relations)\n halelets << get_data(@object.metadata_links(options), relations)\n base_object = halelets.reduce(&:deep_merge)\n add_embedded(base_object, options)\n end",
"def mixed_types\n types = []\n types << 'MV' if (bib_format == 'MX') || (record.leader[8] == 'a')\n types << 'MW' if %w[d f p t].include?(record.leader[6])\n return types\n end",
"def wp_get_mime_types\n # Filters the list of mime types and file extensions.\n apply_filters(\n 'mime_types',\n {\n # Image formats.\n 'jpg|jpeg|jpe': 'image/jpeg',\n 'gif': 'image/gif',\n 'png': 'image/png',\n 'bmp': 'image/bmp',\n 'tiff|tif': 'image/tiff',\n 'ico': 'image/x-icon',\n # Video formats.\n 'asf|asx': 'video/x-ms-asf',\n 'wmv': 'video/x-ms-wmv',\n 'wmx': 'video/x-ms-wmx',\n 'wm': 'video/x-ms-wm',\n 'avi': 'video/avi',\n 'divx': 'video/divx',\n 'flv': 'video/x-flv',\n 'mov|qt': 'video/quicktime',\n 'mpeg|mpg|mpe': 'video/mpeg',\n 'mp4|m4v': 'video/mp4',\n 'ogv': 'video/ogg',\n 'webm': 'video/webm',\n 'mkv': 'video/x-matroska',\n '3gp|3gpp': 'video/3gpp', # Can also be audio\n '3g2|3gp2': 'video/3gpp2', # Can also be audio\n # Text formats.\n 'txt|asc|c|cc|h|srt': 'text/plain',\n 'csv': 'text/csv',\n 'tsv': 'text/tab-separated-values',\n 'ics': 'text/calendar',\n 'rtx': 'text/richtext',\n 'css': 'text/css',\n 'htm|html': 'text/html',\n 'vtt': 'text/vtt',\n 'dfxp': 'application/ttaf+xml',\n # Audio formats.\n 'mp3|m4a|m4b': 'audio/mpeg',\n 'aac': 'audio/aac',\n 'ra|ram': 'audio/x-realaudio',\n 'wav': 'audio/wav',\n 'ogg|oga': 'audio/ogg',\n 'flac': 'audio/flac',\n 'mid|midi': 'audio/midi',\n 'wma': 'audio/x-ms-wma',\n 'wax': 'audio/x-ms-wax',\n 'mka': 'audio/x-matroska',\n # Misc application formats.\n 'rtf': 'application/rtf',\n 'js': 'application/javascript',\n 'pdf': 'application/pdf',\n 'swf': 'application/x-shockwave-flash',\n 'class': 'application/java',\n 'tar': 'application/x-tar',\n 'zip': 'application/zip',\n 'gz|gzip': 'application/x-gzip',\n 'rar': 'application/rar',\n '7z': 'application/x-7z-compressed',\n 'exe': 'application/x-msdownload',\n 'psd': 'application/octet-stream',\n 'xcf': 'application/octet-stream',\n # MS Office formats.\n 'doc': 'application/msword',\n 'pot|pps|ppt': 'application/vnd.ms-powerpoint',\n 'wri': 'application/vnd.ms-write',\n 'xla|xls|xlt|xlw': 'application/vnd.ms-excel',\n 'mdb': 'application/vnd.ms-access',\n 'mpp': 'application/vnd.ms-project',\n 'docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n 'docm': 'application/vnd.ms-word.document.macroEnabled.12',\n 'dotx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',\n 'dotm': 'application/vnd.ms-word.template.macroEnabled.12',\n 'xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n 'xlsm': 'application/vnd.ms-excel.sheet.macroEnabled.12',\n 'xlsb': 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',\n 'xltx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',\n 'xltm': 'application/vnd.ms-excel.template.macroEnabled.12',\n 'xlam': 'application/vnd.ms-excel.addin.macroEnabled.12',\n 'pptx': 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n 'pptm': 'application/vnd.ms-powerpoint.presentation.macroEnabled.12',\n 'ppsx': 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',\n 'ppsm': 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12',\n 'potx': 'application/vnd.openxmlformats-officedocument.presentationml.template',\n 'potm': 'application/vnd.ms-powerpoint.template.macroEnabled.12',\n 'ppam': 'application/vnd.ms-powerpoint.addin.macroEnabled.12',\n 'sldx': 'application/vnd.openxmlformats-officedocument.presentationml.slide',\n 'sldm': 'application/vnd.ms-powerpoint.slide.macroEnabled.12',\n 'onetoc|onetoc2|onetmp|onepkg': 'application/onenote',\n 'oxps': 'application/oxps',\n 'xps': 'application/vnd.ms-xpsdocument',\n # OpenOffice formats.\n 'odt': 'application/vnd.oasis.opendocument.text',\n 'odp': 'application/vnd.oasis.opendocument.presentation',\n 'ods': 'application/vnd.oasis.opendocument.spreadsheet',\n 'odg': 'application/vnd.oasis.opendocument.graphics',\n 'odc': 'application/vnd.oasis.opendocument.chart',\n 'odb': 'application/vnd.oasis.opendocument.database',\n 'odf': 'application/vnd.oasis.opendocument.formula',\n # WordPerfect formats.\n 'wp|wpd': 'application/wordperfect',\n # iWork formats.\n 'key': 'application/vnd.apple.keynote',\n 'numbers': 'application/vnd.apple.numbers',\n 'pages': 'application/vnd.apple.pages',\n }\n )\n end",
"def media_type\n @media_type || parse_and_return(:@media_type)\n end",
"def media_type\n hyper_schema_link.media_type\n end",
"def recognized_item_types\n\t\t# , 'DocFile', 'DocImage', 'DocPrivate', 'Path'\n\t\t['Article', 'Document', 'Event', 'Group', 'Page', 'Petition', 'Signature', 'User', 'Weblink']\n\tend",
"def microform_types\n return [] unless record['008']\n types = ['WM']\n f8_23 = record['008'].value[23]\n return types if %w[BK MU SE MX].include?(bib_format) && %w[a b c].include?(f8_23)\n\n f8_29 = record['008'].value[29]\n return types if %w[MP VM].include?(bib_format) && %w[a b c].include?(f8_29)\n\n return types if record['245'] && (record['245']['h'] =~ /micro/i)\n\n # Nope. Not microform\n return []\n end",
"def dor_resource_content_type\n public_xml_doc.xpath('//contentMetadata/resource/@type').map(&:text)\n end",
"def to_s\n '#<Twilio.Intelligence.V2.MediaList>'\n end",
"def available_types\n gather do |c|\n c.respond_to?(:model_types) ? c.model_types : []\n end\n end",
"def get_allowed_mime_types(user = nil)\n t = wp_get_mime_types\n t.delete(:swf)\n t.delete(:exe)\n # TODO implement:\n # if ( function_exists( 'current_user_can' ) )\n # unfiltered = user ? user_can( user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' )\n # end\n # if unfiltered.blank?\n # t.delete(:'htm|html')\n # t.delete(:js)\n # end\n\n # Filters list of allowed mime types and file extensions.\n apply_filters('upload_mimes', t, user)\n end",
"def type\n Medium.find(self.source.medium_id).media\n end",
"def registered_formats\n @@registered_formats\n end",
"def medium_names\n primary_media | secondary_media | component_media\n end",
"def conf_media_type\n @conf_kit_media_types = Kitting::KitMediaType.where(:kit_type => \"configurable\",:customer_number => \"SYSTEM\")\n end",
"def media_resource?\n true\n end",
"def mime_types(*types)\n types.flatten.each do |t|\n @mime_types << t\n end\n @mime_types\n end",
"def accepts(*types)\n mime_types = types.map{ |type| mime_type(CONTENT_TYPE_ALIASES[type] || type) }\n condition do\n halt 406 unless mime_types.include?(request.media_type)\n content_type(mime_symbol(request.media_type))\n end\n end",
"def acceptable?(media_type)\n !matches(media_type).empty?\n end",
"def media_sizes\n return @media_sizes\n end",
"def formats\n formats = online_resource?(record) ? online_format : physical_format\n any_found?(formats) ? Array(formats[0]) : nil\n end",
"def media\n parse(delete('media'))\n end",
"def mime_type\n self.class.mime_type\n end",
"def allowed_file_types\n Rails.configuration.allowed_file_types\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @media_scopes }\n end\n end",
"def content_type\n @resource.content_type\n end",
"def controlled_resources\n @controlled_resources ||= if params[:media_name]\n super.where(type: singular_linked_media_type)\n else\n super\n end\n end",
"def to_s\n '<Twilio::REST::Media::V1>'\n end",
"def mime_type\n \"application/json\".freeze\n end",
"def media_type(meta, file)\n tags = meta.inject(&:merge)\n tags.fetch 'MIMEType', Rack::Mime.mime_type(File.extname(file))\n end",
"def mime_type; end",
"def mime_type; end",
"def mime_type; end",
"def mime_type; end",
"def singular_linked_media_type\n \"#{polymorphic_klass_name}_#{params[:media_name]}\".singularize\n end",
"def subtype\n return unless media_type\n\n media_type.split('/').last\n end",
"def content_types=(value)\n @content_types = value\n end",
"def mime_exts\n config[:mime_exts]\n end",
"def content_type\n @mime_type\n end",
"def image_types\n [\"image/jpeg\", \"image/png\", \"image/jpg\", \"image/gif\", \"image/tif\"]\n end",
"def image_types\n [\"image/jpeg\", \"image/png\", \"image/jpg\", \"image/gif\", \"image/tif\"]\n end",
"def mediafiles\n source_node.xpath('.//MediaFile').to_a.collect do |node|\n Mediafile.new(node)\n end\n end",
"def media\n self\n end",
"def content_types_provided\n [ [ FILE_EXTENSION_CONTENT_TYPES[file_extension], :file_contents ] ]\n end"
] |
[
"0.82937324",
"0.8271455",
"0.70387685",
"0.68488765",
"0.68208706",
"0.67429936",
"0.6669111",
"0.6653061",
"0.6613159",
"0.6607771",
"0.6602479",
"0.6579117",
"0.65451986",
"0.65254384",
"0.65254384",
"0.64999086",
"0.64642197",
"0.6437094",
"0.6436229",
"0.64359564",
"0.64296913",
"0.6422322",
"0.6411797",
"0.63906604",
"0.6371996",
"0.6295936",
"0.6285032",
"0.62638915",
"0.62591344",
"0.62188905",
"0.619971",
"0.617939",
"0.6157626",
"0.6157626",
"0.6105393",
"0.6063163",
"0.6052699",
"0.6050869",
"0.6050659",
"0.6047392",
"0.6026197",
"0.60147214",
"0.60138613",
"0.6006401",
"0.5993792",
"0.59705806",
"0.5945519",
"0.5944521",
"0.5935456",
"0.5930716",
"0.5905663",
"0.59045035",
"0.58839613",
"0.5873964",
"0.58643615",
"0.5861398",
"0.5861398",
"0.5859213",
"0.58292216",
"0.58068204",
"0.5793928",
"0.5791869",
"0.5763343",
"0.5759391",
"0.5750687",
"0.5743153",
"0.5738221",
"0.57128704",
"0.57105964",
"0.5702565",
"0.5684788",
"0.5683219",
"0.5669215",
"0.5642647",
"0.56330746",
"0.5632771",
"0.56311405",
"0.5619852",
"0.56175274",
"0.56145424",
"0.5606628",
"0.55982935",
"0.5594579",
"0.55905414",
"0.55836636",
"0.5558948",
"0.55524266",
"0.55524266",
"0.55524266",
"0.55524266",
"0.555151",
"0.5548003",
"0.554288",
"0.5540087",
"0.5536643",
"0.5534",
"0.5534",
"0.5526575",
"0.55257535",
"0.551856"
] |
0.7419579
|
2
|
this model's custom representations. those representations were added through media_type definitions
|
def custom_representations
@custom_representations ||= []
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def media_type_representations\n custom_representations + Restfulie::MediaType.default_representations.dup\n end",
"def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"size\" => lambda {|n| @size = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n })\n end",
"def as_media_type(options = {})\n options ||= {}\n halelets = []\n halelets << get_semantic_data(options)\n halelets << get_data(@object.each_transition(options), relations)\n halelets << get_data(@object.metadata_links(options), relations)\n base_object = halelets.reduce(&:deep_merge)\n add_embedded(base_object, options)\n end",
"def as_media_type(options = {})\n options ||= {}\n halelets = []\n halelets << get_semantic_data(options)\n halelets << get_data(@object.each_transition(options), relations)\n halelets << get_data(@object.metadata_links(options), relations)\n base_object = halelets.reduce(&:deep_merge)\n add_embedded(base_object, options)\n end",
"def get_field_deserializers()\n return super.merge({\n \"large\" => lambda {|n| @large = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Thumbnail.create_from_discriminator_value(pn) }) },\n \"medium\" => lambda {|n| @medium = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Thumbnail.create_from_discriminator_value(pn) }) },\n \"small\" => lambda {|n| @small = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Thumbnail.create_from_discriminator_value(pn) }) },\n \"source\" => lambda {|n| @source = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Thumbnail.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"committedContentVersion\" => lambda {|n| @committed_content_version = n.get_string_value() },\n \"contentVersions\" => lambda {|n| @content_versions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::MobileAppContent.create_from_discriminator_value(pn) }) },\n \"fileName\" => lambda {|n| @file_name = n.get_string_value() },\n \"size\" => lambda {|n| @size = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n })\n end",
"def media_types\n Restfulie::MediaType.default_types + MediaType.medias_for(self)\n end",
"def get_field_deserializers()\n return super.merge({\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"file\" => lambda {|n| @file = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"fileHash\" => lambda {|n| @file_hash = n.get_string_value() },\n \"version\" => lambda {|n| @version = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"body\" => lambda {|n| @body = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityFormattedContent.create_from_discriminator_value(pn) }) },\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"imageUrl\" => lambda {|n| @image_url = n.get_string_value() },\n \"indicators\" => lambda {|n| @indicators = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::SecurityArticleIndicator.create_from_discriminator_value(pn) }) },\n \"isFeatured\" => lambda {|n| @is_featured = n.get_boolean_value() },\n \"lastUpdatedDateTime\" => lambda {|n| @last_updated_date_time = n.get_date_time_value() },\n \"summary\" => lambda {|n| @summary = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityFormattedContent.create_from_discriminator_value(pn) }) },\n \"tags\" => lambda {|n| @tags = n.get_collection_of_primitive_values(String) },\n \"title\" => lambda {|n| @title = n.get_string_value() },\n })\n end",
"def media\n super\n end",
"def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"contentUrl\" => lambda {|n| @content_url = n.get_string_value() },\n \"createdByAppId\" => lambda {|n| @created_by_app_id = n.get_string_value() },\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"level\" => lambda {|n| @level = n.get_number_value() },\n \"links\" => lambda {|n| @links = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::PageLinks.create_from_discriminator_value(pn) }) },\n \"order\" => lambda {|n| @order = n.get_number_value() },\n \"parentNotebook\" => lambda {|n| @parent_notebook = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Notebook.create_from_discriminator_value(pn) }) },\n \"parentSection\" => lambda {|n| @parent_section = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::OnenoteSection.create_from_discriminator_value(pn) }) },\n \"title\" => lambda {|n| @title = n.get_string_value() },\n \"userTags\" => lambda {|n| @user_tags = n.get_collection_of_primitive_values(String) },\n })\n end",
"def mediatype; end",
"def get_field_deserializers()\n return {\n \"attribution\" => lambda {|n| @attribution = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ImageInfo.create_from_discriminator_value(pn) }) },\n \"backgroundColor\" => lambda {|n| @background_color = n.get_string_value() },\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"displayText\" => lambda {|n| @display_text = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end",
"def media_type; end",
"def media_type; end",
"def get_field_deserializers()\n return super.merge({\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"owner\" => lambda {|n| @owner = n.get_string_value() },\n \"properties\" => lambda {|n| @properties = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ExtensionSchemaProperty.create_from_discriminator_value(pn) }) },\n \"status\" => lambda {|n| @status = n.get_string_value() },\n \"targetTypes\" => lambda {|n| @target_types = n.get_collection_of_primitive_values(String) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"nextExpectedRanges\" => lambda {|n| @next_expected_ranges = n.get_collection_of_primitive_values(String) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"resource\" => lambda {|n| @resource = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Entity.create_from_discriminator_value(pn) }) },\n \"resourceReference\" => lambda {|n| @resource_reference = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ResourceReference.create_from_discriminator_value(pn) }) },\n \"resourceVisualization\" => lambda {|n| @resource_visualization = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ResourceVisualization.create_from_discriminator_value(pn) }) },\n \"weight\" => lambda {|n| @weight = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"assignments\" => lambda {|n| @assignments = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::MobileAppAssignment.create_from_discriminator_value(pn) }) },\n \"categories\" => lambda {|n| @categories = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::MobileAppCategory.create_from_discriminator_value(pn) }) },\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"developer\" => lambda {|n| @developer = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"informationUrl\" => lambda {|n| @information_url = n.get_string_value() },\n \"isFeatured\" => lambda {|n| @is_featured = n.get_boolean_value() },\n \"largeIcon\" => lambda {|n| @large_icon = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::MimeContent.create_from_discriminator_value(pn) }) },\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"notes\" => lambda {|n| @notes = n.get_string_value() },\n \"owner\" => lambda {|n| @owner = n.get_string_value() },\n \"privacyInformationUrl\" => lambda {|n| @privacy_information_url = n.get_string_value() },\n \"publisher\" => lambda {|n| @publisher = n.get_string_value() },\n \"publishingState\" => lambda {|n| @publishing_state = n.get_enum_value(MicrosoftGraph::Models::MobileAppPublishingState) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"applicableArchitectures\" => lambda {|n| @applicable_architectures = n.get_enum_value(MicrosoftGraph::Models::WindowsArchitecture) },\n \"applicableDeviceTypes\" => lambda {|n| @applicable_device_types = n.get_enum_value(MicrosoftGraph::Models::WindowsDeviceType) },\n \"committedContainedApps\" => lambda {|n| @committed_contained_apps = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::MobileContainedApp.create_from_discriminator_value(pn) }) },\n \"identityName\" => lambda {|n| @identity_name = n.get_string_value() },\n \"identityPublisherHash\" => lambda {|n| @identity_publisher_hash = n.get_string_value() },\n \"identityResourceIdentifier\" => lambda {|n| @identity_resource_identifier = n.get_string_value() },\n \"identityVersion\" => lambda {|n| @identity_version = n.get_string_value() },\n \"isBundle\" => lambda {|n| @is_bundle = n.get_boolean_value() },\n \"minimumSupportedOperatingSystem\" => lambda {|n| @minimum_supported_operating_system = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WindowsMinimumOperatingSystem.create_from_discriminator_value(pn) }) },\n })\n end",
"def to_media_subtype(field, val)\n @models[:medium] ||= {}\n @media_subtype_mappings ||= {\n 'image/jpeg' => :jpg,\n 'image/gif' => :jpg, # It will be converted.\n 'image/tiff' => :jpg, # It will be converted.\n 'video/x-youtube' => :youtube,\n 'video/vimeo' => :vimeo,\n 'video/mp4' => :mp4,\n 'video/quicktime' => :mov,\n 'application/javascript' => :map_js,\n 'audio/mpeg' => :mp3, # NOTE: this one is \"best\".\n 'audio/mp3' => :mp3,\n 'audio/ogg' => :ogg, # NOTE: this one is \"best\"\n 'video/ogg' => :ogv,\n 'audio/wav' => :wav,\n 'audio/x-wav' => :wav,\n 'text/html' => nil, # Nothing needed; this is just an article!\n 'map' => :map_image,\n 'map_image' => :map_image\n }\n norm_val = fix_subtype_val(val.downcase, @models[:medium][:subclass])\n type = if @media_subtype_mappings.key?(norm_val)\n @media_subtype_mappings[norm_val]\n else\n @process.warn(%Q{Could not find a media subtype (format) of \"#{norm_val}\"}) unless\n @missing_media_types.key?(norm_val)\n @missing_media_types[norm_val] = true\n nil\n end\n @models[:medium][:original_format] = norm_val\n @process.debug(\"Set medium original_format to #{norm_val}\") if field.debugging\n if type == :map_image\n @models[:medium][:subclass] = type # Maps are a SUBCLASS in this code, but were a \"format\" in v2...\n @process.debug(\"Set medium subclass to #{type}\") if field.debugging\n else\n @models[:medium][:format] = type\n @process.debug(\"Set medium format to #{type}\") if field.debugging\n end\n end",
"def media_sfp\n super\n end",
"def get_field_deserializers()\n return super.merge({\n \"authenticationConfiguration\" => lambda {|n| @authentication_configuration = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::CustomExtensionAuthenticationConfiguration.create_from_discriminator_value(pn) }) },\n \"clientConfiguration\" => lambda {|n| @client_configuration = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::CustomExtensionClientConfiguration.create_from_discriminator_value(pn) }) },\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"endpointConfiguration\" => lambda {|n| @endpoint_configuration = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::CustomExtensionEndpointConfiguration.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"issuer\" => lambda {|n| @issuer = n.get_string_value() },\n \"issuerName\" => lambda {|n| @issuer_name = n.get_string_value() },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::CertificateStatus) },\n \"subject\" => lambda {|n| @subject = n.get_string_value() },\n \"subjectName\" => lambda {|n| @subject_name = n.get_string_value() },\n \"uploadDateTime\" => lambda {|n| @upload_date_time = n.get_date_time_value() },\n })\n end",
"def attributes\n super.merge(:content_type => content_type)\n end",
"def get_field_deserializers()\n return super.merge({\n \"attachments\" => lambda {|n| @attachments = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Attachment.create_from_discriminator_value(pn) }) },\n \"bccRecipients\" => lambda {|n| @bcc_recipients = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Recipient.create_from_discriminator_value(pn) }) },\n \"body\" => lambda {|n| @body = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ItemBody.create_from_discriminator_value(pn) }) },\n \"bodyPreview\" => lambda {|n| @body_preview = n.get_string_value() },\n \"ccRecipients\" => lambda {|n| @cc_recipients = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Recipient.create_from_discriminator_value(pn) }) },\n \"conversationId\" => lambda {|n| @conversation_id = n.get_string_value() },\n \"conversationIndex\" => lambda {|n| @conversation_index = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"extensions\" => lambda {|n| @extensions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Extension.create_from_discriminator_value(pn) }) },\n \"flag\" => lambda {|n| @flag = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::FollowupFlag.create_from_discriminator_value(pn) }) },\n \"from\" => lambda {|n| @from = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Recipient.create_from_discriminator_value(pn) }) },\n \"hasAttachments\" => lambda {|n| @has_attachments = n.get_boolean_value() },\n \"importance\" => lambda {|n| @importance = n.get_enum_value(MicrosoftGraph::Models::Importance) },\n \"inferenceClassification\" => lambda {|n| @inference_classification = n.get_enum_value(MicrosoftGraph::Models::InferenceClassificationType) },\n \"internetMessageHeaders\" => lambda {|n| @internet_message_headers = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::InternetMessageHeader.create_from_discriminator_value(pn) }) },\n \"internetMessageId\" => lambda {|n| @internet_message_id = n.get_string_value() },\n \"isDeliveryReceiptRequested\" => lambda {|n| @is_delivery_receipt_requested = n.get_boolean_value() },\n \"isDraft\" => lambda {|n| @is_draft = n.get_boolean_value() },\n \"isRead\" => lambda {|n| @is_read = n.get_boolean_value() },\n \"isReadReceiptRequested\" => lambda {|n| @is_read_receipt_requested = n.get_boolean_value() },\n \"multiValueExtendedProperties\" => lambda {|n| @multi_value_extended_properties = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::MultiValueLegacyExtendedProperty.create_from_discriminator_value(pn) }) },\n \"parentFolderId\" => lambda {|n| @parent_folder_id = n.get_string_value() },\n \"receivedDateTime\" => lambda {|n| @received_date_time = n.get_date_time_value() },\n \"replyTo\" => lambda {|n| @reply_to = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Recipient.create_from_discriminator_value(pn) }) },\n \"sender\" => lambda {|n| @sender = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Recipient.create_from_discriminator_value(pn) }) },\n \"sentDateTime\" => lambda {|n| @sent_date_time = n.get_date_time_value() },\n \"singleValueExtendedProperties\" => lambda {|n| @single_value_extended_properties = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::SingleValueLegacyExtendedProperty.create_from_discriminator_value(pn) }) },\n \"subject\" => lambda {|n| @subject = n.get_string_value() },\n \"toRecipients\" => lambda {|n| @to_recipients = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Recipient.create_from_discriminator_value(pn) }) },\n \"uniqueBody\" => lambda {|n| @unique_body = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ItemBody.create_from_discriminator_value(pn) }) },\n \"webLink\" => lambda {|n| @web_link = n.get_string_value() },\n })\n end",
"def represented\n model\n end",
"def get_field_deserializers()\n return super.merge({\n \"contentData\" => lambda {|n| @content_data = n.get_string_value() },\n \"fileName\" => lambda {|n| @file_name = n.get_string_value() },\n })\n end",
"def to_media_type(field, val)\n @models[:medium] ||= {}\n if @models[:medium].key?(:subclass) # We've already got one.\n @process.debug(\"Skipping media type {#{val}}; already specified.\") if field.debugging\n return\n end\n @media_type_mappings ||= {\n 'image' => :image,\n 'video' => :video,\n 'sound' => :sound,\n 'map' => :map_image,\n 'map_image' => :map_image,\n 'map_js' => :map_js,\n 'http://purl.org/dc/dcmitype/stillimage' => :image,\n 'http://purl.org/dc/dcmitype/movingimage' => :video,\n 'http://purl.org/dc/dcmitype/text' => :article,\n 'http://purl.org/dc/dcmitype/sound' => :sound\n }\n norm_val = val.downcase\n type =\n if @media_type_mappings.key?(norm_val)\n @media_type_mappings[norm_val]\n else\n @process.warn(%Q{Could not find a media type (subclass) of \"#{norm_val}\"}) unless\n @missing_media_types.key?(norm_val)\n @missing_media_types[norm_val] = true\n nil\n end\n @models[:medium][:original_type] = norm_val\n @process.debug(\"Set original_type to #{norm_val}\") if field.debugging\n @models[:medium][:subclass] = type\n @process.debug(\"Set subclass to #{type}\") if field.debugging\n return unless type == :article\n\n @models[:medium][:is_article] = true\n @process.debug('Set is_article to true') if field.debugging\n end",
"def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Intelligence.V2.MediaInstance #{values}>\"\n end",
"def get_field_deserializers()\n return super.merge({\n \"format\" => lambda {|n| @format = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WorkbookChartDataLabelFormat.create_from_discriminator_value(pn) }) },\n \"position\" => lambda {|n| @position = n.get_string_value() },\n \"separator\" => lambda {|n| @separator = n.get_string_value() },\n \"showBubbleSize\" => lambda {|n| @show_bubble_size = n.get_boolean_value() },\n \"showCategoryName\" => lambda {|n| @show_category_name = n.get_boolean_value() },\n \"showLegendKey\" => lambda {|n| @show_legend_key = n.get_boolean_value() },\n \"showPercentage\" => lambda {|n| @show_percentage = n.get_boolean_value() },\n \"showSeriesName\" => lambda {|n| @show_series_name = n.get_boolean_value() },\n \"showValue\" => lambda {|n| @show_value = n.get_boolean_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"attachmentSessions\" => lambda {|n| @attachment_sessions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AttachmentSession.create_from_discriminator_value(pn) }) },\n \"attachments\" => lambda {|n| @attachments = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AttachmentBase.create_from_discriminator_value(pn) }) },\n \"body\" => lambda {|n| @body = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ItemBody.create_from_discriminator_value(pn) }) },\n \"bodyLastModifiedDateTime\" => lambda {|n| @body_last_modified_date_time = n.get_date_time_value() },\n \"categories\" => lambda {|n| @categories = n.get_collection_of_primitive_values(String) },\n \"checklistItems\" => lambda {|n| @checklist_items = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ChecklistItem.create_from_discriminator_value(pn) }) },\n \"completedDateTime\" => lambda {|n| @completed_date_time = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::DateTimeTimeZone.create_from_discriminator_value(pn) }) },\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"dueDateTime\" => lambda {|n| @due_date_time = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::DateTimeTimeZone.create_from_discriminator_value(pn) }) },\n \"extensions\" => lambda {|n| @extensions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Extension.create_from_discriminator_value(pn) }) },\n \"hasAttachments\" => lambda {|n| @has_attachments = n.get_boolean_value() },\n \"importance\" => lambda {|n| @importance = n.get_enum_value(MicrosoftGraph::Models::Importance) },\n \"isReminderOn\" => lambda {|n| @is_reminder_on = n.get_boolean_value() },\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"linkedResources\" => lambda {|n| @linked_resources = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::LinkedResource.create_from_discriminator_value(pn) }) },\n \"recurrence\" => lambda {|n| @recurrence = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::PatternedRecurrence.create_from_discriminator_value(pn) }) },\n \"reminderDateTime\" => lambda {|n| @reminder_date_time = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::DateTimeTimeZone.create_from_discriminator_value(pn) }) },\n \"startDateTime\" => lambda {|n| @start_date_time = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::DateTimeTimeZone.create_from_discriminator_value(pn) }) },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::TaskStatus) },\n \"title\" => lambda {|n| @title = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"comment\" => lambda {|n| @comment = n.get_string_value() },\n \"createdBy\" => lambda {|n| @created_by = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::IdentitySet.create_from_discriminator_value(pn) }) },\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"items\" => lambda {|n| @items = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::DocumentSetVersionItem.create_from_discriminator_value(pn) }) },\n \"shouldCaptureMinorVersion\" => lambda {|n| @should_capture_minor_version = n.get_boolean_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"isCourseActivitySyncEnabled\" => lambda {|n| @is_course_activity_sync_enabled = n.get_boolean_value() },\n \"learningContents\" => lambda {|n| @learning_contents = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::LearningContent.create_from_discriminator_value(pn) }) },\n \"learningCourseActivities\" => lambda {|n| @learning_course_activities = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::LearningCourseActivity.create_from_discriminator_value(pn) }) },\n \"loginWebUrl\" => lambda {|n| @login_web_url = n.get_string_value() },\n \"longLogoWebUrlForDarkTheme\" => lambda {|n| @long_logo_web_url_for_dark_theme = n.get_string_value() },\n \"longLogoWebUrlForLightTheme\" => lambda {|n| @long_logo_web_url_for_light_theme = n.get_string_value() },\n \"squareLogoWebUrlForDarkTheme\" => lambda {|n| @square_logo_web_url_for_dark_theme = n.get_string_value() },\n \"squareLogoWebUrlForLightTheme\" => lambda {|n| @square_logo_web_url_for_light_theme = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"details\" => lambda {|n| @details = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::DetailsInfo.create_from_discriminator_value(pn) }) },\n \"identityType\" => lambda {|n| @identity_type = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"attachments\" => lambda {|n| @attachments = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Attachment.create_from_discriminator_value(pn) }) },\n \"body\" => lambda {|n| @body = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ItemBody.create_from_discriminator_value(pn) }) },\n \"conversationId\" => lambda {|n| @conversation_id = n.get_string_value() },\n \"conversationThreadId\" => lambda {|n| @conversation_thread_id = n.get_string_value() },\n \"extensions\" => lambda {|n| @extensions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Extension.create_from_discriminator_value(pn) }) },\n \"from\" => lambda {|n| @from = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Recipient.create_from_discriminator_value(pn) }) },\n \"hasAttachments\" => lambda {|n| @has_attachments = n.get_boolean_value() },\n \"inReplyTo\" => lambda {|n| @in_reply_to = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Post.create_from_discriminator_value(pn) }) },\n \"multiValueExtendedProperties\" => lambda {|n| @multi_value_extended_properties = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::MultiValueLegacyExtendedProperty.create_from_discriminator_value(pn) }) },\n \"newParticipants\" => lambda {|n| @new_participants = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Recipient.create_from_discriminator_value(pn) }) },\n \"receivedDateTime\" => lambda {|n| @received_date_time = n.get_date_time_value() },\n \"sender\" => lambda {|n| @sender = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Recipient.create_from_discriminator_value(pn) }) },\n \"singleValueExtendedProperties\" => lambda {|n| @single_value_extended_properties = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::SingleValueLegacyExtendedProperty.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"templateId\" => lambda {|n| @template_id = n.get_string_value() },\n \"values\" => lambda {|n| @values = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::SettingValue.create_from_discriminator_value(pn) }) },\n })\n end",
"def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Media.V1.MediaProcessorInstance #{values}>\"\n end",
"def get_field_deserializers()\n return super.merge({\n \"apps\" => lambda {|n| @apps = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedMobileApp.create_from_discriminator_value(pn) }) },\n \"customBrowserDisplayName\" => lambda {|n| @custom_browser_display_name = n.get_string_value() },\n \"customBrowserPackageId\" => lambda {|n| @custom_browser_package_id = n.get_string_value() },\n \"deployedAppCount\" => lambda {|n| @deployed_app_count = n.get_number_value() },\n \"deploymentSummary\" => lambda {|n| @deployment_summary = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ManagedAppPolicyDeploymentSummary.create_from_discriminator_value(pn) }) },\n \"disableAppEncryptionIfDeviceEncryptionIsEnabled\" => lambda {|n| @disable_app_encryption_if_device_encryption_is_enabled = n.get_boolean_value() },\n \"encryptAppData\" => lambda {|n| @encrypt_app_data = n.get_boolean_value() },\n \"minimumRequiredPatchVersion\" => lambda {|n| @minimum_required_patch_version = n.get_string_value() },\n \"minimumWarningPatchVersion\" => lambda {|n| @minimum_warning_patch_version = n.get_string_value() },\n \"screenCaptureBlocked\" => lambda {|n| @screen_capture_blocked = n.get_boolean_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"links\" => lambda {|n| @links = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::OnenotePagePreviewLinks.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"previewText\" => lambda {|n| @preview_text = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"additionalTags\" => lambda {|n| @additional_tags = n.get_collection_of_primitive_values(String) },\n \"contentWebUrl\" => lambda {|n| @content_web_url = n.get_string_value() },\n \"contributors\" => lambda {|n| @contributors = n.get_collection_of_primitive_values(String) },\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"duration\" => lambda {|n| @duration = n.get_duration_value() },\n \"externalId\" => lambda {|n| @external_id = n.get_string_value() },\n \"format\" => lambda {|n| @format = n.get_string_value() },\n \"isActive\" => lambda {|n| @is_active = n.get_boolean_value() },\n \"isPremium\" => lambda {|n| @is_premium = n.get_boolean_value() },\n \"isSearchable\" => lambda {|n| @is_searchable = n.get_boolean_value() },\n \"languageTag\" => lambda {|n| @language_tag = n.get_string_value() },\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"numberOfPages\" => lambda {|n| @number_of_pages = n.get_number_value() },\n \"skillTags\" => lambda {|n| @skill_tags = n.get_collection_of_primitive_values(String) },\n \"sourceName\" => lambda {|n| @source_name = n.get_string_value() },\n \"thumbnailWebUrl\" => lambda {|n| @thumbnail_web_url = n.get_string_value() },\n \"title\" => lambda {|n| @title = n.get_string_value() },\n })\n end",
"def initialize_representations\n []\n end",
"def mediatype\n media_type\n end",
"def get_field_deserializers()\n return super.merge({\n \"deviceCount\" => lambda {|n| @device_count = n.get_number_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"managedDevices\" => lambda {|n| @managed_devices = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedDevice.create_from_discriminator_value(pn) }) },\n \"platform\" => lambda {|n| @platform = n.get_enum_value(MicrosoftGraph::Models::DetectedAppPlatformType) },\n \"publisher\" => lambda {|n| @publisher = n.get_string_value() },\n \"sizeInByte\" => lambda {|n| @size_in_byte = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"version\" => lambda {|n| @version = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"audiences\" => lambda {|n| @audiences = n.get_collection_of_primitive_values(String) },\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"issuer\" => lambda {|n| @issuer = n.get_string_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"subject\" => lambda {|n| @subject = n.get_string_value() },\n })\n end",
"def media_types\n return @media_types\n end",
"def get_field_deserializers()\n return super.merge({\n \"aliases\" => lambda {|n| @aliases = n.get_collection_of_primitive_values(String) },\n \"countriesOrRegionsOfOrigin\" => lambda {|n| @countries_or_regions_of_origin = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::SecurityIntelligenceProfileCountryOrRegionOfOrigin.create_from_discriminator_value(pn) }) },\n \"description\" => lambda {|n| @description = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityFormattedContent.create_from_discriminator_value(pn) }) },\n \"firstActiveDateTime\" => lambda {|n| @first_active_date_time = n.get_date_time_value() },\n \"indicators\" => lambda {|n| @indicators = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::SecurityIntelligenceProfileIndicator.create_from_discriminator_value(pn) }) },\n \"kind\" => lambda {|n| @kind = n.get_enum_value(MicrosoftGraph::Models::SecurityIntelligenceProfileKind) },\n \"summary\" => lambda {|n| @summary = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityFormattedContent.create_from_discriminator_value(pn) }) },\n \"targets\" => lambda {|n| @targets = n.get_collection_of_primitive_values(String) },\n \"title\" => lambda {|n| @title = n.get_string_value() },\n \"tradecraft\" => lambda {|n| @tradecraft = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityFormattedContent.create_from_discriminator_value(pn) }) },\n })\n end",
"def mediatype\n\t\treturn \"%s/%s\" % [ self.type || '*', self.subtype || '*' ]\n\tend",
"def get_field_deserializers()\n return super.merge({\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"isBuiltIn\" => lambda {|n| @is_built_in = n.get_boolean_value() },\n \"roleAssignments\" => lambda {|n| @role_assignments = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RoleAssignment.create_from_discriminator_value(pn) }) },\n \"rolePermissions\" => lambda {|n| @role_permissions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RolePermission.create_from_discriminator_value(pn) }) },\n })\n end",
"def to_media_type(options)\n as_media_type(options).to_json\n end",
"def to_media_type(options)\n as_media_type(options).to_json\n end",
"def get_field_deserializers()\n return super.merge({\n \"capability\" => lambda {|n| @capability = n.get_string_value() },\n \"providerId\" => lambda {|n| @provider_id = n.get_string_value() },\n \"providerName\" => lambda {|n| @provider_name = n.get_string_value() },\n \"providerResourceId\" => lambda {|n| @provider_resource_id = n.get_string_value() },\n \"uri\" => lambda {|n| @uri = n.get_string_value() },\n })\n end",
"def content_types\n self.class.custom_content_types\n end",
"def get_field_deserializers()\n return super.merge({\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"isAvailable\" => lambda {|n| @is_available = n.get_boolean_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"isDefault\" => lambda {|n| @is_default = n.get_boolean_value() },\n \"links\" => lambda {|n| @links = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SectionLinks.create_from_discriminator_value(pn) }) },\n \"pages\" => lambda {|n| @pages = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::OnenotePage.create_from_discriminator_value(pn) }) },\n \"pagesUrl\" => lambda {|n| @pages_url = n.get_string_value() },\n \"parentNotebook\" => lambda {|n| @parent_notebook = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Notebook.create_from_discriminator_value(pn) }) },\n \"parentSectionGroup\" => lambda {|n| @parent_section_group = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SectionGroup.create_from_discriminator_value(pn) }) },\n })\n end",
"def media\n self\n end",
"def get_field_deserializers()\n return super.merge({\n \"appId\" => lambda {|n| @app_id = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"objectId\" => lambda {|n| @object_id_escaped = n.get_string_value() },\n \"publisher\" => lambda {|n| @publisher = n.get_string_value() },\n })\n end",
"def to_s\n '<Twilio::REST::Media::V1>'\n end",
"def get_field_deserializers()\n return super.merge({\n \"detectionStatus\" => lambda {|n| @detection_status = n.get_enum_value(MicrosoftGraph::Models::SecurityDetectionStatus) },\n \"fileDetails\" => lambda {|n| @file_details = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityFileDetails.create_from_discriminator_value(pn) }) },\n \"mdeDeviceId\" => lambda {|n| @mde_device_id = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"appDefinitions\" => lambda {|n| @app_definitions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::TeamsAppDefinition.create_from_discriminator_value(pn) }) },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"distributionMethod\" => lambda {|n| @distribution_method = n.get_enum_value(MicrosoftGraph::Models::TeamsAppDistributionMethod) },\n \"externalId\" => lambda {|n| @external_id = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"itemId\" => lambda {|n| @item_id = n.get_string_value() },\n \"urlMatchInfo\" => lambda {|n| @url_match_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ExternalConnectorsUrlMatchInfo.create_from_discriminator_value(pn) }) },\n })\n end",
"def media_types=(value)\n @media_types = value\n end",
"def photo_format; end",
"def get_field_deserializers()\n return super.merge({\n \"audioRoutingGroups\" => lambda {|n| @audio_routing_groups = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AudioRoutingGroup.create_from_discriminator_value(pn) }) },\n \"callChainId\" => lambda {|n| @call_chain_id = n.get_string_value() },\n \"callOptions\" => lambda {|n| @call_options = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::CallOptions.create_from_discriminator_value(pn) }) },\n \"callRoutes\" => lambda {|n| @call_routes = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::CallRoute.create_from_discriminator_value(pn) }) },\n \"callbackUri\" => lambda {|n| @callback_uri = n.get_string_value() },\n \"chatInfo\" => lambda {|n| @chat_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ChatInfo.create_from_discriminator_value(pn) }) },\n \"contentSharingSessions\" => lambda {|n| @content_sharing_sessions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ContentSharingSession.create_from_discriminator_value(pn) }) },\n \"direction\" => lambda {|n| @direction = n.get_enum_value(MicrosoftGraph::Models::CallDirection) },\n \"incomingContext\" => lambda {|n| @incoming_context = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::IncomingContext.create_from_discriminator_value(pn) }) },\n \"mediaConfig\" => lambda {|n| @media_config = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::MediaConfig.create_from_discriminator_value(pn) }) },\n \"mediaState\" => lambda {|n| @media_state = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::CallMediaState.create_from_discriminator_value(pn) }) },\n \"meetingInfo\" => lambda {|n| @meeting_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::MeetingInfo.create_from_discriminator_value(pn) }) },\n \"myParticipantId\" => lambda {|n| @my_participant_id = n.get_string_value() },\n \"operations\" => lambda {|n| @operations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::CommsOperation.create_from_discriminator_value(pn) }) },\n \"participants\" => lambda {|n| @participants = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Participant.create_from_discriminator_value(pn) }) },\n \"requestedModalities\" => lambda {|n| @requested_modalities = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Modality.create_from_discriminator_value(pn) }) },\n \"resultInfo\" => lambda {|n| @result_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ResultInfo.create_from_discriminator_value(pn) }) },\n \"source\" => lambda {|n| @source = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ParticipantInfo.create_from_discriminator_value(pn) }) },\n \"state\" => lambda {|n| @state = n.get_enum_value(MicrosoftGraph::Models::CallState) },\n \"subject\" => lambda {|n| @subject = n.get_string_value() },\n \"targets\" => lambda {|n| @targets = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::InvitationParticipantInfo.create_from_discriminator_value(pn) }) },\n \"tenantId\" => lambda {|n| @tenant_id = n.get_string_value() },\n \"toneInfo\" => lambda {|n| @tone_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ToneInfo.create_from_discriminator_value(pn) }) },\n \"transcription\" => lambda {|n| @transcription = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::CallTranscriptionInfo.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"administrativeUnits\" => lambda {|n| @administrative_units = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AdministrativeUnit.create_from_discriminator_value(pn) }) },\n \"attributeSets\" => lambda {|n| @attribute_sets = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AttributeSet.create_from_discriminator_value(pn) }) },\n \"customSecurityAttributeDefinitions\" => lambda {|n| @custom_security_attribute_definitions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::CustomSecurityAttributeDefinition.create_from_discriminator_value(pn) }) },\n \"deletedItems\" => lambda {|n| @deleted_items = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::DirectoryObject.create_from_discriminator_value(pn) }) },\n \"federationConfigurations\" => lambda {|n| @federation_configurations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::IdentityProviderBase.create_from_discriminator_value(pn) }) },\n \"onPremisesSynchronization\" => lambda {|n| @on_premises_synchronization = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::OnPremisesDirectorySynchronization.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"definitions\" => lambda {|n| @definitions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AccessReviewScheduleDefinition.create_from_discriminator_value(pn) }) },\n \"historyDefinitions\" => lambda {|n| @history_definitions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AccessReviewHistoryDefinition.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"connectors\" => lambda {|n| @connectors = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::PrintConnector.create_from_discriminator_value(pn) }) },\n \"hasPhysicalDevice\" => lambda {|n| @has_physical_device = n.get_boolean_value() },\n \"isShared\" => lambda {|n| @is_shared = n.get_boolean_value() },\n \"lastSeenDateTime\" => lambda {|n| @last_seen_date_time = n.get_date_time_value() },\n \"registeredDateTime\" => lambda {|n| @registered_date_time = n.get_date_time_value() },\n \"shares\" => lambda {|n| @shares = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::PrinterShare.create_from_discriminator_value(pn) }) },\n \"taskTriggers\" => lambda {|n| @task_triggers = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::PrintTaskTrigger.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"platformType\" => lambda {|n| @platform_type = n.get_enum_value(MicrosoftGraph::Models::PolicyPlatformType) },\n \"settingCount\" => lambda {|n| @setting_count = n.get_number_value() },\n \"settingStates\" => lambda {|n| @setting_states = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::DeviceCompliancePolicySettingState.create_from_discriminator_value(pn) }) },\n \"state\" => lambda {|n| @state = n.get_enum_value(MicrosoftGraph::Models::ComplianceStatus) },\n \"version\" => lambda {|n| @version = n.get_number_value() },\n })\n end",
"def media_status\n super\n end",
"def get_field_deserializers()\n return super.merge({\n \"parentNotebook\" => lambda {|n| @parent_notebook = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Notebook.create_from_discriminator_value(pn) }) },\n \"parentSectionGroup\" => lambda {|n| @parent_section_group = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SectionGroup.create_from_discriminator_value(pn) }) },\n \"sectionGroups\" => lambda {|n| @section_groups = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::SectionGroup.create_from_discriminator_value(pn) }) },\n \"sectionGroupsUrl\" => lambda {|n| @section_groups_url = n.get_string_value() },\n \"sections\" => lambda {|n| @sections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::OnenoteSection.create_from_discriminator_value(pn) }) },\n \"sectionsUrl\" => lambda {|n| @sections_url = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"reviewSet\" => lambda {|n| @review_set = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityEdiscoveryReviewSet.create_from_discriminator_value(pn) }) },\n \"search\" => lambda {|n| @search = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityEdiscoverySearch.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"resourceScopes\" => lambda {|n| @resource_scopes = n.get_collection_of_primitive_values(String) },\n \"roleDefinition\" => lambda {|n| @role_definition = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::RoleDefinition.create_from_discriminator_value(pn) }) },\n })\n end",
"def media_option_sfp\n super\n end",
"def get_field_deserializers()\n return {\n \"hashes\" => lambda {|n| @hashes = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Hashes.create_from_discriminator_value(pn) }) },\n \"mimeType\" => lambda {|n| @mime_type = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"processingMetadata\" => lambda {|n| @processing_metadata = n.get_boolean_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"customExtensionStageInstanceDetail\" => lambda {|n| @custom_extension_stage_instance_detail = n.get_string_value() },\n \"customExtensionStageInstanceId\" => lambda {|n| @custom_extension_stage_instance_id = n.get_string_value() },\n \"stage\" => lambda {|n| @stage = n.get_enum_value(MicrosoftGraph::Models::AccessPackageCustomExtensionStage) },\n \"state\" => lambda {|n| @state = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"axes\" => lambda {|n| @axes = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WorkbookChartAxes.create_from_discriminator_value(pn) }) },\n \"dataLabels\" => lambda {|n| @data_labels = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WorkbookChartDataLabels.create_from_discriminator_value(pn) }) },\n \"format\" => lambda {|n| @format = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WorkbookChartAreaFormat.create_from_discriminator_value(pn) }) },\n \"height\" => lambda {|n| @height = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"left\" => lambda {|n| @left = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"legend\" => lambda {|n| @legend = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WorkbookChartLegend.create_from_discriminator_value(pn) }) },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"series\" => lambda {|n| @series = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WorkbookChartSeries.create_from_discriminator_value(pn) }) },\n \"title\" => lambda {|n| @title = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WorkbookChartTitle.create_from_discriminator_value(pn) }) },\n \"top\" => lambda {|n| @top = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"width\" => lambda {|n| @width = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"worksheet\" => lambda {|n| @worksheet = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WorkbookWorksheet.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return {\n \"allowCustomMemes\" => lambda {|n| @allow_custom_memes = n.get_boolean_value() },\n \"allowGiphy\" => lambda {|n| @allow_giphy = n.get_boolean_value() },\n \"allowStickersAndMemes\" => lambda {|n| @allow_stickers_and_memes = n.get_boolean_value() },\n \"giphyContentRating\" => lambda {|n| @giphy_content_rating = n.get_enum_value(MicrosoftGraph::Models::GiphyRatingType) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"columns\" => lambda {|n| @columns = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WorkbookTableColumn.create_from_discriminator_value(pn) }) },\n \"highlightFirstColumn\" => lambda {|n| @highlight_first_column = n.get_boolean_value() },\n \"highlightLastColumn\" => lambda {|n| @highlight_last_column = n.get_boolean_value() },\n \"legacyId\" => lambda {|n| @legacy_id = n.get_string_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"rows\" => lambda {|n| @rows = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WorkbookTableRow.create_from_discriminator_value(pn) }) },\n \"showBandedColumns\" => lambda {|n| @show_banded_columns = n.get_boolean_value() },\n \"showBandedRows\" => lambda {|n| @show_banded_rows = n.get_boolean_value() },\n \"showFilterButton\" => lambda {|n| @show_filter_button = n.get_boolean_value() },\n \"showHeaders\" => lambda {|n| @show_headers = n.get_boolean_value() },\n \"showTotals\" => lambda {|n| @show_totals = n.get_boolean_value() },\n \"sort\" => lambda {|n| @sort = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WorkbookTableSort.create_from_discriminator_value(pn) }) },\n \"style\" => lambda {|n| @style = n.get_string_value() },\n \"worksheet\" => lambda {|n| @worksheet = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WorkbookWorksheet.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"activationUrl\" => lambda {|n| @activation_url = n.get_string_value() },\n \"activitySourceHost\" => lambda {|n| @activity_source_host = n.get_string_value() },\n \"appActivityId\" => lambda {|n| @app_activity_id = n.get_string_value() },\n \"appDisplayName\" => lambda {|n| @app_display_name = n.get_string_value() },\n \"contentInfo\" => lambda {|n| @content_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"contentUrl\" => lambda {|n| @content_url = n.get_string_value() },\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"fallbackUrl\" => lambda {|n| @fallback_url = n.get_string_value() },\n \"historyItems\" => lambda {|n| @history_items = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ActivityHistoryItem.create_from_discriminator_value(pn) }) },\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::Status) },\n \"userTimezone\" => lambda {|n| @user_timezone = n.get_string_value() },\n \"visualElements\" => lambda {|n| @visual_elements = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::VisualInfo.create_from_discriminator_value(pn) }) },\n })\n end",
"def media_option\n super\n end",
"def get_field_deserializers()\n return super.merge({\n \"assignments\" => lambda {|n| @assignments = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedEBookAssignment.create_from_discriminator_value(pn) }) },\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"deviceStates\" => lambda {|n| @device_states = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::DeviceInstallState.create_from_discriminator_value(pn) }) },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"informationUrl\" => lambda {|n| @information_url = n.get_string_value() },\n \"installSummary\" => lambda {|n| @install_summary = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::EBookInstallSummary.create_from_discriminator_value(pn) }) },\n \"largeCover\" => lambda {|n| @large_cover = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::MimeContent.create_from_discriminator_value(pn) }) },\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"privacyInformationUrl\" => lambda {|n| @privacy_information_url = n.get_string_value() },\n \"publishedDateTime\" => lambda {|n| @published_date_time = n.get_date_time_value() },\n \"publisher\" => lambda {|n| @publisher = n.get_string_value() },\n \"userStateSummary\" => lambda {|n| @user_state_summary = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::UserInstallStateSummary.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"group\" => lambda {|n| @group = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Group.create_from_discriminator_value(pn) }) },\n \"includedSources\" => lambda {|n| @included_sources = n.get_enum_value(MicrosoftGraph::Models::SecuritySourceType) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"applicationName\" => lambda {|n| @application_name = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"externalId\" => lambda {|n| @external_id = n.get_string_value() },\n \"webUrl\" => lambda {|n| @web_url = n.get_string_value() },\n })\n end",
"def new\n @media_type = MediaType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @media_type }\n end\n end",
"def get_field_deserializers()\n return super.merge({\n \"bundles\" => lambda {|n| @bundles = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::DriveItem.create_from_discriminator_value(pn) }) },\n \"driveType\" => lambda {|n| @drive_type = n.get_string_value() },\n \"following\" => lambda {|n| @following = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::DriveItem.create_from_discriminator_value(pn) }) },\n \"items\" => lambda {|n| @items = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::DriveItem.create_from_discriminator_value(pn) }) },\n \"list\" => lambda {|n| @list = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::List.create_from_discriminator_value(pn) }) },\n \"owner\" => lambda {|n| @owner = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::IdentitySet.create_from_discriminator_value(pn) }) },\n \"quota\" => lambda {|n| @quota = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Quota.create_from_discriminator_value(pn) }) },\n \"root\" => lambda {|n| @root = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::DriveItem.create_from_discriminator_value(pn) }) },\n \"sharePointIds\" => lambda {|n| @share_point_ids = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SharepointIds.create_from_discriminator_value(pn) }) },\n \"special\" => lambda {|n| @special = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::DriveItem.create_from_discriminator_value(pn) }) },\n \"system\" => lambda {|n| @system = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SystemFacet.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return {\n \"includeContent\" => lambda {|n| @include_content = n.get_enum_value(MicrosoftGraph::Models::SearchContent) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end",
"def set_media_type\n media_types = self.class.head(@endpoint).headers['accept']\n Occi::Log.debug(\"Available media types: #{media_types}\")\n @media_type = case media_types\n when /application\\/occi\\+json/\n 'application/occi+json'\n else\n 'text/plain'\n end\n end",
"def content_format\n attributes.fetch(:contentFormat)\n end",
"def get_field_deserializers()\n return super.merge({\n \"insights\" => lambda {|n| @insights = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::UserExperienceAnalyticsInsight.create_from_discriminator_value(pn) }) },\n \"metricValues\" => lambda {|n| @metric_values = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::UserExperienceAnalyticsMetric.create_from_discriminator_value(pn) }) },\n })\n end",
"def embed_type\n raise NotImplementedError\n end",
"def mime\n self.class.mime(self)\n end",
"def get_field_deserializers()\n return super.merge({\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"details\" => lambda {|n| @details = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ConditionalAccessPolicyDetail.create_from_discriminator_value(pn) }) },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"scenarios\" => lambda {|n| @scenarios = n.get_enum_value(MicrosoftGraph::Models::TemplateScenarios) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"appIdentifier\" => lambda {|n| @app_identifier = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::MobileAppIdentifier.create_from_discriminator_value(pn) }) },\n \"applicationVersion\" => lambda {|n| @application_version = n.get_string_value() },\n \"appliedPolicies\" => lambda {|n| @applied_policies = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedAppPolicy.create_from_discriminator_value(pn) }) },\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"deviceName\" => lambda {|n| @device_name = n.get_string_value() },\n \"deviceTag\" => lambda {|n| @device_tag = n.get_string_value() },\n \"deviceType\" => lambda {|n| @device_type = n.get_string_value() },\n \"flaggedReasons\" => lambda {|n| @flagged_reasons = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedAppFlaggedReason.create_from_discriminator_value(pn) }) },\n \"intendedPolicies\" => lambda {|n| @intended_policies = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedAppPolicy.create_from_discriminator_value(pn) }) },\n \"lastSyncDateTime\" => lambda {|n| @last_sync_date_time = n.get_date_time_value() },\n \"managementSdkVersion\" => lambda {|n| @management_sdk_version = n.get_string_value() },\n \"operations\" => lambda {|n| @operations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedAppOperation.create_from_discriminator_value(pn) }) },\n \"platformVersion\" => lambda {|n| @platform_version = n.get_string_value() },\n \"userId\" => lambda {|n| @user_id = n.get_string_value() },\n \"version\" => lambda {|n| @version = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"borders\" => lambda {|n| @borders = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WorkbookRangeBorder.create_from_discriminator_value(pn) }) },\n \"columnWidth\" => lambda {|n| @column_width = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"fill\" => lambda {|n| @fill = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WorkbookRangeFill.create_from_discriminator_value(pn) }) },\n \"font\" => lambda {|n| @font = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WorkbookRangeFont.create_from_discriminator_value(pn) }) },\n \"horizontalAlignment\" => lambda {|n| @horizontal_alignment = n.get_string_value() },\n \"protection\" => lambda {|n| @protection = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WorkbookFormatProtection.create_from_discriminator_value(pn) }) },\n \"rowHeight\" => lambda {|n| @row_height = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"verticalAlignment\" => lambda {|n| @vertical_alignment = n.get_string_value() },\n \"wrapText\" => lambda {|n| @wrap_text = n.get_boolean_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"audioDeviceName\" => lambda {|n| @audio_device_name = n.get_string_value() },\n \"bookingType\" => lambda {|n| @booking_type = n.get_enum_value(MicrosoftGraph::Models::BookingType) },\n \"building\" => lambda {|n| @building = n.get_string_value() },\n \"capacity\" => lambda {|n| @capacity = n.get_number_value() },\n \"displayDeviceName\" => lambda {|n| @display_device_name = n.get_string_value() },\n \"emailAddress\" => lambda {|n| @email_address = n.get_string_value() },\n \"floorLabel\" => lambda {|n| @floor_label = n.get_string_value() },\n \"floorNumber\" => lambda {|n| @floor_number = n.get_number_value() },\n \"isWheelChairAccessible\" => lambda {|n| @is_wheel_chair_accessible = n.get_boolean_value() },\n \"label\" => lambda {|n| @label = n.get_string_value() },\n \"nickname\" => lambda {|n| @nickname = n.get_string_value() },\n \"tags\" => lambda {|n| @tags = n.get_collection_of_primitive_values(String) },\n \"videoDeviceName\" => lambda {|n| @video_device_name = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"createdDateTimeUtc\" => lambda {|n| @created_date_time_utc = n.get_date_time_value() },\n \"deviceIdentities\" => lambda {|n| @device_identities = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ImportedWindowsAutopilotDeviceIdentity.create_from_discriminator_value(pn) }) },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::ImportedWindowsAutopilotDeviceIdentityUploadStatus) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"appUrl\" => lambda {|n| @app_url = n.get_string_value() },\n \"useManagedBrowser\" => lambda {|n| @use_managed_browser = n.get_boolean_value() },\n })\n end",
"def format\n if ControlledVocabulary.for(:geo_image_format).include? geo_mime_type\n ControlledVocabulary.for(:geo_image_format).find(geo_mime_type).label\n elsif ControlledVocabulary.for(:geo_raster_format).include? geo_mime_type\n ControlledVocabulary.for(:geo_raster_format).find(geo_mime_type).label\n elsif ControlledVocabulary.for(:geo_vector_format).include? geo_mime_type\n ControlledVocabulary.for(:geo_vector_format).find(geo_mime_type).label\n end\n end",
"def get_field_deserializers()\n return super.merge({\n \"categoryDescriptions\" => lambda {|n| @category_descriptions = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::PlannerCategoryDescriptions.create_from_discriminator_value(pn) }) },\n \"sharedWith\" => lambda {|n| @shared_with = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::PlannerUserIds.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"deviceId\" => lambda {|n| @device_id = n.get_string_value() },\n \"key\" => lambda {|n| @key = n.get_string_value() },\n \"volumeType\" => lambda {|n| @volume_type = n.get_enum_value(MicrosoftGraph::Models::VolumeType) },\n })\n end"
] |
[
"0.81593436",
"0.6921461",
"0.69098604",
"0.69098604",
"0.6891906",
"0.67368144",
"0.67271805",
"0.6653601",
"0.6595624",
"0.6521771",
"0.64532167",
"0.6426585",
"0.64094967",
"0.63534504",
"0.63534504",
"0.63127947",
"0.62968343",
"0.62768227",
"0.6275648",
"0.61798555",
"0.61786896",
"0.61359054",
"0.61239254",
"0.61216754",
"0.6116814",
"0.61004615",
"0.60939956",
"0.60601956",
"0.60545576",
"0.6035445",
"0.60290515",
"0.6028119",
"0.60233325",
"0.6022608",
"0.6004429",
"0.59976304",
"0.59706426",
"0.59456724",
"0.59432787",
"0.5941428",
"0.59082085",
"0.59035796",
"0.5901737",
"0.58959997",
"0.58894926",
"0.5879564",
"0.5877554",
"0.5876359",
"0.5875718",
"0.5866705",
"0.5866705",
"0.5865662",
"0.5855527",
"0.5840585",
"0.5833163",
"0.5827381",
"0.5825335",
"0.5821323",
"0.5819595",
"0.58065253",
"0.5797489",
"0.57946134",
"0.57931083",
"0.57906693",
"0.5781943",
"0.57782197",
"0.577732",
"0.57768655",
"0.5776221",
"0.5775378",
"0.576942",
"0.5762738",
"0.5761794",
"0.57498586",
"0.57281536",
"0.5722212",
"0.57208115",
"0.57189035",
"0.57149094",
"0.57117814",
"0.57094175",
"0.5704945",
"0.56994045",
"0.56891227",
"0.56877875",
"0.5684375",
"0.56782925",
"0.56755203",
"0.56734383",
"0.5672791",
"0.5670366",
"0.56696683",
"0.5666318",
"0.5659116",
"0.56589586",
"0.56571287",
"0.56536835",
"0.56465006",
"0.5634344",
"0.5623378"
] |
0.73142064
|
1
|
TODO rename to type for mt
|
def media_type(name)
name = normalize(name)
raise Restfulie::UnsupportedContentType.new("unsupported content type '#{name}'") if media_types[name].nil?
media_types[name].type
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def nonregular_type; end",
"def type() end",
"def type(type); end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def types; end",
"def types; end",
"def types; end",
"def types; end",
"def types; end",
"def types(types); end",
"def type=(_); end",
"def type=(_); end",
"def type=(_); end",
"def type=(_); end",
"def type=(_); end",
"def types=(_arg0); end",
"def type_params; end",
"def type_params; end",
"def type_params; end",
"def type_params; end",
"def type_params; end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def value_types=(_arg0); end",
"def subtype; end",
"def cast_types; end",
"def return_type; end"
] |
[
"0.69271946",
"0.67360437",
"0.669799",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.66325885",
"0.6622906",
"0.6622906",
"0.6622906",
"0.6622906",
"0.6622906",
"0.64387465",
"0.64115983",
"0.64115983",
"0.64115983",
"0.64115983",
"0.64115983",
"0.63928986",
"0.6332576",
"0.6332576",
"0.6332576",
"0.6332576",
"0.6332576",
"0.62822896",
"0.62822896",
"0.62822896",
"0.62822896",
"0.62822896",
"0.62822896",
"0.62822896",
"0.62822896",
"0.62822896",
"0.62822896",
"0.62822896",
"0.62822896",
"0.62822896",
"0.62297684",
"0.61298287",
"0.61159205",
"0.61133695"
] |
0.0
|
-1
|
TODO move to MediaTypeControl.custom_media_types
|
def medias_for(type)
found = {}
type.media_type_representations.each do |key|
found[key] = media_types[key]
end
found.values
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def media_type; end",
"def media_type; end",
"def media_types\n Restfulie::MediaType.default_types + MediaType.medias_for(self)\n end",
"def set_media_type\n media_types = self.class.head(@endpoint).headers['accept']\n Occi::Log.debug(\"Available media types: #{media_types}\")\n @media_type = case media_types\n when /application\\/occi\\+json/\n 'application/occi+json'\n else\n 'text/plain'\n end\n end",
"def media_type\r\ncontent_mime_type.to_s\r\nend",
"def media_type_representations\n custom_representations + Restfulie::MediaType.default_representations.dup\n end",
"def media_type_sym media\n case\n when (media =~ %r{^application/xml}) then :xml\n when (media =~ %r{^application/json}) then :json\n when (media =~ %r{^application/json-p}) then :json\n when (media =~ %r{^(application|text)/(x-)?javascript}) then :json\n when (media =~ %r{^(application|text)/(x-)?ecmascript}) then :json\n when (media =~ %r{^text/yaml}) then :yaml\n # when (media =~ %r{^text/tab-separated-values}) then :tsv\n # when (media =~ %r{^text/(comma-separated-values|csv)}) then :csv\n # when (media =~ %r{^text/html}) then :html\n else :json\n end\n end",
"def media_types=(value)\n @media_types = value\n end",
"def media_types\n return @media_types\n end",
"def status_unsupported_media_type\n respond_to do |format|\n format.any { head :unsupported_media_type }\n end\n end",
"def content_mime_type; end",
"def set_media(opts)\n opts = check_params(opts,[:media_types])\n super(opts)\n end",
"def mime_type; end",
"def mime_type; end",
"def mime_type; end",
"def mime_type; end",
"def mime_type(media_type: T.unsafe(nil)); end",
"def stringy_media_type\n request.content_mime_type.to_s\n end",
"def media_option\n super\n end",
"def accepted_mimes\n case self.type\n when'Recording'\n '.wav,.mp3'\n when 'Document'\n '.pdf'\n when 'Image'\n '.jpeg,.jpg,.gif,.bmp,.png'\n else\n ''\n end\n end",
"def mediatype\n media_type\n end",
"def media_type(name)\n name = normalize(name)\n raise Restfulie::UnsupportedContentType.new(\"unsupported content type '#{name}'\") if media_types[name].nil?\n media_types[name].type\n end",
"def media_format\n media_format = \"\"\n if media_type =~ /[\\/]/\n media_format = media_type.split(\"/\")[1]\n if \"x-www-form-urlencoded\" == media_format\n media_format = format # use regular format instead, we never want form data\n end\n end\n \n media_format\n end",
"def mime_type\n return content_type\nend",
"def set_content_type raw_type\n response_object.mime_raw raw_type\n end",
"def media_type(meta, file)\n tags = meta.inject(&:merge)\n tags.fetch 'MIMEType', Rack::Mime.mime_type(File.extname(file))\n end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def set_media_type\n @media_type = MediaType.find(params[:id])\n end",
"def accept_helper\n content_type = MediaType.parse(request.content_type || 'application/octet-stream')\n acceptable = resource.content_types_accepted.find {|ct, _| content_type.match?(ct) }\n if acceptable\n resource.send(acceptable.last)\n else\n 415\n end\n end",
"def media\n super\n end",
"def mime_type=(_); end",
"def set_default_media_type\n self.media_type = ::MIME::Types[self.content_type].first.try(:media_type) || 'file'\n end",
"def media_type\n @media_type || parse_and_return(:@media_type)\n end",
"def find_content_type_for_media_range(media_range)\n case media_range.to_s\n when '*/*'\n options[:default]\n when 'text/*'\n 'text/turtle'\n when 'application/*'\n 'application/ld+json'\n when 'application/json'\n 'application/ld+json'\n when 'application/xml'\n 'application/rdf+xml'\n when /^([^\\/]+)\\/\\*$/\n nil\n else\n media_range.to_s\n end\n end",
"def accepts(*types)\n mime_types = types.map{ |type| mime_type(CONTENT_TYPE_ALIASES[type] || type) }\n condition do\n halt 406 unless mime_types.include?(request.media_type)\n content_type(mime_symbol(request.media_type))\n end\n end",
"def accepted_media_element_sti_type\n case kind\n when COVER, IMAGE1, IMAGE2, IMAGE3, IMAGE4\n MediaElement::IMAGE_TYPE\n when VIDEO1, VIDEO2\n MediaElement::VIDEO_TYPE\n when AUDIO\n MediaElement::AUDIO_TYPE\n else\n ''\n end\n end",
"def media_status\n super\n end",
"def content_type_whitelist\n MIME_TYPE_WHITELIST\n end",
"def set_media_sfp(opts)\n opts = check_params(opts,[:media_types])\n super(opts)\n end",
"def content_type ctype=nil\n @content_type = ctype if ctype\n @content_type ||=\n \"#{self.class.media_type}/#{self.class.api_name}+#{@env['kiwi.format']}\"\n end",
"def mime_type=(_arg0); end",
"def mime_type=(_arg0); end",
"def mime_type=(_arg0); end",
"def media_types_params\n params.require(:media_type).permit(:name)\n end",
"def to_media_type(options)\n as_media_type(options).to_json\n end",
"def to_media_type(options)\n as_media_type(options).to_json\n end",
"def content_type=(content_type); end",
"def new\n @media_type = MediaType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @media_type }\n end\n end",
"def media_type(default = nil)\n if value = content_type\n value.split('/')[0]\n else\n if block_given?\n yield\n else\n default\n end\n end\n end",
"def set_media_fixed_or_sfp(opts)\n opts = check_params(opts,[:media_types])\n super(opts)\n end",
"def content_type\n @mime_type\n end",
"def content_type_whitelist\n /image\\//\n end",
"def media_type_params\n params.require(:media_type).permit(:name)\n end",
"def response_media_type(options={})\n options = {:halt_if_unacceptable => false}.merge(options)\n accept = env['HTTP_ACCEPT']\n if accept =~ /\\S/\n begin\n best_media_type = env['rack-accept.request'].best_media_type(supported_media_types)\n rescue RuntimeError => e\n # TODO: this is a crappy way to recognize this exception \n raise unless e.message =~ /Invalid header value/\n end\n if best_media_type\n best_media_type\n else\n if options[:halt_if_unacceptable]\n logger.error \"received Accept header of #{accept.inspect}; halting with 406\"\n message = I18n.t('app.errors.request.accept',\n :default => \"The request indicated that no supported media type is acceptable. Supported media types are: %{supported_media_types}. The request specified Accept: %{accept}\",\n :accept => accept,\n :supported_media_types => supported_media_types.join(', ')\n )\n halt_error(406, {'Accept' => [message]})\n else\n supported_media_types.first\n end\n end\n else\n supported_media_types.first\n end\n end",
"def mime\n self.class.mime(self)\n end",
"def type\n return unless media_type\n\n media_type.split('/').first\n end",
"def acceptable?(media_type)\n !matches(media_type).empty?\n end",
"def mediatype; end",
"def content_type\n end",
"def default_mime_type=(value); end",
"def media_option_sfp\n super\n end",
"def content_type_blacklist\n ['application/text', 'application/json']\n end",
"def mediatype\n\t\treturn \"%s/%s\" % [ self.type || '*', self.subtype || '*' ]\n\tend",
"def mime_type\n super || Mime::Type.lookup(DEFAULT_CONTENT_TYPE)\n end",
"def negotiate_mime(order); 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 index\n @admin_media_types = Admin::MediaType.all\n end",
"def content_type_allowlist\n Rails.configuration.x.file_upload_content_type_allowlist.split(/\\s*,\\s*/)\n end",
"def mime_type\n term = format_controlled_vocabulary.all.find { |x| x.definition == info_service.driver }\n term ? term.value : original_file.mime_type\n end",
"def wp_get_mime_types\n # Filters the list of mime types and file extensions.\n apply_filters(\n 'mime_types',\n {\n # Image formats.\n 'jpg|jpeg|jpe': 'image/jpeg',\n 'gif': 'image/gif',\n 'png': 'image/png',\n 'bmp': 'image/bmp',\n 'tiff|tif': 'image/tiff',\n 'ico': 'image/x-icon',\n # Video formats.\n 'asf|asx': 'video/x-ms-asf',\n 'wmv': 'video/x-ms-wmv',\n 'wmx': 'video/x-ms-wmx',\n 'wm': 'video/x-ms-wm',\n 'avi': 'video/avi',\n 'divx': 'video/divx',\n 'flv': 'video/x-flv',\n 'mov|qt': 'video/quicktime',\n 'mpeg|mpg|mpe': 'video/mpeg',\n 'mp4|m4v': 'video/mp4',\n 'ogv': 'video/ogg',\n 'webm': 'video/webm',\n 'mkv': 'video/x-matroska',\n '3gp|3gpp': 'video/3gpp', # Can also be audio\n '3g2|3gp2': 'video/3gpp2', # Can also be audio\n # Text formats.\n 'txt|asc|c|cc|h|srt': 'text/plain',\n 'csv': 'text/csv',\n 'tsv': 'text/tab-separated-values',\n 'ics': 'text/calendar',\n 'rtx': 'text/richtext',\n 'css': 'text/css',\n 'htm|html': 'text/html',\n 'vtt': 'text/vtt',\n 'dfxp': 'application/ttaf+xml',\n # Audio formats.\n 'mp3|m4a|m4b': 'audio/mpeg',\n 'aac': 'audio/aac',\n 'ra|ram': 'audio/x-realaudio',\n 'wav': 'audio/wav',\n 'ogg|oga': 'audio/ogg',\n 'flac': 'audio/flac',\n 'mid|midi': 'audio/midi',\n 'wma': 'audio/x-ms-wma',\n 'wax': 'audio/x-ms-wax',\n 'mka': 'audio/x-matroska',\n # Misc application formats.\n 'rtf': 'application/rtf',\n 'js': 'application/javascript',\n 'pdf': 'application/pdf',\n 'swf': 'application/x-shockwave-flash',\n 'class': 'application/java',\n 'tar': 'application/x-tar',\n 'zip': 'application/zip',\n 'gz|gzip': 'application/x-gzip',\n 'rar': 'application/rar',\n '7z': 'application/x-7z-compressed',\n 'exe': 'application/x-msdownload',\n 'psd': 'application/octet-stream',\n 'xcf': 'application/octet-stream',\n # MS Office formats.\n 'doc': 'application/msword',\n 'pot|pps|ppt': 'application/vnd.ms-powerpoint',\n 'wri': 'application/vnd.ms-write',\n 'xla|xls|xlt|xlw': 'application/vnd.ms-excel',\n 'mdb': 'application/vnd.ms-access',\n 'mpp': 'application/vnd.ms-project',\n 'docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n 'docm': 'application/vnd.ms-word.document.macroEnabled.12',\n 'dotx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',\n 'dotm': 'application/vnd.ms-word.template.macroEnabled.12',\n 'xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n 'xlsm': 'application/vnd.ms-excel.sheet.macroEnabled.12',\n 'xlsb': 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',\n 'xltx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',\n 'xltm': 'application/vnd.ms-excel.template.macroEnabled.12',\n 'xlam': 'application/vnd.ms-excel.addin.macroEnabled.12',\n 'pptx': 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n 'pptm': 'application/vnd.ms-powerpoint.presentation.macroEnabled.12',\n 'ppsx': 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',\n 'ppsm': 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12',\n 'potx': 'application/vnd.openxmlformats-officedocument.presentationml.template',\n 'potm': 'application/vnd.ms-powerpoint.template.macroEnabled.12',\n 'ppam': 'application/vnd.ms-powerpoint.addin.macroEnabled.12',\n 'sldx': 'application/vnd.openxmlformats-officedocument.presentationml.slide',\n 'sldm': 'application/vnd.ms-powerpoint.slide.macroEnabled.12',\n 'onetoc|onetoc2|onetmp|onepkg': 'application/onenote',\n 'oxps': 'application/oxps',\n 'xps': 'application/vnd.ms-xpsdocument',\n # OpenOffice formats.\n 'odt': 'application/vnd.oasis.opendocument.text',\n 'odp': 'application/vnd.oasis.opendocument.presentation',\n 'ods': 'application/vnd.oasis.opendocument.spreadsheet',\n 'odg': 'application/vnd.oasis.opendocument.graphics',\n 'odc': 'application/vnd.oasis.opendocument.chart',\n 'odb': 'application/vnd.oasis.opendocument.database',\n 'odf': 'application/vnd.oasis.opendocument.formula',\n # WordPerfect formats.\n 'wp|wpd': 'application/wordperfect',\n # iWork formats.\n 'key': 'application/vnd.apple.keynote',\n 'numbers': 'application/vnd.apple.numbers',\n 'pages': 'application/vnd.apple.pages',\n }\n )\n end",
"def get_accept_header(media_type)\n media_types = { hale: 'application/vnd.hale+json' }\n { 'Accept' => media_types[media_type] }\n end",
"def blacklist_mime_type_pattern; end",
"def mime_types\n config[:mime_types]\n end",
"def add_mime_type(key, transform_method, values, new_response_headers = {}) \n enforce!(key => Symbol, values => Array)\n ResponderMixin::TYPES.update(key => \n {:request_headers => values, \n :transform_method => transform_method,\n :response_headers => new_response_headers })\n\n Merb::RenderMixin.class_eval <<-EOS\n def render_#{key}(thing = nil, opts = {})\n content_type = :#{key}\n render thing, opts\n end\n EOS\n end",
"def content_type\n nil\n end",
"def specificity(m)\n if m[:media_type] == '*/*' then 0\n elsif m[:media_type] =~ %r{/\\*$} then 1\n else 2 + (m[:parameters] ? m[:parameters].count : 0)\n end\n end",
"def validate_response_format\n accept = request.headers[\"Accept\"]\n return :json if accept.include?(\"json\") || accept.include?(\"*/*\")\n raise IssuesController::UnsupportedMediaTypeError, \"Invalid Response Format #{accept} requested\"\n end",
"def mime_type(*args, **_arg1, &block); end",
"def singular_linked_media_type\n \"#{polymorphic_klass_name}_#{params[:media_name]}\".singularize\n end",
"def scoped_medium_types\n [primary_media.prepend('primary'), secondary_media.prepend('secondary'), component_media.prepend('component')]\n end",
"def media_sfp\n super\n end",
"def content_type(type, params={})\n type = Rack::File::MIME_TYPES[type.to_s] if type.kind_of?(Symbol)\n fail \"Invalid or undefined media_type: #{type}\" if type.nil?\n if params.any?\n params = params.collect { |kv| \"%s=%s\" % kv }.join(', ')\n type = [ type, params ].join(\";\")\n end\n response.header['Content-Type'] = type\n end",
"def validate_content_type( valid )\n raise Atom::HTTPException, \"HTTP response contains no Content-Type!\" if not self.content_type or self.content_type.empty?\n\n media_type = self.content_type.split(\";\").first\n\n unless valid.member? media_type.downcase\n raise Atom::WrongMimetype, \"unexpected response Content-Type: #{media_type.inspect}. should be one of: #{valid.inspect}\"\n end\n end",
"def create\n @media_type = MediaType.new(params[:media_type])\n\n respond_to do |format|\n if @media_type.save\n format.html { redirect_to @media_type, notice: 'Media type was successfully created.' }\n format.json { render json: @media_type, status: :created, location: @media_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @media_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def media_type\n hyper_schema_link.media_type\n end",
"def unsupported_media_type\n msg = \"Image format #{file_type} is not supported.\"\\\n \" Supported formats are: #{roda_class.supported_media_types}.\"\n halt [333, { 'Content-Type' => 'text/html' }, [msg]]\n end",
"def mime_types(type)\n mime_types = {\n yaml: \"application/x-yaml\",\n json: \"application/json\"\n }\n mime_types[type.to_sym]\n end",
"def content_type(ext)\n case ext\n when \"gif\": \"image/gif\"\n when \"jpg\": \"image/jpeg\"\n when \"png\": \"image/png\"\n else \"application/octet-stream\"\n end\nend",
"def validate_content_type!(response)\n return unless media_type\n\n response_content_type = response.content_type\n expected_content_type = Praxis::MediaTypeIdentifier.load(media_type.identifier)\n\n unless expected_content_type.match(response_content_type)\n raise Exceptions::Validation.new(\n \"Bad Content-Type header. #{response_content_type}\" +\n \" is incompatible with #{expected_content_type} as described in response: #{self.name}\"\n )\n end\n end",
"def content_type=(identifier)\n @content_type = nil\n headers['Content-Type'] = MediaTypeIdentifier.load(identifier).to_s\n end",
"def mime_type\n self.class.mime_type\n end",
"def set_Media(value)\n set_input(\"Media\", value)\n end",
"def set_Media(value)\n set_input(\"Media\", value)\n end",
"def set_Media(value)\n set_input(\"Media\", value)\n end"
] |
[
"0.7655368",
"0.7655368",
"0.74709594",
"0.74512",
"0.72484314",
"0.70772976",
"0.70754254",
"0.6980882",
"0.6922792",
"0.68780917",
"0.67966944",
"0.67823637",
"0.6747582",
"0.6747582",
"0.6747582",
"0.6747582",
"0.6690993",
"0.6676044",
"0.6638374",
"0.6605297",
"0.65976506",
"0.6586189",
"0.6561333",
"0.65598375",
"0.65543985",
"0.65493494",
"0.6519405",
"0.6519405",
"0.6519405",
"0.6519405",
"0.6519405",
"0.6519405",
"0.6519405",
"0.6519405",
"0.6494114",
"0.6479078",
"0.6475949",
"0.6457744",
"0.643933",
"0.64349806",
"0.64231294",
"0.64044565",
"0.6384651",
"0.6378398",
"0.63382226",
"0.63374656",
"0.6276418",
"0.6273321",
"0.6273321",
"0.6273321",
"0.6261575",
"0.6254753",
"0.6254753",
"0.6246159",
"0.6244718",
"0.62201864",
"0.6171329",
"0.61544704",
"0.61507267",
"0.61470115",
"0.6141249",
"0.6121706",
"0.6119815",
"0.6114673",
"0.6111873",
"0.61104834",
"0.61091095",
"0.6103383",
"0.6086507",
"0.6084606",
"0.6079153",
"0.60572827",
"0.60462874",
"0.5999328",
"0.598908",
"0.598339",
"0.59829575",
"0.5963779",
"0.5963174",
"0.5948245",
"0.593573",
"0.59300125",
"0.59230876",
"0.59207195",
"0.59189564",
"0.59187746",
"0.59184974",
"0.5916595",
"0.59014773",
"0.5901032",
"0.5892223",
"0.5886879",
"0.58821326",
"0.58806217",
"0.58783126",
"0.5851857",
"0.5843798",
"0.58389735",
"0.5838331",
"0.5838331",
"0.5838331"
] |
0.0
|
-1
|
Structure and Content assertions Fully assert db structure after full migration
|
def see_full_schema
assert_schema do |s|
s.table "activities" do |t|
t.column "id", :integer
t.column "actor_id", :integer
t.column "action", :string
t.column "created_at", :datetime
t.column "updated_at", :datetime
t.column "project_id", :integer
t.column "affected_id", :integer
t.column "affected_type", :string
end
s.table "comments" do |t|
t.column "id", :integer
t.column "content", :text
t.column "created_at", :datetime
t.column "updated_at", :datetime
t.column "commenter_id", :integer
t.column "commentable_id", :integer
t.column "commentable_type", :string
end
s.table "groups" do |t|
t.column "id", :integer
t.column "name", :string
t.column "created_at", :datetime
t.column "updated_at", :datetime
end
s.table "groups_privileges" do |t|
t.column "id", :integer
t.column "group_id", :integer
t.column "privilege_id", :integer
t.column "created_at", :datetime
t.column "updated_at", :datetime
end
s.table "invitations" do |t|
t.column "id", :integer
t.column "inviter_id", :integer
t.column "recipient", :string
t.column "project_id", :integer
t.column "code", :string
t.column "message", :string
t.column "created_at", :datetime
t.column "updated_at", :datetime
end
s.table "buckets" do |t|
t.column "id", :integer
t.column "start_date", :date
t.column "end_date", :date
t.column "project_id", :integer
t.column "name", :string
t.column "description", :text
t.column "budget", :integer
t.column "type", :string
t.column "created_at", :datetime
t.column "updated_at", :datetime
end
s.table "logged_exceptions" do |t|
t.column "id", :integer
t.column "exception_class", :string
t.column "controller_name", :string
t.column "action_name", :string
t.column "message", :text
t.column "backtrace", :text
t.column "environment", :text
t.column "request", :text
t.column "created_at", :datetime
end
s.table "priorities" do |t|
t.column "id", :integer
t.column "name", :string
t.column "color", :string
t.column "position", :integer
t.column "created_at", :datetime
t.column "updated_at", :datetime
end
s.table "privileges" do |t|
t.column "id", :integer
t.column "name", :string
t.column "created_at", :datetime
t.column "updated_at", :datetime
end
s.table "project_permissions" do |t|
t.column "id", :integer
t.column "project_id", :integer
t.column "accessor_id", :integer
t.column "accessor_type", :string
t.column "created_at", :datetime
t.column "updated_at", :datetime
end
s.table "projects" do |t|
t.column "id", :integer
t.column "name", :string
t.column "iteration_length", :string
t.column "created_at", :datetime
t.column "updated_at", :datetime
end
s.table "statuses" do |t|
t.column "id", :integer
t.column "name", :string
t.column "color", :string
t.column "created_at", :datetime
t.column "updated_at", :datetime
end
s.table "stories" do |t|
t.column "id", :integer
t.column "summary", :string
t.column "description", :text
t.column "points", :integer
t.column "position", :integer
t.column "bucket_id", :integer
t.column "project_id", :integer
t.column "responsible_party_id", :integer
t.column "responsible_party_type", :string
t.column "status_id", :integer
t.column "priority_id", :integer
t.column "created_at", :datetime
t.column "completed_at", :datetime
t.column "updated_at", :datetime
end
s.table "taggings" do |t|
t.column "id", :integer
t.column "tag_id", :integer
t.column "taggable_id", :integer
t.column "taggable_type", :string
end
s.table "tags" do |t|
t.column "id", :integer
t.column "name", :string
end
s.table "time_entries" do |t|
t.column "id", :integer
t.column "hours", :decimal
t.column "comment", :string
t.column "date", :date
t.column "project_id", :integer
t.column "timeable_id", :integer
t.column "timeable_type", :string
t.column "created_at", :datetime
t.column "updated_at", :datetime
end
s.table :user_reminders do |t|
t.column :id, :integer
t.column :user_id, :integer
t.column :token, :string
t.column :expires_at, :datetime
end
s.table "users" do |t|
t.column "id", :integer
t.column "password_hash", :string
t.column "first_name", :string
t.column "last_name", :string
t.column "email_address", :string
t.column "group_id", :integer
t.column "active", :boolean
t.column "created_at", :datetime
t.column "updated_at", :datetime
t.column "salt", :string
t.column "remember_me_token", :string
t.column "remember_me_token_expires_at", :datetime
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def assert_content_model\n add_relationship(:has_model, \"info:fedora/hull-cModel:examPaper\")\n add_relationship(:has_model, \"info:fedora/hydra-cModel:compoundContent\")\n add_relationship(:has_model, \"info:fedora/hydra-cModel:commonMetadata\")\n end",
"def assert_content_model\n add_relationship(:has_model, \"info:fedora/hull-cModel:bookChapter\") \n add_relationship(:has_model, \"info:fedora/hydra-cModel:compoundContent\")\n add_relationship(:has_model, \"info:fedora/hydra-cModel:commonMetadata\") \n end",
"def simpletest_tests(bs)\n #check to see if our internal description is correct.\n assert_equal [:simpletest], bs.tables.keys\n assert_equal [:id, :test], bs.tables[:simpletest].columns.keys\n #check to see if our database description is correct\n bs.connect do |db|\n assert_equal [:simpletest], db.tables\n assert_equal [:id, :test], db[:simpletest].columns\n end\n end",
"def assert_content_model\n g = Genre.find(descMetadata.genre.first)\n add_relationship(:has_model, \"info:fedora/#{g.c_model}\")\n add_relationship(:has_model, \"info:fedora/hydra-cModel:compoundContent\")\n add_relationship(:has_model, \"info:fedora/hydra-cModel:commonMetadata\")\n end",
"def test_assert_reading_fields_populated\n edgar_huntley = Reading.new(order_number: 5, lesson_id: 1, url: \"http://www.food.com\")\n assert edgar_huntley.save\n end",
"def test_for_empty_DB\n\t\tputs \"TEST 1\"\n\t\tassert( @db.empty? , \"DB is not empty\")\n\tend",
"def test_adding_pigs_to_the_farm_with_t_dot_references_farm_foreign_key_true\n premigrate\n table = \"pigs\"\n migrate table\n assert_match(/FOREIGN KEY \\(\\\"farm_id\\\"\\) REFERENCES \\\"farms\\\"\\(id\\)/, schema(table))\n end",
"def assert_generated_table(body, name)\n assert_match /create_table :#{name.to_s} do/, body, \"should have table #{name.to_s} defined\"\n end",
"def test_content\n assert_respond_to(@table, :content)\n assert_respond_to(@table, :content=)\n assert_nothing_raised{ @table.content = 'foo' }\n assert_nothing_raised{ @table.content = 123 }\n assert_nothing_raised{ @table.content = ['one',2,'three'] }\n assert_nothing_raised{ @table.content = [['foo','bar'],[1,2,3]] }\n assert_nothing_raised{ @table.content = Table::Row.new }\n assert_nothing_raised{ @table.content = Table::Row::Data.new }\n assert_nothing_raised{ @table.content = Table::Row::Header.new }\n assert_nothing_raised{ @table.content = Table::Head.create }\n assert_nothing_raised{ @table.content = Table::Foot.create }\n assert_nothing_raised{ @table.content = Table::Body.new }\n end",
"def test_load\n content = Agoo::GraphQL.sdl_dump(with_descriptions: false, all: false)\n content.force_encoding('UTF-8')\n assert_equal(SCHEMA_EXPECT, content)\n end",
"def setup_db\n #Supress annoying Schema creation output when tests run\n old_stdout = $stdout\n $stdout = StringIO.new\n \n ActiveRecord::Schema.define(:version => 1) do\n create_table :people do |t|\n t.column :username, :string\n t.column :hair_color, :string\n end\n \n create_table :coffee_mugs do |t|\n t.column :person_id, :integer\n end\n \n create_table :roles do |t|\n t.column :name, :string\n end\n \n create_table :people_roles do |t|\n t.column :role_id, :integer\n t.column :person_id, :integer\n end\n \n create_table :notebooks do |t|\n t.column :title, :string\n t.column :owner_id, :integer\n t.column :ghost_writer_id, :integer\n end\n \n create_table :update_permissions do |t|\n t.column :updater_id, :integer\n t.column :notebook_id, :integer\n end\n \n create_table :pages do |t|\n t.column :number, :integer\n t.column :notebook_id, :integer\n end\n \n create_table :margin_notes do |t|\n t.column :content, :string\n t.column :page_id, :integer\n end\n \n create_table :coffee_stains do |t|\n t.column :opacity, :integer\n t.column :page_id, :integer\n end\n \n create_table :words do |t|\n t.column :text, :string\n t.column :page_id, :integer\n end\n end\n \n #Re-enable stdout\n $stdout = old_stdout\nend",
"def test_adding_sheep_to_the_farm_with_t_dot_foreign_key_farm_column_id_shearing_farm_id\n premigrate\n table = \"sheep\"\n migrate table\n assert_match(/FOREIGN KEY \\(\\\"shearing_farm_id\\\"\\) REFERENCES \\\"farms\\\"\\(id\\)/, schema(table))\n end",
"def test_article_all\n assert_query(Article.all, :Article, :all)\n end",
"def test_basic_account_migration_step1\n post :migrate, {:old_c2w_user_id => old_c2w_users(:jim).email, :password => old_c2w_users(:jim).password}\n assert assigns['old_c2w_user']\n assert_equal old_c2w_users(:jim).password, assigns['old_c2w_user'].password\n assert !assigns['old_c2w_user'].migrated?\n assert User.find_by_email(assigns['old_c2w_user'].email).nil? #there should be no other user with same email for this test\n assert assigns['user']\n assert_equal old_c2w_users(:jim).userid, assigns['user'].username\n assert_equal old_c2w_users(:jim).email, assigns['user'].email\n assert_equal old_c2w_users(:jim).first_name, assigns['user'].first_name\n assert_equal old_c2w_users(:jim).last_name, assigns['user'].last_name\n assert_equal old_c2w_users(:jim).date_of_birth, assigns['user'].date_of_birth\n assert_equal old_c2w_users(:jim).mobile_number, assigns['user'].mobile_number\n assert_equal old_c2w_users(:jim).contact_number, assigns['user'].phone_number\n assert_equal old_c2w_users(:jim).address, assigns['user'].address_line_1\n assert_equal old_c2w_users(:jim).city, assigns['user'].city\n assert_equal old_c2w_users(:jim).state, assigns['user'].state\n assert_equal old_c2w_users(:jim).country, assigns['user'].country\n assert_equal 'Male', assigns['user'].gender\n end",
"def check_for_structure_changes!\n watched_fields = db.query(\"DESC #{watched}\").to_a\n audit_fields = db.query(\"DESC #{audit}\").to_a\n delta = watched_fields - audit_fields\n delta = [delta, (audit_fields - watched_fields).reject { |i| METADATA_FIELDS.include?(i['Field']) }].flatten\n metadata_present = METADATA_FIELDS.all? { |f| (audit_fields - watched_fields).map { |i| i['Field'] }.include?(f) }\n\n if !delta.empty?\n raise \"Structure has changed for table '#{name}'!\"\n elsif !metadata_present\n missing_fields = METADATA_FIELDS - (audit_fields - watched_fields).map { |i| i['Field'] }\n raise \"Missing meta-data fields in audit table '#{name}' : #{missing_fields.join(', ')}.\"\n else\n logger.info \"Audit table #{name} is up to date.\"\n end\n end",
"def assertions; end",
"def assertions; end",
"def test_communication_without_organisation_or_people\n communication = create_communication\n assert !communication.save\n puts \n end",
"def assert_basic_fields_exist_in_dumped_state(dumped_state)\n refute dumped_state.nil?\n refute dumped_state[\"GhostferryVersion\"].nil?\n refute dumped_state[\"LastKnownTableSchemaCache\"].nil?\n refute dumped_state[\"LastSuccessfulPaginationKeys\"].nil?\n refute dumped_state[\"CompletedTables\"].nil?\n refute dumped_state[\"LastWrittenBinlogPosition\"].nil?\n end",
"def test_adding_elephants_to_the_farm_with_t_dot_foreign_key_farm_dependent_delete\n premigrate\n table = \"elephants\"\n migrate table\n assert_match(/FOREIGN KEY \\(\\\"farm_id\\\"\\) REFERENCES \\\"farms\\\"\\(id\\) ON DELETE CASCADE/, schema(table))\n end",
"def verify(db)\n known_good_schema = File.read(File.expand_path(File.join(__FILE__, \"../../config/known_good_schema.yml\")))\n known_good_schema = YAML.load(known_good_schema)\n schema = calculate_schema(db)\n\n db.tables.each do |table|\n # Sorting by column name because we allow column order to be different.\n # (SELECT statement solves this ordering by querying in destination order).\n if schema[table].map(&:first).sort != known_good_schema[table].map(&:first).sort\n puts \"Table #{table} has a different schema\"\n puts \"Want: #{known_good_schema[table].sort_by(&:first).inspect}\"\n puts \"Have: #{schema[table].sort_by(&:first).inspect}\"\n raise \"InvalidSchema\"\n end\n end\n\n true\n end",
"def test_basedata\n assert_not_nil(Cardiotype.find(:first, :conditions => [\"description = ?\", \"Run\"]))\n assert_not_nil(Cardiotype.find(:first, :conditions => [\"description = ?\", \"Swim\"]))\n assert_not_nil(Cardiotype.find(:first, :conditions => [\"description = ?\", \"Cycle\"]))\n end",
"def test_content\n pers = Person::new(\"John\", \"Doe\")\n @root.content = pers\n assert_same(pers, @root.content, \"Content should be the same\")\n end",
"def career_migration_data\n<<RUBY\nt.string :title\n t.string :position\n t.string :location\n t.text :description\n t.text :questions\n t.boolean :status,default: true\n\nRUBY\n end",
"def test_01_fresh_basquet_is_empty\n muffinland_fresh_DB.should == \"New basquet w 0 items.\"\n end",
"def test_entire_table\n $BS = Basie.new :name => \"testdb\"\n $BS.enable_full_access\n\n create :simpletest\n assert_equal [{:id=>1, :test=>\"one\"},{:id=>2, :test=>\"two\"},{:id=>3, :test=>\"two\"}],\n $BS.tables[:simpletest].entire_table(:override_security => true)\n end",
"def test_putrelation_create_valid\n changeset = create(:changeset)\n user = changeset.user\n cs_id = changeset.id\n\n node = create(:node)\n way = create(:way_with_nodes, :nodes_count => 2)\n relation = create(:relation)\n\n amf_content \"putrelation\", \"/1\", [\"#{user.email}:test\", cs_id, 0, -1, { \"test\" => \"new\" }, [[\"Node\", node.id, \"node\"], [\"Way\", way.id, \"way\"], [\"Relation\", relation.id, \"relation\"]], true]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n new_relation_id = result[3].to_i\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal -1, result[2]\n assert_not_equal -1, result[3]\n assert_equal 1, result[4]\n\n new_relation = Relation.find(new_relation_id)\n assert_equal 1, new_relation.version\n assert_equal [[\"Node\", node.id, \"node\"], [\"Way\", way.id, \"way\"], [\"Relation\", relation.id, \"relation\"]], new_relation.members\n assert_equal({ \"test\" => \"new\" }, new_relation.tags)\n assert_equal true, new_relation.visible\n end",
"def test_data_integrity(table='test_ruby', data=[\"Gabriele\", \"MODENA\"])\n test_create_table\n \n values = \"\"\n data.each do |d| values += '\\'' + d.to_s + '\\'' + ',' end\n values = values.chop # remove last ',' character\n \n insert = 'INSERT INTO ' + table + ' VALUES (' + values + ' )' \n \n @db.query(insert)\n \n res = @db.query(\"SELECT * FROM #{table}\")\n rows = res.fetch_all\n \n assert_equal(res.num_rows, rows.size)\n end",
"def test_adding_bears_to_the_farm_with_t_dot_foreign_key_farm_dependent_nullify\n premigrate\n table = \"bears\"\n migrate table\n assert_match(/FOREIGN KEY \\(\\\"farm_id\\\"\\) REFERENCES \\\"farms\\\"\\(id\\) ON DELETE SET NULL/, schema(table))\n end",
"def assert_content_model\n add_relationship(:has_model, \"info:fedora/hydra-cModel:genericParent\")\n super\n end",
"def assert_changes_saved\n assert_text \"All changes saved.\"\n end",
"def test_some_invalid_columns\n process :nasty_columns_1\n assert_response :success\n\n assert_deprecated_assertion { assert_invalid_record 'company' }\n assert_deprecated_assertion { assert_invalid_column_on_record 'company', 'rating' }\n assert_deprecated_assertion { assert_valid_column_on_record 'company', 'name' }\n assert_deprecated_assertion { assert_valid_column_on_record 'company', %w(name id) }\n end",
"def test_all\n Post.create(:title => \"11222\")\n Post.create(:title => \"112ssd22\")\n posts = Post.all\n assert posts.is_a?(Array)\n assert posts[0].is_a?(Post)\n end",
"def extract_db_content(version)\n # Only compare tables with meaningful data. Tables\n # containing temporary state, e.g., db_mutex, are not relevant here.\n # TODO: re-add other tables to check.\n include_tables = %w[master_accounts accounts positions partners partner_users]\n\n client = startup\n\n # db_columns is a temporary structure - it holds all columns for db, by table.\n # It will be merged with rows into a single data structure to facilitate\n # comparison between the 2 DBs.\n db_columns = build_columns_hash(client)\n\n # build the structure which will be used for table comparisons.\n db_columns_and_rows = build_columns_and_rows_hash(db_columns, client, include_tables)\n\n store = initialize_store('mg_db.' + version)\n persist_data(db_columns_and_rows, store)\nend",
"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 test_DB_initialization\n @fdb = setup\n assert(@fdb.size > 0, \"Database entries not correctly read in\")\n end",
"def test_readings_must_have_order_number_lesson_id_and_url\n reading = Reading.new(order_number: 1234, lesson_id: 223, url: \"http://www.google.com\")\n reading_two = Reading.new(caption: \"Back to Basics\", url: \"http://stopfailingatmaths.com\", order_number: 1)\n reading_three = Reading.new()\n\n assert reading.save\n refute reading_two.save\n refute reading_three.save\n end",
"def test_friendly_fields_false\n while_logged_in do\n with_queries do\n assert_block do\n entities = @conn.tasks(query:@small_query,nice_keys:false)[:entities]\n entities.first.keys.include? \"creation-time\"\n end\n end\n end\n end",
"def ensure_migrated\n return if blob\n\n content_upload(fetcher.html_file)\n end",
"def test_putpoi_create_valid\n # This node has no tags\n\n # create a node with random lat/lon\n lat = rand(-50..49) + rand\n lon = rand(-50..49) + rand\n\n changeset = create(:changeset)\n user = changeset.user\n\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", changeset.id, nil, nil, lon, lat, {}, nil]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n # check the array returned by the amf\n assert_equal 5, result.size\n assert_equal 0, result[0], \"expected to get the status ok from the amf\"\n assert_equal 0, result[2], \"The old id should be 0\"\n assert result[3] > 0, \"The new id should be greater than 0\"\n assert_equal 1, result[4], \"The new version should be 1\"\n\n # Finally check that the node that was saved has saved the data correctly\n # in both the current and history tables\n # First check the current table\n current_node = Node.find(result[3].to_i)\n assert_in_delta lat, current_node.lat, 0.00001, \"The latitude was not retreieved correctly\"\n assert_in_delta lon, current_node.lon, 0.00001, \"The longitude was not retreived correctly\"\n assert_equal 0, current_node.tags.size, \"There seems to be a tag that has been added to the node\"\n assert_equal result[4], current_node.version, \"The version returned, is different to the one returned by the amf\"\n # Now check the history table\n historic_nodes = OldNode.where(:node_id => result[3])\n assert_equal 1, historic_nodes.size, \"There should only be one historic node created\"\n first_historic_node = historic_nodes.first\n assert_in_delta lat, first_historic_node.lat, 0.00001, \"The latitude was not retreived correctly\"\n assert_in_delta lon, first_historic_node.lon, 0.00001, \"The longitude was not retreuved correctly\"\n assert_equal 0, first_historic_node.tags.size, \"There seems to be a tag that have been attached to this node\"\n assert_equal result[4], first_historic_node.version, \"The version returned, is different to the one returned by the amf\"\n\n ####\n # This node has some tags\n\n # create a node with random lat/lon\n lat = rand(-50..49) + rand\n lon = rand(-50..49) + rand\n\n amf_content \"putpoi\", \"/2\", [\"#{user.email}:test\", changeset.id, nil, nil, lon, lat, { \"key\" => \"value\", \"ping\" => \"pong\" }, nil]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/2\")\n\n # check the array returned by the amf\n assert_equal 5, result.size\n assert_equal 0, result[0], \"Expected to get the status ok in the amf\"\n assert_equal 0, result[2], \"The old id should be 0\"\n assert result[3] > 0, \"The new id should be greater than 0\"\n assert_equal 1, result[4], \"The new version should be 1\"\n\n # Finally check that the node that was saved has saved the data correctly\n # in both the current and history tables\n # First check the current table\n current_node = Node.find(result[3].to_i)\n assert_in_delta lat, current_node.lat, 0.00001, \"The latitude was not retreieved correctly\"\n assert_in_delta lon, current_node.lon, 0.00001, \"The longitude was not retreived correctly\"\n assert_equal 2, current_node.tags.size, \"There seems to be a tag that has been added to the node\"\n assert_equal({ \"key\" => \"value\", \"ping\" => \"pong\" }, current_node.tags, \"tags are different\")\n assert_equal result[4], current_node.version, \"The version returned, is different to the one returned by the amf\"\n # Now check the history table\n historic_nodes = OldNode.where(:node_id => result[3])\n assert_equal 1, historic_nodes.size, \"There should only be one historic node created\"\n first_historic_node = historic_nodes.first\n assert_in_delta lat, first_historic_node.lat, 0.00001, \"The latitude was not retreived correctly\"\n assert_in_delta lon, first_historic_node.lon, 0.00001, \"The longitude was not retreuved correctly\"\n assert_equal 2, first_historic_node.tags.size, \"There seems to be a tag that have been attached to this node\"\n assert_equal({ \"key\" => \"value\", \"ping\" => \"pong\" }, first_historic_node.tags, \"tags are different\")\n assert_equal result[4], first_historic_node.version, \"The version returned, is different to the one returned by the amf\"\n end",
"def test_putrelation_update_valid\n relation = create(:relation)\n create(:relation_member, :relation => relation)\n user = relation.changeset.user\n cs_id = relation.changeset.id\n\n assert_not_equal({ \"test\" => \"ok\" }, relation.tags)\n amf_content \"putrelation\", \"/1\", [\"#{user.email}:test\", cs_id, relation.version, relation.id, { \"test\" => \"ok\" }, relation.members, true]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal relation.id, result[2]\n assert_equal relation.id, result[3]\n assert_equal relation.version + 1, result[4]\n\n new_relation = Relation.find(relation.id)\n assert_equal relation.version + 1, new_relation.version\n assert_equal relation.members, new_relation.members\n assert_equal({ \"test\" => \"ok\" }, new_relation.tags)\n assert_equal true, new_relation.visible\n end",
"def test_friendly_fields_true\n while_logged_in do\n with_queries do\n assert_block do\n entities = @conn.tasks(query:@small_query,nice_keys:true)[:entities]\n entities.first.keys.include? \"Created By\"\n end\n end\n end\n end",
"def test_putrelation_delete_valid\n relation = create(:relation)\n create(:relation_member, :relation => relation)\n create(:relation_tag, :relation => relation)\n cs_id = relation.changeset.id\n user = relation.changeset.user\n\n amf_content \"putrelation\", \"/1\", [\"#{user.email}:test\", cs_id, relation.version, relation.id, relation.tags, relation.members, false]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal relation.id, result[2]\n assert_equal relation.id, result[3]\n assert_equal relation.version + 1, result[4]\n\n new_relation = Relation.find(relation.id)\n assert_equal relation.version + 1, new_relation.version\n assert_equal [], new_relation.members\n assert_equal({}, new_relation.tags)\n assert_equal false, new_relation.visible\n end",
"def test_attributes\n assert_equal \"Gallery 1\", @gallery.title\n assert @gallery.active?\n assert_equal \"f82dd0bd-4711-4578-ac47-4661257e69a6\", @gallery.guid\n end",
"def test_add_1_recipe\n\t\tputs \"TEST 4\"\n\t\tassert( @db.empty?, \"DB should be empty\" )\n\t\t@db.addRecipe(\"Cookies\", [\"Flour\", \"BakingSoda\"] )\n\t\tassert( @db.empty?, \"DB should still be empty after adding recipe with non existing foods\" )\n\t\t@db.addFood(\"Flour\", \"84\" )\n\t\t@db.addFood(\"BakingSoda\", \"123\" )\n\t\tassert( @db.size == 2, \"there should be 2 foods,ready for recipe\" )\n\t\t@db.addRecipe(\"Cookies\", [\"Flour\", \"BakingSoda\"] )\n\t\tassert( @db.size == 3, \"With recipe, size should == 3\" )\n\t\tassert( @db.is_Recipe?(\"Cookies\") , \"Cookies should be a recipe\" )\n\tend",
"def test_ut_t2_ars_ard_007\n ars_detail = AnalyzeRuleConfigDetail.find(:first)\n new_ars_detail = AnalyzeRuleConfigDetail.create()\n new_ars_detail.copy(ars_detail)\n #new_ars_detail.save\n assert_equal ars_detail.analyze_tool_id ,new_ars_detail.analyze_tool_id\n assert_equal ars_detail.rule_level, new_ars_detail.rule_level\n assert_equal ars_detail.rule_numbers, new_ars_detail.rule_numbers\n end",
"def test_yaml_loads_5_1_dump\n body = File.open(schema_dump_path).read\n cache = YAML.unsafe_load(body)\n\n assert_no_queries do\n assert_equal 11, cache.columns(\"posts\").size\n assert_equal 11, cache.columns_hash(\"posts\").size\n assert cache.data_sources(\"posts\")\n assert_equal \"id\", cache.primary_keys(\"posts\")\n end\n end",
"def test_all_templates\n assert_instance_of(Array, @db.all_templates)\n end",
"def test_associations\n\t\tassert check_associations(DocImage)\n\tend",
"def data_complextest(db); end",
"def test_insert_check\n\n section_01_1 = sections(:section_01_1)\n subsection_01_1_1 = subsections(:subsection_01_1_1)\n \n admin_session = cathy_admin_session\n checklist = Checklist.find(subsection_01_1_1.checklist.id)\n assert_equal(6, checklist.designer_only_count)\n assert_equal(5, checklist.designer_auditor_count)\n assert_equal(0, checklist.dc_designer_only_count)\n assert_equal(3, checklist.dc_designer_auditor_count)\n assert_equal(0, checklist.dr_designer_only_count)\n assert_equal(3, checklist.dr_designer_auditor_count)\n\n new_check = { 'date_code_check' => '1',\n 'full_review' => '1',\n 'title' => 'First New Check',\n 'dot_rev_check' => '1',\n 'url' => '',\n 'check' => 'new check',\n 'check_type' => 'designer_auditor' }\n\n check = { 'id' => checks(:check_01).id }\n assert_equal(3, subsection_01_1_1.checks.size)\n\n post(:insert_check, { :new_check => new_check, :check => check }, admin_session)\n assert_equal('Inserted check successfully.', flash['notice'])\n assert_redirected_to(:id => subsection_01_1_1.id, :action => 'modify_checks')\n\n subsection_01_1_1.reload\n assert_equal(4, subsection_01_1_1.checks.size)\n \n checks = subsection_01_1_1.checks\n assert_equal('First New Check', checks[0].title)\n assert_equal(checks(:check_01).id, checks[1].id)\n assert_equal(checks(:check_02).id, checks[2].id)\n assert_equal(checks(:check_03).id, checks[3].id)\n\n checklist = subsection_01_1_1.section.checklist\n assert_equal(6, checklist.designer_only_count)\n assert_equal(6, checklist.designer_auditor_count)\n assert_equal(0, checklist.dc_designer_only_count)\n assert_equal(4, checklist.dc_designer_auditor_count)\n assert_equal(0, checklist.dr_designer_only_count)\n assert_equal(4, checklist.dr_designer_auditor_count)\n\n\n new_check = { 'date_code_check' => '1',\n 'full_review' => '1',\n 'title' => 'New Check',\n 'dot_rev_check' => '0',\n 'url' => '',\n 'check' => 'text',\n 'check_type' => 'designer_only' }\n check = { 'id' => checks(:check_06).id }\n\n subsection_01_1_2 = subsections(:subsection_01_1_2)\n assert_equal(3, subsection_01_1_2.checks.size)\n\n put(:insert_check, { :new_check => new_check, :check => check }, admin_session)\n subsection_01_1_2.reload\n assert_equal(4, subsection_01_1_2.checks.size)\n\n checks = subsection_01_1_2.checks\n assert_equal(checks(:check_04).id, checks[0][:id])\n assert_equal(checks(:check_05).id, checks[1][:id])\n assert_equal('New Check', checks[2][:title])\n assert_equal(checks(:check_06).id, checks[3][:id])\n\n checklist = Checklist.find(subsection_01_1_2.checklist.id)\n assert_equal(7, checklist.designer_only_count)\n assert_equal(6, checklist.designer_auditor_count)\n assert_equal(1, checklist.dc_designer_only_count)\n assert_equal(4, checklist.dc_designer_auditor_count)\n assert_equal(0, checklist.dr_designer_only_count)\n assert_equal(4, checklist.dr_designer_auditor_count)\n\n\n new_check = { 'date_code_check' => '1',\n 'full_review' => '1',\n 'title' => 'Second New Check in subsect 2',\n 'dot_rev_check' => '1',\n 'url' => '',\n 'check' => 'text',\n 'check_type' => 'designer_only' }\n check = { 'id' => checks(:check_04).id }\n\n put(:insert_check, { :new_check => new_check, :check => check}, admin_session)\n subsection_01_1_2.reload\n checks = subsection_01_1_2.checks\n assert_equal(5, checks.size)\n\n 0.upto(checks.size-1) { |x| assert_equal((x+1), checks[x][:position]) }\n\n assert_equal('Second New Check in subsect 2',\n\t\t checks[0][:title])\n assert_equal(checks(:check_04).id, checks[1][:id])\n assert_equal(checks(:check_05).id, checks[2][:id])\n assert_equal('New Check', checks[3][:title])\n assert_equal(checks(:check_06).id, checks[4][:id])\n\n checklist = Checklist.find(subsection_01_1_2.checklist.id)\n assert_equal(8, checklist.designer_only_count)\n assert_equal(6, checklist.designer_auditor_count)\n assert_equal(2, checklist.dc_designer_only_count)\n assert_equal(4, checklist.dc_designer_auditor_count)\n assert_equal(1, checklist.dr_designer_only_count)\n assert_equal(4, checklist.dr_designer_auditor_count)\n\n end",
"def test_1_relationship_attributes\n skip # remove this line when you want to work on this test\n assert_equal(\"father\", @father_relationship.kind)\n assert_equal(@father_bug, @father_relationship.bug1)\n assert_equal(@child_bug, @father_relationship.bug2)\n end",
"def create\n begin\n puts \"Creating...\"\n ActiveRecord::Schema.define do\n #create_table :test_relations do |table|\n # table.column :test_case_id, :integer\n # table.column :test_collection_id, :integer\n #end\n create_table :defaults do |table|\n table.column :configuration_id, :integer\n end\n\n\n # Project configuration\n create_table :configurations do |table|\n table.column :name, :string\n table.column :server, :string\n table.column :devkey, :string\n table.column :smtp_host, :string\n table.column :smtp_recipient, :string\n table.column :project, :string # aka prefix\n table.column :vm_user, :string\n table.column :vm_password, :string\n table.column :ssh_key_path, :string\n table.column :ssh_key_pw, :string\n table.column :base_path, :string\n table.column :output_path, :string\n table.column :public_options, :string\n end\n\n\n # A test collection is a collection of test, defined by project, testplan and build\n create_table :test_collections do |table|\n table.column :project, :string\n table.column :project_id, :string\n table.column :plan, :string\n table.column :plan_id, :string\n #table.column :build, :string\n #table.column :testrun_id, :string\n #table.column :test_cases, :string\n end\n\n create_table :test_cases do |table|\n table.column :urgency, :string\n table.column :name, :string\n table.column :file, :string\n table.column :external_id, :string\n table.column :platform_id, :string\n table.column :test_collection_id, :string\n\n end\n\n end\n\n rescue ActiveRecord::StatementInvalid\n # Table already created\n puts \"Setup already done. Destroy tables first before creating\"\n end\n\n\n end",
"def test_all_invalid_columns\n process :nasty_columns_2\n assert_response :success\n\n assert_deprecated_assertion { assert_invalid_record 'company' }\n assert_deprecated_assertion { assert_invalid_column_on_record 'company', 'rating' }\n assert_deprecated_assertion { assert_invalid_column_on_record 'company', 'name' }\n assert_deprecated_assertion { assert_invalid_column_on_record 'company', %w(name rating) }\n end",
"def test_10a\r\n db = build\r\n assert_equal [],db.groups\r\n end",
"def test_add_1food\n\t\tputs \"TEST 2\"\n\t\tassert( @db.empty?, \"DB should be empty\" )\n\t\t@db.addFood(\"Potato\", \"123\")\n\t\tassert( @db.size == 1, \"Size of DB != 1\")\n\t\tassert( !@db.empty?, \"DB should not be empty\")\n\tend",
"def test_example_body\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n link = schema.resource('resource').link('create')\n assert_equal({'date_field' => '2013-10-19 22:10:29Z',\n 'string_field' => 'Sample text.',\n 'boolean_field' => true,\n 'uuid_field' => '44724831-bf66-4bc2-865f-e2c4c2b14c78',\n 'email_field' => 'username@example.com'},\n link.example_body)\n end",
"def test_history_equals_versions\n way = create(:way, :with_history)\n used_way = create(:way, :with_history)\n create(:relation_member, :member => used_way)\n way_with_versions = create(:way, :with_history, :version => 4)\n\n check_history_equals_versions(way.id)\n check_history_equals_versions(used_way.id)\n check_history_equals_versions(way_with_versions.id)\n end",
"def test_flatten_model\r\n assert_equal( { \"ident\"=>1, \"name\"=>\"rubylicious\", \"commentary\"=>\"\", \"description\"=>\"\"},\r\n @mymodel.flatten_data)\r\n end",
"def test_insert_pending_details_for_migration\r\n @mm.set_pending(@config, @connection)\r\n assert_equal('Pending', get_state(@mm))\r\n end",
"def test_add_to_wishlist #test pass\n wishlist = Wishlist.new(\"name\" => \"testlist\")\n wishlist.insert(\"wishlists\")\n wishlist.add_to_wishlist(1)\n check = DATABASE.execute(\"SELECT * FROM characters_to_wishlists WHERE\n character_id=1 AND wishlist_id=#{wishlist.id}\")\n refute_equal([], check)\n end",
"def test_lesson_must_have_names\n lesson = Lesson.new(name:\"Algebra Basics\", description: \"Basic intro into the wonderful world of Algebra\", outline: \"See math, do math\")\n lesson_two = Lesson.new(description: \"Lorem ipsum\")\n\n assert lesson.save\n refute lesson_two.save\n end",
"def test_06a\r\n db = build\r\n assert_equal 6,db.images.size\r\n end",
"def migrate\n raise NotImplementedError\n end",
"def assert_generated_column(body, name, type)\n assert_match /t\\.#{type.to_s} :#{name.to_s}/, body, \"should have column #{name.to_s} defined\"\n end",
"def copy_structure\n logger.info \"Copying structure for table #{name} from watched to audit database\"\n db.query(\"CREATE TABLE #{audit} LIKE #{watched}\")\n add_copied_at_field\n add_has_delta_field\n add_last_version_field\n add_has_violation_field\n add_deletion_flag\n end",
"def test_lessons_can_haz_names_07\n Lesson.create(name: \"Life Lesson\")\n l = Lesson.new()\n refute l.save\n end",
"def test_readings_must_order_number_lesson_id_and_url_08\n Reading.create(order_number: 1, lesson_id: 1, url: \"http://lolcrazypants.com\")\n r = Reading.new()\n refute r.save\n end",
"def test_import_from_pstore\r\n model = Persist.import_from_pstore('models/unittest1')\r\n\r\n assert_equal(2, model.ident) \r\n assert_equal('pstore persistance', model.name)\r\n assert_equal('will be deleted between tests', model.description) \r\n assert_equal('and they are off', model.commentary)\r\n \r\n assert_equal(2, model.node_list.size) \r\n assert_equal(1, model.link_list.size)\r\n \r\n assert_equal([0.2, 0.3], model.node_list.node_for_id(1).evidence) \r\n end",
"def test_has_content_eh\n a_node = Tree::TreeNode.new(\"A Node\")\n assert_nil(a_node.content , \"The node should not have content\")\n assert(!a_node.has_content? , \"The node should not have content\")\n\n a_node.content = \"Something\"\n assert_not_nil(a_node.content, \"The node should now have content\")\n assert(a_node.has_content?, \"The node should now have content\")\n end",
"def test_version\n way = create(:way, :with_history)\n used_way = create(:way, :with_history)\n create(:relation_member, :member => used_way)\n way_with_versions = create(:way, :with_history, :version => 4)\n\n create(:way_tag, :way => way)\n create(:way_tag, :way => used_way)\n create(:way_tag, :way => way_with_versions)\n propagate_tags(way, way.old_ways.last)\n propagate_tags(used_way, used_way.old_ways.last)\n propagate_tags(way_with_versions, way_with_versions.old_ways.last)\n\n check_current_version(way.id)\n check_current_version(used_way.id)\n check_current_version(way_with_versions.id)\n end",
"def migration\n end",
"def test_insert_first\n\n subsection_01_1_1 = subsections(:subsection_01_1_1)\n checklist = Checklist.find(subsection_01_1_1.checklist.id)\n \n assert_equal(6, checklist.designer_only_count)\n assert_equal(5, checklist.designer_auditor_count)\n assert_equal(0, checklist.dc_designer_only_count)\n assert_equal(3, checklist.dc_designer_auditor_count)\n assert_equal(0, checklist.dr_designer_only_count)\n assert_equal(3, checklist.dr_designer_auditor_count)\n\n new_check = { 'date_code_check' => '1',\n 'full_review' => '0',\n 'title' => 'First Check',\n 'dot_rev_check' => '1',\n 'url' => '',\n 'check' => 'text',\n 'check_type' => 'yes_no' }\n\n subsection_01_2_3 = subsections(:subsection_01_2_3)\n section_01_2 = sections(:section_01_2)\n \n assert_equal(0, subsection_01_2_3.checks.size)\n\n post(:insert_first,\n { :new_check => new_check,\n :section => { 'id' => subsection_01_2_3.section_id,\n 'checklist_id' => subsection_01_2_3.checklist.id },\n :subsection => { 'id' => subsection_01_2_3.id } },\n cathy_admin_session)\n\t \n assert_equal('Added first check successfully.',\n\t\t flash['notice'])\n assert_redirected_to(:controller => 'checklist',\n :action => 'edit',\n :id => subsection_01_2_3.checklist.id)\n\n\n subsection_01_2_3.reload\n checks = subsection_01_2_3.checks\n assert_equal(1, checks.size)\n assert_equal('First Check', checks[0][:title])\n\n checklist = Checklist.find(subsection_01_1_1.checklist.id)\n assert_equal(6, checklist.designer_only_count)\n assert_equal(5, checklist.designer_auditor_count)\n assert_equal(1, checklist.dc_designer_only_count)\n assert_equal(3, checklist.dc_designer_auditor_count)\n assert_equal(1, checklist.dr_designer_only_count)\n assert_equal(3, checklist.dr_designer_auditor_count)\n\n end",
"def test_truth\n assert nodes(:draft_1)\n end",
"def migrate_document_structure\n set_previous_migrations\n\n GuidesGenerator::Parser::doc_hash.each do |version, data|\n text = get_version_index_text(data['files'], version)\n version_record = get_or_create_version(version, text)\n\n if data['files'] then migrate_documents(data['files'], nil, version_record) end\n if data['sections'] then migrate_sections(data['sections'], version_record) end\n end\n\n destroy_removed_migrations\n end",
"def test_db_creates_table\n db = ::SQLite3::Database.new(self.class::DATABASE_NAME)\n assert_equal(db.table_info('reports'), [])\n\n db = ::WeatherReport::Database.db(database_name: self.class::DATABASE_NAME)\n assert !db.table_info('reports').empty?\n end",
"def create_tables_in_test_schema\n ActiveRecord::Schema.define(version: 1) do\n ActiveRecord::Base.connection.ddl_batch do\n create_table :all_types, id: { limit: 8 } do |t|\n t.column :col_string, :string\n t.column :col_int64, :bigint\n t.column :col_float64, :float\n t.column :col_numeric, :numeric\n t.column :col_bool, :boolean\n t.column :col_bytes, :binary\n t.column :col_date, :date\n t.column :col_timestamp, :datetime\n t.column :col_json, :json\n\n t.column :col_array_string, :string, array: true\n t.column :col_array_int64, :bigint, array: true\n t.column :col_array_float64, :float, array: true\n t.column :col_array_numeric, :numeric, array: true\n t.column :col_array_bool, :boolean, array: true\n t.column :col_array_bytes, :binary, array: true\n t.column :col_array_date, :date, array: true\n t.column :col_array_timestamp, :datetime, array: true\n t.column :col_array_json, :json, array: true\n end\n\n create_table :firms do |t|\n t.string :name\n t.integer :rating\n t.string :description\n t.references :account\n end\n\n create_table :customers do |t|\n t.string :name\n end\n\n create_table :accounts do |t|\n t.references :customer, index: false\n t.references :firm, index: false\n t.string :name\n t.integer :credit_limit\n t.integer :transactions_count\n end\n\n create_table :transactions do |t|\n t.float :amount\n t.references :account, index: false\n end\n\n create_table :departments do |t|\n t.string :name\n t.references :resource, polymorphic: true, index: { name: \"index_departments_on_resource\" }\n end\n\n create_table :member_types do |t|\n t.string :name\n end\n\n create_table :members do |t|\n t.string :name\n t.references :member_type, index: false\n t.references :admittable, polymorphic: true, index: false\n end\n\n create_table :memberships do |t|\n t.datetime :joined_on\n t.references :club, index: false\n t.references :member, index: false\n t.boolean :favourite\n end\n\n create_table :clubs do |t|\n t.string :name\n end\n\n create_table :authors do |t|\n t.string :name, null: false\n t.date :registered_date\n t.references :organization, index: false\n end\n\n create_table :posts do |t|\n t.string :title\n t.string :content\n t.references :author\n t.integer :comments_count\n t.date :post_date\n t.time :published_time\n end\n\n create_table :comments do |t|\n t.string :comment\n t.references :post, index: false, foreign_key: true\n end\n\n create_table :addresses do |t|\n t.string :line1\n t.string :postal_code\n t.string :city\n t.references :author, index: false\n end\n\n create_table :organizations do |t|\n t.string :name\n t.datetime :last_updated, allow_commit_timestamp: true\n end\n\n create_table :singers, id: false do |t|\n t.primary_key :singerid\n t.column :first_name, :string, limit: 200\n t.string :last_name\n t.integer :tracks_count\n t.integer :lock_version\n t.virtual :full_name, type: :string, as: \"COALESCE(first_name || ' ', '') || last_name\", stored: true\n end\n\n create_table :albums, id: false do |t|\n t.interleave_in :singers\n t.primary_key :albumid\n # `singerid` is part of the primary key in the table definition, but it is not visible to ActiveRecord as part of\n # the primary key, to prevent ActiveRecord from considering this to be an entity with a composite primary key.\n t.parent_key :singerid\n t.string :title\n t.integer :lock_version\n end\n\n create_table :tracks, id: false do |t|\n # `:cascade` causes all tracks that belong to an album to automatically be deleted when an album is deleted.\n t.interleave_in :albums, :cascade\n t.primary_key :trackid\n t.parent_key :singerid\n t.parent_key :albumid\n t.string :title\n t.numeric :duration\n t.integer :lock_version\n end\n\n add_index :tracks, [:singerid, :albumid, :title], interleave_in: :albums, null_filtered: true, unique: false\n\n end\n end\nend",
"def test_ut_diff_source_code_o1\n assert @diff_source_code_1.save\n diff_source_code_copy = DiffSourceCode.find(@diff_source_code_1.id)\n assert_equal @diff_source_code_1.diff_file_id, diff_source_code_copy.diff_file_id \n assert @diff_source_code_1.valid?\n assert @diff_source_code_1.destroy\n end",
"def migrate\n db.create_table? table_name do\n primary_key :id\n String :ptype\n String :v0\n String :v1\n String :v2\n String :v3\n String :v4\n String :v5\n end\n end",
"def check_metadata\n version = @db[:schema_info].first\n unless version[:magic] == Bitcoin.network[:magic_head].hth\n name = Bitcoin::NETWORKS.find{|n,d| d[:magic_head].hth == version[:magic]}[0]\n raise \"Error: DB #{@db.url} was created for '#{name}' network!\"\n end\n unless version[:backend] == backend_name\n # rename \"sequel\" to \"archive\" when old db is opened\n if version[:backend] == \"sequel\" && backend_name == \"archive\"\n @db[:schema_info].update(backend: \"archive\")\n else\n raise \"Error: DB #{@db.url} was created for '#{version[:backend]}' backend!\"\n end\n end\n end",
"def assert_working_relations( model, relations )\n failed = []\n relations.each do | name |\n begin\n model.send( name )\n rescue Exception => e\n failed << \"#{name} - #{e}\"\n end\n end\n if failed.empty?\n assert true\n else\n assert false, failed.join('; ')\n end\n end",
"def schema_table_posts_content\n <<-MYSQL\nCREATE TABLE posts_content\n (\n id INTEGER,\n # Ajouté pour la version 2.0 :\n created_at INTEGER(10),\n updated_at INTEGER(10),\n content TEXT NOT NULL,\n\n PRIMARY KEY (id)\n )\n MYSQL\nend",
"def test_show_if_contains_valid_transaction_id\n assert_equal @order.contains_valid_transaction_id?, false\n assert @order.update_attributes(:auth_transaction_id => 123)\n assert_equal @order.contains_valid_transaction_id?, true\n end",
"def test_old\n assert_equal({\n \"shiva\"=>\"Shiva\",\n \"ganesha\"=>\"Ganesha\",\n \"surya\"=>\"Surya\",\n \"ganga\"=>\"Ganga\",\n \"shakti\"=>\"Shakti\",\n \"vishnu\"=>\"Vishnu\",\n \"shiva_desc\"=>\"Shiva is the god of transformation through destruction and the Lord of Dance.\",\n \"ganesha_desc\"=>\"Ganesha is the god of knowledge and beginnings, the Lord of Obstacles.\",\n \"surya_desc\"=>\"Surya is the god of the sun, courage and will.\",\n \"ganga_desc\"=>\"Ganga is the goddess of the sacred river, Ganges, who purifies and redeems.\",\n \"shakti_desc\"=>\"Shakti is the goddess of power and dynamic energy.\",\n \"vishnu_desc\"=>\"Vishnu is the all-pervading god who sustains the world.\",\n \"RV_NO_DEITY_TITLE\"=>\"No Current Deity.\",\n \"RV_NO_DEITY_DESC\"=>\"Hinduism allows you to select which god to follow as your main deity. Each deity will come with its own effects and last until your monarch changes.\",\n \"RV_PICK_DEITY_THIS\"=>\"Follow $NAME|Y$\",\n \"RV_PICK_DEITY\"=>\"Select Deity\",\n }, FakeYaml.load(sample(\"religion_l_english\")))\n end",
"def test_truth\r\n assert_kind_of Planner, Planner.find(1)\r\n end",
"def verify_schema_hash\r\n expect(Schema.schema_hash_i).to be_instance_of(Hash)\r\n %w{person org}.each{|e| expect(Schema.schema_hash.keys).to include(e)}\r\n end",
"def test_putway_create_valid\n changeset = create(:changeset)\n cs_id = changeset.id\n user = changeset.user\n\n a = create(:node).id\n b = create(:node).id\n c = create(:node).id\n d = create(:node).id\n e = create(:node).id\n\n amf_content \"putway\", \"/1\", [\"#{user.email}:test\", cs_id, 0, -1, [a, b, c], { \"test\" => \"new\" }, [], {}]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n new_way_id = result[3].to_i\n\n assert_equal 8, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal -1, result[2]\n assert_not_equal -1, result[3]\n assert_equal({}, result[4])\n assert_equal 1, result[5]\n assert_equal({}, result[6])\n assert_equal({}, result[7])\n\n new_way = Way.find(new_way_id)\n assert_equal 1, new_way.version\n assert_equal [a, b, c], new_way.nds\n assert_equal({ \"test\" => \"new\" }, new_way.tags)\n\n amf_content \"putway\", \"/1\", [\"#{user.email}:test\", cs_id, 0, -1, [b, d, e, a], { \"test\" => \"newer\" }, [], {}]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n new_way_id = result[3].to_i\n\n assert_equal 8, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal -1, result[2]\n assert_not_equal -1, result[3]\n assert_equal({}, result[4])\n assert_equal 1, result[5]\n assert_equal({}, result[6])\n assert_equal({}, result[7])\n\n new_way = Way.find(new_way_id)\n assert_equal 1, new_way.version\n assert_equal [b, d, e, a], new_way.nds\n assert_equal({ \"test\" => \"newer\" }, new_way.tags)\n\n amf_content \"putway\", \"/1\", [\"#{user.email}:test\", cs_id, 0, -1, [b, -1, d, e], { \"test\" => \"newest\" }, [[4.56, 12.34, -1, 0, { \"test\" => \"new\" }], [12.34, 4.56, d, 1, { \"test\" => \"ok\" }]], { a => 1 }]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n new_way_id = result[3].to_i\n new_node_id = result[4][\"-1\"].to_i\n\n assert_equal 8, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal -1, result[2]\n assert_not_equal -1, result[3]\n assert_equal({ \"-1\" => new_node_id }, result[4])\n assert_equal 1, result[5]\n assert_equal({ new_node_id.to_s => 1, d.to_s => 2 }, result[6])\n assert_equal({ a.to_s => 1 }, result[7])\n\n new_way = Way.find(new_way_id)\n assert_equal 1, new_way.version\n assert_equal [b, new_node_id, d, e], new_way.nds\n assert_equal({ \"test\" => \"newest\" }, new_way.tags)\n\n new_node = Node.find(new_node_id)\n assert_equal 1, new_node.version\n assert_equal true, new_node.visible\n assert_equal 4.56, new_node.lon\n assert_equal 12.34, new_node.lat\n assert_equal({ \"test\" => \"new\" }, new_node.tags)\n\n changed_node = Node.find(d)\n assert_equal 2, changed_node.version\n assert_equal true, changed_node.visible\n assert_equal 12.34, changed_node.lon\n assert_equal 4.56, changed_node.lat\n assert_equal({ \"test\" => \"ok\" }, changed_node.tags)\n\n # node is not deleted because our other ways are using it\n deleted_node = Node.find(a)\n assert_equal 1, deleted_node.version\n assert_equal true, deleted_node.visible\n end",
"def test_promotion_line_item\n # Setup\n promo = promotions(:percent_rebate)\n setup_new_order_with_items()\n # Exercise\n @o.promotion_code = promo.code\n assert @o.save\n assert_kind_of Promotion, @o.promotion\n # Verify\n assert_equal @o.promotion_line_item.name, promo.description\n end",
"def checkDatabase( asIs:, toBe: )\n \n chk_db_table_included(\n comment: \"db-Users>\",\n toBe: toBe[:Users], asIs: asIs[:Users],\n keyLambda: ->(r1,r2) { r1[\"email\"] == r2[\"email\"] }\n )\n \n chk_db_table_included(\n comment: \"db-Companies>\",\n toBe: toBe[:Companies], asIs: asIs[:Companies],\n keyLambda: ->(r1,r2) { r1[\"name\"] == r2[\"name\"] }\n )\n \n end",
"def test_truth\n assert_kind_of SiRevision, @si_revision\n end",
"def test_basic_account_migration_step2\n post :register, {:user => old_c2w_users(:jim).to_user.attributes.delete_if{|k,v| ![:username, :email,\n :gender, :date_of_birth, :address_line_1, :address_line_2, :state, :city, :country, :pin_code,\n :mobile_number, :phone_number].include?(k.to_sym)}.merge({:password_confirmation => 'jim277', :password => 'jim277'})},\n {:old_c2w_user => old_c2w_users(:jim)}\n assert assigns['user'].errors.empty?\n user = assigns['user']\n assert !session[:user]\n assert session[:old_c2w_user].nil?\n assert old_c2w_users(:jim).migrated?\n assert_equal AppConfig.migration_bonus_credits + AppConfig.sign_up_bonus_credits + old_c2w_users(:jim).points, user.prize_points\n assert_equal AppConfig.migration_bonus_credits > 0 ? 3:2, user.credit_transactions.count\n assert_equal user.id, old_c2w_users(:jim).new_user_id\n assert_equal old_c2w_users(:jim).date_of_registration.to_time.to_i, user.created_on.to_time.to_i\n end",
"def test_for_create_editransaction_is_valid\n # Create object\n e = Editransaction.create(:isa01 => '99',\n :isa02 => '1234567890')\n\n # Check object is valid\n assert e.valid?\n end",
"def assert_basic_layout\n get topic_path(@topic)\n # Posts index is actually topic show.\n assert_template 'posts/index'\n # Assert there is topic title.\n assert_match CGI.escapeHTML(@topic.title), response.body\n # Assert there is current_page/total_pages indicator.\n current_page = assigns(:posts).current_page\n total_pages = assigns(:posts).total_pages\n assert_match CGI.escapeHTML(\"#{current_page}/#{total_pages}\"), response.body\n # Asset there is link to corresponding category.\n assert_select 'a[href=?]', category_path(@topic.category)\n # Assert there is will_paginate on the page.\n assert_select 'ul.pagination', count: 1\n # Assert there is no flash messages.\n assert_flash_notices\n end",
"def run_active_record_migrations!\n ActiveRecord::Migration.verbose = false\n ActiveRecord::Migrator.migrate([\"test/fixtures/migrate\"])\n end",
"def test_table_container\r\n assert_nothing_raised { $ff.table(:id, 't1').html }\r\n end",
"def migrate(version = nil)\n @logger.fine('Running test migrations...')\n super(File.join(Automation::FRAMEWORK_ROOT, Automation::FET_DIR, 'test/database/migrations'), version)\n end",
"def test_courses_haz_course_code_and_name_10\n b = Course.new()\n a = Course.create(course_code: \"ABC 123\", name: \"Michael Jackson\")\n assert a.name && a.course_code\n refute b.save\n end",
"def test_initializing_existing_privilege_set\n assert_difference(\"PrivilegeSet.sets.length\", 1, \"Adding test PrivilegeSet\") do\n assert_difference(\"Cbac::PrivilegeSetRecord.find(:all).length\", 0, \"Record should have been added to table\") do\n PrivilegeSet.add :existing_privilege_set, \"Something\"\n end\n end\n end",
"def check_metadata\n version = @db[:schema_info].first\n unless version[:magic] == Bitcoin.network[:magic_head].hth\n name = Bitcoin::NETWORKS.find{|n,d| d[:magic_head].hth == version[:magic]}[0]\n raise \"Error: DB #{@db.url} was created for '#{name}' network!\"\n end\n unless version[:backend] == backend_name\n if version[:backend] == \"sequel\" && backend_name == \"utxo\"\n log.warn { \"Note: The 'utxo' store is now the default backend.\n To keep using the full storage, change the configuration to use storage: 'sequel::#{@db.url}'.\n To use the new storage backend, delete or move #{@db.url}, or specify a different database path in the config.\" }\n end\n raise \"Error: DB #{@db.url} was created for '#{version[:backend]}' backend!\"\n end\n end",
"def test_content_empty\n @work_opinion.content = nil\n assert !@work_opinion.save\n end"
] |
[
"0.65234965",
"0.64974135",
"0.629223",
"0.6128113",
"0.6087569",
"0.601674",
"0.5858129",
"0.584822",
"0.58205354",
"0.58180493",
"0.57787365",
"0.57128763",
"0.5705589",
"0.5703517",
"0.57033545",
"0.5679172",
"0.5679172",
"0.5662987",
"0.5647087",
"0.5620317",
"0.56112397",
"0.559933",
"0.559168",
"0.55683076",
"0.5548117",
"0.55380857",
"0.55257213",
"0.55219954",
"0.5520011",
"0.5517358",
"0.5499853",
"0.54887956",
"0.5465161",
"0.5435612",
"0.5428641",
"0.542706",
"0.5416625",
"0.5412823",
"0.5412599",
"0.5408782",
"0.5402421",
"0.5402039",
"0.53947204",
"0.53868204",
"0.5375862",
"0.53753585",
"0.5374218",
"0.5367489",
"0.536409",
"0.536115",
"0.53573895",
"0.53491294",
"0.5344018",
"0.53399456",
"0.5338211",
"0.53378165",
"0.5336615",
"0.5332776",
"0.53254837",
"0.5322701",
"0.532205",
"0.5303183",
"0.53008664",
"0.529407",
"0.5292256",
"0.52921665",
"0.5274811",
"0.5274793",
"0.52612853",
"0.52599895",
"0.5257715",
"0.52554137",
"0.5252706",
"0.5252274",
"0.52480924",
"0.524199",
"0.5239449",
"0.52344954",
"0.52264786",
"0.5225381",
"0.5222705",
"0.521817",
"0.5213457",
"0.5212089",
"0.5205522",
"0.5202922",
"0.52028173",
"0.51990163",
"0.5193229",
"0.5188062",
"0.51839745",
"0.5182981",
"0.5165477",
"0.5156374",
"0.51486003",
"0.5140973",
"0.5134677",
"0.51276255",
"0.5127075",
"0.5125823"
] |
0.67981
|
0
|
Make sure data you expect your migrations to load are in there:
|
def see_default_data
assert Status.find_by_name("defined")
assert Status.find_by_name("in progress")
assert Status.find_by_name("complete")
assert Status.find_by_name("rejected")
assert Status.find_by_name("blocked")
assert Privilege.find_by_name("user")
assert Group.find_by_name("Developer")
assert Group.find_by_name("Customer")
assert Group.find_by_name("Customer Admin")
assert Group.find_by_name("Admin")
assert User.find_by_email_address("admin@example.com")
priority_high = Priority.find_by_name("High")
assert_equal "red", priority_high.color
assert_nil priority_high.position
priority_medium = Priority.find_by_name("Medium")
assert_equal "yellow", priority_medium.color
assert_nil priority_medium.position
priority_low = Priority.find_by_name("Low")
assert_equal "green", priority_low.color
assert_nil priority_low.position
assert_equal 1, Project.count(:conditions=>"name='Example Project'")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def migrations\n @migrations ||= {}\n end",
"def run_before_migrate_setup\n Chef::Log.info 'No before migrate setup defined.'\n end",
"def pre_migrate_database\n old_schema_version = get_schema_version\n new_schema_version = File.read(File.join(source_directory,'db','schema_version')).to_i\n \n return unless old_schema_version > 0\n \n # Are we downgrading?\n if old_schema_version > new_schema_version\n message \"Downgrading schema from #{old_schema_version} to #{new_schema_version}\"\n \n in_directory install_directory do\n unless system(\"rake -s migrate VERSION=#{new_schema_version}\")\n raise InstallFailed, \"Downgrade migrating from #{old_schema_version} to #{new_schema_version} failed.\"\n end\n end\n end\n end",
"def migration\n end",
"def migrate\n DataMapper.auto_migrate!\n end",
"def run_active_record_migrations!\n ActiveRecord::Migration.verbose = false\n ActiveRecord::Migrator.migrate([\"test/fixtures/migrate\"])\n end",
"def migrate\n raise NotImplementedError\n end",
"def setup_database\n ActiveRecord::Base.remove_connection\n\n ActiveRecord::Base.establish_connection(\n adapter: 'sqlite3',\n database: ':memory:'\n )\n\n ActiveRecord::Migration.suppress_messages do\n load File.expand_path('db/schema.rb')\n end\nend",
"def ensure_database\n unless File.exist?(\"./items.csv\")\n puts \"Restoring items database.\"\n update_database\n end\n end",
"def migrate\n run_migrations pending_migrations, :up\n end",
"def run\n load_migrations\n @migrations.each do |mig_class, version|\n mig_class.up\n # Add it to the schema_migrations table as well\n # This will fail if auto-migrations is only and always used,\n # as the schema_migrations table will not exist.\n SchemaMigration.find_or_create_by_version(version) rescue nil\n end\n end",
"def seeds_data\n rake(\"db:reload\")\n end",
"def supports_migrations?\n false\n end",
"def supports_migrations?\n false\n end",
"def schema_migrations_cleanup\n # Read all schema_migrations values from the dump.\n values = dump.scan(/^(\\(\\'\\d{14}\\'\\))[,;]\\n/).flatten.sort\n\n # Replace the schema_migrations values.\n dump.sub!(\n /(?<=INSERT INTO \"schema_migrations\" \\(version\\) VALUES).+;\\n*/m,\n \"\\n #{values.join(\"\\n,\")}\\n;\\n\\n\"\n )\n end",
"def schema_migrations_cleanup\n # Read all schema_migrations values from the dump.\n values = dump.scan(/^(\\(\\'\\d{14}\\'\\))[,;]\\n/).flatten.sort\n\n # Replace the schema_migrations values.\n dump.sub!(\n /(?<=INSERT INTO \"schema_migrations\" \\(version\\) VALUES).+;\\n*/m,\n \"\\n #{values.join(\"\\n,\")}\\n;\\n\\n\"\n )\n end",
"def supports_migrations?\n true\n end",
"def supports_migrations?\n true\n end",
"def supports_migrations?\n true\n end",
"def supports_migrations?\n true\n end",
"def supports_migrations?\n true\n end",
"def career_migration_data\n<<RUBY\nt.string :title\n t.string :position\n t.string :location\n t.text :description\n t.text :questions\n t.boolean :status,default: true\n\nRUBY\n end",
"def migration_railties; end",
"def migration_railties; end",
"def load_into_database(options={})\n # necessary to make multiple invocations possible in a single test\n # case possible\n ActiveRecord::Fixtures.reset_cache\n\n # Filter down the models to load if specified\n the_tables = if options.has_key?(:only)\n self.table_names.select {|x| Array(options[:only]).map(&:to_s).include?(x) }\n elsif options.has_key?(:except)\n self.table_names.select {|x| !Array(options[:except]).map(&:to_s).include?(x) }\n else\n self.table_names\n end\n raise \"No models to load, relax your :only or :except filters (or don't bother calling this method)\" if the_tables.empty?\n\n\n #This wraps all the inserts into a single transaction allowing the constraint check to happen at the end.\n ActiveRecord::Base.transaction do\n\n the_tables.each do |table_name|\n class_name = if self.table_name_to_model_name_hash.kind_of?(Hash)\n self.table_name_to_model_name_hash[table_name]\n else\n ActiveSupport::Deprecation.warn \"your fe_manifest.yml does not contain a table_name_to_model_name_hash (as found in 1.0.0 or earlier). Version 2.0.0 will require this. See test cases for how to manually jigger your fe_manifest.ymls to function.\"\n nil\n end\n if options[:map].nil?\n # Vanilla create_fixtures will work fine when no mapping is being used\n ActiveRecord::Fixtures.create_fixtures(self.target_path, table_name)\n else\n # Map table_name via a function (great for prefixing)\n new_table_name = if options[:map].kind_of?(Proc)\n options[:map].call(table_name)\n # Map table_name via a Hash table name mapping\n elsif options[:map][table_name].kind_of? String\n options[:map][table_name]\n else\n table_name # No mapping for this table name\n end\n fixtures = ActiveRecord::Fixtures.new( ActiveRecord::Base.connection,\n new_table_name,\n class_name,\n ::File.join(self.target_path, table_name))\n fixtures.table_rows.each do |the_table_name,rows|\n rows.each do |row|\n ActiveRecord::Base.connection.insert_fixture(row, the_table_name)\n end\n end\n end\n # FIXME: The right way to do this is to fork the oracle enhanced adapter\n # and implement a reset_pk_sequence! method, this is what ActiveRecord::Fixtures\n # calls. aka this code should be eliminated/live elsewhere.\n case ActiveRecord::Base.connection.adapter_name\n when /oracle/i\n model = class_name.constantize\n if model.column_names.include? \"id\"\n sequence_name = model.sequence_name.to_s\n max_id = model.maximum(:id)\n next_id = max_id.nil? ? 1 : max_id.to_i + 1\n begin\n ActiveRecord::Base.connection.execute(\"drop sequence #{sequence_name}\")\n rescue\n puts \"[Iron Fixture Extractor] WARNING: couldnt drop the sequence #{sequence_name}, (but who cares!)\"\n end\n begin\n q=\"create sequence #{sequence_name} increment by 1 start with #{next_id}\"\n ActiveRecord::Base.connection.execute(q)\n rescue\n puts \"[Iron Fixture Extractor] WARNING: couldnt create the sequence #{sequence_name}\"\n end\n end\n else\n # Do nothing, only oracle adapters need this\n end\n end\n end # End transaction\n end",
"def run_migrations(migrations)\n migrations.each do |direction, version_or_filenames|\n Array.wrap(version_or_filenames).each do |version_or_filename|\n /^(?<version>\\d{3,})/ =~ File.basename(version_or_filename)\n ActiveRecord::Migrator.run(direction, ActiveRecord::Migrator.migrations_path, version.to_i)\n end if version_or_filenames\n end\n if ActiveRecord::Base.schema_format == :ruby\n File.open(ENV['SCHEMA'] || \"#{Rails.root}/db/schema.rb\", 'w') do |file|\n ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, file)\n end\n end\n #TODO unload migraion classes\n end",
"def check_schema_migrations\n unless column_family_exists?('schema_migrations')\n say \"Creating schema_migrations column family\"\n connection.execute_cql_query(DatastaxRails::Cql::CreateColumnFamily.new('schema_migrations').key_type(:text).columns(:digest => :text, :solrconfig => :text, :stopwords => :text).to_cql)\n end\n \n check_key_name('schema_migrations')\n end",
"def auto_migrate!\n DataMapper.auto_migrate!(name)\n end",
"def copy_migrations\n # Can't get this any more DRY, because we need this order.\n better_migration_template \"create_searches.rb\"\n better_migration_template \"create_bookmarks.rb\"\n better_migration_template \"remove_editable_fields_from_bookmarks.rb\"\n better_migration_template \"add_user_types_to_bookmarks_searches.rb\"\n end",
"def check_schema_migrations\n return if column_family_exists?('schema_migrations')\n say 'Creating schema_migrations column family'\n DatastaxRails::Cql::CreateColumnFamily.new('schema_migrations').primary_key('cf')\n .columns(cf: :text, digest: :text, solrconfig: :text, stopwords: :text).execute\n end",
"def assert_skipped_migration(name)\n migration_file = \"#{RAILS_ROOT}/db/migrate/001_#{name.to_s.underscore}.rb\"\n assert !File.exist?(migration_file), \"should not create migration #{migration_file}\"\n end",
"def migrations\n raise(ArgumentError, \"Can't set migrations while using :version option\") if @using_deprecated_version_setting\n yield\n end",
"def before_setup\n Account.connection.drop_table :accounts, if_exists: true\n Account.connection.exec_query(\"CREATE SEQUENCE accounts_id_seq\")\n Account.connection.exec_query(\"\n CREATE TABLE accounts (\n id BIGINT PRIMARY KEY DEFAULT nextval('accounts_id_seq'),\n firm_id bigint,\n firm_name character varying,\n credit_limit integer\n )\n \")\n\n Company.connection.drop_table :companies, if_exists: true\n Company.connection.exec_query(\"CREATE SEQUENCE companies_nonstd_seq\")\n Company.connection.exec_query(\"\n CREATE TABLE companies (\n id BIGINT PRIMARY KEY DEFAULT nextval('companies_nonstd_seq'),\n type character varying,\n firm_id bigint,\n firm_name character varying,\n name character varying,\n client_of bigint,\n rating bigint,\n account_id integer,\n description character varying\n )\n \")\n\n Course.connection.drop_table :courses, if_exists: true\n Course.connection.exec_query(\"CREATE SEQUENCE courses_id_seq\")\n Course.connection.exec_query(\"\n CREATE TABLE courses (\n id INT PRIMARY KEY DEFAULT nextval('courses_id_seq'),\n name character varying,\n college_id integer\n )\n \")\n\n self.class.fixtures :accounts\n self.class.fixtures :companies\n self.class.fixtures :courses\n end",
"def load_schema\n File.read(File.expand_path(\"fixtures/db_definitions/sqlite.sql\", __dir__)).split(\";\").each do |sql|\n ActiveRecord::Base.connection.execute(sql) unless sql.blank?\n end\n end",
"def copy_migrations\n [\n \"acts_as_follower_migration.rb\",\n \"add_social_to_users.rb\",\n \"add_ldap_attrs_to_user.rb\",\n \"add_avatars_to_users.rb\",\n \"add_groups_to_users.rb\",\n \"create_local_authorities.rb\",\n \"create_trophies.rb\",\n 'add_linkedin_to_users.rb',\n 'create_tinymce_assets.rb',\n 'create_content_blocks.rb',\n 'create_featured_works.rb',\n 'add_external_key_to_content_blocks.rb'\n ].each do |file|\n better_migration_template file\n end\n end",
"def migrate?\n raise NotImplementedError\n end",
"def initialize_schema_migrations_table\n unless table_exists?('schema_migrations')\n execute(\"CREATE TABLE schema_migrations (version string primary key INDEX using plain)\")\n end\n end",
"def initialize_schema_migrations_table\n unless table_exists?('schema_migrations')\n execute(\"CREATE TABLE schema_migrations (version string primary key INDEX using plain)\")\n end\n end",
"def initialize_schema_migrations_table\n unless table_exists?('schema_migrations')\n execute(\"CREATE TABLE schema_migrations (version string primary key INDEX using plain)\")\n end\n end",
"def migrations\n @migrations ||= begin\n paths = Dir[\"#{migrations_path}/*.rb\"]\n migrations = paths.map { |path| MigrationProxy.new(path) }\n migrations.sort\n end\n end",
"def load_database_yaml; end",
"def load_database_yaml; end",
"def before_load\n data_class.rebuild_table\n super\n end",
"def before_setup\n super\n DatabaseCleaner.start\n end",
"def check_all_foreign_keys_valid!\n end",
"def setup\n setup_test_database\n drop_and_create_schema_migrations_table\n end",
"def setup_database\n Hanami::Model.load!\n end",
"def up\n ActiveRecord::Base.transaction do\n migrate_cause\n migrate_messages\n end\n end",
"def migrate_configuration\n puts \"migrating configuration\"\n ActiveRecord::Base.connection.execute('truncate table configuration')\n Configuration.create name: 'home', data: {headlines: [], today: [], tracklists: []}\n Configuration.create name: 'home_components', data: {headlines: 5, today: 3, tracklists: 3}\n Configuration.create name: 'navigation', data: {categories: []}\n Configuration.create name: 'about', data: {hebrew: nil, english: nil}\nend",
"def run_migrate\n manage_py_execute('migrate', '--noinput') if new_resource.migrate\n end",
"def run_migrations(migrations)\n migrations.each do |direction, version_or_filenames|\n Array.wrap(version_or_filenames).each do |version_or_filename|\n version = File.basename(version_or_filename)[/\\d{3,}/]\n\n if defined? ActiveRecord::MigrationContext # >= 5.2\n ActiveRecord::Base.connection.migration_context.run(direction, version.to_i)\n else\n ActiveRecord::Migrator.run(direction, ActiveRecord::Migrator.migrations_paths, version.to_i)\n end\n end if version_or_filenames\n end\n if ActiveRecord::Base.schema_format == :ruby\n File.open(ENV['SCHEMA'] || \"#{Rails.root}/db/schema.rb\", 'w') do |file|\n ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, file)\n end\n end\n #TODO unload migraion classes\n end",
"def migrate_database\n RFlow.logger.debug 'Applying default migrations to config database'\n migrations_path = File.join(File.dirname(__FILE__), 'configuration', 'migrations')\n ActiveRecord::Migration.verbose = false\n ActiveRecord::Migrator.migrate migrations_path\n end",
"def initial_setup\n CORE.each { |c| c.auto_migrate! }\n end",
"def add_migrations\n \tmigrations = Dir.glob(SocialFramework::Engine.config.paths[\"db/migrate\"].first + \"/*\")\n\n if options[:migrations]\n options[:migrations].each do |migrate|\n file = \"social_framework_#{migrate.pluralize}.rb\"\n file = migrations.select { |m| m.include?(file) }.first\n unless file.nil? or file.empty?\n file_name = file.split(\"/\").last\n copy_file file, \"db/migrate/#{file_name}\"\n else\n puts \"Could not find migration: '#{migrate}'\"\n end\n end\n else\n migrations.each do |migrate|\n file = migrate.split(\"/\").last \n copy_file migrate, \"db/migrate/#{file}\"\n end\n end\n end",
"def migrations\n rake 'admin:install:migrations'\n rake 'db:migrate SCOPE=admin'\n end",
"def migrate!\n @logger.fine('Dropping schema...')\n\n migrate(0) # migrate to version 0.\n migrate # migrate to latest version.\n end",
"def migrated?\n !find_in_db.nil?\n end",
"def before_setup\n super\n DatabaseCleaner.start\n end",
"def ensure_migrated\n return if blob\n\n content_upload(fetcher.html_file)\n end",
"def load_seeds_data(table_name)\n seed_file = Rails.root.join('db','seeds_data',\"#{table_name}.yml\")\n YAML::load_file(seed_file)\n end",
"def prepare_pre_import\n end",
"def setup\n begin\n create_campaign_table_if_not_exist\n seed_data\n rescue Exception => e\n raise \"Database setup failed with error #{e}\"\n ensure\n @connection.close\n end\n end",
"def migrate!\n Migrator.migrate(name)\n end",
"def migrate!\n Migrator.migrate(name)\n end",
"def set_previous_migrations\n GuidesGenerator::Migrator::previous_versions = version_class.all\n GuidesGenerator::Migrator::previous_sections = section_class.all\n GuidesGenerator::Migrator::previous_documents = document_class.all\n end",
"def populate\n old_logger = ActiveRecord::Base.logger\n ActiveRecord::Base.logger = nil\n\n begin\n write_data\n \n rc = true\n rescue StandardError => e\n errors[:base] << e.message\n rc = false\n ensure\n ActiveRecord::Base.logger = old_logger \n end\n\n return rc\n end",
"def populate\n old_logger = ActiveRecord::Base.logger\n ActiveRecord::Base.logger = nil\n\n begin\n write_data\n \n rc = true\n rescue StandardError => e\n errors[:base] << e.message\n rc = false\n ensure\n ActiveRecord::Base.logger = old_logger \n end\n\n return rc\n end",
"def migrate(version = nil)\n @logger.fine('Running test migrations...')\n super(File.join(Automation::FRAMEWORK_ROOT, Automation::FET_DIR, 'test/database/migrations'), version)\n end",
"def copy_migrations\n # Can't get this any more DRY, because we need this order.\n %w{acts_as_follower_migration.rb\tadd_social_to_users.rb\t\tcreate_single_use_links.rb\tadd_ldap_attrs_to_user.rb\nadd_avatars_to_users.rb\t\tcreate_checksum_audit_logs.rb\tcreate_version_committers.rb\nadd_groups_to_users.rb\t\tcreate_local_authorities.rb\tcreate_trophies.rb}.each do |f|\n better_migration_template f\n end\n end",
"def run_local_migrations()\n setup_local_environment\n # Runs migrations against the local database.\n common = Common.new\n Dir.chdir('db') do\n common.run_inline %W{./run-migrations.sh main}\n end\n Dir.chdir('db-cdr/generate-cdr') do\n common.run_inline %W{./init-new-cdr-db.sh --cdr-db-name cdr}\n end\n common.run_inline %W{gradle :loadConfig -Pconfig_key=main -Pconfig_file=config/config_local.json}\n common.run_inline %W{gradle :loadConfig -Pconfig_key=cdrBigQuerySchema -Pconfig_file=config/cdm/cdm_5_2.json}\n common.run_inline %W{gradle :loadConfig -Pconfig_key=featuredWorkspaces -Pconfig_file=config/featured_workspaces_local.json}\n common.run_inline %W{gradle :updateCdrConfig -PappArgs=['config/cdr_config_local.json',false]}\nend",
"def verify_required_data_files!\n unless File.exists?(\"#{@working_directory}/drupal-filesystem.tar.gz\") && File.exists?(\"#{@working_directory}/drupal-db.sql.gz\")\n raise StandardError.new(\"Cannot locate both 'drupal-filesystem.tar.gz' and 'drupal-db.sql.gz' in directory '#{@working_directory}'.\")\n end\n end",
"def copy_migrations\n \n # get an array of the migrations in your engine's db/migrate/ \n # folder:\n \n migrations = Dir[Bulky::Engine.root.join(\"db/migrate/*.rb\")]\n migrations.each_with_index do |migration, i|\n \n # The migrations will be created with the same timestamp if you \n # create them all at once. So if you have more than one migration \n # in your engine, add one second to the second migration's file\n # timestamp and a third second to the third migration's timestamp \n # and so on:\n \n seconds = (DateTime.now.strftime(\"%S\").to_i + i).to_s\n seconds = seconds.to_s.length == 2 ? seconds : \"0#{seconds}\"\n timestamp = (DateTime.now.strftime \"%Y%m%d%H%M\") + seconds\n \n # get the filename from the engine migration minus the timestamp:\n name = migration.split(\"/\").last.split(\"_\")[1..-1].join(\"_\")\n # puts name\n \n # See if a the name of your engine migration is already in your\n # host app's db/migrate folder:\n \n if Rails.root.join(\"db/migrate/*#{name}\").exist?\n \n # do nothing:\n puts \"Migration #{name} has already been copied to your app\"\n else\n \n # copy your engine migration over to the host app with a new \n # timestamp:\n copy_file migration, \"db/migrate/#{timestamp}_#{name}\"\n end\n end\n end",
"def do_migrations\n migration_path = File.join(\"generators\", \"talia\", \"templates\", \"migrations\")\n ActiveRecord::Migrator.migrate(migration_path, ENV[\"VERSION\"] ? ENV[\"VERSION\"].to_i : nil )\n end",
"def migrate version = nil\n if @migrations\n schema = meta_schema\n version = __check_migration_version(version)\n __create_meta_data_table_for(schema)\n\n s = schema.first || schema.new(version: 0)\n unless s.version == version\n @migrations.sort_by { |migration| migration.version }.each do |m|\n m.migrate(:up) if s.version < m.version and m.version <= version\n\n if s.version >= m.version and m.version > version\n m.migrate(:down)\n else # Handle migrate(0)\n m.migrate(:down) if s.version >= m.version and version.zero?\n end\n end\n s.update_attribute :version, version\n end\n version = s.version\n end\n version\n end",
"def load_fixtures\n # fixtures = ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(File.dirname(__FILE__), 'test', 'fixtures', '*.{yml,csv}')) \n fixtures = [ 'active_sources', 'semantic_relations', 'semantic_properties' 'data_records']\n fixtures.reverse.each { |f| ActiveRecord::Base.connection.execute \"DELETE FROM #{f}\" }\n fixtures.each do |fixture_file|\n Fixtures.create_fixtures(File.join('test', 'fixtures'), File.basename(fixture_file, '.*')) \n end \n end",
"def create_tables!\n migrate(:up)\n end",
"def check\n if File.directory?(app_dir)\n engine_in_app = app_migrations.map do |file_name|\n name, engine = file_name.split('.', 2)\n next unless match_engine?(engine)\n\n name\n end.compact\n\n missing_migrations = engine_migrations.sort - engine_in_app.sort\n unless missing_migrations.empty?\n puts \"[#{engine_name.capitalize} WARNING] Missing migrations.\"\n missing_migrations.each do |migration|\n puts \"[#{engine_name.capitalize} WARNING] #{migration} from #{engine_name} is missing.\"\n end\n puts \"[#{engine_name.capitalize} WARNING] Run `bundle exec rake railties:install:migrations` to get them.\\n\\n\"\n true\n end\n end\n end",
"def populate\n old_logger = ActiveRecord::Base.logger\n ActiveRecord::Base.logger = nil\n\n begin\n write_data\n \n rc = true\n rescue StandardError => e\n self.errors[:base] << e.message\n rc = false\n ensure\n ActiveRecord::Base.logger = old_logger \n end\n\n return rc\n end",
"def index\n @migrations = Migration.all\n end",
"def copy_migrations\n [\n 'create_file_view_stats.rb',\n 'create_file_download_stats.rb'\n ].each do |file|\n better_migration_template file\n end\n end",
"def migrate\n db.create_table? table_name do\n primary_key :id\n String :ptype\n String :v0\n String :v1\n String :v2\n String :v3\n String :v4\n String :v5\n end\n end",
"def migrated_up(migration)\n column_family.insert({\n data: {\n version: migration.version.to_s,\n name: migration.name,\n migrated_at: Time.now.utc,\n },\n })\n end",
"def migrate(_key, _options); end",
"def auto_upgrade!\n AutoMigrator.auto_upgrade(name)\n end",
"def auto_upgrade!\n AutoMigrator.auto_upgrade(name)\n end",
"def load_tables\n return if Rails.env.test?\n PgTools.set_search_path id, false\n load \"#{Rails.root}/db/schema.rb\"\n ActiveRecord::Base.connection.execute %{drop table \"websites\"}\n PgTools.restore_default_search_path\n end",
"def check_sql_before_running; tarif_optimizator.check_sql_before_running; end",
"def copy_migrations\n rake 'hyrax:install:migrations'\n end",
"def ensure_change_logs\n [:left, :right].each do |database|\n create_change_log(database) unless change_log_exists?(database)\n end\n end",
"def test_adding_bears_to_the_farm_with_t_dot_foreign_key_farm_dependent_nullify\n premigrate\n table = \"bears\"\n migrate table\n assert_match(/FOREIGN KEY \\(\\\"farm_id\\\"\\) REFERENCES \\\"farms\\\"\\(id\\) ON DELETE SET NULL/, schema(table))\n end",
"def migrate\n with_maintenance do\n backup if backup?\n run_migration\n restart\n end\n end",
"def test_DB_initialization\n @fdb = setup\n assert(@fdb.size > 0, \"Database entries not correctly read in\")\n end",
"def preload_data\n DataStore.instance.insert_data('users', 'data/users.json')\n DataStore.instance.insert_data('tickets', 'data/tickets.json')\n end",
"def run_migrations\n unless options[\"no-migrate\"]\n puts \"Running rake db:migrate\"\n `rake db:migrate`\n end\n end",
"def generate_migrations\n versions = []\n versions << generate_migration(\"create_users\", <<-EOF\nHanami::Model.migration do\n change do\n create_table :users do\n primary_key :id\n column :name, String\n end\n end\nend\nEOF\n)\n\n versions << generate_migration(\"add_age_to_users\", <<-EOF\nHanami::Model.migration do\n change do\n add_column :users, :age, Integer\n end\nend\nEOF\n)\n versions\n end",
"def skip_migration_creation?\n custom_parent? && !database || !migration\n end",
"def performed_migrations\n rows = column_family.select\n rows.map { |row|\n path = migrations_path.join(\"#{row['version']}_#{row['name']}.rb\")\n MigrationProxy.new(path)\n }.sort\n end",
"def load_restaurant_inspection_model(restaurants_csv, locations_csv, restaurant_locations_csv)\n @db.transaction do\n @db.alter_table :restaurant_locations do\n drop_foreign_key [:restaurant_camis]\n drop_foreign_key [:location_id]\n end\n\n @db[:restaurant_locations].truncate\n @db[:restaurants].truncate\n @db[:locations].truncate\n\n @db.alter_table :restaurant_locations do\n add_foreign_key [:restaurant_camis], :restaurants, unique: true\n add_foreign_key [:location_id], :locations\n end\n\n @db.copy_into(:restaurants, data: restaurants_csv, format: :csv, options: 'HEADER true')\n @db.copy_into(:locations, data: locations_csv, format: :csv, options: 'HEADER true')\n @db.copy_into(:restaurant_locations, data: restaurant_locations_csv, format: :csv, options: 'HEADER true')\n end\n end",
"def install_migrations\n migrations = [\n \"create_blogelator_posts.rb\",\n \"create_blogelator_authors.rb\",\n \"create_blogelator_tags.rb\",\n \"create_blogelator_posts_tags.rb\",\n \"create_blogelator_posts_posts.rb\"\n ]\n migration_path = \"db/migrate\"\n migrations.each do |file|\n migration_template \"#{migration_path}/#{file}\", \"#{migration_path}/#{file}\"\n end\n end",
"def generate!\n table_attributes = resource.table_attributes\n model_attributes = resource.model_attributes\n\n table_keys = table_attributes.keys\n model_keys = model_attributes.keys\n\n # Create table\n if table_keys.blank?\n Rails.logger.info \"effective_developer migrate #{resource.plural_name}: create table\"\n return rails_migrate(\"create_#{resource.plural_name}\", model_attributes)\n end\n\n # Fields are not in database, but present in model.rb\n if(add_keys = (model_keys - table_keys)).present?\n Rails.logger.info \"effective_developer migrate #{resource.plural_name}: add #{add_keys.to_sentence}\"\n rails_migrate(\"add_ATTRIBUTES_to_#{resource.plural_name}\", model_attributes.slice(*add_keys))\n end\n\n # Fields are in database, but no longer in our effective_resource do block\n if (remove_keys = (table_keys - model_keys)).present?\n Rails.logger.info \"effective_developer migrate #{resource.plural_name}: remove #{remove_keys.to_sentence}\"\n rails_migrate(\"remove_ATTRIBUTES_from_#{resource.plural_name}\", table_attributes.slice(*remove_keys))\n end\n end",
"def initialize\n local_db = ActiveRecord::Base.connection_config\n @raw_connection = PG.connect(dbname: local_db[:database], host: 'localhost', port: local_db[:port])\n\n @source_db_config = {\n dbname: ENV[\"DB_NAME\"] || 'dd_demo',\n host: ENV[\"DB_HOST\"] || 'localhost'\n }\n\n raise \"SOURCE_BASE_URL missing!\" unless ENV['SOURCE_BASE_URL']\n\n @source_base_url = ENV[\"SOURCE_BASE_URL\"]\n @uploads_path = ENV['UPLOADS_PATH']\n @uploader = ImportScripts::Uploader.new\n\n if ENV['SOURCE_CDN']\n @source_cdn = ENV['SOURCE_CDN']\n end\n\n local_version = @raw_connection.exec(\"select max(version) from schema_migrations\")\n local_version = local_version.first['max']\n source_version = source_raw_connection.exec(\"select max(version) from schema_migrations\")\n source_version = source_version.first['max']\n\n if local_version != source_version\n raise \"DB schema mismatch. Databases must be at the same migration version. Local is #{local_version}, other is #{source_version}\"\n end\n\n @encoder = PG::TextEncoder::CopyRow.new\n\n @merged_user_ids = []\n @tags = {}\n @tag_groups = {}\n @uploads = {}\n @post_actions = {}\n @notifications = {}\n @badge_groupings = {}\n @badges = {}\n @email_tokens = {}\n\n @auto_group_ids = Group::AUTO_GROUPS.values\n\n # add your authorized extensions here:\n SiteSetting.authorized_extensions = ['jpg', 'jpeg', 'png', 'gif'].join('|')\n\n @sequences = {}\n end"
] |
[
"0.63979584",
"0.62646455",
"0.62423986",
"0.6127222",
"0.6124297",
"0.6114264",
"0.608918",
"0.6070095",
"0.5991623",
"0.5958342",
"0.5910198",
"0.5905127",
"0.5893607",
"0.5893607",
"0.58831155",
"0.58831155",
"0.587724",
"0.587724",
"0.587724",
"0.5854941",
"0.5854941",
"0.5851645",
"0.5849234",
"0.5849234",
"0.581655",
"0.5772415",
"0.5745319",
"0.573665",
"0.5728442",
"0.56733584",
"0.56552446",
"0.56526333",
"0.56002575",
"0.55969894",
"0.5592349",
"0.5576112",
"0.55730563",
"0.55730563",
"0.55730563",
"0.55726683",
"0.5560431",
"0.5560431",
"0.5559935",
"0.5547611",
"0.55433065",
"0.55416256",
"0.5536706",
"0.5525178",
"0.5520318",
"0.5517981",
"0.5515027",
"0.5509875",
"0.5493611",
"0.54874396",
"0.54720575",
"0.5459104",
"0.5432746",
"0.5425862",
"0.5422843",
"0.54144394",
"0.54035294",
"0.5389316",
"0.53773695",
"0.5377347",
"0.53760064",
"0.53742945",
"0.53742945",
"0.5358411",
"0.53529173",
"0.5342676",
"0.53343505",
"0.5315526",
"0.53129286",
"0.5307463",
"0.52988005",
"0.5292364",
"0.5276579",
"0.52731436",
"0.5269754",
"0.5261327",
"0.52583593",
"0.52571297",
"0.5252116",
"0.524489",
"0.524489",
"0.5243194",
"0.5242601",
"0.5236278",
"0.52350456",
"0.52291274",
"0.52287364",
"0.52243054",
"0.5221086",
"0.5218123",
"0.5214807",
"0.5214697",
"0.5199815",
"0.5197062",
"0.51949674",
"0.51921123",
"0.5190054"
] |
0.0
|
-1
|
Create a new user using the strong params.
|
def create
user = User.new(user_params)
if user.save
render json: {status: 200, msg: 'User was created.'}
else
render json: {
errors: user.errors.full_messages
}, status: :unprocessable_entity
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n\t\t\t\t@user = User.create!(create_user_params)\n\t\t\tend",
"def create\n @user = User.create( user_params )\nend",
"def create\n user = User.new(user_params)\n\n respond_to do |format|\n if user.save\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n p params\n @user = User.create(user_params)\n redirect_to @user\n end",
"def create\n p params\n @user = User.create(user_params)\n redirect_to @user\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\tredirect_to sign_in_path\n\t\telse\n\t\t\tredirect_to sign_up_path\n\t\tend\n\tend",
"def create\n logger.debug user_params\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :not_acceptable\n end\n end",
"def create\n @user = User.new(user_params)\n\n # save was requested by either current_user or else must be a new registration\n if @user.save(current_user)\n redirect_to users_path\n else\n render('new', status: :unprocessable_entity)\n end\n end",
"def create\n @user = User.new(user_params)\n \n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'user was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_attributes)\n if @user.save\n created(@user)\n else\n validation_errors(@user)\n end\n end",
"def create_user(params:)\n parse(JSON.parse(connection.post(\"users\", params.to_json).body))\n end",
"def create\n @user = User.new(user_params)\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n user = User.new(user_params)\n msg = if user.save\n 'User has successfully created.'\n else\n set_error(:unprocessable_entity, user)\n end\n common_response(msg, user: user)\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render :show, status: :created\n else\n render json: { errors: @user.errors }, status: :unprocessable_entity\n end\n end",
"def create\n user = User.create(user_params)\n if user.save\n render json: user\n else\n render json: user.errors, status: :bad\n end\n end",
"def create_user(user_hash={})\n @user = User.new(user_hash)\n @user.save\n end",
"def create_user(user_hash={})\n @user = User.new(user_hash)\n @user.save\n end",
"def create\n # creates a new user with attributes params[:user]\n @user = User.create params[:user]\n\n # redirect to show action\n redirect_to @user\n end",
"def create\n\t\t@user = User.new(user_params)\n\t\t# If user was save with succes, then sign in automaticly, else, render new.\n\t\tif @user.save\n\t\t\tsign_in @user\n\t\t \tflash[:sucess] = \"Seja bem-vindo!\"\n\t\t\tredirect_to :action => :show, :id => @user.id\n\t\t\tCUSTOM_LOGGER.info(\"Created and associated user to params #{@user.to_yaml}\")\n\t\telse\n\t\t\trender 'new'\n\t\t\tCUSTOM_LOGGER.error(\"Not created and associated user to params #{@user.to_yaml}\")\n\t\tend\n\tend",
"def create\n @user = User.new(user_params)\n if @user.save\n\n redirect_to edit_user_path(@user.id)\n else\n redirect_to sign_up_path\n end\n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: { error: I18n.t('user_create_error') }, status: :unprocessable_entity\n end\n end",
"def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\trender json: @user, status: :created, location: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend",
"def create\n user = User.create(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params(params))\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n\t\tputs user_params\n\t\tuser = User.new(user_params)\n\t\tif user.save\n\t\t\trender json: { user: user, status: :success }\n\t\telse\n\t\t\trender json: { status: :failure, errors: user.errors.full_messages.join('') }\n\t\tend\n\tend",
"def create\n user = User.create(user_params)\n render json: user, message: 'user succefully create', status: 200\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: {status: 200, msg: 'User was created.'}\n else\n render json: {errors: user.errors.messages}\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: {status: \"Se creo el usuario\"}, status: :ok\n else\n render json: {status: \"Error al crear el usuario\", errors: user.errors }, status: :unprocessable_entity\n end\n end",
"def create\n @user_user = User::User.new(user_user_params)\n\n respond_to do |format|\n if @user_user.save\n format.html { redirect_to @user_user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user_user }\n else\n format.html { render :new }\n format.json { render json: @user_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_user\n @user = User.new(user_params)\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n redirect_to @user, notice: 'Se creo un usuario exitosamente.'\n else\n render :new\n end\n end",
"def create\n user = User.new(user_params)\n\n if user.valid?\n user.save\n render json: {user: user, token: encode_token({user_id: user.id})}\n else\n render json: {error: \"Failed to create the user\"}\n end\n end",
"def create\n\t\t@user = User.new(user_params)\n\t\t\n\t\tif @user.save\n\t\t\tredirect_to users_path\n\t\telse\n\t\t\trender 'new'\n\t\tend\n\tend",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n\t\tparams.permit!\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to(users_url,\n :notice => \"User #{@user.name} was successfully created.\") }\n format.xml { render :xml => @user,\n :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: { status: 'OK', msg: 'User was created.', error: 'nil' },\n status: :created\n else\n not_good(422)\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n redirect_to root_path, notice: 'User was successfully created'\n else\n render action: 'new'\n end\n end",
"def create\n\t\t@user = User.new(user_params)\n# We used to pass new(params[:user]) which defined params as a \n# hash of hashes for the user object. Eq to saying \n# @user = User.new(name: \"joe\", email: \"joe@\"... etc.) but it was insecure \n# so instead now we define the params we want to be accessible and required.\n\t\tif @user.save\t\t\t\n# Handles a successful save\n\t\t\tsign_in @user\n\t\t\tflash[:success] = \"Welcome to Winecards!\"\n\t\t\tredirect_to @user\n\t\telse\n\t\t\trender 'new'\n\t\tend\n\tend",
"def create\n @user = User.new(params[:user])\n if @user.save\n redirect_to users_path\n else\n redirect_to new_user_path\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n flash[:success] = 'User created!'\n redirect_to login_path\n else\n flash[:danger] = @user.errors.full_messages\n redirect_to signup_path\n end\n end",
"def create\n @user = User.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n birth_date: params[:birth_date],\n height: params[:height],\n weight: params[:weight],\n user_name: params[:user_name],\n password: params[:password],\n password_confirmation: params[:password_confirmation],\n facebook_url: params[:facebook_url],\n twitter_url: params[:twitter_url],\n instagram_url: params[:instagram_url],\n address: params[:address],\n email: params[:email]\n ) \n if @user.save!\n render 'successful.json.jb', status: :created\n else\n render 'unsuccessful.json.jb', status: :bad_request\n end\n end",
"def create\n puts \"******* create *******\"\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n\n up = user_params\n\n if up[:name].present?\n up[:first_name] = up[:name].split(' ')[0]\n up[:last_name] = up[:name].split(' ')[1]\n up.delete :name\n end\n @user = User.new(up)\n\n respond_to do |format|\n if @user.save\n # render json: {user: user, token: token}\n\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: api_user_url(@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 create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\tredirect_to login_path\n\t\telse\n\t\t\trender :new\n\t\tend\n\tend",
"def create\n @user = User.new(user_params)\n if @user.save\n redirect_to user_path(@user)\n else\n render :new\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # user_params.permit(:first_name, :last_name, :email, :password, :password_confirmation)\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.new(user_params)\n \n if user.save\n token = JsonWebToken.encode(user_id: user.id)\n render json: { auth_token: token, user: AuthUserSerializer.new(user).serializable_hash }, status: 201\n else \n render json: { errors: user.errors.full_messages }, status: 400\n end\n end",
"def create\n raise\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'Usuário foi inserido com sucesso' }\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 create\n @user = User.new(user_params)\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user }\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 create\n @user = User.new(user_params)\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.83630896",
"0.8006522",
"0.7971518",
"0.7955403",
"0.7955403",
"0.79353535",
"0.79224926",
"0.78954744",
"0.78931195",
"0.7859713",
"0.78448313",
"0.78405404",
"0.7831208",
"0.78295004",
"0.78252316",
"0.78247285",
"0.78056234",
"0.77924716",
"0.77924716",
"0.7787343",
"0.7786698",
"0.7760007",
"0.7746696",
"0.7737893",
"0.77355087",
"0.7727481",
"0.77231526",
"0.7717164",
"0.77141124",
"0.77081394",
"0.77072275",
"0.77072275",
"0.7704426",
"0.77002954",
"0.7699822",
"0.7676297",
"0.76747614",
"0.7673336",
"0.76716155",
"0.7668942",
"0.7657722",
"0.7647438",
"0.764685",
"0.76464415",
"0.76428723",
"0.76303846",
"0.76294744",
"0.7625827",
"0.76257205",
"0.7622482",
"0.76219106",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7620637",
"0.7619985",
"0.76167136",
"0.76163965",
"0.76141423",
"0.7613912",
"0.76074606"
] |
0.78221184
|
16
|
If authorized, return the loggedin user information based on different conditionals: user has profile image and previous geolocation coordinates.
|
def auth
@user = current_user
render json: @user
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def user_info\n auth_hash['user_info']\n end",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info['query']['results'][\"profile\"]\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 user_info\n\t\t@user_info ||= fetch_latest_user_info\n\tend",
"def user_location_info\n if current_user.present? && current_user.current_sign_in_ip != \"127.0.0.1\"\n @user_info = Geocoder.search(current_user.current_sign_in_ip).first\n elsif request.remote_ip != \"127.0.0.1\"\n @user_info = Geocoder.search(request.remote_ip).first \n # else #static ip for unit testing \n # @user_info= Geocoder.search(\"213.180.204.26\").first\n end \n return @user_info\n end",
"def user_info\n @user_info ||= raw_info\n end",
"def current_user_info\n\t\trespond_to do |format|\n\t\t\tif !current_user\n\t\t\t\tformat.json { render json: { 'User' => 'not logged in' } }\n\t\t\telse\n\t\t\t\tformat.json { render json: { 'Name' => current_user.name, 'Image' => getFacebookPicURL(current_user) } }\n\t\t\tend\n\t\tend\n\tend",
"def user_info(comment)\n if comment.user_nickname.present?\n comment.user_nickname + (comment.user_location ? \" (%s)\" % comment.user_location : \"\")\n else\n \"anonymous\"\n end\n end",
"def userinfo?\n @userinfo = session[:userinfo] = request.env['omniauth.auth'][:extra][:raw_info]\n\n # No email address, reject\n return login_failed 'Email required.' unless @userinfo[:email]\n\n @email = @userinfo[:email]\n @auth0_id = @userinfo[: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 logged_in_user\n unless logged_in?\n render json: false, status: :unauthorized\n # store_location\n end\n end",
"def profile\n @user = current_user_with_auths\n @connected = @user.authorizations.collect{|a| a.provider}\n @to_connect = providers - @connected\n unless @user\n redirect_to root_path, :notice => \"Sorry, try logging back in\"\n end\n end",
"def get_user_info\n response = send_method(:get_user_info)\n user_from(response)\n end",
"def raster_profile_picture(user)\n if user.authentications.where(:provider == \"Facebook\").any?\n fb_picture(user)\n elsif user.authentications.where(:provider == \"Twitter\").any?\n twitter_picture(user, type: \"normal\") \n else\n image_tag user.avatar.url(:raster), class: \"img-circle small_profile_picture\"\n end\n end",
"def actual_user\n if @current_user.nil? || session[:cas_user] != @current_user.cas_directory_id\n update_current_user(User.eager_load(*eager_loads).find_by(cas_directory_id: session[:cas_user]))\n end\n @current_user\n end",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info[\"person\"]\n end",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info\n end",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info\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 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 raw_info\n @raw_info ||= access_token.get('/api/me', :headers => {'Accept' => \"application/json; version=1\" }).parsed['payload']['users'].first || {}\n end",
"def get_logged_in_user\n if @logged_in\n if Student.exists?(session[:id])\n @logged_in_user = Student.find(session[:id])\n elsif Marker.exists?(session[:id])\n @logged_in_user = Marker.find(session[:id])\n end\n end\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 user_from_session\n user = user_from_claims\n return user unless session[:auth0_json]\n raw = JSON.parse(session[:auth0_json] || '{}').with_indifferent_access.fetch(:extra, {}).fetch(:raw_info, {})\n user.email = raw.fetch(:email, user.email)\n user.picture = raw.fetch(:picture, user.picture)\n user.user_metadata = raw.fetch(:user_metadata, user.user_metadata)\n user\n end",
"def user_info\n {\n 'nickname' => user_hash['NickName'],\n 'name' => user_hash['NickName']\n }\n end",
"def current_user_with_oauth\n current_user_without_oauth || current_oauth_user\n end",
"def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end",
"def get_user_info\n userTokenInfo = request.env['oauth.token']\n @user = userTokenInfo.user\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 get_user\n @user = current_user\n @is_logged_in = user_signed_in? #true fals\n @is_user = @is_logged_in && @user.role =='user'\n @is_admin = @is_logged_in && @user.role =='admin'\n end",
"def user_info\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n\n respond_to do |format|\n name = @current_user.name\n username = @current_user.username\n format.json {\n render json: {\n :name => name,\n :username => username,\n }.to_json, status: 200\n }\n end\n end",
"def userinfo\n if @user.nil?\n nil\n elsif @password.nil?\n @user\n else\n @user + ':' + @password\n end\n end",
"def normalized_userinfo\n normalized_user + (password ? \":#{normalized_password}\" : \"\") if userinfo\n end",
"def user_coordinates\n self.user_located? ? LocationCoordinate.new(self.userLocation.location.coordinate) : nil\n end",
"def get_current_user(email='', first_name='', last_name='')\n current_user.present? ? current_user : {user_id: nil, email: email, first_name: first_name, last_name: last_name}\n end",
"def user_information\n { \"username\": @user.username, \"email\": @user.email, \"id\": @user.id }\n end",
"def current_user\n # authorization initialization if not run yet\n # (in the case of paper_trial it might not have run)\n authorization_init\n @logged_in_user\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 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 profile\n\t\t\n\t\tif !current_user\n\t\t\tredirect_to root_url and return\n\t\tend\n\t\t\n\t\t@user = current_user\n\t\t\n\tend",
"def get_user_logged_in\n\t\tif current_user != nil\n\t\t\treturn 'Currently signed in as: ' + current_user.forename + ' ' + current_user.surname\n\t\telse\n\t\t\treturn 'You are not logged in!'\n\t\tend\n\tend",
"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_current_user_profile_image\n if ProfileImage.find_by(user_id: get_current_user.id).image_base64 != \"\"\n return ProfileImage.find_by(user_id: get_current_user.id)\n else\n return \"/img/logo/small-logo.png\"\n end\n end",
"def get_user\n\t\tif starting_location_dl.present?\n\t\t\tstarting_location_dl.user\n\t\telsif ending_location_dl.present?\n\t\t\tending_location_dl.user\n\t\telsif starting_location_meeting.present?\n\t\t\tstarting_location_meeting.user\n\t\telsif ending_location_meeting.present?\n\t\t\tending_location_meeting.user\n\t\tend\n\tend",
"def userinfo\n object.fetch(:userinfo) {\n @object[:userinfo] = (format_userinfo(\"\") if @object[:user])\n }\n end",
"def profile\n\t\t@user = User.find(current_user)\n\tend",
"def user_check\n if user_signed_in?\n render status: :ok, json: current_user\n else\n render status: :forbidden, nothing: true\n end\n end",
"def profile\n # (1) the request go into the headers and grab the key authorization and give us the value back (this's the token our server gave us originally)\n # the server only knows about the system\n # byebug/\n token = request.headers[\"Authorization\"]\n # what makes it secure? only the server knows about the secret 'pegasuscode'; the data is encoded using this secret, only server knows it so when server gets the information back, it must be the same information server encoded using the secret. Otherwise, it will break.\n # server uses the secret to encode and decode information\n decoded_token = JWT.decode(token, 'pegasuscode', true, { algorithm: 'HS256' })\n\n user_id = decoded_token[0][\"user_id\"] # user id\n\n user = User.find(user_id)\n\n # get the user back\n render json: user\n end",
"def actual_user\n if @current_user.nil? || session[:cas][:user] != @current_user.cas_directory_id\n update_current_user(User.find_by(cas_directory_id: session[:cas][:user]))\n end\n @current_user\n end",
"def user\n {id: object.user.id, username: object.user.username, avatar: object.user.avatar}\n end",
"def user_info\n response = from_server \"api/user.json\"\n response.data\n end",
"def load_user_and_authorization\n @owner_user = User.find( params[:user_id] )\n @current_user_is_owner = ( current_user_id == params[:user_id].to_i )\n end",
"def info\n oauth_response = access_token.get \"/api/v1/users/current.json\"\n JSON.parse(oauth_response.body)\n end",
"def prefill_if_logged_in(data)\n return if Person.current.anonymous?\n data.name ||= Person.current.name\n data.email ||= Person.current.email\n end",
"def current\n if current_user\n current_user.update!(last_login: Time.zone.now)\n render json: current_user\n else\n not_auth\n end\n end",
"def profile\n\t\t@user = current_user\n\tend",
"def user()\n return @data[\"access\"][\"user\"]\n end",
"def authenticate_profile!\n if logged_in?\n raise ProfileNotSetup unless current_user.profile\n else\n store_location and raise NotLoggedIn\n end\n end",
"def fluidfeatures_current_user(verbose=false)\n if current_user\n if verbose\n {\n :id => @current_user[:id],\n :name => @current_user[:name],\n :uniques => {\n :twitter => @current_user[:twitter_id]\n },\n :cohorts => {\n # Example attributes for the user.\n # These can be any fields you wish to select users by.\n :company => {\n # \"display\" is used to help you find it in the dashboard.\n # Highly recommended unless you work with ids.\n # This display name can change over time without consequence. \n :display => @current_user[:company_name],\n # \"id\" should be unique this this cohort and must be static\n # over time.\n :id => @current_user[:company_id]\n },\n # For this boolean cohort \"true\"|\"false\" is the \"display\"\n # and the \"id\"\n :admin => @current_user[:admin]\n }\n }\n else\n {\n :id => @current_user.id\n }\n end\n else\n end\n end",
"def user_profile\n @current_user = current_user\n\n if params[:id] == 'me'\n @user = @current_user\n else\n @user = User.find_by_id(params[:id])\n end\n end",
"def build_user_hash\n user = {id: self.id.to_s,\n first_name: self.first_name,\n last_name: self.last_name,\n email: self.email,\n user_name: self.user_name,\n pin: self.pin,\n created_at: self.created_at\n }\n user[:normal_avatar] = self.avatar.url || \"res://avatardefault\"\n user[:thumb_avatar] = self.avatar.thumb.url || \"res://avatardefault\"\n user[:like_count] = self.likes.count if self.likes\n return user\n end",
"def current_user\n if session[:user_id].present?\n user_id = session[:user_id]\n user_type = session[:user_type]\n @current_user ||= find_user_by_type(user_type, user_id)\n elsif cookies.signed[:user_id].present?\n user_id = cookies.signed[:user_id]\n user_type = cookies[:user_type]\n user = find_user_by_type(user_type, user_id)\n\n if user and user.authenticated?(:remember, cookies[:remember_token])\n log_in(user, user_type)\n @current_user = user\n else\n forget(user)\n end # if user and user.authenticated?\n end # if session[:user_id] / elsif \n end",
"def current_user\n user_id = get_log_in_session\n if user_id\n get_user(user_id)\n else\n user = get_user(cookies.signed['user_id'])\n if user&.authenticated?(:remember, cookies[:remember_token])\n set_log_in_session user\n user\n end\n end\n end",
"def current_user\n data[:users][@current_user['id']] ||= @current_user\n data[:identities][@current_user_identity['id']] ||= @current_user_identity\n\n @current_user\n end",
"def info(refresh = false)\n return @info if @info and not refresh\n\n begin\n cache_info(nil) # reset existing info\n info = @api.get_account_info['user']\n cache_info(info)\n rescue Api::NotAuthorized, Api::InvalidInput\n nil\n end\n end",
"def current_user\n \n # Normally we would look in the session to see if there is a user_id \n # to figure out if the user is loggged in.\n # For demo purposes this app randomly picks if the user is logged in\n if rand(100) > 20 \n User.last\n else\n nil\n end\n end",
"def current_user\n token_locations = [cookies[:auth_token], ENV['DANGEROUS_AUTH_HACK'], params[:auth_token]]\n token = token_locations.find{|x| !x.blank? }\n if token\n Identity.includes(:person).find_by(token: token).try(:person)\n else\n nil\n end\n end",
"def load_user_if_logged_in\n if user?\n @user = current_user\n else\n @user = nil\n end\n return true\nend",
"def profile\n @user = current_user\n end",
"def current_user\n # this should be:\n # BGoodUser.find_by auth0_id: session[:userinfo][:uid]\n @current_user = BGoodUser.find_by auth0_id: current_auth0_user[\"uid\"] if user_signed_in?\n end",
"def get_cur_user\n @user = nil\n if is_logged_in session\n @user = User.find_by_sunet(session[:user_hash][\"username\"])\n end\n render json: @user\n end",
"def get_cur_user\n @user = nil\n if is_logged_in session\n @user = User.find_by_sunet(session[:user_hash][\"username\"])\n end\n render json: @user\n end",
"def get_user_from_session\n authorize()\n @user = @current_user\n end",
"def require_login\n if current_user\n gon.current_user_email = current_user.email\n gon.current_user_created_at = current_user.created_at.to_i\n gon.current_user_username = current_user.username.capitalize\n gon.current_user_id = current_user.id\n gon.current_user_coaching_intensity = current_user.preference.coaching_intensity\n gon.current_user_last_login_at = current_user.last_login_at\n\n else\n store_location\n flash[:notice] = \"You must be logged in to access this page\"\n redirect_to login_url\n end\n end",
"def user_hash\n @user_hash ||= MultiJson.decode(@access_token.get('/services/api/json/1.2.2/?method=smugmug.auth.checkAccessToken').body)['Auth']['User']\n end",
"def userinfo\n unless defined?(@userinfo)\n @userinfo = solr_url.userinfo if solr_url\n user = user_configuration_from_key('solr', 'user')\n pass = user_configuration_from_key('solr', 'pass')\n @userinfo ||= [ user, pass ].compact.join(\":\") if user && pass\n @userinfo ||= default_userinfo\n end\n @userinfo\n end",
"def profile\n @profile = current_user\n end",
"def current_user\n unless request.format.json?\n @current_user ||= User.find_by_auth_token(cookies[:auth_token]) if cookies[:auth_token]\n end\n @current_user\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\t@labelFirstName.text = \"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\t@profilePic.userID = user[ :id ]\n\t\t@loggedInUser = user\n\tend",
"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 verify_user!\n @profile = current_user.profile\n end",
"def verify_user!\n @profile = current_user.profile\n end",
"def logged_in_user\n if (!logged_in?)\n return User.logged_out_user\n end\n #return nil if !logged_in?\n return session[\"app_user\"]\n end",
"def logged_in\n #checks to see if a current user is available \n \n if @current_user\n render json: {\n logged_in: true,\n user: @current_user\n }\n else \n render json: {\n logged_in: false\n }\n end \n\n end",
"def current_user\n if Rails.application.config.use_omniauth\n return nil unless session[:user_info]\n @current_user ||= User.find_user_from_omniauth(session[:user_info])\n else\n @current_user ||= User.where(username: request.env['aker.check'].user.username).first\n end\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 current_user\n @user || @api_user || @social_user\n end",
"def show\n {\n id: @current_user.id,\n first_name: @current_user.first_name,\n last_name: @current_user.last_name,\n email: @current_user.email,\n role_name: @current_user.super_admin ? 'Super Admin' : @current_user.role.try(:name),\n permissions: Permissions::Builder.user_permissions(@current_user)\n }\n end",
"def logged_in_user\n if session[:user]\n if session[:user].to_i < 1\n @logged_in_user = Person.new\n elsif !@logged_in_user || @logged_in_user.id != session[:user].to_i\n @logged_in_user = Person.find session[:user].to_i\n end\n end\n \n @logged_in_user\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end"
] |
[
"0.68944895",
"0.6792831",
"0.67667216",
"0.648974",
"0.64877",
"0.6427148",
"0.64122933",
"0.64032084",
"0.6386255",
"0.6381735",
"0.636093",
"0.63083535",
"0.6277406",
"0.6266921",
"0.6258286",
"0.62361145",
"0.6229214",
"0.6229214",
"0.61505204",
"0.61495095",
"0.61393285",
"0.6138403",
"0.61374176",
"0.61348945",
"0.61335605",
"0.6114943",
"0.6092475",
"0.6090625",
"0.6065599",
"0.60649216",
"0.6052809",
"0.60461134",
"0.6042328",
"0.60044765",
"0.5988255",
"0.5983664",
"0.59756637",
"0.596135",
"0.59564203",
"0.59518045",
"0.5942512",
"0.59419227",
"0.59401244",
"0.5937724",
"0.5921269",
"0.59141415",
"0.5911489",
"0.5906699",
"0.5901163",
"0.5888501",
"0.5883899",
"0.587562",
"0.5857005",
"0.58564824",
"0.5851163",
"0.5842141",
"0.5841996",
"0.5841409",
"0.5834846",
"0.583291",
"0.5829642",
"0.58241886",
"0.58217216",
"0.5820475",
"0.5798685",
"0.5779029",
"0.5775915",
"0.5773285",
"0.5772931",
"0.57716364",
"0.5758222",
"0.575411",
"0.575411",
"0.57522297",
"0.57488155",
"0.57473594",
"0.57466453",
"0.57460064",
"0.57423615",
"0.57342863",
"0.5730703",
"0.5720258",
"0.5720258",
"0.57145125",
"0.5708224",
"0.5705873",
"0.57007074",
"0.56929594",
"0.56918424",
"0.5688709",
"0.568782",
"0.568782",
"0.568782",
"0.568782",
"0.568782",
"0.568782",
"0.568782",
"0.568782",
"0.568782",
"0.568782",
"0.568782"
] |
0.0
|
-1
|
A simple structure to use as the content for the nodes. Create this structure for the tests ++ | ROOT | +++ | | ++ ++ CHILD1 | | ++ | | ++ ++ CHILD2 | | ++ | | ++ ++ ++ CHILD3 ++ CHILD4 | ++ ++ Some basic setup to create the nodes for the test tree.
|
def setup
@root = Tree::TreeNode.new("ROOT", "Root Node")
@child1 = Tree::TreeNode.new("Child1", "Child Node 1")
@child2 = Tree::TreeNode.new("Child2", "Child Node 2")
@child3 = Tree::TreeNode.new("Child3", "Child Node 3")
@child4 = Tree::TreeNode.new("Child4", "Grand Child 1")
@child5 = Tree::TreeNode.new("Child5", "Child Node 4")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def setup_test_tree\n @root << @child1\n @root << @child2\n @root << @child3 << @child4\n end",
"def test_root_setup\n assert_not_nil(@root , \"Root cannot be nil\")\n assert_nil(@root.parent , \"Parent of root node should be nil\")\n assert_not_nil(@root.name , \"Name should not be nil\")\n assert_equal(\"ROOT\" , @root.name, \"Name should be 'ROOT'\")\n assert_equal(\"Root Node\" , @root.content, \"Content should be 'Root Node'\")\n assert(@root.is_root? , \"Should identify as root\")\n assert(!@root.has_children? , \"Cannot have any children\")\n assert(@root.has_content? , \"This root should have content\")\n assert_equal(1 , @root.size, \"Number of nodes should be one\")\n assert_equal(0, @root.siblings.length, \"This root does not have any children\")\n assert_equal(0, @root.in_degree, \"Root should have an in-degree of 0\")\n assert_equal(0, @root.node_height, \"Root's height before adding any children is 0\")\n assert_raise(ArgumentError) { Tree::TreeNode.new(nil) }\n end",
"def generate_tree\n root =\tTreeNode.new(3)\n root.left =\tTreeNode.new(9)\n right = \t\tTreeNode.new(20)\n right.left = \tTreeNode.new(15)\n right.right = TreeNode.new(7)\n root.right = \tright\n root\nend",
"def initialize\n @root_node = Node.new\n end",
"def test_initialize\n assert_not_nil(@root, \"Binary tree's Root should have been created\")\n assert_nil(@root.left_child, \"The initial left child of root should be nil\")\n assert_nil(@root.right_child, \"The initial right child of root should be nil\")\n assert_equal(@root.children.size, 0, \"Initially no children should be present\")\n end",
"def create_test_node\n parent = @root\n File.open(@file_name, \"r\") do |f|\n f.each_with_index do |line, index|\n \n if index == 0\n @stack = []\n @stack.push(@root)\n end\n line.chomp!\n next if line.empty? || line.nil?\n prelim_whitespace = 0\n line.each_byte do |byte|\n break if byte != 32\n prelim_whitespace += 1\n end\n stripped_line = line.strip\n next if stripped_line.nil? || stripped_line.empty?\n token_line = stripped_line.split\n #accounts for Cucumber colons\n first_token = token_line[0].gsub(/:/,' ').downcase.strip\n last_token = token_line[-1].strip\n\n case stripped_line\n when /^context/, /^describe/, /^Feature:/, /^Feature/, /^RSpec.describe/\n node = Tree.new(format_description(line, first_token), prelim_whitespace)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = first_token\n \n @stack.push(node)\n when /^it/, /^Scenario/, /^Scenario:/\n node = Tree.new(format_description(line, first_token), prelim_whitespace)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = first_token\n \n if stripped_line =~ /do$/\n @stack.push(node)\n end\n when /^def/, /do$/, /do.*$/\n node = Tree.new(first_token, prelim_whitespace)\n node.file_name = @file_name\n node.structure_marker = first_token\n \n @stack.push(node)\n when /^end/\n @stack.pop\n else\n end\n end\n end\n @root\n end",
"def create_test_node\n parent = @root\n File.open(@file_name, \"r\") do |f|\n f.each_with_index do |line, index|\n \n if index == 0\n @stack = []\n @stack.push(@root)\n end\n line.chomp!\n next if line.empty? || line.nil?\n prelim_whitespace = 0\n line.each_byte do |byte|\n break if byte != 32\n prelim_whitespace += 1\n end\n stripped_line = line.strip\n next if stripped_line.nil? || stripped_line.empty?\n token_line = stripped_line.split\n #accounts for Cucumber colons\n first_token = token_line[0].gsub(/:/,' ').downcase.strip\n last_token = token_line[-1].strip\n\n case stripped_line\n when /^context/, /^describe/, /^Feature:/, /^Feature/, /^RSpec.describe/\n node = Tree.new(format_description(line, first_token), prelim_whitespace)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = first_token\n \n @stack.push(node)\n when /^it/, /^Scenario/, /^Scenario:/\n node = Tree.new(format_description(line, first_token), prelim_whitespace)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = first_token\n \n if stripped_line =~ /do$/\n @stack.push(node)\n end\n when /^def/, /do$/, /do.*$/\n node = Tree.new(first_token, prelim_whitespace)\n node.file_name = @file_name\n node.structure_marker = first_token\n \n @stack.push(node)\n when /^end/\n @stack.pop\n else\n end\n end\n end\n @root\n end",
"def test_root\n setup_test_tree\n\n # TODO: Should probably change this logic. Root's root should\n # return nil so that the possibility of a recursive error does not exist\n # at all.\n assert_same(@root , @root.root, \"Root's root is self\")\n assert_same(@root , @child1.root, \"Root should be ROOT\")\n assert_same(@root , @child4.root, \"Root should be ROOT\")\n assert_equal(2 , @root.node_height, \"Root's height after adding the children should be 2\")\n end",
"def test_each\n setup_test_tree\n\n assert(@root.has_children?, \"Should have children\")\n assert_equal(5, @root.size, \"Should have five nodes\")\n assert(@child3.has_children?, \"Should have children\")\n\n nodes = []\n @root.each { |node| nodes << node }\n\n assert_equal(5, nodes.length, \"Should have FIVE NODES\")\n assert(nodes.include?(@root), \"Should have root\")\n assert(nodes.include?(@child1), \"Should have child 1\")\n assert(nodes.include?(@child2), \"Should have child 2\")\n assert(nodes.include?(@child3), \"Should have child 3\")\n assert(nodes.include?(@child4), \"Should have child 4\")\n end",
"def initialize()\n @root = Node.new(nil)\n end",
"def build_tree\n t = RDTree.new\n t.add_node(0, DummyRoot)\n root = root_node_of\n t.add_edge(0, root.attributes[\"ID\"])\n do_build_tree(root, 1, t) \n t\n end",
"def test_print_tree\n setup_test_tree\n #puts\n #@root.print_tree\n end",
"def create_java_test_node\n File.open(@file_name, \"r\") do |f|\n f.each_with_index do |line, index|\n if index == 0\n @stack = []\n @stack.push(@root)\n parent = @root\n end\n line.chomp!\n next if line.empty? || line.nil?\n prelim_whitespace = 0\n line.each_byte do |byte|\n break if byte != 32\n prelim_whitespace += 1\n end\n\n stripped_line = line.strip\n next if stripped_line.nil? || stripped_line.empty?\n\n case stripped_line\n when /^package/\n node = Tree.new(format_java_description(line), prelim_whitespace)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'package'\n @stack.push(node)\n when /^public class/\n node = Tree.new(format_java_description(line), prelim_whitespace)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'java_class'\n @stack.push(node)\n when /^public void/\n node = Tree.new(format_java_description(line), prelim_whitespace)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'test'\n else\n end\n end\n end\n @root\n end",
"def create_java_test_node\n File.open(@file_name, \"r\") do |f|\n f.each_with_index do |line, index|\n if index == 0\n @stack = []\n @stack.push(@root)\n parent = @root\n end\n line.chomp!\n next if line.empty? || line.nil?\n prelim_whitespace = 0\n line.each_byte do |byte|\n break if byte != 32\n prelim_whitespace += 1\n end\n\n stripped_line = line.strip\n next if stripped_line.nil? || stripped_line.empty?\n\n case stripped_line\n when /^package/\n node = Tree.new(format_java_description(line), prelim_whitespace)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'package'\n @stack.push(node)\n when /^public class/\n node = Tree.new(format_java_description(line), prelim_whitespace)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'java_class'\n @stack.push(node)\n when /^public void/\n node = Tree.new(format_java_description(line), prelim_whitespace)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'test'\n else\n end\n end\n end\n @root\n end",
"def initialize\n @root = Node.new\n @current_node = @root\n end",
"def test_children\n setup_test_tree\n\n assert(@root.has_children?, \"Should have children\")\n assert_equal(5, @root.size, \"Should have five nodes\")\n assert(@child3.has_children?, \"Should have children\")\n assert(!@child3.is_leaf?, \"Should not be a leaf\")\n\n assert_equal(1, @child3.node_height, \"The subtree at Child 3 should have a height of 1\")\n for child in [@child1, @child2, @child4]\n assert_equal(0, child.node_height, \"The subtree at #{child.name} should have a height of 0\")\n end\n\n children = []\n for child in @root.children\n children << child\n end\n\n assert_equal(3, children.length, \"Should have three direct children\")\n assert(!children.include?(@root), \"Should not have root\")\n assert(children.include?(@child1), \"Should have child 1\")\n assert(children.include?(@child2), \"Should have child 2\")\n assert(children.include?(@child3), \"Should have child 3\")\n assert(!children.include?(@child4), \"Should not have child 4\")\n\n children.clear\n children = @root.children\n assert_equal(3, children.length, \"Should have three children\")\n end",
"def test_each_leaf\n setup_test_tree\n\n nodes = []\n @root.each_leaf { |node| nodes << node }\n\n assert_equal(3, nodes.length, \"Should have THREE LEAF NODES\")\n assert(!nodes.include?(@root), \"Should not have root\")\n assert(nodes.include?(@child1), \"Should have child 1\")\n assert(nodes.include?(@child2), \"Should have child 2\")\n assert(!nodes.include?(@child3), \"Should not have child 3\")\n assert(nodes.include?(@child4), \"Should have child 4\")\n end",
"def create_csharp_test_node\n @stack = []\n @stack.push(@root)\n @test_case_stack = []\n csharp_regex = Regexp.union([/^namespace/, /^public/, /^\\[TestFixture\\]/, /^\\[Test\\]/, /^\\[TestCase/])\n original_file_string = File.read(@file_name)\n lines = original_file_string.split(\"\\n\")\n lines = lines.each do |line|\n line.gsub!(\"()\",\"\") \n line.gsub!(\";\",\"\")\n line.gsub!(\"async\",\"\") \n line.gsub!(\"Task\",\"\")\n line.gsub!(\"void\",\"\")\n line.gsub!(\"class\",\"\")\n line.strip!\n end\n\n relevant_lines_ary = lines.keep_if do |line|\n !csharp_regex.match(line).nil? && line != \"\"\n end\n relevant_lines_ary.each_cons(3) do |previous, current, nekst|\n first_token = current.split[0].strip\n previous_first_token = previous.split[0].strip\n if first_token == 'namespace'\n second_token = current.split[1].strip\n node = Tree.new(second_token)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'namespace'\n @stack.push(node)\n elsif first_token == \"[TestFixture]\"\n nekst_second_token = nekst.split[1].strip\n node = Tree.new(nekst_second_token)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'test_fixture'\n @stack.push(node)\n elsif first_token == \"[Test]\"\n nekst_second_token = nekst.split[1].strip\n node = Tree.new(nekst_second_token)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'test'\n @stack.push(node)\n elsif /^\\[TestCase/ =~ current \n first_token = first_token.gsub!(/[\\[\\]()]|TestCase/,\"\").strip\n node = Tree.new(first_token)\n node.file_name = @file_name\n node.structure_marker = 'test'\n @test_case_stack.push(node)\n if nekst && nekst.split[0]\n nekst_first_token = nekst.split[0].strip\n end\n if !(/^public/ =~ nekst_first_token)\n if nekst.split[1]\n nekst_second_token = nekst.split[1].strip\n end\n parent = Tree.new(nekst_second_token)\n parent.file_name = @file_name\n parent.structure_marker = 'test'\n parent_of_parent = fetch_parent(@stack, parent)\n parent.parent = parent_of_parent\n while !@test_case_stack.empty?\n test_case = @test_case_stack.pop\n parent.children << test_case\n test_case.parent = parent\n end\n end\n elsif( !(/^\\[TestCase/ =~ first_token) && (/^\\[TestCase/ =~ previous_first_token) )\n next\n else\n end\n end\n @root\n end",
"def create_csharp_test_node\n @stack = []\n @stack.push(@root)\n @test_case_stack = []\n csharp_regex = Regexp.union([/^namespace/, /^public/, /^\\[TestFixture\\]/, /^\\[Test\\]/, /^\\[TestCase/])\n original_file_string = File.read(@file_name)\n lines = original_file_string.split(\"\\n\")\n lines = lines.each do |line|\n line.gsub!(\"()\",\"\") \n line.gsub!(\";\",\"\")\n line.gsub!(\"async\",\"\") \n line.gsub!(\"Task\",\"\")\n line.gsub!(\"void\",\"\")\n line.gsub!(\"class\",\"\")\n line.strip!\n end\n\n relevant_lines_ary = lines.keep_if do |line|\n !csharp_regex.match(line).nil? && line != \"\"\n end\n relevant_lines_ary.each_cons(3) do |previous, current, nekst|\n first_token = current.split[0].strip\n previous_first_token = previous.split[0].strip\n if first_token == 'namespace'\n second_token = current.split[1].strip\n node = Tree.new(second_token)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'namespace'\n @stack.push(node)\n elsif first_token == \"[TestFixture]\"\n nekst_second_token = nekst.split[1].strip\n node = Tree.new(nekst_second_token)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'test_fixture'\n @stack.push(node)\n elsif first_token == \"[Test]\"\n nekst_second_token = nekst.split[1].strip\n node = Tree.new(nekst_second_token)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'test'\n @stack.push(node)\n elsif /^\\[TestCase/ =~ current \n first_token = first_token.gsub!(/[\\[\\]()]|TestCase/,\"\").strip\n node = Tree.new(first_token)\n node.file_name = @file_name\n node.structure_marker = 'test'\n @test_case_stack.push(node)\n if nekst && nekst.split[0]\n nekst_first_token = nekst.split[0].strip\n end\n if !(/^public/ =~ nekst_first_token)\n if nekst.split[1]\n nekst_second_token = nekst.split[1].strip\n end\n parent = Tree.new(nekst_second_token)\n parent.file_name = @file_name\n parent.structure_marker = 'test'\n parent_of_parent = fetch_parent(@stack, parent)\n parent.parent = parent_of_parent\n while !@test_case_stack.empty?\n test_case = @test_case_stack.pop\n parent.children << test_case\n test_case.parent = parent\n end\n end\n elsif( !(/^\\[TestCase/ =~ first_token) && (/^\\[TestCase/ =~ previous_first_token) )\n next\n else\n end\n end\n @root\n end",
"def test_has_children_eh\n setup_test_tree\n assert(@root.has_children?, \"The Root node MUST have children\")\n end",
"def setup\n size(800, 200)\n new_tree\nend",
"def test_new_tree_empty_root\n assert_equal nil, @tree.root\n end",
"def init_simple_tree\n @root_org = Org.create(name: 'root')\n @lv1_child_org = Org.create(name: 'lv1')\n @lv1_child_org2 = Org.create(name: 'lv1-2')\n @lv2_child_org = Org.create(name: 'lv2')\n @lv2_child_org2 = Org.create(name: 'lv2-2')\n @lv2_child_org3 = Org.create(name: 'lv2-3')\n @lv2_child_org4 = Org.create(name: 'lv2-4')\n @lv3_child_org = Org.create(name: 'lv3')\n @lv3_child_org2 = Org.create(name: 'lv3-2')\n @lv4_child_org = Org.create(name: 'lv4')\n @lv4_child_org2 = Org.create(name: 'lv4-2')\n @lv5_child_org = Org.create(name: 'lv5')\n @lv5_child_org2 = Org.create(name: 'lv5-2')\n\n current_time = Time.now\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @root_org.id,\n distance: 0,\n start_time: 10.minutes.ago(current_time),\n end_time: 1000.years.from_now,\n scope_name: 'default'\n )\n\n # 10 minutes ago\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org.id,\n distance: 1,\n start_time: 10.minutes.ago(current_time),\n end_time: current_time,\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv1_child_org.id,\n distance: 2,\n start_time: 10.minutes.ago(current_time),\n end_time: current_time,\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org.id,\n child_id: @lv1_child_org.id,\n distance: 1,\n start_time: 10.minutes.ago(current_time),\n end_time: current_time,\n scope_name: 'default'\n )\n\n # now\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv1_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv1_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv2_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org2.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv2_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org3.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org2.id,\n child_id: @lv2_child_org3.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org4.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org2.id,\n child_id: @lv2_child_org4.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv3_child_org.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv3_child_org.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org.id,\n child_id: @lv3_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv4_child_org.id,\n distance: 4,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv4_child_org.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org.id,\n child_id: @lv4_child_org.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv3_child_org.id,\n child_id: @lv4_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv5_child_org.id,\n distance: 5,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv5_child_org.id,\n distance: 4,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org.id,\n child_id: @lv5_child_org.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv3_child_org.id,\n child_id: @lv5_child_org.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv4_child_org.id,\n child_id: @lv5_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv3_child_org2.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv3_child_org2.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org2.id,\n child_id: @lv3_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv4_child_org2.id,\n distance: 4,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv4_child_org2.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org2.id,\n child_id: @lv4_child_org2.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv3_child_org2.id,\n child_id: @lv4_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv5_child_org2.id,\n distance: 5,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv5_child_org2.id,\n distance: 4,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org2.id,\n child_id: @lv5_child_org2.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv3_child_org2.id,\n child_id: @lv5_child_org2.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv4_child_org2.id,\n child_id: @lv5_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\nend",
"def root_node; end",
"def make_tree_for(position)\n root = TreeNode.new(nil, position)\n\n\nend",
"def create_hiera_template\n options = {ssh_key: Bebox::Project.public_ssh_key_from_file(project_root, environment), project_name: Bebox::Project.shortname_from_file(project_root)}\n Bebox::Provision.generate_hiera_for_steps(self.project_root, \"node.yaml.erb\", self.hostname, options)\n end",
"def runTest()\n\tareaWidth = rand(80..140)\n\tareaHeight = rand(40..80)\n\tsubdivisions = rand(3..6)\n\tbspTree = Tree.new([areaWidth, areaHeight, subdivisions])\n\tcreateTextOutput(bspTree, areaWidth, areaHeight, subdivisions)\nend",
"def initialize(node)\n @root_node = node\n end",
"def test_initialize_node\n \tassert_equal @n.id, 0\n \tassert_equal @n.neighbors, []\n \tassert_equal @n.string, \"a\"\n end",
"def initialize\n @root = {}\n end",
"def test_first_child\n setup_test_tree\n\n assert_equal(@child1, @root.first_child, \"Root's first child is Child1\")\n assert_nil(@child1.first_child, \"Child1 does not have any children\")\n assert_equal(@child4, @child3.first_child, \"Child3's first child is Child4\")\n end",
"def tree\r\n @rootNode\r\n end",
"def create\n create_hiera_template\n create_manifests_node\n create_node_checkpoint\n end",
"def initialize(name = 'ROOT')\n @root = Node::Root.new(name, config)\n end",
"def initial_setup\n # set initial values of vert_pos and sum\n vert_pos = 0\n @sum = @tree[0][0]\n\n # set initial children nodes\n @initial_child_1 = @tree[1][0]\n @initial_child_2 = @tree[1][1]\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 internal_structure(indentation=0)\n node_descr = \"\"\n indentation.times { node_descr.concat \" \" }\n description = self.class.to_s.gsub(\"Node\", \"\")\n node_descr.concat \"#{description}\"\n if(!@node_value.nil?)\n node_descr.concat \" #{@node_value}\"\n end\n node_descr.concat \"\\n\"\n if (!children.nil?)\n children.each do |child| \n node_descr.concat(\"#{child.internal_structure(indentation+1)}\")\n end\n end\n return node_descr\n end",
"def initialize(payload, children = []) #initialize the creation of the Tree with the attributes\n @payload = payload #payload and children. Sets Children to an empty array\n @children = children\n end",
"def tree\n root = Node.new(1)\n root.left = Node.new(2)\n root.right = Node.new(3)\n root.left.left = Node.new(4)\n root.left.right = Node.new(5)\n root.right.left = Node.new(6)\n root.right.right = Node.new(7)\n root.right.right.right = Node.new(8)\n root\nend",
"def initialize(root)\n @root = root\n end",
"def tree(node, *children, **typed_children)\n children += children_for(typed_children)\n children = children.flatten.grep(Tree)\n infos = sub(0, node.start), sub(node.start, node.length), sub(node.stop..-1)\n description = Hansi.render(THEME[:green], node.type.to_s.tr(\"_\", \" \"))\n after = Hansi.render(TEMPLATE, *infos, theme: THEME, tags: true)\n Tree.new(description, *children, after: after, prefix_color: PREFIX_COLOR)\n end",
"def test_lt2 # Test the << method\n @root << @child1\n @root << @child2\n @root << @child3 << @child4\n assert_not_nil(@root['Child1'], \"Child 1 should have been added to Root\")\n assert_not_nil(@root['Child2'], \"Child 2 should have been added to Root\")\n assert_not_nil(@root['Child3'], \"Child 3 should have been added to Root\")\n assert_not_nil(@child3['Child4'], \"Child 4 should have been added to Child3\")\n end",
"def initialize( root )\n\t\tself.root = root\n\tend",
"def test_access\n\tdoc = NQXML::TreeParser.new(@rsrc.xml).document\n\n\troot = doc.rootNode\n\tassert_nil(root.parent)\n\tassert_equal('outer', root.entity.name)\n \tassert_equal(8, root.children.length)\n\tassert_instance_of(NQXML::Text, root.firstChild().entity)\n\tassert_instance_of(NQXML::Text, root.lastChild().entity)\n\n\tnode = root.firstChild().nextSibling()\n\tassert_equal(node.parent, root)\n\tassert_equal('<simpleTag>', node.entity.source)\n\tassert_equal(1, node.children.length)\n\tassert_equal('text', node.firstChild().entity.text)\n end",
"def new\n @title = \"Creating New Content\"\n @content_node = ContentNode.new\n end",
"def build_tree\n c1 = ComponentNode.new(110)\n c2 = ComponentNode.new(20)\n c3 = ComponentNode.new(20)\n c4 = ComponentNode.new(150)\n c5 = ComponentNode.new(80)\n c6 = ComponentNode.new(120, [c1, c2, c3])\n c7 = ComponentNode.new(180, [c4, c5])\n return(ComponentNode.new(200, [c6, c7]))\n end",
"def test_text\n root = CommandNode.new(nil, nil)\n\n root << 'A block of text.'\n assert(root.size == 1)\n assert(root[0].class == TextNode)\n assert(root[0].text == 'A block of text.')\n\n root << \" More text.\"\n assert(root.size == 1)\n assert(root[0].class == TextNode)\n assert(root[0].text == 'A block of text. More text.')\n\n root.paragraph\n root << \"A new node.\"\n assert(root.size == 3)\n assert(root[0].class == TextNode)\n assert(root[-1].class == TextNode)\n assert(root[0].text == 'A block of text. More text.')\n assert(root[-1].text == 'A new node.')\n end",
"def test_left_child\n @root << @left_child1\n @root << @right_child1\n assert_same(@left_child1, @root.left_child, \"The left child should be 'left_child1\")\n assert_not_same(@right_child1, @root.left_child, \"The right_child1 is not the left child\")\n end",
"def test_node_height\n assert_equal(0, @root.node_height, \"A single node's height is 0\")\n\n @root << @child1\n assert_equal(1, @root.node_height, \"This should be of height 1\")\n assert_equal(0, @child1.node_height, \"This should be of height 0\")\n\n @root << @child2\n assert_equal(1, @root.node_height, \"This should be of height 1\")\n assert_equal(0, @child2.node_height, \"This should be of height 0\")\n\n @child2 << @child3\n assert_equal(2, @root.node_height, \"This should be of height 2\")\n assert_equal(1, @child2.node_height, \"This should be of height 1\")\n assert_equal(0, @child3.node_height, \"This should be of height 0\")\n\n @child3 << @child4\n assert_equal(3, @root.node_height, \"This should be of height 3\")\n assert_equal(2, @child2.node_height, \"This should be of height 2\")\n assert_equal(1, @child3.node_height, \"This should be of height 1\")\n assert_equal(0, @child4.node_height, \"This should be of height 0\")\n end",
"def test_node_depth\n assert_equal(0, @root.node_depth, \"A root node's depth is 0\")\n\n setup_test_tree\n\n for child in [@child1, @child2, @child3]\n assert_equal(1, child.node_depth, \"Node #{child.name} should have depth 1\")\n end\n\n assert_equal(2, @child4.node_depth, \"Child 4 should have depth 2\")\n end",
"def init_node\n end",
"def init_node\n end",
"def initialize parent = nil\n self.parent = parent\n self.children_tree = {}\n end",
"def initialize(root)\n @root = root\n end",
"def initialize(root)\n @root = root\n end",
"def initialize(root)\n @root = root\n end",
"def initialize(root=nil)\n @root = root\n end",
"def root; skeleton.root; end",
"def test_single_node_becomes_leaf\n setup_test_tree\n\n leafs = @root.each_leaf\n parents = leafs.collect {|leaf| leaf.parent }\n leafs.each {|leaf| leaf.remove_from_parent!}\n parents.each {|parent| assert(parent.is_leaf?) if not parent.has_children?}\n\n end",
"def test_is_root_eh\n setup_test_tree\n assert(@root.is_root?, \"The ROOT node must respond as the root node\")\n end",
"def initialize(root)\n @root = root\n end",
"def initialize(root)\n @root = root\n end",
"def initialize(root)\n @root = root\n end",
"def initialize(root)\n @root = root\n end",
"def initialize(root)\n @root = root\n end",
"def initialize(root)\n @root = root\n end",
"def initialize(root)\n @root = root\n end",
"def test_level\n assert_equal(0, @root.level, \"A root node's level is 0\")\n\n assert_equal(@root.node_depth, @root.level, \"Level and depth should be the same\")\n\n setup_test_tree\n for child in [@child1, @child2, @child3]\n assert_equal(1, child.level, \"Node #{child.name} should have level 1\")\n assert_equal(@root.node_depth, @root.level, \"Level and depth should be the same\")\n end\n\n assert_equal(2, @child4.level, \"Child 4 should have level 2\")\n end",
"def initialize()\n @childs = {}\n end",
"def initialize()\n @childs = {}\n end",
"def simple_tree\n tree = BinaryTree.new(1)\n tree.insert_left(2)\n tree.insert_right(3)\n tree.left_subtree.insert_left(4)\n tree.left_subtree.insert_right(5)\n tree.right_subtree.insert_left(6)\n tree.right_subtree.insert_right(7)\n return tree\n end",
"def initialize\n\n # This call to Builder creates our main XML document. \n\n @builder = Nokogiri::XML::Builder.new {\n wrap_it( 'WRAP' => \"demo\") {\n # The parent element is \"wrap_it\", thus method parent()\n # returns a Nokogiri::XML::Element that we can operate on later.\n @fs_parent = parent;\n }\n \n # This is our home grown accessor method since @fs_parent is an\n # instance variable and is normally private.\n\n def fs_parent\n return @fs_parent;\n end\n }\n\n print \"Parent class: #{@builder.fs_parent.class}\\n\"\n\n # Create two new child elements just to demonstrate how we use an\n # parameter to the method. We are still in method initialize() so\n # the code below runs during Test_child.new(). In some cases you\n # may want to create the Builder object, have some instance\n # variables for elements to be expanded, and add those child\n # elements long after initialize() has been called.\n\n create_new_element(\"one\", @builder.fs_parent);\n create_new_element(\"two\", @builder.fs_parent);\n end",
"def child_node; end",
"def render(node = nil)\n elt = node | tree\n puts \"\\nNodes: #{elt.body.count}\"\n puts \"\\nAttributes:\"\n elt.attrs.each{ |k, v| puts(\"#{k}: #{v}\") }\n children = elt.body.select{ |i| i.is_a?(Node) }\n puts \"\\nChildren: #{children.each{ |c| render(c) }}\"\n\n\n end",
"def build_tree(model)\n # inflate the node id to test id wrap around edge cases\n ENV[\"NODES\"].to_i.times { model.create!.destroy } if ENV[\"NODES\"]\n\n n1 = model.create!\n n2 = model.create!(:parent => n1)\n n3 = model.create!(:parent => n2)\n n4 = model.create!(:parent => n2)\n n5 = model.create!(:parent => n1)\n n6 = model.create!(:parent => n5)\n\n puts \"create: #{n1.id}..#{n6.id}\" if ENV[\"NODES\"]\n [n1, n2, n3, n4, n5, n6]\n end",
"def test_node_starts_with_empty_branches\n node = Node.new(50, \"movie a\")\n refute node.left_node\n refute node.right_node\n end",
"def create_tree(node, elem, level, parent)\n node.level = level\n elemtype = check_type(elem[1])\n case elemtype\n when \"array\"\n node.kind = \"array\"\n node.arrsize = elem[1][\".array_size\"].to_i\n if elem[1].has_key?(\".subtype\") && elem[1][\".subtype\"].has_key?(\".members\")\n elem[1][\".subtype\"][\".members\"].each do |m|\n x = Tree.new(m[0], item_type(elem[1]), node)\n node.create_child(x)\n create_tree(x, m, level+1, node)\n end\n if elem[1][\".subtype\"].has_key?(\".type_or_id_name\")\n elem[1][\".subtype\"][\".type_or_id_name\"] =~ /\\((.+)\\): (\\w+)/\n node.s_u_name = $2.clone\n else\n node.s_u_name = \"__ANON__\"\n end\n node.basetype = node.data = elem[1][\".subtype\"][\".type\"].clone\n else\n subkind = check_type(elem[1][\".subtype\"])\n case subkind\n when \"enum\"\n node.basetype = \"enum\"\n node.data = {\".type\" => elem[1][\".subtype\"][\".type\"]}\n node.data[\".type_or_id_name\"] = elem[1][\".subtype\"][\".type_or_id_name\"]\n arr = []\n elem[1][\".subtype\"][\".values\"].each { |k,v| arr << [k,v] }\n node.data[\".values\"] = arr.clone\n node.data[\".values\"].sort! { |a,b| a[1] <=> b[1] }\n when \"numeric_ose\", \"boolean\"\n elem[1][\".subtype\"][\".type_or_id_name\"] =~ /\\((.+)\\): (\\w+)/\n node.basetype = $2.clone\n when \"native\", \"numeric_other\"\n node.basetype = \"OTHER\"\n node.data = {\".type\" => elem[1][\".subtype\"][\".type\"]}\n if elem[1][\".subtype\"].has_key?(\".signed\")\n node.data[\".signed\"] = elem[1][\".subtype\"][\".signed\"] \n end\n if elem[1][\".subtype\"].has_key?(\".type_or_id_name\")\n node.data[\".type_or_id_name\"] = elem[1][\".subtype\"][\".type_or_id_name\"]\n end\n end\n node.leaf = true\n end\n when \"struct\", \"union\"\n node.kind = elemtype\n if is_anon?(elem[1])\n node.s_u_name = \"__ANON__\"\n else\n node.s_u_name = item_name(elem[1])\n end\n elem[1][\".members\"].each do |m|\n x = Tree.new(m[0], item_type(elem[1]), node)\n node.create_child(x)\n create_tree(x, m, level+1, node)\n end\n when \"enum\"\n node.kind = \"enum\"\n node.basetype = \"enum\"\n node.s_u_name = item_name(elem[1])\n node.parent = parent\n node.leaf = true\n arr = []\n elem[1][\".values\"].each { |k,v| arr << [k,v] }\n node.data = arr.clone\n node.data.sort! { |a,b| a[1] <=> b[1] }\n when \"numeric_ose\"\n node.kind = \"numeric\"\n node.basetype = item_name(elem[1])\n node.parent = parent\n node.leaf = true\n when \"boolean\"\n node.kind = \"boolean\"\n node.basetype = item_name(elem[1])\n node.parent = parent\n node.leaf = true\n when \"native\", \"numeric_other\"\n node.kind = \"numeric\"\n node.basetype = \"OTHER\"\n node.data = {'.type' => elem[1][\".type\"]}\n node.data[\".signed\"] = elem[1][\".signed\"] if elem[1].has_key?(\".signed\")\n if elem[1].has_key?(\".type_or_id_name\")\n node.data[\".type_or_id_name\"] = elem[1][\".type_or_id_name\"]\n end\n node.parent = parent\n node.leaf = true\n else\n raise \"Node #{node.name} contains erroneous data\" \n end\n end",
"def generate_initial_node\n\t\tnode_text = \".,\" + self.name\n\t\t\n\t\tinitial_node = Node.new()\n\t\t#this line will also build the \"\" category, since it is the first instance of it\n\t\tinitial_node = build_node(initial_node, node_text)\n\t\tinitial_node.save\n\n\t\t#update the ordering\n\t\tordering = []\n\t\tordering.insert(0, ObjectPlace.new(\"Node\", initial_node.id))\n\t\tset_order(ordering)\n\t\t#insert_element(0, node_text)\n\tend",
"def parse_tree\n id = attribute( 'id' )\n label = attribute( 'label' )\n\n type = attribute( 'xsi:type' )[4..-1]\n klass = NeXML.const_get( type )\n tree = klass.new( id, :label => label )\n\n #a 'tree' element *will* have child nodes.\n while next_node\n case local_name\n when \"node\"\n #parse child 'node' element\n node = parse_node\n\n #and add it to the 'tree'\n tree.add_node node\n\n #root?\n tree.roots << node if node.root?\n when \"rootedge\"\n #parse child 'edge' element\n rootedge = parse_rootedge\n\n #and add it to the 'tree'\n # tree.add_rootedge rootedge # XXX it looks like the super class(es)\n # can only deal with edges that have source and target\n when \"edge\"\n #parse child 'edge' element\n edge = parse_edge( type )\n\n #and add it to the 'tree'\n tree.add_edge edge\n when \"tree\"\n #end of current 'tree' element has been reached\n break\n end\n end\n\n #return the 'tree' object\n tree\n end",
"def initialize\n @root = nil\n end",
"def test_first_node_is_root_node\n tree = BinarySearchTree.new\n tree.insert(50, \"movie a\")\n assert_equal \"movie a\", tree.root.title\n end",
"def initialize(root, name, children = {}, defaults = true)\n @children = {}\n @name = name.to_s.upcase\n @root = root\n\n # Try to handle some PHP quirks\n if children.is_a?(Array)\n new_children = {}\n children.each_with_index { |c, i| new_children[i] = c }\n children = new_children\n end\n\n if defaults\n # This is a terribly convoluted way to do this, but this ensures\n # that the order of properties as they are specified in both\n # defaults and the childrens list, are inserted in the object in a\n # natural way.\n list = self.defaults\n nodes = []\n\n children.each do |key, value|\n if value.is_a?(Node)\n list.delete value.name if list.key?(value.name)\n nodes << value\n else\n list[key] = value\n end\n end\n\n list.each do |key, value|\n add(key, value)\n end\n\n nodes.each do |node|\n add(node)\n end\n else\n children.each do |k, child|\n if child.is_a?(Node)\n # Component or Property\n add(child)\n else\n # Property key=>value\n add(k, child)\n end\n end\n end\n end",
"def initialize(contents = [])\n @root = NonLeafNode.new(nil, [], true)\n contents.each do |content|\n insert_privileged(content, true)\n end\n root.update_subtree\n end",
"def test_size\n assert_equal(1, @root.size, \"Root's size should be 1\")\n setup_test_tree\n\n assert_equal(5, @root.size, \"Root's size should be 5\")\n assert_equal(2, @child3.size, \"Child 3's size should be 2\")\n end",
"def print_tree\n if root.children\n puts \" - root : #{root.children.length} - \"\n root.children.each(&:print_node)\n puts ''\n end\n end",
"def root\n subject.root(node)\n end",
"def generate_tree_nodes(ttt)\n while !@avail_moves.empty?\n player_moves = create_new_players_moves_array\n player_makes_move(player_moves)\n create_new_child_node(ttt, player_moves)\n end\n end",
"def test_is_leaf_eh\n setup_test_tree\n assert(!@child3.is_leaf?, \"Child 3 is not a leaf node\")\n assert(@child4.is_leaf?, \"Child 4 is a leaf node\")\n end",
"def test_single_node\n grammar = \"grammar T;\\n\" + \"options {output=AST;}\\n\" + \"a : ID ;\\n\" + \"ID : 'a'..'z'+ ;\\n\" + \"INT : '0'..'9'+;\\n\" + \"WS : (' '|'\\\\n') {$channel=HIDDEN;} ;\\n\"\n tree_grammar = \"tree grammar TP;\\n\" + \"options {ASTLabelType=CommonTree; output=template;}\\n\" + \"s : a {System.out.println($a.st);} ;\\n\" + \"a : ID -> template(x={$ID.text}) <<|<x>|>> ;\\n\"\n found = exec_tree_parser(\"T.g\", grammar, \"TParser\", \"TP.g\", tree_grammar, \"TP\", \"TLexer\", \"a\", \"s\", \"abc\")\n assert_equals(\"|abc|\\n\", found)\n end",
"def create_tree(vupper, vlower, &block)\n @root = Node.new(vupper, vlower, @depth)\n @root.create_children &block\n end",
"def test_has_content_eh\n a_node = Tree::TreeNode.new(\"A Node\")\n assert_nil(a_node.content , \"The node should not have content\")\n assert(!a_node.has_content? , \"The node should not have content\")\n\n a_node.content = \"Something\"\n assert_not_nil(a_node.content, \"The node should now have content\")\n assert(a_node.has_content?, \"The node should now have content\")\n end",
"def test_tree_starts_empty\n tree = BinarySearchTree.new\n assert_nil tree.root\n end",
"def create_tree(items, rootpage)\n _, tree = visit_nodes(items, rootpage.lft + 1, rootpage.id, rootpage.depth + 1, {}, \"\", rootpage.restricted)\n tree\n end",
"def test_json_serialization\n setup_test_tree\n\n expected_json = {\n \"name\" => \"ROOT\",\n \"content\" => \"Root Node\",\n JSON.create_id => \"Tree::TreeNode\",\n \"children\" => [\n {\"name\" => \"Child1\", \"content\" => \"Child Node 1\", JSON.create_id => \"Tree::TreeNode\"},\n {\"name\" => \"Child2\", \"content\" => \"Child Node 2\", JSON.create_id => \"Tree::TreeNode\"},\n {\n \"name\" => \"Child3\",\n \"content\" => \"Child Node 3\",\n JSON.create_id => \"Tree::TreeNode\",\n \"children\" => [\n {\"name\" => \"Child4\", \"content\" => \"Grand Child 1\", JSON.create_id => \"Tree::TreeNode\"}\n ]\n }\n ]\n }.to_json\n\n assert_equal(expected_json, @root.to_json)\n end",
"def divideNode()\n\t\t# Choose a position along the perimeter to divide the node area by\n\t\t@chosenDivision = @areaWidth > @areaHeight ? 0 : 1\n\t\tdivisionTypes = [\n\t\t\trand(@areaX + (@areaWidth * 0.35).floor .. @areaX + @areaWidth - (@areaWidth * 0.35).ceil), \n\t\t\trand(@areaY + (@areaHeight * 0.35).floor .. @areaY + @areaHeight - (@areaHeight * 0.35).ceil),\n\t\t]\n\t\tpossibleDivisions = [ \n\t\t\t# Divide the area vertically\n\t\t\t[\n\t\t\t\t# First child node\n\t\t\t\t@areaX,\n\t\t\t\t@areaY,\n\t\t\t\t@areaX + @areaWidth - divisionTypes[@chosenDivision],\n\t\t\t\t@areaHeight,\n\t\t\t\t# Second child node \n\t\t\t\tdivisionTypes[@chosenDivision],\n\t\t\t\t@areaY,\n\t\t\t\t@areaX + @areaWidth - divisionTypes[@chosenDivision],\n\t\t\t\t@areaHeight,\n\t\t\t\t],\n\t\t\t# Divide the area horizontally\n\t\t\t[\n\t\t\t\t# First child Node\n\t\t\t\t@areaX,\n\t\t\t\t@areaY,\n\t\t\t\t@areaWidth,\n\t\t\t\t@areaY + @areaHeight - divisionTypes[@chosenDivision],\n\t\t\t\t# Second child node\n\t\t\t\t@areaX,\n\t\t\t\tdivisionTypes[@chosenDivision],\n\t\t\t\t@areaWidth,\n\t\t\t\t@areaY + @areaHeight - divisionTypes[@chosenDivision],\n\t\t\t\t]\n\t\t]\n\t\t@areaDivision = possibleDivisions[@chosenDivision]\n\t\t# Create the child nodes and assign each other\n\t\t# a refernce to their sibling\n\t\t@children = [ \n\t\t\tNode.new([\n\t\t\t\t@areaDivision[0], \n\t\t\t\t@areaDivision[1], \n\t\t\t\t@areaDivision[2], \n\t\t\t\t@areaDivision[3], \n\t\t\t\t@divisionsToMake, \n\t\t\t\t@currentDivision + 1, \n\t\t\t\tself\n\t\t\t\t]),\n\t\t\tNode.new([\n\t\t\t\t@areaDivision[4], \n\t\t\t\t@areaDivision[5], \n\t\t\t\t@areaDivision[6], \n\t\t\t\t@areaDivision[7], \n\t\t\t\t@divisionsToMake, \n\t\t\t\t@currentDivision + 1, \n\t\t\t\tself\n\t\t\t\t]),\n\t\t\t]\n\t\t@children[0].assignSiblingNode(@children[1])\n\t\t@children[1].assignSiblingNode(@children[0])\n\t\t# Create connections between sibling, parent, and child nodes\n\t\tself.createConnectorBetweenChildren()\n\t\tif @parentNode \n\t\t\t@parentNode.createConnectorToChild(@roomConnectors[0][0], @roomConnectors[0][1])\n\t\telse\n\t\t\tx1, y1 = @children[0].getConnectorStart()\n\t\t\tx2, y2 = @children[0].getConnectorStart()\n\t\t\tself.createRootConnector(x1, y1, x2, y2)\n\t\tend\n\tend",
"def test_indexed_access\n setup_test_tree\n\n assert_equal(@child1, @root[0], \"Should be the first child\")\n assert_equal(@child4, @root[2][0], \"Should be the grandchild\")\n assert_nil(@root[\"TEST\"], \"Should be nil\")\n assert_nil(@root[99], \"Should be nil\")\n assert_raise(ArgumentError) { @root[nil] }\n end",
"def test_attrs\n #test BinTree attr\n tree = BinTree.new\n test_val = tree.root\n assert test_val == nil\n\n #test TreeNode value\n test_node = TreeNode.new(18)\n test_val = test_node.value\n assert_equal(test_val, 18)\n\n #test TreeNode left set value and read value\n test_left = TreeNode.new(1)\n test_node.left = test_left\n assert_equal(test_left, test_node.left)\n\n #test TreeNode right set value and read value\n test_right = TreeNode.new(23)\n test_node.right = test_right\n assert_equal(test_right, test_node.right)\n end",
"def test_content\n pers = Person::new(\"John\", \"Doe\")\n @root.content = pers\n assert_same(pers, @root.content, \"Content should be the same\")\n end",
"def build_tree(nodes_fragement)\n nodes_element = LonelyPlanet::Node.new nodes_fragement\n node = LonelyPlanet::TreeNode.new(nodes_element.name, nodes_element.id)\n if nodes_element.has_child?\n nodes_element.children.all? { |child_frag|\n node << build_tree(child_frag)\n }\n end\n node\n end",
"def init_root binding, &block\n block.call(self)\n @is_first = @is_last = true\n @level = 0\n @item = nil\n @tabs ||= 0\n root = eval('@items',binding).find{|x| x.identifier == root_identifier}\n children_populate_recursive [root]\n end"
] |
[
"0.74892026",
"0.69768673",
"0.6536382",
"0.6532576",
"0.64579844",
"0.6425516",
"0.6425516",
"0.6415502",
"0.63244176",
"0.63095903",
"0.6268332",
"0.6256298",
"0.6199389",
"0.6199389",
"0.6164461",
"0.61095846",
"0.6101349",
"0.60315055",
"0.60315055",
"0.6016662",
"0.6012783",
"0.5998024",
"0.59956044",
"0.59789276",
"0.59342897",
"0.59172344",
"0.59171987",
"0.58997273",
"0.58967006",
"0.5865339",
"0.58527154",
"0.58373106",
"0.5825364",
"0.5811337",
"0.5808991",
"0.58079165",
"0.578899",
"0.5784103",
"0.57742053",
"0.5756999",
"0.57390743",
"0.5734644",
"0.5724396",
"0.5720026",
"0.5712426",
"0.56905365",
"0.5678223",
"0.56698406",
"0.5668207",
"0.566281",
"0.5659592",
"0.5659592",
"0.5641803",
"0.56325185",
"0.56325185",
"0.56325185",
"0.56240547",
"0.56204784",
"0.5599813",
"0.5597472",
"0.559291",
"0.559291",
"0.559291",
"0.559291",
"0.559291",
"0.559291",
"0.559291",
"0.5590117",
"0.55897874",
"0.55897874",
"0.5573498",
"0.5568824",
"0.5566238",
"0.5563996",
"0.5557895",
"0.55564237",
"0.55535775",
"0.554841",
"0.5547014",
"0.55458593",
"0.55378824",
"0.55364704",
"0.5535484",
"0.5535426",
"0.5534549",
"0.55315167",
"0.55268484",
"0.5525901",
"0.5500155",
"0.54739547",
"0.5471737",
"0.5470828",
"0.54635715",
"0.54579765",
"0.5457404",
"0.54425406",
"0.5438954",
"0.5436362",
"0.5432352",
"0.5429631"
] |
0.76316243
|
0
|
Create the actual test tree.
|
def setup_test_tree
@root << @child1
@root << @child2
@root << @child3 << @child4
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_csharp_test_node\n @stack = []\n @stack.push(@root)\n @test_case_stack = []\n csharp_regex = Regexp.union([/^namespace/, /^public/, /^\\[TestFixture\\]/, /^\\[Test\\]/, /^\\[TestCase/])\n original_file_string = File.read(@file_name)\n lines = original_file_string.split(\"\\n\")\n lines = lines.each do |line|\n line.gsub!(\"()\",\"\") \n line.gsub!(\";\",\"\")\n line.gsub!(\"async\",\"\") \n line.gsub!(\"Task\",\"\")\n line.gsub!(\"void\",\"\")\n line.gsub!(\"class\",\"\")\n line.strip!\n end\n\n relevant_lines_ary = lines.keep_if do |line|\n !csharp_regex.match(line).nil? && line != \"\"\n end\n relevant_lines_ary.each_cons(3) do |previous, current, nekst|\n first_token = current.split[0].strip\n previous_first_token = previous.split[0].strip\n if first_token == 'namespace'\n second_token = current.split[1].strip\n node = Tree.new(second_token)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'namespace'\n @stack.push(node)\n elsif first_token == \"[TestFixture]\"\n nekst_second_token = nekst.split[1].strip\n node = Tree.new(nekst_second_token)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'test_fixture'\n @stack.push(node)\n elsif first_token == \"[Test]\"\n nekst_second_token = nekst.split[1].strip\n node = Tree.new(nekst_second_token)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'test'\n @stack.push(node)\n elsif /^\\[TestCase/ =~ current \n first_token = first_token.gsub!(/[\\[\\]()]|TestCase/,\"\").strip\n node = Tree.new(first_token)\n node.file_name = @file_name\n node.structure_marker = 'test'\n @test_case_stack.push(node)\n if nekst && nekst.split[0]\n nekst_first_token = nekst.split[0].strip\n end\n if !(/^public/ =~ nekst_first_token)\n if nekst.split[1]\n nekst_second_token = nekst.split[1].strip\n end\n parent = Tree.new(nekst_second_token)\n parent.file_name = @file_name\n parent.structure_marker = 'test'\n parent_of_parent = fetch_parent(@stack, parent)\n parent.parent = parent_of_parent\n while !@test_case_stack.empty?\n test_case = @test_case_stack.pop\n parent.children << test_case\n test_case.parent = parent\n end\n end\n elsif( !(/^\\[TestCase/ =~ first_token) && (/^\\[TestCase/ =~ previous_first_token) )\n next\n else\n end\n end\n @root\n end",
"def create_csharp_test_node\n @stack = []\n @stack.push(@root)\n @test_case_stack = []\n csharp_regex = Regexp.union([/^namespace/, /^public/, /^\\[TestFixture\\]/, /^\\[Test\\]/, /^\\[TestCase/])\n original_file_string = File.read(@file_name)\n lines = original_file_string.split(\"\\n\")\n lines = lines.each do |line|\n line.gsub!(\"()\",\"\") \n line.gsub!(\";\",\"\")\n line.gsub!(\"async\",\"\") \n line.gsub!(\"Task\",\"\")\n line.gsub!(\"void\",\"\")\n line.gsub!(\"class\",\"\")\n line.strip!\n end\n\n relevant_lines_ary = lines.keep_if do |line|\n !csharp_regex.match(line).nil? && line != \"\"\n end\n relevant_lines_ary.each_cons(3) do |previous, current, nekst|\n first_token = current.split[0].strip\n previous_first_token = previous.split[0].strip\n if first_token == 'namespace'\n second_token = current.split[1].strip\n node = Tree.new(second_token)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'namespace'\n @stack.push(node)\n elsif first_token == \"[TestFixture]\"\n nekst_second_token = nekst.split[1].strip\n node = Tree.new(nekst_second_token)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'test_fixture'\n @stack.push(node)\n elsif first_token == \"[Test]\"\n nekst_second_token = nekst.split[1].strip\n node = Tree.new(nekst_second_token)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'test'\n @stack.push(node)\n elsif /^\\[TestCase/ =~ current \n first_token = first_token.gsub!(/[\\[\\]()]|TestCase/,\"\").strip\n node = Tree.new(first_token)\n node.file_name = @file_name\n node.structure_marker = 'test'\n @test_case_stack.push(node)\n if nekst && nekst.split[0]\n nekst_first_token = nekst.split[0].strip\n end\n if !(/^public/ =~ nekst_first_token)\n if nekst.split[1]\n nekst_second_token = nekst.split[1].strip\n end\n parent = Tree.new(nekst_second_token)\n parent.file_name = @file_name\n parent.structure_marker = 'test'\n parent_of_parent = fetch_parent(@stack, parent)\n parent.parent = parent_of_parent\n while !@test_case_stack.empty?\n test_case = @test_case_stack.pop\n parent.children << test_case\n test_case.parent = parent\n end\n end\n elsif( !(/^\\[TestCase/ =~ first_token) && (/^\\[TestCase/ =~ previous_first_token) )\n next\n else\n end\n end\n @root\n end",
"def create_test_node\n parent = @root\n File.open(@file_name, \"r\") do |f|\n f.each_with_index do |line, index|\n \n if index == 0\n @stack = []\n @stack.push(@root)\n end\n line.chomp!\n next if line.empty? || line.nil?\n prelim_whitespace = 0\n line.each_byte do |byte|\n break if byte != 32\n prelim_whitespace += 1\n end\n stripped_line = line.strip\n next if stripped_line.nil? || stripped_line.empty?\n token_line = stripped_line.split\n #accounts for Cucumber colons\n first_token = token_line[0].gsub(/:/,' ').downcase.strip\n last_token = token_line[-1].strip\n\n case stripped_line\n when /^context/, /^describe/, /^Feature:/, /^Feature/, /^RSpec.describe/\n node = Tree.new(format_description(line, first_token), prelim_whitespace)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = first_token\n \n @stack.push(node)\n when /^it/, /^Scenario/, /^Scenario:/\n node = Tree.new(format_description(line, first_token), prelim_whitespace)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = first_token\n \n if stripped_line =~ /do$/\n @stack.push(node)\n end\n when /^def/, /do$/, /do.*$/\n node = Tree.new(first_token, prelim_whitespace)\n node.file_name = @file_name\n node.structure_marker = first_token\n \n @stack.push(node)\n when /^end/\n @stack.pop\n else\n end\n end\n end\n @root\n end",
"def create_test_node\n parent = @root\n File.open(@file_name, \"r\") do |f|\n f.each_with_index do |line, index|\n \n if index == 0\n @stack = []\n @stack.push(@root)\n end\n line.chomp!\n next if line.empty? || line.nil?\n prelim_whitespace = 0\n line.each_byte do |byte|\n break if byte != 32\n prelim_whitespace += 1\n end\n stripped_line = line.strip\n next if stripped_line.nil? || stripped_line.empty?\n token_line = stripped_line.split\n #accounts for Cucumber colons\n first_token = token_line[0].gsub(/:/,' ').downcase.strip\n last_token = token_line[-1].strip\n\n case stripped_line\n when /^context/, /^describe/, /^Feature:/, /^Feature/, /^RSpec.describe/\n node = Tree.new(format_description(line, first_token), prelim_whitespace)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = first_token\n \n @stack.push(node)\n when /^it/, /^Scenario/, /^Scenario:/\n node = Tree.new(format_description(line, first_token), prelim_whitespace)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = first_token\n \n if stripped_line =~ /do$/\n @stack.push(node)\n end\n when /^def/, /do$/, /do.*$/\n node = Tree.new(first_token, prelim_whitespace)\n node.file_name = @file_name\n node.structure_marker = first_token\n \n @stack.push(node)\n when /^end/\n @stack.pop\n else\n end\n end\n end\n @root\n end",
"def test_save_tree\n end",
"def create_java_test_node\n File.open(@file_name, \"r\") do |f|\n f.each_with_index do |line, index|\n if index == 0\n @stack = []\n @stack.push(@root)\n parent = @root\n end\n line.chomp!\n next if line.empty? || line.nil?\n prelim_whitespace = 0\n line.each_byte do |byte|\n break if byte != 32\n prelim_whitespace += 1\n end\n\n stripped_line = line.strip\n next if stripped_line.nil? || stripped_line.empty?\n\n case stripped_line\n when /^package/\n node = Tree.new(format_java_description(line), prelim_whitespace)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'package'\n @stack.push(node)\n when /^public class/\n node = Tree.new(format_java_description(line), prelim_whitespace)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'java_class'\n @stack.push(node)\n when /^public void/\n node = Tree.new(format_java_description(line), prelim_whitespace)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'test'\n else\n end\n end\n end\n @root\n end",
"def create_java_test_node\n File.open(@file_name, \"r\") do |f|\n f.each_with_index do |line, index|\n if index == 0\n @stack = []\n @stack.push(@root)\n parent = @root\n end\n line.chomp!\n next if line.empty? || line.nil?\n prelim_whitespace = 0\n line.each_byte do |byte|\n break if byte != 32\n prelim_whitespace += 1\n end\n\n stripped_line = line.strip\n next if stripped_line.nil? || stripped_line.empty?\n\n case stripped_line\n when /^package/\n node = Tree.new(format_java_description(line), prelim_whitespace)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'package'\n @stack.push(node)\n when /^public class/\n node = Tree.new(format_java_description(line), prelim_whitespace)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'java_class'\n @stack.push(node)\n when /^public void/\n node = Tree.new(format_java_description(line), prelim_whitespace)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'test'\n else\n end\n end\n end\n @root\n end",
"def generate_tree\n root =\tTreeNode.new(3)\n root.left =\tTreeNode.new(9)\n right = \t\tTreeNode.new(20)\n right.left = \tTreeNode.new(15)\n right.right = TreeNode.new(7)\n root.right = \tright\n root\nend",
"def build_tree(model)\n # inflate the node id to test id wrap around edge cases\n ENV[\"NODES\"].to_i.times { model.create!.destroy } if ENV[\"NODES\"]\n\n n1 = model.create!\n n2 = model.create!(:parent => n1)\n n3 = model.create!(:parent => n2)\n n4 = model.create!(:parent => n2)\n n5 = model.create!(:parent => n1)\n n6 = model.create!(:parent => n5)\n\n puts \"create: #{n1.id}..#{n6.id}\" if ENV[\"NODES\"]\n [n1, n2, n3, n4, n5, n6]\n end",
"def setup\n @root = Tree::TreeNode.new(\"ROOT\", \"Root Node\")\n\n @child1 = Tree::TreeNode.new(\"Child1\", \"Child Node 1\")\n @child2 = Tree::TreeNode.new(\"Child2\", \"Child Node 2\")\n @child3 = Tree::TreeNode.new(\"Child3\", \"Child Node 3\")\n @child4 = Tree::TreeNode.new(\"Child4\", \"Grand Child 1\")\n @child5 = Tree::TreeNode.new(\"Child5\", \"Child Node 4\")\n\n end",
"def runTest()\n\tareaWidth = rand(80..140)\n\tareaHeight = rand(40..80)\n\tsubdivisions = rand(3..6)\n\tbspTree = Tree.new([areaWidth, areaHeight, subdivisions])\n\tcreateTextOutput(bspTree, areaWidth, areaHeight, subdivisions)\nend",
"def test_print_tree\n setup_test_tree\n #puts\n #@root.print_tree\n end",
"def init_simple_tree\n @root_org = Org.create(name: 'root')\n @lv1_child_org = Org.create(name: 'lv1')\n @lv1_child_org2 = Org.create(name: 'lv1-2')\n @lv2_child_org = Org.create(name: 'lv2')\n @lv2_child_org2 = Org.create(name: 'lv2-2')\n @lv2_child_org3 = Org.create(name: 'lv2-3')\n @lv2_child_org4 = Org.create(name: 'lv2-4')\n @lv3_child_org = Org.create(name: 'lv3')\n @lv3_child_org2 = Org.create(name: 'lv3-2')\n @lv4_child_org = Org.create(name: 'lv4')\n @lv4_child_org2 = Org.create(name: 'lv4-2')\n @lv5_child_org = Org.create(name: 'lv5')\n @lv5_child_org2 = Org.create(name: 'lv5-2')\n\n current_time = Time.now\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @root_org.id,\n distance: 0,\n start_time: 10.minutes.ago(current_time),\n end_time: 1000.years.from_now,\n scope_name: 'default'\n )\n\n # 10 minutes ago\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org.id,\n distance: 1,\n start_time: 10.minutes.ago(current_time),\n end_time: current_time,\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv1_child_org.id,\n distance: 2,\n start_time: 10.minutes.ago(current_time),\n end_time: current_time,\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org.id,\n child_id: @lv1_child_org.id,\n distance: 1,\n start_time: 10.minutes.ago(current_time),\n end_time: current_time,\n scope_name: 'default'\n )\n\n # now\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv1_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv1_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv2_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org2.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv2_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org3.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org2.id,\n child_id: @lv2_child_org3.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org4.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org2.id,\n child_id: @lv2_child_org4.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv3_child_org.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv3_child_org.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org.id,\n child_id: @lv3_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv4_child_org.id,\n distance: 4,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv4_child_org.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org.id,\n child_id: @lv4_child_org.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv3_child_org.id,\n child_id: @lv4_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv5_child_org.id,\n distance: 5,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv5_child_org.id,\n distance: 4,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org.id,\n child_id: @lv5_child_org.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv3_child_org.id,\n child_id: @lv5_child_org.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv4_child_org.id,\n child_id: @lv5_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv3_child_org2.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv3_child_org2.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org2.id,\n child_id: @lv3_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv4_child_org2.id,\n distance: 4,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv4_child_org2.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org2.id,\n child_id: @lv4_child_org2.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv3_child_org2.id,\n child_id: @lv4_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv5_child_org2.id,\n distance: 5,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv5_child_org2.id,\n distance: 4,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org2.id,\n child_id: @lv5_child_org2.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv3_child_org2.id,\n child_id: @lv5_child_org2.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv4_child_org2.id,\n child_id: @lv5_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\nend",
"def setup\n size(800, 200)\n new_tree\nend",
"def build_tree\n t = RDTree.new\n t.add_node(0, DummyRoot)\n root = root_node_of\n t.add_edge(0, root.attributes[\"ID\"])\n do_build_tree(root, 1, t) \n t\n end",
"def generate_tree_nodes(ttt)\n while !@avail_moves.empty?\n player_moves = create_new_players_moves_array\n player_makes_move(player_moves)\n create_new_child_node(ttt, player_moves)\n end\n end",
"def create\n create_hiera_template\n create_manifests_node\n create_node_checkpoint\n end",
"def create_tree(vupper, vlower, &block)\n @root = Node.new(vupper, vlower, @depth)\n @root.create_children &block\n end",
"def build_tree tree_root=nil\n tree_root ||= self.tree_root\n Dir.mkdir(tree_root) unless File.directory?(tree_root)\n Dir.chdir(tree_root) do\n self.files.each do |entry|\n visit_tree entry do |type, name|\n case type\n when :file\n FileUtils.touch(name)\n when :directory\n Dir.mkdir(name)\n else\n throw \"BAD VISIT TREE TYPE. #{type}\"\n end\n end\n end\n end\n end",
"def create_tree(father,tree)\n tree.each do |name|\n n = Meta::create_class(father, name[0], name[1])\n create_tree(n, name[2])\n end\nend",
"def test_new_tree_empty_root\n assert_equal nil, @tree.root\n end",
"def produce_test\n test = Test.new\n\n # Tell traversal object to reset its state\n @traversal.notify_new_traversal\n\n # Retrieved for passing into the Mock object\n decision = @traversal.method(:generate_value)\n\n # Always begin with calling the constructor (new/initialize)\n method = @traversal.select_method [@class.method(:new)]\n args = @traversal.select_arguments generate_parameters(:initialize)\n test.add_line(method, args)\n exception_raised = test.execute_last &decision\n\n # exception_raised could be a mock, we cannot use (if not), as that\n # results in exception_raised.! being called\n # If/Unless are the only primitives that do an object/nil check\n unless exception_raised\n continue_execution = true\n else\n continue_execution = false\n end\n\n # While the traversal allows it, and no execption is raised in execution,\n # continue generating lines\n while continue_execution and @traversal.continue_descent?\n method = @traversal.select_method @class.public_instance_methods(false)\n args = @traversal.select_arguments generate_parameters(method)\n test.add_line(method, args)\n\n exception_raised = (test.execute_last &decision)\n unless exception_raised\n continue_execution = true\n else\n continue_execution = false\n end\n end\n\n if exception_raised\n @traversal.notify_exception_raised exception_raised\n end\n\n return test\n end",
"def gen_tree\n new_tree = {}\n node_list = {}\n @json_tree.each do |k, v|\n if v['child_of'].nil?\n # top\n new_tree[k] = v\n node_list[k] = new_tree[k]\n else\n parent = v['child_of']\n if v['condition'] == 'and'\n node_list[parent]['and'] ||= {}\n node_list[parent]['and'][k] = v\n node_list[k] = node_list[parent]['and'][k]\n elsif v['condition'] == 'or'\n node_list[parent]['or'] ||= {}\n node_list[parent]['or'][k] = v\n node_list[k] = node_list[parent]['or'][k]\n else\n # TODO: sink?\n node_list[parent]['or'] ||= {}\n node_list[parent]['or'][k] = v\n node_list[k] = node_list[parent]['or'][k]\n end\n end\n end\n\n @json_tree_type = 'tree'\n @json_tree = new_tree\n end",
"def initialize(root_dir, module_set, data)\n @module_set = module_set\n @name = data[:name]\n @root = FilePath.new(root_dir, @name).canonicalize\n @compiler_version = data[:compiler_version] \n @aspectj = data[:aspectj] || false\n @dependencies = data[:dependencies] || [ ]\n\n assert(\"Root ('#{@root.to_s}') must be an absolute path\") { @root.absolute? }\n assert(\"Root ('#{@root.to_s}') must exist, and be a directory\") { FileTest.directory?(@root.to_s) }\n assert(\"Compiler version must be specified.\") { ! @compiler_version.nil? }\n \n @subtrees = [ ]\n # Run through all the factories and add a new subtree for each one.\n BuildSubtreeFactory::ALL_BUILD_SUBTREE_FACTORIES.each { |factory| @subtrees << factory.create(self) }\n end",
"def create_branch\n @tree_class.new\n end",
"def build_tree\n c1 = ComponentNode.new(110)\n c2 = ComponentNode.new(20)\n c3 = ComponentNode.new(20)\n c4 = ComponentNode.new(150)\n c5 = ComponentNode.new(80)\n c6 = ComponentNode.new(120, [c1, c2, c3])\n c7 = ComponentNode.new(180, [c4, c5])\n return(ComponentNode.new(200, [c6, c7]))\n end",
"def test_each\n setup_test_tree\n\n assert(@root.has_children?, \"Should have children\")\n assert_equal(5, @root.size, \"Should have five nodes\")\n assert(@child3.has_children?, \"Should have children\")\n\n nodes = []\n @root.each { |node| nodes << node }\n\n assert_equal(5, nodes.length, \"Should have FIVE NODES\")\n assert(nodes.include?(@root), \"Should have root\")\n assert(nodes.include?(@child1), \"Should have child 1\")\n assert(nodes.include?(@child2), \"Should have child 2\")\n assert(nodes.include?(@child3), \"Should have child 3\")\n assert(nodes.include?(@child4), \"Should have child 4\")\n end",
"def create_test_framework_structure\n case options[:test_framework]\n when :rspec then puts \"Create #{name}/spec folder\"\n when :test_unit then puts \"Create #{name}/test folder\"\n when :minitest then puts \"Create #{name}/\"\n end\n end",
"def run_tests\n desc = 'valid full tree'\n tree = BinaryTreeNode.new(50)\n left = tree.insert_left(30)\n right = tree.insert_right(70)\n left.insert_left(10)\n left.insert_right(40)\n right.insert_left(60)\n right.insert_right(80)\n result = binary_search_tree?(tree)\n assert_true(result, desc)\n\n desc = 'both subtrees valid'\n tree = BinaryTreeNode.new(50)\n left = tree.insert_left(30)\n right = tree.insert_right(80)\n left.insert_left(20)\n left.insert_right(60)\n right.insert_left(70)\n right.insert_right(90)\n result = binary_search_tree?(tree)\n assert_false(result, desc)\n\n desc = 'descending linked list'\n tree = BinaryTreeNode.new(50)\n left = tree.insert_left(40)\n left_left = left.insert_left(30)\n left_left_left = left_left.insert_left(20)\n left_left_left.insert_left(10)\n result = binary_search_tree?(tree)\n assert_true(result, desc)\n\n desc = 'out of order linked list'\n tree = BinaryTreeNode.new(50)\n right = tree.insert_right(70)\n right_right = right.insert_right(60)\n right_right.insert_right(80)\n result = binary_search_tree?(tree)\n assert_false(result, desc)\n\n desc = 'one node tree'\n tree = BinaryTreeNode.new(50)\n result = binary_search_tree?(tree)\n assert_true(result, desc)\nend",
"def create_node(test_method, *params)\n # Get available nodes so we can find the one we need, this has to be\n # done since we don't know which letters should be capitalized.\n available_nodes = Dunder::Nodes::Node.sub_classes\n \n node_name_lower_case = \"dunder::nodes::#{get_last_word_in test_method}\"\n node_name = available_nodes.select { |node| node.to_s.downcase == node_name_lower_case }.first\n \n node_name.new *params\n end",
"def build_tree(target_object)\n\n tree = {class: get_test_class(target_object), id: target_object.object_id, composition: []}\n if (target_object.is_a? Array)\n tree[:composition] = deconstruct_array(target_object)\n elsif target_object.is_a? Hash\n tree[:composition] = deconstruct_hash(target_object)\n elsif target_object.is_a? Pretentious::RecordedProc\n tree[:composition] = deconstruct_proc(target_object)\n tree[:given_block] = target_object.given_block?\n tree[:recorded_proc] = target_object\n tree[:id] = target_object.target_proc.object_id\n tree[:block_params] = self.class.block_param_names(target_object)\n elsif target_object.methods.include? :_get_init_arguments\n args = target_object._get_init_arguments\n\n unless args.nil?\n\n args[:params].each { |p|\n tree[:composition] << build_tree(p)\n }\n\n tree[:block] = build_tree(args[:block]) unless args[:block].nil?\n else\n tree[:composition] = target_object\n end\n\n else\n tree[:composition] = target_object\n end\n tree\n end",
"def make_tree_for(position)\n root = TreeNode.new(nil, position)\n\n\nend",
"def create_tree(items, rootpage)\n _, tree = visit_nodes(items, rootpage.lft + 1, rootpage.id, rootpage.depth + 1, {}, \"\", rootpage.restricted)\n tree\n end",
"def test\n sentence = \"(S (NP (NNP John)) (VP (V runs)))\"\n test = Tree.new(sentence)\n end",
"def display_parent_child_test_cases\n \n end",
"def create_mirror_tree\n node = ::BinaryTree::Node.new\n create_mirror_tree_support(self.root, node)\n display_support(node)\n end",
"def test_each_leaf\n setup_test_tree\n\n nodes = []\n @root.each_leaf { |node| nodes << node }\n\n assert_equal(3, nodes.length, \"Should have THREE LEAF NODES\")\n assert(!nodes.include?(@root), \"Should not have root\")\n assert(nodes.include?(@child1), \"Should have child 1\")\n assert(nodes.include?(@child2), \"Should have child 2\")\n assert(!nodes.include?(@child3), \"Should not have child 3\")\n assert(nodes.include?(@child4), \"Should have child 4\")\n end",
"def build_unit_test_contexts\n create_stores\n create_employees\n create_assignments\n create_jobs\n create_shifts\n create_shift_jobs\n create_flavors\n create_store_flavors\n end",
"def test_initialize\n assert_not_nil(@root, \"Binary tree's Root should have been created\")\n assert_nil(@root.left_child, \"The initial left child of root should be nil\")\n assert_nil(@root.right_child, \"The initial right child of root should be nil\")\n assert_equal(@root.children.size, 0, \"Initially no children should be present\")\n end",
"def test_tree_representation\n e =\n'ROOT (0.94)\n outlook => rainy (0.694)\n windy => TRUE (0.0)\n play => no (0.0)\n windy => FALSE (0.0)\n play => yes (0.0)\n outlook => overcast (0.694)\n play => yes (0.0)\n outlook => sunny (0.694)\n humidity => normal (0.0)\n play => yes (0.0)\n humidity => high (0.0)\n play => no (0.0)\n'\n assert_equal e, @tree.to_s\n end",
"def generate_class_tree\n debug_msg \"Generating class tree\"\n tree = generate_class_tree_level\n debug_msg \" writing class tree to %s\" % TREE_FILE\n File.open(TREE_FILE, \"w\", 0644) do |f|\n f.write('var tree = '); f.write(tree.to_json(:max_nesting => 0))\n end unless $dryrun\nend",
"def test_return_array_root_node\n @tree.insert(\"f\")\n assert_equal [\"f\"], @tree.sort\n end",
"def generate_alltest\n\n end",
"def build_tree(arr)\n #arr.shuffle!\n arr.each do |x|\n if @root == nil\n @root = Node.new(x)\n else\n current_node = @root\n until current_node == nil\n if x < current_node.value\n parent = current_node\n direction = \"left\"\n current_node = current_node.left_child\n elsif x > current_node.value\n parent = current_node\n direction = \"right\"\n current_node = current_node.right_child\n end\n end\n if direction == \"left\"\n parent.left_child = Node.new(x)\n elsif direction == \"right\"\n parent.right_child = Node.new(x)\n end\n end\n end\n end",
"def build_unit_test \n \n return if skip_method(__method__)\n \n filename = \"#{singular_table_name}_test.rb\"\n puts \"build Rails unit test for #{model_name} in test/models\"\n # build model test\n \n template = File.read(template(\"rails/test/unit_test.rb\"))\n # #text = ERB.new(template, nil, '-').result(binding)\n text = Erubis::Eruby.new(template).evaluate( self )\n\n path = File.join(\"test\",\"models\",filename)\n write_artifact(path,text)\n end",
"def build_test\n \n return if skip_method(__method__)\n \n build_test_fixtures\n build_test_helper\n build_functional_test\n build_integration_test\n build_unit_test\n end",
"def test_root_setup\n assert_not_nil(@root , \"Root cannot be nil\")\n assert_nil(@root.parent , \"Parent of root node should be nil\")\n assert_not_nil(@root.name , \"Name should not be nil\")\n assert_equal(\"ROOT\" , @root.name, \"Name should be 'ROOT'\")\n assert_equal(\"Root Node\" , @root.content, \"Content should be 'Root Node'\")\n assert(@root.is_root? , \"Should identify as root\")\n assert(!@root.has_children? , \"Cannot have any children\")\n assert(@root.has_content? , \"This root should have content\")\n assert_equal(1 , @root.size, \"Number of nodes should be one\")\n assert_equal(0, @root.siblings.length, \"This root does not have any children\")\n assert_equal(0, @root.in_degree, \"Root should have an in-degree of 0\")\n assert_equal(0, @root.node_height, \"Root's height before adding any children is 0\")\n assert_raise(ArgumentError) { Tree::TreeNode.new(nil) }\n end",
"def build_ranked_tree(model)\n # inflate the node id to test id wrap around edge cases\n # NODES=4..9 seem like edge cases\n ENV[\"NODES\"].to_i.times { model.create!.destroy } if ENV[\"NODES\"]\n\n n1 = model.create!(:rank => 0)\n n2 = model.create!(:rank => 1)\n n3 = model.create!(:rank => 3, :parent => n1)\n n4 = model.create!(:rank => 0, :parent => n2)\n n5 = model.create!(:rank => 0, :parent => n1)\n n6 = model.create!(:rank => 1, :parent => n2)\n\n puts \"create: #{n1.id}..#{n6.id}\" if ENV[\"NODES\"]\n [n1, n2, n3, n4, n5, n6]\n end",
"def tree(capa = 1)\n R3::Tree.new(capa)\nend",
"def build_tree(arr)\n\tend",
"def build_automate_tree(type)\n tree_name = \"#{type}_tree\".to_sym\n\n # build the ae tree to show the tree select box for entry point\n if x_active_tree == tree_name && @edit && @edit[:new][:fqname]\n nodes = @edit[:new][:fqname].split(\"/\")\n @open_nodes = []\n # if there are more than one nested namespaces\n nodes.each_with_index do |_node, i|\n if i == nodes.length - 1\n # check if @cls is there, to make sure the class/instance still exists in Automate db\n inst = @cls ? MiqAeInstance.find_by(:class_id => @cls.id, :name => nodes[i]) : nil\n # show this as selected/expanded node when tree loads\n if inst\n @open_nodes.push(\"aei-#{inst.id}\")\n @active_node = \"aei-#{inst.id}\"\n end\n elsif i == nodes.length - 2\n @cls = MiqAeClass.find_by(:namespace_id => @ns.id, :name => nodes[i])\n @open_nodes.push(\"aec-#{@cls.id}\") if @cls\n else\n @ns = MiqAeNamespace.find_by(:name => nodes[i])\n @open_nodes.push(\"aen-#{@ns.id}\") if @ns\n end\n end\n end\n\n klass = case type\n when :automate\n TreeBuilderAutomate\n when :automate_catalog\n TreeBuilderAutomateCatalog\n end\n\n @automate_tree = klass.new(tree_name, @sb)\n end",
"def make_question_answer_tree\n before :each do\n @reply = 1\n @type_vendor = make_forms_for_app_type \"vendor\"\n @type_donor = make_forms_for_app_type \"donor\"\n \n @q1 = Questionnaire.create(:question => \"hello world\")\n @q2 = Questionnaire.create(:question => \"how are you?\")\n @a1a = Answers.create(:ans => \"hi\", :questionnaire_id => @q1.id, :leads_to => @q2.id)\n @a1b = Answers.create(:ans => @type_donor.app_type, :questionnaire_id => @q1.id, :results_to => @type_donor.id)\n @a2 = Answers.create(:ans => @type_vendor.app_type, :questionnaire_id => @q2.id, :results_to => @type_vendor.id)\n @q2.parent_id = @a1a.id\n @q2.save\n end\n end",
"def test_lt2 # Test the << method\n @root << @child1\n @root << @child2\n @root << @child3 << @child4\n assert_not_nil(@root['Child1'], \"Child 1 should have been added to Root\")\n assert_not_nil(@root['Child2'], \"Child 2 should have been added to Root\")\n assert_not_nil(@root['Child3'], \"Child 3 should have been added to Root\")\n assert_not_nil(@child3['Child4'], \"Child 4 should have been added to Child3\")\n end",
"def create_tests_folder_for(paths)\n Dir.mktmpdir('guard_phpunit') do |d|\n symlink_paths_to_tests_folder(paths, d)\n yield d\n end\n end",
"def unit_test_binary_tree\n node_a = Node.new('A', nil, nil, nil)\n node_b = Node.new('B', nil, nil, nil)\n node_c = Node.new('C', nil, nil, nil)\n node_d = Node.new('D', nil, nil, nil)\n node_e = Node.new('E', nil, nil, nil)\n node_f = Node.new('F', nil, nil, nil)\n node_g = Node.new('G', nil, nil, nil)\n node_h = Node.new('H', nil, nil, nil)\n node_i = Node.new('I', nil, nil, nil)\n node_j = Node.new('J', nil, nil, nil)\n\n tree = Tree.new(nil)\n\n p \"-------------------- BEGIN CONSTRUCTING TREE -------------------- \"\n p \" F \"\n p \" // \\\\ \"\n p \" B G \"\n p \" // \\\\ \\\\ \"\n p \" A D I \"\n p \" // \\\\ // \"\n p \" C E H \"\n\n p \"-------------------- END CONSTRUCTING TREE -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN INRODER TREE WALK -------------------- \"\n p inorder_tree_walk(tree.root)\n p \"-------------------- END INRODER TREE WALK -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN PREORDER TREE WALK -------------------- \"\n p preoder_tree_walk(tree.root)\n p \"-------------------- END PREORDER TREE WALK -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN POSTORDER TREE WALK -------------------- \"\n p postorder_tree_walk(tree.root)\n p \"-------------------- END PREORDER TREE WALK -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN RECURSIVE TREE SEARCH -------------------- \"\n p tree_search(tree.root, 'I')\n p \"-------------------- END RECURSIVE TREE SEARCH -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN ITERATIVE TREE SEARCH -------------------- \"\n p iterative_tree_search(tree.root, 'I')\n p \"-------------------- END ITERATIVETREE SEARCH -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN SEARCHING FOR TREE MIN -------------------- \"\n p tree_minimum(tree.root)\n p \"-------------------- END SEARCHING FOR TREE MIN -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN SEARCHING TREE MAX -------------------- \"\n p tree_maximum(tree.root)\n p \"-------------------- END SEARCHING TREE MAX -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN SEARCHING FOR SUCCESSOR -------------------- \"\n p tree_successor(node_g)\n p \"-------------------- END SEARCHING FOR SUCCESSOR -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN SEARCHING FOR PREDECESSOR -------------------- \"\n p tree_predecessor(node_g)\n p \"-------------------- END SEARCHING FOR PREDECESSOR -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN NODE INSERTION -------------------- \"\n tree_insert(tree, node_j)\n p \" F \"\n p \" // \\\\ \"\n p \" B G \"\n p \" // \\\\ \\\\ \"\n p \" A D I \"\n p \" // \\\\ // \\\\ \"\n p \" C E H J \"\n p \"-------------------- END NODE INSERTION -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN NODE DELETION (SUCCESSOR) -------------------- \"\n tree_delete(tree, node_d)\n p \" F \"\n p \" // \\\\ \"\n p \" B G \"\n p \" // \\\\ \\\\ \"\n p \" A E I \"\n p \" // // \\\\ \"\n p \" C H J \"\n p \"-------------------- END NODE DELETION (SUCCESSOR) -------------------- \"\n preoder_tree_walk(tree.root)\n\n print \"\\n\"\n\n p \"-------------------- BEGIN NODE DELETION (PREDECESSOR) -------------------- \"\n tree_delete_predecessor(tree, node_b)\n p \" F \"\n p \" // \\\\ \"\n p \" A G \"\n p \" \\\\ \\\\ \"\n p \" E I \"\n p \" // // \\\\ \"\n p \" C H J \"\n p \"-------------------- END NODE DELETION (PREDECESSOR) -------------------- \"\n preoder_tree_walk(tree.root)\n end",
"def new\n @smoke_test = SmokeTest.new\n # package builders\n @smoke_test.build_nova_package_builder\n @smoke_test.nova_package_builder.merge_trunk = false\n @smoke_test.build_glance_package_builder\n @smoke_test.glance_package_builder.merge_trunk = false\n @smoke_test.build_keystone_package_builder\n @smoke_test.keystone_package_builder.merge_trunk = false\n @smoke_test.build_swift_package_builder\n @smoke_test.swift_package_builder.merge_trunk = false\n @smoke_test.build_cinder_package_builder\n @smoke_test.cinder_package_builder.merge_trunk = false\n @smoke_test.build_neutron_package_builder\n @smoke_test.neutron_package_builder.merge_trunk = false\n @smoke_test.build_ceilometer_package_builder\n @smoke_test.ceilometer_package_builder.merge_trunk = false\n @smoke_test.build_heat_package_builder\n @smoke_test.heat_package_builder.merge_trunk = false\n\n # config modules\n @smoke_test.build_nova_config_module\n @smoke_test.nova_config_module.merge_trunk = false\n @smoke_test.build_glance_config_module\n @smoke_test.glance_config_module.merge_trunk = false\n @smoke_test.build_keystone_config_module\n @smoke_test.keystone_config_module.merge_trunk = false\n @smoke_test.build_swift_config_module\n @smoke_test.swift_config_module.merge_trunk = false\n @smoke_test.build_cinder_config_module\n @smoke_test.cinder_config_module.merge_trunk = false\n @smoke_test.build_neutron_config_module\n @smoke_test.neutron_config_module.merge_trunk = false\n @smoke_test.build_ceilometer_config_module\n @smoke_test.ceilometer_config_module.merge_trunk = false\n @smoke_test.build_heat_config_module\n @smoke_test.heat_config_module.merge_trunk = false\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @smoke_test }\n format.xml { render :xml => @smoke_test }\n end\n end",
"def create_hiera_template\n options = {ssh_key: Bebox::Project.public_ssh_key_from_file(project_root, environment), project_name: Bebox::Project.shortname_from_file(project_root)}\n Bebox::Provision.generate_hiera_for_steps(self.project_root, \"node.yaml.erb\", self.hostname, options)\n end",
"def tree\n Tree.new(self)\n end",
"def produce_tree(ary); end",
"def test_level\n assert_equal(0, @root.level, \"A root node's level is 0\")\n\n assert_equal(@root.node_depth, @root.level, \"Level and depth should be the same\")\n\n setup_test_tree\n for child in [@child1, @child2, @child3]\n assert_equal(1, child.level, \"Node #{child.name} should have level 1\")\n assert_equal(@root.node_depth, @root.level, \"Level and depth should be the same\")\n end\n\n assert_equal(2, @child4.level, \"Child 4 should have level 2\")\n end",
"def random_tree\n\t\t#range of possible angle separations between branches\n\t\t#big range seems to be ok, 30 to 60 works nice\n\t\t$angle_of_separation = (30..60).to_a\n\t\t#range of possible shrinkage values, will have a decimal in front of it\n\t\t#shrink determines how short each branch is\n\t\t$shrink_range = (4..6).to_a\n\t\t#split determines how many levels of branches there are\n\t\t#below 5 makes a pretty weak tree\n\t\t#above 7 makes a big blob of black\n\t\t$split_range = (5..7).to_a\n\t\t\n\t\t#Determines how many branches the current one splits off into\n\t\t$num_splits = rand(4)+2\n\t\t\n\t\t#how long the \"trunk\" is, height is 600\n\t\t#this gets ugly above 250\n\t\t$trunk = (150..250).to_a\n\t\t\n\t\t#pick a random number from the split range to be used as the number of splits\n\t\t$split_range = $split_range[rand($split_range.length)]\n\t\t#as a decimal, find the factor we will multiply future branches by\n\t\t@shrink = \"0.#{$shrink_range[rand($shrink_range.length)]}\".to_f\n\t\t#pick a random value for the angle of separation from the range\n\t\t$angle_of_separation = $angle_of_separation[rand($angle_of_separation.length)]\n\t\t\n\t\t#make a multidimensional array for branches\n\t\t@branches = []\n\t\t#start at the bottom, but not all the way down\n\t\t#move @x to the top of the trunk, ready for next branches\n\t\t@branches << [ [[@x, Height - @bot_margin], [@x, Height - $trunk[rand($trunk.length)]]] ] \n\t\t\n\t\tputs \"This output is from Random Tree\"\n\t\tputs \"Number of splits: #{$num_splits}\"\n\t\tputs \"Angle of separation: #{$angle_of_separation}\"\n\t\tputs \"Shrink range: #{$shrink_range[0]} to #{$shrink_range[$shrink_range.length-1]}\"\n\t\tputs \"Split range: #{$split_range}\"\n\t\tputs \"Initial branch length: #{$trunk[0]} to #{$trunk[$trunk.length-1]}\"\n\t\t\n\t end",
"def build_tree(ary)\n # If the array is sorted, the tree will not be balanced\n ary.shuffle!\n ary.each { |item| insert(item) }\n end",
"def test_return_sorted_array_two_nodes\n @tree.insert(\"b\")\n @tree.insert(\"a\")\n assert_equal [\"ab\"], @tree.sort\n end",
"def setup\n @testnum += 1\n @tempdirname = \".ocratest-#{$$}-#{@testnum}\"\n Dir.mkdir @tempdirname\n Dir.chdir @tempdirname\n end",
"def create_ruby_test_files\n create_directories\n template \"poro.erb\", ruby_template\n template \"poro_test.erb\", test_template\n end",
"def test_depth_two_levels\n @tree.insert(\"a\")\n @tree.insert(\"b\")\n assert_equal 1, @tree.depth_of?(\"b\")\n end",
"def initialize(height, branching_factor, approx)\n @height = height #get inputs\n @height_count = height\n @branching_factor = branching_factor#get inputs\n @approx = approx#get inputs\n @node_array = []#initialise empty array of nodes\n @node_type = true # set to build daughters first\n get_t_value#get random t_value\n @root_node = RootNode.new\n @root_node.t_value = @t_value # give starting t value to buid tree from\n @node_array << @root_node# to be checked in further building of tree\n build_connecting_nodes(@root_node,@branching_factor)#build first daughters\n @node_type = !@node_type #change to enter next values of interior nodes\n @height_count = @height_count-1 #one layer done\n build_rest_of_tree()\n end",
"def test_create_from_data\n data = @test_record.all_text\n \n creation_test do |record|\n record.create_from_data('', data)\n end\n end",
"def build_tree(array)\n\t\t@root = Node.new(array.shift)\n\t\tarray.each { |value| add_node(value, @root)}\n\tend",
"def build_tree(data)\n @root = Node.new(data[0])\n data.shift\n data.each { |value| @root.insert(value) }\n end",
"def test_fixture_node_group\n ng = node_groups(:one)\n assert ng.valid?\n end",
"def test_node_depth\n assert_equal(0, @root.node_depth, \"A root node's depth is 0\")\n\n setup_test_tree\n\n for child in [@child1, @child2, @child3]\n assert_equal(1, child.node_depth, \"Node #{child.name} should have depth 1\")\n end\n\n assert_equal(2, @child4.node_depth, \"Child 4 should have depth 2\")\n end",
"def create_node(t)\n raise NotImplementedError\n end",
"def test_json_serialization\n setup_test_tree\n\n expected_json = {\n \"name\" => \"ROOT\",\n \"content\" => \"Root Node\",\n JSON.create_id => \"Tree::TreeNode\",\n \"children\" => [\n {\"name\" => \"Child1\", \"content\" => \"Child Node 1\", JSON.create_id => \"Tree::TreeNode\"},\n {\"name\" => \"Child2\", \"content\" => \"Child Node 2\", JSON.create_id => \"Tree::TreeNode\"},\n {\n \"name\" => \"Child3\",\n \"content\" => \"Child Node 3\",\n JSON.create_id => \"Tree::TreeNode\",\n \"children\" => [\n {\"name\" => \"Child4\", \"content\" => \"Grand Child 1\", JSON.create_id => \"Tree::TreeNode\"}\n ]\n }\n ]\n }.to_json\n\n assert_equal(expected_json, @root.to_json)\n end",
"def test_insert_adds_node_at_root\n @tree.insert(\"a\")\n assert_equal \"a\", @tree.root.value\n end",
"def create_test_instances\n model = Sketchup.active_model\n definition = model.definitions.add('TC_Sketchup_InputPoint')\n group1 = definition.entities.add_group\n group2 = group1.entities.add_group\n group2.transform!([10, 20, 30])\n group3 = group2.entities.add_group\n edge = group3.entities.add_line([10, 10, 10], [20, 20, 20])\n tr = Geom::Transformation.new([20, 30, 40])\n instance = model.entities.add_instance(definition, tr)\n [instance, group1, group2, group3, edge]\n end",
"def generate_toc_tree(toc, type, attr); end",
"def create_tree_positions\n # Get the number of qualified participants from the tournament\n if tournament.rankings.empty?\n participants_number = tournament.max_participants\n else\n # Or from the number of qualified from last ranking\n participants_number = tournament.rankings[tournament.rankings.size - 1].qualified\n end\n\n special = false\n next_depth = participants_number\n special_falling = false\n (participants_number * 2 - 1).downto(1) do |pos|\n tree_positions.create(:position => pos, :special => special)\n if tree_type == DOUBLE\n if pos.even?\n tree_positions.create(:position => -pos, :special => false)\n tree_positions.create(:position => -pos, :special => true) if special_falling\n elsif special_falling and pos != 1\n tree_positions.create(:position => -pos, :special => true)\n end\n end\n if pos == next_depth\n special_falling = true\n special = !special\n next_depth /= 2\n end\n end\n end",
"def create_test_directories\n\t\ttrace \"Creating test directory #{TEST_DATADIR}\"\n\t\tTEST_DATADIR.mkpath\n\t\treturn TEST_WORKDIR\n\tend",
"def make_directory_tree\n project_tmp = \"/tmp/#{@package_name}\"\n @scratch = \"#{project_tmp}/#{@title}\"\n @working_tree = {\n 'scripts' => \"#{@scratch}/scripts\",\n 'resources' => \"#{@scratch}/resources\",\n 'working' => \"#{@scratch}/root\",\n 'payload' => \"#{@scratch}/payload\",\n }\n puts \"Cleaning Tree: #{project_tmp}\"\n FileUtils.rm_rf(project_tmp)\n @working_tree.each do |key,val|\n puts \"Creating: #{val}\"\n FileUtils.mkdir_p(val)\n end\n File.open(\"#{@scratch}/#{'prototype.plist'}\", \"w+\") do |f|\n f.write(ERB.new(File.read('tasks/templates/prototype.plist.erb')).result())\n end\n File.open(\"#{@working_tree[\"scripts\"]}/preflight\", \"w+\") do |f|\n f.write(ERB.new(File.read('ext/osx/preflight.erb')).result())\n end\nend",
"def create_tree(node, elem, level, parent)\n node.level = level\n elemtype = check_type(elem[1])\n case elemtype\n when \"array\"\n node.kind = \"array\"\n node.arrsize = elem[1][\".array_size\"].to_i\n if elem[1].has_key?(\".subtype\") && elem[1][\".subtype\"].has_key?(\".members\")\n elem[1][\".subtype\"][\".members\"].each do |m|\n x = Tree.new(m[0], item_type(elem[1]), node)\n node.create_child(x)\n create_tree(x, m, level+1, node)\n end\n if elem[1][\".subtype\"].has_key?(\".type_or_id_name\")\n elem[1][\".subtype\"][\".type_or_id_name\"] =~ /\\((.+)\\): (\\w+)/\n node.s_u_name = $2.clone\n else\n node.s_u_name = \"__ANON__\"\n end\n node.basetype = node.data = elem[1][\".subtype\"][\".type\"].clone\n else\n subkind = check_type(elem[1][\".subtype\"])\n case subkind\n when \"enum\"\n node.basetype = \"enum\"\n node.data = {\".type\" => elem[1][\".subtype\"][\".type\"]}\n node.data[\".type_or_id_name\"] = elem[1][\".subtype\"][\".type_or_id_name\"]\n arr = []\n elem[1][\".subtype\"][\".values\"].each { |k,v| arr << [k,v] }\n node.data[\".values\"] = arr.clone\n node.data[\".values\"].sort! { |a,b| a[1] <=> b[1] }\n when \"numeric_ose\", \"boolean\"\n elem[1][\".subtype\"][\".type_or_id_name\"] =~ /\\((.+)\\): (\\w+)/\n node.basetype = $2.clone\n when \"native\", \"numeric_other\"\n node.basetype = \"OTHER\"\n node.data = {\".type\" => elem[1][\".subtype\"][\".type\"]}\n if elem[1][\".subtype\"].has_key?(\".signed\")\n node.data[\".signed\"] = elem[1][\".subtype\"][\".signed\"] \n end\n if elem[1][\".subtype\"].has_key?(\".type_or_id_name\")\n node.data[\".type_or_id_name\"] = elem[1][\".subtype\"][\".type_or_id_name\"]\n end\n end\n node.leaf = true\n end\n when \"struct\", \"union\"\n node.kind = elemtype\n if is_anon?(elem[1])\n node.s_u_name = \"__ANON__\"\n else\n node.s_u_name = item_name(elem[1])\n end\n elem[1][\".members\"].each do |m|\n x = Tree.new(m[0], item_type(elem[1]), node)\n node.create_child(x)\n create_tree(x, m, level+1, node)\n end\n when \"enum\"\n node.kind = \"enum\"\n node.basetype = \"enum\"\n node.s_u_name = item_name(elem[1])\n node.parent = parent\n node.leaf = true\n arr = []\n elem[1][\".values\"].each { |k,v| arr << [k,v] }\n node.data = arr.clone\n node.data.sort! { |a,b| a[1] <=> b[1] }\n when \"numeric_ose\"\n node.kind = \"numeric\"\n node.basetype = item_name(elem[1])\n node.parent = parent\n node.leaf = true\n when \"boolean\"\n node.kind = \"boolean\"\n node.basetype = item_name(elem[1])\n node.parent = parent\n node.leaf = true\n when \"native\", \"numeric_other\"\n node.kind = \"numeric\"\n node.basetype = \"OTHER\"\n node.data = {'.type' => elem[1][\".type\"]}\n node.data[\".signed\"] = elem[1][\".signed\"] if elem[1].has_key?(\".signed\")\n if elem[1].has_key?(\".type_or_id_name\")\n node.data[\".type_or_id_name\"] = elem[1][\".type_or_id_name\"]\n end\n node.parent = parent\n node.leaf = true\n else\n raise \"Node #{node.name} contains erroneous data\" \n end\n end",
"def create_tests\n if @queue.empty?\n\n test_variants = @test_generator.get_test_with_variants(get_test_path, @test_path_params)\n\n if test_variants\n test_variants.each do |test|\n @queue.push(test)\n end\n end\n\n end\n end",
"def build_tree(arr)\n @root = Node.new(arr.shift)\n arr.each { |data| insert_data(data, @root) }\n end",
"def test_generation\n assert_equal '/parents/parent-id/child-id', @rs.generate(:controller => 'children', :action => 'show', :parent_id => 'parent-id', :id => 'child-id')\n end",
"def tree\n @tree ||= build_tree\n end",
"def plant_a_tree\n new_tree = [OrangeTree.new]\n @tree_array = @tree_array + new_tree\n end",
"def create_structure\n if File.exists?(\"features\") && File.directory?(\"features\")\n return\n else\n FileUtils.mkpath \"features/step_definitions\"\n FileUtils.mkdir \"features/support\"\n FileUtils.mkdir \"features/screenshots\"\n FileUtils.touch\"features/support/env.rb\"\n end\n \n\n end",
"def build_tree\n index = 0\n @ignore_list.each do |attribute|\n #puts \"Attribute: #{attribute}\"\n #puts \"Result: #{@max_result_array[index]}\"\n #puts \"Count: #{@max_class_count_array[index]}\"\n\n @max_class_count_array[index].each do |label, count|\n isLeaf = false\n result = nil\n #puts \"Label: #{label}, Count: #{count}\"\n c1_count = count['<=50K.']\n c2_count = count['>50K.']\n ratio_a = c1_count.to_f / c2_count.to_f\n ratio_b = c2_count.to_f / c1_count.to_f\n #puts \"ratio_a: #{ratio_a} || ratio_b: #{ratio_b} || c1: #{c1_count} || c2: #{c2_count}\"\n if ratio_a >= 30 or ratio_b >= 30 then\n # Have a high ratio, thus we can declare a class\n if c1_count > c2_count\n # declare class 1\n #puts \"Ratio is HIGH, #{ratio_a}, declare any #{attribute} with a #{label} to be class <=50K.\"\n isLeaf = true\n result = '<=50k'\n else\n #puts \"Ratio B is HIGH, #{ratio_b}, declare any #{attribute} with a #{label} to be class >50K.\"\n isLeaf = true\n result = '>50k'\n end\n else\n #puts \"Ratio is too LOW for #{attribute} with label #{label}.\"\n end\n\n if index == 0 then parent = nil else parent = @ignore_list[index-1] end\n\n if isLeaf then\n @tree[label] = Hash['attribute' => attribute, 'label' => label, 'isLeaf' => isLeaf, 'result' => result, 'child' => nil, 'parent' => parent]\n else\n @tree[label] = Hash['attribute' => attribute, 'label' => label, 'isLeaf' => isLeaf, 'result' => result, 'child' => @ignore_list[index+1], 'parent' => parent]\n end\n\n end\n index += 1\n end\n\n @tree.each { |node| puts node }\n end",
"def build_tree(array)\n\t\t@root = Node.new(array[0])\n\t\ttemp_root = @root\n\n\t\tarray[1..-1].each do |node_value|\n\t\t\tinsert_node(node_value, temp_root)\n\t\tend\n\tend",
"def build_tree(unit, node, level = 0)\r\n return nil if level > @max_depth\r\n \t\r\n unit.next_move(node.current_case).each do |next_case|\r\n next if next_case[0] < 0 || next_case[0] > 7 ||\r\n next_case[1] < 0 || next_case[1] > 7 \r\n \r\n next_node = Node.new(next_case, node)\r\n node.children << next_node\r\n\r\n build_tree(unit, next_node, level + 1)\r\n end \r\n end",
"def create_nest(tree)\n Nest.new(self, tree)\n end",
"def test_create_all_locations\n\t\ttest_main = Main.new(3, 4, 6)\n\t\ttest_graph = Graph.new(10)\n\t\ttest_main.create_all_locations(test_graph)\n\t\tassert_equal test_main.num_locations(test_graph), 7\n\tend",
"def build_tree_2(data_array)\n root = nil\n \n data_array.each do |elem|\n node = insert_node(root, nil, elem) \n\troot ||= node\n end\n \n root\nend",
"def create_node(class_name, parent)\n Tree.const_get(class_name.to_s + 'Node')\n .new(parent)\n end",
"def test_depth_three_levels\n @tree.insert(\"c\")\n @tree.insert(\"b\")\n @tree.insert(\"a\")\n assert_equal 2, @tree.depth_of?(\"a\")\n end",
"def test_nested_quote3\n t = build_tree_on('t022-3.txt')\n assert_equal 3, t.array.size\n assert_equal 1, t.array[2].array.size\n end",
"def build_tree_arbitrary(arr)\n node = Node.new(arr[0])\n queue = [node]\n @root = node\n i = 0\n\n until queue.empty?\n node = queue.shift\n children = node_children(node, i, arr)\n queue.concat(children)\n i += 2\n end\n end",
"def generate_alltestc\n\n end",
"def test_initialize_node\n \tassert_equal @n.id, 0\n \tassert_equal @n.neighbors, []\n \tassert_equal @n.string, \"a\"\n end",
"def test_root\n setup_test_tree\n\n # TODO: Should probably change this logic. Root's root should\n # return nil so that the possibility of a recursive error does not exist\n # at all.\n assert_same(@root , @root.root, \"Root's root is self\")\n assert_same(@root , @child1.root, \"Root should be ROOT\")\n assert_same(@root , @child4.root, \"Root should be ROOT\")\n assert_equal(2 , @root.node_height, \"Root's height after adding the children should be 2\")\n end"
] |
[
"0.74843407",
"0.74843407",
"0.7450539",
"0.7450539",
"0.6970523",
"0.67445105",
"0.67445105",
"0.673366",
"0.6630002",
"0.6599638",
"0.65196586",
"0.6453513",
"0.6437223",
"0.63942397",
"0.63213277",
"0.6312018",
"0.6307778",
"0.6289122",
"0.62722176",
"0.62221694",
"0.6218279",
"0.6184791",
"0.612776",
"0.6114071",
"0.6109117",
"0.606271",
"0.60626364",
"0.6056438",
"0.60537684",
"0.605126",
"0.6039249",
"0.60039425",
"0.59805024",
"0.5966445",
"0.5948111",
"0.59016466",
"0.5900258",
"0.59000593",
"0.58823013",
"0.5866745",
"0.5862718",
"0.585742",
"0.58333415",
"0.5829014",
"0.5804184",
"0.57992786",
"0.5798738",
"0.57963556",
"0.57849884",
"0.5773831",
"0.57691425",
"0.57500243",
"0.57247055",
"0.57222253",
"0.5717479",
"0.5716874",
"0.57095695",
"0.5671175",
"0.5670244",
"0.5665432",
"0.56647956",
"0.5663025",
"0.5654658",
"0.56515914",
"0.5647392",
"0.5642042",
"0.5629639",
"0.5611282",
"0.56093436",
"0.56059456",
"0.55896956",
"0.55852515",
"0.5582712",
"0.5579997",
"0.5577798",
"0.5576551",
"0.55755264",
"0.55739975",
"0.55736387",
"0.5573533",
"0.5559529",
"0.55502516",
"0.5546704",
"0.5541689",
"0.55391234",
"0.5520052",
"0.5510588",
"0.5507656",
"0.55072045",
"0.5499527",
"0.54932606",
"0.5487154",
"0.54865015",
"0.5485801",
"0.5483771",
"0.54828316",
"0.5479417",
"0.5467512",
"0.5440547",
"0.5434599"
] |
0.7683765
|
0
|
Tear down the entire structure
|
def teardown
@root = nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def shut_down\n end",
"def tear_down; end",
"def tear_down!\n return unless created?\n\n detach! if attached?\n destroy!\n end",
"def tear_down\n self.instance.tear_down unless self.instance.nil?\n self.instance = nil\n end",
"def shutdown\n @container = nil\n end",
"def down; end",
"def teardown\n Process.kill('KILL',@pid)\n end",
"def destroy\n kill\n reset\n end",
"def cleanup\n end",
"def cleanup\n end",
"def teardown\n $BS.cleanup\n end",
"def cleanup\r\n end",
"def down\n Widget.update_all data_table_id: nil\n\n [DataTableDataset, DataRow, DataTable].each do |clazz|\n clazz.delete_all\n end\n end",
"def nuke\n self.open_graph_event.destroy unless self.open_graph_event.nil?\n self.teamsheet_entries.destroy_all\n self.messages.destroy_all\n self.activity_items.destroy_all\n self.result.destroy unless self.result.nil?\n self.destroy\n end",
"def teardown\r\n @driver.quit\r\n @driver = nil\r\n end",
"def unload\n @all = nil\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end",
"def down\n FhirEndpoint.all.each do |fhir_endpoint|\n reg_org = fhir_endpoint.registered_organization\n\n # If registered_organization exists, carry on. If not, then this is an orphaned fhir_endpoint record\n # that should be destroyed.\n if reg_org\n # Can't reset registered_organization_id to nil because then record is invalid.\n fhir_endpoint.update(organization_id: reg_org.organization_id)\n else\n fhir_endpoint.destroy\n end\n end\n end",
"def down \r\n end",
"def exit\n @interface.hide\n # sth to destroy all dat shit??\n # Shut down propeller\n end",
"def cleanup!; end",
"def cleanup!; end",
"def leave; end",
"def cleanup; end",
"def cleanup; end",
"def cleanup; end",
"def cleanup; end",
"def down\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end",
"def unload!\n @versions = nil\n @version_json = {}\n @last_update = {}\n @maps = {}\n @mappings = nil\n end",
"def destroy\n self.cleanTitle\n @label = []\n \n # Clean up the windows.\n CDK.deleteCursesWindow(@field_win)\n CDK.deleteCursesWindow(@label_win)\n CDK.deleteCursesWindow(@shadow_win)\n CDK.deleteCursesWindow(@win)\n\n # Clean the key bindings.\n self.cleanBindings(self.object_type)\n\n # Unregister this object\n CDK::SCREEN.unregister(self.object_type, self)\n end",
"def shut_down\n puts\n end",
"def reset\n cleanup(true)\n end",
"def down\n\n end",
"def teardown\r\n # Do nothing\r\n @driver.quit\r\n end",
"def teardown\n\t\t\t\t# Do nothing\n\t\tend",
"def down\n execute <<-SQL\n DROP TABLE event_registrations;\n SQL\n\n execute <<-SQL\n DROP TABLE members;\n SQL\n\n execute <<-SQL\n DROP TABLE events;\n SQL\n\n execute <<-SQL\n DROP TABLE treatment_logs;\n SQL\n\n execute <<-SQL\n DROP TABLE feeding_logs;\n SQL\n\n execute <<-SQL\n DROP TABLE employees;\n SQL\n\n execute <<-SQL\n DROP TABLE animals;\n SQL\n\n execute <<-SQL\n DROP TABLE tanks;\n SQL\n\n execute <<-SQL\n DROP TABLE habitats;\n SQL\n end",
"def shutdown; end",
"def shutdown; end",
"def shutdown; end",
"def shutdown; end",
"def shutdown; end",
"def shutdown; end",
"def shutdown; end",
"def teardown\n end",
"def teardown\n end",
"def shutdown\n reset\n @agent.shutdown\n end",
"def teardown()\n # See 6. Disabling the gadget\n # ~ equiv to: echo \"\" > UDC\n System.write(File.join(path_prefix, \"UDC\"), \"\\n\")\n sleep(0.1)\n\n # See 7. Cleaning up\n System.delete(*Dir.glob(File.join(path_prefix, \"configs/*/*\")))\n System.delete(*Dir.glob(File.join(path_prefix, \"configs/*/strings/*\")))\n System.delete(*Dir.glob(File.join(path_prefix, \"configs/*\")))\n System.delete(*Dir.glob(File.join(path_prefix, \"functions/*\")))\n System.delete(*Dir.glob(File.join(path_prefix, \"strings/*\")))\n System.delete(path_prefix)\n end",
"def teardown\n # Do nothing\n @driver.quit\n @sitePerformance.close\n end",
"def shut_down\n @keep_running = false\n @mp.stop\n @mp.shut_down\n end",
"def shutdown\n factory.close\n Pacer.open_graphs.delete url\n end",
"def shutdown\n transition :shutdown\n kill_actors\n close_comm\n NodeCache.delete @id\n MailboxManager.delete Thread.mailbox\n instance_variables.each { |iv| remove_instance_variable iv }\n end",
"def teardown\n # Empty\n end",
"def teardown\n # Empty\n end",
"def shut_down\n @shutdown_lock.synchronize {\n return if @shutting_down\n @shutting_down = true\n }\n die NO_ERROR\n end",
"def teardown\r\n\t\t@vendors = nil\r\n\t\t@vendor = nil\r\n\t\t@model = nil\r\n\t\t@deviceView = nil\r\n\t\t@devicewWhatHas = nil\r\n\t\t@fetchTrees = nil\r\n\t\t@fetchSpecs = nil\r\n\tend",
"def down\n \tdrop_table :solution_submissions\n\n # \texecute <<-SQL\n # \t\tDROP TYPE s_status;\n # \tSQL\n\n # \texecute <<-SQL\n # \t\tDROP TYPE lang;\n # \tSQL\n\n end",
"def unload!\n unload_resources!\n reset_menu!\n end",
"def CleanUp\n\tallGroups.exec(\"killall ITGRecv >/dev/null 2>&1;\")\n\tallGroups.exec(\"killall ITGManager >/dev/null 2>&1; killall ITGSend >/dev/null 2>&1;\") \n\t#set the interfaces down\n @nodes.each do |node|\n\t\tif node.GetType()==\"R\"\n\t\t node.GetInterfaces().each do |ifn|\n\t\t # self.GetGroupInterface(node, ifn).down\n\t\t end\n\t\tend\n\t\t\n\t\tnode.GetInterfaces().each do |ifn| \n\t\t ifn.GetAddresses().each do |add|\n\t\t #info(\"Deleting address #{add.ip} from interface #{add.interface} on node #{node.id}\")\n\t\t Node(node.id).exec(\"ip addr del #{add.ip}/#{add.netmask} dev #{ifn.GetName()}\")\n\t\t end\n\t\tend\n\tend\n end",
"def unload\n @structures = []\n @controllers = []\n @helpers = @helpers.is_a?(Array) ? @helpers.select { |h| h.options[:unloadable] == false } : []\n @authenticators = {}\n @shared_actions = {}\n @default_access = nil\n end",
"def teardown\n end",
"def unload\n Unit.unload(self.label)\n end",
"def shutdown\n end",
"def teardown\n cleanup_tables\n cleanup_caches\n end",
"def teardown\n fakefs_original_teardown\n FakeFS.deactivate!\n end",
"def unload!\n Origen.app.unload_target!\n end",
"def teardown\r\n # Do nothing\r\n @driver.close\r\n end",
"def down\n end",
"def down\n end",
"def down\n end",
"def down\n end",
"def down\n end",
"def shutdown\n stop\n end",
"def shutdown\n end",
"def teardown\n\t\tputs 'teardown: '+ @test_name\n\n\t\t@driver.close\n\t\t@driver.quit\n\tend",
"def desist\n self.class.delete self\n end",
"def cleanup\n\tend",
"def cleanup\n\tend",
"def teardown\n @bu = nil\n end",
"def down\n # un-retext stuff\n @@renames.each do |rename|\n retext_tab(rename[:new_text], rename[:old_text])\n end\n\n task = Task.find_by_name('Update PSD')\n return if task.nil?\n\n # destroy tab\n Tab.find_by_task_id(task.id).destroy\n\n # remove from unlocked lists\n UnlockedTask.where(unlocked_task_id: task.id).destroy_all\n\n # destroy task\n task.destroy\n end",
"def teardown\n nodes.each do |k,v|\n storage = RSpec.configuration.rs_storage[:nodes][k]\n\n next if storage.nil?\n\n ssh = storage[:ssh]\n ssh.close unless ssh.closed?\n end\n\n if destroy\n output << bold(color(\"localhost$\", :green)) << \" vagrant destroy --force\\n\"\n vagrant(\"destroy --force\")\n end\n\n nil\n end",
"def teardown\n @fox_driver.quit\n end",
"def teardown\r\n end",
"def cleanup!\n # This method may be left unimplemented if that is applicable\n end",
"def shutdown\n end",
"def shutdown\n end",
"def shutdown\n end",
"def shutdown\n end",
"def teardown\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def teardown\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def self_destruct\n # `rm -rf *`\nend",
"def teardown\n @mem.mem_clear\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end"
] |
[
"0.7634876",
"0.7227283",
"0.6968223",
"0.6789342",
"0.65773785",
"0.6557551",
"0.65418464",
"0.6479788",
"0.6439508",
"0.6439508",
"0.64275897",
"0.6426667",
"0.64209545",
"0.6413427",
"0.6411198",
"0.6399946",
"0.6380038",
"0.6380038",
"0.6380038",
"0.6380038",
"0.6379036",
"0.6376871",
"0.637479",
"0.63668096",
"0.63668096",
"0.6344962",
"0.6336598",
"0.6336598",
"0.6336598",
"0.6336598",
"0.63239044",
"0.63120764",
"0.63120764",
"0.63120764",
"0.6289183",
"0.6288345",
"0.6282868",
"0.6236929",
"0.6226445",
"0.62257576",
"0.621138",
"0.6206491",
"0.6204426",
"0.6204426",
"0.6204426",
"0.6204426",
"0.6204426",
"0.6204426",
"0.6204426",
"0.6201759",
"0.6201759",
"0.620123",
"0.6195897",
"0.61816317",
"0.61730915",
"0.61712456",
"0.6167373",
"0.6167355",
"0.6167355",
"0.61623096",
"0.61582875",
"0.6157088",
"0.6152957",
"0.61302394",
"0.6128998",
"0.6125334",
"0.6125053",
"0.61239",
"0.61234385",
"0.6122627",
"0.61224675",
"0.6122199",
"0.6121663",
"0.6121663",
"0.6121663",
"0.6121663",
"0.6121663",
"0.6119108",
"0.61167115",
"0.61093026",
"0.610527",
"0.6082926",
"0.6082926",
"0.60765123",
"0.6073895",
"0.60738856",
"0.60730976",
"0.60623133",
"0.6054684",
"0.6046864",
"0.6046864",
"0.6046864",
"0.6046864",
"0.60432637",
"0.60432637",
"0.60342777",
"0.6031013",
"0.60202",
"0.60202",
"0.60202"
] |
0.6168886
|
56
|
Test for presence of the VERSION constant
|
def test_has_version_number
assert_not_nil(Tree::VERSION)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def has_version?; end",
"def valid_version?\n !statement[\"ver\"].empty?\n end",
"def version?(version)\n !!version_named(version.to_sym)\n end",
"def has_version?\n return (@name != @metaname)\n end",
"def test_it_has_a_version_number\n refute_nil ::ApMessageIo::VERSION\n end",
"def check_version(v)\n return true if (!version || version[0..4].gsub(\".\",\"\").to_i>=v)\n return false\n end",
"def available?\n !!version\n end",
"def environment_has_version(environment, version)\n environment = environment.upcase.to_sym\n version = version.to_sym\n !environment_config[environment].nil? and\n !environment_config[environment][version].nil?\n end",
"def test_that_it_has_a_version_number\n refute_nil ::Malody::VERSION\n end",
"def test_redcloth_has_version\n assert RedCloth.included_modules.include?(RedClothVersion)\n assert RedClothVersion.const_defined?(\"VERSION\")\n assert_equal RedClothVersion::VERSION, RedCloth::VERSION\n end",
"def versao?\n \"Versão 1.0\"\n end",
"def version?\n false\n end",
"def check_version(srcdir, version)\n v = File.read(\"#{srcdir}/version.h\").split(\"\\n\").select { |s| s =~ /#define RUBY_VERSION/ }\n raise \"can't find '#define RUBY_VERSION' string\" if !v or v.size == 0\n srcver = v[0].split(' ')[2].split('\"')[1]\n raise BadVersion.new(PKG_NAME, srcver, version) unless srcver == version\nend",
"def version?(*v)\n v.any? { |v| version.index(v.to_s) == 0 }\n end",
"def current_version?\n true\n end",
"def check_version_or_latest_version(version = nil)\n version ||= latest_version\n raise Ajaxlibs::Exception::VersionNotFound unless self.class::Versions.include?(version)\n version\n end",
"def available?\n !version.nil?\n end",
"def pre_0_12?\n VersionRequirement.new('< 0.12.0-alpha').satisfied_by?(version)\n end",
"def invalid?\n %w(undefined 0).include?(version.to_s)\n end",
"def version_present_in_cache?(version)\n tag = %x( cd #{@work_dir} && git tag -l \"#{version}\" )\n tag.strip == \"#{version}\"\n end",
"def have_version?(major, minor = nil, update = nil, build = nil)\n if major.class == Float\n major = major.to_s\n end\n if major.class == String\n major,minor,update = major.split('.').collect { |x| x.to_i }\n end\n if major == @major\n return false if minor != nil && minor != @minor\n return false if update != nil && update != @update\n return false if build != nil && build != @build\n return true\n else\n return false\n end\n end",
"def own_version(version)\n version.release_type == :final\n end",
"def version_ok?\n @version_ok ||= ((GIT_VERSION <=> version) <= 0)\n end",
"def undefined?\n version.nil? or version == 'undefined'\n end",
"def version_mismatch_detected\n end",
"def version?(name)\n Shrine.deprecation(\"Shrine.version? is deprecated and will be removed in Shrine 3.\")\n version_names.nil? || version_names.map(&:to_s).include?(name.to_s)\n end",
"def _validate_version(v)\n if v.to_s.empty?\n results.add_error('version', 'A version is required.')\n elsif v <= Version::ZERO\n results.add_error('version', 'The version of the spec should be' \\\n ' higher than 0.')\n end\n end",
"def has_java_version?(ver)\n java_version.start_with? \"1.#{ver}\"\n end",
"def ___chk_ver(msg)\n ev = ENV['VER']\n return unless ev && msg\n return true if /\\*/ =~ ev\n title = msg.split(\"\\n\").first.upcase\n ev.upcase.split(',').any? do |s|\n ___chk_exp(title, *s.split('!'))\n end\n end",
"def version_requested?\n @version_requested\n end",
"def api_version_match?\n ! api_version_negotiated.nil?\n end",
"def test_that_it_has_a_version_number\n refute_nil ::Paddingoracle::VERSION\n end",
"def valid_version?(version)\n version =~ /\\d+\\.\\d+\\.\\d+(\\.(alpha|beta|rc)(\\.\\d+)?)?/\nend",
"def valid_version?(arg)\n return true if arg == false || arg == 'latest'\n arg =~ /^[0-9]+\\.[0-9]+\\.[0-9]+(-[0-9]+)?$/ ? true : false\n end",
"def required_version\n normalize_version(@required_version ||= nil)\n end",
"def versionable?\n !respond_to?(:is_standard?) || !is_standard?\n end",
"def valid_version?(arg)\n return true if arg == 'latest'\n arg =~ /^[0-9]+\\.[0-9]+\\.[0-9]+(-[0-9]+)?$/ ? true : false\n end",
"def latest_version?\n @requirement.none?\n end",
"def latest_version?\n @requirement.none?\n end",
"def installed_version_matches?(version)\n installed_version? == version\n end",
"def version_condition_met?\n case\n when version_condition.is_a?(Symbol)\n send(version_condition)\n when version_condition.respond_to?(:call) && (version_condition.arity == 1 || version_condition.arity == -1)\n version_condition.call(self)\n else\n version_condition\n end\n end",
"def el_min_version?(version)\n self.rhel_family? && FB::Version.new(self['platform_version']) >= self._canonical_version(version)\n end",
"def supports?\n !@version.nil?\n end",
"def initialized?\n !(version.zero?)\n end",
"def v2?\n version == 2\n end",
"def version_gte_82?\n version >= v82\n end",
"def version_has_service(version, service)\n version = version.to_sym\n service = service.to_sym\n (!service_config[version].nil? and\n service_config[version].include?(service))\n end",
"def check_version(version, requirement)\n Gem::Requirement.new( requirement ).satisfied_by? Gem::Version.new( version )\n end",
"def test_prerelease?(version)\n !@version.stable? && @version.major == version.major && @version.minor == version.minor && @version.patch == version.patch\n end",
"def versioned?\n !!self[:versioned]\n end",
"def initial_version?\n version.zero? && DATA_ATTRIBUTES.all? { |e| send( e ).blank? }\n end",
"def gem_version_more?(name, version)\n Gem.loaded_specs[name].version >= Gem::Version.new(version)\n end",
"def version_gte_81?\n version >= v81\n end",
"def sdk_version_1?\n sdk_version.to_s == '1'\n end",
"def prerelease?(version)\n !!PRERELEASE_STRINGS.detect do |string|\n version.match(/[^\\w]#{string}[^\\w]/)\n end\n end",
"def valid?(ver)\n !!(ver =~ /\\A#{REGEX_FULL}\\Z/)\n end",
"def versioned?\n Bones::VersionedRelease === release\n end",
"def versioned?\n !unversioned?\n end",
"def has_timestamp?(version)\n _ver, build_info = version.split(\"+\")\n return false if build_info.nil?\n\n build_info.split(\".\").any? do |part|\n Time.strptime(part, Omnibus::BuildVersion::TIMESTAMP_FORMAT)\n true\n rescue ArgumentError\n false\n end\n end",
"def check_yaml_version(config)\n # If we don't have one specified assume v1\n config[:version] ? config[:version] : \"1.0.0\"\n end",
"def restrictive_version_specified_gem?(node); end",
"def safe_explicit(version)\n return version if version.to_s == ''\n\n test_version = `bundle #{version} --version`.include?('Could not find command')\n test_version ? '' : version\n end",
"def versionable?\n version_id.nil?\n end",
"def require_matched_dependency_version\n false\n end",
"def sdk_version_3?\n sdk_version.to_s == '3'\n end",
"def api_version_v2?\n client.url_prefix.to_s =~ /v2\\.0/\n end",
"def version_specified_gem?(node); end",
"def version\n @version ||= config(\"version\", \"0.0.1\")\n end",
"def semantic?\n !!(self =~ /^v?\\d+\\.\\d+\\.\\d+$/ ||\n self =~ /^v?\\d+\\.\\d+\\.\\d+\\.(dev|pre)\\d+$/\n )\n end",
"def Check_OS_Version()\n\tos_version = `ver`\n\treturn os_version\nend",
"def version_available?(package_name, desired_version, arch = nil)\n version(package_name, arch, true, false) do |v|\n return true if desired_version == v\n end\n\n false\n end",
"def append_version?\n !!@append_version\n end",
"def current_version?\n version == FirmwareUpgrade.current_software_version\n end",
"def test_version\n assert Snarl.version >= '1.1'\n end",
"def has_current_version_for?(path)\n file_with_any_ext_exists_for?(non_versioned_path(path))\n end",
"def version_gte_61?\n version >= v61\n end",
"def create_version?\n !_skip_version? && !merge_version? && !append_version? && super\n end",
"def ensure_version!(version_number, platform: nil)\n if (e = edit_version(platform: platform))\n if e.version.to_s != version_number.to_s\n # Update an existing version\n e.version = version_number\n e.save!\n return true\n end\n return false\n else\n create_version!(version_number, platform: platform)\n return true\n end\n end",
"def registered?(version)\n registered_versions[version]\n end",
"def required_version\n fetch(:chef_version) || nil\n end",
"def version\n if import_date <= Date.new(2011, 6)\n VERSION::V1\n elsif import_date < Date.new(2012, 11)\n VERSION::V2\n else\n VERSION::V3\n end\n end",
"def version_number\n @version ||= nil\n end",
"def ios_at_least? version\n version.to_f.round(3) <= ios_version.to_f.round(3)\n end",
"def current_version?\n page.content.version == self.version\n end",
"def required_version\n versions.find { |v| dependency.match?(name, v) } ||\n raise(Informative, \"Required version (#{dependency}) not found for `#{name}'.\\nAvailable versions: #{versions.join(', ')}\")\n end",
"def version_check\n version = params[:version]\n return render :status=>400, :json=>{:message=>\"The request must contain the a version number.\"} if version.blank?\n\n #check against current major version of app\n v = version.split(\".\")[0]\n if CURRENT_MAJOR_VERSION.to_i > v.to_i\n render :status=>600, :json=>{:status => \"Needs to upgrade to latest major version\"}\n return\n end\n render :status=>200, :json=>{:status => \"Success\"}\n end",
"def legacy?\n concierge_version.to_s.empty?\n end",
"def is_versioned?\n\t\t\t@is_versioned \n\t\tend",
"def get_version_info\n version_file = Rails.root.join('lib', 'version.json')\n\n File.exist?(version_file) ? read_version_file(version_file) : development_version_info\nend",
"def requires_version(cmd, version_)\n v = check_version(version_)\n unless v[0]\n raise NoMethodError, format('%s is not supported in Bugzilla %s', cmd, v[1])\n end\n end",
"def check_current_version!\n minimum_version = get('minimum_version')\n return if Gem::Dependency.new('', \">= #{minimum_version}\")\n .match?('', VERSION)\n\n raise ClientTooOldError,\n 'The .importjs.json file you are using requires version ' \\\n \"#{get('minimum_version')}. You are using #{VERSION}.\"\n end",
"def is_version(string)\n return false if string === false || string === true || string.nil?\n string.to_s.match(/^\\d+[\\d\\.a-zA-Z\\-_~]*/)\n end",
"def update_version?\n append_version?\n end",
"def version_gte_8?\n version >= v80\n end",
"def verify_swig_version\n @@swig_version ||= IO.popen \"#{env[:swig]} -version 2>&1\" do |swig|\n banner = swig.readlines.reject { |l| l.strip.empty? }\n banner = banner[0].match(/swig version ([^ ]+)/i)\n banner and banner[1]\n end\n unless @@swig_version and @@swig_version >= '1.3'\n raise \"Need SWIG version 1.3 or later (have #{@@swig_version || 'none'})\"\n end\n end",
"def version_gte_72?\n version >= v72\n end",
"def version_type(version)\n data = Settings::ProgramSettings.new.parse(\"https://github.com/Ekultek/whitewidow/blob/master/lib/misc/banner.rb\", \"td\", 57)\n arr = data.split(\" \")\n version_number = arr[7][/(\\d+\\.)?(\\d+\\.)?(\\d+\\.)?(\\*|\\d+)/]\n if version.count(\".\") <= 2\n return \"stable\".green.bold\n elsif version.length >= 3\n return \"dev\".yellow.bold\n elsif version != version_number\n return \"upgrade available\".red.bold\n else\n return \"unknown version type\".red.bold\n end\n\n end",
"def installed?\n !installed_version.nil?\n end",
"def validate_version(version)\n return if SemanticPuppet::Version.valid?(version)\n\n err = \"version string cannot be parsed as a valid Semantic Version\"\n raise ArgumentError, \"Invalid 'version' field in metadata.json: #{err}\"\n end",
"def parameter_validation?\n $client.version_support.es_version_5_x?\nend"
] |
[
"0.73936874",
"0.72455746",
"0.7100905",
"0.7093173",
"0.705587",
"0.6731751",
"0.6705082",
"0.66778785",
"0.66554826",
"0.6620286",
"0.6610916",
"0.65979165",
"0.65637785",
"0.6563375",
"0.65327036",
"0.64933884",
"0.64911956",
"0.64896244",
"0.6430234",
"0.6413429",
"0.63972294",
"0.6392766",
"0.6389781",
"0.6389556",
"0.63362545",
"0.63349926",
"0.6307411",
"0.63034034",
"0.63028365",
"0.62591845",
"0.62554944",
"0.62552845",
"0.6242753",
"0.6235148",
"0.622872",
"0.6203457",
"0.6179016",
"0.6175365",
"0.6175365",
"0.61728704",
"0.61678857",
"0.616696",
"0.6136193",
"0.6133266",
"0.6130308",
"0.6117286",
"0.61091655",
"0.6104554",
"0.6104468",
"0.61039007",
"0.61031073",
"0.6073326",
"0.60595477",
"0.6058306",
"0.6057767",
"0.60553306",
"0.60528195",
"0.6046642",
"0.6028044",
"0.60212344",
"0.6021192",
"0.6014183",
"0.60006434",
"0.59916925",
"0.5984834",
"0.5982945",
"0.5982144",
"0.5982072",
"0.59813625",
"0.5964623",
"0.59616566",
"0.5957488",
"0.5954259",
"0.5951191",
"0.5940293",
"0.5927005",
"0.5918282",
"0.59151745",
"0.5904637",
"0.5900539",
"0.5895386",
"0.58856666",
"0.5883623",
"0.58790785",
"0.58785737",
"0.58779514",
"0.58712584",
"0.5855067",
"0.58421713",
"0.5840491",
"0.5837549",
"0.58315367",
"0.583044",
"0.5823838",
"0.58143294",
"0.58140934",
"0.5812558",
"0.58100504",
"0.57937056",
"0.5792493"
] |
0.6756435
|
5
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.