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 |
|---|---|---|---|---|---|---|
Power cycles the specified port(s) turning them OFF then ON. The delay between the OFF and the ON is usually configured on the device itself, it is usually in the region of 10 seconds. | def reboot(port_index)
set_state(:reboot, port_index)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_power(port, state)\n\t\tstate = state ? 1 : 0\n\t\t\n\t\tdo_send(\"\\eP#{port}*#{state}DCPP\")\n\t\t# Response: DcppP_port*portstatus 0 == off, 1== on\n\tend",
"def blink(repeat=3, switched_on=0.25, switched_off=0.5)\n repeat.times do |n|\n on\n sleep switched_on\n off\n ... | [
"0.65427494",
"0.5996964",
"0.57159466",
"0.56762064",
"0.5622505",
"0.54685724",
"0.54631674",
"0.541596",
"0.54116565",
"0.53857255",
"0.5339861",
"0.5339861",
"0.5316588",
"0.53160125",
"0.52651805",
"0.52450794",
"0.52401143",
"0.52215505",
"0.51409847",
"0.51366097",
"0.... | 0.46823207 | 60 |
all following methods will be callable from outside the module tries to handle various encoding problems encounterd with path strings | def sanitize_string(string)
return string.encode("UTF-16BE", :invalid=>:replace, :undef => :replace, :replace=>"?")
.encode("UTF-8")
.gsub(/[\u0080-\u009F]/) {|x| x.getbyte(1).chr.force_encoding('windows-1252').encode('utf-8') }
.gsub(/\"/, "\\\"") # escape double quotes in string
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unescape_path(path); end",
"def iconv() end",
"def encode_string_ex; end",
"def found_encoding; end",
"def found_encoding; end",
"def encoding_found; end",
"def encoding_found; end",
"def external_utf8_check?(safe_path)\n iconv = system('command -v iconv > /dev/null 2>&1')\n ret... | [
"0.6540214",
"0.6515423",
"0.6236619",
"0.6129628",
"0.6129628",
"0.61065936",
"0.61065936",
"0.60224736",
"0.60156137",
"0.60065687",
"0.5981527",
"0.5981527",
"0.5981527",
"0.5981527",
"0.5981527",
"0.5981527",
"0.5981527",
"0.5981527",
"0.5981527",
"0.5981527",
"0.5981527"... | 0.0 | -1 |
Ensures that configuration is set properly before executing | def verify_config
if !@config.has_key? 'command'
raise Huck::Error, 'missing "exec" generator config: "command"'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_configuration!\n config.check!\n end",
"def configure\n load_configuration\n verify_configuration\n end",
"def configured?; false; end",
"def check_configure\n apply_task_params(true)\n enable_variants\n unless Cache.instance[\"configuration_data\"][\"configu... | [
"0.71038556",
"0.68533206",
"0.66548073",
"0.6642778",
"0.6614759",
"0.66092384",
"0.657386",
"0.6558399",
"0.6514052",
"0.6503562",
"0.6494076",
"0.6426489",
"0.64059865",
"0.63780946",
"0.6354746",
"0.6345355",
"0.63227373",
"0.6313503",
"0.6244819",
"0.62039614",
"0.620396... | 0.6586405 | 6 |
Generate data by running a command and collecting output | def generate
verify_config
Open3.popen2e @config['command'] do |_, output, thread|
thread.value # wait for process to complete
return output.read
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_data!\n start_dir = Dir.pwd\n \n Dir.chdir tool_path\n system \"./generate -pc #{product_factor} -fn #{filename} -fc\"\n ensure\n Dir.chdir start_dir\n end",
"def process_command_file\n gather_command\n create_command_structure\n end",
"def execute(options={})... | [
"0.64516294",
"0.6336629",
"0.63296103",
"0.6193673",
"0.6151324",
"0.61205655",
"0.60542774",
"0.6052807",
"0.60262215",
"0.60226816",
"0.5993887",
"0.59515625",
"0.5942318",
"0.5936501",
"0.5936066",
"0.5936066",
"0.5890919",
"0.5889902",
"0.5862355",
"0.5856018",
"0.580720... | 0.6569582 | 0 |
required to call the .methods in setup | def initialize(name, fee, capacity) #needs to be same number of arguments as @room_1 in setup
@name = name
@fee = fee
@capacity = capacity
@guests = []
@playlist = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end"... | [
"0.7891789",
"0.7891789",
"0.7891789",
"0.7891789",
"0.7891789",
"0.7891789",
"0.7891789",
"0.7891789",
"0.7891789",
"0.7891789",
"0.7891789",
"0.7891789",
"0.7891789",
"0.7891789",
"0.7891789",
"0.7891789",
"0.7891789",
"0.7891789",
"0.7891789",
"0.7780818",
"0.7780818",
"... | 0.0 | -1 |
if guest is already there, return out function | def check_in_guest(guest) #unknown guest
if @guests.include? guest #guests array includes guest in parameter
return #exit out of function
end
@guests << guest #else add parameter guest to guests array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_guest_in\n\n end",
"def guest?\n false\n end",
"def guest\n\tend",
"def check_in_guest(guest)\n check_room_under_capacity ? @guests << guest : @full_message\n end",
"def registered?\n !guest?\n end",
"def create_guest?\r\n admin? or streamer?\r\n end",
"def is_guest?\n ret... | [
"0.7410358",
"0.715029",
"0.7022288",
"0.70178497",
"0.6949647",
"0.68717533",
"0.6822883",
"0.67929786",
"0.67866886",
"0.6784206",
"0.6735379",
"0.669593",
"0.66810673",
"0.66810673",
"0.6652118",
"0.6614335",
"0.6614115",
"0.6601692",
"0.6584512",
"0.65656567",
"0.6540923"... | 0.74786454 | 0 |
return length of guests array | def check_in_count()
return @guests.length #guests array length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guest_count\n return @guests.count\n end",
"def guests_count\n return @guests_count\n end",
"def how_many_on_bus\n return @passengers.length\n end",
"def total_guests_in_rooms()\n guests_in_bar = 0\n for room in @rooms\n guests_in_bar += room.guests_in_room()\... | [
"0.78583276",
"0.7791704",
"0.7013013",
"0.70009977",
"0.68703973",
"0.6829684",
"0.68013054",
"0.677168",
"0.67589056",
"0.67343223",
"0.67008513",
"0.6698393",
"0.6670585",
"0.6650039",
"0.66431344",
"0.6622324",
"0.6615711",
"0.6610021",
"0.6591628",
"0.6577191",
"0.656785... | 0.85818213 | 0 |
delete guest from room (checkout) | def check_out_guest(guest)
@guests.delete(guest)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_guest_from_room(guest)\n @guest_list.delete(guest)\nend",
"def check_out_guest(guest)\n @guest.delete(guest)\n end",
"def remove_guest_from_room()\n @room.remove_guest_from_room\n assert_equal(2, @room.count_occupants)\n end",
"def destroy\n @guest.destroy\n \n head :no_co... | [
"0.8070543",
"0.79746747",
"0.7686322",
"0.75443536",
"0.7503191",
"0.74931955",
"0.7423502",
"0.740848",
"0.7333578",
"0.72555083",
"0.70654905",
"0.70147216",
"0.69991994",
"0.69523066",
"0.6927726",
"0.6882915",
"0.6867856",
"0.68499887",
"0.68414813",
"0.6831871",
"0.6831... | 0.77163595 | 2 |
check if song already in playlist if not, then add song to playlist | def add_song_to_playlist(song)
if @playlist.include? song
return #exit out of function if already exits
end
@playlist << song #else add song to playlist array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_track(new_song)\n if AVAILABLE_SONGS.include?(new_song)\n @playlist << new_song\n else\n return false\n end\n end",
"def add_song(song)\n if(!songs.include?song)\n songs.add(song)\n end\n end",
"def add_song(song)\n if song.artist == nil #does not assign the song if the ... | [
"0.8434937",
"0.7989234",
"0.77276343",
"0.7713624",
"0.7488609",
"0.7471647",
"0.7427519",
"0.7427519",
"0.7318612",
"0.73185813",
"0.7309025",
"0.72842914",
"0.72813916",
"0.72039473",
"0.72027",
"0.71968687",
"0.7169483",
"0.7145249",
"0.7135759",
"0.7104619",
"0.70811206"... | 0.87650377 | 0 |
return length of playlist array | def playlist_count()
return @playlist.length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def playlist_count\n return @playlists.length\n end",
"def playlists_length\n self.lib.playlists.length\n end",
"def number_of_songs()\n return songs.length\n end",
"def number_of_songs()\n return songs.length\n end",
"def size\n return @songs.length\n end",
"def length\... | [
"0.8705708",
"0.8167604",
"0.7896768",
"0.7896768",
"0.78688854",
"0.75186074",
"0.7386976",
"0.7352658",
"0.7350901",
"0.71811694",
"0.7092691",
"0.70698416",
"0.7068581",
"0.7041744",
"0.7038525",
"0.6981889",
"0.6970537",
"0.6944267",
"0.69323736",
"0.6927623",
"0.6927623"... | 0.8865844 | 0 |
remove song provided as argument from playlist array | def remove_song_from_playlist(song)
@playlist.delete(song)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(*song)\n\t\tsong.each do |num|\n\t\t\tif @contents.include?(num) == false #order matters here or else you get statement due to delete destructiveness\n\t\t\t\tputs \"You don't have this song in your playlist to delete.\"\n\t\t\tend\n\t\t\tif @contents.include?(num)\n\t\t\t\t@num_of_tracks -= 1\n\t\t\t\t... | [
"0.81234753",
"0.7929283",
"0.7749781",
"0.7314323",
"0.73069143",
"0.71923465",
"0.7147525",
"0.6951077",
"0.68610513",
"0.68596494",
"0.6797947",
"0.67112815",
"0.6700946",
"0.668437",
"0.66258067",
"0.65319383",
"0.64740896",
"0.6450877",
"0.64472127",
"0.64418256",
"0.634... | 0.81154925 | 1 |
too many guests max 6 this is not right but is passing test | def too_may_guests_in_room__true()
if @guests.check_in_count() > @capacity
return true
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_guest_check_in__under_capacity()\n @room1.check_guest_in(@guest4)\n assert_equal(3, @room1.guests.length())\n end",
"def test_too_many_guests_in_room__true()\n @room_1.check_in_guest(@guest_1)\n @room_1.check_in_guest(@guest_2)\n @room_1.check_in_guest(@guest_3)\n @room_1.check_in_gue... | [
"0.712115",
"0.6813237",
"0.677187",
"0.6601035",
"0.65486026",
"0.6422186",
"0.6407671",
"0.63760465",
"0.6372852",
"0.6346748",
"0.6345402",
"0.6334635",
"0.6329164",
"0.62207973",
"0.62125957",
"0.61484855",
"0.6139244",
"0.6137288",
"0.6113616",
"0.6100911",
"0.6068151",
... | 0.582155 | 40 |
songs can be added to artist | def add_song(song)
@songs <<(song)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_song(song)\n # song.artist = self # assigns the current artist to the song's 'artist' property (song belongs to artist)\n #@songs << song #adds the song to the current artist's 'songs' collection \n ##does not assign the artist if the song already has an artist\n if song.artist == s... | [
"0.79232967",
"0.78082263",
"0.7756778",
"0.7756778",
"0.7756778",
"0.77331173",
"0.7687537",
"0.76847327",
"0.76845515",
"0.76729906",
"0.7665747",
"0.7665747",
"0.7663329",
"0.762999",
"0.762874",
"0.762874",
"0.762874",
"0.762874",
"0.762874",
"0.762874",
"0.762874",
"0.... | 0.7325196 | 59 |
interate songs through genres | def genres
@songs.collect {|g| g.genre}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def genres\n self.songs.collect do |song| #call the artist class on the songs method and collect the song\n song.genre #then call the genre on the song\n end\n end",
"def genres\n songs.map{|song| song.genre} # giving back all the genres under that particular artist. artists can have nmany genr... | [
"0.66566724",
"0.6550072",
"0.6480032",
"0.64588547",
"0.6411091",
"0.63688934",
"0.63300127",
"0.63190585",
"0.63167983",
"0.631523",
"0.6310767",
"0.6310767",
"0.6310767",
"0.6310767",
"0.6310767",
"0.63103974",
"0.6297886",
"0.625026",
"0.6228864",
"0.6212446",
"0.61807513... | 0.62155515 | 19 |
Registers a component class so an alias can be used rather than worrying about the module path etc.. | def register_ctype(type, klass)
ctypes[type] = klass
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_class(name, clazz)\n register(name, Component::Descriptor.new(clazz))\n end",
"def register_component(dsl_method, component_class)\n # Matestack::Ui::Component.register({ dsl_method => component_class })\n Matestack::Ui::Core::Base.define_method(dsl_method) do |text = nil, options = {}... | [
"0.6685995",
"0.6471076",
"0.6319131",
"0.6213128",
"0.6001703",
"0.5883832",
"0.5848968",
"0.57155985",
"0.57087356",
"0.57072216",
"0.5664496",
"0.5654362",
"0.5632018",
"0.5626731",
"0.561078",
"0.56103384",
"0.5496881",
"0.54968536",
"0.54968536",
"0.5473569",
"0.54709166... | 0.0 | -1 |
Lookup a component object by its type | def lookup_ctype(ctype)
ctypes[ctype] or raise Exceptions::TypeNotRegistered.new(ctype)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_component(result, type, data = 'long_name')\n result.fetch('address_components', [])\n .find { |component| component['types'].include?(type) }\n &.dig(data)\n end",
"def component(name)\n components.each { |c| return c if c.name == name.to_sym }\n r... | [
"0.6764163",
"0.6490957",
"0.6345944",
"0.6315893",
"0.63075745",
"0.62950176",
"0.6263396",
"0.6243505",
"0.620995",
"0.6207355",
"0.6207199",
"0.6138898",
"0.61342806",
"0.61342806",
"0.61313653",
"0.6117531",
"0.6104118",
"0.6099368",
"0.60856646",
"0.6074642",
"0.6023894"... | 0.5500097 | 57 |
Lookup a page object by its type | def lookup_ptype(ptype)
ptypes[ptype] or raise Exceptions::TypeNotRegistered.new(ptype)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type\n :pages if is_a?(Page)\n end",
"def type_name\n \"page\"\n end",
"def get_object(type, id)\n repo = barerepo\n return false if repo.empty?\n return repo.head.target unless id\n begin\n res = repo.lookup id\n rescue\n return false\n end\n (res.type == type) ?... | [
"0.69089067",
"0.6537821",
"0.64206654",
"0.64206654",
"0.63904953",
"0.63445276",
"0.6258888",
"0.62308544",
"0.62291974",
"0.6203273",
"0.6192876",
"0.6180086",
"0.6166505",
"0.6059156",
"0.6012655",
"0.6012655",
"0.5993433",
"0.5991561",
"0.5980976",
"0.5973948",
"0.595959... | 0.0 | -1 |
GET /units GET /units.json | def index
@units = Unit.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def foods_units\n get('/foods/units.json')\n end",
"def index\n response = HTTParty.get(\"https://casa-core.herokuapp.com/api/units\", :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n @units = JSON.parse(response.body)\n return @units\n end",
"def units\n @units = Item.select... | [
"0.84164613",
"0.75558716",
"0.745075",
"0.6969121",
"0.69408023",
"0.68929374",
"0.68462974",
"0.67773116",
"0.6772809",
"0.67331964",
"0.6627543",
"0.66267127",
"0.66160816",
"0.6614156",
"0.6612874",
"0.6612874",
"0.6612874",
"0.65965754",
"0.65781355",
"0.6564471",
"0.654... | 0.68686295 | 9 |
GET /units/1 GET /units/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def foods_units\n get('/foods/units.json')\n end",
"def units\n @units = Item.select(\"DISTINCT unit\").where(\"unit like ?\", \"%#{params[:q]}%\").limit(20).map(&:unit)\n @units += Detail.select(\"DISTINCT unit\").where(\"unit like ?\", \"%#{params[:q]}%\").limit(20).map(&:unit)\n @units = @uni... | [
"0.8020733",
"0.73784614",
"0.72970515",
"0.727637",
"0.7244588",
"0.7244588",
"0.7244588",
"0.7179953",
"0.6931644",
"0.68736583",
"0.683191",
"0.6751607",
"0.6751607",
"0.6751607",
"0.6751607",
"0.6751607",
"0.6751607",
"0.66951364",
"0.66746956",
"0.66559684",
"0.66320664"... | 0.0 | -1 |
POST /units POST /units.json | def create
@datasheet = Datasheet.find_by(name: params[:name])
@unit = Unit.new
@unit.name = @datasheet.name
@unit.role = @datasheet.role
@unit.power = @datasheet.power
@unit.movement = @datasheet.movement
@unit.shooting_skill = @datasheet.shooting_skill
@unit.strength = @datasheet.strength
@unit.combat_skill = @datasheet.combat_skill
@unit.attacks = @datasheet.attacks
@unit.wounds = @datasheet.wounds
@unit.leadership = @datasheet.leadership
@unit.armor_save = @datasheet.armor_save
@unit.invul_shooting = @datasheet.invul_shooting
@unit.invul_combat = @datasheet.invul_combat
@unit.single_model_point_cost = @datasheet.single_model_point_cost
@unit.model_count_increment = @datasheet.model_count_increment
@unit.power_for_each_increment = @datasheet.power_for_each_increment
@unit.min_model_count = @datasheet.min_model_count
@unit.max_model_count = @datasheet.max_model_count
@unit.slots = @datasheet.slots
@unit.toughness = @datasheet.toughness
@unit.fnp = @datasheet.fnp
@unit.faction_keywords = @datasheet.faction_keywords
@unit.keywords = @datasheet.keywords
@unit.abilities = @datasheet.abilities
respond_to do |format|
if @unit.save
format.html { redirect_to @unit, notice: 'Unit was successfully create@datasheet.' }
format.json { render :show, status: :created, location: @unit }
else
format.html { render :new }
format.json { render json: @unit.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @unit = Unit.new(params[:unit])\n\n respond_to do |format|\n if @unit.save\n format.html { redirect_to @unit, notice: 'Unit was successfully created.' }\n format.json { render json: @unit, status: :created, location: @unit }\n else\n format.html { render action: \"... | [
"0.67017543",
"0.67017543",
"0.665163",
"0.66260743",
"0.65848905",
"0.6571388",
"0.6559905",
"0.6513941",
"0.64358485",
"0.643058",
"0.64260685",
"0.64147675",
"0.6377638",
"0.6371824",
"0.63462377",
"0.6335834",
"0.6332594",
"0.6331857",
"0.6330569",
"0.631212",
"0.6300642"... | 0.0 | -1 |
PATCH/PUT /units/1 PATCH/PUT /units/1.json | def update
respond_to do |format|
if @unit.update(unit_params)
format.html { redirect_to @unit, notice: 'Unit was successfully update@datasheet.' }
format.json { render :show, status: :ok, location: @unit }
else
format.html { render :edit }
format.json { render json: @unit.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n params.require(%i[id units])\n retrieve_and_validate_put.update!(units: params[:units])\n head :no_content\n end",
"def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query... | [
"0.78405803",
"0.71017027",
"0.69240105",
"0.6828834",
"0.67859524",
"0.67807686",
"0.6654957",
"0.6617484",
"0.659022",
"0.6557099",
"0.6543901",
"0.6528244",
"0.6519733",
"0.6517602",
"0.6511026",
"0.64756215",
"0.6440191",
"0.6405442",
"0.63572663",
"0.63474584",
"0.631114... | 0.6488906 | 15 |
DELETE /units/1 DELETE /units/1.json | def destroy
@unit.destroy
respond_to do |format|
format.html { redirect_to units_url, notice: 'Unit was successfully destroye@datasheet.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n response = HTTParty.delete(url, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n redirect_to units_url, notice: 'Unit was successfully deleted.'\n end",
"def destroy\n @unit.destroy\n respond_to do |form... | [
"0.7785851",
"0.76692647",
"0.7640569",
"0.7640569",
"0.7640569",
"0.7640569",
"0.76393604",
"0.75941813",
"0.7526625",
"0.7450989",
"0.7423007",
"0.7408337",
"0.7406485",
"0.73811907",
"0.73450744",
"0.7308755",
"0.7216169",
"0.72083074",
"0.7170146",
"0.7147241",
"0.7145571... | 0.7330169 | 15 |
Use callbacks to share common setup or constraints between actions. | def set_unit
@unit = Unit.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 unit_params
params.require(:unit).permit(:name, :role, :power, :movement, :shooting_skill, :strength, :combat_skill, :attacks, :wounds, :leadership, :armor_save, :invul_shooting, :invul_combat, :single_model_point_cost, :model_count_increment, :power_for_each_increment, :min_model_count, :max_model_count, :detachment_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.6980244",
"0.6782812",
"0.6745103",
"0.6741142",
"0.6733961",
"0.65925",
"0.6503602",
"0.64967257",
"0.64822173",
"0.64796996",
"0.6456357",
"0.6439594",
"0.63803256",
"0.6376499",
"0.63644457",
"0.6319286",
"0.6299465",
"0.6298051",
"0.62935406",
"0.62923044",
"0.6291212"... | 0.0 | -1 |
stack = [1, 2, 3 ] arr[index] = 2 | def calc(arr)
arr.unshift(0)
arr.push(0)
areas = []
stack = []
(0...(arr.size)).each do |index|
if stack.empty? || arr[index] > arr[stack.last]
# increasing
stack << index
else
# decreased
while !stack.empty? && arr[stack.last] >= arr[index]
stack_last_index = stack.pop
height = arr[stack_last_index]
if stack.empty?
width = index + 1 - 2
else
width = index - stack.last + 1 - 2
puts "width: #{width}, #{index}- #{stack.last}"
end
area = width * height
puts "#{arr[stack_last_index]}: #{arr[index]}, area: #{area}"
areas << area
end
stack << index
end
end
areas.max
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_element_from_index(array, index_number, element)\nreturn array[index_number] = element\n\nend",
"def []=(index, element); end",
"def []=(indx, value)\n elements[indx] = value\n end",
"def set(index, element)\n @array_list.set(index, element)\n end",
"def replace_index!(arr, i,array)\... | [
"0.72332317",
"0.67044294",
"0.66684604",
"0.6662143",
"0.6607765",
"0.65674853",
"0.65340406",
"0.65303344",
"0.6355904",
"0.6354378",
"0.6300532",
"0.6298089",
"0.6279905",
"0.62794507",
"0.62416357",
"0.6218035",
"0.6216051",
"0.61948895",
"0.6159129",
"0.6133033",
"0.6129... | 0.0 | -1 |
More than the half of the possible votes are required to approve a motion. | def required_votes
possible_votes / 2 + 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_met_requirement?\n yeas >= required_votes\n end",
"def require_minimum?\n self.minimum_positive_votes > 0\n end",
"def votes_needed \n if self.filed? || self.finished? # If the petition is not pending, then 0 votes are needed.\n return 0\n elsif self.pending? # Petition has not be... | [
"0.6876242",
"0.65553147",
"0.6524294",
"0.6163054",
"0.6159624",
"0.6147537",
"0.6129235",
"0.6062156",
"0.6062156",
"0.60585105",
"0.605571",
"0.5999721",
"0.5908174",
"0.5899893",
"0.588491",
"0.5827727",
"0.5798995",
"0.57938755",
"0.5789473",
"0.5774228",
"0.5758461",
... | 0.7615077 | 0 |
Check if a motion has enough possitive votes to be approved. | def has_met_requirement?
yeas >= required_votes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_enough_votes?\n if self.resident_upvotes.count >= 5\n return true \n else \n return false\n end \n end",
"def any_votes?\n total_votes > 0\n end",
"def has_votes?\n vote_count > 0\n end",
"def require_minimum?\n self.minimum_positive_votes > 0\n end",
"def vote?\... | [
"0.73018366",
"0.7154165",
"0.7091299",
"0.68457776",
"0.678379",
"0.6759563",
"0.67576575",
"0.6756744",
"0.6634839",
"0.659845",
"0.6537551",
"0.6512551",
"0.6482864",
"0.6482864",
"0.6478575",
"0.6468165",
"0.64644057",
"0.63844293",
"0.63379097",
"0.6333957",
"0.6316613",... | 0.7647059 | 0 |
More than a third of the possible votes are required to expedite a motion. | def seconds_for_expedition
possible_votes / 3 + 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def required_votes\n possible_votes / 2 + 1\n end",
"def has_met_requirement?\n yeas >= required_votes\n end",
"def votes_needed \n if self.filed? || self.finished? # If the petition is not pending, then 0 votes are needed.\n return 0\n elsif self.pending? # Petition has not been filed ye... | [
"0.7409202",
"0.6717243",
"0.6539872",
"0.6056907",
"0.5919687",
"0.57985973",
"0.57480663",
"0.56763995",
"0.56730163",
"0.56201",
"0.5585578",
"0.54954344",
"0.54739374",
"0.5467074",
"0.54477614",
"0.5422542",
"0.5404214",
"0.54031813",
"0.5372747",
"0.5368989",
"0.5363862... | 0.7327932 | 1 |
Check if a motion has enough seconds to bypass the discussion and be brought inmediately to a vote (be expedited). | def can_expedite?
seconds.count >= seconds_for_expedition
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scheduled_update(time_elapsed)\n if time_elapsed >= 48.hours\n @motion.voting!\n elsif !@motion.objected? && time_elapsed >= 24.hours\n @motion.voting!\n end\n end",
"def quality_check\n if session[:comment_id] == nil\n return true\n else session[:comment_id].each d... | [
"0.6505838",
"0.62662476",
"0.6250974",
"0.6224769",
"0.62233603",
"0.62162703",
"0.6194223",
"0.6055213",
"0.59939057",
"0.5990719",
"0.59867144",
"0.5957111",
"0.594844",
"0.5926441",
"0.5924136",
"0.5919701",
"0.5906367",
"0.58695716",
"0.5863581",
"0.58513147",
"0.5851314... | 0.6778013 | 0 |
Check if a motion has enough seconds (more than two) to start being discussed. | def can_wait_objection?
seconds.count >= 2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_expedite?\n seconds.count >= seconds_for_expedition\n end",
"def has_seconded?(motion)\n seconds.where(:motion_id => motion.id).present?\n end",
"def hasTopStoryDeadlineEnded?\n Time.now.to_s.slice(11..12).to_i > 11 \n end",
"def need_tock?\n if @second == 60\n @second = 0\n ... | [
"0.6941057",
"0.6907861",
"0.6659343",
"0.66139865",
"0.64578575",
"0.64102715",
"0.635969",
"0.63528615",
"0.6348545",
"0.62990856",
"0.6236253",
"0.62322724",
"0.6224659",
"0.61783874",
"0.61300397",
"0.6112214",
"0.6090784",
"0.60905117",
"0.60802406",
"0.6037961",
"0.6021... | 0.64493793 | 5 |
Checks to see if a member has a conflict on a motion. | def conflicts_with_member?(member)
motion_conflicts = conflicts
member_conflicts = member.conflicts
(member_conflicts & motion_conflicts).size > 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conflict?\n conflicts = users_events.select{|e| e.start_time < self.end_bound && e.end_time > self.start_bound}.sort{|a,b| a.start_time <=> b.start_time}\n conflicts -= [self]\n if conflicts.empty?\n return false\n else\n return (!self.resolve_conflict([self]))... | [
"0.6520546",
"0.6515015",
"0.61512333",
"0.5950593",
"0.5822961",
"0.5757731",
"0.57151526",
"0.5677083",
"0.5662443",
"0.5586008",
"0.5552758",
"0.5530891",
"0.55269736",
"0.5489859",
"0.5488872",
"0.54590595",
"0.5458942",
"0.5420457",
"0.53968257",
"0.5393582",
"0.5382554"... | 0.85868144 | 0 |
Check if the member is allowed to perform the given action. | def permit?(action, member)
state.permit?(action, member)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can?(action)\n @allowed_fields.include? action\n end",
"def member_action?\n member_actions.include?(action)\n end",
"def action_allowed?(action_name, user)\n return false\n end",
"def is_authorized_to_perform(action)\n permission = role.shift_management_permissions_table.read_... | [
"0.77265525",
"0.76904637",
"0.76589197",
"0.76586634",
"0.752774",
"0.74699926",
"0.74660164",
"0.74595314",
"0.74399394",
"0.7245327",
"0.71963763",
"0.7195146",
"0.71870273",
"0.7162875",
"0.7130789",
"0.7097035",
"0.7082429",
"0.70640355",
"0.7055085",
"0.70246035",
"0.70... | 0.7577431 | 4 |
Check if a motion has been objected by any member. | def objected?
objections.any?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conflicts_with_member?(member)\n motion_conflicts = conflicts\n member_conflicts = member.conflicts\n (member_conflicts & motion_conflicts).size > 0\n end",
"def permit_object?(member)\n member.membership_active? && @motion.objections.where(:member_id => member.id).blank?\n end",
"def has... | [
"0.7146535",
"0.6554934",
"0.6494094",
"0.6466953",
"0.6250113",
"0.62248224",
"0.62027276",
"0.61767066",
"0.61340016",
"0.6103764",
"0.6095675",
"0.6095675",
"0.60941714",
"0.6078952",
"0.6078597",
"0.60766304",
"0.60701674",
"0.6069082",
"0.6065589",
"0.60510087",
"0.60473... | 0.0 | -1 |
Check if a motion is currently waiting for seconds. | def waitingsecond?
state_name == "waitingsecond"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def waiting?\n @lock.synchronize { !defined?(@start_time) }\n end",
"def waiting?\n @status[:description] == :wait\n end",
"def update_wait?\r\n # If waiting\r\n if @wait_count > 0\r\n # Decrease wait count\r\n @wait_count -= 1\r\n return true\r\n end\r\n return false... | [
"0.73131037",
"0.700427",
"0.6962456",
"0.69039625",
"0.6898193",
"0.6765377",
"0.67591244",
"0.6747025",
"0.672226",
"0.66708356",
"0.66506463",
"0.6633222",
"0.6617553",
"0.6616925",
"0.66162705",
"0.6598381",
"0.65912706",
"0.6541481",
"0.6541481",
"0.65316695",
"0.6460328... | 0.6357339 | 24 |
Move a motion to the discussing state. | def discussing!
update_attributes(:state_name => "discussing")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_move(move)\n @current_state = @current_state.next_state(move)\n end",
"def move(direction)\n \n end",
"def setup_move_to_target\n return unless PONY::ERRNO.check_sequence(current_act)\n stop_all_movements\n xpos = target.x + (flip ? -@acts[1] : @acts[1])\n ypos = target.y + @... | [
"0.6046507",
"0.59363395",
"0.58787924",
"0.5864213",
"0.5864213",
"0.58580405",
"0.5824478",
"0.58216256",
"0.58035135",
"0.58035135",
"0.5777753",
"0.5741631",
"0.571615",
"0.56874275",
"0.5675241",
"0.567032",
"0.5668092",
"0.5648709",
"0.5646061",
"0.5629996",
"0.5594657"... | 0.51355815 | 90 |
Check if a motion is currently being discussed. For the details of the behaviour of a motion in this state see the corresponding MotionState object. | def discussing?
state_name == "discussing"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def motivatedByCommenting?\n motivatedByCommenting.length > 0\n end",
"def has_seconded?(motion)\n seconds.where(:motion_id => motion.id).present?\n end",
"def motivatedByTagging?\n motivatedByTagging.length > 0\n end",
"def animation?\n return @animation != nil\n end",
"def... | [
"0.6403353",
"0.6153051",
"0.6011644",
"0.5959487",
"0.5945336",
"0.59112275",
"0.5908494",
"0.5832522",
"0.5798627",
"0.57980907",
"0.5797082",
"0.5789777",
"0.5769233",
"0.5761686",
"0.5687327",
"0.56840914",
"0.56731415",
"0.56660455",
"0.5642243",
"0.56355745",
"0.5601055... | 0.62574744 | 1 |
Move a motion to the voting state. | def voting!
update_attributes(:state_name => "voting")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_move(move)\n @current_state = @current_state.next_state(move)\n end",
"def move(direction)\n \n end",
"def living_move\n simulate_move(opponent)\n end",
"def robot_move\n state_execute do |robot|\n robot.move\n end\n end",
"def move(vpoint)\n @position += vpoin... | [
"0.6249201",
"0.60600835",
"0.59730464",
"0.59561867",
"0.5913665",
"0.5899842",
"0.5850397",
"0.5847538",
"0.5847538",
"0.5812924",
"0.5793761",
"0.57884747",
"0.5784363",
"0.5744491",
"0.57334167",
"0.5705649",
"0.5704264",
"0.5704264",
"0.56843936",
"0.56777155",
"0.566412... | 0.56908077 | 18 |
Check if a motion is currently being voted. For the details of the behaviour of a motion in this state see the corresponding MotionState object. | def voting?
state_name == "voting"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_voted_on?(motion)\n votes.where(:motion_id => motion.id).present?\n end",
"def voted\n\t\tcurrent_user = User.current_user\n\t\tunless current_user.blank?\n\t\t\tcurrent_user.voted?(self)\n\t\telse\n\t\t\tfalse\n\t\tend \n\tend",
"def current_user_can_vote?\n current_user && votes_enabled? &... | [
"0.74492514",
"0.68972766",
"0.66509634",
"0.66293937",
"0.6595027",
"0.6568033",
"0.6553048",
"0.6539838",
"0.6494603",
"0.6404001",
"0.6358157",
"0.6300463",
"0.62940323",
"0.62805027",
"0.62749904",
"0.6273466",
"0.6271532",
"0.6229559",
"0.6227473",
"0.61639345",
"0.61533... | 0.72338253 | 1 |
A motion is considered passed when it has enough votes to be accepted but the voting period hasn't ended. | def passed?
voting? && has_met_requirement?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_met_requirement?\n yeas >= required_votes\n end",
"def vote_threshold\n vote_count = self.votes_for.count # Sets variable for tracking petition's vote count\n if vote_count >= 500 && self.filed == false && self.stage == 0 # Petition hit the goal threshold and hasn't already been file... | [
"0.6608893",
"0.65680903",
"0.63286537",
"0.6328483",
"0.62781113",
"0.62677574",
"0.62479186",
"0.61320484",
"0.61200714",
"0.60836905",
"0.6071617",
"0.6035847",
"0.6019764",
"0.59455895",
"0.58984274",
"0.58933276",
"0.5891851",
"0.58760965",
"0.5868786",
"0.58415467",
"0.... | 0.67786723 | 0 |
Move a motion to the closed state. Also calculates the number of members who abstained from voting and record the time when the motion was closed. Also notify members on the outcome of the vote. | def closed!
update_attributes(
:state_name => "closed",
:abstains => possible_votes - votes.count,
:closed_at => Time.now
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def block\n winning_move(@opponent_mark) \n end",
"def scheduled_update(time_elapsed)\n @motion.closed! if time_elapsed >= 48.hours\n end",
"def motion (direction)\n unit = (direction == :forward) ? 1 : -1;\n new_x, new_y = @x, @y\n case @heading\n when 'N'\n new_y = bound... | [
"0.524176",
"0.5110267",
"0.5099136",
"0.5080111",
"0.50496984",
"0.494642",
"0.49322176",
"0.4910202",
"0.48956367",
"0.48553088",
"0.4852663",
"0.48355287",
"0.48315617",
"0.47934532",
"0.47911367",
"0.47801855",
"0.4764904",
"0.47518197",
"0.47229236",
"0.47005713",
"0.470... | 0.63517076 | 0 |
The time when the motion was approved. | def approved_at
closed_at if approved?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reviewed_date_time\n return @reviewed_date_time\n end",
"def current_time\r\n return @owner.timestamp.to_i - @start.to_i\r\n end",
"def acquired_date_time\n return @acquired_date_time\n end",
"def current_time\n @definition.current_time\n ... | [
"0.6955905",
"0.68401855",
"0.66379476",
"0.6540269",
"0.65285707",
"0.65285707",
"0.65179944",
"0.65179944",
"0.65179944",
"0.65179944",
"0.65179944",
"0.65179944",
"0.6474352",
"0.64543784",
"0.6444993",
"0.64394766",
"0.6437613",
"0.641087",
"0.641087",
"0.63726133",
"0.63... | 0.6655101 | 2 |
Check if the voting period of a motion has ended or if the motion never got there. For the details of the behaviour of a motion in this state see the corresponding MotionState object. | def closed?
state_name == "closed"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_progress?\n ended_at.nil?\n end",
"def ended?\n\t\t\tstate == 'ended'\n\t\tend",
"def has_started?\n historic_velocity.any? do |velocity|\n velocity != 0\n end\n end",
"def game_ended?\n\t\treturn @game_ended\n\t end",
"def vt_forever?\n vtend_at == InfinityValue\n end",
... | [
"0.6222734",
"0.61449236",
"0.60914475",
"0.60570663",
"0.59851354",
"0.5929526",
"0.5927477",
"0.5921877",
"0.5917316",
"0.58930767",
"0.5891457",
"0.58789027",
"0.58789027",
"0.58761173",
"0.585854",
"0.58287454",
"0.5822438",
"0.5819397",
"0.5817261",
"0.58094233",
"0.5792... | 0.0 | -1 |
A open state is any state different than closed. | def open?
!closed?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state\n # pending, open, closed\n now = Time.now\n if now < opening\n return :pending\n elsif now < closing\n return :open\n else\n return :closed\n end\n end",
"def is_open?\n return state == :open\n end",
"def closed?\n state == \"closed\"... | [
"0.7477812",
"0.74129236",
"0.7410055",
"0.7399374",
"0.73821753",
"0.72755736",
"0.7200966",
"0.71756387",
"0.7070934",
"0.70585775",
"0.7028843",
"0.6969704",
"0.6968767",
"0.6922147",
"0.68861234",
"0.6820528",
"0.66325605",
"0.66235673",
"0.66156757",
"0.65756816",
"0.657... | 0.6664011 | 17 |
A motion is considered approved when it has enough votes to be accepted and the voting period has ended. | def approved?
closed? && has_met_requirement?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def approved?\n !self.pending\n end",
"def permit_vote?(member)\n member.membership_active? && !member.has_voted_on?(@motion) && !@motion.conflicts_with_member?(member)\n end",
"def approved?\n (status == APPROVED)\n end",
"def approved?\n status == STATUS_APPROVED\n end",
"def ... | [
"0.64893955",
"0.62969774",
"0.62834364",
"0.6272881",
"0.6205557",
"0.6196468",
"0.61599267",
"0.6136747",
"0.61215395",
"0.6073041",
"0.6053503",
"0.6051891",
"0.6045109",
"0.60410976",
"0.6000122",
"0.5962924",
"0.5962786",
"0.5936705",
"0.59327865",
"0.5918725",
"0.590790... | 0.5692713 | 48 |
A motion is considered failed when it didn't get enough votes to be accepted in the voting period, or when it didn't even got the enough seconds to be there. | def failed?
closed? && !has_met_requirement?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_met_requirement?\n yeas >= required_votes\n end",
"def passed?\n voting? && has_met_requirement?\n end",
"def check_rating_run\n raise Error.new(\"rating run is not in waiting state\") unless @rating_run.status == \"waiting\"\n rivals = @rating_run.rivals\n raise Error.new(\"ther... | [
"0.6253899",
"0.6234462",
"0.6075437",
"0.6040925",
"0.59720665",
"0.5920691",
"0.57971776",
"0.577078",
"0.57311225",
"0.5707214",
"0.56947255",
"0.56826943",
"0.5634414",
"0.5627313",
"0.55756056",
"0.55179423",
"0.55087733",
"0.54651314",
"0.54538536",
"0.5451983",
"0.5438... | 0.0 | -1 |
GET /ins_companies/1 GET /ins_companies/1.json | def show
@ins_company = InsCompany.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @ins_company }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @companies = Company.all\n if @companies\n render json: {\n companies: @companies\n }\n else\n render json: {\n status: 500,\n errors: ['No companies']\n }\n end\n end",
"def companies\n render \"company/companies.json.jbuilder\", status: :ok... | [
"0.7346406",
"0.7322858",
"0.7313215",
"0.7140198",
"0.71147716",
"0.71147716",
"0.71147716",
"0.71147716",
"0.70954835",
"0.7021455",
"0.6961943",
"0.69552577",
"0.69405466",
"0.69345313",
"0.69337124",
"0.69319624",
"0.69311345",
"0.691568",
"0.6905434",
"0.68424493",
"0.68... | 0.7443731 | 0 |
GET /ins_companies/new GET /ins_companies/new.json | def new
@ins_company = InsCompany.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @ins_company }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @company = Company.new(:name => 'default')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @company }\n end\n end",
"def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render ... | [
"0.7786051",
"0.7761228",
"0.7761228",
"0.7761228",
"0.7761228",
"0.7761228",
"0.7761228",
"0.7761228",
"0.7761228",
"0.7761228",
"0.7761228",
"0.77298295",
"0.7542765",
"0.749776",
"0.7452097",
"0.74302375",
"0.737182",
"0.7325608",
"0.72716516",
"0.7266218",
"0.72135305",
... | 0.80190885 | 0 |
POST /ins_companies POST /ins_companies.json | def create
@ins_company = InsCompany.new(params[:ins_company])
respond_to do |format|
if @ins_company.save
format.html { redirect_to @ins_company, notice: 'Ins company was successfully created.' }
format.json { render json: @ins_company, status: :created, location: @ins_company }
else
format.html { render action: "new" }
format.json { render json: @ins_company.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n if @company = Company.find(entity_id_from_params(:company))\n respond_to do |format|\n current_user.account.companies << @company\n format.html { redirect_to root_path, notice: 'Company was successfully created.' }\n format.json\n end\n end\n end",
"def companie... | [
"0.6751136",
"0.63088596",
"0.6227939",
"0.6165858",
"0.6110454",
"0.59519774",
"0.58928305",
"0.5873369",
"0.58414567",
"0.5827541",
"0.58225596",
"0.5792947",
"0.57411194",
"0.5693189",
"0.56482947",
"0.56395614",
"0.56373066",
"0.56282496",
"0.5626879",
"0.56174856",
"0.55... | 0.6783427 | 0 |
PUT /ins_companies/1 PUT /ins_companies/1.json | def update
@ins_company = InsCompany.find(params[:id])
respond_to do |format|
if @ins_company.update_attributes(params[:ins_company])
format.html { redirect_to @ins_company, notice: 'Ins company was successfully updated.' }
format.json { head :ok }
else
format.html { render action: "edit" }
format.json { render json: @ins_company.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update_companies\n current_companies = @movie.companies.collect { |c| c.id.to_s }\n\n delete_production_companies( current_companies )\n add_production_companies( current_companies ) unless params[:companies].... | [
"0.70827025",
"0.6908864",
"0.65594894",
"0.65311855",
"0.6493785",
"0.64832133",
"0.6423527",
"0.6414983",
"0.6383885",
"0.63819474",
"0.63688356",
"0.6311995",
"0.62923837",
"0.62917036",
"0.62917036",
"0.62917036",
"0.62917036",
"0.62917036",
"0.62917036",
"0.6279401",
"0.... | 0.72514665 | 0 |
DELETE /ins_companies/1 DELETE /ins_companies/1.json | def destroy
@ins_company = InsCompany.find(params[:id])
@ins_company.destroy
respond_to do |format|
format.html { redirect_to ins_companies_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @crunch_company = CrunchCompany.find(params[:id])\n @crunch_company.destroy\n\n respond_to do |fo... | [
"0.7669816",
"0.7452429",
"0.7278111",
"0.72413665",
"0.72413665",
"0.72413665",
"0.72413665",
"0.72413665",
"0.72413665",
"0.72413665",
"0.72413665",
"0.72413665",
"0.72413665",
"0.7235946",
"0.7235946",
"0.7235946",
"0.7223442",
"0.7207534",
"0.7168047",
"0.7123996",
"0.711... | 0.7856465 | 0 |
Display inbound or outbound route for Bus | def route_config(direction)
stops_xml = MbtaWrapper::BusLine.get_xml('routeConfig', line.to_i)
stops = []
stops_xml.elements.each('body/route/stop') do |stop|
stops << stop.attributes['title']
end
stops
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bus\n [bus_route, bus_stop].map{|r| r.try(:name)}.compact.join(' / ')\n end",
"def show\n @bus_route = BusRoute.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bus_route }\n end\n end",
"def bus_route_name\n bus_route.try(:na... | [
"0.65109503",
"0.6143897",
"0.6140282",
"0.60198545",
"0.5871463",
"0.56142515",
"0.56045014",
"0.54909134",
"0.5488037",
"0.54803866",
"0.54657376",
"0.54431576",
"0.5341485",
"0.5310497",
"0.527451",
"0.52576977",
"0.52408636",
"0.5238818",
"0.521296",
"0.51994556",
"0.5198... | 0.53420645 | 12 |
Cuando llamen a un metodo lo pasamos al hash | def method_missing(m, *args, &block)
@data[m]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash(*) end",
"def hash(key); end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
... | [
"0.76444656",
"0.76444656",
"0.76444656",
"0.76444656",
"0.76444656",
"0.76444656",
"0.76444656",
"0.75371623",
"0.7301164",
"0.7220735",
"0.7220735",
"0.7220735",
"0.7220735",
"0.7220735",
"0.7220735",
"0.7220735",
"0.7220735",
"0.7220735",
"0.7220735",
"0.7027049",
"0.70168... | 0.0 | -1 |
method to creat each instance of Customer | def initialize(id, email, address)
@id = id
@email = email
@address = address
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def customers\n @customers ||= new_resource(self, :customer, :customers)\n end",
"def new\n # The variable @customer receive the object customer.\n @customer = Customer.new\n end",
"def initialize(id, name, addr)\n # Instance variables start with @, available across methods for that insta... | [
"0.7036414",
"0.6866401",
"0.656035",
"0.65577525",
"0.65451074",
"0.6526764",
"0.6521138",
"0.65202284",
"0.6476644",
"0.6451857",
"0.64508516",
"0.6385415",
"0.6349444",
"0.6309968",
"0.62940925",
"0.62855804",
"0.6279796",
"0.62542754",
"0.622749",
"0.6207192",
"0.6201754"... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_rental
@rental = Rental.find(params[:rental_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.61642385",
"0.60448",
"0.5945487",
"0.5915654",
"0.58890367",
"0.58330417",
"0.5776098",
"0.5703048",
"0.5703048",
"0.5654613",
"0.5620029",
"0.5423114",
"0.540998",
"0.540998",
"0.540998",
"0.5393666",
"0.53783023",
"0.53568405",
"0.53391176",
"0.5339061",
"0.53310865",
... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def booking_params
params.permit(:client_email, :start_at, :end_at)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
Defines an area of content in your layout that can be modified or replaced by child layouts that extend it. You can optionally add content to an area using either a String, or a block. Areas are declared in a parent layout and modified by a child layout, but since Nestive allows for multiple levels of inheritance, a child layout can also declare an area for it's children to modify. | def area(name, content = nil, &block)
content = capture(&block) if block_given?
append name, content
render_area name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setContentArea(x, y, width, height)\n setContentAreaX(x)\n setContentAreaY(y)\n setContentAreaWidth(width)\n setContentAreaHeight(height)\n self\n end",
"def contentr_area(area_name, pristine: false, editable: nil)\n raise \"No area name give... | [
"0.6078524",
"0.6069876",
"0.5751081",
"0.56225735",
"0.559077",
"0.5509076",
"0.5490285",
"0.54873246",
"0.5366926",
"0.5361067",
"0.53285384",
"0.5303343",
"0.5286823",
"0.51623654",
"0.51361066",
"0.5125866",
"0.51133394",
"0.51028293",
"0.51028293",
"0.50988686",
"0.50708... | 0.7706212 | 0 |
Appends content to an area previously defined or modified in parent layout(s). You can provide the content using either a String, or a block. | def append(name, content = nil, &block)
content = capture(&block) if block_given?
add_instruction_to_area name, :push, content
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def area(name, content = nil, &block)\n content = capture(&block) if block_given?\n append name, content\n render_area name\n end",
"def place_in_layouts(content, payload, info); end",
"def content_for_layout(name, content) # no blocks allowed yet\n @_content_for_layout ||= {}\n ... | [
"0.7420148",
"0.65578234",
"0.6169124",
"0.61532843",
"0.59366107",
"0.59184915",
"0.5881593",
"0.5768338",
"0.5763261",
"0.5744897",
"0.56603014",
"0.56335837",
"0.5612447",
"0.55990976",
"0.5567159",
"0.5565555",
"0.5524237",
"0.5518246",
"0.55110306",
"0.5491995",
"0.54904... | 0.68521106 | 1 |
Prepends content to an area previously declared or modified in parent layout(s). You can provide the content using either a String, or a block. | def prepend(name, content = nil, &block)
content = capture(&block) if block_given?
add_instruction_to_area name, :unshift, content
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def place_in_layouts(content, payload, info); end",
"def area(name, content = nil, &block)\n content = capture(&block) if block_given?\n append name, content\n render_area name\n end",
"def postload\n if @current_layout && @current_layout.length > 0\n @content_for_layout = @body\n... | [
"0.6359433",
"0.59607196",
"0.58661973",
"0.56467336",
"0.563238",
"0.5628071",
"0.5593315",
"0.55665386",
"0.5526255",
"0.55006814",
"0.54183525",
"0.5410345",
"0.5365752",
"0.5346797",
"0.5285589",
"0.52736866",
"0.52520615",
"0.5236769",
"0.5236769",
"0.520629",
"0.5192526... | 0.6170437 | 1 |
Replaces the content of an area previously declared or modified in parent layout(s). You can provide the content using either a String, or a block. | def replace(name, content = nil, &block)
content = capture(&block) if block_given?
add_instruction_to_area name, :replace, [content]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def area(name, content = nil, &block)\n content = capture(&block) if block_given?\n append name, content\n render_area name\n end",
"def replace_container(name, content)\n render :update do |page|\n page.replace name, content\n end\n end",
"def replace_content(name, content)\n ... | [
"0.65709585",
"0.6432374",
"0.6074983",
"0.602256",
"0.569463",
"0.562737",
"0.5484162",
"0.54821366",
"0.54792005",
"0.54486376",
"0.5446952",
"0.5419411",
"0.5379235",
"0.5373584",
"0.53685385",
"0.5349335",
"0.5308869",
"0.52927893",
"0.5267754",
"0.52423316",
"0.5240538",... | 0.7226312 | 0 |
Purge the content of an area previously declared or modified in parent layout(s). | def purge(*names)
names.each { |name| replace(name, nil) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_area(area)\n reset_meta_data\n segments.each do |seg|\n seg.delete_area(area)\n update_meta_data(seg) unless seg.empty?\n end\n segments.delete_if { |seg| seg.empty? }\n end",
"def forget(element_id)\n unless is_parent_layout?\n return parent_layout.rem... | [
"0.6390228",
"0.61116254",
"0.60780483",
"0.604011",
"0.5995074",
"0.595815",
"0.58571327",
"0.5847901",
"0.5814668",
"0.5745329",
"0.57047343",
"0.5616978",
"0.5603714",
"0.5596921",
"0.5568588",
"0.5568588",
"0.5562394",
"0.5562394",
"0.5550492",
"0.5542791",
"0.554278",
... | 0.0 | -1 |
We record the instructions (declaring, appending, prepending and replacing) for an area of content into an array that we can later retrieve and replay. Instructions are stored in an instance variable Hash | def add_instruction_to_area(name, instruction, value)
@_area_for ||= {}
@_area_for[name] ||= []
@_area_for[name] << [instruction, value]
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_instruction_debug_table\n @instruction_debug_table = {}\n\n @@instructions.each do |i|\n @instruction_debug_table[i[:op]] = {\n :mnemonic => i[:mnemonic],\n :args => i[:args]\n }\n end\n end",
"def instructions(lines)\n lines.map do |l|\n parts... | [
"0.5964653",
"0.59394413",
"0.58945894",
"0.5887134",
"0.554744",
"0.54713655",
"0.54713655",
"0.54019725",
"0.53817236",
"0.53183943",
"0.52872884",
"0.52575696",
"0.52504027",
"0.52194184",
"0.5215418",
"0.5135375",
"0.51125646",
"0.5093502",
"0.5073777",
"0.50684357",
"0.5... | 0.5003616 | 30 |
Take the instructions we've gathered for the area and replay them one after the other on an empty array. These instructions will push, unshift or replace items into our output array, which we then join and mark as html_safe. These instructions are reversed and replayed when we render the block (rather than as they happen) due to the way they are gathered by the layout extension process (in reverse). | def render_area(name)
[].tap do |output|
@_area_for.fetch(name, []).reverse_each do |method_name, content|
output.public_send method_name, content
end
end.join.html_safe
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content\n @blocks.map {|b| b.render } * EOL\n end",
"def doInstructions\n # do absolutely nothing at all... just render instructions\n end",
"def clear\n @instructions = []\n end",
"def clear\n @instructions = []\n end",
"def render\n\t\tputs `clear` #this clears the terminal to kee... | [
"0.5638034",
"0.5445028",
"0.5359173",
"0.53350323",
"0.53062296",
"0.5160986",
"0.5132019",
"0.5100497",
"0.50606847",
"0.5024862",
"0.502193",
"0.49809435",
"0.49798295",
"0.494992",
"0.49490398",
"0.4931152",
"0.4930349",
"0.4926453",
"0.4926452",
"0.49214962",
"0.4916451"... | 0.592374 | 0 |
show new item form | def new
@item = Item.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n\t@item = Item.new(:number => 1, :user_id => current_user.id )\n\trender :layout => 'form' \n end",
"def create\n @item = Item.new(item_params)\n if @item.save\n flash[:success] = \"項目已新增!\"\n redirect_to root_url\n else\n flash[:danger] = \"新增失敗!\"\n @submit_te... | [
"0.80181235",
"0.7450183",
"0.7422244",
"0.73509836",
"0.72914183",
"0.7279561",
"0.7277429",
"0.725858",
"0.7250638",
"0.72412294",
"0.72412294",
"0.72412294",
"0.72245145",
"0.7180633",
"0.7107731",
"0.70588714",
"0.70313275",
"0.70313275",
"0.70313275",
"0.70313275",
"0.70... | 0.69460636 | 49 |
show edit form for item with id | def edit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n @item = Item.find_by_id( params[:id] )\n render :layout => 'form'\n end",
"def edit\n\t\t@item = Item.find(params[:id])\n \tend",
"def edit\n # Renders the edit form\n end",
"def edit\n\n end",
"def item_edit\n end",
"def edit\r\n end",
"def edit\n @option = Vger::Resou... | [
"0.86646557",
"0.81759447",
"0.77520007",
"0.76002294",
"0.748847",
"0.74833983",
"0.7473924",
"0.7437784",
"0.74045384",
"0.7392965",
"0.7319586",
"0.73085415",
"0.73085415",
"0.73085415",
"0.73085415",
"0.73085415",
"0.73085415",
"0.73085415",
"0.73085415",
"0.73085415",
"0... | 0.7439966 | 19 |
update item with id | def update
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!(**args)\n @item_id = args[:item_id] if args.key?(:item_id)\n end",
"def updateItem(app, repo_url, item, id)\n headers = defaultHeaders(app[\"token\"])\n data = id.merge(item).to_json\n response = HTTParty.post(repo_url,\n headers: headers,\n ... | [
"0.7889149",
"0.7648435",
"0.76377106",
"0.7521647",
"0.7423808",
"0.74166626",
"0.73778534",
"0.72335374",
"0.72306925",
"0.7222595",
"0.7208775",
"0.7126178",
"0.7126178",
"0.7126178",
"0.7126178",
"0.7126178",
"0.7117312",
"0.7109247",
"0.7090909",
"0.70758295",
"0.7048842... | 0.0 | -1 |
delete form for item with id | def delete
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n item = FormTemplate.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end",
"def delete\n \t@item = Item.find(params[:id])\n \t@item.destroy\n \tredirect_to :action => 'index'\n\tend",
"def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end",
"def delete... | [
"0.7946836",
"0.7658678",
"0.748391",
"0.73598224",
"0.7292523",
"0.7240384",
"0.7220972",
"0.71934545",
"0.71680033",
"0.71627825",
"0.7161773",
"0.7088923",
"0.7001405",
"0.6976906",
"0.69163734",
"0.69108075",
"0.69066054",
"0.69016564",
"0.6895776",
"0.6891475",
"0.687202... | 0.6633145 | 67 |
Define a method that takes an array of numbers to decode. | def decode(numbers)
text=""
#Process each number in the array.
number.each do |numebr|
#Get the letterr that corresponds to this number.
letter=KEY[number]
#Add it onto the string.
text = letter
end
#return the decoded string.
return text
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def array_converter(*args)\n \nend",
"def array_converter *arrays\n arrays.flatten.map(&:to_i)\nend",
"def big_numbers(array_of_integers)\n # TODO\nend",
"def array_translate(array)\n # Write your code here\nend",
"def decode(numbers)\n\ttext=\"\"\n\t#Process each number in the array.\n\tnumber.e... | [
"0.6612235",
"0.6351284",
"0.6286689",
"0.62110806",
"0.60716206",
"0.60606647",
"0.6001693",
"0.5961808",
"0.58080745",
"0.58080745",
"0.58029515",
"0.5798569",
"0.5793096",
"0.5772458",
"0.57224214",
"0.56950444",
"0.5639746",
"0.562679",
"0.5607272",
"0.5599854",
"0.559111... | 0.5961048 | 8 |
switch branch and analyse files but don't generate a report | def analyse_branch(branch)
::RubyCritic::SourceControlSystem::Git.switch_branch(::RubyCritic::Config.send(branch))
critic = critique(branch)
::RubyCritic::Config.send(:"#{branch}_score=", critic.skunk_score_average)
::RubyCritic::Config.root = branch_directory(branch)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def analyse_branch(branch)\n SourceControlSystem::Git.switch_branch(Config.send(branch))\n critic = critique(branch)\n Config.send(:\"#{branch}_score=\", critic.score)\n Config.root = branch_directory(branch)\n report(critic)\n end",
"def analyse_modified_files\n mo... | [
"0.6858513",
"0.6340784",
"0.6290224",
"0.62378716",
"0.61708844",
"0.59453714",
"0.5918464",
"0.58573073",
"0.56982404",
"0.5605016",
"0.5584618",
"0.55570775",
"0.5522293",
"0.5457347",
"0.54513234",
"0.54116976",
"0.5379238",
"0.5377319",
"0.5358627",
"0.5341621",
"0.53342... | 0.6440564 | 1 |
generate report only for modified files but don't report it | def analyse_modified_files
modified_files = ::RubyCritic::Config
.feature_branch_collection
.where(::RubyCritic::SourceControlSystem::Git.modified_files)
::RubyCritic::AnalysedModulesCollection.new(modified_files.map(&:path),
modified_files)
::RubyCritic::Config.root = "#{::RubyCritic::Config.root}/compare"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_report(report)\n file_names = @dangerfile.git.modified_files.map { |file| File.expand_path(file) }\n file_names += @dangerfile.git.added_files.map { |file| File.expand_path(file) }\n report.targets.each do |target|\n target.files = target.files.select { |file| file_names.include?(... | [
"0.6789516",
"0.67345214",
"0.67165816",
"0.6572688",
"0.64650106",
"0.63750523",
"0.63750523",
"0.63750523",
"0.63750523",
"0.63750523",
"0.63564837",
"0.61883193",
"0.61157846",
"0.6074965",
"0.60370195",
"0.59642684",
"0.5953283",
"0.59515744",
"0.59206593",
"0.58834106",
... | 0.5610471 | 48 |
create a txt file with the branch score details | def build_details
details = CompareScore.new(
::RubyCritic::Config.base_branch,
::RubyCritic::Config.feature_branch,
::RubyCritic::Config.base_branch_score.to_f.round(2),
::RubyCritic::Config.feature_branch_score.to_f.round(2)
).message
Skunk::Command::Output.create_directory(::RubyCritic::Config.compare_root_directory)
File.open(build_details_path, "w") { |file| file.write(details) }
puts details
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_details\n details = \"Base branch (#{Config.base_branch}) score: #{Config.base_branch_score} \\n\" \\\n \"Feature branch (#{Config.feature_branch}) score: #{Config.feature_branch_score} \\n\"\n File.write(\"#{Config.compare_root_directory}/build_details.txt\", details)\n ... | [
"0.66549057",
"0.6184458",
"0.5960179",
"0.59488297",
"0.5884136",
"0.5859844",
"0.57822686",
"0.57804453",
"0.577127",
"0.5730676",
"0.5702842",
"0.5701316",
"0.5691053",
"0.5687971",
"0.5667687",
"0.56672186",
"0.5570938",
"0.54694796",
"0.544543",
"0.54195064",
"0.5365438"... | 0.6531467 | 1 |
GET /annual_stats/1 GET /annual_stats/1.json | def show
@annual_stat = AnnualStat.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @annual_stat }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stats\n year = Analytic.where(\"created_at > ?\", Time.now - 1.year)\n @stats = time_data year\n\n respond_to do |format|\n format.html # stats.html.erb\n format.json { render json: time_data(year, :hash), callback: params[:callback] }\n format.xml { render xml: time_data(year, :hash) }... | [
"0.68336046",
"0.6559413",
"0.6520204",
"0.6520204",
"0.6310124",
"0.61959505",
"0.61959505",
"0.61959505",
"0.61919653",
"0.6190661",
"0.6183318",
"0.6153456",
"0.611887",
"0.6115231",
"0.61109084",
"0.60995656",
"0.6082629",
"0.6082629",
"0.6082629",
"0.60731006",
"0.600624... | 0.7406226 | 0 |
GET /annual_stats/new GET /annual_stats/new.json | def new
@annual_stat = AnnualStat.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @annual_stat }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @annual_stat = AnnualStat.new(params[:annual_stat])\n\n respond_to do |format|\n if @annual_stat.save\n format.html { redirect_to @annual_stat, notice: 'Annual stat was successfully created.' }\n format.json { render json: @annual_stat, status: :created, location: @annual_stat... | [
"0.74197155",
"0.6982337",
"0.69354516",
"0.6799926",
"0.66047174",
"0.6575936",
"0.6566205",
"0.6555019",
"0.6494437",
"0.6463658",
"0.64612144",
"0.6456276",
"0.6445223",
"0.64222556",
"0.64189214",
"0.6404114",
"0.64025694",
"0.6394406",
"0.6366076",
"0.6366076",
"0.636136... | 0.81392425 | 0 |
POST /annual_stats POST /annual_stats.json | def create
@annual_stat = AnnualStat.new(params[:annual_stat])
respond_to do |format|
if @annual_stat.save
format.html { redirect_to @annual_stat, notice: 'Annual stat was successfully created.' }
format.json { render json: @annual_stat, status: :created, location: @annual_stat }
else
format.html { render action: "new" }
format.json { render json: @annual_stat.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @annual_stat = AnnualStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @annual_stat }\n end\n end",
"def stats\n year = Analytic.where(\"created_at > ?\", Time.now - 1.year)\n @stats = time_data year\n\n respond_to do |format|\n ... | [
"0.6412291",
"0.6080995",
"0.5751651",
"0.571411",
"0.5713159",
"0.55085003",
"0.55029595",
"0.549151",
"0.54801464",
"0.5475444",
"0.54004365",
"0.5398121",
"0.5392149",
"0.5371514",
"0.53642845",
"0.53634644",
"0.53445446",
"0.53417933",
"0.5313136",
"0.5306713",
"0.5304616... | 0.68931323 | 0 |
PUT /annual_stats/1 PUT /annual_stats/1.json | def update
@annual_stat = AnnualStat.find(params[:id])
respond_to do |format|
if @annual_stat.update_attributes(params[:annual_stat])
format.html { redirect_to @annual_stat, notice: 'Annual stat was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @annual_stat.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @annual_stat = AnnualStat.new(params[:annual_stat])\n\n respond_to do |format|\n if @annual_stat.save\n format.html { redirect_to @annual_stat, notice: 'Annual stat was successfully created.' }\n format.json { render json: @annual_stat, status: :created, location: @annual_stat... | [
"0.64163136",
"0.60165685",
"0.6006525",
"0.5912252",
"0.58924615",
"0.5859861",
"0.5665983",
"0.55691385",
"0.5566539",
"0.5548227",
"0.5548227",
"0.5548227",
"0.5548227",
"0.5548227",
"0.5548227",
"0.5548227",
"0.5548227",
"0.5548227",
"0.5548227",
"0.5548227",
"0.5548227",... | 0.7016287 | 0 |
DELETE /annual_stats/1 DELETE /annual_stats/1.json | def destroy
@annual_stat = AnnualStat.find(params[:id])
@annual_stat.destroy
respond_to do |format|
format.html { redirect_to annual_stats_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @annual_summary_report.destroy\n respond_to do |format|\n format.html { redirect_to annual_summary_reports_url}\n format.json { head :no_content }\n end\n end",
"def destroy\n @statistic.destroy\n respond_to do |format|\n format.html { redirect_to statistics_url }\n ... | [
"0.7133116",
"0.7003411",
"0.6990844",
"0.69713765",
"0.69601184",
"0.6946585",
"0.68603617",
"0.68603617",
"0.68603617",
"0.68603617",
"0.68603617",
"0.68403894",
"0.6816427",
"0.68142116",
"0.680704",
"0.6801024",
"0.6745629",
"0.6728449",
"0.6728449",
"0.671704",
"0.670533... | 0.78986704 | 0 |
Get Basic Maximum HP | def base_maxhp
return $data_enemies[@enemy_id].maxhp
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def native_maxhp\n actor.parameters[0, @level] + @maxhp_plus\n end",
"def base_maxhp\n return enemy.maxhp\n end",
"def get_max()\n end",
"def base_maxhp\n return $data_actors[@actor_id].parameters[0, @level]\n end",
"def max_health(level)\n (self.health + self.health*0.1*(level-1)).to_i... | [
"0.76376176",
"0.7554158",
"0.71854436",
"0.71716774",
"0.715582",
"0.71488655",
"0.712599",
"0.7070318",
"0.7061318",
"0.70431805",
"0.69652545",
"0.6864245",
"0.6864245",
"0.68532014",
"0.68532014",
"0.68424535",
"0.68261623",
"0.6813145",
"0.67982703",
"0.67982703",
"0.679... | 0.7742643 | 0 |
Get Basic Maximum SP | def base_maxsp
return $data_enemies[@enemy_id].maxsp
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_max()\n end",
"def get_max\n @max\n end",
"def get_max\n\t\t@max.last\n\tend",
"def find_max()\r\n self.max\r\n end",
"def max; end",
"def max; end",
"def max\n end",
"def max\n end",
"def get_max\n @max ||= calculate_max\n end",
"def native_maxmp\n actor.parameters[1,... | [
"0.7391935",
"0.7022868",
"0.692642",
"0.6921298",
"0.6856911",
"0.6856911",
"0.6841548",
"0.6841548",
"0.68155545",
"0.67843753",
"0.6680802",
"0.6595834",
"0.6593663",
"0.6593663",
"0.6588043",
"0.65590185",
"0.6550869",
"0.65334505",
"0.6501078",
"0.6455348",
"0.6441624",
... | 0.6605195 | 11 |
Get Basic Attack Power | def base_atk
return $data_enemies[@enemy_id].atk
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attack(weapon)\n rand(10) + weapon.power\n end",
"def power\r\n return @access >> 26\r\n end",
"def attack()\r\n\t\tweaponPower = @weapon.offensiveWeapon()\r\n\t\tif(@weapon.name == \"Shield\")\r\n\t\t\treturn (weaponPower*@strength)/2\r\n\t\telse\r\n\t\t\treturn weaponPower*@strength\r\n\... | [
"0.6830873",
"0.6760588",
"0.6638149",
"0.65903914",
"0.65889585",
"0.658519",
"0.6570022",
"0.6500188",
"0.6475727",
"0.63986063",
"0.6379584",
"0.6276981",
"0.62667686",
"0.6152722",
"0.6143754",
"0.60736907",
"0.6061249",
"0.6038086",
"0.5998981",
"0.5992804",
"0.5988758",... | 0.5432099 | 95 |
Get Basic Physical Defense | def base_pdef
return $data_enemies[@enemy_id].pdef
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def defense\n total_for(:defense)\n end",
"def health_benefit; end",
"def debt_service\n property.net_operating_income / debt_payment\n end",
"def energy\n combatant.maximum_energy\n end",
"def index\n @defenses = Defense.all\n end",
"def spirit_defense\n defense_bonus = calc... | [
"0.68368655",
"0.58271605",
"0.5782619",
"0.577957",
"0.57764125",
"0.57440114",
"0.5712988",
"0.5701252",
"0.56680584",
"0.5645118",
"0.5618615",
"0.5602101",
"0.55541784",
"0.5541827",
"0.55349445",
"0.55349445",
"0.5511633",
"0.5494517",
"0.5491395",
"0.54898715",
"0.54889... | 0.0 | -1 |
Get Basic Magic Defense | def base_mdef
return $data_enemies[@enemy_id].mdef
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def defense\n total_for(:defense)\n end",
"def damage\n @damage ||= [(@power * (rand + 0.5)).to_i - @defender.toughness, 0].max\n end",
"def determine_damage\n if Random.rand(100) < critical_rate\n [fighter_attack * 2, FightEvent.attack_types['critical']]\n else\n [fighter_attack, Fight... | [
"0.6607412",
"0.646403",
"0.61876935",
"0.6056294",
"0.6036127",
"0.60202295",
"0.59829354",
"0.59801114",
"0.59793764",
"0.59688365",
"0.59545213",
"0.59366345",
"0.5889759",
"0.585976",
"0.5837217",
"0.58178914",
"0.58089256",
"0.57922685",
"0.57807595",
"0.57787603",
"0.57... | 0.5903551 | 12 |
Get Offensive Animation ID for Normal Attack | def animation1_id
return $data_enemies[@enemy_id].animation1_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def animation2_id\n return $data_enemies[@enemy_id].animation2_id\n end",
"def guts_animation_id\n if actor?\n self.actor.guts_animation\n else\n self.enemy.guts_animation\n end\n end",
"def animation1_id\n weapon = $data_weapons[@weapon_id]\n return weapon != nil ? weapon.animati... | [
"0.67899776",
"0.6719664",
"0.6514705",
"0.6408649",
"0.63255686",
"0.62214696",
"0.58524704",
"0.5769819",
"0.5769819",
"0.5717222",
"0.5694719",
"0.5657924",
"0.55908847",
"0.55396813",
"0.54710406",
"0.5469847",
"0.5444189",
"0.54081756",
"0.5368112",
"0.5365609",
"0.53626... | 0.70069283 | 0 |
Get Target Animation ID for Normal Attack | def animation2_id
return $data_enemies[@enemy_id].animation2_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guts_animation_id\n if actor?\n self.actor.guts_animation\n else\n self.enemy.guts_animation\n end\n end",
"def animation1_id\n return $data_enemies[@enemy_id].animation1_id\n end",
"def animation2_id\n weapon = $data_weapons[@weapon_id]\n return weapon != nil ? weapon.animati... | [
"0.71540296",
"0.7092229",
"0.66598105",
"0.6569974",
"0.638796",
"0.6171132",
"0.6171132",
"0.60529",
"0.59769475",
"0.5975825",
"0.5963273",
"0.5962016",
"0.58832335",
"0.58551866",
"0.5752369",
"0.57268",
"0.57173055",
"0.57128686",
"0.5712556",
"0.5701703",
"0.5670574",
... | 0.70878696 | 2 |
Get Element Revision Value element_id : Element ID | def element_rate(element_id)
# Get a numerical value corresponding to element effectiveness
table = [0,200,150,100,50,0,-100]
result = table[$data_enemies[@enemy_id].element_ranks[element_id]]
# If protected by state, this element is reduced by half
for i in @states
if $data_states[i].guard_element_set.include?(element_id)
result /= 2
end
end
# End Method
return result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_element id\n @elements[id.to_s]\n end",
"def get_id_value(artifact)\n return get_value(artifact,'id')\n end",
"def find_element_value(element, element_link, client)\n element_id = element.match(/\\?id=(\\d+)/)[1]\n\n result = client.get(element_link + \"/?id=#{element_id}\")\n items ... | [
"0.656496",
"0.61983466",
"0.61142164",
"0.60722023",
"0.6054667",
"0.6005347",
"0.59672004",
"0.5952023",
"0.5885529",
"0.5864256",
"0.5864256",
"0.58621734",
"0.58574593",
"0.58573073",
"0.58174133",
"0.5810459",
"0.5810206",
"0.57250726",
"0.56753963",
"0.5659955",
"0.5658... | 0.0 | -1 |
Determine State Guard state_id : state ID | def state_guard?(state_id)
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lookup_state_id(state)\n state_id = @db.get_first_value(\"SELECT id FROM states WHERE name = ?\", state)\n end",
"def death_state_id\r\n return 1\r\n end",
"def game_state(game_id)\n\n end",
"def state_code\n end",
"def state_code\n decode hash[\"StateCode\"]\n end",
"... | [
"0.7849504",
"0.6632471",
"0.64412904",
"0.640836",
"0.6396621",
"0.6348174",
"0.63222885",
"0.62957054",
"0.627274",
"0.627274",
"0.62004566",
"0.61774004",
"0.6148109",
"0.6119831",
"0.60879743",
"0.607843",
"0.6037444",
"0.6032292",
"0.6031005",
"0.6025869",
"0.6025869",
... | 0.64654136 | 2 |
Get Normal Attack Element | def element_set
return []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_attack_type\n read_attribute(:attack_type)\n end",
"def base_atk\n return $data_enemies[@enemy_id].atk\n end",
"def attack_technique\n return @attack_technique\n end",
"def attack()\n return @level + rand(3) - rand(3)\n end",
"def attack_effect_element_corr... | [
"0.58822644",
"0.58294135",
"0.57241774",
"0.5642711",
"0.5609767",
"0.552643",
"0.5501813",
"0.5488388",
"0.54811716",
"0.5403287",
"0.5357837",
"0.5307423",
"0.5301397",
"0.5301033",
"0.5296499",
"0.5272384",
"0.52501",
"0.52329457",
"0.52329457",
"0.52329457",
"0.51411474"... | 0.0 | -1 |
Get Normal Attack State Change (+) | def plus_state_set
return []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attack() stat(:attack) end",
"def enchant_state\n @enchant_state || 0\n end",
"def state\n %w{ OFF ON }[params.valve.cmd]\n end",
"def atk_action_lmt\n return 0 if (b=battler).nil?\n b.attack_action_lmt + atk_lmt_equip_mod\n end",
"def attack()\n return @level + rand(3) - rand(3)\n ... | [
"0.62039334",
"0.58742183",
"0.58089054",
"0.5777745",
"0.5752088",
"0.5639592",
"0.5619665",
"0.55982804",
"0.55982804",
"0.55982804",
"0.55982804",
"0.5597745",
"0.5581484",
"0.55691665",
"0.5560482",
"0.5510243",
"0.54844344",
"0.54844344",
"0.54844344",
"0.54844344",
"0.5... | 0.0 | -1 |
Get Normal Attack State Change () | def minus_state_set
return []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state\n %w{ OFF ON }[params.valve.cmd]\n end",
"def attack() stat(:attack) end",
"def enchant_state\n @enchant_state || 0\n end",
"def game_state\n end",
"def effect\n state[\"effect\"]\n end",
"def state()\n info[:state]\n end",
"def get_state\n return self.state ... | [
"0.63034433",
"0.6169834",
"0.60711944",
"0.60252196",
"0.597853",
"0.58895814",
"0.5889273",
"0.5857061",
"0.5849086",
"0.5831561",
"0.5813013",
"0.5807783",
"0.58055896",
"0.5798912",
"0.57924336",
"0.57880706",
"0.5760274",
"0.57503545",
"0.5744004",
"0.5728909",
"0.572890... | 0.0 | -1 |
Get Treasure Appearance Probability | def treasure_prob
return $data_enemies[@enemy_id].treasure_prob
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def probability_of(gram)\n @probabilities.fetch(gram,0.0)\n end",
"def probability\n return @probability\n end",
"def treasure_chance\n chance = roll.d100(1)\n if chance <= 100\n @treasure = Treasure.new\n end\n en... | [
"0.62220675",
"0.61453027",
"0.6124372",
"0.6124372",
"0.6124372",
"0.5926937",
"0.5863328",
"0.57658106",
"0.5760216",
"0.5716946",
"0.57058793",
"0.5696544",
"0.5696544",
"0.5696544",
"0.5696544",
"0.5696544",
"0.5689877",
"0.56704265",
"0.56629556",
"0.56629556",
"0.566295... | 0.6691672 | 0 |
Get Battle Screen XCoordinate | def screen_x
return $data_troops[@troop_id].members[@member_index].x
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def screen_x\n x = (@real_x - $game_map.display_x + 3) / 4\n return x\n end",
"def screen_x\n x = ((@real_x - $game_map.display_x + 3) / 4)+16\n return x\n end",
"def screen_x\n x = ((@real_x - $game_map.display_x + 3) / 4)\n return x\n end",
"def screen_x\n x = ((@real_x - $game_map.... | [
"0.8323634",
"0.83181906",
"0.8305357",
"0.8305357",
"0.82942414",
"0.82109123",
"0.8105615",
"0.79681283",
"0.79443485",
"0.7889534",
"0.7880283",
"0.78567576",
"0.77439415",
"0.77439415",
"0.7677418",
"0.76581293",
"0.7608564",
"0.7549986",
"0.74187505",
"0.7382043",
"0.732... | 0.7387054 | 19 |
Get Battle Screen YCoordinate | def screen_y
return $data_troops[@troop_id].members[@member_index].y
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def screen_y\n if $game_temp.enemies_position[self.index] != nil\n return $game_temp.enemies_position[self.index][1]\n else\n return $data_troops[@troop_id].members[@member_index].y + Enemy_Position_AdjustY\n end\n end",
"def screen_y\n y = ((@real_y - $game_map.display_y + 3) / 4 )+16\n ... | [
"0.83931154",
"0.82202584",
"0.82057524",
"0.82018405",
"0.8183105",
"0.8183105",
"0.81134117",
"0.81102467",
"0.7992247",
"0.79247093",
"0.7857582",
"0.7773692",
"0.7727843",
"0.7720623",
"0.7720623",
"0.75123763",
"0.73991954",
"0.73714626",
"0.7342428",
"0.7326338",
"0.731... | 0.67448044 | 40 |
Get Battle Screen ZCoordinate | def screen_z
return screen_y
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def screen_z_formula\n @shadow_point.screen_y + additional_z\n # Real Y position (without jumping) + Additional Z value\n end",
"def screen_z\n # Return after calculating z-coordinate by order of members in party\n if self.index != nil\n return 4 - self.index\n else\n return 0\n end\... | [
"0.7683055",
"0.74454165",
"0.73411655",
"0.72503805",
"0.67651194",
"0.673346",
"0.6542432",
"0.6516978",
"0.6471383",
"0.6471383",
"0.6430626",
"0.6427607",
"0.635854",
"0.6350543",
"0.6310139",
"0.6191794",
"0.61596256",
"0.6146512",
"0.6139527",
"0.6112791",
"0.6109598",
... | 0.78315145 | 0 |
Transform enemy_id : ID of enemy to be transformed | def transform(enemy_id)
# Change enemy ID
@enemy_id = enemy_id
# Change battler graphics
@battler_name = $data_enemies[@enemy_id].battler_name
@battler_hue = $data_enemies[@enemy_id].battler_hue
# Remake action
make_action
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enemy_transform(id, enemy_id)\n # transform all existing target enemies\n get_enemies(id).each {|e| e.transform(enemy_id) if e.battler != nil}\n end",
"def transform(enemy_id)\n @enemy_id = enemy_id\n if enemy.name != @original_name\n @original_name = enemy.name\n @letter = ''\n ... | [
"0.8681446",
"0.8347071",
"0.6537319",
"0.6492783",
"0.62289906",
"0.62289906",
"0.62289906",
"0.62289906",
"0.6148942",
"0.5935039",
"0.5921082",
"0.58776826",
"0.5876523",
"0.5867912",
"0.5804627",
"0.56983477",
"0.5696815",
"0.56664443",
"0.5656304",
"0.5655269",
"0.564820... | 0.83570755 | 1 |
returns a post's top comments comments that have a null value for their original_comment_id field which are basically non replies | def top_comments(limit: 25, offset: nil)
if offset
self.comments.where('original_comment_id IS NULL AND created_at < ?', offset).includes(:user).order(created_at: :desc).limit(limit)
else
self.comments.where('original_comment_id IS NULL').order(created_at: :desc).limit(limit)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_replies_only\n self.comments.includes(:user).where.not(parent_comment_id: nil)\n end",
"def get_comments_only\n self.comments.includes(:comments, :user).where(parent_comment_id: nil)\n end",
"def root_comments\n comment_threads.where(parent_id: nil)\n end",
"def root_comments\n self.co... | [
"0.7083998",
"0.69617987",
"0.6537448",
"0.65136963",
"0.63940346",
"0.6154849",
"0.6004395",
"0.59519917",
"0.59519917",
"0.5909502",
"0.5863065",
"0.58495814",
"0.5751307",
"0.5668353",
"0.5660836",
"0.5652821",
"0.5640756",
"0.5639069",
"0.5610734",
"0.55984485",
"0.557941... | 0.6041926 | 6 |
returns module name (excluding of the class name) if class separator does not exists (the "::" chars), then returns the whole class name | def module_name
(i = name.index("::")) ? name[0..i-1] : name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name\n has_module?(klass) ? klass[(klass.index(\"::\")+2)..-1] : klass\n end",
"def class_name\n self.fullname[/\\A(.*)([\\.\\#])([^\\.\\#]+)\\z/, 1]\n end",
"def stripped_class_name\n name.demodulize\n end",
"def full_class_name\n @class_names.join(\"::\")\n end",
"def demo... | [
"0.74564034",
"0.73315907",
"0.7323999",
"0.7298603",
"0.7240414",
"0.7237407",
"0.72202593",
"0.72202593",
"0.7141534",
"0.7061097",
"0.6980629",
"0.6968053",
"0.68946797",
"0.68878263",
"0.6791536",
"0.67899466",
"0.67424816",
"0.669735",
"0.66891795",
"0.6639782",
"0.66223... | 0.7093605 | 9 |
returns class name (excluding of the module name) | def klass
name.gsub(module_name+"::","")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name\n has_module?(klass) ? klass[(klass.index(\"::\")+2)..-1] : klass\n end",
"def class_name\n self.class.name.split(\"::\").last\n end",
"def class_name\n self.class.to_s.split('::').last\n end",
"def class_name\n @class_name ||= derive_class_name\n end",
"def full_cl... | [
"0.8495667",
"0.8278967",
"0.8268621",
"0.82210344",
"0.8149919",
"0.81280494",
"0.81177163",
"0.8095978",
"0.8012728",
"0.8009404",
"0.79887307",
"0.7982183",
"0.79712105",
"0.7860397",
"0.7844973",
"0.7768526",
"0.77098256",
"0.765258",
"0.76458025",
"0.7616889",
"0.7607969... | 0.84605306 | 1 |
Never trust parameters from the scary internet, only allow the white list through. | def user_params
params.require(:user).permit(:name, :email, :password, :password_confirmation)
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.6980244",
"0.6782812",
"0.6745103",
"0.6741142",
"0.6733961",
"0.65925",
"0.6503602",
"0.64967257",
"0.64822173",
"0.64796996",
"0.6456357",
"0.6439594",
"0.63803256",
"0.6376499",
"0.63644457",
"0.6319286",
"0.6299465",
"0.6298051",
"0.62935406",
"0.62923044",
"0.6291212"... | 0.0 | -1 |
Simulate session and flash | def initialize
@session = {}
@flash = {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def session; end",
"def session; end",
"def session; end",
"def session; end",
"def set_session\n \n end",
"def open_session; end",
"def session\n end",
"def visit_with_session\n open_session do |sess|\n sess.host = 'test.host'\n sess.extend Mephisto::Integration::Actor\n ... | [
"0.66984636",
"0.66984636",
"0.66984636",
"0.66984636",
"0.6666893",
"0.662433",
"0.6540685",
"0.6486215",
"0.6432023",
"0.64095694",
"0.6325118",
"0.62630886",
"0.62329686",
"0.62283325",
"0.6208615",
"0.61730266",
"0.61625344",
"0.61491346",
"0.612727",
"0.61023045",
"0.608... | 0.57149327 | 52 |
GET /big_cms/content_managers GET /big_cms/content_managers.xml | def index
@content_managers = BigCms::ContentManager.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @content_managers }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @content_manager = BigCms::ContentManager.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @content_manager }\n end\n end",
"def managers\n response = request(:get, \"/manager\")\n response_to_array(response, \"managers\", KontaktI... | [
"0.68650776",
"0.6823028",
"0.6757392",
"0.639434",
"0.6204576",
"0.6174171",
"0.60852104",
"0.6065295",
"0.5936707",
"0.59264326",
"0.5883746",
"0.58570325",
"0.5766593",
"0.5759765",
"0.5727774",
"0.5715897",
"0.5707141",
"0.5691301",
"0.567363",
"0.56650114",
"0.56647396",... | 0.7847918 | 0 |
GET /big_cms/content_managers/1 GET /big_cms/content_managers/1.xml | def show
if params[:id].eql?("current")
@content_manager = current_cms
else
@content_manager = BigCms::ContentManager.find(params[:id])
end
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @content_manager }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @content_managers = BigCms::ContentManager.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @content_managers }\n end\n end",
"def new\n @content_manager = BigCms::ContentManager.new\n\n respond_to do |format|\n format.html # ... | [
"0.7724881",
"0.7053656",
"0.6520927",
"0.6326201",
"0.6195747",
"0.615247",
"0.60036147",
"0.58629835",
"0.5858243",
"0.58332896",
"0.5808916",
"0.5804914",
"0.5789202",
"0.5782512",
"0.57582575",
"0.57240885",
"0.57100374",
"0.5670824",
"0.56676745",
"0.56296533",
"0.562263... | 0.6925274 | 2 |
GET /big_cms/content_managers/new GET /big_cms/content_managers/new.xml | def new
@content_manager = BigCms::ContentManager.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @content_manager }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @content_manager = BigCms::ContentManager.new(params[:big_cms_content_manager])\n\n respond_to do |format|\n if @content_manager.save\n format.html { redirect_to(@content_manager, :notice => 'Content manager was successfully created.') }\n format.xml { render :xml => @content... | [
"0.75305504",
"0.69313014",
"0.68928635",
"0.67099935",
"0.6665153",
"0.6665153",
"0.6665153",
"0.6665153",
"0.6664625",
"0.6649265",
"0.66203326",
"0.6599939",
"0.6555704",
"0.6548849",
"0.65248376",
"0.6524162",
"0.6441471",
"0.63627505",
"0.63455474",
"0.63414264",
"0.6339... | 0.7997405 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.