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
Searches the path, looking for the given utility. If an executable file is found that matches the parameter, this returns true.
def find_in_path(utility) path = (ENV['PATH'] || "").split(File::PATH_SEPARATOR) suffixes = self.class.on_windows? ? self.class.windows_executable_extensions : [""] path.each do |dir| suffixes.each do |sfx| file = File.join(dir, utility + sfx) return true if File.executable?(file) end end false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def installed?(utility)\n return false if execute_as_root(\"which #{utility}\").nil?\n true\n end", "def program_in_path?(program)\n # Scan path to find the executable\n # Do this to help the user get a better error message.\n envpath = ENV[\"PATH\"].split(\":\")\n return env...
[ "0.71268994", "0.6641659", "0.6639891", "0.66239744", "0.654763", "0.63793373", "0.6346122", "0.6250733", "0.6183886", "0.6146379", "0.61130303", "0.6112948", "0.606561", "0.6042703", "0.6040647", "0.6040647", "0.6005289", "0.6000839", "0.5969626", "0.5963465", "0.59526545", ...
0.8518301
0
Returns a value for a configuration key. Params: domain: The file. key: The key. Leave blank to return the whole thing. Example: config/db.yml :development: adapter: mysql app_config(:db, 'adapter') => 'mysql' TODO: Merge this onto a custom monk glue?
def app_config(domain, key=nil) domain = domain.to_sym unless $monk_config $monk_config = Hash.new { Hash.new } end unless $monk_config.include?(domain) fname = root_path('config', "#{domain}.yml") $monk_config[domain] = Hash.new $monk_config[domain] = YAML.load_file(fname) if File.exists?(fname) end return $monk_config[domain][RACK_ENV.to_sym] if key.nil? $monk_config[domain][RACK_ENV.to_sym][key] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getConfigByKey(key, domain = \"grid\") \n qs = <<CONFIG_Q\nSELECT testbeds.#{key} \n FROM testbeds\nWHERE testbeds.node_domain='#{domain}';\nCONFIG_Q\n \n value = nil\n runQuery(qs) { |v| \n value = v\n }\n return value\n end", "def config_for_key(key)\n settings.config[key]\n en...
[ "0.7140688", "0.71347445", "0.7001569", "0.68143064", "0.67630565", "0.6745837", "0.67084044", "0.66505444", "0.65780824", "0.65620655", "0.655565", "0.6540446", "0.65078807", "0.64809424", "0.64587337", "0.6369938", "0.6346507", "0.63408864", "0.63288385", "0.6320109", "0.63...
0.74832577
0
edit method takes two parameters (title, content) first checks if any of the parameters are missing else it will allow the user to edit the post
def edit(title, content) if title.empty? || content.empty? puts "Empty parameters are not allowed!" else self.title = title self.content = content end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_by_title\n @post = Roxiware::Blog::Post.where(:guid=>request.env['REQUEST_PATH']).first\n raise ActiveRecord::RecordNotFound if @post.nil?\n authorize! :edit, @post\n\n respond_to do |format|\n format.html { render :partial =>\...
[ "0.7609094", "0.7412276", "0.7281567", "0.7270827", "0.7267332", "0.72131765", "0.719783", "0.7194104", "0.7182913", "0.71818304", "0.7180925", "0.7169005", "0.7158429", "0.7126956", "0.7126956", "0.71222764", "0.70827585", "0.70822465", "0.70763654", "0.7056292", "0.70458066...
0.8332487
0
=begin :type start: Integer :type end: Integer :rtype: Boolean =end
def book(start, end) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_and_end_set?\n [start, self.end].map(&:present?).uniq.length == 1\n end", "def ends_before_it_begins?\n end_on? && end_on <= start_on\n end", "def valid?\n return false if @range_start_index.nil?\n return false if @range_end_index.nil?\n true\n end", "def range\n\t\t\t#(@e...
[ "0.7516155", "0.7485152", "0.7133263", "0.6964809", "0.6953061", "0.6913597", "0.68867993", "0.67873734", "0.67786384", "0.6765599", "0.67378473", "0.67020434", "0.6639195", "0.6621599", "0.65750074", "0.65583783", "0.65238786", "0.65044016", "0.6498226", "0.6477372", "0.6464...
0.0
-1
before_action :current_hackathon, only: [:show] GET /hackathons GET /hackathons.json
def index @hackathons = Hackathon.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @hackathons = @idea.hacker == current_hacker ? Hackathon.all : []\n end", "def set_hackathon\n @hackathon = Hackathon.find(params[:id])\n end", "def set_hackathon\n @hackathon = Hackathon.find(params[:id])\n end", "def show\n @hackathon = current_hackathon#Hackathon.find_by_...
[ "0.76442385", "0.7446163", "0.7446163", "0.7343967", "0.6764491", "0.67169756", "0.66198206", "0.65687627", "0.65228164", "0.65047747", "0.6462738", "0.63472176", "0.6293509", "0.6293509", "0.6270126", "0.62476164", "0.61884457", "0.61391103", "0.6133563", "0.6112621", "0.610...
0.7222819
5
GET /hackathons/1 GET /hackathons/1.json
def show @hackathon = current_hackathon#Hackathon.find_by_subdomain!(request.subdomain) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @hack = Hack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @hack }\n end\n end", "def index\n @hackathons = Hackathon.all\n end", "def index\n @hackathons = Hackathon.all\n end", "def show\n @hacker = Hacke...
[ "0.7159786", "0.70362145", "0.70362145", "0.6815508", "0.635997", "0.6311304", "0.63040626", "0.62927556", "0.62813", "0.6206364", "0.61890155", "0.6156249", "0.6099722", "0.60654116", "0.6041824", "0.6027863", "0.60082394", "0.6004421", "0.5994112", "0.5994112", "0.593823", ...
0.58550125
23
GET /hackathons/1/edit def edit end POST /hackathons POST /hackathons.json
def create @hackathon = current_user.hackathons.build(hackathon_params) #Hackathon.new(hackathon_params) respond_to do |format| if @hackathon.save format.html { redirect_to hackathons_path, notice: 'Hackathon was successfully created.' } else format.html { render :new } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @hack = Hack.find(params[:id])\n\n respond_to do |format|\n if @hack.update_attributes(params[:hack])\n format.html { redirect_to @hack, :notice => 'Hack was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n ...
[ "0.7336024", "0.7272929", "0.7052996", "0.70367086", "0.68558055", "0.68426126", "0.6781378", "0.6781378", "0.66770595", "0.6586483", "0.6532483", "0.64858025", "0.64858025", "0.64858025", "0.64858025", "0.64858025", "0.64858025", "0.64858025", "0.64858025", "0.64858025", "0....
0.0
-1
Use callbacks to share common setup or constraints between actions. def set_hackathon
def current_hackathon @current_hackathon ||= Hackathon.find_by_subdomain!(request.subdomain) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_hackathon\n @hackathon = Hackathon.find(params[:id])\n end", "def set_hackathon\n @hackathon = Hackathon.find(params[:id])\n end", "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def post_setup\n end", "def before_setup; end", ...
[ "0.59015805", "0.59015805", "0.58767647", "0.5813733", "0.5803964", "0.5663808", "0.5644203", "0.55782396", "0.55782396", "0.55690074", "0.55599064", "0.55562294", "0.554222", "0.5540353", "0.5523439", "0.552104", "0.54757786", "0.54732585", "0.54732585", "0.5465334", "0.5465...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def hackathon_params params.require(:hackathon).permit(:name, :subdomain, :about, :tagline, :location, :logo, :header, :start, :end, :hs_hackers_allowed, :mlh_sanctioned, :user_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Forward all logging calls to the supplied logging instance. Parameters logger: [Object] Instance of an existing logger conforming to the Ruby Logger methods. level: [:trace | :debug | :info | :warn | :error | :fatal] Override the log level for this appender. Default: SemanticLogger.default_level formatter: [Object|Proc] An instance of a class that implements call, or a Proc to be used to format the output from this appender Default: Use the builtin formatter (See: call) filter: [Regexp|Proc] RegExp: Only include log messages where the class name matches the supplied. regular expression. All other messages will be ignored. Proc: Only include log messages where the supplied Proc returns true The Proc must return true or false. Ruby Logger require 'logger' require 'semantic_logger' ruby_logger = Logger.new($stdout) SemanticLogger.add_appender(logger: ruby_logger) logger = SemanticLogger['test'] logger.info('Hello World', some: :payload) Install the `rails_semantic_logger` gem to replace the Rails logger with Semantic Logger.
def initialize(logger:, **args, &block) @logger = logger # Check if the custom appender responds to all the log levels. For example Ruby ::Logger does_not_implement = LEVELS[1..-1].find { |i| !@logger.respond_to?(i) } if does_not_implement raise(ArgumentError, "Supplied logger does not implement:#{does_not_implement}. It must implement all of #{LEVELS[1..-1].inspect}") end super(**args, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attach(logger)\n unless logger.is_a?(::Logger) || logger.is_a?(SemanticLogger::Logger)\n raise ArgumentError,\n \"Must be a Logger, given #{logger.inspect}.\"\n end\n\n logger.formatter = CustomFormatter.new if logger.respond_to?(:formatter=)\n @loggers.push(logger)\n end...
[ "0.6651636", "0.6296584", "0.6244127", "0.62188065", "0.6179801", "0.6179801", "0.61752087", "0.6128238", "0.6105664", "0.60848105", "0.60392874", "0.60356957", "0.60325515", "0.60325515", "0.59994614", "0.5998884", "0.5967885", "0.5967885", "0.5949213", "0.5942988", "0.59296...
0.6130455
7
Pass log calls to the underlying Rails, log4j or Ruby logger trace entries are mapped to debug since :trace is not supported by the Ruby or Rails Loggers
def log(log) @logger.send(log.level == :trace ? :debug : log.level, formatter.call(log, self)) true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trace( *args )\n\t\tRake.application.trace( *args ) if Rake.application.options.trace\n\tend", "def trace(progname = nil, &block)\n if logger.respond_to?(:trace) then\n logger.trace(progname, &block)\n else\n logger.debug(progname, &block)\n end\n end", "def trace!\n requ...
[ "0.703813", "0.70265543", "0.68523526", "0.6717445", "0.6715191", "0.6685685", "0.66593075", "0.66321516", "0.6516877", "0.64701396", "0.6448982", "0.6422256", "0.6422256", "0.64047945", "0.63732153", "0.6366646", "0.6363028", "0.634453", "0.6340288", "0.63394153", "0.6328599...
0.0
-1
Flush all pending logs to disk. Waits for all sent documents to be writted to disk
def flush @logger.flush if @logger.respond_to?(:flush) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flush_pending_files\n return unless Time.now - @last_flush_cycle >= flush_interval\n\n @logger.debug(\"Starting flush cycle\") if @logger.debug?\n @files.each do |path, fd|\n @logger.debug(\"Flushing file\", :path => path, :fd => fd) if @logger.debug?\n fd.flush\n ...
[ "0.7335208", "0.71906996", "0.71709853", "0.708202", "0.6973057", "0.68490595", "0.6678056", "0.66185296", "0.65412074", "0.64928055", "0.64440393", "0.6409431", "0.64044863", "0.6382779", "0.63801146", "0.6378036", "0.63721687", "0.6371252", "0.6364485", "0.63480353", "0.629...
0.6503587
9
Use strong_parameters for attribute whitelisting Be sure to update your create() and update() controller methods.
def image_params params.require(:image).permit(:title, :avatar) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_parameters\n\t\t\tattrs = self.attribute_names - [\"created_at\", \"updated_at\", \"id\"]\n\t\t\tattrs.push(:_color) if colored? # add the color attribute to the permitted attributes if the object is colorable\n\t\t\tif is_encrypted? # add the color attribute to the permitted attributes if the object is...
[ "0.7362868", "0.72757727", "0.690314", "0.6902138", "0.6887883", "0.6829281", "0.6829281", "0.6822533", "0.6821213", "0.6746019", "0.67150944", "0.66879386", "0.6681827", "0.6663225", "0.66562396", "0.6641877", "0.66383517", "0.66281205", "0.66217595", "0.65725005", "0.656038...
0.0
-1
figure out how to avoid this
def get_results(store,pricelist) storename = 'QFC' visit store page.driver.browser.switch_to.frame(0) page.execute_script "wishabi.app.gotoGridView()" #sleep 1 page.first(:button,"Meat & Seafood").click $meaty_targets.each do |m| page.all(:xpath,"//li[@class='item']").each do |node| item_name = node.first(:xpath,"./div[@class='item-name']").text item_price = node.first(:xpath,"./div[@class='item-price']").text pricelist["#{item_name}"] = item_price scan_price(storename, item_name, m, item_price) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def ignores; end", "def placebo?; false end", "def ignore; end", "def missed?; end", "def semact?; false; end", "def miss_reason; end", "def big_bad; end", "def internal?; end", "def missing?; end", "def continued_exception; end", "def anchored; end", "def treat_reserved...
[ "0.6680268", "0.6300925", "0.61187196", "0.6104018", "0.60513717", "0.60412955", "0.6035256", "0.60076827", "0.5959543", "0.5957273", "0.59384876", "0.5917776", "0.5909092", "0.59081095", "0.58277214", "0.58085775", "0.5800024", "0.5797941", "0.57661444", "0.57287365", "0.572...
0.0
-1
Invokes a shell command using ``, checks exit code, and exits (with error) on failure. On success, returns the captured contents of stdout from the command.
def sh(cmd) output = `#{cmd}` if !$?.success? puts "Command exited with failure code: #{cmd}" puts "Aborting." exit(1) end output end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shell_command(command)\n system(command)\n\n result = $?\n\n reporter.info\n if result.exitstatus == 0\n reporter.exclaim(\"Command exited with status code: 0\")\n else\n reporter.error(\"Command exited with status code: #{result.exitstatus}\")\n end\n end", "de...
[ "0.775734", "0.7596361", "0.7477991", "0.7423676", "0.74106145", "0.739385", "0.73905075", "0.7374024", "0.7374024", "0.7206604", "0.717993", "0.71705323", "0.71225643", "0.7104902", "0.7063503", "0.70601076", "0.7052163", "0.7025804", "0.7001788", "0.6996027", "0.6988054", ...
0.77023023
1
GET /course_taken_statuses GET /course_taken_statuses.xml
def index @course_taken_statuses = CourseTakenStatus.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @course_taken_statuses } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @course_taken_status = CourseTakenStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @course_taken_status }\n end\n end", "def statuses\n request(:get, \"applicant_tracking/statuses\")\n end", "def index\n ...
[ "0.6557261", "0.62119085", "0.61170113", "0.59838927", "0.59159535", "0.58334905", "0.5754658", "0.5696767", "0.56424797", "0.56243205", "0.56108516", "0.5580641", "0.5527686", "0.5522457", "0.5507214", "0.5483057", "0.5459593", "0.5442382", "0.54054403", "0.532976", "0.53297...
0.7357751
0
GET /course_taken_statuses/1 GET /course_taken_statuses/1.xml
def show @course_taken_status = CourseTakenStatus.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @course_taken_status } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @course_taken_statuses = CourseTakenStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @course_taken_statuses }\n end\n end", "def new\n @course_taken_status = CourseTakenStatus.new\n\n respond_to do |format|\n format.htm...
[ "0.7365262", "0.63245285", "0.6111569", "0.59841", "0.5945928", "0.57647216", "0.5764186", "0.5689678", "0.566821", "0.5530048", "0.55202085", "0.5484427", "0.54651344", "0.5435974", "0.542176", "0.5416997", "0.54007566", "0.53990394", "0.5357833", "0.5324025", "0.531591", ...
0.6896833
1
GET /course_taken_statuses/new GET /course_taken_statuses/new.xml
def new @course_taken_status = CourseTakenStatus.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @course_taken_status } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @course_taken_status = CourseTakenStatus.new(params[:course_taken_status])\n\n respond_to do |format|\n if @course_taken_status.save\n flash[:notice] = 'CourseTakenStatus was successfully created.'\n format.html { redirect_to(@course_taken_status) }\n format.xml { rend...
[ "0.7239165", "0.66860175", "0.65574086", "0.65574086", "0.65574086", "0.64518034", "0.6449812", "0.64050454", "0.6342047", "0.62267727", "0.62227005", "0.62199646", "0.6216727", "0.62108403", "0.6205984", "0.6204455", "0.6189316", "0.6175301", "0.6142479", "0.6088548", "0.604...
0.7706324
0
POST /course_taken_statuses POST /course_taken_statuses.xml
def create @course_taken_status = CourseTakenStatus.new(params[:course_taken_status]) respond_to do |format| if @course_taken_status.save flash[:notice] = 'CourseTakenStatus was successfully created.' format.html { redirect_to(@course_taken_status) } format.xml { render :xml => @course_taken_status, :status => :created, :location => @course_taken_status } else format.html { render :action => "new" } format.xml { render :xml => @course_taken_status.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @course_taken_statuses = CourseTakenStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @course_taken_statuses }\n end\n end", "def new\n @course_taken_status = CourseTakenStatus.new\n\n respond_to do |format|\n format.htm...
[ "0.6347886", "0.6083683", "0.6036942", "0.5914815", "0.57359225", "0.57359225", "0.5467278", "0.5289846", "0.52535367", "0.52417886", "0.52279454", "0.51972276", "0.518724", "0.5150496", "0.51498663", "0.5148926", "0.51317185", "0.51156706", "0.51053035", "0.510356", "0.50755...
0.6728595
0
PUT /course_taken_statuses/1 PUT /course_taken_statuses/1.xml
def update @course_taken_status = CourseTakenStatus.find(params[:id]) respond_to do |format| if @course_taken_status.update_attributes(params[:course_taken_status]) flash[:notice] = 'CourseTakenStatus was successfully updated.' format.html { redirect_to(@course_taken_status) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @course_taken_status.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @course_taken_status = CourseTakenStatus.find(params[:id])\n @course_taken_status.destroy\n\n respond_to do |format|\n format.html { redirect_to(course_taken_statuses_url) }\n format.xml { head :ok }\n end\n end", "def update\n @course_status = CourseStatus.find(params[:i...
[ "0.6295536", "0.6203752", "0.6118239", "0.6045378", "0.59722424", "0.5718811", "0.56754076", "0.56701005", "0.56130654", "0.55940247", "0.5586368", "0.55779636", "0.55491227", "0.55221033", "0.55066234", "0.5479665", "0.547723", "0.5470403", "0.54344505", "0.5418747", "0.5411...
0.72026896
0
DELETE /course_taken_statuses/1 DELETE /course_taken_statuses/1.xml
def destroy @course_taken_status = CourseTakenStatus.find(params[:id]) @course_taken_status.destroy respond_to do |format| format.html { redirect_to(course_taken_statuses_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @course_status = CourseStatus.find(params[:id])\n @course_status.destroy\n\n respond_to do |format|\n format.html { redirect_to course_statuses_url, :notice => 'Estado de Curso excluído com sucesso.' }\n format.json { head :no_content }\n end\n end", "def delete_course_by_id(...
[ "0.69094086", "0.6822606", "0.6733072", "0.6629627", "0.6596246", "0.6551576", "0.65421045", "0.6533131", "0.65267605", "0.65151125", "0.6513013", "0.6492212", "0.6481534", "0.6481534", "0.6481534", "0.6462452", "0.6440805", "0.6413432", "0.64104295", "0.64007425", "0.6382507...
0.779645
0
this function will transform an array index into a distance from the center each even number (and 0) will return a distance to the left and each odd number will return a distance to the right
def get_adjacent_seat_distance(number) return number % 2 == 0 ? -((number/2).ceil + 1): (number/2.0).ceil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_even_index(arr)\n left_side = 0\n right_side = arr.reduce(:+)\n \n arr.each_with_index do |e, ind|\n right_side -= e\n return ind if left_side == right_side\n left_side += e\n end\n \n -1\nend", "def find_even_index(arr)\r\n last_index = arr.size - 1\r\n arr.each_index do |index|\r\n ...
[ "0.6410662", "0.6389756", "0.63825935", "0.63220316", "0.6312054", "0.61245275", "0.6067801", "0.60641503", "0.60641503", "0.6031119", "0.60054237", "0.5997443", "0.59880745", "0.5931974", "0.59081286", "0.5859166", "0.5833951", "0.5769288", "0.5766366", "0.57509744", "0.5748...
0.0
-1
GET /appissues GET /appissues.json
def fixissues grabissues = Appissue.where('disputant is not null') grabissues.each do |issue| mldlissue = Issue.find_by_old_id(issue.issueid) if mldlissue mldlissue.update_attributes(disputant: issue.disputant) end end defaultdef = 'Enter Field Definition Here' pops = Infopopup.create([ {code: 'issue_name', title: 'Issue Name' , body: defaultdef }, {code: 'issue_structure', title: 'Structure (CSC,DSC,CF,NSC)' , body: defaultdef }, {code: 'issue_community', title: 'Community' , body: defaultdef }, {code: 'issue_district', title: 'District' , body: defaultdef }, {code: 'issue_disputantstext', title: 'Disputants (General)' , body: defaultdef }, {code: 'issue_raisedby', title: 'Issue Raised By' , body: defaultdef }, {code: 'issue_origin', title: 'Issue Origin' , body: defaultdef }, {code: 'issue_origintext', title: 'Origin Notes' , body: defaultdef }, {code: 'issue_category', title: 'Category' , body: defaultdef }, {code: 'issue_othercategory', title: 'Other (New) Category' , body: defaultdef }, {code: 'issue_description', title: 'Issue Description' , body: defaultdef }, {code: 'issue_actionplan', title: 'Action Plan' , body: defaultdef }, {code: 'issue_committee', title: 'Action Plan Committee' , body: defaultdef } ]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gather_issues\n url = \"#{URL}/projects/foreman/issues.json?status_id=1&limit=100&release_id=#{@current_release_id}\"\n puts url\n uri = URI(URI.escape(url))\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend", "def issues\n Sifter.\n get(api_issues_url).\n fetch(\"issues\", []).\n...
[ "0.7623517", "0.7402823", "0.7136208", "0.70497733", "0.7016549", "0.68888617", "0.68825144", "0.68783426", "0.68474704", "0.68474704", "0.68474704", "0.68474704", "0.68474704", "0.68398625", "0.676394", "0.67511284", "0.6744021", "0.6650947", "0.6594267", "0.6581418", "0.657...
0.0
-1
GET /appissues/1 GET /appissues/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gather_issues\n url = \"#{URL}/projects/foreman/issues.json?status_id=1&limit=100&release_id=#{@current_release_id}\"\n puts url\n uri = URI(URI.escape(url))\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend", "def index\n @issues = Issue.all\n\n respond_to do |format|\n format.html...
[ "0.7633088", "0.708079", "0.70786434", "0.6941061", "0.6941061", "0.6941061", "0.6941061", "0.6941061", "0.69325644", "0.68989736", "0.689465", "0.6841955", "0.67927617", "0.67927504", "0.6775119", "0.6686094", "0.6648518", "0.6644789", "0.6641799", "0.66144466", "0.6599141",...
0.0
-1
POST /appissues POST /appissues.json
def create @appissue = Appissue.new(appissue_params) respond_to do |format| if @appissue.save format.html { redirect_to @appissue, notice: 'Appissue was successfully created.' } format.json { render :show, status: :created, location: @appissue } else format.html { render :new } format.json { render json: @appissue.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def appissue_params\n params.require(:appissue).permit(:uuid, :yourname, :originalmeet, :issueid, :meetingname, :structurecode, :county, :district, :status, :issuedistrict, :community, :category, :raisedby, :disputant, :duration, :actioncommittee, :actiondescription, :actionnote, :resolved, :resolutiondate, :...
[ "0.6565665", "0.62447995", "0.62040263", "0.6156489", "0.5986978", "0.5986538", "0.59783226", "0.5965905", "0.5962395", "0.594153", "0.5930341", "0.5923988", "0.5917195", "0.5917195", "0.5917195", "0.5917195", "0.5866256", "0.582401", "0.5815033", "0.5797212", "0.5790172", ...
0.70455647
0
PATCH/PUT /appissues/1 PATCH/PUT /appissues/1.json
def update respond_to do |format| if @appissue.update(appissue_params) format.html { redirect_to @appissue, notice: 'Appissue was successfully updated.' } format.json { render :show, status: :ok, location: @appissue } else format.html { render :edit } format.json { render json: @appissue.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @issues = args[:issues] if args.key?(:issues)\n end", "def update\n respond_to do |format|\n if issue.save\n format.html { redirect_to issue, notice: 'Issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html...
[ "0.6476491", "0.647034", "0.6438442", "0.6438297", "0.6412169", "0.64082605", "0.6372775", "0.63041675", "0.63041675", "0.63041675", "0.63041675", "0.63041675", "0.63031846", "0.6286853", "0.6190942", "0.61792684", "0.6139088", "0.6122174", "0.61100245", "0.6097891", "0.60819...
0.7068831
0
DELETE /appissues/1 DELETE /appissues/1.json
def destroy @appissue.destroy respond_to do |format| format.html { redirect_to appissues_url, notice: 'Appissue was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n issues_permissions\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url }\n format.json...
[ "0.72342044", "0.71041113", "0.7074694", "0.7052106", "0.7052106", "0.7052106", "0.7052106", "0.6986224", "0.696223", "0.6934247", "0.69060093", "0.690407", "0.68661135", "0.6844768", "0.68350565", "0.68350565", "0.68350565", "0.68350565", "0.68350565", "0.68350565", "0.68343...
0.76093173
0
Use callbacks to share common setup or constraints between actions.
def set_appissue @appissue = Appissue.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_...
[ "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.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def appissue_params params.require(:appissue).permit(:uuid, :yourname, :originalmeet, :issueid, :meetingname, :structurecode, :county, :district, :status, :issuedistrict, :community, :category, :raisedby, :disputant, :duration, :actioncommittee, :actiondescription, :actionnote, :resolved, :resolutiondate, :docslink, :updatetype, :resolutiontype, :updated_on, :updatedesc, :mediationdate, :mediationoutcome, :issuedesc, :issuename, :issuenote, :statusnote) 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...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Baseline implementation for the list_conversation_profiles REST call
def list_conversation_profiles request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_list_conversation_profiles_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Dialogflow::V2::ListConversationProfilesResponse.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def profiles \n personid = params[:id]\n @response = JSON.parse(current_user.access_token.token.get('/api/v0/aspects/profiles?ids=['+params[:id]+']'))\n respond_to do |format|\n format.html\n format.json {render :json=> @response, :callback=>params[:callback]}#{render json: @response}\...
[ "0.6795803", "0.633012", "0.62877375", "0.62823063", "0.6275993", "0.627133", "0.62433016", "0.6229642", "0.6226919", "0.62130594", "0.62004906", "0.6192344", "0.61671764", "0.6159476", "0.6115283", "0.6093136", "0.6093136", "0.6063559", "0.605651", "0.592843", "0.58888906", ...
0.7216637
0
Baseline implementation for the get_conversation_profile REST call
def get_conversation_profile request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_get_conversation_profile_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Dialogflow::V2::ConversationProfile.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_profile\n \n profil =\n Excon.get(\n 'https://eastus.api.cognitive.microsoft.com/speaker/identification/v2.0/text-independent/profiles',\n headers: {\n 'Content-Type' => 'application/json',\n 'Ocp-Apim-Subscription-Key' => \"3c43bca9ad884fe39518a5c...
[ "0.68915564", "0.65818363", "0.6530704", "0.6516649", "0.6503777", "0.631252", "0.63016474", "0.6290444", "0.6237772", "0.6237381", "0.62291396", "0.6229121", "0.61922944", "0.61689526", "0.6098032", "0.6093718", "0.6091055", "0.6058805", "0.60563934", "0.6054143", "0.6043113...
0.70812166
0
Baseline implementation for the create_conversation_profile REST call
def create_conversation_profile request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_create_conversation_profile_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Dialogflow::V2::ConversationProfile.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_profile(profile, options = {})\n options = @@create_profile_option_defaults.merge(options)\n @type = Type::CIM_CREATE_PROFILE\n @fields.merge!(profile.to_hash)\n set_fields(:validation_mode => options[:validation_mode])\n make_request\n end", "def create\n @profile = Pro...
[ "0.6799689", "0.66992396", "0.6656566", "0.6634261", "0.655533", "0.6509754", "0.648564", "0.64830285", "0.6447102", "0.6434505", "0.643138", "0.6416683", "0.6398551", "0.6395909", "0.63842714", "0.6377861", "0.63738966", "0.63224715", "0.63218683", "0.63099015", "0.62719727"...
0.69232833
0
Baseline implementation for the update_conversation_profile REST call
def update_conversation_profile request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_update_conversation_profile_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Dialogflow::V2::ConversationProfile.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n\t\t@user = current_user\n\t\t@profile = @user.profile\n\t\t@profile.update_columns(profile_params)\n\t\trespond_with @profile \n\tend", "def update_profile(body={})\n perform_post(\"/account/update_profile.json\", :body => body)\nend", "def update\n @profile.update(profile_params)\n respond...
[ "0.69392073", "0.6887954", "0.6861052", "0.6836325", "0.6727704", "0.6710338", "0.67055506", "0.67055506", "0.6698381", "0.6690381", "0.66900635", "0.6638787", "0.6630907", "0.66270626", "0.66201967", "0.66153264", "0.6612879", "0.6607862", "0.6594756", "0.65725297", "0.65623...
0.71189284
0
Baseline implementation for the delete_conversation_profile REST call
def delete_conversation_profile request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_delete_conversation_profile_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n authorize @profile\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: \"Profile: #{I18n.t('helpers.deleted')}\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_with(@profile)\n end"...
[ "0.71087694", "0.70774597", "0.70670146", "0.70670146", "0.70670146", "0.70670146", "0.70670146", "0.70670146", "0.70670146", "0.70670146", "0.69782734", "0.6942498", "0.69128966", "0.69069743", "0.6877409", "0.6869103", "0.68683976", "0.68683976", "0.68595856", "0.68594056", ...
0.7701637
0
Baseline implementation for the set_suggestion_feature_config REST call
def set_suggestion_feature_config request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_set_suggestion_feature_config_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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...
[ "0.62082344", "0.62082344", "0.62082344", "0.62082344", "0.62082344", "0.62082344", "0.62082344", "0.60902286", "0.5976258", "0.5911617", "0.585909", "0.5832947", "0.57687473", "0.57668483", "0.5654981", "0.5604486", "0.5537915", "0.55259573", "0.54606605", "0.54563385", "0.5...
0.75039405
0
Baseline implementation for the clear_suggestion_feature_config REST call
def clear_suggestion_feature_config request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_clear_suggestion_feature_config_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decline_suggestion(id)\n delete(\"suggestions/#{id}\")\n end", "def clear_options\n @entries = {}\n end", "def set_suggestion_feature_config request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb,...
[ "0.5924671", "0.57042277", "0.5528084", "0.55245775", "0.5473869", "0.524984", "0.5240474", "0.52359885", "0.5231285", "0.51986146", "0.518803", "0.5177607", "0.5153739", "0.5151589", "0.5150886", "0.5136548", "0.5135517", "0.5124979", "0.5082687", "0.5071328", "0.506629", ...
0.768859
0
The list of procs that have been registered with Merb to run when Merb exits gracefully. ==== Returns Array:: The current list of procs :api: private
def at_exit_procs @at_exit_procs ||= [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def procs\n @procs\n end", "def get_proc_list(pattern, zombies)\n require 'sys/proctable'\n require 'etc'\n\n res = Sys::ProcTable.ps.map do |ps|\n ret = nil\n\n if ps[\"cmdline\"] =~ /#{pattern}/\n ...
[ "0.7175663", "0.65965736", "0.65805227", "0.6511848", "0.61827743", "0.60078037", "0.59939843", "0.5944946", "0.59396577", "0.59156376", "0.58181083", "0.5784599", "0.5745436", "0.574331", "0.57421476", "0.5736746", "0.5689943", "0.5682515", "0.56719273", "0.5671646", "0.5649...
0.710872
1
Set the current exiting state of Merb. Setting this state to true also alerts Extlib to exit and clean up its state. ==== Returns Boolean:: The current exiting state of Merb :api: private
def exiting=(bool) Extlib.exiting = bool @exiting = bool if bool if Extlib.const_defined?("Pooling") && Extlib::Pooling.scavenger Extlib::Pooling.scavenger.wakeup end while prc = self.at_exit_procs.pop prc.call end unless Merb::Config[:reap_workers_quickly] end @exiting end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_as_exit\n @exit = true\n end", "def exit?\n @exit\n end", "def exit_state\n end", "def exit(state_manager, game)\n exiting = true\n end", "def exited?\n return true\n end", "def exit_state\n puts \"Exiting #{self.class}\"\n execution_state = EXECUTION_STATE...
[ "0.72830784", "0.66422087", "0.660748", "0.6497333", "0.62914866", "0.6227051", "0.60878164", "0.5969949", "0.59096974", "0.58791566", "0.5878943", "0.5878943", "0.5878943", "0.58075047", "0.5772733", "0.56509256", "0.5589065", "0.5586791", "0.5581721", "0.5550086", "0.553616...
0.7182184
1
Register a proc to run when Merb is exiting gracefully. It will not be run when Merb exits quickly. ==== Returns Array:: The current list of procs to run when Merb exits gracefully :api: plugin
def at_exit(&blk) self.at_exit_procs << blk end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def at_exit_procs\n @at_exit_procs ||= []\n end", "def at_exit(&block); end", "def on_exit\n end", "def on_exit(&block)\n @on_exit ||= block\n end", "def register_at_exit\n return if at_exit_handler_installed?\n @exit_handler_added = true\n at_exit do\n if $!\n ...
[ "0.733178", "0.60367", "0.5870227", "0.58414006", "0.57955164", "0.57184213", "0.5617933", "0.5596219", "0.55224514", "0.551371", "0.5490566", "0.54862493", "0.54676515", "0.54574764", "0.5400623", "0.5373823", "0.5352631", "0.5295358", "0.526847", "0.52499497", "0.5244951", ...
0.7148339
1
Merge environment settings This can allow you to have a "localdev" environment that runs like your "development". OR A "staging" environment that runs identical to your "production" environment. ==== Examples From any environment config file (ie, development.rb, custom.rb, localdev.rb, etc). staging.rb: Merb.merge_env "production" We want to use all the settings production uses Merb::Config.use do |c| c[:log_level] = "debug" except we want debug log level
def merge_env(env,use_db=false) if Merb.environment_info.nil? Merb.environment_info = { :real_env => Merb.environment, :merged_envs => [], :db_env => Merb.environment } end #Only load if it hasn't been loaded unless Merb.environment_info[:merged_envs].member? env Merb.environment_info[:merged_envs] << env env_file = Merb.dir_for(:config) / "environments" / ("#{env}.rb") if File.exists?(env_file) load(env_file) else Merb.logger.warn! "Environment file does not exist! #{env_file}" end end # Mark specific environment to load when ORM loads, # if multiple environments are loaded, the last one # with use_db as TRUE will be loaded if use_db Merb.environment_info[:db_env] = env end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merged_settings\n merged = self.class.current\n settings_hash.each do |k, v|\n if v.present?\n merged['production'][k] = v\n else\n merged['production'].delete(k)\n end\n end\n merged\n end", "def merge_opts_with_env opts = {}\n merge_env (opts...
[ "0.6614996", "0.63893145", "0.6315756", "0.62785745", "0.6191162", "0.60800105", "0.60276586", "0.60104597", "0.5909293", "0.58564955", "0.5849791", "0.5738993", "0.57047933", "0.569367", "0.56631005", "0.564564", "0.55872416", "0.5567633", "0.5567633", "0.5556669", "0.552585...
0.7210429
0
Start Merb by setting up the Config and then starting the server. Set the Merb application environment and the root path. ==== Parameters argv:: The config arguments to start Merb with. Defaults to +ARGV+. :api: public
def start(argv = ARGV) Merb::Config[:original_log_stream] = Merb::Config[:log_stream] Merb::Config[:log_stream] ||= STDOUT if Hash === argv Merb::Config.setup(argv) elsif !argv.nil? Merb::Config.parse_args(argv) end Merb::Config[:log_stream] = STDOUT Merb.environment = Merb::Config[:environment] Merb.root = Merb::Config[:merb_root] case Merb::Config[:action] when :kill Merb::Server.kill(Merb::Config[:port], 2) when :kill_9 Merb::Server.kill(Merb::Config[:port], 9) when :fast_deploy Merb::Server.kill("main", "HUP") else Merb::Server.start(Merb::Config[:port], Merb::Config[:cluster]) @started = true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_environment(argv=ARGV)\n unless (@started ||= false)\n start(argv)\n @started = true\n end\n end", "def start_environment(argv=ARGV)\n start(argv) unless (@started ||= false)\n end", "def parse_args(argv = ARGV)\n @configuration ||= {}\n # Our primary ...
[ "0.65432805", "0.64673465", "0.6244221", "0.6145305", "0.59608686", "0.59592724", "0.5922934", "0.5834093", "0.5823664", "0.57808584", "0.5729175", "0.57288045", "0.56957936", "0.5673257", "0.5627707", "0.56011754", "0.53863263", "0.53288126", "0.53092796", "0.52951676", "0.5...
0.8081475
0
Start the Merb environment, but only if it hasn't been loaded yet. ==== Parameters argv:: The config arguments to start Merb with. Defaults to +ARGV+. :api: public
def start_environment(argv=ARGV) start(argv) unless (@started ||= false) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(argv = ARGV)\n Merb::Config[:original_log_stream] = Merb::Config[:log_stream]\n Merb::Config[:log_stream] ||= STDOUT\n if Hash === argv\n Merb::Config.setup(argv)\n elsif !argv.nil?\n Merb::Config.parse_args(argv)\n end\n\n Merb::Config[:log_stream] = STDOUT\n ...
[ "0.76502573", "0.7490077", "0.64237034", "0.64234376", "0.6011664", "0.5926128", "0.56266725", "0.5621916", "0.55598474", "0.55005074", "0.5358295", "0.5340261", "0.5289846", "0.52618694", "0.52579117", "0.521405", "0.521405", "0.521405", "0.51876515", "0.51689583", "0.515068...
0.7593625
1
Restart the Merb environment explicitly. ==== Parameters argv:: The config arguments to restart Merb with. Defaults to +Merb::Config+. :api: public
def restart_environment(argv={}) @started = false start_environment(Merb::Config.to_hash.merge(argv)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(argv = ARGV)\n Merb::Config[:original_log_stream] = Merb::Config[:log_stream]\n Merb::Config[:log_stream] ||= STDOUT\n if Hash === argv\n Merb::Config.setup(argv)\n elsif !argv.nil?\n Merb::Config.parse_args(argv)\n end\n\n Merb::Config[:log_stream] = STDOUT\n ...
[ "0.64115137", "0.6108882", "0.5935461", "0.5831562", "0.55668914", "0.5519562", "0.5514436", "0.5296722", "0.5267378", "0.5236678", "0.5158023", "0.50485575", "0.50481886", "0.4974159", "0.4950475", "0.48960024", "0.48590678", "0.4838173", "0.48004836", "0.47638324", "0.47608...
0.83249617
0
This is the mechanism for setting up your application layout. There are three application layouts in Merb: 1. Regular app/:type layout of Ruby on Rails fame: app/models for models app/mailers for mailers (special type of controllers) app/parts for parts, Merb components app/views for templates app/controllers for controller lib for libraries 2. Flat application layout: application.rb for models, controllers, mailers, etc config/init.rb for initialization and router configuration config/framework.rb for framework and dependencies configuration views for views 3. Campingstyle "very flat" application layout, where the whole Merb application and configs are contained within a single file. ==== Notes Autoloading for lib uses an empty glob by default. If you want to have your libraries under lib use autoload, add the following to Merb init file: Merb.push_path(:lib, Merb.root / "lib", "/.rb") glob set explicity. Then lib/magicwand/lib/magicwand.rb with MagicWand module will be autoloaded when you first access that constant. ==== Examples This method gives you a way to build up your own application structure, for instance, to reflect the structure Rails uses to simplify transition of legacy application, you can set it up like this: Merb.push_path(:model, Merb.root / "app" / "models", "/.rb") Merb.push_path(:mailer, Merb.root / "app" / "models", "/.rb") Merb.push_path(:controller, Merb.root / "app" / "controllers", "/.rb") Merb.push_path(:view, Merb.root / "app" / "views", "/.rb") ==== Parameters type:: The type of path being registered (i.e. :view) path:: The full path file_glob:: A glob that will be used to autoload files under the path. Defaults to "/.rb". :api: public
def push_path(type, path, file_glob = "**/*.rb") enforce!(type => Symbol) load_paths[type] = [path, file_glob] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_default_structure!\n self.push_app_path(:root, Merb.root / 'slices' / self.identifier)\n \n self.push_path(:application, root_path('app'))\n self.push_app_path(:application, app_dir_for(:root) / 'app')\n \n app_components.each do |component|\n self.push_pa...
[ "0.6482224", "0.6159048", "0.6024797", "0.5928061", "0.59042597", "0.59042597", "0.5747972", "0.5702957", "0.5693537", "0.5575712", "0.5555482", "0.547292", "0.5411951", "0.53994375", "0.5382453", "0.5378587", "0.53769094", "0.5375027", "0.5370487", "0.5345133", "0.5338547", ...
0.0
-1
Removes given types of application components from load path Merb uses for autoloading. ==== Parameters args:: component(s) names, for instance, :views, :models ==== Examples Using this combined with Merb::GlobalHelpers.push_path you can make your Merb application use legacy Rails application components. Merb.root = "path/to/legacy/app/root" Merb.remove_paths(:mailer) Merb.push_path(:mailer, Merb.root / "app" / "models", "/.rb") Will make Merb use app/models for mailers just like Ruby on Rails does. :api: public
def remove_paths(*args) args.each {|arg| load_paths.delete(arg)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_app_paths(*args)\n args.each { |arg| self.app_paths.delete(arg) }\n end", "def remove_paths(*args)\n args.each { |arg| self.slice_paths.delete(arg) }\n end", "def uninstall_app(*args)\n # remove files based on pkg info (boms)\n # or\n # just remove the app directory\...
[ "0.7156513", "0.60381466", "0.59769446", "0.5638225", "0.55413496", "0.5480516", "0.53811413", "0.5342087", "0.52772367", "0.5273739", "0.5260434", "0.515536", "0.5115807", "0.5084547", "0.50723153", "0.5067074", "0.50625145", "0.50566447", "0.5045894", "0.5028138", "0.498342...
0.6570889
1
==== Parameters type:: The type of path to retrieve directory for, e.g. :view. ==== Returns String:: The directory for the requested type. :api: public
def dir_for(type) Merb.load_paths[type].first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path_for(type = nil)\n if @outdir\n File.join(@outdir, basename(type))\n elsif @basename\n File.join(File.dirname(path), basename(type))\n else\n basename(type)\n end\n end", "def dir_for(type) self.slice_paths[type].first end", "def dir\n Rails.root.join(ROOT...
[ "0.75043255", "0.7385963", "0.7360968", "0.71627593", "0.71124184", "0.6932511", "0.69295406", "0.68192786", "0.677121", "0.6771159", "0.67591125", "0.6728954", "0.6663269", "0.6590068", "0.6583932", "0.65394026", "0.6440619", "0.64103395", "0.6355211", "0.6332578", "0.629948...
0.73222136
3
==== Parameters type:: The type of path to retrieve glob for, e.g. :view. ===== Returns String:: The pattern with which to match files within the type directory. :api: public
def glob_for(type) Merb.load_paths[type][1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list type\n Dir.chdir(\"#{Rails.root}/#{type.to_s}\")\n @files[type] = Dir.glob(\"**/*.#{@paths[type]}\")\n end", "def glob_for(type) Merb.load_paths[type][1] end", "def patterns_for_type(type_)\n @mutex.synchronize do\n typedata_ = @types[type_]\n typedata_ ? typedata_.dup : [...
[ "0.6909645", "0.667226", "0.6664508", "0.65452325", "0.6403013", "0.6239749", "0.61793834", "0.61491394", "0.60685635", "0.60496414", "0.60369426", "0.5988183", "0.5938639", "0.5926034", "0.59067434", "0.5856404", "0.5832997", "0.5824263", "0.5780722", "0.57648927", "0.576489...
0.7283511
0
==== Returns String:: The Merb root path. :api: public
def root @root || Merb::Config[:merb_root] || File.expand_path(Dir.pwd) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def root() @root || Merb::Config[:merb_root] || Dir.pwd end", "def base_path\n @base_path ||= self.class.respond_to?(:base_path) ? self.class.base_path : Merb.dir_for(:public)\n end", "def get_root\n return File.join('/root/path', SETTINGS[:project])\n end", "def rails_root\n @...
[ "0.7745757", "0.7491813", "0.7437405", "0.73077166", "0.726643", "0.72351897", "0.7125598", "0.71253484", "0.7085705", "0.7073503", "0.7072896", "0.7072896", "0.7072896", "0.7034792", "0.7018614", "0.698821", "0.6969219", "0.69356424", "0.6911464", "0.6882555", "0.68768495", ...
0.802954
0
==== Parameters value:: Path to the root directory. :api: public
def root=(value) @root = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def root=(value)\n @root = Utils::Kernel.Pathname(value).realpath\n end", "def root(value = nil)\n if value\n @root = value\n else\n Utils::Kernel.Pathname(@root || Dir.pwd).realpath\n end\n end", "def root_path\n Pathname.new(upload_path_value).join(search_direct...
[ "0.7588422", "0.72732353", "0.71736187", "0.71224666", "0.69455403", "0.67138153", "0.6647485", "0.66219", "0.6608686", "0.66069776", "0.65929306", "0.65868133", "0.65726495", "0.6563163", "0.6555529", "0.6549068", "0.65281844", "0.65247405", "0.6519427", "0.65092963", "0.647...
0.0
-1
==== Parameters path:: The relative path (or list of path components) to a directory under the root of the application. ==== Returns String:: The full path including the root. ==== Examples Merb.root = "/home/merb/app" Merb.path("images") => "/home/merb/app/images" Merb.path("views", "admin") => "/home/merb/app/views/admin"
def root_path(*path) File.join(root, *path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_path(path)\n return '' if path.blank?\n return path if path[0] == '/'\n Rails.root.to_s + '/' + path\n end", "def relativize_path(path)\n path.to_s.gsub(/^\\/?#{Regexp.escape(root_path.to_s)}\\/?/, '')\n end", "def path(path)\n return self if path.nil?\n return root....
[ "0.7798731", "0.7050255", "0.7048168", "0.69759846", "0.69596094", "0.6955613", "0.693802", "0.6891928", "0.688705", "0.68504584", "0.6827634", "0.6797881", "0.6797881", "0.6770034", "0.67669904", "0.6738826", "0.6698579", "0.66985077", "0.6657941", "0.6649844", "0.6644207", ...
0.70435417
3
Return the Merb Logger object for the current thread. Set it up if it does not exist. :api: public
def logger Thread.current[:merb_logger] ||= Merb::Logger.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logger\n @logger ||= build_logger\n end", "def logger\n @logger ||= create_logger\n end", "def logger\n @logger ||= create_logger\n end", "def logger\n init unless @initialized\n logger = @logger\n end", "def logger\n @logger ||= Logging.logger_for(self.class...
[ "0.72473", "0.71180296", "0.71180296", "0.71050936", "0.70551777", "0.7052323", "0.7042595", "0.70180964", "0.7009227", "0.6989291", "0.6980381", "0.69760615", "0.69585365", "0.6955597", "0.69305825", "0.69238746", "0.6915962", "0.69141066", "0.6899652", "0.6877502", "0.68685...
0.82189614
0
Removes the logger for the current thread (nil). :api: public
def reset_logger! Thread.current[:merb_logger] = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_own_logger\n self.logger = nil\n end", "def clear\n synchronize do\n @locks.delete(Logging::Logger.thread_name)\n end\n end", "def disable_logging\n @logger = nil\n end", "def remove_logger(logger)\n init unless @initialized\n @logger.remove(logge...
[ "0.75744545", "0.7432444", "0.7139152", "0.7007285", "0.69096065", "0.6652546", "0.6364987", "0.6361938", "0.6361938", "0.6305239", "0.6265797", "0.6099595", "0.60796", "0.5979693", "0.5933899", "0.585982", "0.5836836", "0.5834152", "0.58180624", "0.5764421", "0.57067114", ...
0.7643389
0
==== Returns String:: The path to the log file. If this Merb instance is running as a daemon this will return +STDOUT+. ==== Notes When Merb.testing? the port is modified to become :test this keeps this
def log_stream(port = "main") port = :test if Merb.testing? @streams ||= {} @streams[port] ||= begin log = if Merb.testing? log_path / "merb_test.log" elsif !Merb::Config[:daemonize] && !Merb::Config[:force_logging] STDOUT else log_path / "merb.#{port}.log" end if log.is_a?(IO) stream = log elsif File.exist?(log) stream = File.open(log, (File::WRONLY | File::APPEND)) else FileUtils.mkdir_p(File.dirname(log)) stream = File.open(log, (File::WRONLY | File::APPEND | File::CREAT)) stream.write("#{Time.now.httpdate} #{Merb::Config[:log_delimiter]} " \ "info #{Merb::Config[:log_delimiter]} Logfile created\n") end stream.sync = true stream end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_file\n if Merb::Config[:log_file]\n Merb::Config[:log_file]\n elsif Merb.testing?\n log_path / \"merb_test.log\"\n elsif !(Merb::Config[:daemonize] || Merb::Config[:cluster])\n STDOUT\n else\n log_path / \"merb.#{Merb::Config[:port]}.log\"\n end\n end...
[ "0.83829117", "0.77357507", "0.77357507", "0.7618479", "0.7417938", "0.7329718", "0.7227046", "0.71181285", "0.70597297", "0.7021445", "0.70150036", "0.69515985", "0.693398", "0.6887197", "0.68647486", "0.6801843", "0.67524093", "0.6737297", "0.6736543", "0.6698602", "0.66909...
0.64247906
38
==== Returns String:: Path to the log directory which contains the log file. :api: public
def log_path case Merb::Config[:log_file] when String then File.dirname(Merb::Config[:log_file]) else Merb.root_path("log") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_directory\n File.join(@relative_to_base, LOG_DIRECTORY_NAME)\n end", "def log_dir\n return pretty_path(File.join(Dir::COMMON_APPDATA, 'RightScale', 'log'))\n end", "def log_directory\n @relative_location.end_with?('/') ? @relative_location + LOG_DIRECTORY_NAME : @relative_loca...
[ "0.885156", "0.84036297", "0.8362703", "0.8289593", "0.8163155", "0.79288393", "0.791734", "0.79141426", "0.78644675", "0.7830715", "0.7639855", "0.75041705", "0.74490106", "0.7389704", "0.73603636", "0.73423034", "0.72753304", "0.72205114", "0.7183838", "0.7181464", "0.71687...
0.843724
2
==== Returns String:: The path of root directory of the Merb framework. :api: public
def framework_root @framework_root ||= File.dirname(__FILE__) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def root\n @root || Merb::Config[:merb_root] || File.expand_path(Dir.pwd)\n end", "def get_root\n return File.join('/root/path', SETTINGS[:project])\n end", "def root() @root || Merb::Config[:merb_root] || Dir.pwd end", "def root\n Pathname.new(File.dirname(__dir__))\n end", "def ...
[ "0.78452116", "0.7802962", "0.76789045", "0.76288575", "0.7578247", "0.7518626", "0.749885", "0.7497338", "0.7484193", "0.7452712", "0.7447622", "0.74424976", "0.74239147", "0.74239147", "0.73858154", "0.7357044", "0.73493016", "0.73044485", "0.7304257", "0.72888625", "0.7279...
0.7230866
23
==== Returns RegExp:: Regular expression against which deferred actions are matched by Rack application handler. ==== Notes Concatenates :deferred_actions configuration option values. :api: public
def deferred_actions @deferred ||= begin if Merb::Config[:deferred_actions].empty? /^\0$/ else /#{Merb::Config[:deferred_actions].join("|")}/ end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rejected_characters_regexp\n @rejected_characters_regexp ||= %r{(#{RESOURCES_REJECTED_CHARS.join('|')})}\n end", "def paths_to_regex(path_config, req='req')\n paths = normalize_paths(path_config)\n paths.empty? ? 'false' : paths.map {|path| \"#{req}.url ~ \\\"#{path}\\\"\"}.join(' || ')\nend", "def o...
[ "0.49777573", "0.49181482", "0.48764902", "0.48579434", "0.480499", "0.48028016", "0.47973198", "0.46823427", "0.45867288", "0.45845127", "0.4578471", "0.45350656", "0.45072246", "0.44816512", "0.44683152", "0.44640538", "0.4461369", "0.44299132", "0.44152", "0.43896103", "0....
0.7113317
0
Perform a hard Exit. Print a backtrace to the merb logger before exiting if verbose is enabled. :api: private
def fatal!(str, e = nil) Merb.logger.fatal! Merb.logger.fatal!("\e[1;31;47mFATAL: #{str}\e[0m") Merb.logger.fatal! print_colorized_backtrace(e) if e && Merb::Config[:verbose] if Merb::Config[:show_ugly_backtraces] raise e else exit(1) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coolest_exit\n Kernel.exit! 99\n end", "def handle_exit\n __exit! if respond_to?(:__exit!)\n exit(0)\n end", "def exit!() end", "def exit() end", "def rescue_at_exit!\n logger.info \"Attached to application exit.\"\n at_exit { report($!) if $! && !last_reported.equal?...
[ "0.6780493", "0.6698057", "0.6506709", "0.6493665", "0.642594", "0.6400083", "0.627377", "0.6228812", "0.6215182", "0.62019175", "0.6195", "0.61713606", "0.61606646", "0.6150893", "0.6130077", "0.6118281", "0.6089346", "0.6087016", "0.60859424", "0.6078973", "0.60666835", "...
0.0
-1
Print a colorized backtrace to the merb logger. :api: private
def print_colorized_backtrace(e) e.backtrace.map! do |line| line.gsub!(/^#{Merb.framework_root}/, "\e[34mFRAMEWORK_ROOT\e[31m") end Merb.logger.fatal! "\e[34mFRAMEWORK_ROOT\e[0m = #{Merb.framework_root}" Merb.logger.fatal! Merb.logger.fatal! "\e[31m#{e.class}: \e[1;31;47m#{e.message}\e[0m" e.backtrace.each do |line| Merb.logger.fatal! "\e[31m#{line}\e[0m" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error(message, backtrace=nil)\n STDERR.puts color(message, error_color)\n backtrace.each {|line| line_color = (line[0..1] == '/') ? backtrace_local_color : backtrace_gem_color; STDERR.puts color(line, line_color)} unless backtrace.nil? || backtrace.empty?\n end", "def handle_exception(e)\n pu...
[ "0.6458262", "0.63585615", "0.6300863", "0.6282642", "0.62267375", "0.6203961", "0.6175136", "0.6123621", "0.6104438", "0.60132974", "0.6009473", "0.59992963", "0.5965602", "0.59595174", "0.59558684", "0.59258926", "0.5925675", "0.5852505", "0.57987154", "0.5774986", "0.57698...
0.785528
0
Returns the default ORM for this application. For instance, :datamapper. ==== Returns :: default ORM. :api: public
def orm @orm ||= :none end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def orm\n @orm || self.class.default_orm\n end", "def orm\n @orm || self.class.default_orm\n end", "def orm\n if @orm\n return @orm\n else\n self.orm = ENV['ORM']\n end\n @orm\n end", "def default_orm\n\t\t\t@default_orm ||= :in_memory\n\t\tend", "def or...
[ "0.8325936", "0.8325936", "0.8033665", "0.7625449", "0.7558922", "0.71466094", "0.68269485", "0.6590297", "0.6444173", "0.6313797", "0.6140352", "0.60956126", "0.6039181", "0.6007452", "0.5984292", "0.59658414", "0.594881", "0.5903869", "0.5843801", "0.5818628", "0.58155245",...
0.7605466
4
Returns the default test framework for this application. For instance :rspec. ==== Returns :: default test framework. :api: public
def test_framework @test_framework ||= :rspec end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_framework\n @current_framework ||= self.default_framework\n return @current_framework\n end", "def framework\n @framework\n end", "def framework\n\t\treturn self.class.framework\n\tend", "def framework_name; registered_framework_name; end", "def current_framework=(value...
[ "0.72809047", "0.6756125", "0.67158604", "0.64955807", "0.64759755", "0.6438653", "0.64118606", "0.63548267", "0.63401896", "0.61948943", "0.6192542", "0.6097853", "0.6076828", "0.6076828", "0.6046804", "0.60375774", "0.60375774", "0.60375774", "0.5976578", "0.58670753", "0.5...
0.76094425
0
Returns the default template engine for this application. For instance :haml. ==== Returns :: default template engine. :api: public
def template_engine @template_engine ||= :erb end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def template_engine\n te = options[:template_engine].try(:to_s).try(:downcase) || 'erb'\n if te == \"haml\"\n return \"haml\"\n else\n return \"erb\"\n end\n end", "def current_template_engine(use_default=false)\n #current_engine || Vue::Helpers.template_...
[ "0.8171522", "0.76694477", "0.7377066", "0.67279476", "0.65885174", "0.65391976", "0.6471885", "0.63171744", "0.6263937", "0.61381394", "0.6092401", "0.6078663", "0.60394293", "0.6018083", "0.60047007", "0.59658885", "0.5963471", "0.5956494", "0.59174776", "0.5913494", "0.591...
0.77047503
1
==== Returns Boolean:: True if Merb is running as an application with bundled gems. ==== Notes Bundling required gems makes your application independent from the environment it runs in. It is a good practice to freeze application framework and gems and is very useful when application is run in some sort of sandbox, for instance, shared hosting with preconfigured gems. :api: public
def bundled? $BUNDLE || ENV.key?("BUNDLE") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bundled?\n Gem.loaded_specs.key?(self.class.from_gem)\n end", "def bundled?(filename); end", "def bundler?\n @bundler ||= File.exist?(\"#{ Dir.pwd }/Gemfile\")\n end", "def vendored_bundler?\n false\n end", "def application?\n gem_dir\n end", "def application?\n ...
[ "0.780504", "0.69607604", "0.6911958", "0.6874941", "0.68278307", "0.68278307", "0.6575182", "0.64950573", "0.6466936", "0.6439142", "0.6439142", "0.6439142", "0.6430685", "0.6363232", "0.6354732", "0.6336895", "0.631173", "0.6308831", "0.6262347", "0.6236952", "0.62242144", ...
0.80232173
0
Load configuration and assign the logger. ==== Parameters options:: Options to pass on to the Merb config. ==== Options :host:: host to bind to, default is 0.0.0.0. :port:: port to run Merb application on, default is 4000. :adapter:: name of Rack adapter to use, default is "runner" :rackup:: name of Rack init file to use, default is "rack.rb" :reload_classes:: whether Merb should reload classes on each request, default is true :environment:: name of environment to use, default is development :merb_root:: Merb application root, default is Dir.pwd :use_mutex:: turns action dispatch synchronization on or off, default is on (true) :log_delimiter:: what Merb logger uses as delimiter between message sections, default is " ~ " :log_auto_flush:: whether the log should automatically flush after new messages are added, defaults to true. :log_stream:: IO handle for logger. Defaults to STDOUT. :log_file:: File path for logger. Overrides :log_stream. :log_level:: logger level, default is :info :disabled_components:: array of disabled component names, for instance, to disable json gem, specify :json. Default is empty array. :deferred_actions:: names of actions that should be deferred no matter what controller they belong to. Default is empty array. Some of these options come from command line on Merb application start, some of them are set in Merb init file or environmentspecific. :api: public
def load_config(options = {}) Merb::Config.setup(Merb::Config.defaults.merge(options)) Merb::BootLoader::Logger.run end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_config(options = {})\n Merb::Config.setup({ :log_file => STDOUT, :log_level => :warn, :log_auto_flush => true }.merge(options))\n Merb::BootLoader::Logger.run\n end", "def initialize(options = {})\n @logger = options[:logger]\n end", "def configuration\n if options[:log].ni...
[ "0.76339483", "0.6255285", "0.6239034", "0.6223445", "0.61164886", "0.6104873", "0.6015194", "0.5954016", "0.59503984", "0.59426475", "0.5936261", "0.59219015", "0.58585495", "0.5838297", "0.58312434", "0.5794387", "0.5773458", "0.5729807", "0.5685357", "0.5640933", "0.563712...
0.7497065
1
Load all basic dependencies (selected BootLoaders only). This sets up Merb framework component paths (directories for models, controllers, etc) using framework.rb or default layout, loads init file and dependencies specified in it and runs before_app_loads hooks. ==== Parameters options:: Options to pass on to the Merb config. :api: public
def load_dependencies(options = {}) load_config(options) Merb::BootLoader::BuildFramework.run Merb::BootLoader::Dependencies.run Merb::BootLoader::BeforeAppLoads.run end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_dependencies(options = {})\n load_config(options)\n Merb::BootLoader::BuildFramework.run\n Merb::BootLoader::Dependencies.run\n Merb::BootLoader::BeforeAppRuns.run\n end", "def init! options = {}\n verify_rails!\n copy_template :rails, :to => :jspec\n vendoriz...
[ "0.7586295", "0.62609005", "0.5912915", "0.5783087", "0.5774039", "0.57158417", "0.5655977", "0.5649885", "0.5638338", "0.56220233", "0.56220233", "0.5552747", "0.552256", "0.552237", "0.55016756", "0.54711336", "0.53556705", "0.5347025", "0.5314094", "0.5263581", "0.5248708"...
0.76981205
0
Reload application and framework classes. See Merb::BootLoader::ReloadClasses for details. :api: public
def reload Merb::BootLoader::ReloadClasses.reload end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reload!\n Merb::BootLoader::ReloadClasses.reload\n end", "def reload!\n Merb::BootLoader::ReloadClasses.reload\n end", "def reload_app \n return if @klass and @mtime and mtime <= @mtime\n\n if @requires\n @requires.each { |req| $LOADED_FEATURES.delete(req) }...
[ "0.8338909", "0.8338909", "0.7642311", "0.75798714", "0.71238637", "0.69754624", "0.69501734", "0.68512154", "0.68214536", "0.67113304", "0.6537666", "0.6436211", "0.6436211", "0.64013475", "0.6286944", "0.62176836", "0.6204597", "0.61909634", "0.61909634", "0.6170305", "0.61...
0.84657204
0
==== Returns Boolean:: True if Merb environment is testing for instance, Merb is running with RSpec, Test::Unit of other testing facility. :api: public
def testing? $TESTING ||= env?(:test) || Merb::Config[:testing] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testing?\n $TESTING || Merb::Config[:testing]\n end", "def test_env?\n @test_environment\n end", "def test?\n settings.environment == 'test'\n end", "def test?\n self.environment == ENV_TEST\n end", "def test_env\n if ENVIRONMENT.is_a?(String) && ENVIRONMENT == \"test\"\n ...
[ "0.81409854", "0.79564", "0.79418343", "0.7927941", "0.7609068", "0.7556477", "0.74703306", "0.74391943", "0.7386539", "0.73528075", "0.7342597", "0.7322524", "0.73064286", "0.71839917", "0.7171202", "0.7084507", "0.7065681", "0.6926761", "0.68992054", "0.68454516", "0.680121...
0.8439443
0
Ask the question about which environment you're in. ==== Parameters env:: Name of the environment to query ==== Examples Merb.env => production Merb.env?(:production) => true Merb.env?(:development) => false :api: public
def env?(env) Merb.env == env.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def environment(env)\n raise \"unknown environment\" unless [:production, :test, :development].include?(env)\n @environment = env\n end", "def env(env=nil)\n env ||= 'default'\n e = @environments[env] ||= Environment.new\n yield e if block_given?\n e\n end", "def e...
[ "0.75975454", "0.69990474", "0.6940648", "0.69110775", "0.6786354", "0.6786354", "0.66537213", "0.6651335", "0.6557751", "0.6557751", "0.65328526", "0.6493311", "0.649056", "0.6486101", "0.64756685", "0.6453377", "0.6441462", "0.6440289", "0.6409158", "0.6407335", "0.63957924...
0.7344425
1
If block was given configures using the block. ==== Parameters &block:: Configuration parameter block, see example below. ==== Returns Hash:: The current configuration. ==== Notes See Merb::GlobalHelpers.load_config for configuration options list. ==== Examples Merb.config do beer "good" hashish :foo => "bar" environment "development" log_level "debug" use_mutex false exception_details true reload_classes true reload_time 0.5 end :api: public
def config(&block) Merb::Config.configure(&block) if block_given? Config end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config(&block)\n @config ||= Configuration.new\n instance_exec(@config, &block) if block_given?\n @config\n end", "def config(&block)\n if block_given?\n c = Config.new\n c.instance_eval(&block)\n @config = c\n end\n\n @config ||= Config.new\n end", ...
[ "0.86383545", "0.84745467", "0.8440776", "0.8428027", "0.84253573", "0.831978", "0.79187185", "0.7892953", "0.7879572", "0.78722155", "0.7853612", "0.7840719", "0.7823894", "0.78145254", "0.781053", "0.78015476", "0.7794542", "0.77846825", "0.7770909", "0.7770909", "0.7733192...
0.8531921
2
Disables the given core components, like a Gem for example. ==== Parameters args:: One or more symbols of Merb internal components. :api: public
def disable(*components) disabled_components.push(*components) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable(*components)\n disabled_components.push *components\n end", "def disableable_components\n available_components\n end", "def disableable_components\n Course::ControllerComponentHost.disableable_components\n end", "def disabled_components\n Merb::Config[:disabled_components] ||...
[ "0.6843542", "0.6592422", "0.6472748", "0.6335515", "0.6334626", "0.6244296", "0.6233199", "0.6233199", "0.61792547", "0.6008304", "0.598062", "0.5885233", "0.5885233", "0.58733726", "0.57493615", "0.5728073", "0.56953895", "0.56211585", "0.55687994", "0.5447757", "0.5382009"...
0.6784543
1
==== Parameters Array:: All components that should be disabled. :api: public
def disabled_components=(components) disabled_components.replace components end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable(*components)\n disabled_components.push *components\n end", "def disable(*components)\n disabled_components.push(*components)\n end", "def disableable_components\n available_components\n end", "def disabled_components\n Merb::Config[:disabled_components] ||= []\n end",...
[ "0.8576091", "0.8523543", "0.81465644", "0.7922737", "0.79213595", "0.75740105", "0.74826163", "0.7470646", "0.7268507", "0.7268507", "0.7048694", "0.7031638", "0.6858487", "0.67439926", "0.6566347", "0.64956474", "0.6437827", "0.6425248", "0.64088225", "0.6407552", "0.634136...
0.81142294
4
==== Returns Array:: All components that have been disabled. :api: public
def disabled_components Merb::Config[:disabled_components] ||= [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disableable_components\n available_components\n end", "def disableable_components\n @component_host.course_disableable_components\n end", "def disableable_component_collection\n @settable.disableable_components.map { |c| [c.display_name, c.key.to_s] }.sort\n end", "def enabled_component_ids\n...
[ "0.8274733", "0.743764", "0.73971415", "0.7298506", "0.7176933", "0.7155846", "0.715326", "0.711745", "0.7090087", "0.68307674", "0.6805532", "0.6805532", "0.6800729", "0.67659307", "0.6713659", "0.6713659", "0.6684044", "0.6531178", "0.64533526", "0.6409747", "0.6400948", ...
0.791205
2
==== Returns Boolean:: True if all components (or just one) are disabled. :api: public
def disabled?(*components) components.all? { |c| disabled_components.include?(c) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_disabled?\n @all_disabled\n end", "def disableable_components\n available_components\n end", "def disabled?\n !enabled?\n end", "def disabled?\n !enabled?\n end", "def disabled?\n @disabled\n end", "def disabled_components\n Merb::Config[:disabled_...
[ "0.77630985", "0.7462455", "0.72694445", "0.7250939", "0.7245896", "0.7200712", "0.7199389", "0.71312636", "0.711636", "0.7082274", "0.70692533", "0.70259494", "0.70259494", "0.70114684", "0.69950706", "0.6966099", "0.6921228", "0.69049436", "0.6821446", "0.68012273", "0.6775...
0.83120567
1
==== Returns Array(String):: Paths Rakefiles are loaded from. ==== Notes Recommended way to find out what paths Rakefiles are loaded from. :api: public
def rakefiles @rakefiles ||= [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onetime_rake_files\n tasks_dir = self.tasks_directory\n return [] unless Dir.exist?(tasks_dir) && !Dir.empty?(tasks_dir)\n\n Dir.glob(File.join('**', '*.rake'), base: tasks_dir)\n end", "def rakefiles\n @rakefiles ||= ['merb-core/test/tasks/spectasks']\n end", "def load_paths\n ...
[ "0.71465623", "0.7077187", "0.6936084", "0.68501395", "0.6765734", "0.6758416", "0.6682638", "0.65876526", "0.65485644", "0.65383965", "0.65343946", "0.6470299", "0.64683765", "0.6464487", "0.6456063", "0.64525336", "0.6444343", "0.6406679", "0.6384674", "0.63732845", "0.6360...
0.71620446
0
=== Returns Array(String):: Paths generators are loaded from === Notes Recommended way to find out what paths generators are loaded from. :api: public
def generators @generators ||= [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paths\n @paths ||= [\n data_path,\n output_path,\n converted_path,\n converted_fail_path,\n unpacked_path,\n unpacked_fail_path,\n recreated_path,\n ]\n end", "def paths\n @paths ||= []\n @paths\n end", "def paths\n @paths ||= []\n @paths\n end", "d...
[ "0.70695597", "0.7017096", "0.7017096", "0.6943547", "0.67360693", "0.67038596", "0.6700488", "0.6684265", "0.66755074", "0.6670233", "0.6670233", "0.6670233", "0.6670233", "0.6670233", "0.661003", "0.65548044", "0.65548044", "0.653447", "0.6531414", "0.6509925", "0.64849406"...
0.6935412
5
==== Parameters rakefiles:: Rakefile paths to add to the list of Rakefiles. ==== Notes Recommended way to add Rakefiles load path for plugins authors. :api: public
def add_rakefiles(*rakefiles) @rakefiles ||= [] @rakefiles += rakefiles end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_rakefiles(*rakefiles)\n @rakefiles ||= ['merb-core/test/tasks/spectasks']\n @rakefiles += rakefiles\n end", "def rakefiles\n @rakefiles ||= []\n end", "def rakefiles\n @rakefiles ||= ['merb-core/test/tasks/spectasks']\n end", "def add_rakefile_and_tasks(rakefilename, task...
[ "0.81456804", "0.7126377", "0.6964578", "0.6820154", "0.64730775", "0.6466652", "0.6347725", "0.62934905", "0.6252123", "0.6188051", "0.61522835", "0.6140157", "0.6125501", "0.61232734", "0.61113", "0.60921675", "0.6081729", "0.59703016", "0.5940001", "0.59074044", "0.5896694...
0.819246
0
==== Parameters generators:: Generator paths to add to the list of generators. ==== Notes Recommended way to add Generator load paths for plugin authors. :api: public
def add_generators(*generators) @generators ||= [] @generators += generators end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generators\n @generators ||= []\n end", "def generators\n @generators ||= []\n end", "def generators #:nodoc:\n @generators ||= Rails::Configuration::Generators.new\n yield(@generators) if block_given?\n @generators\n end", "def generators\n @generators ||...
[ "0.72524166", "0.72524166", "0.6924995", "0.69162554", "0.6878666", "0.65482295", "0.627877", "0.627877", "0.60686827", "0.60686827", "0.6022131", "0.6022131", "0.588772", "0.5835668", "0.58266515", "0.5803606", "0.57033414", "0.56936055", "0.5687681", "0.56440777", "0.554660...
0.7751888
0
Install a signal handler for a given signal unless signals have been disabled with Merb.disable(:signals) ==== Parameters signal:: The name of the signal to install a handler for. &block:: The block to be run when the given signal is received. :api: public
def trap(signal, &block) if Signal.list.include?(signal) Kernel.trap(signal, &block) unless Merb.disabled?(:signals) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handler_for signal, &block\n interrupt_handler[signal] = block\n end", "def install_signal_handler(signal, position=:end, &blk)\n raise ArgumentError, \"Unknown position: #{position}\" if ![:beginning, :end].include?(position)\n logger.debug { \"Installing signal handler for #{signal}\" }\n...
[ "0.65983164", "0.64501876", "0.6253071", "0.62016326", "0.60105264", "0.594287", "0.58082026", "0.5615039", "0.5498695", "0.5383373", "0.5343249", "0.53314835", "0.5300705", "0.5266534", "0.51688063", "0.5130935", "0.5113627", "0.5096097", "0.50562483", "0.50533104", "0.50524...
0.67947394
0
GET /admin/subscriptions GET /admin/subscriptions.json
def index @admin_subscriptions = Subscription.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_subscriptions\n get(url_(\"subscription\"))\n end", "def subscriptions\n url = url_with_api_version(@base_url, 'subscriptions')\n resp = rest_get(url)\n JSON.parse(resp.body)[\"value\"]\n end", "def list_my_subscriptions() path = \"/api/v2/utilities/subscrip...
[ "0.828075", "0.82691514", "0.7972541", "0.7955835", "0.7693934", "0.7629951", "0.7561977", "0.7529651", "0.75050735", "0.7475107", "0.7456623", "0.74321735", "0.7422043", "0.74152404", "0.73910564", "0.7364352", "0.73470354", "0.7334559", "0.7334559", "0.7334559", "0.73210526...
0.7647873
5
GET /admin/subscriptions/1 GET /admin/subscriptions/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscriptions\n url = url_with_api_version(@base_url, 'subscriptions')\n resp = rest_get(url)\n JSON.parse(resp.body)[\"value\"]\n end", "def all_subscriptions\n get(url_(\"subscription\"))\n end", "def list_my_subscriptions() path = \"/api/v2/utilities/subscrip...
[ "0.79191124", "0.7768032", "0.76251173", "0.75614506", "0.75614506", "0.7546043", "0.73897886", "0.73839194", "0.73428893", "0.7328567", "0.7298051", "0.7298", "0.729258", "0.7212421", "0.720581", "0.7197373", "0.7175278", "0.7171985", "0.7171985", "0.71069884", "0.7099488", ...
0.0
-1
POST /admin/subscriptions POST /admin/subscriptions.json
def create @admin_subscription = Subscription.new(admin_subscription_params) respond_to do |format| if @admin_subscription.save format.html { redirect_to [:admin, @admin_subscription], notice: 'L\'abonnement a bien été créé !' } format.json { render :show, status: :created, location: @admin_subscription } else format.html { render :new } format.json { render json: @admin_subscription.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create / update_subscriptions\n end", "def create\n megam_rest.post_subscriptions(to_hash)\n end", "def post body=nil, headers={}\n @connection.post \"subscriptions.json\", body, headers\n end", "def create\n @subscription = Subscription.new(subscription_params)\n\n ...
[ "0.7795476", "0.77431285", "0.7618619", "0.7350751", "0.7343979", "0.7295985", "0.72519255", "0.7227078", "0.7140375", "0.71372956", "0.7072838", "0.70285505", "0.6971968", "0.6958084", "0.69420344", "0.691842", "0.68520486", "0.68145466", "0.68110883", "0.6780562", "0.673758...
0.6855106
16
PATCH/PUT /admin/subscriptions/1 PATCH/PUT /admin/subscriptions/1.json
def update respond_to do |format| if @admin_subscription.update(admin_subscription_params) format.html { redirect_to [:admin, @admin_subscription], notice: 'L\'abonnement a bien été mis à jour !' } format.json { render :show, status: :ok, location: @admin_subscription } else format.html { render :edit } format.json { render json: @admin_subscription.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @subscription = current_user.subscriptions.find(params[:id])\n\n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n format.html { redirect_to @subscription, notice: 'Subscription was successfully updated.' }\n format.json { head :no_content }\...
[ "0.72498447", "0.7130687", "0.71222746", "0.7121397", "0.711715", "0.7087294", "0.70307004", "0.699017", "0.699017", "0.699017", "0.6954248", "0.69415146", "0.6924815", "0.6904681", "0.6901651", "0.6895819", "0.6895819", "0.68912446", "0.6807301", "0.6804981", "0.6797963", ...
0.66796124
29
DELETE /admin/subscriptions/1 DELETE /admin/subscriptions/1.json
def destroy @admin_subscription.destroy respond_to do |format| format.html { redirect_to admin_subscriptions_url, notice: 'L\'abonnement a bien été créé supprimé.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete options={}, headers={}\n @connection.delete \"subscriptions.json\", options, headers\n end", "def destroy\n subscription = current_user.subscriptions.find(params[:id])\n subscription.destroy!\n\n render json: { status: 'success'}\n end", "def delete_subscriptions\n end", ...
[ "0.8004872", "0.79674906", "0.7808291", "0.77198905", "0.76968056", "0.7656756", "0.7656756", "0.7656756", "0.7656756", "0.7627649", "0.7619344", "0.7583551", "0.7573028", "0.7538817", "0.75026816", "0.7472022", "0.7472022", "0.7472022", "0.7472022", "0.7472022", "0.7435656",...
0.75752974
12
Use callbacks to share common setup or constraints between actions.
def set_admin_subscription @admin_subscription = Subscription.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_...
[ "0.6163927", "0.6046165", "0.59465253", "0.59167755", "0.58904207", "0.58346355", "0.577713", "0.5703502", "0.5703502", "0.56531286", "0.56215113", "0.54224145", "0.5410795", "0.5410795", "0.5410795", "0.53924775", "0.5379919", "0.53580743", "0.53401667", "0.53397506", "0.533...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def admin_subscription_params params.fetch(:admin_subscription, {}) 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...
[ "0.6981269", "0.6783559", "0.6746007", "0.67423046", "0.6735905", "0.6593568", "0.6504213", "0.649792", "0.6482664", "0.6478558", "0.64566684", "0.64392304", "0.6380194", "0.6376366", "0.636562", "0.63208145", "0.63006365", "0.63001287", "0.6292953", "0.62927175", "0.62911004...
0.0
-1
age, height they are both attributes/characteristics/ instance variable inside this class OrangeTree Ages the tree one year
def initialize(feet, year) # initialize is method, feet& year are called arguments/inputs/parameters of method @height = feet @age = year @oranges = [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def age!\n #tree aging code goes here\n @age += 1\n @height += rand(100..400)\n rand(50..100).times {@oranges << Orange.new(rand(10..40))} if @age > FRUIT_SEASON_TIME\n end", "def age\n \n end", "def age!\n #tree aging code goes here\n @age += 1\n @height += rand(100..400)\n ...
[ "0.6932296", "0.67701036", "0.6677617", "0.6603205", "0.6504284", "0.64758015", "0.645731", "0.63790274", "0.62905717", "0.6266362", "0.62579507", "0.6226411", "0.6211108", "0.6179182", "0.6122082", "0.60877234", "0.608307", "0.6074065", "0.60603285", "0.6058402", "0.60346603...
0.5927343
35
Returns +true+ if there are any oranges on the tree, +false+ otherwise
def any_oranges? !!(@oranges.length > 0) #got orange end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def any_oranges?\n true if @oranges_in_tree.length > 0\n end", "def any_oranges?\n # code to check if tree has any oranges goes here\n @oranges.length > 0\n end", "def any_apples?\n # code to check if tree has any oranges goes here\n @apples.length > 0\n end", "def any_pears?\n # code to...
[ "0.8796609", "0.87100583", "0.8137075", "0.8051588", "0.6906302", "0.67958045", "0.6774955", "0.6764812", "0.6764812", "0.6745744", "0.6733655", "0.6720086", "0.671983", "0.6699348", "0.6685619", "0.66158414", "0.66065955", "0.656348", "0.6546673", "0.65083885", "0.6498102", ...
0.66359854
15
True if user has accepted a role named role_name
def role? role_name self.roles.exists? name: role_name.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accepts_role?( role_name, user )\n user.has_role? role_name, self\n end", "def accepts_role( role_name, user )\n user.has_role role_name, self\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...
[ "0.8620598", "0.8540762", "0.82759", "0.82759", "0.8119501", "0.80960006", "0.8083392", "0.80792934", "0.7966904", "0.7954282", "0.79313505", "0.789117", "0.7882271", "0.7880432", "0.78709626", "0.7862518", "0.7859086", "0.7821512", "0.78114253", "0.7809436", "0.7801205", "...
0.79019594
11
Ask the user to take on a new role.
def accept_role role self.roles.push role end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def role\n puts \"Now give #{@name} a role\"\n @role = gets.chomp.upcase\n puts \"The Gods are considering your request, please wait 3 seconds\"\n sleep 3\n puts \"The Gods have heard you and #{@name} shall be a: #{@role}\"\n end", "def new_role\n new_role = create_role(params[:role][:name])...
[ "0.69628334", "0.6934695", "0.6932229", "0.6884924", "0.6877733", "0.67993575", "0.67727304", "0.66981196", "0.66798806", "0.66684824", "0.66684824", "0.66663647", "0.6666021", "0.66478515", "0.66411704", "0.66153663", "0.66038734", "0.6600909", "0.65990454", "0.65730494", "0...
0.6949864
1
Ask the user to stop acting as a role
def withdraw_role role self.roles.delete role end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toggle_role\n do_toggle_role params[:role]\n end", "def destroy\n\n @role.stop_user_id = session[:user_id]\n @role.stoped_at = DateTime.now\n @role.state = \"N\"\n @role.save\n respond_to do |format|\n format.html { redirect_to roles_url }\n format.json { head :no_content }...
[ "0.6306913", "0.63028663", "0.6285579", "0.6229743", "0.62001306", "0.6195451", "0.61573696", "0.61379576", "0.6128076", "0.6081615", "0.60264957", "0.59868646", "0.59760994", "0.59714526", "0.59576565", "0.59268403", "0.5912059", "0.5899735", "0.5895337", "0.58620995", "0.58...
0.56156045
54
Accept a collection of roles, withdrawing any not present
def establish_roles specified_roles # TODO: Separate cleanup method / script to take care of duplicate # User<->Role connections rather than `delete_all` here. self.roles.delete_all self.roles = specified_roles end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_roles(roles)\n return self.roles = (self.roles + Array(roles)).uniq\n end", "def add_roles(*values)\n values.map(&:to_s).each do |value|\n roles << value if Settings.valid_roles.include?(value) && !role?(value)\n end\n end", "def for_roles *user_roles, &block\n user_roles = user_ro...
[ "0.7237264", "0.7220444", "0.695262", "0.69414204", "0.69065905", "0.6897457", "0.6838201", "0.6838201", "0.68239576", "0.6783647", "0.67462456", "0.67437714", "0.67318535", "0.67054534", "0.6671572", "0.6660743", "0.6651392", "0.66406953", "0.66324294", "0.6618802", "0.66178...
0.6153036
82
Get user preference for setting, or default if not set.
def preference_for setting if preferences = self.preference pref = preferences.attributes[setting.to_s] return pref unless pref.empty? end Preference.default_for setting end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_setting(key, default)\r\n setting = Setting.where(key: key).first\r\n setting && !setting.value.blank? ? setting.value : default\r\n end", "def user_pref(pref, for_user=nil)\n user = for_user || @current_user || User.current_user\n user.preferences[pref] if user\n end", "def get_default_p...
[ "0.7080704", "0.7005406", "0.7001073", "0.6975422", "0.68846864", "0.677065", "0.6666726", "0.66480476", "0.66210294", "0.65321374", "0.64384365", "0.6408303", "0.63912064", "0.63757914", "0.6322821", "0.6317355", "0.6175891", "0.6119218", "0.6025676", "0.59997964", "0.598502...
0.7756903
0
Store user preference hash for later access
def remember_preference settings self.preference = Preference.find_or_create_by user_id: self self.preference.update settings end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store(prefs)\n prefs.each do |key, value|\n self[key] = value\n end if prefs.respond_to?(:each)\n end", "def user_pref(pref, for_user=nil)\n user = for_user || @current_user || User.current_user\n user.preferences[pref] if user\n end", "def set_user_preferences\n @user_prefe...
[ "0.6699735", "0.6371645", "0.6343836", "0.61827356", "0.61057705", "0.6087678", "0.6080832", "0.60117036", "0.60060996", "0.5893449", "0.58506775", "0.572224", "0.5713655", "0.5712218", "0.56536114", "0.5619971", "0.5605501", "0.55964714", "0.55941117", "0.5593219", "0.559158...
0.68457365
0
Alias for acts_as_taggable_on :tags
def amount_raised self.pledges.sum(:amount) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def research_acts_as_taggable\n research_acts_as_taggable_on :tags\n end", "def acts_as_taggable_on(*tag_types)\n taggable_on(*tag_types)\n end", "def research_acts_as_ordered_taggable\n research_acts_as_ordered_taggable_on :tags\n end", "def acts_as_ordered_taggable(options = {})...
[ "0.78287154", "0.7567243", "0.7469932", "0.7423987", "0.6871035", "0.6851894", "0.6746614", "0.67341435", "0.6683202", "0.66482204", "0.66025186", "0.65526927", "0.654537", "0.652359", "0.6513902", "0.6502537", "0.6502537", "0.6481686", "0.6481686", "0.6481686", "0.6481686", ...
0.0
-1
Se encarga de realizar todo los movimientos posibles de una maquina
def procesar case @estado #Estado = Inactiva, la maquina se llena when 1 if @maquinaA != nil if @prodAlmacen < @cantPA @prodAlmacen += @maquinaA.getProvisiones(@cantPA - @prodAlmacen) if @prodAlmacen == @cantPA @estado = 4 else @estado = 1 end else @estado = 4 end else @estado = 4 end #Estado = Procesando, la maquina esta procesando su insumo when 2 @cicloActual += 1 if @cicloActual == @cicloMax @estado = 3 @cantProduc = @cantProduc + (@cantMax * (1 - @desecho)) @prodAlmacen = 0 @cicloActual = 0 end #Estado = En espera, la maquina esta esperando a que la #proxima maquina este inactiva para podor darle insumos when 3 if @cantProduc == 0 @estado = 1 end #Estado = Lleno, la maquina esta lista para procesar su when 4 if @cicloMax == 0 @cantProduc = @cantProduc + @cantMax * (1 - @desecho) @prodAlmacen = 0 @estado = 3 else @estado = 2 end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bc_movimiento\r\n\t\t\tself.fecha = Time.now\r\n\t\t\tif self.monto_cheque == 0 \r\n\t\t\t\tmonto_cheque = 0\r\n\t\t\t\tself.cheque_recibidos.each do |cheque|\r\n\t\t\t\t\tmonto_cheque = monto_cheque + cheque.monto\r\n\t\t\t\tend\r\n\t\t\t\tself.monto_cheque = monto_cheque \r\n\t\t\tend\r\n\t\tend", "def cre...
[ "0.6356851", "0.60321534", "0.5904238", "0.5844877", "0.58091116", "0.57688767", "0.5725642", "0.5655059", "0.56511194", "0.5644153", "0.563889", "0.56382364", "0.5632099", "0.5617733", "0.56021", "0.55803925", "0.5534111", "0.55129623", "0.55087334", "0.5508151", "0.5497104"...
0.0
-1
Revisa si la maquina anterior tiene insumos para suministrarle
def getProvisiones(cant) case @estado when 3 if cant <= @cantProduc @cantProduc -= cant return cant else out = @cantProduc @cantProduc = 0 @estado = 1 return out end else 0 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mine_total(i, j)\n return is_mined(@data[i-1][j-1]) +\n is_mined(@data[i-1][j]) +\n is_mined(@data[i-1][j+1]) +\n is_mined(@data[i][j-1]) +\n is_mined(@data[i][j+1]) +\n is_mined(@data[i+1][j-1]) +\n is_mined(@data[i+1][j]) +\n is_mined(@...
[ "0.6445272", "0.6088215", "0.5923986", "0.5874231", "0.5813951", "0.57757264", "0.5730899", "0.5710428", "0.5710428", "0.5678126", "0.56622463", "0.5584422", "0.5575996", "0.5546206", "0.5545448", "0.55346847", "0.55316454", "0.5481904", "0.5481904", "0.54659635", "0.5460983"...
0.0
-1
GET /atividades GET /atividades.json
def index case usuario_atual.categoria when "Aluno" @atividades = Atividade.where({usuario_id: usuario_atual.id}).group("status", "id") when "Professor" @atividades = Atividade.where({professor: [usuario_atual.nome , nil]}) when "Administrador" || "Coordenacao" || "Secretaria" @atividades = Atividade.all.group("status", "id") else @atividades = Atividade.all.group("status", "id") end respond_to do |format| format.html end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @atividades = Atividade.all\n end", "def index\n @atividades_extras = AtividadesExtra.all\n end", "def index\n @atividade_extras = AtividadeExtra.all\n end", "def index\n @ivas = Iva.all\n\n render json: @ivas\n end", "def set_atividade\n @atividade = Atividade.fin...
[ "0.7639979", "0.68071854", "0.66475177", "0.6637777", "0.65882146", "0.65882146", "0.65882146", "0.65882146", "0.64510465", "0.6410964", "0.6355535", "0.63413924", "0.6285", "0.61408204", "0.61031103", "0.6099291", "0.6080147", "0.6069336", "0.60308707", "0.6015944", "0.60097...
0.0
-1
GET /atividades/1 GET /atividades/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @atividades = Atividade.all\n end", "def set_atividade\n @atividade = Atividade.where(id: params[:id]).first\n end", "def set_atividade\n @atividade = Atividade.find(params[:id])\n end", "def set_atividade\n @atividade = Atividade.find(params[:id])\n end", "def set_a...
[ "0.7468348", "0.6860278", "0.67562723", "0.67562723", "0.67562723", "0.67562723", "0.67383564", "0.6724825", "0.66982746", "0.66465896", "0.66333985", "0.6586352", "0.64992154", "0.63909316", "0.6390856", "0.6332751", "0.6321472", "0.6176431", "0.6149427", "0.61438006", "0.61...
0.0
-1
POST /atividades POST /atividades.json
def create @atividade = usuario_atual.atividades.build(atividade_params) @atividade.aluno = usuario_atual.nome @atividade.status = "Registrada" #TODO check set default options respond_to do |format| if @atividade.save # UsuarioMailer.novo_pedido_email(usuario_atual, "registrada").deliver_now format.html { redirect_to @atividade, notice: 'Atividade foi criada com sucesso.' } format.json { render :show, status: :created, location: @atividade } else format.html { render :new, alert: 'Atividade nao pode ser criada' } format.json { render json: @atividade.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @atividade = Atividade.new(atividade_params)\n\n respond_to do |format|\n if @atividade.save\n format.html { redirect_to @atividade, notice: 'Atividade was successfully created.' }\n format.json { render :show, status: :created, location: @atividade }\n else\n form...
[ "0.7343392", "0.6930671", "0.68643284", "0.68594515", "0.6802815", "0.6741121", "0.6696211", "0.65768886", "0.6304546", "0.6280427", "0.6280427", "0.6280427", "0.6280427", "0.62488467", "0.6185002", "0.6153039", "0.60122633", "0.599383", "0.59433764", "0.5873509", "0.58489096...
0.65470535
8
PATCH/PUT /atividades/1 PATCH/PUT /atividades/1.json
def update respond_to do |format| if @atividade.update(atividade_params) if params[:arquivos] params[:arquivos].each_with_index { |arquivo, index| @comprovante = Comprovante.novo_comprovante(arquivo, index, usuario_atual.nome) @comprovante.atividade = @atividade if !@comprovante.save flash[:alert] = "Nao foi possivel salvar o comprovante" end } end format.html { redirect_to @atividade, notice: 'Atividade foi atualizada.' } format.json { render :show, status: :ok, location: @atividade } else format.html { render :edit } format.json { render json: @atividade.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @atividade_extra.update(atividade_extra_params)\n format.html { redirect_to @atividade_extra, notice: 'Atividade foi atualizada.' }\n format.json { render :show, status: :ok, location: @atividade_extra }\n else\n format.html { render :edit ...
[ "0.70368934", "0.7018498", "0.7011574", "0.6784726", "0.67462903", "0.6645501", "0.6581859", "0.65741646", "0.6570475", "0.6565945", "0.65492564", "0.6545703", "0.65163887", "0.6495643", "0.6495532", "0.6492971", "0.6486664", "0.6479768", "0.6479225", "0.6467724", "0.6454479"...
0.64687294
19
DELETE /atividades/1 DELETE /atividades/1.json
def destroy @atividade.destroy respond_to do |format| format.html { redirect_to atividades_url, notice: 'Atividade foi deletada com sucesso.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @atividade.destroy\n respond_to do |format|\n format.html { redirect_to atividades_url, notice: 'Atividade was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end", "def destro...
[ "0.75591993", "0.7471747", "0.747129", "0.74503595", "0.7432229", "0.7407461", "0.7281873", "0.7281873", "0.7198118", "0.7192733", "0.7150274", "0.71214575", "0.7104309", "0.710202", "0.70976245", "0.7084911", "0.7076202", "0.7075832", "0.70729476", "0.7051524", "0.7045175", ...
0.75924706
0