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 |
|---|---|---|---|---|---|---|
Builds a RDoc::Markup::Document from +found+, +klasses+ and +includes+ | def method_document name, filtered
out = RDoc::Markup::Document.new
out << RDoc::Markup::Heading.new(1, name)
out << RDoc::Markup::BlankLine.new
filtered.each do |store, methods|
methods.each do |method|
render_method out, store, method, name
end
end
out
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_document name, found, klasses, includes, extends\n also_in = []\n\n out = RDoc::Markup::Document.new\n\n add_class out, name, klasses\n\n add_includes out, includes\n add_extends out, extends\n\n found.each do |store, klass|\n render_class out, store, klass, also_in\n end\n\n ... | [
"0.79521734",
"0.59954107",
"0.5738297",
"0.5727153",
"0.56440693",
"0.56292874",
"0.5587088",
"0.5587088",
"0.55202097",
"0.55009127",
"0.5493279",
"0.5441404",
"0.5434213",
"0.53858423",
"0.53391504",
"0.53088856",
"0.52988243",
"0.52877796",
"0.52877796",
"0.5269917",
"0.5... | 0.5128378 | 32 |
Returns the type of method (:both, :instance, :class) for +selector+ | def method_type selector
case selector
when '.', nil then :both
when '#' then :instance
else :class
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type\n (@type || :invoke).to_sym\n end",
"def define_selectors_(type, name, selector)\n define_method(\"#{name}_#{type}_selector\") do |text = nil|\n text ? extend_selector(selector, :text, text) : selector\n end\n\n define_method(\"#{name}_selector\") do |text = nil|\n text ? exte... | [
"0.60247016",
"0.58388776",
"0.58268964",
"0.5739441",
"0.569685",
"0.5551258",
"0.5488362",
"0.5488362",
"0.5477114",
"0.54584444",
"0.5436222",
"0.540309",
"0.5322395",
"0.52816445",
"0.52693814",
"0.5256626",
"0.52441674",
"0.5215844",
"0.5210975",
"0.52055407",
"0.5197708... | 0.83274966 | 1 |
Returns a regular expression for +name+ that will match an RDoc::AnyMethod's name. | def name_regexp name
klass, type, name = parse_name name
case type
when '#', '::' then
/^#{klass}#{type}#{Regexp.escape name}$/
else
/^#{klass}(#|::)#{Regexp.escape name}$/
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_regex\n Regexp.new method_pattern, 'i'\n end",
"def match(re)\n @method_name.match(re)\n end",
"def name_regexp name\n klass, type, name = parse_name name\n case type\n when '#', '::' then\n /^#{klass}#{type}#{Regexp.escape name}$/\n else\n /^#{klass}(#|::)#{Regexp.... | [
"0.6383781",
"0.62254286",
"0.61365783",
"0.591806",
"0.58785594",
"0.5816269",
"0.5808404",
"0.57587504",
"0.5680152",
"0.5589226",
"0.5589226",
"0.55882275",
"0.5566614",
"0.5478753",
"0.54530317",
"0.5425889",
"0.5389151",
"0.5389151",
"0.53677535",
"0.5362484",
"0.5348283... | 0.61325014 | 3 |
Paginates output through a pager program. | def page
if pager = setup_pager then
begin
yield pager
ensure
pager.close
@jruby_pager_process.wait_for if @jruby_pager_process
end
else
yield $stdout
end
rescue Errno::EPIPE
ensure
@paging = false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pager; end",
"def pager=(_arg0); end",
"def spawn_pager\n # In case there's a previous pager running:\n close\n\n command = pager_command\n status = self.class.run_command(command)\n # Issue running command, e.g. unsupported flag, fallback to just command\n unless ... | [
"0.7637778",
"0.73274446",
"0.7043486",
"0.7034005",
"0.70323443",
"0.69764775",
"0.697505",
"0.6868551",
"0.68650556",
"0.6716472",
"0.6700343",
"0.6556751",
"0.6531326",
"0.6526382",
"0.6439522",
"0.6430098",
"0.6402554",
"0.63926744",
"0.62995696",
"0.6229582",
"0.6228836"... | 0.7048368 | 2 |
Are we using a pager? | def paging?
@paging
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pager; end",
"def pagination_enabled?(site); end",
"def pagination_candidate?(config, page); end",
"def paginated?\n @pages and @pages.length > 1\n end",
"def paginated?\n current_page && current_page > 0\n end",
"def paginated?\n\t\t\t!next_page_url.nil?||!prev_page_url.nil?\n\t\tend",
... | [
"0.7255431",
"0.72490907",
"0.72310674",
"0.7177632",
"0.70713574",
"0.7034799",
"0.7017524",
"0.69720405",
"0.69648224",
"0.6962507",
"0.6962507",
"0.6899561",
"0.6899055",
"0.68682534",
"0.68528587",
"0.68212855",
"0.6773088",
"0.67061675",
"0.6698825",
"0.66823965",
"0.667... | 0.7485864 | 0 |
Extracts the class, selector and method name parts from +name+ like Foo::Barbaz. NOTE: Given Foo::Bar, Bar is considered a class even though it may be a method | def parse_name name
parts = name.split(/(::?|#|\.)/)
if parts.length == 1 then
if parts.first =~ /^[a-z]|^([%&*+\/<>^`|~-]|\+@|-@|<<|<=>?|===?|=>|=~|>>|\[\]=?|~@)$/ then
type = '.'
meth = parts.pop
else
type = nil
meth = nil
end
elsif parts.length == 2 or p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_name(name)\n parts = name.split(/(::|\\#|\\.)/)\n\n if parts[-2] != '::' or parts.last !~ /^[A-Z]/ then\n meth = parts.pop\n parts.pop\n end\n\n klass = parts.join\n\n [klass, meth]\n end",
"def parse_name(name)\n parts = name.split(/(::|#|\\.)/)\n if parts.length == 1 t... | [
"0.8132324",
"0.7883221",
"0.711339",
"0.70700496",
"0.6583719",
"0.6561413",
"0.6533518",
"0.6490589",
"0.64730215",
"0.6375882",
"0.63380617",
"0.6323475",
"0.6317774",
"0.6281876",
"0.6236716",
"0.62290525",
"0.62290525",
"0.62223166",
"0.6218959",
"0.6218959",
"0.61924505... | 0.75598216 | 2 |
Renders the +klass+ from +store+ to +out+. If the klass has no documentable items the class is added to +also_in+ instead. | def render_class out, store, klass, also_in # :nodoc:
comment = klass.comment
# TODO the store's cache should always return an empty Array
class_methods = store.class_methods[klass.full_name] || []
instance_methods = store.instance_methods[klass.full_name] || []
attributes = store.attrib... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_document name, found, klasses, includes, extends\n also_in = []\n\n out = RDoc::Markup::Document.new\n\n add_class out, name, klasses\n\n add_includes out, includes\n add_extends out, extends\n\n found.each do |store, klass|\n render_class out, store, klass, also_in\n end\n\n ... | [
"0.6051684",
"0.53472936",
"0.5329515",
"0.53172195",
"0.5294755",
"0.5294755",
"0.5244572",
"0.5188154",
"0.5134126",
"0.5121529",
"0.5078156",
"0.5033045",
"0.49252838",
"0.49011505",
"0.48486787",
"0.4824074",
"0.48102942",
"0.48029447",
"0.47308943",
"0.4714089",
"0.47102... | 0.7838232 | 0 |
Looks up and displays ri data according to the options given. | def run
if @list_doc_dirs then
puts @doc_dirs
elsif @list then
list_known_classes @names
elsif @server then
start_server
elsif @interactive or @names.empty? then
interactive
else
display_names @names
end
rescue NotFoundError => e
abort e.message
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_values\n options.each do |option|\n update_ui option, read(option)\n end\n end",
"def show\n @item = Vger::Resources::Suitability::Item.find(params[:id])\n @options = Vger::Resources::Suitability::Option.where(\n query_options: {\n item_id: @item.id\n },\n ... | [
"0.61608523",
"0.5637462",
"0.5626179",
"0.55342525",
"0.54756224",
"0.5452051",
"0.5434392",
"0.54237837",
"0.53959996",
"0.5395368",
"0.53796077",
"0.5361609",
"0.53603804",
"0.53261876",
"0.5323889",
"0.5300965",
"0.5295826",
"0.5270473",
"0.52699304",
"0.52665573",
"0.525... | 0.0 | -1 |
Sets up a pager program to pass output through. Tries the RI_PAGER and PAGER environment variables followed by pager, less then more. | def setup_pager
return if @use_stdout
jruby = RUBY_ENGINE == 'jruby'
pagers = [ENV['RI_PAGER'], ENV['PAGER'], 'pager', 'less', 'more']
pagers.compact.uniq.each do |pager|
next unless pager
pager_cmd = pager.split(' ').first
next unless in_path? pager_cmd
if jruby then
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_pager\n return unless @pager\n return if Gem.win_platform?\n return unless STDOUT.tty?\n\n @color_scheme = ColorScheme::NONE unless get_pager == \"less\"\n\n read, write = IO.pipe\n\n unless Kernel.fork # Child process\n STDOUT.reopen(write)\n STDERR.reopen(write... | [
"0.7271583",
"0.7029197",
"0.67265505",
"0.657321",
"0.6461925",
"0.64541876",
"0.6435728",
"0.6416654",
"0.63340366",
"0.62883276",
"0.61692715",
"0.611928",
"0.5900842",
"0.58526874",
"0.5718977",
"0.56432134",
"0.5452617",
"0.54329735",
"0.5373012",
"0.531695",
"0.52556473... | 0.81442004 | 0 |
Starts a WEBrick server for ri. | def start_server
begin
require 'webrick'
rescue LoadError
abort "webrick is not found. You may need to `gem install webrick` to install webrick."
end
server = WEBrick::HTTPServer.new :Port => @server
extra_doc_dirs = @stores.map {|s| s.type == :extra ? s.path : nil}.compact
server... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start\n UI.info \"Starting up WEBrick...\"\n if running?\n UI.error \"Another instance of WEBrick::HTTPServer is running.\"\n false\n else\n @pid = Spoon.spawnp('ruby',\n File.expand_path(File.join(File.dirname(__FILE__), %w{webrick server.rb})),\n @options... | [
"0.71083075",
"0.6880159",
"0.66840184",
"0.6582155",
"0.65696543",
"0.63713944",
"0.6361535",
"0.6299764",
"0.6287934",
"0.6272598",
"0.62531424",
"0.6190533",
"0.6174737",
"0.6140634",
"0.61019397",
"0.61009306",
"0.6081432",
"0.60704195",
"0.6058185",
"0.60580075",
"0.6048... | 0.68763036 | 2 |
Create an ri task with the given name. See RDoc::Task for documentation on setting names. | def initialize name = DEFAULT_NAMES # :yield: self
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task name, options={}, &block\n task = Task.new name, options, &block\n TodoRunner.registry[name] = task\n end",
"def define_task\n desc @desc\n task @name do\n config.mode == 'shell' ? run_shell : run\n end\n end",
"def createTask(project, target)\n task \"... | [
"0.7332176",
"0.6591946",
"0.6511784",
"0.6511784",
"0.6474106",
"0.64664066",
"0.6444578",
"0.63524044",
"0.6322815",
"0.62916136",
"0.62829226",
"0.62478596",
"0.6187634",
"0.61141896",
"0.61103904",
"0.60960597",
"0.60618174",
"0.5990528",
"0.5979135",
"0.5979135",
"0.5951... | 0.0 | -1 |
Sets default task values | def defaults
super
@rdoc_dir = '.rdoc'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_task(name,task=nil) # Add a Task and its name\n @defaults['taskname']=name.to_s # taskname = task name\n if ! task.nil?\n @defaults['taskobj']=task # taskobj = the Task\n @defaults['env']=task.envars # env = the Task's env vars\n @defaults['seq']=task.seq # seq = Task'... | [
"0.707794",
"0.6714458",
"0.6627441",
"0.6597361",
"0.6597361",
"0.65888643",
"0.6561272",
"0.65471274",
"0.6491222",
"0.6491222",
"0.6491222",
"0.6491222",
"0.6491222",
"0.6491222",
"0.6490677",
"0.646767",
"0.6465677",
"0.64562196",
"0.64266276",
"0.6413825",
"0.6340562",
... | 0.0 | -1 |
Set up a new .pot generator | def initialize store, options #:not-new:
@options = options
@store = store
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init\n File.open(ELEVATOR_PITCH_GENERATOR_FILE, 'w') do |f|\n f.puts ELEVATOR_PITCH_GENERATOR_TEMPLATE\n end\n end",
"def barista_init(options)\n pot = Pot.new(\"cfg/#{options[:target]}.cfg\")\n pot.save\nend",
"def generator\n printf(\"%-10s %s\\n\",\"generator:\", \"generating.. (... | [
"0.6740822",
"0.6497283",
"0.63805914",
"0.5900392",
"0.58684",
"0.5860742",
"0.58596694",
"0.5779523",
"0.57422143",
"0.56368154",
"0.5617999",
"0.56032324",
"0.5516131",
"0.5513551",
"0.55117327",
"0.5508987",
"0.55073017",
"0.5436382",
"0.5434082",
"0.5409409",
"0.54061645... | 0.0 | -1 |
Writes .pot to disk. | def generate
po = extract_messages
pot_path = 'rdoc.pot'
File.open(pot_path, "w") do |pot|
pot.print(po.to_s)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write\n\n # output to disk\n File.open(@outfile, 'w:UTF-8') { |file|\n file.write(@buffer)\n }\n end",
"def write()\n f = File.open(\"#{@directory}/#{@filename}\", \"w\")\n f.write(@raw)\n f.close()\n end",
"def save!\n FileUtils.mkdir_p File.dirname(self.f... | [
"0.623705",
"0.62264544",
"0.6038956",
"0.591843",
"0.5896808",
"0.58286023",
"0.58241665",
"0.57869816",
"0.5741708",
"0.57203",
"0.5717516",
"0.57053286",
"0.5690309",
"0.5676091",
"0.5668746",
"0.566572",
"0.5663545",
"0.5650706",
"0.56394744",
"0.5638306",
"0.56363326",
... | 0.56166816 | 23 |
Creates a PO entry for +msgid+. Other valus can be specified by +options+. | def initialize msgid, options = {}
@msgid = msgid
@msgstr = options[:msgstr] || ""
@translator_comment = options[:translator_comment]
@extracted_comment = options[:extracted_comment]
@references = options[:references] || []
@flags = options[:flags] || []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_linked_po_and_comment!(options)\n warning_prefix = \"***** \"\n returner = {}\n returner[:output_string] = \"\"\n\n pac = options[:po_and_comment]\n returner[:po] = PurchaseOrder.new({ provider: self, \n description: pac[:description],\n id_in_purchasing_system: pac[:id_in_purch... | [
"0.58486027",
"0.53823483",
"0.532087",
"0.52994615",
"0.51696014",
"0.51422447",
"0.49498636",
"0.49390513",
"0.49112278",
"0.4894936",
"0.48846564",
"0.48589993",
"0.48024064",
"0.47908956",
"0.47820473",
"0.47596544",
"0.4756478",
"0.47220087",
"0.47201002",
"0.46619004",
... | 0.57863796 | 1 |
Returns the PO entry in PO format. | def to_s
entry = ''
entry += format_translator_comment
entry += format_extracted_comment
entry += format_references
entry += format_flags
entry += <<-ENTRY
msgid #{format_message(@msgid)}
msgstr #{format_message(@msgstr)}
ENTRY
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entry\n @entry.object\n end",
"def entry_to_str(entry)\n entry.to_s\n end",
"def obj\r\n Pronouns.get_pronoun_set(@object)[1]\r\n end",
"def get_entry(entry); end",
"def to_s\n output = \n 'AUTHOR: ' + self.author.author_name + \"\\n\" +\n 'TITLE: ' ... | [
"0.58416426",
"0.56309354",
"0.55441755",
"0.54956615",
"0.54705715",
"0.54537475",
"0.5445539",
"0.54213065",
"0.5350869",
"0.5349724",
"0.5311973",
"0.5269114",
"0.5268742",
"0.5253168",
"0.5230559",
"0.52169317",
"0.52114296",
"0.5201008",
"0.5191745",
"0.51812285",
"0.516... | 0.56084836 | 2 |
Merges the PO entry with +other_entry+. | def merge other_entry
options = {
:extracted_comment => merge_string(@extracted_comment,
other_entry.extracted_comment),
:translator_comment => merge_string(@translator_comment,
other_entry.translator_comment),
:r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge(other_entry)\n @references += other_entry.references\n self\n end",
"def merge_entries! other_feed\n other_feed.each do |entry|\n # TODO: add atom:source elements\n self << entry\n end\n end",
"def join(other)\n new(entries.merge(other.entries) { |_name,... | [
"0.7363173",
"0.6998462",
"0.6821565",
"0.67988646",
"0.6600336",
"0.65438855",
"0.6478018",
"0.6418038",
"0.6368744",
"0.63495076",
"0.62570286",
"0.62363315",
"0.615686",
"0.61341536",
"0.6132496",
"0.60752624",
"0.60542256",
"0.6049515",
"0.6027811",
"0.60135925",
"0.60076... | 0.7653342 | 0 |
Adds a PO entry to the PO. | def add entry
existing_entry = @entries[entry.msgid]
if existing_entry
entry = existing_entry.merge(entry)
end
@entries[entry.msgid] = entry
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_entry entry\n @data << entry\n end",
"def add(entry)\n @entries[entry.tag] = entry\n end",
"def add(entry)\n entries << entry\n end",
"def add(o); addObject o end",
"def manual_add_entry\n address_book.add_entry(enter_name, enter_phone, enter_email)\n end",
"def ad... | [
"0.67620295",
"0.6464502",
"0.64573437",
"0.63777924",
"0.6349393",
"0.63091016",
"0.629415",
"0.6185534",
"0.61505675",
"0.6086818",
"0.6078299",
"0.59744936",
"0.5924277",
"0.5916927",
"0.5886579",
"0.5886579",
"0.58709174",
"0.58706963",
"0.58691376",
"0.5855735",
"0.58076... | 0.7082914 | 0 |
Returns PO format text for the PO. | def to_s
po = ''
sort_entries.each do |entry|
po += "\n" unless po.empty?
po += entry.to_s
end
po
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_text\n \"#{__getobj__.to_text} (OPTIONAL)\"\n end",
"def proptext(name) #:nodoc:\n prop = @properties.detect { |f| f.name? name }\n if prop\n prop = prop.to_text\n end\n prop\n end",
"def text\n #[@organism, @symbol, @description, @aka, ... | [
"0.643801",
"0.6271663",
"0.6133026",
"0.6085035",
"0.6064915",
"0.60509807",
"0.6039465",
"0.5994156",
"0.5986541",
"0.5986541",
"0.5962673",
"0.595077",
"0.5946092",
"0.5940177",
"0.5838888",
"0.58326286",
"0.5815343",
"0.58049625",
"0.57767123",
"0.5764787",
"0.5755178",
... | 0.0 | -1 |
Extracts messages from +store+, stores them into RDoc::Generator::POT::PO and returns it. | def extract
@store.all_classes_and_modules.each do |klass|
extract_from_klass(klass)
end
@po
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse\n @parsed_values = {}\n @buffer = {}\n @last_key_type = \"\"\n @errors = []\n File.foreach(@path_to_po) do |line|\n line = line.chomp\n case line\n # Empty lines means we have parsed one full message\n # so far and need to flush the buffer\n when /^$/ then fl... | [
"0.6044387",
"0.54757804",
"0.5258534",
"0.51334786",
"0.5121153",
"0.498637",
"0.4929656",
"0.48418772",
"0.48215958",
"0.47831357",
"0.4725781",
"0.47053063",
"0.46959278",
"0.46381646",
"0.46307468",
"0.4595335",
"0.45557487",
"0.45468372",
"0.4530594",
"0.44919744",
"0.44... | 0.47628114 | 10 |
Initialize a few instance variables before we start | def initialize store, options
@store = store
@options = options
@asset_rel_path = ''
@base_dir = Pathname.pwd.expand_path
@dry_run = @options.dry_run
@file_output = true
@template_dir = Pathname.new options.template_dir
@template_cache = {}
@classes = nil
@c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pre_initialize; end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def pre_initialize\n end",
"def init\n end",
"def init\n end",
"def init\n end",
"def at_init\n\n\t\tend",
"def post_init\n end",
"def init\n\n end",
"def initialize_default_in... | [
"0.7631419",
"0.7596646",
"0.7596646",
"0.7596646",
"0.7596646",
"0.75651824",
"0.7514635",
"0.7514635",
"0.7514635",
"0.7482982",
"0.7465966",
"0.7417207",
"0.7304129",
"0.7265961",
"0.7265961",
"0.72491395",
"0.72286296",
"0.7205018",
"0.7160566",
"0.7138585",
"0.7096468",
... | 0.0 | -1 |
Output progress information if debugging is enabled | def debug_msg *msg
return unless $DEBUG_RDOC
$stderr.puts(*msg)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_progress\n @data[\"print_progress\"]\n end",
"def debug(message)\n @progress = Time.now.to_f\n buffer_checkpoint(\"debug: #{message}\")\n end",
"def report_progress(progress, total, show_parts=true)\n if total && total > 0\n percent = (progress.to_f / total.to_f) ... | [
"0.70662045",
"0.67347425",
"0.65104693",
"0.65014946",
"0.649798",
"0.6473906",
"0.64719486",
"0.64719486",
"0.64719486",
"0.64719486",
"0.64719486",
"0.64526665",
"0.63403195",
"0.6332515",
"0.63084716",
"0.62251866",
"0.6208365",
"0.6182417",
"0.6152968",
"0.61512196",
"0.... | 0.0 | -1 |
Directory where generated class HTML files live relative to the output dir. | def class_dir
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_dir(options = {})\n options[:dir] = \"generate\"\n build_webby_path(options)\n end",
"def gen_dir\n File.join(root_path, 'generated')\n end",
"def output_dir\n @output_dir\n end",
"def generated_files_dir\n dir(@generated_files_dir || default_generated_files_dir)\n e... | [
"0.75384563",
"0.72518635",
"0.7182905",
"0.70239425",
"0.6891929",
"0.67834544",
"0.6640887",
"0.65968037",
"0.6543156",
"0.6543156",
"0.65230757",
"0.64975524",
"0.64881796",
"0.64335227",
"0.6425703",
"0.64007264",
"0.63893443",
"0.6384721",
"0.6303961",
"0.62979573",
"0.6... | 0.5832619 | 62 |
Directory where generated class HTML files live relative to the output dir. | def file_dir
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_dir(options = {})\n options[:dir] = \"generate\"\n build_webby_path(options)\n end",
"def gen_dir\n File.join(root_path, 'generated')\n end",
"def output_dir\n @output_dir\n end",
"def generated_files_dir\n dir(@generated_files_dir || default_generated_files_dir)\n e... | [
"0.75384563",
"0.72518635",
"0.7182905",
"0.70239425",
"0.6891929",
"0.67834544",
"0.6640887",
"0.65968037",
"0.6543156",
"0.6543156",
"0.65230757",
"0.64975524",
"0.64881796",
"0.64335227",
"0.6425703",
"0.64007264",
"0.63893443",
"0.6384721",
"0.6303961",
"0.62979573",
"0.6... | 0.0 | -1 |
Create the directories the generated docs will live in if they don't already exist. | def gen_sub_directories
@outputdir.mkpath
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_sub_directories\n FileUtils.mkdir_p RDoc::Generator::FILE_DIR\n FileUtils.mkdir_p RDoc::Generator::CLASS_DIR\n rescue\n $stderr.puts $!.message\n exit 1\n end",
"def gen_sub_directories\n FileUtils.mkdir_p RDoc::Generator::FILE_DIR\n FileUtils.mkdir_p RDoc::Generator::CLASS_DIR\n res... | [
"0.7999038",
"0.7999038",
"0.7886141",
"0.7166485",
"0.7166485",
"0.7116431",
"0.69477177",
"0.6947387",
"0.6905084",
"0.68470365",
"0.68104947",
"0.6786918",
"0.6756026",
"0.67160755",
"0.6694724",
"0.665672",
"0.66385204",
"0.65979946",
"0.65978914",
"0.65760213",
"0.657602... | 0.7291242 | 3 |
Copy over the stylesheet into the appropriate place in the output directory. | def write_style_sheet
debug_msg "Copying static files"
options = { :verbose => $DEBUG_RDOC, :noop => @dry_run }
BUILTIN_STYLE_ITEMS.each do |item|
install_rdoc_static_file @template_dir + item, "./#{item}", options
end
unless @options.template_stylesheets.empty?
FileUtils.cp @options.t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_style_sheet\n\t\tdebug_msg \"Copying over static files\"\n\t\tstaticfiles = %w[rdoc.css js images]\n\t\tstaticfiles.each do |path|\n\t\t\tFileUtils.cp_r( @template_dir + path, '.', :verbose => $DEBUG, :noop => $dryrun )\n\t\tend\n\tend",
"def write_style_sheet\n\t\tdebug_msg \"Copying over static files... | [
"0.7731996",
"0.7731996",
"0.75681627",
"0.702492",
"0.67535686",
"0.6630583",
"0.66223776",
"0.65458435",
"0.6481138",
"0.6423381",
"0.6313298",
"0.6284529",
"0.6249645",
"0.62262493",
"0.62196606",
"0.6147224",
"0.6084363",
"0.6046036",
"0.60175484",
"0.59506744",
"0.591225... | 0.7569885 | 2 |
Build the initial indices and output objects based on an array of TopLevel objects containing the extracted information. | def generate
setup
write_style_sheet
generate_index
generate_class_files
generate_file_files
generate_table_of_contents
@json_index.generate
@json_index.generate_gzipped
copy_static
rescue => e
debug_msg "%s: %s\n %s" % [
e.class.name, e.message, e.backtrace.join("\n ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_indices\n @files, @classes = RDoc::Generator::Context.build_indices(@toplevels,\n @options)\n end",
"def build_indices\n @files, @classes = RDoc::Generator::Context.build_indices(@toplevels,\n ... | [
"0.66799206",
"0.66799206",
"0.63648176",
"0.6179205",
"0.6179205",
"0.6070032",
"0.5779898",
"0.5721857",
"0.56148344",
"0.56127924",
"0.56060195",
"0.56060195",
"0.5530475",
"0.5497697",
"0.5481927",
"0.54108244",
"0.53041786",
"0.5301011",
"0.52966577",
"0.5291416",
"0.527... | 0.0 | -1 |
Copies static files from the static_path into the output directory | def copy_static
return if @options.static_path.empty?
fu_options = { :verbose => $DEBUG_RDOC, :noop => @dry_run }
@options.static_path.each do |path|
unless File.directory? path then
FileUtils.install path, @outputdir, **fu_options.merge(:mode => 0644)
next
end
Dir.chdir... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_static\n FileUtils.cp_r 'static/.', 'output/', :preserve => true\nend",
"def copy_static\n FileUtils.cp_r 'static/.', 'output/' \nend",
"def copy_static\n puts \" - \\033[32mCopying\\033[0m static content\"\n static_folder = File.join(@proj_dir, @static_folder)\n FileUtils.cp_r(File.j... | [
"0.8345914",
"0.82550037",
"0.8190057",
"0.7984154",
"0.7897653",
"0.7875894",
"0.7863586",
"0.7674271",
"0.6803409",
"0.67603916",
"0.6665809",
"0.6642803",
"0.6533409",
"0.6533409",
"0.65109146",
"0.6463218",
"0.64109874",
"0.6398249",
"0.63750947",
"0.6373066",
"0.6357422"... | 0.83306515 | 1 |
Return a list of the documented modules sorted by salience first, then by name. | def get_sorted_module_list classes
classes.select do |klass|
klass.display?
end.sort
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sorted_module_list( classes )\n\t\tnscounts = classes.keys.inject({}) do |counthash, name|\n\t\t\ttoplevel = name.gsub( /::.*/, '' )\n\t\t\tcounthash[toplevel] ||= 0\n\t\t\tcounthash[toplevel] += 1\n\t\t\t\n\t\t\tcounthash\n\t\tend\n\n\t\t# Sort based on how often the toplevel namespace occurs, and then on... | [
"0.6701074",
"0.6701074",
"0.6287708",
"0.6178598",
"0.61348253",
"0.59842074",
"0.5940994",
"0.57952744",
"0.5782745",
"0.57668006",
"0.57328075",
"0.5728238",
"0.5714938",
"0.5664809",
"0.5614799",
"0.5613398",
"0.5603457",
"0.5587504",
"0.55381966",
"0.55083215",
"0.550541... | 0.63827264 | 2 |
Generate an index page which lists all the classes which are documented. | def generate_index
setup
template_file = @template_dir + 'index.rhtml'
return unless template_file.exist?
debug_msg "Rendering the index page..."
out_file = @base_dir + @options.op_dir + 'index.html'
rel_prefix = @outputdir.relative_path_from out_file.dirname
search_index_rel_prefix = rel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_all_classes_index(site)\n puts \"55555555555555555555555555555555555555555555555555555555\"\n allClasses = AllClassesIndex.new(site, site.source, \"/pages/classes\")\n allClasses.render(site.layouts, site.site_payload)\n allClasses.write(site... | [
"0.7475932",
"0.74531555",
"0.7317577",
"0.6886754",
"0.68806577",
"0.68678445",
"0.67596465",
"0.67596465",
"0.6747786",
"0.6736551",
"0.6643503",
"0.66340905",
"0.6585342",
"0.656006",
"0.655119",
"0.65410906",
"0.6523199",
"0.6521639",
"0.65111625",
"0.65095127",
"0.643044... | 0.0 | -1 |
Generates a class file for +klass+ | def generate_class klass, template_file = nil
setup
current = klass
template_file ||= @template_dir + 'class.rhtml'
debug_msg " working on %s (%s)" % [klass.full_name, klass.path]
out_file = @outputdir + klass.path
rel_prefix = @outputdir.relative_path_from out_file.dirname
search_inde... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_class_files\n debug_msg \"Generating class documentation in #@outputdir\"\n templatefile = Pathname.new(File.dirname(__FILE__) + '/template/railsfish/classpage.rhtml')\n \n @classes.each do |klass|\n debug_msg \" working on %s (%s)\" % [ klass.full_name, klass.path ]\n outfile ... | [
"0.7496508",
"0.715316",
"0.70117426",
"0.6945589",
"0.68454885",
"0.68199587",
"0.67997277",
"0.67355156",
"0.6726442",
"0.6711893",
"0.6701087",
"0.66850126",
"0.66663504",
"0.6603045",
"0.65700006",
"0.65452105",
"0.65200424",
"0.6412067",
"0.6374562",
"0.63036627",
"0.628... | 0.70381945 | 2 |
Generate a documentation file for each class and module | def generate_class_files
setup
template_file = @template_dir + 'class.rhtml'
template_file = @template_dir + 'classpage.rhtml' unless
template_file.exist?
return unless template_file.exist?
debug_msg "Generating class documentation in #{@outputdir}"
current = nil
@classes.each do |k... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_class_and_module_files\n template_file = @template_dir + 'class-page.html.erb'\n debug_msg \"Generating class documentation\"\n @unique_classes_and_modules.each do |klass|\n debug_msg \" %s %s\" % [klass.type, klass.full_name]\n outfile = @output_dir + klass.path\n @class = kl... | [
"0.8071282",
"0.73264396",
"0.7154484",
"0.71544385",
"0.6948765",
"0.6678017",
"0.662652",
"0.6598976",
"0.65743786",
"0.65196615",
"0.65140545",
"0.65120316",
"0.64708215",
"0.6392067",
"0.6363449",
"0.6353151",
"0.63095206",
"0.62917966",
"0.6254472",
"0.6234314",
"0.62297... | 0.71997225 | 2 |
Generate a documentation file for each file | def generate_file_files
setup
page_file = @template_dir + 'page.rhtml'
fileinfo_file = @template_dir + 'fileinfo.rhtml'
# for legacy templates
filepage_file = @template_dir + 'filepage.rhtml' unless
page_file.exist? or fileinfo_file.exist?
return unless
page_file.exist? or fil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_file_files\n template_file = @template_dir + 'file-page.html.erb'\n debug_msg \"Generating file documentation\"\n @all_files.each do |file|\n debug_msg \" file #{file.path}\"\n outfile = @output_dir + file.path\n @file = file\n self.render_template(template_file, binding(... | [
"0.80722106",
"0.7346902",
"0.7300775",
"0.72543275",
"0.724553",
"0.722633",
"0.7048856",
"0.7029981",
"0.6953614",
"0.69007874",
"0.6853008",
"0.68434554",
"0.6835757",
"0.67932016",
"0.67452896",
"0.6740713",
"0.6607613",
"0.6593709",
"0.65822583",
"0.65370286",
"0.6530981... | 0.7538879 | 1 |
Generate a page file for +file+ | def generate_page file
setup
template_file = @template_dir + 'page.rhtml'
out_file = @outputdir + file.path
debug_msg " working on %s (%s)" % [file.full_name, out_file]
rel_prefix = @outputdir.relative_path_from out_file.dirname
search_index_rel_prefix = rel_prefix
search_index_rel_prefix... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_file page_name\n file_name = File.basename(page_name).gsub('.', '_')\n\n File.join @path, File.dirname(page_name), \"page-#{file_name}.ri\"\n end",
"def generate_pages\n Dir.foreach(@site_path) do |file|\n if file =~ /(\\w+)\\.page/\n path = File.join(@site_path, file)\n\n F... | [
"0.72245044",
"0.69345874",
"0.69216156",
"0.68995845",
"0.6658683",
"0.65714145",
"0.65520686",
"0.65368104",
"0.652531",
"0.65095556",
"0.6477941",
"0.6450803",
"0.639195",
"0.63765967",
"0.6360504",
"0.63586855",
"0.63405406",
"0.6326529",
"0.63144",
"0.6282981",
"0.625989... | 0.7860889 | 0 |
Generates the 404 page for the RDoc servlet | def generate_servlet_not_found message
setup
template_file = @template_dir + 'servlet_not_found.rhtml'
return unless template_file.exist?
debug_msg "Rendering the servlet 404 Not Found page..."
rel_prefix = rel_prefix = ''
search_index_rel_prefix = rel_prefix
search_index_rel_prefix += @a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_found generator, req, res, message = nil\n message ||= \"The page <kbd>#{ERB::Util.h req.path}</kbd> was not found\"\n res.body = generator.generate_servlet_not_found message\n res.status = 404\n end",
"def page404(pathname);end",
"def render_404\n render 'web/404', status: 404\n end"... | [
"0.7946405",
"0.7306241",
"0.72623485",
"0.7249272",
"0.7211956",
"0.7211492",
"0.7157288",
"0.7157071",
"0.7156429",
"0.7140008",
"0.7127314",
"0.7117282",
"0.71086645",
"0.7093353",
"0.7090738",
"0.706542",
"0.70497185",
"0.7047426",
"0.7046103",
"0.7036793",
"0.7036793",
... | 0.79240674 | 1 |
Generates the servlet root page for the RDoc servlet | def generate_servlet_root installed
setup
template_file = @template_dir + 'servlet_root.rhtml'
return unless template_file.exist?
debug_msg 'Rendering the servlet root page...'
rel_prefix = '.'
asset_rel_prefix = rel_prefix
search_index_rel_prefix = asset_rel_prefix
search_index_rel_p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def root req, res\n generator = RDoc::Generator::Darkfish.new nil, @options\n\n res.body = generator.generate_servlet_root installed_docs\n\n res.content_type = 'text/html'\n end",
"def generate_html\n @main_url = main_url\n @sorted_files = @files.sort\n @sorted_classes = @classes.sort\n @s... | [
"0.80515516",
"0.64864457",
"0.6431311",
"0.6268605",
"0.62095743",
"0.6171148",
"0.6118512",
"0.6073515",
"0.60542274",
"0.6002435",
"0.58812714",
"0.58760947",
"0.5857758",
"0.5805453",
"0.5794631",
"0.5765206",
"0.57205796",
"0.5659267",
"0.5652974",
"0.56503594",
"0.56439... | 0.8147352 | 0 |
Generate an index page which lists all the classes which are documented. | def generate_table_of_contents
setup
template_file = @template_dir + 'table_of_contents.rhtml'
return unless template_file.exist?
debug_msg "Rendering the Table of Contents..."
out_file = @outputdir + 'table_of_contents.html'
rel_prefix = @outputdir.relative_path_from out_file.dirname
sea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_all_classes_index(site)\n puts \"55555555555555555555555555555555555555555555555555555555\"\n allClasses = AllClassesIndex.new(site, site.source, \"/pages/classes\")\n allClasses.render(site.layouts, site.site_payload)\n allClasses.write(site... | [
"0.74769706",
"0.74525124",
"0.7319425",
"0.68868065",
"0.68811184",
"0.686655",
"0.67618495",
"0.67618495",
"0.6749457",
"0.67381793",
"0.6643944",
"0.66341305",
"0.658503",
"0.6560717",
"0.6550782",
"0.654084",
"0.6526342",
"0.65228534",
"0.65126204",
"0.65109825",
"0.64301... | 0.0 | -1 |
Prepares for generation of output from the current directory | def setup
return if instance_variable_defined? :@outputdir
@outputdir = Pathname.new(@options.op_dir).expand_path @base_dir
return unless @store
@classes = @store.all_classes_and_modules.sort
@files = @store.all_files.sort
@methods = @classes.map { |m| m.method_list }.flatten.sort
@mods... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare\n FileUtils.rm_rf(output_dir)\n FileUtils.mkdir_p(output_dir)\n end",
"def prepare\n FileUtils.rm_rf(output_dir)\n FileUtils.mkdir_p(output_dir)\n end",
"def prepare\n FileUtils.mkdir_p(@base_dir)\n end",
"def prepare_target_dir\n begin\n FileUtils.mk... | [
"0.7659528",
"0.7657874",
"0.67768896",
"0.67061347",
"0.6624623",
"0.66172206",
"0.66172206",
"0.6536094",
"0.6478489",
"0.64153177",
"0.63194525",
"0.6243925",
"0.62412006",
"0.62408",
"0.6220267",
"0.6180343",
"0.61480385",
"0.6047535",
"0.60416955",
"0.60383946",
"0.60233... | 0.0 | -1 |
Return a string describing the amount of time in the given number of seconds in terms a human can understand easily. | def time_delta_string seconds
return 'less than a minute' if seconds < 60
return "#{seconds / 60} minute#{seconds / 60 == 1 ? '' : 's'}" if
seconds < 3000 # 50 minutes
return 'about one hour' if seconds < 5400 # 90 minutes
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pretty_time(num_seconds)\n\ttemp = num_seconds\t\n\n\thours = temp/3600\n\ttemp = temp%3600\n\n\tminutes = temp/60\n\ttemp = temp%60\n\n\tif hours > 0\n\t\treturn \"#{hours} Hours, #{minutes} Minutes, and #{temp} Seconds\"\n\telsif minutes > 0\n\t\treturn \"#{minutes} Minutes and #{temp} Seconds\"\n\telse\n\t\... | [
"0.76475644",
"0.7582894",
"0.75659853",
"0.73944527",
"0.73944527",
"0.7390767",
"0.73682654",
"0.7357926",
"0.7334925",
"0.7322216",
"0.72854865",
"0.7228563",
"0.7173471",
"0.7125909",
"0.70654446",
"0.7026924",
"0.7024034",
"0.7014279",
"0.6986824",
"0.69610167",
"0.69521... | 0.72936714 | 10 |
Try to extract Subversion information out of the first constant whose value looks like a subversion Id tag. If no matching constant is found, and empty hash is returned. | def get_svninfo klass
constants = klass.constants or return {}
constants.find { |c| c.value =~ SVNID_PATTERN } or return {}
filename, rev, date, time, committer = $~.captures
commitdate = Time.parse "#{date} #{time}"
return {
:filename => filename,
:rev => Integer(rev),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compact_hash_id\n id = @hash_id if @hash_id\n id = ref(tag: @tag) if @tag\n id = ref(branch: @branch) if @branch\n id = ref(branch: \"HEAD\") unless id\n return short_hash_id(id)\n end",
"def sub_id() @tag.sub( /.*_/, '' ) end",
"def sub_id() @tag.sub( /.*... | [
"0.53934556",
"0.53509194",
"0.53509194",
"0.5336865",
"0.5314858",
"0.5285965",
"0.5269954",
"0.5257445",
"0.52394164",
"0.5228369",
"0.521557",
"0.5171973",
"0.5168315",
"0.5139921",
"0.51141906",
"0.5105705",
"0.5101406",
"0.50967",
"0.505919",
"0.501976",
"0.5005225",
"... | 0.54977536 | 0 |
Creates a template from its components and the +body_file+. For backwards compatibility, if +body_file+ contains "<html" the body is used directly. | def assemble_template body_file
body = body_file.read
return body if body =~ /<html/
head_file = @template_dir + '_head.rhtml'
footer_file = @template_dir + '_footer.rhtml'
<<-TEMPLATE
<!DOCTYPE html>
<html>
<head>
#{head_file.read}
#{body}
#{footer_file.read}
TEMPLATE
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assemble_template body_file\n if body_file.basename.to_s =~ /\\.hh(k|c|p)/\n body = body_file.read\n return body if body\n else\n super\n end\n end",
"def mailto_body_template\n Liquid::Template.parse(File.read(File.join(@options[:templates], \"mailto_body.liquid\")))\n end",... | [
"0.68460035",
"0.6429966",
"0.63995016",
"0.6217183",
"0.6168219",
"0.61582595",
"0.61337626",
"0.60353434",
"0.60267913",
"0.5959722",
"0.5957711",
"0.5957711",
"0.5951089",
"0.5942224",
"0.5941715",
"0.59374744",
"0.5935208",
"0.5913673",
"0.5843538",
"0.58298683",
"0.57892... | 0.728538 | 0 |
Renders the ERb contained in +file_name+ relative to the template directory and returns the result based on the current context. | def render file_name
template_file = @template_dir + file_name
template = template_for template_file, false, RDoc::ERBPartial
template.filename = template_file.to_s
template.result @context
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render(template_name)\n template = ERB.new( \n File.read( full_template_path( template_name ) )\n )\n render_content( template.result( binding ), 'text/html' )\n end",
"def render(template_name)\n controller_name = self.class.name.underscore\n dir_path = File.dirname(__FILE__)\n\n fil... | [
"0.769242",
"0.7552992",
"0.74967825",
"0.74347514",
"0.74339575",
"0.738301",
"0.7307848",
"0.7286061",
"0.7249572",
"0.7224936",
"0.72149056",
"0.71969205",
"0.71777964",
"0.7162468",
"0.7152133",
"0.7152133",
"0.71468645",
"0.7135392",
"0.7123737",
"0.710131",
"0.707842",
... | 0.80636036 | 0 |
Load and render the erb template in the given +template_file+ and write it out to +out_file+. Both +template_file+ and +out_file+ should be Pathnamelike objects. An io will be yielded which must be captured by binding in the caller. | def render_template template_file, out_file = nil # :yield: io
io_output = out_file && !@dry_run && @file_output
erb_klass = io_output ? RDoc::ERBIO : ERB
template = template_for template_file, true, erb_klass
if io_output then
debug_msg "Outputting to %s" % [out_file.expand_path]
out_fil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_template(template_file, binding, outfile)\n\n debug_msg \" rendering #{outfile}\"\n\n @rel_prefix = @output_dir.relative_path_from(outfile.dirname)\n @stylesheet_url = @babel_options[:stylesheet_url] || (@rel_prefix + 'rdoc.css').to_s\n\n template_src = template_file.read\n template = ER... | [
"0.7583062",
"0.7440507",
"0.7384867",
"0.73027384",
"0.73027384",
"0.70419663",
"0.7030049",
"0.696887",
"0.6957915",
"0.6909245",
"0.6845522",
"0.6766471",
"0.6673652",
"0.66706884",
"0.6659673",
"0.6654424",
"0.6630873",
"0.6630873",
"0.66295415",
"0.66088533",
"0.6583131"... | 0.80038893 | 0 |
Creates the result for +template+ with +context+. If an error is raised a Pathname +template_file+ will indicate the file where the error occurred. | def template_result template, context, template_file
template.filename = template_file.to_s
template.result context
rescue NoMethodError => e
raise RDoc::Error, "Error while evaluating %s: %s" % [
template_file.expand_path,
e.message,
], e.backtrace
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_template_to_file(template, file, context)\n t = File.read(File.join(template))\n File.open(file, \"w\") do |f|\n f << ERB.new(t, nil, \"-\").result(context)\n end\n end",
"def render_template( templatefile, context, outfile )\n\t\ttemplate_src = templatefile.read\n\t\ttemplate... | [
"0.7285114",
"0.7124714",
"0.7124714",
"0.6875657",
"0.6856139",
"0.6723946",
"0.66960675",
"0.6604187",
"0.64773124",
"0.6414553",
"0.6391676",
"0.62691265",
"0.6244235",
"0.6238664",
"0.62170625",
"0.62033075",
"0.6180289",
"0.61789995",
"0.617794",
"0.6159238",
"0.61432844... | 0.81171376 | 0 |
Retrieves a cache template for +file+, if present, or fills the cache. | def template_for file, page = true, klass = ERB
template = @template_cache[file]
return template if template
if page then
template = assemble_template file
erbout = 'io'
else
template = file.read
template = template.encode @options.encoding
file_var = File.basename(file)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(file)\n binding.pry\n #return the values from cached first\n @cached[file] || \n @file_metadata[file] || \n read_metadata_from_yaml(file) || \n cache(file, read_metadata_from_disk(file)) \n end",
"def fetch_template_from_local_cache\n @@cache ||= {}\n \n return nil unless @@ca... | [
"0.70894474",
"0.6743222",
"0.66775525",
"0.650719",
"0.6464891",
"0.6400576",
"0.63593465",
"0.63074625",
"0.6269389",
"0.62492293",
"0.62379134",
"0.62022126",
"0.61625993",
"0.6133995",
"0.6122055",
"0.6097977",
"0.6087155",
"0.60782385",
"0.6047719",
"0.6047719",
"0.60477... | 0.6094643 | 16 |
Generates a relative URL from +from_path+ to this object's path | def as_href(from_path)
RDoc::Markup::ToHtml.gen_relative_url from_path, path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relative_path_from(from); end",
"def relative_path(from, to); end",
"def url_for(path)\n raise \"no file at path: #{path}\" unless File.exists?(File.expand_path(path, File.dirname(@source)))\n target_path(path)\n end",
"def relative_path(path_to, path_from)\n path_from ||= \"\"\n path_to... | [
"0.7860587",
"0.74141884",
"0.6824331",
"0.67894727",
"0.67611915",
"0.6757668",
"0.67281145",
"0.6544535",
"0.640064",
"0.640064",
"0.63489705",
"0.63489705",
"0.63182634",
"0.63069606",
"0.6253166",
"0.6246891",
"0.61509526",
"0.61509526",
"0.61509526",
"0.60959965",
"0.606... | 0.7572999 | 1 |
Handy wrapper for marking up this object's comment | def description
markup @comment
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comment\n cyc.comment(self.to_sym)\n end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
... | [
"0.75403756",
"0.75091666",
"0.75091666",
"0.75091666",
"0.75091666",
"0.75091666",
"0.75091666",
"0.75091666",
"0.75091666",
"0.75091666",
"0.75091666",
"0.75091666",
"0.75091666",
"0.75091666",
"0.75091666",
"0.75091666",
"0.75091666",
"0.75091666",
"0.734963",
"0.734963",
... | 0.6288594 | 67 |
Creates an RDoc::Markup::ToHtmlCrossref formatter | def formatter
return @formatter if defined? @formatter
options = @store.rdoc.options
this = RDoc::Context === self ? self : @parent
@formatter = RDoc::Markup::ToHtmlCrossref.new options, this.path, this
@formatter.code_object = self
@formatter
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rdoc(input)\n markup = RDoc::Markup::ToHtml.new\n markup.convert(input)\n end",
"def xreftext xrefstyle = nil\n reftext\n end",
"def initialize markup = nil\n super nil, markup\n\n @markup.add_regexp_handling RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF\n @markup.add_regexp_ha... | [
"0.59816134",
"0.5945176",
"0.5940132",
"0.5918391",
"0.58302075",
"0.5690527",
"0.55422556",
"0.55113584",
"0.54574174",
"0.5455481",
"0.54215276",
"0.54075974",
"0.53909075",
"0.53751117",
"0.5362888",
"0.5351364",
"0.5351364",
"0.5351364",
"0.5351364",
"0.52881145",
"0.522... | 0.7622284 | 0 |
Build a webcvs URL starting for the given +url+ with +full_path+ appended as the destination path. If +url+ contains '%s' +full_path+ will be will replace the %s using sprintf on the +url+. | def cvs_url(url, full_path)
if /%s/ =~ url then
sprintf url, full_path
else
url + full_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_url(url, path)\n if path.start_with?('http')\n path\n else\n url = url[0..1] if url.end_with?('/')\n path = path[1..-1] if path.start_with?('/')\n \"#{url}/#{path}\"\n end\n end",
"def full_url(path)\n \"#{base_url}#{path}\"\n end",
... | [
"0.69255966",
"0.6370267",
"0.629312",
"0.62351733",
"0.62108225",
"0.613279",
"0.6114586",
"0.6036479",
"0.59642684",
"0.59393555",
"0.59393555",
"0.59393555",
"0.5937662",
"0.5908489",
"0.5886166",
"0.58383244",
"0.5812762",
"0.5763684",
"0.57472783",
"0.5744438",
"0.571011... | 0.79661757 | 0 |
Turns the method's token stream into HTML. Prepends line numbers if +options.line_numbers+ is true. | def markup_code
return '' unless @token_stream
src = RDoc::TokenStream.to_html @token_stream
# dedent the source
indent = src.length
lines = src.lines.to_a
lines.shift if src =~ /\A.*#\ *File/i # remove '# File' comment
lines.each do |line|
if line =~ /^ *(?=\S)/
n = $&.lengt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_next_line\n @line_starts_with_tick = false\n @self_closing = false\n @inner_text = nil\n \n line = \"\"\n \n if @text[\"\\n\"] != nil\n line_break_index = @text.index \"\\n\"\n line = @text[0..line_break_index].strip\n @text = @text[line_break_index+1..-1]\n else\... | [
"0.56022567",
"0.55128384",
"0.5421275",
"0.54010403",
"0.53640187",
"0.5336773",
"0.53080267",
"0.53052604",
"0.52956146",
"0.52795196",
"0.52753294",
"0.52677083",
"0.5263793",
"0.524501",
"0.5239529",
"0.5201423",
"0.5201423",
"0.5201423",
"0.519142",
"0.5169961",
"0.51614... | 0.6129995 | 0 |
Set up a new ri generator | def initialize store, options #:not-new:
@options = options
@store = store
@store.path = '.'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_ri\n setup_rdoc\n install_ri # RDoc bug, ri goes first\n\n FileUtils.mkdir_p @doc_dir unless File.exist?(@doc_dir)\n end",
"def generate_me(generator)\n generator.generate self\n end",
"def generators; end",
"def generators; end",
"def generators=(_arg0); end",
"def initial... | [
"0.6305384",
"0.6012973",
"0.5998538",
"0.5998538",
"0.5974628",
"0.58902013",
"0.58792156",
"0.58473104",
"0.58376515",
"0.5826209",
"0.58093625",
"0.580564",
"0.580564",
"0.57915324",
"0.57628506",
"0.5698526",
"0.5694695",
"0.56814307",
"0.5610399",
"0.5598561",
"0.5598561... | 0.0 | -1 |
Writes the parsed data store to disk for use by ri. | def generate
@store.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save\n pathname.open('w') { |file| file.write(data) }\n end",
"def save\n if file\n # Ensure the current store has been loaded before we try to re-write it, this\n # is necessary if the program generator has crashed before creating a test\n store\n p = Pathname.new(fi... | [
"0.7074223",
"0.68324864",
"0.6737839",
"0.67017555",
"0.67017555",
"0.6657145",
"0.66349673",
"0.6377754",
"0.63776964",
"0.6356854",
"0.63485324",
"0.6331035",
"0.6316763",
"0.6312502",
"0.6304827",
"0.6295903",
"0.62835586",
"0.62732863",
"0.62608504",
"0.6251399",
"0.6251... | 0.0 | -1 |
:nodoc: Creates a new generator. +parent_generator+ is used to determine the class_dir and file_dir of links in the output index. +options+ are the same options passed to the parent generator. | def initialize parent_generator, options
@parent_generator = parent_generator
@store = parent_generator.store
@options = options
@template_dir = File.expand_path '../template/json_index', __FILE__
@base_dir = @parent_generator.base_dir
@classes = nil
@files = nil
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(options = {})\n @options = options\n @lock = Mutex.new\n @generators = @options[\"generators\"].map do |h|\n generator_name = h[\"name\"]\n \"Nagoriyuki::Generators::#{generator_name.classify}\".constantize.new(h)\n end\n end",
"def initialize store, options\n @store = ... | [
"0.56577754",
"0.54904896",
"0.54887855",
"0.5431662",
"0.54175335",
"0.53695124",
"0.5358072",
"0.53372675",
"0.5328924",
"0.5283366",
"0.5255888",
"0.5255836",
"0.52115",
"0.5204017",
"0.5189242",
"0.5152938",
"0.5111396",
"0.5084769",
"0.5080041",
"0.5055824",
"0.4971198",... | 0.7538173 | 0 |
Builds the JSON index as a Hash. | def build_index
reset @store.all_files.sort, @store.all_classes_and_modules.sort
index_classes
index_methods
index_pages
{ :index => @index }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_hash\n index_hash = {}\n index_hash['json_claz'] = self.class.name\n index_hash['id'] = id\n index_hash['provided_by'] = provided_by\n index_hash['cattype'] = cattype\n index_hash['flavor'] = flavor\n index_hash['image'] = image\n ... | [
"0.77918327",
"0.7781042",
"0.7749127",
"0.7713616",
"0.7691858",
"0.7642465",
"0.76388717",
"0.76173586",
"0.7569684",
"0.7519777",
"0.7498987",
"0.747322",
"0.74728787",
"0.71665967",
"0.7068536",
"0.69864935",
"0.6903955",
"0.6841274",
"0.682106",
"0.682106",
"0.68138605",... | 0.6974524 | 16 |
Output progress information if debugging is enabled | def debug_msg *msg
return unless $DEBUG_RDOC
$stderr.puts(*msg)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_progress\n @data[\"print_progress\"]\n end",
"def debug(message)\n @progress = Time.now.to_f\n buffer_checkpoint(\"debug: #{message}\")\n end",
"def report_progress(progress, total, show_parts=true)\n if total && total > 0\n percent = (progress.to_f / total.to_f) ... | [
"0.70689523",
"0.6734159",
"0.6511325",
"0.6503936",
"0.6499457",
"0.6475701",
"0.64756495",
"0.64756495",
"0.64756495",
"0.64756495",
"0.64756495",
"0.6454582",
"0.63429874",
"0.6334078",
"0.6310672",
"0.6224218",
"0.6208773",
"0.61844695",
"0.6156935",
"0.6153706",
"0.61460... | 0.0 | -1 |
Writes the JSON index to disk | def generate
debug_msg "Generating JSON index"
debug_msg " writing search index to %s" % SEARCH_INDEX_FILE
data = build_index
return if @options.dry_run
out_dir = @base_dir + @options.op_dir
index_file = out_dir + SEARCH_INDEX_FILE
FileUtils.mkdir_p index_file.dirname, :verbose => $DEBU... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_search_index(index)\n require 'json'\n @updated_search_index = index\n search_index_path.open('w') do |io|\n io.write(@updated_search_index.to_json)\n end\n end",
"def save_index\r\n # if validate_markdown_repo\r\n\r\n # Write full list to json file\r\n ... | [
"0.7602267",
"0.7527442",
"0.7229945",
"0.7215879",
"0.7165181",
"0.7150531",
"0.71434546",
"0.7097778",
"0.6949085",
"0.6672877",
"0.6495407",
"0.647482",
"0.647482",
"0.6415043",
"0.63907176",
"0.638483",
"0.63756615",
"0.6368298",
"0.6362195",
"0.63288605",
"0.63149047",
... | 0.6913761 | 9 |
Compress the search_index.js file using gzip | def generate_gzipped
return if @options.dry_run or not defined?(Zlib)
debug_msg "Compressing generated JSON index"
out_dir = @base_dir + @options.op_dir
search_index_file = out_dir + SEARCH_INDEX_FILE
outfile = out_dir + "#{search_index_file}.gz"
debug_msg "Reading the JSON index fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compression; end",
"def generate\n debug_msg \"Generating JSON index\"\n\n debug_msg \" writing search index to %s\" % SEARCH_INDEX_FILE\n data = build_index\n\n return if @options.dry_run\n\n out_dir = @base_dir + @options.op_dir\n index_file = out_dir + SEARCH_INDEX_FILE\n\n FileUtils... | [
"0.6744364",
"0.63685316",
"0.6361833",
"0.63151044",
"0.6293752",
"0.6247611",
"0.61283857",
"0.6098697",
"0.6055405",
"0.60103166",
"0.60103166",
"0.60073453",
"0.59956247",
"0.59757894",
"0.5949352",
"0.59007657",
"0.58820075",
"0.5845251",
"0.5815072",
"0.5806096",
"0.580... | 0.7961578 | 0 |
Adds classes and modules to the index | def index_classes
debug_msg " generating class search index"
documented = @classes.uniq.select do |klass|
klass.document_self_or_methods
end
documented.each do |klass|
debug_msg " #{klass.full_name}"
record = klass.search_record
@index[:searchIndex] << search_string(rec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_class_search_index(index)\n debug_msg \" generating search index\"\n \n $all.each do |klass|\n index[:searchIndex].push( search_string(klass['fullname']) )\n index[:longSearchIndex].push( search_string(klass['fullname']) )\n index[:info].push([ klass['name'], # klass.name, \n ... | [
"0.72441214",
"0.6791479",
"0.65086865",
"0.6451544",
"0.6071275",
"0.6060212",
"0.60546124",
"0.60374457",
"0.6029032",
"0.6029032",
"0.6029032",
"0.5976477",
"0.58172935",
"0.58120155",
"0.5808939",
"0.58025974",
"0.5791814",
"0.5791814",
"0.5783312",
"0.5770848",
"0.575098... | 0.5756413 | 20 |
Adds methods to the index | def index_methods
debug_msg " generating method search index"
list = @classes.uniq.map do |klass|
klass.method_list
end.flatten.sort_by do |method|
[method.name, method.parent.full_name]
end
list.each do |method|
debug_msg " #{method.full_name}"
record = method.search_r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_method_search_index(index)\n debug_msg \" generating method search index\"\n\n $all.each do |klass|\n klass['methods'].each do |method|\n params = method['parameters'].map{|p| p['name']}\n index[:searchIndex].push( search_string(method['name']) + ' ()' )\n index[:longSearchIndex].push(... | [
"0.7673323",
"0.69149303",
"0.6805543",
"0.67477846",
"0.67477846",
"0.67477846",
"0.67477846",
"0.6526643",
"0.64184195",
"0.62991595",
"0.62757266",
"0.6222118",
"0.6206049",
"0.61904174",
"0.6135047",
"0.6131002",
"0.610739",
"0.61029077",
"0.6102184",
"0.60989445",
"0.608... | 0.6950546 | 1 |
Adds pages to the index | def index_pages
debug_msg " generating pages search index"
pages = @files.select do |file|
file.text?
end
pages.each do |page|
debug_msg " #{page.page_name}"
record = page.search_record
@index[:searchIndex] << search_string(record.shift)
@index[:longSearchIndex] <... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_pages\n exhibit.feature_pages.published.find_each do |p|\n sitemap.add sitemap.exhibit_feature_page_path(exhibit, p), priority: 0.8, lastmod: p.updated_at\n end\n\n exhibit.about_pages.published.find_each do |p|\n sitemap.add sitemap.exhibit_about_page_path(exhibit, p), priorit... | [
"0.7049128",
"0.6996429",
"0.6964825",
"0.6903354",
"0.68760306",
"0.68100774",
"0.6796907",
"0.6660288",
"0.6656151",
"0.66474605",
"0.6603515",
"0.65706515",
"0.654671",
"0.65410703",
"0.65410703",
"0.65410703",
"0.65410703",
"0.65410703",
"0.65410703",
"0.65410703",
"0.654... | 0.7490982 | 0 |
The directory classes are written to | def class_dir
@parent_generator.class_dir
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_all_classes(site)\n puts \"222222222222222222222222222222222222222222222222222222222222\"\n if Dir.exists?('src/_classes')\n puts \"3333333333\"\n Dir.chdir('src/_classes')\n\n Dir[\"*.yml\"].each do |path|\n ... | [
"0.7117882",
"0.6907287",
"0.6896535",
"0.6341648",
"0.62659585",
"0.6242384",
"0.6242384",
"0.62331796",
"0.6220969",
"0.6209455",
"0.6209455",
"0.62081116",
"0.6196377",
"0.61621106",
"0.616151",
"0.611006",
"0.60985035",
"0.6096133",
"0.6067543",
"0.6037137",
"0.6034289",
... | 0.61774963 | 13 |
The directory files are written to | def file_dir
@parent_generator.file_dir
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write\n make_parent_directory\n generate_file\n end",
"def write\n @selected_files.each do |file|\n file.write(file.path)\n end\n end",
"def new_dirs; end",
"def write!\n Dir.chdir(dirname) do\n Channels.new(config, client).write!\n Groups.new(config,... | [
"0.7171844",
"0.6904038",
"0.6747364",
"0.6627069",
"0.66029304",
"0.6599025",
"0.6544013",
"0.6544013",
"0.64917713",
"0.6488526",
"0.63990885",
"0.63895977",
"0.6370548",
"0.6346069",
"0.6346069",
"0.6292088",
"0.62906945",
"0.6270712",
"0.6270712",
"0.62698793",
"0.6256117... | 0.0 | -1 |
Removes whitespace and downcases +string+ | def search_string string
string.downcase.gsub(/\s/, '')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup(string)\n switch = 0\n clean_string = []\n string\n .downcase\n .chars\n .map do |char|\n case ('a'..'z').cover?(char)\n when true\n clean_string << char\n switch = 0\n when false\n next if switch == 1\n clean_string << ' '\n switch = 1\n ... | [
"0.75798833",
"0.75212044",
"0.75212044",
"0.74020135",
"0.7355315",
"0.7254369",
"0.71469754",
"0.7120825",
"0.7117494",
"0.70765865",
"0.70443135",
"0.7024265",
"0.69897896",
"0.6977489",
"0.6957087",
"0.6949214",
"0.69489914",
"0.6915856",
"0.685505",
"0.6852049",
"0.68256... | 0.7108197 | 9 |
Creates a new Attr with body +text+, +name+, read/write status +rw+ and +comment+. +singleton+ marks this as a class attribute. | def initialize(text, name, rw, comment, singleton = false)
super text, name
@rw = rw
@singleton = singleton
self.comment = comment
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_attr container, single, name, rw, comment # :nodoc:\n att = RDoc::Attr.new get_tkread, name, rw, comment, single == SINGLE\n record_location att\n\n container.add_attribute att\n @stats.add_attribute att\n\n att\n end",
"def createAttribute(name)\n ret = Attr.new(name)\n ... | [
"0.6620209",
"0.6150298",
"0.6114593",
"0.5846439",
"0.55873156",
"0.54822624",
"0.54750407",
"0.5455883",
"0.5425852",
"0.5376712",
"0.5370511",
"0.5366144",
"0.5318689",
"0.5316033",
"0.5300398",
"0.5273853",
"0.5271006",
"0.5259757",
"0.524729",
"0.523474",
"0.5209087",
... | 0.6196944 | 1 |
Attributes are equal when their names, singleton and rw are identical | def == other
self.class == other.class and
self.name == other.name and
self.rw == other.rw and
self.singleton == other.singleton
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def same_attributes?(spec)\n @@attributes.all? {|name, default| self.send(name) == spec.send(name) }\n end",
"def attribute_names\n (self._read_only_attributes + self._read_write_attributes).uniq\n end",
"def ==(other) # :nodoc:\n @attrs == other.attrs\n end",
"def attr_equal?(o)\n sel... | [
"0.6505504",
"0.6180547",
"0.6111209",
"0.6103773",
"0.6070525",
"0.5879695",
"0.5828656",
"0.5804785",
"0.5784949",
"0.5742906",
"0.5720915",
"0.5654373",
"0.56362337",
"0.56362337",
"0.5580928",
"0.5570948",
"0.5560786",
"0.55363035",
"0.55212384",
"0.55008006",
"0.5498894"... | 0.65009063 | 1 |
Add +an_alias+ as an attribute in +context+. | def add_alias(an_alias, context)
new_attr = self.class.new(self.text, an_alias.new_name, self.rw,
self.comment, self.singleton)
new_attr.record_location an_alias.file
new_attr.visibility = self.visibility
new_attr.is_alias_for = self
@aliases << new_attr
context.ad... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_alias(an_alias, context)\n raise NotImplementedError\n end",
"def add_alias an_alias, context = nil\n method = self.class.new an_alias.text, an_alias.new_name\n\n method.record_location an_alias.file\n method.singleton = self.singleton\n method.params = self.params\n method.visibility ... | [
"0.76845",
"0.68917936",
"0.6416173",
"0.6347519",
"0.63076603",
"0.62582356",
"0.6124197",
"0.5998805",
"0.5969898",
"0.5903135",
"0.5872255",
"0.5839736",
"0.5839736",
"0.5839175",
"0.5814819",
"0.578788",
"0.5773038",
"0.5772387",
"0.57674885",
"0.57667786",
"0.57559854",
... | 0.8416587 | 0 |
The aref prefix for attributes | def aref_prefix
'attribute'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aref\n \"#{aref_prefix}-#{full_name}\"\n end",
"def aref_prefix\n raise NotImplementedError\n end",
"def aref_prefix\n 'method'\n end",
"def aref\n type = singleton ? 'c' : 'i'\n # % characters are not allowed in html names => dash instead\n \"#{aref_prefix}-#{type}-#{html_name}\"\n ... | [
"0.7418352",
"0.72481656",
"0.6944319",
"0.68532914",
"0.64815146",
"0.6467047",
"0.6467047",
"0.6467047",
"0.64589214",
"0.64557564",
"0.64557564",
"0.63378674",
"0.63243157",
"0.62749887",
"0.62132066",
"0.6199639",
"0.61911887",
"0.6190109",
"0.6180603",
"0.6127076",
"0.61... | 0.8852854 | 0 |
Attributes never call super. See RDoc::AnyMethodcalls_super An RDoc::Attr can show up in the method list in some situations (see Gem::ConfigFile) | def calls_super # :nodoc:
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(method, *args, &block)\n unless self.class.attribute_methods_generated?\n self.class.define_attribute_methods\n\n if respond_to_without_attributes?(method)\n send(method, *args, &block)\n else\n super\n end\n else\n super\n end\... | [
"0.6662063",
"0.6662063",
"0.6654441",
"0.6519956",
"0.6514772",
"0.6271878",
"0.6243758",
"0.62434167",
"0.62236106",
"0.6191364",
"0.6175218",
"0.6145913",
"0.6130458",
"0.61030537",
"0.6098185",
"0.6098185",
"0.60939974",
"0.6081728",
"0.6076123",
"0.60696983",
"0.6051356"... | 0.6591828 | 3 |
Returns attr_reader, attr_writer or attr_accessor as appropriate. | def definition
case @rw
when 'RW' then 'attr_accessor'
when 'R' then 'attr_reader'
when 'W' then 'attr_writer'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_accessor_sybling(method)\n attr_reader?(method) ? to_attr_writer(method) : to_attr_reader(method)\n end",
"def internal_attr_accessor(*syms)\n internal_attr_reader(*syms)\n internal_attr_writer(*syms)\n end",
"def attr_accessor(*args)\n attr_reader(*args)\n attr_writer(*args)\... | [
"0.7563549",
"0.7000917",
"0.69071054",
"0.69064724",
"0.69064724",
"0.69064724",
"0.67940605",
"0.6699602",
"0.6625365",
"0.6614433",
"0.65903205",
"0.6528052",
"0.65199095",
"0.6458117",
"0.6415013",
"0.6410009",
"0.637983",
"0.63675666",
"0.636326",
"0.63280505",
"0.632541... | 0.6956138 | 2 |
Dumps this Attr for use by ri. See also marshal_load | def marshal_dump
[ MARSHAL_VERSION,
@name,
full_name,
@rw,
@visibility,
parse(@comment),
singleton,
@file.relative_name,
@parent.full_name,
@parent.class,
@section.title
]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dump_data\n create_attr_hash\n end",
"def dump\n\t\t\t\tflatten!\n\t\t\t\t\n\t\t\t\tMessagePack.dump(@attributes)\n\t\t\tend",
"def marshal_dump\n dump\n end",
"def marshal_dump\n { \n :klass => self.class.to_s, \n :values => @attribute_values_flat, \n :joined => @joined_mod... | [
"0.75234836",
"0.70696455",
"0.6947242",
"0.6923758",
"0.674765",
"0.67328703",
"0.6718474",
"0.6608168",
"0.6583545",
"0.6557255",
"0.6523878",
"0.6519937",
"0.65066123",
"0.64812285",
"0.6471703",
"0.6471703",
"0.6471703",
"0.6471703",
"0.6471703",
"0.6457035",
"0.6438312",... | 0.0 | -1 |
Loads this Attr from +array+. For a loaded Attr the following methods will return cached values: full_name parent_name | def marshal_load array
initialize_visibility
@aliases = []
@parent = nil
@parent_name = nil
@parent_class = nil
@section = nil
@file = nil
version = array[0]
@name = array[1]
@full_name = array[2]
@rw = array[3]
@v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def marshal_load array\n initialize array[1], nil, array[5]\n\n @full_name = array[2]\n @visibility = array[3] || :public\n @is_alias_for = array[4]\n # 5 handled above\n # 6 handled below\n @parent_name = array[7]\n @parent_class = array... | [
"0.53664386",
"0.5220491",
"0.5199925",
"0.51731795",
"0.51498467",
"0.5146182",
"0.5124003",
"0.5088117",
"0.50725174",
"0.49839512",
"0.4948888",
"0.49424776",
"0.4936403",
"0.487346",
"0.4837641",
"0.4822505",
"0.4812405",
"0.48107922",
"0.48025188",
"0.47982514",
"0.47767... | 0.51336193 | 6 |
Attributes do not have token streams. An RDoc::Attr can show up in the method list in some situations (see Gem::ConfigFile) | def token_stream # :nodoc:
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr(name); end",
"def initialize\n @am = RDoc::Markup::AttributeManager.new\n @output = nil\n end",
"def parse_attr(context, single, tk, comment)\n line_no = tk[:line_no]\n\n args = parse_symbol_arg 1\n if args.size > 0 then\n name = args[0]\n rw = \"R\"\n skip_tkspace_witho... | [
"0.6610817",
"0.65586907",
"0.6512892",
"0.64346933",
"0.6380175",
"0.6364594",
"0.6341485",
"0.63186663",
"0.63053083",
"0.6226694",
"0.6225094",
"0.62146866",
"0.6200694",
"0.6199624",
"0.612456",
"0.61057395",
"0.6052833",
"0.60363483",
"0.60320145",
"0.6016099",
"0.599535... | 0.0 | -1 |
Expands tab characters in +text+ to eight spaces | def expand_tabs text
expanded = []
text.each_line do |line|
nil while line.gsub!(/(?:\G|\r)((?:.{8})*?)([^\t\r\n]{0,7})\t/) do
r = "#{$1}#{$2}#{' ' * (8 - $2.size)}"
r = RDoc::Encoding.change_encoding r, text.encoding
r
end
expanded << line
end
expanded.join
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tabbed_text(text, spaces = 0)\n Array(text).join(\"\\n\").gsub(\"\\n\", \"\\n#{' ' * (4 + spaces.to_i)}\").strip\n end",
"def reduce_tab(_production, _range, _tokens, _children)\n Regex::Character.new('\\t')\n end",
"def expand_tabs(n=8)\n n = n.to_int\n raise ArgumentError, \"n must ... | [
"0.79304135",
"0.72114384",
"0.7172528",
"0.7172528",
"0.7061482",
"0.6941992",
"0.69208884",
"0.6783988",
"0.6605011",
"0.65429723",
"0.6522183",
"0.648851",
"0.6463755",
"0.64489",
"0.6405192",
"0.63245296",
"0.6231422",
"0.6220007",
"0.6199898",
"0.6196902",
"0.6180145",
... | 0.7382639 | 1 |
Flush +text+ left based on the shortest line | def flush_left text
indent = 9999
text.each_line do |line|
line_indent = line =~ /\S/ || 9999
indent = line_indent if indent > line_indent
end
empty = ''
empty = RDoc::Encoding.change_encoding empty, text.encoding
text.gsub(/^ {0,#{indent}}/, empty)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flush_left text\n indents = []\n\n text.each_line do |line|\n indents << (line =~ /[^\\s]/ || 9999)\n end\n\n indent = indents.min\n\n flush = []\n\n text.each_line do |line|\n line[/^ {0,#{indent}}/] = ''\n flush << line\n end\n\n flush.join\n end",
"def line_to_wrap;... | [
"0.73763806",
"0.6287043",
"0.624124",
"0.6140198",
"0.60732853",
"0.60558563",
"0.60460085",
"0.60333025",
"0.59959054",
"0.5994993",
"0.5985251",
"0.58587575",
"0.58531463",
"0.5841385",
"0.5836595",
"0.5822714",
"0.57898045",
"0.57837117",
"0.5749407",
"0.5749407",
"0.5721... | 0.72903645 | 1 |
Convert a string in markup format into HTML. Requires the including class to implement formatter | def markup text
if @store.rdoc.options
locale = @store.rdoc.options.locale
else
locale = nil
end
if locale
i18n_text = RDoc::I18n::Text.new(text)
text = i18n_text.translate(locale)
end
parse(text).accept formatter
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def markup text\n document = parse text\n\n document.accept formatter\n end",
"def html_markup_html(text); end",
"def inline_formatting(str)\n str.rstrip!\n str = @re_help.rewrite_emphasis(str) do |marker, s|\n \"#{Tags[marker][:open]}#{s}#{Tags[marker][:close]}\"\n end\n str ... | [
"0.74140966",
"0.7186367",
"0.7098346",
"0.6893603",
"0.68586487",
"0.6825735",
"0.6795807",
"0.6733815",
"0.6667163",
"0.66653514",
"0.66334605",
"0.6630756",
"0.66087687",
"0.6593368",
"0.6492139",
"0.6468511",
"0.64626473",
"0.64526546",
"0.6442435",
"0.6431776",
"0.642511... | 0.62297904 | 39 |
Strips hashes, expands tabs then flushes +text+ to the left | def normalize_comment text
return text if text.empty?
case language
when :ruby
text = strip_hashes text
when :c
text = strip_stars text
end
text = expand_tabs text
text = flush_left text
text = strip_newlines text
text
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip_hashes text\n return text if text =~ /^(?>\\s*)[^\\#]/\n text.gsub(/^\\s*(#+)/) { $1.tr '#',' ' }\n end",
"def strip_hashes text\n return text if text =~ /^(?>\\s*)[^\\#]/\n\n empty = ''\n empty = RDoc::Encoding.change_encoding empty, text.encoding\n\n text.gsub(/^\\s*(#+)/) { $1.tr ... | [
"0.61391264",
"0.60343546",
"0.59757304",
"0.58415234",
"0.58198553",
"0.5787609",
"0.57572526",
"0.56970984",
"0.5643665",
"0.55909103",
"0.5513545",
"0.55117023",
"0.5482152",
"0.5482152",
"0.5463837",
"0.5400017",
"0.53471076",
"0.5342215",
"0.53221714",
"0.5318737",
"0.52... | 0.0 | -1 |
Normalizes +text+ then builds a RDoc::Markup::Document from it | def parse text, format = 'rdoc'
return text if RDoc::Markup::Document === text
return text.parse if RDoc::Comment === text
text = normalize_comment text # TODO remove, should not be necessary
return RDoc::Markup::Document.new if text =~ /\A\n*\z/
MARKUP_FORMAT[format].parse text
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse text\n return text if RDoc::Markup::Document === text\n\n text = normalize_comment text\n\n return RDoc::Markup::Document.new if text =~ /\\A\\n*\\z/\n\n RDoc::Markup::Parser.parse text\n rescue RDoc::Markup::Parser::Error => e\n $stderr.puts <<-EOF\nWhile parsing markup, RDoc encountered... | [
"0.68845904",
"0.6386258",
"0.62987876",
"0.6134319",
"0.61231446",
"0.61218756",
"0.6118715",
"0.60964054",
"0.6090161",
"0.60873836",
"0.6080723",
"0.60695857",
"0.60406876",
"0.5799157",
"0.57568043",
"0.57369745",
"0.5733124",
"0.57282335",
"0.5664522",
"0.5657635",
"0.56... | 0.617483 | 3 |
The first +limit+ characters of +text+ as HTML | def snippet text, limit = 100
document = parse text
RDoc::Markup::ToHtmlSnippet.new(options, limit).convert document
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def truncate text\n length = text.length\n characters = @characters\n @characters += length\n\n return text if @characters < @character_limit\n\n remaining = @character_limit - characters\n\n text =~ /\\A(.{#{remaining},}?)(\\s|$)/m # TODO word-break instead of \\s?\n\n $1\n end",
"def cap_... | [
"0.7065653",
"0.68788975",
"0.68498045",
"0.6758423",
"0.6705905",
"0.6703633",
"0.6653313",
"0.6645014",
"0.66084236",
"0.65985817",
"0.65980566",
"0.6558853",
"0.65231276",
"0.64828825",
"0.6461146",
"0.64403725",
"0.64103544",
"0.6404922",
"0.63879067",
"0.6377721",
"0.636... | 0.63313454 | 22 |
Strips leading characters from +text+ | def strip_hashes text
return text if text =~ /^(?>\s*)[^\#]/
empty = ''
empty = RDoc::Encoding.change_encoding empty, text.encoding
text.gsub(/^\s*(#+)/) { $1.tr '#', ' ' }.gsub(/^\s+$/, empty)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip_leading_whitespace(text)\n return text if text.empty?\n leading_spaces = text.lines.first[/^(\\s+)/, 1]\n text.gsub(/^#{leading_spaces}/, '')\n end",
"def pre_proccess(text)\n text.to_s.strip.gsub(/[[:space:]]+/, ' ').gsub(/\\s{2,}/, ' ')\n end",
"def clean text\n ... | [
"0.7323216",
"0.6942077",
"0.6937654",
"0.68463075",
"0.6829753",
"0.6816823",
"0.67976254",
"0.6793842",
"0.6791837",
"0.6765843",
"0.6764754",
"0.67604154",
"0.67378175",
"0.6723626",
"0.6722887",
"0.67209494",
"0.67159367",
"0.6703914",
"0.6696541",
"0.66791296",
"0.665978... | 0.0 | -1 |
Strips leading and trailing \n characters from +text+ | def strip_newlines text
text.gsub(/\A\n*(.*?)\n*\z/m) do $1 end # block preserves String encoding
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unwrap_text(text)\n text.gsub(/([^\\n])\\n([^\\n])/, '\\1 \\2')\n end",
"def strip_trailing_whitespace(text)\n text.split(\"\\n\").collect(&:strip).join(\"\\n\")\n end",
"def remove_lines(text)\n text.gsub(/\\n/, '')\n end",
"def strip_newlines text\n text.gsub(/\\A\\n*(.*?)\\n... | [
"0.80636007",
"0.7783918",
"0.7758885",
"0.7679982",
"0.75762063",
"0.7414722",
"0.7307735",
"0.72694755",
"0.7261328",
"0.7210001",
"0.71573037",
"0.7101969",
"0.7048962",
"0.7003466",
"0.6943676",
"0.6940544",
"0.6868403",
"0.6808813",
"0.6808813",
"0.6688368",
"0.66839826"... | 0.75845903 | 4 |
Strips / / style comments | def strip_stars text
return text unless text =~ %r%/\*.*\*/%m
encoding = text.encoding
text = text.gsub %r%Document-method:\s+[\w:.#=!?|^&<>~+\-/*\%@`\[\]]+%, ''
space = ' '
space = RDoc::Encoding.change_encoding space, encoding if encoding
text.sub! %r%/\*+% do space * $&.length end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip_comments(doc)\n\n multiline_comments = /\\/\\*(?:.|([\\r\\n]))*?\\*\\//\n doc.gsub!(multiline_comments) do |s|\n if $1\n r = \"\"\n a = s.split(\"\\n\")\n r += \"\\n\" * (a.length-1) if a.length > 1\n r\n end\n end\n\n single_line_comments = /\\/\\/.*$/\n... | [
"0.7559385",
"0.7533328",
"0.75169104",
"0.7348411",
"0.7258873",
"0.72094655",
"0.7192533",
"0.71539664",
"0.7128163",
"0.7128163",
"0.7128163",
"0.7128163",
"0.71178603",
"0.7097263",
"0.70873815",
"0.70365006",
"0.70292175",
"0.7027143",
"0.70183665",
"0.6953365",
"0.69187... | 0.62649465 | 67 |
Converts ampersand, dashes, ellipsis, quotes, copyright and registered trademark symbols in +text+ to properly encoded characters. | def to_html text
html = (''.encode text.encoding).dup
encoded = RDoc::Text::TO_HTML_CHARACTERS[text.encoding]
s = StringScanner.new text
insquotes = false
indquotes = false
after_word = nil
until s.eos? do
case
when s.scan(/<(tt|code)>.*?<\/\1>/) then # skip contents of tt
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode(text)\n @char_to_entity ||= begin\n map = {}\n File.read(File.join(File.dirname(__FILE__), 'characters.txt')).scan(/^(\\d+)\\s*(.+)$/) do |key, value|\n map[[key.to_i].pack('U')] = value\n end\n map\n end\n\n text.gsub(/[^\\x00-\\x7F]|[\"'<>&]/) do |ch|\n ent = @... | [
"0.7435172",
"0.7391465",
"0.73149073",
"0.72188085",
"0.6942376",
"0.68668205",
"0.67711663",
"0.67170024",
"0.665809",
"0.665809",
"0.66572237",
"0.66547686",
"0.6651284",
"0.66100353",
"0.66100353",
"0.65930223",
"0.6571186",
"0.6541736",
"0.65251255",
"0.65221447",
"0.648... | 0.0 | -1 |
Wraps +txt+ to +line_len+ | def wrap(txt, line_len = 76)
res = []
sp = 0
ep = txt.length
while sp < ep
# scan back for a space
p = sp + line_len - 1
if p >= ep
p = ep
else
while p > sp and txt[p] != ?\s
p -= 1
end
if p <= sp
p = sp + line_len
wh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def word_wrap(txt, line_length) # :nodoc:\n txt.split(\"\\n\").collect do |line|\n line.length > line_length ? line.gsub(/(.{1,#{line_length}})(\\s+|$)/, \"\\\\1\\n\").strip : line\n end * \"\\n\"\n end",
"def word_wrap(txt, line_length)\n txt.split(\"\\n\").collect do |line|\n ... | [
"0.77922577",
"0.77106166",
"0.7692219",
"0.76638544",
"0.7653569",
"0.7597447",
"0.7566165",
"0.7554373",
"0.7553075",
"0.74660754",
"0.73640656",
"0.73327523",
"0.7298701",
"0.7284163",
"0.7281169",
"0.7179595",
"0.7177629",
"0.7160354",
"0.70237875",
"0.70028514",
"0.69408... | 0.7280654 | 15 |
Converts the parts of +paragraph+ to a single entry. | def accept_paragraph paragraph
parts = paragraph.parts.chunk do |part|
String === part
end.map do |string, chunk|
string ? chunk.join.rstrip : chunk
end.flatten
paragraph.parts.replace parts
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_paragraph; end",
"def accept_paragraph paragraph\n tt_sections(paragraph.text)\n end",
"def paragraph parts\n parts = parts.map do |part|\n if \"\\n\" == part then\n RDoc::Markup::HardBreak.new\n else\n part\n end\n end if break_on_newline?\n\n RDoc::Markup::... | [
"0.6608188",
"0.63100874",
"0.6218444",
"0.61957455",
"0.60976076",
"0.6086896",
"0.6086896",
"0.5999554",
"0.59469485",
"0.5899735",
"0.5793072",
"0.57734174",
"0.5753419",
"0.57370573",
"0.5692918",
"0.5680816",
"0.55759466",
"0.5520453",
"0.5513769",
"0.5508745",
"0.550123... | 0.6611384 | 0 |
Joins the raw paragraph text and converts inline HardBreaks to the +hard_break+ text. | def text hard_break = ''
@parts.map do |part|
if RDoc::Markup::HardBreak === part then
hard_break
else
part
end
end.join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hard_break( text ) \n text.gsub!( /(.)\\n(?!\\n|\\Z|>| *([#*=]+(\\s|$)|[{|]))/, \"\\\\1<br />\" ) if hard_breaks\n end",
"def accept_paragraph paragraph\n @res << \"\\n<p>\"\n text = paragraph.text @hard_break\n text = text.gsub(/\\r?\\n/, ' ')\n @res << to_html(text)\n @res <<... | [
"0.6805989",
"0.6712549",
"0.657845",
"0.6363988",
"0.63476014",
"0.6269915",
"0.61175555",
"0.61077964",
"0.6094443",
"0.6072224",
"0.60115075",
"0.59464854",
"0.5909768",
"0.59072965",
"0.5892711",
"0.58827937",
"0.5880639",
"0.58791655",
"0.5866686",
"0.5865489",
"0.585786... | 0.72140545 | 0 |
Creates a new ListItem with an optional +label+ containing +parts+ | def initialize label = nil, *parts
@label = label
@parts = []
@parts.concat parts
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(name, label, nav)\n @item = Octant::Item.new(name, label)\n @nav = nav\n end",
"def create_listing(label, opts = {})\n options = default_options.merge(PROFILES.fetch(label.to_s, {})).merge(opts)\n\n listing = BwRex::Listings.new(options)\n listing.price_advertise_as = ... | [
"0.5665118",
"0.5528479",
"0.5492029",
"0.5449859",
"0.5361181",
"0.53502977",
"0.53339064",
"0.5279675",
"0.5279675",
"0.5196307",
"0.5151745",
"0.51173127",
"0.5108214",
"0.50973475",
"0.50808847",
"0.50808847",
"0.50749135",
"0.5069139",
"0.50522196",
"0.50384104",
"0.5020... | 0.6732224 | 0 |
Appends +part+ to the ListItem | def << part
@parts << part
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_part(part)\n @parts ||= Array.new\n @parts << part\n end",
"def special_list_item_line(text)\n end",
"def append(part)\n # Don't write the part again if it already exists ya dummy\n return nil if exists? part\n\n edit_xml do |xml|\n xml.at_xpath('/xml... | [
"0.682423",
"0.621304",
"0.60566896",
"0.5842244",
"0.5841923",
"0.56646734",
"0.5585562",
"0.5580811",
"0.5496252",
"0.5471395",
"0.5434397",
"0.5432356",
"0.5418528",
"0.5381165",
"0.532067",
"0.5318898",
"0.528496",
"0.52741736",
"0.52641785",
"0.52555865",
"0.5249572",
... | 0.6695717 | 1 |
Runs this list item and all its parts through +visitor+ | def accept visitor
visitor.accept_list_item_start self
@parts.each do |part|
part.accept visitor
end
visitor.accept_list_item_end self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accept visitor\n visitor.accept_list_start self\n\n @items.each do |item|\n item.accept visitor\n end\n\n visitor.accept_list_end self\n end",
"def accept(visitor); end",
"def accept(visitor); end",
"def examine(item)\r\n \r\n end",
"def accept(visitor)\n visitor.visit(self... | [
"0.70056033",
"0.6088971",
"0.6088971",
"0.60502774",
"0.59741646",
"0.5956412",
"0.5921376",
"0.5868091",
"0.5768261",
"0.56623787",
"0.5558155",
"0.5513721",
"0.54997754",
"0.549846",
"0.5475729",
"0.5420025",
"0.5348063",
"0.5316093",
"0.5301967",
"0.53009534",
"0.5242701"... | 0.73090816 | 0 |
Is the ListItem empty? | def empty?
@parts.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty?\n items.empty?\n end",
"def is_empty()\n return @items.empty?\n end",
"def empty?\n @items.empty?\n end",
"def empty?\n @items.empty?\n end",
"def empty?\n return item.nil?\n end",
"def empty?\n @items.count == 0\n end",
"def empty?\n @i... | [
"0.8330687",
"0.83041674",
"0.82930255",
"0.82930255",
"0.82819",
"0.82517606",
"0.8211005",
"0.8211005",
"0.8154373",
"0.8150344",
"0.8103787",
"0.80692893",
"0.80372846",
"0.8034038",
"0.78980666",
"0.7786776",
"0.7683451",
"0.76663744",
"0.76647437",
"0.7568018",
"0.753577... | 0.0 | -1 |
Length of parts in the ListItem | def length
@parts.length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def length\n # calculates the length of the list\n end",
"def length(item_type = nil)\n item_type ||= :item\n # The item length of a list is the length of the items property, avoiding the need to sum list entry lengths\n item_type == :item ? self.items.length : super(item_type)\n ... | [
"0.7450283",
"0.7378969",
"0.7325375",
"0.73199457",
"0.7294943",
"0.7181255",
"0.71423894",
"0.7087669",
"0.70569134",
"0.7047404",
"0.69894594",
"0.69855917",
"0.6967632",
"0.69639915",
"0.6946251",
"0.6932813",
"0.6932813",
"0.6932813",
"0.6932813",
"0.6932813",
"0.6932813... | 0.77943987 | 0 |
Adds +parts+ to the ListItem | def push *parts
@parts.concat parts
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_part(part)\n @parts ||= Array.new\n @parts << part\n end",
"def << part\n @parts << part\n end",
"def concat parts\n self.parts.concat parts\n end",
"def push *parts\n self.parts.concat parts\n end",
"def add_to_group(group, names, component)\n if names.length ==... | [
"0.65801966",
"0.63808745",
"0.5995291",
"0.592742",
"0.57300955",
"0.56520927",
"0.54999685",
"0.5495927",
"0.546482",
"0.5350772",
"0.52657163",
"0.5227453",
"0.52014536",
"0.51930034",
"0.5180014",
"0.5171786",
"0.5171786",
"0.5171106",
"0.5162617",
"0.5159202",
"0.5156352... | 0.5838411 | 4 |
Maps attributes to HTML sequences | def init_tags
add_tag :BOLD, '**', '**'
add_tag :EM, '*', '*'
add_tag :TT, '`', '`'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_attributes(attr); end",
"def html_attributes(attr)\n return '' if attr.empty?\n\n attr.map do |k, v|\n v.nil? || (k == 'id' && v.strip.empty?) ? '' : \" #{k}=\\\"#{escape_html(v.to_s, :attribute)}\\\"\"\n end.join('')\n end",
"def attr_tag(text); end",
"def attribu... | [
"0.7886784",
"0.7188132",
"0.6940125",
"0.69291306",
"0.6705045",
"0.66999596",
"0.66792905",
"0.6557349",
"0.65492296",
"0.6545523",
"0.6545523",
"0.65012956",
"0.646729",
"0.64672166",
"0.64660746",
"0.6427043",
"0.6406302",
"0.64015806",
"0.63986504",
"0.6391099",
"0.63860... | 0.0 | -1 |
Adds a newline to the output | def handle_regexp_HARD_BREAK target
" \n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def newline\n @results += nl\n end",
"def line_feed\n write_raw \"\\n\"\n end",
"def newline\n print \"\\n\"\n end",
"def fancy_newline\n @results += '|'\n newline\n end",
"def newline\n @printer.nl\n end",
"def output()\n add_newline if @linebreak\n @text... | [
"0.80261",
"0.79887086",
"0.7867862",
"0.7815782",
"0.7792112",
"0.7722391",
"0.7632728",
"0.7632728",
"0.75683856",
"0.7421348",
"0.7406515",
"0.7338735",
"0.7338735",
"0.72672224",
"0.720534",
"0.7166062",
"0.71340096",
"0.70730376",
"0.70190185",
"0.7004011",
"0.6995972",
... | 0.0 | -1 |
Finishes consumption of `list` | def accept_list_end list
@res << "\n"
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def closed_end_list(list); end",
"def saw_end_list(list); end",
"def flush\n @lists = nil\n end",
"def run(list); end",
"def end_special_list\n end",
"def finish_item(list_id:, id:)\n path = \"lists/#{list_id}/items/#{id}/finish\"\n request(method: :put, path: path)\n end",
... | [
"0.65654844",
"0.63176346",
"0.6240237",
"0.6219942",
"0.60898685",
"0.6046743",
"0.58744085",
"0.5847891",
"0.58212554",
"0.57580143",
"0.5751189",
"0.57498044",
"0.57487535",
"0.5720365",
"0.57026947",
"0.5680804",
"0.566392",
"0.56452817",
"0.5633469",
"0.5584377",
"0.5583... | 0.5082925 | 92 |
Finishes consumption of `list_item` | def accept_list_item_end list_item
width = case @list_type.last
when :BULLET then
4
when :NOTE, :LABEL then
use_prefix
4
else
@list_index[-1] = @list_index.last.succ
4
end
@indent -= width
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def finish_item(list_id:, item_id:)\n api_request(method: :put, path: \"lists/#{list_id}/items/#{item_id}/finish\")\n end",
"def end_special_list_item\n end",
"def finish_item(list_id:, id:)\n path = \"lists/#{list_id}/items/#{id}/finish\"\n request(method: :put, path: path)\n ... | [
"0.73330796",
"0.7098673",
"0.70646864",
"0.6951159",
"0.65320796",
"0.64567053",
"0.63907206",
"0.6324318",
"0.63042045",
"0.62963927",
"0.6067254",
"0.59852606",
"0.59409934",
"0.58986527",
"0.58627564",
"0.5844995",
"0.58280826",
"0.581097",
"0.580529",
"0.5800165",
"0.579... | 0.0 | -1 |
Prepares the visitor for consuming `list_item` | def accept_list_item_start list_item
type = @list_type.last
case type
when :NOTE, :LABEL then
bullets = Array(list_item.label).map do |label|
attributes(label).strip
end.join "\n"
bullets << "\n:"
@prefix = ' ' * @indent
@indent += 4
@prefix << bullets + (' ' *... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accept visitor\n visitor.accept_list_start self\n\n @items.each do |item|\n item.accept visitor\n end\n\n visitor.accept_list_end self\n end",
"def start_special_list_item\n end",
"def saw_item(item); end",
"def accept_list_item_start(list_item)\n if tag = @in_list_entry.last\n ... | [
"0.66437536",
"0.65443444",
"0.6373572",
"0.63384247",
"0.6309071",
"0.6133939",
"0.6131041",
"0.6059909",
"0.6036667",
"0.60321826",
"0.5797698",
"0.5708991",
"0.57004976",
"0.5679925",
"0.5640657",
"0.5604594",
"0.5557535",
"0.55062425",
"0.5481824",
"0.54560494",
"0.545512... | 0.55652314 | 16 |
Prepares the visitor for consuming `list` | def accept_list_start list
case list.type
when :BULLET, :LABEL, :NOTE then
@list_index << nil
when :LALPHA, :NUMBER, :UALPHA then
@list_index << 1
else
raise RDoc::Error, "invalid list type #{list.type}"
end
@list_width << 4
@list_type << list.type
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accept visitor\n visitor.accept_list_start self\n\n @items.each do |item|\n item.accept visitor\n end\n\n visitor.accept_list_end self\n end",
"def accept visitor\n visitor.accept_list_item_start self\n\n @parts.each do |part|\n part.accept visitor\n end\n\n visitor.accept_... | [
"0.6866016",
"0.63929254",
"0.6323157",
"0.6323157",
"0.61746436",
"0.612721",
"0.6069048",
"0.6054434",
"0.6042073",
"0.60347384",
"0.5998503",
"0.59905034",
"0.58502835",
"0.57442695",
"0.56935245",
"0.5672774",
"0.5605062",
"0.5605062",
"0.5605062",
"0.5605062",
"0.5605062... | 0.53433573 | 44 |
Adds `rule` to the output | def accept_rule rule
use_prefix or @res << ' ' * @indent
@res << '-' * 3
@res << "\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_rule(rule)\n @rules << rule\n LOGGER.info \"Adding rule: #{rule.readable}\"\n end",
"def add(rule); end",
"def << rule\n rules << rule\n nil\n end",
"def add_rule(rule)\n @rulebook.add_rule rule\n end",
"def accept_rule rule\n @res << \"<hr>\\n\"\n end",
"def <<(rule);... | [
"0.7730245",
"0.7488788",
"0.7337359",
"0.7204972",
"0.71964437",
"0.7164962",
"0.7093102",
"0.70747066",
"0.703453",
"0.69999015",
"0.68902624",
"0.67972124",
"0.6789249",
"0.6762472",
"0.67396784",
"0.66529274",
"0.65767545",
"0.6561689",
"0.65215826",
"0.6517088",
"0.65131... | 0.6593488 | 16 |
Outputs `verbatim` indented 4 columns | def accept_verbatim verbatim
indent = ' ' * (@indent + 4)
verbatim.parts.each do |part|
@res << indent unless part == "\n"
@res << part
end
@res << "\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_verbatim margin\n p :verbatim_begin => margin if @debug\n verbatim = RDoc::Markup::Verbatim.new\n\n min_indent = nil\n generate_leading_spaces = true\n line = ''.dup\n\n until @tokens.empty? do\n type, data, column, = get\n\n if type == :NEWLINE then\n line << data\n ... | [
"0.6362071",
"0.63525397",
"0.630793",
"0.6232067",
"0.62308294",
"0.62101465",
"0.6114017",
"0.6110608",
"0.60521775",
"0.60521775",
"0.605135",
"0.603827",
"0.5992644",
"0.5991831",
"0.5978202",
"0.59693223",
"0.5959875",
"0.5959875",
"0.5959875",
"0.5959875",
"0.5959875",
... | 0.62865657 | 3 |
Creates a Markdownstyle URL from +url+ with +text+. | def gen_url url, text
scheme, url, = parse_url url
"[#{text.sub(%r{^#{scheme}:/*}i, '')}](#{url})"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_link(url, text)\n return (\"[#{text}|#{url}]\")\n end",
"def gen_url(url, text)\n if url =~ /([A-Za-z]+):(.*)/ then\n type = $1\n path = $2\n else\n type = \"http\"\n path = url\n url = \"http://#{url}\"\n end\n\n if type == \"link\" then\n url = if pat... | [
"0.7560218",
"0.74143344",
"0.73976445",
"0.72464126",
"0.6947297",
"0.6896972",
"0.6896846",
"0.6796557",
"0.67733824",
"0.6685917",
"0.6545022",
"0.6478381",
"0.6477263",
"0.6468262",
"0.63988054",
"0.63715726",
"0.6357154",
"0.6343143",
"0.63360804",
"0.6319911",
"0.624456... | 0.72109556 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.